@aibee/crc-bmap 0.0.130 → 0.0.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bmap.cjs.min.js +11 -11
- package/lib/bmap.cjs.min.js.map +3 -3
- package/lib/bmap.esm.js +127 -30
- package/lib/bmap.esm.js.map +3 -3
- package/lib/bmap.esm.min.js +10 -10
- package/lib/bmap.esm.min.js.map +3 -3
- package/lib/bmap.min.js +11 -11
- package/lib/bmap.min.js.map +3 -3
- package/lib/src/loader/AibeeLoader/type.d.ts +2 -0
- package/lib/src/utils/coordinate.d.ts +1 -0
- package/package.json +1 -1
package/lib/bmap.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var gi=Object.create;var Be=Object.defineProperty;var mi=Object.getOwnPropertyDescriptor;var yi=Object.getOwnPropertyNames;var _i=Object.getPrototypeOf,vi=Object.prototype.hasOwnProperty;var g=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(n,t)=>(typeof require<"u"?require:n)[t]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')});var ft=(o,n)=>()=>(n||o((n={exports:{}}).exports,n),n.exports);var xi=(o,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of yi(n))!vi.call(o,i)&&i!==t&&Be(o,i,{get:()=>n[i],enumerable:!(e=mi(n,i))||e.enumerable});return o};var be=(o,n,t)=>(t=o!=null?gi(_i(o)):{},xi(n||!o||!o.__esModule?Be(t,"default",{value:o,enumerable:!0}):t,o));var rn=ft((vr,nn)=>{nn.exports=function(n,t){return n[0]=t[0],n[1]=t[1],n}});var an=ft((xr,sn)=>{var on=rn();sn.exports=function(o,n){Array.isArray(n)||(n=[]),o.length>0&&n.push(on([0,0],o[0]));for(var t=0;t<o.length-1;t++){var e=o[t],i=o[t+1],r=e[0],s=e[1],a=i[0],u=i[1],l=[.75*r+.25*a,.75*s+.25*u],c=[.25*r+.75*a,.25*s+.75*u];n.push(l),n.push(c)}return o.length>1&&n.push(on([0,0],o[o.length-1])),n}});var dn=ft((Sr,fn)=>{var Ce=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((n,t)=>n.priority-t.priority)}set(n,t){let e=Number(t);if(isNaN(e))throw new TypeError('"priority" must be a number');return this.keys.has(n)?this.queue.map(i=>(i.key===n&&Object.assign(i,{priority:e}),i)):(this.keys.add(n),this.queue.push({key:n,priority:e})),this.sort(),this.queue.length}next(){let n=this.queue.shift();return this.keys.delete(n.key),n}isEmpty(){return this.queue.length===0}has(n){return this.keys.has(n)}get(n){return this.queue.find(t=>t.key===n)}};fn.exports=Ce});var yn=ft((wr,mn)=>{function gn(o,n){let t=new Map;for(let[e,i]of o)e!==n&&i instanceof Map?t.set(e,gn(i,n)):e!==n&&t.set(e,i);return t}mn.exports=gn});var xn=ft((Tr,vn)=>{function Ai(o){let n=Number(o);return!(isNaN(n)||n<=0)}function _n(o){let n=new Map;return Object.keys(o).forEach(e=>{let i=o[e];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return n.set(e,_n(i));if(!Ai(i))throw new Error(`Could not add node at key "${e}", make sure it's a valid node`,i);return n.set(e,Number(i))}),n}vn.exports=_n});var Mn=ft((Cr,bn)=>{function En(o){if(!(o instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof o}`);o.forEach((n,t)=>{if(typeof n=="object"&&n instanceof Map){En(n);return}if(typeof n!="number"||n<=0)throw new Error(`Values must be numbers greater than 0. Found value ${n} at ${t}`)})}bn.exports=En});var Le=ft((Pr,Tn)=>{var Ri=dn(),Ii=yn(),Sn=xn(),wn=Mn(),Pe=class{constructor(n){n instanceof Map?(wn(n),this.graph=n):n?this.graph=Sn(n):this.graph=new Map}addNode(n,t){let e;return t instanceof Map?(wn(t),e=t):e=Sn(t),this.graph.set(n,e),this}addVertex(n,t){return this.addNode(n,t)}removeNode(n){return this.graph=Ii(this.graph,n),this}path(n,t,e={}){if(!this.graph.size)return e.cost?{path:null,cost:0}:null;let i=new Set,r=new Ri,s=new Map,a=[],u=0,l=[];if(e.avoid&&(l=[].concat(e.avoid)),l.includes(n))throw new Error(`Starting node (${n}) cannot be avoided`);if(l.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(r.set(n,0);!r.isEmpty();){let c=r.next();if(c.key===t){u=c.priority;let f=c.key;for(;s.has(f);)a.push(f),f=s.get(f);break}i.add(c.key),(this.graph.get(c.key)||new Map).forEach((f,d)=>{if(i.has(d)||l.includes(d))return null;if(!r.has(d))return s.set(d,c.key),r.set(d,c.priority+f);let _=r.get(d).priority,v=c.priority+f;return v<_?(s.set(d,c.key),r.set(d,v)):null})}return a.length?(e.trim?a.shift():a=a.concat([n]),e.reverse||(a=a.reverse()),e.cost?{path:a,cost:u}:a):e.cost?{path:null,cost:0}:null}shortestPath(...n){return this.path(...n)}};Tn.exports=Pe});var ye=g("three");var X=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(n){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),n()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(n){this.tasks.requestAnimation.delete(n),window.cancelAnimationFrame(n)}setTimeout(n,t){let e=window.setTimeout(()=>{this.tasks.timeout.delete(e),n()},t);return this.tasks.timeout.add(e),e}clearTimeout(n){this.tasks.timeout.delete(n),window.clearTimeout(n)}setInterval(n,t){let e=window.setInterval(()=>{this.tasks.interval.delete(e),n()},t);return this.tasks.interval.add(e),e}clearInterval(n){this.tasks.interval.delete(n),window.clearInterval(n)}dispose(){this.tasks.requestAnimation.forEach(n=>{window.cancelAnimationFrame(n)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(n=>{window.clearTimeout(n)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(n=>{window.clearInterval(n)}),this.tasks.interval.clear()}};var C=g("three"),Ge=g("three/examples/jsm/controls/MapControls");function ze(){let o=new C.Scene;return o.background=new C.Color(16777215),o}function ke(){let o=new C.WebGLRenderer({antialias:!0});return o.autoClear=!0,o.setClearAlpha(1),o.setClearColor(16777215),o.setPixelRatio(window.devicePixelRatio),o.shadowMap.enabled=!0,o.shadowMap.autoUpdate=!0,o.shadowMap.type=C.PCFSoftShadowMap,o}function Ve(o,n){let t=new C.OrthographicCamera(-o/2,o/2,n/2,-n/2,-1e3,5e3);return t.up.set(0,0,1),t.position.set(0,0,100),t.lookAt(0,0,0),t}function He(){let o=new C.Group,n=new C.AmbientLight(16777215,2.6);return o.add(n),o}function We(o,n){let t=new Ge.MapControls(o,n);return t.enableDamping=!1,t.zoomSpeed=2,t}function it(o,n=[]){let t=new C.Shape(o.map(e=>new C.Vector2(...e)));return n.length&&n.forEach(e=>{var i=new C.Path(e.map(r=>new C.Vector2(...r)));t.holes.push(i)}),t}function Xe(o=16777215,n=1){let t=new C.DirectionalLight(o,n);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function Z(o,n){if(n&&o.children&&o.children.length&&o.children.forEach(t=>{Z(t,n)}),o.isMesh){let t=o;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(e=>{e.dispose()}):t.material.dispose())}o.isLight&&o.dispose?.()}function qe(o){return/[\u4E00-\u9FA5]+/g.test(o)}var q=g("three"),Et=new Map,At=new Map,Ei=new q.TextureLoader;function bi(){let o=document.createElement("canvas");o.width=1024,o.height=64;let n=o.getContext("2d",{willReadFrequently:!0});return n.font="54px sans-serif",n.textBaseline="hanging",n.lineWidth=12,n.fillStyle="rgba(0,0,0,1)",n.strokeStyle="white",{canvas:o,ctx:n}}var Me,dt;function Mi(){if(!Me){let{canvas:o,ctx:n}=bi();Me=o,dt=n}}function je(o){if(At.has(o))return At.get(o);Mi(),dt.clearRect(0,0,1024,64);let n=qe(o)?4:8;dt.strokeText(o,2,n),dt.fillText(o,2,n);let t=Math.ceil(dt.measureText(o).width);t=t%2===0?t:t+1,t+=2;let e=dt.getImageData(0,0,t,64),i=new q.DataTexture(Uint8Array.from(e.data),t,64,q.RGBAFormat);return i.flipY=!0,i.minFilter=q.LinearFilter,i.magFilter=q.LinearFilter,At.set(o,i),i}function Ye(){At.forEach((o,n)=>{o.dispose()}),Et.forEach(o=>{o instanceof Promise?o.then(n=>n.dispose()):o.dispose()}),At.clear(),Et.clear()}function $e(){dt=null,Me=null}async function Ke(o){if(Et.has(o))return Et.get(o);let n=Ei.loadAsync(o);return n.then(t=>{t.format=q.RGBAFormat,t.magFilter=q.LinearFilter,t.minFilter=q.LinearFilter,t.colorSpace="srgb",Et.set(o,t)}),Et.set(o,n),n}var lt=g("three"),bt=g("@turf/turf");function x(o,n,t,e){let i=o.clone().project(n),r=t/2,s=e/2,a=Math.round(i.x*r+r),u=Math.round(-i.y*s+s);return{x:a,y:u}}function Se(o){let n=(0,bt.featureCollection)(o.map(e=>(0,bt.point)(e)));return(0,bt.center)(n).geometry.coordinates}function Ft(o,n,t){return o.x>=n.x&&o.x<=t.x&&o.y>=n.y&&o.y<=t.y}function Ji(o){let n=0,t=new lt.Vector3;for(let e=1;e<o.length;e++){let i=new lt.Vector3(o[e-1][0],o[e-1][1],0),r=new lt.Vector3(o[e][0],o[e][1],0),s=r.distanceTo(i);s>n&&(n=s,t=r.clone().sub(i).normalize())}return t}function F(o,n){return Math.sqrt((n[0]-o[0])**2+(n[1]-o[1])**2)}function ut(o){let n=0;for(let t=0;t<o.length-1;t++)n+=F(o[t],o[t+1]);return n}function Ut(o,n,t){let e=new lt.Vector2(n[0]-o[0],n[1]-o[1]),i=new lt.Vector2(n[0]-t[0],n[1]-t[1]),s=e.angleTo(i)*180/Math.PI,a=new lt.Vector2(n[0]-o[0],n[1]-o[1]);return new lt.Vector2(t[0]-o[0],t[1]-o[1]).cross(a)>0?s:-s}function Mt(o,n){return new Proxy(o,{get:(t,e,i)=>Reflect.get(t,e,i),set:(t,e,i,r)=>{let s=Reflect.get(t,e,r),a=Reflect.set(t,e,i,r);return s!==i&&n.dispatchEvent({type:`change-${e}`,value:i}),a}})}function gt(o,n){return Promise.race([o,new Promise((t,e)=>{setTimeout(()=>e(new Error("Promise timeout")),n)})])}function Bt(o){return document.createElementNS("http://www.w3.org/2000/svg",o)}function Ze(o,n){let t=Bt("svg");return t.setAttribute("width",o),t.setAttribute("height",n),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function Rt(o="2",n){let t=Bt("circle");return t.setAttribute("r",o),t.setAttribute("fill",n),t}function Gt(o){let n=Bt("line");return n.setAttribute("stroke",o),n}function St(o,n){let t=Bt("rect");return t.setAttribute("stroke",o),t.setAttribute("fill",n),t}function mt(o,n,t){o.setAttribute("cx",`${n}`),o.setAttribute("cy",`${t}`)}function J(o,n,t){n&&(o.setAttribute("x1",`${n.x}`),o.setAttribute("y1",`${n.y}`)),t&&(o.setAttribute("x2",`${t.x}`),o.setAttribute("y2",`${t.y}`))}function Q(o,n,t,e,i){o.setAttribute("x",`${n}`),o.setAttribute("y",`${t}`),o.setAttribute("width",`${e}`),o.setAttribute("height",`${i}`)}function Je(){return Promise.resolve()}function ir(){return new Promise(o=>{requestAnimationFrame(o)})}function or(o){return parseInt(o.replace("#","0x"),16)}function sr(o,n){let t=parseInt(o.substring(1,3),16),e=parseInt(o.substring(3,5),16),i=parseInt(o.substring(5,7),16),r=Math.round(t*n),s=Math.round(e*n),a=Math.round(i*n);return`#${(1<<24|r<<16|s<<8|a).toString(16).slice(1)}`}function ct(o,n=.85){let t,e,i;if(o.startsWith("#"))t=parseInt(o.substring(1,3),16),e=parseInt(o.substring(3,5),16),i=parseInt(o.substring(5,7),16);else{let s=o.slice(4,-1).split(",");t=parseInt(s[0].trim()),e=parseInt(s[1].trim()),i=parseInt(s[2].trim())}return t=Math.min(Math.floor(t*n),255),e=Math.min(Math.floor(e*n),255),i=Math.min(Math.floor(i*n),255),"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)}var Qe=g("three/examples/jsm/loaders/GLTFLoader");function Si(){return new Qe.GLTFLoader}var zt=null,kt=new Map;function Vt(o){if(kt.has(o)){let t=kt.get(o).then(e=>(e.scene=e.scene.clone(),e))}zt||(zt=Si());let n=new Promise((t,e)=>{zt.load(o,i=>{t(i)},void 0,e)});return kt.set(o,n),n.then(t=>(t.scene=t.scene.clone(),t))}function tn(){zt=null,kt.clear()}var Ht=navigator.userAgent.toUpperCase().indexOf("MAC")>=0;function we(o){return Ht?o==="Meta":o==="Control"}var Te="__once__",en=class{events=new Map;on(n,t){if(typeof t!="function")return;let e=this.events.get(n);return e?e.add(t):this.events.set(n,new Set([t]))}once(n,t){if(typeof t!="function")return;let e=`${Te}${n}`,i=this.events.get(e);return i?i.add(t):this.events.set(e,new Set([t]))}off(n,t){let e=this.events.get(n),i=this.events.get(`${Te}${n}`);!e&&!i||(t===void 0&&(e?.clear(),i?.clear()),e?.has(t)&&e.delete(t),i?.has(t)&&i.delete(t))}offAll(){this.events.clear()}emit(n,...t){let e=this.events.get(n),i=this.events.get(`${Te}${n}`);!e&&!i||(e?.forEach(r=>{typeof r=="function"&&r(...t)}),i?.forEach(r=>{typeof r=="function"&&r(...t)}),i?.clear())}};var It=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(It||{});function tt(o){return Object.keys(o).sort().map(n=>`${n}=${o[n]}`).join("&")}function mr(o,n){return new Promise((t,e)=>{let i=new XMLHttpRequest;i.open("GET",o,!0),Object.keys(n.headers||{}).forEach(r=>{i.setRequestHeader(r,n.headers[r])}),n.responseType&&(i.responseType=n.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(n.responseType==="arraybuffer")t(i.response);else try{let r=JSON.parse(i.responseText);t(r)}catch(r){e(r)}else e(i.statusText)},i.onerror=()=>{e(i.statusText)},i.send()})}var wt=class o{keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}genUniqueKey(){let n=o.createKey();for(;this.keySet.has(n);)n=o.createKey();return n}removeKey(n){this.keySet.delete(n)}dispose(){this.keySet.clear()}};var Tt=g("three"),ln=be(an(),1);function wi(o,n){let t=o.clone().normalize(),e=n.clone().normalize();return Math.acos(t.dot(e))}function Ti(o){let n=0;return o.reduce(([t,e],[i,r])=>(n+=Math.sqrt((i-t)**2+(r-e)**2),[i,r])),n/o.length}function un(o,n=.25){if(Ti(o)<n)return o;let t=(0,ln.default)(o);return un(t,n)}function cn(o,n=!1,t=!0,e=5,i=150,r=3){let s=[],a=!n;if(s.push(o[0]),o.length<2)return s;for(let l=0;l<o.length-2;l+=1){let c=o[l],p=o[l+1],f=o[l+2],d=new Tt.Vector2(c[0]-p[0],c[1]-p[1]),_=new Tt.Vector2(f[0]-p[0],f[1]-p[1]),v=wi(d,_)/Math.PI*180,h=d.length()+_.length();(!a||v<i&&h>.01||h>e)&&(s.push(o[l+1]),a=!0)}if(s.push(o[o.length-1]),!t)return s;let u=[];u.push(s[0]);for(let l=0;l<s.length-2;l+=1){let c=new Tt.Vector2(s[l][0],s[l][1]),p=new Tt.Vector2(s[l+1][0],s[l+1][1]),f=new Tt.Vector2(s[l+2][0],s[l+2][1]),d=c.distanceTo(p)/2,_=f.distanceTo(p)/2,v=p.clone(),h=p.clone();v.add(c.clone().sub(p).normalize().multiplyScalar(d>r?r/2:d)),h.add(f.clone().sub(p).normalize().multiplyScalar(_>r?r/2:_));let y=[[v.x,v.y],[p.x,p.y],[h.x,h.y]];u.push(...un(y,r/25))}return u.push(s[s.length-1]),Ci(u)}function Ci(o){if(o.length<=1)return o;let n=[],t;return o.forEach(([e,i])=>{t?e===t[0]&&i===t[1]||(t=[e,i],n.push([e,i])):(t=[e,i],n.push([e,i]))}),n}function hn(o,n,t){let e=Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2);if(e===0)return{distance:Math.sqrt((o[0]-n[0])**2+(o[1]-n[1])**2),closestPoint:n.slice(0)};let i=Math.max(0,Math.min(1,((o[0]-n[0])*(t[0]-n[0])+(o[1]-n[1])*(t[1]-n[1]))/e**2)),r=[n[0]+i*(t[0]-n[0]),n[1]+i*(t[1]-n[1])];return{distance:Math.sqrt((o[0]-r[0])**2+(o[1]-r[1])**2),closestPoint:r}}function pn(o,n,t){let[e,i]=o,[r,s]=n,a=Math.sqrt(Math.pow(r-e,2)+Math.pow(s-i,2));if(a===0||a<t)return[...n];let u=t/a,l=e+(r-e)*u,c=i+(s-i)*u;return[l,c]}var Pi=(l=>(l.START="start",l.END="end",l.FRONT="front",l.RIGHT="right",l.LEFT="left",l.RIGHT_FRONT="right_front",l.LEFT_FRONT="left_front",l.RIGHT_BACK="right_back",l.LEFT_BACK="left_back",l))(Pi||{});function Li(o,n,t){let e=Ut(o,n,t);return 180-Math.abs(e)<15?"front":e>135?"right_front":e<-135?"left_front":e<=135&&e>=60?"right":e>=-135&&e<=-60?"left":e<60&&e>0?"right_back":e>-60&&e<0?"left_back":"front"}function br(o){let n=[{direction:"start",distance:F(o[0],o[1]),points:[o[0],o[1]]}];for(let t=2;t<o.length;t++){let e=Li(o[t-2],o[t-1],o[t]);if(e==="front"){let i=n[n.length-1],r=F(o[t-1],o[t]);i.distance+=r,t!==2&&i.points.push(o[t-1])}else n.push({direction:e,distance:F(o[t-1],o[t]),points:[o[t-1],o[t]]})}return n.push({direction:"end",distance:0,points:[o[o.length-1]]}),n}var rt=be(Le(),1);var j="___",Cn=class{constructor(n=3){this.lift_priority=n}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new rt.default;escalatorRoute=new rt.default;straightLadderRoute=new rt.default;initRoute(n){this.clear(),this.roadInfo=n,n.length&&(n.forEach(t=>{t.points.forEach(e=>{let i=`${t.floor}${j}${e.id}`;if(this.pointMap.set(i,e),this.nodeMap.set(`${e.floor}${j}${e.nodeId}`,i),e.type==="straightLadder"){let r=this.straightLadderMap.get(e.name)||[];r.push({...e}),this.straightLadderMap.set(e.name,r)}if(e.type==="staircase"){let r=this.staircaseMap.get(e.name)||[];r.push({...e}),this.staircaseMap.set(e.name,r)}if(e.type==="escalator"){let r=this.escalatorMap.get(e.name)||{};e.escalatorDirection==="exit"?r.end={floor:e.floor,id:e.id}:r.start={floor:e.floor,id:e.id},this.escalatorMap.set(e.name,r)}if(e.type==="facility"){let r=this.facilityMap.get(e.targetId)||[];r.push({...e}),this.facilityMap.set(e.targetId,r)}}),t.lines.filter(e=>e.direction!=="no").forEach(e=>{let i=`${t.floor}${j}${e.from}`,r=`${t.floor}${j}${e.to}`,s=this.pointMap.get(i)?.cds,a=this.pointMap.get(r)?.cds;if(s?.length&&a?.length){let u=F(s,a);this.addLineItem(i,r,u),e.direction==="double"&&this.addLineItem(r,i,u)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(n,t,e,i=this.lineMap){let r=i.get(n)||new Map;r.set(t,e),i.set(n,r)}addFacilityToLineMap(n,t,e,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([r,s])=>{if(!(s.length<2))for(let a=0;a<s.length;a++){let u=`${s[a].floor}${j}${s[a].id}`;for(let l=0;l<s.length;l++)if(a!==l){let c=`${s[l].floor}${j}${s[l].id}`,p=this.pointMap.get(u)?.cds,f=this.pointMap.get(c)?.cds;if(p?.length&&f?.length)if(s[a].type==="straightLadder"){let d=t;this.addLineItem(u,c,d,i)}else{let d=e;this.addLineItem(u,c,d,i)}}}}),this.escalatorMap.forEach((r,s)=>{if(r.start&&r.end){let a=`${r.start.floor}${j}${r.start.id}`,u=`${r.end.floor}${j}${r.end.id}`,l=this.pointMap.get(a)?.cds,c=this.pointMap.get(u)?.cds;if(l?.length&&c?.length){let p=n;this.addLineItem(a,u,p,i)}}})}initBaseRoute(){let n=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,n),this.baseRoute=new rt.default(n)}initEscalatorRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,n),this.escalatorRoute=new rt.default(n)}initStraightLadderRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,n),this.straightLadderRoute=new rt.default(n)}checkStart(n){return!(!n.floor||!n.nodeId&&(!n.coord||n.coord.length<2))}checkEnd(n){return n.facility?!0:this.checkStart(n)}transformStart(n){if(n.nodeId){let t=this.nodeMap.get(`${n.floor}${j}${n.nodeId}`);if(t){let[e,i]=t.split(j);return{floor:e,id:i}}}if(n.coord?.length){let t=this.roadInfo.find(i=>i.floor===n.floor);if(!t)return null;let e=t.points.reduce((i,r)=>{let s=F(n.coord,r.cds);return s<i.min&&(i.min=s,i.point=r),i},{min:1/0,point:t.points[0]});return{floor:e.point.floor,id:e.point.id}}return null}transformEnd(n){if(n.floor){let t=this.transformStart(n);if(t)return t}return n.facility&&this.facilityMap.get(n.facility)?.length?{floor:n.floor,facility:n.facility}:null}getPath(n,t,e=""){if(!this.checkStart(n))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(n);if(!i)return"no-start";let r=this.transformEnd(t);if(!r)return"no-end";let s=this.getBasePath.bind(this);switch(e){case"escalator":s=this.getEscalatorPath.bind(this);case"straightLadder":s=this.getStraightLadderPath.bind(this);default:s=this.getBasePath.bind(this)}if(console.log(i,r),r.id)return s(i,r);if(r.facility){let a=this.facilityMap.get(r.facility).filter(l=>r.floor?l.floor===r.floor:!0);if(!a.length)return null;let u=a.map(l=>s(i,{floor:l.floor,id:l.id})).filter(l=>!!l);return u.reduce((l,c)=>{let p=c.reduce((f,d)=>f+ut(d.points),0);return p<l.distance&&(l.distance=p,l.path=c),l},{distance:1/0,path:u[0]}).path}}getRoutePath(n,t,e){let i=`${n.floor}${j}${n.id}`,r=`${t.floor}${j}${t.id}`,s=e.path(i,r);if(console.log(i,r,s),!s)return null;let a=[];return s.map(u=>{let l=this.pointMap.get(u);if(l){let{floor:c}=l;if(a[a.length-1]?.floor===c){let p=a[a.length-1];p.points.push(l.cds),p.endType=l.type,p.destId=l.nodeId}else a.push({floor:c,points:[l.cds],endType:l.type,destId:l.nodeId})}}),a}getBasePath(n,t){return this.getRoutePath(n,t,this.baseRoute)}getEscalatorPath(n,t){return this.getRoutePath(n,t,this.escalatorRoute)}getStraightLadderPath(n,t){return this.getRoutePath(n,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new rt.default,this.escalatorRoute=new rt.default,this.straightLadderRoute=new rt.default}};var Y=be(Le(),1);var k="___",Pn=class{constructor(n=3){this.lift_priority=n}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new Y.default;escalatorRoute=new Y.default;straightLadderRoute=new Y.default;forwardLineMap=new Map;forwardRoute=new Y.default;initRoute(n){this.clear(),this.roadInfo=n,n.length&&(n.forEach(t=>{t.points.forEach(e=>{let i=`${t.floor}${k}${e.id}`;if(this.pointMap.set(i,e),this.nodeMap.set(`${e.floor}${k}${e.nodeId}`,i),e.type==="straightLadder"){let r=this.straightLadderMap.get(e.name)||[];r.push({...e}),this.straightLadderMap.set(e.name,r)}if(e.type==="staircase"){let r=this.staircaseMap.get(e.name)||[];r.push({...e}),this.staircaseMap.set(e.name,r)}if(e.type==="escalator"){let r=this.escalatorMap.get(e.name)||{};e.escalatorDirection==="exit"?r.end={floor:e.floor,id:e.id}:r.start={floor:e.floor,id:e.id},this.escalatorMap.set(e.name,r)}if(e.type==="facility"){let r=this.facilityMap.get(e.targetId)||[];r.push({...e}),this.facilityMap.set(e.targetId,r)}e.type==="parkingSpace"&&this.parkingMap.set(`${e.floor}${k}${e.name}`,e)}),t.lines.filter(e=>e.direction!=="no").forEach(e=>{let i=`${t.floor}${k}${e.from}`,r=`${t.floor}${k}${e.to}`,s=this.pointMap.get(i)?.cds,a=this.pointMap.get(r)?.cds;if(s?.length&&a?.length){let u=F(s,a);switch(this.addLineItem(i,r,u),this.addLineItem(r,i,u),e.direction){case"double":this.addLineItem(i,r,u,this.forwardLineMap),this.addLineItem(r,i,u,this.forwardLineMap);break;case"single":this.addLineItem(i,r,u,this.forwardLineMap);break;case"back":this.addLineItem(r,i,u,this.forwardLineMap);break}}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}addLineItem(n,t,e,i=this.lineMap){let r=i.get(n)||new Map;r.set(t,e),i.set(n,r)}addFacilityToLineMap(n,t,e,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([r,s])=>{if(!(s.length<2))for(let a=0;a<s.length;a++){let u=`${s[a].floor}${k}${s[a].id}`;for(let l=0;l<s.length;l++)if(a!==l){let c=`${s[l].floor}${k}${s[l].id}`,p=this.pointMap.get(u)?.cds,f=this.pointMap.get(c)?.cds;if(p?.length&&f?.length)if(s[a].type==="straightLadder"){let d=t;this.addLineItem(u,c,d,i)}else{let d=e;this.addLineItem(u,c,d,i)}}}}),this.escalatorMap.forEach((r,s)=>{if(r.start&&r.end){let a=`${r.start.floor}${k}${r.start.id}`,u=`${r.end.floor}${k}${r.end.id}`,l=this.pointMap.get(a)?.cds,c=this.pointMap.get(u)?.cds;if(l?.length&&c?.length){let p=n;this.addLineItem(a,u,p,i)}}})}initBaseRoute(){let n=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,n),this.baseRoute=new Y.default(n)}initEscalatorRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,n),this.escalatorRoute=new Y.default(n)}initStraightLadderRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,n),this.straightLadderRoute=new Y.default(n)}initForwardRoute(){this.forwardRoute=new Y.default(this.forwardLineMap)}checkStart(n){return!(!n.floor||!n.nodeId&&(!n.coord||n.coord.length<2))}checkEnd(n){return n.facility||n.parkingSpace&&n.floor?!0:this.checkStart(n)}transformStart(n){if(n.nodeId){let t=this.nodeMap.get(`${n.floor}${k}${n.nodeId}`);if(t){let[e,i]=t.split(k);return{floor:e,id:i}}}if(n.coord?.length){let t=this.roadInfo.find(i=>i.floor===n.floor);if(!t)return null;let e=t.points.reduce((i,r)=>{let s=F(n.coord,r.cds);return s<i.min&&(i.min=s,i.point=r),i},{min:1/0,point:t.points[0]});return{floor:e.point.floor,id:e.point.id}}return null}transformEnd(n){if(n.floor){if(n.parkingSpace){let e=this.parkingMap.get(`${n.floor}${k}${n.parkingSpace}`);if(e)return{floor:e.floor,id:e.id}}let t=this.transformStart(n);if(t)return t}return n.facility&&this.facilityMap.get(n.facility)?.length?{floor:n.floor,facility:n.facility}:null}getPath(n,t,e=""){if(!this.checkStart(n))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(n);if(!i)return"no-start";let r=this.transformEnd(t);if(!r)return"no-end";let s=this.getBasePath.bind(this);switch(e){case"escalator":s=this.getEscalatorPath.bind(this);case"straightLadder":s=this.getStraightLadderPath.bind(this);case"forward":s=this.getForwardPath.bind(this);default:s=this.getBasePath.bind(this)}if(r.id)return s(i,r);if(r.facility){let a=this.facilityMap.get(r.facility).filter(l=>r.floor?l.floor===r.floor:!0);if(!a.length)return null;let u=a.map(l=>s(i,{floor:l.floor,id:l.id})).filter(l=>!!l);return u.reduce((l,c)=>{let p=c.reduce((f,d)=>f+ut(d.points),0);return p<l.distance&&(l.distance=p,l.path=c),l},{distance:1/0,path:u[0]}).path}}getRoutePath(n,t,e){let i=`${n.floor}${k}${n.id}`,r=`${t.floor}${k}${t.id}`,s=e.path(i,r);if(!s)return null;let a=[];return s.map(u=>{let l=this.pointMap.get(u);if(l){let{floor:c}=l;if(a[a.length-1]?.floor===c){let p=a[a.length-1];p.points.push(l.cds),p.endType=l.type,p.destId=l.nodeId,p.distance=ut(p.points)}else a.push({floor:c,points:[l.cds],endType:l.type,destId:l.nodeId,distance:0})}}),a}getBasePath(n,t){return this.getRoutePath(n,t,this.baseRoute)}getEscalatorPath(n,t){return this.getRoutePath(n,t,this.escalatorRoute)}getStraightLadderPath(n,t){return this.getRoutePath(n,t,this.straightLadderRoute)}getForwardPath(n,t){return this.getRoutePath(n,t,this.forwardRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new Y.default,this.escalatorRoute=new Y.default,this.straightLadderRoute=new Y.default}};function Ln(o){return o.replace(/[A-Z]/g,n=>"_"+n.toLowerCase()).replace(/^_/,"")}var An=new wt;function Ct(o,n,t){return new Promise((e,i)=>{let r=An.genUniqueKey(),s=({data:a})=>{a.type===`${n}_result`&&a.key===r&&(An.removeKey(r),self.removeEventListener("message",s),a.error?i(a.error):e(a.data))};o.addEventListener("message",s),o.postMessage({type:n,key:r,data:t})})}function Fr(o){let n={};for(let e in o)e.startsWith("on")&&(n[Ln(e.slice(2))]=o[e]);let t=async({data:e})=>{if(n[e.type])try{let i=await n[e.type](e.data);self.postMessage({type:`${e.type}_result`,key:e.key,data:i})}catch(i){self.postMessage({type:`${e.type}_result`,key:e.key,error:i})}else self.postMessage({type:`${e.type}_result`,key:e.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var w=g("three"),vt=g("@tweenjs/tween.js");var Hn=g("three");var M=g("three");var Ae={id:"",height:.1,airHeight:0,area:0,group:"",fillColor:"#EFF4FB",strokeColor:"#ffffff",fillOpacity:1,strokeOpacity:1,strokeWidth:1,doors:[],locked:!1,visible:!0,geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},layerType:"",zIndex:0,stroke:!0,deltaHeight:0,userData:{},gradualColor:[],renderType:"single",colorFactor:.9},B=class extends M.Object3D{constructor(t,e){super();this.context=t;if(this.options=Mt({...Ae,...e},this),this.options.geometry.type==="point"){let[i,r]=this.options.geometry.coords;return this.position.set(i,r,this.options.height+this.options.airHeight),this}this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",({value:i})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",({value:i})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",({value:i})=>{this.dispose(),this.init()}),this.addEventListener("change-strokeColor",({value:i})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",({value:i})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-airHeight",({value:i})=>{this.position.z=i}),this.addEventListener("change-visible",({value:i})=>{this.visible=i}),this.addEventListener("change-stroke",({value:i})=>{if(i){if(this.line)return;this.initLineGeometry(),this.initLineMaterial(),this.createBorder()}else this.line&&(this.remove(this.line),this.lineGeometry?.dispose())}),this.addEventListener("change-renderType",()=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-gradualColor",()=>{this.initMaterial(),this.initMesh()})}geometry;material;mesh;line;lineMaterial;lineGeometry;options;getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new M.Vector3,e=new M.Box3;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new M.Vector3(0,0,0);let t=new M.Box3,e=new M.Vector3;return t.setFromObject(this),t.getSize(e),e}getPosition(){let t=this.getCenter();return t.setZ(t.z+this.options.height/2),t}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initGeometry(){let t=it(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new M.ExtrudeGeometry(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=this.context.materialFactory.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.height<=.1)return this.material=t,t;let e=this.context.materialFactory.createMeshBasicMaterial({color:ct(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let i=new M.Box3().setFromObject(this),r=t.clone().add(e.clone().multiplyScalar(1e3)),s=new M.Ray(r,e.clone().multiplyScalar(-1)),a=new M.Vector3;s.intersectBox(i,a);let u=t.clone().add(e.clone().multiplyScalar(-1e3)),l=new M.Ray(u,e.clone()),c=new M.Vector3;return l.intersectBox(i,c),{max:c,min:a}}initGradualMaterial(){let{max:t,min:e}=new M.Box3().setFromObject(this),i=t.clone().sub(e),r=Math.max(i.x,i.y,i.z)/2,s=this.getPosition(),a=new M.Vector3(-1,.2,0).normalize(),{max:u,min:l}=this.getMaxAndMin(s,a),c=this.context.materialFactory.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:r,opacity:this.options.fillOpacity,direction:new M.Vector3(-1,.2,0),max:u,min:l});if(this.options.height<=.1)return this.material=c,c;let p=this.getCenter(),f=new M.Vector3(-1,.2,1).normalize(),{max:d,min:_}=this.getMaxAndMin(p,f),v=this.context.materialFactory.createShaderMaterial({gradualColor:[ct(this.options.gradualColor[0],this.options.colorFactor),ct(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:r,opacity:this.options.fillOpacity,direction:new M.Vector3(-1,.2,1),max:d,min:_});return this.material=[c,v],[c,v]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){let t=this.context.materialFactory.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new M.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options.height+this.options.deltaHeight,{coords:i}=this.options.geometry;for(let r=0;r<i.length;r++){let s=i[r];for(let a=0;a<s.length;a++){let u=s[a],l=a+1===s.length?s[0]:s[a+1];t.push(new M.Vector3(u[0],u[1],e)),t.push(new M.Vector3(l[0],l[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new M.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new M.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=this.options.airHeight+.01,this.line=t,this.add(t),t}raycast(t){if(!this.visible||this.options.geometry.type==="point")return!1;this.mesh.updateMatrixWorld(!0);let e=t.intersectObject(this.mesh);if(e[0]){let{point:i,distance:r}=e[0];return{position:i,distance:r}}return!1}dispose(){this.geometry?.dispose(),this.line?.geometry.dispose(),this.clear()}};var $=g("three");var Wt=class extends $.Object3D{directionalLight;plane;basicOpacity=.07;constructor(){super(),this.directionalLight=this.initLight(),this.initPlane()}initLight(){let n=Xe(16777215,.5);return n.position.set(0,0,100),this.add(n),n}changeLightCamera(n){let t=n.x,e=n.y;this.directionalLight.shadow.camera.left=-t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.top=e,this.directionalLight.shadow.camera.bottom=-e,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(t,e)}changeLightColor(n){this.directionalLight.color=new $.Color(n)}setPosition(n){this.position.copy(n),this.directionalLight.position.set(-n.x/2,-n.y/2,100)}initPlane(n=1e3,t=1e3){let e=new $.PlaneGeometry(n,t),i=new $.ShadowMaterial({transparent:!0,opacity:0,side:$.DoubleSide}),r=new $.Mesh(e,i);return r.receiveShadow=!0,r.position.z=-10,this.add(r),this.plane=r,r}setTarget(n){this.directionalLight.target=n}transformOpacity(n){return n*this.basicOpacity}setOpacity(n){this.plane.material.opacity=this.transformOpacity(n)}dispose(){Z(this,!0)}};var qt=g("three");var T=g("three");var Rn=g("lodash");var Ni={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},Xt=class extends T.EventDispatcher{constructor(t,e={}){super();this.context=t;this.options={...Ni,...e},this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}div;element;position=new T.Vector3;clientPos={x:0,y:0};visible=!0;options;placement="top";observer=null;initObserver(){let t=new MutationObserver((0,Rn.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){if(this.element instanceof B&&this.element.options.geometry.type==="polygon"){let{max:r,min:s}=new T.Box3().setFromObject(this.element),a=(r.x+s.x)/2,u=(r.y+s.y)/2;return{left:new T.Vector3(s.x,u,r.z),leftTop:new T.Vector3(s.x,r.y,r.z),top:new T.Vector3(a,r.y,r.z),rightTop:new T.Vector3(r.x,r.y,r.z),right:new T.Vector3(r.x,u,r.z),rightBottom:new T.Vector3(r.x,s.y,r.z),bottom:new T.Vector3(a,s.y,r.z),leftBottom:new T.Vector3(s.x,s.y,r.z),center:new T.Vector3(a,u,r.z)}}let{x:t,y:e,z:i}=this.element?.getPosition?.()||this.position;return{left:new T.Vector3(t,e,i),leftTop:new T.Vector3(t,e,i),top:new T.Vector3(t,e,i),rightTop:new T.Vector3(t,e,i),right:new T.Vector3(t,e,i),rightBottom:new T.Vector3(t,e,i),bottom:new T.Vector3(t,e,i),leftBottom:new T.Vector3(t,e,i),center:new T.Vector3(t,e,i)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,i=this.getPlacementPosition();return Object.keys(i).reduce((r,s)=>{let{x:a,y:u}=x(i[s],this.context.camera,t,e);return r[s]={x:a,y:u},r},{})}checkOverflow(t,e){let{width:i,height:r}=this.context.clientSize;return e.x>0&&t.x<i&&e.y<r&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,i=this.getPlacementScreenPosition(),r=t/2,s=e/2,a=[{type:"center",getBox(u,l){return{max:{x:r+u,y:l-e},min:{x:u-r,y:l}}}},{type:"left",getBox(u,l){return{max:{x:u,y:l-s},min:{x:u-t,y:l+s}}}},{type:"leftTop",getBox(u,l){return{max:{x:u,y:l-e},min:{x:u-t,y:l}}}},{type:"top",getBox(u,l){return{max:{x:u+r,y:l-e},min:{x:u-r,y:l}}}},{type:"rightTop",getBox(u,l){return{max:{x:u+t,y:l-e},min:{x:u,y:l}}}},{type:"right",getBox(u,l){return{max:{x:u+t,y:l-s},min:{x:u,y:l+s}}}},{type:"rightBottom",getBox(u,l){return{max:{x:u+t,y:l},min:{x:u,y:l+e}}}},{type:"bottom",getBox(u,l){return{max:{x:u+r,y:l},min:{x:u-r,y:l+e}}}},{type:"leftBottom",getBox(u,l){return{max:{x:u,y:l},min:{x:u-t,y:l+s}}}}];for(let u=0;u<a.length;u++){let l=a[u],c=i[l.type],{max:p,min:f}=l.getBox(c.x,c.y);if(this.checkOverflow(p,f))return{type:l.type,position:c}}return{type:"center",position:i.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className=`overlay_${t.type}`,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,e="block"){t!==this.visible&&(this.div.style.display=t?e:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=`${t}`}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new T.Box3().setFromObject(this.element).getCenter(new T.Vector3):this.position}get withinDisplayRange(){let{x:t,y:e}=this.clientPos,{width:i,height:r}=this.context.clientSize;return t>=0&&t<=i&&e>=0&&e<=r}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:i,height:r,x:s,y:a}=this.context.clientSize;this.options.appendToBody&&(this.div.style.left=`${s}px`,this.div.style.top=`${a+r}px`),this.options.autoUpdate?this.div.style.transform=`translate3d(${t}px, ${-r+e}px, 0)`:this.dispatchEvent({type:"update-position",x:t,y:e,width:i,height:r})}updatePosition(t=!1){let e=this.getPosition(),{width:i,height:r}=this.context.clientSize,{x:s,y:a}=x(e,this.context.camera,i,r);this.clientPos.x===s&&this.clientPos.y===a&&!t||this._updatePosition(s,a)}onUpdate=()=>{this.options.autoChangePlacement?this.usePlacement():this.updatePosition()};registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.unRegistryEvent(),this.unBindElement(),this.observer?.disconnect(),this.div?.remove(),this.div=null}};var Di={texts:[{text:""}],level:1,icon_position:"bottom",collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},icon_opacity:1,icon_border:{color:"#586EE0",width:0},background:"",collision_hide_icon:!0,built_in:!1,box_only_icon:!1},yt=class extends qt.EventDispatcher{constructor(t,e){super();this.context=t;this.options=Mt({...Di,...e},this),this.position.set(e.position?.x||0,e.position?.y||0,e.position?.z||0),this.overlay=new Xt(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",({x:i,y:r,height:s})=>{this.overlay.div.style.transform=`translate3d(calc(${i}px - 50%), calc(${-s+r}px - ${this.options.icon&&this.options.icon_position!=="center"?"100%":"50%"}), 0)`}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",({value:i})=>{i?this.img?this.img.setAttribute("src",i):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",({value:i})=>{let r=this.textDiv;if(r){let s=this.initText();this.div.replaceChild(s,r)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",({value:i})=>{this.overlay.setOpacity(i)}),this.addEventListener("change-icon_size",({value:i})=>{this.img&&(this.img.style.width=`${i?.[0]||32}px`,this.img.style.height=`${i?.[1]||32}px`,this.resetSize())}),this.addEventListener("change-icon_opacity",({value:i})=>{this.img&&(this.img.style.opacity=`${i}`)}),this.addEventListener("change-icon_border",({value:i})=>{this.img&&(this.img.style.border=`${i.width}px solid ${i.color}`)}),this.addEventListener("change-background",({value:i})=>{this.div.style.background=i})}div;textDiv;img;overlay;options;visible=!0;size={width:0,height:0};position=new qt.Vector3;userData={};showTextStatus=!0;disposed=!1;get withinDisplayRange(){return this.overlay.withinDisplayRange}async resetSize(){if(await Je(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:e}=this.img.getBoundingClientRect();this.size={width:t+2,height:e+2}}else{let{width:t,height:e}=this.div.getBoundingClientRect();this.size={width:t+2,height:e+2}}}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(e=>{let i=document.createElement("div");if(i.style.whiteSpace="nowrap",e.styles)for(let[r,s]of Object.entries(e.styles))i.style[r]=s;i.textContent=e.text,t.appendChild(i)}),t}initIcon(){let t=document.createElement("img");return t.setAttribute("src",this.options.icon),t.style.width=`${this.options.icon_size?.[0]||32}px`,t.style.height=`${this.options.icon_size?.[1]||32}px`,t.style.opacity=`${this.options.icon_opacity}px`,t.style.borderRadius="50%",this.options.icon_border.width&&(t.style.border=`${this.options.icon_border.width}px solid ${this.options.icon_border.color}`),t.onload=()=>{this.resetSize()},this.img=t,t}_changePosition=()=>{this.overlay.updatePosition(!0)};registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t=this.context.config.poi.boxScale){let{width:e,height:i}=this.size,r=e*t,s=i*t,{x:a,y:u}=this.overlay.clientPos;return{left:a-r/2,right:a+r/2,top:this.options.icon?u-s:u-s/2,bottom:this.options.icon?u:u+s/2}}getOriginBox(){return this.getBox(1)}isContain(t,e){if(!this.overlay.visible||!this.visible)return!1;let i=this.getOriginBox();return t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}};var z=g("three");var D=g("three"),In=g("@mars3d/heatmap.js"),ht=g("@turf/turf"),jt=class extends D.Object3D{constructor(t){super();this.context=t;this.div=document.createElement("div")}heatmap;div;plane;clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){this.clearHeatmap();let{width:e,height:i,leftTop:r,center:s}=this.getBox(t);this.heatmap=(0,In.create)({width:e,height:i,container:this.div,...this.context.config.heatMap}),this.heatmap.setData(this.transformData(t,r)),this.initPlane(e,i),this.position.set(s[0],s[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let i=new D.PlaneGeometry(t,e),r=new D.Texture(this.div.firstChild);r.needsUpdate=!0;let s=new D.MeshBasicMaterial({transparent:!0,side:D.DoubleSide,map:r});s.needsUpdate=!0,this.plane=new D.Mesh(i,s),this.add(this.plane)}getTransMatrix({x:t,y:e}){return new D.Matrix3().makeScale(1,-1).multiply(new D.Matrix3().makeTranslation(0-t,0-e))}transformData(t,e){let i=this.getTransMatrix(e);return{data:t.data.map(s=>{let a=new D.Vector2(s.x,s.y).applyMatrix3(i);return{x:a.x,y:a.y,value:s.value}}),max:t.max,min:t.min}}getBox(t){let e=(0,ht.featureCollection)(t.data.map(l=>(0,ht.point)([l.x,l.y]))),i=(0,ht.bbox)(e),r=i[2]-i[0],s=i[3]-i[1],a={x:i[0],y:i[3]},u=(0,ht.center)(e);return{width:r,height:s,leftTop:a,center:u.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}};var $t=g("three");var Yt=class extends $t.Object3D{constructor(t,e){super();this.context=t;this.options=e;this.position.copy(e.position||new $t.Vector3(0,0,0)),this.loadModel()}model=null;async loadModel(){let t=await Vt(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t}dispose(){Z(this),this.model=null}};var Zt=g("three");var Nn=g("three");var G=class extends Nn.Object3D{constructor(t){super();this.context=t}dispose(){Z(this),this.children.forEach(t=>t.dispose?.()),this.clear()}};var Kt=class extends G{graphicMap=new Map;constructor(n){super(n)}getCenter(){return new Zt.Box3().setFromObject(this).getCenter(new Zt.Vector3)}createGraphic(n){let t=new B(this.context,n);return this.add(t),this.graphicMap.set(n.id,t),t}removeGraphic(n){this.remove(n),this.graphicMap.delete(n.options.id),n.dispose()}removeGraphicById(n){this.graphicMap.has(n)&&this.removeGraphic(this.graphicMap.get(n))}getGraphicByNodeId(n){return this.graphicMap.get(n)||null}getGraphicByRaycaster(n){let t={distance:1e4,graphic:null,position:null},e=this.children.reduce((i,r)=>{if(r instanceof B){let s=r.raycast(n);if(s){let{distance:a}=s;if(a<i.distance)return{distance:s.distance,position:s.position,graphic:r}}return i}else return i},t);return e===t?{graphics:[],position:null}:{graphics:[e.graphic],position:e.position}}};var Dn=g("lodash");var Pt=class extends G{pois=[];debounceCollisionDetection;timer=new X;constructor(n){super(n),this.registryEvent(),this.debounceCollisionDetection=(0,Dn.debounce)(this.collisionDetection,10)}clear(n=!1){return this.pois.forEach(t=>{t.options.built_in&&!n||t.dispose()}),this.pois=n?[]:this.pois.filter(t=>t.options.built_in),this}createPoi(n){let t=new yt(this.context,n);return this.pushPoi(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),t}changePoiLevelOrCollisionEnable(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),this.pushPoi(n))}removePoi(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),n.dispose())}removePoiById(n){let t=this.pois.find(e=>e.options.id===n);t&&this.removePoi(t)}getPoiById(n){return this.pois.find(e=>e.options.id===n)||null}pushPoi(n){if(!n.options.collision_enable){this.pois.unshift(n);return}if(n.options.level===0){this.pois.push(n);return}for(let t=0;t<this.pois.length;t++){let e=this.pois[t];if(e.options.collision_enable&&e.options.level<=n.options.level){this.pois.splice(t,0,n);return}}this.pois.push(n)}getPoiByDeviceXy(n,t){return this.pois.filter(i=>i instanceof yt&&i.isContain(n,t))}onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let n=[];this.pois.filter(e=>e.visible&&e.withinDisplayRange).forEach((e,i)=>{let{left:r,right:s,top:a,bottom:u}=e.getBox();if(i===0||!e.options.collision_enable){n.push({left:r,right:s,top:a,bottom:u}),e.parentSetVisible(!0);return}let l=n.some(c=>c.left<s&&c.right>r&&c.top<u&&c.bottom>a);e.parentSetVisible(!l),l||n.push({left:r,right:s,top:a,bottom:u})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(n=>n.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var On=g("lodash");var Qt=g("three"),Jt=class extends G{pois=[];debounceCollisionDetection;timer=new X;constructor(n){super(n),this.registryEvent(),this.debounceCollisionDetection=(0,On.debounce)(this.collisionDetection,10)}clear(){return this.pois.forEach(n=>{n.dispose()}),this.pois=[],this}createPoi(n){let t=new V(this.context,n);return this.pushPoi(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),t}changePoiLevelOrCollisionEnable(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),this.pushPoi(n))}removePoi(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.remove(n),this.pois.splice(t,1),n.dispose())}removePoiById(n){let t=this.pois.find(e=>e.options.id===n);t&&this.removePoi(t)}getPoiById(n){return this.pois.find(e=>e.options.id===n)||null}pushPoi(n){if(this.add(n),!n.options.collision_enable){this.pois.unshift(n);return}if(n.options.level===0){this.pois.push(n);return}for(let t=0;t<this.pois.length;t++){let e=this.pois[t];if(e.options.collision_enable&&e.options.level<=n.options.level){this.pois.splice(t,0,n);return}}this.pois.push(n)}getPoiByDeviceXy(n,t){let e=new Qt.Vector2(n,t);return this.pois.filter(r=>r instanceof V&&r.box.containsPoint(e))}onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let n=[],{camera:t}=this.context;t.updateMatrixWorld();let e=s=>s<=1&&s>=-1,i=t.projectionMatrix.clone();i.multiply(t.matrixWorldInverse),this.pois.filter(s=>{if(s.visible){let a=new Qt.Vector3().setFromMatrixPosition(s.matrixWorld);return a.applyMatrix4(i),s.screenPosition=a,e(a.x)&&e(a.y)&&e(a.z)}return!1}).forEach((s,a)=>{let u=s.getBox(s.screenPosition);if(a===0||!s.options.collision_enable){n.push(u),s.parentSetVisible(!0);return}let l=n.some(c=>c.intersectsBox(u));s.parentSetVisible(!l),l||n.push(u)})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(n=>n.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var pt=class extends z.Object3D{constructor(t){super();this.context=t;this.groundLayer=new G(this.context),this.graphicLayer=new Kt(this.context),this.poiLayer=new Pt(this.context),this.poiLayer2=new Jt(this.context),this.wallLayer=new G(this.context),this.textureLayer=new G(this.context),this.glbModelLayer=new G(this.context),this.laneLayer=new G(this.context),this.mergeGraphicLayer=new G(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}graphicLayer;poiLayer;poiLayer2;wallLayer;textureLayer;glbModelLayer;laneLayer;mergeGraphicLayer;grounds=new Set;groundLayer;shadow=new Wt;heatmap;groundUpper=new z.Object3D;models=new z.Object3D;modelMap=new Map;groundMaxHeight=0;name="";key="";box=new z.Box3;getPosition(){return new z.Box3().setFromObject(this).getCenter(new z.Vector3)}createGround(t){let e=new B(this.context,t);this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(e.mesh.castShadow=!0,this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new z.Box3().setFromObject(this).getCenter(new z.Vector3)}addModel(t){let e=new Yt(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new z.Box3().setFromObject(this.groundUpper),e=t.getCenter(new z.Vector3),i=t.getSize(new z.Vector3);this.shadow.setPosition(e),this.shadow.changeLightCamera(i)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addHeatmap(t){this.heatmap||(this.heatmap=new jt(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let e=new z.Box3().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(e.max.z),this.heatmap}removeHeatMap(){this.heatmap&&(this.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=void 0)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}updateBox(){this.box.setFromObject(this)}dispose(){this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.grounds.forEach(t=>t.dispose()),this.heatmap?.dispose(),this.groundUpper.clear(),this.models.children.forEach(t=>t.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}};var te=g("three");var ot=class extends te.EventDispatcher{constructor(t){super();this.context=t;this.svg=Ze(`${t.container.clientWidth}`,`${t.container.clientHeight}`),t.container.appendChild(this.svg),this._registryEvent()}points=[];svg;enable=!0;_onResize=({width:t,height:e})=>{this.svg&&(this.svg.setAttribute("width",`${t}`),this.svg.setAttribute("height",`${e}`))};_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:i}=this.context,{offsetX:r,offsetY:s}=t,{clientWidth:a,clientHeight:u}=i.domElement,l=r/a*2-1,c=1-s/u*2;return new te.Vector3(l,c,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:i}=this.context;return x(t,e,i.clientWidth,i.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}};var ee=class extends ot{constructor(t){super(t);this.context=t;let{config:{svg:{circle:e,line:i}}}=t;this.circles=[Rt(e.radius,e.fill),Rt(e.radius,e.fill)],this.line=Gt(i.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}circles;line;setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{if(this.points[0]){let t=this.getSvgCoordinate(this.points[0]);mt(this.circles[0],t.x,t.y),J(this.line,t)}if(this.points[1]){let t=this.getSvgCoordinate(this.points[1]);mt(this.circles[1],t.x,t.y),J(this.line,void 0,t)}};onPointermove=t=>{this.points.length===1&&(this.line.style.display="block",J(this.line,void 0,{x:t.offsetX,y:t.offsetY}))};onPointerleave=()=>{this.points[1]||(this.line.style.display="none")};onPointerdown=t=>{if(this.points[1])return;let e=this.getIntersectByPointerEvent(t);if(e){let{offsetX:i,offsetY:r}=t,s=this.circles[this.points.length];mt(s,i,r),this.points.length||J(this.line,{x:i,y:r},{x:i,y:r}),this.addPoint(e)}};addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:i,y:r}]=this.points;return Math.sqrt((i-t)**2+(r-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}};var ne=class extends ot{circles=[];lines=[];isClose=!1;constructor(n){super(n),this.registryEvent()}setEnable(n){super.setEnable(n),n?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(n){this.circles.push(n),this.svg.appendChild(n)}addLine(n){this.lines.push(n),this.svg.appendChild(n)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{this.points.length&&this.points.forEach((n,t)=>{let e=this.getSvgCoordinate(n);this.circles[t]&&mt(this.circles[t],e.x,e.y),t!==0&&J(this.lines[t-1],void 0,e),this.lines[t]&&J(this.lines[t],e)})};onPointermove=n=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",J(this.lastLine,void 0,{x:n.offsetX,y:n.offsetY}))};onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")};onPointerdown=n=>{if(this.isClose)return;let t=this.getIntersectByPointerEvent(n);if(t){let{offsetX:e,offsetY:i}=n;this.checkAdsorb(e,i)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(t);let{circle:{fill:r,radius:s},line:{stroke:a}}=this.context.config.svg;if(!this.isClose){let u=Rt(s,r);mt(u,e,i),this.addCircle(u)}if(this.lines.length&&J(this.lastLine,void 0,{x:e,y:i}),!this.isClose){let u=Gt(a);J(u,{x:e,y:i},{x:e,y:i}),this.addLine(u)}}};checkAdsorb(n,t){if(this.points.length<3)return!1;let e=this.circles[0],i=+e.getAttribute("cx"),r=+e.getAttribute("cy");return Math.sqrt((n-i)**2+(t-r)**2)<=5}addPoint(n){if(this.points.push(n),this.isClose){let t=this.calculatedArea();this.dispatchEvent({type:"area",area:t})}}calculatedArea(){let n=this.points.map(i=>[i.x,i.y]),t=0,e=n.length;for(let i=0;i<e;i++){let r=(i+1)%e;t+=n[i][0]*n[r][1]-n[r][0]*n[i][1]}return Math.abs(t/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}};var Un=g("three");var Fn=class extends ot{constructor(t){super(t);this.context=t;let{config:{svg:{line:e}}}=t;this.rect=St(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let i=0;i<4;i++)this.cornerRect[i]=St(e.stroke,"#ffffff"),this.centerRect[i]=St(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[i]),this.svg.appendChild(this.centerRect[i]);this.registryEvent()}rect;cornerRect=[];centerRect=[];graphic;setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{if(this.graphic){let t=new Un.Box3().setFromObject(this.graphic),{camera:e,container:{clientWidth:i,clientHeight:r}}=this.context,{min:s,max:a}=t,u=x(s,e,i,r),l=x(a,e,i,r);Q(this.rect,u.x,l.y,Math.abs(l.x-u.x),Math.abs(l.y-u.y));let{x:c,y:p}=u,{x:f,y:d}=l,_=5,v=[{x:c-_,y:d-_},{x:f-_,y:d-_},{x:c-_,y:p-_},{x:f-_,y:p-_}];for(let S=0;S<v.length;S++)Q(this.cornerRect[S],v[S].x,v[S].y,_*2,_*2);let h=4,y=(c+f)/2,b=(p+d)/2,E=[{x:y-h,y:d-h},{x:c-h,y:b-h},{x:f-h,y:b-h},{x:y-h,y:p-h}];for(let S=0;S<E.length;S++)Q(this.centerRect[S],E[S].x,E[S].y,h*2,h*2)}else{Q(this.rect,0,0,0,0);for(let t=0;t<this.cornerRect.length;t++)Q(this.cornerRect[t],0,0,0,0),Q(this.centerRect[t],0,0,0,0)}};selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}};var A=g("three");var Re=g("three/examples/jsm/utils/BufferGeometryUtils"),ie=class extends A.Object3D{constructor(t,e){super();this.context=t;this.options=e;e.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;initGeometry(){let t=this.options.map(e=>{let i=it(e.geometry.coords[0],e.geometry.coords.slice(1));return new A.ExtrudeGeometry(i,{steps:1,bevelEnabled:!1,depth:e.height,curveSegments:4})});this.geometry=(0,Re.mergeGeometries)(t),t.forEach(e=>e.dispose())}initMaterial(){let t=`
|
|
1
|
+
"use strict";(()=>{var xi=Object.create;var Ge=Object.defineProperty;var Ei=Object.getOwnPropertyDescriptor;var bi=Object.getOwnPropertyNames;var Mi=Object.getPrototypeOf,Si=Object.prototype.hasOwnProperty;var g=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(n,t)=>(typeof require<"u"?require:n)[t]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+o+'" is not supported')});var dt=(o,n)=>()=>(n||o((n={exports:{}}).exports,n),n.exports);var wi=(o,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of bi(n))!Si.call(o,i)&&i!==t&&Ge(o,i,{get:()=>n[i],enumerable:!(e=Ei(n,i))||e.enumerable});return o};var Se=(o,n,t)=>(t=o!=null?xi(Mi(o)):{},wi(n||!o||!o.__esModule?Ge(t,"default",{value:o,enumerable:!0}):t,o));var sn=dt((Pr,on)=>{on.exports=function(n,t){return n[0]=t[0],n[1]=t[1],n}});var un=dt((Lr,ln)=>{var an=sn();ln.exports=function(o,n){Array.isArray(n)||(n=[]),o.length>0&&n.push(an([0,0],o[0]));for(var t=0;t<o.length-1;t++){var e=o[t],i=o[t+1],r=e[0],s=e[1],a=i[0],u=i[1],l=[.75*r+.25*a,.75*s+.25*u],c=[.25*r+.75*a,.25*s+.75*u];n.push(l),n.push(c)}return o.length>1&&n.push(an([0,0],o[o.length-1])),n}});var mn=dt((Nr,gn)=>{var Pe=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((n,t)=>n.priority-t.priority)}set(n,t){let e=Number(t);if(isNaN(e))throw new TypeError('"priority" must be a number');return this.keys.has(n)?this.queue.map(i=>(i.key===n&&Object.assign(i,{priority:e}),i)):(this.keys.add(n),this.queue.push({key:n,priority:e})),this.sort(),this.queue.length}next(){let n=this.queue.shift();return this.keys.delete(n.key),n}isEmpty(){return this.queue.length===0}has(n){return this.keys.has(n)}get(n){return this.queue.find(t=>t.key===n)}};gn.exports=Pe});var vn=dt((Dr,_n)=>{function yn(o,n){let t=new Map;for(let[e,i]of o)e!==n&&i instanceof Map?t.set(e,yn(i,n)):e!==n&&t.set(e,i);return t}_n.exports=yn});var bn=dt((Or,En)=>{function Fi(o){let n=Number(o);return!(isNaN(n)||n<=0)}function xn(o){let n=new Map;return Object.keys(o).forEach(e=>{let i=o[e];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return n.set(e,xn(i));if(!Fi(i))throw new Error(`Could not add node at key "${e}", make sure it's a valid node`,i);return n.set(e,Number(i))}),n}En.exports=xn});var wn=dt((Fr,Sn)=>{function Mn(o){if(!(o instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof o}`);o.forEach((n,t)=>{if(typeof n=="object"&&n instanceof Map){Mn(n);return}if(typeof n!="number"||n<=0)throw new Error(`Values must be numbers greater than 0. Found value ${n} at ${t}`)})}Sn.exports=Mn});var Ae=dt((Ur,Pn)=>{var Ui=mn(),Bi=vn(),Tn=bn(),Cn=wn(),Le=class{constructor(n){n instanceof Map?(Cn(n),this.graph=n):n?this.graph=Tn(n):this.graph=new Map}addNode(n,t){let e;return t instanceof Map?(Cn(t),e=t):e=Tn(t),this.graph.set(n,e),this}addVertex(n,t){return this.addNode(n,t)}removeNode(n){return this.graph=Bi(this.graph,n),this}path(n,t,e={}){if(!this.graph.size)return e.cost?{path:null,cost:0}:null;let i=new Set,r=new Ui,s=new Map,a=[],u=0,l=[];if(e.avoid&&(l=[].concat(e.avoid)),l.includes(n))throw new Error(`Starting node (${n}) cannot be avoided`);if(l.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(r.set(n,0);!r.isEmpty();){let c=r.next();if(c.key===t){u=c.priority;let f=c.key;for(;s.has(f);)a.push(f),f=s.get(f);break}i.add(c.key),(this.graph.get(c.key)||new Map).forEach((f,d)=>{if(i.has(d)||l.includes(d))return null;if(!r.has(d))return s.set(d,c.key),r.set(d,c.priority+f);let _=r.get(d).priority,v=c.priority+f;return v<_?(s.set(d,c.key),r.set(d,v)):null})}return a.length?(e.trim?a.shift():a=a.concat([n]),e.reverse||(a=a.reverse()),e.cost?{path:a,cost:u}:a):e.cost?{path:null,cost:0}:null}shortestPath(...n){return this.path(...n)}};Pn.exports=Le});var ve=g("three");var q=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(n){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),n()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(n){this.tasks.requestAnimation.delete(n),window.cancelAnimationFrame(n)}setTimeout(n,t){let e=window.setTimeout(()=>{this.tasks.timeout.delete(e),n()},t);return this.tasks.timeout.add(e),e}clearTimeout(n){this.tasks.timeout.delete(n),window.clearTimeout(n)}setInterval(n,t){let e=window.setInterval(()=>{this.tasks.interval.delete(e),n()},t);return this.tasks.interval.add(e),e}clearInterval(n){this.tasks.interval.delete(n),window.clearInterval(n)}dispose(){this.tasks.requestAnimation.forEach(n=>{window.cancelAnimationFrame(n)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(n=>{window.clearTimeout(n)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(n=>{window.clearInterval(n)}),this.tasks.interval.clear()}};var C=g("three"),ze=g("three/examples/jsm/controls/MapControls");function ke(){let o=new C.Scene;return o.background=new C.Color(16777215),o}function Ve(){let o=new C.WebGLRenderer({antialias:!0});return o.autoClear=!0,o.setClearAlpha(1),o.setClearColor(16777215),o.setPixelRatio(window.devicePixelRatio),o.shadowMap.enabled=!0,o.shadowMap.autoUpdate=!0,o.shadowMap.type=C.PCFSoftShadowMap,o}function He(o,n){let t=new C.OrthographicCamera(-o/2,o/2,n/2,-n/2,-1e3,5e3);return t.up.set(0,0,1),t.position.set(0,0,100),t.lookAt(0,0,0),t}function We(){let o=new C.Group,n=new C.AmbientLight(16777215,2.6);return o.add(n),o}function Xe(o,n){let t=new ze.MapControls(o,n);return t.enableDamping=!1,t.zoomSpeed=2,t}function rt(o,n=[]){let t=new C.Shape(o.map(e=>new C.Vector2(...e)));return n.length&&n.forEach(e=>{var i=new C.Path(e.map(r=>new C.Vector2(...r)));t.holes.push(i)}),t}function qe(o=16777215,n=1){let t=new C.DirectionalLight(o,n);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function J(o,n){if(n&&o.children&&o.children.length&&o.children.forEach(t=>{J(t,n)}),o.isMesh){let t=o;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(e=>{e.dispose()}):t.material.dispose())}o.isLight&&o.dispose?.()}function je(o){return/[\u4E00-\u9FA5]+/g.test(o)}var j=g("three"),bt=new Map,Rt=new Map,Ti=new j.TextureLoader;function Ci(){let o=document.createElement("canvas");o.width=1024,o.height=64;let n=o.getContext("2d",{willReadFrequently:!0});return n.font="54px sans-serif",n.textBaseline="hanging",n.lineWidth=12,n.fillStyle="rgba(0,0,0,1)",n.strokeStyle="white",{canvas:o,ctx:n}}var we,gt;function Pi(){if(!we){let{canvas:o,ctx:n}=Ci();we=o,gt=n}}function Ye(o){if(Rt.has(o))return Rt.get(o);Pi(),gt.clearRect(0,0,1024,64);let n=je(o)?4:8;gt.strokeText(o,2,n),gt.fillText(o,2,n);let t=Math.ceil(gt.measureText(o).width);t=t%2===0?t:t+1,t+=2;let e=gt.getImageData(0,0,t,64),i=new j.DataTexture(Uint8Array.from(e.data),t,64,j.RGBAFormat);return i.flipY=!0,i.minFilter=j.LinearFilter,i.magFilter=j.LinearFilter,Rt.set(o,i),i}function $e(){Rt.forEach((o,n)=>{o.dispose()}),bt.forEach(o=>{o instanceof Promise?o.then(n=>n.dispose()):o.dispose()}),Rt.clear(),bt.clear()}function Ke(){gt=null,we=null}async function Ze(o){if(bt.has(o))return bt.get(o);let n=Ti.loadAsync(o);return n.then(t=>{t.format=j.RGBAFormat,t.magFilter=j.LinearFilter,t.minFilter=j.LinearFilter,t.colorSpace="srgb",bt.set(o,t)}),bt.set(o,n),n}var L=g("three"),Mt=g("@turf/turf");function E(o,n,t,e){let i=o.clone().project(n),r=t/2,s=e/2,a=Math.round(i.x*r+r),u=Math.round(-i.y*s+s);return{x:a,y:u}}function Bt(o){let n=(0,Mt.featureCollection)(o.map(e=>(0,Mt.point)(e)));return(0,Mt.center)(n).geometry.coordinates}function Gt(o,n,t){return o.x>=n.x&&o.x<=t.x&&o.y>=n.y&&o.y<=t.y}function ar(o){let n=0,t=new L.Vector3;for(let e=1;e<o.length;e++){let i=new L.Vector3(o[e-1][0],o[e-1][1],0),r=new L.Vector3(o[e][0],o[e][1],0),s=r.distanceTo(i);s>n&&(n=s,t=r.clone().sub(i).normalize())}return t}function R(o,n){return Math.sqrt((n[0]-o[0])**2+(n[1]-o[1])**2)}function ut(o){let n=0;for(let t=0;t<o.length-1;t++)n+=R(o[t],o[t+1]);return n}function zt(o,n,t){let e=new L.Vector2(n[0]-o[0],n[1]-o[1]),i=new L.Vector2(n[0]-t[0],n[1]-t[1]),s=e.angleTo(i)*180/Math.PI,a=new L.Vector2(n[0]-o[0],n[1]-o[1]);return new L.Vector2(t[0]-o[0],t[1]-o[1]).cross(a)>0?s:-s}function Je(o,n){let t=Math.min(R(o[0][0],o[0][1]),R(o[0][2],o[0][1]))-1;n||(n=Bt(o[0]));let e=Li(n,t),i=new L.Vector2(o[0][0][0],o[0][0][1]),r=new L.Vector2(o[0][1][0],o[0][1][1]),s=new L.Vector2(o[0][2][0],o[0][2][1]),u=(i.distanceTo(r)>r.distanceTo(s)?r.clone().sub(i):s.clone().sub(r)).angleTo(new L.Vector2(0,1)),l=new L.Matrix3;return l.multiply(new L.Matrix3().translate(n[0],n[1])).multiply(new L.Matrix3().rotate(u)).multiply(new L.Matrix3().translate(-n[0],-n[1])),[e.map(c=>{let p=new L.Vector2(c[0],c[1]).applyMatrix3(l);return[p.x,p.y]})]}function Li(o,n){let t=n/2;return[[o[0]-t,o[1]+t],[o[0]+t,o[1]+t],[o[0]+t,o[1]-t],[o[0]-t,o[1]-t],[o[0]-t,o[1]+t]]}function St(o,n){return new Proxy(o,{get:(t,e,i)=>Reflect.get(t,e,i),set:(t,e,i,r)=>{let s=Reflect.get(t,e,r),a=Reflect.set(t,e,i,r);return s!==i&&n.dispatchEvent({type:`change-${e}`,value:i}),a}})}function mt(o,n){return Promise.race([o,new Promise((t,e)=>{setTimeout(()=>e(new Error("Promise timeout")),n)})])}function kt(o){return document.createElementNS("http://www.w3.org/2000/svg",o)}function Qe(o,n){let t=kt("svg");return t.setAttribute("width",o),t.setAttribute("height",n),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function It(o="2",n){let t=kt("circle");return t.setAttribute("r",o),t.setAttribute("fill",n),t}function Vt(o){let n=kt("line");return n.setAttribute("stroke",o),n}function wt(o,n){let t=kt("rect");return t.setAttribute("stroke",o),t.setAttribute("fill",n),t}function yt(o,n,t){o.setAttribute("cx",`${n}`),o.setAttribute("cy",`${t}`)}function Q(o,n,t){n&&(o.setAttribute("x1",`${n.x}`),o.setAttribute("y1",`${n.y}`)),t&&(o.setAttribute("x2",`${t.x}`),o.setAttribute("y2",`${t.y}`))}function tt(o,n,t,e,i){o.setAttribute("x",`${n}`),o.setAttribute("y",`${t}`),o.setAttribute("width",`${e}`),o.setAttribute("height",`${i}`)}function tn(){return Promise.resolve()}function pr(){return new Promise(o=>{requestAnimationFrame(o)})}function dr(o){return parseInt(o.replace("#","0x"),16)}function gr(o,n){let t=parseInt(o.substring(1,3),16),e=parseInt(o.substring(3,5),16),i=parseInt(o.substring(5,7),16),r=Math.round(t*n),s=Math.round(e*n),a=Math.round(i*n);return`#${(1<<24|r<<16|s<<8|a).toString(16).slice(1)}`}function ct(o,n=.85){let t,e,i;if(o.startsWith("#"))t=parseInt(o.substring(1,3),16),e=parseInt(o.substring(3,5),16),i=parseInt(o.substring(5,7),16);else{let s=o.slice(4,-1).split(",");t=parseInt(s[0].trim()),e=parseInt(s[1].trim()),i=parseInt(s[2].trim())}return t=Math.min(Math.floor(t*n),255),e=Math.min(Math.floor(e*n),255),i=Math.min(Math.floor(i*n),255),"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)}var en=g("three/examples/jsm/loaders/GLTFLoader");function Ai(){return new en.GLTFLoader}var Ht=null,Wt=new Map;function Xt(o){if(Wt.has(o)){let t=Wt.get(o).then(e=>(e.scene=e.scene.clone(),e))}Ht||(Ht=Ai());let n=new Promise((t,e)=>{Ht.load(o,i=>{t(i)},void 0,e)});return Wt.set(o,n),n.then(t=>(t.scene=t.scene.clone(),t))}function nn(){Ht=null,Wt.clear()}var qt=navigator.userAgent.toUpperCase().indexOf("MAC")>=0;function Te(o){return qt?o==="Meta":o==="Control"}var Ce="__once__",rn=class{events=new Map;on(n,t){if(typeof t!="function")return;let e=this.events.get(n);return e?e.add(t):this.events.set(n,new Set([t]))}once(n,t){if(typeof t!="function")return;let e=`${Ce}${n}`,i=this.events.get(e);return i?i.add(t):this.events.set(e,new Set([t]))}off(n,t){let e=this.events.get(n),i=this.events.get(`${Ce}${n}`);!e&&!i||(t===void 0&&(e?.clear(),i?.clear()),e?.has(t)&&e.delete(t),i?.has(t)&&i.delete(t))}offAll(){this.events.clear()}emit(n,...t){let e=this.events.get(n),i=this.events.get(`${Ce}${n}`);!e&&!i||(e?.forEach(r=>{typeof r=="function"&&r(...t)}),i?.forEach(r=>{typeof r=="function"&&r(...t)}),i?.clear())}};var Nt=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(Nt||{});function et(o){return Object.keys(o).sort().map(n=>`${n}=${o[n]}`).join("&")}function wr(o,n){return new Promise((t,e)=>{let i=new XMLHttpRequest;i.open("GET",o,!0),Object.keys(n.headers||{}).forEach(r=>{i.setRequestHeader(r,n.headers[r])}),n.responseType&&(i.responseType=n.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(n.responseType==="arraybuffer")t(i.response);else try{let r=JSON.parse(i.responseText);t(r)}catch(r){e(r)}else e(i.statusText)},i.onerror=()=>{e(i.statusText)},i.send()})}var Tt=class o{keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}genUniqueKey(){let n=o.createKey();for(;this.keySet.has(n);)n=o.createKey();return n}removeKey(n){this.keySet.delete(n)}dispose(){this.keySet.clear()}};var Ct=g("three"),cn=Se(un(),1);function Ri(o,n){let t=o.clone().normalize(),e=n.clone().normalize();return Math.acos(t.dot(e))}function Ii(o){let n=0;return o.reduce(([t,e],[i,r])=>(n+=Math.sqrt((i-t)**2+(r-e)**2),[i,r])),n/o.length}function hn(o,n=.25){if(Ii(o)<n)return o;let t=(0,cn.default)(o);return hn(t,n)}function pn(o,n=!1,t=!0,e=5,i=150,r=3){let s=[],a=!n;if(s.push(o[0]),o.length<2)return s;for(let l=0;l<o.length-2;l+=1){let c=o[l],p=o[l+1],f=o[l+2],d=new Ct.Vector2(c[0]-p[0],c[1]-p[1]),_=new Ct.Vector2(f[0]-p[0],f[1]-p[1]),v=Ri(d,_)/Math.PI*180,h=d.length()+_.length();(!a||v<i&&h>.01||h>e)&&(s.push(o[l+1]),a=!0)}if(s.push(o[o.length-1]),!t)return s;let u=[];u.push(s[0]);for(let l=0;l<s.length-2;l+=1){let c=new Ct.Vector2(s[l][0],s[l][1]),p=new Ct.Vector2(s[l+1][0],s[l+1][1]),f=new Ct.Vector2(s[l+2][0],s[l+2][1]),d=c.distanceTo(p)/2,_=f.distanceTo(p)/2,v=p.clone(),h=p.clone();v.add(c.clone().sub(p).normalize().multiplyScalar(d>r?r/2:d)),h.add(f.clone().sub(p).normalize().multiplyScalar(_>r?r/2:_));let m=[[v.x,v.y],[p.x,p.y],[h.x,h.y]];u.push(...hn(m,r/25))}return u.push(s[s.length-1]),Ni(u)}function Ni(o){if(o.length<=1)return o;let n=[],t;return o.forEach(([e,i])=>{t?e===t[0]&&i===t[1]||(t=[e,i],n.push([e,i])):(t=[e,i],n.push([e,i]))}),n}function fn(o,n,t){let e=Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2);if(e===0)return{distance:Math.sqrt((o[0]-n[0])**2+(o[1]-n[1])**2),closestPoint:n.slice(0)};let i=Math.max(0,Math.min(1,((o[0]-n[0])*(t[0]-n[0])+(o[1]-n[1])*(t[1]-n[1]))/e**2)),r=[n[0]+i*(t[0]-n[0]),n[1]+i*(t[1]-n[1])];return{distance:Math.sqrt((o[0]-r[0])**2+(o[1]-r[1])**2),closestPoint:r}}function dn(o,n,t){let[e,i]=o,[r,s]=n,a=Math.sqrt(Math.pow(r-e,2)+Math.pow(s-i,2));if(a===0||a<t)return[...n];let u=t/a,l=e+(r-e)*u,c=i+(s-i)*u;return[l,c]}var Di=(l=>(l.START="start",l.END="end",l.FRONT="front",l.RIGHT="right",l.LEFT="left",l.RIGHT_FRONT="right_front",l.LEFT_FRONT="left_front",l.RIGHT_BACK="right_back",l.LEFT_BACK="left_back",l))(Di||{});function Oi(o,n,t){let e=zt(o,n,t);return 180-Math.abs(e)<15?"front":e>135?"right_front":e<-135?"left_front":e<=135&&e>=60?"right":e>=-135&&e<=-60?"left":e<60&&e>0?"right_back":e>-60&&e<0?"left_back":"front"}function Rr(o){let n=[{direction:"start",distance:R(o[0],o[1]),points:[o[0],o[1]]}];for(let t=2;t<o.length;t++){let e=Oi(o[t-2],o[t-1],o[t]);if(e==="front"){let i=n[n.length-1],r=R(o[t-1],o[t]);i.distance+=r,t!==2&&i.points.push(o[t-1])}else n.push({direction:e,distance:R(o[t-1],o[t]),points:[o[t-1],o[t]]})}return n.push({direction:"end",distance:0,points:[o[o.length-1]]}),n}var ot=Se(Ae(),1);var Y="___",Ln=class{constructor(n=3){this.lift_priority=n}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new ot.default;escalatorRoute=new ot.default;straightLadderRoute=new ot.default;initRoute(n){this.clear(),this.roadInfo=n,n.length&&(n.forEach(t=>{t.points.forEach(e=>{let i=`${t.floor}${Y}${e.id}`;if(this.pointMap.set(i,e),this.nodeMap.set(`${e.floor}${Y}${e.nodeId}`,i),e.type==="straightLadder"){let r=this.straightLadderMap.get(e.name)||[];r.push({...e}),this.straightLadderMap.set(e.name,r)}if(e.type==="staircase"){let r=this.staircaseMap.get(e.name)||[];r.push({...e}),this.staircaseMap.set(e.name,r)}if(e.type==="escalator"){let r=this.escalatorMap.get(e.name)||{};e.escalatorDirection==="exit"?r.end={floor:e.floor,id:e.id}:r.start={floor:e.floor,id:e.id},this.escalatorMap.set(e.name,r)}if(e.type==="facility"){let r=this.facilityMap.get(e.targetId)||[];r.push({...e}),this.facilityMap.set(e.targetId,r)}}),t.lines.filter(e=>e.direction!=="no").forEach(e=>{let i=`${t.floor}${Y}${e.from}`,r=`${t.floor}${Y}${e.to}`,s=this.pointMap.get(i)?.cds,a=this.pointMap.get(r)?.cds;if(s?.length&&a?.length){let u=R(s,a);this.addLineItem(i,r,u),e.direction==="double"&&this.addLineItem(r,i,u)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(n,t,e,i=this.lineMap){let r=i.get(n)||new Map;r.set(t,e),i.set(n,r)}addFacilityToLineMap(n,t,e,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([r,s])=>{if(!(s.length<2))for(let a=0;a<s.length;a++){let u=`${s[a].floor}${Y}${s[a].id}`;for(let l=0;l<s.length;l++)if(a!==l){let c=`${s[l].floor}${Y}${s[l].id}`,p=this.pointMap.get(u)?.cds,f=this.pointMap.get(c)?.cds;if(p?.length&&f?.length)if(s[a].type==="straightLadder"){let d=t;this.addLineItem(u,c,d,i)}else{let d=e;this.addLineItem(u,c,d,i)}}}}),this.escalatorMap.forEach((r,s)=>{if(r.start&&r.end){let a=`${r.start.floor}${Y}${r.start.id}`,u=`${r.end.floor}${Y}${r.end.id}`,l=this.pointMap.get(a)?.cds,c=this.pointMap.get(u)?.cds;if(l?.length&&c?.length){let p=n;this.addLineItem(a,u,p,i)}}})}initBaseRoute(){let n=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,n),this.baseRoute=new ot.default(n)}initEscalatorRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,n),this.escalatorRoute=new ot.default(n)}initStraightLadderRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,n),this.straightLadderRoute=new ot.default(n)}checkStart(n){return!(!n.floor||!n.nodeId&&(!n.coord||n.coord.length<2))}checkEnd(n){return n.facility?!0:this.checkStart(n)}transformStart(n){if(n.nodeId){let t=this.nodeMap.get(`${n.floor}${Y}${n.nodeId}`);if(t){let[e,i]=t.split(Y);return{floor:e,id:i}}}if(n.coord?.length){let t=this.roadInfo.find(i=>i.floor===n.floor);if(!t)return null;let e=t.points.reduce((i,r)=>{let s=R(n.coord,r.cds);return s<i.min&&(i.min=s,i.point=r),i},{min:1/0,point:t.points[0]});return{floor:e.point.floor,id:e.point.id}}return null}transformEnd(n){if(n.floor){let t=this.transformStart(n);if(t)return t}return n.facility&&this.facilityMap.get(n.facility)?.length?{floor:n.floor,facility:n.facility}:null}getPath(n,t,e=""){if(!this.checkStart(n))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(n);if(!i)return"no-start";let r=this.transformEnd(t);if(!r)return"no-end";let s=this.getBasePath.bind(this);switch(e){case"escalator":s=this.getEscalatorPath.bind(this);case"straightLadder":s=this.getStraightLadderPath.bind(this);default:s=this.getBasePath.bind(this)}if(console.log(i,r),r.id)return s(i,r);if(r.facility){let a=this.facilityMap.get(r.facility).filter(l=>r.floor?l.floor===r.floor:!0);if(!a.length)return null;let u=a.map(l=>s(i,{floor:l.floor,id:l.id})).filter(l=>!!l);return u.reduce((l,c)=>{let p=c.reduce((f,d)=>f+ut(d.points),0);return p<l.distance&&(l.distance=p,l.path=c),l},{distance:1/0,path:u[0]}).path}}getRoutePath(n,t,e){let i=`${n.floor}${Y}${n.id}`,r=`${t.floor}${Y}${t.id}`,s=e.path(i,r);if(console.log(i,r,s),!s)return null;let a=[];return s.map(u=>{let l=this.pointMap.get(u);if(l){let{floor:c}=l;if(a[a.length-1]?.floor===c){let p=a[a.length-1];p.points.push(l.cds),p.endType=l.type,p.destId=l.nodeId}else a.push({floor:c,points:[l.cds],endType:l.type,destId:l.nodeId})}}),a}getBasePath(n,t){return this.getRoutePath(n,t,this.baseRoute)}getEscalatorPath(n,t){return this.getRoutePath(n,t,this.escalatorRoute)}getStraightLadderPath(n,t){return this.getRoutePath(n,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new ot.default,this.escalatorRoute=new ot.default,this.straightLadderRoute=new ot.default}};var $=Se(Ae(),1);var V="___",An=class{constructor(n=3){this.lift_priority=n}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new $.default;escalatorRoute=new $.default;straightLadderRoute=new $.default;forwardLineMap=new Map;forwardRoute=new $.default;initRoute(n){this.clear(),this.roadInfo=n,n.length&&(n.forEach(t=>{t.points.forEach(e=>{let i=`${t.floor}${V}${e.id}`;if(this.pointMap.set(i,e),this.nodeMap.set(`${e.floor}${V}${e.nodeId}`,i),e.type==="straightLadder"){let r=this.straightLadderMap.get(e.name)||[];r.push({...e}),this.straightLadderMap.set(e.name,r)}if(e.type==="staircase"){let r=this.staircaseMap.get(e.name)||[];r.push({...e}),this.staircaseMap.set(e.name,r)}if(e.type==="escalator"){let r=this.escalatorMap.get(e.name)||{};e.escalatorDirection==="exit"?r.end={floor:e.floor,id:e.id}:r.start={floor:e.floor,id:e.id},this.escalatorMap.set(e.name,r)}if(e.type==="facility"){let r=this.facilityMap.get(e.targetId)||[];r.push({...e}),this.facilityMap.set(e.targetId,r)}e.type==="parkingSpace"&&this.parkingMap.set(`${e.floor}${V}${e.name}`,e)}),t.lines.filter(e=>e.direction!=="no").forEach(e=>{let i=`${t.floor}${V}${e.from}`,r=`${t.floor}${V}${e.to}`,s=this.pointMap.get(i)?.cds,a=this.pointMap.get(r)?.cds;if(s?.length&&a?.length){let u=R(s,a);switch(this.addLineItem(i,r,u),this.addLineItem(r,i,u),e.direction){case"double":this.addLineItem(i,r,u,this.forwardLineMap),this.addLineItem(r,i,u,this.forwardLineMap);break;case"single":this.addLineItem(i,r,u,this.forwardLineMap);break;case"back":this.addLineItem(r,i,u,this.forwardLineMap);break}}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}addLineItem(n,t,e,i=this.lineMap){let r=i.get(n)||new Map;r.set(t,e),i.set(n,r)}addFacilityToLineMap(n,t,e,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([r,s])=>{if(!(s.length<2))for(let a=0;a<s.length;a++){let u=`${s[a].floor}${V}${s[a].id}`;for(let l=0;l<s.length;l++)if(a!==l){let c=`${s[l].floor}${V}${s[l].id}`,p=this.pointMap.get(u)?.cds,f=this.pointMap.get(c)?.cds;if(p?.length&&f?.length)if(s[a].type==="straightLadder"){let d=t;this.addLineItem(u,c,d,i)}else{let d=e;this.addLineItem(u,c,d,i)}}}}),this.escalatorMap.forEach((r,s)=>{if(r.start&&r.end){let a=`${r.start.floor}${V}${r.start.id}`,u=`${r.end.floor}${V}${r.end.id}`,l=this.pointMap.get(a)?.cds,c=this.pointMap.get(u)?.cds;if(l?.length&&c?.length){let p=n;this.addLineItem(a,u,p,i)}}})}initBaseRoute(){let n=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,n),this.baseRoute=new $.default(n)}initEscalatorRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,n),this.escalatorRoute=new $.default(n)}initStraightLadderRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,n),this.straightLadderRoute=new $.default(n)}initForwardRoute(){this.forwardRoute=new $.default(this.forwardLineMap)}checkStart(n){return!(!n.floor||!n.nodeId&&(!n.coord||n.coord.length<2))}checkEnd(n){return n.facility||n.parkingSpace&&n.floor?!0:this.checkStart(n)}transformStart(n){if(n.nodeId){let t=this.nodeMap.get(`${n.floor}${V}${n.nodeId}`);if(t){let[e,i]=t.split(V);return{floor:e,id:i}}}if(n.coord?.length){let t=this.roadInfo.find(i=>i.floor===n.floor);if(!t)return null;let e=t.points.reduce((i,r)=>{let s=R(n.coord,r.cds);return s<i.min&&(i.min=s,i.point=r),i},{min:1/0,point:t.points[0]});return{floor:e.point.floor,id:e.point.id}}return null}transformEnd(n){if(n.floor){if(n.parkingSpace){let e=this.parkingMap.get(`${n.floor}${V}${n.parkingSpace}`);if(e)return{floor:e.floor,id:e.id}}let t=this.transformStart(n);if(t)return t}return n.facility&&this.facilityMap.get(n.facility)?.length?{floor:n.floor,facility:n.facility}:null}getPath(n,t,e=""){if(!this.checkStart(n))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(n);if(!i)return"no-start";let r=this.transformEnd(t);if(!r)return"no-end";let s=this.getBasePath.bind(this);switch(e){case"escalator":s=this.getEscalatorPath.bind(this);case"straightLadder":s=this.getStraightLadderPath.bind(this);case"forward":s=this.getForwardPath.bind(this);default:s=this.getBasePath.bind(this)}if(r.id)return s(i,r);if(r.facility){let a=this.facilityMap.get(r.facility).filter(l=>r.floor?l.floor===r.floor:!0);if(!a.length)return null;let u=a.map(l=>s(i,{floor:l.floor,id:l.id})).filter(l=>!!l);return u.reduce((l,c)=>{let p=c.reduce((f,d)=>f+ut(d.points),0);return p<l.distance&&(l.distance=p,l.path=c),l},{distance:1/0,path:u[0]}).path}}getRoutePath(n,t,e){let i=`${n.floor}${V}${n.id}`,r=`${t.floor}${V}${t.id}`,s=e.path(i,r);if(!s)return null;let a=[];return s.map(u=>{let l=this.pointMap.get(u);if(l){let{floor:c}=l;if(a[a.length-1]?.floor===c){let p=a[a.length-1];p.points.push(l.cds),p.endType=l.type,p.destId=l.nodeId,p.distance=ut(p.points)}else a.push({floor:c,points:[l.cds],endType:l.type,destId:l.nodeId,distance:0})}}),a}getBasePath(n,t){return this.getRoutePath(n,t,this.baseRoute)}getEscalatorPath(n,t){return this.getRoutePath(n,t,this.escalatorRoute)}getStraightLadderPath(n,t){return this.getRoutePath(n,t,this.straightLadderRoute)}getForwardPath(n,t){return this.getRoutePath(n,t,this.forwardRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new $.default,this.escalatorRoute=new $.default,this.straightLadderRoute=new $.default}};function Rn(o){return o.replace(/[A-Z]/g,n=>"_"+n.toLowerCase()).replace(/^_/,"")}var In=new Tt;function Pt(o,n,t){return new Promise((e,i)=>{let r=In.genUniqueKey(),s=({data:a})=>{a.type===`${n}_result`&&a.key===r&&(In.removeKey(r),self.removeEventListener("message",s),a.error?i(a.error):e(a.data))};o.addEventListener("message",s),o.postMessage({type:n,key:r,data:t})})}function Xr(o){let n={};for(let e in o)e.startsWith("on")&&(n[Rn(e.slice(2))]=o[e]);let t=async({data:e})=>{if(n[e.type])try{let i=await n[e.type](e.data);self.postMessage({type:`${e.type}_result`,key:e.key,data:i})}catch(i){self.postMessage({type:`${e.type}_result`,key:e.key,error:i})}else self.postMessage({type:`${e.type}_result`,key:e.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var w=g("three"),Et=g("@tweenjs/tween.js");var Xn=g("three");var M=g("three");var Re={id:"",height:.1,airHeight:0,area:0,group:"",fillColor:"#EFF4FB",strokeColor:"#ffffff",fillOpacity:1,strokeOpacity:1,strokeWidth:1,doors:[],locked:!1,visible:!0,geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},layerType:"",zIndex:0,stroke:!0,deltaHeight:0,userData:{},gradualColor:[],renderType:"single",colorFactor:.9},G=class extends M.Object3D{constructor(t,e){super();this.context=t;if(this.options=St({...Re,...e},this),this.options.geometry.type==="point"){let[i,r]=this.options.geometry.coords;return this.position.set(i,r,this.options.height+this.options.airHeight),this}this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",({value:i})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",({value:i})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",({value:i})=>{this.dispose(),this.init()}),this.addEventListener("change-strokeColor",({value:i})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",({value:i})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-airHeight",({value:i})=>{this.position.z=i}),this.addEventListener("change-visible",({value:i})=>{this.visible=i}),this.addEventListener("change-stroke",({value:i})=>{if(i){if(this.line)return;this.initLineGeometry(),this.initLineMaterial(),this.createBorder()}else this.line&&(this.remove(this.line),this.lineGeometry?.dispose())}),this.addEventListener("change-renderType",()=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-gradualColor",()=>{this.initMaterial(),this.initMesh()})}geometry;material;mesh;line;lineMaterial;lineGeometry;options;getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new M.Vector3,e=new M.Box3;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new M.Vector3(0,0,0);let t=new M.Box3,e=new M.Vector3;return t.setFromObject(this),t.getSize(e),e}getPosition(){let t=this.getCenter();return t.setZ(t.z+this.options.height/2),t}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initGeometry(){let t=rt(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new M.ExtrudeGeometry(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=this.context.materialFactory.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.height<=.1)return this.material=t,t;let e=this.context.materialFactory.createMeshBasicMaterial({color:ct(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let i=new M.Box3().setFromObject(this),r=t.clone().add(e.clone().multiplyScalar(1e3)),s=new M.Ray(r,e.clone().multiplyScalar(-1)),a=new M.Vector3;s.intersectBox(i,a);let u=t.clone().add(e.clone().multiplyScalar(-1e3)),l=new M.Ray(u,e.clone()),c=new M.Vector3;return l.intersectBox(i,c),{max:c,min:a}}initGradualMaterial(){let{max:t,min:e}=new M.Box3().setFromObject(this),i=t.clone().sub(e),r=Math.max(i.x,i.y,i.z)/2,s=this.getPosition(),a=new M.Vector3(-1,.2,0).normalize(),{max:u,min:l}=this.getMaxAndMin(s,a),c=this.context.materialFactory.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:r,opacity:this.options.fillOpacity,direction:new M.Vector3(-1,.2,0),max:u,min:l});if(this.options.height<=.1)return this.material=c,c;let p=this.getCenter(),f=new M.Vector3(-1,.2,1).normalize(),{max:d,min:_}=this.getMaxAndMin(p,f),v=this.context.materialFactory.createShaderMaterial({gradualColor:[ct(this.options.gradualColor[0],this.options.colorFactor),ct(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:r,opacity:this.options.fillOpacity,direction:new M.Vector3(-1,.2,1),max:d,min:_});return this.material=[c,v],[c,v]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){let t=this.context.materialFactory.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new M.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options.height+this.options.deltaHeight,{coords:i}=this.options.geometry;for(let r=0;r<i.length;r++){let s=i[r];for(let a=0;a<s.length;a++){let u=s[a],l=a+1===s.length?s[0]:s[a+1];t.push(new M.Vector3(u[0],u[1],e)),t.push(new M.Vector3(l[0],l[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new M.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new M.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=this.options.airHeight+.01,this.line=t,this.add(t),t}raycast(t){if(!this.visible||this.options.geometry.type==="point")return!1;this.mesh.updateMatrixWorld(!0);let e=t.intersectObject(this.mesh);if(e[0]){let{point:i,distance:r}=e[0];return{position:i,distance:r}}return!1}dispose(){this.geometry?.dispose(),this.line?.geometry.dispose(),this.clear()}};var K=g("three");var jt=class extends K.Object3D{directionalLight;plane;basicOpacity=.07;constructor(){super(),this.directionalLight=this.initLight(),this.initPlane()}initLight(){let n=qe(16777215,.5);return n.position.set(0,0,100),this.add(n),n}changeLightCamera(n){let t=n.x,e=n.y;this.directionalLight.shadow.camera.left=-t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.top=e,this.directionalLight.shadow.camera.bottom=-e,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(t,e)}changeLightColor(n){this.directionalLight.color=new K.Color(n)}setPosition(n){this.position.copy(n),this.directionalLight.position.set(-n.x/2,-n.y/2,100)}initPlane(n=1e3,t=1e3){let e=new K.PlaneGeometry(n,t),i=new K.ShadowMaterial({transparent:!0,opacity:0,side:K.DoubleSide}),r=new K.Mesh(e,i);return r.receiveShadow=!0,r.position.z=-10,this.add(r),this.plane=r,r}setTarget(n){this.directionalLight.target=n}transformOpacity(n){return n*this.basicOpacity}setOpacity(n){this.plane.material.opacity=this.transformOpacity(n)}dispose(){J(this,!0)}};var $t=g("three");var T=g("three");var Nn=g("lodash");var Gi={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},Yt=class extends T.EventDispatcher{constructor(t,e={}){super();this.context=t;this.options={...Gi,...e},this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}div;element;position=new T.Vector3;clientPos={x:0,y:0};visible=!0;options;placement="top";observer=null;initObserver(){let t=new MutationObserver((0,Nn.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){if(this.element instanceof G&&this.element.options.geometry.type==="polygon"){let{max:r,min:s}=new T.Box3().setFromObject(this.element),a=(r.x+s.x)/2,u=(r.y+s.y)/2;return{left:new T.Vector3(s.x,u,r.z),leftTop:new T.Vector3(s.x,r.y,r.z),top:new T.Vector3(a,r.y,r.z),rightTop:new T.Vector3(r.x,r.y,r.z),right:new T.Vector3(r.x,u,r.z),rightBottom:new T.Vector3(r.x,s.y,r.z),bottom:new T.Vector3(a,s.y,r.z),leftBottom:new T.Vector3(s.x,s.y,r.z),center:new T.Vector3(a,u,r.z)}}let{x:t,y:e,z:i}=this.element?.getPosition?.()||this.position;return{left:new T.Vector3(t,e,i),leftTop:new T.Vector3(t,e,i),top:new T.Vector3(t,e,i),rightTop:new T.Vector3(t,e,i),right:new T.Vector3(t,e,i),rightBottom:new T.Vector3(t,e,i),bottom:new T.Vector3(t,e,i),leftBottom:new T.Vector3(t,e,i),center:new T.Vector3(t,e,i)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,i=this.getPlacementPosition();return Object.keys(i).reduce((r,s)=>{let{x:a,y:u}=E(i[s],this.context.camera,t,e);return r[s]={x:a,y:u},r},{})}checkOverflow(t,e){let{width:i,height:r}=this.context.clientSize;return e.x>0&&t.x<i&&e.y<r&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,i=this.getPlacementScreenPosition(),r=t/2,s=e/2,a=[{type:"center",getBox(u,l){return{max:{x:r+u,y:l-e},min:{x:u-r,y:l}}}},{type:"left",getBox(u,l){return{max:{x:u,y:l-s},min:{x:u-t,y:l+s}}}},{type:"leftTop",getBox(u,l){return{max:{x:u,y:l-e},min:{x:u-t,y:l}}}},{type:"top",getBox(u,l){return{max:{x:u+r,y:l-e},min:{x:u-r,y:l}}}},{type:"rightTop",getBox(u,l){return{max:{x:u+t,y:l-e},min:{x:u,y:l}}}},{type:"right",getBox(u,l){return{max:{x:u+t,y:l-s},min:{x:u,y:l+s}}}},{type:"rightBottom",getBox(u,l){return{max:{x:u+t,y:l},min:{x:u,y:l+e}}}},{type:"bottom",getBox(u,l){return{max:{x:u+r,y:l},min:{x:u-r,y:l+e}}}},{type:"leftBottom",getBox(u,l){return{max:{x:u,y:l},min:{x:u-t,y:l+s}}}}];for(let u=0;u<a.length;u++){let l=a[u],c=i[l.type],{max:p,min:f}=l.getBox(c.x,c.y);if(this.checkOverflow(p,f))return{type:l.type,position:c}}return{type:"center",position:i.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className=`overlay_${t.type}`,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,e="block"){t!==this.visible&&(this.div.style.display=t?e:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=`${t}`}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new T.Box3().setFromObject(this.element).getCenter(new T.Vector3):this.position}get withinDisplayRange(){let{x:t,y:e}=this.clientPos,{width:i,height:r}=this.context.clientSize;return t>=0&&t<=i&&e>=0&&e<=r}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:i,height:r,x:s,y:a}=this.context.clientSize;this.options.appendToBody&&(this.div.style.left=`${s}px`,this.div.style.top=`${a+r}px`),this.options.autoUpdate?this.div.style.transform=`translate3d(${t}px, ${-r+e}px, 0)`:this.dispatchEvent({type:"update-position",x:t,y:e,width:i,height:r})}updatePosition(t=!1){let e=this.getPosition(),{width:i,height:r}=this.context.clientSize,{x:s,y:a}=E(e,this.context.camera,i,r);this.clientPos.x===s&&this.clientPos.y===a&&!t||this._updatePosition(s,a)}onUpdate=()=>{this.options.autoChangePlacement?this.usePlacement():this.updatePosition()};registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.unRegistryEvent(),this.unBindElement(),this.observer?.disconnect(),this.div?.remove(),this.div=null}};var zi={texts:[{text:""}],level:1,icon_position:"bottom",collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},icon_opacity:1,icon_border:{color:"#586EE0",width:0},background:"",collision_hide_icon:!0,built_in:!1,box_only_icon:!1},_t=class extends $t.EventDispatcher{constructor(t,e){super();this.context=t;this.options=St({...zi,...e},this),this.position.set(e.position?.x||0,e.position?.y||0,e.position?.z||0),this.overlay=new Yt(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",({x:i,y:r,height:s})=>{this.overlay.div.style.transform=`translate3d(calc(${i}px - 50%), calc(${-s+r}px - ${this.options.icon&&this.options.icon_position!=="center"?"100%":"50%"}), 0)`}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",({value:i})=>{i?this.img?this.img.setAttribute("src",i):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",({value:i})=>{let r=this.textDiv;if(r){let s=this.initText();this.div.replaceChild(s,r)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",({value:i})=>{this.overlay.setOpacity(i)}),this.addEventListener("change-icon_size",({value:i})=>{this.img&&(this.img.style.width=`${i?.[0]||32}px`,this.img.style.height=`${i?.[1]||32}px`,this.resetSize())}),this.addEventListener("change-icon_opacity",({value:i})=>{this.img&&(this.img.style.opacity=`${i}`)}),this.addEventListener("change-icon_border",({value:i})=>{this.img&&(this.img.style.border=`${i.width}px solid ${i.color}`)}),this.addEventListener("change-background",({value:i})=>{this.div.style.background=i})}div;textDiv;img;overlay;options;visible=!0;size={width:0,height:0};position=new $t.Vector3;userData={};showTextStatus=!0;disposed=!1;get withinDisplayRange(){return this.overlay.withinDisplayRange}async resetSize(){if(await tn(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:e}=this.img.getBoundingClientRect();this.size={width:t+2,height:e+2}}else{let{width:t,height:e}=this.div.getBoundingClientRect();this.size={width:t+2,height:e+2}}}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(e=>{let i=document.createElement("div");if(i.style.whiteSpace="nowrap",e.styles)for(let[r,s]of Object.entries(e.styles))i.style[r]=s;i.textContent=e.text,t.appendChild(i)}),t}initIcon(){let t=document.createElement("img");return t.setAttribute("src",this.options.icon),t.style.width=`${this.options.icon_size?.[0]||32}px`,t.style.height=`${this.options.icon_size?.[1]||32}px`,t.style.opacity=`${this.options.icon_opacity}px`,t.style.borderRadius="50%",this.options.icon_border.width&&(t.style.border=`${this.options.icon_border.width}px solid ${this.options.icon_border.color}`),t.onload=()=>{this.resetSize()},this.img=t,t}_changePosition=()=>{this.overlay.updatePosition(!0)};registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t=this.context.config.poi.boxScale){let{width:e,height:i}=this.size,r=e*t,s=i*t,{x:a,y:u}=this.overlay.clientPos;return{left:a-r/2,right:a+r/2,top:this.options.icon?u-s:u-s/2,bottom:this.options.icon?u:u+s/2}}getOriginBox(){return this.getBox(1)}isContain(t,e){if(!this.overlay.visible||!this.visible)return!1;let i=this.getOriginBox();return t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}};var k=g("three");var F=g("three"),Dn=g("@mars3d/heatmap.js"),ht=g("@turf/turf"),Kt=class extends F.Object3D{constructor(t){super();this.context=t;this.div=document.createElement("div")}heatmap;div;plane;clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){this.clearHeatmap();let{width:e,height:i,leftTop:r,center:s}=this.getBox(t);this.heatmap=(0,Dn.create)({width:e,height:i,container:this.div,...this.context.config.heatMap}),this.heatmap.setData(this.transformData(t,r)),this.initPlane(e,i),this.position.set(s[0],s[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let i=new F.PlaneGeometry(t,e),r=new F.Texture(this.div.firstChild);r.needsUpdate=!0;let s=new F.MeshBasicMaterial({transparent:!0,side:F.DoubleSide,map:r});s.needsUpdate=!0,this.plane=new F.Mesh(i,s),this.add(this.plane)}getTransMatrix({x:t,y:e}){return new F.Matrix3().makeScale(1,-1).multiply(new F.Matrix3().makeTranslation(0-t,0-e))}transformData(t,e){let i=this.getTransMatrix(e);return{data:t.data.map(s=>{let a=new F.Vector2(s.x,s.y).applyMatrix3(i);return{x:a.x,y:a.y,value:s.value}}),max:t.max,min:t.min}}getBox(t){let e=(0,ht.featureCollection)(t.data.map(l=>(0,ht.point)([l.x,l.y]))),i=(0,ht.bbox)(e),r=i[2]-i[0],s=i[3]-i[1],a={x:i[0],y:i[3]},u=(0,ht.center)(e);return{width:r,height:s,leftTop:a,center:u.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}};var Jt=g("three");var Zt=class extends Jt.Object3D{constructor(t,e){super();this.context=t;this.options=e;this.position.copy(e.position||new Jt.Vector3(0,0,0)),this.loadModel()}model=null;async loadModel(){let t=await Xt(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t}dispose(){J(this),this.model=null}};var te=g("three");var On=g("three");var z=class extends On.Object3D{constructor(t){super();this.context=t}dispose(){J(this),this.children.forEach(t=>t.dispose?.()),this.clear()}};var Qt=class extends z{graphicMap=new Map;constructor(n){super(n)}getCenter(){return new te.Box3().setFromObject(this).getCenter(new te.Vector3)}createGraphic(n){let t=new G(this.context,n);return this.add(t),this.graphicMap.set(n.id,t),t}removeGraphic(n){this.remove(n),this.graphicMap.delete(n.options.id),n.dispose()}removeGraphicById(n){this.graphicMap.has(n)&&this.removeGraphic(this.graphicMap.get(n))}getGraphicByNodeId(n){return this.graphicMap.get(n)||null}getGraphicByRaycaster(n){let t={distance:1e4,graphic:null,position:null},e=this.children.reduce((i,r)=>{if(r instanceof G){let s=r.raycast(n);if(s){let{distance:a}=s;if(a<i.distance)return{distance:s.distance,position:s.position,graphic:r}}return i}else return i},t);return e===t?{graphics:[],position:null}:{graphics:[e.graphic],position:e.position}}};var Fn=g("lodash");var Lt=class extends z{pois=[];debounceCollisionDetection;timer=new q;constructor(n){super(n),this.registryEvent(),this.debounceCollisionDetection=(0,Fn.debounce)(this.collisionDetection,10)}clear(n=!1){return this.pois.forEach(t=>{t.options.built_in&&!n||t.dispose()}),this.pois=n?[]:this.pois.filter(t=>t.options.built_in),this}createPoi(n){let t=new _t(this.context,n);return this.pushPoi(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),t}changePoiLevelOrCollisionEnable(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),this.pushPoi(n))}removePoi(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),n.dispose())}removePoiById(n){let t=this.pois.find(e=>e.options.id===n);t&&this.removePoi(t)}getPoiById(n){return this.pois.find(e=>e.options.id===n)||null}pushPoi(n){if(!n.options.collision_enable){this.pois.unshift(n);return}if(n.options.level===0){this.pois.push(n);return}for(let t=0;t<this.pois.length;t++){let e=this.pois[t];if(e.options.collision_enable&&e.options.level<=n.options.level){this.pois.splice(t,0,n);return}}this.pois.push(n)}getPoiByDeviceXy(n,t){return this.pois.filter(i=>i instanceof _t&&i.isContain(n,t))}onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let n=[];this.pois.filter(e=>e.visible&&e.withinDisplayRange).forEach((e,i)=>{let{left:r,right:s,top:a,bottom:u}=e.getBox();if(i===0||!e.options.collision_enable){n.push({left:r,right:s,top:a,bottom:u}),e.parentSetVisible(!0);return}let l=n.some(c=>c.left<s&&c.right>r&&c.top<u&&c.bottom>a);e.parentSetVisible(!l),l||n.push({left:r,right:s,top:a,bottom:u})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(n=>n.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var Un=g("lodash");var ne=g("three"),ee=class extends z{pois=[];debounceCollisionDetection;timer=new q;constructor(n){super(n),this.registryEvent(),this.debounceCollisionDetection=(0,Un.debounce)(this.collisionDetection,10)}clear(){return this.pois.forEach(n=>{n.dispose()}),this.pois=[],this}createPoi(n){let t=new H(this.context,n);return this.pushPoi(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),t}changePoiLevelOrCollisionEnable(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),this.pushPoi(n))}removePoi(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.remove(n),this.pois.splice(t,1),n.dispose())}removePoiById(n){let t=this.pois.find(e=>e.options.id===n);t&&this.removePoi(t)}getPoiById(n){return this.pois.find(e=>e.options.id===n)||null}pushPoi(n){if(this.add(n),!n.options.collision_enable){this.pois.unshift(n);return}if(n.options.level===0){this.pois.push(n);return}for(let t=0;t<this.pois.length;t++){let e=this.pois[t];if(e.options.collision_enable&&e.options.level<=n.options.level){this.pois.splice(t,0,n);return}}this.pois.push(n)}getPoiByDeviceXy(n,t){let e=new ne.Vector2(n,t);return this.pois.filter(r=>r instanceof H&&r.box.containsPoint(e))}onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let n=[],{camera:t}=this.context;t.updateMatrixWorld();let e=s=>s<=1&&s>=-1,i=t.projectionMatrix.clone();i.multiply(t.matrixWorldInverse),this.pois.filter(s=>{if(s.visible){let a=new ne.Vector3().setFromMatrixPosition(s.matrixWorld);return a.applyMatrix4(i),s.screenPosition=a,e(a.x)&&e(a.y)&&e(a.z)}return!1}).forEach((s,a)=>{let u=s.getBox(s.screenPosition);if(a===0||!s.options.collision_enable){n.push(u),s.parentSetVisible(!0);return}let l=n.some(c=>c.intersectsBox(u));s.parentSetVisible(!l),l||n.push(u)})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(n=>n.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var pt=class extends k.Object3D{constructor(t){super();this.context=t;this.groundLayer=new z(this.context),this.graphicLayer=new Qt(this.context),this.poiLayer=new Lt(this.context),this.poiLayer2=new ee(this.context),this.wallLayer=new z(this.context),this.textureLayer=new z(this.context),this.glbModelLayer=new z(this.context),this.laneLayer=new z(this.context),this.mergeGraphicLayer=new z(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}graphicLayer;poiLayer;poiLayer2;wallLayer;textureLayer;glbModelLayer;laneLayer;mergeGraphicLayer;grounds=new Set;groundLayer;shadow=new jt;heatmap;groundUpper=new k.Object3D;models=new k.Object3D;modelMap=new Map;groundMaxHeight=0;name="";key="";box=new k.Box3;getPosition(){return new k.Box3().setFromObject(this).getCenter(new k.Vector3)}createGround(t){let e=new G(this.context,t);this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(e.mesh.castShadow=!0,this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new k.Box3().setFromObject(this).getCenter(new k.Vector3)}addModel(t){let e=new Zt(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new k.Box3().setFromObject(this.groundUpper),e=t.getCenter(new k.Vector3),i=t.getSize(new k.Vector3);this.shadow.setPosition(e),this.shadow.changeLightCamera(i)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addHeatmap(t){this.heatmap||(this.heatmap=new Kt(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let e=new k.Box3().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(e.max.z),this.heatmap}removeHeatMap(){this.heatmap&&(this.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=void 0)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}updateBox(){this.box.setFromObject(this)}dispose(){this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.grounds.forEach(t=>t.dispose()),this.heatmap?.dispose(),this.groundUpper.clear(),this.models.children.forEach(t=>t.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}};var ie=g("three");var st=class extends ie.EventDispatcher{constructor(t){super();this.context=t;this.svg=Qe(`${t.container.clientWidth}`,`${t.container.clientHeight}`),t.container.appendChild(this.svg),this._registryEvent()}points=[];svg;enable=!0;_onResize=({width:t,height:e})=>{this.svg&&(this.svg.setAttribute("width",`${t}`),this.svg.setAttribute("height",`${e}`))};_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:i}=this.context,{offsetX:r,offsetY:s}=t,{clientWidth:a,clientHeight:u}=i.domElement,l=r/a*2-1,c=1-s/u*2;return new ie.Vector3(l,c,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:i}=this.context;return E(t,e,i.clientWidth,i.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}};var re=class extends st{constructor(t){super(t);this.context=t;let{config:{svg:{circle:e,line:i}}}=t;this.circles=[It(e.radius,e.fill),It(e.radius,e.fill)],this.line=Vt(i.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}circles;line;setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{if(this.points[0]){let t=this.getSvgCoordinate(this.points[0]);yt(this.circles[0],t.x,t.y),Q(this.line,t)}if(this.points[1]){let t=this.getSvgCoordinate(this.points[1]);yt(this.circles[1],t.x,t.y),Q(this.line,void 0,t)}};onPointermove=t=>{this.points.length===1&&(this.line.style.display="block",Q(this.line,void 0,{x:t.offsetX,y:t.offsetY}))};onPointerleave=()=>{this.points[1]||(this.line.style.display="none")};onPointerdown=t=>{if(this.points[1])return;let e=this.getIntersectByPointerEvent(t);if(e){let{offsetX:i,offsetY:r}=t,s=this.circles[this.points.length];yt(s,i,r),this.points.length||Q(this.line,{x:i,y:r},{x:i,y:r}),this.addPoint(e)}};addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:i,y:r}]=this.points;return Math.sqrt((i-t)**2+(r-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}};var oe=class extends st{circles=[];lines=[];isClose=!1;constructor(n){super(n),this.registryEvent()}setEnable(n){super.setEnable(n),n?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(n){this.circles.push(n),this.svg.appendChild(n)}addLine(n){this.lines.push(n),this.svg.appendChild(n)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{this.points.length&&this.points.forEach((n,t)=>{let e=this.getSvgCoordinate(n);this.circles[t]&&yt(this.circles[t],e.x,e.y),t!==0&&Q(this.lines[t-1],void 0,e),this.lines[t]&&Q(this.lines[t],e)})};onPointermove=n=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",Q(this.lastLine,void 0,{x:n.offsetX,y:n.offsetY}))};onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")};onPointerdown=n=>{if(this.isClose)return;let t=this.getIntersectByPointerEvent(n);if(t){let{offsetX:e,offsetY:i}=n;this.checkAdsorb(e,i)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(t);let{circle:{fill:r,radius:s},line:{stroke:a}}=this.context.config.svg;if(!this.isClose){let u=It(s,r);yt(u,e,i),this.addCircle(u)}if(this.lines.length&&Q(this.lastLine,void 0,{x:e,y:i}),!this.isClose){let u=Vt(a);Q(u,{x:e,y:i},{x:e,y:i}),this.addLine(u)}}};checkAdsorb(n,t){if(this.points.length<3)return!1;let e=this.circles[0],i=+e.getAttribute("cx"),r=+e.getAttribute("cy");return Math.sqrt((n-i)**2+(t-r)**2)<=5}addPoint(n){if(this.points.push(n),this.isClose){let t=this.calculatedArea();this.dispatchEvent({type:"area",area:t})}}calculatedArea(){let n=this.points.map(i=>[i.x,i.y]),t=0,e=n.length;for(let i=0;i<e;i++){let r=(i+1)%e;t+=n[i][0]*n[r][1]-n[r][0]*n[i][1]}return Math.abs(t/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}};var Gn=g("three");var Bn=class extends st{constructor(t){super(t);this.context=t;let{config:{svg:{line:e}}}=t;this.rect=wt(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let i=0;i<4;i++)this.cornerRect[i]=wt(e.stroke,"#ffffff"),this.centerRect[i]=wt(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[i]),this.svg.appendChild(this.centerRect[i]);this.registryEvent()}rect;cornerRect=[];centerRect=[];graphic;setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{if(this.graphic){let t=new Gn.Box3().setFromObject(this.graphic),{camera:e,container:{clientWidth:i,clientHeight:r}}=this.context,{min:s,max:a}=t,u=E(s,e,i,r),l=E(a,e,i,r);tt(this.rect,u.x,l.y,Math.abs(l.x-u.x),Math.abs(l.y-u.y));let{x:c,y:p}=u,{x:f,y:d}=l,_=5,v=[{x:c-_,y:d-_},{x:f-_,y:d-_},{x:c-_,y:p-_},{x:f-_,y:p-_}];for(let S=0;S<v.length;S++)tt(this.cornerRect[S],v[S].x,v[S].y,_*2,_*2);let h=4,m=(c+f)/2,x=(p+d)/2,b=[{x:m-h,y:d-h},{x:c-h,y:x-h},{x:f-h,y:x-h},{x:m-h,y:p-h}];for(let S=0;S<b.length;S++)tt(this.centerRect[S],b[S].x,b[S].y,h*2,h*2)}else{tt(this.rect,0,0,0,0);for(let t=0;t<this.cornerRect.length;t++)tt(this.cornerRect[t],0,0,0,0),tt(this.centerRect[t],0,0,0,0)}};selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}};var I=g("three");var Ie=g("three/examples/jsm/utils/BufferGeometryUtils"),se=class extends I.Object3D{constructor(t,e){super();this.context=t;this.options=e;e.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;initGeometry(){let t=this.options.map(e=>{let i=rt(e.geometry.coords[0],e.geometry.coords.slice(1));return new I.ExtrudeGeometry(i,{steps:1,bevelEnabled:!1,depth:e.height,curveSegments:4})});this.geometry=(0,Ie.mergeGeometries)(t),t.forEach(e=>e.dispose())}initMaterial(){let t=`
|
|
2
2
|
varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
|
|
3
3
|
uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
|
|
4
4
|
uniform vec3 uColor;
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
gl_FragColor = vec4(uColor2, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
`,i=-1/0,r=this.geometry.getAttribute("position");if(r)for(let a=0;a<r.count;a++){let u=r.getZ(a);u>i&&(i=u)}let s=new
|
|
27
|
+
`,i=-1/0,r=this.geometry.getAttribute("position");if(r)for(let a=0;a<r.count;a++){let u=r.getZ(a);u>i&&(i=u)}let s=new I.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new I.Color(this.options[0].fillColor)},uColor2:{value:new I.Color(ct(this.options[0].fillColor))},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e});this.material=s}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],i=this.context.materialFactory.createLineMaterial({color:t,opacity:e});return this.lineMaterial=i,i}getBorderPoints(t){let{height:e,deltaHeight:i,geometry:r}=t,s=[],a=e+(i||0),{coords:u}=r;for(let l=0;l<u.length;l++){let c=u[l];for(let p=0;p<c.length;p++){let f=c[p],d=p+1===c.length?c[0]:c[p+1];s.push(new I.Vector3(f[0],f[1],a)),s.push(new I.Vector3(d[0],d[1],a))}}return s}initLineGeometry(){let t=this.options.map(e=>{let i=this.getBorderPoints(e);return new I.BufferGeometry().setFromPoints(i)});this.lineGeometry=(0,Ie.mergeGeometries)(t)}createBorder(){let t=new I.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new I.Mesh(this.geometry,this.material);this.add(t),this.initLineMaterial(),this.initLineGeometry(),this.createBorder()}dispose(){this.geometry?.dispose(),this.material?.dispose(),this.lineGeometry?.dispose(),this.clear()}};var Z=g("three"),zn=g("three/examples/jsm/utils/BufferGeometryUtils"),ki={uuid:"",iconUrl:"",name:"",airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},opacity:1,visible:!0},Dt=class extends Z.Object3D{constructor(t,e){super();this.context=t;this.options=e.map(i=>({...ki,...i})),this.init()}options;mesh;async init(){let t=this.options.map(s=>{let{geometry:a}=s,u=rt(a.coords[0],a.coords.slice(1)),l=new Z.ShapeGeometry(u,4),c=s.height+s.deltaHeight+s.airHeight,p=l.getAttribute("position");for(let d=0;d<p.count;d++)p.setZ(d,c);let f=[0,1,1,1,1,0,0,0];return l.setAttribute("uv",new Z.Float32BufferAttribute(f,2)),l}),e=(0,zn.mergeGeometries)(t,!0);t.forEach(s=>s.dispose());let i=await Promise.all(this.options.map(async s=>{let{iconUrl:a}=s,u=await this.context.textureFactory.getTexture(a);return new Z.MeshBasicMaterial({map:u,alphaTest:.5,side:Z.DoubleSide})})),r=new Z.Mesh(e,i);this.mesh=r,this.position.z+=.004,this.add(r)}dispose(){this.mesh?.geometry.dispose(),(this.mesh?.material).forEach(t=>t.dispose()),this.clear()}};var At=g("three");var Vi={url:"",geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},id:"",width:0,rotate:1,airHeight:1,deltaHeight:0,center_x:0,center_y:0},ae=class extends At.Object3D{constructor(t,e){super();this.context=t;this.options=Object.assign({},Vi,e),this.loadModel()}model=null;options;async loadModel(){let t=await Xt(this.options.url);t.scene.rotation.set(Math.PI/2,0,0);let i=new At.Box3().setFromObject(t.scene).getSize(new At.Vector3),r=Math.max(i.x,i.y),s=this.options.width/r;this.scale.set(s,s,s),this.add(t.scene),this.position.set(this.options.center_x,this.options.center_y,0),this.position.z+=this.options.airHeight+this.options.deltaHeight,this.model=t,this.rotateZ(this.options.rotate)}dispose(){J(this),this.model=null}};var W=g("three");var Ne=g("three/examples/jsm/utils/BufferGeometryUtils"),kn=g("three/examples/jsm/lines/Line2"),Vn=g("three/examples/jsm/lines/LineGeometry"),le=class extends W.Object3D{constructor(t,e){super();this.context=t;this.options=e;e.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;doubleLines=[];initGeometry(){let t=this.options.map(e=>{let i=rt(e.geometry.coords[0].slice(0,-1),e.geometry.coords.slice(1)),r=new W.ShapeGeometry(i,4),s=r.getAttribute("position");for(let a=0;a<s.count;a++)s.setZ(a,e.airHeight+(e.deltaHeight||0));return r});this.geometry=(0,Ne.mergeGeometries)(t),t.forEach(e=>e.dispose())}initMaterial(){let{fillColor:t,fillOpacity:e}=this.options[0],i=this.context.materialFactory.createMeshBasicMaterial({color:t,opacity:e});return this.material=i,i}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],i=this.context.materialFactory.createLineMaterial({color:t,opacity:e});return this.lineMaterial=i,i}getBorderPoints(t){let{deltaHeight:e,geometry:i}=t,r=[],s=e||0,{coords:a}=i;for(let u=0;u<a.length;u++){let l=a[u];for(let c=0;c<l.length;c++){let p=l[c],f=c+1===l.length?l[0]:l[c+1];r.push(new W.Vector3(p[0],p[1],s)),r.push(new W.Vector3(f[0],f[1],s))}}return r}initDoubleLine(){let t=this.options.filter(i=>i.double&&i.geometry.otherCoords?.[1]?.length);if(!t.length)return;let e=t.reduce((i,r)=>{let s=`${r.secondColor}-${r.dashed}`;return i[s]&&i[s].push(r),i[s]||(i[s]=[r]),i},{});this.doubleLines=Object.values(e).map(i=>{let r=this.context.materialFactory.createLine2MaterialMap({color:i[0].secondColor,width:.2,dashed:i[0].dashed});return i.map(s=>{let a=new Vn.LineGeometry,u=s.geometry.otherCoords[1].map(c=>[...c,s.airHeight+(s.deltaHeight||0)]).flat(2);a.setPositions(u);let l=new kn.Line2(a,r);return l.computeLineDistances(),l.position.z+=.001,this.add(l),l})}).flat(2)}initLineGeometry(){let t=this.options.map(e=>{let i=this.getBorderPoints(e);return new W.BufferGeometry().setFromPoints(i)});this.lineGeometry=(0,Ne.mergeGeometries)(t)}createBorder(){let t=new W.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new W.Mesh(this.geometry,this.material);this.add(t),this.initLineMaterial(),this.initLineGeometry(),this.createBorder(),this.initDoubleLine(),this.position.z+=.002+(this.options[0].deltaHeight||0)}dispose(){this.geometry?.dispose(),this.lineGeometry?.dispose(),this.doubleLines.map(t=>t.geometry.dispose()),this.clear()}};var N=g("three");var Hn=g("three/examples/jsm/utils/BufferGeometryUtils"),ue=class extends N.Object3D{constructor(t,e){super();this.context=t;this.options=e.map(i=>({...Re,...i})),this.init()}geometry;material;mesh;line;lineMaterial;lineGeometry;options;init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options[0].deltaHeight,this.initLineMaterial(),this.initLineGeometry(),this.createBorder()}initGeometry(){let t=this.options.map(i=>{let r=rt(i.geometry.coords[0],i.geometry.coords.slice(1));return new N.ExtrudeGeometry(r,{steps:1,bevelEnabled:!1,depth:i.height,curveSegments:4})}),e=(0,Hn.mergeGeometries)(t);return t.forEach(i=>i.dispose()),e}initMaterial(){let t=`
|
|
28
28
|
varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
|
|
29
29
|
uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
|
|
30
30
|
uniform vec3 uColor;
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
gl_FragColor = vec4(uColor2, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
`,i=-1/0,r=this.geometry.getAttribute("position");if(r)for(let a=0;a<r.count;a++){let u=r.getZ(a);u>i&&(i=u)}let s=new R.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new R.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new R.Color(ct(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e});this.material=s}initLineMaterial(){let t=this.context.materialFactory.createLineMaterial({color:this.options[0].strokeColor,opacity:this.options[0].strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new R.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(i=>{let{coords:r}=i.geometry;for(let s=0;s<r.length;s++){let a=r[s];for(let u=0;u<a.length;u++){let l=a[u],c=u+1===a.length?a[0]:a[u+1];t.push(new R.Vector3(l[0],l[1],e)),t.push(new R.Vector3(c[0],c[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new R.BufferGeometry().setFromPoints(t);this.lineGeometry=e}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 O=g("three"),Ui={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},V=class extends O.Object3D{constructor(t,e){super();this.context=t;this.options=Mt({...Ui,...e},this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}options;textAspect=1;spriteText;spriteIcon;box=new O.Box2;boxHelper;get durIconAndText(){return this.options.icon&&this.options.text?2:0}get offset(){return this.options.icon&&this.options.text?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.options.text?this.options.text_font_size*this.textAspect:0}get textHeight(){return this.options.text?this.options.text_font_size:0}get deltaZ(){let{offset:t,iconHeight:e,durIconAndText:i,textHeight:r}=this,s=t*(e+i+r)/this.context.camera.zoom;return s+=.1,s}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",async({value:t})=>{this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),await this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text",({value:t})=>{this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}async initIcon(){if(this.options.icon){let t=await Ke(this.options.icon),e=new O.Sprite(new O.SpriteMaterial({map:t,transparent:!0,alphaTest:.2}));e.renderOrder=1e5,t.needsUpdate=!0,this.add(e),this.spriteIcon=e}}initText(){if(this.options.text){let t=je(this.options.text);this.textAspect=t.image.width/t.image.height;let e=new O.Sprite(new O.SpriteMaterial({map:t,transparent:!0,alphaTest:.2}));e.renderOrder=100001,t.needsUpdate=!0,this.spriteText=e,this.add(e)}}initSize(){let t=0,e=0,{icon:i,text:r}=this.options;i?r?(t=0,e=t*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(t=.5,e=0):r?(e=.5,t=0):(t=0,e=0),this.spriteIcon?.center.set(.5,t),this.spriteText?.center.set(.5,e)}async init(){await this.initIcon(),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}_initScale=({zoom:t})=>{if(this.spriteText){let e=this.textHeight/t;this.spriteText.scale.set(this.textAspect*e,e,.1)}this.spriteIcon&&this.spriteIcon?.scale.set(this.options.icon_size[0]/t,this.options.icon_size[1]/t,.1),this.resetZ()};resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:e,height:i}}=this.context,r=e*(t.x+1)/2,s=i*(-t.y+1)/2;s+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let a=this.iconWidth/2,u=new O.Box2(new O.Vector2(r-a,s-this.iconHeight),new O.Vector2(r+a,s)),l=this.textWidth/2,c=new O.Box2(new O.Vector2(r-l,s-this.textHeight-this.durIconAndText-this.iconHeight),new O.Vector2(r+l,s-this.iconHeight-this.durIconAndText));return this.box=c.union(u),this.box}renderBoxHelper(){if(!this.boxHelper){let t=document.createElement("div");t.style.position="fixed",this.boxHelper=t,t.style.border="1px solid red",t.style.pointerEvents="none",this.context.container.appendChild(t)}this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px"}parentSetVisible(t){this.spriteText&&(this.spriteText.visible=t),this.spriteIcon&&(this.spriteIcon.visible=t),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.unRegistryEvent(),this.spriteText=void 0}};var Vn=g("three"),le=class extends ot{startPoint;endPoint;rect;frustum=new Vn.Frustum;constructor(n){super(n);let{config:{selectBox:{fill:t,stroke:e}}}=n;this.rect=St(e,t),this.svg.appendChild(this.rect),this.registryEvent()}setEnable(n){super.setEnable(n),Q(this.rect,0,0,0,0),n?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}onPointerDown=n=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(n);t&&(this.startPoint=t),this.endPoint=void 0};onPointerMove=n=>{if(!this.enable||!this.startPoint)return;let t=this.getIntersectByPointerEvent(n);t&&(this.endPoint=t)};onPointerUp=n=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(n);t&&(this.endPoint=t),this.doSelect(),this.startPoint=void 0};onUpdate=()=>{if(this.startPoint){let n=this.getSvgCoordinate(this.startPoint),t={...n};this.endPoint&&(t=this.getSvgCoordinate(this.endPoint));let e={x:Math.min(n.x,t.x),y:Math.min(n.y,t.y)},i=Math.abs(t.x-n.x),r=Math.abs(t.y-n.y);Q(this.rect,e.x,e.y,i,r)}else Q(this.rect,0,0,0,0)};registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:t,container:{clientWidth:e,clientHeight:i}}}=this,r=x(this.startPoint,t,e,i),s=x(this.endPoint,t,e,i),a={x:Math.min(r.x,s.x),y:Math.min(r.y,s.y)},u={x:Math.max(r.x,s.x),y:Math.max(r.y,s.y)},l=this.searchMapInFrustum(a,u);this.dispatchEvent({type:"selected",list:l})}}searchMapInFrustum(n,t){let{context:e}=this;return e.currentFloor?.graphicLayer.children.filter(i=>i instanceof B&&this.searchChildInFrustum(i,n,t))||[]}searchChildInFrustum(n,t,e){let{context:{camera:i,container:{clientWidth:r,clientHeight:s}}}=this;if(!n)return!1;if(!n.mesh){let f=n.getPosition();if(f){let d=x(f,i,r,s);return Ft(d,t,e)}return!1}n.mesh.geometry.boundingBox||n.mesh.geometry.computeBoundingBox();let a=n.mesh.geometry.boundingBox;if(!a)return!1;let{min:u,max:l}=a,c=x(u,i,r,s),p=x(l,i,r,s);return!(!Ft(c,t,e)||!Ft(p,t,e))}dispose(){this.unRegistryEvent()}};var ue=class extends Hn.EventDispatcher{constructor(t){super();this.context=t;this.boxSelection=new le(t),this.boxSelection.setEnable(!1),this.registryEvent()}_list=new Set;boxSelection;prevPanStatus;prevRotateStatus;downPoint=null;isMultipleSelect=!1;get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}onPointerDown=t=>{this.downPoint={x:t.offsetX,y:t.offsetY}};onPointerUp=t=>{if(!this.downPoint)return;let{offsetX:e,offsetY:i}=t,{x:r,y:s}=this.downPoint;if(Math.sqrt((r-e)**2+(s-i)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(e,i),u=new Set(a.map(c=>c.options.id));this.context.getPoisByDeviceXy(e,i).forEach(c=>{if(!u.has(c.options.id)){let p=this.context.currentFloor?.graphicLayer.graphicMap.get(c.options.id)||null;p&&p.options.geometry.type==="point"&&(a.push(p),u.add(c.options.id))}}),(Ht?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=>{we(t.key)&&this.enableBoxSelection()};onKeyUp=t=>{we(t.key)&&this.disableBoxSelection()};onBoxSelected=({list:t})=>{this._list.clear(),t.forEach(e=>{this._list.add(e)}),this.selectEnd()};selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}};var he=g("three");var ce=class extends he.EventDispatcher{constructor(t){super();this.context=t;this.registryEvent()}curGraphics=new Set;timer=new X;graphicTimerMap=new Map;onPointerMove=({graphics:t,pois:e,e:i})=>{let r=e.map(l=>this.context.currentFloor?.graphicLayer.graphicMap.get(l.options.id)).filter(l=>l&&l.options.geometry.type==="point");if(!t.length&&!r.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:s}=this.context.config.hover,a=new Set;if(r.length){let l,c=1e4;r.forEach(p=>{let f=e.find(d=>d.options.id===p.options.id);if(f instanceof yt){let{x:d,y:_}=f.clientPos,v=Math.sqrt((d-i.offsetX)**2+(_-i.offsetY)**2);v<c&&(c=v,l=p)}else if(f instanceof V){let{x:d,y:_}=f.box.getCenter(new he.Vector2),v=Math.sqrt((d-i.offsetX)**2+(_-i.offsetY)**2);v<c&&(c=v,l=p)}}),a.add(l)}a.size||t.forEach(l=>a.add(l)),a.forEach(l=>{if(this.graphicTimerMap.get(l)||this.curGraphics.has(l))return;let c=this.timer.setTimeout(()=>{this.curGraphics.add(l),this.graphicTimerMap.delete(l),this.timer.clearTimeout(c),this.handleHoverGraphicsChange()},s);this.graphicTimerMap.set(l,c)}),this.graphicTimerMap.forEach((l,c)=>{a.has(c)||(this.timer.clearTimeout(l),this.graphicTimerMap.delete(c))});let u=this.curGraphics.size;this.curGraphics.forEach(l=>{a.has(l)||this.curGraphics.delete(l)}),u!==this.curGraphics.size&&this.handleHoverGraphicsChange()};onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()};onBodyPointerMove=t=>{if(this.curGraphics.size){let e=this.context.container.getBoundingClientRect();(t.clientX<e.left||t.clientX>e.right||t.clientY<e.top||t.clientY>e.bottom)&&this.onPointerLevel()}};handleHoverGraphicsChange(t=this.curGraphics){this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}};var Xn=g("three/examples/jsm/lines/LineMaterial"),L=g("three");function Wn(o){return`${o.x}-${o.y}-${o.z}`}var pe=class{constructor(n){this.context=n}lineMaterialMap=new Map;meshStandardMaterialMap=new Map;meshBasicMaterialMap=new Map;shaderMaterialMap=new Map;groundTextureMaterialMap=new Map;line2MaterialMap=new Map;generateLineMaterialKey({color:n,opacity:t}){return`${n}-${t}`}createLineMaterial({color:n,opacity:t}){let e=this.generateLineMaterialKey({color:n,opacity:t});if(this.lineMaterialMap.has(e))return this.lineMaterialMap.get(e);let i=new L.LineBasicMaterial({color:new L.Color(n).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(e,i),i}createMeshStandardMaterial({color:n,opacity:t}){let e=`${n}-${t}`;if(this.meshStandardMaterialMap.has(e))return this.meshStandardMaterialMap.get(e);let i=new L.MeshStandardMaterial({color:new L.Color(n).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(e,i),i}createMeshBasicMaterial({color:n,opacity:t}){let e=`${n}-${t}`;if(this.meshBasicMaterialMap.has(e))return this.meshBasicMaterialMap.get(e);let i=new L.MeshBasicMaterial({color:n,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(e,i),i}createShaderMaterial({gradualColor:n,center:t,maxValue:e,opacity:i,direction:r,max:s,min:a}){let u=`${n.toString()}-${Wn(t)}-${e}-${i}-${Wn(r)}`;if(this.shaderMaterialMap.has(u))return this.shaderMaterialMap.get(u);let l=`
|
|
53
|
+
`,i=-1/0,r=this.geometry.getAttribute("position");if(r)for(let a=0;a<r.count;a++){let u=r.getZ(a);u>i&&(i=u)}let s=new N.ShaderMaterial({uniforms:{maxZ:{value:i},uColor:{value:new N.Color(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new N.Color(ct(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e});this.material=s}initLineMaterial(){let t=this.context.materialFactory.createLineMaterial({color:this.options[0].strokeColor,opacity:this.options[0].strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new N.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(i=>{let{coords:r}=i.geometry;for(let s=0;s<r.length;s++){let a=r[s];for(let u=0;u<a.length;u++){let l=a[u],c=u+1===a.length?a[0]:a[u+1];t.push(new N.Vector3(l[0],l[1],e)),t.push(new N.Vector3(c[0],c[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new N.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new N.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){this.geometry.dispose(),this.material.dispose(),this.line?.geometry.dispose(),this.clear()}};var U=g("three"),Hi={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},H=class extends U.Object3D{constructor(t,e){super();this.context=t;this.options=St({...Hi,...e},this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}options;textAspect=1;spriteText;spriteIcon;box=new U.Box2;boxHelper;get durIconAndText(){return this.options.icon&&this.options.text?2:0}get offset(){return this.options.icon&&this.options.text?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.options.text?this.options.text_font_size*this.textAspect:0}get textHeight(){return this.options.text?this.options.text_font_size:0}get deltaZ(){let{offset:t,iconHeight:e,durIconAndText:i,textHeight:r}=this,s=t*(e+i+r)/this.context.camera.zoom;return s+=.1,s}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",async({value:t})=>{this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),await this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text",({value:t})=>{this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}async initIcon(){if(this.options.icon){let t=await Ze(this.options.icon),e=new U.Sprite(new U.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:!1}));e.visible=!1,e.renderOrder=1e5,t.needsUpdate=!0,this.add(e),this.spriteIcon=e}}initText(){if(this.options.text){let t=Ye(this.options.text);this.textAspect=t.image.width/t.image.height;let e=new U.Sprite(new U.SpriteMaterial({map:t,transparent:!0,alphaTest:.2,depthTest:!1}));e.visible=!1,e.renderOrder=100001,t.needsUpdate=!0,this.spriteText=e,this.add(e)}}initSize(){let t=0,e=0,{icon:i,text:r}=this.options;i?r?(t=0,e=t*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(t=.5,e=0):r?(e=.5,t=0):(t=0,e=0),this.spriteIcon?.center.set(.5,t),this.spriteText?.center.set(.5,e)}async init(){await this.initIcon(),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}_initScale=({zoom:t})=>{if(this.spriteText){let e=this.textHeight/t;this.spriteText.scale.set(this.textAspect*e,e,.1)}this.spriteIcon&&this.spriteIcon?.scale.set(this.options.icon_size[0]/t,this.options.icon_size[1]/t,.1),this.resetZ()};resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:e,height:i}}=this.context,r=e*(t.x+1)/2,s=i*(-t.y+1)/2;s+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let a=this.iconWidth/2,u=new U.Box2(new U.Vector2(r-a,s-this.iconHeight),new U.Vector2(r+a,s)),l=this.textWidth/2,c=new U.Box2(new U.Vector2(r-l,s-this.textHeight-this.durIconAndText-this.iconHeight),new U.Vector2(r+l,s-this.iconHeight-this.durIconAndText));return this.box=c.union(u),this.box}renderBoxHelper(){if(!this.boxHelper){let t=document.createElement("div");t.style.position="fixed",this.boxHelper=t,t.style.border="1px solid red",t.style.pointerEvents="none",this.context.container.appendChild(t)}this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px"}parentSetVisible(t){this.spriteText&&(this.spriteText.visible=t),this.spriteIcon&&(this.spriteIcon.visible=t),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.unRegistryEvent(),this.spriteText=void 0}};var Wn=g("three"),ce=class extends st{startPoint;endPoint;rect;frustum=new Wn.Frustum;constructor(n){super(n);let{config:{selectBox:{fill:t,stroke:e}}}=n;this.rect=wt(e,t),this.svg.appendChild(this.rect),this.registryEvent()}setEnable(n){super.setEnable(n),tt(this.rect,0,0,0,0),n?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}onPointerDown=n=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(n);t&&(this.startPoint=t),this.endPoint=void 0};onPointerMove=n=>{if(!this.enable||!this.startPoint)return;let t=this.getIntersectByPointerEvent(n);t&&(this.endPoint=t)};onPointerUp=n=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(n);t&&(this.endPoint=t),this.doSelect(),this.startPoint=void 0};onUpdate=()=>{if(this.startPoint){let n=this.getSvgCoordinate(this.startPoint),t={...n};this.endPoint&&(t=this.getSvgCoordinate(this.endPoint));let e={x:Math.min(n.x,t.x),y:Math.min(n.y,t.y)},i=Math.abs(t.x-n.x),r=Math.abs(t.y-n.y);tt(this.rect,e.x,e.y,i,r)}else tt(this.rect,0,0,0,0)};registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:t,container:{clientWidth:e,clientHeight:i}}}=this,r=E(this.startPoint,t,e,i),s=E(this.endPoint,t,e,i),a={x:Math.min(r.x,s.x),y:Math.min(r.y,s.y)},u={x:Math.max(r.x,s.x),y:Math.max(r.y,s.y)},l=this.searchMapInFrustum(a,u);this.dispatchEvent({type:"selected",list:l})}}searchMapInFrustum(n,t){let{context:e}=this;return e.currentFloor?.graphicLayer.children.filter(i=>i instanceof G&&this.searchChildInFrustum(i,n,t))||[]}searchChildInFrustum(n,t,e){let{context:{camera:i,container:{clientWidth:r,clientHeight:s}}}=this;if(!n)return!1;if(!n.mesh){let f=n.getPosition();if(f){let d=E(f,i,r,s);return Gt(d,t,e)}return!1}n.mesh.geometry.boundingBox||n.mesh.geometry.computeBoundingBox();let a=n.mesh.geometry.boundingBox;if(!a)return!1;let{min:u,max:l}=a,c=E(u,i,r,s),p=E(l,i,r,s);return!(!Gt(c,t,e)||!Gt(p,t,e))}dispose(){this.unRegistryEvent()}};var he=class extends Xn.EventDispatcher{constructor(t){super();this.context=t;this.boxSelection=new ce(t),this.boxSelection.setEnable(!1),this.registryEvent()}_list=new Set;boxSelection;prevPanStatus;prevRotateStatus;downPoint=null;isMultipleSelect=!1;get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}onPointerDown=t=>{this.downPoint={x:t.offsetX,y:t.offsetY}};onPointerUp=t=>{if(!this.downPoint)return;let{offsetX:e,offsetY:i}=t,{x:r,y:s}=this.downPoint;if(Math.sqrt((r-e)**2+(s-i)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(e,i),u=new Set(a.map(c=>c.options.id));this.context.getPoisByDeviceXy(e,i).forEach(c=>{if(!u.has(c.options.id)){let p=this.context.currentFloor?.graphicLayer.graphicMap.get(c.options.id)||null;p&&p.options.geometry.type==="point"&&(a.push(p),u.add(c.options.id))}}),(qt?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=>{Te(t.key)&&this.enableBoxSelection()};onKeyUp=t=>{Te(t.key)&&this.disableBoxSelection()};onBoxSelected=({list:t})=>{this._list.clear(),t.forEach(e=>{this._list.add(e)}),this.selectEnd()};selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}};var fe=g("three");var pe=class extends fe.EventDispatcher{constructor(t){super();this.context=t;this.registryEvent()}curGraphics=new Set;timer=new q;graphicTimerMap=new Map;onPointerMove=({graphics:t,pois:e,e:i})=>{let r=e.map(l=>this.context.currentFloor?.graphicLayer.graphicMap.get(l.options.id)).filter(l=>l&&l.options.geometry.type==="point");if(!t.length&&!r.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:s}=this.context.config.hover,a=new Set;if(r.length){let l,c=1e4;r.forEach(p=>{let f=e.find(d=>d.options.id===p.options.id);if(f instanceof _t){let{x:d,y:_}=f.clientPos,v=Math.sqrt((d-i.offsetX)**2+(_-i.offsetY)**2);v<c&&(c=v,l=p)}else if(f instanceof H){let{x:d,y:_}=f.box.getCenter(new fe.Vector2),v=Math.sqrt((d-i.offsetX)**2+(_-i.offsetY)**2);v<c&&(c=v,l=p)}}),a.add(l)}a.size||t.forEach(l=>a.add(l)),a.forEach(l=>{if(this.graphicTimerMap.get(l)||this.curGraphics.has(l))return;let c=this.timer.setTimeout(()=>{this.curGraphics.add(l),this.graphicTimerMap.delete(l),this.timer.clearTimeout(c),this.handleHoverGraphicsChange()},s);this.graphicTimerMap.set(l,c)}),this.graphicTimerMap.forEach((l,c)=>{a.has(c)||(this.timer.clearTimeout(l),this.graphicTimerMap.delete(c))});let u=this.curGraphics.size;this.curGraphics.forEach(l=>{a.has(l)||this.curGraphics.delete(l)}),u!==this.curGraphics.size&&this.handleHoverGraphicsChange()};onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()};onBodyPointerMove=t=>{if(this.curGraphics.size){let e=this.context.container.getBoundingClientRect();(t.clientX<e.left||t.clientX>e.right||t.clientY<e.top||t.clientY>e.bottom)&&this.onPointerLevel()}};handleHoverGraphicsChange(t=this.curGraphics){this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}};var jn=g("three/examples/jsm/lines/LineMaterial"),A=g("three");function qn(o){return`${o.x}-${o.y}-${o.z}`}var de=class{constructor(n){this.context=n}lineMaterialMap=new Map;meshStandardMaterialMap=new Map;meshBasicMaterialMap=new Map;shaderMaterialMap=new Map;groundTextureMaterialMap=new Map;line2MaterialMap=new Map;generateLineMaterialKey({color:n,opacity:t}){return`${n}-${t}`}createLineMaterial({color:n,opacity:t}){let e=this.generateLineMaterialKey({color:n,opacity:t});if(this.lineMaterialMap.has(e))return this.lineMaterialMap.get(e);let i=new A.LineBasicMaterial({color:new A.Color(n).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(e,i),i}createMeshStandardMaterial({color:n,opacity:t}){let e=`${n}-${t}`;if(this.meshStandardMaterialMap.has(e))return this.meshStandardMaterialMap.get(e);let i=new A.MeshStandardMaterial({color:new A.Color(n).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(e,i),i}createMeshBasicMaterial({color:n,opacity:t}){let e=`${n}-${t}`;if(this.meshBasicMaterialMap.has(e))return this.meshBasicMaterialMap.get(e);let i=new A.MeshBasicMaterial({color:n,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(e,i),i}createShaderMaterial({gradualColor:n,center:t,maxValue:e,opacity:i,direction:r,max:s,min:a}){let u=`${n.toString()}-${qn(t)}-${e}-${i}-${qn(r)}`;if(this.shaderMaterialMap.has(u))return this.shaderMaterialMap.get(u);let l=`
|
|
54
54
|
uniform vec3 uColor;
|
|
55
55
|
uniform vec3 uGradualColor;
|
|
56
56
|
uniform vec3 center;
|
|
@@ -87,11 +87,11 @@
|
|
|
87
87
|
void main() {
|
|
88
88
|
gl_FragColor = vec4(vColor.x, vColor.y, vColor.z, opacity);
|
|
89
89
|
}
|
|
90
|
-
`,p=new L.ShaderMaterial({uniforms:{uColor:{value:new L.Color(n[0]).convertLinearToSRGB()},uGradualColor:{value:new L.Color(n[1]).convertLinearToSRGB()},center:{value:t},maxValue:{value:e},opacity:{value:i},uDirection:{value:r},uMax:{value:s},uMin:{value:a}},vertexShader:l,fragmentShader:c,side:L.DoubleSide});return this.shaderMaterialMap.set(u,p),p}async createGroundTextureMaterial({url:n,opacity:t}){let e=`${n}-${t}`;if(this.groundTextureMaterialMap.has(e))return this.groundTextureMaterialMap.get(e);let i=await this.context.textureFactory.getTexture(n),r=new L.MeshBasicMaterial({map:i,alphaTest:.2,side:L.DoubleSide});return i.needsUpdate=!0,this.groundTextureMaterialMap.set(e,r),r}createLine2MaterialMap({color:n,width:t,dashed:e}){let i=`${n}-${t}-${e}`;if(this.line2MaterialMap.has(i))return this.line2MaterialMap.get(i);let r=new Xn.LineMaterial({color:parseInt(n.slice(1),16),dashed:e,linewidth:t,worldUnits:!0,dashSize:1,gapSize:3,dashScale:1,resolution:new L.Vector2(this.context.clientSize.width,this.context.clientSize.height)});return this.line2MaterialMap.set(i,r),r}dispose(){this.lineMaterialMap.forEach((n,t)=>{n.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((n,t)=>{n.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((n,t)=>{n.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((n,t)=>{n.dispose()}),this.shaderMaterialMap.clear(),this.groundTextureMaterialMap.forEach((n,t)=>{n.dispose(),n.map?.dispose()}),this.groundTextureMaterialMap.clear(),this.line2MaterialMap.forEach((n,t)=>{n.dispose()}),this.line2MaterialMap.clear()}};var _t=g("three");var fe=class{constructor(n){this.context=n;this.registryEvent(),this.changePrevCamera()}prevCamera={position:new _t.Vector3,zoom:1,target:new _t.Vector3};enable=!0;box=new _t.Box3;updateBox(){this.box.setFromObject(this.context.scene)}setEnable(n){this.enable=n,n?this.registryEvent():this.unRegistryEvent()}changePrevCamera(){this.prevCamera={position:this.context.camera.position.clone(),zoom:this.context.camera.zoom,target:this.context.control.target.clone()}}backToPrevCamera(){this.setEnable(!1),this.context.camera.position.copy(this.prevCamera.position),this.context.camera.zoom=this.prevCamera.zoom,this.context.control.target.copy(this.prevCamera.target),this.context.control.update(),this.setEnable(!0)}registryEvent(){this.context.addEventListener("control-change",this.onCameraChange)}unRegistryEvent(){this.context.removeEventListener("control-change",this.onCameraChange)}getCurFloorScreenPosition(){if(!this.context.scene.children.filter(h=>h instanceof pt).length)return null;let t=this.box,{camera:e,clientSize:{width:i,height:r}}=this.context,{min:s,max:a}=t,u=x(s,e,i,r),l=x(a,e,i,r),c=x(new _t.Vector3(s.x,a.y,a.z),e,i,r),p=x(new _t.Vector3(a.x,s.y,s.z),e,i,r),f=Math.min(u.x,l.x,c.x,p.x),d=Math.max(u.x,l.x,c.x,p.x),_=Math.min(u.y,l.y,c.y,p.y),v=Math.max(u.y,l.y,c.y,p.y);return{left:f,right:d,top:_,bottom:v}}checkDistanceToScreenEdge({left:n,right:t,top:e,bottom:i}){let{width:r,height:s}=this.context.clientSize,[a,u,l,c]=this.context.config.cameraBound.padding,p=t>=c,f=r-n>=u,d=s-e>=l,_=i>=a;return p&&f&&d&&_}onCameraChange=()=>{let n=this.getCurFloorScreenPosition();if(n){let{left:t,right:e,top:i,bottom:r}=n;this.checkDistanceToScreenEdge({left:t,right:e,top:i,bottom:r})?this.changePrevCamera():this.backToPrevCamera()}};dispose(){this.unRegistryEvent()}};var qn=g("three"),de=class{constructor(n){this.context=n}textureMap=new Map;loader=new qn.TextureLoader;async getTexture(n){if(this.textureMap.has(n))return this.textureMap.get(n);let t=this.loader.loadAsync(n).then(e=>(this.textureMap.set(n,e),e));return this.textureMap.set(n,t),t}dispose(){this.textureMap.forEach(n=>{n instanceof Promise?n.then(t=>t.dispose()):n.dispose()}),this.textureMap.clear()}};var ge=class extends w.EventDispatcher{constructor(t,e){super();this.container=t;this.config=e;this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new ue(this),this.hoverHelper=new ce(this),this.materialFactory=new pe(this),this.textureFactory=new de(this),this.resizeClientSize(),this.registryEvent()}scene=ze();renderer=ke();camera;control;lights=He();timer=new X;tweenGroup=new vt.Group;currentFloor;selection;hoverHelper;basicRatio;materialFactory;textureFactory;cameraBound;clientSize={width:0,height:0,x:0,y:0};renderRf=0;prevCameraZoom=1;resizeClientSize(){let{x:t,y:e,width:i,height:r}=this.container.getBoundingClientRect();this.clientSize={width:i||this.container.clientWidth,height:r||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=Ve(t,e),this.prevCameraZoom=this.camera.zoom,this.renderer.setSize(t,e),this.control=We(this.camera,this.renderer.domElement),this.control.maxPolarAngle=this.config.control.maxPolar,this.container.appendChild(this.renderer.domElement),this.scene.add(this.lights),this.basicRatio=this.getRatio(),this.control.addEventListener("change",()=>{let i=this.control.getPolarAngle();this.currentFloor?.setShadowOpacity(i/this.config.control.maxPolar),this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"}),this.prevCameraZoom!==this.camera.zoom&&(this.dispatchEvent({type:"control-zoom-change",zoom:this.camera.zoom}),this.prevCameraZoom=this.camera.zoom)}),this.cameraBound=new fe(this)}getRatio(t=new w.Vector3(0,0,0),e=new w.Vector3(100,0,0)){let{clientWidth:i,clientHeight:r}=this.container,s=x(t,this.camera,i,r),a=x(e,this.camera,i,r);return Math.ceil(Math.sqrt((a.x-s.x)**2+(a.y-s.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof w.AmbientLight&&(e.color=new w.Color(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let e=t.getCenter();e&&(this.lights.position.x=e.x,this.lights.position.y=e.y),this.cameraBound.updateBox()}onWindowResize=()=>{let{container:t,camera:e,renderer:i}=this,{clientWidth:r,clientHeight:s}=t;r=Math.max(1,r),s=Math.max(1,s),e.left=-r/2,e.right=r/2,e.top=s/2,e.bottom=-s/2,e.updateProjectionMatrix(),i.setSize(r,s),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:r,height:s})};onClick=t=>{let{graphics:e,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY);e.length&&this.dispatchEvent({type:"graphic-click",graphics:e,position:i});let r=this.getPoisByDeviceXy(t.offsetX,t.offsetY);r.length&&this.dispatchEvent({type:"poi-click",pois:r})};getGraphicsByDeviceXy(t,e){let i=new w.Vector2;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let r=new w.Raycaster;return r.setFromCamera(i,this.camera),r.ray.origin.sub(r.ray.direction.clone().multiplyScalar(100)),this.currentFloor?.graphicLayer.getGraphicByRaycaster(r)||{graphics:[],position:null}}getPoisByDeviceXy(t,e){let i=this.currentFloor?.poiLayer.getPoiByDeviceXy(t,e),r=this.currentFloor?.poiLayer2.getPoiByDeviceXy(t,e);return(i||[]).concat(r||[])}onPointerover=t=>{let{graphics:e,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),r=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-over",e:t,graphics:e,pois:r,position:i})};onPointermove=t=>{let{graphics:e,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),r=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-move",e:t,graphics:e,pois:r,position:i})};onPointerleave=t=>{this.dispatchEvent({type:"pointer-level"})};onSelectionSelect=({graphics:t,isMultipleSelect:e})=>{this.dispatchEvent({type:"select-graphic",graphics:t,isMultipleSelect:e})};onHoverChange=({graphics:t})=>{this.dispatchEvent({type:"hover",graphics:t})};registryEvent(){window.addEventListener("resize",this.onWindowResize),this.container.addEventListener("click",this.onClick),this.container.addEventListener("pointerover",this.onPointerover),this.container.addEventListener("pointermove",this.onPointermove),this.container.addEventListener("pointerleave",this.onPointerleave),this.container.addEventListener("pointercancel",this.onPointerleave),this.container.addEventListener("pointerout",this.onPointerleave),this.selection.addEventListener("select",this.onSelectionSelect),this.hoverHelper.addEventListener("hover-change",this.onHoverChange)}unRegistryEvent(){window.removeEventListener("resize",this.onWindowResize),this.container.removeEventListener("click",this.onClick),this.container.removeEventListener("pointerover",this.onPointerover),this.container.removeEventListener("pointermove",this.onPointermove),this.container.removeEventListener("pointerleave",this.onPointerleave),this.container.removeEventListener("pointercancel",this.onPointerleave),this.container.removeEventListener("pointerout",this.onPointerleave),this.selection.removeEventListener("select",this.onSelectionSelect),this.hoverHelper.removeEventListener("hover-change",this.onHoverChange)}setPolarAngle(t,e=500){return e===0?(this.control.maxPolarAngle=t,this.control.minPolarAngle=t,this.control.update(),this.control.maxPolarAngle=this.config.control.maxPolar,this.control.minPolarAngle=0,Promise.resolve()):gt(new Promise(i=>{let r={polar:this.control.getPolarAngle()},s={polar:t},a=new vt.Tween(r,this.tweenGroup).to(s,e).onUpdate(()=>{this.control.maxPolarAngle=r.polar,this.control.minPolarAngle=r.polar,this.control.update()}).onComplete(()=>{this.control.enabled=!0,this.control.maxPolarAngle=this.config.control.maxPolar,this.control.minPolarAngle=0,this.tweenGroup.remove(a),i(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}setAzimuthalAngle(t,e=500){let{maxAzimuthAngle:i,minAzimuthAngle:r}=this.control,s=i===r;if(!(!s&&t>i&&t<r)){if(e===0){this.control.maxAzimuthAngle=t,this.control.minAzimuthAngle=t,this.control.update(),s||(this.control.maxAzimuthAngle=i,this.control.minAzimuthAngle=r);return}return gt(new Promise(a=>{let u={azimuthal:this.control.getAzimuthalAngle()},l={azimuthal:t},c=new vt.Tween(u,this.tweenGroup).to(l,e).onUpdate(()=>{this.control.maxAzimuthAngle=u.azimuthal,this.control.minAzimuthAngle=u.azimuthal,this.control.update()}).onComplete(()=>{this.control.enabled=!0,s||(this.control.maxAzimuthAngle=i,this.control.minAzimuthAngle=r),this.tweenGroup.remove(c),a(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}}getCameraLookAt(){return new w.Vector3().subVectors(this.control.target,this.camera.position)}setZoom(t,e,i=500){let r=this.getCameraLookAt(),s={zoom:this.camera.zoom,target:this.control.target.clone()};if(!i){this.camera.position.copy(e.clone().sub(r)),this.control.target.copy(e),this.camera.zoom=t,this.control.update();return}return gt(new Promise(a=>{let u=new vt.Tween(s,this.tweenGroup).to({zoom:t,target:e},i).onUpdate(()=>{this.camera.position.copy(s.target.clone().sub(r)),this.control.target.copy(s.target),this.camera.zoom=s.zoom,this.control.update()}).onComplete(()=>{this.tweenGroup.remove(u),this.control.enabled=!0,a(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),i+500)}getFitCameraToObjectZoom(t,e=[20,20,20,20],i=500,r=!0){let[s,a,u,l]=e,{clientSize:{width:c,height:p}}=this,f=this.control.getPolarAngle();r&&this.setPolarAngle(0,0);let d=new w.Box3().setFromObject(t);this.setPolarAngle(f,0);let{max:_,min:v}=d,h=new w.Vector3(v.x,_.y,_.z),y=new w.Vector3(_.x,_.y,_.z),b=new w.Vector3(_.x,v.y,v.z),E=new w.Vector3(v.x,v.y,v.z),S=x(h,this.camera,c,p),P=x(y,this.camera,c,p),U=x(E,this.camera,c,p),N=x(b,this.camera,c,p),Ue=new w.Box2().setFromPoints([new w.Vector2(S.x,S.y),new w.Vector2(P.x,P.y),new w.Vector2(U.x,U.y),new w.Vector2(N.x,N.y)]).getSize(new w.Vector2),hi=(c-a-l)/Ue.x,pi=(p-s-u)/Ue.y,fi=Math.min(hi,pi),di=new w.Vector3((_.x+v.x)/2,(_.y+v.y)/2,(_.z+v.z)/2);return{zoom:fi*this.camera.zoom,center:di}}fitCameraToObject(t,e=[20,20,20,20],i=500,r=!0){let{zoom:s,center:a}=this.getFitCameraToObjectZoom(t,e,i,r);return this.setZoom(s,a,i)}getFitCameraToGroundZoom(t=[20,20,20,20],e=500,i=!0){if(this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,e,i).zoom}fitCameraToGround(t=[20,20,20,20],e=500,i=!0){return this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundUpper,t,e,i):Promise.resolve(!1)}setCameraPosition(t,e){let i=this.camera.position.clone(),r=this.getCameraLookAt();return e||(this.control.enabled=!1,this.camera.position.copy(t.clone().sub(r)),this.control.target.copy(t.clone()),this.control.update(),this.control.enabled=!0),gt(new Promise(s=>{let a=new vt.Tween(i,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(i.clone().sub(r)),this.control.target.copy(i.clone()),this.control.update()}).onComplete(()=>{this.tweenGroup.remove(a),this.camera.position.copy(i.clone().sub(r)),this.control.target.copy(t.clone()),this.control.update(),this.control.enabled=!0,s(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}render(){this.renderer.render(this.scene,this.camera),this.dispatchEvent({type:"update"}),this.renderRf=this.timer.requestAnimationFrame(()=>{this.render()}),this.tweenGroup.update()}pauseRender(){this.timer.cancelAnimationFrame(this.renderRf)}continueRender(){this.render()}dispose(){this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.timer.dispose(),this.renderer.dispose(),this.lights.children.forEach(t=>t.dispose()),this.materialFactory.dispose(),this.textureFactory.dispose(),Z(this.scene)}};var jn=g("lodash"),Bi={apiDomain:"",apiInfo:{},apiPath:{floorGraphic:"/api/inception-map/floor/get",floorRange:"/api/inception-map/range/get",equipmentList:"/api/inception-map/equipment/get",roadNetwork:"/api/inception-map/road_network/get"},resizeObserver:!1,initTransToMark:!1,heatMap:{radius:50,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0},defaultPadding:[20,20,20,20],svg:{circle:{radius:"2",fill:"#1CADFF"},line:{stroke:"#1CADFF"}},selectBox:{stroke:"#1CADFF",fill:"rgba(28, 173, 255, 0.3)"},hover:{time:100},ground:{color:"#F6F6F6",opacity:1,height:.001,stroke:!1,strokeColor:"#E6E6E6",strokeOpacity:1},markGraphic:{color:"#EEF0F3",opacity:1,height:.001,stroke:!1,strokeColor:"#000",strokeOpacity:1},graphic:{fillOpacity:1},cameraBound:{padding:[150,150,150,150]},poi:{boxScale:1}};function Yn(o){return(0,jn.merge)({},Bi,o)}var Zn=g("lodash");async function $n({brand:o,project:n},t){let{apiDomain:e,apiPath:{floorRange:i},apiInfo:r}=t,s=`${e}${i}?brand=${o}&project=${n}&phase=${n}&building=${n}`;return await fetch(s,r).then(u=>u.json()).then(u=>u.data).then(u=>{let l=(u||[])[0];return l&&(l.info=JSON.parse(l.info)),l})}async function me({brand:o,project:n,floor:t,ts:e,resource_type_list:i},r){let{apiDomain:s,apiPath:{floorGraphic:a},apiInfo:u}=r,l=`${s}${a}?brand=${o}&project=${n}&phase=${n}&building=${n}&floor=${t}&ts=${e}&resource_type_list=${i}`;return await fetch(l,u).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(f=>f.info=JSON.parse(f.info)),p||[]))}var Gi=(t=>(t[t.D2=0]="D2",t[t.D3=1.1]="D3",t))(Gi||{}),Kn=class extends ye.EventDispatcher{constructor(t,e={}){super();this.container=t;this.config=Yn(e),this.context=new ge(t,this.config),this.registryEvent(),this.context.render()}config;context;polarKeys=[];azimuthalKeys=[];svgLine;svgPolygon;basicZoom=1;prevCameraZoom=1;type="2d";floorDataMap=new Map;buildingGroundMap=new Map;buildingGroundPromiseMap=new Map;currentBuildGround=null;observe=null;buildingCenter=[0,0];timer=new X;plugins=[];async loadGraphics({brand:t,project:e,floor:i,ts:r,resource_type_list:s}){return await me({brand:t,project:e,floor:i,ts:r,resource_type_list:s},this.config)}changeBuildingCenter(t,{brand:e,project:i}){let r=t?Se(t.info.geometry.cds[0]):[0,0];this.buildingCenter=r,this.dispatchEvent({type:"center-change",center:r,project:i,brand:e})}async loadBuildingGround({brand:t,project:e}){let i=tt({brand:t,project:e});if(this.buildingGroundMap.has(i)){let s=this.buildingGroundMap.get(i);return this.changeBuildingCenter(s||null,{brand:t,project:e}),s||null}if(this.buildingGroundPromiseMap.has(i))return this.buildingGroundPromiseMap.get(i);let r=new Promise(async s=>{let a=await $n({brand:t,project:e},this.config);this.buildingGroundMap.set(i,a),this.changeBuildingCenter(a||null,{brand:t,project:e}),this.buildingGroundPromiseMap.delete(i),s(a)});return this.buildingGroundPromiseMap.set(i,r),r}async load({brand:t,project:e,floor:i,ts:r,resource_type_list:s}){let a=tt({brand:t,project:e,floor:i,ts:r,resource_type_list:s});if(this.floorDataMap.has(a))return this.floorDataMap.get(a);let[u,l]=await Promise.all([this.loadGraphics({brand:t,project:e,floor:i,ts:r,resource_type_list:s}),this.loadBuildingGround({brand:t,project:e})]);return this.transformGraphicData(u),u.forEach(c=>{c.info.transformToBuildingGround=!!l}),this.config.useFloorCache||this.floorDataMap.clear(),this.floorDataMap.set(a,u),u}transformGraphicData(t,e=this.buildingCenter,i=0){t.forEach(u=>{if(u.info.geometry.coords=JSON.parse(JSON.stringify(u.info.geometry.cds)),u.info.geometry.type==="polygon")u.info.geometry.coords.map(l=>{Array.isArray(l)&&l.forEach(c=>{c[0]-=e[0],c[1]-=e[1]})});else{let[l,c]=u.info.geometry.cds;u.info.geometry.coords=[l-e[0],c-e[1]]}});let{ground:r,markGraphic:s,graphic:a}=this.config;for(let u=0;u<t.length;u++){let l=t[u];l.info.deltaHeight=1e-5*(i+u+1),l.info.group==="ground"?(l.info.fillColor=r.color,l.info.fillOpacity=r.opacity,l.info.height=r.height,l.info.stroke=r.stroke,l.info.strokeColor=r.strokeColor,l.info.strokeOpacity=r.strokeOpacity):l.info.userData.mark?(l.info.height=s.height,l.info.fillColor=s.color,l.info.fillOpacity=s.opacity,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity):(l.info.fillOpacity=a.fillOpacity,this.config.initTransToMark&&(l.info.height=s.height,l.info.fillColor=s.color,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity))}}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}createFloor(t){let e=new pt(this.context);if(!t.length)return{curFloor:e,graphics:[]};let i=new Map,r=[];for(let s of t)if(s.info.group==="ground")e.createGround(s.info);else{let a=e.addGraphic(s.info);a.userData.data=s,i.set(s.legacy_id,a),r.push(a)}return e.userData.legacyToGraphicMap=i,{curFloor:e,graphics:r}}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor({brand:t,project:e,floor:i,ts:r,resource_type_list:s}){let a=tt({brand:t,project:e,floor:i,ts:r,resource_type_list:s}),u=this.floorDataMap.get(a);if(this.context.control.removeEventListener("change",this.onControlChange),u){let l=tt({brand:t,project:e});this.currentBuildGround=this.buildingGroundMap.get(l)||null;let c=this.createFloor(u);c?(c.curFloor.name=i,this.triggerHooks("switch_floor_before",c),c.curFloor.updateBox(),this.context.switchFloor(c.curFloor),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",c)):console.warn("[switchFloor error] ["+i+"] \u697C\u5C42\u6CA1\u6709\u6570\u636E")}else console.warn("[switchFloor error] \u6CA1\u6709\u8FD9\u4E2A\u697C\u5C42\uFF0C\u8BF7\u5148\u8C03\u7528load\u65B9\u6CD5\u52A0\u8F7D\u697C\u5C42")}switchFloorByData(t,e,i=e){let{curFloor:r,graphics:s}=this.createFloor(t);r.name=e,r.key=i;let a=new Map;t.forEach(u=>{a.set(u.element_uuid,u)}),r.userData.graphicMap=a,this.switchFloorByFloor(r,s)}switchFloorByFloor(t,e=t.graphicLayer.children){this.triggerHooks("switch_floor_before",{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",{curFloor:t,graphics:e})}initialFloorCamera(){this.context.cameraBound.setEnable(!1),this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,0),this.context.setPolarAngle(this.config.control.defaultPolar,0),this.context.fitCameraToGround(void 0,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*25,this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.basicZoom=this.context.camera.zoom,this.context.control.addEventListener("change",this.onControlChange),this.onControlChange(),this.context.cameraBound.setEnable(!0),this.context.cameraBound.changePrevCamera()}onControlChange=()=>{let{camera:{zoom:t}}=this.context;t!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=t)};addModel(t,e){if(t.options.geometry.type==="polygon"){let i=this.context.currentFloor?.addModel({...e,position:t.getPosition().setZ(.1),id:t.options.id});if(i){let{facilityAngle:r=0,facilityXScale:s=1,facilityYScale:a=1}=t.options.userData;i.rotateZ((180-r)/180*Math.PI),i.scale.set(s,a,1)}}}addHeatmap(t){return this.context.currentFloor?.addHeatmap(t)}getLegacyToGraphicMap(){return this.context.currentFloor?.userData.legacyToGraphicMap||new Map}getFloorAllGraphics(){return this.context.currentFloor?.graphicLayer.children.filter(t=>t instanceof B)||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let i=t.getCenter();return this.context.currentFloor.addPoi({...e,position:{...i,z:i.z+t.options.height/2}})}return null}removeHeatMap(){this.context.currentFloor?.removeHeatMap()}translateElementToCenter(t,e=500){let i=t.getPosition();return this.context.setCameraPosition(i,e)}async translateElementToCenterX(t,e=500){return gt(new Promise(i=>{let r=this.context.control.target.clone(),s=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:a,height:u},camera:l}=this.context,p=x(s,l,a,u).x-a/2,f=new ye.Vector3;f.setFromMatrixColumn(this.context.camera.matrix,0),f.normalize(),f.multiplyScalar(p/this.context.camera.zoom),r.add(f),this.context.setCameraPosition(r,e).then(i)})}),e+500)}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:i,clientHeight:r}=this.container;return x(e,this.context.camera,i,r)}changeMapType(t,e=500){return this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}async resetView(t=300){let e=t/3;await this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),await this.context.setPolarAngle(this.config.control.defaultPolar,e),await this.context.fitCameraToGround(this.config.defaultPadding,e,!1)}reduceMap(t=.5,e=500){let i=this.context.camera.zoom;return this.context.setZoom(i-t,this.context.control.target,e)}enlargeMap(t=.5,e=500){let i=this.context.camera.zoom;return this.context.setZoom(i+t,this.context.control.target,e)}onKeydown=t=>{this.polarKeys.includes(t.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(t.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)};onKeyUp=t=>{if(this.polarKeys.includes(t.code)){let e=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=e,this.context.control.minPolarAngle=e}if(this.azimuthalKeys.includes(t.code)){let e=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=e,this.context.control.minAzimuthAngle=e}};registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver((0,Zn.debounce)(this.resize,5));t.observe(this.container),this.observe=t}}unRegistryEvent(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),this.observe?.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t=.1){let e=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(e+t,500)}async measureDistance(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new ee(this.context);let i=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){i(),e("cancel")},this.svgLine.addEventListener("distance",({distance:r})=>{t(r)})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new ne(this.context);let i=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){i(),e("cancel")},this.svgPolygon.addEventListener("area",({area:r})=>{t(r)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}getGraphicByNodeId(t){return this.context.currentFloor?.graphicLayer.getGraphicByNodeId(t)||null}deleteGraphic(t){this.context.currentFloor?.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){if(!t.transformToBuildingGround&&this.currentBuildGround){let e=Se(this.currentBuildGround.info.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(r=>{r[0]-=e[0],r[1]-=e[1]})});else{let[i,r]=t.geometry.cds;t.geometry.coords=[i-e[0],r-e[1]]}}return this.context.currentFloor?.graphicLayer.createGraphic(t)}removePoiById(t){this.context.currentFloor?.poiLayer.removePoiById(t),this.context.currentFloor?.poiLayer2.removePoiById(t)}getPoiById(t){return this.context.currentFloor?.poiLayer.getPoiById(t)||this.context.currentFloor?.poiLayer2.getPoiById(t)}getPois(){return[...(this.context.currentFloor?.poiLayer.pois||[]).filter(t=>!t.options.built_in),...this.context.currentFloor?.poiLayer2.pois||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let t=this.context.control.getAzimuthalAngle(),e=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let i=this.context.getFitCameraToGroundZoom(void 0,0)||1;this.context.camera.zoom=e,this.context.control.minZoom=i,this.context.control.maxZoom=i*25,this.basicZoom=e,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(t,0),this.context.cameraBound.setEnable(!0)};dispose(){this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.context.dispose(),this.floorDataMap.clear(),this.buildingGroundMap.clear(),Ye(),$e(),tn(),this.unRegistryEvent()}};var Jn=g("three"),st=class extends Jn.EventDispatcher{bmap;constructor(n){super(),this.bmap=n}dispose(){}};var Qn=class extends st{equipmentList=[];equipmentMap=new Map;constructor(n){super(n),this.fetchEquipment(),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}async fetchEquipment(){let{apiDomain:n,apiPath:{equipmentList:t},apiInfo:e}=this.bmap.config,i=`${n}${t}`;await fetch(i,e).then(r=>r.json()).then(r=>r.data).then(r=>{this.equipmentList=r,this.equipmentMap=new Map(r.map(s=>[s.equipment_id,s]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)}onSwitchFloor=({data:{graphics:n}})=>{this.equipmentList.length&&this.changeGraphicToEquipment(n)};getGraphicEquipment(n){return n.userData.data.info.userData.equipment}changeGraphicToEquipment(n){n.filter(t=>{let e=this.getGraphicEquipment(t);return e&&this.equipmentMap.has(e)}).forEach(t=>{let e=this.equipmentMap.get(this.getGraphicEquipment(t)),i=this.bmap.createGraphicPoi(t,{icon:e?.equipment_icon,built_in:!0,icon_size:[14,14]});i&&(i.userData.data=e,i.userData.type="equipment")})}dispose(){this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),Array.from(this.bmap.context.currentFloor?.poiLayer.pois||[]).forEach(n=>{n.userData.type==="equipment"&&this.bmap.context.currentFloor?.poiLayer.removePoi(n)})}};function Ne(o){let n=new Blob([o],{type:"text/javascript"}),t=URL.createObjectURL(n),e=new Worker(t);return URL.revokeObjectURL(t),e}function De(){return Ne(`var B1=Object.create;var Uf=Object.defineProperty;var z1=Object.getOwnPropertyDescriptor;var k1=Object.getOwnPropertyNames,gm=Object.getOwnPropertySymbols,G1=Object.getPrototypeOf,ym=Object.prototype.hasOwnProperty,V1=Object.prototype.propertyIsEnumerable;var Ff=(r,t,e)=>t in r?Uf(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ls=(r,t)=>{for(var e in t||(t={}))ym.call(t,e)&&Ff(r,e,t[e]);if(gm)for(var e of gm(t))V1.call(t,e)&&Ff(r,e,t[e]);return r};var Zt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var H1=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of k1(t))!ym.call(r,a)&&a!==e&&Uf(r,a,{get:()=>t[a],enumerable:!(o=z1(t,a))||o.enumerable});return r};var Ln=(r,t,e)=>(e=r!=null?B1(G1(r)):{},H1(t||!r||!r.__esModule?Uf(e,"default",{value:r,enumerable:!0}):e,r));var dn=(r,t,e)=>Ff(r,typeof t!="symbol"?t+"":t,e);var _m=Zt((dR,vm)=>{var Bf=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(a=>(a.key===t&&Object.assign(a,{priority:o}),a)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};vm.exports=Bf});var Mm=Zt((mR,Em)=>{function xm(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,xm(a,t)):o!==t&&e.set(o,a);return e}Em.exports=xm});var bm=Zt((gR,Sm)=>{function W1(r){let t=Number(r);return!(isNaN(t)||t<=0)}function wm(r){let t=new Map;return Object.keys(r).forEach(o=>{let a=r[o];if(a!==null&&typeof a=="object"&&!Array.isArray(a))return t.set(o,wm(a));if(!W1(a))throw new Error(\`Could not add node at key "\${o}", make sure it's a valid node\`,a);return t.set(o,Number(a))}),t}Sm.exports=wm});var Cm=Zt((yR,Am)=>{function Tm(r){if(!(r instanceof Map))throw new Error(\`Invalid graph: Expected Map instead found \${typeof r}\`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){Tm(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}Am.exports=Tm});var kf=Zt((vR,Rm)=>{var q1=_m(),X1=Mm(),Pm=bm(),Im=Cm(),zf=class{constructor(t){t instanceof Map?(Im(t),this.graph=t):t?this.graph=Pm(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(Im(e),o=e):o=Pm(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=X1(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,l=new q1,f=new Map,h=[],p=0,d=[];if(o.avoid&&(d=[].concat(o.avoid)),d.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(d.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(l.set(t,0);!l.isEmpty();){let g=l.next();if(g.key===e){p=g.priority;let y=g.key;for(;f.has(y);)h.push(y),y=f.get(y);break}a.add(g.key),(this.graph.get(g.key)||new Map).forEach((y,M)=>{if(a.has(M)||d.includes(M))return null;if(!l.has(M))return f.set(M,g.key),l.set(M,g.priority+y);let S=l.get(M).priority,T=g.priority+y;return T<S?(f.set(M,g.key),l.set(M,T)):null})}return h.length?(o.trim?h.shift():h=h.concat([t]),o.reverse||(h=h.reverse()),o.cost?{path:h,cost:p}:h):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};Rm.exports=zf});var Mc=Zt((AR,E0)=>{"use strict";var x0=Object.getOwnPropertySymbols,Yb=Object.prototype.hasOwnProperty,$b=Object.prototype.propertyIsEnumerable;function Zb(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Jb(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(l){return t[l]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(l){a[l]=l}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(l){return!1}}E0.exports=Jb()?Object.assign:function(r,t){for(var e,o=Zb(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var f in e)Yb.call(e,f)&&(o[f]=e[f]);if(x0){a=x0(e);for(var h=0;h<a.length;h++)$b.call(e,a[h])&&(o[a[h]]=e[a[h]])}}return o}});var hp=Zt((cp,fp)=>{(function(r,t){typeof cp=="object"&&typeof fp!="undefined"?fp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(cp,function(){"use strict";function r(x,v,C,w,O){(function F(G,z,L,D,q){for(;D>L;){if(D-L>600){var nt=D-L+1,k=z-L+1,xt=Math.log(nt),X=.5*Math.exp(2*xt/3),it=.5*Math.sqrt(xt*X*(nt-X)/nt)*(k-nt/2<0?-1:1),vt=Math.max(L,Math.floor(z-k*X/nt+it)),pt=Math.min(D,Math.floor(z+(nt-k)*X/nt+it));F(G,z,vt,pt,q)}var et=G[z],ot=L,V=D;for(t(G,L,z),q(G[D],et)>0&&t(G,L,D);ot<V;){for(t(G,ot,V),ot++,V--;q(G[ot],et)<0;)ot++;for(;q(G[V],et)>0;)V--}q(G[L],et)===0?t(G,L,V):t(G,++V,D),V<=z&&(L=V+1),z<=V&&(D=V-1)}})(x,v,C||0,w||x.length-1,O||e)}function t(x,v,C){var w=x[v];x[v]=x[C],x[C]=w}function e(x,v){return x<v?-1:x>v?1:0}var o=function(x){x===void 0&&(x=9),this._maxEntries=Math.max(4,x),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(x,v,C){if(!C)return v.indexOf(x);for(var w=0;w<v.length;w++)if(C(x,v[w]))return w;return-1}function l(x,v){f(x,0,x.children.length,v,x)}function f(x,v,C,w,O){O||(O=S(null)),O.minX=1/0,O.minY=1/0,O.maxX=-1/0,O.maxY=-1/0;for(var F=v;F<C;F++){var G=x.children[F];h(O,x.leaf?w(G):G)}return O}function h(x,v){return x.minX=Math.min(x.minX,v.minX),x.minY=Math.min(x.minY,v.minY),x.maxX=Math.max(x.maxX,v.maxX),x.maxY=Math.max(x.maxY,v.maxY),x}function p(x,v){return x.minX-v.minX}function d(x,v){return x.minY-v.minY}function g(x){return(x.maxX-x.minX)*(x.maxY-x.minY)}function _(x){return x.maxX-x.minX+(x.maxY-x.minY)}function y(x,v){return x.minX<=v.minX&&x.minY<=v.minY&&v.maxX<=x.maxX&&v.maxY<=x.maxY}function M(x,v){return v.minX<=x.maxX&&v.minY<=x.maxY&&v.maxX>=x.minX&&v.maxY>=x.minY}function S(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(x,v,C,w,O){for(var F=[v,C];F.length;)if(!((C=F.pop())-(v=F.pop())<=w)){var G=v+Math.ceil((C-v)/w/2)*w;r(x,G,v,C,O),F.push(v,G,G,C)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(x){var v=this.data,C=[];if(!M(x,v))return C;for(var w=this.toBBox,O=[];v;){for(var F=0;F<v.children.length;F++){var G=v.children[F],z=v.leaf?w(G):G;M(x,z)&&(v.leaf?C.push(G):y(x,z)?this._all(G,C):O.push(G))}v=O.pop()}return C},o.prototype.collides=function(x){var v=this.data;if(!M(x,v))return!1;for(var C=[];v;){for(var w=0;w<v.children.length;w++){var O=v.children[w],F=v.leaf?this.toBBox(O):O;if(M(x,F)){if(v.leaf||y(x,F))return!0;C.push(O)}}v=C.pop()}return!1},o.prototype.load=function(x){if(!x||!x.length)return this;if(x.length<this._minEntries){for(var v=0;v<x.length;v++)this.insert(x[v]);return this}var C=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===C.height)this._splitRoot(this.data,C);else{if(this.data.height<C.height){var w=this.data;this.data=C,C=w}this._insert(C,this.data.height-C.height-1,!0)}else this.data=C;return this},o.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},o.prototype.clear=function(){return this.data=S([]),this},o.prototype.remove=function(x,v){if(!x)return this;for(var C,w,O,F=this.data,G=this.toBBox(x),z=[],L=[];F||z.length;){if(F||(F=z.pop(),w=z[z.length-1],C=L.pop(),O=!0),F.leaf){var D=a(x,F.children,v);if(D!==-1)return F.children.splice(D,1),z.push(F),this._condense(z),this}O||F.leaf||!y(F,G)?w?(C++,F=w.children[C],O=!1):F=null:(z.push(F),L.push(C),C=0,w=F,F=F.children[0])}return this},o.prototype.toBBox=function(x){return x},o.prototype.compareMinX=function(x,v){return x.minX-v.minX},o.prototype.compareMinY=function(x,v){return x.minY-v.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(x){return this.data=x,this},o.prototype._all=function(x,v){for(var C=[];x;)x.leaf?v.push.apply(v,x.children):C.push.apply(C,x.children),x=C.pop();return v},o.prototype._build=function(x,v,C,w){var O,F=C-v+1,G=this._maxEntries;if(F<=G)return l(O=S(x.slice(v,C+1)),this.toBBox),O;w||(w=Math.ceil(Math.log(F)/Math.log(G)),G=Math.ceil(F/Math.pow(G,w-1))),(O=S([])).leaf=!1,O.height=w;var z=Math.ceil(F/G),L=z*Math.ceil(Math.sqrt(G));T(x,v,C,L,this.compareMinX);for(var D=v;D<=C;D+=L){var q=Math.min(D+L-1,C);T(x,D,q,z,this.compareMinY);for(var nt=D;nt<=q;nt+=z){var k=Math.min(nt+z-1,q);O.children.push(this._build(x,nt,k,w-1))}}return l(O,this.toBBox),O},o.prototype._chooseSubtree=function(x,v,C,w){for(;w.push(v),!v.leaf&&w.length-1!==C;){for(var O=1/0,F=1/0,G=void 0,z=0;z<v.children.length;z++){var L=v.children[z],D=g(L),q=(nt=x,k=L,(Math.max(k.maxX,nt.maxX)-Math.min(k.minX,nt.minX))*(Math.max(k.maxY,nt.maxY)-Math.min(k.minY,nt.minY))-D);q<F?(F=q,O=D<O?D:O,G=L):q===F&&D<O&&(O=D,G=L)}v=G||v.children[0]}var nt,k;return v},o.prototype._insert=function(x,v,C){var w=C?x:this.toBBox(x),O=[],F=this._chooseSubtree(w,this.data,v,O);for(F.children.push(x),h(F,w);v>=0&&O[v].children.length>this._maxEntries;)this._split(O,v),v--;this._adjustParentBBoxes(w,O,v)},o.prototype._split=function(x,v){var C=x[v],w=C.children.length,O=this._minEntries;this._chooseSplitAxis(C,O,w);var F=this._chooseSplitIndex(C,O,w),G=S(C.children.splice(F,C.children.length-F));G.height=C.height,G.leaf=C.leaf,l(C,this.toBBox),l(G,this.toBBox),v?x[v-1].children.push(G):this._splitRoot(C,G)},o.prototype._splitRoot=function(x,v){this.data=S([x,v]),this.data.height=x.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(x,v,C){for(var w,O,F,G,z,L,D,q=1/0,nt=1/0,k=v;k<=C-v;k++){var xt=f(x,0,k,this.toBBox),X=f(x,k,C,this.toBBox),it=(O=xt,F=X,G=void 0,z=void 0,L=void 0,D=void 0,G=Math.max(O.minX,F.minX),z=Math.max(O.minY,F.minY),L=Math.min(O.maxX,F.maxX),D=Math.min(O.maxY,F.maxY),Math.max(0,L-G)*Math.max(0,D-z)),vt=g(xt)+g(X);it<q?(q=it,w=k,nt=vt<nt?vt:nt):it===q&&vt<nt&&(nt=vt,w=k)}return w||C-v},o.prototype._chooseSplitAxis=function(x,v,C){var w=x.leaf?this.compareMinX:p,O=x.leaf?this.compareMinY:d;this._allDistMargin(x,v,C,w)<this._allDistMargin(x,v,C,O)&&x.children.sort(w)},o.prototype._allDistMargin=function(x,v,C,w){x.children.sort(w);for(var O=this.toBBox,F=f(x,0,v,O),G=f(x,C-v,C,O),z=_(F)+_(G),L=v;L<C-v;L++){var D=x.children[L];h(F,x.leaf?O(D):D),z+=_(F)}for(var q=C-v-1;q>=v;q--){var nt=x.children[q];h(G,x.leaf?O(nt):nt),z+=_(G)}return z},o.prototype._adjustParentBBoxes=function(x,v,C){for(var w=C;w>=0;w--)h(v[w],x)},o.prototype._condense=function(x){for(var v=x.length-1,C=void 0;v>=0;v--)x[v].children.length===0?v>0?(C=x[v-1].children).splice(C.indexOf(x[v]),1):this.clear():l(x[v],this.toBBox)},o})});var M0=Zt((pp,dp)=>{(function(r,t){typeof pp=="object"&&typeof dp!="undefined"?dp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(pp,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var l=(this.length>>1)-1;l>=0;l--)this._down(l)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,l=a.data,f=a.compare,h=l[o];o>0;){var p=o-1>>1,d=l[p];if(f(h,d)>=0)break;l[o]=d,o=p}l[o]=h},r.prototype._down=function(o){for(var a=this,l=a.data,f=a.compare,h=this.length>>1,p=l[o];o<h;){var d=(o<<1)+1,g=l[d],_=d+1;if(_<this.length&&f(l[_],g)<0&&(d=_,g=l[_]),f(g,p)>=0)break;l[o]=g,o=d}l[o]=p};function t(e,o){return e<o?-1:e>o?1:0}return r})});var S0=Zt((NR,w0)=>{w0.exports=function(t,e,o,a){var l=t[0],f=t[1],h=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=(a-o)/2,d=0,g=p-1;d<p;g=d++){var _=e[o+d*2+0],y=e[o+d*2+1],M=e[o+g*2+0],S=e[o+g*2+1],T=y>f!=S>f&&l<(M-_)*(f-y)/(S-y)+_;T&&(h=!h)}return h}});var T0=Zt((OR,b0)=>{b0.exports=function(t,e,o,a){var l=t[0],f=t[1],h=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=a-o,d=0,g=p-1;d<p;g=d++){var _=e[d+o][0],y=e[d+o][1],M=e[g+o][0],S=e[g+o][1],T=y>f!=S>f&&l<(M-_)*(f-y)/(S-y)+_;T&&(h=!h)}return h}});var P0=Zt((DR,bc)=>{var A0=S0(),C0=T0();bc.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?C0(t,e,o,a):A0(t,e,o,a)};bc.exports.nested=C0;bc.exports.flat=A0});var R0=Zt((Tc,I0)=>{(function(r,t){typeof Tc=="object"&&typeof I0!="undefined"?t(Tc):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(Tc,function(r){"use strict";let e=33306690738754706e-32;function o(M,S,T,x,v){let C,w,O,F,G=S[0],z=x[0],L=0,D=0;z>G==z>-G?(C=G,G=S[++L]):(C=z,z=x[++D]);let q=0;if(L<M&&D<T)for(z>G==z>-G?(O=C-((w=G+C)-G),G=S[++L]):(O=C-((w=z+C)-z),z=x[++D]),C=w,O!==0&&(v[q++]=O);L<M&&D<T;)z>G==z>-G?(O=C-((w=C+G)-(F=w-C))+(G-F),G=S[++L]):(O=C-((w=C+z)-(F=w-C))+(z-F),z=x[++D]),C=w,O!==0&&(v[q++]=O);for(;L<M;)O=C-((w=C+G)-(F=w-C))+(G-F),G=S[++L],C=w,O!==0&&(v[q++]=O);for(;D<T;)O=C-((w=C+z)-(F=w-C))+(z-F),z=x[++D],C=w,O!==0&&(v[q++]=O);return C===0&&q!==0||(v[q++]=C),q}function a(M){return new Float64Array(M)}let l=33306690738754716e-32,f=22204460492503146e-32,h=11093356479670487e-47,p=a(4),d=a(8),g=a(12),_=a(16),y=a(4);r.orient2d=function(M,S,T,x,v,C){let w=(S-C)*(T-v),O=(M-v)*(x-C),F=w-O;if(w===0||O===0||w>0!=O>0)return F;let G=Math.abs(w+O);return Math.abs(F)>=l*G?F:-function(z,L,D,q,nt,k,xt){let X,it,vt,pt,et,ot,V,K,at,Tt,dt,Ct,Yt,Wt,Nt,ne,Pt,Xt,tt=z-nt,nn=D-nt,Gt=L-k,te=q-k;et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=tt*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=Gt*nn)-V*at-K*at-V*Tt))),p[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),p[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,p[2]=Ct-(Xt-et)+(dt-et),p[3]=Xt;let qt=function(W,Z){let I=Z[0];for(let P=1;P<W;P++)I+=Z[P];return I}(4,p),J=f*xt;if(qt>=J||-qt>=J||(X=z-(tt+(et=z-tt))+(et-nt),vt=D-(nn+(et=D-nn))+(et-nt),it=L-(Gt+(et=L-Gt))+(et-k),pt=q-(te+(et=q-te))+(et-k),X===0&&it===0&&vt===0&&pt===0)||(J=h*xt+e*Math.abs(qt),(qt+=tt*pt+te*X-(Gt*vt+nn*it))>=J||-qt>=J))return qt;et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=X*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=it*nn)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let N=o(4,p,4,y,d);et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=tt*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=Gt*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let b=o(N,d,4,y,g);et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=X*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=it*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let R=o(b,g,4,y,_);return _[R-1]}(M,S,T,x,v,C,G)},r.orient2dfast=function(M,S,T,x,v,C){return(S-C)*(T-v)-(M-v)*(x-C)},Object.defineProperty(r,"__esModule",{value:!0})})});var U0=Zt((FR,vp)=>{"use strict";var L0=hp(),Cc=M0(),Qb=P0(),jb=R0().orient2d;Cc.default&&(Cc=Cc.default);vp.exports=F0;vp.exports.default=F0;function F0(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=iT(r),a=new L0(16);a.toBBox=function(C){return{minX:C[0],minY:C[1],maxX:C[0],maxY:C[1]}},a.compareMinX=function(C,w){return C[0]-w[0]},a.compareMinY=function(C,w){return C[1]-w[1]},a.load(r);for(var l=[],f=0,h;f<o.length;f++){var p=o[f];a.remove(p),h=D0(p,h),l.push(h)}var d=new L0(16);for(f=0;f<l.length;f++)d.insert(mp(l[f]));for(var g=t*t,_=e*e;l.length;){var y=l.shift(),M=y.p,S=y.next.p,T=gp(M,S);if(!(T<_)){var x=T/g;p=tT(a,y.prev.p,M,S,y.next.next.p,x,d),p&&Math.min(gp(p,M),gp(p,S))<=x&&(l.push(y),l.push(D0(p,y)),a.remove(p),d.remove(y),d.insert(mp(y)),d.insert(mp(y.next)))}}y=h;var v=[];do v.push(y.p),y=y.next;while(y!==h);return v.push(y.p),v}function tT(r,t,e,o,a,l,f){for(var h=new Cc([],eT),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],_=p.leaf?yp(g,e,o):nT(e,o,g);_>l||h.push({node:g,dist:_})}for(;h.length&&!h.peek().node.children;){var y=h.pop(),M=y.node,S=yp(M,t,e),T=yp(M,o,a);if(y.dist<S&&y.dist<T&&O0(e,M,f)&&O0(o,M,f))return M}p=h.pop(),p&&(p=p.node)}return null}function eT(r,t){return r.dist-t.dist}function nT(r,t,e){if(N0(r,e)||N0(t,e))return 0;var o=Ac(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=Ac(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=Ac(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var f=Ac(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return f===0?0:Math.min(o,a,l,f)}function N0(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function O0(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),l=Math.max(r[0],t[0]),f=Math.max(r[1],t[1]),h=e.search({minX:o,minY:a,maxX:l,maxY:f}),p=0;p<h.length;p++)if(rT(h[p].p,h[p].next.p,r,t))return!1;return!0}function Qa(r,t,e){return jb(r[0],r[1],t[0],t[1],e[0],e[1])}function rT(r,t,e,o){return r!==o&&t!==e&&Qa(r,t,e)>0!=Qa(r,t,o)>0&&Qa(e,o,r)>0!=Qa(e,o,t)>0}function mp(r){var t=r.p,e=r.next.p;return r.minX=Math.min(t[0],e[0]),r.minY=Math.min(t[1],e[1]),r.maxX=Math.max(t[0],e[0]),r.maxY=Math.max(t[1],e[1]),r}function iT(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],l=0;l<r.length;l++){var f=r[l];f[0]<t[0]&&(t=f),f[0]>o[0]&&(o=f),f[1]<e[1]&&(e=f),f[1]>a[1]&&(a=f)}var h=[t,e,o,a],p=h.slice();for(l=0;l<r.length;l++)Qb(r[l],h)||p.push(r[l]);return sT(p)}function D0(r,t){var e={p:r,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function gp(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function yp(r,t,e){var o=t[0],a=t[1],l=e[0]-o,f=e[1]-a;if(l!==0||f!==0){var h=((r[0]-o)*l+(r[1]-a)*f)/(l*l+f*f);h>1?(o=e[0],a=e[1]):h>0&&(o+=l*h,a+=f*h)}return l=r[0]-o,f=r[1]-a,l*l+f*f}function Ac(r,t,e,o,a,l,f,h){var p=e-r,d=o-t,g=f-a,_=h-l,y=r-a,M=t-l,S=p*p+d*d,T=p*g+d*_,x=g*g+_*_,v=p*y+d*M,C=g*y+_*M,w=S*x-T*T,O,F,G,z,L=w,D=w;w===0?(F=0,L=1,z=C,D=x):(F=T*C-x*v,z=S*C-T*v,F<0?(F=0,z=C,D=x):F>L&&(F=L,z=C+T,D=x)),z<0?(z=0,-v<0?F=0:-v>S?F=L:(F=-v,L=S)):z>D&&(z=D,-v+T<0?F=0:-v+T>S?F=L:(F=-v+T,L=S)),O=F===0?0:F/L,G=z===0?0:z/D;var q=(1-O)*r+O*e,nt=(1-O)*t+O*o,k=(1-G)*a+G*f,xt=(1-G)*l+G*h,X=k-q,it=xt-nt;return X*X+it*it}function oT(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function sT(r){r.sort(oT);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Qa(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}for(var o=[],a=r.length-1;a>=0;a--){for(;o.length>=2&&Qa(o[o.length-2],o[o.length-1],r[a])<=0;)o.pop();o.push(r[a])}return o.pop(),t.pop(),t.concat(o)}});var H0=Zt((xp,Ep)=>{(function(r,t){typeof xp=="object"&&typeof Ep!="undefined"?Ep.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(xp,function(){"use strict";function r(a,l,f,h,p){t(a,l,f||0,h||a.length-1,p||o)}function t(a,l,f,h,p){for(;h>f;){if(h-f>600){var d=h-f+1,g=l-f+1,_=Math.log(d),y=.5*Math.exp(2*_/3),M=.5*Math.sqrt(_*y*(d-y)/d)*(g-d/2<0?-1:1),S=Math.max(f,Math.floor(l-g*y/d+M)),T=Math.min(h,Math.floor(l+(d-g)*y/d+M));t(a,l,S,T,p)}var x=a[l],v=f,C=h;for(e(a,f,l),p(a[h],x)>0&&e(a,f,h);v<C;){for(e(a,v,C),v++,C--;p(a[v],x)<0;)v++;for(;p(a[C],x)>0;)C--}p(a[f],x)===0?e(a,f,C):(C++,e(a,C,h)),C<=l&&(f=C+1),l<=C&&(h=C-1)}}function e(a,l,f){var h=a[l];a[l]=a[f],a[f]=h}function o(a,l){return a<l?-1:a>l?1:0}return r})});var bp=Zt((u2,Sp)=>{"use strict";Sp.exports=$u;Sp.exports.default=$u;var _T=H0();function $u(r,t){if(!(this instanceof $u))return new $u(r,t);this._maxEntries=Math.max(4,r||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}$u.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!Ic(r,t))return e;for(var a=[],l,f,h,p;t;){for(l=0,f=t.children.length;l<f;l++)h=t.children[l],p=t.leaf?o(h):h,Ic(r,p)&&(t.leaf?e.push(h):wp(r,p)?this._all(h,e):a.push(h));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!Ic(r,t))return!1;for(var o=[],a,l,f,h;t;){for(a=0,l=t.children.length;a<l;a++)if(f=t.children[a],h=t.leaf?e(f):f,Ic(r,h)){if(t.leaf||wp(r,h))return!0;o.push(f)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=eu([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],l=[],f,h,p,d;e||a.length;){if(e||(e=a.pop(),h=a[a.length-1],f=l.pop(),d=!0),e.leaf&&(p=xT(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&wp(e,o)?(a.push(e),l.push(f),f=0,h=e,e=e.children[0]):h?(f++,e=h.children[f],d=!1):e=null}return this},toBBox:function(r){return r},compareMinX:W0,compareMinY:q0,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,l=this._maxEntries,f;if(a<=l)return f=eu(r.slice(t,e+1)),tu(f,this.toBBox),f;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),f=eu([]),f.leaf=!1,f.height=o;var h=Math.ceil(a/l),p=h*Math.ceil(Math.sqrt(l)),d,g,_,y;for(X0(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(_=Math.min(d+p-1,e),X0(r,d,_,h,this.compareMinY),g=d;g<=_;g+=h)y=Math.min(g+h-1,_),f.children.push(this._build(r,g,y,o-1));return tu(f,this.toBBox),f},_chooseSubtree:function(r,t,e,o){for(var a,l,f,h,p,d,g,_;o.push(t),!(t.leaf||o.length-1===e);){for(g=_=1/0,a=0,l=t.children.length;a<l;a++)f=t.children[a],p=Mp(f),d=ET(r,f)-p,d<_?(_=d,g=p<g?p:g,h=f):d===_&&p<g&&(g=p,h=f);t=h||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),l=[],f=this._chooseSubtree(a,this.data,t,l);for(f.children.push(r),Yu(f,a);t>=0&&l[t].children.length>this._maxEntries;)this._split(l,t),t--;this._adjustParentBBoxes(a,l,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var l=this._chooseSplitIndex(e,a,o),f=eu(e.children.splice(l,e.children.length-l));f.height=e.height,f.leaf=e.leaf,tu(e,this.toBBox),tu(f,this.toBBox),t?r[t-1].children.push(f):this._splitRoot(e,f)},_splitRoot:function(r,t){this.data=eu([r,t]),this.data.height=r.height+1,this.data.leaf=!1,tu(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,l,f,h,p,d,g;for(p=d=1/0,o=t;o<=e-t;o++)a=Xu(r,0,o,this.toBBox),l=Xu(r,o,e,this.toBBox),f=MT(a,l),h=Mp(a)+Mp(l),f<p?(p=f,g=o,d=h<d?h:d):f===p&&h<d&&(d=h,g=o);return g},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:W0,a=r.leaf?this.compareMinY:q0,l=this._allDistMargin(r,t,e,o),f=this._allDistMargin(r,t,e,a);l<f&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,l=Xu(r,0,t,a),f=Xu(r,e-t,e,a),h=Pc(l)+Pc(f),p,d;for(p=t;p<e-t;p++)d=r.children[p],Yu(l,r.leaf?a(d):d),h+=Pc(l);for(p=e-t-1;p>=t;p--)d=r.children[p],Yu(f,r.leaf?a(d):d),h+=Pc(f);return h},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)Yu(t[o],r)},_condense:function(r){for(var t=r.length-1,e;t>=0;t--)r[t].children.length===0?t>0?(e=r[t-1].children,e.splice(e.indexOf(r[t]),1)):this.clear():tu(r[t],this.toBBox)},_initFormat:function(r){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(r[0])),this.compareMinY=new Function("a","b",t.join(r[1])),this.toBBox=new Function("a","return {minX: a"+r[0]+", minY: a"+r[1]+", maxX: a"+r[2]+", maxY: a"+r[3]+"};")}};function xT(r,t,e){if(!e)return t.indexOf(r);for(var o=0;o<t.length;o++)if(e(r,t[o]))return o;return-1}function tu(r,t){Xu(r,0,r.children.length,t,r)}function Xu(r,t,e,o,a){a||(a=eu(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var l=t,f;l<e;l++)f=r.children[l],Yu(a,r.leaf?o(f):f);return a}function Yu(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function W0(r,t){return r.minX-t.minX}function q0(r,t){return r.minY-t.minY}function Mp(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function Pc(r){return r.maxX-r.minX+(r.maxY-r.minY)}function ET(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function MT(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),l=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,l-o)}function wp(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Ic(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function eu(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function X0(r,t,e,o,a){for(var l=[t,e],f;l.length;)e=l.pop(),t=l.pop(),!(e-t<=o)&&(f=t+Math.ceil((e-t)/o/2)*o,_T(r,f,t,e,a),l.push(t,f,f,e))}});var Q0=Zt((EO,Rp)=>{"use strict";Rp.exports=Oc;Rp.exports.default=Oc;function Oc(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=Z0(r,0,a,e,!0),f=[];if(!l||l.next===l.prev)return f;var h,p,d,g,_,y,M;if(o&&(l=LT(r,t,l,e)),r.length>80*e){h=d=r[0],p=g=r[1];for(var S=e;S<a;S+=e)_=r[S],y=r[S+1],_<h&&(h=_),y<p&&(p=y),_>d&&(d=_),y>g&&(g=y);M=Math.max(d-h,g-p),M=M!==0?32767/M:0}return Ku(l,f,e,h,p,M,0),f}function Z0(r,t,e,o,a){var l,f;if(a===Ip(r,t,e,o)>0)for(l=t;l<e;l+=o)f=$0(l,r[l],r[l+1],f);else for(l=e-o;l>=t;l-=o)f=$0(l,r[l],r[l+1],f);return f&&Dc(f,f.next)&&(ju(f),f=f.next),f}function ea(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(Dc(e,e.next)||Bn(e.prev,e,e.next)===0)){if(ju(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function Ku(r,t,e,o,a,l,f){if(r){!f&&l&&UT(r,o,a,l);for(var h=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?PT(r,o,a,l):CT(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),ju(r),r=d.next,h=d.next;continue}if(r=d,r===h){f?f===1?(r=IT(ea(r),t,e),Ku(r,t,e,o,a,l,2)):f===2&&RT(r,t,e,o,a,l):Ku(ea(r),t,e,o,a,l,1);break}}}}function CT(r){var t=r.prev,e=r,o=r.next;if(Bn(t,e,o)>=0)return!1;for(var a=t.x,l=e.x,f=o.x,h=t.y,p=e.y,d=o.y,g=a<l?a<f?a:f:l<f?l:f,_=h<p?h<d?h:d:p<d?p:d,y=a>l?a>f?a:f:l>f?l:f,M=h>p?h>d?h:d:p>d?p:d,S=o.next;S!==t;){if(S.x>=g&&S.x<=y&&S.y>=_&&S.y<=M&&iu(a,h,l,p,f,d,S.x,S.y)&&Bn(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function PT(r,t,e,o){var a=r.prev,l=r,f=r.next;if(Bn(a,l,f)>=0)return!1;for(var h=a.x,p=l.x,d=f.x,g=a.y,_=l.y,y=f.y,M=h<p?h<d?h:d:p<d?p:d,S=g<_?g<y?g:y:_<y?_:y,T=h>p?h>d?h:d:p>d?p:d,x=g>_?g>y?g:y:_>y?_:y,v=Cp(M,S,t,e,o),C=Cp(T,x,t,e,o),w=r.prevZ,O=r.nextZ;w&&w.z>=v&&O&&O.z<=C;){if(w.x>=M&&w.x<=T&&w.y>=S&&w.y<=x&&w!==a&&w!==f&&iu(h,g,p,_,d,y,w.x,w.y)&&Bn(w.prev,w,w.next)>=0||(w=w.prevZ,O.x>=M&&O.x<=T&&O.y>=S&&O.y<=x&&O!==a&&O!==f&&iu(h,g,p,_,d,y,O.x,O.y)&&Bn(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;w&&w.z>=v;){if(w.x>=M&&w.x<=T&&w.y>=S&&w.y<=x&&w!==a&&w!==f&&iu(h,g,p,_,d,y,w.x,w.y)&&Bn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;O&&O.z<=C;){if(O.x>=M&&O.x<=T&&O.y>=S&&O.y<=x&&O!==a&&O!==f&&iu(h,g,p,_,d,y,O.x,O.y)&&Bn(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function IT(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!Dc(a,l)&&J0(a,o,o.next,l)&&Qu(a,l)&&Qu(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),ju(o),ju(o.next),o=r=l),o=o.next}while(o!==r);return ea(o)}function RT(r,t,e,o,a,l){var f=r;do{for(var h=f.next.next;h!==f.prev;){if(f.i!==h.i&&kT(f,h)){var p=K0(f,h);f=ea(f,f.next),p=ea(p,p.next),Ku(f,t,e,o,a,l,0),Ku(p,t,e,o,a,l,0);return}h=h.next}f=f.next}while(f!==r)}function LT(r,t,e,o){var a=[],l,f,h,p,d;for(l=0,f=t.length;l<f;l++)h=t[l]*o,p=l<f-1?t[l+1]*o:r.length,d=Z0(r,h,p,o,!1),d===d.next&&(d.steiner=!0),a.push(zT(d));for(a.sort(NT),l=0;l<a.length;l++)e=OT(a[l],e);return e}function NT(r,t){return r.x-t.x}function OT(r,t){var e=DT(r,t);if(!e)return t;var o=K0(e,r);return ea(o,o.next),ea(e,e.next)}function DT(r,t){var e=t,o=r.x,a=r.y,l=-1/0,f;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var h=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=o&&h>l&&(l=h,f=e.x<e.next.x?e:e.next,h===o))return f}e=e.next}while(e!==t);if(!f)return null;var p=f,d=f.x,g=f.y,_=1/0,y;e=f;do o>=e.x&&e.x>=d&&o!==e.x&&iu(a<g?o:l,a,d,g,a<g?l:o,a,e.x,e.y)&&(y=Math.abs(a-e.y)/(o-e.x),Qu(e,r)&&(y<_||y===_&&(e.x>f.x||e.x===f.x&&FT(f,e)))&&(f=e,_=y)),e=e.next;while(e!==p);return f}function FT(r,t){return Bn(r.prev,r,t.prev)<0&&Bn(t.next,r,r.next)<0}function UT(r,t,e,o){var a=r;do a.z===0&&(a.z=Cp(a.x,a.y,t,e,o)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==r);a.prevZ.nextZ=null,a.prevZ=null,BT(a)}function BT(r){var t,e,o,a,l,f,h,p,d=1;do{for(e=r,r=null,l=null,f=0;e;){for(f++,o=e,h=0,t=0;t<d&&(h++,o=o.nextZ,!!o);t++);for(p=d;h>0||p>0&&o;)h!==0&&(p===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,h--):(a=o,o=o.nextZ,p--),l?l.nextZ=a:r=a,a.prevZ=l,l=a;e=o}l.nextZ=null,d*=2}while(f>1);return r}function Cp(r,t,e,o,a){return r=(r-e)*a|0,t=(t-o)*a|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function zT(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function iu(r,t,e,o,a,l,f,h){return(a-f)*(t-h)>=(r-f)*(l-h)&&(r-f)*(o-h)>=(e-f)*(t-h)&&(e-f)*(l-h)>=(a-f)*(o-h)}function kT(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!GT(r,t)&&(Qu(r,t)&&Qu(t,r)&&VT(r,t)&&(Bn(r.prev,r,t.prev)||Bn(r,t.prev,t))||Dc(r,t)&&Bn(r.prev,r,r.next)>0&&Bn(t.prev,t,t.next)>0)}function Bn(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Dc(r,t){return r.x===t.x&&r.y===t.y}function J0(r,t,e,o){var a=Nc(Bn(r,t,e)),l=Nc(Bn(r,t,o)),f=Nc(Bn(e,o,r)),h=Nc(Bn(e,o,t));return!!(a!==l&&f!==h||a===0&&Lc(r,e,t)||l===0&&Lc(r,o,t)||f===0&&Lc(e,r,o)||h===0&&Lc(e,t,o))}function Lc(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Nc(r){return r>0?1:r<0?-1:0}function GT(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&J0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Qu(r,t){return Bn(r.prev,r,r.next)<0?Bn(r,t,r.next)>=0&&Bn(r,r.prev,t)>=0:Bn(r,t,r.prev)<0||Bn(r,r.next,t)<0}function VT(r,t){var e=r,o=!1,a=(r.x+t.x)/2,l=(r.y+t.y)/2;do e.y>l!=e.next.y>l&&e.next.y!==e.y&&a<(e.next.x-e.x)*(l-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function K0(r,t){var e=new Pp(r.i,r.x,r.y),o=new Pp(t.i,t.x,t.y),a=r.next,l=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,l.next=o,o.prev=l,o}function $0(r,t,e,o){var a=new Pp(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function ju(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Pp(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Oc.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,f=Math.abs(Ip(r,0,l,e));if(a)for(var h=0,p=t.length;h<p;h++){var d=t[h]*e,g=h<p-1?t[h+1]*e:r.length;f-=Math.abs(Ip(r,d,g,e))}var _=0;for(h=0;h<o.length;h+=3){var y=o[h]*e,M=o[h+1]*e,S=o[h+2]*e;_+=Math.abs((r[y]-r[S])*(r[M+1]-r[y+1])-(r[y]-r[M])*(r[S+1]-r[y+1]))}return f===0&&_===0?0:Math.abs((_-f)/f)};function Ip(r,t,e,o){for(var a=0,l=t,f=e-o;l<e;l+=o)a+=(r[f]-r[l])*(r[l+1]+r[f+1]),f=l;return a}Oc.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var l=0;l<r[a].length;l++)for(var f=0;f<t;f++)e.vertices.push(r[a][l][f]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var Fp=Zt(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.earthRadius=63710088e-1;ue.factors={centimeters:ue.earthRadius*100,centimetres:ue.earthRadius*100,degrees:ue.earthRadius/111325,feet:ue.earthRadius*3.28084,inches:ue.earthRadius*39.37,kilometers:ue.earthRadius/1e3,kilometres:ue.earthRadius/1e3,meters:ue.earthRadius,metres:ue.earthRadius,miles:ue.earthRadius/1609.344,millimeters:ue.earthRadius*1e3,millimetres:ue.earthRadius*1e3,nauticalmiles:ue.earthRadius/1852,radians:1,yards:ue.earthRadius*1.0936};ue.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/ue.earthRadius,yards:1.0936133};ue.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Ss(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}ue.feature=Ss;function WT(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Lp(t).geometry;case"LineString":return Op(t).geometry;case"Polygon":return Np(t).geometry;case"MultiPoint":return ty(t).geometry;case"MultiLineString":return j0(t).geometry;case"MultiPolygon":return ey(t).geometry;default:throw new Error(r+" is invalid")}}ue.geometry=WT;function Lp(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Fc(r[0])||!Fc(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Ss(o,t,e)}ue.point=Lp;function qT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Lp(o,t)}),e)}ue.points=qT;function Np(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var f=0;f<l[l.length-1].length;f++)if(l[l.length-1][f]!==l[0][f])throw new Error("First and last Position are not equivalent.")}var h={type:"Polygon",coordinates:r};return Ss(h,t,e)}ue.polygon=Np;function XT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Np(o,t)}),e)}ue.polygons=XT;function Op(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return Ss(o,t,e)}ue.lineString=Op;function YT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Op(o,t)}),e)}ue.lineStrings=YT;function Uc(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}ue.featureCollection=Uc;function j0(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Ss(o,t,e)}ue.multiLineString=j0;function ty(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Ss(o,t,e)}ue.multiPoint=ty;function ey(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Ss(o,t,e)}ue.multiPolygon=ey;function $T(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Ss(o,t,e)}ue.geometryCollection=$T;function ZT(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}ue.round=ZT;function ny(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}ue.radiansToLength=ny;function Dp(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}ue.lengthToRadians=Dp;function JT(r,t){return ry(Dp(r,t))}ue.lengthToDegrees=JT;function KT(r){var t=r%360;return t<0&&(t+=360),t}ue.bearingToAzimuth=KT;function ry(r){var t=r%(2*Math.PI);return t*180/Math.PI}ue.radiansToDegrees=ry;function QT(r){var t=r%360;return t*Math.PI/180}ue.degreesToRadians=QT;function jT(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return ny(Dp(r,t),e)}ue.convertLength=jT;function tA(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=ue.areaFactors[t];if(!o)throw new Error("invalid original units");var a=ue.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}ue.convertArea=tA;function Fc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}ue.isNumber=Fc;function eA(r){return!!r&&r.constructor===Object}ue.isObject=eA;function nA(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!Fc(t))throw new Error("bbox must only contain numbers")})}ue.validateBBox=nA;function rA(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}ue.validateId=rA});var Bp=Zt(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});var Vr=Fp();function tl(r,t,e){if(r!==null)for(var o,a,l,f,h,p,d,g=0,_=0,y,M=r.type,S=M==="FeatureCollection",T=M==="Feature",x=S?r.features.length:1,v=0;v<x;v++){d=S?r.features[v].geometry:T?r.geometry:r,y=d?d.type==="GeometryCollection":!1,h=y?d.geometries.length:1;for(var C=0;C<h;C++){var w=0,O=0;if(f=y?d.geometries[C]:d,f!==null){p=f.coordinates;var F=f.type;switch(g=e&&(F==="Polygon"||F==="MultiPolygon")?1:0,F){case null:break;case"Point":if(t(p,_,v,w,O)===!1)return!1;_++,w++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,w,O)===!1)return!1;_++,F==="MultiPoint"&&w++}F==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],_,v,w,O)===!1)return!1;_++}F==="MultiLineString"&&w++,F==="Polygon"&&O++}F==="Polygon"&&w++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(O=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],_,v,w,O)===!1)return!1;_++}O++}w++}break;case"GeometryCollection":for(o=0;o<f.geometries.length;o++)if(tl(f.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function iA(r,t,e,o){var a=e;return tl(r,function(l,f,h,p,d){f===0&&e===void 0?a=l:a=t(a,l,f,h,p,d)},o),a}function iy(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}function oA(r,t,e){var o=e;return iy(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function oy(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function sA(r,t,e){var o=e;return oy(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function aA(r){var t=[];return tl(r,function(e){t.push(e)}),t}function Up(r,t){var e,o,a,l,f,h,p,d,g,_,y=0,M=r.type==="FeatureCollection",S=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(h=M?r.features[e].geometry:S?r.geometry:r,d=M?r.features[e].properties:S?r.properties:{},g=M?r.features[e].bbox:S?r.bbox:void 0,_=M?r.features[e].id:S?r.id:void 0,p=h?h.type==="GeometryCollection":!1,f=p?h.geometries.length:1,a=0;a<f;a++){if(l=p?h.geometries[a]:h,l===null){if(t(null,y,d,g,_)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,y,d,g,_)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],y,d,g,_)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}function uA(r,t,e){var o=e;return Up(r,function(a,l,f,h,p){l===0&&e===void 0?o=a:o=t(o,a,l,f,h,p)}),o}function Bc(r,t){Up(r,function(e,o,a,l,f){var h=e===null?null:e.type;switch(h){case null:case"Point":case"LineString":case"Polygon":return t(Vr.feature(e,a,{bbox:l,id:f}),o,0)===!1?!1:void 0}var p;switch(h){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],_={type:p,coordinates:g};if(t(Vr.feature(_,a),o,d)===!1)return!1}})}function lA(r,t,e){var o=e;return Bc(r,function(a,l,f){l===0&&f===0&&e===void 0?o=a:o=t(o,a,l,f)}),o}function sy(r,t){Bc(r,function(e,o,a){var l=0;if(e.geometry){var f=e.geometry.type;if(!(f==="Point"||f==="MultiPoint")){var h,p=0,d=0,g=0;if(tl(e,function(_,y,M,S,T){if(h===void 0||o>p||S>d||T>g){h=_,p=o,d=S,g=T,l=0;return}var x=Vr.lineString([h,_],e.properties);if(t(x,o,a,T,l)===!1)return!1;l++,h=_})===!1)return!1}}})}function cA(r,t,e){var o=e,a=!1;return sy(r,function(l,f,h,p,d){a===!1&&e===void 0?o=l:o=t(o,l,f,h,p,d),a=!0}),o}function ay(r,t){if(!r)throw new Error("geojson is required");Bc(r,function(e,o,a){if(e.geometry!==null){var l=e.geometry.type,f=e.geometry.coordinates;switch(l){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var h=0;h<f.length;h++)if(t(Vr.lineString(f[h],e.properties),o,a,h)===!1)return!1;break}}})}function fA(r,t,e){var o=e;return ay(r,function(a,l,f,h){l===0&&e===void 0?o=a:o=t(o,a,l,f,h)}),o}function hA(r,t){if(t=t||{},!Vr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.segmentIndex||0,f=t.properties,h;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),f=f||r.features[e].properties,h=r.features[e].geometry;break;case"Feature":f=f||r.properties,h=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":h=r;break;default:throw new Error("geojson is invalid")}if(h===null)return null;var p=h.coordinates;switch(h.type){case"Point":case"MultiPoint":return null;case"LineString":return l<0&&(l=p.length+l-1),Vr.lineString([p[l],p[l+1]],f,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l-1),Vr.lineString([p[a][l],p[a][l+1]],f,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l-1),Vr.lineString([p[o][l],p[o][l+1]],f,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l-1),Vr.lineString([p[o][a][l],p[o][a][l+1]],f,t)}throw new Error("geojson is invalid")}function pA(r,t){if(t=t||{},!Vr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.coordIndex||0,f=t.properties,h;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),f=f||r.features[e].properties,h=r.features[e].geometry;break;case"Feature":f=f||r.properties,h=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":h=r;break;default:throw new Error("geojson is invalid")}if(h===null)return null;var p=h.coordinates;switch(h.type){case"Point":return Vr.point(p,f,t);case"MultiPoint":return o<0&&(o=p.length+o),Vr.point(p[o],f,t);case"LineString":return l<0&&(l=p.length+l),Vr.point(p[l],f,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Vr.point(p[a][l],f,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Vr.point(p[o][l],f,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l),Vr.point(p[o][a][l],f,t)}throw new Error("geojson is invalid")}or.coordAll=aA;or.coordEach=tl;or.coordReduce=iA;or.featureEach=oy;or.featureReduce=sA;or.findPoint=pA;or.findSegment=hA;or.flattenEach=Bc;or.flattenReduce=lA;or.geomEach=Up;or.geomReduce=uA;or.lineEach=ay;or.lineReduce=fA;or.propEach=iy;or.propReduce=oA;or.segmentEach=sy;or.segmentReduce=cA});var uy=Zt(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});var dA=Bp();function zp(r){var t=[1/0,1/0,-1/0,-1/0];return dA.coordEach(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}zp.default=zp;kp.default=zp});var zc=Zt((UO,Gp)=>{var _o=hp(),cy=Fp(),fy=Bp(),ou=uy().default,mA=fy.featureEach,DO=fy.coordEach,FO=cy.polygon,ly=cy.featureCollection;function hy(r){var t=new _o(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:ou(e),_o.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:ou(a),o.push(a)}):mA(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:ou(a),o.push(a)}),_o.prototype.load.call(this,o)},t.remove=function(e,o){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:ou(e),_o.prototype.remove.call(this,e,o)},t.clear=function(){return _o.prototype.clear.call(this)},t.search=function(e){var o=_o.prototype.search.call(this,this.toBBox(e));return ly(o)},t.collides=function(e){return _o.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=_o.prototype.all.call(this);return ly(e)},t.toJSON=function(){return _o.prototype.toJSON.call(this)},t.fromJSON=function(e){return _o.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var o;if(e.bbox)o=e.bbox;else if(Array.isArray(e)&&e.length===4)o=e;else if(Array.isArray(e)&&e.length===6)o=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")o=ou(e);else if(e.type==="FeatureCollection")o=ou(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Gp.exports=hy;Gp.exports.default=hy});var Yp=Zt((X3,My)=>{"use strict";var Ey=Object.prototype.toString;My.exports=function(t){var e=Ey.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Ey.call(t.callee)==="[object Function]"),o}});var Ry=Zt((Y3,Iy)=>{"use strict";var Py;Object.keys||(rl=Object.prototype.hasOwnProperty,$p=Object.prototype.toString,wy=Yp(),Zp=Object.prototype.propertyIsEnumerable,Sy=!Zp.call({toString:null},"toString"),by=Zp.call(function(){},"prototype"),il=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Wc=function(r){var t=r.constructor;return t&&t.prototype===r},Ty={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},Ay=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!Ty["$"+r]&&rl.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Wc(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),Cy=function(r){if(typeof window=="undefined"||!Ay)return Wc(r);try{return Wc(r)}catch(t){return!1}},Py=function(t){var e=t!==null&&typeof t=="object",o=$p.call(t)==="[object Function]",a=wy(t),l=e&&$p.call(t)==="[object String]",f=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var h=by&&o;if(l&&t.length>0&&!rl.call(t,0))for(var p=0;p<t.length;++p)f.push(String(p));if(a&&t.length>0)for(var d=0;d<t.length;++d)f.push(String(d));else for(var g in t)!(h&&g==="prototype")&&rl.call(t,g)&&f.push(String(g));if(Sy)for(var _=Cy(t),y=0;y<il.length;++y)!(_&&il[y]==="constructor")&&rl.call(t,il[y])&&f.push(il[y]);return f});var rl,$p,wy,Zp,Sy,by,il,Wc,Ty,Ay,Cy;Iy.exports=Py});var Jp=Zt(($3,Oy)=>{"use strict";var bA=Array.prototype.slice,TA=Yp(),Ly=Object.keys,qc=Ly?function(t){return Ly(t)}:Ry(),Ny=Object.keys;qc.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(o){return TA(o)?Ny(bA.call(o)):Ny(o)})}else Object.keys=qc;return Object.keys||qc};Oy.exports=qc});var Kp=Zt((Z3,Dy)=>{"use strict";Dy.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var l=Object.getOwnPropertySymbols(t);if(l.length!==1||l[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(t,e);if(f.value!==a||f.enumerable!==!0)return!1}return!0}});var Xc=Zt((J3,Fy)=>{"use strict";var AA=Kp();Fy.exports=function(){return AA()&&!!Symbol.toStringTag}});var zy=Zt((K3,By)=>{"use strict";var Uy=typeof Symbol!="undefined"&&Symbol,CA=Kp();By.exports=function(){return typeof Uy!="function"||typeof Symbol!="function"||typeof Uy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:CA()}});var Vy=Zt((Q3,Gy)=>{"use strict";var ky={foo:{}},PA=Object;Gy.exports=function(){return{__proto__:ky}.foo===ky.foo&&!({__proto__:null}instanceof PA)}});var qy=Zt((j3,Wy)=>{"use strict";var IA="Function.prototype.bind called on incompatible ",RA=Object.prototype.toString,LA=Math.max,NA="[object Function]",Hy=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var l=0;l<e.length;l+=1)o[l+t.length]=e[l];return o},OA=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},DA=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};Wy.exports=function(t){var e=this;if(typeof e!="function"||RA.apply(e)!==NA)throw new TypeError(IA+e);for(var o=OA(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,Hy(o,arguments));return Object(g)===g?g:this}return e.apply(t,Hy(o,arguments))},f=LA(0,e.length-o.length),h=[],p=0;p<f;p++)h[p]="$"+p;if(a=Function("binder","return function ("+DA(h,",")+"){ return binder.apply(this,arguments); }")(l),e.prototype){var d=function(){};d.prototype=e.prototype,a.prototype=new d,d.prototype=null}return a}});var Yc=Zt((tF,Xy)=>{"use strict";var FA=qy();Xy.exports=Function.prototype.bind||FA});var $y=Zt((eF,Yy)=>{"use strict";var UA=Function.prototype.call,BA=Object.prototype.hasOwnProperty,zA=Yc();Yy.exports=zA.call(UA,BA)});var ia=Zt((nF,jy)=>{"use strict";var tn,lu=SyntaxError,Qy=Function,uu=TypeError,Qp=function(r){try{return Qy('"use strict"; return ('+r+").constructor;")()}catch(t){}},na=Object.getOwnPropertyDescriptor;if(na)try{na({},"")}catch(r){na=null}var jp=function(){throw new uu},kA=na?function(){try{return arguments.callee,jp}catch(r){try{return na(arguments,"callee").get}catch(t){return jp}}}():jp,su=zy()(),GA=Vy()(),_r=Object.getPrototypeOf||(GA?function(r){return r.__proto__}:null),au={},VA=typeof Uint8Array=="undefined"||!_r?tn:_r(Uint8Array),ra={"%AggregateError%":typeof AggregateError=="undefined"?tn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?tn:ArrayBuffer,"%ArrayIteratorPrototype%":su&&_r?_r([][Symbol.iterator]()):tn,"%AsyncFromSyncIteratorPrototype%":tn,"%AsyncFunction%":au,"%AsyncGenerator%":au,"%AsyncGeneratorFunction%":au,"%AsyncIteratorPrototype%":au,"%Atomics%":typeof Atomics=="undefined"?tn:Atomics,"%BigInt%":typeof BigInt=="undefined"?tn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?tn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?tn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?tn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array=="undefined"?tn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?tn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?tn:FinalizationRegistry,"%Function%":Qy,"%GeneratorFunction%":au,"%Int8Array%":typeof Int8Array=="undefined"?tn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?tn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?tn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":su&&_r?_r(_r([][Symbol.iterator]())):tn,"%JSON%":typeof JSON=="object"?JSON:tn,"%Map%":typeof Map=="undefined"?tn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!su||!_r?tn:_r(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?tn:Promise,"%Proxy%":typeof Proxy=="undefined"?tn:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect=="undefined"?tn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?tn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!su||!_r?tn:_r(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?tn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":su&&_r?_r(""[Symbol.iterator]()):tn,"%Symbol%":su?Symbol:tn,"%SyntaxError%":lu,"%ThrowTypeError%":kA,"%TypedArray%":VA,"%TypeError%":uu,"%Uint8Array%":typeof Uint8Array=="undefined"?tn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?tn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?tn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?tn:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap=="undefined"?tn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?tn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?tn:WeakSet};if(_r)try{null.error}catch(r){Zy=_r(_r(r)),ra["%Error.prototype%"]=Zy}var Zy,HA=function r(t){var e;if(t==="%AsyncFunction%")e=Qp("async function () {}");else if(t==="%GeneratorFunction%")e=Qp("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Qp("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&_r&&(e=_r(a.prototype))}return ra[t]=e,e},Jy={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ol=Yc(),$c=$y(),WA=ol.call(Function.call,Array.prototype.concat),qA=ol.call(Function.apply,Array.prototype.splice),Ky=ol.call(Function.call,String.prototype.replace),Zc=ol.call(Function.call,String.prototype.slice),XA=ol.call(Function.call,RegExp.prototype.exec),YA=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,$A=/\\\\(\\\\)?/g,ZA=function(t){var e=Zc(t,0,1),o=Zc(t,-1);if(e==="%"&&o!=="%")throw new lu("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new lu("invalid intrinsic syntax, expected opening \`%\`");var a=[];return Ky(t,YA,function(l,f,h,p){a[a.length]=h?Ky(p,$A,"$1"):f||l}),a},JA=function(t,e){var o=t,a;if($c(Jy,o)&&(a=Jy[o],o="%"+a[0]+"%"),$c(ra,o)){var l=ra[o];if(l===au&&(l=HA(o)),typeof l=="undefined"&&!e)throw new uu("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new lu("intrinsic "+t+" does not exist!")};jy.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new uu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new uu('"allowMissing" argument must be a boolean');if(XA(/^%?[^%]*%?$/,t)===null)throw new lu("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=ZA(t),a=o.length>0?o[0]:"",l=JA("%"+a+"%",e),f=l.name,h=l.value,p=!1,d=l.alias;d&&(a=d[0],qA(o,WA([0,1],d)));for(var g=1,_=!0;g<o.length;g+=1){var y=o[g],M=Zc(y,0,1),S=Zc(y,-1);if((M==='"'||M==="'"||M==="\`"||S==='"'||S==="'"||S==="\`")&&M!==S)throw new lu("property names with quotes must have matching quotes");if((y==="constructor"||!_)&&(p=!0),a+="."+y,f="%"+a+"%",$c(ra,f))h=ra[f];else if(h!=null){if(!(y in h)){if(!e)throw new uu("base intrinsic for "+t+" exists, but the property is not available.");return}if(na&&g+1>=o.length){var T=na(h,y);_=!!T,_&&"get"in T&&!("originalValue"in T.get)?h=T.get:h=h[y]}else _=$c(h,y),h=h[y];_&&!p&&(ra[f]=h)}}return h}});var sl=Zt((rF,tv)=>{"use strict";var KA=ia(),td=KA("%Object.defineProperty%",!0),ed=function(){if(td)try{return td({},"a",{value:1}),!0}catch(t){return!1}return!1};ed.hasArrayLengthDefineBug=function(){if(!ed())return null;try{return td([],"length",{value:1}).length!==1}catch(t){return!0}};tv.exports=ed});var nd=Zt((iF,ev)=>{"use strict";var QA=ia(),Jc=QA("%Object.getOwnPropertyDescriptor%",!0);if(Jc)try{Jc([],"length")}catch(r){Jc=null}ev.exports=Jc});var Kc=Zt((oF,rv)=>{"use strict";var jA=sl()(),rd=ia(),al=jA&&rd("%Object.defineProperty%",!0);if(al)try{al({},"a",{value:1})}catch(r){al=!1}var tC=rd("%SyntaxError%"),cu=rd("%TypeError%"),nv=nd();rv.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new cu("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new cu("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new cu("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new cu("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new cu("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new cu("\`loose\`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,h=arguments.length>6?arguments[6]:!1,p=!!nv&&nv(t,e);if(al)al(t,e,{configurable:f===null&&p?p.configurable:!f,enumerable:a===null&&p?p.enumerable:!a,value:o,writable:l===null&&p?p.writable:!l});else if(h||!a&&!l&&!f)t[e]=o;else throw new tC("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var lv=Zt((sF,uv)=>{"use strict";var av=ia(),iv=Kc(),eC=sl()(),ov=nd(),sv=av("%TypeError%"),nC=av("%Math.floor%");uv.exports=function(t,e){if(typeof t!="function")throw new sv("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||nC(e)!==e)throw new sv("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&ov){var f=ov(t,"length");f&&!f.configurable&&(a=!1),f&&!f.writable&&(l=!1)}return(a||l||!o)&&(eC?iv(t,"length",e,!0,!0):iv(t,"length",e)),t}});var jc=Zt((aF,Qc)=>{"use strict";var id=Yc(),fu=ia(),rC=lv(),iC=fu("%TypeError%"),fv=fu("%Function.prototype.apply%"),hv=fu("%Function.prototype.call%"),pv=fu("%Reflect.apply%",!0)||id.call(hv,fv),ul=fu("%Object.defineProperty%",!0),oC=fu("%Math.max%");if(ul)try{ul({},"a",{value:1})}catch(r){ul=null}Qc.exports=function(t){if(typeof t!="function")throw new iC("a function is required");var e=pv(id,hv,arguments);return rC(e,1+oC(0,t.length-(arguments.length-1)),!0)};var cv=function(){return pv(id,fv,arguments)};ul?ul(Qc.exports,"apply",{value:cv}):Qc.exports.apply=cv});var od=Zt((uF,gv)=>{"use strict";var dv=ia(),mv=jc(),sC=mv(dv("String.prototype.indexOf"));gv.exports=function(t,e){var o=dv(t,!!e);return typeof o=="function"&&sC(t,".prototype.")>-1?mv(o):o}});var _v=Zt((lF,vv)=>{"use strict";var aC=Xc()(),uC=od(),sd=uC("Object.prototype.toString"),tf=function(t){return aC&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:sd(t)==="[object Arguments]"},yv=function(t){return tf(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&sd(t)!=="[object Array]"&&sd(t.callee)==="[object Function]"},lC=function(){return tf(arguments)}();tf.isLegacyArguments=yv;vv.exports=lC?tf:yv});var hu=Zt((cF,wv)=>{"use strict";var cC=Jp(),fC=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",hC=Object.prototype.toString,pC=Array.prototype.concat,xv=Kc(),dC=function(r){return typeof r=="function"&&hC.call(r)==="[object Function]"},Ev=sl()(),mC=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!dC(o)||!o())return}Ev?xv(r,t,e,!0):xv(r,t,e)},Mv=function(r,t){var e=arguments.length>2?arguments[2]:{},o=cC(t);fC&&(o=pC.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)mC(r,o[a],t[o[a]],e[o[a]])};Mv.supportsDescriptors=!!Ev;wv.exports=Mv});var ad=Zt((fF,bv)=>{"use strict";var Sv=function(r){return r!==r};bv.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||Sv(t)&&Sv(e))}});var ud=Zt((hF,Tv)=>{"use strict";var gC=ad();Tv.exports=function(){return typeof Object.is=="function"?Object.is:gC}});var Cv=Zt((pF,Av)=>{"use strict";var yC=ud(),vC=hu();Av.exports=function(){var t=yC();return vC(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Lv=Zt((dF,Rv)=>{"use strict";var _C=hu(),xC=jc(),EC=ad(),Pv=ud(),MC=Cv(),Iv=xC(Pv(),Object);_C(Iv,{getPolyfill:Pv,implementation:EC,shim:MC});Rv.exports=Iv});var Uv=Zt((mF,Fv)=>{"use strict";var ld=od(),Nv=Xc()(),Ov,Dv,cd,fd;Nv&&(Ov=ld("Object.prototype.hasOwnProperty"),Dv=ld("RegExp.prototype.exec"),cd={},ef=function(){throw cd},fd={toString:ef,valueOf:ef},typeof Symbol.toPrimitive=="symbol"&&(fd[Symbol.toPrimitive]=ef));var ef,wC=ld("Object.prototype.toString"),SC=Object.getOwnPropertyDescriptor,bC="[object RegExp]";Fv.exports=Nv?function(t){if(!t||typeof t!="object")return!1;var e=SC(t,"lastIndex"),o=e&&Ov(e,"value");if(!o)return!1;try{Dv(t,fd)}catch(a){return a===cd}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:wC(t)===bC}});var zv=Zt((gF,Bv)=>{"use strict";var cl=function(){return typeof function(){}.name=="string"},ll=Object.getOwnPropertyDescriptor;if(ll)try{ll([],"length")}catch(r){ll=null}cl.functionsHaveConfigurableNames=function(){if(!cl()||!ll)return!1;var t=ll(function(){},"name");return!!t&&!!t.configurable};var TC=Function.prototype.bind;cl.boundFunctionsHaveNames=function(){return cl()&&typeof TC=="function"&&function(){}.bind().name!==""};Bv.exports=cl});var Vv=Zt((yF,Gv)=>{"use strict";var kv=Kc(),AC=sl()(),CC=zv().functionsHaveConfigurableNames(),PC=TypeError;Gv.exports=function(t,e){if(typeof t!="function")throw new PC("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||CC)&&(AC?kv(t,"name",e,!0,!0):kv(t,"name",e)),t}});var hd=Zt((vF,Hv)=>{"use strict";var IC=Vv(),RC=Object,LC=TypeError;Hv.exports=IC(function(){if(this!=null&&this!==RC(this))throw new LC("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0)});var pd=Zt((_F,Wv)=>{"use strict";var NC=hd(),OC=hu().supportsDescriptors,DC=Object.getOwnPropertyDescriptor;Wv.exports=function(){if(OC&&/a/mig.flags==="gim"){var t=DC(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),e==="dy")return t.get}}return NC}});var Yv=Zt((xF,Xv)=>{"use strict";var FC=hu().supportsDescriptors,UC=pd(),BC=Object.getOwnPropertyDescriptor,zC=Object.defineProperty,kC=TypeError,qv=Object.getPrototypeOf,GC=/a/;Xv.exports=function(){if(!FC||!qv)throw new kC("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=UC(),e=qv(GC),o=BC(e,"flags");return(!o||o.get!==t)&&zC(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Kv=Zt((EF,Jv)=>{"use strict";var VC=hu(),HC=jc(),WC=hd(),$v=pd(),qC=Yv(),Zv=HC($v());VC(Zv,{getPolyfill:$v,implementation:WC,shim:qC});Jv.exports=Zv});var jv=Zt((MF,Qv)=>{"use strict";var XC=Date.prototype.getDay,YC=function(t){try{return XC.call(t),!0}catch(e){return!1}},$C=Object.prototype.toString,ZC="[object Date]",JC=Xc()();Qv.exports=function(t){return typeof t!="object"||t===null?!1:JC?YC(t):$C.call(t)===ZC}});var dd=Zt((wF,c_)=>{var t_=Jp(),e_=_v(),n_=Lv(),r_=Uv(),i_=Kv(),o_=jv(),s_=Date.prototype.getTime;function l_(r,t,e){var o=e||{};return(o.strict?n_(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?n_(r,t):r==t:KC(r,t,o)}function a_(r){return r==null}function u_(r){return!(!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number")}function KC(r,t,e){var o,a;if(typeof r!=typeof t||a_(r)||a_(t)||r.prototype!==t.prototype||e_(r)!==e_(t))return!1;var l=r_(r),f=r_(t);if(l!==f)return!1;if(l||f)return r.source===t.source&&i_(r)===i_(t);if(o_(r)&&o_(t))return s_.call(r)===s_.call(t);var h=u_(r),p=u_(t);if(h!==p)return!1;if(h||p){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var d=t_(r),g=t_(t)}catch(_){return!1}if(d.length!==g.length)return!1;for(d.sort(),g.sort(),o=d.length-1;o>=0;o--)if(d[o]!=g[o])return!1;for(o=d.length-1;o>=0;o--)if(a=d[o],!l_(r[a],t[a],e))return!1;return!0}c_.exports=l_});var Td=Zt((PB,y_)=>{var GP=dd(),xo=function(r){this.precision=r&&r.precision?r.precision:17,this.direction=r&&r.direction?r.direction:!1,this.pseudoNode=r&&r.pseudoNode?r.pseudoNode:!1,this.objectComparator=r&&r.objectComparator?r.objectComparator:VP};xo.prototype.compare=function(r,t){if(r.type!==t.type||!g_(r,t))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,t.coordinates);case"LineString":return this.compareLine(r.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(r,t);case"Feature":return this.compareFeature(r,t);default:if(r.type.indexOf("Multi")===0){var e=this,o=m_(r),a=m_(t);return o.every(function(l){return this.some(function(f){return e.compare(l,f)})},a)}}return!1};function m_(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function g_(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}xo.prototype.compareCoord=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e++)if(r[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};xo.prototype.compareLine=function(r,t,e,o){if(!g_(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),l=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],l[0])&&(l=this.fixStartIndex(l,a),!l))){var f=this.compareCoord(a[e],l[e]);return this.direction||f?this.comparePath(a,l):this.compareCoord(a[e],l[l.length-(1+e)])?this.comparePath(a.slice().reverse(),l):!1}};xo.prototype.fixStartIndex=function(r,t){for(var e,o=-1,a=0;a<r.length;a++)if(this.compareCoord(r[a],t[0])){o=a;break}return o>=0&&(e=[].concat(r.slice(o,r.length),r.slice(1,o+1))),e};xo.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};xo.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(l){return this.some(function(f){return a.compareLine(l,f,1,!0)})},o)}else return!1};xo.prototype.compareFeature=function(r,t){return r.id!==t.id||!this.objectComparator(r.properties,t.properties)||!this.compareBBox(r,t)?!1:this.compare(r.geometry,t.geometry)};xo.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};xo.prototype.removePseudo=function(r){return r};function VP(r,t){return GP(r,t,{strict:!0})}y_.exports=xo});var v_=Zt((GB,of)=>{function Ts(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}Ts.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var l=this._regionQuery(a);if(l.length<this.minPts)this.noise.push(a);else{var f=this.clusters.length;this.clusters.push([]),this._addToCluster(a,f),this._expandCluster(f,l)}}return this.clusters};Ts.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Ts.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};Ts.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};Ts.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};Ts.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};Ts.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof of!="undefined"&&of.exports&&(of.exports=Ts)});var __=Zt((VB,sf)=>{function As(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}As.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};As.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var l=0;l<this.k;l++){for(var f=new Array(g),h=0,p=0;p<g;p++)f[p]=0;for(var d=0;d<e;d++){var g=this.dataset[d].length;if(l===this.assignments[d]){for(var p=0;p<g;p++)f[p]+=this.dataset[d][p];h++}}if(h>0){for(var p=0;p<g;p++)f[p]/=h;this.centroids[l]=f}else this.centroids[l]=this.randomCentroid(),a=!0}}return this.getClusters()};As.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};As.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};As.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};As.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,l=t.length,f,h=0;h<l;h++)f=e(r,t[h]),f<o&&(o=f,a=h);return a};As.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof sf!="undefined"&&sf.exports&&(sf.exports=As)});var Ad=Zt((HB,af)=>{function Eo(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}Eo.prototype.insert=function(r,t){for(var e=this._queue.length,o=e;o--;){var a=this._priorities[o];this._sorting==="desc"?t>a&&(e=o):t<a&&(e=o)}this._insertAt(r,t,e)};Eo.prototype.remove=function(r){for(var t=this._queue.length;t--;){var e=this._queue[t];if(r===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};Eo.prototype.forEach=function(r){this._queue.forEach(r)};Eo.prototype.getElements=function(){return this._queue};Eo.prototype.getElementPriority=function(r){return this._priorities[r]};Eo.prototype.getPriorities=function(){return this._priorities};Eo.prototype.getElementsWithPriorities=function(){for(var r=[],t=0,e=this._queue.length;t<e;t++)r.push([this._queue[t],this._priorities[t]]);return r};Eo.prototype._init=function(r,t,e){if(r&&t){if(this._queue=[],this._priorities=[],r.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<r.length;o++)this.insert(r[o],t[o])}e&&(this._sorting=e)};Eo.prototype._insertAt=function(r,t,e){this._queue.length===e?(this._queue.push(r),this._priorities.push(t)):(this._queue.splice(e,0,r),this._priorities.splice(e,0,t))};typeof af!="undefined"&&af.exports&&(af.exports=Eo)});var E_=Zt((WB,du)=>{typeof du!="undefined"&&du.exports&&(x_=Ad());var x_;function jo(r,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,t,e,o)}jo.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,l=this.dataset.length;a<l;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var f=this.clusters.length-1;this._orderedList.push(a);var h=new x_(null,null,"asc"),p=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,p,h),this._expandCluster(f,h))}return this.clusters};jo.prototype.getReachabilityPlot=function(){for(var r=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],a=this._reachability[o];r.push([o,a])}return r};jo.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};jo.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var l=o.distance(o.dataset[r],o.dataset[a]),f=Math.max(o._coreDistance,l);o._reachability[a]===void 0?(o._reachability[a]=f,e.insert(a,f)):f<o._reachability[a]&&(o._reachability[a]=f,e.remove(a),e.insert(a,f))}})};jo.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var l=e[o];if(this._processed[l]===void 0){var f=this._regionQuery(l);this._processed[l]=1,this.clusters[r].push(l),this._orderedList.push(l),this._distanceToCore(l)!==void 0&&(this._updateQueue(l,f,t),this._expandCluster(r,t))}}};jo.prototype._distanceToCore=function(r){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(r,e);if(o.length>=this.minPts)return e}};jo.prototype._regionQuery=function(r,t){t=t||this.epsilon;for(var e=[],o=0,a=this.dataset.length;o<a;o++)this.distance(this.dataset[r],this.dataset[o])<t&&e.push(o);return e};jo.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof du!="undefined"&&du.exports&&(du.exports=jo)});var M_=Zt((qB,uf)=>{typeof uf!="undefined"&&uf.exports&&(uf.exports={DBSCAN:v_(),KMEANS:__(),OPTICS:E_(),PriorityQueue:Ad()})});var Cd=Zt((KB,S_)=>{"use strict";S_.exports={eudist:function(t,e,o){for(var a=t.length,l=0,f=0;f<a;f++){var h=(t[f]||0)-(e[f]||0);l+=h*h}return o?Math.sqrt(l):l},mandist:function(t,e,o){for(var a=t.length,l=0,f=0;f<a;f++)l+=Math.abs((t[f]||0)-(e[f]||0));return o?Math.sqrt(l):l},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var A_=Zt((QB,T_)=>{"use strict";var b_=Cd(),$P=b_.eudist,ZP=b_.dist;T_.exports={kmrand:function(t,e){for(var o={},a=[],l=e<<2,f=t.length,h=t[0].length>0;a.length<e&&l-- >0;){var p=t[Math.floor(Math.random()*f)],d=h?p.join("_"):""+p;o[d]||(o[d]=!0,a.push(p))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?$P:ZP,a=[],l=t.length,f=t[0].length>0,h={},p=t[Math.floor(Math.random()*l)],d=f?p.join("_"):""+p;for(a.push(p),h[d]=!0;a.length<e;){for(var g=[],_=a.length,y=0,M=[],S=0;S<l;S++){for(var T=1/0,x=0;x<_;x++){var v=o(t[S],a[x]);v<=T&&(T=v)}g[S]=T}for(var C=0;C<l;C++)y+=g[C];for(var w=0;w<l;w++)M[w]={i:w,v:t[w],pr:g[w]/y,cs:0};M.sort(function(z,L){return z.pr-L.pr}),M[0].cs=M[0].pr;for(var O=1;O<l;O++)M[O].cs=M[O-1].cs+M[O].pr;for(var F=Math.random(),G=0;G<l-1&&M[G++].cs<F;);a.push(M[G-1].v)}return a}}});var L_=Zt((ez,R_)=>{"use strict";var Pd=Cd(),I_=A_(),JP=Pd.eudist,jB=Pd.mandist,tz=Pd.dist,KP=I_.kmrand,QP=I_.kmpp,C_=1e4;function P_(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function jP(r,t,e,o){var a=[],l=[],f=[],h=[],p=!1,d=o||C_,g=r.length,_=r[0].length,y=_>0,M=[];if(e)e=="kmrand"?a=KP(r,t):e=="kmpp"?a=QP(r,t):a=e;else for(var S={};a.length<t;){var T=Math.floor(Math.random()*g);S[T]||(S[T]=!0,a.push(r[T]))}do{P_(t,0,M);for(var x=0;x<g;x++){for(var v=1/0,C=0,w=0;w<t;w++){var h=y?JP(r[x],a[w]):Math.abs(r[x]-a[w]);h<=v&&(v=h,C=w)}f[x]=C,M[C]++}for(var O=[],l=[],F=0,G=0;G<t;G++)O[G]=y?P_(_,0,O[G]):0,l[G]=a[G];if(y){for(var z=0;z<t;z++)a[z]=[];for(var L=0;L<g;L++)for(var D=f[L],q=O[D],nt=r[L],k=0;k<_;k++)q[k]+=nt[k];p=!0;for(var xt=0;xt<t;xt++){for(var X=a[xt],it=O[xt],vt=l[xt],pt=M[xt],et=0;et<_;et++)X[et]=it[et]/pt||0;if(p){for(var ot=0;ot<_;ot++)if(vt[ot]!=X[ot]){p=!1;break}}}}else{for(var V=0;V<g;V++){var K=f[V];O[K]+=r[V]}for(var at=0;at<t;at++)a[at]=O[at]/M[at]||0;p=!0;for(var Tt=0;Tt<t;Tt++)if(l[Tt]!=a[Tt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:C_-d,k:t,idxs:f,centroids:a}}R_.exports=jP});var _u=Zt((Dd,Fd)=>{(function(r,t){typeof Dd=="object"&&typeof Fd!="undefined"?Fd.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(Dd,function(){"use strict";function r(J,N){if(!(J instanceof N))throw new TypeError("Cannot call a class as a function")}function t(J,N){for(var b=0;b<N.length;b++){var R=N[b];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(J,R.key,R)}}function e(J,N,b){return N&&t(J.prototype,N),b&&t(J,b),J}var o=function(){function J(N,b){this.next=null,this.key=N,this.data=b,this.left=null,this.right=null}return J}();function a(J,N){return J>N?1:J<N?-1:0}function l(J,N,b){for(var R=new o(null,null),W=R,Z=R;;){var I=b(J,N.key);if(I<0){if(N.left===null)break;if(b(J,N.left.key)<0){var P=N.left;if(N.left=P.right,P.right=N,N=P,N.left===null)break}Z.left=N,Z=N,N=N.left}else if(I>0){if(N.right===null)break;if(b(J,N.right.key)>0){var P=N.right;if(N.right=P.left,P.left=N,N=P,N.right===null)break}W.right=N,W=N,N=N.right}else break}return W.right=N.left,Z.left=N.right,N.left=R.right,N.right=R.left,N}function f(J,N,b,R){var W=new o(J,N);if(b===null)return W.left=W.right=null,W;b=l(J,b,R);var Z=R(J,b.key);return Z<0?(W.left=b.left,W.right=b,b.left=null):Z>=0&&(W.right=b.right,W.left=b,b.right=null),W}function h(J,N,b){var R=null,W=null;if(N){N=l(J,N,b);var Z=b(N.key,J);Z===0?(R=N.left,W=N.right):Z<0?(W=N.right,N.right=null,R=N):(R=N.left,N.left=null,W=N)}return{left:R,right:W}}function p(J,N,b){return N===null?J:(J===null||(N=l(J.key,N,b),N.left=J),N)}function d(J,N,b,R,W){if(J){R(""+N+(b?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+W(J)+\`
|
|
90
|
+
`,p=new A.ShaderMaterial({uniforms:{uColor:{value:new A.Color(n[0]).convertLinearToSRGB()},uGradualColor:{value:new A.Color(n[1]).convertLinearToSRGB()},center:{value:t},maxValue:{value:e},opacity:{value:i},uDirection:{value:r},uMax:{value:s},uMin:{value:a}},vertexShader:l,fragmentShader:c,side:A.DoubleSide});return this.shaderMaterialMap.set(u,p),p}async createGroundTextureMaterial({url:n,opacity:t}){let e=`${n}-${t}`;if(this.groundTextureMaterialMap.has(e))return this.groundTextureMaterialMap.get(e);let i=await this.context.textureFactory.getTexture(n),r=new A.MeshBasicMaterial({map:i,alphaTest:.2,side:A.DoubleSide});return i.needsUpdate=!0,this.groundTextureMaterialMap.set(e,r),r}createLine2MaterialMap({color:n,width:t,dashed:e}){let i=`${n}-${t}-${e}`;if(this.line2MaterialMap.has(i))return this.line2MaterialMap.get(i);let r=new jn.LineMaterial({color:parseInt(n.slice(1),16),dashed:e,linewidth:t,worldUnits:!0,dashSize:1,gapSize:3,dashScale:1,resolution:new A.Vector2(this.context.clientSize.width,this.context.clientSize.height)});return this.line2MaterialMap.set(i,r),r}dispose(){this.lineMaterialMap.forEach((n,t)=>{n.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((n,t)=>{n.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((n,t)=>{n.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((n,t)=>{n.dispose()}),this.shaderMaterialMap.clear(),this.groundTextureMaterialMap.forEach((n,t)=>{n.dispose(),n.map?.dispose()}),this.groundTextureMaterialMap.clear(),this.line2MaterialMap.forEach((n,t)=>{n.dispose()}),this.line2MaterialMap.clear()}};var vt=g("three");var ge=class{constructor(n){this.context=n;this.registryEvent(),this.changePrevCamera()}prevCamera={position:new vt.Vector3,zoom:1,target:new vt.Vector3};enable=!0;box=new vt.Box3;updateBox(){this.box.setFromObject(this.context.scene)}setEnable(n){this.enable=n,n?this.registryEvent():this.unRegistryEvent()}changePrevCamera(){this.prevCamera={position:this.context.camera.position.clone(),zoom:this.context.camera.zoom,target:this.context.control.target.clone()}}backToPrevCamera(){this.setEnable(!1),this.context.camera.position.copy(this.prevCamera.position),this.context.camera.zoom=this.prevCamera.zoom,this.context.control.target.copy(this.prevCamera.target),this.context.control.update(),this.setEnable(!0)}registryEvent(){this.context.addEventListener("control-change",this.onCameraChange)}unRegistryEvent(){this.context.removeEventListener("control-change",this.onCameraChange)}getCurFloorScreenPosition(){if(!this.context.scene.children.filter(h=>h instanceof pt).length)return null;let t=this.box,{camera:e,clientSize:{width:i,height:r}}=this.context,{min:s,max:a}=t,u=E(s,e,i,r),l=E(a,e,i,r),c=E(new vt.Vector3(s.x,a.y,a.z),e,i,r),p=E(new vt.Vector3(a.x,s.y,s.z),e,i,r),f=Math.min(u.x,l.x,c.x,p.x),d=Math.max(u.x,l.x,c.x,p.x),_=Math.min(u.y,l.y,c.y,p.y),v=Math.max(u.y,l.y,c.y,p.y);return{left:f,right:d,top:_,bottom:v}}checkDistanceToScreenEdge({left:n,right:t,top:e,bottom:i}){let{width:r,height:s}=this.context.clientSize,[a,u,l,c]=this.context.config.cameraBound.padding,p=t>=c,f=r-n>=u,d=s-e>=l,_=i>=a;return p&&f&&d&&_}onCameraChange=()=>{let n=this.getCurFloorScreenPosition();if(n){let{left:t,right:e,top:i,bottom:r}=n;this.checkDistanceToScreenEdge({left:t,right:e,top:i,bottom:r})?this.changePrevCamera():this.backToPrevCamera()}};dispose(){this.unRegistryEvent()}};var xt=g("three"),me=class{constructor(n){this.context=n}textureMap=new Map;loader=new xt.TextureLoader;async getTexture(n){if(this.textureMap.has(n))return this.textureMap.get(n);let t=this.loader.loadAsync(n).then(e=>(this.textureMap.set(n,e),e.format=xt.RGBAFormat,e.magFilter=xt.LinearFilter,e.minFilter=xt.LinearFilter,e.colorSpace="srgb",e));return this.textureMap.set(n,t),t}dispose(){this.textureMap.forEach(n=>{n instanceof Promise?n.then(t=>t.dispose()):n.dispose()}),this.textureMap.clear()}};var ye=class extends w.EventDispatcher{constructor(t,e){super();this.container=t;this.config=e;this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new he(this),this.hoverHelper=new pe(this),this.materialFactory=new de(this),this.textureFactory=new me(this),this.resizeClientSize(),this.registryEvent()}scene=ke();renderer=Ve();camera;control;lights=We();timer=new q;tweenGroup=new Et.Group;currentFloor;selection;hoverHelper;basicRatio;materialFactory;textureFactory;cameraBound;clientSize={width:0,height:0,x:0,y:0};renderRf=0;prevCameraZoom=1;resizeClientSize(){let{x:t,y:e,width:i,height:r}=this.container.getBoundingClientRect();this.clientSize={width:i||this.container.clientWidth,height:r||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=He(t,e),this.prevCameraZoom=this.camera.zoom,this.renderer.setSize(t,e),this.control=Xe(this.camera,this.renderer.domElement),this.control.maxPolarAngle=this.config.control.maxPolar,this.container.appendChild(this.renderer.domElement),this.scene.add(this.lights),this.basicRatio=this.getRatio(),this.control.addEventListener("change",()=>{let i=this.control.getPolarAngle();this.currentFloor?.setShadowOpacity(i/this.config.control.maxPolar),this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"}),this.prevCameraZoom!==this.camera.zoom&&(this.dispatchEvent({type:"control-zoom-change",zoom:this.camera.zoom}),this.prevCameraZoom=this.camera.zoom)}),this.cameraBound=new ge(this)}getRatio(t=new w.Vector3(0,0,0),e=new w.Vector3(100,0,0)){let{clientWidth:i,clientHeight:r}=this.container,s=E(t,this.camera,i,r),a=E(e,this.camera,i,r);return Math.ceil(Math.sqrt((a.x-s.x)**2+(a.y-s.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof w.AmbientLight&&(e.color=new w.Color(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let e=t.getCenter();e&&(this.lights.position.x=e.x,this.lights.position.y=e.y),this.cameraBound.updateBox()}onWindowResize=()=>{let{container:t,camera:e,renderer:i}=this,{clientWidth:r,clientHeight:s}=t;r=Math.max(1,r),s=Math.max(1,s),e.left=-r/2,e.right=r/2,e.top=s/2,e.bottom=-s/2,e.updateProjectionMatrix(),i.setSize(r,s),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:r,height:s})};onClick=t=>{let{graphics:e,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY);e.length&&this.dispatchEvent({type:"graphic-click",graphics:e,position:i});let r=this.getPoisByDeviceXy(t.offsetX,t.offsetY);r.length&&this.dispatchEvent({type:"poi-click",pois:r})};getGraphicsByDeviceXy(t,e){let i=new w.Vector2;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let r=new w.Raycaster;return r.setFromCamera(i,this.camera),r.ray.origin.sub(r.ray.direction.clone().multiplyScalar(100)),this.currentFloor?.graphicLayer.getGraphicByRaycaster(r)||{graphics:[],position:null}}getPoisByDeviceXy(t,e){let i=this.currentFloor?.poiLayer.getPoiByDeviceXy(t,e),r=this.currentFloor?.poiLayer2.getPoiByDeviceXy(t,e);return(i||[]).concat(r||[])}onPointerover=t=>{let{graphics:e,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),r=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-over",e:t,graphics:e,pois:r,position:i})};onPointermove=t=>{let{graphics:e,position:i}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),r=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-move",e:t,graphics:e,pois:r,position:i})};onPointerleave=t=>{this.dispatchEvent({type:"pointer-level"})};onSelectionSelect=({graphics:t,isMultipleSelect:e})=>{this.dispatchEvent({type:"select-graphic",graphics:t,isMultipleSelect:e})};onHoverChange=({graphics:t})=>{this.dispatchEvent({type:"hover",graphics:t})};registryEvent(){window.addEventListener("resize",this.onWindowResize),this.container.addEventListener("click",this.onClick),this.container.addEventListener("pointerover",this.onPointerover),this.container.addEventListener("pointermove",this.onPointermove),this.container.addEventListener("pointerleave",this.onPointerleave),this.container.addEventListener("pointercancel",this.onPointerleave),this.container.addEventListener("pointerout",this.onPointerleave),this.selection.addEventListener("select",this.onSelectionSelect),this.hoverHelper.addEventListener("hover-change",this.onHoverChange)}unRegistryEvent(){window.removeEventListener("resize",this.onWindowResize),this.container.removeEventListener("click",this.onClick),this.container.removeEventListener("pointerover",this.onPointerover),this.container.removeEventListener("pointermove",this.onPointermove),this.container.removeEventListener("pointerleave",this.onPointerleave),this.container.removeEventListener("pointercancel",this.onPointerleave),this.container.removeEventListener("pointerout",this.onPointerleave),this.selection.removeEventListener("select",this.onSelectionSelect),this.hoverHelper.removeEventListener("hover-change",this.onHoverChange)}setPolarAngle(t,e=500){return e===0?(this.control.maxPolarAngle=t,this.control.minPolarAngle=t,this.control.update(),this.control.maxPolarAngle=this.config.control.maxPolar,this.control.minPolarAngle=0,Promise.resolve()):mt(new Promise(i=>{let r={polar:this.control.getPolarAngle()},s={polar:t},a=new Et.Tween(r,this.tweenGroup).to(s,e).onUpdate(()=>{this.control.maxPolarAngle=r.polar,this.control.minPolarAngle=r.polar,this.control.update()}).onComplete(()=>{this.control.enabled=!0,this.control.maxPolarAngle=this.config.control.maxPolar,this.control.minPolarAngle=0,this.tweenGroup.remove(a),i(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}setAzimuthalAngle(t,e=500){let{maxAzimuthAngle:i,minAzimuthAngle:r}=this.control,s=i===r;if(!(!s&&t>i&&t<r)){if(e===0){this.control.maxAzimuthAngle=t,this.control.minAzimuthAngle=t,this.control.update(),s||(this.control.maxAzimuthAngle=i,this.control.minAzimuthAngle=r);return}return mt(new Promise(a=>{let u={azimuthal:this.control.getAzimuthalAngle()},l={azimuthal:t},c=new Et.Tween(u,this.tweenGroup).to(l,e).onUpdate(()=>{this.control.maxAzimuthAngle=u.azimuthal,this.control.minAzimuthAngle=u.azimuthal,this.control.update()}).onComplete(()=>{this.control.enabled=!0,s||(this.control.maxAzimuthAngle=i,this.control.minAzimuthAngle=r),this.tweenGroup.remove(c),a(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}}getCameraLookAt(){return new w.Vector3().subVectors(this.control.target,this.camera.position)}setZoom(t,e,i=500){let r=this.getCameraLookAt(),s={zoom:this.camera.zoom,target:this.control.target.clone()};if(!i){this.camera.position.copy(e.clone().sub(r)),this.control.target.copy(e),this.camera.zoom=t,this.control.update();return}return mt(new Promise(a=>{let u=new Et.Tween(s,this.tweenGroup).to({zoom:t,target:e},i).onUpdate(()=>{this.camera.position.copy(s.target.clone().sub(r)),this.control.target.copy(s.target),this.camera.zoom=s.zoom,this.control.update()}).onComplete(()=>{this.tweenGroup.remove(u),this.control.enabled=!0,a(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),i+500)}getFitCameraToObjectZoom(t,e=[20,20,20,20],i=500,r=!0){let[s,a,u,l]=e,{clientSize:{width:c,height:p}}=this,f=this.control.getPolarAngle();r&&this.setPolarAngle(0,0);let d=new w.Box3().setFromObject(t);this.setPolarAngle(f,0);let{max:_,min:v}=d,h=new w.Vector3(v.x,_.y,_.z),m=new w.Vector3(_.x,_.y,_.z),x=new w.Vector3(_.x,v.y,v.z),b=new w.Vector3(v.x,v.y,v.z),S=E(h,this.camera,c,p),P=E(m,this.camera,c,p),B=E(b,this.camera,c,p),O=E(x,this.camera,c,p),Be=new w.Box2().setFromPoints([new w.Vector2(S.x,S.y),new w.Vector2(P.x,P.y),new w.Vector2(B.x,B.y),new w.Vector2(O.x,O.y)]).getSize(new w.Vector2),mi=(c-a-l)/Be.x,yi=(p-s-u)/Be.y,_i=Math.min(mi,yi),vi=new w.Vector3((_.x+v.x)/2,(_.y+v.y)/2,(_.z+v.z)/2);return{zoom:_i*this.camera.zoom,center:vi}}fitCameraToObject(t,e=[20,20,20,20],i=500,r=!0){let{zoom:s,center:a}=this.getFitCameraToObjectZoom(t,e,i,r);return this.setZoom(s,a,i)}getFitCameraToGroundZoom(t=[20,20,20,20],e=500,i=!0){if(this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,e,i).zoom}fitCameraToGround(t=[20,20,20,20],e=500,i=!0){return this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundUpper,t,e,i):Promise.resolve(!1)}async setCameraPosition(t,e){let i=this.camera.position.clone(),r=this.getCameraLookAt();if(!e){this.control.enabled=!1,this.camera.position.copy(t.clone().sub(r)),this.control.target.copy(t.clone()),this.control.update(),this.control.enabled=!0;return}return mt(new Promise(s=>{let a=new Et.Tween(i,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(i.clone().sub(r)),this.control.target.copy(i.clone()),this.control.update()}).onComplete(()=>{this.tweenGroup.remove(a),this.camera.position.copy(i.clone().sub(r)),this.control.target.copy(t.clone()),this.control.update(),this.control.enabled=!0,s(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}render(){this.dispatchEvent({type:"update"}),this.tweenGroup.update(),this.renderer.render(this.scene,this.camera),this.renderRf=this.timer.setTimeout(()=>{this.render()},100)}pauseRender(){this.timer.cancelAnimationFrame(this.renderRf)}continueRender(){this.render()}dispose(){this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.timer.dispose(),this.renderer.dispose(),this.lights.children.forEach(t=>t.dispose()),this.materialFactory.dispose(),this.textureFactory.dispose(),J(this.scene)}};var Yn=g("lodash"),Wi={apiDomain:"",apiInfo:{},apiPath:{floorGraphic:"/api/inception-map/floor/get",floorRange:"/api/inception-map/range/get",equipmentList:"/api/inception-map/equipment/get",roadNetwork:"/api/inception-map/road_network/get"},resizeObserver:!1,initTransToMark:!1,heatMap:{radius:50,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0},defaultPadding:[20,20,20,20],svg:{circle:{radius:"2",fill:"#1CADFF"},line:{stroke:"#1CADFF"}},selectBox:{stroke:"#1CADFF",fill:"rgba(28, 173, 255, 0.3)"},hover:{time:100},ground:{color:"#F6F6F6",opacity:1,height:.001,stroke:!1,strokeColor:"#E6E6E6",strokeOpacity:1},markGraphic:{color:"#EEF0F3",opacity:1,height:.001,stroke:!1,strokeColor:"#000",strokeOpacity:1},graphic:{fillOpacity:1},cameraBound:{padding:[150,150,150,150]},poi:{boxScale:1}};function $n(o){return(0,Yn.merge)({},Wi,o)}var Jn=g("lodash");async function Kn({brand:o,project:n},t){let{apiDomain:e,apiPath:{floorRange:i},apiInfo:r}=t,s=`${e}${i}?brand=${o}&project=${n}&phase=${n}&building=${n}`;return await fetch(s,r).then(u=>u.json()).then(u=>u.data).then(u=>{let l=(u||[])[0];return l&&(l.info=JSON.parse(l.info)),l})}async function _e({brand:o,project:n,floor:t,ts:e,resource_type_list:i},r){let{apiDomain:s,apiPath:{floorGraphic:a},apiInfo:u}=r,l=`${s}${a}?brand=${o}&project=${n}&phase=${n}&building=${n}&floor=${t}&ts=${e}&resource_type_list=${i}`;return await fetch(l,u).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(f=>f.info=JSON.parse(f.info)),p||[]))}var Xi=(t=>(t[t.D2=0]="D2",t[t.D3=1.1]="D3",t))(Xi||{}),Zn=class extends ve.EventDispatcher{constructor(t,e={}){super();this.container=t;this.config=$n(e),this.context=new ye(t,this.config),this.registryEvent(),this.context.render()}config;context;polarKeys=[];azimuthalKeys=[];svgLine;svgPolygon;basicZoom=1;prevCameraZoom=1;type="2d";floorDataMap=new Map;buildingGroundMap=new Map;buildingGroundPromiseMap=new Map;currentBuildGround=null;observe=null;buildingCenter=[0,0];timer=new q;plugins=[];async loadGraphics({brand:t,project:e,floor:i,ts:r,resource_type_list:s}){return await _e({brand:t,project:e,floor:i,ts:r,resource_type_list:s},this.config)}changeBuildingCenter(t,{brand:e,project:i}){let r=t?Bt(t.info.geometry.cds[0]):[0,0];this.buildingCenter=r,this.dispatchEvent({type:"center-change",center:r,project:i,brand:e})}async loadBuildingGround({brand:t,project:e}){let i=et({brand:t,project:e});if(this.buildingGroundMap.has(i)){let s=this.buildingGroundMap.get(i);return this.changeBuildingCenter(s||null,{brand:t,project:e}),s||null}if(this.buildingGroundPromiseMap.has(i))return this.buildingGroundPromiseMap.get(i);let r=new Promise(async s=>{let a=await Kn({brand:t,project:e},this.config);this.buildingGroundMap.set(i,a),this.changeBuildingCenter(a||null,{brand:t,project:e}),this.buildingGroundPromiseMap.delete(i),s(a)});return this.buildingGroundPromiseMap.set(i,r),r}async load({brand:t,project:e,floor:i,ts:r,resource_type_list:s}){let a=et({brand:t,project:e,floor:i,ts:r,resource_type_list:s});if(this.floorDataMap.has(a))return this.floorDataMap.get(a);let[u,l]=await Promise.all([this.loadGraphics({brand:t,project:e,floor:i,ts:r,resource_type_list:s}),this.loadBuildingGround({brand:t,project:e})]);return this.transformGraphicData(u),u.forEach(c=>{c.info.transformToBuildingGround=!!l}),this.config.useFloorCache||this.floorDataMap.clear(),this.floorDataMap.set(a,u),u}transformGraphicData(t,e=this.buildingCenter,i=0){t.forEach(u=>{if(u.info.geometry.coords=JSON.parse(JSON.stringify(u.info.geometry.cds)),u.info.geometry.type==="polygon")u.info.geometry.coords.map(l=>{Array.isArray(l)&&l.forEach(c=>{c[0]-=e[0],c[1]-=e[1]})});else{let[l,c]=u.info.geometry.cds;u.info.geometry.coords=[l-e[0],c-e[1]]}});let{ground:r,markGraphic:s,graphic:a}=this.config;for(let u=0;u<t.length;u++){let l=t[u];l.info.deltaHeight=1e-5*(i+u+1),l.info.group==="ground"?(l.info.fillColor=r.color,l.info.fillOpacity=r.opacity,l.info.height=r.height,l.info.stroke=r.stroke,l.info.strokeColor=r.strokeColor,l.info.strokeOpacity=r.strokeOpacity):l.info.userData.mark?(l.info.height=s.height,l.info.fillColor=s.color,l.info.fillOpacity=s.opacity,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity):(l.info.fillOpacity=a.fillOpacity,this.config.initTransToMark&&(l.info.height=s.height,l.info.fillColor=s.color,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity))}}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}createFloor(t){let e=new pt(this.context);if(!t.length)return{curFloor:e,graphics:[]};let i=new Map,r=[];for(let s of t)if(s.info.group==="ground")e.createGround(s.info);else{let a=e.addGraphic(s.info);a.userData.data=s,i.set(s.legacy_id,a),r.push(a)}return e.userData.legacyToGraphicMap=i,{curFloor:e,graphics:r}}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor({brand:t,project:e,floor:i,ts:r,resource_type_list:s}){let a=et({brand:t,project:e,floor:i,ts:r,resource_type_list:s}),u=this.floorDataMap.get(a);if(this.context.control.removeEventListener("change",this.onControlChange),u){let l=et({brand:t,project:e});this.currentBuildGround=this.buildingGroundMap.get(l)||null;let c=this.createFloor(u);c?(c.curFloor.name=i,this.triggerHooks("switch_floor_before",c),c.curFloor.updateBox(),this.context.switchFloor(c.curFloor),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",c)):console.warn("[switchFloor error] ["+i+"] \u697C\u5C42\u6CA1\u6709\u6570\u636E")}else console.warn("[switchFloor error] \u6CA1\u6709\u8FD9\u4E2A\u697C\u5C42\uFF0C\u8BF7\u5148\u8C03\u7528load\u65B9\u6CD5\u52A0\u8F7D\u697C\u5C42")}switchFloorByData(t,e,i=e){let{curFloor:r,graphics:s}=this.createFloor(t);r.name=e,r.key=i;let a=new Map;t.forEach(u=>{a.set(u.element_uuid,u)}),r.userData.graphicMap=a,this.switchFloorByFloor(r,s)}switchFloorByFloor(t,e=t.graphicLayer.children){this.triggerHooks("switch_floor_before",{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",{curFloor:t,graphics:e})}initialFloorCamera(){this.context.cameraBound.setEnable(!1),this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,0),this.context.setPolarAngle(this.config.control.defaultPolar,0),this.context.fitCameraToGround(void 0,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*25,this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.basicZoom=this.context.camera.zoom,this.context.control.addEventListener("change",this.onControlChange),this.onControlChange(),this.context.cameraBound.setEnable(!0),this.context.cameraBound.changePrevCamera()}onControlChange=()=>{let{camera:{zoom:t}}=this.context;t!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=t)};addModel(t,e){if(t.options.geometry.type==="polygon"){let i=this.context.currentFloor?.addModel({...e,position:t.getPosition().setZ(.1),id:t.options.id});if(i){let{facilityAngle:r=0,facilityXScale:s=1,facilityYScale:a=1}=t.options.userData;i.rotateZ((180-r)/180*Math.PI),i.scale.set(s,a,1)}}}addHeatmap(t){return this.context.currentFloor?.addHeatmap(t)}getLegacyToGraphicMap(){return this.context.currentFloor?.userData.legacyToGraphicMap||new Map}getFloorAllGraphics(){return this.context.currentFloor?.graphicLayer.children.filter(t=>t instanceof G)||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let i=t.getCenter();return this.context.currentFloor.addPoi({...e,position:{...i,z:i.z+t.options.height/2}})}return null}removeHeatMap(){this.context.currentFloor?.removeHeatMap()}translateElementToCenter(t,e=500){let i=t.getPosition();return this.context.setCameraPosition(i,e)}async translateElementToCenterX(t,e=500){return mt(new Promise(i=>{let r=this.context.control.target.clone(),s=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:a,height:u},camera:l}=this.context,p=E(s,l,a,u).x-a/2,f=new ve.Vector3;f.setFromMatrixColumn(this.context.camera.matrix,0),f.normalize(),f.multiplyScalar(p/this.context.camera.zoom),r.add(f),this.context.setCameraPosition(r,e).then(i)})}),e+500)}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:i,clientHeight:r}=this.container;return E(e,this.context.camera,i,r)}changeMapType(t,e=500){return this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}async resetView(t=300){let e=t/3;await this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),await this.context.setPolarAngle(this.config.control.defaultPolar,e),await this.context.fitCameraToGround(this.config.defaultPadding,e,!1)}reduceMap(t=.5,e=500){let i=this.context.camera.zoom;return this.context.setZoom(i-t,this.context.control.target,e)}enlargeMap(t=.5,e=500){let i=this.context.camera.zoom;return this.context.setZoom(i+t,this.context.control.target,e)}onKeydown=t=>{this.polarKeys.includes(t.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(t.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)};onKeyUp=t=>{if(this.polarKeys.includes(t.code)){let e=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=e,this.context.control.minPolarAngle=e}if(this.azimuthalKeys.includes(t.code)){let e=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=e,this.context.control.minAzimuthAngle=e}};registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver((0,Jn.debounce)(this.resize,5));t.observe(this.container),this.observe=t}}unRegistryEvent(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),this.observe?.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t=.1){let e=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(e+t,500)}async measureDistance(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new re(this.context);let i=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){i(),e("cancel")},this.svgLine.addEventListener("distance",({distance:r})=>{t(r)})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new oe(this.context);let i=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){i(),e("cancel")},this.svgPolygon.addEventListener("area",({area:r})=>{t(r)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}getGraphicByNodeId(t){return this.context.currentFloor?.graphicLayer.getGraphicByNodeId(t)||null}deleteGraphic(t){this.context.currentFloor?.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){if(!t.transformToBuildingGround&&this.currentBuildGround){let e=Bt(this.currentBuildGround.info.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(r=>{r[0]-=e[0],r[1]-=e[1]})});else{let[i,r]=t.geometry.cds;t.geometry.coords=[i-e[0],r-e[1]]}}return this.context.currentFloor?.graphicLayer.createGraphic(t)}removePoiById(t){this.context.currentFloor?.poiLayer.removePoiById(t),this.context.currentFloor?.poiLayer2.removePoiById(t)}getPoiById(t){return this.context.currentFloor?.poiLayer.getPoiById(t)||this.context.currentFloor?.poiLayer2.getPoiById(t)}getPois(){return[...(this.context.currentFloor?.poiLayer.pois||[]).filter(t=>!t.options.built_in),...this.context.currentFloor?.poiLayer2.pois||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let t=this.context.control.getAzimuthalAngle(),e=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let i=this.context.getFitCameraToGroundZoom(void 0,0)||1;this.context.camera.zoom=e,this.context.control.minZoom=i,this.context.control.maxZoom=i*25,this.basicZoom=e,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(t,0),this.context.cameraBound.setEnable(!0)};dispose(){this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.context.dispose(),this.floorDataMap.clear(),this.buildingGroundMap.clear(),$e(),Ke(),nn(),this.unRegistryEvent()}};var Qn=g("three"),at=class extends Qn.EventDispatcher{bmap;constructor(n){super(),this.bmap=n}dispose(){}};var ti=class extends at{equipmentList=[];equipmentMap=new Map;constructor(n){super(n),this.fetchEquipment(),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}async fetchEquipment(){let{apiDomain:n,apiPath:{equipmentList:t},apiInfo:e}=this.bmap.config,i=`${n}${t}`;await fetch(i,e).then(r=>r.json()).then(r=>r.data).then(r=>{this.equipmentList=r,this.equipmentMap=new Map(r.map(s=>[s.equipment_id,s]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)}onSwitchFloor=({data:{graphics:n}})=>{this.equipmentList.length&&this.changeGraphicToEquipment(n)};getGraphicEquipment(n){return n.userData.data.info.userData.equipment}changeGraphicToEquipment(n){n.filter(t=>{let e=this.getGraphicEquipment(t);return e&&this.equipmentMap.has(e)}).forEach(t=>{let e=this.equipmentMap.get(this.getGraphicEquipment(t)),i=this.bmap.createGraphicPoi(t,{icon:e?.equipment_icon,built_in:!0,icon_size:[14,14]});i&&(i.userData.data=e,i.userData.type="equipment")})}dispose(){this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),Array.from(this.bmap.context.currentFloor?.poiLayer.pois||[]).forEach(n=>{n.userData.type==="equipment"&&this.bmap.context.currentFloor?.poiLayer.removePoi(n)})}};function De(o){let n=new Blob([o],{type:"text/javascript"}),t=URL.createObjectURL(n),e=new Worker(t);return URL.revokeObjectURL(t),e}function Oe(){return De(`var B1=Object.create;var Uf=Object.defineProperty;var z1=Object.getOwnPropertyDescriptor;var k1=Object.getOwnPropertyNames,gm=Object.getOwnPropertySymbols,G1=Object.getPrototypeOf,ym=Object.prototype.hasOwnProperty,V1=Object.prototype.propertyIsEnumerable;var Ff=(r,t,e)=>t in r?Uf(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ls=(r,t)=>{for(var e in t||(t={}))ym.call(t,e)&&Ff(r,e,t[e]);if(gm)for(var e of gm(t))V1.call(t,e)&&Ff(r,e,t[e]);return r};var Zt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var H1=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of k1(t))!ym.call(r,a)&&a!==e&&Uf(r,a,{get:()=>t[a],enumerable:!(o=z1(t,a))||o.enumerable});return r};var Ln=(r,t,e)=>(e=r!=null?B1(G1(r)):{},H1(t||!r||!r.__esModule?Uf(e,"default",{value:r,enumerable:!0}):e,r));var dn=(r,t,e)=>Ff(r,typeof t!="symbol"?t+"":t,e);var _m=Zt((dR,vm)=>{var Bf=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(a=>(a.key===t&&Object.assign(a,{priority:o}),a)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};vm.exports=Bf});var Mm=Zt((mR,Em)=>{function xm(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,xm(a,t)):o!==t&&e.set(o,a);return e}Em.exports=xm});var bm=Zt((gR,Sm)=>{function W1(r){let t=Number(r);return!(isNaN(t)||t<=0)}function wm(r){let t=new Map;return Object.keys(r).forEach(o=>{let a=r[o];if(a!==null&&typeof a=="object"&&!Array.isArray(a))return t.set(o,wm(a));if(!W1(a))throw new Error(\`Could not add node at key "\${o}", make sure it's a valid node\`,a);return t.set(o,Number(a))}),t}Sm.exports=wm});var Cm=Zt((yR,Am)=>{function Tm(r){if(!(r instanceof Map))throw new Error(\`Invalid graph: Expected Map instead found \${typeof r}\`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){Tm(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}Am.exports=Tm});var kf=Zt((vR,Rm)=>{var q1=_m(),X1=Mm(),Pm=bm(),Im=Cm(),zf=class{constructor(t){t instanceof Map?(Im(t),this.graph=t):t?this.graph=Pm(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(Im(e),o=e):o=Pm(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=X1(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,l=new q1,f=new Map,h=[],p=0,d=[];if(o.avoid&&(d=[].concat(o.avoid)),d.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(d.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(l.set(t,0);!l.isEmpty();){let g=l.next();if(g.key===e){p=g.priority;let y=g.key;for(;f.has(y);)h.push(y),y=f.get(y);break}a.add(g.key),(this.graph.get(g.key)||new Map).forEach((y,M)=>{if(a.has(M)||d.includes(M))return null;if(!l.has(M))return f.set(M,g.key),l.set(M,g.priority+y);let S=l.get(M).priority,T=g.priority+y;return T<S?(f.set(M,g.key),l.set(M,T)):null})}return h.length?(o.trim?h.shift():h=h.concat([t]),o.reverse||(h=h.reverse()),o.cost?{path:h,cost:p}:h):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};Rm.exports=zf});var Mc=Zt((AR,E0)=>{"use strict";var x0=Object.getOwnPropertySymbols,Yb=Object.prototype.hasOwnProperty,$b=Object.prototype.propertyIsEnumerable;function Zb(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Jb(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(l){return t[l]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(l){a[l]=l}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(l){return!1}}E0.exports=Jb()?Object.assign:function(r,t){for(var e,o=Zb(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var f in e)Yb.call(e,f)&&(o[f]=e[f]);if(x0){a=x0(e);for(var h=0;h<a.length;h++)$b.call(e,a[h])&&(o[a[h]]=e[a[h]])}}return o}});var hp=Zt((cp,fp)=>{(function(r,t){typeof cp=="object"&&typeof fp!="undefined"?fp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(cp,function(){"use strict";function r(x,v,C,w,O){(function F(G,z,L,D,q){for(;D>L;){if(D-L>600){var nt=D-L+1,k=z-L+1,xt=Math.log(nt),X=.5*Math.exp(2*xt/3),it=.5*Math.sqrt(xt*X*(nt-X)/nt)*(k-nt/2<0?-1:1),vt=Math.max(L,Math.floor(z-k*X/nt+it)),pt=Math.min(D,Math.floor(z+(nt-k)*X/nt+it));F(G,z,vt,pt,q)}var et=G[z],ot=L,V=D;for(t(G,L,z),q(G[D],et)>0&&t(G,L,D);ot<V;){for(t(G,ot,V),ot++,V--;q(G[ot],et)<0;)ot++;for(;q(G[V],et)>0;)V--}q(G[L],et)===0?t(G,L,V):t(G,++V,D),V<=z&&(L=V+1),z<=V&&(D=V-1)}})(x,v,C||0,w||x.length-1,O||e)}function t(x,v,C){var w=x[v];x[v]=x[C],x[C]=w}function e(x,v){return x<v?-1:x>v?1:0}var o=function(x){x===void 0&&(x=9),this._maxEntries=Math.max(4,x),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(x,v,C){if(!C)return v.indexOf(x);for(var w=0;w<v.length;w++)if(C(x,v[w]))return w;return-1}function l(x,v){f(x,0,x.children.length,v,x)}function f(x,v,C,w,O){O||(O=S(null)),O.minX=1/0,O.minY=1/0,O.maxX=-1/0,O.maxY=-1/0;for(var F=v;F<C;F++){var G=x.children[F];h(O,x.leaf?w(G):G)}return O}function h(x,v){return x.minX=Math.min(x.minX,v.minX),x.minY=Math.min(x.minY,v.minY),x.maxX=Math.max(x.maxX,v.maxX),x.maxY=Math.max(x.maxY,v.maxY),x}function p(x,v){return x.minX-v.minX}function d(x,v){return x.minY-v.minY}function g(x){return(x.maxX-x.minX)*(x.maxY-x.minY)}function _(x){return x.maxX-x.minX+(x.maxY-x.minY)}function y(x,v){return x.minX<=v.minX&&x.minY<=v.minY&&v.maxX<=x.maxX&&v.maxY<=x.maxY}function M(x,v){return v.minX<=x.maxX&&v.minY<=x.maxY&&v.maxX>=x.minX&&v.maxY>=x.minY}function S(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(x,v,C,w,O){for(var F=[v,C];F.length;)if(!((C=F.pop())-(v=F.pop())<=w)){var G=v+Math.ceil((C-v)/w/2)*w;r(x,G,v,C,O),F.push(v,G,G,C)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(x){var v=this.data,C=[];if(!M(x,v))return C;for(var w=this.toBBox,O=[];v;){for(var F=0;F<v.children.length;F++){var G=v.children[F],z=v.leaf?w(G):G;M(x,z)&&(v.leaf?C.push(G):y(x,z)?this._all(G,C):O.push(G))}v=O.pop()}return C},o.prototype.collides=function(x){var v=this.data;if(!M(x,v))return!1;for(var C=[];v;){for(var w=0;w<v.children.length;w++){var O=v.children[w],F=v.leaf?this.toBBox(O):O;if(M(x,F)){if(v.leaf||y(x,F))return!0;C.push(O)}}v=C.pop()}return!1},o.prototype.load=function(x){if(!x||!x.length)return this;if(x.length<this._minEntries){for(var v=0;v<x.length;v++)this.insert(x[v]);return this}var C=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===C.height)this._splitRoot(this.data,C);else{if(this.data.height<C.height){var w=this.data;this.data=C,C=w}this._insert(C,this.data.height-C.height-1,!0)}else this.data=C;return this},o.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},o.prototype.clear=function(){return this.data=S([]),this},o.prototype.remove=function(x,v){if(!x)return this;for(var C,w,O,F=this.data,G=this.toBBox(x),z=[],L=[];F||z.length;){if(F||(F=z.pop(),w=z[z.length-1],C=L.pop(),O=!0),F.leaf){var D=a(x,F.children,v);if(D!==-1)return F.children.splice(D,1),z.push(F),this._condense(z),this}O||F.leaf||!y(F,G)?w?(C++,F=w.children[C],O=!1):F=null:(z.push(F),L.push(C),C=0,w=F,F=F.children[0])}return this},o.prototype.toBBox=function(x){return x},o.prototype.compareMinX=function(x,v){return x.minX-v.minX},o.prototype.compareMinY=function(x,v){return x.minY-v.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(x){return this.data=x,this},o.prototype._all=function(x,v){for(var C=[];x;)x.leaf?v.push.apply(v,x.children):C.push.apply(C,x.children),x=C.pop();return v},o.prototype._build=function(x,v,C,w){var O,F=C-v+1,G=this._maxEntries;if(F<=G)return l(O=S(x.slice(v,C+1)),this.toBBox),O;w||(w=Math.ceil(Math.log(F)/Math.log(G)),G=Math.ceil(F/Math.pow(G,w-1))),(O=S([])).leaf=!1,O.height=w;var z=Math.ceil(F/G),L=z*Math.ceil(Math.sqrt(G));T(x,v,C,L,this.compareMinX);for(var D=v;D<=C;D+=L){var q=Math.min(D+L-1,C);T(x,D,q,z,this.compareMinY);for(var nt=D;nt<=q;nt+=z){var k=Math.min(nt+z-1,q);O.children.push(this._build(x,nt,k,w-1))}}return l(O,this.toBBox),O},o.prototype._chooseSubtree=function(x,v,C,w){for(;w.push(v),!v.leaf&&w.length-1!==C;){for(var O=1/0,F=1/0,G=void 0,z=0;z<v.children.length;z++){var L=v.children[z],D=g(L),q=(nt=x,k=L,(Math.max(k.maxX,nt.maxX)-Math.min(k.minX,nt.minX))*(Math.max(k.maxY,nt.maxY)-Math.min(k.minY,nt.minY))-D);q<F?(F=q,O=D<O?D:O,G=L):q===F&&D<O&&(O=D,G=L)}v=G||v.children[0]}var nt,k;return v},o.prototype._insert=function(x,v,C){var w=C?x:this.toBBox(x),O=[],F=this._chooseSubtree(w,this.data,v,O);for(F.children.push(x),h(F,w);v>=0&&O[v].children.length>this._maxEntries;)this._split(O,v),v--;this._adjustParentBBoxes(w,O,v)},o.prototype._split=function(x,v){var C=x[v],w=C.children.length,O=this._minEntries;this._chooseSplitAxis(C,O,w);var F=this._chooseSplitIndex(C,O,w),G=S(C.children.splice(F,C.children.length-F));G.height=C.height,G.leaf=C.leaf,l(C,this.toBBox),l(G,this.toBBox),v?x[v-1].children.push(G):this._splitRoot(C,G)},o.prototype._splitRoot=function(x,v){this.data=S([x,v]),this.data.height=x.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(x,v,C){for(var w,O,F,G,z,L,D,q=1/0,nt=1/0,k=v;k<=C-v;k++){var xt=f(x,0,k,this.toBBox),X=f(x,k,C,this.toBBox),it=(O=xt,F=X,G=void 0,z=void 0,L=void 0,D=void 0,G=Math.max(O.minX,F.minX),z=Math.max(O.minY,F.minY),L=Math.min(O.maxX,F.maxX),D=Math.min(O.maxY,F.maxY),Math.max(0,L-G)*Math.max(0,D-z)),vt=g(xt)+g(X);it<q?(q=it,w=k,nt=vt<nt?vt:nt):it===q&&vt<nt&&(nt=vt,w=k)}return w||C-v},o.prototype._chooseSplitAxis=function(x,v,C){var w=x.leaf?this.compareMinX:p,O=x.leaf?this.compareMinY:d;this._allDistMargin(x,v,C,w)<this._allDistMargin(x,v,C,O)&&x.children.sort(w)},o.prototype._allDistMargin=function(x,v,C,w){x.children.sort(w);for(var O=this.toBBox,F=f(x,0,v,O),G=f(x,C-v,C,O),z=_(F)+_(G),L=v;L<C-v;L++){var D=x.children[L];h(F,x.leaf?O(D):D),z+=_(F)}for(var q=C-v-1;q>=v;q--){var nt=x.children[q];h(G,x.leaf?O(nt):nt),z+=_(G)}return z},o.prototype._adjustParentBBoxes=function(x,v,C){for(var w=C;w>=0;w--)h(v[w],x)},o.prototype._condense=function(x){for(var v=x.length-1,C=void 0;v>=0;v--)x[v].children.length===0?v>0?(C=x[v-1].children).splice(C.indexOf(x[v]),1):this.clear():l(x[v],this.toBBox)},o})});var M0=Zt((pp,dp)=>{(function(r,t){typeof pp=="object"&&typeof dp!="undefined"?dp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(pp,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var l=(this.length>>1)-1;l>=0;l--)this._down(l)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,l=a.data,f=a.compare,h=l[o];o>0;){var p=o-1>>1,d=l[p];if(f(h,d)>=0)break;l[o]=d,o=p}l[o]=h},r.prototype._down=function(o){for(var a=this,l=a.data,f=a.compare,h=this.length>>1,p=l[o];o<h;){var d=(o<<1)+1,g=l[d],_=d+1;if(_<this.length&&f(l[_],g)<0&&(d=_,g=l[_]),f(g,p)>=0)break;l[o]=g,o=d}l[o]=p};function t(e,o){return e<o?-1:e>o?1:0}return r})});var S0=Zt((NR,w0)=>{w0.exports=function(t,e,o,a){var l=t[0],f=t[1],h=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=(a-o)/2,d=0,g=p-1;d<p;g=d++){var _=e[o+d*2+0],y=e[o+d*2+1],M=e[o+g*2+0],S=e[o+g*2+1],T=y>f!=S>f&&l<(M-_)*(f-y)/(S-y)+_;T&&(h=!h)}return h}});var T0=Zt((OR,b0)=>{b0.exports=function(t,e,o,a){var l=t[0],f=t[1],h=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=a-o,d=0,g=p-1;d<p;g=d++){var _=e[d+o][0],y=e[d+o][1],M=e[g+o][0],S=e[g+o][1],T=y>f!=S>f&&l<(M-_)*(f-y)/(S-y)+_;T&&(h=!h)}return h}});var P0=Zt((DR,bc)=>{var A0=S0(),C0=T0();bc.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?C0(t,e,o,a):A0(t,e,o,a)};bc.exports.nested=C0;bc.exports.flat=A0});var R0=Zt((Tc,I0)=>{(function(r,t){typeof Tc=="object"&&typeof I0!="undefined"?t(Tc):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(Tc,function(r){"use strict";let e=33306690738754706e-32;function o(M,S,T,x,v){let C,w,O,F,G=S[0],z=x[0],L=0,D=0;z>G==z>-G?(C=G,G=S[++L]):(C=z,z=x[++D]);let q=0;if(L<M&&D<T)for(z>G==z>-G?(O=C-((w=G+C)-G),G=S[++L]):(O=C-((w=z+C)-z),z=x[++D]),C=w,O!==0&&(v[q++]=O);L<M&&D<T;)z>G==z>-G?(O=C-((w=C+G)-(F=w-C))+(G-F),G=S[++L]):(O=C-((w=C+z)-(F=w-C))+(z-F),z=x[++D]),C=w,O!==0&&(v[q++]=O);for(;L<M;)O=C-((w=C+G)-(F=w-C))+(G-F),G=S[++L],C=w,O!==0&&(v[q++]=O);for(;D<T;)O=C-((w=C+z)-(F=w-C))+(z-F),z=x[++D],C=w,O!==0&&(v[q++]=O);return C===0&&q!==0||(v[q++]=C),q}function a(M){return new Float64Array(M)}let l=33306690738754716e-32,f=22204460492503146e-32,h=11093356479670487e-47,p=a(4),d=a(8),g=a(12),_=a(16),y=a(4);r.orient2d=function(M,S,T,x,v,C){let w=(S-C)*(T-v),O=(M-v)*(x-C),F=w-O;if(w===0||O===0||w>0!=O>0)return F;let G=Math.abs(w+O);return Math.abs(F)>=l*G?F:-function(z,L,D,q,nt,k,xt){let X,it,vt,pt,et,ot,V,K,at,Tt,dt,Ct,Yt,Wt,Nt,ne,Pt,Xt,tt=z-nt,nn=D-nt,Gt=L-k,te=q-k;et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=tt*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=Gt*nn)-V*at-K*at-V*Tt))),p[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),p[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,p[2]=Ct-(Xt-et)+(dt-et),p[3]=Xt;let qt=function(W,Z){let I=Z[0];for(let P=1;P<W;P++)I+=Z[P];return I}(4,p),J=f*xt;if(qt>=J||-qt>=J||(X=z-(tt+(et=z-tt))+(et-nt),vt=D-(nn+(et=D-nn))+(et-nt),it=L-(Gt+(et=L-Gt))+(et-k),pt=q-(te+(et=q-te))+(et-k),X===0&&it===0&&vt===0&&pt===0)||(J=h*xt+e*Math.abs(qt),(qt+=tt*pt+te*X-(Gt*vt+nn*it))>=J||-qt>=J))return qt;et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=X*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=it*nn)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let N=o(4,p,4,y,d);et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=tt*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=Gt*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let b=o(N,d,4,y,g);et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=X*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=it*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let R=o(b,g,4,y,_);return _[R-1]}(M,S,T,x,v,C,G)},r.orient2dfast=function(M,S,T,x,v,C){return(S-C)*(T-v)-(M-v)*(x-C)},Object.defineProperty(r,"__esModule",{value:!0})})});var U0=Zt((FR,vp)=>{"use strict";var L0=hp(),Cc=M0(),Qb=P0(),jb=R0().orient2d;Cc.default&&(Cc=Cc.default);vp.exports=F0;vp.exports.default=F0;function F0(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=iT(r),a=new L0(16);a.toBBox=function(C){return{minX:C[0],minY:C[1],maxX:C[0],maxY:C[1]}},a.compareMinX=function(C,w){return C[0]-w[0]},a.compareMinY=function(C,w){return C[1]-w[1]},a.load(r);for(var l=[],f=0,h;f<o.length;f++){var p=o[f];a.remove(p),h=D0(p,h),l.push(h)}var d=new L0(16);for(f=0;f<l.length;f++)d.insert(mp(l[f]));for(var g=t*t,_=e*e;l.length;){var y=l.shift(),M=y.p,S=y.next.p,T=gp(M,S);if(!(T<_)){var x=T/g;p=tT(a,y.prev.p,M,S,y.next.next.p,x,d),p&&Math.min(gp(p,M),gp(p,S))<=x&&(l.push(y),l.push(D0(p,y)),a.remove(p),d.remove(y),d.insert(mp(y)),d.insert(mp(y.next)))}}y=h;var v=[];do v.push(y.p),y=y.next;while(y!==h);return v.push(y.p),v}function tT(r,t,e,o,a,l,f){for(var h=new Cc([],eT),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],_=p.leaf?yp(g,e,o):nT(e,o,g);_>l||h.push({node:g,dist:_})}for(;h.length&&!h.peek().node.children;){var y=h.pop(),M=y.node,S=yp(M,t,e),T=yp(M,o,a);if(y.dist<S&&y.dist<T&&O0(e,M,f)&&O0(o,M,f))return M}p=h.pop(),p&&(p=p.node)}return null}function eT(r,t){return r.dist-t.dist}function nT(r,t,e){if(N0(r,e)||N0(t,e))return 0;var o=Ac(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=Ac(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=Ac(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var f=Ac(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return f===0?0:Math.min(o,a,l,f)}function N0(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function O0(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),l=Math.max(r[0],t[0]),f=Math.max(r[1],t[1]),h=e.search({minX:o,minY:a,maxX:l,maxY:f}),p=0;p<h.length;p++)if(rT(h[p].p,h[p].next.p,r,t))return!1;return!0}function Qa(r,t,e){return jb(r[0],r[1],t[0],t[1],e[0],e[1])}function rT(r,t,e,o){return r!==o&&t!==e&&Qa(r,t,e)>0!=Qa(r,t,o)>0&&Qa(e,o,r)>0!=Qa(e,o,t)>0}function mp(r){var t=r.p,e=r.next.p;return r.minX=Math.min(t[0],e[0]),r.minY=Math.min(t[1],e[1]),r.maxX=Math.max(t[0],e[0]),r.maxY=Math.max(t[1],e[1]),r}function iT(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],l=0;l<r.length;l++){var f=r[l];f[0]<t[0]&&(t=f),f[0]>o[0]&&(o=f),f[1]<e[1]&&(e=f),f[1]>a[1]&&(a=f)}var h=[t,e,o,a],p=h.slice();for(l=0;l<r.length;l++)Qb(r[l],h)||p.push(r[l]);return sT(p)}function D0(r,t){var e={p:r,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function gp(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function yp(r,t,e){var o=t[0],a=t[1],l=e[0]-o,f=e[1]-a;if(l!==0||f!==0){var h=((r[0]-o)*l+(r[1]-a)*f)/(l*l+f*f);h>1?(o=e[0],a=e[1]):h>0&&(o+=l*h,a+=f*h)}return l=r[0]-o,f=r[1]-a,l*l+f*f}function Ac(r,t,e,o,a,l,f,h){var p=e-r,d=o-t,g=f-a,_=h-l,y=r-a,M=t-l,S=p*p+d*d,T=p*g+d*_,x=g*g+_*_,v=p*y+d*M,C=g*y+_*M,w=S*x-T*T,O,F,G,z,L=w,D=w;w===0?(F=0,L=1,z=C,D=x):(F=T*C-x*v,z=S*C-T*v,F<0?(F=0,z=C,D=x):F>L&&(F=L,z=C+T,D=x)),z<0?(z=0,-v<0?F=0:-v>S?F=L:(F=-v,L=S)):z>D&&(z=D,-v+T<0?F=0:-v+T>S?F=L:(F=-v+T,L=S)),O=F===0?0:F/L,G=z===0?0:z/D;var q=(1-O)*r+O*e,nt=(1-O)*t+O*o,k=(1-G)*a+G*f,xt=(1-G)*l+G*h,X=k-q,it=xt-nt;return X*X+it*it}function oT(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function sT(r){r.sort(oT);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Qa(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}for(var o=[],a=r.length-1;a>=0;a--){for(;o.length>=2&&Qa(o[o.length-2],o[o.length-1],r[a])<=0;)o.pop();o.push(r[a])}return o.pop(),t.pop(),t.concat(o)}});var H0=Zt((xp,Ep)=>{(function(r,t){typeof xp=="object"&&typeof Ep!="undefined"?Ep.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(xp,function(){"use strict";function r(a,l,f,h,p){t(a,l,f||0,h||a.length-1,p||o)}function t(a,l,f,h,p){for(;h>f;){if(h-f>600){var d=h-f+1,g=l-f+1,_=Math.log(d),y=.5*Math.exp(2*_/3),M=.5*Math.sqrt(_*y*(d-y)/d)*(g-d/2<0?-1:1),S=Math.max(f,Math.floor(l-g*y/d+M)),T=Math.min(h,Math.floor(l+(d-g)*y/d+M));t(a,l,S,T,p)}var x=a[l],v=f,C=h;for(e(a,f,l),p(a[h],x)>0&&e(a,f,h);v<C;){for(e(a,v,C),v++,C--;p(a[v],x)<0;)v++;for(;p(a[C],x)>0;)C--}p(a[f],x)===0?e(a,f,C):(C++,e(a,C,h)),C<=l&&(f=C+1),l<=C&&(h=C-1)}}function e(a,l,f){var h=a[l];a[l]=a[f],a[f]=h}function o(a,l){return a<l?-1:a>l?1:0}return r})});var bp=Zt((u2,Sp)=>{"use strict";Sp.exports=$u;Sp.exports.default=$u;var _T=H0();function $u(r,t){if(!(this instanceof $u))return new $u(r,t);this._maxEntries=Math.max(4,r||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}$u.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!Ic(r,t))return e;for(var a=[],l,f,h,p;t;){for(l=0,f=t.children.length;l<f;l++)h=t.children[l],p=t.leaf?o(h):h,Ic(r,p)&&(t.leaf?e.push(h):wp(r,p)?this._all(h,e):a.push(h));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!Ic(r,t))return!1;for(var o=[],a,l,f,h;t;){for(a=0,l=t.children.length;a<l;a++)if(f=t.children[a],h=t.leaf?e(f):f,Ic(r,h)){if(t.leaf||wp(r,h))return!0;o.push(f)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=eu([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],l=[],f,h,p,d;e||a.length;){if(e||(e=a.pop(),h=a[a.length-1],f=l.pop(),d=!0),e.leaf&&(p=xT(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&wp(e,o)?(a.push(e),l.push(f),f=0,h=e,e=e.children[0]):h?(f++,e=h.children[f],d=!1):e=null}return this},toBBox:function(r){return r},compareMinX:W0,compareMinY:q0,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,l=this._maxEntries,f;if(a<=l)return f=eu(r.slice(t,e+1)),tu(f,this.toBBox),f;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),f=eu([]),f.leaf=!1,f.height=o;var h=Math.ceil(a/l),p=h*Math.ceil(Math.sqrt(l)),d,g,_,y;for(X0(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(_=Math.min(d+p-1,e),X0(r,d,_,h,this.compareMinY),g=d;g<=_;g+=h)y=Math.min(g+h-1,_),f.children.push(this._build(r,g,y,o-1));return tu(f,this.toBBox),f},_chooseSubtree:function(r,t,e,o){for(var a,l,f,h,p,d,g,_;o.push(t),!(t.leaf||o.length-1===e);){for(g=_=1/0,a=0,l=t.children.length;a<l;a++)f=t.children[a],p=Mp(f),d=ET(r,f)-p,d<_?(_=d,g=p<g?p:g,h=f):d===_&&p<g&&(g=p,h=f);t=h||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),l=[],f=this._chooseSubtree(a,this.data,t,l);for(f.children.push(r),Yu(f,a);t>=0&&l[t].children.length>this._maxEntries;)this._split(l,t),t--;this._adjustParentBBoxes(a,l,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var l=this._chooseSplitIndex(e,a,o),f=eu(e.children.splice(l,e.children.length-l));f.height=e.height,f.leaf=e.leaf,tu(e,this.toBBox),tu(f,this.toBBox),t?r[t-1].children.push(f):this._splitRoot(e,f)},_splitRoot:function(r,t){this.data=eu([r,t]),this.data.height=r.height+1,this.data.leaf=!1,tu(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,l,f,h,p,d,g;for(p=d=1/0,o=t;o<=e-t;o++)a=Xu(r,0,o,this.toBBox),l=Xu(r,o,e,this.toBBox),f=MT(a,l),h=Mp(a)+Mp(l),f<p?(p=f,g=o,d=h<d?h:d):f===p&&h<d&&(d=h,g=o);return g},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:W0,a=r.leaf?this.compareMinY:q0,l=this._allDistMargin(r,t,e,o),f=this._allDistMargin(r,t,e,a);l<f&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,l=Xu(r,0,t,a),f=Xu(r,e-t,e,a),h=Pc(l)+Pc(f),p,d;for(p=t;p<e-t;p++)d=r.children[p],Yu(l,r.leaf?a(d):d),h+=Pc(l);for(p=e-t-1;p>=t;p--)d=r.children[p],Yu(f,r.leaf?a(d):d),h+=Pc(f);return h},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)Yu(t[o],r)},_condense:function(r){for(var t=r.length-1,e;t>=0;t--)r[t].children.length===0?t>0?(e=r[t-1].children,e.splice(e.indexOf(r[t]),1)):this.clear():tu(r[t],this.toBBox)},_initFormat:function(r){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(r[0])),this.compareMinY=new Function("a","b",t.join(r[1])),this.toBBox=new Function("a","return {minX: a"+r[0]+", minY: a"+r[1]+", maxX: a"+r[2]+", maxY: a"+r[3]+"};")}};function xT(r,t,e){if(!e)return t.indexOf(r);for(var o=0;o<t.length;o++)if(e(r,t[o]))return o;return-1}function tu(r,t){Xu(r,0,r.children.length,t,r)}function Xu(r,t,e,o,a){a||(a=eu(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var l=t,f;l<e;l++)f=r.children[l],Yu(a,r.leaf?o(f):f);return a}function Yu(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function W0(r,t){return r.minX-t.minX}function q0(r,t){return r.minY-t.minY}function Mp(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function Pc(r){return r.maxX-r.minX+(r.maxY-r.minY)}function ET(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function MT(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),l=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,l-o)}function wp(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Ic(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function eu(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function X0(r,t,e,o,a){for(var l=[t,e],f;l.length;)e=l.pop(),t=l.pop(),!(e-t<=o)&&(f=t+Math.ceil((e-t)/o/2)*o,_T(r,f,t,e,a),l.push(t,f,f,e))}});var Q0=Zt((EO,Rp)=>{"use strict";Rp.exports=Oc;Rp.exports.default=Oc;function Oc(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=Z0(r,0,a,e,!0),f=[];if(!l||l.next===l.prev)return f;var h,p,d,g,_,y,M;if(o&&(l=LT(r,t,l,e)),r.length>80*e){h=d=r[0],p=g=r[1];for(var S=e;S<a;S+=e)_=r[S],y=r[S+1],_<h&&(h=_),y<p&&(p=y),_>d&&(d=_),y>g&&(g=y);M=Math.max(d-h,g-p),M=M!==0?32767/M:0}return Ku(l,f,e,h,p,M,0),f}function Z0(r,t,e,o,a){var l,f;if(a===Ip(r,t,e,o)>0)for(l=t;l<e;l+=o)f=$0(l,r[l],r[l+1],f);else for(l=e-o;l>=t;l-=o)f=$0(l,r[l],r[l+1],f);return f&&Dc(f,f.next)&&(ju(f),f=f.next),f}function ea(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(Dc(e,e.next)||Bn(e.prev,e,e.next)===0)){if(ju(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function Ku(r,t,e,o,a,l,f){if(r){!f&&l&&UT(r,o,a,l);for(var h=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?PT(r,o,a,l):CT(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),ju(r),r=d.next,h=d.next;continue}if(r=d,r===h){f?f===1?(r=IT(ea(r),t,e),Ku(r,t,e,o,a,l,2)):f===2&&RT(r,t,e,o,a,l):Ku(ea(r),t,e,o,a,l,1);break}}}}function CT(r){var t=r.prev,e=r,o=r.next;if(Bn(t,e,o)>=0)return!1;for(var a=t.x,l=e.x,f=o.x,h=t.y,p=e.y,d=o.y,g=a<l?a<f?a:f:l<f?l:f,_=h<p?h<d?h:d:p<d?p:d,y=a>l?a>f?a:f:l>f?l:f,M=h>p?h>d?h:d:p>d?p:d,S=o.next;S!==t;){if(S.x>=g&&S.x<=y&&S.y>=_&&S.y<=M&&iu(a,h,l,p,f,d,S.x,S.y)&&Bn(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function PT(r,t,e,o){var a=r.prev,l=r,f=r.next;if(Bn(a,l,f)>=0)return!1;for(var h=a.x,p=l.x,d=f.x,g=a.y,_=l.y,y=f.y,M=h<p?h<d?h:d:p<d?p:d,S=g<_?g<y?g:y:_<y?_:y,T=h>p?h>d?h:d:p>d?p:d,x=g>_?g>y?g:y:_>y?_:y,v=Cp(M,S,t,e,o),C=Cp(T,x,t,e,o),w=r.prevZ,O=r.nextZ;w&&w.z>=v&&O&&O.z<=C;){if(w.x>=M&&w.x<=T&&w.y>=S&&w.y<=x&&w!==a&&w!==f&&iu(h,g,p,_,d,y,w.x,w.y)&&Bn(w.prev,w,w.next)>=0||(w=w.prevZ,O.x>=M&&O.x<=T&&O.y>=S&&O.y<=x&&O!==a&&O!==f&&iu(h,g,p,_,d,y,O.x,O.y)&&Bn(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;w&&w.z>=v;){if(w.x>=M&&w.x<=T&&w.y>=S&&w.y<=x&&w!==a&&w!==f&&iu(h,g,p,_,d,y,w.x,w.y)&&Bn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;O&&O.z<=C;){if(O.x>=M&&O.x<=T&&O.y>=S&&O.y<=x&&O!==a&&O!==f&&iu(h,g,p,_,d,y,O.x,O.y)&&Bn(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function IT(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!Dc(a,l)&&J0(a,o,o.next,l)&&Qu(a,l)&&Qu(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),ju(o),ju(o.next),o=r=l),o=o.next}while(o!==r);return ea(o)}function RT(r,t,e,o,a,l){var f=r;do{for(var h=f.next.next;h!==f.prev;){if(f.i!==h.i&&kT(f,h)){var p=K0(f,h);f=ea(f,f.next),p=ea(p,p.next),Ku(f,t,e,o,a,l,0),Ku(p,t,e,o,a,l,0);return}h=h.next}f=f.next}while(f!==r)}function LT(r,t,e,o){var a=[],l,f,h,p,d;for(l=0,f=t.length;l<f;l++)h=t[l]*o,p=l<f-1?t[l+1]*o:r.length,d=Z0(r,h,p,o,!1),d===d.next&&(d.steiner=!0),a.push(zT(d));for(a.sort(NT),l=0;l<a.length;l++)e=OT(a[l],e);return e}function NT(r,t){return r.x-t.x}function OT(r,t){var e=DT(r,t);if(!e)return t;var o=K0(e,r);return ea(o,o.next),ea(e,e.next)}function DT(r,t){var e=t,o=r.x,a=r.y,l=-1/0,f;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var h=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=o&&h>l&&(l=h,f=e.x<e.next.x?e:e.next,h===o))return f}e=e.next}while(e!==t);if(!f)return null;var p=f,d=f.x,g=f.y,_=1/0,y;e=f;do o>=e.x&&e.x>=d&&o!==e.x&&iu(a<g?o:l,a,d,g,a<g?l:o,a,e.x,e.y)&&(y=Math.abs(a-e.y)/(o-e.x),Qu(e,r)&&(y<_||y===_&&(e.x>f.x||e.x===f.x&&FT(f,e)))&&(f=e,_=y)),e=e.next;while(e!==p);return f}function FT(r,t){return Bn(r.prev,r,t.prev)<0&&Bn(t.next,r,r.next)<0}function UT(r,t,e,o){var a=r;do a.z===0&&(a.z=Cp(a.x,a.y,t,e,o)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==r);a.prevZ.nextZ=null,a.prevZ=null,BT(a)}function BT(r){var t,e,o,a,l,f,h,p,d=1;do{for(e=r,r=null,l=null,f=0;e;){for(f++,o=e,h=0,t=0;t<d&&(h++,o=o.nextZ,!!o);t++);for(p=d;h>0||p>0&&o;)h!==0&&(p===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,h--):(a=o,o=o.nextZ,p--),l?l.nextZ=a:r=a,a.prevZ=l,l=a;e=o}l.nextZ=null,d*=2}while(f>1);return r}function Cp(r,t,e,o,a){return r=(r-e)*a|0,t=(t-o)*a|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function zT(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function iu(r,t,e,o,a,l,f,h){return(a-f)*(t-h)>=(r-f)*(l-h)&&(r-f)*(o-h)>=(e-f)*(t-h)&&(e-f)*(l-h)>=(a-f)*(o-h)}function kT(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!GT(r,t)&&(Qu(r,t)&&Qu(t,r)&&VT(r,t)&&(Bn(r.prev,r,t.prev)||Bn(r,t.prev,t))||Dc(r,t)&&Bn(r.prev,r,r.next)>0&&Bn(t.prev,t,t.next)>0)}function Bn(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Dc(r,t){return r.x===t.x&&r.y===t.y}function J0(r,t,e,o){var a=Nc(Bn(r,t,e)),l=Nc(Bn(r,t,o)),f=Nc(Bn(e,o,r)),h=Nc(Bn(e,o,t));return!!(a!==l&&f!==h||a===0&&Lc(r,e,t)||l===0&&Lc(r,o,t)||f===0&&Lc(e,r,o)||h===0&&Lc(e,t,o))}function Lc(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Nc(r){return r>0?1:r<0?-1:0}function GT(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&J0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Qu(r,t){return Bn(r.prev,r,r.next)<0?Bn(r,t,r.next)>=0&&Bn(r,r.prev,t)>=0:Bn(r,t,r.prev)<0||Bn(r,r.next,t)<0}function VT(r,t){var e=r,o=!1,a=(r.x+t.x)/2,l=(r.y+t.y)/2;do e.y>l!=e.next.y>l&&e.next.y!==e.y&&a<(e.next.x-e.x)*(l-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function K0(r,t){var e=new Pp(r.i,r.x,r.y),o=new Pp(t.i,t.x,t.y),a=r.next,l=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,l.next=o,o.prev=l,o}function $0(r,t,e,o){var a=new Pp(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function ju(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Pp(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Oc.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,f=Math.abs(Ip(r,0,l,e));if(a)for(var h=0,p=t.length;h<p;h++){var d=t[h]*e,g=h<p-1?t[h+1]*e:r.length;f-=Math.abs(Ip(r,d,g,e))}var _=0;for(h=0;h<o.length;h+=3){var y=o[h]*e,M=o[h+1]*e,S=o[h+2]*e;_+=Math.abs((r[y]-r[S])*(r[M+1]-r[y+1])-(r[y]-r[M])*(r[S+1]-r[y+1]))}return f===0&&_===0?0:Math.abs((_-f)/f)};function Ip(r,t,e,o){for(var a=0,l=t,f=e-o;l<e;l+=o)a+=(r[f]-r[l])*(r[l+1]+r[f+1]),f=l;return a}Oc.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var l=0;l<r[a].length;l++)for(var f=0;f<t;f++)e.vertices.push(r[a][l][f]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var Fp=Zt(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.earthRadius=63710088e-1;ue.factors={centimeters:ue.earthRadius*100,centimetres:ue.earthRadius*100,degrees:ue.earthRadius/111325,feet:ue.earthRadius*3.28084,inches:ue.earthRadius*39.37,kilometers:ue.earthRadius/1e3,kilometres:ue.earthRadius/1e3,meters:ue.earthRadius,metres:ue.earthRadius,miles:ue.earthRadius/1609.344,millimeters:ue.earthRadius*1e3,millimetres:ue.earthRadius*1e3,nauticalmiles:ue.earthRadius/1852,radians:1,yards:ue.earthRadius*1.0936};ue.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/ue.earthRadius,yards:1.0936133};ue.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Ss(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}ue.feature=Ss;function WT(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Lp(t).geometry;case"LineString":return Op(t).geometry;case"Polygon":return Np(t).geometry;case"MultiPoint":return ty(t).geometry;case"MultiLineString":return j0(t).geometry;case"MultiPolygon":return ey(t).geometry;default:throw new Error(r+" is invalid")}}ue.geometry=WT;function Lp(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Fc(r[0])||!Fc(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Ss(o,t,e)}ue.point=Lp;function qT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Lp(o,t)}),e)}ue.points=qT;function Np(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var f=0;f<l[l.length-1].length;f++)if(l[l.length-1][f]!==l[0][f])throw new Error("First and last Position are not equivalent.")}var h={type:"Polygon",coordinates:r};return Ss(h,t,e)}ue.polygon=Np;function XT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Np(o,t)}),e)}ue.polygons=XT;function Op(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return Ss(o,t,e)}ue.lineString=Op;function YT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Op(o,t)}),e)}ue.lineStrings=YT;function Uc(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}ue.featureCollection=Uc;function j0(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Ss(o,t,e)}ue.multiLineString=j0;function ty(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Ss(o,t,e)}ue.multiPoint=ty;function ey(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Ss(o,t,e)}ue.multiPolygon=ey;function $T(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Ss(o,t,e)}ue.geometryCollection=$T;function ZT(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}ue.round=ZT;function ny(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}ue.radiansToLength=ny;function Dp(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}ue.lengthToRadians=Dp;function JT(r,t){return ry(Dp(r,t))}ue.lengthToDegrees=JT;function KT(r){var t=r%360;return t<0&&(t+=360),t}ue.bearingToAzimuth=KT;function ry(r){var t=r%(2*Math.PI);return t*180/Math.PI}ue.radiansToDegrees=ry;function QT(r){var t=r%360;return t*Math.PI/180}ue.degreesToRadians=QT;function jT(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return ny(Dp(r,t),e)}ue.convertLength=jT;function tA(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=ue.areaFactors[t];if(!o)throw new Error("invalid original units");var a=ue.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}ue.convertArea=tA;function Fc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}ue.isNumber=Fc;function eA(r){return!!r&&r.constructor===Object}ue.isObject=eA;function nA(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!Fc(t))throw new Error("bbox must only contain numbers")})}ue.validateBBox=nA;function rA(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}ue.validateId=rA});var Bp=Zt(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});var Vr=Fp();function tl(r,t,e){if(r!==null)for(var o,a,l,f,h,p,d,g=0,_=0,y,M=r.type,S=M==="FeatureCollection",T=M==="Feature",x=S?r.features.length:1,v=0;v<x;v++){d=S?r.features[v].geometry:T?r.geometry:r,y=d?d.type==="GeometryCollection":!1,h=y?d.geometries.length:1;for(var C=0;C<h;C++){var w=0,O=0;if(f=y?d.geometries[C]:d,f!==null){p=f.coordinates;var F=f.type;switch(g=e&&(F==="Polygon"||F==="MultiPolygon")?1:0,F){case null:break;case"Point":if(t(p,_,v,w,O)===!1)return!1;_++,w++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,w,O)===!1)return!1;_++,F==="MultiPoint"&&w++}F==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],_,v,w,O)===!1)return!1;_++}F==="MultiLineString"&&w++,F==="Polygon"&&O++}F==="Polygon"&&w++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(O=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],_,v,w,O)===!1)return!1;_++}O++}w++}break;case"GeometryCollection":for(o=0;o<f.geometries.length;o++)if(tl(f.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function iA(r,t,e,o){var a=e;return tl(r,function(l,f,h,p,d){f===0&&e===void 0?a=l:a=t(a,l,f,h,p,d)},o),a}function iy(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}function oA(r,t,e){var o=e;return iy(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function oy(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function sA(r,t,e){var o=e;return oy(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function aA(r){var t=[];return tl(r,function(e){t.push(e)}),t}function Up(r,t){var e,o,a,l,f,h,p,d,g,_,y=0,M=r.type==="FeatureCollection",S=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(h=M?r.features[e].geometry:S?r.geometry:r,d=M?r.features[e].properties:S?r.properties:{},g=M?r.features[e].bbox:S?r.bbox:void 0,_=M?r.features[e].id:S?r.id:void 0,p=h?h.type==="GeometryCollection":!1,f=p?h.geometries.length:1,a=0;a<f;a++){if(l=p?h.geometries[a]:h,l===null){if(t(null,y,d,g,_)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,y,d,g,_)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],y,d,g,_)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}function uA(r,t,e){var o=e;return Up(r,function(a,l,f,h,p){l===0&&e===void 0?o=a:o=t(o,a,l,f,h,p)}),o}function Bc(r,t){Up(r,function(e,o,a,l,f){var h=e===null?null:e.type;switch(h){case null:case"Point":case"LineString":case"Polygon":return t(Vr.feature(e,a,{bbox:l,id:f}),o,0)===!1?!1:void 0}var p;switch(h){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],_={type:p,coordinates:g};if(t(Vr.feature(_,a),o,d)===!1)return!1}})}function lA(r,t,e){var o=e;return Bc(r,function(a,l,f){l===0&&f===0&&e===void 0?o=a:o=t(o,a,l,f)}),o}function sy(r,t){Bc(r,function(e,o,a){var l=0;if(e.geometry){var f=e.geometry.type;if(!(f==="Point"||f==="MultiPoint")){var h,p=0,d=0,g=0;if(tl(e,function(_,y,M,S,T){if(h===void 0||o>p||S>d||T>g){h=_,p=o,d=S,g=T,l=0;return}var x=Vr.lineString([h,_],e.properties);if(t(x,o,a,T,l)===!1)return!1;l++,h=_})===!1)return!1}}})}function cA(r,t,e){var o=e,a=!1;return sy(r,function(l,f,h,p,d){a===!1&&e===void 0?o=l:o=t(o,l,f,h,p,d),a=!0}),o}function ay(r,t){if(!r)throw new Error("geojson is required");Bc(r,function(e,o,a){if(e.geometry!==null){var l=e.geometry.type,f=e.geometry.coordinates;switch(l){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var h=0;h<f.length;h++)if(t(Vr.lineString(f[h],e.properties),o,a,h)===!1)return!1;break}}})}function fA(r,t,e){var o=e;return ay(r,function(a,l,f,h){l===0&&e===void 0?o=a:o=t(o,a,l,f,h)}),o}function hA(r,t){if(t=t||{},!Vr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.segmentIndex||0,f=t.properties,h;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),f=f||r.features[e].properties,h=r.features[e].geometry;break;case"Feature":f=f||r.properties,h=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":h=r;break;default:throw new Error("geojson is invalid")}if(h===null)return null;var p=h.coordinates;switch(h.type){case"Point":case"MultiPoint":return null;case"LineString":return l<0&&(l=p.length+l-1),Vr.lineString([p[l],p[l+1]],f,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l-1),Vr.lineString([p[a][l],p[a][l+1]],f,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l-1),Vr.lineString([p[o][l],p[o][l+1]],f,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l-1),Vr.lineString([p[o][a][l],p[o][a][l+1]],f,t)}throw new Error("geojson is invalid")}function pA(r,t){if(t=t||{},!Vr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.coordIndex||0,f=t.properties,h;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),f=f||r.features[e].properties,h=r.features[e].geometry;break;case"Feature":f=f||r.properties,h=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":h=r;break;default:throw new Error("geojson is invalid")}if(h===null)return null;var p=h.coordinates;switch(h.type){case"Point":return Vr.point(p,f,t);case"MultiPoint":return o<0&&(o=p.length+o),Vr.point(p[o],f,t);case"LineString":return l<0&&(l=p.length+l),Vr.point(p[l],f,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Vr.point(p[a][l],f,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Vr.point(p[o][l],f,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l),Vr.point(p[o][a][l],f,t)}throw new Error("geojson is invalid")}or.coordAll=aA;or.coordEach=tl;or.coordReduce=iA;or.featureEach=oy;or.featureReduce=sA;or.findPoint=pA;or.findSegment=hA;or.flattenEach=Bc;or.flattenReduce=lA;or.geomEach=Up;or.geomReduce=uA;or.lineEach=ay;or.lineReduce=fA;or.propEach=iy;or.propReduce=oA;or.segmentEach=sy;or.segmentReduce=cA});var uy=Zt(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});var dA=Bp();function zp(r){var t=[1/0,1/0,-1/0,-1/0];return dA.coordEach(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}zp.default=zp;kp.default=zp});var zc=Zt((UO,Gp)=>{var _o=hp(),cy=Fp(),fy=Bp(),ou=uy().default,mA=fy.featureEach,DO=fy.coordEach,FO=cy.polygon,ly=cy.featureCollection;function hy(r){var t=new _o(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:ou(e),_o.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:ou(a),o.push(a)}):mA(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:ou(a),o.push(a)}),_o.prototype.load.call(this,o)},t.remove=function(e,o){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:ou(e),_o.prototype.remove.call(this,e,o)},t.clear=function(){return _o.prototype.clear.call(this)},t.search=function(e){var o=_o.prototype.search.call(this,this.toBBox(e));return ly(o)},t.collides=function(e){return _o.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=_o.prototype.all.call(this);return ly(e)},t.toJSON=function(){return _o.prototype.toJSON.call(this)},t.fromJSON=function(e){return _o.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var o;if(e.bbox)o=e.bbox;else if(Array.isArray(e)&&e.length===4)o=e;else if(Array.isArray(e)&&e.length===6)o=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")o=ou(e);else if(e.type==="FeatureCollection")o=ou(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Gp.exports=hy;Gp.exports.default=hy});var Yp=Zt((X3,My)=>{"use strict";var Ey=Object.prototype.toString;My.exports=function(t){var e=Ey.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Ey.call(t.callee)==="[object Function]"),o}});var Ry=Zt((Y3,Iy)=>{"use strict";var Py;Object.keys||(rl=Object.prototype.hasOwnProperty,$p=Object.prototype.toString,wy=Yp(),Zp=Object.prototype.propertyIsEnumerable,Sy=!Zp.call({toString:null},"toString"),by=Zp.call(function(){},"prototype"),il=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Wc=function(r){var t=r.constructor;return t&&t.prototype===r},Ty={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},Ay=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!Ty["$"+r]&&rl.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Wc(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),Cy=function(r){if(typeof window=="undefined"||!Ay)return Wc(r);try{return Wc(r)}catch(t){return!1}},Py=function(t){var e=t!==null&&typeof t=="object",o=$p.call(t)==="[object Function]",a=wy(t),l=e&&$p.call(t)==="[object String]",f=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var h=by&&o;if(l&&t.length>0&&!rl.call(t,0))for(var p=0;p<t.length;++p)f.push(String(p));if(a&&t.length>0)for(var d=0;d<t.length;++d)f.push(String(d));else for(var g in t)!(h&&g==="prototype")&&rl.call(t,g)&&f.push(String(g));if(Sy)for(var _=Cy(t),y=0;y<il.length;++y)!(_&&il[y]==="constructor")&&rl.call(t,il[y])&&f.push(il[y]);return f});var rl,$p,wy,Zp,Sy,by,il,Wc,Ty,Ay,Cy;Iy.exports=Py});var Jp=Zt(($3,Oy)=>{"use strict";var bA=Array.prototype.slice,TA=Yp(),Ly=Object.keys,qc=Ly?function(t){return Ly(t)}:Ry(),Ny=Object.keys;qc.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(o){return TA(o)?Ny(bA.call(o)):Ny(o)})}else Object.keys=qc;return Object.keys||qc};Oy.exports=qc});var Kp=Zt((Z3,Dy)=>{"use strict";Dy.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var l=Object.getOwnPropertySymbols(t);if(l.length!==1||l[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(t,e);if(f.value!==a||f.enumerable!==!0)return!1}return!0}});var Xc=Zt((J3,Fy)=>{"use strict";var AA=Kp();Fy.exports=function(){return AA()&&!!Symbol.toStringTag}});var zy=Zt((K3,By)=>{"use strict";var Uy=typeof Symbol!="undefined"&&Symbol,CA=Kp();By.exports=function(){return typeof Uy!="function"||typeof Symbol!="function"||typeof Uy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:CA()}});var Vy=Zt((Q3,Gy)=>{"use strict";var ky={foo:{}},PA=Object;Gy.exports=function(){return{__proto__:ky}.foo===ky.foo&&!({__proto__:null}instanceof PA)}});var qy=Zt((j3,Wy)=>{"use strict";var IA="Function.prototype.bind called on incompatible ",RA=Object.prototype.toString,LA=Math.max,NA="[object Function]",Hy=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var l=0;l<e.length;l+=1)o[l+t.length]=e[l];return o},OA=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},DA=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};Wy.exports=function(t){var e=this;if(typeof e!="function"||RA.apply(e)!==NA)throw new TypeError(IA+e);for(var o=OA(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,Hy(o,arguments));return Object(g)===g?g:this}return e.apply(t,Hy(o,arguments))},f=LA(0,e.length-o.length),h=[],p=0;p<f;p++)h[p]="$"+p;if(a=Function("binder","return function ("+DA(h,",")+"){ return binder.apply(this,arguments); }")(l),e.prototype){var d=function(){};d.prototype=e.prototype,a.prototype=new d,d.prototype=null}return a}});var Yc=Zt((tF,Xy)=>{"use strict";var FA=qy();Xy.exports=Function.prototype.bind||FA});var $y=Zt((eF,Yy)=>{"use strict";var UA=Function.prototype.call,BA=Object.prototype.hasOwnProperty,zA=Yc();Yy.exports=zA.call(UA,BA)});var ia=Zt((nF,jy)=>{"use strict";var tn,lu=SyntaxError,Qy=Function,uu=TypeError,Qp=function(r){try{return Qy('"use strict"; return ('+r+").constructor;")()}catch(t){}},na=Object.getOwnPropertyDescriptor;if(na)try{na({},"")}catch(r){na=null}var jp=function(){throw new uu},kA=na?function(){try{return arguments.callee,jp}catch(r){try{return na(arguments,"callee").get}catch(t){return jp}}}():jp,su=zy()(),GA=Vy()(),_r=Object.getPrototypeOf||(GA?function(r){return r.__proto__}:null),au={},VA=typeof Uint8Array=="undefined"||!_r?tn:_r(Uint8Array),ra={"%AggregateError%":typeof AggregateError=="undefined"?tn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?tn:ArrayBuffer,"%ArrayIteratorPrototype%":su&&_r?_r([][Symbol.iterator]()):tn,"%AsyncFromSyncIteratorPrototype%":tn,"%AsyncFunction%":au,"%AsyncGenerator%":au,"%AsyncGeneratorFunction%":au,"%AsyncIteratorPrototype%":au,"%Atomics%":typeof Atomics=="undefined"?tn:Atomics,"%BigInt%":typeof BigInt=="undefined"?tn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?tn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?tn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?tn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array=="undefined"?tn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?tn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?tn:FinalizationRegistry,"%Function%":Qy,"%GeneratorFunction%":au,"%Int8Array%":typeof Int8Array=="undefined"?tn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?tn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?tn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":su&&_r?_r(_r([][Symbol.iterator]())):tn,"%JSON%":typeof JSON=="object"?JSON:tn,"%Map%":typeof Map=="undefined"?tn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!su||!_r?tn:_r(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?tn:Promise,"%Proxy%":typeof Proxy=="undefined"?tn:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect=="undefined"?tn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?tn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!su||!_r?tn:_r(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?tn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":su&&_r?_r(""[Symbol.iterator]()):tn,"%Symbol%":su?Symbol:tn,"%SyntaxError%":lu,"%ThrowTypeError%":kA,"%TypedArray%":VA,"%TypeError%":uu,"%Uint8Array%":typeof Uint8Array=="undefined"?tn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?tn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?tn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?tn:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap=="undefined"?tn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?tn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?tn:WeakSet};if(_r)try{null.error}catch(r){Zy=_r(_r(r)),ra["%Error.prototype%"]=Zy}var Zy,HA=function r(t){var e;if(t==="%AsyncFunction%")e=Qp("async function () {}");else if(t==="%GeneratorFunction%")e=Qp("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Qp("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&_r&&(e=_r(a.prototype))}return ra[t]=e,e},Jy={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ol=Yc(),$c=$y(),WA=ol.call(Function.call,Array.prototype.concat),qA=ol.call(Function.apply,Array.prototype.splice),Ky=ol.call(Function.call,String.prototype.replace),Zc=ol.call(Function.call,String.prototype.slice),XA=ol.call(Function.call,RegExp.prototype.exec),YA=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,$A=/\\\\(\\\\)?/g,ZA=function(t){var e=Zc(t,0,1),o=Zc(t,-1);if(e==="%"&&o!=="%")throw new lu("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new lu("invalid intrinsic syntax, expected opening \`%\`");var a=[];return Ky(t,YA,function(l,f,h,p){a[a.length]=h?Ky(p,$A,"$1"):f||l}),a},JA=function(t,e){var o=t,a;if($c(Jy,o)&&(a=Jy[o],o="%"+a[0]+"%"),$c(ra,o)){var l=ra[o];if(l===au&&(l=HA(o)),typeof l=="undefined"&&!e)throw new uu("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new lu("intrinsic "+t+" does not exist!")};jy.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new uu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new uu('"allowMissing" argument must be a boolean');if(XA(/^%?[^%]*%?$/,t)===null)throw new lu("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=ZA(t),a=o.length>0?o[0]:"",l=JA("%"+a+"%",e),f=l.name,h=l.value,p=!1,d=l.alias;d&&(a=d[0],qA(o,WA([0,1],d)));for(var g=1,_=!0;g<o.length;g+=1){var y=o[g],M=Zc(y,0,1),S=Zc(y,-1);if((M==='"'||M==="'"||M==="\`"||S==='"'||S==="'"||S==="\`")&&M!==S)throw new lu("property names with quotes must have matching quotes");if((y==="constructor"||!_)&&(p=!0),a+="."+y,f="%"+a+"%",$c(ra,f))h=ra[f];else if(h!=null){if(!(y in h)){if(!e)throw new uu("base intrinsic for "+t+" exists, but the property is not available.");return}if(na&&g+1>=o.length){var T=na(h,y);_=!!T,_&&"get"in T&&!("originalValue"in T.get)?h=T.get:h=h[y]}else _=$c(h,y),h=h[y];_&&!p&&(ra[f]=h)}}return h}});var sl=Zt((rF,tv)=>{"use strict";var KA=ia(),td=KA("%Object.defineProperty%",!0),ed=function(){if(td)try{return td({},"a",{value:1}),!0}catch(t){return!1}return!1};ed.hasArrayLengthDefineBug=function(){if(!ed())return null;try{return td([],"length",{value:1}).length!==1}catch(t){return!0}};tv.exports=ed});var nd=Zt((iF,ev)=>{"use strict";var QA=ia(),Jc=QA("%Object.getOwnPropertyDescriptor%",!0);if(Jc)try{Jc([],"length")}catch(r){Jc=null}ev.exports=Jc});var Kc=Zt((oF,rv)=>{"use strict";var jA=sl()(),rd=ia(),al=jA&&rd("%Object.defineProperty%",!0);if(al)try{al({},"a",{value:1})}catch(r){al=!1}var tC=rd("%SyntaxError%"),cu=rd("%TypeError%"),nv=nd();rv.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new cu("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new cu("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new cu("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new cu("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new cu("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new cu("\`loose\`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,h=arguments.length>6?arguments[6]:!1,p=!!nv&&nv(t,e);if(al)al(t,e,{configurable:f===null&&p?p.configurable:!f,enumerable:a===null&&p?p.enumerable:!a,value:o,writable:l===null&&p?p.writable:!l});else if(h||!a&&!l&&!f)t[e]=o;else throw new tC("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var lv=Zt((sF,uv)=>{"use strict";var av=ia(),iv=Kc(),eC=sl()(),ov=nd(),sv=av("%TypeError%"),nC=av("%Math.floor%");uv.exports=function(t,e){if(typeof t!="function")throw new sv("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||nC(e)!==e)throw new sv("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&ov){var f=ov(t,"length");f&&!f.configurable&&(a=!1),f&&!f.writable&&(l=!1)}return(a||l||!o)&&(eC?iv(t,"length",e,!0,!0):iv(t,"length",e)),t}});var jc=Zt((aF,Qc)=>{"use strict";var id=Yc(),fu=ia(),rC=lv(),iC=fu("%TypeError%"),fv=fu("%Function.prototype.apply%"),hv=fu("%Function.prototype.call%"),pv=fu("%Reflect.apply%",!0)||id.call(hv,fv),ul=fu("%Object.defineProperty%",!0),oC=fu("%Math.max%");if(ul)try{ul({},"a",{value:1})}catch(r){ul=null}Qc.exports=function(t){if(typeof t!="function")throw new iC("a function is required");var e=pv(id,hv,arguments);return rC(e,1+oC(0,t.length-(arguments.length-1)),!0)};var cv=function(){return pv(id,fv,arguments)};ul?ul(Qc.exports,"apply",{value:cv}):Qc.exports.apply=cv});var od=Zt((uF,gv)=>{"use strict";var dv=ia(),mv=jc(),sC=mv(dv("String.prototype.indexOf"));gv.exports=function(t,e){var o=dv(t,!!e);return typeof o=="function"&&sC(t,".prototype.")>-1?mv(o):o}});var _v=Zt((lF,vv)=>{"use strict";var aC=Xc()(),uC=od(),sd=uC("Object.prototype.toString"),tf=function(t){return aC&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:sd(t)==="[object Arguments]"},yv=function(t){return tf(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&sd(t)!=="[object Array]"&&sd(t.callee)==="[object Function]"},lC=function(){return tf(arguments)}();tf.isLegacyArguments=yv;vv.exports=lC?tf:yv});var hu=Zt((cF,wv)=>{"use strict";var cC=Jp(),fC=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",hC=Object.prototype.toString,pC=Array.prototype.concat,xv=Kc(),dC=function(r){return typeof r=="function"&&hC.call(r)==="[object Function]"},Ev=sl()(),mC=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!dC(o)||!o())return}Ev?xv(r,t,e,!0):xv(r,t,e)},Mv=function(r,t){var e=arguments.length>2?arguments[2]:{},o=cC(t);fC&&(o=pC.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)mC(r,o[a],t[o[a]],e[o[a]])};Mv.supportsDescriptors=!!Ev;wv.exports=Mv});var ad=Zt((fF,bv)=>{"use strict";var Sv=function(r){return r!==r};bv.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||Sv(t)&&Sv(e))}});var ud=Zt((hF,Tv)=>{"use strict";var gC=ad();Tv.exports=function(){return typeof Object.is=="function"?Object.is:gC}});var Cv=Zt((pF,Av)=>{"use strict";var yC=ud(),vC=hu();Av.exports=function(){var t=yC();return vC(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Lv=Zt((dF,Rv)=>{"use strict";var _C=hu(),xC=jc(),EC=ad(),Pv=ud(),MC=Cv(),Iv=xC(Pv(),Object);_C(Iv,{getPolyfill:Pv,implementation:EC,shim:MC});Rv.exports=Iv});var Uv=Zt((mF,Fv)=>{"use strict";var ld=od(),Nv=Xc()(),Ov,Dv,cd,fd;Nv&&(Ov=ld("Object.prototype.hasOwnProperty"),Dv=ld("RegExp.prototype.exec"),cd={},ef=function(){throw cd},fd={toString:ef,valueOf:ef},typeof Symbol.toPrimitive=="symbol"&&(fd[Symbol.toPrimitive]=ef));var ef,wC=ld("Object.prototype.toString"),SC=Object.getOwnPropertyDescriptor,bC="[object RegExp]";Fv.exports=Nv?function(t){if(!t||typeof t!="object")return!1;var e=SC(t,"lastIndex"),o=e&&Ov(e,"value");if(!o)return!1;try{Dv(t,fd)}catch(a){return a===cd}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:wC(t)===bC}});var zv=Zt((gF,Bv)=>{"use strict";var cl=function(){return typeof function(){}.name=="string"},ll=Object.getOwnPropertyDescriptor;if(ll)try{ll([],"length")}catch(r){ll=null}cl.functionsHaveConfigurableNames=function(){if(!cl()||!ll)return!1;var t=ll(function(){},"name");return!!t&&!!t.configurable};var TC=Function.prototype.bind;cl.boundFunctionsHaveNames=function(){return cl()&&typeof TC=="function"&&function(){}.bind().name!==""};Bv.exports=cl});var Vv=Zt((yF,Gv)=>{"use strict";var kv=Kc(),AC=sl()(),CC=zv().functionsHaveConfigurableNames(),PC=TypeError;Gv.exports=function(t,e){if(typeof t!="function")throw new PC("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||CC)&&(AC?kv(t,"name",e,!0,!0):kv(t,"name",e)),t}});var hd=Zt((vF,Hv)=>{"use strict";var IC=Vv(),RC=Object,LC=TypeError;Hv.exports=IC(function(){if(this!=null&&this!==RC(this))throw new LC("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0)});var pd=Zt((_F,Wv)=>{"use strict";var NC=hd(),OC=hu().supportsDescriptors,DC=Object.getOwnPropertyDescriptor;Wv.exports=function(){if(OC&&/a/mig.flags==="gim"){var t=DC(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),e==="dy")return t.get}}return NC}});var Yv=Zt((xF,Xv)=>{"use strict";var FC=hu().supportsDescriptors,UC=pd(),BC=Object.getOwnPropertyDescriptor,zC=Object.defineProperty,kC=TypeError,qv=Object.getPrototypeOf,GC=/a/;Xv.exports=function(){if(!FC||!qv)throw new kC("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=UC(),e=qv(GC),o=BC(e,"flags");return(!o||o.get!==t)&&zC(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Kv=Zt((EF,Jv)=>{"use strict";var VC=hu(),HC=jc(),WC=hd(),$v=pd(),qC=Yv(),Zv=HC($v());VC(Zv,{getPolyfill:$v,implementation:WC,shim:qC});Jv.exports=Zv});var jv=Zt((MF,Qv)=>{"use strict";var XC=Date.prototype.getDay,YC=function(t){try{return XC.call(t),!0}catch(e){return!1}},$C=Object.prototype.toString,ZC="[object Date]",JC=Xc()();Qv.exports=function(t){return typeof t!="object"||t===null?!1:JC?YC(t):$C.call(t)===ZC}});var dd=Zt((wF,c_)=>{var t_=Jp(),e_=_v(),n_=Lv(),r_=Uv(),i_=Kv(),o_=jv(),s_=Date.prototype.getTime;function l_(r,t,e){var o=e||{};return(o.strict?n_(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?n_(r,t):r==t:KC(r,t,o)}function a_(r){return r==null}function u_(r){return!(!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number")}function KC(r,t,e){var o,a;if(typeof r!=typeof t||a_(r)||a_(t)||r.prototype!==t.prototype||e_(r)!==e_(t))return!1;var l=r_(r),f=r_(t);if(l!==f)return!1;if(l||f)return r.source===t.source&&i_(r)===i_(t);if(o_(r)&&o_(t))return s_.call(r)===s_.call(t);var h=u_(r),p=u_(t);if(h!==p)return!1;if(h||p){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var d=t_(r),g=t_(t)}catch(_){return!1}if(d.length!==g.length)return!1;for(d.sort(),g.sort(),o=d.length-1;o>=0;o--)if(d[o]!=g[o])return!1;for(o=d.length-1;o>=0;o--)if(a=d[o],!l_(r[a],t[a],e))return!1;return!0}c_.exports=l_});var Td=Zt((PB,y_)=>{var GP=dd(),xo=function(r){this.precision=r&&r.precision?r.precision:17,this.direction=r&&r.direction?r.direction:!1,this.pseudoNode=r&&r.pseudoNode?r.pseudoNode:!1,this.objectComparator=r&&r.objectComparator?r.objectComparator:VP};xo.prototype.compare=function(r,t){if(r.type!==t.type||!g_(r,t))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,t.coordinates);case"LineString":return this.compareLine(r.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(r,t);case"Feature":return this.compareFeature(r,t);default:if(r.type.indexOf("Multi")===0){var e=this,o=m_(r),a=m_(t);return o.every(function(l){return this.some(function(f){return e.compare(l,f)})},a)}}return!1};function m_(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function g_(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}xo.prototype.compareCoord=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e++)if(r[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};xo.prototype.compareLine=function(r,t,e,o){if(!g_(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),l=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],l[0])&&(l=this.fixStartIndex(l,a),!l))){var f=this.compareCoord(a[e],l[e]);return this.direction||f?this.comparePath(a,l):this.compareCoord(a[e],l[l.length-(1+e)])?this.comparePath(a.slice().reverse(),l):!1}};xo.prototype.fixStartIndex=function(r,t){for(var e,o=-1,a=0;a<r.length;a++)if(this.compareCoord(r[a],t[0])){o=a;break}return o>=0&&(e=[].concat(r.slice(o,r.length),r.slice(1,o+1))),e};xo.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};xo.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(l){return this.some(function(f){return a.compareLine(l,f,1,!0)})},o)}else return!1};xo.prototype.compareFeature=function(r,t){return r.id!==t.id||!this.objectComparator(r.properties,t.properties)||!this.compareBBox(r,t)?!1:this.compare(r.geometry,t.geometry)};xo.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};xo.prototype.removePseudo=function(r){return r};function VP(r,t){return GP(r,t,{strict:!0})}y_.exports=xo});var v_=Zt((GB,of)=>{function Ts(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}Ts.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var l=this._regionQuery(a);if(l.length<this.minPts)this.noise.push(a);else{var f=this.clusters.length;this.clusters.push([]),this._addToCluster(a,f),this._expandCluster(f,l)}}return this.clusters};Ts.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Ts.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};Ts.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};Ts.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};Ts.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};Ts.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof of!="undefined"&&of.exports&&(of.exports=Ts)});var __=Zt((VB,sf)=>{function As(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}As.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};As.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var l=0;l<this.k;l++){for(var f=new Array(g),h=0,p=0;p<g;p++)f[p]=0;for(var d=0;d<e;d++){var g=this.dataset[d].length;if(l===this.assignments[d]){for(var p=0;p<g;p++)f[p]+=this.dataset[d][p];h++}}if(h>0){for(var p=0;p<g;p++)f[p]/=h;this.centroids[l]=f}else this.centroids[l]=this.randomCentroid(),a=!0}}return this.getClusters()};As.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};As.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};As.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};As.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,l=t.length,f,h=0;h<l;h++)f=e(r,t[h]),f<o&&(o=f,a=h);return a};As.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof sf!="undefined"&&sf.exports&&(sf.exports=As)});var Ad=Zt((HB,af)=>{function Eo(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}Eo.prototype.insert=function(r,t){for(var e=this._queue.length,o=e;o--;){var a=this._priorities[o];this._sorting==="desc"?t>a&&(e=o):t<a&&(e=o)}this._insertAt(r,t,e)};Eo.prototype.remove=function(r){for(var t=this._queue.length;t--;){var e=this._queue[t];if(r===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};Eo.prototype.forEach=function(r){this._queue.forEach(r)};Eo.prototype.getElements=function(){return this._queue};Eo.prototype.getElementPriority=function(r){return this._priorities[r]};Eo.prototype.getPriorities=function(){return this._priorities};Eo.prototype.getElementsWithPriorities=function(){for(var r=[],t=0,e=this._queue.length;t<e;t++)r.push([this._queue[t],this._priorities[t]]);return r};Eo.prototype._init=function(r,t,e){if(r&&t){if(this._queue=[],this._priorities=[],r.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<r.length;o++)this.insert(r[o],t[o])}e&&(this._sorting=e)};Eo.prototype._insertAt=function(r,t,e){this._queue.length===e?(this._queue.push(r),this._priorities.push(t)):(this._queue.splice(e,0,r),this._priorities.splice(e,0,t))};typeof af!="undefined"&&af.exports&&(af.exports=Eo)});var E_=Zt((WB,du)=>{typeof du!="undefined"&&du.exports&&(x_=Ad());var x_;function jo(r,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,t,e,o)}jo.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,l=this.dataset.length;a<l;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var f=this.clusters.length-1;this._orderedList.push(a);var h=new x_(null,null,"asc"),p=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,p,h),this._expandCluster(f,h))}return this.clusters};jo.prototype.getReachabilityPlot=function(){for(var r=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],a=this._reachability[o];r.push([o,a])}return r};jo.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};jo.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var l=o.distance(o.dataset[r],o.dataset[a]),f=Math.max(o._coreDistance,l);o._reachability[a]===void 0?(o._reachability[a]=f,e.insert(a,f)):f<o._reachability[a]&&(o._reachability[a]=f,e.remove(a),e.insert(a,f))}})};jo.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var l=e[o];if(this._processed[l]===void 0){var f=this._regionQuery(l);this._processed[l]=1,this.clusters[r].push(l),this._orderedList.push(l),this._distanceToCore(l)!==void 0&&(this._updateQueue(l,f,t),this._expandCluster(r,t))}}};jo.prototype._distanceToCore=function(r){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(r,e);if(o.length>=this.minPts)return e}};jo.prototype._regionQuery=function(r,t){t=t||this.epsilon;for(var e=[],o=0,a=this.dataset.length;o<a;o++)this.distance(this.dataset[r],this.dataset[o])<t&&e.push(o);return e};jo.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof du!="undefined"&&du.exports&&(du.exports=jo)});var M_=Zt((qB,uf)=>{typeof uf!="undefined"&&uf.exports&&(uf.exports={DBSCAN:v_(),KMEANS:__(),OPTICS:E_(),PriorityQueue:Ad()})});var Cd=Zt((KB,S_)=>{"use strict";S_.exports={eudist:function(t,e,o){for(var a=t.length,l=0,f=0;f<a;f++){var h=(t[f]||0)-(e[f]||0);l+=h*h}return o?Math.sqrt(l):l},mandist:function(t,e,o){for(var a=t.length,l=0,f=0;f<a;f++)l+=Math.abs((t[f]||0)-(e[f]||0));return o?Math.sqrt(l):l},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var A_=Zt((QB,T_)=>{"use strict";var b_=Cd(),$P=b_.eudist,ZP=b_.dist;T_.exports={kmrand:function(t,e){for(var o={},a=[],l=e<<2,f=t.length,h=t[0].length>0;a.length<e&&l-- >0;){var p=t[Math.floor(Math.random()*f)],d=h?p.join("_"):""+p;o[d]||(o[d]=!0,a.push(p))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?$P:ZP,a=[],l=t.length,f=t[0].length>0,h={},p=t[Math.floor(Math.random()*l)],d=f?p.join("_"):""+p;for(a.push(p),h[d]=!0;a.length<e;){for(var g=[],_=a.length,y=0,M=[],S=0;S<l;S++){for(var T=1/0,x=0;x<_;x++){var v=o(t[S],a[x]);v<=T&&(T=v)}g[S]=T}for(var C=0;C<l;C++)y+=g[C];for(var w=0;w<l;w++)M[w]={i:w,v:t[w],pr:g[w]/y,cs:0};M.sort(function(z,L){return z.pr-L.pr}),M[0].cs=M[0].pr;for(var O=1;O<l;O++)M[O].cs=M[O-1].cs+M[O].pr;for(var F=Math.random(),G=0;G<l-1&&M[G++].cs<F;);a.push(M[G-1].v)}return a}}});var L_=Zt((ez,R_)=>{"use strict";var Pd=Cd(),I_=A_(),JP=Pd.eudist,jB=Pd.mandist,tz=Pd.dist,KP=I_.kmrand,QP=I_.kmpp,C_=1e4;function P_(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function jP(r,t,e,o){var a=[],l=[],f=[],h=[],p=!1,d=o||C_,g=r.length,_=r[0].length,y=_>0,M=[];if(e)e=="kmrand"?a=KP(r,t):e=="kmpp"?a=QP(r,t):a=e;else for(var S={};a.length<t;){var T=Math.floor(Math.random()*g);S[T]||(S[T]=!0,a.push(r[T]))}do{P_(t,0,M);for(var x=0;x<g;x++){for(var v=1/0,C=0,w=0;w<t;w++){var h=y?JP(r[x],a[w]):Math.abs(r[x]-a[w]);h<=v&&(v=h,C=w)}f[x]=C,M[C]++}for(var O=[],l=[],F=0,G=0;G<t;G++)O[G]=y?P_(_,0,O[G]):0,l[G]=a[G];if(y){for(var z=0;z<t;z++)a[z]=[];for(var L=0;L<g;L++)for(var D=f[L],q=O[D],nt=r[L],k=0;k<_;k++)q[k]+=nt[k];p=!0;for(var xt=0;xt<t;xt++){for(var X=a[xt],it=O[xt],vt=l[xt],pt=M[xt],et=0;et<_;et++)X[et]=it[et]/pt||0;if(p){for(var ot=0;ot<_;ot++)if(vt[ot]!=X[ot]){p=!1;break}}}}else{for(var V=0;V<g;V++){var K=f[V];O[K]+=r[V]}for(var at=0;at<t;at++)a[at]=O[at]/M[at]||0;p=!0;for(var Tt=0;Tt<t;Tt++)if(l[Tt]!=a[Tt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:C_-d,k:t,idxs:f,centroids:a}}R_.exports=jP});var _u=Zt((Dd,Fd)=>{(function(r,t){typeof Dd=="object"&&typeof Fd!="undefined"?Fd.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(Dd,function(){"use strict";function r(J,N){if(!(J instanceof N))throw new TypeError("Cannot call a class as a function")}function t(J,N){for(var b=0;b<N.length;b++){var R=N[b];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty(J,R.key,R)}}function e(J,N,b){return N&&t(J.prototype,N),b&&t(J,b),J}var o=function(){function J(N,b){this.next=null,this.key=N,this.data=b,this.left=null,this.right=null}return J}();function a(J,N){return J>N?1:J<N?-1:0}function l(J,N,b){for(var R=new o(null,null),W=R,Z=R;;){var I=b(J,N.key);if(I<0){if(N.left===null)break;if(b(J,N.left.key)<0){var P=N.left;if(N.left=P.right,P.right=N,N=P,N.left===null)break}Z.left=N,Z=N,N=N.left}else if(I>0){if(N.right===null)break;if(b(J,N.right.key)>0){var P=N.right;if(N.right=P.left,P.left=N,N=P,N.right===null)break}W.right=N,W=N,N=N.right}else break}return W.right=N.left,Z.left=N.right,N.left=R.right,N.right=R.left,N}function f(J,N,b,R){var W=new o(J,N);if(b===null)return W.left=W.right=null,W;b=l(J,b,R);var Z=R(J,b.key);return Z<0?(W.left=b.left,W.right=b,b.left=null):Z>=0&&(W.right=b.right,W.left=b,b.right=null),W}function h(J,N,b){var R=null,W=null;if(N){N=l(J,N,b);var Z=b(N.key,J);Z===0?(R=N.left,W=N.right):Z<0?(W=N.right,N.right=null,R=N):(R=N.left,N.left=null,W=N)}return{left:R,right:W}}function p(J,N,b){return N===null?J:(J===null||(N=l(J.key,N,b),N.left=J),N)}function d(J,N,b,R,W){if(J){R(""+N+(b?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+W(J)+\`
|
|
91
91
|
\`);var Z=N+(b?" ":"\\u2502 ");J.left&&d(J.left,Z,!1,R,W),J.right&&d(J.right,Z,!0,R,W)}}var g=function(){function J(N){N===void 0&&(N=a),this._root=null,this._size=0,this._comparator=N}return J.prototype.insert=function(N,b){return this._size++,this._root=f(N,b,this._root,this._comparator)},J.prototype.add=function(N,b){var R=new o(N,b);this._root===null&&(R.left=R.right=null,this._size++,this._root=R);var W=this._comparator,Z=l(N,this._root,W),I=W(N,Z.key);return I===0?this._root=Z:(I<0?(R.left=Z.left,R.right=Z,Z.left=null):I>0&&(R.right=Z.right,R.left=Z,Z.right=null),this._size++,this._root=R),this._root},J.prototype.remove=function(N){this._root=this._remove(N,this._root,this._comparator)},J.prototype._remove=function(N,b,R){var W;if(b===null)return null;b=l(N,b,R);var Z=R(N,b.key);return Z===0?(b.left===null?W=b.right:(W=l(N,b.left,R),W.right=b.right),this._size--,W):b},J.prototype.pop=function(){var N=this._root;if(N){for(;N.left;)N=N.left;return this._root=l(N.key,this._root,this._comparator),this._root=this._remove(N.key,this._root,this._comparator),{key:N.key,data:N.data}}return null},J.prototype.findStatic=function(N){for(var b=this._root,R=this._comparator;b;){var W=R(N,b.key);if(W===0)return b;W<0?b=b.left:b=b.right}return null},J.prototype.find=function(N){return this._root&&(this._root=l(N,this._root,this._comparator),this._comparator(N,this._root.key)!==0)?null:this._root},J.prototype.contains=function(N){for(var b=this._root,R=this._comparator;b;){var W=R(N,b.key);if(W===0)return!0;W<0?b=b.left:b=b.right}return!1},J.prototype.forEach=function(N,b){for(var R=this._root,W=[],Z=!1;!Z;)R!==null?(W.push(R),R=R.left):W.length!==0?(R=W.pop(),N.call(b,R),R=R.right):Z=!0;return this},J.prototype.range=function(N,b,R,W){for(var Z=[],I=this._comparator,P=this._root,B;Z.length!==0||P;)if(P)Z.push(P),P=P.left;else{if(P=Z.pop(),B=I(P.key,b),B>0)break;if(I(P.key,N)>=0&&R.call(W,P))return this;P=P.right}return this},J.prototype.keys=function(){var N=[];return this.forEach(function(b){var R=b.key;return N.push(R)}),N},J.prototype.values=function(){var N=[];return this.forEach(function(b){var R=b.data;return N.push(R)}),N},J.prototype.min=function(){return this._root?this.minNode(this._root).key:null},J.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},J.prototype.minNode=function(N){if(N===void 0&&(N=this._root),N)for(;N.left;)N=N.left;return N},J.prototype.maxNode=function(N){if(N===void 0&&(N=this._root),N)for(;N.right;)N=N.right;return N},J.prototype.at=function(N){for(var b=this._root,R=!1,W=0,Z=[];!R;)if(b)Z.push(b),b=b.left;else if(Z.length>0){if(b=Z.pop(),W===N)return b;W++,b=b.right}else R=!0;return null},J.prototype.next=function(N){var b=this._root,R=null;if(N.right){for(R=N.right;R.left;)R=R.left;return R}for(var W=this._comparator;b;){var Z=W(N.key,b.key);if(Z===0)break;Z<0?(R=b,b=b.left):b=b.right}return R},J.prototype.prev=function(N){var b=this._root,R=null;if(N.left!==null){for(R=N.left;R.right;)R=R.right;return R}for(var W=this._comparator;b;){var Z=W(N.key,b.key);if(Z===0)break;Z<0?b=b.left:(R=b,b=b.right)}return R},J.prototype.clear=function(){return this._root=null,this._size=0,this},J.prototype.toList=function(){return M(this._root)},J.prototype.load=function(N,b,R){b===void 0&&(b=[]),R===void 0&&(R=!1);var W=N.length,Z=this._comparator;if(R&&x(N,b,0,W-1,Z),this._root===null)this._root=_(N,b,0,W),this._size=W;else{var I=T(this.toList(),y(N,b),Z);W=this._size+W,this._root=S({head:I},0,W)}return this},J.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(J.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(J.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),J.prototype.toString=function(N){N===void 0&&(N=function(W){return String(W.key)});var b=[];return d(this._root,"",!0,function(R){return b.push(R)},N),b.join("")},J.prototype.update=function(N,b,R){var W=this._comparator,Z=h(N,this._root,W),I=Z.left,P=Z.right;W(N,b)<0?P=f(b,R,P,W):I=f(b,R,I,W),this._root=p(I,P,W)},J.prototype.split=function(N){return h(N,this._root,this._comparator)},J}();function _(J,N,b,R){var W=R-b;if(W>0){var Z=b+Math.floor(W/2),I=J[Z],P=N[Z],B=new o(I,P);return B.left=_(J,N,b,Z),B.right=_(J,N,Z+1,R),B}return null}function y(J,N){for(var b=new o(null,null),R=b,W=0;W<J.length;W++)R=R.next=new o(J[W],N[W]);return R.next=null,b.next}function M(J){for(var N=J,b=[],R=!1,W=new o(null,null),Z=W;!R;)N?(b.push(N),N=N.left):b.length>0?(N=Z=Z.next=b.pop(),N=N.right):R=!0;return Z.next=null,W.next}function S(J,N,b){var R=b-N;if(R>0){var W=N+Math.floor(R/2),Z=S(J,N,W),I=J.head;return I.left=Z,J.head=J.head.next,I.right=S(J,W+1,b),I}return null}function T(J,N,b){for(var R=new o(null,null),W=R,Z=J,I=N;Z!==null&&I!==null;)b(Z.key,I.key)<0?(W.next=Z,Z=Z.next):(W.next=I,I=I.next),W=W.next;return Z!==null?W.next=Z:I!==null&&(W.next=I),R.next}function x(J,N,b,R,W){if(!(b>=R)){for(var Z=J[b+R>>1],I=b-1,P=R+1;;){do I++;while(W(J[I],Z)<0);do P--;while(W(J[P],Z)>0);if(I>=P)break;var B=J[I];J[I]=J[P],J[P]=B,B=N[I],N[I]=N[P],N[P]=B}x(J,N,b,P,W),x(J,N,P+1,R,W)}}var v=function(N,b){return N.ll.x<=b.x&&b.x<=N.ur.x&&N.ll.y<=b.y&&b.y<=N.ur.y},C=function(N,b){if(b.ur.x<N.ll.x||N.ur.x<b.ll.x||b.ur.y<N.ll.y||N.ur.y<b.ll.y)return null;var R=N.ll.x<b.ll.x?b.ll.x:N.ll.x,W=N.ur.x<b.ur.x?N.ur.x:b.ur.x,Z=N.ll.y<b.ll.y?b.ll.y:N.ll.y,I=N.ur.y<b.ur.y?N.ur.y:b.ur.y;return{ll:{x:R,y:Z},ur:{x:W,y:I}}},w=Number.EPSILON;w===void 0&&(w=Math.pow(2,-52));var O=w*w,F=function(N,b){if(-w<N&&N<w&&-w<b&&b<w)return 0;var R=N-b;return R*R<O*N*b?0:N<b?-1:1},G=function(){function J(){r(this,J),this.reset()}return e(J,[{key:"reset",value:function(){this.xRounder=new z,this.yRounder=new z}},{key:"round",value:function(b,R){return{x:this.xRounder.round(b),y:this.yRounder.round(R)}}}]),J}(),z=function(){function J(){r(this,J),this.tree=new g,this.round(0)}return e(J,[{key:"round",value:function(b){var R=this.tree.add(b),W=this.tree.prev(R);if(W!==null&&F(R.key,W.key)===0)return this.tree.remove(b),W.key;var Z=this.tree.next(R);return Z!==null&&F(R.key,Z.key)===0?(this.tree.remove(b),Z.key):b}}]),J}(),L=new G,D=function(N,b){return N.x*b.y-N.y*b.x},q=function(N,b){return N.x*b.x+N.y*b.y},nt=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},Z={x:R.x-N.x,y:R.y-N.y},I=D(W,Z);return F(I,0)},k=function(N){return Math.sqrt(q(N,N))},xt=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},Z={x:R.x-N.x,y:R.y-N.y};return D(Z,W)/k(Z)/k(W)},X=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},Z={x:R.x-N.x,y:R.y-N.y};return q(Z,W)/k(Z)/k(W)},it=function(N,b,R){return b.y===0?null:{x:N.x+b.x/b.y*(R-N.y),y:R}},vt=function(N,b,R){return b.x===0?null:{x:R,y:N.y+b.y/b.x*(R-N.x)}},pt=function(N,b,R,W){if(b.x===0)return vt(R,W,N.x);if(W.x===0)return vt(N,b,R.x);if(b.y===0)return it(R,W,N.y);if(W.y===0)return it(N,b,R.y);var Z=D(b,W);if(Z==0)return null;var I={x:R.x-N.x,y:R.y-N.y},P=D(I,b)/Z,B=D(I,W)/Z,lt=N.x+B*b.x,ct=R.x+P*W.x,j=N.y+B*b.y,wt=R.y+P*W.y,_t=(lt+ct)/2,Mt=(j+wt)/2;return{x:_t,y:Mt}},et=function(){e(J,null,[{key:"compare",value:function(b,R){var W=J.comparePoints(b.point,R.point);return W!==0?W:(b.point!==R.point&&b.link(R),b.isLeft!==R.isLeft?b.isLeft?1:-1:V.compare(b.segment,R.segment))}},{key:"comparePoints",value:function(b,R){return b.x<R.x?-1:b.x>R.x?1:b.y<R.y?-1:b.y>R.y?1:0}}]);function J(N,b){r(this,J),N.events===void 0?N.events=[this]:N.events.push(this),this.point=N,this.isLeft=b}return e(J,[{key:"link",value:function(b){if(b.point===this.point)throw new Error("Tried to link already linked events");for(var R=b.point.events,W=0,Z=R.length;W<Z;W++){var I=R[W];this.point.events.push(I),I.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var b=this.point.events.length,R=0;R<b;R++){var W=this.point.events[R];if(W.segment.consumedBy===void 0)for(var Z=R+1;Z<b;Z++){var I=this.point.events[Z];I.consumedBy===void 0&&W.otherSE.point.events===I.otherSE.point.events&&W.segment.consume(I.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var b=[],R=0,W=this.point.events.length;R<W;R++){var Z=this.point.events[R];Z!==this&&!Z.segment.ringOut&&Z.segment.isInResult()&&b.push(Z)}return b}},{key:"getLeftmostComparator",value:function(b){var R=this,W=new Map,Z=function(P){var B=P.otherSE;W.set(P,{sine:xt(R.point,b.point,B.point),cosine:X(R.point,b.point,B.point)})};return function(I,P){W.has(I)||Z(I),W.has(P)||Z(P);var B=W.get(I),lt=B.sine,ct=B.cosine,j=W.get(P),wt=j.sine,_t=j.cosine;return lt>=0&&wt>=0?ct<_t?1:ct>_t?-1:0:lt<0&&wt<0?ct<_t?-1:ct>_t?1:0:wt<lt?-1:wt>lt?1:0}}}]),J}(),ot=0,V=function(){e(J,null,[{key:"compare",value:function(b,R){var W=b.leftSE.point.x,Z=R.leftSE.point.x,I=b.rightSE.point.x,P=R.rightSE.point.x;if(P<W)return 1;if(I<Z)return-1;var B=b.leftSE.point.y,lt=R.leftSE.point.y,ct=b.rightSE.point.y,j=R.rightSE.point.y;if(W<Z){if(lt<B&<<ct)return 1;if(lt>B&<>ct)return-1;var wt=b.comparePoint(R.leftSE.point);if(wt<0)return 1;if(wt>0)return-1;var _t=R.comparePoint(b.rightSE.point);return _t!==0?_t:-1}if(W>Z){if(B<lt&&B<j)return-1;if(B>lt&&B>j)return 1;var Mt=R.comparePoint(b.leftSE.point);if(Mt!==0)return Mt;var Lt=b.comparePoint(R.rightSE.point);return Lt<0?1:Lt>0?-1:1}if(B<lt)return-1;if(B>lt)return 1;if(I<P){var Jt=R.comparePoint(b.rightSE.point);if(Jt!==0)return Jt}if(I>P){var Et=b.comparePoint(R.rightSE.point);if(Et<0)return 1;if(Et>0)return-1}if(I!==P){var oe=ct-B,Qt=I-W,Ht=j-lt,Ot=P-Z;if(oe>Qt&&Ht<Ot)return 1;if(oe<Qt&&Ht>Ot)return-1}return I>P?1:I<P||ct<j?-1:ct>j?1:b.id<R.id?-1:b.id>R.id?1:0}}]);function J(N,b,R,W){r(this,J),this.id=++ot,this.leftSE=N,N.segment=this,N.otherSE=b,this.rightSE=b,b.segment=this,b.otherSE=N,this.rings=R,this.windings=W}return e(J,[{key:"replaceRightSE",value:function(b){this.rightSE=b,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var b=this.leftSE.point.y,R=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:b<R?b:R},ur:{x:this.rightSE.point.x,y:b>R?b:R}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(b){return b.x===this.leftSE.point.x&&b.y===this.leftSE.point.y||b.x===this.rightSE.point.x&&b.y===this.rightSE.point.y}},{key:"comparePoint",value:function(b){if(this.isAnEndpoint(b))return 0;var R=this.leftSE.point,W=this.rightSE.point,Z=this.vector();if(R.x===W.x)return b.x===R.x?0:b.x<R.x?1:-1;var I=(b.y-R.y)/Z.y,P=R.x+I*Z.x;if(b.x===P)return 0;var B=(b.x-R.x)/Z.x,lt=R.y+B*Z.y;return b.y===lt?0:b.y<lt?-1:1}},{key:"getIntersection",value:function(b){var R=this.bbox(),W=b.bbox(),Z=C(R,W);if(Z===null)return null;var I=this.leftSE.point,P=this.rightSE.point,B=b.leftSE.point,lt=b.rightSE.point,ct=v(R,B)&&this.comparePoint(B)===0,j=v(W,I)&&b.comparePoint(I)===0,wt=v(R,lt)&&this.comparePoint(lt)===0,_t=v(W,P)&&b.comparePoint(P)===0;if(j&&ct)return _t&&!wt?P:!_t&&wt?lt:null;if(j)return wt&&I.x===lt.x&&I.y===lt.y?null:I;if(ct)return _t&&P.x===B.x&&P.y===B.y?null:B;if(_t&&wt)return null;if(_t)return P;if(wt)return lt;var Mt=pt(I,this.vector(),B,b.vector());return Mt===null||!v(Z,Mt)?null:L.round(Mt.x,Mt.y)}},{key:"split",value:function(b){var R=[],W=b.events!==void 0,Z=new et(b,!0),I=new et(b,!1),P=this.rightSE;this.replaceRightSE(I),R.push(I),R.push(Z);var B=new J(Z,P,this.rings.slice(),this.windings.slice());return et.comparePoints(B.leftSE.point,B.rightSE.point)>0&&B.swapEvents(),et.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),W&&(Z.checkForConsuming(),I.checkForConsuming()),R}},{key:"swapEvents",value:function(){var b=this.rightSE;this.rightSE=this.leftSE,this.leftSE=b,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var R=0,W=this.windings.length;R<W;R++)this.windings[R]*=-1}},{key:"consume",value:function(b){for(var R=this,W=b;R.consumedBy;)R=R.consumedBy;for(;W.consumedBy;)W=W.consumedBy;var Z=J.compare(R,W);if(Z!==0){if(Z>0){var I=R;R=W,W=I}if(R.prev===W){var P=R;R=W,W=P}for(var B=0,lt=W.rings.length;B<lt;B++){var ct=W.rings[B],j=W.windings[B],wt=R.rings.indexOf(ct);wt===-1?(R.rings.push(ct),R.windings.push(j)):R.windings[wt]+=j}W.rings=null,W.windings=null,W.consumedBy=R,W.leftSE.consumedBy=R.leftSE,W.rightSE.consumedBy=R.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var b=this.prev.consumedBy||this.prev;this._beforeState=b.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var b=this.beforeState();this._afterState={rings:b.rings.slice(0),windings:b.windings.slice(0),multiPolys:[]};for(var R=this._afterState.rings,W=this._afterState.windings,Z=this._afterState.multiPolys,I=0,P=this.rings.length;I<P;I++){var B=this.rings[I],lt=this.windings[I],ct=R.indexOf(B);ct===-1?(R.push(B),W.push(lt)):W[ct]+=lt}for(var j=[],wt=[],_t=0,Mt=R.length;_t<Mt;_t++)if(W[_t]!==0){var Lt=R[_t],Jt=Lt.poly;if(wt.indexOf(Jt)===-1)if(Lt.isExterior)j.push(Jt);else{wt.indexOf(Jt)===-1&&wt.push(Jt);var Et=j.indexOf(Lt.poly);Et!==-1&&j.splice(Et,1)}}for(var oe=0,Qt=j.length;oe<Qt;oe++){var Ht=j[oe].multiPoly;Z.indexOf(Ht)===-1&&Z.push(Ht)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var b=this.beforeState().multiPolys,R=this.afterState().multiPolys;switch(Xt.type){case"union":{var W=b.length===0,Z=R.length===0;this._isInResult=W!==Z;break}case"intersection":{var I,P;b.length<R.length?(I=b.length,P=R.length):(I=R.length,P=b.length),this._isInResult=P===Xt.numMultiPolys&&I<P;break}case"xor":{var B=Math.abs(b.length-R.length);this._isInResult=B%2===1;break}case"difference":{var lt=function(j){return j.length===1&&j[0].isSubject};this._isInResult=lt(b)!==lt(R);break}default:throw new Error("Unrecognized operation type found ".concat(Xt.type))}return this._isInResult}}],[{key:"fromRing",value:function(b,R,W){var Z,I,P,B=et.comparePoints(b,R);if(B<0)Z=b,I=R,P=1;else if(B>0)Z=R,I=b,P=-1;else throw new Error("Tried to create degenerate segment at [".concat(b.x,", ").concat(b.y,"]"));var lt=new et(Z,!0),ct=new et(I,!1);return new J(lt,ct,[W],[P])}}]),J}(),K=function(){function J(N,b,R){if(r(this,J),!Array.isArray(N)||N.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=b,this.isExterior=R,this.segments=[],typeof N[0][0]!="number"||typeof N[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var W=L.round(N[0][0],N[0][1]);this.bbox={ll:{x:W.x,y:W.y},ur:{x:W.x,y:W.y}};for(var Z=W,I=1,P=N.length;I<P;I++){if(typeof N[I][0]!="number"||typeof N[I][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var B=L.round(N[I][0],N[I][1]);B.x===Z.x&&B.y===Z.y||(this.segments.push(V.fromRing(Z,B,this)),B.x<this.bbox.ll.x&&(this.bbox.ll.x=B.x),B.y<this.bbox.ll.y&&(this.bbox.ll.y=B.y),B.x>this.bbox.ur.x&&(this.bbox.ur.x=B.x),B.y>this.bbox.ur.y&&(this.bbox.ur.y=B.y),Z=B)}(W.x!==Z.x||W.y!==Z.y)&&this.segments.push(V.fromRing(Z,W,this))}return e(J,[{key:"getSweepEvents",value:function(){for(var b=[],R=0,W=this.segments.length;R<W;R++){var Z=this.segments[R];b.push(Z.leftSE),b.push(Z.rightSE)}return b}}]),J}(),at=function(){function J(N,b){if(r(this,J),!Array.isArray(N))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new K(N[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var R=1,W=N.length;R<W;R++){var Z=new K(N[R],this,!1);Z.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=Z.bbox.ll.x),Z.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=Z.bbox.ll.y),Z.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=Z.bbox.ur.x),Z.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=Z.bbox.ur.y),this.interiorRings.push(Z)}this.multiPoly=b}return e(J,[{key:"getSweepEvents",value:function(){for(var b=this.exteriorRing.getSweepEvents(),R=0,W=this.interiorRings.length;R<W;R++)for(var Z=this.interiorRings[R].getSweepEvents(),I=0,P=Z.length;I<P;I++)b.push(Z[I]);return b}}]),J}(),Tt=function(){function J(N,b){if(r(this,J),!Array.isArray(N))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof N[0][0][0]=="number"&&(N=[N])}catch(I){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var R=0,W=N.length;R<W;R++){var Z=new at(N[R],this);Z.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=Z.bbox.ll.x),Z.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=Z.bbox.ll.y),Z.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=Z.bbox.ur.x),Z.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=Z.bbox.ur.y),this.polys.push(Z)}this.isSubject=b}return e(J,[{key:"getSweepEvents",value:function(){for(var b=[],R=0,W=this.polys.length;R<W;R++)for(var Z=this.polys[R].getSweepEvents(),I=0,P=Z.length;I<P;I++)b.push(Z[I]);return b}}]),J}(),dt=function(){e(J,null,[{key:"factory",value:function(b){for(var R=[],W=0,Z=b.length;W<Z;W++){var I=b[W];if(!(!I.isInResult()||I.ringOut)){for(var P=null,B=I.leftSE,lt=I.rightSE,ct=[B],j=B.point,wt=[];P=B,B=lt,ct.push(B),B.point!==j;)for(;;){var _t=B.getAvailableLinkedEvents();if(_t.length===0){var Mt=ct[0].point,Lt=ct[ct.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(Mt.x,",")+" ".concat(Mt.y,"]. Last matching segment found ends at")+" [".concat(Lt.x,", ").concat(Lt.y,"]."))}if(_t.length===1){lt=_t[0].otherSE;break}for(var Jt=null,Et=0,oe=wt.length;Et<oe;Et++)if(wt[Et].point===B.point){Jt=Et;break}if(Jt!==null){var Qt=wt.splice(Jt)[0],Ht=ct.splice(Qt.index);Ht.unshift(Ht[0].otherSE),R.push(new J(Ht.reverse()));continue}wt.push({index:ct.length,point:B.point});var Ot=B.getLeftmostComparator(P);lt=_t.sort(Ot)[0].otherSE;break}R.push(new J(ct))}}return R}}]);function J(N){r(this,J),this.events=N;for(var b=0,R=N.length;b<R;b++)N[b].segment.ringOut=this;this.poly=null}return e(J,[{key:"getGeom",value:function(){for(var b=this.events[0].point,R=[b],W=1,Z=this.events.length-1;W<Z;W++){var I=this.events[W].point,P=this.events[W+1].point;nt(I,b,P)!==0&&(R.push(I),b=I)}if(R.length===1)return null;var B=R[0],lt=R[1];nt(B,b,lt)===0&&R.shift(),R.push(R[0]);for(var ct=this.isExteriorRing()?1:-1,j=this.isExteriorRing()?0:R.length-1,wt=this.isExteriorRing()?R.length:-1,_t=[],Mt=j;Mt!=wt;Mt+=ct)_t.push([R[Mt].x,R[Mt].y]);return _t}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var b=this.enclosingRing();this._isExteriorRing=b?!b.isExteriorRing():!0}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var b=this.events[0],R=1,W=this.events.length;R<W;R++){var Z=this.events[R];et.compare(b,Z)>0&&(b=Z)}for(var I=b.segment.prevInResult(),P=I?I.prevInResult():null;;){if(!I)return null;if(!P)return I.ringOut;if(P.ringOut!==I.ringOut)return P.ringOut.enclosingRing()!==I.ringOut?I.ringOut:I.ringOut.enclosingRing();I=P.prevInResult(),P=I?I.prevInResult():null}}}]),J}(),Ct=function(){function J(N){r(this,J),this.exteriorRing=N,N.poly=this,this.interiorRings=[]}return e(J,[{key:"addInterior",value:function(b){this.interiorRings.push(b),b.poly=this}},{key:"getGeom",value:function(){var b=[this.exteriorRing.getGeom()];if(b[0]===null)return null;for(var R=0,W=this.interiorRings.length;R<W;R++){var Z=this.interiorRings[R].getGeom();Z!==null&&b.push(Z)}return b}}]),J}(),Yt=function(){function J(N){r(this,J),this.rings=N,this.polys=this._composePolys(N)}return e(J,[{key:"getGeom",value:function(){for(var b=[],R=0,W=this.polys.length;R<W;R++){var Z=this.polys[R].getGeom();Z!==null&&b.push(Z)}return b}},{key:"_composePolys",value:function(b){for(var R=[],W=0,Z=b.length;W<Z;W++){var I=b[W];if(!I.poly)if(I.isExteriorRing())R.push(new Ct(I));else{var P=I.enclosingRing();P.poly||R.push(new Ct(P)),P.poly.addInterior(I)}}return R}}]),J}(),Wt=function(){function J(N){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:V.compare;r(this,J),this.queue=N,this.tree=new g(b),this.segments=[]}return e(J,[{key:"process",value:function(b){var R=b.segment,W=[];if(b.consumedBy)return b.isLeft?this.queue.remove(b.otherSE):this.tree.remove(R),W;var Z=b.isLeft?this.tree.insert(R):this.tree.find(R);if(!Z)throw new Error("Unable to find segment #".concat(R.id," ")+"[".concat(R.leftSE.point.x,", ").concat(R.leftSE.point.y,"] -> ")+"[".concat(R.rightSE.point.x,", ").concat(R.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var I=Z,P=Z,B=void 0,lt=void 0;B===void 0;)I=this.tree.prev(I),I===null?B=null:I.key.consumedBy===void 0&&(B=I.key);for(;lt===void 0;)P=this.tree.next(P),P===null?lt=null:P.key.consumedBy===void 0&&(lt=P.key);if(b.isLeft){var ct=null;if(B){var j=B.getIntersection(R);if(j!==null&&(R.isAnEndpoint(j)||(ct=j),!B.isAnEndpoint(j)))for(var wt=this._splitSafely(B,j),_t=0,Mt=wt.length;_t<Mt;_t++)W.push(wt[_t])}var Lt=null;if(lt){var Jt=lt.getIntersection(R);if(Jt!==null&&(R.isAnEndpoint(Jt)||(Lt=Jt),!lt.isAnEndpoint(Jt)))for(var Et=this._splitSafely(lt,Jt),oe=0,Qt=Et.length;oe<Qt;oe++)W.push(Et[oe])}if(ct!==null||Lt!==null){var Ht=null;if(ct===null)Ht=Lt;else if(Lt===null)Ht=ct;else{var Ot=et.comparePoints(ct,Lt);Ht=Ot<=0?ct:Lt}this.queue.remove(R.rightSE),W.push(R.rightSE);for(var Y=R.split(Ht),St=0,Q=Y.length;St<Q;St++)W.push(Y[St])}W.length>0?(this.tree.remove(R),W.push(b)):(this.segments.push(R),R.prev=B)}else{if(B&<){var Ut=B.getIntersection(lt);if(Ut!==null){if(!B.isAnEndpoint(Ut))for(var Dt=this._splitSafely(B,Ut),ft=0,Kt=Dt.length;ft<Kt;ft++)W.push(Dt[ft]);if(!lt.isAnEndpoint(Ut))for(var re=this._splitSafely(lt,Ut),gn=0,He=re.length;gn<He;gn++)W.push(re[gn])}}this.tree.remove(R)}return W}},{key:"_splitSafely",value:function(b,R){this.tree.remove(b);var W=b.rightSE;this.queue.remove(W);var Z=b.split(R);return Z.push(W),b.consumedBy===void 0&&this.tree.insert(b),Z}}]),J}(),Nt=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ne=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Pt=function(){function J(){r(this,J)}return e(J,[{key:"run",value:function(b,R,W){Xt.type=b,L.reset();for(var Z=[new Tt(R,!0)],I=0,P=W.length;I<P;I++)Z.push(new Tt(W[I],!1));if(Xt.numMultiPolys=Z.length,Xt.type==="difference")for(var B=Z[0],lt=1;lt<Z.length;)C(Z[lt].bbox,B.bbox)!==null?lt++:Z.splice(lt,1);if(Xt.type==="intersection"){for(var ct=0,j=Z.length;ct<j;ct++)for(var wt=Z[ct],_t=ct+1,Mt=Z.length;_t<Mt;_t++)if(C(wt.bbox,Z[_t].bbox)===null)return[]}for(var Lt=new g(et.compare),Jt=0,Et=Z.length;Jt<Et;Jt++)for(var oe=Z[Jt].getSweepEvents(),Qt=0,Ht=oe.length;Qt<Ht;Qt++)if(Lt.insert(oe[Qt]),Lt.size>Nt)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var Ot=new Wt(Lt),Y=Lt.size,St=Lt.pop();St;){var Q=St.key;if(Lt.size===Y){var Ut=Q.segment;throw new Error("Unable to pop() ".concat(Q.isLeft?"left":"right"," SweepEvent ")+"[".concat(Q.point.x,", ").concat(Q.point.y,"] from segment #").concat(Ut.id," ")+"[".concat(Ut.leftSE.point.x,", ").concat(Ut.leftSE.point.y,"] -> ")+"[".concat(Ut.rightSE.point.x,", ").concat(Ut.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(Lt.size>Nt)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(Ot.segments.length>ne)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var Dt=Ot.process(Q),ft=0,Kt=Dt.length;ft<Kt;ft++){var re=Dt[ft];re.consumedBy===void 0&&Lt.insert(re)}Y=Lt.size,St=Lt.pop()}L.reset();var gn=dt.factory(Ot.segments),He=new Yt(gn);return He.getGeom()}}]),J}(),Xt=new Pt,tt=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("union",N,R)},nn=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("intersection",N,R)},Gt=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("xor",N,R)},te=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("difference",N,R)},qt={union:tt,intersection:nn,xor:Gt,difference:te};return qt})});var K_=Zt((hf,J_)=>{(function(r,t){typeof hf=="object"&&typeof J_!="undefined"?t(hf):typeof define=="function"&&define.amd?define(["exports"],t):t(r.jsts={})})(hf,function(r){"use strict";function t(){}function e(n){this.message=n||""}function o(n){this.message=n||""}function a(n){this.message=n||""}function l(){}function f(n){return n===null?di:n.color}function h(n){return n===null?null:n.parent}function p(n,i){n!==null&&(n.color=i)}function d(n){return n===null?null:n.left}function g(n){return n===null?null:n.right}function _(){this.root_=null,this.size_=0}function y(){}function M(){this.array_=[],arguments[0]instanceof Ot&&this.addAll(arguments[0])}function S(){}function T(n){this.message=n||""}function x(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(n){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),s=Math.max(Math.min(i.length,9007199254740991),0)||0,u=1 in arguments&&parseInt(Number(arguments[1]),10)||0;u=u<0?Math.max(s+u,0):Math.min(u,s);var c=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:s;for(c=c<0?Math.max(s+arguments[2],0):Math.min(c,s);u<c;)i[u]=n,++u;return i},writable:!0}),Number.isFinite=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},Number.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(n){return n!=n},Math.trunc=Math.trunc||function(n){return n<0?Math.ceil(n):Math.floor(n)};var v=function(){};v.prototype.interfaces_=function(){return[]},v.prototype.getClass=function(){return v},v.prototype.equalsWithTolerance=function(n,i,s){return Math.abs(n-i)<=s};var C=function(n){function i(s){n.call(this,s),this.name="IllegalArgumentException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),w=function(){},O={MAX_VALUE:{configurable:!0}};w.isNaN=function(n){return Number.isNaN(n)},w.doubleToLongBits=function(n){return n},w.longBitsToDouble=function(n){return n},w.isInfinite=function(n){return!Number.isFinite(n)},O.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(w,O);var F=function(){},G=function(){},z=function(){},L=function n(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=n.NULL_ORDINATE;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.z=i.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=n.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},D={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};L.prototype.setOrdinate=function(n,i){switch(n){case L.X:this.x=i;break;case L.Y:this.y=i;break;case L.Z:this.z=i;break;default:throw new C("Invalid ordinate index: "+n)}},L.prototype.equals2D=function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var i=arguments[0],s=arguments[1];return!!v.equalsWithTolerance(this.x,i.x,s)&&!!v.equalsWithTolerance(this.y,i.y,s)}},L.prototype.getOrdinate=function(n){switch(n){case L.X:return this.x;case L.Y:return this.y;case L.Z:return this.z}throw new C("Invalid ordinate index: "+n)},L.prototype.equals3D=function(n){return this.x===n.x&&this.y===n.y&&(this.z===n.z||w.isNaN(this.z))&&w.isNaN(n.z)},L.prototype.equals=function(n){return n instanceof L&&this.equals2D(n)},L.prototype.equalInZ=function(n,i){return v.equalsWithTolerance(this.z,n.z,i)},L.prototype.compareTo=function(n){var i=n;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0},L.prototype.clone=function(){},L.prototype.copy=function(){return new L(this)},L.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},L.prototype.distance3D=function(n){var i=this.x-n.x,s=this.y-n.y,u=this.z-n.z;return Math.sqrt(i*i+s*s+u*u)},L.prototype.distance=function(n){var i=this.x-n.x,s=this.y-n.y;return Math.sqrt(i*i+s*s)},L.prototype.hashCode=function(){var n=17;return n=37*n+L.hashCode(this.x),n=37*n+L.hashCode(this.y)},L.prototype.setCoordinate=function(n){this.x=n.x,this.y=n.y,this.z=n.z},L.prototype.interfaces_=function(){return[F,G,t]},L.prototype.getClass=function(){return L},L.hashCode=function(){if(arguments.length===1){var n=arguments[0],i=w.doubleToLongBits(n);return Math.trunc((i^i)>>>32)}},D.DimensionalComparator.get=function(){return q},D.serialVersionUID.get=function(){return 6683108902428367e3},D.NULL_ORDINATE.get=function(){return w.NaN},D.X.get=function(){return 0},D.Y.get=function(){return 1},D.Z.get=function(){return 2},Object.defineProperties(L,D);var q=function(n){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var i=arguments[0];if(i!==2&&i!==3)throw new C("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};q.prototype.compare=function(n,i){var s=n,u=i,c=q.compare(s.x,u.x);if(c!==0)return c;var m=q.compare(s.y,u.y);return m!==0?m:this._dimensionsToTest<=2?0:q.compare(s.z,u.z)},q.prototype.interfaces_=function(){return[z]},q.prototype.getClass=function(){return q},q.compare=function(n,i){return n<i?-1:n>i?1:w.isNaN(n)?w.isNaN(i)?0:-1:w.isNaN(i)?1:0};var nt=function(){};nt.prototype.create=function(){},nt.prototype.interfaces_=function(){return[]},nt.prototype.getClass=function(){return nt};var k=function(){},xt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};k.prototype.interfaces_=function(){return[]},k.prototype.getClass=function(){return k},k.toLocationSymbol=function(n){switch(n){case k.EXTERIOR:return"e";case k.BOUNDARY:return"b";case k.INTERIOR:return"i";case k.NONE:return"-"}throw new C("Unknown location value: "+n)},xt.INTERIOR.get=function(){return 0},xt.BOUNDARY.get=function(){return 1},xt.EXTERIOR.get=function(){return 2},xt.NONE.get=function(){return-1},Object.defineProperties(k,xt);var X=function(n,i){return n.interfaces_&&n.interfaces_().indexOf(i)>-1},it=function(){},vt={LOG_10:{configurable:!0}};it.prototype.interfaces_=function(){return[]},it.prototype.getClass=function(){return it},it.log10=function(n){var i=Math.log(n);return w.isInfinite(i)||w.isNaN(i)?i:i/it.LOG_10},it.min=function(n,i,s,u){var c=n;return i<c&&(c=i),s<c&&(c=s),u<c&&(c=u),c},it.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1],s=arguments[2];return n<i?i:n>s?s:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var u=arguments[0],c=arguments[1],m=arguments[2];return u<c?c:u>m?m:u}},it.wrap=function(n,i){return n<0?i- -n%i:n%i},it.max=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2],u=n;return i>u&&(u=i),s>u&&(u=s),u}if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3],U=c;return m>U&&(U=m),E>U&&(U=E),A>U&&(U=A),U}},it.average=function(n,i){return(n+i)/2},vt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(it,vt);var pt=function(n){this.str=n};pt.prototype.append=function(n){this.str+=n},pt.prototype.setCharAt=function(n,i){this.str=this.str.substr(0,n)+i+this.str.substr(n+1)},pt.prototype.toString=function(n){return this.str};var et=function(n){this.value=n};et.prototype.intValue=function(){return this.value},et.prototype.compareTo=function(n){return this.value<n?-1:this.value>n?1:0},et.isNaN=function(n){return Number.isNaN(n)};var ot=function(){};ot.isWhitespace=function(n){return n<=32&&n>=0||n===127},ot.toUpperCase=function(n){return n.toUpperCase()};var V=function n(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var i=arguments[0];this.init(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}else if(typeof arguments[0]=="string"){var u=arguments[0];n.call(this,n.parse(u))}}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.init(c,m)}},K={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};V.prototype.le=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<=n._lo},V.prototype.extractSignificantDigits=function(n,i){var s=this.abs(),u=V.magnitude(s._hi),c=V.TEN.pow(u);(s=s.divide(c)).gt(V.TEN)?(s=s.divide(V.TEN),u+=1):s.lt(V.ONE)&&(s=s.multiply(V.TEN),u-=1);for(var m=u+1,E=new pt,A=V.MAX_PRINT_DIGITS-1,U=0;U<=A;U++){n&&U===m&&E.append(".");var $=Math.trunc(s._hi);if($<0)break;var ut=!1,ht=0;$>9?(ut=!0,ht="9"):ht="0"+$,E.append(ht),s=s.subtract(V.valueOf($)).multiply(V.TEN),ut&&s.selfAdd(V.TEN);var At=!0,Rt=V.magnitude(s._hi);if(Rt<0&&Math.abs(Rt)>=A-U&&(At=!1),!At)break}return i[0]=u,E.toString()},V.prototype.sqr=function(){return this.multiply(this)},V.prototype.doubleValue=function(){return this._hi+this._lo},V.prototype.subtract=function(){if(arguments[0]instanceof V){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},V.prototype.equals=function(){if(arguments.length===1){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}},V.prototype.isZero=function(){return this._hi===0&&this._lo===0},V.prototype.selfSubtract=function(){if(arguments[0]instanceof V){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n._hi,-n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}},V.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},V.prototype.min=function(n){return this.le(n)?this:n},V.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,A=null,U=null,$=null,ut=null,ht=null;return U=this._hi/s,$=V.SPLIT*U,c=$-U,ht=V.SPLIT*s,c=$-c,m=U-c,E=ht-s,ut=U*s,E=ht-E,A=s-E,ht=c*E-ut+c*A+m*E+m*A,$=(this._hi-ut-ht+this._lo-U*u)/s,ht=U+$,this._hi=ht,this._lo=U-ht+$,this}},V.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},V.prototype.divide=function(){if(arguments[0]instanceof V){var n=arguments[0],i=null,s=null,u=null,c=null,m=null,E=null,A=null,U=null;return s=(m=this._hi/n._hi)-(i=(E=V.SPLIT*m)-(i=E-m)),U=i*(u=(U=V.SPLIT*n._hi)-(u=U-n._hi))-(A=m*n._hi)+i*(c=n._hi-u)+s*u+s*c,E=(this._hi-A-U+this._lo-m*n._lo)/n._hi,new V(U=m+E,m-U+E)}if(typeof arguments[0]=="number"){var $=arguments[0];return w.isNaN($)?V.createNaN():V.copy(this).selfDivide($,0)}},V.prototype.ge=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>=n._lo},V.prototype.pow=function(n){if(n===0)return V.valueOf(1);var i=new V(this),s=V.valueOf(1),u=Math.abs(n);if(u>1)for(;u>0;)u%2==1&&s.selfMultiply(i),(u/=2)>0&&(i=i.sqr());else s=i;return n<0?s.reciprocal():s},V.prototype.ceil=function(){if(this.isNaN())return V.NaN;var n=Math.ceil(this._hi),i=0;return n===this._hi&&(i=Math.ceil(this._lo)),new V(n,i)},V.prototype.compareTo=function(n){var i=n;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0},V.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},V.prototype.setValue=function(){if(arguments[0]instanceof V){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},V.prototype.max=function(n){return this.ge(n)?this:n},V.prototype.sqrt=function(){if(this.isZero())return V.valueOf(0);if(this.isNegative())return V.NaN;var n=1/Math.sqrt(this._hi),i=this._hi*n,s=V.valueOf(i),u=this.subtract(s.sqr())._hi*(.5*n);return s.add(u)},V.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],s=null,u=null,c=null,m=null,E=null,A=null;return c=this._hi+i,E=c-this._hi,m=c-E,m=i-E+(this._hi-m),A=m+this._lo,s=c+A,u=A+(c-s),this._hi=s+u,this._lo=u+(s-this._hi),this}}else if(arguments.length===2){var U=arguments[0],$=arguments[1],ut=null,ht=null,At=null,Rt=null,kt=null,ee=null,on=null;Rt=this._hi+U,ht=this._lo+$,kt=Rt-(ee=Rt-this._hi),At=ht-(on=ht-this._lo);var Rn=(ut=Rt+(ee=(kt=U-ee+(this._hi-kt))+ht))+(ee=(At=$-on+(this._lo-At))+(ee+(Rt-ut))),dr=ee+(ut-Rn);return this._hi=Rn,this._lo=dr,this}},V.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,A=null,U=null,$=null;c=(U=V.SPLIT*this._hi)-this._hi,$=V.SPLIT*s,c=U-c,m=this._hi-c,E=$-s;var ut=(U=this._hi*s)+($=c*(E=$-E)-U+c*(A=s-E)+m*E+m*A+(this._hi*u+this._lo*s)),ht=$+(c=U-ut);return this._hi=ut,this._lo=ht,this}},V.prototype.selfSqr=function(){return this.selfMultiply(this)},V.prototype.floor=function(){if(this.isNaN())return V.NaN;var n=Math.floor(this._hi),i=0;return n===this._hi&&(i=Math.floor(this._lo)),new V(n,i)},V.prototype.negate=function(){return this.isNaN()?this:new V(-this._hi,-this._lo)},V.prototype.clone=function(){},V.prototype.multiply=function(){if(arguments[0]instanceof V){var n=arguments[0];return n.isNaN()?V.createNaN():V.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return w.isNaN(i)?V.createNaN():V.copy(this).selfMultiply(i,0)}},V.prototype.isNaN=function(){return w.isNaN(this._hi)},V.prototype.intValue=function(){return Math.trunc(this._hi)},V.prototype.toString=function(){var n=V.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()},V.prototype.toStandardNotation=function(){var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!0,i),u=i[0]+1,c=s;if(s.charAt(0)===".")c="0"+s;else if(u<0)c="0."+V.stringOfChar("0",-u)+s;else if(s.indexOf(".")===-1){var m=u-s.length;c=s+V.stringOfChar("0",m)+".0"}return this.isNegative()?"-"+c:c},V.prototype.reciprocal=function(){var n=null,i=null,s=null,u=null,c=null,m=null,E=null,A=null;i=(c=1/this._hi)-(n=(m=V.SPLIT*c)-(n=m-c)),s=(A=V.SPLIT*this._hi)-this._hi;var U=c+(m=(1-(E=c*this._hi)-(A=n*(s=A-s)-E+n*(u=this._hi-s)+i*s+i*u)-c*this._lo)/this._hi);return new V(U,c-U+m)},V.prototype.toSciNotation=function(){if(this.isZero())return V.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!1,i),u=V.SCI_NOT_EXPONENT_CHAR+i[0];if(s.charAt(0)==="0")throw new Error("Found leading zero: "+s);var c="";s.length>1&&(c=s.substring(1));var m=s.charAt(0)+"."+c;return this.isNegative()?"-"+m+u:m+u},V.prototype.abs=function(){return this.isNaN()?V.NaN:this.isNegative()?this.negate():new V(this)},V.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},V.prototype.lt=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<n._lo},V.prototype.add=function(){if(arguments[0]instanceof V){var n=arguments[0];return V.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return V.copy(this).selfAdd(i)}},V.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this._hi=n,this._lo=0}else if(arguments[0]instanceof V){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._hi=s,this._lo=u}},V.prototype.gt=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>n._lo},V.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},V.prototype.trunc=function(){return this.isNaN()?V.NaN:this.isPositive()?this.floor():this.ceil()},V.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},V.prototype.interfaces_=function(){return[t,F,G]},V.prototype.getClass=function(){return V},V.sqr=function(n){return V.valueOf(n).selfMultiply(n)},V.valueOf=function(){if(typeof arguments[0]=="string"){var n=arguments[0];return V.parse(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return new V(i)}},V.sqrt=function(n){return V.valueOf(n).sqrt()},V.parse=function(n){for(var i=0,s=n.length;ot.isWhitespace(n.charAt(i));)i++;var u=!1;if(i<s){var c=n.charAt(i);c!=="-"&&c!=="+"||(i++,c==="-"&&(u=!0))}for(var m=new V,E=0,A=0,U=0;!(i>=s);){var $=n.charAt(i);if(i++,ot.isDigit($)){var ut=$-"0";m.selfMultiply(V.TEN),m.selfAdd(ut),E++}else{if($!=="."){if($==="e"||$==="E"){var ht=n.substring(i);try{U=et.parseInt(ht)}catch(on){throw on instanceof Error?new Error("Invalid exponent "+ht+" in string "+n):on}break}throw new Error("Unexpected character '"+$+"' at position "+i+" in string "+n)}A=E}}var At=m,Rt=E-A-U;if(Rt===0)At=m;else if(Rt>0){var kt=V.TEN.pow(Rt);At=m.divide(kt)}else if(Rt<0){var ee=V.TEN.pow(-Rt);At=m.multiply(ee)}return u?At.negate():At},V.createNaN=function(){return new V(w.NaN,w.NaN)},V.copy=function(n){return new V(n)},V.magnitude=function(n){var i=Math.abs(n),s=Math.log(i)/Math.log(10),u=Math.trunc(Math.floor(s));return 10*Math.pow(10,u)<=i&&(u+=1),u},V.stringOfChar=function(n,i){for(var s=new pt,u=0;u<i;u++)s.append(n);return s.toString()},K.PI.get=function(){return new V(3.141592653589793,12246467991473532e-32)},K.TWO_PI.get=function(){return new V(6.283185307179586,24492935982947064e-32)},K.PI_2.get=function(){return new V(1.5707963267948966,6123233995736766e-32)},K.E.get=function(){return new V(2.718281828459045,14456468917292502e-32)},K.NaN.get=function(){return new V(w.NaN,w.NaN)},K.EPS.get=function(){return 123259516440783e-46},K.SPLIT.get=function(){return 134217729},K.MAX_PRINT_DIGITS.get=function(){return 32},K.TEN.get=function(){return V.valueOf(10)},K.ONE.get=function(){return V.valueOf(1)},K.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},K.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(V,K);var at=function(){},Tt={DP_SAFE_EPSILON:{configurable:!0}};at.prototype.interfaces_=function(){return[]},at.prototype.getClass=function(){return at},at.orientationIndex=function(n,i,s){var u=at.orientationIndexFilter(n,i,s);if(u<=1)return u;var c=V.valueOf(i.x).selfAdd(-n.x),m=V.valueOf(i.y).selfAdd(-n.y),E=V.valueOf(s.x).selfAdd(-i.x),A=V.valueOf(s.y).selfAdd(-i.y);return c.selfMultiply(A).selfSubtract(m.selfMultiply(E)).signum()},at.signOfDet2x2=function(n,i,s,u){return n.multiply(u).selfSubtract(i.multiply(s)).signum()},at.intersection=function(n,i,s,u){var c=V.valueOf(u.y).selfSubtract(s.y).selfMultiply(V.valueOf(i.x).selfSubtract(n.x)),m=V.valueOf(u.x).selfSubtract(s.x).selfMultiply(V.valueOf(i.y).selfSubtract(n.y)),E=c.subtract(m),A=V.valueOf(u.x).selfSubtract(s.x).selfMultiply(V.valueOf(n.y).selfSubtract(s.y)),U=V.valueOf(u.y).selfSubtract(s.y).selfMultiply(V.valueOf(n.x).selfSubtract(s.x)),$=A.subtract(U).selfDivide(E).doubleValue(),ut=V.valueOf(n.x).selfAdd(V.valueOf(i.x).selfSubtract(n.x).selfMultiply($)).doubleValue(),ht=V.valueOf(i.x).selfSubtract(n.x).selfMultiply(V.valueOf(n.y).selfSubtract(s.y)),At=V.valueOf(i.y).selfSubtract(n.y).selfMultiply(V.valueOf(n.x).selfSubtract(s.x)),Rt=ht.subtract(At).selfDivide(E).doubleValue(),kt=V.valueOf(s.y).selfAdd(V.valueOf(u.y).selfSubtract(s.y).selfMultiply(Rt)).doubleValue();return new L(ut,kt)},at.orientationIndexFilter=function(n,i,s){var u=null,c=(n.x-s.x)*(i.y-s.y),m=(n.y-s.y)*(i.x-s.x),E=c-m;if(c>0){if(m<=0)return at.signum(E);u=c+m}else{if(!(c<0)||m>=0)return at.signum(E);u=-c-m}var A=at.DP_SAFE_EPSILON*u;return E>=A||-E>=A?at.signum(E):2},at.signum=function(n){return n>0?1:n<0?-1:0},Tt.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(at,Tt);var dt=function(){},Ct={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Ct.X.get=function(){return 0},Ct.Y.get=function(){return 1},Ct.Z.get=function(){return 2},Ct.M.get=function(){return 3},dt.prototype.setOrdinate=function(n,i,s){},dt.prototype.size=function(){},dt.prototype.getOrdinate=function(n,i){},dt.prototype.getCoordinate=function(){},dt.prototype.getCoordinateCopy=function(n){},dt.prototype.getDimension=function(){},dt.prototype.getX=function(n){},dt.prototype.clone=function(){},dt.prototype.expandEnvelope=function(n){},dt.prototype.copy=function(){},dt.prototype.getY=function(n){},dt.prototype.toCoordinateArray=function(){},dt.prototype.interfaces_=function(){return[G]},dt.prototype.getClass=function(){return dt},Object.defineProperties(dt,Ct);var Yt=function(){},Wt=function(n){function i(){n.call(this,"Projective point not representable on the Cartesian plane.")}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Yt),Nt=function(){};Nt.arraycopy=function(n,i,s,u,c){for(var m=0,E=i;E<i+c;E++)s[u+m]=n[E],m++},Nt.getProperty=function(n){return{"line.separator":\`
|
|
92
92
|
\`}[n]};var ne=function n(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1];this.x=s,this.y=u,this.w=1}else if(arguments[0]instanceof n&&arguments[1]instanceof n){var c=arguments[0],m=arguments[1];this.x=c.y*m.w-m.y*c.w,this.y=m.x*c.w-c.x*m.w,this.w=c.x*m.y-m.x*c.y}else if(arguments[0]instanceof L&&arguments[1]instanceof L){var E=arguments[0],A=arguments[1];this.x=E.y-A.y,this.y=A.x-E.x,this.w=E.x*A.y-A.x*E.y}}else if(arguments.length===3){var U=arguments[0],$=arguments[1],ut=arguments[2];this.x=U,this.y=$,this.w=ut}else if(arguments.length===4){var ht=arguments[0],At=arguments[1],Rt=arguments[2],kt=arguments[3],ee=ht.y-At.y,on=At.x-ht.x,Rn=ht.x*At.y-At.x*ht.y,dr=Rt.y-kt.y,Ji=kt.x-Rt.x,Bo=Rt.x*kt.y-kt.x*Rt.y;this.x=on*Bo-Ji*Rn,this.y=dr*Rn-ee*Bo,this.w=ee*Ji-dr*on}};ne.prototype.getY=function(){var n=this.y/this.w;if(w.isNaN(n)||w.isInfinite(n))throw new Wt;return n},ne.prototype.getX=function(){var n=this.x/this.w;if(w.isNaN(n)||w.isInfinite(n))throw new Wt;return n},ne.prototype.getCoordinate=function(){var n=new L;return n.x=this.getX(),n.y=this.getY(),n},ne.prototype.interfaces_=function(){return[]},ne.prototype.getClass=function(){return ne},ne.intersection=function(n,i,s,u){var c=n.y-i.y,m=i.x-n.x,E=n.x*i.y-i.x*n.y,A=s.y-u.y,U=u.x-s.x,$=s.x*u.y-u.x*s.y,ut=c*U-A*m,ht=(m*$-U*E)/ut,At=(A*E-c*$)/ut;if(w.isNaN(ht)||w.isInfinite(ht)||w.isNaN(At)||w.isInfinite(At))throw new Wt;return new L(ht,At)};var Pt=function n(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof L){var i=arguments[0];this.init(i.x,i.x,i.y,i.y)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.init(u.x,c.x,u.y,c.y)}else if(arguments.length===4){var m=arguments[0],E=arguments[1],A=arguments[2],U=arguments[3];this.init(m,E,A,U)}},Xt={serialVersionUID:{configurable:!0}};Pt.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Pt.prototype.equals=function(n){if(!(n instanceof Pt))return!1;var i=n;return this.isNull()?i.isNull():this._maxx===i.getMaxX()&&this._maxy===i.getMaxY()&&this._minx===i.getMinX()&&this._miny===i.getMinY()},Pt.prototype.intersection=function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new Pt;var i=this._minx>n._minx?this._minx:n._minx,s=this._miny>n._miny?this._miny:n._miny,u=this._maxx<n._maxx?this._maxx:n._maxx,c=this._maxy<n._maxy?this._maxy:n._maxy;return new Pt(i,u,s,c)},Pt.prototype.isNull=function(){return this._maxx<this._minx},Pt.prototype.getMaxX=function(){return this._maxx},Pt.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof Pt){var i=arguments[0];return!this.isNull()&&!i.isNull()&&i.getMinX()>=this._minx&&i.getMaxX()<=this._maxx&&i.getMinY()>=this._miny&&i.getMaxY()<=this._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&s>=this._minx&&s<=this._maxx&&u>=this._miny&&u<=this._maxy}},Pt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Pt){var n=arguments[0];return!this.isNull()&&!n.isNull()&&!(n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny)}if(arguments[0]instanceof L){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&!(s>this._maxx||s<this._minx||u>this._maxy||u<this._miny)}},Pt.prototype.getMinY=function(){return this._miny},Pt.prototype.getMinX=function(){return this._minx},Pt.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof Pt){var i=arguments[0];if(i.isNull())return null;this.isNull()?(this._minx=i.getMinX(),this._maxx=i.getMaxX(),this._miny=i.getMinY(),this._maxy=i.getMaxY()):(i._minx<this._minx&&(this._minx=i._minx),i._maxx>this._maxx&&(this._maxx=i._maxx),i._miny<this._miny&&(this._miny=i._miny),i._maxy>this._maxy&&(this._maxy=i._maxy))}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.isNull()?(this._minx=s,this._maxx=s,this._miny=u,this._maxy=u):(s<this._minx&&(this._minx=s),s>this._maxx&&(this._maxx=s),u<this._miny&&(this._miny=u),u>this._maxy&&(this._maxy=u))}},Pt.prototype.minExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n<i?n:i},Pt.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Pt.prototype.compareTo=function(n){var i=n;return this.isNull()?i.isNull()?0:-1:i.isNull()?1:this._minx<i._minx?-1:this._minx>i._minx?1:this._miny<i._miny?-1:this._miny>i._miny?1:this._maxx<i._maxx?-1:this._maxx>i._maxx?1:this._maxy<i._maxy?-1:this._maxy>i._maxy?1:0},Pt.prototype.translate=function(n,i){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+i,this.getMaxY()+i)},Pt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Pt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Pt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Pt.prototype.maxExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n>i?n:i},Pt.prototype.expandBy=function(){if(arguments.length===1){var n=arguments[0];this.expandBy(n,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this.isNull())return null;this._minx-=i,this._maxx+=i,this._miny-=s,this._maxy+=s,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},Pt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Pt){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof L){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.covers(s,u)}},Pt.prototype.centre=function(){return this.isNull()?null:new L((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Pt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof Pt){var i=arguments[0];this._minx=i._minx,this._maxx=i._maxx,this._miny=i._miny,this._maxy=i._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.init(s.x,u.x,s.y,u.y)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];c<m?(this._minx=c,this._maxx=m):(this._minx=m,this._maxx=c),E<A?(this._miny=E,this._maxy=A):(this._miny=A,this._maxy=E)}},Pt.prototype.getMaxY=function(){return this._maxy},Pt.prototype.distance=function(n){if(this.intersects(n))return 0;var i=0;this._maxx<n._minx?i=n._minx-this._maxx:this._minx>n._maxx&&(i=this._minx-n._maxx);var s=0;return this._maxy<n._miny?s=n._miny-this._maxy:this._miny>n._maxy&&(s=this._miny-n._maxy),i===0?s:s===0?i:Math.sqrt(i*i+s*s)},Pt.prototype.hashCode=function(){var n=17;return n=37*n+L.hashCode(this._minx),n=37*n+L.hashCode(this._maxx),n=37*n+L.hashCode(this._miny),n=37*n+L.hashCode(this._maxy)},Pt.prototype.interfaces_=function(){return[F,t]},Pt.prototype.getClass=function(){return Pt},Pt.intersects=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];return s.x>=(n.x<i.x?n.x:i.x)&&s.x<=(n.x>i.x?n.x:i.x)&&s.y>=(n.y<i.y?n.y:i.y)&&s.y<=(n.y>i.y?n.y:i.y)}if(arguments.length===4){var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],A=Math.min(m.x,E.x),U=Math.max(m.x,E.x),$=Math.min(u.x,c.x),ut=Math.max(u.x,c.x);return!($>U)&&!(ut<A)&&(A=Math.min(m.y,E.y),U=Math.max(m.y,E.y),$=Math.min(u.y,c.y),ut=Math.max(u.y,c.y),!($>U)&&!(ut<A))}},Xt.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Pt,Xt);var tt={typeStr:/^\\s*(\\w+)\\s*\\(\\s*(.*)\\s*\\)\\s*$/,emptyTypeStr:/^\\s*(\\w+)\\s*EMPTY\\s*$/,spaces:/\\s+/,parenComma:/\\)\\s*,\\s*\\(/,doubleParenComma:/\\)\\s*\\)\\s*,\\s*\\(\\s*\\(/,trimParens:/^\\s*\\(?(.*?)\\)?\\s*$/},nn=function(n){this.geometryFactory=n||new le};nn.prototype.read=function(n){var i,s,u;n=n.replace(/[\\n\\r]/g," ");var c=tt.typeStr.exec(n);if(n.search("EMPTY")!==-1&&((c=tt.emptyTypeStr.exec(n))[2]=void 0),c&&(s=c[1].toLowerCase(),u=c[2],te[s]&&(i=te[s].apply(this,[u]))),i===void 0)throw new Error("Could not parse WKT "+n);return i},nn.prototype.write=function(n){return this.extractGeometry(n)},nn.prototype.extractGeometry=function(n){var i=n.getGeometryType().toLowerCase();if(!Gt[i])return null;var s=i.toUpperCase();return n.isEmpty()?s+" EMPTY":s+"("+Gt[i].apply(this,[n])+")"};var Gt={coordinate:function(n){return n.x+" "+n.y},point:function(n){return Gt.coordinate.call(this,n._coordinates._coordinates[0])},multipoint:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Gt.point.apply(this,[n._geometries[s]])+")");return i.join(",")},linestring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(Gt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},linearring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(Gt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},multilinestring:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Gt.linestring.apply(this,[n._geometries[s]])+")");return i.join(",")},polygon:function(n){var i=[];i.push("("+Gt.linestring.apply(this,[n._shell])+")");for(var s=0,u=n._holes.length;s<u;++s)i.push("("+Gt.linestring.apply(this,[n._holes[s]])+")");return i.join(",")},multipolygon:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Gt.polygon.apply(this,[n._geometries[s]])+")");return i.join(",")},geometrycollection:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push(this.extractGeometry(n._geometries[s]));return i.join(",")}},te={point:function(n){if(n===void 0)return this.geometryFactory.createPoint();var i=n.trim().split(tt.spaces);return this.geometryFactory.createPoint(new L(Number.parseFloat(i[0]),Number.parseFloat(i[1])))},multipoint:function(n){if(n===void 0)return this.geometryFactory.createMultiPoint();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(tt.trimParens,"$1"),u.push(te.point.apply(this,[i]));return this.geometryFactory.createMultiPoint(u)},linestring:function(n){if(n===void 0)return this.geometryFactory.createLineString();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(tt.spaces),u.push(new L(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(u)},linearring:function(n){if(n===void 0)return this.geometryFactory.createLinearRing();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(tt.spaces),u.push(new L(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(u)},multilinestring:function(n){if(n===void 0)return this.geometryFactory.createMultiLineString();for(var i,s=n.trim().split(tt.parenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(tt.trimParens,"$1"),u.push(te.linestring.apply(this,[i]));return this.geometryFactory.createMultiLineString(u)},polygon:function(n){if(n===void 0)return this.geometryFactory.createPolygon();for(var i,s,u,c,m=n.trim().split(tt.parenComma),E=[],A=0,U=m.length;A<U;++A)i=m[A].replace(tt.trimParens,"$1"),s=te.linestring.apply(this,[i]),u=this.geometryFactory.createLinearRing(s._points),A===0?c=u:E.push(u);return this.geometryFactory.createPolygon(c,E)},multipolygon:function(n){if(n===void 0)return this.geometryFactory.createMultiPolygon();for(var i,s=n.trim().split(tt.doubleParenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(tt.trimParens,"$1"),u.push(te.polygon.apply(this,[i]));return this.geometryFactory.createMultiPolygon(u)},geometrycollection:function(n){if(n===void 0)return this.geometryFactory.createGeometryCollection();for(var i=(n=n.replace(/,\\s*([A-Za-z])/g,"|$1")).trim().split("|"),s=[],u=0,c=i.length;u<c;++u)s.push(this.read(i[u]));return this.geometryFactory.createGeometryCollection(s)}},qt=function(n){this.parser=new nn(n)};qt.prototype.write=function(n){return this.parser.write(n)},qt.toLineString=function(n,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+n.x+" "+n.y+", "+i.x+" "+i.y+" )"};var J=function(n){function i(s){n.call(this,s),this.name="RuntimeException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),N=function(n){function i(){if(n.call(this),arguments.length===0)n.call(this);else if(arguments.length===1){var s=arguments[0];n.call(this,s)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(J),b=function(){};b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b.shouldNeverReachHere=function(){if(arguments.length===0)b.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new N("Should never reach here"+(n!==null?": "+n:""))}},b.isTrue=function(){var n,i;if(arguments.length===1)n=arguments[0],b.isTrue(n,null);else if(arguments.length===2&&(n=arguments[0],i=arguments[1],!n))throw i===null?new N:new N(i)},b.equals=function(){var n,i,s;if(arguments.length===2)n=arguments[0],i=arguments[1],b.equals(n,i,null);else if(arguments.length===3&&(n=arguments[0],i=arguments[1],s=arguments[2],!i.equals(n)))throw new N("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))};var R=function(){this._result=null,this._inputLines=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new L,this._intPt[1]=new L,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},W={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};R.prototype.getIndexAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intLineIndex[n][i]},R.prototype.getTopologySummary=function(){var n=new pt;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()},R.prototype.computeIntersection=function(n,i,s,u){this._inputLines[0][0]=n,this._inputLines[0][1]=i,this._inputLines[1][0]=s,this._inputLines[1][1]=u,this._result=this.computeIntersect(n,i,s,u)},R.prototype.getIntersectionNum=function(){return this._result},R.prototype.computeIntLineIndex=function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var n=arguments[0];this.getEdgeDistance(n,0)>this.getEdgeDistance(n,1)?(this._intLineIndex[n][0]=0,this._intLineIndex[n][1]=1):(this._intLineIndex[n][0]=1,this._intLineIndex[n][1]=0)}},R.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},R.prototype.setPrecisionModel=function(n){this._precisionModel=n},R.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var n=arguments[0],i=0;i<this._result;i++)if(!this._intPt[i].equals2D(this._inputLines[n][0])&&!this._intPt[i].equals2D(this._inputLines[n][1]))return!0;return!1}},R.prototype.getIntersection=function(n){return this._intPt[n]},R.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},R.prototype.hasIntersection=function(){return this._result!==R.NO_INTERSECTION},R.prototype.getEdgeDistance=function(n,i){return R.computeEdgeDistance(this._intPt[i],this._inputLines[n][0],this._inputLines[n][1])},R.prototype.isCollinear=function(){return this._result===R.COLLINEAR_INTERSECTION},R.prototype.toString=function(){return qt.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+qt.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},R.prototype.getEndpoint=function(n,i){return this._inputLines[n][i]},R.prototype.isIntersection=function(n){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(n))return!0;return!1},R.prototype.getIntersectionAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][i]]},R.prototype.interfaces_=function(){return[]},R.prototype.getClass=function(){return R},R.computeEdgeDistance=function(n,i,s){var u=Math.abs(s.x-i.x),c=Math.abs(s.y-i.y),m=-1;if(n.equals(i))m=0;else if(n.equals(s))m=u>c?u:c;else{var E=Math.abs(n.x-i.x),A=Math.abs(n.y-i.y);(m=u>c?E:A)!==0||n.equals(i)||(m=Math.max(E,A))}return b.isTrue(!(m===0&&!n.equals(i)),"Bad distance calculation"),m},R.nonRobustComputeEdgeDistance=function(n,i,s){var u=n.x-i.x,c=n.y-i.y,m=Math.sqrt(u*u+c*c);return b.isTrue(!(m===0&&!n.equals(i)),"Invalid distance calculation"),m},W.DONT_INTERSECT.get=function(){return 0},W.DO_INTERSECT.get=function(){return 1},W.COLLINEAR.get=function(){return 2},W.NO_INTERSECTION.get=function(){return 0},W.POINT_INTERSECTION.get=function(){return 1},W.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(R,W);var Z=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isInSegmentEnvelopes=function(s){var u=new Pt(this._inputLines[0][0],this._inputLines[0][1]),c=new Pt(this._inputLines[1][0],this._inputLines[1][1]);return u.contains(s)&&c.contains(s)},i.prototype.computeIntersection=function(){if(arguments.length!==3)return n.prototype.computeIntersection.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2];if(this._isProper=!1,Pt.intersects(u,c,s)&&B.orientationIndex(u,c,s)===0&&B.orientationIndex(c,u,s)===0)return this._isProper=!0,(s.equals(u)||s.equals(c))&&(this._isProper=!1),this._result=n.POINT_INTERSECTION,null;this._result=n.NO_INTERSECTION},i.prototype.normalizeToMinimum=function(s,u,c,m,E){E.x=this.smallestInAbsValue(s.x,u.x,c.x,m.x),E.y=this.smallestInAbsValue(s.y,u.y,c.y,m.y),s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.safeHCoordinateIntersection=function(s,u,c,m){var E=null;try{E=ne.intersection(s,u,c,m)}catch(A){if(!(A instanceof Wt))throw A;E=i.nearestEndpoint(s,u,c,m)}return E},i.prototype.intersection=function(s,u,c,m){var E=this.intersectionWithNormalization(s,u,c,m);return this.isInSegmentEnvelopes(E)||(E=new L(i.nearestEndpoint(s,u,c,m))),this._precisionModel!==null&&this._precisionModel.makePrecise(E),E},i.prototype.smallestInAbsValue=function(s,u,c,m){var E=s,A=Math.abs(E);return Math.abs(u)<A&&(E=u,A=Math.abs(u)),Math.abs(c)<A&&(E=c,A=Math.abs(c)),Math.abs(m)<A&&(E=m),E},i.prototype.checkDD=function(s,u,c,m,E){var A=at.intersection(s,u,c,m),U=this.isInSegmentEnvelopes(A);Nt.out.println("DD in env = "+U+" --------------------- "+A),E.distance(A)>1e-4&&Nt.out.println("Distance = "+E.distance(A))},i.prototype.intersectionWithNormalization=function(s,u,c,m){var E=new L(s),A=new L(u),U=new L(c),$=new L(m),ut=new L;this.normalizeToEnvCentre(E,A,U,$,ut);var ht=this.safeHCoordinateIntersection(E,A,U,$);return ht.x+=ut.x,ht.y+=ut.y,ht},i.prototype.computeCollinearIntersection=function(s,u,c,m){var E=Pt.intersects(s,u,c),A=Pt.intersects(s,u,m),U=Pt.intersects(c,m,s),$=Pt.intersects(c,m,u);return E&&A?(this._intPt[0]=c,this._intPt[1]=m,n.COLLINEAR_INTERSECTION):U&&$?(this._intPt[0]=s,this._intPt[1]=u,n.COLLINEAR_INTERSECTION):E&&U?(this._intPt[0]=c,this._intPt[1]=s,!c.equals(s)||A||$?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):E&&$?(this._intPt[0]=c,this._intPt[1]=u,!c.equals(u)||A||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):A&&U?(this._intPt[0]=m,this._intPt[1]=s,!m.equals(s)||E||$?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):A&&$?(this._intPt[0]=m,this._intPt[1]=u,!m.equals(u)||E||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):n.NO_INTERSECTION},i.prototype.normalizeToEnvCentre=function(s,u,c,m,E){var A=s.x<u.x?s.x:u.x,U=s.y<u.y?s.y:u.y,$=s.x>u.x?s.x:u.x,ut=s.y>u.y?s.y:u.y,ht=c.x<m.x?c.x:m.x,At=c.y<m.y?c.y:m.y,Rt=c.x>m.x?c.x:m.x,kt=c.y>m.y?c.y:m.y,ee=((A>ht?A:ht)+($<Rt?$:Rt))/2,on=((U>At?U:At)+(ut<kt?ut:kt))/2;E.x=ee,E.y=on,s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.computeIntersect=function(s,u,c,m){if(this._isProper=!1,!Pt.intersects(s,u,c,m))return n.NO_INTERSECTION;var E=B.orientationIndex(s,u,c),A=B.orientationIndex(s,u,m);if(E>0&&A>0||E<0&&A<0)return n.NO_INTERSECTION;var U=B.orientationIndex(c,m,s),$=B.orientationIndex(c,m,u);return U>0&&$>0||U<0&&$<0?n.NO_INTERSECTION:E===0&&A===0&&U===0&&$===0?this.computeCollinearIntersection(s,u,c,m):(E===0||A===0||U===0||$===0?(this._isProper=!1,s.equals2D(c)||s.equals2D(m)?this._intPt[0]=s:u.equals2D(c)||u.equals2D(m)?this._intPt[0]=u:E===0?this._intPt[0]=new L(c):A===0?this._intPt[0]=new L(m):U===0?this._intPt[0]=new L(s):$===0&&(this._intPt[0]=new L(u))):(this._isProper=!0,this._intPt[0]=this.intersection(s,u,c,m)),n.POINT_INTERSECTION)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.nearestEndpoint=function(s,u,c,m){var E=s,A=B.distancePointLine(s,c,m),U=B.distancePointLine(u,c,m);return U<A&&(A=U,E=u),(U=B.distancePointLine(c,s,u))<A&&(A=U,E=c),(U=B.distancePointLine(m,s,u))<A&&(A=U,E=m),E},i}(R),I=function(){};I.prototype.interfaces_=function(){return[]},I.prototype.getClass=function(){return I},I.orientationIndex=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=s.x-i.x,E=s.y-i.y;return I.signOfDet2x2(u,c,m,E)},I.signOfDet2x2=function(n,i,s,u){var c=null,m=null,E=null;if(c=1,n===0||u===0)return i===0||s===0?0:i>0?s>0?-c:c:s>0?c:-c;if(i===0||s===0)return u>0?n>0?c:-c:n>0?-c:c;if(i>0?u>0?i<=u||(c=-c,m=n,n=s,s=m,m=i,i=u,u=m):i<=-u?(c=-c,s=-s,u=-u):(m=n,n=-s,s=m,m=i,i=-u,u=m):u>0?-i<=u?(c=-c,n=-n,i=-i):(m=-n,n=s,s=m,m=-i,i=u,u=m):i>=u?(n=-n,i=-i,s=-s,u=-u):(c=-c,m=-n,n=-s,s=m,m=-i,i=-u,u=m),n>0){if(!(s>0)||!(n<=s))return c}else{if(s>0||!(n>=s))return-c;c=-c,n=-n,s=-s}for(;;){if(E=Math.floor(s/n),s-=E*n,(u-=E*i)<0)return-c;if(u>i)return c;if(n>s+s){if(i<u+u)return c}else{if(i>u+u)return-c;s=n-s,u=i-u,c=-c}if(u===0)return s===0?0:-c;if(s===0||(E=Math.floor(n/s),n-=E*s,(i-=E*u)<0))return c;if(i>u)return-c;if(s>n+n){if(u<i+i)return-c}else{if(u>i+i)return c;n=s-n,i=u-i,c=-c}if(i===0)return n===0?0:c;if(n===0)return-c}};var P=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n};P.prototype.countSegment=function(n,i){if(n.x<this._p.x&&i.x<this._p.x)return null;if(this._p.x===i.x&&this._p.y===i.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&i.y===this._p.y){var s=n.x,u=i.x;return s>u&&(s=i.x,u=n.x),this._p.x>=s&&this._p.x<=u&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&i.y<=this._p.y||i.y>this._p.y&&n.y<=this._p.y){var c=n.x-this._p.x,m=n.y-this._p.y,E=i.x-this._p.x,A=i.y-this._p.y,U=I.signOfDet2x2(c,m,E,A);if(U===0)return this._isPointOnSegment=!0,null;A<m&&(U=-U),U>0&&this._crossingCount++}},P.prototype.isPointInPolygon=function(){return this.getLocation()!==k.EXTERIOR},P.prototype.getLocation=function(){return this._isPointOnSegment?k.BOUNDARY:this._crossingCount%2==1?k.INTERIOR:k.EXTERIOR},P.prototype.isOnSegment=function(){return this._isPointOnSegment},P.prototype.interfaces_=function(){return[]},P.prototype.getClass=function(){return P},P.locatePointInRing=function(){if(arguments[0]instanceof L&&X(arguments[1],dt)){for(var n=arguments[0],i=arguments[1],s=new P(n),u=new L,c=new L,m=1;m<i.size();m++)if(i.getCoordinate(m,u),i.getCoordinate(m-1,c),s.countSegment(u,c),s.isOnSegment())return s.getLocation();return s.getLocation()}if(arguments[0]instanceof L&&arguments[1]instanceof Array){for(var E=arguments[0],A=arguments[1],U=new P(E),$=1;$<A.length;$++){var ut=A[$],ht=A[$-1];if(U.countSegment(ut,ht),U.isOnSegment())return U.getLocation()}return U.getLocation()}};var B=function(){},lt={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};B.prototype.interfaces_=function(){return[]},B.prototype.getClass=function(){return B},B.orientationIndex=function(n,i,s){return at.orientationIndex(n,i,s)},B.signedArea=function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var i=0,s=n[0].x,u=1;u<n.length-1;u++){var c=n[u].x-s,m=n[u+1].y;i+=c*(n[u-1].y-m)}return i/2}if(X(arguments[0],dt)){var E=arguments[0],A=E.size();if(A<3)return 0;var U=new L,$=new L,ut=new L;E.getCoordinate(0,$),E.getCoordinate(1,ut);var ht=$.x;ut.x-=ht;for(var At=0,Rt=1;Rt<A-1;Rt++)U.y=$.y,$.x=ut.x,$.y=ut.y,E.getCoordinate(Rt+1,ut),ut.x-=ht,At+=$.x*(U.y-ut.y);return At/2}},B.distanceLineLine=function(n,i,s,u){if(n.equals(i))return B.distancePointLine(n,s,u);if(s.equals(u))return B.distancePointLine(u,n,i);var c=!1;if(Pt.intersects(n,i,s,u)){var m=(i.x-n.x)*(u.y-s.y)-(i.y-n.y)*(u.x-s.x);if(m===0)c=!0;else{var E=(n.y-s.y)*(u.x-s.x)-(n.x-s.x)*(u.y-s.y),A=((n.y-s.y)*(i.x-n.x)-(n.x-s.x)*(i.y-n.y))/m,U=E/m;(U<0||U>1||A<0||A>1)&&(c=!0)}}else c=!0;return c?it.min(B.distancePointLine(n,s,u),B.distancePointLine(i,s,u),B.distancePointLine(s,n,i),B.distancePointLine(u,n,i)):0},B.isPointInRing=function(n,i){return B.locatePointInRing(n,i)!==k.EXTERIOR},B.computeLength=function(n){var i=n.size();if(i<=1)return 0;var s=0,u=new L;n.getCoordinate(0,u);for(var c=u.x,m=u.y,E=1;E<i;E++){n.getCoordinate(E,u);var A=u.x,U=u.y,$=A-c,ut=U-m;s+=Math.sqrt($*$+ut*ut),c=A,m=U}return s},B.isCCW=function(n){var i=n.length-1;if(i<3)throw new C("Ring has fewer than 4 points, so orientation cannot be determined");for(var s=n[0],u=0,c=1;c<=i;c++){var m=n[c];m.y>s.y&&(s=m,u=c)}var E=u;do(E-=1)<0&&(E=i);while(n[E].equals2D(s)&&E!==u);var A=u;do A=(A+1)%i;while(n[A].equals2D(s)&&A!==u);var U=n[E],$=n[A];if(U.equals2D(s)||$.equals2D(s)||U.equals2D($))return!1;var ut=B.computeOrientation(U,s,$),ht=!1;return ht=ut===0?U.x>$.x:ut>0,ht},B.locatePointInRing=function(n,i){return P.locatePointInRing(n,i)},B.distancePointLinePerpendicular=function(n,i,s){var u=(s.x-i.x)*(s.x-i.x)+(s.y-i.y)*(s.y-i.y),c=((i.y-n.y)*(s.x-i.x)-(i.x-n.x)*(s.y-i.y))/u;return Math.abs(c)*Math.sqrt(u)},B.computeOrientation=function(n,i,s){return B.orientationIndex(n,i,s)},B.distancePointLine=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(i.length===0)throw new C("Line array must contain at least one vertex");for(var s=n.distance(i[0]),u=0;u<i.length-1;u++){var c=B.distancePointLine(n,i[u],i[u+1]);c<s&&(s=c)}return s}if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];if(E.x===A.x&&E.y===A.y)return m.distance(E);var U=(A.x-E.x)*(A.x-E.x)+(A.y-E.y)*(A.y-E.y),$=((m.x-E.x)*(A.x-E.x)+(m.y-E.y)*(A.y-E.y))/U;if($<=0)return m.distance(E);if($>=1)return m.distance(A);var ut=((E.y-m.y)*(A.x-E.x)-(E.x-m.x)*(A.y-E.y))/U;return Math.abs(ut)*Math.sqrt(U)}},B.isOnLine=function(n,i){for(var s=new Z,u=1;u<i.length;u++){var c=i[u-1],m=i[u];if(s.computeIntersection(n,c,m),s.hasIntersection())return!0}return!1},lt.CLOCKWISE.get=function(){return-1},lt.RIGHT.get=function(){return B.CLOCKWISE},lt.COUNTERCLOCKWISE.get=function(){return 1},lt.LEFT.get=function(){return B.COUNTERCLOCKWISE},lt.COLLINEAR.get=function(){return 0},lt.STRAIGHT.get=function(){return B.COLLINEAR},Object.defineProperties(B,lt);var ct=function(){};ct.prototype.filter=function(n){},ct.prototype.interfaces_=function(){return[]},ct.prototype.getClass=function(){return ct};var j=function(){var n=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=n,this._SRID=n.getSRID()},wt={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};j.prototype.isGeometryCollection=function(){return this.getSortIndex()===j.SORTINDEX_GEOMETRYCOLLECTION},j.prototype.getFactory=function(){return this._factory},j.prototype.getGeometryN=function(n){return this},j.prototype.getArea=function(){return 0},j.prototype.isRectangle=function(){return!1},j.prototype.equals=function(){if(arguments[0]instanceof j){var n=arguments[0];return n!==null&&this.equalsTopo(n)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof j))return!1;var s=i;return this.equalsExact(s)}},j.prototype.equalsExact=function(n){return this===n||this.equalsExact(n,0)},j.prototype.geometryChanged=function(){this.apply(j.geometryChangedFilter)},j.prototype.geometryChangedAction=function(){this._envelope=null},j.prototype.equalsNorm=function(n){return n!==null&&this.norm().equalsExact(n.norm())},j.prototype.getLength=function(){return 0},j.prototype.getNumGeometries=function(){return 1},j.prototype.compareTo=function(){if(arguments.length===1){var n=arguments[0],i=n;return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(n)}if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.getSortIndex()!==s.getSortIndex()?this.getSortIndex()-s.getSortIndex():this.isEmpty()&&s.isEmpty()?0:this.isEmpty()?-1:s.isEmpty()?1:this.compareToSameClass(s,u)}},j.prototype.getUserData=function(){return this._userData},j.prototype.getSRID=function(){return this._SRID},j.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},j.prototype.checkNotGeometryCollection=function(n){if(n.getSortIndex()===j.SORTINDEX_GEOMETRYCOLLECTION)throw new C("This method does not support GeometryCollection arguments")},j.prototype.equal=function(n,i,s){return s===0?n.equals(i):n.distance(i)<=s},j.prototype.norm=function(){var n=this.copy();return n.normalize(),n},j.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},j.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Pt(this._envelope)},j.prototype.setSRID=function(n){this._SRID=n},j.prototype.setUserData=function(n){this._userData=n},j.prototype.compare=function(n,i){for(var s=n.iterator(),u=i.iterator();s.hasNext()&&u.hasNext();){var c=s.next(),m=u.next(),E=c.compareTo(m);if(E!==0)return E}return s.hasNext()?1:u.hasNext()?-1:0},j.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},j.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===j.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===j.SORTINDEX_MULTIPOINT||this.getSortIndex()===j.SORTINDEX_MULTILINESTRING||this.getSortIndex()===j.SORTINDEX_MULTIPOLYGON},j.prototype.interfaces_=function(){return[G,F,t]},j.prototype.getClass=function(){return j},j.hasNonEmptyElements=function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1},j.hasNullElements=function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1},wt.serialVersionUID.get=function(){return 8763622679187377e3},wt.SORTINDEX_POINT.get=function(){return 0},wt.SORTINDEX_MULTIPOINT.get=function(){return 1},wt.SORTINDEX_LINESTRING.get=function(){return 2},wt.SORTINDEX_LINEARRING.get=function(){return 3},wt.SORTINDEX_MULTILINESTRING.get=function(){return 4},wt.SORTINDEX_POLYGON.get=function(){return 5},wt.SORTINDEX_MULTIPOLYGON.get=function(){return 6},wt.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},wt.geometryChangedFilter.get=function(){return _t},Object.defineProperties(j,wt);var _t=function(){};_t.interfaces_=function(){return[ct]},_t.filter=function(n){n.geometryChangedAction()};var Mt=function(){};Mt.prototype.filter=function(n){},Mt.prototype.interfaces_=function(){return[]},Mt.prototype.getClass=function(){return Mt};var Lt=function(){},Jt={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};Lt.prototype.isInBoundary=function(n){},Lt.prototype.interfaces_=function(){return[]},Lt.prototype.getClass=function(){return Lt},Jt.Mod2BoundaryNodeRule.get=function(){return Et},Jt.EndPointBoundaryNodeRule.get=function(){return oe},Jt.MultiValentEndPointBoundaryNodeRule.get=function(){return Qt},Jt.MonoValentEndPointBoundaryNodeRule.get=function(){return Ht},Jt.MOD2_BOUNDARY_RULE.get=function(){return new Et},Jt.ENDPOINT_BOUNDARY_RULE.get=function(){return new oe},Jt.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Qt},Jt.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Ht},Jt.OGC_SFS_BOUNDARY_RULE.get=function(){return Lt.MOD2_BOUNDARY_RULE},Object.defineProperties(Lt,Jt);var Et=function(){};Et.prototype.isInBoundary=function(n){return n%2==1},Et.prototype.interfaces_=function(){return[Lt]},Et.prototype.getClass=function(){return Et};var oe=function(){};oe.prototype.isInBoundary=function(n){return n>0},oe.prototype.interfaces_=function(){return[Lt]},oe.prototype.getClass=function(){return oe};var Qt=function(){};Qt.prototype.isInBoundary=function(n){return n>1},Qt.prototype.interfaces_=function(){return[Lt]},Qt.prototype.getClass=function(){return Qt};var Ht=function(){};Ht.prototype.isInBoundary=function(n){return n===1},Ht.prototype.interfaces_=function(){return[Lt]},Ht.prototype.getClass=function(){return Ht};var Ot=function(){};Ot.prototype.add=function(){},Ot.prototype.addAll=function(){},Ot.prototype.isEmpty=function(){},Ot.prototype.iterator=function(){},Ot.prototype.size=function(){},Ot.prototype.toArray=function(){},Ot.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var Y=function(){};Y.prototype.hasNext=function(){},Y.prototype.next=function(){},Y.prototype.remove=function(){};var St=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(){},i.prototype.set=function(){},i.prototype.isEmpty=function(){},i}(Ot);(o.prototype=new Error).name="NoSuchElementException";var Q=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof Ot&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.ensureCapacity=function(){},i.prototype.interfaces_=function(){return[n,Ot]},i.prototype.add=function(s){return arguments.length===1?this.array_.push(s):this.array_.splice(arguments[0],arguments[1]),!0},i.prototype.clear=function(){this.array_=[]},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.set=function(s,u){var c=this.array_[s];return this.array_[s]=u,c},i.prototype.iterator=function(){return new Ut(this)},i.prototype.get=function(s){if(s<0||s>=this.size())throw new e;return this.array_[s]},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.size=function(){return this.array_.length},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.remove=function(s){for(var u=!1,c=0,m=this.array_.length;c<m;c++)if(this.array_[c]===s){this.array_.splice(c,1),u=!0;break}return u},i}(St),Ut=function(n){function i(s){n.call(this),this.arrayList_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new o;return this.arrayList_.get(this.position_++)},i.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},i.prototype.set=function(s){return this.arrayList_.set(this.position_-1,s)},i.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},i}(Y),Dt=function(n){function i(){if(n.call(this),arguments.length!==0){if(arguments.length===1){var u=arguments[0];this.ensureCapacity(u.length),this.add(u,!0)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.ensureCapacity(c.length),this.add(c,m)}}}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={coordArrayType:{configurable:!0}};return s.coordArrayType.get=function(){return new Array(0).fill(null)},i.prototype.getCoordinate=function(u){return this.get(u)},i.prototype.addAll=function(){if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m=!1,E=u.iterator();E.hasNext();)this.add(E.next(),c),m=!0;return m}return n.prototype.addAll.apply(this,arguments)},i.prototype.clone=function(){for(var u=n.prototype.clone.call(this),c=0;c<this.size();c++)u.add(c,this.get(c).copy());return u},i.prototype.toCoordinateArray=function(){return this.toArray(i.coordArrayType)},i.prototype.add=function(){if(arguments.length===1){var u=arguments[0];n.prototype.add.call(this,u)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var c=arguments[0],m=arguments[1];return this.add(c,m,!0),!0}if(arguments[0]instanceof L&&typeof arguments[1]=="boolean"){var E=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(E))return null;n.prototype.add.call(this,E)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var A=arguments[0],U=arguments[1];return this.add(A,U),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var $=arguments[0],ut=arguments[1];if(arguments[2])for(var ht=0;ht<$.length;ht++)this.add($[ht],ut);else for(var At=$.length-1;At>=0;At--)this.add($[At],ut);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof L){var Rt=arguments[0],kt=arguments[1];if(!arguments[2]){var ee=this.size();if(ee>0&&(Rt>0&&this.get(Rt-1).equals2D(kt)||Rt<ee&&this.get(Rt).equals2D(kt)))return null}n.prototype.add.call(this,Rt,kt)}}else if(arguments.length===4){var on=arguments[0],Rn=arguments[1],dr=arguments[2],Ji=arguments[3],Bo=1;dr>Ji&&(Bo=-1);for(var Df=dr;Df!==Ji;Df+=Bo)this.add(on[Df],Rn);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new L(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,s),i}(Q),ft=function(){},Kt={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Kt.ForwardComparator.get=function(){return re},Kt.BidirectionalComparator.get=function(){return gn},Kt.coordArrayType.get=function(){return new Array(0).fill(null)},ft.prototype.interfaces_=function(){return[]},ft.prototype.getClass=function(){return ft},ft.isRing=function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])},ft.ptNotInList=function(n,i){for(var s=0;s<n.length;s++){var u=n[s];if(ft.indexOf(u,i)<0)return u}return null},ft.scroll=function(n,i){var s=ft.indexOf(i,n);if(s<0)return null;var u=new Array(n.length).fill(null);Nt.arraycopy(n,s,u,0,n.length-s),Nt.arraycopy(n,0,u,n.length-s,s),Nt.arraycopy(u,0,n,0,n.length)},ft.equals=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(n===i)return!0;if(n===null||i===null||n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(!n[s].equals(i[s]))return!1;return!0}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];if(u===c)return!0;if(u===null||c===null||u.length!==c.length)return!1;for(var E=0;E<u.length;E++)if(m.compare(u[E],c[E])!==0)return!1;return!0}},ft.intersection=function(n,i){for(var s=new Dt,u=0;u<n.length;u++)i.intersects(n[u])&&s.add(n[u],!0);return s.toCoordinateArray()},ft.hasRepeatedPoints=function(n){for(var i=1;i<n.length;i++)if(n[i-1].equals(n[i]))return!0;return!1},ft.removeRepeatedPoints=function(n){return ft.hasRepeatedPoints(n)?new Dt(n,!1).toCoordinateArray():n},ft.reverse=function(n){for(var i=n.length-1,s=Math.trunc(i/2),u=0;u<=s;u++){var c=n[u];n[u]=n[i-u],n[i-u]=c}},ft.removeNull=function(n){for(var i=0,s=0;s<n.length;s++)n[s]!==null&&i++;var u=new Array(i).fill(null);if(i===0)return u;for(var c=0,m=0;m<n.length;m++)n[m]!==null&&(u[c++]=n[m]);return u},ft.copyDeep=function(){if(arguments.length===1){for(var n=arguments[0],i=new Array(n.length).fill(null),s=0;s<n.length;s++)i[s]=new L(n[s]);return i}if(arguments.length===5)for(var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],A=arguments[4],U=0;U<A;U++)m[E+U]=new L(u[c+U])},ft.isEqualReversed=function(n,i){for(var s=0;s<n.length;s++){var u=n[s],c=i[n.length-s-1];if(u.compareTo(c)!==0)return!1}return!0},ft.envelope=function(n){for(var i=new Pt,s=0;s<n.length;s++)i.expandToInclude(n[s]);return i},ft.toCoordinateArray=function(n){return n.toArray(ft.coordArrayType)},ft.atLeastNCoordinatesOrNothing=function(n,i){return i.length>=n?i:[]},ft.indexOf=function(n,i){for(var s=0;s<i.length;s++)if(n.equals(i[s]))return s;return-1},ft.increasingDirection=function(n){for(var i=0;i<Math.trunc(n.length/2);i++){var s=n.length-1-i,u=n[i].compareTo(n[s]);if(u!==0)return u}return 1},ft.compare=function(n,i){for(var s=0;s<n.length&&s<i.length;){var u=n[s].compareTo(i[s]);if(u!==0)return u;s++}return s<i.length?-1:s<n.length?1:0},ft.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},ft.extract=function(n,i,s){i=it.clamp(i,0,n.length);var u=(s=it.clamp(s,-1,n.length))-i+1;s<0&&(u=0),i>=n.length&&(u=0),s<i&&(u=0);var c=new Array(u).fill(null);if(u===0)return c;for(var m=0,E=i;E<=s;E++)c[m++]=n[E];return c},Object.defineProperties(ft,Kt);var re=function(){};re.prototype.compare=function(n,i){return ft.compare(n,i)},re.prototype.interfaces_=function(){return[z]},re.prototype.getClass=function(){return re};var gn=function(){};gn.prototype.compare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;var c=ft.compare(s,u);return ft.isEqualReversed(s,u)?0:c},gn.prototype.OLDcompare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;for(var c=ft.increasingDirection(s),m=ft.increasingDirection(u),E=c>0?0:s.length-1,A=m>0?0:s.length-1,U=0;U<s.length;U++){var $=s[E].compareTo(u[A]);if($!==0)return $;E+=c,A+=m}return 0},gn.prototype.interfaces_=function(){return[z]},gn.prototype.getClass=function(){return gn};var He=function(){};He.prototype.get=function(){},He.prototype.put=function(){},He.prototype.size=function(){},He.prototype.values=function(){},He.prototype.entrySet=function(){};var Si=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(He);(a.prototype=new Error).name="OperationNotSupported",(l.prototype=new Ot).contains=function(){};var Kn=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof Ot&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.contains=function(s){for(var u=0,c=this.array_.length;u<c;u++)if(this.array_[u]===s)return!0;return!1},i.prototype.add=function(s){return!this.contains(s)&&(this.array_.push(s),!0)},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.remove=function(s){throw new Error},i.prototype.size=function(){return this.array_.length},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.iterator=function(){return new Ml(this)},i}(l),Ml=function(n){function i(s){n.call(this),this.hashSet_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new o;return this.hashSet_.array_[this.position_++]},i.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},i.prototype.remove=function(){throw new a},i}(Y),di=0;(_.prototype=new Si).get=function(n){for(var i=this.root_;i!==null;){var s=n.compareTo(i.key);if(s<0)i=i.left;else{if(!(s>0))return i.value;i=i.right}}return null},_.prototype.put=function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:di,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var s,u,c=this.root_;do if(s=c,(u=n.compareTo(c.key))<0)c=c.left;else{if(!(u>0)){var m=c.value;return c.value=i,m}c=c.right}while(c!==null);var E={key:n,left:null,right:null,value:i,parent:s,color:di,getValue:function(){return this.value},getKey:function(){return this.key}};return u<0?s.left=E:s.right=E,this.fixAfterInsertion(E),this.size_++,null},_.prototype.fixAfterInsertion=function(n){for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)if(h(n)===d(h(h(n)))){var i=g(h(h(n)));f(i)===1?(p(h(n),di),p(i,di),p(h(h(n)),1),n=h(h(n))):(n===g(h(n))&&(n=h(n),this.rotateLeft(n)),p(h(n),di),p(h(h(n)),1),this.rotateRight(h(h(n))))}else{var s=d(h(h(n)));f(s)===1?(p(h(n),di),p(s,di),p(h(h(n)),1),n=h(h(n))):(n===d(h(n))&&(n=h(n),this.rotateRight(n)),p(h(n),di),p(h(h(n)),1),this.rotateLeft(h(h(n))))}this.root_.color=di},_.prototype.values=function(){var n=new Q,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=_.successor(i))!==null;)n.add(i.value);return n},_.prototype.entrySet=function(){var n=new Kn,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=_.successor(i))!==null;)n.add(i);return n},_.prototype.rotateLeft=function(n){if(n!=null){var i=n.right;n.right=i.left,i.left!=null&&(i.left.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.left===n?n.parent.left=i:n.parent.right=i,i.left=n,n.parent=i}},_.prototype.rotateRight=function(n){if(n!=null){var i=n.left;n.left=i.right,i.right!=null&&(i.right.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.right===n?n.parent.right=i:n.parent.left=i,i.right=n,n.parent=i}},_.prototype.getFirstEntry=function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n},_.successor=function(n){if(n===null)return null;if(n.right!==null){for(var i=n.right;i.left!==null;)i=i.left;return i}for(var s=n.parent,u=n;s!==null&&u===s.right;)u=s,s=s.parent;return s},_.prototype.size=function(){return this.size_};var Is=function(){};Is.prototype.interfaces_=function(){return[]},Is.prototype.getClass=function(){return Is},y.prototype=new l,(M.prototype=new y).contains=function(n){for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===0)return!0;return!1},M.prototype.add=function(n){if(this.contains(n))return!1;for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===1)return this.array_.splice(i,0,n),!0;return this.array_.push(n),!0},M.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next());return!0},M.prototype.remove=function(n){throw new a},M.prototype.size=function(){return this.array_.length},M.prototype.isEmpty=function(){return this.array_.length===0},M.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n},M.prototype.iterator=function(){return new bo(this)};var bo=function(n){this.treeSet_=n,this.position_=0};bo.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},bo.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},bo.prototype.remove=function(){throw new a};var ki=function(){};ki.sort=function(){var n,i,s,u,c=arguments[0];if(arguments.length===1)u=function(E,A){return E.compareTo(A)},c.sort(u);else if(arguments.length===2)s=arguments[1],u=function(E,A){return s.compare(E,A)},c.sort(u);else if(arguments.length===3){(i=c.slice(arguments[1],arguments[2])).sort();var m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length));for(c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])}else if(arguments.length===4)for(i=c.slice(arguments[1],arguments[2]),s=arguments[3],u=function(E,A){return s.compare(E,A)},i.sort(u),m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length)),c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])},ki.asList=function(n){for(var i=new Q,s=0,u=n.length;s<u;s++)i.add(n[s]);return i};var pe=function(){},Lr={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};Lr.P.get=function(){return 0},Lr.L.get=function(){return 1},Lr.A.get=function(){return 2},Lr.FALSE.get=function(){return-1},Lr.TRUE.get=function(){return-2},Lr.DONTCARE.get=function(){return-3},Lr.SYM_FALSE.get=function(){return"F"},Lr.SYM_TRUE.get=function(){return"T"},Lr.SYM_DONTCARE.get=function(){return"*"},Lr.SYM_P.get=function(){return"0"},Lr.SYM_L.get=function(){return"1"},Lr.SYM_A.get=function(){return"2"},pe.prototype.interfaces_=function(){return[]},pe.prototype.getClass=function(){return pe},pe.toDimensionSymbol=function(n){switch(n){case pe.FALSE:return pe.SYM_FALSE;case pe.TRUE:return pe.SYM_TRUE;case pe.DONTCARE:return pe.SYM_DONTCARE;case pe.P:return pe.SYM_P;case pe.L:return pe.SYM_L;case pe.A:return pe.SYM_A}throw new C("Unknown dimension value: "+n)},pe.toDimensionValue=function(n){switch(ot.toUpperCase(n)){case pe.SYM_FALSE:return pe.FALSE;case pe.SYM_TRUE:return pe.TRUE;case pe.SYM_DONTCARE:return pe.DONTCARE;case pe.SYM_P:return pe.P;case pe.SYM_L:return pe.L;case pe.SYM_A:return pe.A}throw new C("Unknown dimension symbol: "+n)},Object.defineProperties(pe,Lr);var ni=function(){};ni.prototype.filter=function(n){},ni.prototype.interfaces_=function(){return[]},ni.prototype.getClass=function(){return ni};var Hr=function(){};Hr.prototype.filter=function(n,i){},Hr.prototype.isDone=function(){},Hr.prototype.isGeometryChanged=function(){},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr};var Hn=function(n){function i(u,c){if(n.call(this,c),this._geometries=u||[],n.hasNullElements(this._geometries))throw new C("geometries must not contain null elements")}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){for(var u=new Pt,c=0;c<this._geometries.length;c++)u.expandToInclude(this._geometries[c].getEnvelopeInternal());return u},i.prototype.getGeometryN=function(u){return this._geometries[u]},i.prototype.getSortIndex=function(){return n.SORTINDEX_GEOMETRYCOLLECTION},i.prototype.getCoordinates=function(){for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=0;m<this._geometries.length;m++)for(var E=this._geometries[m].getCoordinates(),A=0;A<E.length;A++)u[++c]=E[A];return u},i.prototype.getArea=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getArea();return u},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._geometries.length!==m._geometries.length)return!1;for(var E=0;E<this._geometries.length;E++)if(!this._geometries[E].equalsExact(m._geometries[E],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<this._geometries.length;u++)this._geometries[u].normalize();ki.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var u=pe.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getBoundaryDimension());return u},i.prototype.getDimension=function(){for(var u=pe.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getDimension());return u},i.prototype.getLength=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getNumPoints();return u},i.prototype.getNumGeometries=function(){return this._geometries.length},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createGeometryCollection(c)},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=new M(ki.asList(this._geometries)),m=new M(ki.asList(u._geometries));return this.compare(c,m)}if(arguments.length===2){for(var E=arguments[0],A=arguments[1],U=E,$=this.getNumGeometries(),ut=U.getNumGeometries(),ht=0;ht<$&&ht<ut;){var At=this.getGeometryN(ht),Rt=U.getGeometryN(ht),kt=At.compareToSameClass(Rt,A);if(kt!==0)return kt;ht++}return ht<$?1:ht<ut?-1:0}},i.prototype.apply=function(){if(X(arguments[0],Mt))for(var u=arguments[0],c=0;c<this._geometries.length;c++)this._geometries[c].apply(u);else if(X(arguments[0],Hr)){var m=arguments[0];if(this._geometries.length===0)return null;for(var E=0;E<this._geometries.length&&(this._geometries[E].apply(m),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else if(X(arguments[0],ni)){var A=arguments[0];A.filter(this);for(var U=0;U<this._geometries.length;U++)this._geometries[U].apply(A)}else if(X(arguments[0],ct)){var $=arguments[0];$.filter(this);for(var ut=0;ut<this._geometries.length;ut++)this._geometries[ut].apply($)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),b.shouldNeverReachHere(),null},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._geometries=new Array(this._geometries.length).fill(null);for(var c=0;c<this._geometries.length;c++)u._geometries[c]=this._geometries[c].clone();return u},i.prototype.getGeometryType=function(){return"GeometryCollection"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.isEmpty=function(){for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isEmpty())return!1;return!0},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(i,s),i}(j),H=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return j.SORTINDEX_MULTILINESTRING},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?pe.FALSE:0},i.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isClosed())return!1;return!0},i.prototype.getDimension=function(){return 1},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[u-1-m]=this._geometries[m].reverse();return this.getFactory().createMultiLineString(c)},i.prototype.getBoundary=function(){return new rt(this).getBoundary()},i.prototype.getGeometryType=function(){return"MultiLineString"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[Is]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,s),i}(Hn),rt=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var n=arguments[0],i=Lt.MOD2_BOUNDARY_RULE;this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._geom=s,this._geomFact=s.getFactory(),this._bnRule=u}};rt.prototype.boundaryMultiLineString=function(n){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var i=this.computeBoundaryCoordinates(n);return i.length===1?this._geomFact.createPoint(i[0]):this._geomFact.createMultiPointFromCoords(i)},rt.prototype.getBoundary=function(){return this._geom instanceof Bt?this.boundaryLineString(this._geom):this._geom instanceof H?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},rt.prototype.boundaryLineString=function(n){return this._geom.isEmpty()?this.getEmptyMultiPoint():n.isClosed()?this._bnRule.isInBoundary(2)?n.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([n.getStartPoint(),n.getEndPoint()])},rt.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},rt.prototype.computeBoundaryCoordinates=function(n){var i=new Q;this._endpointMap=new _;for(var s=0;s<n.getNumGeometries();s++){var u=n.getGeometryN(s);u.getNumPoints()!==0&&(this.addEndpoint(u.getCoordinateN(0)),this.addEndpoint(u.getCoordinateN(u.getNumPoints()-1)))}for(var c=this._endpointMap.entrySet().iterator();c.hasNext();){var m=c.next(),E=m.getValue().count;this._bnRule.isInBoundary(E)&&i.add(m.getKey())}return ft.toCoordinateArray(i)},rt.prototype.addEndpoint=function(n){var i=this._endpointMap.get(n);i===null&&(i=new gt,this._endpointMap.put(n,i)),i.count++},rt.prototype.interfaces_=function(){return[]},rt.prototype.getClass=function(){return rt},rt.getBoundary=function(){if(arguments.length===1){var n=arguments[0];return new rt(n).getBoundary()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new rt(i,s).getBoundary()}};var gt=function(){this.count=null};gt.prototype.interfaces_=function(){return[]},gt.prototype.getClass=function(){return gt};var st=function(){},yt={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st},st.chars=function(n,i){for(var s=new Array(i).fill(null),u=0;u<i;u++)s[u]=n;return String(s)},st.getStackTrace=function(){if(arguments.length===1){var n=arguments[0],i=new function(){},s=new function(){}(i);return n.printStackTrace(s),i.toString()}if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m="",E=new function(){}(new function(){}(st.getStackTrace(u))),A=0;A<c;A++)try{m+=E.readLine()+st.NEWLINE}catch(U){if(!(U instanceof S))throw U;b.shouldNeverReachHere()}return m}},st.split=function(n,i){for(var s=i.length,u=new Q,c=""+n,m=c.indexOf(i);m>=0;){var E=c.substring(0,m);u.add(E),m=(c=c.substring(m+s)).indexOf(i)}c.length>0&&u.add(c);for(var A=new Array(u.size()).fill(null),U=0;U<A.length;U++)A[U]=u.get(U);return A},st.toString=function(){if(arguments.length===1){var n=arguments[0];return st.SIMPLE_ORDINATE_FORMAT.format(n)}},st.spaces=function(n){return st.chars(" ",n)},yt.NEWLINE.get=function(){return Nt.getProperty("line.separator")},yt.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(st,yt);var It=function(){};It.prototype.interfaces_=function(){return[]},It.prototype.getClass=function(){return It},It.copyCoord=function(n,i,s,u){for(var c=Math.min(n.getDimension(),s.getDimension()),m=0;m<c;m++)s.setOrdinate(u,m,n.getOrdinate(i,m))},It.isRing=function(n){var i=n.size();return i===0||!(i<=3)&&n.getOrdinate(0,dt.X)===n.getOrdinate(i-1,dt.X)&&n.getOrdinate(0,dt.Y)===n.getOrdinate(i-1,dt.Y)},It.isEqual=function(n,i){var s=n.size();if(s!==i.size())return!1;for(var u=Math.min(n.getDimension(),i.getDimension()),c=0;c<s;c++)for(var m=0;m<u;m++){var E=n.getOrdinate(c,m),A=i.getOrdinate(c,m);if(n.getOrdinate(c,m)!==i.getOrdinate(c,m)&&(!w.isNaN(E)||!w.isNaN(A)))return!1}return!0},It.extend=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();if(It.copy(i,0,u,0,c),c>0)for(var m=c;m<s;m++)It.copy(i,c-1,u,m,1);return u},It.reverse=function(n){for(var i=n.size()-1,s=Math.trunc(i/2),u=0;u<=s;u++)It.swap(n,u,i-u)},It.swap=function(n,i,s){if(i===s)return null;for(var u=0;u<n.getDimension();u++){var c=n.getOrdinate(i,u);n.setOrdinate(i,u,n.getOrdinate(s,u)),n.setOrdinate(s,u,c)}},It.copy=function(n,i,s,u,c){for(var m=0;m<c;m++)It.copyCoord(n,i+m,s,u+m)},It.toString=function(){if(arguments.length===1){var n=arguments[0],i=n.size();if(i===0)return"()";var s=n.getDimension(),u=new pt;u.append("(");for(var c=0;c<i;c++){c>0&&u.append(" ");for(var m=0;m<s;m++)m>0&&u.append(","),u.append(st.toString(n.getOrdinate(c,m)))}return u.append(")"),u.toString()}},It.ensureValidRing=function(n,i){var s=i.size();return s===0?i:s<=3?It.createClosedRing(n,i,4):i.getOrdinate(0,dt.X)===i.getOrdinate(s-1,dt.X)&&i.getOrdinate(0,dt.Y)===i.getOrdinate(s-1,dt.Y)?i:It.createClosedRing(n,i,s+1)},It.createClosedRing=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();It.copy(i,0,u,0,c);for(var m=c;m<s;m++)It.copy(i,0,u,m,1);return u};var Bt=function(n){function i(u,c){n.call(this,c),this._points=null,this.init(u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new Pt:this._points.expandEnvelope(new Pt)},i.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},i.prototype.getSortIndex=function(){return n.SORTINDEX_LINESTRING},i.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._points.size()!==m._points.size())return!1;for(var E=0;E<this._points.size();E++)if(!this.equal(this._points.getCoordinate(E),m._points.getCoordinate(E),c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<Math.trunc(this._points.size()/2);u++){var c=this._points.size()-1-u;if(!this._points.getCoordinate(u).equals(this._points.getCoordinate(c)))return this._points.getCoordinate(u).compareTo(this._points.getCoordinate(c))>0&&It.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?pe.FALSE:0},i.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},i.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},i.prototype.getDimension=function(){return 1},i.prototype.getLength=function(){return B.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var u=this._points.copy();return It.reverse(u),this.getFactory().createLineString(u)},i.prototype.compareToSameClass=function(){if(arguments.length===1){for(var u=arguments[0],c=0,m=0;c<this._points.size()&&m<u._points.size();){var E=this._points.getCoordinate(c).compareTo(u._points.getCoordinate(m));if(E!==0)return E;c++,m++}return c<this._points.size()?1:m<u._points.size()?-1:0}if(arguments.length===2){var A=arguments[0];return arguments[1].compare(this._points,A._points)}},i.prototype.apply=function(){if(X(arguments[0],Mt))for(var u=arguments[0],c=0;c<this._points.size();c++)u.filter(this._points.getCoordinate(c));else if(X(arguments[0],Hr)){var m=arguments[0];if(this._points.size()===0)return null;for(var E=0;E<this._points.size()&&(m.filter(this._points,E),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else X(arguments[0],ni)?arguments[0].filter(this):X(arguments[0],ct)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new rt(this).getBoundary()},i.prototype.isEquivalentClass=function(u){return u instanceof i},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._points=this._points.clone(),u},i.prototype.getCoordinateN=function(u){return this._points.getCoordinate(u)},i.prototype.getGeometryType=function(){return"LineString"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._points},i.prototype.isEmpty=function(){return this._points.size()===0},i.prototype.init=function(u){if(u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),u.size()===1)throw new C("Invalid number of points in LineString (found "+u.size()+" - must be 0 or >= 2)");this._points=u},i.prototype.isCoordinate=function(u){for(var c=0;c<this._points.size();c++)if(this._points.getCoordinate(c).equals(u))return!0;return!1},i.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},i.prototype.getPointN=function(u){return this.getFactory().createPoint(this._points.getCoordinate(u))},i.prototype.interfaces_=function(){return[Is]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,s),i}(j),se=function(){};se.prototype.interfaces_=function(){return[]},se.prototype.getClass=function(){return se};var jt=function(n){function i(u,c){n.call(this,c),this._coordinates=u||null,this.init(this._coordinates)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new Pt;var u=new Pt;return u.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),u},i.prototype.getSortIndex=function(){return n.SORTINDEX_POINT},i.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&(!(!this.isEmpty()||!u.isEmpty())||this.isEmpty()===u.isEmpty()&&this.equal(u.getCoordinate(),this.getCoordinate(),c))}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){},i.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},i.prototype.getBoundaryDimension=function(){return pe.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getNumPoints=function(){return this.isEmpty()?0:1},i.prototype.reverse=function(){return this.copy()},i.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0];return this.getCoordinate().compareTo(u.getCoordinate())}if(arguments.length===2){var c=arguments[0];return arguments[1].compare(this._coordinates,c._coordinates)}},i.prototype.apply=function(){if(X(arguments[0],Mt)){var u=arguments[0];if(this.isEmpty())return null;u.filter(this.getCoordinate())}else if(X(arguments[0],Hr)){var c=arguments[0];if(this.isEmpty())return null;c.filter(this._coordinates,0),c.isGeometryChanged()&&this.geometryChanged()}else X(arguments[0],ni)?arguments[0].filter(this):X(arguments[0],ct)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._coordinates=this._coordinates.clone(),u},i.prototype.getGeometryType=function(){return"Point"},i.prototype.copy=function(){return new i(this._coordinates.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._coordinates},i.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},i.prototype.isEmpty=function(){return this._coordinates.size()===0},i.prototype.init=function(u){u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),b.isTrue(u.size()<=1),this._coordinates=u},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[se]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,s),i}(j),ce=function(){};ce.prototype.interfaces_=function(){return[]},ce.prototype.getClass=function(){return ce};var Vt=function(n){function i(u,c,m){if(n.call(this,m),this._shell=null,this._holes=null,u===null&&(u=this.getFactory().createLinearRing()),c===null&&(c=[]),n.hasNullElements(c))throw new C("holes must not contain null elements");if(u.isEmpty()&&n.hasNonEmptyElements(c))throw new C("shell is empty but holes are not");this._shell=u,this._holes=c}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},i.prototype.getSortIndex=function(){return n.SORTINDEX_POLYGON},i.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=this._shell.getCoordinates(),E=0;E<m.length;E++)u[++c]=m[E];for(var A=0;A<this._holes.length;A++)for(var U=this._holes[A].getCoordinates(),$=0;$<U.length;$++)u[++c]=U[$];return u},i.prototype.getArea=function(){var u=0;u+=Math.abs(B.signedArea(this._shell.getCoordinateSequence()));for(var c=0;c<this._holes.length;c++)u-=Math.abs(B.signedArea(this._holes[c].getCoordinateSequence()));return u},i.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var u=this._shell.getCoordinateSequence(),c=this.getEnvelopeInternal(),m=0;m<5;m++){var E=u.getX(m);if(E!==c.getMinX()&&E!==c.getMaxX())return!1;var A=u.getY(m);if(A!==c.getMinY()&&A!==c.getMaxY())return!1}for(var U=u.getX(0),$=u.getY(0),ut=1;ut<=4;ut++){var ht=u.getX(ut),At=u.getY(ut);if(ht!==U==(At!==$))return!1;U=ht,$=At}return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u,E=this._shell,A=m._shell;if(!E.equalsExact(A,c)||this._holes.length!==m._holes.length)return!1;for(var U=0;U<this._holes.length;U++)if(!this._holes[U].equalsExact(m._holes[U],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var u=0;u<this._holes.length;u++)this.normalize(this._holes[u],!1);ki.sort(this._holes)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];if(c.isEmpty())return null;var E=new Array(c.getCoordinates().length-1).fill(null);Nt.arraycopy(c.getCoordinates(),0,E,0,E.length);var A=ft.minCoordinate(c.getCoordinates());ft.scroll(E,A),Nt.arraycopy(E,0,c.getCoordinates(),0,E.length),c.getCoordinates()[E.length]=E[0],B.isCCW(c.getCoordinates())===m&&ft.reverse(c.getCoordinates())}},i.prototype.getCoordinate=function(){return this._shell.getCoordinate()},i.prototype.getNumInteriorRing=function(){return this._holes.length},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.getLength=function(){var u=0;u+=this._shell.getLength();for(var c=0;c<this._holes.length;c++)u+=this._holes[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=this._shell.getNumPoints(),c=0;c<this._holes.length;c++)u+=this._holes[c].getNumPoints();return u},i.prototype.reverse=function(){var u=this.copy();u._shell=this._shell.copy().reverse(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].copy().reverse();return u},i.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=this._shell,m=u._shell;return c.compareToSameClass(m)}if(arguments.length===2){var E=arguments[0],A=arguments[1],U=E,$=this._shell,ut=U._shell,ht=$.compareToSameClass(ut,A);if(ht!==0)return ht;for(var At=this.getNumInteriorRing(),Rt=U.getNumInteriorRing(),kt=0;kt<At&&kt<Rt;){var ee=this.getInteriorRingN(kt),on=U.getInteriorRingN(kt),Rn=ee.compareToSameClass(on,A);if(Rn!==0)return Rn;kt++}return kt<At?1:kt<Rt?-1:0}},i.prototype.apply=function(u){if(X(u,Mt)){this._shell.apply(u);for(var c=0;c<this._holes.length;c++)this._holes[c].apply(u)}else if(X(u,Hr)){if(this._shell.apply(u),!u.isDone())for(var m=0;m<this._holes.length&&(this._holes[m].apply(u),!u.isDone());m++);u.isGeometryChanged()&&this.geometryChanged()}else if(X(u,ni))u.filter(this);else if(X(u,ct)){u.filter(this),this._shell.apply(u);for(var E=0;E<this._holes.length;E++)this._holes[E].apply(u)}},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var u=new Array(this._holes.length+1).fill(null);u[0]=this._shell;for(var c=0;c<this._holes.length;c++)u[c+1]=this._holes[c];return u.length<=1?this.getFactory().createLinearRing(u[0].getCoordinateSequence()):this.getFactory().createMultiLineString(u)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._shell=this._shell.clone(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].clone();return u},i.prototype.getGeometryType=function(){return"Polygon"},i.prototype.copy=function(){for(var u=this._shell.copy(),c=new Array(this._holes.length).fill(null),m=0;m<c.length;m++)c[m]=this._holes[m].copy();return new i(u,c,this._factory)},i.prototype.getExteriorRing=function(){return this._shell},i.prototype.isEmpty=function(){return this._shell.isEmpty()},i.prototype.getInteriorRingN=function(u){return this._holes[u]},i.prototype.interfaces_=function(){return[ce]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(i,s),i}(j),fe=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return j.SORTINDEX_MULTIPOINT},i.prototype.isValid=function(){return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getCoordinate=function(){if(arguments.length===1){var u=arguments[0];return this._geometries[u].getCoordinate()}return n.prototype.getCoordinate.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return pe.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.getGeometryType=function(){return"MultiPoint"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[se]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,s),i}(Hn),sn=function(n){function i(u,c){u instanceof L&&c instanceof le&&(u=c.getCoordinateSequenceFactory().create(u)),n.call(this,u,c),this.validateConstruction()}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return j.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return pe.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},i.prototype.reverse=function(){var u=this._points.copy();return It.reverse(u),this.getFactory().createLinearRing(u)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new C("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new C("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},i.prototype.getGeometryType=function(){return"LinearRing"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.MINIMUM_VALID_SIZE.get=function(){return 4},s.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(i,s),i}(Bt),un=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return j.SORTINDEX_MULTIPOLYGON},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createMultiPolygon(c)},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var u=new Q,c=0;c<this._geometries.length;c++)for(var m=this._geometries[c].getBoundary(),E=0;E<m.getNumGeometries();E++)u.add(m.getGeometryN(E));var A=new Array(u.size()).fill(null);return this.getFactory().createMultiLineString(u.toArray(A))},i.prototype.getGeometryType=function(){return"MultiPolygon"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[ce]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(i,s),i}(Hn),_n=function(n){this._factory=n||null,this._isUserDataCopied=!1},ri={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};_n.prototype.setCopyUserData=function(n){this._isUserDataCopied=n},_n.prototype.edit=function(n,i){if(n===null)return null;var s=this.editInternal(n,i);return this._isUserDataCopied&&s.setUserData(n.getUserData()),s},_n.prototype.editInternal=function(n,i){return this._factory===null&&(this._factory=n.getFactory()),n instanceof Hn?this.editGeometryCollection(n,i):n instanceof Vt?this.editPolygon(n,i):n instanceof jt?i.edit(n,this._factory):n instanceof Bt?i.edit(n,this._factory):(b.shouldNeverReachHere("Unsupported Geometry class: "+n.getClass().getName()),null)},_n.prototype.editGeometryCollection=function(n,i){for(var s=i.edit(n,this._factory),u=new Q,c=0;c<s.getNumGeometries();c++){var m=this.edit(s.getGeometryN(c),i);m===null||m.isEmpty()||u.add(m)}return s.getClass()===fe?this._factory.createMultiPoint(u.toArray([])):s.getClass()===H?this._factory.createMultiLineString(u.toArray([])):s.getClass()===un?this._factory.createMultiPolygon(u.toArray([])):this._factory.createGeometryCollection(u.toArray([]))},_n.prototype.editPolygon=function(n,i){var s=i.edit(n,this._factory);if(s===null&&(s=this._factory.createPolygon(null)),s.isEmpty())return s;var u=this.edit(s.getExteriorRing(),i);if(u===null||u.isEmpty())return this._factory.createPolygon();for(var c=new Q,m=0;m<s.getNumInteriorRing();m++){var E=this.edit(s.getInteriorRingN(m),i);E===null||E.isEmpty()||c.add(E)}return this._factory.createPolygon(u,c.toArray([]))},_n.prototype.interfaces_=function(){return[]},_n.prototype.getClass=function(){return _n},_n.GeometryEditorOperation=function(){},ri.NoOpGeometryOperation.get=function(){return Mn},ri.CoordinateOperation.get=function(){return de},ri.CoordinateSequenceOperation.get=function(){return To},Object.defineProperties(_n,ri);var Mn=function(){};Mn.prototype.edit=function(n,i){return n},Mn.prototype.interfaces_=function(){return[_n.GeometryEditorOperation]},Mn.prototype.getClass=function(){return Mn};var de=function(){};de.prototype.edit=function(n,i){var s=this.editCoordinates(n.getCoordinates(),n);return s===null?n:n instanceof sn?i.createLinearRing(s):n instanceof Bt?i.createLineString(s):n instanceof jt?s.length>0?i.createPoint(s[0]):i.createPoint():n},de.prototype.interfaces_=function(){return[_n.GeometryEditorOperation]},de.prototype.getClass=function(){return de};var To=function(){};To.prototype.edit=function(n,i){return n instanceof sn?i.createLinearRing(this.edit(n.getCoordinateSequence(),n)):n instanceof Bt?i.createLineString(this.edit(n.getCoordinateSequence(),n)):n instanceof jt?i.createPoint(this.edit(n.getCoordinateSequence(),n)):n},To.prototype.interfaces_=function(){return[_n.GeometryEditorOperation]},To.prototype.getClass=function(){return To};var he=function(){if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=new Array(n).fill(null);for(var i=0;i<n;i++)this._coordinates[i]=new L}else if(X(arguments[0],dt)){var s=arguments[0];if(s===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=s.getDimension(),this._coordinates=new Array(s.size()).fill(null);for(var u=0;u<this._coordinates.length;u++)this._coordinates[u]=s.getCoordinateCopy(u)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var c=arguments[0],m=arguments[1];this._coordinates=c,this._dimension=m,c===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var E=arguments[0],A=arguments[1];this._coordinates=new Array(E).fill(null),this._dimension=A;for(var U=0;U<E;U++)this._coordinates[U]=new L}}},ao={serialVersionUID:{configurable:!0}};he.prototype.setOrdinate=function(n,i,s){switch(i){case dt.X:this._coordinates[n].x=s;break;case dt.Y:this._coordinates[n].y=s;break;case dt.Z:this._coordinates[n].z=s;break;default:throw new C("invalid ordinateIndex")}},he.prototype.size=function(){return this._coordinates.length},he.prototype.getOrdinate=function(n,i){switch(i){case dt.X:return this._coordinates[n].x;case dt.Y:return this._coordinates[n].y;case dt.Z:return this._coordinates[n].z}return w.NaN},he.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}},he.prototype.getCoordinateCopy=function(n){return new L(this._coordinates[n])},he.prototype.getDimension=function(){return this._dimension},he.prototype.getX=function(n){return this._coordinates[n].x},he.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 he(n,this._dimension)},he.prototype.expandEnvelope=function(n){for(var i=0;i<this._coordinates.length;i++)n.expandToInclude(this._coordinates[i]);return n},he.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 he(n,this._dimension)},he.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"()"},he.prototype.getY=function(n){return this._coordinates[n].y},he.prototype.toCoordinateArray=function(){return this._coordinates},he.prototype.interfaces_=function(){return[dt,t]},he.prototype.getClass=function(){return he},ao.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(he,ao);var ii=function(){},Ao={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};ii.prototype.readResolve=function(){return ii.instance()},ii.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new he(n)}if(X(arguments[0],dt)){var i=arguments[0];return new he(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return u>3&&(u=3),u<2?new he(s):new he(s,u)}},ii.prototype.interfaces_=function(){return[nt,t]},ii.prototype.getClass=function(){return ii},ii.instance=function(){return ii.instanceObject},Ao.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Ao.instanceObject.get=function(){return new ii},Object.defineProperties(ii,Ao);var ca=function(n){function i(){n.call(this),this.map_=new Map}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(s){return this.map_.get(s)||null},i.prototype.put=function(s,u){return this.map_.set(s,u),u},i.prototype.values=function(){for(var s=new Q,u=this.map_.values(),c=u.next();!c.done;)s.add(c.value),c=u.next();return s},i.prototype.entrySet=function(){var s=new Kn;return this.map_.entries().forEach(function(u){return s.add(u)}),s},i.prototype.size=function(){return this.map_.size()},i}(He),ie=function n(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=n.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Nr){var i=arguments[0];this._modelType=i,i===n.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var s=arguments[0];this._modelType=n.FIXED,this.setScale(s)}else if(arguments[0]instanceof n){var u=arguments[0];this._modelType=u._modelType,this._scale=u._scale}}},Gi={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};ie.prototype.equals=function(n){if(!(n instanceof ie))return!1;var i=n;return this._modelType===i._modelType&&this._scale===i._scale},ie.prototype.compareTo=function(n){var i=n,s=this.getMaximumSignificantDigits(),u=i.getMaximumSignificantDigits();return new et(s).compareTo(new et(u))},ie.prototype.getScale=function(){return this._scale},ie.prototype.isFloating=function(){return this._modelType===ie.FLOATING||this._modelType===ie.FLOATING_SINGLE},ie.prototype.getType=function(){return this._modelType},ie.prototype.toString=function(){var n="UNKNOWN";return this._modelType===ie.FLOATING?n="Floating":this._modelType===ie.FLOATING_SINGLE?n="Floating-Single":this._modelType===ie.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n},ie.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var n=arguments[0];return w.isNaN(n)||this._modelType===ie.FLOATING_SINGLE?n:this._modelType===ie.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof L){var i=arguments[0];if(this._modelType===ie.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}},ie.prototype.getMaximumSignificantDigits=function(){var n=16;return this._modelType===ie.FLOATING?n=16:this._modelType===ie.FLOATING_SINGLE?n=6:this._modelType===ie.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n},ie.prototype.setScale=function(n){this._scale=Math.abs(n)},ie.prototype.interfaces_=function(){return[t,F]},ie.prototype.getClass=function(){return ie},ie.mostPrecise=function(n,i){return n.compareTo(i)>=0?n:i},Gi.serialVersionUID.get=function(){return 7777263578777804e3},Gi.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ie,Gi);var Nr=function n(i){this._name=i||null,n.nameToTypeMap.put(i,this)},Er={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Nr.prototype.readResolve=function(){return Nr.nameToTypeMap.get(this._name)},Nr.prototype.toString=function(){return this._name},Nr.prototype.interfaces_=function(){return[t]},Nr.prototype.getClass=function(){return Nr},Er.serialVersionUID.get=function(){return-552860263173159e4},Er.nameToTypeMap.get=function(){return new ca},Object.defineProperties(Nr,Er),ie.Type=Nr,ie.FIXED=new Nr("FIXED"),ie.FLOATING=new Nr("FLOATING"),ie.FLOATING_SINGLE=new Nr("FLOATING SINGLE");var le=function n(){this._precisionModel=new ie,this._SRID=0,this._coordinateSequenceFactory=n.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?X(arguments[0],nt)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof ie&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},wl={serialVersionUID:{configurable:!0}};le.prototype.toGeometry=function(n){return n.isNull()?this.createPoint(null):n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new L(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new L(n.getMinX(),n.getMinY()),new L(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new L(n.getMinX(),n.getMinY()),new L(n.getMinX(),n.getMaxY()),new L(n.getMaxX(),n.getMaxY()),new L(n.getMaxX(),n.getMinY()),new L(n.getMinX(),n.getMinY())]),null)},le.prototype.createLineString=function(n){return n?n instanceof Array?new Bt(this.getCoordinateSequenceFactory().create(n),this):X(n,dt)?new Bt(n,this):void 0:new Bt(this.getCoordinateSequenceFactory().create([]),this)},le.prototype.createMultiLineString=function(){if(arguments.length===0)return new H(null,this);if(arguments.length===1){var n=arguments[0];return new H(n,this)}},le.prototype.buildGeometry=function(n){for(var i=null,s=!1,u=!1,c=n.iterator();c.hasNext();){var m=c.next(),E=m.getClass();i===null&&(i=E),E!==i&&(s=!0),m.isGeometryCollectionOrDerived()&&(u=!0)}if(i===null)return this.createGeometryCollection();if(s||u)return this.createGeometryCollection(le.toGeometryArray(n));var A=n.iterator().next();if(n.size()>1){if(A instanceof Vt)return this.createMultiPolygon(le.toPolygonArray(n));if(A instanceof Bt)return this.createMultiLineString(le.toLineStringArray(n));if(A instanceof jt)return this.createMultiPoint(le.toPointArray(n));b.shouldNeverReachHere("Unhandled class: "+A.getClass().getName())}return A},le.prototype.createMultiPointFromCoords=function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)},le.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(X(arguments[0],dt)){var i=arguments[0];return new jt(i,this)}}},le.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},le.prototype.createPolygon=function(){if(arguments.length===0)return new Vt(null,null,this);if(arguments.length===1){if(X(arguments[0],dt)){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof Array){var i=arguments[0];return this.createPolygon(this.createLinearRing(i))}if(arguments[0]instanceof sn){var s=arguments[0];return this.createPolygon(s,null)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];return new Vt(u,c,this)}},le.prototype.getSRID=function(){return this._SRID},le.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Hn(null,this);if(arguments.length===1){var n=arguments[0];return new Hn(n,this)}},le.prototype.createGeometry=function(n){return new _n(this).edit(n,{edit:function(){if(arguments.length===2){var i=arguments[0];return this._coordinateSequenceFactory.create(i)}}})},le.prototype.getPrecisionModel=function(){return this._precisionModel},le.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(X(arguments[0],dt)){var i=arguments[0];return new sn(i,this)}}},le.prototype.createMultiPolygon=function(){if(arguments.length===0)return new un(null,this);if(arguments.length===1){var n=arguments[0];return new un(n,this)}},le.prototype.createMultiPoint=function(){if(arguments.length===0)return new fe(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new fe(n,this)}if(arguments[0]instanceof Array){var i=arguments[0];return this.createMultiPoint(i!==null?this.getCoordinateSequenceFactory().create(i):null)}if(X(arguments[0],dt)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var u=new Array(s.size()).fill(null),c=0;c<s.size();c++){var m=this.getCoordinateSequenceFactory().create(1,s.getDimension());It.copy(s,c,m,0,1),u[c]=this.createPoint(m)}return this.createMultiPoint(u)}}},le.prototype.interfaces_=function(){return[t]},le.prototype.getClass=function(){return le},le.toMultiPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toGeometryArray=function(n){if(n===null)return null;var i=new Array(n.size()).fill(null);return n.toArray(i)},le.getDefaultCoordinateSequenceFactory=function(){return ii.instance()},le.toMultiLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toMultiPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toLinearRingArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.createPointFromInternalCoord=function(n,i){return i.getPrecisionModel().makePrecise(n),i.getFactory().createPoint(n)},wl.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(le,wl);var Sl=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],bl=function(n){this.geometryFactory=n||new le};bl.prototype.read=function(n){var i,s=(i=typeof n=="string"?JSON.parse(n):n).type;if(!bi[s])throw new Error("Unknown GeoJSON type: "+i.type);return Sl.indexOf(s)!==-1?bi[s].apply(this,[i.coordinates]):s==="GeometryCollection"?bi[s].apply(this,[i.geometries]):bi[s].apply(this,[i])},bl.prototype.write=function(n){var i=n.getGeometryType();if(!uo[i])throw new Error("Geometry is not supported");return uo[i].apply(this,[n])};var bi={Feature:function(n){var i={};for(var s in n)i[s]=n[s];if(n.geometry){var u=n.geometry.type;if(!bi[u])throw new Error("Unknown GeoJSON type: "+n.type);i.geometry=this.read(n.geometry)}return n.bbox&&(i.bbox=bi.bbox.apply(this,[n.bbox])),i},FeatureCollection:function(n){var i={};if(n.features){i.features=[];for(var s=0;s<n.features.length;++s)i.features.push(this.read(n.features[s]))}return n.bbox&&(i.bbox=this.parse.bbox.apply(this,[n.bbox])),i},coordinates:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(new L(u[0],u[1]))}return i},bbox:function(n){return this.geometryFactory.createLinearRing([new L(n[0],n[1]),new L(n[2],n[1]),new L(n[2],n[3]),new L(n[0],n[3]),new L(n[0],n[1])])},Point:function(n){var i=new L(n[0],n[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(n){for(var i=[],s=0;s<n.length;++s)i.push(bi.Point.apply(this,[n[s]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(n){var i=bi.coordinates.apply(this,[n]);return this.geometryFactory.createLineString(i)},MultiLineString:function(n){for(var i=[],s=0;s<n.length;++s)i.push(bi.LineString.apply(this,[n[s]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(n){for(var i=bi.coordinates.apply(this,[n[0]]),s=this.geometryFactory.createLinearRing(i),u=[],c=1;c<n.length;++c){var m=n[c],E=bi.coordinates.apply(this,[m]),A=this.geometryFactory.createLinearRing(E);u.push(A)}return this.geometryFactory.createPolygon(s,u)},MultiPolygon:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(bi.Polygon.apply(this,[u]))}return this.geometryFactory.createMultiPolygon(i)},GeometryCollection:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(this.read(u))}return this.geometryFactory.createGeometryCollection(i)}},uo={coordinate:function(n){return[n.x,n.y]},Point:function(n){return{type:"Point",coordinates:uo.coordinate.apply(this,[n.getCoordinate()])}},MultiPoint:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=uo.Point.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPoint",coordinates:i}},LineString:function(n){for(var i=[],s=n.getCoordinates(),u=0;u<s.length;++u){var c=s[u];i.push(uo.coordinate.apply(this,[c]))}return{type:"LineString",coordinates:i}},MultiLineString:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=uo.LineString.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(n){var i=[],s=uo.LineString.apply(this,[n._shell]);i.push(s.coordinates);for(var u=0;u<n._holes.length;++u){var c=n._holes[u],m=uo.LineString.apply(this,[c]);i.push(m.coordinates)}return{type:"Polygon",coordinates:i}},MultiPolygon:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=uo.Polygon.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPolygon",coordinates:i}},GeometryCollection:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=u.getGeometryType();i.push(uo[c].apply(this,[u]))}return{type:"GeometryCollection",geometries:i}}},bf=function(n){this.geometryFactory=n||new le,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new bl(this.geometryFactory)};bf.prototype.read=function(n){var i=this.parser.read(n);return this.precisionModel.getType()===ie.FIXED&&this.reducePrecision(i),i},bf.prototype.reducePrecision=function(n){var i,s;if(n.coordinate)this.precisionModel.makePrecise(n.coordinate);else if(n.points)for(i=0,s=n.points.length;i<s;i++)this.precisionModel.makePrecise(n.points[i]);else if(n.geometries)for(i=0,s=n.geometries.length;i<s;i++)this.reducePrecision(n.geometries[i])};var Jd=function(){this.parser=new bl(this.geometryFactory)};Jd.prototype.write=function(n){return this.parser.write(n)};var bt=function(){},Tl={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};bt.prototype.interfaces_=function(){return[]},bt.prototype.getClass=function(){return bt},bt.opposite=function(n){return n===bt.LEFT?bt.RIGHT:n===bt.RIGHT?bt.LEFT:n},Tl.ON.get=function(){return 0},Tl.LEFT.get=function(){return 1},Tl.RIGHT.get=function(){return 2},Object.defineProperties(bt,Tl),(T.prototype=new Error).name="EmptyStackException",(x.prototype=new St).add=function(n){return this.array_.push(n),!0},x.prototype.get=function(n){if(n<0||n>=this.size())throw new Error;return this.array_[n]},x.prototype.push=function(n){return this.array_.push(n),n},x.prototype.pop=function(n){if(this.array_.length===0)throw new T;return this.array_.pop()},x.prototype.peek=function(){if(this.array_.length===0)throw new T;return this.array_[this.array_.length-1]},x.prototype.empty=function(){return this.array_.length===0},x.prototype.isEmpty=function(){return this.empty()},x.prototype.search=function(n){return this.array_.indexOf(n)},x.prototype.size=function(){return this.array_.length},x.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n};var Ti=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Ti.prototype.getCoordinate=function(){return this._minCoord},Ti.prototype.getRightmostSide=function(n,i){var s=this.getRightmostSideOfSegment(n,i);return s<0&&(s=this.getRightmostSideOfSegment(n,i-1)),s<0&&(this._minCoord=null,this.checkForRightmostCoordinate(n)),s},Ti.prototype.findRightmostEdgeAtVertex=function(){var n=this._minDe.getEdge().getCoordinates();b.isTrue(this._minIndex>0&&this._minIndex<n.length,"rightmost point expected to be interior vertex of edge");var i=n[this._minIndex-1],s=n[this._minIndex+1],u=B.computeOrientation(this._minCoord,s,i),c=!1;(i.y<this._minCoord.y&&s.y<this._minCoord.y&&u===B.COUNTERCLOCKWISE||i.y>this._minCoord.y&&s.y>this._minCoord.y&&u===B.CLOCKWISE)&&(c=!0),c&&(this._minIndex=this._minIndex-1)},Ti.prototype.getRightmostSideOfSegment=function(n,i){var s=n.getEdge().getCoordinates();if(i<0||i+1>=s.length||s[i].y===s[i+1].y)return-1;var u=bt.LEFT;return s[i].y<s[i+1].y&&(u=bt.RIGHT),u},Ti.prototype.getEdge=function(){return this._orientedDe},Ti.prototype.checkForRightmostCoordinate=function(n){for(var i=n.getEdge().getCoordinates(),s=0;s<i.length-1;s++)(this._minCoord===null||i[s].x>this._minCoord.x)&&(this._minDe=n,this._minIndex=s,this._minCoord=i[s])},Ti.prototype.findRightmostEdgeAtNode=function(){var n=this._minDe.getNode().getEdges();this._minDe=n.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},Ti.prototype.findEdge=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isForward()&&this.checkForRightmostCoordinate(s)}b.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===bt.LEFT&&(this._orientedDe=this._minDe.getSym())},Ti.prototype.interfaces_=function(){return[]},Ti.prototype.getClass=function(){return Ti};var lo=function(n){function i(s,u){n.call(this,i.msgWithCoord(s,u)),this.pt=u?new L(u):null,this.name="TopologyException"}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getCoordinate=function(){return this.pt},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.msgWithCoord=function(s,u){return u?s:s+" [ "+u+" ]"},i}(J),Al=function(){this.array_=[]};Al.prototype.addLast=function(n){this.array_.push(n)},Al.prototype.removeFirst=function(){return this.array_.shift()},Al.prototype.isEmpty=function(){return this.array_.length===0};var ar=function(){this._finder=null,this._dirEdgeList=new Q,this._nodes=new Q,this._rightMostCoord=null,this._env=null,this._finder=new Ti};ar.prototype.clearVisitedEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();)n.next().setVisited(!1)},ar.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},ar.prototype.computeNodeDepth=function(n){for(var i=null,s=n.getEdges().iterator();s.hasNext();){var u=s.next();if(u.isVisited()||u.getSym().isVisited()){i=u;break}}if(i===null)throw new lo("unable to find edge to compute depths at "+n.getCoordinate());n.getEdges().computeDepths(i);for(var c=n.getEdges().iterator();c.hasNext();){var m=c.next();m.setVisited(!0),this.copySymDepths(m)}},ar.prototype.computeDepth=function(n){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(bt.RIGHT,n),this.copySymDepths(i),this.computeDepths(i)},ar.prototype.create=function(n){this.addReachable(n),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},ar.prototype.findResultEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();){var i=n.next();i.getDepth(bt.RIGHT)>=1&&i.getDepth(bt.LEFT)<=0&&!i.isInteriorAreaEdge()&&i.setInResult(!0)}},ar.prototype.computeDepths=function(n){var i=new Kn,s=new Al,u=n.getNode();for(s.addLast(u),i.add(u),n.setVisited(!0);!s.isEmpty();){var c=s.removeFirst();i.add(c),this.computeNodeDepth(c);for(var m=c.getEdges().iterator();m.hasNext();){var E=m.next().getSym();if(!E.isVisited()){var A=E.getNode();i.contains(A)||(s.addLast(A),i.add(A))}}}},ar.prototype.compareTo=function(n){var i=n;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},ar.prototype.getEnvelope=function(){if(this._env===null){for(var n=new Pt,i=this._dirEdgeList.iterator();i.hasNext();)for(var s=i.next().getEdge().getCoordinates(),u=0;u<s.length-1;u++)n.expandToInclude(s[u]);this._env=n}return this._env},ar.prototype.addReachable=function(n){var i=new x;for(i.add(n);!i.empty();){var s=i.pop();this.add(s,i)}},ar.prototype.copySymDepths=function(n){var i=n.getSym();i.setDepth(bt.LEFT,n.getDepth(bt.RIGHT)),i.setDepth(bt.RIGHT,n.getDepth(bt.LEFT))},ar.prototype.add=function(n,i){n.setVisited(!0),this._nodes.add(n);for(var s=n.getEdges().iterator();s.hasNext();){var u=s.next();this._dirEdgeList.add(u);var c=u.getSym().getNode();c.isVisited()||i.push(c)}},ar.prototype.getNodes=function(){return this._nodes},ar.prototype.getDirectedEdges=function(){return this._dirEdgeList},ar.prototype.interfaces_=function(){return[F]},ar.prototype.getClass=function(){return ar};var hn=function n(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var i=arguments[0];this.init(i.length)}else if(Number.isInteger(arguments[0])){var s=arguments[0];this.init(1),this.location[bt.ON]=s}else if(arguments[0]instanceof n){var u=arguments[0];if(this.init(u.location.length),u!==null)for(var c=0;c<this.location.length;c++)this.location[c]=u.location[c]}}else if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];this.init(3),this.location[bt.ON]=m,this.location[bt.LEFT]=E,this.location[bt.RIGHT]=A}};hn.prototype.setAllLocations=function(n){for(var i=0;i<this.location.length;i++)this.location[i]=n},hn.prototype.isNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==k.NONE)return!1;return!0},hn.prototype.setAllLocationsIfNull=function(n){for(var i=0;i<this.location.length;i++)this.location[i]===k.NONE&&(this.location[i]=n)},hn.prototype.isLine=function(){return this.location.length===1},hn.prototype.merge=function(n){if(n.location.length>this.location.length){var i=new Array(3).fill(null);i[bt.ON]=this.location[bt.ON],i[bt.LEFT]=k.NONE,i[bt.RIGHT]=k.NONE,this.location=i}for(var s=0;s<this.location.length;s++)this.location[s]===k.NONE&&s<n.location.length&&(this.location[s]=n.location[s])},hn.prototype.getLocations=function(){return this.location},hn.prototype.flip=function(){if(this.location.length<=1)return null;var n=this.location[bt.LEFT];this.location[bt.LEFT]=this.location[bt.RIGHT],this.location[bt.RIGHT]=n},hn.prototype.toString=function(){var n=new pt;return this.location.length>1&&n.append(k.toLocationSymbol(this.location[bt.LEFT])),n.append(k.toLocationSymbol(this.location[bt.ON])),this.location.length>1&&n.append(k.toLocationSymbol(this.location[bt.RIGHT])),n.toString()},hn.prototype.setLocations=function(n,i,s){this.location[bt.ON]=n,this.location[bt.LEFT]=i,this.location[bt.RIGHT]=s},hn.prototype.get=function(n){return n<this.location.length?this.location[n]:k.NONE},hn.prototype.isArea=function(){return this.location.length>1},hn.prototype.isAnyNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===k.NONE)return!0;return!1},hn.prototype.setLocation=function(){if(arguments.length===1){var n=arguments[0];this.setLocation(bt.ON,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.location[i]=s}},hn.prototype.init=function(n){this.location=new Array(n).fill(null),this.setAllLocations(k.NONE)},hn.prototype.isEqualOnSide=function(n,i){return this.location[i]===n.location[i]},hn.prototype.allPositionsEqual=function(n){for(var i=0;i<this.location.length;i++)if(this.location[i]!==n)return!1;return!0},hn.prototype.interfaces_=function(){return[]},hn.prototype.getClass=function(){return hn};var rn=function n(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var i=arguments[0];this.elt[0]=new hn(i),this.elt[1]=new hn(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.elt[0]=new hn(s.elt[0]),this.elt[1]=new hn(s.elt[1])}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.elt[0]=new hn(k.NONE),this.elt[1]=new hn(k.NONE),this.elt[u].setLocation(c)}else if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];this.elt[0]=new hn(m,E,A),this.elt[1]=new hn(m,E,A)}else if(arguments.length===4){var U=arguments[0],$=arguments[1],ut=arguments[2],ht=arguments[3];this.elt[0]=new hn(k.NONE,k.NONE,k.NONE),this.elt[1]=new hn(k.NONE,k.NONE,k.NONE),this.elt[U].setLocations($,ut,ht)}};rn.prototype.getGeometryCount=function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n},rn.prototype.setAllLocations=function(n,i){this.elt[n].setAllLocations(i)},rn.prototype.isNull=function(n){return this.elt[n].isNull()},rn.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var n=arguments[0];this.setAllLocationsIfNull(0,n),this.setAllLocationsIfNull(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.elt[i].setAllLocationsIfNull(s)}},rn.prototype.isLine=function(n){return this.elt[n].isLine()},rn.prototype.merge=function(n){for(var i=0;i<2;i++)this.elt[i]===null&&n.elt[i]!==null?this.elt[i]=new hn(n.elt[i]):this.elt[i].merge(n.elt[i])},rn.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},rn.prototype.getLocation=function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(bt.ON)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.elt[i].get(s)}},rn.prototype.toString=function(){var n=new pt;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()},rn.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var n=arguments[0];return this.elt[n].isArea()}},rn.prototype.isAnyNull=function(n){return this.elt[n].isAnyNull()},rn.prototype.setLocation=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setLocation(bt.ON,i)}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this.elt[s].setLocation(u,c)}},rn.prototype.isEqualOnSide=function(n,i){return this.elt[0].isEqualOnSide(n.elt[0],i)&&this.elt[1].isEqualOnSide(n.elt[1],i)},rn.prototype.allPositionsEqual=function(n,i){return this.elt[n].allPositionsEqual(i)},rn.prototype.toLine=function(n){this.elt[n].isArea()&&(this.elt[n]=new hn(this.elt[n].location[0]))},rn.prototype.interfaces_=function(){return[]},rn.prototype.getClass=function(){return rn},rn.toLineLabel=function(n){for(var i=new rn(k.NONE),s=0;s<2;s++)i.setLocation(s,n.getLocation(s));return i};var Cn=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new Q,this._pts=new Q,this._label=new rn(k.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new Q,this._geometryFactory=null;var n=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(n),this.computeRing()};Cn.prototype.computeRing=function(){if(this._ring!==null)return null;for(var n=new Array(this._pts.size()).fill(null),i=0;i<this._pts.size();i++)n[i]=this._pts.get(i);this._ring=this._geometryFactory.createLinearRing(n),this._isHole=B.isCCW(this._ring.getCoordinates())},Cn.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},Cn.prototype.computePoints=function(n){this._startDe=n;var i=n,s=!0;do{if(i===null)throw new lo("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new lo("Directed Edge visited twice during ring-building at "+i.getCoordinate());this._edges.add(i);var u=i.getLabel();b.isTrue(u.isArea()),this.mergeLabel(u),this.addPoints(i.getEdge(),i.isForward(),s),s=!1,this.setEdgeRing(i,this),i=this.getNext(i)}while(i!==this._startDe)},Cn.prototype.getLinearRing=function(){return this._ring},Cn.prototype.getCoordinate=function(n){return this._pts.get(n)},Cn.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var n=this._startDe;do{var i=n.getNode().getEdges().getOutgoingDegree(this);i>this._maxNodeDegree&&(this._maxNodeDegree=i),n=this.getNext(n)}while(n!==this._startDe);this._maxNodeDegree*=2},Cn.prototype.addPoints=function(n,i,s){var u=n.getCoordinates();if(i){var c=1;s&&(c=0);for(var m=c;m<u.length;m++)this._pts.add(u[m])}else{var E=u.length-2;s&&(E=u.length-1);for(var A=E;A>=0;A--)this._pts.add(u[A])}},Cn.prototype.isHole=function(){return this._isHole},Cn.prototype.setInResult=function(){var n=this._startDe;do n.getEdge().setInResult(!0),n=n.getNext();while(n!==this._startDe)},Cn.prototype.containsPoint=function(n){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(n)||!B.isPointInRing(n,i.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();)if(s.next().containsPoint(n))return!1;return!0},Cn.prototype.addHole=function(n){this._holes.add(n)},Cn.prototype.isShell=function(){return this._shell===null},Cn.prototype.getLabel=function(){return this._label},Cn.prototype.getEdges=function(){return this._edges},Cn.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Cn.prototype.getShell=function(){return this._shell},Cn.prototype.mergeLabel=function(){if(arguments.length===1){var n=arguments[0];this.mergeLabel(n,0),this.mergeLabel(n,1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=i.getLocation(s,bt.RIGHT);if(u===k.NONE)return null;if(this._label.getLocation(s)===k.NONE)return this._label.setLocation(s,u),null}},Cn.prototype.setShell=function(n){this._shell=n,n!==null&&n.addHole(this)},Cn.prototype.toPolygon=function(n){for(var i=new Array(this._holes.size()).fill(null),s=0;s<this._holes.size();s++)i[s]=this._holes.get(s).getLinearRing();return n.createPolygon(this.getLinearRing(),i)},Cn.prototype.interfaces_=function(){return[]},Cn.prototype.getClass=function(){return Cn};var R1=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.setEdgeRing=function(s,u){s.setMinEdgeRing(u)},i.prototype.getNext=function(s){return s.getNextMin()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Cn),L1=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildMinimalRings=function(){var s=new Q,u=this._startDe;do{if(u.getMinEdgeRing()===null){var c=new R1(u,this._geometryFactory);s.add(c)}u=u.getNext()}while(u!==this._startDe);return s},i.prototype.setEdgeRing=function(s,u){s.setEdgeRing(u)},i.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var s=this._startDe;do s.getNode().getEdges().linkMinimalDirectedEdges(this),s=s.getNext();while(s!==this._startDe)},i.prototype.getNext=function(s){return s.getNext()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Cn),Wr=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._label=n}}};Wr.prototype.setVisited=function(n){this._isVisited=n},Wr.prototype.setInResult=function(n){this._isInResult=n},Wr.prototype.isCovered=function(){return this._isCovered},Wr.prototype.isCoveredSet=function(){return this._isCoveredSet},Wr.prototype.setLabel=function(n){this._label=n},Wr.prototype.getLabel=function(){return this._label},Wr.prototype.setCovered=function(n){this._isCovered=n,this._isCoveredSet=!0},Wr.prototype.updateIM=function(n){b.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(n)},Wr.prototype.isInResult=function(){return this._isInResult},Wr.prototype.isVisited=function(){return this._isVisited},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr};var Cl=function(n){function i(){n.call(this),this._coord=null,this._edges=null;var s=arguments[0],u=arguments[1];this._coord=s,this._edges=u,this._label=new rn(0,k.NONE)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isIncidentEdgeInResult=function(){for(var s=this.getEdges().getEdges().iterator();s.hasNext();)if(s.next().getEdge().isInResult())return!0;return!1},i.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},i.prototype.getCoordinate=function(){return this._coord},i.prototype.print=function(s){s.println("node "+this._coord+" lbl: "+this._label)},i.prototype.computeIM=function(s){},i.prototype.computeMergedLocation=function(s,u){var c=k.NONE;if(c=this._label.getLocation(u),!s.isNull(u)){var m=s.getLocation(u);c!==k.BOUNDARY&&(c=m)}return c},i.prototype.setLabel=function(){if(arguments.length!==2)return n.prototype.setLabel.apply(this,arguments);var s=arguments[0],u=arguments[1];this._label===null?this._label=new rn(s,u):this._label.setLocation(s,u)},i.prototype.getEdges=function(){return this._edges},i.prototype.mergeLabel=function(){if(arguments[0]instanceof i){var s=arguments[0];this.mergeLabel(s._label)}else if(arguments[0]instanceof rn)for(var u=arguments[0],c=0;c<2;c++){var m=this.computeMergedLocation(u,c);this._label.getLocation(c)===k.NONE&&this._label.setLocation(c,m)}},i.prototype.add=function(s){this._edges.insert(s),s.setNode(this)},i.prototype.setLabelBoundary=function(s){if(this._label===null)return null;var u=k.NONE;this._label!==null&&(u=this._label.getLocation(s));var c=null;switch(u){case k.BOUNDARY:c=k.INTERIOR;break;case k.INTERIOR:default:c=k.BOUNDARY}this._label.setLocation(s,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Wr),Ai=function(){this.nodeMap=new _,this.nodeFact=null;var n=arguments[0];this.nodeFact=n};Ai.prototype.find=function(n){return this.nodeMap.get(n)},Ai.prototype.addNode=function(){if(arguments[0]instanceof L){var n=arguments[0],i=this.nodeMap.get(n);return i===null&&(i=this.nodeFact.createNode(n),this.nodeMap.put(n,i)),i}if(arguments[0]instanceof Cl){var s=arguments[0],u=this.nodeMap.get(s.getCoordinate());return u===null?(this.nodeMap.put(s.getCoordinate(),s),s):(u.mergeLabel(s),u)}},Ai.prototype.print=function(n){for(var i=this.iterator();i.hasNext();)i.next().print(n)},Ai.prototype.iterator=function(){return this.nodeMap.values().iterator()},Ai.prototype.values=function(){return this.nodeMap.values()},Ai.prototype.getBoundaryNodes=function(n){for(var i=new Q,s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().getLocation(n)===k.BOUNDARY&&i.add(u)}return i},Ai.prototype.add=function(n){var i=n.getCoordinate();this.addNode(i).add(n)},Ai.prototype.interfaces_=function(){return[]},Ai.prototype.getClass=function(){return Ai};var ln=function(){},Eu={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};ln.prototype.interfaces_=function(){return[]},ln.prototype.getClass=function(){return ln},ln.isNorthern=function(n){return n===ln.NE||n===ln.NW},ln.isOpposite=function(n,i){return n===i?!1:(n-i+4)%4===2},ln.commonHalfPlane=function(n,i){if(n===i)return n;if((n-i+4)%4===2)return-1;var s=n<i?n:i;return s===0&&(n>i?n:i)===3?3:s},ln.isInHalfPlane=function(n,i){return i===ln.SE?n===ln.SE||n===ln.SW:n===i||n===i+1},ln.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new C("Cannot compute the quadrant for point ( "+n+", "+i+" )");return n>=0?i>=0?ln.NE:ln.SE:i>=0?ln.NW:ln.SW}if(arguments[0]instanceof L&&arguments[1]instanceof L){var s=arguments[0],u=arguments[1];if(u.x===s.x&&u.y===s.y)throw new C("Cannot compute the quadrant for two identical points "+s);return u.x>=s.x?u.y>=s.y?ln.NE:ln.SE:u.y>=s.y?ln.NW:ln.SW}},Eu.NE.get=function(){return 0},Eu.NW.get=function(){return 1},Eu.SW.get=function(){return 2},Eu.SE.get=function(){return 3},Object.defineProperties(ln,Eu);var Qn=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2];this._edge=i,this.init(s,u),this._label=null}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];this._edge=c,this.init(m,E),this._label=A}};Qn.prototype.compareDirection=function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:B.computeOrientation(n._p0,n._p1,this._p1)},Qn.prototype.getDy=function(){return this._dy},Qn.prototype.getCoordinate=function(){return this._p0},Qn.prototype.setNode=function(n){this._node=n},Qn.prototype.print=function(n){var i=Math.atan2(this._dy,this._dx),s=this.getClass().getName(),u=s.lastIndexOf("."),c=s.substring(u+1);n.print(" "+c+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)},Qn.prototype.compareTo=function(n){var i=n;return this.compareDirection(i)},Qn.prototype.getDirectedCoordinate=function(){return this._p1},Qn.prototype.getDx=function(){return this._dx},Qn.prototype.getLabel=function(){return this._label},Qn.prototype.getEdge=function(){return this._edge},Qn.prototype.getQuadrant=function(){return this._quadrant},Qn.prototype.getNode=function(){return this._node},Qn.prototype.toString=function(){var n=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),s=i.lastIndexOf(".");return" "+i.substring(s+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label},Qn.prototype.computeLabel=function(n){},Qn.prototype.init=function(n,i){this._p0=n,this._p1=i,this._dx=i.x-n.x,this._dy=i.y-n.y,this._quadrant=ln.quadrant(this._dx,this._dy),b.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},Qn.prototype.interfaces_=function(){return[F]},Qn.prototype.getClass=function(){return Qn};var Tf=function(n){function i(){var s=arguments[0],u=arguments[1];if(n.call(this,s),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=u,u)this.init(s.getCoordinate(0),s.getCoordinate(1));else{var c=s.getNumPoints()-1;this.init(s.getCoordinate(c),s.getCoordinate(c-1))}this.computeDirectedLabel()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getNextMin=function(){return this._nextMin},i.prototype.getDepth=function(s){return this._depth[s]},i.prototype.setVisited=function(s){this._isVisited=s},i.prototype.computeDirectedLabel=function(){this._label=new rn(this._edge.getLabel()),this._isForward||this._label.flip()},i.prototype.getNext=function(){return this._next},i.prototype.setDepth=function(s,u){if(this._depth[s]!==-999&&this._depth[s]!==u)throw new lo("assigned depths do not match",this.getCoordinate());this._depth[s]=u},i.prototype.isInteriorAreaEdge=function(){for(var s=!0,u=0;u<2;u++)this._label.isArea(u)&&this._label.getLocation(u,bt.LEFT)===k.INTERIOR&&this._label.getLocation(u,bt.RIGHT)===k.INTERIOR||(s=!1);return s},i.prototype.setNextMin=function(s){this._nextMin=s},i.prototype.print=function(s){n.prototype.print.call(this,s),s.print(" "+this._depth[bt.LEFT]+"/"+this._depth[bt.RIGHT]),s.print(" ("+this.getDepthDelta()+")"),this._isInResult&&s.print(" inResult")},i.prototype.setMinEdgeRing=function(s){this._minEdgeRing=s},i.prototype.isLineEdge=function(){var s=this._label.isLine(0)||this._label.isLine(1),u=!this._label.isArea(0)||this._label.allPositionsEqual(0,k.EXTERIOR),c=!this._label.isArea(1)||this._label.allPositionsEqual(1,k.EXTERIOR);return s&&u&&c},i.prototype.setEdgeRing=function(s){this._edgeRing=s},i.prototype.getMinEdgeRing=function(){return this._minEdgeRing},i.prototype.getDepthDelta=function(){var s=this._edge.getDepthDelta();return this._isForward||(s=-s),s},i.prototype.setInResult=function(s){this._isInResult=s},i.prototype.getSym=function(){return this._sym},i.prototype.isForward=function(){return this._isForward},i.prototype.getEdge=function(){return this._edge},i.prototype.printEdge=function(s){this.print(s),s.print(" "),this._isForward?this._edge.print(s):this._edge.printReverse(s)},i.prototype.setSym=function(s){this._sym=s},i.prototype.setVisitedEdge=function(s){this.setVisited(s),this._sym.setVisited(s)},i.prototype.setEdgeDepths=function(s,u){var c=this.getEdge().getDepthDelta();this._isForward||(c=-c);var m=1;s===bt.LEFT&&(m=-1);var E=bt.opposite(s),A=u+c*m;this.setDepth(s,u),this.setDepth(E,A)},i.prototype.getEdgeRing=function(){return this._edgeRing},i.prototype.isInResult=function(){return this._isInResult},i.prototype.setNext=function(s){this._next=s},i.prototype.isVisited=function(){return this._isVisited},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.depthFactor=function(s,u){return s===k.EXTERIOR&&u===k.INTERIOR?1:s===k.INTERIOR&&u===k.EXTERIOR?-1:0},i}(Qn),fa=function(){};fa.prototype.createNode=function(n){return new Cl(n,null)},fa.prototype.interfaces_=function(){return[]},fa.prototype.getClass=function(){return fa};var xn=function(){if(this._edges=new Q,this._nodes=null,this._edgeEndList=new Q,arguments.length===0)this._nodes=new Ai(new fa);else if(arguments.length===1){var n=arguments[0];this._nodes=new Ai(n)}};xn.prototype.printEdges=function(n){n.println("Edges:");for(var i=0;i<this._edges.size();i++){n.println("edge "+i+":");var s=this._edges.get(i);s.print(n),s.eiList.print(n)}},xn.prototype.find=function(n){return this._nodes.find(n)},xn.prototype.addNode=function(){if(arguments[0]instanceof Cl){var n=arguments[0];return this._nodes.addNode(n)}if(arguments[0]instanceof L){var i=arguments[0];return this._nodes.addNode(i)}},xn.prototype.getNodeIterator=function(){return this._nodes.iterator()},xn.prototype.linkResultDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()},xn.prototype.debugPrintln=function(n){Nt.out.println(n)},xn.prototype.isBoundaryNode=function(n,i){var s=this._nodes.find(i);if(s===null)return!1;var u=s.getLabel();return u!==null&&u.getLocation(n)===k.BOUNDARY},xn.prototype.linkAllDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkAllDirectedEdges()},xn.prototype.matchInSameDirection=function(n,i,s,u){return!!n.equals(s)&&B.computeOrientation(n,i,u)===B.COLLINEAR&&ln.quadrant(n,i)===ln.quadrant(s,u)},xn.prototype.getEdgeEnds=function(){return this._edgeEndList},xn.prototype.debugPrint=function(n){Nt.out.print(n)},xn.prototype.getEdgeIterator=function(){return this._edges.iterator()},xn.prototype.findEdgeInSameDirection=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(this.matchInSameDirection(n,i,c[0],c[1])||this.matchInSameDirection(n,i,c[c.length-1],c[c.length-2]))return u}return null},xn.prototype.insertEdge=function(n){this._edges.add(n)},xn.prototype.findEdgeEnd=function(n){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var s=i.next();if(s.getEdge()===n)return s}return null},xn.prototype.addEdges=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();this._edges.add(s);var u=new Tf(s,!0),c=new Tf(s,!1);u.setSym(c),c.setSym(u),this.add(u),this.add(c)}},xn.prototype.add=function(n){this._nodes.add(n),this._edgeEndList.add(n)},xn.prototype.getNodes=function(){return this._nodes.values()},xn.prototype.findEdge=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(n.equals(c[0])&&i.equals(c[1]))return u}return null},xn.prototype.interfaces_=function(){return[]},xn.prototype.getClass=function(){return xn},xn.linkResultDirectedEdges=function(n){for(var i=n.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var Or=function(){this._geometryFactory=null,this._shellList=new Q;var n=arguments[0];this._geometryFactory=n};Or.prototype.sortShellsAndHoles=function(n,i,s){for(var u=n.iterator();u.hasNext();){var c=u.next();c.isHole()?s.add(c):i.add(c)}},Or.prototype.computePolygons=function(n){for(var i=new Q,s=n.iterator();s.hasNext();){var u=s.next().toPolygon(this._geometryFactory);i.add(u)}return i},Or.prototype.placeFreeHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();if(u.getShell()===null){var c=this.findEdgeRingContaining(u,n);if(c===null)throw new lo("unable to assign hole to a shell",u.getCoordinate(0));u.setShell(c)}}},Or.prototype.buildMinimalEdgeRings=function(n,i,s){for(var u=new Q,c=n.iterator();c.hasNext();){var m=c.next();if(m.getMaxNodeDegree()>2){m.linkDirectedEdgesForMinimalEdgeRings();var E=m.buildMinimalRings(),A=this.findShell(E);A!==null?(this.placePolygonHoles(A,E),i.add(A)):s.addAll(E)}else u.add(m)}return u},Or.prototype.containsPoint=function(n){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(n))return!0;return!1},Or.prototype.buildMaximalEdgeRings=function(n){for(var i=new Q,s=n.iterator();s.hasNext();){var u=s.next();if(u.isInResult()&&u.getLabel().isArea()&&u.getEdgeRing()===null){var c=new L1(u,this._geometryFactory);i.add(c),c.setInResult()}}return i},Or.prototype.placePolygonHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();u.isHole()&&u.setShell(n)}},Or.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Or.prototype.findEdgeRingContaining=function(n,i){for(var s=n.getLinearRing(),u=s.getEnvelopeInternal(),c=s.getCoordinateN(0),m=null,E=null,A=i.iterator();A.hasNext();){var U=A.next(),$=U.getLinearRing(),ut=$.getEnvelopeInternal();m!==null&&(E=m.getLinearRing().getEnvelopeInternal());var ht=!1;ut.contains(u)&&B.isPointInRing(c,$.getCoordinates())&&(ht=!0),ht&&(m===null||E.contains(ut))&&(m=U)}return m},Or.prototype.findShell=function(n){for(var i=0,s=null,u=n.iterator();u.hasNext();){var c=u.next();c.isHole()||(s=c,i++)}return b.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),s},Or.prototype.add=function(){if(arguments.length===1){var n=arguments[0];this.add(n.getEdgeEnds(),n.getNodes())}else if(arguments.length===2){var i=arguments[0],s=arguments[1];xn.linkResultDirectedEdges(s);var u=this.buildMaximalEdgeRings(i),c=new Q,m=this.buildMinimalEdgeRings(u,this._shellList,c);this.sortShellsAndHoles(m,this._shellList,c),this.placeFreeHoles(this._shellList,c)}},Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or};var ha=function(){};ha.prototype.getBounds=function(){},ha.prototype.interfaces_=function(){return[]},ha.prototype.getClass=function(){return ha};var mi=function(){this._bounds=null,this._item=null;var n=arguments[0],i=arguments[1];this._bounds=n,this._item=i};mi.prototype.getItem=function(){return this._item},mi.prototype.getBounds=function(){return this._bounds},mi.prototype.interfaces_=function(){return[ha,t]},mi.prototype.getClass=function(){return mi};var co=function(){this._size=null,this._items=null,this._size=0,this._items=new Q,this._items.add(null)};co.prototype.poll=function(){if(this.isEmpty())return null;var n=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),n},co.prototype.size=function(){return this._size},co.prototype.reorder=function(n){for(var i=null,s=this._items.get(n);2*n<=this._size&&((i=2*n)!==this._size&&this._items.get(i+1).compareTo(this._items.get(i))<0&&i++,this._items.get(i).compareTo(s)<0);n=i)this._items.set(n,this._items.get(i));this._items.set(n,s)},co.prototype.clear=function(){this._size=0,this._items.clear()},co.prototype.isEmpty=function(){return this._size===0},co.prototype.add=function(n){this._items.add(null),this._size+=1;var i=this._size;for(this._items.set(0,n);n.compareTo(this._items.get(Math.trunc(i/2)))<0;i/=2)this._items.set(i,this._items.get(Math.trunc(i/2)));this._items.set(i,n)},co.prototype.interfaces_=function(){return[]},co.prototype.getClass=function(){return co};var Co=function(){};Co.prototype.visitItem=function(n){},Co.prototype.interfaces_=function(){return[]},Co.prototype.getClass=function(){return Co};var Rs=function(){};Rs.prototype.insert=function(n,i){},Rs.prototype.remove=function(n,i){},Rs.prototype.query=function(){},Rs.prototype.interfaces_=function(){return[]},Rs.prototype.getClass=function(){return Rs};var Dn=function(){if(this._childBoundables=new Q,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._level=n}}},Kd={serialVersionUID:{configurable:!0}};Dn.prototype.getLevel=function(){return this._level},Dn.prototype.size=function(){return this._childBoundables.size()},Dn.prototype.getChildBoundables=function(){return this._childBoundables},Dn.prototype.addChildBoundable=function(n){b.isTrue(this._bounds===null),this._childBoundables.add(n)},Dn.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Dn.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Dn.prototype.interfaces_=function(){return[ha,t]},Dn.prototype.getClass=function(){return Dn},Kd.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Dn,Kd);var gi=function(){};gi.reverseOrder=function(){return{compare:function(n,i){return i.compareTo(n)}}},gi.min=function(n){return gi.sort(n),n.get(0)},gi.sort=function(n,i){var s=n.toArray();i?ki.sort(s,i):ki.sort(s);for(var u=n.iterator(),c=0,m=s.length;c<m;c++)u.next(),u.set(s[c])},gi.singletonList=function(n){var i=new Q;return i.add(n),i};var Pn=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var n=arguments[0],i=arguments[1],s=arguments[2];this._boundable1=n,this._boundable2=i,this._itemDistance=s,this._distance=this.distance()};Pn.prototype.expandToQueue=function(n,i){var s=Pn.isComposite(this._boundable1),u=Pn.isComposite(this._boundable2);if(s&&u)return Pn.area(this._boundable1)>Pn.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,n,i),null):(this.expand(this._boundable2,this._boundable1,n,i),null);if(s)return this.expand(this._boundable1,this._boundable2,n,i),null;if(u)return this.expand(this._boundable2,this._boundable1,n,i),null;throw new C("neither boundable is composite")},Pn.prototype.isLeaves=function(){return!(Pn.isComposite(this._boundable1)||Pn.isComposite(this._boundable2))},Pn.prototype.compareTo=function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0},Pn.prototype.expand=function(n,i,s,u){for(var c=n.getChildBoundables().iterator();c.hasNext();){var m=c.next(),E=new Pn(m,i,this._itemDistance);E.getDistance()<u&&s.add(E)}},Pn.prototype.getBoundable=function(n){return n===0?this._boundable1:this._boundable2},Pn.prototype.getDistance=function(){return this._distance},Pn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Pn.prototype.interfaces_=function(){return[F]},Pn.prototype.getClass=function(){return Pn},Pn.area=function(n){return n.getBounds().getArea()},Pn.isComposite=function(n){return n instanceof Dn};var kn=function n(){if(this._root=null,this._built=!1,this._itemBoundables=new Q,this._nodeCapacity=null,arguments.length===0){var i=n.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var s=arguments[0];b.isTrue(s>1,"Node capacity must be greater than 1"),this._nodeCapacity=s}},Pl={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};kn.prototype.getNodeCapacity=function(){return this._nodeCapacity},kn.prototype.lastNode=function(n){return n.get(n.size()-1)},kn.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof Dn?n+=this.size(s):s instanceof mi&&(n+=1)}return n}},kn.prototype.removeItem=function(n,i){for(var s=null,u=n.getChildBoundables().iterator();u.hasNext();){var c=u.next();c instanceof mi&&c.getItem()===i&&(s=c)}return s!==null&&(n.getChildBoundables().remove(s),!0)},kn.prototype.itemsTree=function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new Q:n}if(arguments.length===1){for(var i=arguments[0],s=new Q,u=i.getChildBoundables().iterator();u.hasNext();){var c=u.next();if(c instanceof Dn){var m=this.itemsTree(c);m!==null&&s.add(m)}else c instanceof mi?s.add(c.getItem()):b.shouldNeverReachHere()}return s.size()<=0?null:s}},kn.prototype.insert=function(n,i){b.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new mi(n,i))},kn.prototype.boundablesAtLevel=function(){if(arguments.length===1){var n=arguments[0],i=new Q;return this.boundablesAtLevel(n,this._root,i),i}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];if(b.isTrue(s>-2),u.getLevel()===s)return c.add(u),null;for(var m=u.getChildBoundables().iterator();m.hasNext();){var E=m.next();E instanceof Dn?this.boundablesAtLevel(s,E,c):(b.isTrue(E instanceof mi),s===-1&&c.add(E))}return null}},kn.prototype.query=function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new Q;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i),i}if(arguments.length===2){var s=arguments[0],u=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,u)}else if(arguments.length===3){if(X(arguments[2],Co)&&arguments[0]instanceof Object&&arguments[1]instanceof Dn)for(var c=arguments[0],m=arguments[1],E=arguments[2],A=m.getChildBoundables(),U=0;U<A.size();U++){var $=A.get(U);this.getIntersectsOp().intersects($.getBounds(),c)&&($ instanceof Dn?this.query(c,$,E):$ instanceof mi?E.visitItem($.getItem()):b.shouldNeverReachHere())}else if(X(arguments[2],St)&&arguments[0]instanceof Object&&arguments[1]instanceof Dn)for(var ut=arguments[0],ht=arguments[1],At=arguments[2],Rt=ht.getChildBoundables(),kt=0;kt<Rt.size();kt++){var ee=Rt.get(kt);this.getIntersectsOp().intersects(ee.getBounds(),ut)&&(ee instanceof Dn?this.query(ut,ee,At):ee instanceof mi?At.add(ee.getItem()):b.shouldNeverReachHere())}}},kn.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},kn.prototype.getRoot=function(){return this.build(),this._root},kn.prototype.remove=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,i)}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=this.removeItem(u,c);if(m)return!0;for(var E=null,A=u.getChildBoundables().iterator();A.hasNext();){var U=A.next();if(this.getIntersectsOp().intersects(U.getBounds(),s)&&U instanceof Dn&&(m=this.remove(s,U,c))){E=U;break}}return E!==null&&E.getChildBoundables().isEmpty()&&u.getChildBoundables().remove(E),m}},kn.prototype.createHigherLevels=function(n,i){b.isTrue(!n.isEmpty());var s=this.createParentBoundables(n,i+1);return s.size()===1?s.get(0):this.createHigherLevels(s,i+1)},kn.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();if(s instanceof Dn){var u=this.depth(s);u>n&&(n=u)}}return n+1}},kn.prototype.createParentBoundables=function(n,i){b.isTrue(!n.isEmpty());var s=new Q;s.add(this.createNode(i));var u=new Q(n);gi.sort(u,this.getComparator());for(var c=u.iterator();c.hasNext();){var m=c.next();this.lastNode(s).getChildBoundables().size()===this.getNodeCapacity()&&s.add(this.createNode(i)),this.lastNode(s).addChildBoundable(m)}return s},kn.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},kn.prototype.interfaces_=function(){return[t]},kn.prototype.getClass=function(){return kn},kn.compareDoubles=function(n,i){return n>i?1:n<i?-1:0},Pl.IntersectsOp.get=function(){return N1},Pl.serialVersionUID.get=function(){return-3886435814360241e3},Pl.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(kn,Pl);var N1=function(){},pa=function(){};pa.prototype.distance=function(n,i){},pa.prototype.interfaces_=function(){return[]},pa.prototype.getClass=function(){return pa};var Qd=function(n){function i(u){u=u||i.DEFAULT_NODE_CAPACITY,n.call(this,u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return i.prototype.createParentBoundablesFromVerticalSlices=function(u,c){b.isTrue(u.length>0);for(var m=new Q,E=0;E<u.length;E++)m.addAll(this.createParentBoundablesFromVerticalSlice(u[E],c));return m},i.prototype.createNode=function(u){return new jd(u)},i.prototype.size=function(){return arguments.length===0?n.prototype.size.call(this):n.prototype.size.apply(this,arguments)},i.prototype.insert=function(){if(arguments.length!==2)return n.prototype.insert.apply(this,arguments);var u=arguments[0],c=arguments[1];if(u.isNull())return null;n.prototype.insert.call(this,u,c)},i.prototype.getIntersectsOp=function(){return i.intersectsOp},i.prototype.verticalSlices=function(u,c){for(var m=Math.trunc(Math.ceil(u.size()/c)),E=new Array(c).fill(null),A=u.iterator(),U=0;U<c;U++){E[U]=new Q;for(var $=0;A.hasNext()&&$<m;){var ut=A.next();E[U].add(ut),$++}}return E},i.prototype.query=function(){if(arguments.length===1){var u=arguments[0];return n.prototype.query.call(this,u)}if(arguments.length===2){var c=arguments[0],m=arguments[1];n.prototype.query.call(this,c,m)}else if(arguments.length===3){if(X(arguments[2],Co)&&arguments[0]instanceof Object&&arguments[1]instanceof Dn){var E=arguments[0],A=arguments[1],U=arguments[2];n.prototype.query.call(this,E,A,U)}else if(X(arguments[2],St)&&arguments[0]instanceof Object&&arguments[1]instanceof Dn){var $=arguments[0],ut=arguments[1],ht=arguments[2];n.prototype.query.call(this,$,ut,ht)}}},i.prototype.getComparator=function(){return i.yComparator},i.prototype.createParentBoundablesFromVerticalSlice=function(u,c){return n.prototype.createParentBoundables.call(this,u,c)},i.prototype.remove=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return n.prototype.remove.call(this,u,c)}return n.prototype.remove.apply(this,arguments)},i.prototype.depth=function(){return arguments.length===0?n.prototype.depth.call(this):n.prototype.depth.apply(this,arguments)},i.prototype.createParentBoundables=function(u,c){b.isTrue(!u.isEmpty());var m=Math.trunc(Math.ceil(u.size()/this.getNodeCapacity())),E=new Q(u);gi.sort(E,i.xComparator);var A=this.verticalSlices(E,Math.trunc(Math.ceil(Math.sqrt(m))));return this.createParentBoundablesFromVerticalSlices(A,c)},i.prototype.nearestNeighbour=function(){if(arguments.length===1){if(X(arguments[0],pa)){var u=arguments[0],c=new Pn(this.getRoot(),this.getRoot(),u);return this.nearestNeighbour(c)}if(arguments[0]instanceof Pn){var m=arguments[0];return this.nearestNeighbour(m,w.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&X(arguments[1],pa)){var E=arguments[0],A=arguments[1],U=new Pn(this.getRoot(),E.getRoot(),A);return this.nearestNeighbour(U)}if(arguments[0]instanceof Pn&&typeof arguments[1]=="number"){var $=arguments[0],ut=arguments[1],ht=null,At=new co;for(At.add($);!At.isEmpty()&&ut>0;){var Rt=At.poll(),kt=Rt.getDistance();if(kt>=ut)break;Rt.isLeaves()?(ut=kt,ht=Rt):Rt.expandToQueue(At,ut)}return[ht.getBoundable(0).getItem(),ht.getBoundable(1).getItem()]}}else if(arguments.length===3){var ee=arguments[0],on=arguments[1],Rn=arguments[2],dr=new mi(ee,on),Ji=new Pn(this.getRoot(),dr,Rn);return this.nearestNeighbour(Ji)[0]}},i.prototype.interfaces_=function(){return[Rs,t]},i.prototype.getClass=function(){return i},i.centreX=function(u){return i.avg(u.getMinX(),u.getMaxX())},i.avg=function(u,c){return(u+c)/2},i.centreY=function(u){return i.avg(u.getMinY(),u.getMaxY())},s.STRtreeNode.get=function(){return jd},s.serialVersionUID.get=function(){return 0x39920f7d5f261e0},s.xComparator.get=function(){return{interfaces_:function(){return[z]},compare:function(u,c){return n.compareDoubles(i.centreX(u.getBounds()),i.centreX(c.getBounds()))}}},s.yComparator.get=function(){return{interfaces_:function(){return[z]},compare:function(u,c){return n.compareDoubles(i.centreY(u.getBounds()),i.centreY(c.getBounds()))}}},s.intersectsOp.get=function(){return{interfaces_:function(){return[n.IntersectsOp]},intersects:function(u,c){return u.intersects(c)}}},s.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(i,s),i}(kn),jd=function(n){function i(){var s=arguments[0];n.call(this,s)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.computeBounds=function(){for(var s=null,u=this.getChildBoundables().iterator();u.hasNext();){var c=u.next();s===null?s=new Pt(c.getBounds()):s.expandToInclude(c.getBounds())}return s},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Dn),Mr=function(){};Mr.prototype.interfaces_=function(){return[]},Mr.prototype.getClass=function(){return Mr},Mr.relativeSign=function(n,i){return n<i?-1:n>i?1:0},Mr.compare=function(n,i,s){if(i.equals2D(s))return 0;var u=Mr.relativeSign(i.x,s.x),c=Mr.relativeSign(i.y,s.y);switch(n){case 0:return Mr.compareValue(u,c);case 1:return Mr.compareValue(c,u);case 2:return Mr.compareValue(c,-u);case 3:return Mr.compareValue(-u,c);case 4:return Mr.compareValue(-u,-c);case 5:return Mr.compareValue(-c,-u);case 6:return Mr.compareValue(-c,u);case 7:return Mr.compareValue(u,-c)}return b.shouldNeverReachHere("invalid octant value"),0},Mr.compareValue=function(n,i){return n<0?-1:n>0?1:i<0?-1:i>0?1:0};var Po=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._segString=n,this.coord=new L(i),this.segmentIndex=s,this._segmentOctant=u,this._isInterior=!i.equals2D(n.getCoordinate(s))};Po.prototype.getCoordinate=function(){return this.coord},Po.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex)},Po.prototype.compareTo=function(n){var i=n;return this.segmentIndex<i.segmentIndex?-1:this.segmentIndex>i.segmentIndex?1:this.coord.equals2D(i.coord)?0:Mr.compare(this._segmentOctant,this.coord,i.coord)},Po.prototype.isEndPoint=function(n){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===n},Po.prototype.isInterior=function(){return this._isInterior},Po.prototype.interfaces_=function(){return[F]},Po.prototype.getClass=function(){return Po};var ur=function(){this._nodeMap=new _,this._edge=null;var n=arguments[0];this._edge=n};ur.prototype.getSplitCoordinates=function(){var n=new Dt;this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next();this.addEdgeCoordinates(s,u,n),s=u}return n.toCoordinateArray()},ur.prototype.addCollapsedNodes=function(){var n=new Q;this.findCollapsesFromInsertedNodes(n),this.findCollapsesFromExistingVertices(n);for(var i=n.iterator();i.hasNext();){var s=i.next().intValue();this.add(this._edge.getCoordinate(s),s)}},ur.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},ur.prototype.findCollapsesFromExistingVertices=function(n){for(var i=0;i<this._edge.size()-2;i++){var s=this._edge.getCoordinate(i),u=this._edge.getCoordinate(i+2);s.equals2D(u)&&n.add(new et(i+1))}},ur.prototype.addEdgeCoordinates=function(n,i,s){var u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);s.add(new L(n.coord),!1);for(var m=n.segmentIndex+1;m<=i.segmentIndex;m++)s.add(this._edge.getCoordinate(m));c&&s.add(new L(i.coord))},ur.prototype.iterator=function(){return this._nodeMap.values().iterator()},ur.prototype.addSplitEdges=function(n){this.addEndpoints(),this.addCollapsedNodes();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next(),c=this.createSplitEdge(s,u);n.add(c),s=u}},ur.prototype.findCollapseIndex=function(n,i,s){if(!n.coord.equals2D(i.coord))return!1;var u=i.segmentIndex-n.segmentIndex;return i.isInterior()||u--,u===1&&(s[0]=n.segmentIndex+1,!0)},ur.prototype.findCollapsesFromInsertedNodes=function(n){for(var i=new Array(1).fill(null),s=this.iterator(),u=s.next();s.hasNext();){var c=s.next();this.findCollapseIndex(u,c,i)&&n.add(new et(i[0])),u=c}},ur.prototype.getEdge=function(){return this._edge},ur.prototype.addEndpoints=function(){var n=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(n),n)},ur.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);c||s--;var m=new Array(s).fill(null),E=0;m[E++]=new L(n.coord);for(var A=n.segmentIndex+1;A<=i.segmentIndex;A++)m[E++]=this._edge.getCoordinate(A);return c&&(m[E]=new L(i.coord)),new bn(m,this._edge.getData())},ur.prototype.add=function(n,i){var s=new Po(this._edge,n,i,this._edge.getSegmentOctant(i)),u=this._nodeMap.get(s);return u!==null?(b.isTrue(u.coord.equals2D(n),"Found equal nodes with different coordinates"),u):(this._nodeMap.put(s,s),s)},ur.prototype.checkSplitEdgesCorrectness=function(n){var i=this._edge.getCoordinates(),s=n.get(0).getCoordinate(0);if(!s.equals2D(i[0]))throw new J("bad split edge start point at "+s);var u=n.get(n.size()-1).getCoordinates(),c=u[u.length-1];if(!c.equals2D(i[i.length-1]))throw new J("bad split edge end point at "+c)},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur};var Ls=function(){};Ls.prototype.interfaces_=function(){return[]},Ls.prototype.getClass=function(){return Ls},Ls.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new C("Cannot compute the octant for point ( "+n+", "+i+" )");var s=Math.abs(n),u=Math.abs(i);return n>=0?i>=0?s>=u?0:1:s>=u?7:6:i>=0?s>=u?3:2:s>=u?4:5}if(arguments[0]instanceof L&&arguments[1]instanceof L){var c=arguments[0],m=arguments[1],E=m.x-c.x,A=m.y-c.y;if(E===0&&A===0)throw new C("Cannot compute the octant for two identical points "+c);return Ls.octant(E,A)}};var Vi=function(){};Vi.prototype.getCoordinates=function(){},Vi.prototype.size=function(){},Vi.prototype.getCoordinate=function(n){},Vi.prototype.isClosed=function(){},Vi.prototype.setData=function(n){},Vi.prototype.getData=function(){},Vi.prototype.interfaces_=function(){return[]},Vi.prototype.getClass=function(){return Vi};var Mu=function(){};Mu.prototype.addIntersection=function(n,i){},Mu.prototype.interfaces_=function(){return[Vi]},Mu.prototype.getClass=function(){return Mu};var bn=function(){this._nodeList=new ur(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};bn.prototype.getCoordinates=function(){return this._pts},bn.prototype.size=function(){return this._pts.length},bn.prototype.getCoordinate=function(n){return this._pts[n]},bn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},bn.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))},bn.prototype.setData=function(n){this._data=n},bn.prototype.safeOctant=function(n,i){return n.equals2D(i)?0:Ls.octant(n,i)},bn.prototype.getData=function(){return this._data},bn.prototype.addIntersection=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.addIntersectionNode(n,i)}else if(arguments.length===4){var s=arguments[0],u=arguments[1],c=arguments[3],m=new L(s.getIntersection(c));this.addIntersection(m,u)}},bn.prototype.toString=function(){return qt.toLineString(new he(this._pts))},bn.prototype.getNodeList=function(){return this._nodeList},bn.prototype.addIntersectionNode=function(n,i){var s=i,u=s+1;if(u<this._pts.length){var c=this._pts[u];n.equals2D(c)&&(s=u)}return this._nodeList.add(n,s)},bn.prototype.addIntersections=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++)this.addIntersection(n,i,s,u)},bn.prototype.interfaces_=function(){return[Mu]},bn.prototype.getClass=function(){return bn},bn.getNodedSubstrings=function(){if(arguments.length===1){var n=arguments[0],i=new Q;return bn.getNodedSubstrings(n,i),i}if(arguments.length===2)for(var s=arguments[0],u=arguments[1],c=s.iterator();c.hasNext();)c.next().getNodeList().addSplitEdges(u)};var $t=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new L,this.p1=new L;else if(arguments.length===1){var n=arguments[0];this.p0=new L(n.p0),this.p1=new L(n.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var i=arguments[0],s=arguments[1],u=arguments[2],c=arguments[3];this.p0=new L(i,s),this.p1=new L(u,c)}},tm={serialVersionUID:{configurable:!0}};$t.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},$t.prototype.orientationIndex=function(){if(arguments[0]instanceof $t){var n=arguments[0],i=B.orientationIndex(this.p0,this.p1,n.p0),s=B.orientationIndex(this.p0,this.p1,n.p1);return i>=0&&s>=0||i<=0&&s<=0?Math.max(i,s):0}if(arguments[0]instanceof L){var u=arguments[0];return B.orientationIndex(this.p0,this.p1,u)}},$t.prototype.toGeometry=function(n){return n.createLineString([this.p0,this.p1])},$t.prototype.isVertical=function(){return this.p0.x===this.p1.x},$t.prototype.equals=function(n){if(!(n instanceof $t))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},$t.prototype.intersection=function(n){var i=new Z;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null},$t.prototype.project=function(){if(arguments[0]instanceof L){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new L(n);var i=this.projectionFactor(n),s=new L;return s.x=this.p0.x+i*(this.p1.x-this.p0.x),s.y=this.p0.y+i*(this.p1.y-this.p0.y),s}if(arguments[0]instanceof $t){var u=arguments[0],c=this.projectionFactor(u.p0),m=this.projectionFactor(u.p1);if(c>=1&&m>=1||c<=0&&m<=0)return null;var E=this.project(u.p0);c<0&&(E=this.p0),c>1&&(E=this.p1);var A=this.project(u.p1);return m<0&&(A=this.p0),m>1&&(A=this.p1),new $t(E,A)}},$t.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},$t.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},$t.prototype.getCoordinate=function(n){return n===0?this.p0:this.p1},$t.prototype.distancePerpendicular=function(n){return B.distancePointLinePerpendicular(n,this.p0,this.p1)},$t.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},$t.prototype.midPoint=function(){return $t.midPoint(this.p0,this.p1)},$t.prototype.projectionFactor=function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var i=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,u=i*i+s*s;return u<=0?w.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*s)/u},$t.prototype.closestPoints=function(n){var i=this.intersection(n);if(i!==null)return[i,i];var s=new Array(2).fill(null),u=w.MAX_VALUE,c=null,m=this.closestPoint(n.p0);u=m.distance(n.p0),s[0]=m,s[1]=n.p0;var E=this.closestPoint(n.p1);(c=E.distance(n.p1))<u&&(u=c,s[0]=E,s[1]=n.p1);var A=n.closestPoint(this.p0);(c=A.distance(this.p0))<u&&(u=c,s[0]=this.p0,s[1]=A);var U=n.closestPoint(this.p1);return(c=U.distance(this.p1))<u&&(u=c,s[0]=this.p1,s[1]=U),s},$t.prototype.closestPoint=function(n){var i=this.projectionFactor(n);return i>0&&i<1?this.project(n):this.p0.distance(n)<this.p1.distance(n)?this.p0:this.p1},$t.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},$t.prototype.getLength=function(){return this.p0.distance(this.p1)},$t.prototype.compareTo=function(n){var i=n,s=this.p0.compareTo(i.p0);return s!==0?s:this.p1.compareTo(i.p1)},$t.prototype.reverse=function(){var n=this.p0;this.p0=this.p1,this.p1=n},$t.prototype.equalsTopo=function(n){return this.p0.equals(n.p0)&&(this.p1.equals(n.p1)||this.p0.equals(n.p1))&&this.p1.equals(n.p0)},$t.prototype.lineIntersection=function(n){try{return ne.intersection(this.p0,this.p1,n.p0,n.p1)}catch(i){if(!(i instanceof Wt))throw i}return null},$t.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},$t.prototype.pointAlongOffset=function(n,i){var s=this.p0.x+n*(this.p1.x-this.p0.x),u=this.p0.y+n*(this.p1.y-this.p0.y),c=this.p1.x-this.p0.x,m=this.p1.y-this.p0.y,E=Math.sqrt(c*c+m*m),A=0,U=0;if(i!==0){if(E<=0)throw new Error("Cannot compute offset from zero-length line segment");A=i*c/E,U=i*m/E}return new L(s-U,u+A)},$t.prototype.setCoordinates=function(){if(arguments.length===1){var n=arguments[0];this.setCoordinates(n.p0,n.p1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.p0.x=i.x,this.p0.y=i.y,this.p1.x=s.x,this.p1.y=s.y}},$t.prototype.segmentFraction=function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||w.isNaN(i))&&(i=1),i},$t.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},$t.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},$t.prototype.distance=function(){if(arguments[0]instanceof $t){var n=arguments[0];return B.distanceLineLine(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof L){var i=arguments[0];return B.distancePointLine(i,this.p0,this.p1)}},$t.prototype.pointAlong=function(n){var i=new L;return i.x=this.p0.x+n*(this.p1.x-this.p0.x),i.y=this.p0.y+n*(this.p1.y-this.p0.y),i},$t.prototype.hashCode=function(){var n=w.doubleToLongBits(this.p0.x);n^=31*w.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),s=w.doubleToLongBits(this.p1.x);return s^=31*w.doubleToLongBits(this.p1.y),i^(Math.trunc(s)^Math.trunc(s>>32))},$t.prototype.interfaces_=function(){return[F,t]},$t.prototype.getClass=function(){return $t},$t.midPoint=function(n,i){return new L((n.x+i.x)/2,(n.y+i.y)/2)},tm.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties($t,tm);var wu=function(){this.tempEnv1=new Pt,this.tempEnv2=new Pt,this._overlapSeg1=new $t,this._overlapSeg2=new $t};wu.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];n.getLineSegment(i,this._overlapSeg1),s.getLineSegment(u,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},wu.prototype.interfaces_=function(){return[]},wu.prototype.getClass=function(){return wu};var Dr=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._pts=n,this._start=i,this._end=s,this._context=u};Dr.prototype.getLineSegment=function(n,i){i.p0=this._pts[n],i.p1=this._pts[n+1]},Dr.prototype.computeSelect=function(n,i,s,u){var c=this._pts[i],m=this._pts[s];if(u.tempEnv1.init(c,m),s-i==1)return u.select(this,i),null;if(!n.intersects(u.tempEnv1))return null;var E=Math.trunc((i+s)/2);i<E&&this.computeSelect(n,i,E,u),E<s&&this.computeSelect(n,E,s,u)},Dr.prototype.getCoordinates=function(){for(var n=new Array(this._end-this._start+1).fill(null),i=0,s=this._start;s<=this._end;s++)n[i++]=this._pts[s];return n},Dr.prototype.computeOverlaps=function(n,i){this.computeOverlapsInternal(this._start,this._end,n,n._start,n._end,i)},Dr.prototype.setId=function(n){this._id=n},Dr.prototype.select=function(n,i){this.computeSelect(n,this._start,this._end,i)},Dr.prototype.getEnvelope=function(){if(this._env===null){var n=this._pts[this._start],i=this._pts[this._end];this._env=new Pt(n,i)}return this._env},Dr.prototype.getEndIndex=function(){return this._end},Dr.prototype.getStartIndex=function(){return this._start},Dr.prototype.getContext=function(){return this._context},Dr.prototype.getId=function(){return this._id},Dr.prototype.computeOverlapsInternal=function(n,i,s,u,c,m){var E=this._pts[n],A=this._pts[i],U=s._pts[u],$=s._pts[c];if(i-n==1&&c-u==1)return m.overlap(this,n,s,u),null;if(m.tempEnv1.init(E,A),m.tempEnv2.init(U,$),!m.tempEnv1.intersects(m.tempEnv2))return null;var ut=Math.trunc((n+i)/2),ht=Math.trunc((u+c)/2);n<ut&&(u<ht&&this.computeOverlapsInternal(n,ut,s,u,ht,m),ht<c&&this.computeOverlapsInternal(n,ut,s,ht,c,m)),ut<i&&(u<ht&&this.computeOverlapsInternal(ut,i,s,u,ht,m),ht<c&&this.computeOverlapsInternal(ut,i,s,ht,c,m))},Dr.prototype.interfaces_=function(){return[]},Dr.prototype.getClass=function(){return Dr};var Ci=function(){};Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci},Ci.getChainStartIndices=function(n){var i=0,s=new Q;s.add(new et(i));do{var u=Ci.findChainEnd(n,i);s.add(new et(u)),i=u}while(i<n.length-1);return Ci.toIntArray(s)},Ci.findChainEnd=function(n,i){for(var s=i;s<n.length-1&&n[s].equals2D(n[s+1]);)s++;if(s>=n.length-1)return n.length-1;for(var u=ln.quadrant(n[s],n[s+1]),c=i+1;c<n.length&&!(!n[c-1].equals2D(n[c])&&ln.quadrant(n[c-1],n[c])!==u);)c++;return c-1},Ci.getChains=function(){if(arguments.length===1){var n=arguments[0];return Ci.getChains(n,null)}if(arguments.length===2){for(var i=arguments[0],s=arguments[1],u=new Q,c=Ci.getChainStartIndices(i),m=0;m<c.length-1;m++){var E=new Dr(i,c[m],c[m+1],s);u.add(E)}return u}},Ci.toIntArray=function(n){for(var i=new Array(n.size()).fill(null),s=0;s<i.length;s++)i[s]=n.get(s).intValue();return i};var ts=function(){};ts.prototype.computeNodes=function(n){},ts.prototype.getNodedSubstrings=function(){},ts.prototype.interfaces_=function(){return[]},ts.prototype.getClass=function(){return ts};var Su=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setSegmentIntersector(n)}}};Su.prototype.setSegmentIntersector=function(n){this._segInt=n},Su.prototype.interfaces_=function(){return[ts]},Su.prototype.getClass=function(){return Su};var Af=function(n){function i(u){u?n.call(this,u):n.call(this),this._monoChains=new Q,this._index=new Qd,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={SegmentOverlapAction:{configurable:!0}};return i.prototype.getMonotoneChains=function(){return this._monoChains},i.prototype.getNodedSubstrings=function(){return bn.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(u){for(var c=Ci.getChains(u.getCoordinates(),u).iterator();c.hasNext();){var m=c.next();m.setId(this._idCounter++),this._index.insert(m.getEnvelope(),m),this._monoChains.add(m)}},i.prototype.computeNodes=function(u){this._nodedSegStrings=u;for(var c=u.iterator();c.hasNext();)this.add(c.next());this.intersectChains()},i.prototype.intersectChains=function(){for(var u=new em(this._segInt),c=this._monoChains.iterator();c.hasNext();)for(var m=c.next(),E=this._index.query(m.getEnvelope()).iterator();E.hasNext();){var A=E.next();if(A.getId()>m.getId()&&(m.computeOverlaps(A,u),this._nOverlaps++),this._segInt.isDone())return null}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.SegmentOverlapAction.get=function(){return em},Object.defineProperties(i,s),i}(Su),em=function(n){function i(){n.call(this),this._si=null;var s=arguments[0];this._si=s}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.overlap=function(){if(arguments.length!==4)return n.prototype.overlap.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2],m=arguments[3],E=s.getContext(),A=c.getContext();this._si.processIntersections(E,u,A,m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(wu),We=function n(){if(this._quadrantSegments=n.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=n.CAP_ROUND,this._joinStyle=n.JOIN_ROUND,this._mitreLimit=n.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=n.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setQuadrantSegments(i)}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.setQuadrantSegments(s),this.setEndCapStyle(u)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];this.setQuadrantSegments(c),this.setEndCapStyle(m),this.setJoinStyle(E),this.setMitreLimit(A)}}},fo={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};We.prototype.getEndCapStyle=function(){return this._endCapStyle},We.prototype.isSingleSided=function(){return this._isSingleSided},We.prototype.setQuadrantSegments=function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=We.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=We.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==We.JOIN_ROUND&&(this._quadrantSegments=We.DEFAULT_QUADRANT_SEGMENTS)},We.prototype.getJoinStyle=function(){return this._joinStyle},We.prototype.setJoinStyle=function(n){this._joinStyle=n},We.prototype.setSimplifyFactor=function(n){this._simplifyFactor=n<0?0:n},We.prototype.getSimplifyFactor=function(){return this._simplifyFactor},We.prototype.getQuadrantSegments=function(){return this._quadrantSegments},We.prototype.setEndCapStyle=function(n){this._endCapStyle=n},We.prototype.getMitreLimit=function(){return this._mitreLimit},We.prototype.setMitreLimit=function(n){this._mitreLimit=n},We.prototype.setSingleSided=function(n){this._isSingleSided=n},We.prototype.interfaces_=function(){return[]},We.prototype.getClass=function(){return We},We.bufferDistanceError=function(n){var i=Math.PI/2/n;return 1-Math.cos(i/2)},fo.CAP_ROUND.get=function(){return 1},fo.CAP_FLAT.get=function(){return 2},fo.CAP_SQUARE.get=function(){return 3},fo.JOIN_ROUND.get=function(){return 1},fo.JOIN_MITRE.get=function(){return 2},fo.JOIN_BEVEL.get=function(){return 3},fo.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},fo.DEFAULT_MITRE_LIMIT.get=function(){return 5},fo.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(We,fo);var wn=function(n){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=B.COUNTERCLOCKWISE,this._inputLine=n||null},bu={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};wn.prototype.isDeletable=function(n,i,s,u){var c=this._inputLine[n],m=this._inputLine[i],E=this._inputLine[s];return!!this.isConcave(c,m,E)&&!!this.isShallow(c,m,E,u)&&this.isShallowSampled(c,m,n,s,u)},wn.prototype.deleteShallowConcavities=function(){for(var n=1,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i),u=!1;s<this._inputLine.length;){var c=!1;this.isDeletable(n,i,s,this._distanceTol)&&(this._isDeleted[i]=wn.DELETE,c=!0,u=!0),n=c?s:i,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i)}return u},wn.prototype.isShallowConcavity=function(n,i,s,u){return B.computeOrientation(n,i,s)!==this._angleOrientation?!1:B.distancePointLine(i,n,s)<u},wn.prototype.isShallowSampled=function(n,i,s,u,c){var m=Math.trunc((u-s)/wn.NUM_PTS_TO_CHECK);m<=0&&(m=1);for(var E=s;E<u;E+=m)if(!this.isShallow(n,i,this._inputLine[E],c))return!1;return!0},wn.prototype.isConcave=function(n,i,s){var u=B.computeOrientation(n,i,s)===this._angleOrientation;return u},wn.prototype.simplify=function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=B.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},wn.prototype.findNextNonDeletedIndex=function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===wn.DELETE;)i++;return i},wn.prototype.isShallow=function(n,i,s,u){return B.distancePointLine(i,n,s)<u},wn.prototype.collapseLine=function(){for(var n=new Dt,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==wn.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()},wn.prototype.interfaces_=function(){return[]},wn.prototype.getClass=function(){return wn},wn.simplify=function(n,i){return new wn(n).simplify(i)},bu.INIT.get=function(){return 0},bu.DELETE.get=function(){return 1},bu.KEEP.get=function(){return 1},bu.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(wn,bu);var qr=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new Q},nm={COORDINATE_ARRAY_TYPE:{configurable:!0}};qr.prototype.getCoordinates=function(){return this._ptList.toArray(qr.COORDINATE_ARRAY_TYPE)},qr.prototype.setPrecisionModel=function(n){this._precisionModel=n},qr.prototype.addPt=function(n){var i=new L(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},qr.prototype.revere=function(){},qr.prototype.addPts=function(n,i){if(i)for(var s=0;s<n.length;s++)this.addPt(n[s]);else for(var u=n.length-1;u>=0;u--)this.addPt(n[u])},qr.prototype.isRedundant=function(n){if(this._ptList.size()<1)return!1;var i=this._ptList.get(this._ptList.size()-1);return n.distance(i)<this._minimimVertexDistance},qr.prototype.toString=function(){return new le().createLineString(this.getCoordinates()).toString()},qr.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var n=new L(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(n.equals(i))return null;this._ptList.add(n)},qr.prototype.setMinimumVertexDistance=function(n){this._minimimVertexDistance=n},qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr},nm.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(qr,nm);var me=function(){},Ns={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};me.prototype.interfaces_=function(){return[]},me.prototype.getClass=function(){return me},me.toDegrees=function(n){return 180*n/Math.PI},me.normalize=function(n){for(;n>Math.PI;)n-=me.PI_TIMES_2;for(;n<=-Math.PI;)n+=me.PI_TIMES_2;return n},me.angle=function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var i=arguments[0],s=arguments[1],u=s.x-i.x,c=s.y-i.y;return Math.atan2(c,u)}},me.isAcute=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)>0},me.isObtuse=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)<0},me.interiorAngle=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s);return Math.abs(c-u)},me.normalizePositive=function(n){if(n<0){for(;n<0;)n+=me.PI_TIMES_2;n>=me.PI_TIMES_2&&(n=0)}else{for(;n>=me.PI_TIMES_2;)n-=me.PI_TIMES_2;n<0&&(n=0)}return n},me.angleBetween=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s);return me.diff(u,c)},me.diff=function(n,i){var s=null;return(s=n<i?i-n:n-i)>Math.PI&&(s=2*Math.PI-s),s},me.toRadians=function(n){return n*Math.PI/180},me.getTurn=function(n,i){var s=Math.sin(i-n);return s>0?me.COUNTERCLOCKWISE:s<0?me.CLOCKWISE:me.NONE},me.angleBetweenOriented=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s)-u;return c<=-Math.PI?c+me.PI_TIMES_2:c>Math.PI?c-me.PI_TIMES_2:c},Ns.PI_TIMES_2.get=function(){return 2*Math.PI},Ns.PI_OVER_2.get=function(){return Math.PI/2},Ns.PI_OVER_4.get=function(){return Math.PI/4},Ns.COUNTERCLOCKWISE.get=function(){return B.COUNTERCLOCKWISE},Ns.CLOCKWISE.get=function(){return B.CLOCKWISE},Ns.NONE.get=function(){return B.COLLINEAR},Object.defineProperties(me,Ns);var pn=function n(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new $t,this._seg1=new $t,this._offset0=new $t,this._offset1=new $t,this._side=0,this._hasNarrowConcaveAngle=!1;var i=arguments[0],s=arguments[1],u=arguments[2];this._precisionModel=i,this._bufParams=s,this._li=new Z,this._filletAngleQuantum=Math.PI/2/s.getQuadrantSegments(),s.getQuadrantSegments()>=8&&s.getJoinStyle()===We.JOIN_ROUND&&(this._closingSegLengthFactor=n.MAX_CLOSING_SEG_LEN_FACTOR),this.init(u)},Tu={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};pn.prototype.addNextSegment=function(n,i){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var s=B.computeOrientation(this._s0,this._s1,this._s2),u=s===B.CLOCKWISE&&this._side===bt.LEFT||s===B.COUNTERCLOCKWISE&&this._side===bt.RIGHT;s===0?this.addCollinear(i):u?this.addOutsideTurn(s,i):this.addInsideTurn(s,i)},pn.prototype.addLineEndCap=function(n,i){var s=new $t(n,i),u=new $t;this.computeOffsetSegment(s,bt.LEFT,this._distance,u);var c=new $t;this.computeOffsetSegment(s,bt.RIGHT,this._distance,c);var m=i.x-n.x,E=i.y-n.y,A=Math.atan2(E,m);switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:this._segList.addPt(u.p1),this.addFilletArc(i,A+Math.PI/2,A-Math.PI/2,B.CLOCKWISE,this._distance),this._segList.addPt(c.p1);break;case We.CAP_FLAT:this._segList.addPt(u.p1),this._segList.addPt(c.p1);break;case We.CAP_SQUARE:var U=new L;U.x=Math.abs(this._distance)*Math.cos(A),U.y=Math.abs(this._distance)*Math.sin(A);var $=new L(u.p1.x+U.x,u.p1.y+U.y),ut=new L(c.p1.x+U.x,c.p1.y+U.y);this._segList.addPt($),this._segList.addPt(ut)}},pn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},pn.prototype.addMitreJoin=function(n,i,s,u){var c=!0,m=null;try{m=ne.intersection(i.p0,i.p1,s.p0,s.p1),(u<=0?1:m.distance(n)/Math.abs(u))>this._bufParams.getMitreLimit()&&(c=!1)}catch(E){if(!(E instanceof Wt))throw E;m=new L(0,0),c=!1}c?this._segList.addPt(m):this.addLimitedMitreJoin(i,s,u,this._bufParams.getMitreLimit())},pn.prototype.addFilletCorner=function(n,i,s,u,c){var m=i.x-n.x,E=i.y-n.y,A=Math.atan2(E,m),U=s.x-n.x,$=s.y-n.y,ut=Math.atan2($,U);u===B.CLOCKWISE?A<=ut&&(A+=2*Math.PI):A>=ut&&(A-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(n,A,ut,u,c),this._segList.addPt(s)},pn.prototype.addOutsideTurn=function(n,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*pn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===We.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===We.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(i&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))},pn.prototype.createSquare=function(n){this._segList.addPt(new L(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new L(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new L(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new L(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()},pn.prototype.addSegments=function(n,i){this._segList.addPts(n,i)},pn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},pn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},pn.prototype.initSideSegments=function(n,i,s){this._s1=n,this._s2=i,this._side=s,this._seg1.setCoordinates(n,i),this.computeOffsetSegment(this._seg1,s,this._distance,this._offset1)},pn.prototype.addLimitedMitreJoin=function(n,i,s,u){var c=this._seg0.p1,m=me.angle(c,this._seg0.p0),E=me.angleBetweenOriented(this._seg0.p0,c,this._seg1.p1)/2,A=me.normalize(m+E),U=me.normalize(A+Math.PI),$=u*s,ut=s-$*Math.abs(Math.sin(E)),ht=c.x+$*Math.cos(U),At=c.y+$*Math.sin(U),Rt=new L(ht,At),kt=new $t(c,Rt),ee=kt.pointAlongOffset(1,ut),on=kt.pointAlongOffset(1,-ut);this._side===bt.LEFT?(this._segList.addPt(ee),this._segList.addPt(on)):(this._segList.addPt(on),this._segList.addPt(ee))},pn.prototype.computeOffsetSegment=function(n,i,s,u){var c=i===bt.LEFT?1:-1,m=n.p1.x-n.p0.x,E=n.p1.y-n.p0.y,A=Math.sqrt(m*m+E*E),U=c*s*m/A,$=c*s*E/A;u.p0.x=n.p0.x-$,u.p0.y=n.p0.y+U,u.p1.x=n.p1.x-$,u.p1.y=n.p1.y+U},pn.prototype.addFilletArc=function(n,i,s,u,c){var m=u===B.CLOCKWISE?-1:1,E=Math.abs(i-s),A=Math.trunc(E/this._filletAngleQuantum+.5);if(A<1)return null;for(var U=E/A,$=0,ut=new L;$<E;){var ht=i+m*$;ut.x=n.x+c*Math.cos(ht),ut.y=n.y+c*Math.sin(ht),this._segList.addPt(ut),$+=U}},pn.prototype.addInsideTurn=function(n,i){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*pn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var s=new L((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(s);var u=new L((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(u)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},pn.prototype.createCircle=function(n){var i=new L(n.x+this._distance,n.y);this._segList.addPt(i),this.addFilletArc(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},pn.prototype.addBevelJoin=function(n,i){this._segList.addPt(n.p1),this._segList.addPt(i.p0)},pn.prototype.init=function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new qr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*pn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},pn.prototype.addCollinear=function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===We.JOIN_BEVEL||this._bufParams.getJoinStyle()===We.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,B.CLOCKWISE,this._distance))},pn.prototype.closeRing=function(){this._segList.closeRing()},pn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},pn.prototype.interfaces_=function(){return[]},pn.prototype.getClass=function(){return pn},Tu.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},Tu.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},Tu.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Tu.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(pn,Tu);var wr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i};wr.prototype.getOffsetCurve=function(n,i){if(this._distance=i,i===0)return null;var s=i<0,u=Math.abs(i),c=this.getSegGen(u);n.length<=1?this.computePointCurve(n[0],c):this.computeOffsetCurve(n,s,c);var m=c.getCoordinates();return s&&ft.reverse(m),m},wr.prototype.computeSingleSidedBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){s.addSegments(n,!0);var c=wn.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],bt.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{s.addSegments(n,!1);var A=wn.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var $=2;$<=U;$++)s.addNextSegment(A[$],!0)}s.addLastSegment(),s.closeRing()},wr.prototype.computeRingBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);i===bt.RIGHT&&(u=-u);var c=wn.simplify(n,u),m=c.length-1;s.initSideSegments(c[m-1],c[0],i);for(var E=1;E<=m;E++){var A=E!==1;s.addNextSegment(c[E],A)}s.closeRing()},wr.prototype.computeLineBufferCurve=function(n,i){var s=this.simplifyTolerance(this._distance),u=wn.simplify(n,s),c=u.length-1;i.initSideSegments(u[0],u[1],bt.LEFT);for(var m=2;m<=c;m++)i.addNextSegment(u[m],!0);i.addLastSegment(),i.addLineEndCap(u[c-1],u[c]);var E=wn.simplify(n,-s),A=E.length-1;i.initSideSegments(E[A],E[A-1],bt.LEFT);for(var U=A-2;U>=0;U--)i.addNextSegment(E[U],!0);i.addLastSegment(),i.addLineEndCap(E[1],E[0]),i.closeRing()},wr.prototype.computePointCurve=function(n,i){switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:i.createCircle(n);break;case We.CAP_SQUARE:i.createSquare(n)}},wr.prototype.getLineCurve=function(n,i){if(this._distance=i,i<0&&!this._bufParams.isSingleSided()||i===0)return null;var s=Math.abs(i),u=this.getSegGen(s);if(n.length<=1)this.computePointCurve(n[0],u);else if(this._bufParams.isSingleSided()){var c=i<0;this.computeSingleSidedBufferCurve(n,c,u)}else this.computeLineBufferCurve(n,u);return u.getCoordinates()},wr.prototype.getBufferParameters=function(){return this._bufParams},wr.prototype.simplifyTolerance=function(n){return n*this._bufParams.getSimplifyFactor()},wr.prototype.getRingCurve=function(n,i,s){if(this._distance=s,n.length<=2)return this.getLineCurve(n,s);if(s===0)return wr.copyCoordinates(n);var u=this.getSegGen(s);return this.computeRingBufferCurve(n,i,u),u.getCoordinates()},wr.prototype.computeOffsetCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){var c=wn.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],bt.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{var A=wn.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var $=2;$<=U;$++)s.addNextSegment(A[$],!0)}s.addLastSegment()},wr.prototype.getSegGen=function(n){return new pn(this._precisionModel,this._bufParams,n)},wr.prototype.interfaces_=function(){return[]},wr.prototype.getClass=function(){return wr},wr.copyCoordinates=function(n){for(var i=new Array(n.length).fill(null),s=0;s<i.length;s++)i[s]=new L(n[s]);return i};var Os=function(){this._subgraphs=null,this._seg=new $t,this._cga=new B;var n=arguments[0];this._subgraphs=n},rm={DepthSegment:{configurable:!0}};Os.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var n=arguments[0],i=new Q,s=this._subgraphs.iterator();s.hasNext();){var u=s.next(),c=u.getEnvelope();n.y<c.getMinY()||n.y>c.getMaxY()||this.findStabbedSegments(n,u.getDirectedEdges(),i)}return i}if(arguments.length===3){if(X(arguments[2],St)&&arguments[0]instanceof L&&arguments[1]instanceof Tf){for(var m=arguments[0],E=arguments[1],A=arguments[2],U=E.getEdge().getCoordinates(),$=0;$<U.length-1;$++)if(this._seg.p0=U[$],this._seg.p1=U[$+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<m.x)&&!(this._seg.isHorizontal()||m.y<this._seg.p0.y||m.y>this._seg.p1.y||B.computeOrientation(this._seg.p0,this._seg.p1,m)===B.RIGHT)){var ut=E.getDepth(bt.LEFT);this._seg.p0.equals(U[$])||(ut=E.getDepth(bt.RIGHT));var ht=new es(this._seg,ut);A.add(ht)}}else if(X(arguments[2],St)&&arguments[0]instanceof L&&X(arguments[1],St))for(var At=arguments[0],Rt=arguments[1],kt=arguments[2],ee=Rt.iterator();ee.hasNext();){var on=ee.next();on.isForward()&&this.findStabbedSegments(At,on,kt)}}},Os.prototype.getDepth=function(n){var i=this.findStabbedSegments(n);return i.size()===0?0:gi.min(i)._leftDepth},Os.prototype.interfaces_=function(){return[]},Os.prototype.getClass=function(){return Os},rm.DepthSegment.get=function(){return es},Object.defineProperties(Os,rm);var es=function(){this._upwardSeg=null,this._leftDepth=null;var n=arguments[0],i=arguments[1];this._upwardSeg=new $t(n),this._leftDepth=i};es.prototype.compareTo=function(n){var i=n;if(this._upwardSeg.minX()>=i._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=i._upwardSeg.minX())return-1;var s=this._upwardSeg.orientationIndex(i._upwardSeg);return s!==0||(s=-1*i._upwardSeg.orientationIndex(this._upwardSeg))!=0?s:this._upwardSeg.compareTo(i._upwardSeg)},es.prototype.compareX=function(n,i){var s=n.p0.compareTo(i.p0);return s!==0?s:n.p1.compareTo(i.p1)},es.prototype.toString=function(){return this._upwardSeg.toString()},es.prototype.interfaces_=function(){return[F]},es.prototype.getClass=function(){return es};var qe=function(n,i,s){this.p0=n||null,this.p1=i||null,this.p2=s||null};qe.prototype.area=function(){return qe.area(this.p0,this.p1,this.p2)},qe.prototype.signedArea=function(){return qe.signedArea(this.p0,this.p1,this.p2)},qe.prototype.interpolateZ=function(n){if(n===null)throw new C("Supplied point is null.");return qe.interpolateZ(n,this.p0,this.p1,this.p2)},qe.prototype.longestSideLength=function(){return qe.longestSideLength(this.p0,this.p1,this.p2)},qe.prototype.isAcute=function(){return qe.isAcute(this.p0,this.p1,this.p2)},qe.prototype.circumcentre=function(){return qe.circumcentre(this.p0,this.p1,this.p2)},qe.prototype.area3D=function(){return qe.area3D(this.p0,this.p1,this.p2)},qe.prototype.centroid=function(){return qe.centroid(this.p0,this.p1,this.p2)},qe.prototype.inCentre=function(){return qe.inCentre(this.p0,this.p1,this.p2)},qe.prototype.interfaces_=function(){return[]},qe.prototype.getClass=function(){return qe},qe.area=function(n,i,s){return Math.abs(((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2)},qe.signedArea=function(n,i,s){return((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2},qe.det=function(n,i,s,u){return n*u-i*s},qe.interpolateZ=function(n,i,s,u){var c=i.x,m=i.y,E=s.x-c,A=u.x-c,U=s.y-m,$=u.y-m,ut=E*$-A*U,ht=n.x-c,At=n.y-m,Rt=($*ht-A*At)/ut,kt=(-U*ht+E*At)/ut;return i.z+Rt*(s.z-i.z)+kt*(u.z-i.z)},qe.longestSideLength=function(n,i,s){var u=n.distance(i),c=i.distance(s),m=s.distance(n),E=u;return c>E&&(E=c),m>E&&(E=m),E},qe.isAcute=function(n,i,s){return!!me.isAcute(n,i,s)&&!!me.isAcute(i,s,n)&&!!me.isAcute(s,n,i)},qe.circumcentre=function(n,i,s){var u=s.x,c=s.y,m=n.x-u,E=n.y-c,A=i.x-u,U=i.y-c,$=2*qe.det(m,E,A,U),ut=qe.det(E,m*m+E*E,U,A*A+U*U),ht=qe.det(m,m*m+E*E,A,A*A+U*U);return new L(u-ut/$,c+ht/$)},qe.perpendicularBisector=function(n,i){var s=i.x-n.x,u=i.y-n.y,c=new ne(n.x+s/2,n.y+u/2,1),m=new ne(n.x-u+s/2,n.y+s+u/2,1);return new ne(c,m)},qe.angleBisector=function(n,i,s){var u=i.distance(n),c=u/(u+i.distance(s)),m=s.x-n.x,E=s.y-n.y;return new L(n.x+c*m,n.y+c*E)},qe.area3D=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=i.z-n.z,E=s.x-n.x,A=s.y-n.y,U=s.z-n.z,$=c*U-m*A,ut=m*E-u*U,ht=u*A-c*E,At=$*$+ut*ut+ht*ht,Rt=Math.sqrt(At)/2;return Rt},qe.centroid=function(n,i,s){var u=(n.x+i.x+s.x)/3,c=(n.y+i.y+s.y)/3;return new L(u,c)},qe.inCentre=function(n,i,s){var u=i.distance(s),c=n.distance(s),m=n.distance(i),E=u+c+m,A=(u*n.x+c*i.x+m*s.x)/E,U=(u*n.y+c*i.y+m*s.y)/E;return new L(A,U)};var oi=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Q;var n=arguments[0],i=arguments[1],s=arguments[2];this._inputGeom=n,this._distance=i,this._curveBuilder=s};oi.prototype.addPoint=function(n){if(this._distance<=0)return null;var i=n.getCoordinates(),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,k.EXTERIOR,k.INTERIOR)},oi.prototype.addPolygon=function(n){var i=this._distance,s=bt.LEFT;this._distance<0&&(i=-this._distance,s=bt.RIGHT);var u=n.getExteriorRing(),c=ft.removeRepeatedPoints(u.getCoordinates());if(this._distance<0&&this.isErodedCompletely(u,this._distance)||this._distance<=0&&c.length<3)return null;this.addPolygonRing(c,i,s,k.EXTERIOR,k.INTERIOR);for(var m=0;m<n.getNumInteriorRing();m++){var E=n.getInteriorRingN(m),A=ft.removeRepeatedPoints(E.getCoordinates());this._distance>0&&this.isErodedCompletely(E,-this._distance)||this.addPolygonRing(A,i,bt.opposite(s),k.INTERIOR,k.EXTERIOR)}},oi.prototype.isTriangleErodedCompletely=function(n,i){var s=new qe(n[0],n[1],n[2]),u=s.inCentre();return B.distancePointLine(u,s.p0,s.p1)<Math.abs(i)},oi.prototype.addLineString=function(n){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=ft.removeRepeatedPoints(n.getCoordinates()),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,k.EXTERIOR,k.INTERIOR)},oi.prototype.addCurve=function(n,i,s){if(n===null||n.length<2)return null;var u=new bn(n,new rn(0,k.BOUNDARY,i,s));this._curveList.add(u)},oi.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},oi.prototype.addPolygonRing=function(n,i,s,u,c){if(i===0&&n.length<sn.MINIMUM_VALID_SIZE)return null;var m=u,E=c;n.length>=sn.MINIMUM_VALID_SIZE&&B.isCCW(n)&&(m=c,E=u,s=bt.opposite(s));var A=this._curveBuilder.getRingCurve(n,s,i);this.addCurve(A,m,E)},oi.prototype.add=function(n){if(n.isEmpty())return null;n instanceof Vt?this.addPolygon(n):n instanceof Bt?this.addLineString(n):n instanceof jt?this.addPoint(n):n instanceof fe?this.addCollection(n):n instanceof H?this.addCollection(n):n instanceof un?this.addCollection(n):n instanceof Hn&&this.addCollection(n)},oi.prototype.isErodedCompletely=function(n,i){var s=n.getCoordinates();if(s.length<4)return i<0;if(s.length===4)return this.isTriangleErodedCompletely(s,i);var u=n.getEnvelopeInternal(),c=Math.min(u.getHeight(),u.getWidth());return i<0&&2*Math.abs(i)>c},oi.prototype.addCollection=function(n){for(var i=0;i<n.getNumGeometries();i++){var s=n.getGeometryN(i);this.add(s)}},oi.prototype.interfaces_=function(){return[]},oi.prototype.getClass=function(){return oi};var da=function(){};da.prototype.locate=function(n){},da.prototype.interfaces_=function(){return[]},da.prototype.getClass=function(){return da};var Hi=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var n=arguments[0];this._parent=n,this._atStart=!0,this._index=0,this._max=n.getNumGeometries()};Hi.prototype.next=function(){if(this._atStart)return this._atStart=!1,Hi.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new o;var n=this._parent.getGeometryN(this._index++);return n instanceof Hn?(this._subcollectionIterator=new Hi(n),this._subcollectionIterator.next()):n},Hi.prototype.remove=function(){throw new Error(this.getClass().getName())},Hi.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Hi.prototype.interfaces_=function(){return[Y]},Hi.prototype.getClass=function(){return Hi},Hi.isAtomic=function(n){return!(n instanceof Hn)};var Xr=function(){this._geom=null;var n=arguments[0];this._geom=n};Xr.prototype.locate=function(n){return Xr.locate(n,this._geom)},Xr.prototype.interfaces_=function(){return[da]},Xr.prototype.getClass=function(){return Xr},Xr.isPointInRing=function(n,i){return!!i.getEnvelopeInternal().intersects(n)&&B.isPointInRing(n,i.getCoordinates())},Xr.containsPointInPolygon=function(n,i){if(i.isEmpty())return!1;var s=i.getExteriorRing();if(!Xr.isPointInRing(n,s))return!1;for(var u=0;u<i.getNumInteriorRing();u++){var c=i.getInteriorRingN(u);if(Xr.isPointInRing(n,c))return!1}return!0},Xr.containsPoint=function(n,i){if(i instanceof Vt)return Xr.containsPointInPolygon(n,i);if(i instanceof Hn)for(var s=new Hi(i);s.hasNext();){var u=s.next();if(u!==i&&Xr.containsPoint(n,u))return!0}return!1},Xr.locate=function(n,i){return i.isEmpty()?k.EXTERIOR:Xr.containsPoint(n,i)?k.INTERIOR:k.EXTERIOR};var jn=function(){this._edgeMap=new _,this._edgeList=null,this._ptInAreaLocation=[k.NONE,k.NONE]};jn.prototype.getNextCW=function(n){this.getEdges();var i=this._edgeList.indexOf(n),s=i-1;return i===0&&(s=this._edgeList.size()-1),this._edgeList.get(s)},jn.prototype.propagateSideLabels=function(n){for(var i=k.NONE,s=this.iterator();s.hasNext();){var u=s.next().getLabel();u.isArea(n)&&u.getLocation(n,bt.LEFT)!==k.NONE&&(i=u.getLocation(n,bt.LEFT))}if(i===k.NONE)return null;for(var c=i,m=this.iterator();m.hasNext();){var E=m.next(),A=E.getLabel();if(A.getLocation(n,bt.ON)===k.NONE&&A.setLocation(n,bt.ON,c),A.isArea(n)){var U=A.getLocation(n,bt.LEFT),$=A.getLocation(n,bt.RIGHT);if($!==k.NONE){if($!==c)throw new lo("side location conflict",E.getCoordinate());U===k.NONE&&b.shouldNeverReachHere("found single null side (at "+E.getCoordinate()+")"),c=U}else b.isTrue(A.getLocation(n,bt.LEFT)===k.NONE,"found single null side"),A.setLocation(n,bt.RIGHT,c),A.setLocation(n,bt.LEFT,c)}}},jn.prototype.getCoordinate=function(){var n=this.iterator();return n.hasNext()?n.next().getCoordinate():null},jn.prototype.print=function(n){Nt.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(n)},jn.prototype.isAreaLabelsConsistent=function(n){return this.computeEdgeEndLabels(n.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},jn.prototype.checkAreaLabelsConsistent=function(n){var i=this.getEdges();if(i.size()<=0)return!0;var s=i.size()-1,u=i.get(s).getLabel().getLocation(n,bt.LEFT);b.isTrue(u!==k.NONE,"Found unlabelled area edge");for(var c=u,m=this.iterator();m.hasNext();){var E=m.next().getLabel();b.isTrue(E.isArea(n),"Found non-area edge");var A=E.getLocation(n,bt.LEFT),U=E.getLocation(n,bt.RIGHT);if(A===U||U!==c)return!1;c=A}return!0},jn.prototype.findIndex=function(n){this.iterator();for(var i=0;i<this._edgeList.size();i++)if(this._edgeList.get(i)===n)return i;return-1},jn.prototype.iterator=function(){return this.getEdges().iterator()},jn.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new Q(this._edgeMap.values())),this._edgeList},jn.prototype.getLocation=function(n,i,s){return this._ptInAreaLocation[n]===k.NONE&&(this._ptInAreaLocation[n]=Xr.locate(i,s[n].getGeometry())),this._ptInAreaLocation[n]},jn.prototype.toString=function(){var n=new pt;n.append("EdgeEndStar: "+this.getCoordinate()),n.append(\`
|
|
93
93
|
\`);for(var i=this.iterator();i.hasNext();){var s=i.next();n.append(s),n.append(\`
|
|
94
|
-
\`)}return n.toString()},jn.prototype.computeEdgeEndLabels=function(n){for(var i=this.iterator();i.hasNext();)i.next().computeLabel(n)},jn.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 u=s.next().getLabel(),c=0;c<2;c++)u.isLine(c)&&u.getLocation(c)===k.BOUNDARY&&(i[c]=!0);for(var m=this.iterator();m.hasNext();)for(var E=m.next(),A=E.getLabel(),U=0;U<2;U++)if(A.isAnyNull(U)){var $=k.NONE;if(i[U])$=k.EXTERIOR;else{var ut=E.getCoordinate();$=this.getLocation(U,ut,n)}A.setAllLocationsIfNull(U,$)}},jn.prototype.getDegree=function(){return this._edgeMap.size()},jn.prototype.insertEdgeEnd=function(n,i){this._edgeMap.put(n,i),this._edgeList=null},jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn};var O1=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,u=null,c=this._SCANNING_FOR_INCOMING,m=0;m<this._resultAreaEdgeList.size();m++){var E=this._resultAreaEdgeList.get(m),A=E.getSym();if(E.getLabel().isArea())switch(s===null&&E.isInResult()&&(s=E),c){case this._SCANNING_FOR_INCOMING:if(!A.isInResult())continue;u=A,c=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!E.isInResult())continue;u.setNext(E),c=this._SCANNING_FOR_INCOMING}}if(c===this._LINKING_TO_OUTGOING){if(s===null)throw new lo("no outgoing dirEdge found",this.getCoordinate());b.isTrue(s.isInResult(),"unable to link last incoming dirEdge"),u.setNext(s)}},i.prototype.insert=function(s){var u=s;this.insertEdgeEnd(u,u)},i.prototype.getRightmostEdge=function(){var s=this.getEdges(),u=s.size();if(u<1)return null;var c=s.get(0);if(u===1)return c;var m=s.get(u-1),E=c.getQuadrant(),A=m.getQuadrant();return ln.isNorthern(E)&&ln.isNorthern(A)?c:ln.isNorthern(E)||ln.isNorthern(A)?c.getDy()!==0?c:m.getDy()!==0?m:(b.shouldNeverReachHere("found two horizontal edges incident on node"),null):m},i.prototype.print=function(s){Nt.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var u=this.iterator();u.hasNext();){var c=u.next();s.print("out "),c.print(s),s.println(),s.print("in "),c.getSym().print(s),s.println()}},i.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new Q;for(var s=this.iterator();s.hasNext();){var u=s.next();(u.isInResult()||u.getSym().isInResult())&&this._resultAreaEdgeList.add(u)}return this._resultAreaEdgeList},i.prototype.updateLabelling=function(s){for(var u=this.iterator();u.hasNext();){var c=u.next().getLabel();c.setAllLocationsIfNull(0,s.getLocation(0)),c.setAllLocationsIfNull(1,s.getLocation(1))}},i.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var s=null,u=null,c=this._edgeList.size()-1;c>=0;c--){var m=this._edgeList.get(c),E=m.getSym();u===null&&(u=E),s!==null&&E.setNext(s),s=m}u.setNext(s)},i.prototype.computeDepths=function(){if(arguments.length===1){var s=arguments[0],u=this.findIndex(s),c=s.getDepth(bt.LEFT),m=s.getDepth(bt.RIGHT),E=this.computeDepths(u+1,this._edgeList.size(),c);if(this.computeDepths(0,u,E)!==m)throw new lo("depth mismatch at "+s.getCoordinate())}else if(arguments.length===3){for(var A=arguments[0],U=arguments[1],$=arguments[2],ut=A;ut<U;ut++){var ht=this._edgeList.get(ut);ht.setEdgeDepths(bt.RIGHT,$),$=ht.getDepth(bt.LEFT)}return $}},i.prototype.mergeSymLabels=function(){for(var s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().merge(u.getSym().getLabel())}},i.prototype.linkMinimalDirectedEdges=function(s){for(var u=null,c=null,m=this._SCANNING_FOR_INCOMING,E=this._resultAreaEdgeList.size()-1;E>=0;E--){var A=this._resultAreaEdgeList.get(E),U=A.getSym();switch(u===null&&A.getEdgeRing()===s&&(u=A),m){case this._SCANNING_FOR_INCOMING:if(U.getEdgeRing()!==s)continue;c=U,m=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(A.getEdgeRing()!==s)continue;c.setNextMin(A),m=this._SCANNING_FOR_INCOMING}}m===this._LINKING_TO_OUTGOING&&(b.isTrue(u!==null,"found null for first outgoing dirEdge"),b.isTrue(u.getEdgeRing()===s,"unable to link last incoming dirEdge"),c.setNextMin(u))},i.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var s=0,u=this.iterator();u.hasNext();)u.next().isInResult()&&s++;return s}if(arguments.length===1){for(var c=arguments[0],m=0,E=this.iterator();E.hasNext();)E.next().getEdgeRing()===c&&m++;return m}},i.prototype.getLabel=function(){return this._label},i.prototype.findCoveredLineEdges=function(){for(var s=k.NONE,u=this.iterator();u.hasNext();){var c=u.next(),m=c.getSym();if(!c.isLineEdge()){if(c.isInResult()){s=k.INTERIOR;break}if(m.isInResult()){s=k.EXTERIOR;break}}}if(s===k.NONE)return null;for(var E=s,A=this.iterator();A.hasNext();){var U=A.next(),$=U.getSym();U.isLineEdge()?U.getEdge().setCovered(E===k.INTERIOR):(U.isInResult()&&(E=k.EXTERIOR),$.isInResult()&&(E=k.INTERIOR))}},i.prototype.computeLabelling=function(s){n.prototype.computeLabelling.call(this,s),this._label=new rn(k.NONE);for(var u=this.iterator();u.hasNext();)for(var c=u.next().getEdge().getLabel(),m=0;m<2;m++){var E=c.getLocation(m);E!==k.INTERIOR&&E!==k.BOUNDARY||this._label.setLocation(m,k.INTERIOR)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(jn),im=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 Cl(s,new O1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(fa),Io=function n(){this._pts=null,this._orientation=null;var i=arguments[0];this._pts=i,this._orientation=n.orientation(i)};Io.prototype.compareTo=function(n){var i=n;return Io.compareOriented(this._pts,this._orientation,i._pts,i._orientation)},Io.prototype.interfaces_=function(){return[F]},Io.prototype.getClass=function(){return Io},Io.orientation=function(n){return ft.increasingDirection(n)===1},Io.compareOriented=function(n,i,s,u){for(var c=i?1:-1,m=u?1:-1,E=i?n.length:-1,A=u?s.length:-1,U=i?0:n.length-1,$=u?0:s.length-1;;){var ut=n[U].compareTo(s[$]);if(ut!==0)return ut;var ht=(U+=c)===E,At=($+=m)===A;if(ht&&!At)return-1;if(!ht&&At)return 1;if(ht&&At)return 0}};var yi=function(){this._edges=new Q,this._ocaMap=new _};yi.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 u=s.getCoordinates(),c=0;c<u.length;c++)c>0&&n.print(","),n.print(u[c].x+" "+u[c].y);n.println(")")}n.print(") ")},yi.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next())},yi.prototype.findEdgeIndex=function(n){for(var i=0;i<this._edges.size();i++)if(this._edges.get(i).equals(n))return i;return-1},yi.prototype.iterator=function(){return this._edges.iterator()},yi.prototype.getEdges=function(){return this._edges},yi.prototype.get=function(n){return this._edges.get(n)},yi.prototype.findEqualEdge=function(n){var i=new Io(n.getCoordinates());return this._ocaMap.get(i)},yi.prototype.add=function(n){this._edges.add(n);var i=new Io(n.getCoordinates());this._ocaMap.put(i,n)},yi.prototype.interfaces_=function(){return[]},yi.prototype.getClass=function(){return yi};var ns=function(){};ns.prototype.processIntersections=function(n,i,s,u){},ns.prototype.isDone=function(){},ns.prototype.interfaces_=function(){return[]},ns.prototype.getClass=function(){return ns};var Yr=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};Yr.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(Yr.isAdjacentSegments(i,u))return!0;if(n.isClosed()){var c=n.size()-1;if(i===0&&u===c||u===0&&i===c)return!0}}return!1},Yr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Yr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Yr.prototype.getLineIntersector=function(){return this._li},Yr.prototype.hasProperIntersection=function(){return this._hasProper},Yr.prototype.processIntersections=function(n,i,s,u){if(n===s&&i===u)return null;this.numTests++;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],A=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,A),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(n,i,s,u)||(this._hasIntersection=!0,n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Yr.prototype.hasIntersection=function(){return this._hasIntersection},Yr.prototype.isDone=function(){return!1},Yr.prototype.hasInteriorIntersection=function(){return this._hasInterior},Yr.prototype.interfaces_=function(){return[ns]},Yr.prototype.getClass=function(){return Yr},Yr.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var Pi=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var n=arguments[0],i=arguments[1],s=arguments[2];this.coord=new L(n),this.segmentIndex=i,this.dist=s};Pi.prototype.getSegmentIndex=function(){return this.segmentIndex},Pi.prototype.getCoordinate=function(){return this.coord},Pi.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex),n.println(" dist = "+this.dist)},Pi.prototype.compareTo=function(n){var i=n;return this.compare(i.segmentIndex,i.dist)},Pi.prototype.isEndPoint=function(n){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===n},Pi.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Pi.prototype.getDistance=function(){return this.dist},Pi.prototype.compare=function(n,i){return this.segmentIndex<n?-1:this.segmentIndex>n?1:this.dist<i?-1:this.dist>i?1:0},Pi.prototype.interfaces_=function(){return[F]},Pi.prototype.getClass=function(){return Pi};var Wi=function(){this._nodeMap=new _,this.edge=null;var n=arguments[0];this.edge=n};Wi.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},Wi.prototype.iterator=function(){return this._nodeMap.values().iterator()},Wi.prototype.addSplitEdges=function(n){this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next(),c=this.createSplitEdge(s,u);n.add(c),s=u}},Wi.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)},Wi.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,u=this.edge.pts[i.segmentIndex],c=i.dist>0||!i.coord.equals2D(u);c||s--;var m=new Array(s).fill(null),E=0;m[E++]=new L(n.coord);for(var A=n.segmentIndex+1;A<=i.segmentIndex;A++)m[E++]=this.edge.pts[A];return c&&(m[E]=i.coord),new Il(m,new rn(this.edge._label))},Wi.prototype.add=function(n,i,s){var u=new Pi(n,i,s),c=this._nodeMap.get(u);return c!==null?c:(this._nodeMap.put(u,u),u)},Wi.prototype.isIntersection=function(n){for(var i=this.iterator();i.hasNext();)if(i.next().coord.equals(n))return!0;return!1},Wi.prototype.interfaces_=function(){return[]},Wi.prototype.getClass=function(){return Wi};var rs=function(){};rs.prototype.getChainStartIndices=function(n){var i=0,s=new Q;s.add(new et(i));do{var u=this.findChainEnd(n,i);s.add(new et(u)),i=u}while(i<n.length-1);return rs.toIntArray(s)},rs.prototype.findChainEnd=function(n,i){for(var s=ln.quadrant(n[i],n[i+1]),u=i+1;u<n.length&&ln.quadrant(n[u-1],n[u])===s;)u++;return u-1},rs.prototype.interfaces_=function(){return[]},rs.prototype.getClass=function(){return rs},rs.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 ho=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new Pt,this.env2=new Pt;var n=arguments[0];this.e=n,this.pts=n.getCoordinates();var i=new rs;this.startIndex=i.getChainStartIndices(this.pts)};ho.prototype.getCoordinates=function(){return this.pts},ho.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},ho.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},ho.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this.computeIntersectsForChain(this.startIndex[n],this.startIndex[n+1],i,i.startIndex[s],i.startIndex[s+1],u)}else if(arguments.length===6){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3],U=arguments[4],$=arguments[5],ut=this.pts[c],ht=this.pts[m],At=E.pts[A],Rt=E.pts[U];if(m-c==1&&U-A==1)return $.addIntersections(this.e,c,E.e,A),null;if(this.env1.init(ut,ht),this.env2.init(At,Rt),!this.env1.intersects(this.env2))return null;var kt=Math.trunc((c+m)/2),ee=Math.trunc((A+U)/2);c<kt&&(A<ee&&this.computeIntersectsForChain(c,kt,E,A,ee,$),ee<U&&this.computeIntersectsForChain(c,kt,E,ee,U,$)),kt<m&&(A<ee&&this.computeIntersectsForChain(kt,m,E,A,ee,$),ee<U&&this.computeIntersectsForChain(kt,m,E,ee,U,$))}},ho.prototype.getStartIndexes=function(){return this.startIndex},ho.prototype.computeIntersects=function(n,i){for(var s=0;s<this.startIndex.length-1;s++)for(var u=0;u<n.startIndex.length-1;u++)this.computeIntersectsForChain(s,n,u,i)},ho.prototype.interfaces_=function(){return[]},ho.prototype.getClass=function(){return ho};var Wn=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},om={NULL_VALUE:{configurable:!0}};Wn.prototype.getDepth=function(n,i){return this._depth[n][i]},Wn.prototype.setDepth=function(n,i,s){this._depth[n][i]=s},Wn.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]!==Wn.NULL_VALUE)return!1;return!0}if(arguments.length===1){var s=arguments[0];return this._depth[s][1]===Wn.NULL_VALUE}if(arguments.length===2){var u=arguments[0],c=arguments[1];return this._depth[u][c]===Wn.NULL_VALUE}},Wn.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 u=0;this._depth[n][s]>i&&(u=1),this._depth[n][s]=u}}},Wn.prototype.getDelta=function(n){return this._depth[n][bt.RIGHT]-this._depth[n][bt.LEFT]},Wn.prototype.getLocation=function(n,i){return this._depth[n][i]<=0?k.EXTERIOR:k.INTERIOR},Wn.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Wn.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 u=n.getLocation(i,s);u!==k.EXTERIOR&&u!==k.INTERIOR||(this.isNull(i,s)?this._depth[i][s]=Wn.depthAtLocation(u):this._depth[i][s]+=Wn.depthAtLocation(u))}else if(arguments.length===3){var c=arguments[0],m=arguments[1];arguments[2]===k.INTERIOR&&this._depth[c][m]++}},Wn.prototype.interfaces_=function(){return[]},Wn.prototype.getClass=function(){return Wn},Wn.depthAtLocation=function(n){return n===k.EXTERIOR?0:n===k.INTERIOR?1:Wn.NULL_VALUE},om.NULL_VALUE.get=function(){return-1},Object.defineProperties(Wn,om);var Il=function(n){function i(){if(n.call(this),this.pts=null,this._env=null,this.eiList=new Wi(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Wn,this._depthDelta=0,arguments.length===1){var s=arguments[0];i.call(this,s,null)}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.pts=u,this._label=c}}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,rn.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 u=s;if(this.pts.length!==u.pts.length)return!1;for(var c=!0,m=!0,E=this.pts.length,A=0;A<this.pts.length;A++)if(this.pts[A].equals2D(u.pts[A])||(c=!1),this.pts[A].equals2D(u.pts[--E])||(m=!1),!c&&!m)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 u=0;u<this.pts.length;u++)u>0&&s.print(","),s.print(this.pts[u].x+" "+this.pts[u].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 u=this.pts.length-1;u>=0;u--)s.print(this.pts[u]+" ");s.println("")},i.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new ho(this)),this._mce},i.prototype.getEnvelope=function(){if(this._env===null){this._env=new Pt;for(var s=0;s<this.pts.length;s++)this._env.expandToInclude(this.pts[s])}return this._env},i.prototype.addIntersection=function(s,u,c,m){var E=new L(s.getIntersection(m)),A=u,U=s.getEdgeDistance(c,m),$=A+1;if($<this.pts.length){var ut=this.pts[$];E.equals2D(ut)&&(A=$,U=0)}this.eiList.add(E,A,U)},i.prototype.toString=function(){var s=new pt;s.append("edge "+this._name+": "),s.append("LINESTRING (");for(var u=0;u<this.pts.length;u++)u>0&&s.append(","),s.append(this.pts[u].x+" "+this.pts[u].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 u=0;u<this.pts.length;u++)if(!this.pts[u].equals2D(s.pts[u]))return!1;return!0},i.prototype.setDepthDelta=function(s){this._depthDelta=s},i.prototype.getEdgeIntersectionList=function(){return this.eiList},i.prototype.addIntersections=function(s,u,c){for(var m=0;m<s.getIntersectionNum();m++)this.addIntersection(s,u,c,m)},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],u=arguments[1];u.setAtLeastIfValid(s.getLocation(0,bt.ON),s.getLocation(1,bt.ON),1),s.isArea()&&(u.setAtLeastIfValid(s.getLocation(0,bt.LEFT),s.getLocation(1,bt.LEFT),2),u.setAtLeastIfValid(s.getLocation(0,bt.RIGHT),s.getLocation(1,bt.RIGHT),2))},i}(Wr),lr=function(n){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new yi,this._bufParams=n||null};lr.prototype.setWorkingPrecisionModel=function(n){this._workingPrecisionModel=n},lr.prototype.insertUniqueEdge=function(n){var i=this._edgeList.findEqualEdge(n);if(i!==null){var s=i.getLabel(),u=n.getLabel();i.isPointwiseEqual(n)||(u=new rn(n.getLabel())).flip(),s.merge(u);var c=lr.depthDelta(u),m=i.getDepthDelta()+c;i.setDepthDelta(m)}else this._edgeList.add(n),n.setDepthDelta(lr.depthDelta(n.getLabel()))},lr.prototype.buildSubgraphs=function(n,i){for(var s=new Q,u=n.iterator();u.hasNext();){var c=u.next(),m=c.getRightmostCoordinate(),E=new Os(s).getDepth(m);c.computeDepth(E),c.findResultEdges(),s.add(c),i.add(c.getDirectedEdges(),c.getNodes())}},lr.prototype.createSubgraphs=function(n){for(var i=new Q,s=n.getNodes().iterator();s.hasNext();){var u=s.next();if(!u.isVisited()){var c=new ar;c.create(u),i.add(c)}}return gi.sort(i,gi.reverseOrder()),i},lr.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},lr.prototype.getNoder=function(n){if(this._workingNoder!==null)return this._workingNoder;var i=new Af,s=new Z;return s.setPrecisionModel(n),i.setSegmentIntersector(new Yr(s)),i},lr.prototype.buffer=function(n,i){var s=this._workingPrecisionModel;s===null&&(s=n.getPrecisionModel()),this._geomFact=n.getFactory();var u=new wr(s,this._bufParams),c=new oi(n,i,u).getCurves();if(c.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(c,s),this._graph=new xn(new im),this._graph.addEdges(this._edgeList.getEdges());var m=this.createSubgraphs(this._graph),E=new Or(this._geomFact);this.buildSubgraphs(m,E);var A=E.getPolygons();return A.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(A)},lr.prototype.computeNodedEdges=function(n,i){var s=this.getNoder(i);s.computeNodes(n);for(var u=s.getNodedSubstrings().iterator();u.hasNext();){var c=u.next(),m=c.getCoordinates();if(m.length!==2||!m[0].equals2D(m[1])){var E=c.getData(),A=new Il(c.getCoordinates(),new rn(E));this.insertUniqueEdge(A)}}},lr.prototype.setNoder=function(n){this._workingNoder=n},lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr},lr.depthDelta=function(n){var i=n.getLocation(0,bt.LEFT),s=n.getLocation(0,bt.RIGHT);return i===k.INTERIOR&&s===k.EXTERIOR?1:i===k.EXTERIOR&&s===k.INTERIOR?-1:0},lr.convertSegStrings=function(n){for(var i=new le,s=new Q;n.hasNext();){var u=n.next(),c=i.createLineString(u.getCoordinates());s.add(c)}return i.buildGeometry(s)};var Ro=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],u=arguments[1],c=arguments[2],m=arguments[3];this._noder=s,this._scaleFactor=u,this._offsetX=c,this._offsetY=m,this._isScaled=!this.isIntegerPrecision()}};Ro.prototype.rescale=function(){if(X(arguments[0],Ot))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],u=0;u<s.length;u++)s[u].x=s[u].x/this._scaleFactor+this._offsetX,s[u].y=s[u].y/this._scaleFactor+this._offsetY;s.length===2&&s[0].equals2D(s[1])&&Nt.out.println(s)}},Ro.prototype.scale=function(){if(X(arguments[0],Ot)){for(var n=arguments[0],i=new Q,s=n.iterator();s.hasNext();){var u=s.next();i.add(new bn(this.scale(u.getCoordinates()),u.getData()))}return i}if(arguments[0]instanceof Array){for(var c=arguments[0],m=new Array(c.length).fill(null),E=0;E<c.length;E++)m[E]=new L(Math.round((c[E].x-this._offsetX)*this._scaleFactor),Math.round((c[E].y-this._offsetY)*this._scaleFactor),c[E].z);return ft.removeRepeatedPoints(m)}},Ro.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},Ro.prototype.getNodedSubstrings=function(){var n=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(n),n},Ro.prototype.computeNodes=function(n){var i=n;this._isScaled&&(i=this.scale(n)),this._noder.computeNodes(i)},Ro.prototype.interfaces_=function(){return[ts]},Ro.prototype.getClass=function(){return Ro};var Ii=function(){this._li=new Z,this._segStrings=null;var n=arguments[0];this._segStrings=n},sm={fact:{configurable:!0}};Ii.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],u=arguments[1].iterator();u.hasNext();)for(var c=u.next().getCoordinates(),m=1;m<c.length-1;m++)if(c[m].equals(s))throw new J("found endpt/interior pt intersection at index "+m+" :pt "+s)}},Ii.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 u=s.next();this.checkInteriorIntersections(i,u)}else if(arguments.length===2)for(var c=arguments[0],m=arguments[1],E=c.getCoordinates(),A=m.getCoordinates(),U=0;U<E.length-1;U++)for(var $=0;$<A.length-1;$++)this.checkInteriorIntersections(c,U,m,$);else if(arguments.length===4){var ut=arguments[0],ht=arguments[1],At=arguments[2],Rt=arguments[3];if(ut===At&&ht===Rt)return null;var kt=ut.getCoordinates()[ht],ee=ut.getCoordinates()[ht+1],on=At.getCoordinates()[Rt],Rn=At.getCoordinates()[Rt+1];if(this._li.computeIntersection(kt,ee,on,Rn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,kt,ee)||this.hasInteriorIntersection(this._li,on,Rn)))throw new J("found non-noded intersection at "+kt+"-"+ee+" and "+on+"-"+Rn)}},Ii.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},Ii.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(),u=0;u<s.length-2;u++)this.checkCollapse(s[u],s[u+1],s[u+2])},Ii.prototype.hasInteriorIntersection=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++){var c=n.getIntersection(u);if(!c.equals(i)&&!c.equals(s))return!0}return!1},Ii.prototype.checkCollapse=function(n,i,s){if(n.equals(s))throw new J("found non-noded collapse at "+Ii.fact.createLineString([n,i,s]))},Ii.prototype.interfaces_=function(){return[]},Ii.prototype.getClass=function(){return Ii},sm.fact.get=function(){return new le},Object.defineProperties(Ii,sm);var Sr=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 C("Scale factor must be non-zero");i!==1&&(this._pt=new L(this.scale(n.x),this.scale(n.y)),this._p0Scaled=new L,this._p1Scaled=new L),this.initCorners(this._pt)},am={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Sr.prototype.intersectsScaled=function(n,i){var s=Math.min(n.x,i.x),u=Math.max(n.x,i.x),c=Math.min(n.y,i.y),m=Math.max(n.y,i.y),E=this._maxx<s||this._minx>u||this._maxy<c||this._miny>m;if(E)return!1;var A=this.intersectsToleranceSquare(n,i);return b.isTrue(!(E&&A),"Found bad envelope test"),A},Sr.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 L(this._maxx,this._maxy),this._corner[1]=new L(this._minx,this._maxy),this._corner[2]=new L(this._minx,this._miny),this._corner[3]=new L(this._maxx,this._miny)},Sr.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))},Sr.prototype.scale=function(n){return Math.round(n*this._scaleFactor)},Sr.prototype.getCoordinate=function(){return this._originalPt},Sr.prototype.copyScaled=function(n,i){i.x=this.scale(n.x),i.y=this.scale(n.y)},Sr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var n=Sr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Pt(this._originalPt.x-n,this._originalPt.x+n,this._originalPt.y-n,this._originalPt.y+n)}return this._safeEnv},Sr.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())))},Sr.prototype.intersectsToleranceSquare=function(n,i){var s=!1,u=!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()&&(u=!0),this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!s||!u)||!!n.equals(this._pt)||!!i.equals(this._pt))))},Sr.prototype.addSnappedNode=function(n,i){var s=n.getCoordinate(i),u=n.getCoordinate(i+1);return!!this.intersects(s,u)&&(n.addIntersection(this.getCoordinate(),i),!0)},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr},am.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(Sr,am);var Au=function(){this.tempEnv1=new Pt,this.selectedSegment=new $t};Au.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)}}},Au.prototype.interfaces_=function(){return[]},Au.prototype.getClass=function(){return Au};var ma=function(){this._index=null;var n=arguments[0];this._index=n},um={HotPixelSnapAction:{configurable:!0}};ma.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],u=arguments[2],c=i.getSafeEnvelope(),m=new lm(i,s,u);return this._index.query(c,{interfaces_:function(){return[Co]},visitItem:function(E){E.select(c,m)}}),m.isNodeAdded()}},ma.prototype.interfaces_=function(){return[]},ma.prototype.getClass=function(){return ma},um.HotPixelSnapAction.get=function(){return lm},Object.defineProperties(ma,um);var lm=function(n){function i(){n.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var s=arguments[0],u=arguments[1],c=arguments[2];this._hotPixel=s,this._parentEdge=u,this._hotPixelVertexIndex=c}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],u=arguments[1],c=s.getContext();if(this._parentEdge!==null&&c===this._parentEdge&&u===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(c,u)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Au),Ds=function(){this._li=null,this._interiorIntersections=null;var n=arguments[0];this._li=n,this._interiorIntersections=new Q};Ds.prototype.processIntersections=function(n,i,s,u){if(n===s&&i===u)return null;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],A=s.getCoordinates()[u+1];if(this._li.computeIntersection(c,m,E,A),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var U=0;U<this._li.getIntersectionNum();U++)this._interiorIntersections.add(this._li.getIntersection(U));n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,1)}},Ds.prototype.isDone=function(){return!1},Ds.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Ds.prototype.interfaces_=function(){return[ns]},Ds.prototype.getClass=function(){return Ds};var qi=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 Z,this._li.setPrecisionModel(n),this._scaleFactor=n.getScale()};qi.prototype.checkCorrectness=function(n){var i=bn.getNodedSubstrings(n),s=new Ii(i);try{s.checkValid()}catch(u){if(!(u instanceof Yt))throw u;u.printStackTrace()}},qi.prototype.getNodedSubstrings=function(){return bn.getNodedSubstrings(this._nodedSegStrings)},qi.prototype.snapRound=function(n,i){var s=this.findInteriorIntersections(n,i);this.computeIntersectionSnaps(s),this.computeVertexSnaps(n)},qi.prototype.findInteriorIntersections=function(n,i){var s=new Ds(i);return this._noder.setSegmentIntersector(s),this._noder.computeNodes(n),s.getInteriorIntersections()},qi.prototype.computeVertexSnaps=function(){if(X(arguments[0],Ot))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.computeVertexSnaps(i)}else if(arguments[0]instanceof bn)for(var s=arguments[0],u=s.getCoordinates(),c=0;c<u.length;c++){var m=new Sr(u[c],this._scaleFactor,this._li);this._pointSnapper.snap(m,s,c)&&s.addIntersection(u[c],c)}},qi.prototype.computeNodes=function(n){this._nodedSegStrings=n,this._noder=new Af,this._pointSnapper=new ma(this._noder.getIndex()),this.snapRound(n,this._li)},qi.prototype.computeIntersectionSnaps=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),u=new Sr(s,this._scaleFactor,this._li);this._pointSnapper.snap(u)}},qi.prototype.interfaces_=function(){return[ts]},qi.prototype.getClass=function(){return qi};var qn=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new We,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}},ga={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};qn.prototype.bufferFixedPrecision=function(n){var i=new Ro(new qi(new ie(1)),n.getScale()),s=new lr(this._bufParams);s.setWorkingPrecisionModel(n),s.setNoder(i),this._resultGeometry=s.buffer(this._argGeom,this._distance)},qn.prototype.bufferReducedPrecision=function(){var n=this;if(arguments.length===0){for(var i=qn.MAX_PRECISION_DIGITS;i>=0;i--){try{n.bufferReducedPrecision(i)}catch(m){if(!(m instanceof lo))throw m;n._saveException=m}if(n._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var s=arguments[0],u=qn.precisionScaleFactor(this._argGeom,this._distance,s),c=new ie(u);this.bufferFixedPrecision(c)}},qn.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var n=this._argGeom.getFactory().getPrecisionModel();n.getType()===ie.FIXED?this.bufferFixedPrecision(n):this.bufferReducedPrecision()},qn.prototype.setQuadrantSegments=function(n){this._bufParams.setQuadrantSegments(n)},qn.prototype.bufferOriginalPrecision=function(){try{var n=new lr(this._bufParams);this._resultGeometry=n.buffer(this._argGeom,this._distance)}catch(i){if(!(i instanceof J))throw i;this._saveException=i}},qn.prototype.getResultGeometry=function(n){return this._distance=n,this.computeGeometry(),this._resultGeometry},qn.prototype.setEndCapStyle=function(n){this._bufParams.setEndCapStyle(n)},qn.prototype.interfaces_=function(){return[]},qn.prototype.getClass=function(){return qn},qn.bufferOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new qn(n).getResultGeometry(i)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof j&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1],c=arguments[2],m=new qn(s);return m.setQuadrantSegments(c),m.getResultGeometry(u)}if(arguments[2]instanceof We&&arguments[0]instanceof j&&typeof arguments[1]=="number"){var E=arguments[0],A=arguments[1],U=arguments[2];return new qn(E,U).getResultGeometry(A)}}else if(arguments.length===4){var $=arguments[0],ut=arguments[1],ht=arguments[2],At=arguments[3],Rt=new qn($);return Rt.setQuadrantSegments(ht),Rt.setEndCapStyle(At),Rt.getResultGeometry(ut)}},qn.precisionScaleFactor=function(n,i,s){var u=n.getEnvelopeInternal(),c=it.max(Math.abs(u.getMaxX()),Math.abs(u.getMaxY()),Math.abs(u.getMinX()),Math.abs(u.getMinY()))+2*(i>0?i:0),m=s-Math.trunc(Math.log(c)/Math.log(10)+1);return Math.pow(10,m)},ga.CAP_ROUND.get=function(){return We.CAP_ROUND},ga.CAP_BUTT.get=function(){return We.CAP_FLAT},ga.CAP_FLAT.get=function(){return We.CAP_FLAT},ga.CAP_SQUARE.get=function(){return We.CAP_SQUARE},ga.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(qn,ga);var cr=function(){this._pt=[new L,new L],this._distance=w.NaN,this._isNull=!0};cr.prototype.getCoordinates=function(){return this._pt},cr.prototype.getCoordinate=function(n){return this._pt[n]},cr.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 u=i.distance(s);u<this._distance&&this.initialize(i,s,u)}},cr.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],u=arguments[1],c=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(u),this._distance=c,this._isNull=!1}},cr.prototype.getDistance=function(){return this._distance},cr.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 u=i.distance(s);u>this._distance&&this.initialize(i,s,u)}},cr.prototype.interfaces_=function(){return[]},cr.prototype.getClass=function(){return cr};var Xi=function(){};Xi.prototype.interfaces_=function(){return[]},Xi.prototype.getClass=function(){return Xi},Xi.computeDistance=function(){if(arguments[2]instanceof cr&&arguments[0]instanceof Bt&&arguments[1]instanceof L)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=n.getCoordinates(),c=new $t,m=0;m<u.length-1;m++){c.setCoordinates(u[m],u[m+1]);var E=c.closestPoint(i);s.setMinimum(E,i)}else if(arguments[2]instanceof cr&&arguments[0]instanceof Vt&&arguments[1]instanceof L){var A=arguments[0],U=arguments[1],$=arguments[2];Xi.computeDistance(A.getExteriorRing(),U,$);for(var ut=0;ut<A.getNumInteriorRing();ut++)Xi.computeDistance(A.getInteriorRingN(ut),U,$)}else if(arguments[2]instanceof cr&&arguments[0]instanceof j&&arguments[1]instanceof L){var ht=arguments[0],At=arguments[1],Rt=arguments[2];if(ht instanceof Bt)Xi.computeDistance(ht,At,Rt);else if(ht instanceof Vt)Xi.computeDistance(ht,At,Rt);else if(ht instanceof Hn)for(var kt=ht,ee=0;ee<kt.getNumGeometries();ee++){var on=kt.getGeometryN(ee);Xi.computeDistance(on,At,Rt)}else Rt.setMinimum(ht.getCoordinate(),At)}else if(arguments[2]instanceof cr&&arguments[0]instanceof $t&&arguments[1]instanceof L){var Rn=arguments[0],dr=arguments[1],Ji=arguments[2],Bo=Rn.closestPoint(dr);Ji.setMinimum(Bo,dr)}};var is=function(n){this._maxPtDist=new cr,this._inputGeom=n||null},Cf={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};is.prototype.computeMaxMidpointDistance=function(n){var i=new Lo(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},is.prototype.computeMaxVertexDistance=function(n){var i=new Fs(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},is.prototype.findDistance=function(n){return this.computeMaxVertexDistance(n),this.computeMaxMidpointDistance(n),this._maxPtDist.getDistance()},is.prototype.getDistancePoints=function(){return this._maxPtDist},is.prototype.interfaces_=function(){return[]},is.prototype.getClass=function(){return is},Cf.MaxPointDistanceFilter.get=function(){return Fs},Cf.MaxMidpointDistanceFilter.get=function(){return Lo},Object.defineProperties(is,Cf);var Fs=function(n){this._maxPtDist=new cr,this._minPtDist=new cr,this._geom=n||null};Fs.prototype.filter=function(n){this._minPtDist.initialize(),Xi.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Fs.prototype.getMaxPointDistance=function(){return this._maxPtDist},Fs.prototype.interfaces_=function(){return[Mt]},Fs.prototype.getClass=function(){return Fs};var Lo=function(n){this._maxPtDist=new cr,this._minPtDist=new cr,this._geom=n||null};Lo.prototype.filter=function(n,i){if(i===0)return null;var s=n.getCoordinate(i-1),u=n.getCoordinate(i),c=new L((s.x+u.x)/2,(s.y+u.y)/2);this._minPtDist.initialize(),Xi.computeDistance(this._geom,c,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Lo.prototype.isDone=function(){return!1},Lo.prototype.isGeometryChanged=function(){return!1},Lo.prototype.getMaxPointDistance=function(){return this._maxPtDist},Lo.prototype.interfaces_=function(){return[Hr]},Lo.prototype.getClass=function(){return Lo};var po=function(n){this._comps=n||null};po.prototype.filter=function(n){n instanceof Vt&&this._comps.add(n)},po.prototype.interfaces_=function(){return[ni]},po.prototype.getClass=function(){return po},po.getPolygons=function(){if(arguments.length===1){var n=arguments[0];return po.getPolygons(n,new Q)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof Vt?s.add(i):i instanceof Hn&&i.apply(new po(s)),s}};var Xn=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}};Xn.prototype.filter=function(n){if(this._isForcedToLineString&&n instanceof sn){var i=n.getFactory().createLineString(n.getCoordinateSequence());return this._lines.add(i),null}n instanceof Bt&&this._lines.add(n)},Xn.prototype.setForceToLineString=function(n){this._isForcedToLineString=n},Xn.prototype.interfaces_=function(){return[ct]},Xn.prototype.getClass=function(){return Xn},Xn.getGeometry=function(){if(arguments.length===1){var n=arguments[0];return n.getFactory().buildGeometry(Xn.getLines(n))}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().buildGeometry(Xn.getLines(i,s))}},Xn.getLines=function(){if(arguments.length===1){var n=arguments[0];return Xn.getLines(n,!1)}if(arguments.length===2){if(X(arguments[0],Ot)&&X(arguments[1],Ot)){for(var i=arguments[0],s=arguments[1],u=i.iterator();u.hasNext();){var c=u.next();Xn.getLines(c,s)}return s}if(arguments[0]instanceof j&&typeof arguments[1]=="boolean"){var m=arguments[0],E=arguments[1],A=new Q;return m.apply(new Xn(A,E)),A}if(arguments[0]instanceof j&&X(arguments[1],Ot)){var U=arguments[0],$=arguments[1];return U instanceof Bt?$.add(U):U.apply(new Xn($)),$}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&X(arguments[0],Ot)&&X(arguments[1],Ot)){for(var ut=arguments[0],ht=arguments[1],At=arguments[2],Rt=ut.iterator();Rt.hasNext();){var kt=Rt.next();Xn.getLines(kt,ht,At)}return ht}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof j&&X(arguments[1],Ot)){var ee=arguments[0],on=arguments[1],Rn=arguments[2];return ee.apply(new Xn(on,Rn)),on}}};var vi=function(){if(this._boundaryRule=Lt.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 C("Rule must be non-null");this._boundaryRule=n}}};vi.prototype.locateInternal=function(){if(arguments[0]instanceof L&&arguments[1]instanceof Vt){var n=arguments[0],i=arguments[1];if(i.isEmpty())return k.EXTERIOR;var s=i.getExteriorRing(),u=this.locateInPolygonRing(n,s);if(u===k.EXTERIOR)return k.EXTERIOR;if(u===k.BOUNDARY)return k.BOUNDARY;for(var c=0;c<i.getNumInteriorRing();c++){var m=i.getInteriorRingN(c),E=this.locateInPolygonRing(n,m);if(E===k.INTERIOR)return k.EXTERIOR;if(E===k.BOUNDARY)return k.BOUNDARY}return k.INTERIOR}if(arguments[0]instanceof L&&arguments[1]instanceof Bt){var A=arguments[0],U=arguments[1];if(!U.getEnvelopeInternal().intersects(A))return k.EXTERIOR;var $=U.getCoordinates();return U.isClosed()||!A.equals($[0])&&!A.equals($[$.length-1])?B.isOnLine(A,$)?k.INTERIOR:k.EXTERIOR:k.BOUNDARY}if(arguments[0]instanceof L&&arguments[1]instanceof jt){var ut=arguments[0];return arguments[1].getCoordinate().equals2D(ut)?k.INTERIOR:k.EXTERIOR}},vi.prototype.locateInPolygonRing=function(n,i){return i.getEnvelopeInternal().intersects(n)?B.locatePointInRing(n,i.getCoordinates()):k.EXTERIOR},vi.prototype.intersects=function(n,i){return this.locate(n,i)!==k.EXTERIOR},vi.prototype.updateLocationInfo=function(n){n===k.INTERIOR&&(this._isIn=!0),n===k.BOUNDARY&&this._numBoundaries++},vi.prototype.computeLocation=function(n,i){if(i instanceof jt&&this.updateLocationInfo(this.locateInternal(n,i)),i instanceof Bt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof Vt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof H)for(var s=i,u=0;u<s.getNumGeometries();u++){var c=s.getGeometryN(u);this.updateLocationInfo(this.locateInternal(n,c))}else if(i instanceof un)for(var m=i,E=0;E<m.getNumGeometries();E++){var A=m.getGeometryN(E);this.updateLocationInfo(this.locateInternal(n,A))}else if(i instanceof Hn)for(var U=new Hi(i);U.hasNext();){var $=U.next();$!==i&&this.computeLocation(n,$)}},vi.prototype.locate=function(n,i){return i.isEmpty()?k.EXTERIOR:i instanceof Bt?this.locateInternal(n,i):i instanceof Vt?this.locateInternal(n,i):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(n,i),this._boundaryRule.isInBoundary(this._numBoundaries)?k.BOUNDARY:this._numBoundaries>0||this._isIn?k.INTERIOR:k.EXTERIOR)},vi.prototype.interfaces_=function(){return[]},vi.prototype.getClass=function(){return vi};var fr=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 u=arguments[0],c=arguments[1],m=arguments[2];this._component=u,this._segIndex=c,this._pt=m}},cm={INSIDE_AREA:{configurable:!0}};fr.prototype.isInsideArea=function(){return this._segIndex===fr.INSIDE_AREA},fr.prototype.getCoordinate=function(){return this._pt},fr.prototype.getGeometryComponent=function(){return this._component},fr.prototype.getSegmentIndex=function(){return this._segIndex},fr.prototype.interfaces_=function(){return[]},fr.prototype.getClass=function(){return fr},cm.INSIDE_AREA.get=function(){return-1},Object.defineProperties(fr,cm);var No=function(n){this._pts=n||null};No.prototype.filter=function(n){n instanceof jt&&this._pts.add(n)},No.prototype.interfaces_=function(){return[ni]},No.prototype.getClass=function(){return No},No.getPoints=function(){if(arguments.length===1){var n=arguments[0];return n instanceof jt?gi.singletonList(n):No.getPoints(n,new Q)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof jt?s.add(i):i instanceof Hn&&i.apply(new No(s)),s}};var Us=function(){this._locations=null;var n=arguments[0];this._locations=n};Us.prototype.filter=function(n){(n instanceof jt||n instanceof Bt||n instanceof Vt)&&this._locations.add(new fr(n,0,n.getCoordinate()))},Us.prototype.interfaces_=function(){return[ni]},Us.prototype.getClass=function(){return Us},Us.getLocations=function(n){var i=new Q;return n.apply(new Us(i)),i};var Yn=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new vi,this._minDistanceLocation=null,this._minDistance=w.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],u=arguments[1],c=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=s,this._geom[1]=u,this._terminateDistance=c}};Yn.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],u=1-i,c=po.getPolygons(this._geom[i]);if(c.size()>0){var m=Us.getLocations(this._geom[u]);if(this.computeContainmentDistance(m,c,s),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[u]=s[0],this._minDistanceLocation[i]=s[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&X(arguments[0],St)&&X(arguments[1],St)){for(var E=arguments[0],A=arguments[1],U=arguments[2],$=0;$<E.size();$++)for(var ut=E.get($),ht=0;ht<A.size();ht++)if(this.computeContainmentDistance(ut,A.get(ht),U),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof fr&&arguments[1]instanceof Vt){var At=arguments[0],Rt=arguments[1],kt=arguments[2],ee=At.getCoordinate();if(k.EXTERIOR!==this._ptLocator.locate(ee,Rt))return this._minDistance=0,kt[0]=At,kt[1]=new fr(Rt,ee),null}}},Yn.prototype.computeMinDistanceLinesPoints=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m);if(this.computeMinDistance(c,E,s),this._minDistance<=this._terminateDistance)return null}},Yn.prototype.computeFacetDistance=function(){var n=new Array(2).fill(null),i=Xn.getLines(this._geom[0]),s=Xn.getLines(this._geom[1]),u=No.getPoints(this._geom[0]),c=No.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,c,n),this.updateMinDistance(n,!1),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistanceLinesPoints(s,u,n),this.updateMinDistance(n,!0),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistancePoints(u,c,n),void this.updateMinDistance(n,!1))))},Yn.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},Yn.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])},Yn.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},Yn.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 Bt&&arguments[1]instanceof jt){var n=arguments[0],i=arguments[1],s=arguments[2];if(n.getEnvelopeInternal().distance(i.getEnvelopeInternal())>this._minDistance)return null;for(var u=n.getCoordinates(),c=i.getCoordinate(),m=0;m<u.length-1;m++){var E=B.distancePointLine(c,u[m],u[m+1]);if(E<this._minDistance){this._minDistance=E;var A=new $t(u[m],u[m+1]).closestPoint(c);s[0]=new fr(n,m,A),s[1]=new fr(i,0,c)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Bt&&arguments[1]instanceof Bt){var U=arguments[0],$=arguments[1],ut=arguments[2];if(U.getEnvelopeInternal().distance($.getEnvelopeInternal())>this._minDistance)return null;for(var ht=U.getCoordinates(),At=$.getCoordinates(),Rt=0;Rt<ht.length-1;Rt++)for(var kt=0;kt<At.length-1;kt++){var ee=B.distanceLineLine(ht[Rt],ht[Rt+1],At[kt],At[kt+1]);if(ee<this._minDistance){this._minDistance=ee;var on=new $t(ht[Rt],ht[Rt+1]),Rn=new $t(At[kt],At[kt+1]),dr=on.closestPoints(Rn);ut[0]=new fr(U,Rt,dr[0]),ut[1]=new fr($,kt,dr[1])}if(this._minDistance<=this._terminateDistance)return null}}}},Yn.prototype.computeMinDistancePoints=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m),A=c.getCoordinate().distance(E.getCoordinate());if(A<this._minDistance&&(this._minDistance=A,s[0]=new fr(c,0,c.getCoordinate()),s[1]=new fr(E,0,E.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},Yn.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new C("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},Yn.prototype.computeMinDistanceLines=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m);if(this.computeMinDistance(c,E,s),this._minDistance<=this._terminateDistance)return null}},Yn.prototype.interfaces_=function(){return[]},Yn.prototype.getClass=function(){return Yn},Yn.distance=function(n,i){return new Yn(n,i).distance()},Yn.isWithinDistance=function(n,i,s){return new Yn(n,i,s).distance()<=s},Yn.nearestPoints=function(n,i){return new Yn(n,i).nearestPoints()};var tr=function(){this._pt=[new L,new L],this._distance=w.NaN,this._isNull=!0};tr.prototype.getCoordinates=function(){return this._pt},tr.prototype.getCoordinate=function(n){return this._pt[n]},tr.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 u=i.distance(s);u<this._distance&&this.initialize(i,s,u)}},tr.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],u=arguments[1],c=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(u),this._distance=c,this._isNull=!1}},tr.prototype.toString=function(){return qt.toLineString(this._pt[0],this._pt[1])},tr.prototype.getDistance=function(){return this._distance},tr.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 u=i.distance(s);u>this._distance&&this.initialize(i,s,u)}},tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr};var Ri=function(){};Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri},Ri.computeDistance=function(){if(arguments[2]instanceof tr&&arguments[0]instanceof Bt&&arguments[1]instanceof L)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=new $t,c=n.getCoordinates(),m=0;m<c.length-1;m++){u.setCoordinates(c[m],c[m+1]);var E=u.closestPoint(i);s.setMinimum(E,i)}else if(arguments[2]instanceof tr&&arguments[0]instanceof Vt&&arguments[1]instanceof L){var A=arguments[0],U=arguments[1],$=arguments[2];Ri.computeDistance(A.getExteriorRing(),U,$);for(var ut=0;ut<A.getNumInteriorRing();ut++)Ri.computeDistance(A.getInteriorRingN(ut),U,$)}else if(arguments[2]instanceof tr&&arguments[0]instanceof j&&arguments[1]instanceof L){var ht=arguments[0],At=arguments[1],Rt=arguments[2];if(ht instanceof Bt)Ri.computeDistance(ht,At,Rt);else if(ht instanceof Vt)Ri.computeDistance(ht,At,Rt);else if(ht instanceof Hn)for(var kt=ht,ee=0;ee<kt.getNumGeometries();ee++){var on=kt.getGeometryN(ee);Ri.computeDistance(on,At,Rt)}else Rt.setMinimum(ht.getCoordinate(),At)}else if(arguments[2]instanceof tr&&arguments[0]instanceof $t&&arguments[1]instanceof L){var Rn=arguments[0],dr=arguments[1],Ji=arguments[2],Bo=Rn.closestPoint(dr);Ji.setMinimum(Bo,dr)}};var si=function(){this._g0=null,this._g1=null,this._ptDist=new tr,this._densifyFrac=0;var n=arguments[0],i=arguments[1];this._g0=n,this._g1=i},Pf={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};si.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},si.prototype.setDensifyFraction=function(n){if(n>1||n<=0)throw new C("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=n},si.prototype.compute=function(n,i){this.computeOrientedDistance(n,i,this._ptDist),this.computeOrientedDistance(i,n,this._ptDist)},si.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},si.prototype.computeOrientedDistance=function(n,i,s){var u=new Bs(i);if(n.apply(u),s.setMaximum(u.getMaxPointDistance()),this._densifyFrac>0){var c=new Oo(i,this._densifyFrac);n.apply(c),s.setMaximum(c.getMaxPointDistance())}},si.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},si.prototype.interfaces_=function(){return[]},si.prototype.getClass=function(){return si},si.distance=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new si(n,i).distance()}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=new si(s,u);return m.setDensifyFraction(c),m.distance()}},Pf.MaxPointDistanceFilter.get=function(){return Bs},Pf.MaxDensifiedByFractionDistanceFilter.get=function(){return Oo},Object.defineProperties(si,Pf);var Bs=function(){this._maxPtDist=new tr,this._minPtDist=new tr,this._euclideanDist=new Ri,this._geom=null;var n=arguments[0];this._geom=n};Bs.prototype.filter=function(n){this._minPtDist.initialize(),Ri.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Bs.prototype.getMaxPointDistance=function(){return this._maxPtDist},Bs.prototype.interfaces_=function(){return[Mt]},Bs.prototype.getClass=function(){return Bs};var Oo=function(){this._maxPtDist=new tr,this._minPtDist=new tr,this._geom=null,this._numSubSegs=0;var n=arguments[0],i=arguments[1];this._geom=n,this._numSubSegs=Math.trunc(Math.round(1/i))};Oo.prototype.filter=function(n,i){if(i===0)return null;for(var s=n.getCoordinate(i-1),u=n.getCoordinate(i),c=(u.x-s.x)/this._numSubSegs,m=(u.y-s.y)/this._numSubSegs,E=0;E<this._numSubSegs;E++){var A=s.x+E*c,U=s.y+E*m,$=new L(A,U);this._minPtDist.initialize(),Ri.computeDistance(this._geom,$,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},Oo.prototype.isDone=function(){return!1},Oo.prototype.isGeometryChanged=function(){return!1},Oo.prototype.getMaxPointDistance=function(){return this._maxPtDist},Oo.prototype.interfaces_=function(){return[Hr]},Oo.prototype.getClass=function(){return Oo};var Fr=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},If={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Fr.prototype.checkMaximumDistance=function(n,i,s){var u=new si(i,n);if(u.setDensifyFraction(.25),this._maxDistanceFound=u.orientedDistance(),this._maxDistanceFound>s){this._isValid=!1;var c=u.getCoordinates();this._errorLocation=c[1],this._errorIndicator=n.getFactory().createLineString(c),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+qt.toLineString(c[0],c[1])+")"}},Fr.prototype.isValid=function(){var n=Math.abs(this._bufDistance),i=Fr.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(),Fr.VERBOSE&&Nt.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Fr.prototype.checkNegativeValid=function(){if(!(this._input instanceof Vt||this._input instanceof un||this._input instanceof Hn))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)},Fr.prototype.getErrorIndicator=function(){return this._errorIndicator},Fr.prototype.checkMinimumDistance=function(n,i,s){var u=new Yn(n,i,s);if(this._minDistanceFound=u.distance(),this._minDistanceFound<s){this._isValid=!1;var c=u.nearestPoints();this._errorLocation=u.nearestPoints()[1],this._errorIndicator=n.getFactory().createLineString(c),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+qt.toLineString(c[0],c[1])+" )"}},Fr.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)},Fr.prototype.getErrorLocation=function(){return this._errorLocation},Fr.prototype.getPolygonLines=function(n){for(var i=new Q,s=new Xn(i),u=po.getPolygons(n).iterator();u.hasNext();)u.next().apply(s);return n.getFactory().buildGeometry(i)},Fr.prototype.getErrorMessage=function(){return this._errMsg},Fr.prototype.interfaces_=function(){return[]},Fr.prototype.getClass=function(){return Fr},If.VERBOSE.get=function(){return!1},If.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Fr,If);var $n=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},Rf={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};$n.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},$n.prototype.checkEnvelope=function(){if(this._distance<0)return null;var n=this._distance*$n.MAX_ENV_DIFF_FRAC;n===0&&(n=.001);var i=new Pt(this._input.getEnvelopeInternal());i.expandBy(this._distance);var s=new Pt(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")},$n.prototype.checkDistance=function(){var n=new Fr(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")},$n.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")},$n.prototype.checkPolygonal=function(){this._result instanceof Vt||this._result instanceof un||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},$n.prototype.getErrorIndicator=function(){return this._errorIndicator},$n.prototype.getErrorLocation=function(){return this._errorLocation},$n.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"))},$n.prototype.report=function(n){if(!$n.VERBOSE)return null;Nt.out.println("Check "+n+": "+(this._isValid?"passed":"FAILED"))},$n.prototype.getErrorMessage=function(){return this._errorMsg},$n.prototype.interfaces_=function(){return[]},$n.prototype.getClass=function(){return $n},$n.isValidMsg=function(n,i,s){var u=new $n(n,i,s);return u.isValid()?null:u.getErrorMessage()},$n.isValid=function(n,i,s){return!!new $n(n,i,s).isValid()},Rf.VERBOSE.get=function(){return!1},Rf.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties($n,Rf);var Li=function(){this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};Li.prototype.getCoordinates=function(){return this._pts},Li.prototype.size=function(){return this._pts.length},Li.prototype.getCoordinate=function(n){return this._pts[n]},Li.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Li.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:Ls.octant(this.getCoordinate(n),this.getCoordinate(n+1))},Li.prototype.setData=function(n){this._data=n},Li.prototype.getData=function(){return this._data},Li.prototype.toString=function(){return qt.toLineString(new he(this._pts))},Li.prototype.interfaces_=function(){return[Vi]},Li.prototype.getClass=function(){return Li};var Gn=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new Q,this._intersectionCount=0,this._keepIntersections=!0;var n=arguments[0];this._li=n,this._interiorIntersection=null};Gn.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Gn.prototype.setCheckEndSegmentsOnly=function(n){this._isCheckEndSegmentsOnly=n},Gn.prototype.getIntersectionSegments=function(){return this._intSegments},Gn.prototype.count=function(){return this._intersectionCount},Gn.prototype.getIntersections=function(){return this._intersections},Gn.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},Gn.prototype.setKeepIntersections=function(n){this._keepIntersections=n},Gn.prototype.processIntersections=function(n,i,s,u){if(!this._findAllIntersections&&this.hasIntersection()||n===s&&i===u||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(n,i)||this.isEndSegment(s,u)))return null;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],A=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,A),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=c,this._intSegments[1]=m,this._intSegments[2]=E,this._intSegments[3]=A,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Gn.prototype.isEndSegment=function(n,i){return i===0||i>=n.size()-2},Gn.prototype.hasIntersection=function(){return this._interiorIntersection!==null},Gn.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},Gn.prototype.interfaces_=function(){return[ns]},Gn.prototype.getClass=function(){return Gn},Gn.createAllIntersectionsFinder=function(n){var i=new Gn(n);return i.setFindAllIntersections(!0),i},Gn.createAnyIntersectionFinder=function(n){return new Gn(n)},Gn.createIntersectionCounter=function(n){var i=new Gn(n);return i.setFindAllIntersections(!0),i.setKeepIntersections(!1),i};var _i=function(){this._li=new Z,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var n=arguments[0];this._segStrings=n};_i.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},_i.prototype.getIntersections=function(){return this._segInt.getIntersections()},_i.prototype.isValid=function(){return this.execute(),this._isValid},_i.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},_i.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Gn(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var n=new Af;if(n.setSegmentIntersector(this._segInt),n.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},_i.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new lo(this.getErrorMessage(),this._segInt.getInteriorIntersection())},_i.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var n=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+qt.toLineString(n[0],n[1])+" and "+qt.toLineString(n[2],n[3])},_i.prototype.interfaces_=function(){return[]},_i.prototype.getClass=function(){return _i},_i.computeIntersections=function(n){var i=new _i(n);return i.setFindAllIntersections(!0),i.isValid(),i.getIntersections()};var os=function n(){this._nv=null;var i=arguments[0];this._nv=new _i(n.toSegmentStrings(i))};os.prototype.checkValid=function(){this._nv.checkValid()},os.prototype.interfaces_=function(){return[]},os.prototype.getClass=function(){return os},os.toSegmentStrings=function(n){for(var i=new Q,s=n.iterator();s.hasNext();){var u=s.next();i.add(new Li(u.getCoordinates(),u))}return i},os.checkValid=function(n){new os(n).checkValid()};var zs=function(n){this._mapOp=n};zs.prototype.map=function(n){for(var i=new Q,s=0;s<n.getNumGeometries();s++){var u=this._mapOp.map(n.getGeometryN(s));u.isEmpty()||i.add(u)}return n.getFactory().createGeometryCollection(le.toGeometryArray(i))},zs.prototype.interfaces_=function(){return[]},zs.prototype.getClass=function(){return zs},zs.map=function(n,i){return new zs(i).map(n)};var Ni=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new Q,this._resultLineList=new Q;var n=arguments[0],i=arguments[1],s=arguments[2];this._op=n,this._geometryFactory=i,this._ptLocator=s};Ni.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)}},Ni.prototype.labelIsolatedLine=function(n,i){var s=this._ptLocator.locate(n.getCoordinate(),this._op.getArgGeometry(i));n.getLabel().setLocation(i,s)},Ni.prototype.build=function(n){return this.findCoveredLineEdges(),this.collectLines(n),this.buildLines(n),this._resultLineList},Ni.prototype.collectLineEdge=function(n,i,s){var u=n.getLabel(),c=n.getEdge();n.isLineEdge()&&(n.isVisited()||!ae.isResultOfOp(u,i)||c.isCovered()||(s.add(c),n.setVisitedEdge(!0)))},Ni.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(),u=s.getEdge();if(s.isLineEdge()&&!u.isCoveredSet()){var c=this._op.isCoveredByA(s.getCoordinate());u.setCovered(c)}}},Ni.prototype.labelIsolatedLines=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),u=s.getLabel();s.isIsolated()&&(u.isNull(0)?this.labelIsolatedLine(s,0):this.labelIsolatedLine(s,1))}},Ni.prototype.buildLines=function(n){for(var i=this._lineEdgesList.iterator();i.hasNext();){var s=i.next(),u=this._geometryFactory.createLineString(s.getCoordinates());this._resultLineList.add(u),s.setInResult(!0)}},Ni.prototype.collectBoundaryTouchEdge=function(n,i,s){var u=n.getLabel();return n.isLineEdge()||n.isVisited()||n.isInteriorAreaEdge()||n.getEdge().isInResult()?null:(b.isTrue(!(n.isInResult()||n.getSym().isInResult())||!n.getEdge().isInResult()),void(ae.isResultOfOp(u,i)&&i===ae.INTERSECTION&&(s.add(n.getEdge()),n.setVisitedEdge(!0))))},Ni.prototype.interfaces_=function(){return[]},Ni.prototype.getClass=function(){return Ni};var ks=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new Q;var n=arguments[0],i=arguments[1];this._op=n,this._geometryFactory=i};ks.prototype.filterCoveredNodeToPoint=function(n){var i=n.getCoordinate();if(!this._op.isCoveredByLA(i)){var s=this._geometryFactory.createPoint(i);this._resultPointList.add(s)}},ks.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 u=s.getLabel();ae.isResultOfOp(u,n)&&this.filterCoveredNodeToPoint(s)}}},ks.prototype.build=function(n){return this.extractNonCoveredResultNodes(n),this._resultPointList},ks.prototype.interfaces_=function(){return[]},ks.prototype.getClass=function(){return ks};var br=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};br.prototype.transformPoint=function(n,i){return this._factory.createPoint(this.transformCoordinates(n.getCoordinateSequence(),n))},br.prototype.transformPolygon=function(n,i){var s=!0,u=this.transformLinearRing(n.getExteriorRing(),n);u!==null&&u instanceof sn&&!u.isEmpty()||(s=!1);for(var c=new Q,m=0;m<n.getNumInteriorRing();m++){var E=this.transformLinearRing(n.getInteriorRingN(m),n);E===null||E.isEmpty()||(E instanceof sn||(s=!1),c.add(E))}if(s)return this._factory.createPolygon(u,c.toArray([]));var A=new Q;return u!==null&&A.add(u),A.addAll(c),this._factory.buildGeometry(A)},br.prototype.createCoordinateSequence=function(n){return this._factory.getCoordinateSequenceFactory().create(n)},br.prototype.getInputGeometry=function(){return this._inputGeom},br.prototype.transformMultiLineString=function(n,i){for(var s=new Q,u=0;u<n.getNumGeometries();u++){var c=this.transformLineString(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},br.prototype.transformCoordinates=function(n,i){return this.copy(n)},br.prototype.transformLineString=function(n,i){return this._factory.createLineString(this.transformCoordinates(n.getCoordinateSequence(),n))},br.prototype.transformMultiPoint=function(n,i){for(var s=new Q,u=0;u<n.getNumGeometries();u++){var c=this.transformPoint(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},br.prototype.transformMultiPolygon=function(n,i){for(var s=new Q,u=0;u<n.getNumGeometries();u++){var c=this.transformPolygon(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},br.prototype.copy=function(n){return n.copy()},br.prototype.transformGeometryCollection=function(n,i){for(var s=new Q,u=0;u<n.getNumGeometries();u++){var c=this.transform(n.getGeometryN(u));c!==null&&(this._pruneEmptyGeometry&&c.isEmpty()||s.add(c))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(le.toGeometryArray(s)):this._factory.buildGeometry(s)},br.prototype.transform=function(n){if(this._inputGeom=n,this._factory=n.getFactory(),n instanceof jt)return this.transformPoint(n,null);if(n instanceof fe)return this.transformMultiPoint(n,null);if(n instanceof sn)return this.transformLinearRing(n,null);if(n instanceof Bt)return this.transformLineString(n,null);if(n instanceof H)return this.transformMultiLineString(n,null);if(n instanceof Vt)return this.transformPolygon(n,null);if(n instanceof un)return this.transformMultiPolygon(n,null);if(n instanceof Hn)return this.transformGeometryCollection(n,null);throw new C("Unknown Geometry subtype: "+n.getClass().getName())},br.prototype.transformLinearRing=function(n,i){var s=this.transformCoordinates(n.getCoordinateSequence(),n);if(s===null)return this._factory.createLinearRing(null);var u=s.size();return u>0&&u<4&&!this._preserveType?this._factory.createLineString(s):this._factory.createLinearRing(s)},br.prototype.interfaces_=function(){return[]},br.prototype.getClass=function(){return br};var Yi=function n(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new $t,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Bt&&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 u=arguments[0],c=arguments[1];this._srcPts=u,this._isClosed=n.isClosed(u),this._snapTolerance=c}};Yi.prototype.snapVertices=function(n,i){for(var s=this._isClosed?n.size()-1:n.size(),u=0;u<s;u++){var c=n.get(u),m=this.findSnapForVertex(c,i);m!==null&&(n.set(u,new L(m)),u===0&&this._isClosed&&n.set(n.size()-1,new L(m)))}},Yi.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},Yi.prototype.snapTo=function(n){var i=new Dt(this._srcPts);return this.snapVertices(i,n),this.snapSegments(i,n),i.toCoordinateArray()},Yi.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 u=0;u<s;u++){var c=i[u],m=this.findSegmentIndexToSnap(c,n);m>=0&&n.add(m+1,new L(c),!1)}},Yi.prototype.findSegmentIndexToSnap=function(n,i){for(var s=w.MAX_VALUE,u=-1,c=0;c<i.size()-1;c++){if(this._seg.p0=i.get(c),this._seg.p1=i.get(c+1),this._seg.p0.equals2D(n)||this._seg.p1.equals2D(n)){if(this._allowSnappingToSourceVertices)continue;return-1}var m=this._seg.distance(n);m<this._snapTolerance&&m<s&&(s=m,u=c)}return u},Yi.prototype.setAllowSnappingToSourceVertices=function(n){this._allowSnappingToSourceVertices=n},Yi.prototype.interfaces_=function(){return[]},Yi.prototype.getClass=function(){return Yi},Yi.isClosed=function(n){return!(n.length<=1)&&n[0].equals2D(n[n.length-1])};var Tn=function(n){this._srcGeom=n||null},fm={SNAP_PRECISION_FACTOR:{configurable:!0}};Tn.prototype.snapTo=function(n,i){var s=this.extractTargetCoordinates(n);return new hm(i,s).transform(this._srcGeom)},Tn.prototype.snapToSelf=function(n,i){var s=this.extractTargetCoordinates(this._srcGeom),u=new hm(n,s,!0).transform(this._srcGeom),c=u;return i&&X(c,ce)&&(c=u.buffer(0)),c},Tn.prototype.computeSnapTolerance=function(n){return this.computeMinimumSegmentLength(n)/10},Tn.prototype.extractTargetCoordinates=function(n){for(var i=new M,s=n.getCoordinates(),u=0;u<s.length;u++)i.add(s[u]);return i.toArray(new Array(0).fill(null))},Tn.prototype.computeMinimumSegmentLength=function(n){for(var i=w.MAX_VALUE,s=0;s<n.length-1;s++){var u=n[s].distance(n[s+1]);u<i&&(i=u)}return i},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn},Tn.snap=function(n,i,s){var u=new Array(2).fill(null),c=new Tn(n);u[0]=c.snapTo(i,s);var m=new Tn(i);return u[1]=m.snapTo(u[0],s),u},Tn.computeOverlaySnapTolerance=function(){if(arguments.length===1){var n=arguments[0],i=Tn.computeSizeBasedSnapTolerance(n),s=n.getPrecisionModel();if(s.getType()===ie.FIXED){var u=1/s.getScale()*2/1.415;u>i&&(i=u)}return i}if(arguments.length===2){var c=arguments[0],m=arguments[1];return Math.min(Tn.computeOverlaySnapTolerance(c),Tn.computeOverlaySnapTolerance(m))}},Tn.computeSizeBasedSnapTolerance=function(n){var i=n.getEnvelopeInternal();return Math.min(i.getHeight(),i.getWidth())*Tn.SNAP_PRECISION_FACTOR},Tn.snapToSelf=function(n,i,s){return new Tn(n).snapToSelf(i,s)},fm.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Tn,fm);var hm=function(n){function i(s,u,c){n.call(this),this._snapTolerance=s||null,this._snapPts=u||null,this._isSelfSnap=c!==void 0&&c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.snapLine=function(s,u){var c=new Yi(s,this._snapTolerance);return c.setAllowSnappingToSourceVertices(this._isSelfSnap),c.snapTo(u)},i.prototype.transformCoordinates=function(s,u){var c=s.toCoordinateArray(),m=this.snapLine(c,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(br),hr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};hr.prototype.getCommon=function(){return w.longBitsToDouble(this._commonBits)},hr.prototype.add=function(n){var i=w.doubleToLongBits(n);if(this._isFirst)return this._commonBits=i,this._commonSignExp=hr.signExpBits(this._commonBits),this._isFirst=!1,null;if(hr.signExpBits(i)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=hr.numCommonMostSigMantissaBits(this._commonBits,i),this._commonBits=hr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},hr.prototype.toString=function(){if(arguments.length===1){var n=arguments[0],i=w.longBitsToDouble(n),s="0000000000000000000000000000000000000000000000000000000000000000"+w.toBinaryString(n),u=s.substring(s.length-64);return u.substring(0,1)+" "+u.substring(1,12)+"(exp) "+u.substring(12)+" [ "+i+" ]"}},hr.prototype.interfaces_=function(){return[]},hr.prototype.getClass=function(){return hr},hr.getBit=function(n,i){return n&1<<i?1:0},hr.signExpBits=function(n){return n>>52},hr.zeroLowerBits=function(n,i){return n&~((1<<i)-1)},hr.numCommonMostSigMantissaBits=function(n,i){for(var s=0,u=52;u>=0;u--){if(hr.getBit(n,u)!==hr.getBit(i,u))return s;s++}return 52};var Do=function(){this._commonCoord=null,this._ccFilter=new Gs},Lf={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Do.prototype.addCommonBits=function(n){var i=new Fo(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 L(this._commonCoord);i.x=-i.x,i.y=-i.y;var s=new Fo(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},Lf.CommonCoordinateFilter.get=function(){return Gs},Lf.Translater.get=function(){return Fo},Object.defineProperties(Do,Lf);var Gs=function(){this._commonBitsX=new hr,this._commonBitsY=new hr};Gs.prototype.filter=function(n){this._commonBitsX.add(n.x),this._commonBitsY.add(n.y)},Gs.prototype.getCommonCoordinate=function(){return new L(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Gs.prototype.interfaces_=function(){return[Mt]},Gs.prototype.getClass=function(){return Gs};var Fo=function(){this.trans=null;var n=arguments[0];this.trans=n};Fo.prototype.filter=function(n,i){var s=n.getOrdinate(i,0)+this.trans.x,u=n.getOrdinate(i,1)+this.trans.y;n.setOrdinate(i,0,s),n.setOrdinate(i,1,u)},Fo.prototype.isDone=function(){return!1},Fo.prototype.isGeometryChanged=function(){return!0},Fo.prototype.interfaces_=function(){return[Hr]},Fo.prototype.getClass=function(){return Fo};var Vn=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()};Vn.prototype.selfSnap=function(n){return new Tn(n).snapTo(n,this._snapTolerance)},Vn.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},Vn.prototype.prepareResult=function(n){return this._cbr.addCommonBits(n),n},Vn.prototype.getResultGeometry=function(n){var i=this.snap(this._geom),s=ae.overlayOp(i[0],i[1],n);return this.prepareResult(s)},Vn.prototype.checkValid=function(n){n.isValid()||Nt.out.println("Snapped geometry is invalid")},Vn.prototype.computeSnapTolerance=function(){this._snapTolerance=Tn.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Vn.prototype.snap=function(n){var i=this.removeCommonBits(n);return Tn.snap(i[0],i[1],this._snapTolerance)},Vn.prototype.interfaces_=function(){return[]},Vn.prototype.getClass=function(){return Vn},Vn.overlayOp=function(n,i,s){return new Vn(n,i).getResultGeometry(s)},Vn.union=function(n,i){return Vn.overlayOp(n,i,ae.UNION)},Vn.intersection=function(n,i){return Vn.overlayOp(n,i,ae.INTERSECTION)},Vn.symDifference=function(n,i){return Vn.overlayOp(n,i,ae.SYMDIFFERENCE)},Vn.difference=function(n,i){return Vn.overlayOp(n,i,ae.DIFFERENCE)};var pr=function(n,i){this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i};pr.prototype.getResultGeometry=function(n){var i=null,s=!1,u=null;try{i=ae.overlayOp(this._geom[0],this._geom[1],n),s=!0}catch(c){if(!(c instanceof J))throw c;u=c}if(!s)try{i=Vn.overlayOp(this._geom[0],this._geom[1],n)}catch(c){throw c instanceof J?u:c}return i},pr.prototype.interfaces_=function(){return[]},pr.prototype.getClass=function(){return pr},pr.overlayOp=function(n,i,s){return new pr(n,i).getResultGeometry(s)},pr.union=function(n,i){return pr.overlayOp(n,i,ae.UNION)},pr.intersection=function(n,i){return pr.overlayOp(n,i,ae.INTERSECTION)},pr.symDifference=function(n,i){return pr.overlayOp(n,i,ae.SYMDIFFERENCE)},pr.difference=function(n,i){return pr.overlayOp(n,i,ae.DIFFERENCE)};var Cu=function(){this.mce=null,this.chainIndex=null;var n=arguments[0],i=arguments[1];this.mce=n,this.chainIndex=i};Cu.prototype.computeIntersections=function(n,i){this.mce.computeIntersectsForChain(this.chainIndex,n.mce,n.chainIndex,i)},Cu.prototype.interfaces_=function(){return[]},Cu.prototype.getClass=function(){return Cu};var Ur=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 u=arguments[0],c=arguments[1],m=arguments[2];this._eventType=n.INSERT,this._label=u,this._xValue=c,this._obj=m}},Nf={INSERT:{configurable:!0},DELETE:{configurable:!0}};Ur.prototype.isDelete=function(){return this._eventType===Ur.DELETE},Ur.prototype.setDeleteEventIndex=function(n){this._deleteEventIndex=n},Ur.prototype.getObject=function(){return this._obj},Ur.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},Ur.prototype.getInsertEvent=function(){return this._insertEvent},Ur.prototype.isInsert=function(){return this._eventType===Ur.INSERT},Ur.prototype.isSameLabel=function(n){return this._label!==null&&this._label===n._label},Ur.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Ur.prototype.interfaces_=function(){return[F]},Ur.prototype.getClass=function(){return Ur},Nf.INSERT.get=function(){return 1},Nf.DELETE.get=function(){return 2},Object.defineProperties(Ur,Nf);var Rl=function(){};Rl.prototype.interfaces_=function(){return[]},Rl.prototype.getClass=function(){return Rl};var Zn=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};Zn.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(Zn.isAdjacentSegments(i,u))return!0;if(n.isClosed()){var c=n.getNumPoints()-1;if(i===0&&u===c||u===0&&i===c)return!0}}return!1},Zn.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Zn.prototype.setIsDoneIfProperInt=function(n){this._isDoneWhenProperInt=n},Zn.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Zn.prototype.isBoundaryPointInternal=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next().getCoordinate();if(n.isIntersection(u))return!0}return!1},Zn.prototype.hasProperIntersection=function(){return this._hasProper},Zn.prototype.hasIntersection=function(){return this._hasIntersection},Zn.prototype.isDone=function(){return this._isDone},Zn.prototype.isBoundaryPoint=function(n,i){return i!==null&&(!!this.isBoundaryPointInternal(n,i[0])||!!this.isBoundaryPointInternal(n,i[1]))},Zn.prototype.setBoundaryNodes=function(n,i){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=n,this._bdyNodes[1]=i},Zn.prototype.addIntersections=function(n,i,s,u){if(n===s&&i===u)return null;this.numTests++;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],A=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,A),this._li.hasIntersection()&&(this._recordIsolated&&(n.setIsolated(!1),s.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(n,i,s,u)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,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))))},Zn.prototype.interfaces_=function(){return[]},Zn.prototype.getClass=function(){return Zn},Zn.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var D1=function(n){function i(){n.call(this),this.events=new Q,this.nOverlaps=null}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.prepareEvents=function(){gi.sort(this.events);for(var s=0;s<this.events.size();s++){var u=this.events.get(s);u.isDelete()&&u.getInsertEvent().setDeleteEventIndex(s)}},i.prototype.computeIntersections=function(){if(arguments.length===1){var s=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var u=0;u<this.events.size();u++){var c=this.events.get(u);if(c.isInsert()&&this.processOverlaps(u,c.getDeleteEventIndex(),c,s),s.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof Zn&&X(arguments[0],St)&&X(arguments[1],St)){var m=arguments[0],E=arguments[1],A=arguments[2];this.addEdges(m,m),this.addEdges(E,E),this.computeIntersections(A)}else if(typeof arguments[2]=="boolean"&&X(arguments[0],St)&&arguments[1]instanceof Zn){var U=arguments[0],$=arguments[1];arguments[2]?this.addEdges(U,null):this.addEdges(U),this.computeIntersections($)}}},i.prototype.addEdge=function(s,u){for(var c=s.getMonotoneChainEdge(),m=c.getStartIndexes(),E=0;E<m.length-1;E++){var A=new Cu(c,E),U=new Ur(u,c.getMinX(E),A);this.events.add(U),this.events.add(new Ur(c.getMaxX(E),U))}},i.prototype.processOverlaps=function(s,u,c,m){for(var E=c.getObject(),A=s;A<u;A++){var U=this.events.get(A);if(U.isInsert()){var $=U.getObject();c.isSameLabel(U)||(E.computeIntersections($,m),this.nOverlaps++)}}},i.prototype.addEdges=function(){if(arguments.length===1)for(var s=arguments[0].iterator();s.hasNext();){var u=s.next();this.addEdge(u,u)}else if(arguments.length===2)for(var c=arguments[0],m=arguments[1],E=c.iterator();E.hasNext();){var A=E.next();this.addEdge(A,m)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Rl),$i=function(){this._min=w.POSITIVE_INFINITY,this._max=w.NEGATIVE_INFINITY},pm={NodeComparator:{configurable:!0}};$i.prototype.getMin=function(){return this._min},$i.prototype.intersects=function(n,i){return!(this._min>i||this._max<n)},$i.prototype.getMax=function(){return this._max},$i.prototype.toString=function(){return qt.toLineString(new L(this._min,0),new L(this._max,0))},$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i},pm.NodeComparator.get=function(){return Pu},Object.defineProperties($i,pm);var Pu=function(){};Pu.prototype.compare=function(n,i){var s=n,u=i,c=(s._min+s._max)/2,m=(u._min+u._max)/2;return c<m?-1:c>m?1:0},Pu.prototype.interfaces_=function(){return[z]},Pu.prototype.getClass=function(){return Pu};var F1=function(n){function i(){n.call(this),this._item=null;var s=arguments[0],u=arguments[1],c=arguments[2];this._min=s,this._max=u,this._item=c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.query=function(s,u,c){if(!this.intersects(s,u))return null;c.visitItem(this._item)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}($i),U1=function(n){function i(){n.call(this),this._node1=null,this._node2=null;var s=arguments[0],u=arguments[1];this._node1=s,this._node2=u,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,u){this._min=Math.min(s._min,u._min),this._max=Math.max(s._max,u._max)},i.prototype.query=function(s,u,c){if(!this.intersects(s,u))return null;this._node1!==null&&this._node1.query(s,u,c),this._node2!==null&&this._node2.query(s,u,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}($i),Zi=function(){this._leaves=new Q,this._root=null,this._level=0};Zi.prototype.buildTree=function(){gi.sort(this._leaves,new $i.NodeComparator);for(var n=this._leaves,i=null,s=new Q;;){if(this.buildLevel(n,s),s.size()===1)return s.get(0);i=n,n=s,s=i}},Zi.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 F1(n,i,s))},Zi.prototype.query=function(n,i,s){this.init(),this._root.query(n,i,s)},Zi.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},Zi.prototype.printNode=function(n){Nt.out.println(qt.toLineString(new L(n._min,this._level),new L(n._max,this._level)))},Zi.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},Zi.prototype.buildLevel=function(n,i){this._level++,i.clear();for(var s=0;s<n.size();s+=2){var u=n.get(s);if((s+1<n.size()?n.get(s):null)===null)i.add(u);else{var c=new U1(n.get(s),n.get(s+1));i.add(c)}}},Zi.prototype.interfaces_=function(){return[]},Zi.prototype.getClass=function(){return Zi};var ya=function(){this._items=new Q};ya.prototype.visitItem=function(n){this._items.add(n)},ya.prototype.getItems=function(){return this._items},ya.prototype.interfaces_=function(){return[Co]},ya.prototype.getClass=function(){return ya};var va=function(){this._index=null;var n=arguments[0];if(!X(n,ce))throw new C("Argument must be Polygonal");this._index=new ss(n)},Of={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};va.prototype.locate=function(n){var i=new P(n),s=new _a(i);return this._index.query(n.y,n.y,s),i.getLocation()},va.prototype.interfaces_=function(){return[da]},va.prototype.getClass=function(){return va},Of.SegmentVisitor.get=function(){return _a},Of.IntervalIndexedGeometry.get=function(){return ss},Object.defineProperties(va,Of);var _a=function(){this._counter=null;var n=arguments[0];this._counter=n};_a.prototype.visitItem=function(n){var i=n;this._counter.countSegment(i.getCoordinate(0),i.getCoordinate(1))},_a.prototype.interfaces_=function(){return[Co]},_a.prototype.getClass=function(){return _a};var ss=function(){this._index=new Zi;var n=arguments[0];this.init(n)};ss.prototype.init=function(n){for(var i=Xn.getLines(n).iterator();i.hasNext();){var s=i.next().getCoordinates();this.addLine(s)}},ss.prototype.addLine=function(n){for(var i=1;i<n.length;i++){var s=new $t(n[i-1],n[i]),u=Math.min(s.p0.y,s.p1.y),c=Math.max(s.p0.y,s.p1.y);this._index.insert(u,c,s)}},ss.prototype.query=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new ya;return this._index.query(n,i,s),s.getItems()}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];this._index.query(u,c,m)}},ss.prototype.interfaces_=function(){return[]},ss.prototype.getClass=function(){return ss};var Iu=function(n){function i(){if(n.call(this),this._parentGeom=null,this._lineEdgeMap=new ca,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new vi,arguments.length===2){var s=arguments[0],u=arguments[1],c=Lt.OGC_SFS_BOUNDARY_RULE;this._argIndex=s,this._parentGeom=u,this._boundaryNodeRule=c,u!==null&&this.add(u)}else if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];this._argIndex=m,this._parentGeom=E,this._boundaryNodeRule=A,E!==null&&this.add(E)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.insertBoundaryPoint=function(s,u){var c=this._nodes.addNode(u).getLabel(),m=1;k.NONE,c.getLocation(s,bt.ON)===k.BOUNDARY&&m++;var E=i.determineBoundary(this._boundaryNodeRule,m);c.setLocation(s,E)},i.prototype.computeSelfNodes=function(){if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.computeSelfNodes(s,u,!1)}if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2],A=new Zn(c,!0,!1);A.setIsDoneIfProperInt(E);var U=this.createEdgeSetIntersector(),$=this._parentGeom instanceof sn||this._parentGeom instanceof Vt||this._parentGeom instanceof un,ut=m||!$;return U.computeIntersections(this._edges,A,ut),this.addSelfIntersectionNodes(this._argIndex),A}},i.prototype.computeSplitEdges=function(s){for(var u=this._edges.iterator();u.hasNext();)u.next().eiList.addSplitEdges(s)},i.prototype.computeEdgeIntersections=function(s,u,c){var m=new Zn(u,c,!0);return m.setBoundaryNodes(this.getBoundaryNodes(),s.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,s._edges,m),m},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 jt){var s=arguments[0].getCoordinate();this.insertPoint(this._argIndex,s,k.INTERIOR)}else if(arguments[0]instanceof L){var u=arguments[0];this.insertPoint(this._argIndex,u,k.INTERIOR)}},i.prototype.addPolygon=function(s){this.addPolygonRing(s.getExteriorRing(),k.EXTERIOR,k.INTERIOR);for(var u=0;u<s.getNumInteriorRing();u++){var c=s.getInteriorRingN(u);this.addPolygonRing(c,k.INTERIOR,k.EXTERIOR)}},i.prototype.addEdge=function(s){this.insertEdge(s);var u=s.getCoordinates();this.insertPoint(this._argIndex,u[0],k.BOUNDARY),this.insertPoint(this._argIndex,u[u.length-1],k.BOUNDARY)},i.prototype.addLineString=function(s){var u=ft.removeRepeatedPoints(s.getCoordinates());if(u.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=u[0],null;var c=new Il(u,new rn(this._argIndex,k.INTERIOR));this._lineEdgeMap.put(s,c),this.insertEdge(c),b.isTrue(u.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,u[0]),this.insertBoundaryPoint(this._argIndex,u[u.length-1])},i.prototype.getInvalidPoint=function(){return this._invalidPoint},i.prototype.getBoundaryPoints=function(){for(var s=this.getBoundaryNodes(),u=new Array(s.size()).fill(null),c=0,m=s.iterator();m.hasNext();){var E=m.next();u[c++]=E.getCoordinate().copy()}return u},i.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},i.prototype.addSelfIntersectionNode=function(s,u,c){if(this.isBoundaryNode(s,u))return null;c===k.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(s,u):this.insertPoint(s,u,c)},i.prototype.addPolygonRing=function(s,u,c){if(s.isEmpty())return null;var m=ft.removeRepeatedPoints(s.getCoordinates());if(m.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=m[0],null;var E=u,A=c;B.isCCW(m)&&(E=c,A=u);var U=new Il(m,new rn(this._argIndex,k.BOUNDARY,E,A));this._lineEdgeMap.put(s,U),this.insertEdge(U),this.insertPoint(this._argIndex,m[0],k.BOUNDARY)},i.prototype.insertPoint=function(s,u,c){var m=this._nodes.addNode(u),E=m.getLabel();E===null?m._label=new rn(s,c):E.setLocation(s,c)},i.prototype.createEdgeSetIntersector=function(){return new D1},i.prototype.addSelfIntersectionNodes=function(s){for(var u=this._edges.iterator();u.hasNext();)for(var c=u.next(),m=c.getLabel().getLocation(s),E=c.eiList.iterator();E.hasNext();){var A=E.next();this.addSelfIntersectionNode(s,A.coord,m)}},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 un&&(this._useBoundaryDeterminationRule=!1),s instanceof Vt)this.addPolygon(s);else if(s instanceof Bt)this.addLineString(s);else if(s instanceof jt)this.addPoint(s);else if(s instanceof fe)this.addCollection(s);else if(s instanceof H)this.addCollection(s);else if(s instanceof un)this.addCollection(s);else{if(!(s instanceof Hn))throw new Error(s.getClass().getName());this.addCollection(s)}},i.prototype.addCollection=function(s){for(var u=0;u<s.getNumGeometries();u++){var c=s.getGeometryN(u);this.add(c)}},i.prototype.locate=function(s){return X(this._parentGeom,ce)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new va(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,u){return s.isInBoundary(u)?k.BOUNDARY:k.INTERIOR},i}(xn),xa=function(){if(this._li=new Z,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 Iu(0,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=Lt.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 Iu(0,i,u),this._arg[1]=new Iu(1,s,u)}else if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2];c.getPrecisionModel().compareTo(m.getPrecisionModel())>=0?this.setComputationPrecision(c.getPrecisionModel()):this.setComputationPrecision(m.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Iu(0,c,E),this._arg[1]=new Iu(1,m,E)}};xa.prototype.getArgGeometry=function(n){return this._arg[n].getGeometry()},xa.prototype.setComputationPrecision=function(n){this._resultPrecisionModel=n,this._li.setPrecisionModel(this._resultPrecisionModel)},xa.prototype.interfaces_=function(){return[]},xa.prototype.getClass=function(){return xa};var as=function(){};as.prototype.interfaces_=function(){return[]},as.prototype.getClass=function(){return as},as.map=function(){if(arguments[0]instanceof j&&X(arguments[1],as.MapOp)){for(var n=arguments[0],i=arguments[1],s=new Q,u=0;u<n.getNumGeometries();u++){var c=i.map(n.getGeometryN(u));c!==null&&s.add(c)}return n.getFactory().buildGeometry(s)}if(X(arguments[0],Ot)&&X(arguments[1],as.MapOp)){for(var m=arguments[0],E=arguments[1],A=new Q,U=m.iterator();U.hasNext();){var $=U.next(),ut=E.map($);ut!==null&&A.add(ut)}return A}},as.MapOp=function(){};var ae=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u),this._ptLocator=new vi,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new yi,this._resultPolyList=new Q,this._resultLineList=new Q,this._resultPointList=new Q,this._graph=new xn(new im),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 u=this._edgeList.findEqualEdge(s);if(u!==null){var c=u.getLabel(),m=s.getLabel();u.isPointwiseEqual(s)||(m=new rn(s.getLabel())).flip();var E=u.getDepth();E.isNull()&&E.add(c),E.add(m),c.merge(m)}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 u=s.next(),c=u.getSym();u.isInResult()&&c.isInResult()&&(u.setInResult(!1),c.setInResult(!1))}},i.prototype.isCoveredByLA=function(s){return!!this.isCovered(s,this._resultLineList)||!!this.isCovered(s,this._resultPolyList)},i.prototype.computeGeometry=function(s,u,c,m){var E=new Q;return E.addAll(s),E.addAll(u),E.addAll(c),E.isEmpty()?i.createEmptyResult(m,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(E)},i.prototype.mergeSymLabels=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();)s.next().getEdges().mergeSymLabels()},i.prototype.isCovered=function(s,u){for(var c=u.iterator();c.hasNext();){var m=c.next();if(this._ptLocator.locate(s,m)!==k.EXTERIOR)return!0}return!1},i.prototype.replaceCollapsedEdges=function(){for(var s=new Q,u=this._edgeList.iterator();u.hasNext();){var c=u.next();c.isCollapsed()&&(u.remove(),s.add(c.getCollapsedEdge()))}this._edgeList.addAll(s)},i.prototype.updateNodeLabelling=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();){var u=s.next(),c=u.getEdges().getLabel();u.getLabel().merge(c)}},i.prototype.getResultGeometry=function(s){return this.computeOverlay(s),this._resultGeom},i.prototype.insertUniqueEdges=function(s){for(var u=s.iterator();u.hasNext();){var c=u.next();this.insertUniqueEdge(c)}},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 u=new Q;this._arg[0].computeSplitEdges(u),this._arg[1].computeSplitEdges(u),this.insertUniqueEdges(u),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),os.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(s),this.cancelDuplicateResultEdges();var c=new Or(this._geomFact);c.add(this._graph),this._resultPolyList=c.getPolygons();var m=new Ni(this,this._geomFact,this._ptLocator);this._resultLineList=m.build(s);var E=new ks(this,this._geomFact,this._ptLocator);this._resultPointList=E.build(s),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,s)},i.prototype.labelIncompleteNode=function(s,u){var c=this._ptLocator.locate(s.getCoordinate(),this._arg[u].getGeometry());s.getLabel().setLocation(u,c)},i.prototype.copyPoints=function(s){for(var u=this._arg[s].getNodeIterator();u.hasNext();){var c=u.next();this._graph.addNode(c.getCoordinate()).setLabel(s,c.getLabel().getLocation(s))}},i.prototype.findResultAreaEdges=function(s){for(var u=this._graph.getEdgeEnds().iterator();u.hasNext();){var c=u.next(),m=c.getLabel();m.isArea()&&!c.isInteriorAreaEdge()&&i.isResultOfOp(m.getLocation(0,bt.RIGHT),m.getLocation(1,bt.RIGHT),s)&&c.setInResult(!0)}},i.prototype.computeLabelsFromDepths=function(){for(var s=this._edgeList.iterator();s.hasNext();){var u=s.next(),c=u.getLabel(),m=u.getDepth();if(!m.isNull()){m.normalize();for(var E=0;E<2;E++)c.isNull(E)||!c.isArea()||m.isNull(E)||(m.getDelta(E)===0?c.toLine(E):(b.isTrue(!m.isNull(E,bt.LEFT),"depth of LEFT side has not been initialized"),c.setLocation(E,bt.LEFT,m.getLocation(E,bt.LEFT)),b.isTrue(!m.isNull(E,bt.RIGHT),"depth of RIGHT side has not been initialized"),c.setLocation(E,bt.RIGHT,m.getLocation(E,bt.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 u=s.next(),c=u.getLabel();u.isIsolated()&&(c.isNull(0)?this.labelIncompleteNode(u,0):this.labelIncompleteNode(u,1)),u.getEdges().updateLabelling(c)}},i.prototype.isCoveredByA=function(s){return!!this.isCovered(s,this._resultPolyList)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(xa);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 zs.map(n,{interfaces_:function(){return[as.MapOp]},map:function(u){return u.intersection(s)}})}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),pr.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),pr.overlayOp(n,i,ae.SYMDIFFERENCE)},ae.resultDimension=function(n,i,s){var u=i.getDimension(),c=s.getDimension(),m=-1;switch(n){case ae.INTERSECTION:m=Math.min(u,c);break;case ae.UNION:m=Math.max(u,c);break;case ae.DIFFERENCE:m=u;break;case ae.SYMDIFFERENCE:m=Math.max(u,c)}return m},ae.createEmptyResult=function(n,i,s,u){var c=null;switch(ae.resultDimension(n,i,s)){case-1:c=u.createGeometryCollection(new Array(0).fill(null));break;case 0:c=u.createPoint();break;case 1:c=u.createLineString();break;case 2:c=u.createPolygon()}return c},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),pr.overlayOp(n,i,ae.DIFFERENCE))},ae.isResultOfOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=n.getLocation(0),u=n.getLocation(1);return ae.isResultOfOp(s,u,i)}if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2];switch(c===k.BOUNDARY&&(c=k.INTERIOR),m===k.BOUNDARY&&(m=k.INTERIOR),E){case ae.INTERSECTION:return c===k.INTERIOR&&m===k.INTERIOR;case ae.UNION:return c===k.INTERIOR||m===k.INTERIOR;case ae.DIFFERENCE:return c===k.INTERIOR&&m!==k.INTERIOR;case ae.SYMDIFFERENCE:return c===k.INTERIOR&&m!==k.INTERIOR||c!==k.INTERIOR&&m===k.INTERIOR}return!1}},ae.INTERSECTION=1,ae.UNION=2,ae.DIFFERENCE=3,ae.SYMDIFFERENCE=4;var Uo=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new vi,this._seg=new $t;var n=arguments[0],i=arguments[1];this._g=n,this._boundaryDistanceTolerance=i,this._linework=this.extractLinework(n)};Uo.prototype.isWithinToleranceOfBoundary=function(n){for(var i=0;i<this._linework.getNumGeometries();i++)for(var s=this._linework.getGeometryN(i).getCoordinateSequence(),u=0;u<s.size()-1;u++)if(s.getCoordinate(u,this._seg.p0),s.getCoordinate(u+1,this._seg.p1),this._seg.distance(n)<=this._boundaryDistanceTolerance)return!0;return!1},Uo.prototype.getLocation=function(n){return this.isWithinToleranceOfBoundary(n)?k.BOUNDARY:this._ptLocator.locate(n,this._g)},Uo.prototype.extractLinework=function(n){var i=new Ea;n.apply(i);var s=i.getLinework(),u=le.toLineStringArray(s);return n.getFactory().createMultiLineString(u)},Uo.prototype.interfaces_=function(){return[]},Uo.prototype.getClass=function(){return Uo};var Ea=function(){this._linework=null,this._linework=new Q};Ea.prototype.getLinework=function(){return this._linework},Ea.prototype.filter=function(n){if(n instanceof Vt){var i=n;this._linework.add(i.getExteriorRing());for(var s=0;s<i.getNumInteriorRing();s++)this._linework.add(i.getInteriorRingN(s))}},Ea.prototype.interfaces_=function(){return[ni]},Ea.prototype.getClass=function(){return Ea};var us=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var n=arguments[0];this._g=n};us.prototype.extractPoints=function(n,i,s){for(var u=n.getCoordinates(),c=0;c<u.length-1;c++)this.computeOffsetPoints(u[c],u[c+1],i,s)},us.prototype.setSidesToGenerate=function(n,i){this._doLeft=n,this._doRight=i},us.prototype.getPoints=function(n){for(var i=new Q,s=Xn.getLines(this._g).iterator();s.hasNext();){var u=s.next();this.extractPoints(u,n,i)}return i},us.prototype.computeOffsetPoints=function(n,i,s,u){var c=i.x-n.x,m=i.y-n.y,E=Math.sqrt(c*c+m*m),A=s*c/E,U=s*m/E,$=(i.x+n.x)/2,ut=(i.y+n.y)/2;if(this._doLeft){var ht=new L($-U,ut+A);u.add(ht)}if(this._doRight){var At=new L($+U,ut-A);u.add(At)}},us.prototype.interfaces_=function(){return[]},us.prototype.getClass=function(){return us};var $r=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 Q;var i=arguments[0],s=arguments[1],u=arguments[2];this._boundaryDistanceTolerance=n.computeBoundaryDistanceTolerance(i,s),this._geom=[i,s,u],this._locFinder=[new Uo(this._geom[0],this._boundaryDistanceTolerance),new Uo(this._geom[1],this._boundaryDistanceTolerance),new Uo(this._geom[2],this._boundaryDistanceTolerance)]},dm={TOLERANCE:{configurable:!0}};$r.prototype.reportResult=function(n,i,s){Nt.out.println("Overlay result invalid - A:"+k.toLocationSymbol(i[0])+" B:"+k.toLocationSymbol(i[1])+" expected:"+(s?"i":"e")+" actual:"+k.toLocationSymbol(i[2]))},$r.prototype.isValid=function(n){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var i=this.checkValid(n);return i},$r.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 u=arguments[0],c=arguments[1];return this._location[0]=this._locFinder[0].getLocation(c),this._location[1]=this._locFinder[1].getLocation(c),this._location[2]=this._locFinder[2].getLocation(c),!!$r.hasLocation(this._location,k.BOUNDARY)||this.isValidResult(u,this._location)}},$r.prototype.addTestPts=function(n){var i=new us(n);this._testCoords.addAll(i.getPoints(5*this._boundaryDistanceTolerance))},$r.prototype.isValidResult=function(n,i){var s=ae.isResultOfOp(i[0],i[1],n),u=!(s^i[2]===k.INTERIOR);return u||this.reportResult(n,i,s),u},$r.prototype.getInvalidLocation=function(){return this._invalidLocation},$r.prototype.interfaces_=function(){return[]},$r.prototype.getClass=function(){return $r},$r.hasLocation=function(n,i){for(var s=0;s<3;s++)if(n[s]===i)return!0;return!1},$r.computeBoundaryDistanceTolerance=function(n,i){return Math.min(Tn.computeSizeBasedSnapTolerance(n),Tn.computeSizeBasedSnapTolerance(i))},$r.isValid=function(n,i,s,u){return new $r(n,i,u).isValid(s)},dm.TOLERANCE.get=function(){return 1e-6},Object.defineProperties($r,dm);var Zr=function n(i){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=n.extractFactory(i),this._inputGeoms=i};Zr.prototype.extractElements=function(n,i){if(n===null)return null;for(var s=0;s<n.getNumGeometries();s++){var u=n.getGeometryN(s);this._skipEmpty&&u.isEmpty()||i.add(u)}},Zr.prototype.combine=function(){for(var n=new Q,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)},Zr.prototype.interfaces_=function(){return[]},Zr.prototype.getClass=function(){return Zr},Zr.combine=function(){if(arguments.length===1){var n=arguments[0];return new Zr(n).combine()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new Zr(Zr.createList(i,s)).combine()}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];return new Zr(Zr.createList(u,c,m)).combine()}},Zr.extractFactory=function(n){return n.isEmpty()?null:n.iterator().next().getFactory()},Zr.createList=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new Q;return s.add(n),s.add(i),s}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2],E=new Q;return E.add(u),E.add(c),E.add(m),E}};var In=function(){this._inputPolys=null,this._geomFactory=null;var n=arguments[0];this._inputPolys=n,this._inputPolys===null&&(this._inputPolys=new Q)},mm={STRTREE_NODE_CAPACITY:{configurable:!0}};In.prototype.reduceToGeometries=function(n){for(var i=new Q,s=n.iterator();s.hasNext();){var u=s.next(),c=null;X(u,St)?c=this.unionTree(u):u instanceof j&&(c=u),i.add(c)}return i},In.prototype.extractByEnvelope=function(n,i,s){for(var u=new Q,c=0;c<i.getNumGeometries();c++){var m=i.getGeometryN(c);m.getEnvelopeInternal().intersects(n)?u.add(m):s.add(m)}return this._geomFactory.buildGeometry(u)},In.prototype.unionOptimized=function(n,i){var s=n.getEnvelopeInternal(),u=i.getEnvelopeInternal();if(!s.intersects(u))return Zr.combine(n,i);if(n.getNumGeometries()<=1&&i.getNumGeometries()<=1)return this.unionActual(n,i);var c=s.intersection(u);return this.unionUsingEnvelopeIntersection(n,i,c)},In.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 Qd(In.STRTREE_NODE_CAPACITY),i=this._inputPolys.iterator();i.hasNext();){var s=i.next();n.insert(s.getEnvelopeInternal(),s)}this._inputPolys=null;var u=n.itemsTree();return this.unionTree(u)},In.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],u=arguments[2];if(u-s<=1){var c=In.getGeometry(i,s);return this.unionSafe(c,null)}if(u-s==2)return this.unionSafe(In.getGeometry(i,s),In.getGeometry(i,s+1));var m=Math.trunc((u+s)/2),E=this.binaryUnion(i,s,m),A=this.binaryUnion(i,m,u);return this.unionSafe(E,A)}},In.prototype.repeatedUnion=function(n){for(var i=null,s=n.iterator();s.hasNext();){var u=s.next();i=i===null?u.copy():i.union(u)}return i},In.prototype.unionSafe=function(n,i){return n===null&&i===null?null:n===null?i.copy():i===null?n.copy():this.unionOptimized(n,i)},In.prototype.unionActual=function(n,i){return In.restrictToPolygons(n.union(i))},In.prototype.unionTree=function(n){var i=this.reduceToGeometries(n);return this.binaryUnion(i)},In.prototype.unionUsingEnvelopeIntersection=function(n,i,s){var u=new Q,c=this.extractByEnvelope(s,n,u),m=this.extractByEnvelope(s,i,u),E=this.unionActual(c,m);return u.add(E),Zr.combine(u)},In.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)}},In.prototype.interfaces_=function(){return[]},In.prototype.getClass=function(){return In},In.restrictToPolygons=function(n){if(X(n,ce))return n;var i=po.getPolygons(n);return i.size()===1?i.get(0):n.getFactory().createMultiPolygon(le.toPolygonArray(i))},In.getGeometry=function(n,i){return i>=n.size()?null:n.get(i)},In.union=function(n){return new In(n).union()},mm.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(In,mm);var Ru=function(){};Ru.prototype.interfaces_=function(){return[]},Ru.prototype.getClass=function(){return Ru},Ru.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),pr.overlayOp(n,i,ae.UNION)},r.GeoJSONReader=bf,r.GeoJSONWriter=Jd,r.OverlayOp=ae,r.UnionOp=Ru,r.BufferOp=qn,Object.defineProperty(r,"__esModule",{value:!0})})});var S1=Zt((z9,w1)=>{w1.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}});var A1=Zt((k9,T1)=>{var b1=S1();T1.exports=function(r,t){Array.isArray(t)||(t=[]),r.length>0&&t.push(b1([0,0],r[0]));for(var e=0;e<r.length-1;e++){var o=r[e],a=r[e+1],l=o[0],f=o[1],h=a[0],p=a[1],d=[.75*l+.25*h,.75*f+.25*p],g=[.25*l+.75*h,.25*f+.75*p];t.push(d),t.push(g)}return r.length>1&&t.push(b1([0,0],r[r.length-1])),t}});var Bi=Ln(kf(),1);var ep="157";var Y1=0,Lm=1,$1=2;var jg=1,Z1=2,qo=3,xs=0,li=1,Yo=2;var ys=0,Va=1,Nm=2,Om=3,Dm=4,J1=5,Ba=100,K1=101,Q1=102,Fm=103,Um=104,j1=200,tx=201,ex=202,nx=203,t0=204,e0=205,rx=206,ix=207,ox=208,sx=209,ax=210,ux=0,lx=1,cx=2,yh=3,fx=4,hx=5,px=6,dx=7,n0=0,mx=1,gx=2,vs=0,yx=1,vx=2,_x=3,xx=4,Ex=5,r0=300,qa=301,Xa=302,vh=303,_h=304,_c=306,xh=1e3,ji=1001,Eh=1002,Kr=1003,Bm=1004;var Gf=1005;var Di=1006,Mx=1007;var ku=1008;var _s=1009,wx=1010,Sx=1011,np=1012,i0=1013,ms=1014,gs=1015,Gu=1016,o0=1017,s0=1018,$s=1020,bx=1021,to=1023,Tx=1024,Ax=1025,Zs=1026,Ya=1027,Cx=1028,a0=1029,Px=1030,u0=1031,l0=1033,Vf=33776,Hf=33777,Wf=33778,qf=33779,zm=35840,km=35841,Gm=35842,Vm=35843,Ix=36196,Hm=37492,Wm=37496,qm=37808,Xm=37809,Ym=37810,$m=37811,Zm=37812,Jm=37813,Km=37814,Qm=37815,jm=37816,tg=37817,eg=37818,ng=37819,rg=37820,ig=37821,Xf=36492,og=36494,sg=36495,Rx=36283,ag=36284,ug=36285,lg=36286;var tc=2300,ec=2301,Yf=2302,cg=2400,fg=2401,hg=2402;var c0=3e3,Js=3001,Lx=3200,Nx=3201,Ox=0,Dx=1,Fi="",Tr="srgb",Jo="srgb-linear",rp="display-p3",xc="display-p3-linear",nc="linear",An="srgb",rc="rec709",ic="p3";var $f=7680;var Fx=519,Ux=512,Bx=513,zx=514,kx=515,Gx=516,Vx=517,Hx=518,Wx=519,pg=35044;var dg="300 es",Mh=1035,$o=2e3,oc=2001,Es=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 l=a.indexOf(e);l!==-1&&a.splice(l,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 l=0,f=a.length;l<f;l++)a[l].call(this,t);t.target=null}}},Br=["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 Zf=Math.PI/180,wh=180/Math.PI;function qu(){let r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(Br[r&255]+Br[r>>8&255]+Br[r>>16&255]+Br[r>>24&255]+"-"+Br[t&255]+Br[t>>8&255]+"-"+Br[t>>16&15|64]+Br[t>>24&255]+"-"+Br[e&63|128]+Br[e>>8&255]+"-"+Br[e>>16&255]+Br[e>>24&255]+Br[o&255]+Br[o>>8&255]+Br[o>>16&255]+Br[o>>24&255]).toLowerCase()}function ui(r,t,e){return Math.max(t,Math.min(e,r))}function qx(r,t){return(r%t+t)%t}function Jf(r,t,e){return(1-e)*r+e*t}function mg(r){return(r&r-1)===0&&r!==0}function Sh(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Lu(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 ai(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 fn=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(ui(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),l=this.x-t.x,f=this.y-t.y;return this.x=l*o-f*a+t.x,this.y=l*a+f*o+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},ve=class r{constructor(t,e,o,a,l,f,h,p,d){r.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,o,a,l,f,h,p,d)}set(t,e,o,a,l,f,h,p,d){let g=this.elements;return g[0]=t,g[1]=a,g[2]=h,g[3]=e,g[4]=l,g[5]=p,g[6]=o,g[7]=f,g[8]=d,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,l=this.elements,f=o[0],h=o[3],p=o[6],d=o[1],g=o[4],_=o[7],y=o[2],M=o[5],S=o[8],T=a[0],x=a[3],v=a[6],C=a[1],w=a[4],O=a[7],F=a[2],G=a[5],z=a[8];return l[0]=f*T+h*C+p*F,l[3]=f*x+h*w+p*G,l[6]=f*v+h*O+p*z,l[1]=d*T+g*C+_*F,l[4]=d*x+g*w+_*G,l[7]=d*v+g*O+_*z,l[2]=y*T+M*C+S*F,l[5]=y*x+M*w+S*G,l[8]=y*v+M*O+S*z,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],l=t[3],f=t[4],h=t[5],p=t[6],d=t[7],g=t[8];return e*f*g-e*h*d-o*l*g+o*h*p+a*l*d-a*f*p}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],l=t[3],f=t[4],h=t[5],p=t[6],d=t[7],g=t[8],_=g*f-h*d,y=h*p-g*l,M=d*l-f*p,S=e*_+o*y+a*M;if(S===0)return this.set(0,0,0,0,0,0,0,0,0);let T=1/S;return t[0]=_*T,t[1]=(a*d-g*o)*T,t[2]=(h*o-a*f)*T,t[3]=y*T,t[4]=(g*e-a*p)*T,t[5]=(a*l-h*e)*T,t[6]=M*T,t[7]=(o*p-d*e)*T,t[8]=(f*e-o*l)*T,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,l,f,h){let p=Math.cos(l),d=Math.sin(l);return this.set(o*p,o*d,-o*(p*f+d*h)+f+t,-a*d,a*p,-a*(-d*f+p*h)+h+e,0,0,1),this}scale(t,e){return this.premultiply(Kf.makeScale(t,e)),this}rotate(t){return this.premultiply(Kf.makeRotation(-t)),this}translate(t,e){return this.premultiply(Kf.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)}},Kf=new ve;function f0(r){for(let t=r.length-1;t>=0;--t)if(r[t]>=65535)return!0;return!1}function sc(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Xx(){let r=sc("canvas");return r.style.display="block",r}var gg={};function Bu(r){r in gg||(gg[r]=!0,console.warn(r))}var yg=new ve().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),vg=new ve().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Ll={[Jo]:{transfer:nc,primaries:rc,toReference:r=>r,fromReference:r=>r},[Tr]:{transfer:An,primaries:rc,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[xc]:{transfer:nc,primaries:ic,toReference:r=>r.applyMatrix3(vg),fromReference:r=>r.applyMatrix3(yg)},[rp]:{transfer:An,primaries:ic,toReference:r=>r.convertSRGBToLinear().applyMatrix3(vg),fromReference:r=>r.applyMatrix3(yg).convertLinearToSRGB()}},Yx=new Set([Jo,xc]),yn={enabled:!0,_workingColorSpace:Jo,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(!Yx.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=Ll[t].toReference,a=Ll[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 Ll[r].primaries},getTransfer:function(r){return r===Fi?nc:Ll[r].transfer}};function Ha(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Qf(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var Ma,ac=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{Ma===void 0&&(Ma=sc("canvas")),Ma.width=t.width,Ma.height=t.height;let o=Ma.getContext("2d");t instanceof ImageData?o.putImageData(t,0,0):o.drawImage(t,0,0,t.width,t.height),e=Ma}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=sc("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),l=a.data;for(let f=0;f<l.length;f++)l[f]=Ha(l[f]/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(Ha(e[o]/255)*255):e[o]=Ha(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}},$x=0,uc=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:$x++}),this.uuid=qu(),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 l;if(Array.isArray(a)){l=[];for(let f=0,h=a.length;f<h;f++)a[f].isDataTexture?l.push(jf(a[f].image)):l.push(jf(a[f]))}else l=jf(a);o.url=l}return e||(t.images[this.uuid]=o),o}};function jf(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?ac.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 Zx=0,eo=class r extends Es{constructor(t=r.DEFAULT_IMAGE,e=r.DEFAULT_MAPPING,o=ji,a=ji,l=Di,f=ku,h=to,p=_s,d=r.DEFAULT_ANISOTROPY,g=Fi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Zx++}),this.uuid=qu(),this.name="",this.source=new uc(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=o,this.wrapT=a,this.magFilter=l,this.minFilter=f,this.anisotropy=d,this.format=h,this.internalFormat=null,this.type=p,this.offset=new fn(0,0),this.repeat=new fn(1,1),this.center=new fn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ve,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof g=="string"?this.colorSpace=g:(Bu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=g===Js?Tr:Fi),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!==r0)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case xh:t.x=t.x-Math.floor(t.x);break;case ji:t.x=t.x<0?0:1;break;case Eh: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 xh:t.y=t.y-Math.floor(t.y);break;case ji:t.y=t.y<0?0:1;break;case Eh: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 Bu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Tr?Js:c0}set encoding(t){Bu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===Js?Tr:Fi}};eo.DEFAULT_IMAGE=null;eo.DEFAULT_MAPPING=r0;eo.DEFAULT_ANISOTROPY=1;var Ar=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,l=this.w,f=t.elements;return this.x=f[0]*e+f[4]*o+f[8]*a+f[12]*l,this.y=f[1]*e+f[5]*o+f[9]*a+f[13]*l,this.z=f[2]*e+f[6]*o+f[10]*a+f[14]*l,this.w=f[3]*e+f[7]*o+f[11]*a+f[15]*l,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,l,p=t.elements,d=p[0],g=p[4],_=p[8],y=p[1],M=p[5],S=p[9],T=p[2],x=p[6],v=p[10];if(Math.abs(g-y)<.01&&Math.abs(_-T)<.01&&Math.abs(S-x)<.01){if(Math.abs(g+y)<.1&&Math.abs(_+T)<.1&&Math.abs(S+x)<.1&&Math.abs(d+M+v-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let w=(d+1)/2,O=(M+1)/2,F=(v+1)/2,G=(g+y)/4,z=(_+T)/4,L=(S+x)/4;return w>O&&w>F?w<.01?(o=0,a=.707106781,l=.707106781):(o=Math.sqrt(w),a=G/o,l=z/o):O>F?O<.01?(o=.707106781,a=0,l=.707106781):(a=Math.sqrt(O),o=G/a,l=L/a):F<.01?(o=.707106781,a=.707106781,l=0):(l=Math.sqrt(F),o=z/l,a=L/l),this.set(o,a,l,e),this}let C=Math.sqrt((x-S)*(x-S)+(_-T)*(_-T)+(y-g)*(y-g));return Math.abs(C)<.001&&(C=1),this.x=(x-S)/C,this.y=(_-T)/C,this.z=(y-g)/C,this.w=Math.acos((d+M+v-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}},bh=class extends Es{constructor(t=1,e=1,o={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Ar(0,0,t,e),this.scissorTest=!1,this.viewport=new Ar(0,0,t,e);let a={width:t,height:e,depth:1};o.encoding!==void 0&&(Bu("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),o.colorSpace=o.encoding===Js?Tr:Fi),o=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Di,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},o),this.texture=new eo(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 uc(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"})}},Ko=class extends bh{constructor(t=1,e=1,o={}){super(t,e,o),this.isWebGLRenderTarget=!0}},lc=class extends eo{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=Kr,this.minFilter=Kr,this.wrapR=ji,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Th=class extends eo{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=Kr,this.minFilter=Kr,this.wrapR=ji,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Ms=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,l,f,h){let p=o[a+0],d=o[a+1],g=o[a+2],_=o[a+3],y=l[f+0],M=l[f+1],S=l[f+2],T=l[f+3];if(h===0){t[e+0]=p,t[e+1]=d,t[e+2]=g,t[e+3]=_;return}if(h===1){t[e+0]=y,t[e+1]=M,t[e+2]=S,t[e+3]=T;return}if(_!==T||p!==y||d!==M||g!==S){let x=1-h,v=p*y+d*M+g*S+_*T,C=v>=0?1:-1,w=1-v*v;if(w>Number.EPSILON){let F=Math.sqrt(w),G=Math.atan2(F,v*C);x=Math.sin(x*G)/F,h=Math.sin(h*G)/F}let O=h*C;if(p=p*x+y*O,d=d*x+M*O,g=g*x+S*O,_=_*x+T*O,x===1-h){let F=1/Math.sqrt(p*p+d*d+g*g+_*_);p*=F,d*=F,g*=F,_*=F}}t[e]=p,t[e+1]=d,t[e+2]=g,t[e+3]=_}static multiplyQuaternionsFlat(t,e,o,a,l,f){let h=o[a],p=o[a+1],d=o[a+2],g=o[a+3],_=l[f],y=l[f+1],M=l[f+2],S=l[f+3];return t[e]=h*S+g*_+p*M-d*y,t[e+1]=p*S+g*y+d*_-h*M,t[e+2]=d*S+g*M+h*y-p*_,t[e+3]=g*S-h*_-p*y-d*M,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,l=t._z,f=t._order,h=Math.cos,p=Math.sin,d=h(o/2),g=h(a/2),_=h(l/2),y=p(o/2),M=p(a/2),S=p(l/2);switch(f){case"XYZ":this._x=y*g*_+d*M*S,this._y=d*M*_-y*g*S,this._z=d*g*S+y*M*_,this._w=d*g*_-y*M*S;break;case"YXZ":this._x=y*g*_+d*M*S,this._y=d*M*_-y*g*S,this._z=d*g*S-y*M*_,this._w=d*g*_+y*M*S;break;case"ZXY":this._x=y*g*_-d*M*S,this._y=d*M*_+y*g*S,this._z=d*g*S+y*M*_,this._w=d*g*_-y*M*S;break;case"ZYX":this._x=y*g*_-d*M*S,this._y=d*M*_+y*g*S,this._z=d*g*S-y*M*_,this._w=d*g*_+y*M*S;break;case"YZX":this._x=y*g*_+d*M*S,this._y=d*M*_+y*g*S,this._z=d*g*S-y*M*_,this._w=d*g*_-y*M*S;break;case"XZY":this._x=y*g*_-d*M*S,this._y=d*M*_-y*g*S,this._z=d*g*S+y*M*_,this._w=d*g*_+y*M*S;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+f)}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],l=e[8],f=e[1],h=e[5],p=e[9],d=e[2],g=e[6],_=e[10],y=o+h+_;if(y>0){let M=.5/Math.sqrt(y+1);this._w=.25/M,this._x=(g-p)*M,this._y=(l-d)*M,this._z=(f-a)*M}else if(o>h&&o>_){let M=2*Math.sqrt(1+o-h-_);this._w=(g-p)/M,this._x=.25*M,this._y=(a+f)/M,this._z=(l+d)/M}else if(h>_){let M=2*Math.sqrt(1+h-o-_);this._w=(l-d)/M,this._x=(a+f)/M,this._y=.25*M,this._z=(p+g)/M}else{let M=2*Math.sqrt(1+_-o-h);this._w=(f-a)/M,this._x=(l+d)/M,this._y=(p+g)/M,this._z=.25*M}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(ui(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,l=t._z,f=t._w,h=e._x,p=e._y,d=e._z,g=e._w;return this._x=o*g+f*h+a*d-l*p,this._y=a*g+f*p+l*h-o*d,this._z=l*g+f*d+o*p-a*h,this._w=f*g-o*h-a*p-l*d,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,l=this._z,f=this._w,h=f*t._w+o*t._x+a*t._y+l*t._z;if(h<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,h=-h):this.copy(t),h>=1)return this._w=f,this._x=o,this._y=a,this._z=l,this;let p=1-h*h;if(p<=Number.EPSILON){let M=1-e;return this._w=M*f+e*this._w,this._x=M*o+e*this._x,this._y=M*a+e*this._y,this._z=M*l+e*this._z,this.normalize(),this._onChangeCallback(),this}let d=Math.sqrt(p),g=Math.atan2(d,h),_=Math.sin((1-e)*g)/d,y=Math.sin(e*g)/d;return this._w=f*_+this._w*y,this._x=o*_+this._x*y,this._y=a*_+this._y*y,this._z=l*_+this._z*y,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(),l=2*Math.PI*Math.random();return this.set(e*Math.cos(a),o*Math.sin(l),o*Math.cos(l),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}},mt=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(_g.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(_g.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,o=this.y,a=this.z,l=t.elements;return this.x=l[0]*e+l[3]*o+l[6]*a,this.y=l[1]*e+l[4]*o+l[7]*a,this.z=l[2]*e+l[5]*o+l[8]*a,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,o=this.y,a=this.z,l=t.elements,f=1/(l[3]*e+l[7]*o+l[11]*a+l[15]);return this.x=(l[0]*e+l[4]*o+l[8]*a+l[12])*f,this.y=(l[1]*e+l[5]*o+l[9]*a+l[13])*f,this.z=(l[2]*e+l[6]*o+l[10]*a+l[14])*f,this}applyQuaternion(t){let e=this.x,o=this.y,a=this.z,l=t.x,f=t.y,h=t.z,p=t.w,d=p*e+f*a-h*o,g=p*o+h*e-l*a,_=p*a+l*o-f*e,y=-l*e-f*o-h*a;return this.x=d*p+y*-l+g*-h-_*-f,this.y=g*p+y*-f+_*-l-d*-h,this.z=_*p+y*-h+d*-f-g*-l,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,l=t.elements;return this.x=l[0]*e+l[4]*o+l[8]*a,this.y=l[1]*e+l[5]*o+l[9]*a,this.z=l[2]*e+l[6]*o+l[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,l=t.z,f=e.x,h=e.y,p=e.z;return this.x=a*p-l*h,this.y=l*f-o*p,this.z=o*h-a*f,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 th.copy(this).projectOnVector(t),this.sub(th)}reflect(t){return this.sub(th.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(ui(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}},th=new mt,_g=new Ms,Ks=class{constructor(t=new mt(1/0,1/0,1/0),e=new mt(-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(ko.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,o=t.count;e<o;e++)this.expandByPoint(ko.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=ko.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(),wa.copy(t.boundingBox),wa.applyMatrix4(t.matrixWorld),this.union(wa);else{let a=t.geometry;if(a!==void 0)if(e&&a.attributes!==void 0&&a.attributes.position!==void 0){let l=a.attributes.position;for(let f=0,h=l.count;f<h;f++)ko.fromBufferAttribute(l,f).applyMatrix4(t.matrixWorld),this.expandByPoint(ko)}else a.boundingBox===null&&a.computeBoundingBox(),wa.copy(a.boundingBox),wa.applyMatrix4(t.matrixWorld),this.union(wa)}let o=t.children;for(let a=0,l=o.length;a<l;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,ko),ko.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(Nu),Nl.subVectors(this.max,Nu),Sa.subVectors(t.a,Nu),ba.subVectors(t.b,Nu),Ta.subVectors(t.c,Nu),cs.subVectors(ba,Sa),fs.subVectors(Ta,ba),Vs.subVectors(Sa,Ta);let e=[0,-cs.z,cs.y,0,-fs.z,fs.y,0,-Vs.z,Vs.y,cs.z,0,-cs.x,fs.z,0,-fs.x,Vs.z,0,-Vs.x,-cs.y,cs.x,0,-fs.y,fs.x,0,-Vs.y,Vs.x,0];return!eh(e,Sa,ba,Ta,Nl)||(e=[1,0,0,0,1,0,0,0,1],!eh(e,Sa,ba,Ta,Nl))?!1:(Ol.crossVectors(cs,fs),e=[Ol.x,Ol.y,Ol.z],eh(e,Sa,ba,Ta,Nl))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ko).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(ko).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:(zo[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),zo[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),zo[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),zo[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),zo[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),zo[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),zo[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),zo[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(zo),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)}},zo=[new mt,new mt,new mt,new mt,new mt,new mt,new mt,new mt],ko=new mt,wa=new Ks,Sa=new mt,ba=new mt,Ta=new mt,cs=new mt,fs=new mt,Vs=new mt,Nu=new mt,Nl=new mt,Ol=new mt,Hs=new mt;function eh(r,t,e,o,a){for(let l=0,f=r.length-3;l<=f;l+=3){Hs.fromArray(r,l);let h=a.x*Math.abs(Hs.x)+a.y*Math.abs(Hs.y)+a.z*Math.abs(Hs.z),p=t.dot(Hs),d=e.dot(Hs),g=o.dot(Hs);if(Math.max(-Math.max(p,d,g),Math.min(p,d,g))>h)return!1}return!0}var Jx=new Ks,Ou=new mt,nh=new mt,Vu=class{constructor(t=new mt,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):Jx.setFromPoints(t).getCenter(o);let a=0;for(let l=0,f=t.length;l<f;l++)a=Math.max(a,o.distanceToSquared(t[l]));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;Ou.subVectors(t,this.center);let e=Ou.lengthSq();if(e>this.radius*this.radius){let o=Math.sqrt(e),a=(o-this.radius)*.5;this.center.addScaledVector(Ou,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):(nh.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Ou.copy(t.center).add(nh)),this.expandByPoint(Ou.copy(t.center).sub(nh))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},Go=new mt,rh=new mt,Dl=new mt,hs=new mt,ih=new mt,Fl=new mt,oh=new mt,Ah=class{constructor(t=new mt,e=new mt(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,Go)),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=Go.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Go.copy(this.origin).addScaledVector(this.direction,e),Go.distanceToSquared(t))}distanceSqToSegment(t,e,o,a){rh.copy(t).add(e).multiplyScalar(.5),Dl.copy(e).sub(t).normalize(),hs.copy(this.origin).sub(rh);let l=t.distanceTo(e)*.5,f=-this.direction.dot(Dl),h=hs.dot(this.direction),p=-hs.dot(Dl),d=hs.lengthSq(),g=Math.abs(1-f*f),_,y,M,S;if(g>0)if(_=f*p-h,y=f*h-p,S=l*g,_>=0)if(y>=-S)if(y<=S){let T=1/g;_*=T,y*=T,M=_*(_+f*y+2*h)+y*(f*_+y+2*p)+d}else y=l,_=Math.max(0,-(f*y+h)),M=-_*_+y*(y+2*p)+d;else y=-l,_=Math.max(0,-(f*y+h)),M=-_*_+y*(y+2*p)+d;else y<=-S?(_=Math.max(0,-(-f*l+h)),y=_>0?-l:Math.min(Math.max(-l,-p),l),M=-_*_+y*(y+2*p)+d):y<=S?(_=0,y=Math.min(Math.max(-l,-p),l),M=y*(y+2*p)+d):(_=Math.max(0,-(f*l+h)),y=_>0?l:Math.min(Math.max(-l,-p),l),M=-_*_+y*(y+2*p)+d);else y=f>0?-l:l,_=Math.max(0,-(f*y+h)),M=-_*_+y*(y+2*p)+d;return o&&o.copy(this.origin).addScaledVector(this.direction,_),a&&a.copy(rh).addScaledVector(Dl,y),M}intersectSphere(t,e){Go.subVectors(t.center,this.origin);let o=Go.dot(this.direction),a=Go.dot(Go)-o*o,l=t.radius*t.radius;if(a>l)return null;let f=Math.sqrt(l-a),h=o-f,p=o+f;return p<0?null:h<0?this.at(p,e):this.at(h,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,l,f,h,p,d=1/this.direction.x,g=1/this.direction.y,_=1/this.direction.z,y=this.origin;return d>=0?(o=(t.min.x-y.x)*d,a=(t.max.x-y.x)*d):(o=(t.max.x-y.x)*d,a=(t.min.x-y.x)*d),g>=0?(l=(t.min.y-y.y)*g,f=(t.max.y-y.y)*g):(l=(t.max.y-y.y)*g,f=(t.min.y-y.y)*g),o>f||l>a||((l>o||isNaN(o))&&(o=l),(f<a||isNaN(a))&&(a=f),_>=0?(h=(t.min.z-y.z)*_,p=(t.max.z-y.z)*_):(h=(t.max.z-y.z)*_,p=(t.min.z-y.z)*_),o>p||h>a)||((h>o||o!==o)&&(o=h),(p<a||a!==a)&&(a=p),a<0)?null:this.at(o>=0?o:a,e)}intersectsBox(t){return this.intersectBox(t,Go)!==null}intersectTriangle(t,e,o,a,l){ih.subVectors(e,t),Fl.subVectors(o,t),oh.crossVectors(ih,Fl);let f=this.direction.dot(oh),h;if(f>0){if(a)return null;h=1}else if(f<0)h=-1,f=-f;else return null;hs.subVectors(this.origin,t);let p=h*this.direction.dot(Fl.crossVectors(hs,Fl));if(p<0)return null;let d=h*this.direction.dot(ih.cross(hs));if(d<0||p+d>f)return null;let g=-h*hs.dot(oh);return g<0?null:this.at(g/f,l)}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)}},kr=class r{constructor(t,e,o,a,l,f,h,p,d,g,_,y,M,S,T,x){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,l,f,h,p,d,g,_,y,M,S,T,x)}set(t,e,o,a,l,f,h,p,d,g,_,y,M,S,T,x){let v=this.elements;return v[0]=t,v[4]=e,v[8]=o,v[12]=a,v[1]=l,v[5]=f,v[9]=h,v[13]=p,v[2]=d,v[6]=g,v[10]=_,v[14]=y,v[3]=M,v[7]=S,v[11]=T,v[15]=x,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/Aa.setFromMatrixColumn(t,0).length(),l=1/Aa.setFromMatrixColumn(t,1).length(),f=1/Aa.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]*l,e[5]=o[5]*l,e[6]=o[6]*l,e[7]=0,e[8]=o[8]*f,e[9]=o[9]*f,e[10]=o[10]*f,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,l=t.z,f=Math.cos(o),h=Math.sin(o),p=Math.cos(a),d=Math.sin(a),g=Math.cos(l),_=Math.sin(l);if(t.order==="XYZ"){let y=f*g,M=f*_,S=h*g,T=h*_;e[0]=p*g,e[4]=-p*_,e[8]=d,e[1]=M+S*d,e[5]=y-T*d,e[9]=-h*p,e[2]=T-y*d,e[6]=S+M*d,e[10]=f*p}else if(t.order==="YXZ"){let y=p*g,M=p*_,S=d*g,T=d*_;e[0]=y+T*h,e[4]=S*h-M,e[8]=f*d,e[1]=f*_,e[5]=f*g,e[9]=-h,e[2]=M*h-S,e[6]=T+y*h,e[10]=f*p}else if(t.order==="ZXY"){let y=p*g,M=p*_,S=d*g,T=d*_;e[0]=y-T*h,e[4]=-f*_,e[8]=S+M*h,e[1]=M+S*h,e[5]=f*g,e[9]=T-y*h,e[2]=-f*d,e[6]=h,e[10]=f*p}else if(t.order==="ZYX"){let y=f*g,M=f*_,S=h*g,T=h*_;e[0]=p*g,e[4]=S*d-M,e[8]=y*d+T,e[1]=p*_,e[5]=T*d+y,e[9]=M*d-S,e[2]=-d,e[6]=h*p,e[10]=f*p}else if(t.order==="YZX"){let y=f*p,M=f*d,S=h*p,T=h*d;e[0]=p*g,e[4]=T-y*_,e[8]=S*_+M,e[1]=_,e[5]=f*g,e[9]=-h*g,e[2]=-d*g,e[6]=M*_+S,e[10]=y-T*_}else if(t.order==="XZY"){let y=f*p,M=f*d,S=h*p,T=h*d;e[0]=p*g,e[4]=-_,e[8]=d*g,e[1]=y*_+T,e[5]=f*g,e[9]=M*_-S,e[2]=S*_-M,e[6]=h*g,e[10]=T*_+y}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(Kx,t,Qx)}lookAt(t,e,o){let a=this.elements;return xi.subVectors(t,e),xi.lengthSq()===0&&(xi.z=1),xi.normalize(),ps.crossVectors(o,xi),ps.lengthSq()===0&&(Math.abs(o.z)===1?xi.x+=1e-4:xi.z+=1e-4,xi.normalize(),ps.crossVectors(o,xi)),ps.normalize(),Ul.crossVectors(xi,ps),a[0]=ps.x,a[4]=Ul.x,a[8]=xi.x,a[1]=ps.y,a[5]=Ul.y,a[9]=xi.y,a[2]=ps.z,a[6]=Ul.z,a[10]=xi.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,l=this.elements,f=o[0],h=o[4],p=o[8],d=o[12],g=o[1],_=o[5],y=o[9],M=o[13],S=o[2],T=o[6],x=o[10],v=o[14],C=o[3],w=o[7],O=o[11],F=o[15],G=a[0],z=a[4],L=a[8],D=a[12],q=a[1],nt=a[5],k=a[9],xt=a[13],X=a[2],it=a[6],vt=a[10],pt=a[14],et=a[3],ot=a[7],V=a[11],K=a[15];return l[0]=f*G+h*q+p*X+d*et,l[4]=f*z+h*nt+p*it+d*ot,l[8]=f*L+h*k+p*vt+d*V,l[12]=f*D+h*xt+p*pt+d*K,l[1]=g*G+_*q+y*X+M*et,l[5]=g*z+_*nt+y*it+M*ot,l[9]=g*L+_*k+y*vt+M*V,l[13]=g*D+_*xt+y*pt+M*K,l[2]=S*G+T*q+x*X+v*et,l[6]=S*z+T*nt+x*it+v*ot,l[10]=S*L+T*k+x*vt+v*V,l[14]=S*D+T*xt+x*pt+v*K,l[3]=C*G+w*q+O*X+F*et,l[7]=C*z+w*nt+O*it+F*ot,l[11]=C*L+w*k+O*vt+F*V,l[15]=C*D+w*xt+O*pt+F*K,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],l=t[12],f=t[1],h=t[5],p=t[9],d=t[13],g=t[2],_=t[6],y=t[10],M=t[14],S=t[3],T=t[7],x=t[11],v=t[15];return S*(+l*p*_-a*d*_-l*h*y+o*d*y+a*h*M-o*p*M)+T*(+e*p*M-e*d*y+l*f*y-a*f*M+a*d*g-l*p*g)+x*(+e*d*_-e*h*M-l*f*_+o*f*M+l*h*g-o*d*g)+v*(-a*h*g-e*p*_+e*h*y+a*f*_-o*f*y+o*p*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],l=t[3],f=t[4],h=t[5],p=t[6],d=t[7],g=t[8],_=t[9],y=t[10],M=t[11],S=t[12],T=t[13],x=t[14],v=t[15],C=_*x*d-T*y*d+T*p*M-h*x*M-_*p*v+h*y*v,w=S*y*d-g*x*d-S*p*M+f*x*M+g*p*v-f*y*v,O=g*T*d-S*_*d+S*h*M-f*T*M-g*h*v+f*_*v,F=S*_*p-g*T*p-S*h*y+f*T*y+g*h*x-f*_*x,G=e*C+o*w+a*O+l*F;if(G===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let z=1/G;return t[0]=C*z,t[1]=(T*y*l-_*x*l-T*a*M+o*x*M+_*a*v-o*y*v)*z,t[2]=(h*x*l-T*p*l+T*a*d-o*x*d-h*a*v+o*p*v)*z,t[3]=(_*p*l-h*y*l-_*a*d+o*y*d+h*a*M-o*p*M)*z,t[4]=w*z,t[5]=(g*x*l-S*y*l+S*a*M-e*x*M-g*a*v+e*y*v)*z,t[6]=(S*p*l-f*x*l-S*a*d+e*x*d+f*a*v-e*p*v)*z,t[7]=(f*y*l-g*p*l+g*a*d-e*y*d-f*a*M+e*p*M)*z,t[8]=O*z,t[9]=(S*_*l-g*T*l-S*o*M+e*T*M+g*o*v-e*_*v)*z,t[10]=(f*T*l-S*h*l+S*o*d-e*T*d-f*o*v+e*h*v)*z,t[11]=(g*h*l-f*_*l-g*o*d+e*_*d+f*o*M-e*h*M)*z,t[12]=F*z,t[13]=(g*T*a-S*_*a+S*o*y-e*T*y-g*o*x+e*_*x)*z,t[14]=(S*h*a-f*T*a-S*o*p+e*T*p+f*o*x-e*h*x)*z,t[15]=(f*_*a-g*h*a+g*o*p-e*_*p-f*o*y+e*h*y)*z,this}scale(t){let e=this.elements,o=t.x,a=t.y,l=t.z;return e[0]*=o,e[4]*=a,e[8]*=l,e[1]*=o,e[5]*=a,e[9]*=l,e[2]*=o,e[6]*=a,e[10]*=l,e[3]*=o,e[7]*=a,e[11]*=l,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),l=1-o,f=t.x,h=t.y,p=t.z,d=l*f,g=l*h;return this.set(d*f+o,d*h-a*p,d*p+a*h,0,d*h+a*p,g*h+o,g*p-a*f,0,d*p-a*h,g*p+a*f,l*p*p+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,l,f){return this.set(1,o,l,0,t,1,f,0,e,a,1,0,0,0,0,1),this}compose(t,e,o){let a=this.elements,l=e._x,f=e._y,h=e._z,p=e._w,d=l+l,g=f+f,_=h+h,y=l*d,M=l*g,S=l*_,T=f*g,x=f*_,v=h*_,C=p*d,w=p*g,O=p*_,F=o.x,G=o.y,z=o.z;return a[0]=(1-(T+v))*F,a[1]=(M+O)*F,a[2]=(S-w)*F,a[3]=0,a[4]=(M-O)*G,a[5]=(1-(y+v))*G,a[6]=(x+C)*G,a[7]=0,a[8]=(S+w)*z,a[9]=(x-C)*z,a[10]=(1-(y+T))*z,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,l=Aa.set(a[0],a[1],a[2]).length(),f=Aa.set(a[4],a[5],a[6]).length(),h=Aa.set(a[8],a[9],a[10]).length();this.determinant()<0&&(l=-l),t.x=a[12],t.y=a[13],t.z=a[14],Ki.copy(this);let d=1/l,g=1/f,_=1/h;return Ki.elements[0]*=d,Ki.elements[1]*=d,Ki.elements[2]*=d,Ki.elements[4]*=g,Ki.elements[5]*=g,Ki.elements[6]*=g,Ki.elements[8]*=_,Ki.elements[9]*=_,Ki.elements[10]*=_,e.setFromRotationMatrix(Ki),o.x=l,o.y=f,o.z=h,this}makePerspective(t,e,o,a,l,f,h=$o){let p=this.elements,d=2*l/(e-t),g=2*l/(o-a),_=(e+t)/(e-t),y=(o+a)/(o-a),M,S;if(h===$o)M=-(f+l)/(f-l),S=-2*f*l/(f-l);else if(h===oc)M=-f/(f-l),S=-f*l/(f-l);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+h);return p[0]=d,p[4]=0,p[8]=_,p[12]=0,p[1]=0,p[5]=g,p[9]=y,p[13]=0,p[2]=0,p[6]=0,p[10]=M,p[14]=S,p[3]=0,p[7]=0,p[11]=-1,p[15]=0,this}makeOrthographic(t,e,o,a,l,f,h=$o){let p=this.elements,d=1/(e-t),g=1/(o-a),_=1/(f-l),y=(e+t)*d,M=(o+a)*g,S,T;if(h===$o)S=(f+l)*_,T=-2*_;else if(h===oc)S=l*_,T=-1*_;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+h);return p[0]=2*d,p[4]=0,p[8]=0,p[12]=-y,p[1]=0,p[5]=2*g,p[9]=0,p[13]=-M,p[2]=0,p[6]=0,p[10]=T,p[14]=-S,p[3]=0,p[7]=0,p[11]=0,p[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}},Aa=new mt,Ki=new kr,Kx=new mt(0,0,0),Qx=new mt(1,1,1),ps=new mt,Ul=new mt,xi=new mt,xg=new kr,Eg=new Ms,cc=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,l=a[0],f=a[4],h=a[8],p=a[1],d=a[5],g=a[9],_=a[2],y=a[6],M=a[10];switch(e){case"XYZ":this._y=Math.asin(ui(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-g,M),this._z=Math.atan2(-f,l)):(this._x=Math.atan2(y,d),this._z=0);break;case"YXZ":this._x=Math.asin(-ui(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(h,M),this._z=Math.atan2(p,d)):(this._y=Math.atan2(-_,l),this._z=0);break;case"ZXY":this._x=Math.asin(ui(y,-1,1)),Math.abs(y)<.9999999?(this._y=Math.atan2(-_,M),this._z=Math.atan2(-f,d)):(this._y=0,this._z=Math.atan2(p,l));break;case"ZYX":this._y=Math.asin(-ui(_,-1,1)),Math.abs(_)<.9999999?(this._x=Math.atan2(y,M),this._z=Math.atan2(p,l)):(this._x=0,this._z=Math.atan2(-f,d));break;case"YZX":this._z=Math.asin(ui(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(-g,d),this._y=Math.atan2(-_,l)):(this._x=0,this._y=Math.atan2(h,M));break;case"XZY":this._z=Math.asin(-ui(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(y,d),this._y=Math.atan2(h,l)):(this._x=Math.atan2(-g,M),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 xg.makeRotationFromQuaternion(t),this.setFromRotationMatrix(xg,e,o)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Eg.setFromEuler(this),this.setFromQuaternion(Eg,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}};cc.DEFAULT_ORDER="XYZ";var fc=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}},jx=0,Mg=new mt,Ca=new Ms,Vo=new kr,Bl=new mt,Du=new mt,tE=new mt,eE=new Ms,wg=new mt(1,0,0),Sg=new mt(0,1,0),bg=new mt(0,0,1),nE={type:"added"},rE={type:"removed"},yo=class r extends Es{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:jx++}),this.uuid=qu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new mt,e=new cc,o=new Ms,a=new mt(1,1,1);function l(){o.setFromEuler(e,!1)}function f(){e.setFromQuaternion(o,void 0,!1)}e._onChange(l),o._onChange(f),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 kr},normalMatrix:{value:new ve}}),this.matrix=new kr,this.matrixWorld=new kr,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new fc,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 Ca.setFromAxisAngle(t,e),this.quaternion.multiply(Ca),this}rotateOnWorldAxis(t,e){return Ca.setFromAxisAngle(t,e),this.quaternion.premultiply(Ca),this}rotateX(t){return this.rotateOnAxis(wg,t)}rotateY(t){return this.rotateOnAxis(Sg,t)}rotateZ(t){return this.rotateOnAxis(bg,t)}translateOnAxis(t,e){return Mg.copy(t).applyQuaternion(this.quaternion),this.position.add(Mg.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(wg,t)}translateY(t){return this.translateOnAxis(Sg,t)}translateZ(t){return this.translateOnAxis(bg,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Vo.copy(this.matrixWorld).invert())}lookAt(t,e,o){t.isVector3?Bl.copy(t):Bl.set(t,e,o);let a=this.parent;this.updateWorldMatrix(!0,!1),Du.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Vo.lookAt(Du,Bl,this.up):Vo.lookAt(Bl,Du,this.up),this.quaternion.setFromRotationMatrix(Vo),a&&(Vo.extractRotation(a.matrixWorld),Ca.setFromRotationMatrix(Vo),this.quaternion.premultiply(Ca.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(nE)):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(rE)),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),Vo.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Vo.multiply(t.parent.matrixWorld)),t.applyMatrix4(Vo),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 f=this.children[o].getObjectByProperty(t,e);if(f!==void 0)return f}}getObjectsByProperty(t,e){let o=[];this[t]===e&&o.push(this);for(let a=0,l=this.children.length;a<l;a++){let f=this.children[a].getObjectsByProperty(t,e);f.length>0&&(o=o.concat(f))}return o}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Du,t,tE),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Du,eE,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 l=e[o];(l.matrixWorldAutoUpdate===!0||t===!0)&&l.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 l=0,f=a.length;l<f;l++){let h=a[l];h.matrixWorldAutoUpdate===!0&&h.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 l(h,p){return h[p.uuid]===void 0&&(h[p.uuid]=p.toJSON(t)),p.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=l(t.geometries,this.geometry);let h=this.geometry.parameters;if(h!==void 0&&h.shapes!==void 0){let p=h.shapes;if(Array.isArray(p))for(let d=0,g=p.length;d<g;d++){let _=p[d];l(t.shapes,_)}else l(t.shapes,p)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(l(t.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let h=[];for(let p=0,d=this.material.length;p<d;p++)h.push(l(t.materials,this.material[p]));a.material=h}else a.material=l(t.materials,this.material);if(this.children.length>0){a.children=[];for(let h=0;h<this.children.length;h++)a.children.push(this.children[h].toJSON(t).object)}if(this.animations.length>0){a.animations=[];for(let h=0;h<this.animations.length;h++){let p=this.animations[h];a.animations.push(l(t.animations,p))}}if(e){let h=f(t.geometries),p=f(t.materials),d=f(t.textures),g=f(t.images),_=f(t.shapes),y=f(t.skeletons),M=f(t.animations),S=f(t.nodes);h.length>0&&(o.geometries=h),p.length>0&&(o.materials=p),d.length>0&&(o.textures=d),g.length>0&&(o.images=g),_.length>0&&(o.shapes=_),y.length>0&&(o.skeletons=y),M.length>0&&(o.animations=M),S.length>0&&(o.nodes=S)}return o.object=a,o;function f(h){let p=[];for(let d in h){let g=h[d];delete g.metadata,p.push(g)}return p}}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}};yo.DEFAULT_UP=new mt(0,1,0);yo.DEFAULT_MATRIX_AUTO_UPDATE=!0;yo.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Qi=new mt,Ho=new mt,sh=new mt,Wo=new mt,Pa=new mt,Ia=new mt,Tg=new mt,ah=new mt,uh=new mt,lh=new mt,zl=!1,za=class r{constructor(t=new mt,e=new mt,o=new mt){this.a=t,this.b=e,this.c=o}static getNormal(t,e,o,a){a.subVectors(o,e),Qi.subVectors(t,e),a.cross(Qi);let l=a.lengthSq();return l>0?a.multiplyScalar(1/Math.sqrt(l)):a.set(0,0,0)}static getBarycoord(t,e,o,a,l){Qi.subVectors(a,e),Ho.subVectors(o,e),sh.subVectors(t,e);let f=Qi.dot(Qi),h=Qi.dot(Ho),p=Qi.dot(sh),d=Ho.dot(Ho),g=Ho.dot(sh),_=f*d-h*h;if(_===0)return l.set(-2,-1,-1);let y=1/_,M=(d*p-h*g)*y,S=(f*g-h*p)*y;return l.set(1-M-S,S,M)}static containsPoint(t,e,o,a){return this.getBarycoord(t,e,o,a,Wo),Wo.x>=0&&Wo.y>=0&&Wo.x+Wo.y<=1}static getUV(t,e,o,a,l,f,h,p){return zl===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),zl=!0),this.getInterpolation(t,e,o,a,l,f,h,p)}static getInterpolation(t,e,o,a,l,f,h,p){return this.getBarycoord(t,e,o,a,Wo),p.setScalar(0),p.addScaledVector(l,Wo.x),p.addScaledVector(f,Wo.y),p.addScaledVector(h,Wo.z),p}static isFrontFacing(t,e,o,a){return Qi.subVectors(o,e),Ho.subVectors(t,e),Qi.cross(Ho).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 Qi.subVectors(this.c,this.b),Ho.subVectors(this.a,this.b),Qi.cross(Ho).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,l){return zl===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),zl=!0),r.getInterpolation(t,this.a,this.b,this.c,e,o,a,l)}getInterpolation(t,e,o,a,l){return r.getInterpolation(t,this.a,this.b,this.c,e,o,a,l)}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,l=this.c,f,h;Pa.subVectors(a,o),Ia.subVectors(l,o),ah.subVectors(t,o);let p=Pa.dot(ah),d=Ia.dot(ah);if(p<=0&&d<=0)return e.copy(o);uh.subVectors(t,a);let g=Pa.dot(uh),_=Ia.dot(uh);if(g>=0&&_<=g)return e.copy(a);let y=p*_-g*d;if(y<=0&&p>=0&&g<=0)return f=p/(p-g),e.copy(o).addScaledVector(Pa,f);lh.subVectors(t,l);let M=Pa.dot(lh),S=Ia.dot(lh);if(S>=0&&M<=S)return e.copy(l);let T=M*d-p*S;if(T<=0&&d>=0&&S<=0)return h=d/(d-S),e.copy(o).addScaledVector(Ia,h);let x=g*S-M*_;if(x<=0&&_-g>=0&&M-S>=0)return Tg.subVectors(l,a),h=(_-g)/(_-g+(M-S)),e.copy(a).addScaledVector(Tg,h);let v=1/(x+T+y);return f=T*v,h=y*v,e.copy(o).addScaledVector(Pa,f).addScaledVector(Ia,h)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},iE=0,$a=class extends Es{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:iE++}),this.uuid=qu(),this.name="",this.type="Material",this.blending=Va,this.side=xs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=t0,this.blendDst=e0,this.blendEquation=Ba,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=yh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Fx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=$f,this.stencilZFail=$f,this.stencilZPass=$f,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!==Va&&(o.blending=this.blending),this.side!==xs&&(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(l){let f=[];for(let h in l){let p=l[h];delete p.metadata,f.push(p)}return f}if(e){let l=a(t.textures),f=a(t.images);l.length>0&&(o.textures=l),f.length>0&&(o.images=f)}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 l=0;l!==a;++l)o[l]=e[l].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++}},h0={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},ds={h:0,s:0,l:0},kl={h:0,s:0,l:0};function ch(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 En=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=Tr){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,yn.toWorkingColorSpace(this,e),this}setRGB(t,e,o,a=yn.workingColorSpace){return this.r=t,this.g=e,this.b=o,yn.toWorkingColorSpace(this,a),this}setHSL(t,e,o,a=yn.workingColorSpace){if(t=qx(t,1),e=ui(e,0,1),o=ui(o,0,1),e===0)this.r=this.g=this.b=o;else{let l=o<=.5?o*(1+e):o+e-o*e,f=2*o-l;this.r=ch(f,l,t+1/3),this.g=ch(f,l,t),this.b=ch(f,l,t-1/3)}return yn.toWorkingColorSpace(this,a),this}setStyle(t,e=Tr){function o(l){l!==void 0&&parseFloat(l)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let a;if(a=/^(\\w+)\\(([^\\)]*)\\)/.exec(t)){let l,f=a[1],h=a[2];switch(f){case"rgb":case"rgba":if(l=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(h))return o(l[4]),this.setRGB(Math.min(255,parseInt(l[1],10))/255,Math.min(255,parseInt(l[2],10))/255,Math.min(255,parseInt(l[3],10))/255,e);if(l=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(h))return o(l[4]),this.setRGB(Math.min(100,parseInt(l[1],10))/100,Math.min(100,parseInt(l[2],10))/100,Math.min(100,parseInt(l[3],10))/100,e);break;case"hsl":case"hsla":if(l=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(h))return o(l[4]),this.setHSL(parseFloat(l[1])/360,parseFloat(l[2])/100,parseFloat(l[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(a=/^\\#([A-Fa-f\\d]+)$/.exec(t)){let l=a[1],f=l.length;if(f===3)return this.setRGB(parseInt(l.charAt(0),16)/15,parseInt(l.charAt(1),16)/15,parseInt(l.charAt(2),16)/15,e);if(f===6)return this.setHex(parseInt(l,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=Tr){let o=h0[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=Ha(t.r),this.g=Ha(t.g),this.b=Ha(t.b),this}copyLinearToSRGB(t){return this.r=Qf(t.r),this.g=Qf(t.g),this.b=Qf(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Tr){return yn.fromWorkingColorSpace(zr.copy(this),t),Math.round(ui(zr.r*255,0,255))*65536+Math.round(ui(zr.g*255,0,255))*256+Math.round(ui(zr.b*255,0,255))}getHexString(t=Tr){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=yn.workingColorSpace){yn.fromWorkingColorSpace(zr.copy(this),e);let o=zr.r,a=zr.g,l=zr.b,f=Math.max(o,a,l),h=Math.min(o,a,l),p,d,g=(h+f)/2;if(h===f)p=0,d=0;else{let _=f-h;switch(d=g<=.5?_/(f+h):_/(2-f-h),f){case o:p=(a-l)/_+(a<l?6:0);break;case a:p=(l-o)/_+2;break;case l:p=(o-a)/_+4;break}p/=6}return t.h=p,t.s=d,t.l=g,t}getRGB(t,e=yn.workingColorSpace){return yn.fromWorkingColorSpace(zr.copy(this),e),t.r=zr.r,t.g=zr.g,t.b=zr.b,t}getStyle(t=Tr){yn.fromWorkingColorSpace(zr.copy(this),t);let e=zr.r,o=zr.g,a=zr.b;return t!==Tr?\`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(ds),this.setHSL(ds.h+t,ds.s+e,ds.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(ds),t.getHSL(kl);let o=Jf(ds.h,kl.h,e),a=Jf(ds.s,kl.s,e),l=Jf(ds.l,kl.l,e);return this.setHSL(o,a,l),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,l=t.elements;return this.r=l[0]*e+l[3]*o+l[6]*a,this.g=l[1]*e+l[4]*o+l[7]*a,this.b=l[2]*e+l[5]*o+l[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}},zr=new En;En.NAMES=h0;var hc=class extends $a{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new En(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=n0,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 Jn=new mt,Gl=new fn,Ui=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=pg,this.updateRange={offset:0,count:-1},this.gpuType=gs,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,l=this.itemSize;a<l;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++)Gl.fromBufferAttribute(this,e),Gl.applyMatrix3(t),this.setXY(e,Gl.x,Gl.y);else if(this.itemSize===3)for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.applyMatrix3(t),this.setXYZ(e,Jn.x,Jn.y,Jn.z);return this}applyMatrix4(t){for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.applyMatrix4(t),this.setXYZ(e,Jn.x,Jn.y,Jn.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.applyNormalMatrix(t),this.setXYZ(e,Jn.x,Jn.y,Jn.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.transformDirection(t),this.setXYZ(e,Jn.x,Jn.y,Jn.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=Lu(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=ai(o,this.array)),this.array[t*this.itemSize+e]=o,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Lu(e,this.array)),e}setX(t,e){return this.normalized&&(e=ai(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Lu(e,this.array)),e}setY(t,e){return this.normalized&&(e=ai(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=Lu(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ai(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=Lu(e,this.array)),e}setW(t,e){return this.normalized&&(e=ai(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,o){return t*=this.itemSize,this.normalized&&(e=ai(e,this.array),o=ai(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=ai(e,this.array),o=ai(o,this.array),a=ai(a,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this}setXYZW(t,e,o,a,l){return t*=this.itemSize,this.normalized&&(e=ai(e,this.array),o=ai(o,this.array),a=ai(a,this.array),l=ai(l,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this.array[t+3]=l,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!==pg&&(t.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(t.updateRange=this.updateRange),t}};var pc=class extends Ui{constructor(t,e,o){super(new Uint16Array(t),e,o)}};var dc=class extends Ui{constructor(t,e,o){super(new Uint32Array(t),e,o)}};var Zo=class extends Ui{constructor(t,e,o){super(new Float32Array(t),e,o)}};var oE=0,Oi=new kr,fh=new yo,Ra=new mt,Ei=new Ks,Fu=new Ks,mr=new mt,Qs=class r extends Es{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:oE++}),this.uuid=qu(),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(f0(t)?dc:pc)(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 l=new ve().getNormalMatrix(t);o.applyNormalMatrix(l),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 Oi.makeRotationFromQuaternion(t),this.applyMatrix4(Oi),this}rotateX(t){return Oi.makeRotationX(t),this.applyMatrix4(Oi),this}rotateY(t){return Oi.makeRotationY(t),this.applyMatrix4(Oi),this}rotateZ(t){return Oi.makeRotationZ(t),this.applyMatrix4(Oi),this}translate(t,e,o){return Oi.makeTranslation(t,e,o),this.applyMatrix4(Oi),this}scale(t,e,o){return Oi.makeScale(t,e,o),this.applyMatrix4(Oi),this}lookAt(t){return fh.lookAt(t),fh.updateMatrix(),this.applyMatrix4(fh.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ra).negate(),this.translate(Ra.x,Ra.y,Ra.z),this}setFromPoints(t){let e=[];for(let o=0,a=t.length;o<a;o++){let l=t[o];e.push(l.x,l.y,l.z||0)}return this.setAttribute("position",new Zo(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ks);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 mt(-1/0,-1/0,-1/0),new mt(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 l=e[o];Ei.setFromBufferAttribute(l),this.morphTargetsRelative?(mr.addVectors(this.boundingBox.min,Ei.min),this.boundingBox.expandByPoint(mr),mr.addVectors(this.boundingBox.max,Ei.max),this.boundingBox.expandByPoint(mr)):(this.boundingBox.expandByPoint(Ei.min),this.boundingBox.expandByPoint(Ei.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 Vu);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 mt,1/0);return}if(t){let o=this.boundingSphere.center;if(Ei.setFromBufferAttribute(t),e)for(let l=0,f=e.length;l<f;l++){let h=e[l];Fu.setFromBufferAttribute(h),this.morphTargetsRelative?(mr.addVectors(Ei.min,Fu.min),Ei.expandByPoint(mr),mr.addVectors(Ei.max,Fu.max),Ei.expandByPoint(mr)):(Ei.expandByPoint(Fu.min),Ei.expandByPoint(Fu.max))}Ei.getCenter(o);let a=0;for(let l=0,f=t.count;l<f;l++)mr.fromBufferAttribute(t,l),a=Math.max(a,o.distanceToSquared(mr));if(e)for(let l=0,f=e.length;l<f;l++){let h=e[l],p=this.morphTargetsRelative;for(let d=0,g=h.count;d<g;d++)mr.fromBufferAttribute(h,d),p&&(Ra.fromBufferAttribute(t,d),mr.add(Ra)),a=Math.max(a,o.distanceToSquared(mr))}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,l=e.normal.array,f=e.uv.array,h=a.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ui(new Float32Array(4*h),4));let p=this.getAttribute("tangent").array,d=[],g=[];for(let q=0;q<h;q++)d[q]=new mt,g[q]=new mt;let _=new mt,y=new mt,M=new mt,S=new fn,T=new fn,x=new fn,v=new mt,C=new mt;function w(q,nt,k){_.fromArray(a,q*3),y.fromArray(a,nt*3),M.fromArray(a,k*3),S.fromArray(f,q*2),T.fromArray(f,nt*2),x.fromArray(f,k*2),y.sub(_),M.sub(_),T.sub(S),x.sub(S);let xt=1/(T.x*x.y-x.x*T.y);isFinite(xt)&&(v.copy(y).multiplyScalar(x.y).addScaledVector(M,-T.y).multiplyScalar(xt),C.copy(M).multiplyScalar(T.x).addScaledVector(y,-x.x).multiplyScalar(xt),d[q].add(v),d[nt].add(v),d[k].add(v),g[q].add(C),g[nt].add(C),g[k].add(C))}let O=this.groups;O.length===0&&(O=[{start:0,count:o.length}]);for(let q=0,nt=O.length;q<nt;++q){let k=O[q],xt=k.start,X=k.count;for(let it=xt,vt=xt+X;it<vt;it+=3)w(o[it+0],o[it+1],o[it+2])}let F=new mt,G=new mt,z=new mt,L=new mt;function D(q){z.fromArray(l,q*3),L.copy(z);let nt=d[q];F.copy(nt),F.sub(z.multiplyScalar(z.dot(nt))).normalize(),G.crossVectors(L,nt);let xt=G.dot(g[q])<0?-1:1;p[q*4]=F.x,p[q*4+1]=F.y,p[q*4+2]=F.z,p[q*4+3]=xt}for(let q=0,nt=O.length;q<nt;++q){let k=O[q],xt=k.start,X=k.count;for(let it=xt,vt=xt+X;it<vt;it+=3)D(o[it+0]),D(o[it+1]),D(o[it+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 Ui(new Float32Array(e.count*3),3),this.setAttribute("normal",o);else for(let y=0,M=o.count;y<M;y++)o.setXYZ(y,0,0,0);let a=new mt,l=new mt,f=new mt,h=new mt,p=new mt,d=new mt,g=new mt,_=new mt;if(t)for(let y=0,M=t.count;y<M;y+=3){let S=t.getX(y+0),T=t.getX(y+1),x=t.getX(y+2);a.fromBufferAttribute(e,S),l.fromBufferAttribute(e,T),f.fromBufferAttribute(e,x),g.subVectors(f,l),_.subVectors(a,l),g.cross(_),h.fromBufferAttribute(o,S),p.fromBufferAttribute(o,T),d.fromBufferAttribute(o,x),h.add(g),p.add(g),d.add(g),o.setXYZ(S,h.x,h.y,h.z),o.setXYZ(T,p.x,p.y,p.z),o.setXYZ(x,d.x,d.y,d.z)}else for(let y=0,M=e.count;y<M;y+=3)a.fromBufferAttribute(e,y+0),l.fromBufferAttribute(e,y+1),f.fromBufferAttribute(e,y+2),g.subVectors(f,l),_.subVectors(a,l),g.cross(_),o.setXYZ(y+0,g.x,g.y,g.z),o.setXYZ(y+1,g.x,g.y,g.z),o.setXYZ(y+2,g.x,g.y,g.z);this.normalizeNormals(),o.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,o=t.count;e<o;e++)mr.fromBufferAttribute(t,e),mr.normalize(),t.setXYZ(e,mr.x,mr.y,mr.z)}toNonIndexed(){function t(h,p){let d=h.array,g=h.itemSize,_=h.normalized,y=new d.constructor(p.length*g),M=0,S=0;for(let T=0,x=p.length;T<x;T++){h.isInterleavedBufferAttribute?M=p[T]*h.data.stride+h.offset:M=p[T]*g;for(let v=0;v<g;v++)y[S++]=d[M++]}return new Ui(y,g,_)}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 h in a){let p=a[h],d=t(p,o);e.setAttribute(h,d)}let l=this.morphAttributes;for(let h in l){let p=[],d=l[h];for(let g=0,_=d.length;g<_;g++){let y=d[g],M=t(y,o);p.push(M)}e.morphAttributes[h]=p}e.morphTargetsRelative=this.morphTargetsRelative;let f=this.groups;for(let h=0,p=f.length;h<p;h++){let d=f[h];e.addGroup(d.start,d.count,d.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 p=this.parameters;for(let d in p)p[d]!==void 0&&(t[d]=p[d]);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 p in o){let d=o[p];t.data.attributes[p]=d.toJSON(t.data)}let a={},l=!1;for(let p in this.morphAttributes){let d=this.morphAttributes[p],g=[];for(let _=0,y=d.length;_<y;_++){let M=d[_];g.push(M.toJSON(t.data))}g.length>0&&(a[p]=g,l=!0)}l&&(t.data.morphAttributes=a,t.data.morphTargetsRelative=this.morphTargetsRelative);let f=this.groups;f.length>0&&(t.data.groups=JSON.parse(JSON.stringify(f)));let h=this.boundingSphere;return h!==null&&(t.data.boundingSphere={center:h.center.toArray(),radius:h.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 d in a){let g=a[d];this.setAttribute(d,g.clone(e))}let l=t.morphAttributes;for(let d in l){let g=[],_=l[d];for(let y=0,M=_.length;y<M;y++)g.push(_[y].clone(e));this.morphAttributes[d]=g}this.morphTargetsRelative=t.morphTargetsRelative;let f=t.groups;for(let d=0,g=f.length;d<g;d++){let _=f[d];this.addGroup(_.start,_.count,_.materialIndex)}let h=t.boundingBox;h!==null&&(this.boundingBox=h.clone());let p=t.boundingSphere;return p!==null&&(this.boundingSphere=p.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},Ag=new kr,Ws=new Ah,Vl=new Vu,Cg=new mt,La=new mt,Na=new mt,Oa=new mt,hh=new mt,Hl=new mt,Wl=new fn,ql=new fn,Xl=new fn,Pg=new mt,Ig=new mt,Rg=new mt,Yl=new mt,$l=new mt,go=class extends yo{constructor(t=new Qs,e=new hc){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 l=0,f=a.length;l<f;l++){let h=a[l].name||String(l);this.morphTargetInfluences.push(0),this.morphTargetDictionary[h]=l}}}}getVertexPosition(t,e){let o=this.geometry,a=o.attributes.position,l=o.morphAttributes.position,f=o.morphTargetsRelative;e.fromBufferAttribute(a,t);let h=this.morphTargetInfluences;if(l&&h){Hl.set(0,0,0);for(let p=0,d=l.length;p<d;p++){let g=h[p],_=l[p];g!==0&&(hh.fromBufferAttribute(_,t),f?Hl.addScaledVector(hh,g):Hl.addScaledVector(hh.sub(e),g))}e.add(Hl)}return e}raycast(t,e){let o=this.geometry,a=this.material,l=this.matrixWorld;a!==void 0&&(o.boundingSphere===null&&o.computeBoundingSphere(),Vl.copy(o.boundingSphere),Vl.applyMatrix4(l),Ws.copy(t.ray).recast(t.near),!(Vl.containsPoint(Ws.origin)===!1&&(Ws.intersectSphere(Vl,Cg)===null||Ws.origin.distanceToSquared(Cg)>(t.far-t.near)**2))&&(Ag.copy(l).invert(),Ws.copy(t.ray).applyMatrix4(Ag),!(o.boundingBox!==null&&Ws.intersectsBox(o.boundingBox)===!1)&&this._computeIntersections(t,e,Ws)))}_computeIntersections(t,e,o){let a,l=this.geometry,f=this.material,h=l.index,p=l.attributes.position,d=l.attributes.uv,g=l.attributes.uv1,_=l.attributes.normal,y=l.groups,M=l.drawRange;if(h!==null)if(Array.isArray(f))for(let S=0,T=y.length;S<T;S++){let x=y[S],v=f[x.materialIndex],C=Math.max(x.start,M.start),w=Math.min(h.count,Math.min(x.start+x.count,M.start+M.count));for(let O=C,F=w;O<F;O+=3){let G=h.getX(O),z=h.getX(O+1),L=h.getX(O+2);a=Zl(this,v,t,o,d,g,_,G,z,L),a&&(a.faceIndex=Math.floor(O/3),a.face.materialIndex=x.materialIndex,e.push(a))}}else{let S=Math.max(0,M.start),T=Math.min(h.count,M.start+M.count);for(let x=S,v=T;x<v;x+=3){let C=h.getX(x),w=h.getX(x+1),O=h.getX(x+2);a=Zl(this,f,t,o,d,g,_,C,w,O),a&&(a.faceIndex=Math.floor(x/3),e.push(a))}}else if(p!==void 0)if(Array.isArray(f))for(let S=0,T=y.length;S<T;S++){let x=y[S],v=f[x.materialIndex],C=Math.max(x.start,M.start),w=Math.min(p.count,Math.min(x.start+x.count,M.start+M.count));for(let O=C,F=w;O<F;O+=3){let G=O,z=O+1,L=O+2;a=Zl(this,v,t,o,d,g,_,G,z,L),a&&(a.faceIndex=Math.floor(O/3),a.face.materialIndex=x.materialIndex,e.push(a))}}else{let S=Math.max(0,M.start),T=Math.min(p.count,M.start+M.count);for(let x=S,v=T;x<v;x+=3){let C=x,w=x+1,O=x+2;a=Zl(this,f,t,o,d,g,_,C,w,O),a&&(a.faceIndex=Math.floor(x/3),e.push(a))}}}};function sE(r,t,e,o,a,l,f,h){let p;if(t.side===li?p=o.intersectTriangle(f,l,a,!0,h):p=o.intersectTriangle(a,l,f,t.side===xs,h),p===null)return null;$l.copy(h),$l.applyMatrix4(r.matrixWorld);let d=e.ray.origin.distanceTo($l);return d<e.near||d>e.far?null:{distance:d,point:$l.clone(),object:r}}function Zl(r,t,e,o,a,l,f,h,p,d){r.getVertexPosition(h,La),r.getVertexPosition(p,Na),r.getVertexPosition(d,Oa);let g=sE(r,t,e,o,La,Na,Oa,Yl);if(g){a&&(Wl.fromBufferAttribute(a,h),ql.fromBufferAttribute(a,p),Xl.fromBufferAttribute(a,d),g.uv=za.getInterpolation(Yl,La,Na,Oa,Wl,ql,Xl,new fn)),l&&(Wl.fromBufferAttribute(l,h),ql.fromBufferAttribute(l,p),Xl.fromBufferAttribute(l,d),g.uv1=za.getInterpolation(Yl,La,Na,Oa,Wl,ql,Xl,new fn),g.uv2=g.uv1),f&&(Pg.fromBufferAttribute(f,h),Ig.fromBufferAttribute(f,p),Rg.fromBufferAttribute(f,d),g.normal=za.getInterpolation(Yl,La,Na,Oa,Pg,Ig,Rg,new mt),g.normal.dot(o.direction)>0&&g.normal.multiplyScalar(-1));let _={a:h,b:p,c:d,normal:new mt,materialIndex:0};za.getNormal(La,Na,Oa,_.normal),g.face=_}return g}var Hu=class r extends Qs{constructor(t=1,e=1,o=1,a=1,l=1,f=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:o,widthSegments:a,heightSegments:l,depthSegments:f};let h=this;a=Math.floor(a),l=Math.floor(l),f=Math.floor(f);let p=[],d=[],g=[],_=[],y=0,M=0;S("z","y","x",-1,-1,o,e,t,f,l,0),S("z","y","x",1,-1,o,e,-t,f,l,1),S("x","z","y",1,1,t,o,e,a,f,2),S("x","z","y",1,-1,t,o,-e,a,f,3),S("x","y","z",1,-1,t,e,o,a,l,4),S("x","y","z",-1,-1,t,e,-o,a,l,5),this.setIndex(p),this.setAttribute("position",new Zo(d,3)),this.setAttribute("normal",new Zo(g,3)),this.setAttribute("uv",new Zo(_,2));function S(T,x,v,C,w,O,F,G,z,L,D){let q=O/z,nt=F/L,k=O/2,xt=F/2,X=G/2,it=z+1,vt=L+1,pt=0,et=0,ot=new mt;for(let V=0;V<vt;V++){let K=V*nt-xt;for(let at=0;at<it;at++){let Tt=at*q-k;ot[T]=Tt*C,ot[x]=K*w,ot[v]=X,d.push(ot.x,ot.y,ot.z),ot[T]=0,ot[x]=0,ot[v]=G>0?1:-1,g.push(ot.x,ot.y,ot.z),_.push(at/z),_.push(1-V/L),pt+=1}}for(let V=0;V<L;V++)for(let K=0;K<z;K++){let at=y+K+it*V,Tt=y+K+it*(V+1),dt=y+(K+1)+it*(V+1),Ct=y+(K+1)+it*V;p.push(at,Tt,Ct),p.push(Tt,dt,Ct),et+=6}h.addGroup(M,et,D),M+=et,y+=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 Za(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 Jr(r){let t={};for(let e=0;e<r.length;e++){let o=Za(r[e]);for(let a in o)t[a]=o[a]}return t}function aE(r){let t=[];for(let e=0;e<r.length;e++)t.push(r[e].clone());return t}function p0(r){return r.getRenderTarget()===null?r.outputColorSpace:yn.workingColorSpace}var uE={clone:Za,merge:Jr},lE=\`void main() {
|
|
94
|
+
\`)}return n.toString()},jn.prototype.computeEdgeEndLabels=function(n){for(var i=this.iterator();i.hasNext();)i.next().computeLabel(n)},jn.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 u=s.next().getLabel(),c=0;c<2;c++)u.isLine(c)&&u.getLocation(c)===k.BOUNDARY&&(i[c]=!0);for(var m=this.iterator();m.hasNext();)for(var E=m.next(),A=E.getLabel(),U=0;U<2;U++)if(A.isAnyNull(U)){var $=k.NONE;if(i[U])$=k.EXTERIOR;else{var ut=E.getCoordinate();$=this.getLocation(U,ut,n)}A.setAllLocationsIfNull(U,$)}},jn.prototype.getDegree=function(){return this._edgeMap.size()},jn.prototype.insertEdgeEnd=function(n,i){this._edgeMap.put(n,i),this._edgeList=null},jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn};var O1=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,u=null,c=this._SCANNING_FOR_INCOMING,m=0;m<this._resultAreaEdgeList.size();m++){var E=this._resultAreaEdgeList.get(m),A=E.getSym();if(E.getLabel().isArea())switch(s===null&&E.isInResult()&&(s=E),c){case this._SCANNING_FOR_INCOMING:if(!A.isInResult())continue;u=A,c=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!E.isInResult())continue;u.setNext(E),c=this._SCANNING_FOR_INCOMING}}if(c===this._LINKING_TO_OUTGOING){if(s===null)throw new lo("no outgoing dirEdge found",this.getCoordinate());b.isTrue(s.isInResult(),"unable to link last incoming dirEdge"),u.setNext(s)}},i.prototype.insert=function(s){var u=s;this.insertEdgeEnd(u,u)},i.prototype.getRightmostEdge=function(){var s=this.getEdges(),u=s.size();if(u<1)return null;var c=s.get(0);if(u===1)return c;var m=s.get(u-1),E=c.getQuadrant(),A=m.getQuadrant();return ln.isNorthern(E)&&ln.isNorthern(A)?c:ln.isNorthern(E)||ln.isNorthern(A)?c.getDy()!==0?c:m.getDy()!==0?m:(b.shouldNeverReachHere("found two horizontal edges incident on node"),null):m},i.prototype.print=function(s){Nt.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var u=this.iterator();u.hasNext();){var c=u.next();s.print("out "),c.print(s),s.println(),s.print("in "),c.getSym().print(s),s.println()}},i.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new Q;for(var s=this.iterator();s.hasNext();){var u=s.next();(u.isInResult()||u.getSym().isInResult())&&this._resultAreaEdgeList.add(u)}return this._resultAreaEdgeList},i.prototype.updateLabelling=function(s){for(var u=this.iterator();u.hasNext();){var c=u.next().getLabel();c.setAllLocationsIfNull(0,s.getLocation(0)),c.setAllLocationsIfNull(1,s.getLocation(1))}},i.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var s=null,u=null,c=this._edgeList.size()-1;c>=0;c--){var m=this._edgeList.get(c),E=m.getSym();u===null&&(u=E),s!==null&&E.setNext(s),s=m}u.setNext(s)},i.prototype.computeDepths=function(){if(arguments.length===1){var s=arguments[0],u=this.findIndex(s),c=s.getDepth(bt.LEFT),m=s.getDepth(bt.RIGHT),E=this.computeDepths(u+1,this._edgeList.size(),c);if(this.computeDepths(0,u,E)!==m)throw new lo("depth mismatch at "+s.getCoordinate())}else if(arguments.length===3){for(var A=arguments[0],U=arguments[1],$=arguments[2],ut=A;ut<U;ut++){var ht=this._edgeList.get(ut);ht.setEdgeDepths(bt.RIGHT,$),$=ht.getDepth(bt.LEFT)}return $}},i.prototype.mergeSymLabels=function(){for(var s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().merge(u.getSym().getLabel())}},i.prototype.linkMinimalDirectedEdges=function(s){for(var u=null,c=null,m=this._SCANNING_FOR_INCOMING,E=this._resultAreaEdgeList.size()-1;E>=0;E--){var A=this._resultAreaEdgeList.get(E),U=A.getSym();switch(u===null&&A.getEdgeRing()===s&&(u=A),m){case this._SCANNING_FOR_INCOMING:if(U.getEdgeRing()!==s)continue;c=U,m=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(A.getEdgeRing()!==s)continue;c.setNextMin(A),m=this._SCANNING_FOR_INCOMING}}m===this._LINKING_TO_OUTGOING&&(b.isTrue(u!==null,"found null for first outgoing dirEdge"),b.isTrue(u.getEdgeRing()===s,"unable to link last incoming dirEdge"),c.setNextMin(u))},i.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var s=0,u=this.iterator();u.hasNext();)u.next().isInResult()&&s++;return s}if(arguments.length===1){for(var c=arguments[0],m=0,E=this.iterator();E.hasNext();)E.next().getEdgeRing()===c&&m++;return m}},i.prototype.getLabel=function(){return this._label},i.prototype.findCoveredLineEdges=function(){for(var s=k.NONE,u=this.iterator();u.hasNext();){var c=u.next(),m=c.getSym();if(!c.isLineEdge()){if(c.isInResult()){s=k.INTERIOR;break}if(m.isInResult()){s=k.EXTERIOR;break}}}if(s===k.NONE)return null;for(var E=s,A=this.iterator();A.hasNext();){var U=A.next(),$=U.getSym();U.isLineEdge()?U.getEdge().setCovered(E===k.INTERIOR):(U.isInResult()&&(E=k.EXTERIOR),$.isInResult()&&(E=k.INTERIOR))}},i.prototype.computeLabelling=function(s){n.prototype.computeLabelling.call(this,s),this._label=new rn(k.NONE);for(var u=this.iterator();u.hasNext();)for(var c=u.next().getEdge().getLabel(),m=0;m<2;m++){var E=c.getLocation(m);E!==k.INTERIOR&&E!==k.BOUNDARY||this._label.setLocation(m,k.INTERIOR)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(jn),im=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 Cl(s,new O1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(fa),Io=function n(){this._pts=null,this._orientation=null;var i=arguments[0];this._pts=i,this._orientation=n.orientation(i)};Io.prototype.compareTo=function(n){var i=n;return Io.compareOriented(this._pts,this._orientation,i._pts,i._orientation)},Io.prototype.interfaces_=function(){return[F]},Io.prototype.getClass=function(){return Io},Io.orientation=function(n){return ft.increasingDirection(n)===1},Io.compareOriented=function(n,i,s,u){for(var c=i?1:-1,m=u?1:-1,E=i?n.length:-1,A=u?s.length:-1,U=i?0:n.length-1,$=u?0:s.length-1;;){var ut=n[U].compareTo(s[$]);if(ut!==0)return ut;var ht=(U+=c)===E,At=($+=m)===A;if(ht&&!At)return-1;if(!ht&&At)return 1;if(ht&&At)return 0}};var yi=function(){this._edges=new Q,this._ocaMap=new _};yi.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 u=s.getCoordinates(),c=0;c<u.length;c++)c>0&&n.print(","),n.print(u[c].x+" "+u[c].y);n.println(")")}n.print(") ")},yi.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next())},yi.prototype.findEdgeIndex=function(n){for(var i=0;i<this._edges.size();i++)if(this._edges.get(i).equals(n))return i;return-1},yi.prototype.iterator=function(){return this._edges.iterator()},yi.prototype.getEdges=function(){return this._edges},yi.prototype.get=function(n){return this._edges.get(n)},yi.prototype.findEqualEdge=function(n){var i=new Io(n.getCoordinates());return this._ocaMap.get(i)},yi.prototype.add=function(n){this._edges.add(n);var i=new Io(n.getCoordinates());this._ocaMap.put(i,n)},yi.prototype.interfaces_=function(){return[]},yi.prototype.getClass=function(){return yi};var ns=function(){};ns.prototype.processIntersections=function(n,i,s,u){},ns.prototype.isDone=function(){},ns.prototype.interfaces_=function(){return[]},ns.prototype.getClass=function(){return ns};var Yr=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};Yr.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(Yr.isAdjacentSegments(i,u))return!0;if(n.isClosed()){var c=n.size()-1;if(i===0&&u===c||u===0&&i===c)return!0}}return!1},Yr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Yr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Yr.prototype.getLineIntersector=function(){return this._li},Yr.prototype.hasProperIntersection=function(){return this._hasProper},Yr.prototype.processIntersections=function(n,i,s,u){if(n===s&&i===u)return null;this.numTests++;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],A=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,A),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(n,i,s,u)||(this._hasIntersection=!0,n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Yr.prototype.hasIntersection=function(){return this._hasIntersection},Yr.prototype.isDone=function(){return!1},Yr.prototype.hasInteriorIntersection=function(){return this._hasInterior},Yr.prototype.interfaces_=function(){return[ns]},Yr.prototype.getClass=function(){return Yr},Yr.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var Pi=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var n=arguments[0],i=arguments[1],s=arguments[2];this.coord=new L(n),this.segmentIndex=i,this.dist=s};Pi.prototype.getSegmentIndex=function(){return this.segmentIndex},Pi.prototype.getCoordinate=function(){return this.coord},Pi.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex),n.println(" dist = "+this.dist)},Pi.prototype.compareTo=function(n){var i=n;return this.compare(i.segmentIndex,i.dist)},Pi.prototype.isEndPoint=function(n){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===n},Pi.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Pi.prototype.getDistance=function(){return this.dist},Pi.prototype.compare=function(n,i){return this.segmentIndex<n?-1:this.segmentIndex>n?1:this.dist<i?-1:this.dist>i?1:0},Pi.prototype.interfaces_=function(){return[F]},Pi.prototype.getClass=function(){return Pi};var Wi=function(){this._nodeMap=new _,this.edge=null;var n=arguments[0];this.edge=n};Wi.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},Wi.prototype.iterator=function(){return this._nodeMap.values().iterator()},Wi.prototype.addSplitEdges=function(n){this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next(),c=this.createSplitEdge(s,u);n.add(c),s=u}},Wi.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)},Wi.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,u=this.edge.pts[i.segmentIndex],c=i.dist>0||!i.coord.equals2D(u);c||s--;var m=new Array(s).fill(null),E=0;m[E++]=new L(n.coord);for(var A=n.segmentIndex+1;A<=i.segmentIndex;A++)m[E++]=this.edge.pts[A];return c&&(m[E]=i.coord),new Il(m,new rn(this.edge._label))},Wi.prototype.add=function(n,i,s){var u=new Pi(n,i,s),c=this._nodeMap.get(u);return c!==null?c:(this._nodeMap.put(u,u),u)},Wi.prototype.isIntersection=function(n){for(var i=this.iterator();i.hasNext();)if(i.next().coord.equals(n))return!0;return!1},Wi.prototype.interfaces_=function(){return[]},Wi.prototype.getClass=function(){return Wi};var rs=function(){};rs.prototype.getChainStartIndices=function(n){var i=0,s=new Q;s.add(new et(i));do{var u=this.findChainEnd(n,i);s.add(new et(u)),i=u}while(i<n.length-1);return rs.toIntArray(s)},rs.prototype.findChainEnd=function(n,i){for(var s=ln.quadrant(n[i],n[i+1]),u=i+1;u<n.length&&ln.quadrant(n[u-1],n[u])===s;)u++;return u-1},rs.prototype.interfaces_=function(){return[]},rs.prototype.getClass=function(){return rs},rs.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 ho=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new Pt,this.env2=new Pt;var n=arguments[0];this.e=n,this.pts=n.getCoordinates();var i=new rs;this.startIndex=i.getChainStartIndices(this.pts)};ho.prototype.getCoordinates=function(){return this.pts},ho.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},ho.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},ho.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this.computeIntersectsForChain(this.startIndex[n],this.startIndex[n+1],i,i.startIndex[s],i.startIndex[s+1],u)}else if(arguments.length===6){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3],U=arguments[4],$=arguments[5],ut=this.pts[c],ht=this.pts[m],At=E.pts[A],Rt=E.pts[U];if(m-c==1&&U-A==1)return $.addIntersections(this.e,c,E.e,A),null;if(this.env1.init(ut,ht),this.env2.init(At,Rt),!this.env1.intersects(this.env2))return null;var kt=Math.trunc((c+m)/2),ee=Math.trunc((A+U)/2);c<kt&&(A<ee&&this.computeIntersectsForChain(c,kt,E,A,ee,$),ee<U&&this.computeIntersectsForChain(c,kt,E,ee,U,$)),kt<m&&(A<ee&&this.computeIntersectsForChain(kt,m,E,A,ee,$),ee<U&&this.computeIntersectsForChain(kt,m,E,ee,U,$))}},ho.prototype.getStartIndexes=function(){return this.startIndex},ho.prototype.computeIntersects=function(n,i){for(var s=0;s<this.startIndex.length-1;s++)for(var u=0;u<n.startIndex.length-1;u++)this.computeIntersectsForChain(s,n,u,i)},ho.prototype.interfaces_=function(){return[]},ho.prototype.getClass=function(){return ho};var Wn=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},om={NULL_VALUE:{configurable:!0}};Wn.prototype.getDepth=function(n,i){return this._depth[n][i]},Wn.prototype.setDepth=function(n,i,s){this._depth[n][i]=s},Wn.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]!==Wn.NULL_VALUE)return!1;return!0}if(arguments.length===1){var s=arguments[0];return this._depth[s][1]===Wn.NULL_VALUE}if(arguments.length===2){var u=arguments[0],c=arguments[1];return this._depth[u][c]===Wn.NULL_VALUE}},Wn.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 u=0;this._depth[n][s]>i&&(u=1),this._depth[n][s]=u}}},Wn.prototype.getDelta=function(n){return this._depth[n][bt.RIGHT]-this._depth[n][bt.LEFT]},Wn.prototype.getLocation=function(n,i){return this._depth[n][i]<=0?k.EXTERIOR:k.INTERIOR},Wn.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Wn.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 u=n.getLocation(i,s);u!==k.EXTERIOR&&u!==k.INTERIOR||(this.isNull(i,s)?this._depth[i][s]=Wn.depthAtLocation(u):this._depth[i][s]+=Wn.depthAtLocation(u))}else if(arguments.length===3){var c=arguments[0],m=arguments[1];arguments[2]===k.INTERIOR&&this._depth[c][m]++}},Wn.prototype.interfaces_=function(){return[]},Wn.prototype.getClass=function(){return Wn},Wn.depthAtLocation=function(n){return n===k.EXTERIOR?0:n===k.INTERIOR?1:Wn.NULL_VALUE},om.NULL_VALUE.get=function(){return-1},Object.defineProperties(Wn,om);var Il=function(n){function i(){if(n.call(this),this.pts=null,this._env=null,this.eiList=new Wi(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Wn,this._depthDelta=0,arguments.length===1){var s=arguments[0];i.call(this,s,null)}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.pts=u,this._label=c}}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,rn.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 u=s;if(this.pts.length!==u.pts.length)return!1;for(var c=!0,m=!0,E=this.pts.length,A=0;A<this.pts.length;A++)if(this.pts[A].equals2D(u.pts[A])||(c=!1),this.pts[A].equals2D(u.pts[--E])||(m=!1),!c&&!m)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 u=0;u<this.pts.length;u++)u>0&&s.print(","),s.print(this.pts[u].x+" "+this.pts[u].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 u=this.pts.length-1;u>=0;u--)s.print(this.pts[u]+" ");s.println("")},i.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new ho(this)),this._mce},i.prototype.getEnvelope=function(){if(this._env===null){this._env=new Pt;for(var s=0;s<this.pts.length;s++)this._env.expandToInclude(this.pts[s])}return this._env},i.prototype.addIntersection=function(s,u,c,m){var E=new L(s.getIntersection(m)),A=u,U=s.getEdgeDistance(c,m),$=A+1;if($<this.pts.length){var ut=this.pts[$];E.equals2D(ut)&&(A=$,U=0)}this.eiList.add(E,A,U)},i.prototype.toString=function(){var s=new pt;s.append("edge "+this._name+": "),s.append("LINESTRING (");for(var u=0;u<this.pts.length;u++)u>0&&s.append(","),s.append(this.pts[u].x+" "+this.pts[u].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 u=0;u<this.pts.length;u++)if(!this.pts[u].equals2D(s.pts[u]))return!1;return!0},i.prototype.setDepthDelta=function(s){this._depthDelta=s},i.prototype.getEdgeIntersectionList=function(){return this.eiList},i.prototype.addIntersections=function(s,u,c){for(var m=0;m<s.getIntersectionNum();m++)this.addIntersection(s,u,c,m)},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],u=arguments[1];u.setAtLeastIfValid(s.getLocation(0,bt.ON),s.getLocation(1,bt.ON),1),s.isArea()&&(u.setAtLeastIfValid(s.getLocation(0,bt.LEFT),s.getLocation(1,bt.LEFT),2),u.setAtLeastIfValid(s.getLocation(0,bt.RIGHT),s.getLocation(1,bt.RIGHT),2))},i}(Wr),lr=function(n){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new yi,this._bufParams=n||null};lr.prototype.setWorkingPrecisionModel=function(n){this._workingPrecisionModel=n},lr.prototype.insertUniqueEdge=function(n){var i=this._edgeList.findEqualEdge(n);if(i!==null){var s=i.getLabel(),u=n.getLabel();i.isPointwiseEqual(n)||(u=new rn(n.getLabel())).flip(),s.merge(u);var c=lr.depthDelta(u),m=i.getDepthDelta()+c;i.setDepthDelta(m)}else this._edgeList.add(n),n.setDepthDelta(lr.depthDelta(n.getLabel()))},lr.prototype.buildSubgraphs=function(n,i){for(var s=new Q,u=n.iterator();u.hasNext();){var c=u.next(),m=c.getRightmostCoordinate(),E=new Os(s).getDepth(m);c.computeDepth(E),c.findResultEdges(),s.add(c),i.add(c.getDirectedEdges(),c.getNodes())}},lr.prototype.createSubgraphs=function(n){for(var i=new Q,s=n.getNodes().iterator();s.hasNext();){var u=s.next();if(!u.isVisited()){var c=new ar;c.create(u),i.add(c)}}return gi.sort(i,gi.reverseOrder()),i},lr.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},lr.prototype.getNoder=function(n){if(this._workingNoder!==null)return this._workingNoder;var i=new Af,s=new Z;return s.setPrecisionModel(n),i.setSegmentIntersector(new Yr(s)),i},lr.prototype.buffer=function(n,i){var s=this._workingPrecisionModel;s===null&&(s=n.getPrecisionModel()),this._geomFact=n.getFactory();var u=new wr(s,this._bufParams),c=new oi(n,i,u).getCurves();if(c.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(c,s),this._graph=new xn(new im),this._graph.addEdges(this._edgeList.getEdges());var m=this.createSubgraphs(this._graph),E=new Or(this._geomFact);this.buildSubgraphs(m,E);var A=E.getPolygons();return A.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(A)},lr.prototype.computeNodedEdges=function(n,i){var s=this.getNoder(i);s.computeNodes(n);for(var u=s.getNodedSubstrings().iterator();u.hasNext();){var c=u.next(),m=c.getCoordinates();if(m.length!==2||!m[0].equals2D(m[1])){var E=c.getData(),A=new Il(c.getCoordinates(),new rn(E));this.insertUniqueEdge(A)}}},lr.prototype.setNoder=function(n){this._workingNoder=n},lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr},lr.depthDelta=function(n){var i=n.getLocation(0,bt.LEFT),s=n.getLocation(0,bt.RIGHT);return i===k.INTERIOR&&s===k.EXTERIOR?1:i===k.EXTERIOR&&s===k.INTERIOR?-1:0},lr.convertSegStrings=function(n){for(var i=new le,s=new Q;n.hasNext();){var u=n.next(),c=i.createLineString(u.getCoordinates());s.add(c)}return i.buildGeometry(s)};var Ro=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],u=arguments[1],c=arguments[2],m=arguments[3];this._noder=s,this._scaleFactor=u,this._offsetX=c,this._offsetY=m,this._isScaled=!this.isIntegerPrecision()}};Ro.prototype.rescale=function(){if(X(arguments[0],Ot))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],u=0;u<s.length;u++)s[u].x=s[u].x/this._scaleFactor+this._offsetX,s[u].y=s[u].y/this._scaleFactor+this._offsetY;s.length===2&&s[0].equals2D(s[1])&&Nt.out.println(s)}},Ro.prototype.scale=function(){if(X(arguments[0],Ot)){for(var n=arguments[0],i=new Q,s=n.iterator();s.hasNext();){var u=s.next();i.add(new bn(this.scale(u.getCoordinates()),u.getData()))}return i}if(arguments[0]instanceof Array){for(var c=arguments[0],m=new Array(c.length).fill(null),E=0;E<c.length;E++)m[E]=new L(Math.round((c[E].x-this._offsetX)*this._scaleFactor),Math.round((c[E].y-this._offsetY)*this._scaleFactor),c[E].z);return ft.removeRepeatedPoints(m)}},Ro.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},Ro.prototype.getNodedSubstrings=function(){var n=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(n),n},Ro.prototype.computeNodes=function(n){var i=n;this._isScaled&&(i=this.scale(n)),this._noder.computeNodes(i)},Ro.prototype.interfaces_=function(){return[ts]},Ro.prototype.getClass=function(){return Ro};var Ii=function(){this._li=new Z,this._segStrings=null;var n=arguments[0];this._segStrings=n},sm={fact:{configurable:!0}};Ii.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],u=arguments[1].iterator();u.hasNext();)for(var c=u.next().getCoordinates(),m=1;m<c.length-1;m++)if(c[m].equals(s))throw new J("found endpt/interior pt intersection at index "+m+" :pt "+s)}},Ii.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 u=s.next();this.checkInteriorIntersections(i,u)}else if(arguments.length===2)for(var c=arguments[0],m=arguments[1],E=c.getCoordinates(),A=m.getCoordinates(),U=0;U<E.length-1;U++)for(var $=0;$<A.length-1;$++)this.checkInteriorIntersections(c,U,m,$);else if(arguments.length===4){var ut=arguments[0],ht=arguments[1],At=arguments[2],Rt=arguments[3];if(ut===At&&ht===Rt)return null;var kt=ut.getCoordinates()[ht],ee=ut.getCoordinates()[ht+1],on=At.getCoordinates()[Rt],Rn=At.getCoordinates()[Rt+1];if(this._li.computeIntersection(kt,ee,on,Rn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,kt,ee)||this.hasInteriorIntersection(this._li,on,Rn)))throw new J("found non-noded intersection at "+kt+"-"+ee+" and "+on+"-"+Rn)}},Ii.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},Ii.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(),u=0;u<s.length-2;u++)this.checkCollapse(s[u],s[u+1],s[u+2])},Ii.prototype.hasInteriorIntersection=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++){var c=n.getIntersection(u);if(!c.equals(i)&&!c.equals(s))return!0}return!1},Ii.prototype.checkCollapse=function(n,i,s){if(n.equals(s))throw new J("found non-noded collapse at "+Ii.fact.createLineString([n,i,s]))},Ii.prototype.interfaces_=function(){return[]},Ii.prototype.getClass=function(){return Ii},sm.fact.get=function(){return new le},Object.defineProperties(Ii,sm);var Sr=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 C("Scale factor must be non-zero");i!==1&&(this._pt=new L(this.scale(n.x),this.scale(n.y)),this._p0Scaled=new L,this._p1Scaled=new L),this.initCorners(this._pt)},am={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Sr.prototype.intersectsScaled=function(n,i){var s=Math.min(n.x,i.x),u=Math.max(n.x,i.x),c=Math.min(n.y,i.y),m=Math.max(n.y,i.y),E=this._maxx<s||this._minx>u||this._maxy<c||this._miny>m;if(E)return!1;var A=this.intersectsToleranceSquare(n,i);return b.isTrue(!(E&&A),"Found bad envelope test"),A},Sr.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 L(this._maxx,this._maxy),this._corner[1]=new L(this._minx,this._maxy),this._corner[2]=new L(this._minx,this._miny),this._corner[3]=new L(this._maxx,this._miny)},Sr.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))},Sr.prototype.scale=function(n){return Math.round(n*this._scaleFactor)},Sr.prototype.getCoordinate=function(){return this._originalPt},Sr.prototype.copyScaled=function(n,i){i.x=this.scale(n.x),i.y=this.scale(n.y)},Sr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var n=Sr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Pt(this._originalPt.x-n,this._originalPt.x+n,this._originalPt.y-n,this._originalPt.y+n)}return this._safeEnv},Sr.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())))},Sr.prototype.intersectsToleranceSquare=function(n,i){var s=!1,u=!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()&&(u=!0),this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!s||!u)||!!n.equals(this._pt)||!!i.equals(this._pt))))},Sr.prototype.addSnappedNode=function(n,i){var s=n.getCoordinate(i),u=n.getCoordinate(i+1);return!!this.intersects(s,u)&&(n.addIntersection(this.getCoordinate(),i),!0)},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr},am.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(Sr,am);var Au=function(){this.tempEnv1=new Pt,this.selectedSegment=new $t};Au.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)}}},Au.prototype.interfaces_=function(){return[]},Au.prototype.getClass=function(){return Au};var ma=function(){this._index=null;var n=arguments[0];this._index=n},um={HotPixelSnapAction:{configurable:!0}};ma.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],u=arguments[2],c=i.getSafeEnvelope(),m=new lm(i,s,u);return this._index.query(c,{interfaces_:function(){return[Co]},visitItem:function(E){E.select(c,m)}}),m.isNodeAdded()}},ma.prototype.interfaces_=function(){return[]},ma.prototype.getClass=function(){return ma},um.HotPixelSnapAction.get=function(){return lm},Object.defineProperties(ma,um);var lm=function(n){function i(){n.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var s=arguments[0],u=arguments[1],c=arguments[2];this._hotPixel=s,this._parentEdge=u,this._hotPixelVertexIndex=c}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],u=arguments[1],c=s.getContext();if(this._parentEdge!==null&&c===this._parentEdge&&u===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(c,u)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Au),Ds=function(){this._li=null,this._interiorIntersections=null;var n=arguments[0];this._li=n,this._interiorIntersections=new Q};Ds.prototype.processIntersections=function(n,i,s,u){if(n===s&&i===u)return null;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],A=s.getCoordinates()[u+1];if(this._li.computeIntersection(c,m,E,A),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var U=0;U<this._li.getIntersectionNum();U++)this._interiorIntersections.add(this._li.getIntersection(U));n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,1)}},Ds.prototype.isDone=function(){return!1},Ds.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Ds.prototype.interfaces_=function(){return[ns]},Ds.prototype.getClass=function(){return Ds};var qi=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 Z,this._li.setPrecisionModel(n),this._scaleFactor=n.getScale()};qi.prototype.checkCorrectness=function(n){var i=bn.getNodedSubstrings(n),s=new Ii(i);try{s.checkValid()}catch(u){if(!(u instanceof Yt))throw u;u.printStackTrace()}},qi.prototype.getNodedSubstrings=function(){return bn.getNodedSubstrings(this._nodedSegStrings)},qi.prototype.snapRound=function(n,i){var s=this.findInteriorIntersections(n,i);this.computeIntersectionSnaps(s),this.computeVertexSnaps(n)},qi.prototype.findInteriorIntersections=function(n,i){var s=new Ds(i);return this._noder.setSegmentIntersector(s),this._noder.computeNodes(n),s.getInteriorIntersections()},qi.prototype.computeVertexSnaps=function(){if(X(arguments[0],Ot))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.computeVertexSnaps(i)}else if(arguments[0]instanceof bn)for(var s=arguments[0],u=s.getCoordinates(),c=0;c<u.length;c++){var m=new Sr(u[c],this._scaleFactor,this._li);this._pointSnapper.snap(m,s,c)&&s.addIntersection(u[c],c)}},qi.prototype.computeNodes=function(n){this._nodedSegStrings=n,this._noder=new Af,this._pointSnapper=new ma(this._noder.getIndex()),this.snapRound(n,this._li)},qi.prototype.computeIntersectionSnaps=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),u=new Sr(s,this._scaleFactor,this._li);this._pointSnapper.snap(u)}},qi.prototype.interfaces_=function(){return[ts]},qi.prototype.getClass=function(){return qi};var qn=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new We,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}},ga={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};qn.prototype.bufferFixedPrecision=function(n){var i=new Ro(new qi(new ie(1)),n.getScale()),s=new lr(this._bufParams);s.setWorkingPrecisionModel(n),s.setNoder(i),this._resultGeometry=s.buffer(this._argGeom,this._distance)},qn.prototype.bufferReducedPrecision=function(){var n=this;if(arguments.length===0){for(var i=qn.MAX_PRECISION_DIGITS;i>=0;i--){try{n.bufferReducedPrecision(i)}catch(m){if(!(m instanceof lo))throw m;n._saveException=m}if(n._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var s=arguments[0],u=qn.precisionScaleFactor(this._argGeom,this._distance,s),c=new ie(u);this.bufferFixedPrecision(c)}},qn.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var n=this._argGeom.getFactory().getPrecisionModel();n.getType()===ie.FIXED?this.bufferFixedPrecision(n):this.bufferReducedPrecision()},qn.prototype.setQuadrantSegments=function(n){this._bufParams.setQuadrantSegments(n)},qn.prototype.bufferOriginalPrecision=function(){try{var n=new lr(this._bufParams);this._resultGeometry=n.buffer(this._argGeom,this._distance)}catch(i){if(!(i instanceof J))throw i;this._saveException=i}},qn.prototype.getResultGeometry=function(n){return this._distance=n,this.computeGeometry(),this._resultGeometry},qn.prototype.setEndCapStyle=function(n){this._bufParams.setEndCapStyle(n)},qn.prototype.interfaces_=function(){return[]},qn.prototype.getClass=function(){return qn},qn.bufferOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new qn(n).getResultGeometry(i)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof j&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1],c=arguments[2],m=new qn(s);return m.setQuadrantSegments(c),m.getResultGeometry(u)}if(arguments[2]instanceof We&&arguments[0]instanceof j&&typeof arguments[1]=="number"){var E=arguments[0],A=arguments[1],U=arguments[2];return new qn(E,U).getResultGeometry(A)}}else if(arguments.length===4){var $=arguments[0],ut=arguments[1],ht=arguments[2],At=arguments[3],Rt=new qn($);return Rt.setQuadrantSegments(ht),Rt.setEndCapStyle(At),Rt.getResultGeometry(ut)}},qn.precisionScaleFactor=function(n,i,s){var u=n.getEnvelopeInternal(),c=it.max(Math.abs(u.getMaxX()),Math.abs(u.getMaxY()),Math.abs(u.getMinX()),Math.abs(u.getMinY()))+2*(i>0?i:0),m=s-Math.trunc(Math.log(c)/Math.log(10)+1);return Math.pow(10,m)},ga.CAP_ROUND.get=function(){return We.CAP_ROUND},ga.CAP_BUTT.get=function(){return We.CAP_FLAT},ga.CAP_FLAT.get=function(){return We.CAP_FLAT},ga.CAP_SQUARE.get=function(){return We.CAP_SQUARE},ga.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(qn,ga);var cr=function(){this._pt=[new L,new L],this._distance=w.NaN,this._isNull=!0};cr.prototype.getCoordinates=function(){return this._pt},cr.prototype.getCoordinate=function(n){return this._pt[n]},cr.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 u=i.distance(s);u<this._distance&&this.initialize(i,s,u)}},cr.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],u=arguments[1],c=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(u),this._distance=c,this._isNull=!1}},cr.prototype.getDistance=function(){return this._distance},cr.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 u=i.distance(s);u>this._distance&&this.initialize(i,s,u)}},cr.prototype.interfaces_=function(){return[]},cr.prototype.getClass=function(){return cr};var Xi=function(){};Xi.prototype.interfaces_=function(){return[]},Xi.prototype.getClass=function(){return Xi},Xi.computeDistance=function(){if(arguments[2]instanceof cr&&arguments[0]instanceof Bt&&arguments[1]instanceof L)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=n.getCoordinates(),c=new $t,m=0;m<u.length-1;m++){c.setCoordinates(u[m],u[m+1]);var E=c.closestPoint(i);s.setMinimum(E,i)}else if(arguments[2]instanceof cr&&arguments[0]instanceof Vt&&arguments[1]instanceof L){var A=arguments[0],U=arguments[1],$=arguments[2];Xi.computeDistance(A.getExteriorRing(),U,$);for(var ut=0;ut<A.getNumInteriorRing();ut++)Xi.computeDistance(A.getInteriorRingN(ut),U,$)}else if(arguments[2]instanceof cr&&arguments[0]instanceof j&&arguments[1]instanceof L){var ht=arguments[0],At=arguments[1],Rt=arguments[2];if(ht instanceof Bt)Xi.computeDistance(ht,At,Rt);else if(ht instanceof Vt)Xi.computeDistance(ht,At,Rt);else if(ht instanceof Hn)for(var kt=ht,ee=0;ee<kt.getNumGeometries();ee++){var on=kt.getGeometryN(ee);Xi.computeDistance(on,At,Rt)}else Rt.setMinimum(ht.getCoordinate(),At)}else if(arguments[2]instanceof cr&&arguments[0]instanceof $t&&arguments[1]instanceof L){var Rn=arguments[0],dr=arguments[1],Ji=arguments[2],Bo=Rn.closestPoint(dr);Ji.setMinimum(Bo,dr)}};var is=function(n){this._maxPtDist=new cr,this._inputGeom=n||null},Cf={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};is.prototype.computeMaxMidpointDistance=function(n){var i=new Lo(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},is.prototype.computeMaxVertexDistance=function(n){var i=new Fs(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},is.prototype.findDistance=function(n){return this.computeMaxVertexDistance(n),this.computeMaxMidpointDistance(n),this._maxPtDist.getDistance()},is.prototype.getDistancePoints=function(){return this._maxPtDist},is.prototype.interfaces_=function(){return[]},is.prototype.getClass=function(){return is},Cf.MaxPointDistanceFilter.get=function(){return Fs},Cf.MaxMidpointDistanceFilter.get=function(){return Lo},Object.defineProperties(is,Cf);var Fs=function(n){this._maxPtDist=new cr,this._minPtDist=new cr,this._geom=n||null};Fs.prototype.filter=function(n){this._minPtDist.initialize(),Xi.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Fs.prototype.getMaxPointDistance=function(){return this._maxPtDist},Fs.prototype.interfaces_=function(){return[Mt]},Fs.prototype.getClass=function(){return Fs};var Lo=function(n){this._maxPtDist=new cr,this._minPtDist=new cr,this._geom=n||null};Lo.prototype.filter=function(n,i){if(i===0)return null;var s=n.getCoordinate(i-1),u=n.getCoordinate(i),c=new L((s.x+u.x)/2,(s.y+u.y)/2);this._minPtDist.initialize(),Xi.computeDistance(this._geom,c,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Lo.prototype.isDone=function(){return!1},Lo.prototype.isGeometryChanged=function(){return!1},Lo.prototype.getMaxPointDistance=function(){return this._maxPtDist},Lo.prototype.interfaces_=function(){return[Hr]},Lo.prototype.getClass=function(){return Lo};var po=function(n){this._comps=n||null};po.prototype.filter=function(n){n instanceof Vt&&this._comps.add(n)},po.prototype.interfaces_=function(){return[ni]},po.prototype.getClass=function(){return po},po.getPolygons=function(){if(arguments.length===1){var n=arguments[0];return po.getPolygons(n,new Q)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof Vt?s.add(i):i instanceof Hn&&i.apply(new po(s)),s}};var Xn=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}};Xn.prototype.filter=function(n){if(this._isForcedToLineString&&n instanceof sn){var i=n.getFactory().createLineString(n.getCoordinateSequence());return this._lines.add(i),null}n instanceof Bt&&this._lines.add(n)},Xn.prototype.setForceToLineString=function(n){this._isForcedToLineString=n},Xn.prototype.interfaces_=function(){return[ct]},Xn.prototype.getClass=function(){return Xn},Xn.getGeometry=function(){if(arguments.length===1){var n=arguments[0];return n.getFactory().buildGeometry(Xn.getLines(n))}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().buildGeometry(Xn.getLines(i,s))}},Xn.getLines=function(){if(arguments.length===1){var n=arguments[0];return Xn.getLines(n,!1)}if(arguments.length===2){if(X(arguments[0],Ot)&&X(arguments[1],Ot)){for(var i=arguments[0],s=arguments[1],u=i.iterator();u.hasNext();){var c=u.next();Xn.getLines(c,s)}return s}if(arguments[0]instanceof j&&typeof arguments[1]=="boolean"){var m=arguments[0],E=arguments[1],A=new Q;return m.apply(new Xn(A,E)),A}if(arguments[0]instanceof j&&X(arguments[1],Ot)){var U=arguments[0],$=arguments[1];return U instanceof Bt?$.add(U):U.apply(new Xn($)),$}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&X(arguments[0],Ot)&&X(arguments[1],Ot)){for(var ut=arguments[0],ht=arguments[1],At=arguments[2],Rt=ut.iterator();Rt.hasNext();){var kt=Rt.next();Xn.getLines(kt,ht,At)}return ht}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof j&&X(arguments[1],Ot)){var ee=arguments[0],on=arguments[1],Rn=arguments[2];return ee.apply(new Xn(on,Rn)),on}}};var vi=function(){if(this._boundaryRule=Lt.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 C("Rule must be non-null");this._boundaryRule=n}}};vi.prototype.locateInternal=function(){if(arguments[0]instanceof L&&arguments[1]instanceof Vt){var n=arguments[0],i=arguments[1];if(i.isEmpty())return k.EXTERIOR;var s=i.getExteriorRing(),u=this.locateInPolygonRing(n,s);if(u===k.EXTERIOR)return k.EXTERIOR;if(u===k.BOUNDARY)return k.BOUNDARY;for(var c=0;c<i.getNumInteriorRing();c++){var m=i.getInteriorRingN(c),E=this.locateInPolygonRing(n,m);if(E===k.INTERIOR)return k.EXTERIOR;if(E===k.BOUNDARY)return k.BOUNDARY}return k.INTERIOR}if(arguments[0]instanceof L&&arguments[1]instanceof Bt){var A=arguments[0],U=arguments[1];if(!U.getEnvelopeInternal().intersects(A))return k.EXTERIOR;var $=U.getCoordinates();return U.isClosed()||!A.equals($[0])&&!A.equals($[$.length-1])?B.isOnLine(A,$)?k.INTERIOR:k.EXTERIOR:k.BOUNDARY}if(arguments[0]instanceof L&&arguments[1]instanceof jt){var ut=arguments[0];return arguments[1].getCoordinate().equals2D(ut)?k.INTERIOR:k.EXTERIOR}},vi.prototype.locateInPolygonRing=function(n,i){return i.getEnvelopeInternal().intersects(n)?B.locatePointInRing(n,i.getCoordinates()):k.EXTERIOR},vi.prototype.intersects=function(n,i){return this.locate(n,i)!==k.EXTERIOR},vi.prototype.updateLocationInfo=function(n){n===k.INTERIOR&&(this._isIn=!0),n===k.BOUNDARY&&this._numBoundaries++},vi.prototype.computeLocation=function(n,i){if(i instanceof jt&&this.updateLocationInfo(this.locateInternal(n,i)),i instanceof Bt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof Vt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof H)for(var s=i,u=0;u<s.getNumGeometries();u++){var c=s.getGeometryN(u);this.updateLocationInfo(this.locateInternal(n,c))}else if(i instanceof un)for(var m=i,E=0;E<m.getNumGeometries();E++){var A=m.getGeometryN(E);this.updateLocationInfo(this.locateInternal(n,A))}else if(i instanceof Hn)for(var U=new Hi(i);U.hasNext();){var $=U.next();$!==i&&this.computeLocation(n,$)}},vi.prototype.locate=function(n,i){return i.isEmpty()?k.EXTERIOR:i instanceof Bt?this.locateInternal(n,i):i instanceof Vt?this.locateInternal(n,i):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(n,i),this._boundaryRule.isInBoundary(this._numBoundaries)?k.BOUNDARY:this._numBoundaries>0||this._isIn?k.INTERIOR:k.EXTERIOR)},vi.prototype.interfaces_=function(){return[]},vi.prototype.getClass=function(){return vi};var fr=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 u=arguments[0],c=arguments[1],m=arguments[2];this._component=u,this._segIndex=c,this._pt=m}},cm={INSIDE_AREA:{configurable:!0}};fr.prototype.isInsideArea=function(){return this._segIndex===fr.INSIDE_AREA},fr.prototype.getCoordinate=function(){return this._pt},fr.prototype.getGeometryComponent=function(){return this._component},fr.prototype.getSegmentIndex=function(){return this._segIndex},fr.prototype.interfaces_=function(){return[]},fr.prototype.getClass=function(){return fr},cm.INSIDE_AREA.get=function(){return-1},Object.defineProperties(fr,cm);var No=function(n){this._pts=n||null};No.prototype.filter=function(n){n instanceof jt&&this._pts.add(n)},No.prototype.interfaces_=function(){return[ni]},No.prototype.getClass=function(){return No},No.getPoints=function(){if(arguments.length===1){var n=arguments[0];return n instanceof jt?gi.singletonList(n):No.getPoints(n,new Q)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof jt?s.add(i):i instanceof Hn&&i.apply(new No(s)),s}};var Us=function(){this._locations=null;var n=arguments[0];this._locations=n};Us.prototype.filter=function(n){(n instanceof jt||n instanceof Bt||n instanceof Vt)&&this._locations.add(new fr(n,0,n.getCoordinate()))},Us.prototype.interfaces_=function(){return[ni]},Us.prototype.getClass=function(){return Us},Us.getLocations=function(n){var i=new Q;return n.apply(new Us(i)),i};var Yn=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new vi,this._minDistanceLocation=null,this._minDistance=w.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],u=arguments[1],c=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=s,this._geom[1]=u,this._terminateDistance=c}};Yn.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],u=1-i,c=po.getPolygons(this._geom[i]);if(c.size()>0){var m=Us.getLocations(this._geom[u]);if(this.computeContainmentDistance(m,c,s),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[u]=s[0],this._minDistanceLocation[i]=s[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&X(arguments[0],St)&&X(arguments[1],St)){for(var E=arguments[0],A=arguments[1],U=arguments[2],$=0;$<E.size();$++)for(var ut=E.get($),ht=0;ht<A.size();ht++)if(this.computeContainmentDistance(ut,A.get(ht),U),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof fr&&arguments[1]instanceof Vt){var At=arguments[0],Rt=arguments[1],kt=arguments[2],ee=At.getCoordinate();if(k.EXTERIOR!==this._ptLocator.locate(ee,Rt))return this._minDistance=0,kt[0]=At,kt[1]=new fr(Rt,ee),null}}},Yn.prototype.computeMinDistanceLinesPoints=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m);if(this.computeMinDistance(c,E,s),this._minDistance<=this._terminateDistance)return null}},Yn.prototype.computeFacetDistance=function(){var n=new Array(2).fill(null),i=Xn.getLines(this._geom[0]),s=Xn.getLines(this._geom[1]),u=No.getPoints(this._geom[0]),c=No.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,c,n),this.updateMinDistance(n,!1),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistanceLinesPoints(s,u,n),this.updateMinDistance(n,!0),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistancePoints(u,c,n),void this.updateMinDistance(n,!1))))},Yn.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},Yn.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])},Yn.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},Yn.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 Bt&&arguments[1]instanceof jt){var n=arguments[0],i=arguments[1],s=arguments[2];if(n.getEnvelopeInternal().distance(i.getEnvelopeInternal())>this._minDistance)return null;for(var u=n.getCoordinates(),c=i.getCoordinate(),m=0;m<u.length-1;m++){var E=B.distancePointLine(c,u[m],u[m+1]);if(E<this._minDistance){this._minDistance=E;var A=new $t(u[m],u[m+1]).closestPoint(c);s[0]=new fr(n,m,A),s[1]=new fr(i,0,c)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Bt&&arguments[1]instanceof Bt){var U=arguments[0],$=arguments[1],ut=arguments[2];if(U.getEnvelopeInternal().distance($.getEnvelopeInternal())>this._minDistance)return null;for(var ht=U.getCoordinates(),At=$.getCoordinates(),Rt=0;Rt<ht.length-1;Rt++)for(var kt=0;kt<At.length-1;kt++){var ee=B.distanceLineLine(ht[Rt],ht[Rt+1],At[kt],At[kt+1]);if(ee<this._minDistance){this._minDistance=ee;var on=new $t(ht[Rt],ht[Rt+1]),Rn=new $t(At[kt],At[kt+1]),dr=on.closestPoints(Rn);ut[0]=new fr(U,Rt,dr[0]),ut[1]=new fr($,kt,dr[1])}if(this._minDistance<=this._terminateDistance)return null}}}},Yn.prototype.computeMinDistancePoints=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m),A=c.getCoordinate().distance(E.getCoordinate());if(A<this._minDistance&&(this._minDistance=A,s[0]=new fr(c,0,c.getCoordinate()),s[1]=new fr(E,0,E.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},Yn.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new C("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},Yn.prototype.computeMinDistanceLines=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m);if(this.computeMinDistance(c,E,s),this._minDistance<=this._terminateDistance)return null}},Yn.prototype.interfaces_=function(){return[]},Yn.prototype.getClass=function(){return Yn},Yn.distance=function(n,i){return new Yn(n,i).distance()},Yn.isWithinDistance=function(n,i,s){return new Yn(n,i,s).distance()<=s},Yn.nearestPoints=function(n,i){return new Yn(n,i).nearestPoints()};var tr=function(){this._pt=[new L,new L],this._distance=w.NaN,this._isNull=!0};tr.prototype.getCoordinates=function(){return this._pt},tr.prototype.getCoordinate=function(n){return this._pt[n]},tr.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 u=i.distance(s);u<this._distance&&this.initialize(i,s,u)}},tr.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],u=arguments[1],c=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(u),this._distance=c,this._isNull=!1}},tr.prototype.toString=function(){return qt.toLineString(this._pt[0],this._pt[1])},tr.prototype.getDistance=function(){return this._distance},tr.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 u=i.distance(s);u>this._distance&&this.initialize(i,s,u)}},tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr};var Ri=function(){};Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri},Ri.computeDistance=function(){if(arguments[2]instanceof tr&&arguments[0]instanceof Bt&&arguments[1]instanceof L)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=new $t,c=n.getCoordinates(),m=0;m<c.length-1;m++){u.setCoordinates(c[m],c[m+1]);var E=u.closestPoint(i);s.setMinimum(E,i)}else if(arguments[2]instanceof tr&&arguments[0]instanceof Vt&&arguments[1]instanceof L){var A=arguments[0],U=arguments[1],$=arguments[2];Ri.computeDistance(A.getExteriorRing(),U,$);for(var ut=0;ut<A.getNumInteriorRing();ut++)Ri.computeDistance(A.getInteriorRingN(ut),U,$)}else if(arguments[2]instanceof tr&&arguments[0]instanceof j&&arguments[1]instanceof L){var ht=arguments[0],At=arguments[1],Rt=arguments[2];if(ht instanceof Bt)Ri.computeDistance(ht,At,Rt);else if(ht instanceof Vt)Ri.computeDistance(ht,At,Rt);else if(ht instanceof Hn)for(var kt=ht,ee=0;ee<kt.getNumGeometries();ee++){var on=kt.getGeometryN(ee);Ri.computeDistance(on,At,Rt)}else Rt.setMinimum(ht.getCoordinate(),At)}else if(arguments[2]instanceof tr&&arguments[0]instanceof $t&&arguments[1]instanceof L){var Rn=arguments[0],dr=arguments[1],Ji=arguments[2],Bo=Rn.closestPoint(dr);Ji.setMinimum(Bo,dr)}};var si=function(){this._g0=null,this._g1=null,this._ptDist=new tr,this._densifyFrac=0;var n=arguments[0],i=arguments[1];this._g0=n,this._g1=i},Pf={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};si.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},si.prototype.setDensifyFraction=function(n){if(n>1||n<=0)throw new C("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=n},si.prototype.compute=function(n,i){this.computeOrientedDistance(n,i,this._ptDist),this.computeOrientedDistance(i,n,this._ptDist)},si.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},si.prototype.computeOrientedDistance=function(n,i,s){var u=new Bs(i);if(n.apply(u),s.setMaximum(u.getMaxPointDistance()),this._densifyFrac>0){var c=new Oo(i,this._densifyFrac);n.apply(c),s.setMaximum(c.getMaxPointDistance())}},si.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},si.prototype.interfaces_=function(){return[]},si.prototype.getClass=function(){return si},si.distance=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new si(n,i).distance()}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=new si(s,u);return m.setDensifyFraction(c),m.distance()}},Pf.MaxPointDistanceFilter.get=function(){return Bs},Pf.MaxDensifiedByFractionDistanceFilter.get=function(){return Oo},Object.defineProperties(si,Pf);var Bs=function(){this._maxPtDist=new tr,this._minPtDist=new tr,this._euclideanDist=new Ri,this._geom=null;var n=arguments[0];this._geom=n};Bs.prototype.filter=function(n){this._minPtDist.initialize(),Ri.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Bs.prototype.getMaxPointDistance=function(){return this._maxPtDist},Bs.prototype.interfaces_=function(){return[Mt]},Bs.prototype.getClass=function(){return Bs};var Oo=function(){this._maxPtDist=new tr,this._minPtDist=new tr,this._geom=null,this._numSubSegs=0;var n=arguments[0],i=arguments[1];this._geom=n,this._numSubSegs=Math.trunc(Math.round(1/i))};Oo.prototype.filter=function(n,i){if(i===0)return null;for(var s=n.getCoordinate(i-1),u=n.getCoordinate(i),c=(u.x-s.x)/this._numSubSegs,m=(u.y-s.y)/this._numSubSegs,E=0;E<this._numSubSegs;E++){var A=s.x+E*c,U=s.y+E*m,$=new L(A,U);this._minPtDist.initialize(),Ri.computeDistance(this._geom,$,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},Oo.prototype.isDone=function(){return!1},Oo.prototype.isGeometryChanged=function(){return!1},Oo.prototype.getMaxPointDistance=function(){return this._maxPtDist},Oo.prototype.interfaces_=function(){return[Hr]},Oo.prototype.getClass=function(){return Oo};var Fr=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},If={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Fr.prototype.checkMaximumDistance=function(n,i,s){var u=new si(i,n);if(u.setDensifyFraction(.25),this._maxDistanceFound=u.orientedDistance(),this._maxDistanceFound>s){this._isValid=!1;var c=u.getCoordinates();this._errorLocation=c[1],this._errorIndicator=n.getFactory().createLineString(c),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+qt.toLineString(c[0],c[1])+")"}},Fr.prototype.isValid=function(){var n=Math.abs(this._bufDistance),i=Fr.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(),Fr.VERBOSE&&Nt.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Fr.prototype.checkNegativeValid=function(){if(!(this._input instanceof Vt||this._input instanceof un||this._input instanceof Hn))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)},Fr.prototype.getErrorIndicator=function(){return this._errorIndicator},Fr.prototype.checkMinimumDistance=function(n,i,s){var u=new Yn(n,i,s);if(this._minDistanceFound=u.distance(),this._minDistanceFound<s){this._isValid=!1;var c=u.nearestPoints();this._errorLocation=u.nearestPoints()[1],this._errorIndicator=n.getFactory().createLineString(c),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+qt.toLineString(c[0],c[1])+" )"}},Fr.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)},Fr.prototype.getErrorLocation=function(){return this._errorLocation},Fr.prototype.getPolygonLines=function(n){for(var i=new Q,s=new Xn(i),u=po.getPolygons(n).iterator();u.hasNext();)u.next().apply(s);return n.getFactory().buildGeometry(i)},Fr.prototype.getErrorMessage=function(){return this._errMsg},Fr.prototype.interfaces_=function(){return[]},Fr.prototype.getClass=function(){return Fr},If.VERBOSE.get=function(){return!1},If.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Fr,If);var $n=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},Rf={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};$n.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},$n.prototype.checkEnvelope=function(){if(this._distance<0)return null;var n=this._distance*$n.MAX_ENV_DIFF_FRAC;n===0&&(n=.001);var i=new Pt(this._input.getEnvelopeInternal());i.expandBy(this._distance);var s=new Pt(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")},$n.prototype.checkDistance=function(){var n=new Fr(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")},$n.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")},$n.prototype.checkPolygonal=function(){this._result instanceof Vt||this._result instanceof un||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},$n.prototype.getErrorIndicator=function(){return this._errorIndicator},$n.prototype.getErrorLocation=function(){return this._errorLocation},$n.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"))},$n.prototype.report=function(n){if(!$n.VERBOSE)return null;Nt.out.println("Check "+n+": "+(this._isValid?"passed":"FAILED"))},$n.prototype.getErrorMessage=function(){return this._errorMsg},$n.prototype.interfaces_=function(){return[]},$n.prototype.getClass=function(){return $n},$n.isValidMsg=function(n,i,s){var u=new $n(n,i,s);return u.isValid()?null:u.getErrorMessage()},$n.isValid=function(n,i,s){return!!new $n(n,i,s).isValid()},Rf.VERBOSE.get=function(){return!1},Rf.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties($n,Rf);var Li=function(){this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};Li.prototype.getCoordinates=function(){return this._pts},Li.prototype.size=function(){return this._pts.length},Li.prototype.getCoordinate=function(n){return this._pts[n]},Li.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Li.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:Ls.octant(this.getCoordinate(n),this.getCoordinate(n+1))},Li.prototype.setData=function(n){this._data=n},Li.prototype.getData=function(){return this._data},Li.prototype.toString=function(){return qt.toLineString(new he(this._pts))},Li.prototype.interfaces_=function(){return[Vi]},Li.prototype.getClass=function(){return Li};var Gn=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new Q,this._intersectionCount=0,this._keepIntersections=!0;var n=arguments[0];this._li=n,this._interiorIntersection=null};Gn.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Gn.prototype.setCheckEndSegmentsOnly=function(n){this._isCheckEndSegmentsOnly=n},Gn.prototype.getIntersectionSegments=function(){return this._intSegments},Gn.prototype.count=function(){return this._intersectionCount},Gn.prototype.getIntersections=function(){return this._intersections},Gn.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},Gn.prototype.setKeepIntersections=function(n){this._keepIntersections=n},Gn.prototype.processIntersections=function(n,i,s,u){if(!this._findAllIntersections&&this.hasIntersection()||n===s&&i===u||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(n,i)||this.isEndSegment(s,u)))return null;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],A=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,A),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=c,this._intSegments[1]=m,this._intSegments[2]=E,this._intSegments[3]=A,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Gn.prototype.isEndSegment=function(n,i){return i===0||i>=n.size()-2},Gn.prototype.hasIntersection=function(){return this._interiorIntersection!==null},Gn.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},Gn.prototype.interfaces_=function(){return[ns]},Gn.prototype.getClass=function(){return Gn},Gn.createAllIntersectionsFinder=function(n){var i=new Gn(n);return i.setFindAllIntersections(!0),i},Gn.createAnyIntersectionFinder=function(n){return new Gn(n)},Gn.createIntersectionCounter=function(n){var i=new Gn(n);return i.setFindAllIntersections(!0),i.setKeepIntersections(!1),i};var _i=function(){this._li=new Z,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var n=arguments[0];this._segStrings=n};_i.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},_i.prototype.getIntersections=function(){return this._segInt.getIntersections()},_i.prototype.isValid=function(){return this.execute(),this._isValid},_i.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},_i.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Gn(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var n=new Af;if(n.setSegmentIntersector(this._segInt),n.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},_i.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new lo(this.getErrorMessage(),this._segInt.getInteriorIntersection())},_i.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var n=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+qt.toLineString(n[0],n[1])+" and "+qt.toLineString(n[2],n[3])},_i.prototype.interfaces_=function(){return[]},_i.prototype.getClass=function(){return _i},_i.computeIntersections=function(n){var i=new _i(n);return i.setFindAllIntersections(!0),i.isValid(),i.getIntersections()};var os=function n(){this._nv=null;var i=arguments[0];this._nv=new _i(n.toSegmentStrings(i))};os.prototype.checkValid=function(){this._nv.checkValid()},os.prototype.interfaces_=function(){return[]},os.prototype.getClass=function(){return os},os.toSegmentStrings=function(n){for(var i=new Q,s=n.iterator();s.hasNext();){var u=s.next();i.add(new Li(u.getCoordinates(),u))}return i},os.checkValid=function(n){new os(n).checkValid()};var zs=function(n){this._mapOp=n};zs.prototype.map=function(n){for(var i=new Q,s=0;s<n.getNumGeometries();s++){var u=this._mapOp.map(n.getGeometryN(s));u.isEmpty()||i.add(u)}return n.getFactory().createGeometryCollection(le.toGeometryArray(i))},zs.prototype.interfaces_=function(){return[]},zs.prototype.getClass=function(){return zs},zs.map=function(n,i){return new zs(i).map(n)};var Ni=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new Q,this._resultLineList=new Q;var n=arguments[0],i=arguments[1],s=arguments[2];this._op=n,this._geometryFactory=i,this._ptLocator=s};Ni.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)}},Ni.prototype.labelIsolatedLine=function(n,i){var s=this._ptLocator.locate(n.getCoordinate(),this._op.getArgGeometry(i));n.getLabel().setLocation(i,s)},Ni.prototype.build=function(n){return this.findCoveredLineEdges(),this.collectLines(n),this.buildLines(n),this._resultLineList},Ni.prototype.collectLineEdge=function(n,i,s){var u=n.getLabel(),c=n.getEdge();n.isLineEdge()&&(n.isVisited()||!ae.isResultOfOp(u,i)||c.isCovered()||(s.add(c),n.setVisitedEdge(!0)))},Ni.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(),u=s.getEdge();if(s.isLineEdge()&&!u.isCoveredSet()){var c=this._op.isCoveredByA(s.getCoordinate());u.setCovered(c)}}},Ni.prototype.labelIsolatedLines=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),u=s.getLabel();s.isIsolated()&&(u.isNull(0)?this.labelIsolatedLine(s,0):this.labelIsolatedLine(s,1))}},Ni.prototype.buildLines=function(n){for(var i=this._lineEdgesList.iterator();i.hasNext();){var s=i.next(),u=this._geometryFactory.createLineString(s.getCoordinates());this._resultLineList.add(u),s.setInResult(!0)}},Ni.prototype.collectBoundaryTouchEdge=function(n,i,s){var u=n.getLabel();return n.isLineEdge()||n.isVisited()||n.isInteriorAreaEdge()||n.getEdge().isInResult()?null:(b.isTrue(!(n.isInResult()||n.getSym().isInResult())||!n.getEdge().isInResult()),void(ae.isResultOfOp(u,i)&&i===ae.INTERSECTION&&(s.add(n.getEdge()),n.setVisitedEdge(!0))))},Ni.prototype.interfaces_=function(){return[]},Ni.prototype.getClass=function(){return Ni};var ks=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new Q;var n=arguments[0],i=arguments[1];this._op=n,this._geometryFactory=i};ks.prototype.filterCoveredNodeToPoint=function(n){var i=n.getCoordinate();if(!this._op.isCoveredByLA(i)){var s=this._geometryFactory.createPoint(i);this._resultPointList.add(s)}},ks.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 u=s.getLabel();ae.isResultOfOp(u,n)&&this.filterCoveredNodeToPoint(s)}}},ks.prototype.build=function(n){return this.extractNonCoveredResultNodes(n),this._resultPointList},ks.prototype.interfaces_=function(){return[]},ks.prototype.getClass=function(){return ks};var br=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};br.prototype.transformPoint=function(n,i){return this._factory.createPoint(this.transformCoordinates(n.getCoordinateSequence(),n))},br.prototype.transformPolygon=function(n,i){var s=!0,u=this.transformLinearRing(n.getExteriorRing(),n);u!==null&&u instanceof sn&&!u.isEmpty()||(s=!1);for(var c=new Q,m=0;m<n.getNumInteriorRing();m++){var E=this.transformLinearRing(n.getInteriorRingN(m),n);E===null||E.isEmpty()||(E instanceof sn||(s=!1),c.add(E))}if(s)return this._factory.createPolygon(u,c.toArray([]));var A=new Q;return u!==null&&A.add(u),A.addAll(c),this._factory.buildGeometry(A)},br.prototype.createCoordinateSequence=function(n){return this._factory.getCoordinateSequenceFactory().create(n)},br.prototype.getInputGeometry=function(){return this._inputGeom},br.prototype.transformMultiLineString=function(n,i){for(var s=new Q,u=0;u<n.getNumGeometries();u++){var c=this.transformLineString(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},br.prototype.transformCoordinates=function(n,i){return this.copy(n)},br.prototype.transformLineString=function(n,i){return this._factory.createLineString(this.transformCoordinates(n.getCoordinateSequence(),n))},br.prototype.transformMultiPoint=function(n,i){for(var s=new Q,u=0;u<n.getNumGeometries();u++){var c=this.transformPoint(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},br.prototype.transformMultiPolygon=function(n,i){for(var s=new Q,u=0;u<n.getNumGeometries();u++){var c=this.transformPolygon(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},br.prototype.copy=function(n){return n.copy()},br.prototype.transformGeometryCollection=function(n,i){for(var s=new Q,u=0;u<n.getNumGeometries();u++){var c=this.transform(n.getGeometryN(u));c!==null&&(this._pruneEmptyGeometry&&c.isEmpty()||s.add(c))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(le.toGeometryArray(s)):this._factory.buildGeometry(s)},br.prototype.transform=function(n){if(this._inputGeom=n,this._factory=n.getFactory(),n instanceof jt)return this.transformPoint(n,null);if(n instanceof fe)return this.transformMultiPoint(n,null);if(n instanceof sn)return this.transformLinearRing(n,null);if(n instanceof Bt)return this.transformLineString(n,null);if(n instanceof H)return this.transformMultiLineString(n,null);if(n instanceof Vt)return this.transformPolygon(n,null);if(n instanceof un)return this.transformMultiPolygon(n,null);if(n instanceof Hn)return this.transformGeometryCollection(n,null);throw new C("Unknown Geometry subtype: "+n.getClass().getName())},br.prototype.transformLinearRing=function(n,i){var s=this.transformCoordinates(n.getCoordinateSequence(),n);if(s===null)return this._factory.createLinearRing(null);var u=s.size();return u>0&&u<4&&!this._preserveType?this._factory.createLineString(s):this._factory.createLinearRing(s)},br.prototype.interfaces_=function(){return[]},br.prototype.getClass=function(){return br};var Yi=function n(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new $t,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Bt&&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 u=arguments[0],c=arguments[1];this._srcPts=u,this._isClosed=n.isClosed(u),this._snapTolerance=c}};Yi.prototype.snapVertices=function(n,i){for(var s=this._isClosed?n.size()-1:n.size(),u=0;u<s;u++){var c=n.get(u),m=this.findSnapForVertex(c,i);m!==null&&(n.set(u,new L(m)),u===0&&this._isClosed&&n.set(n.size()-1,new L(m)))}},Yi.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},Yi.prototype.snapTo=function(n){var i=new Dt(this._srcPts);return this.snapVertices(i,n),this.snapSegments(i,n),i.toCoordinateArray()},Yi.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 u=0;u<s;u++){var c=i[u],m=this.findSegmentIndexToSnap(c,n);m>=0&&n.add(m+1,new L(c),!1)}},Yi.prototype.findSegmentIndexToSnap=function(n,i){for(var s=w.MAX_VALUE,u=-1,c=0;c<i.size()-1;c++){if(this._seg.p0=i.get(c),this._seg.p1=i.get(c+1),this._seg.p0.equals2D(n)||this._seg.p1.equals2D(n)){if(this._allowSnappingToSourceVertices)continue;return-1}var m=this._seg.distance(n);m<this._snapTolerance&&m<s&&(s=m,u=c)}return u},Yi.prototype.setAllowSnappingToSourceVertices=function(n){this._allowSnappingToSourceVertices=n},Yi.prototype.interfaces_=function(){return[]},Yi.prototype.getClass=function(){return Yi},Yi.isClosed=function(n){return!(n.length<=1)&&n[0].equals2D(n[n.length-1])};var Tn=function(n){this._srcGeom=n||null},fm={SNAP_PRECISION_FACTOR:{configurable:!0}};Tn.prototype.snapTo=function(n,i){var s=this.extractTargetCoordinates(n);return new hm(i,s).transform(this._srcGeom)},Tn.prototype.snapToSelf=function(n,i){var s=this.extractTargetCoordinates(this._srcGeom),u=new hm(n,s,!0).transform(this._srcGeom),c=u;return i&&X(c,ce)&&(c=u.buffer(0)),c},Tn.prototype.computeSnapTolerance=function(n){return this.computeMinimumSegmentLength(n)/10},Tn.prototype.extractTargetCoordinates=function(n){for(var i=new M,s=n.getCoordinates(),u=0;u<s.length;u++)i.add(s[u]);return i.toArray(new Array(0).fill(null))},Tn.prototype.computeMinimumSegmentLength=function(n){for(var i=w.MAX_VALUE,s=0;s<n.length-1;s++){var u=n[s].distance(n[s+1]);u<i&&(i=u)}return i},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn},Tn.snap=function(n,i,s){var u=new Array(2).fill(null),c=new Tn(n);u[0]=c.snapTo(i,s);var m=new Tn(i);return u[1]=m.snapTo(u[0],s),u},Tn.computeOverlaySnapTolerance=function(){if(arguments.length===1){var n=arguments[0],i=Tn.computeSizeBasedSnapTolerance(n),s=n.getPrecisionModel();if(s.getType()===ie.FIXED){var u=1/s.getScale()*2/1.415;u>i&&(i=u)}return i}if(arguments.length===2){var c=arguments[0],m=arguments[1];return Math.min(Tn.computeOverlaySnapTolerance(c),Tn.computeOverlaySnapTolerance(m))}},Tn.computeSizeBasedSnapTolerance=function(n){var i=n.getEnvelopeInternal();return Math.min(i.getHeight(),i.getWidth())*Tn.SNAP_PRECISION_FACTOR},Tn.snapToSelf=function(n,i,s){return new Tn(n).snapToSelf(i,s)},fm.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Tn,fm);var hm=function(n){function i(s,u,c){n.call(this),this._snapTolerance=s||null,this._snapPts=u||null,this._isSelfSnap=c!==void 0&&c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.snapLine=function(s,u){var c=new Yi(s,this._snapTolerance);return c.setAllowSnappingToSourceVertices(this._isSelfSnap),c.snapTo(u)},i.prototype.transformCoordinates=function(s,u){var c=s.toCoordinateArray(),m=this.snapLine(c,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(br),hr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};hr.prototype.getCommon=function(){return w.longBitsToDouble(this._commonBits)},hr.prototype.add=function(n){var i=w.doubleToLongBits(n);if(this._isFirst)return this._commonBits=i,this._commonSignExp=hr.signExpBits(this._commonBits),this._isFirst=!1,null;if(hr.signExpBits(i)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=hr.numCommonMostSigMantissaBits(this._commonBits,i),this._commonBits=hr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},hr.prototype.toString=function(){if(arguments.length===1){var n=arguments[0],i=w.longBitsToDouble(n),s="0000000000000000000000000000000000000000000000000000000000000000"+w.toBinaryString(n),u=s.substring(s.length-64);return u.substring(0,1)+" "+u.substring(1,12)+"(exp) "+u.substring(12)+" [ "+i+" ]"}},hr.prototype.interfaces_=function(){return[]},hr.prototype.getClass=function(){return hr},hr.getBit=function(n,i){return n&1<<i?1:0},hr.signExpBits=function(n){return n>>52},hr.zeroLowerBits=function(n,i){return n&~((1<<i)-1)},hr.numCommonMostSigMantissaBits=function(n,i){for(var s=0,u=52;u>=0;u--){if(hr.getBit(n,u)!==hr.getBit(i,u))return s;s++}return 52};var Do=function(){this._commonCoord=null,this._ccFilter=new Gs},Lf={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Do.prototype.addCommonBits=function(n){var i=new Fo(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 L(this._commonCoord);i.x=-i.x,i.y=-i.y;var s=new Fo(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},Lf.CommonCoordinateFilter.get=function(){return Gs},Lf.Translater.get=function(){return Fo},Object.defineProperties(Do,Lf);var Gs=function(){this._commonBitsX=new hr,this._commonBitsY=new hr};Gs.prototype.filter=function(n){this._commonBitsX.add(n.x),this._commonBitsY.add(n.y)},Gs.prototype.getCommonCoordinate=function(){return new L(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Gs.prototype.interfaces_=function(){return[Mt]},Gs.prototype.getClass=function(){return Gs};var Fo=function(){this.trans=null;var n=arguments[0];this.trans=n};Fo.prototype.filter=function(n,i){var s=n.getOrdinate(i,0)+this.trans.x,u=n.getOrdinate(i,1)+this.trans.y;n.setOrdinate(i,0,s),n.setOrdinate(i,1,u)},Fo.prototype.isDone=function(){return!1},Fo.prototype.isGeometryChanged=function(){return!0},Fo.prototype.interfaces_=function(){return[Hr]},Fo.prototype.getClass=function(){return Fo};var Vn=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()};Vn.prototype.selfSnap=function(n){return new Tn(n).snapTo(n,this._snapTolerance)},Vn.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},Vn.prototype.prepareResult=function(n){return this._cbr.addCommonBits(n),n},Vn.prototype.getResultGeometry=function(n){var i=this.snap(this._geom),s=ae.overlayOp(i[0],i[1],n);return this.prepareResult(s)},Vn.prototype.checkValid=function(n){n.isValid()||Nt.out.println("Snapped geometry is invalid")},Vn.prototype.computeSnapTolerance=function(){this._snapTolerance=Tn.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Vn.prototype.snap=function(n){var i=this.removeCommonBits(n);return Tn.snap(i[0],i[1],this._snapTolerance)},Vn.prototype.interfaces_=function(){return[]},Vn.prototype.getClass=function(){return Vn},Vn.overlayOp=function(n,i,s){return new Vn(n,i).getResultGeometry(s)},Vn.union=function(n,i){return Vn.overlayOp(n,i,ae.UNION)},Vn.intersection=function(n,i){return Vn.overlayOp(n,i,ae.INTERSECTION)},Vn.symDifference=function(n,i){return Vn.overlayOp(n,i,ae.SYMDIFFERENCE)},Vn.difference=function(n,i){return Vn.overlayOp(n,i,ae.DIFFERENCE)};var pr=function(n,i){this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i};pr.prototype.getResultGeometry=function(n){var i=null,s=!1,u=null;try{i=ae.overlayOp(this._geom[0],this._geom[1],n),s=!0}catch(c){if(!(c instanceof J))throw c;u=c}if(!s)try{i=Vn.overlayOp(this._geom[0],this._geom[1],n)}catch(c){throw c instanceof J?u:c}return i},pr.prototype.interfaces_=function(){return[]},pr.prototype.getClass=function(){return pr},pr.overlayOp=function(n,i,s){return new pr(n,i).getResultGeometry(s)},pr.union=function(n,i){return pr.overlayOp(n,i,ae.UNION)},pr.intersection=function(n,i){return pr.overlayOp(n,i,ae.INTERSECTION)},pr.symDifference=function(n,i){return pr.overlayOp(n,i,ae.SYMDIFFERENCE)},pr.difference=function(n,i){return pr.overlayOp(n,i,ae.DIFFERENCE)};var Cu=function(){this.mce=null,this.chainIndex=null;var n=arguments[0],i=arguments[1];this.mce=n,this.chainIndex=i};Cu.prototype.computeIntersections=function(n,i){this.mce.computeIntersectsForChain(this.chainIndex,n.mce,n.chainIndex,i)},Cu.prototype.interfaces_=function(){return[]},Cu.prototype.getClass=function(){return Cu};var Ur=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 u=arguments[0],c=arguments[1],m=arguments[2];this._eventType=n.INSERT,this._label=u,this._xValue=c,this._obj=m}},Nf={INSERT:{configurable:!0},DELETE:{configurable:!0}};Ur.prototype.isDelete=function(){return this._eventType===Ur.DELETE},Ur.prototype.setDeleteEventIndex=function(n){this._deleteEventIndex=n},Ur.prototype.getObject=function(){return this._obj},Ur.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},Ur.prototype.getInsertEvent=function(){return this._insertEvent},Ur.prototype.isInsert=function(){return this._eventType===Ur.INSERT},Ur.prototype.isSameLabel=function(n){return this._label!==null&&this._label===n._label},Ur.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Ur.prototype.interfaces_=function(){return[F]},Ur.prototype.getClass=function(){return Ur},Nf.INSERT.get=function(){return 1},Nf.DELETE.get=function(){return 2},Object.defineProperties(Ur,Nf);var Rl=function(){};Rl.prototype.interfaces_=function(){return[]},Rl.prototype.getClass=function(){return Rl};var Zn=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};Zn.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(Zn.isAdjacentSegments(i,u))return!0;if(n.isClosed()){var c=n.getNumPoints()-1;if(i===0&&u===c||u===0&&i===c)return!0}}return!1},Zn.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Zn.prototype.setIsDoneIfProperInt=function(n){this._isDoneWhenProperInt=n},Zn.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Zn.prototype.isBoundaryPointInternal=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next().getCoordinate();if(n.isIntersection(u))return!0}return!1},Zn.prototype.hasProperIntersection=function(){return this._hasProper},Zn.prototype.hasIntersection=function(){return this._hasIntersection},Zn.prototype.isDone=function(){return this._isDone},Zn.prototype.isBoundaryPoint=function(n,i){return i!==null&&(!!this.isBoundaryPointInternal(n,i[0])||!!this.isBoundaryPointInternal(n,i[1]))},Zn.prototype.setBoundaryNodes=function(n,i){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=n,this._bdyNodes[1]=i},Zn.prototype.addIntersections=function(n,i,s,u){if(n===s&&i===u)return null;this.numTests++;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],A=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,A),this._li.hasIntersection()&&(this._recordIsolated&&(n.setIsolated(!1),s.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(n,i,s,u)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,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))))},Zn.prototype.interfaces_=function(){return[]},Zn.prototype.getClass=function(){return Zn},Zn.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var D1=function(n){function i(){n.call(this),this.events=new Q,this.nOverlaps=null}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.prepareEvents=function(){gi.sort(this.events);for(var s=0;s<this.events.size();s++){var u=this.events.get(s);u.isDelete()&&u.getInsertEvent().setDeleteEventIndex(s)}},i.prototype.computeIntersections=function(){if(arguments.length===1){var s=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var u=0;u<this.events.size();u++){var c=this.events.get(u);if(c.isInsert()&&this.processOverlaps(u,c.getDeleteEventIndex(),c,s),s.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof Zn&&X(arguments[0],St)&&X(arguments[1],St)){var m=arguments[0],E=arguments[1],A=arguments[2];this.addEdges(m,m),this.addEdges(E,E),this.computeIntersections(A)}else if(typeof arguments[2]=="boolean"&&X(arguments[0],St)&&arguments[1]instanceof Zn){var U=arguments[0],$=arguments[1];arguments[2]?this.addEdges(U,null):this.addEdges(U),this.computeIntersections($)}}},i.prototype.addEdge=function(s,u){for(var c=s.getMonotoneChainEdge(),m=c.getStartIndexes(),E=0;E<m.length-1;E++){var A=new Cu(c,E),U=new Ur(u,c.getMinX(E),A);this.events.add(U),this.events.add(new Ur(c.getMaxX(E),U))}},i.prototype.processOverlaps=function(s,u,c,m){for(var E=c.getObject(),A=s;A<u;A++){var U=this.events.get(A);if(U.isInsert()){var $=U.getObject();c.isSameLabel(U)||(E.computeIntersections($,m),this.nOverlaps++)}}},i.prototype.addEdges=function(){if(arguments.length===1)for(var s=arguments[0].iterator();s.hasNext();){var u=s.next();this.addEdge(u,u)}else if(arguments.length===2)for(var c=arguments[0],m=arguments[1],E=c.iterator();E.hasNext();){var A=E.next();this.addEdge(A,m)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Rl),$i=function(){this._min=w.POSITIVE_INFINITY,this._max=w.NEGATIVE_INFINITY},pm={NodeComparator:{configurable:!0}};$i.prototype.getMin=function(){return this._min},$i.prototype.intersects=function(n,i){return!(this._min>i||this._max<n)},$i.prototype.getMax=function(){return this._max},$i.prototype.toString=function(){return qt.toLineString(new L(this._min,0),new L(this._max,0))},$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i},pm.NodeComparator.get=function(){return Pu},Object.defineProperties($i,pm);var Pu=function(){};Pu.prototype.compare=function(n,i){var s=n,u=i,c=(s._min+s._max)/2,m=(u._min+u._max)/2;return c<m?-1:c>m?1:0},Pu.prototype.interfaces_=function(){return[z]},Pu.prototype.getClass=function(){return Pu};var F1=function(n){function i(){n.call(this),this._item=null;var s=arguments[0],u=arguments[1],c=arguments[2];this._min=s,this._max=u,this._item=c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.query=function(s,u,c){if(!this.intersects(s,u))return null;c.visitItem(this._item)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}($i),U1=function(n){function i(){n.call(this),this._node1=null,this._node2=null;var s=arguments[0],u=arguments[1];this._node1=s,this._node2=u,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,u){this._min=Math.min(s._min,u._min),this._max=Math.max(s._max,u._max)},i.prototype.query=function(s,u,c){if(!this.intersects(s,u))return null;this._node1!==null&&this._node1.query(s,u,c),this._node2!==null&&this._node2.query(s,u,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}($i),Zi=function(){this._leaves=new Q,this._root=null,this._level=0};Zi.prototype.buildTree=function(){gi.sort(this._leaves,new $i.NodeComparator);for(var n=this._leaves,i=null,s=new Q;;){if(this.buildLevel(n,s),s.size()===1)return s.get(0);i=n,n=s,s=i}},Zi.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 F1(n,i,s))},Zi.prototype.query=function(n,i,s){this.init(),this._root.query(n,i,s)},Zi.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},Zi.prototype.printNode=function(n){Nt.out.println(qt.toLineString(new L(n._min,this._level),new L(n._max,this._level)))},Zi.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},Zi.prototype.buildLevel=function(n,i){this._level++,i.clear();for(var s=0;s<n.size();s+=2){var u=n.get(s);if((s+1<n.size()?n.get(s):null)===null)i.add(u);else{var c=new U1(n.get(s),n.get(s+1));i.add(c)}}},Zi.prototype.interfaces_=function(){return[]},Zi.prototype.getClass=function(){return Zi};var ya=function(){this._items=new Q};ya.prototype.visitItem=function(n){this._items.add(n)},ya.prototype.getItems=function(){return this._items},ya.prototype.interfaces_=function(){return[Co]},ya.prototype.getClass=function(){return ya};var va=function(){this._index=null;var n=arguments[0];if(!X(n,ce))throw new C("Argument must be Polygonal");this._index=new ss(n)},Of={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};va.prototype.locate=function(n){var i=new P(n),s=new _a(i);return this._index.query(n.y,n.y,s),i.getLocation()},va.prototype.interfaces_=function(){return[da]},va.prototype.getClass=function(){return va},Of.SegmentVisitor.get=function(){return _a},Of.IntervalIndexedGeometry.get=function(){return ss},Object.defineProperties(va,Of);var _a=function(){this._counter=null;var n=arguments[0];this._counter=n};_a.prototype.visitItem=function(n){var i=n;this._counter.countSegment(i.getCoordinate(0),i.getCoordinate(1))},_a.prototype.interfaces_=function(){return[Co]},_a.prototype.getClass=function(){return _a};var ss=function(){this._index=new Zi;var n=arguments[0];this.init(n)};ss.prototype.init=function(n){for(var i=Xn.getLines(n).iterator();i.hasNext();){var s=i.next().getCoordinates();this.addLine(s)}},ss.prototype.addLine=function(n){for(var i=1;i<n.length;i++){var s=new $t(n[i-1],n[i]),u=Math.min(s.p0.y,s.p1.y),c=Math.max(s.p0.y,s.p1.y);this._index.insert(u,c,s)}},ss.prototype.query=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new ya;return this._index.query(n,i,s),s.getItems()}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];this._index.query(u,c,m)}},ss.prototype.interfaces_=function(){return[]},ss.prototype.getClass=function(){return ss};var Iu=function(n){function i(){if(n.call(this),this._parentGeom=null,this._lineEdgeMap=new ca,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new vi,arguments.length===2){var s=arguments[0],u=arguments[1],c=Lt.OGC_SFS_BOUNDARY_RULE;this._argIndex=s,this._parentGeom=u,this._boundaryNodeRule=c,u!==null&&this.add(u)}else if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];this._argIndex=m,this._parentGeom=E,this._boundaryNodeRule=A,E!==null&&this.add(E)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.insertBoundaryPoint=function(s,u){var c=this._nodes.addNode(u).getLabel(),m=1;k.NONE,c.getLocation(s,bt.ON)===k.BOUNDARY&&m++;var E=i.determineBoundary(this._boundaryNodeRule,m);c.setLocation(s,E)},i.prototype.computeSelfNodes=function(){if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.computeSelfNodes(s,u,!1)}if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2],A=new Zn(c,!0,!1);A.setIsDoneIfProperInt(E);var U=this.createEdgeSetIntersector(),$=this._parentGeom instanceof sn||this._parentGeom instanceof Vt||this._parentGeom instanceof un,ut=m||!$;return U.computeIntersections(this._edges,A,ut),this.addSelfIntersectionNodes(this._argIndex),A}},i.prototype.computeSplitEdges=function(s){for(var u=this._edges.iterator();u.hasNext();)u.next().eiList.addSplitEdges(s)},i.prototype.computeEdgeIntersections=function(s,u,c){var m=new Zn(u,c,!0);return m.setBoundaryNodes(this.getBoundaryNodes(),s.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,s._edges,m),m},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 jt){var s=arguments[0].getCoordinate();this.insertPoint(this._argIndex,s,k.INTERIOR)}else if(arguments[0]instanceof L){var u=arguments[0];this.insertPoint(this._argIndex,u,k.INTERIOR)}},i.prototype.addPolygon=function(s){this.addPolygonRing(s.getExteriorRing(),k.EXTERIOR,k.INTERIOR);for(var u=0;u<s.getNumInteriorRing();u++){var c=s.getInteriorRingN(u);this.addPolygonRing(c,k.INTERIOR,k.EXTERIOR)}},i.prototype.addEdge=function(s){this.insertEdge(s);var u=s.getCoordinates();this.insertPoint(this._argIndex,u[0],k.BOUNDARY),this.insertPoint(this._argIndex,u[u.length-1],k.BOUNDARY)},i.prototype.addLineString=function(s){var u=ft.removeRepeatedPoints(s.getCoordinates());if(u.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=u[0],null;var c=new Il(u,new rn(this._argIndex,k.INTERIOR));this._lineEdgeMap.put(s,c),this.insertEdge(c),b.isTrue(u.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,u[0]),this.insertBoundaryPoint(this._argIndex,u[u.length-1])},i.prototype.getInvalidPoint=function(){return this._invalidPoint},i.prototype.getBoundaryPoints=function(){for(var s=this.getBoundaryNodes(),u=new Array(s.size()).fill(null),c=0,m=s.iterator();m.hasNext();){var E=m.next();u[c++]=E.getCoordinate().copy()}return u},i.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},i.prototype.addSelfIntersectionNode=function(s,u,c){if(this.isBoundaryNode(s,u))return null;c===k.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(s,u):this.insertPoint(s,u,c)},i.prototype.addPolygonRing=function(s,u,c){if(s.isEmpty())return null;var m=ft.removeRepeatedPoints(s.getCoordinates());if(m.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=m[0],null;var E=u,A=c;B.isCCW(m)&&(E=c,A=u);var U=new Il(m,new rn(this._argIndex,k.BOUNDARY,E,A));this._lineEdgeMap.put(s,U),this.insertEdge(U),this.insertPoint(this._argIndex,m[0],k.BOUNDARY)},i.prototype.insertPoint=function(s,u,c){var m=this._nodes.addNode(u),E=m.getLabel();E===null?m._label=new rn(s,c):E.setLocation(s,c)},i.prototype.createEdgeSetIntersector=function(){return new D1},i.prototype.addSelfIntersectionNodes=function(s){for(var u=this._edges.iterator();u.hasNext();)for(var c=u.next(),m=c.getLabel().getLocation(s),E=c.eiList.iterator();E.hasNext();){var A=E.next();this.addSelfIntersectionNode(s,A.coord,m)}},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 un&&(this._useBoundaryDeterminationRule=!1),s instanceof Vt)this.addPolygon(s);else if(s instanceof Bt)this.addLineString(s);else if(s instanceof jt)this.addPoint(s);else if(s instanceof fe)this.addCollection(s);else if(s instanceof H)this.addCollection(s);else if(s instanceof un)this.addCollection(s);else{if(!(s instanceof Hn))throw new Error(s.getClass().getName());this.addCollection(s)}},i.prototype.addCollection=function(s){for(var u=0;u<s.getNumGeometries();u++){var c=s.getGeometryN(u);this.add(c)}},i.prototype.locate=function(s){return X(this._parentGeom,ce)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new va(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,u){return s.isInBoundary(u)?k.BOUNDARY:k.INTERIOR},i}(xn),xa=function(){if(this._li=new Z,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 Iu(0,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=Lt.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 Iu(0,i,u),this._arg[1]=new Iu(1,s,u)}else if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2];c.getPrecisionModel().compareTo(m.getPrecisionModel())>=0?this.setComputationPrecision(c.getPrecisionModel()):this.setComputationPrecision(m.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Iu(0,c,E),this._arg[1]=new Iu(1,m,E)}};xa.prototype.getArgGeometry=function(n){return this._arg[n].getGeometry()},xa.prototype.setComputationPrecision=function(n){this._resultPrecisionModel=n,this._li.setPrecisionModel(this._resultPrecisionModel)},xa.prototype.interfaces_=function(){return[]},xa.prototype.getClass=function(){return xa};var as=function(){};as.prototype.interfaces_=function(){return[]},as.prototype.getClass=function(){return as},as.map=function(){if(arguments[0]instanceof j&&X(arguments[1],as.MapOp)){for(var n=arguments[0],i=arguments[1],s=new Q,u=0;u<n.getNumGeometries();u++){var c=i.map(n.getGeometryN(u));c!==null&&s.add(c)}return n.getFactory().buildGeometry(s)}if(X(arguments[0],Ot)&&X(arguments[1],as.MapOp)){for(var m=arguments[0],E=arguments[1],A=new Q,U=m.iterator();U.hasNext();){var $=U.next(),ut=E.map($);ut!==null&&A.add(ut)}return A}},as.MapOp=function(){};var ae=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u),this._ptLocator=new vi,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new yi,this._resultPolyList=new Q,this._resultLineList=new Q,this._resultPointList=new Q,this._graph=new xn(new im),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 u=this._edgeList.findEqualEdge(s);if(u!==null){var c=u.getLabel(),m=s.getLabel();u.isPointwiseEqual(s)||(m=new rn(s.getLabel())).flip();var E=u.getDepth();E.isNull()&&E.add(c),E.add(m),c.merge(m)}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 u=s.next(),c=u.getSym();u.isInResult()&&c.isInResult()&&(u.setInResult(!1),c.setInResult(!1))}},i.prototype.isCoveredByLA=function(s){return!!this.isCovered(s,this._resultLineList)||!!this.isCovered(s,this._resultPolyList)},i.prototype.computeGeometry=function(s,u,c,m){var E=new Q;return E.addAll(s),E.addAll(u),E.addAll(c),E.isEmpty()?i.createEmptyResult(m,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(E)},i.prototype.mergeSymLabels=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();)s.next().getEdges().mergeSymLabels()},i.prototype.isCovered=function(s,u){for(var c=u.iterator();c.hasNext();){var m=c.next();if(this._ptLocator.locate(s,m)!==k.EXTERIOR)return!0}return!1},i.prototype.replaceCollapsedEdges=function(){for(var s=new Q,u=this._edgeList.iterator();u.hasNext();){var c=u.next();c.isCollapsed()&&(u.remove(),s.add(c.getCollapsedEdge()))}this._edgeList.addAll(s)},i.prototype.updateNodeLabelling=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();){var u=s.next(),c=u.getEdges().getLabel();u.getLabel().merge(c)}},i.prototype.getResultGeometry=function(s){return this.computeOverlay(s),this._resultGeom},i.prototype.insertUniqueEdges=function(s){for(var u=s.iterator();u.hasNext();){var c=u.next();this.insertUniqueEdge(c)}},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 u=new Q;this._arg[0].computeSplitEdges(u),this._arg[1].computeSplitEdges(u),this.insertUniqueEdges(u),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),os.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(s),this.cancelDuplicateResultEdges();var c=new Or(this._geomFact);c.add(this._graph),this._resultPolyList=c.getPolygons();var m=new Ni(this,this._geomFact,this._ptLocator);this._resultLineList=m.build(s);var E=new ks(this,this._geomFact,this._ptLocator);this._resultPointList=E.build(s),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,s)},i.prototype.labelIncompleteNode=function(s,u){var c=this._ptLocator.locate(s.getCoordinate(),this._arg[u].getGeometry());s.getLabel().setLocation(u,c)},i.prototype.copyPoints=function(s){for(var u=this._arg[s].getNodeIterator();u.hasNext();){var c=u.next();this._graph.addNode(c.getCoordinate()).setLabel(s,c.getLabel().getLocation(s))}},i.prototype.findResultAreaEdges=function(s){for(var u=this._graph.getEdgeEnds().iterator();u.hasNext();){var c=u.next(),m=c.getLabel();m.isArea()&&!c.isInteriorAreaEdge()&&i.isResultOfOp(m.getLocation(0,bt.RIGHT),m.getLocation(1,bt.RIGHT),s)&&c.setInResult(!0)}},i.prototype.computeLabelsFromDepths=function(){for(var s=this._edgeList.iterator();s.hasNext();){var u=s.next(),c=u.getLabel(),m=u.getDepth();if(!m.isNull()){m.normalize();for(var E=0;E<2;E++)c.isNull(E)||!c.isArea()||m.isNull(E)||(m.getDelta(E)===0?c.toLine(E):(b.isTrue(!m.isNull(E,bt.LEFT),"depth of LEFT side has not been initialized"),c.setLocation(E,bt.LEFT,m.getLocation(E,bt.LEFT)),b.isTrue(!m.isNull(E,bt.RIGHT),"depth of RIGHT side has not been initialized"),c.setLocation(E,bt.RIGHT,m.getLocation(E,bt.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 u=s.next(),c=u.getLabel();u.isIsolated()&&(c.isNull(0)?this.labelIncompleteNode(u,0):this.labelIncompleteNode(u,1)),u.getEdges().updateLabelling(c)}},i.prototype.isCoveredByA=function(s){return!!this.isCovered(s,this._resultPolyList)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(xa);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 zs.map(n,{interfaces_:function(){return[as.MapOp]},map:function(u){return u.intersection(s)}})}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),pr.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),pr.overlayOp(n,i,ae.SYMDIFFERENCE)},ae.resultDimension=function(n,i,s){var u=i.getDimension(),c=s.getDimension(),m=-1;switch(n){case ae.INTERSECTION:m=Math.min(u,c);break;case ae.UNION:m=Math.max(u,c);break;case ae.DIFFERENCE:m=u;break;case ae.SYMDIFFERENCE:m=Math.max(u,c)}return m},ae.createEmptyResult=function(n,i,s,u){var c=null;switch(ae.resultDimension(n,i,s)){case-1:c=u.createGeometryCollection(new Array(0).fill(null));break;case 0:c=u.createPoint();break;case 1:c=u.createLineString();break;case 2:c=u.createPolygon()}return c},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),pr.overlayOp(n,i,ae.DIFFERENCE))},ae.isResultOfOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=n.getLocation(0),u=n.getLocation(1);return ae.isResultOfOp(s,u,i)}if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2];switch(c===k.BOUNDARY&&(c=k.INTERIOR),m===k.BOUNDARY&&(m=k.INTERIOR),E){case ae.INTERSECTION:return c===k.INTERIOR&&m===k.INTERIOR;case ae.UNION:return c===k.INTERIOR||m===k.INTERIOR;case ae.DIFFERENCE:return c===k.INTERIOR&&m!==k.INTERIOR;case ae.SYMDIFFERENCE:return c===k.INTERIOR&&m!==k.INTERIOR||c!==k.INTERIOR&&m===k.INTERIOR}return!1}},ae.INTERSECTION=1,ae.UNION=2,ae.DIFFERENCE=3,ae.SYMDIFFERENCE=4;var Uo=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new vi,this._seg=new $t;var n=arguments[0],i=arguments[1];this._g=n,this._boundaryDistanceTolerance=i,this._linework=this.extractLinework(n)};Uo.prototype.isWithinToleranceOfBoundary=function(n){for(var i=0;i<this._linework.getNumGeometries();i++)for(var s=this._linework.getGeometryN(i).getCoordinateSequence(),u=0;u<s.size()-1;u++)if(s.getCoordinate(u,this._seg.p0),s.getCoordinate(u+1,this._seg.p1),this._seg.distance(n)<=this._boundaryDistanceTolerance)return!0;return!1},Uo.prototype.getLocation=function(n){return this.isWithinToleranceOfBoundary(n)?k.BOUNDARY:this._ptLocator.locate(n,this._g)},Uo.prototype.extractLinework=function(n){var i=new Ea;n.apply(i);var s=i.getLinework(),u=le.toLineStringArray(s);return n.getFactory().createMultiLineString(u)},Uo.prototype.interfaces_=function(){return[]},Uo.prototype.getClass=function(){return Uo};var Ea=function(){this._linework=null,this._linework=new Q};Ea.prototype.getLinework=function(){return this._linework},Ea.prototype.filter=function(n){if(n instanceof Vt){var i=n;this._linework.add(i.getExteriorRing());for(var s=0;s<i.getNumInteriorRing();s++)this._linework.add(i.getInteriorRingN(s))}},Ea.prototype.interfaces_=function(){return[ni]},Ea.prototype.getClass=function(){return Ea};var us=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var n=arguments[0];this._g=n};us.prototype.extractPoints=function(n,i,s){for(var u=n.getCoordinates(),c=0;c<u.length-1;c++)this.computeOffsetPoints(u[c],u[c+1],i,s)},us.prototype.setSidesToGenerate=function(n,i){this._doLeft=n,this._doRight=i},us.prototype.getPoints=function(n){for(var i=new Q,s=Xn.getLines(this._g).iterator();s.hasNext();){var u=s.next();this.extractPoints(u,n,i)}return i},us.prototype.computeOffsetPoints=function(n,i,s,u){var c=i.x-n.x,m=i.y-n.y,E=Math.sqrt(c*c+m*m),A=s*c/E,U=s*m/E,$=(i.x+n.x)/2,ut=(i.y+n.y)/2;if(this._doLeft){var ht=new L($-U,ut+A);u.add(ht)}if(this._doRight){var At=new L($+U,ut-A);u.add(At)}},us.prototype.interfaces_=function(){return[]},us.prototype.getClass=function(){return us};var $r=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 Q;var i=arguments[0],s=arguments[1],u=arguments[2];this._boundaryDistanceTolerance=n.computeBoundaryDistanceTolerance(i,s),this._geom=[i,s,u],this._locFinder=[new Uo(this._geom[0],this._boundaryDistanceTolerance),new Uo(this._geom[1],this._boundaryDistanceTolerance),new Uo(this._geom[2],this._boundaryDistanceTolerance)]},dm={TOLERANCE:{configurable:!0}};$r.prototype.reportResult=function(n,i,s){Nt.out.println("Overlay result invalid - A:"+k.toLocationSymbol(i[0])+" B:"+k.toLocationSymbol(i[1])+" expected:"+(s?"i":"e")+" actual:"+k.toLocationSymbol(i[2]))},$r.prototype.isValid=function(n){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var i=this.checkValid(n);return i},$r.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 u=arguments[0],c=arguments[1];return this._location[0]=this._locFinder[0].getLocation(c),this._location[1]=this._locFinder[1].getLocation(c),this._location[2]=this._locFinder[2].getLocation(c),!!$r.hasLocation(this._location,k.BOUNDARY)||this.isValidResult(u,this._location)}},$r.prototype.addTestPts=function(n){var i=new us(n);this._testCoords.addAll(i.getPoints(5*this._boundaryDistanceTolerance))},$r.prototype.isValidResult=function(n,i){var s=ae.isResultOfOp(i[0],i[1],n),u=!(s^i[2]===k.INTERIOR);return u||this.reportResult(n,i,s),u},$r.prototype.getInvalidLocation=function(){return this._invalidLocation},$r.prototype.interfaces_=function(){return[]},$r.prototype.getClass=function(){return $r},$r.hasLocation=function(n,i){for(var s=0;s<3;s++)if(n[s]===i)return!0;return!1},$r.computeBoundaryDistanceTolerance=function(n,i){return Math.min(Tn.computeSizeBasedSnapTolerance(n),Tn.computeSizeBasedSnapTolerance(i))},$r.isValid=function(n,i,s,u){return new $r(n,i,u).isValid(s)},dm.TOLERANCE.get=function(){return 1e-6},Object.defineProperties($r,dm);var Zr=function n(i){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=n.extractFactory(i),this._inputGeoms=i};Zr.prototype.extractElements=function(n,i){if(n===null)return null;for(var s=0;s<n.getNumGeometries();s++){var u=n.getGeometryN(s);this._skipEmpty&&u.isEmpty()||i.add(u)}},Zr.prototype.combine=function(){for(var n=new Q,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)},Zr.prototype.interfaces_=function(){return[]},Zr.prototype.getClass=function(){return Zr},Zr.combine=function(){if(arguments.length===1){var n=arguments[0];return new Zr(n).combine()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new Zr(Zr.createList(i,s)).combine()}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];return new Zr(Zr.createList(u,c,m)).combine()}},Zr.extractFactory=function(n){return n.isEmpty()?null:n.iterator().next().getFactory()},Zr.createList=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new Q;return s.add(n),s.add(i),s}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2],E=new Q;return E.add(u),E.add(c),E.add(m),E}};var In=function(){this._inputPolys=null,this._geomFactory=null;var n=arguments[0];this._inputPolys=n,this._inputPolys===null&&(this._inputPolys=new Q)},mm={STRTREE_NODE_CAPACITY:{configurable:!0}};In.prototype.reduceToGeometries=function(n){for(var i=new Q,s=n.iterator();s.hasNext();){var u=s.next(),c=null;X(u,St)?c=this.unionTree(u):u instanceof j&&(c=u),i.add(c)}return i},In.prototype.extractByEnvelope=function(n,i,s){for(var u=new Q,c=0;c<i.getNumGeometries();c++){var m=i.getGeometryN(c);m.getEnvelopeInternal().intersects(n)?u.add(m):s.add(m)}return this._geomFactory.buildGeometry(u)},In.prototype.unionOptimized=function(n,i){var s=n.getEnvelopeInternal(),u=i.getEnvelopeInternal();if(!s.intersects(u))return Zr.combine(n,i);if(n.getNumGeometries()<=1&&i.getNumGeometries()<=1)return this.unionActual(n,i);var c=s.intersection(u);return this.unionUsingEnvelopeIntersection(n,i,c)},In.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 Qd(In.STRTREE_NODE_CAPACITY),i=this._inputPolys.iterator();i.hasNext();){var s=i.next();n.insert(s.getEnvelopeInternal(),s)}this._inputPolys=null;var u=n.itemsTree();return this.unionTree(u)},In.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],u=arguments[2];if(u-s<=1){var c=In.getGeometry(i,s);return this.unionSafe(c,null)}if(u-s==2)return this.unionSafe(In.getGeometry(i,s),In.getGeometry(i,s+1));var m=Math.trunc((u+s)/2),E=this.binaryUnion(i,s,m),A=this.binaryUnion(i,m,u);return this.unionSafe(E,A)}},In.prototype.repeatedUnion=function(n){for(var i=null,s=n.iterator();s.hasNext();){var u=s.next();i=i===null?u.copy():i.union(u)}return i},In.prototype.unionSafe=function(n,i){return n===null&&i===null?null:n===null?i.copy():i===null?n.copy():this.unionOptimized(n,i)},In.prototype.unionActual=function(n,i){return In.restrictToPolygons(n.union(i))},In.prototype.unionTree=function(n){var i=this.reduceToGeometries(n);return this.binaryUnion(i)},In.prototype.unionUsingEnvelopeIntersection=function(n,i,s){var u=new Q,c=this.extractByEnvelope(s,n,u),m=this.extractByEnvelope(s,i,u),E=this.unionActual(c,m);return u.add(E),Zr.combine(u)},In.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)}},In.prototype.interfaces_=function(){return[]},In.prototype.getClass=function(){return In},In.restrictToPolygons=function(n){if(X(n,ce))return n;var i=po.getPolygons(n);return i.size()===1?i.get(0):n.getFactory().createMultiPolygon(le.toPolygonArray(i))},In.getGeometry=function(n,i){return i>=n.size()?null:n.get(i)},In.union=function(n){return new In(n).union()},mm.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(In,mm);var Ru=function(){};Ru.prototype.interfaces_=function(){return[]},Ru.prototype.getClass=function(){return Ru},Ru.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),pr.overlayOp(n,i,ae.UNION)},r.GeoJSONReader=bf,r.GeoJSONWriter=Jd,r.OverlayOp=ae,r.UnionOp=Ru,r.BufferOp=qn,Object.defineProperty(r,"__esModule",{value:!0})})});var S1=Zt((z9,w1)=>{w1.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}});var A1=Zt((k9,T1)=>{var b1=S1();T1.exports=function(r,t){Array.isArray(t)||(t=[]),r.length>0&&t.push(b1([0,0],r[0]));for(var e=0;e<r.length-1;e++){var o=r[e],a=r[e+1],l=o[0],f=o[1],h=a[0],p=a[1],d=[.75*l+.25*h,.75*f+.25*p],g=[.25*l+.75*h,.25*f+.75*p];t.push(d),t.push(g)}return r.length>1&&t.push(b1([0,0],r[r.length-1])),t}});var Bi=Ln(kf(),1);var ep="157";var Y1=0,Lm=1,$1=2;var jg=1,Z1=2,qo=3,xs=0,li=1,Yo=2;var ys=0,Va=1,Nm=2,Om=3,Dm=4,J1=5,Ba=100,K1=101,Q1=102,Fm=103,Um=104,j1=200,tx=201,ex=202,nx=203,t0=204,e0=205,rx=206,ix=207,ox=208,sx=209,ax=210,ux=0,lx=1,cx=2,yh=3,fx=4,hx=5,px=6,dx=7,n0=0,mx=1,gx=2,vs=0,yx=1,vx=2,_x=3,xx=4,Ex=5,r0=300,qa=301,Xa=302,vh=303,_h=304,_c=306,xh=1e3,ji=1001,Eh=1002,Kr=1003,Bm=1004;var Gf=1005;var Di=1006,Mx=1007;var ku=1008;var _s=1009,wx=1010,Sx=1011,np=1012,i0=1013,ms=1014,gs=1015,Gu=1016,o0=1017,s0=1018,$s=1020,bx=1021,to=1023,Tx=1024,Ax=1025,Zs=1026,Ya=1027,Cx=1028,a0=1029,Px=1030,u0=1031,l0=1033,Vf=33776,Hf=33777,Wf=33778,qf=33779,zm=35840,km=35841,Gm=35842,Vm=35843,Ix=36196,Hm=37492,Wm=37496,qm=37808,Xm=37809,Ym=37810,$m=37811,Zm=37812,Jm=37813,Km=37814,Qm=37815,jm=37816,tg=37817,eg=37818,ng=37819,rg=37820,ig=37821,Xf=36492,og=36494,sg=36495,Rx=36283,ag=36284,ug=36285,lg=36286;var tc=2300,ec=2301,Yf=2302,cg=2400,fg=2401,hg=2402;var c0=3e3,Js=3001,Lx=3200,Nx=3201,Ox=0,Dx=1,Fi="",Tr="srgb",Jo="srgb-linear",rp="display-p3",xc="display-p3-linear",nc="linear",An="srgb",rc="rec709",ic="p3";var $f=7680;var Fx=519,Ux=512,Bx=513,zx=514,kx=515,Gx=516,Vx=517,Hx=518,Wx=519,pg=35044;var dg="300 es",Mh=1035,$o=2e3,oc=2001,Es=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 l=a.indexOf(e);l!==-1&&a.splice(l,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 l=0,f=a.length;l<f;l++)a[l].call(this,t);t.target=null}}},Br=["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 Zf=Math.PI/180,wh=180/Math.PI;function qu(){let r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(Br[r&255]+Br[r>>8&255]+Br[r>>16&255]+Br[r>>24&255]+"-"+Br[t&255]+Br[t>>8&255]+"-"+Br[t>>16&15|64]+Br[t>>24&255]+"-"+Br[e&63|128]+Br[e>>8&255]+"-"+Br[e>>16&255]+Br[e>>24&255]+Br[o&255]+Br[o>>8&255]+Br[o>>16&255]+Br[o>>24&255]).toLowerCase()}function ui(r,t,e){return Math.max(t,Math.min(e,r))}function qx(r,t){return(r%t+t)%t}function Jf(r,t,e){return(1-e)*r+e*t}function mg(r){return(r&r-1)===0&&r!==0}function Sh(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Lu(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 ai(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 fn=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(ui(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),l=this.x-t.x,f=this.y-t.y;return this.x=l*o-f*a+t.x,this.y=l*a+f*o+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},ye=class r{constructor(t,e,o,a,l,f,h,p,d){r.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,o,a,l,f,h,p,d)}set(t,e,o,a,l,f,h,p,d){let g=this.elements;return g[0]=t,g[1]=a,g[2]=h,g[3]=e,g[4]=l,g[5]=p,g[6]=o,g[7]=f,g[8]=d,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,l=this.elements,f=o[0],h=o[3],p=o[6],d=o[1],g=o[4],_=o[7],y=o[2],M=o[5],S=o[8],T=a[0],x=a[3],v=a[6],C=a[1],w=a[4],O=a[7],F=a[2],G=a[5],z=a[8];return l[0]=f*T+h*C+p*F,l[3]=f*x+h*w+p*G,l[6]=f*v+h*O+p*z,l[1]=d*T+g*C+_*F,l[4]=d*x+g*w+_*G,l[7]=d*v+g*O+_*z,l[2]=y*T+M*C+S*F,l[5]=y*x+M*w+S*G,l[8]=y*v+M*O+S*z,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],l=t[3],f=t[4],h=t[5],p=t[6],d=t[7],g=t[8];return e*f*g-e*h*d-o*l*g+o*h*p+a*l*d-a*f*p}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],l=t[3],f=t[4],h=t[5],p=t[6],d=t[7],g=t[8],_=g*f-h*d,y=h*p-g*l,M=d*l-f*p,S=e*_+o*y+a*M;if(S===0)return this.set(0,0,0,0,0,0,0,0,0);let T=1/S;return t[0]=_*T,t[1]=(a*d-g*o)*T,t[2]=(h*o-a*f)*T,t[3]=y*T,t[4]=(g*e-a*p)*T,t[5]=(a*l-h*e)*T,t[6]=M*T,t[7]=(o*p-d*e)*T,t[8]=(f*e-o*l)*T,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,l,f,h){let p=Math.cos(l),d=Math.sin(l);return this.set(o*p,o*d,-o*(p*f+d*h)+f+t,-a*d,a*p,-a*(-d*f+p*h)+h+e,0,0,1),this}scale(t,e){return this.premultiply(Kf.makeScale(t,e)),this}rotate(t){return this.premultiply(Kf.makeRotation(-t)),this}translate(t,e){return this.premultiply(Kf.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)}},Kf=new ye;function f0(r){for(let t=r.length-1;t>=0;--t)if(r[t]>=65535)return!0;return!1}function sc(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Xx(){let r=sc("canvas");return r.style.display="block",r}var gg={};function Bu(r){r in gg||(gg[r]=!0,console.warn(r))}var yg=new ye().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),vg=new ye().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Ll={[Jo]:{transfer:nc,primaries:rc,toReference:r=>r,fromReference:r=>r},[Tr]:{transfer:An,primaries:rc,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[xc]:{transfer:nc,primaries:ic,toReference:r=>r.applyMatrix3(vg),fromReference:r=>r.applyMatrix3(yg)},[rp]:{transfer:An,primaries:ic,toReference:r=>r.convertSRGBToLinear().applyMatrix3(vg),fromReference:r=>r.applyMatrix3(yg).convertLinearToSRGB()}},Yx=new Set([Jo,xc]),yn={enabled:!0,_workingColorSpace:Jo,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(!Yx.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=Ll[t].toReference,a=Ll[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 Ll[r].primaries},getTransfer:function(r){return r===Fi?nc:Ll[r].transfer}};function Ha(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Qf(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var Ma,ac=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{Ma===void 0&&(Ma=sc("canvas")),Ma.width=t.width,Ma.height=t.height;let o=Ma.getContext("2d");t instanceof ImageData?o.putImageData(t,0,0):o.drawImage(t,0,0,t.width,t.height),e=Ma}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=sc("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),l=a.data;for(let f=0;f<l.length;f++)l[f]=Ha(l[f]/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(Ha(e[o]/255)*255):e[o]=Ha(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}},$x=0,uc=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:$x++}),this.uuid=qu(),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 l;if(Array.isArray(a)){l=[];for(let f=0,h=a.length;f<h;f++)a[f].isDataTexture?l.push(jf(a[f].image)):l.push(jf(a[f]))}else l=jf(a);o.url=l}return e||(t.images[this.uuid]=o),o}};function jf(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?ac.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 Zx=0,eo=class r extends Es{constructor(t=r.DEFAULT_IMAGE,e=r.DEFAULT_MAPPING,o=ji,a=ji,l=Di,f=ku,h=to,p=_s,d=r.DEFAULT_ANISOTROPY,g=Fi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Zx++}),this.uuid=qu(),this.name="",this.source=new uc(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=o,this.wrapT=a,this.magFilter=l,this.minFilter=f,this.anisotropy=d,this.format=h,this.internalFormat=null,this.type=p,this.offset=new fn(0,0),this.repeat=new fn(1,1),this.center=new fn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ye,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,typeof g=="string"?this.colorSpace=g:(Bu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=g===Js?Tr:Fi),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!==r0)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case xh:t.x=t.x-Math.floor(t.x);break;case ji:t.x=t.x<0?0:1;break;case Eh: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 xh:t.y=t.y-Math.floor(t.y);break;case ji:t.y=t.y<0?0:1;break;case Eh: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 Bu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Tr?Js:c0}set encoding(t){Bu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===Js?Tr:Fi}};eo.DEFAULT_IMAGE=null;eo.DEFAULT_MAPPING=r0;eo.DEFAULT_ANISOTROPY=1;var Ar=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,l=this.w,f=t.elements;return this.x=f[0]*e+f[4]*o+f[8]*a+f[12]*l,this.y=f[1]*e+f[5]*o+f[9]*a+f[13]*l,this.z=f[2]*e+f[6]*o+f[10]*a+f[14]*l,this.w=f[3]*e+f[7]*o+f[11]*a+f[15]*l,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,l,p=t.elements,d=p[0],g=p[4],_=p[8],y=p[1],M=p[5],S=p[9],T=p[2],x=p[6],v=p[10];if(Math.abs(g-y)<.01&&Math.abs(_-T)<.01&&Math.abs(S-x)<.01){if(Math.abs(g+y)<.1&&Math.abs(_+T)<.1&&Math.abs(S+x)<.1&&Math.abs(d+M+v-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let w=(d+1)/2,O=(M+1)/2,F=(v+1)/2,G=(g+y)/4,z=(_+T)/4,L=(S+x)/4;return w>O&&w>F?w<.01?(o=0,a=.707106781,l=.707106781):(o=Math.sqrt(w),a=G/o,l=z/o):O>F?O<.01?(o=.707106781,a=0,l=.707106781):(a=Math.sqrt(O),o=G/a,l=L/a):F<.01?(o=.707106781,a=.707106781,l=0):(l=Math.sqrt(F),o=z/l,a=L/l),this.set(o,a,l,e),this}let C=Math.sqrt((x-S)*(x-S)+(_-T)*(_-T)+(y-g)*(y-g));return Math.abs(C)<.001&&(C=1),this.x=(x-S)/C,this.y=(_-T)/C,this.z=(y-g)/C,this.w=Math.acos((d+M+v-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}},bh=class extends Es{constructor(t=1,e=1,o={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Ar(0,0,t,e),this.scissorTest=!1,this.viewport=new Ar(0,0,t,e);let a={width:t,height:e,depth:1};o.encoding!==void 0&&(Bu("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),o.colorSpace=o.encoding===Js?Tr:Fi),o=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Di,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},o),this.texture=new eo(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 uc(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"})}},Ko=class extends bh{constructor(t=1,e=1,o={}){super(t,e,o),this.isWebGLRenderTarget=!0}},lc=class extends eo{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=Kr,this.minFilter=Kr,this.wrapR=ji,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Th=class extends eo{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=Kr,this.minFilter=Kr,this.wrapR=ji,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Ms=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,l,f,h){let p=o[a+0],d=o[a+1],g=o[a+2],_=o[a+3],y=l[f+0],M=l[f+1],S=l[f+2],T=l[f+3];if(h===0){t[e+0]=p,t[e+1]=d,t[e+2]=g,t[e+3]=_;return}if(h===1){t[e+0]=y,t[e+1]=M,t[e+2]=S,t[e+3]=T;return}if(_!==T||p!==y||d!==M||g!==S){let x=1-h,v=p*y+d*M+g*S+_*T,C=v>=0?1:-1,w=1-v*v;if(w>Number.EPSILON){let F=Math.sqrt(w),G=Math.atan2(F,v*C);x=Math.sin(x*G)/F,h=Math.sin(h*G)/F}let O=h*C;if(p=p*x+y*O,d=d*x+M*O,g=g*x+S*O,_=_*x+T*O,x===1-h){let F=1/Math.sqrt(p*p+d*d+g*g+_*_);p*=F,d*=F,g*=F,_*=F}}t[e]=p,t[e+1]=d,t[e+2]=g,t[e+3]=_}static multiplyQuaternionsFlat(t,e,o,a,l,f){let h=o[a],p=o[a+1],d=o[a+2],g=o[a+3],_=l[f],y=l[f+1],M=l[f+2],S=l[f+3];return t[e]=h*S+g*_+p*M-d*y,t[e+1]=p*S+g*y+d*_-h*M,t[e+2]=d*S+g*M+h*y-p*_,t[e+3]=g*S-h*_-p*y-d*M,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,l=t._z,f=t._order,h=Math.cos,p=Math.sin,d=h(o/2),g=h(a/2),_=h(l/2),y=p(o/2),M=p(a/2),S=p(l/2);switch(f){case"XYZ":this._x=y*g*_+d*M*S,this._y=d*M*_-y*g*S,this._z=d*g*S+y*M*_,this._w=d*g*_-y*M*S;break;case"YXZ":this._x=y*g*_+d*M*S,this._y=d*M*_-y*g*S,this._z=d*g*S-y*M*_,this._w=d*g*_+y*M*S;break;case"ZXY":this._x=y*g*_-d*M*S,this._y=d*M*_+y*g*S,this._z=d*g*S+y*M*_,this._w=d*g*_-y*M*S;break;case"ZYX":this._x=y*g*_-d*M*S,this._y=d*M*_+y*g*S,this._z=d*g*S-y*M*_,this._w=d*g*_+y*M*S;break;case"YZX":this._x=y*g*_+d*M*S,this._y=d*M*_+y*g*S,this._z=d*g*S-y*M*_,this._w=d*g*_-y*M*S;break;case"XZY":this._x=y*g*_-d*M*S,this._y=d*M*_-y*g*S,this._z=d*g*S+y*M*_,this._w=d*g*_+y*M*S;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+f)}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],l=e[8],f=e[1],h=e[5],p=e[9],d=e[2],g=e[6],_=e[10],y=o+h+_;if(y>0){let M=.5/Math.sqrt(y+1);this._w=.25/M,this._x=(g-p)*M,this._y=(l-d)*M,this._z=(f-a)*M}else if(o>h&&o>_){let M=2*Math.sqrt(1+o-h-_);this._w=(g-p)/M,this._x=.25*M,this._y=(a+f)/M,this._z=(l+d)/M}else if(h>_){let M=2*Math.sqrt(1+h-o-_);this._w=(l-d)/M,this._x=(a+f)/M,this._y=.25*M,this._z=(p+g)/M}else{let M=2*Math.sqrt(1+_-o-h);this._w=(f-a)/M,this._x=(l+d)/M,this._y=(p+g)/M,this._z=.25*M}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(ui(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,l=t._z,f=t._w,h=e._x,p=e._y,d=e._z,g=e._w;return this._x=o*g+f*h+a*d-l*p,this._y=a*g+f*p+l*h-o*d,this._z=l*g+f*d+o*p-a*h,this._w=f*g-o*h-a*p-l*d,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,l=this._z,f=this._w,h=f*t._w+o*t._x+a*t._y+l*t._z;if(h<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,h=-h):this.copy(t),h>=1)return this._w=f,this._x=o,this._y=a,this._z=l,this;let p=1-h*h;if(p<=Number.EPSILON){let M=1-e;return this._w=M*f+e*this._w,this._x=M*o+e*this._x,this._y=M*a+e*this._y,this._z=M*l+e*this._z,this.normalize(),this._onChangeCallback(),this}let d=Math.sqrt(p),g=Math.atan2(d,h),_=Math.sin((1-e)*g)/d,y=Math.sin(e*g)/d;return this._w=f*_+this._w*y,this._x=o*_+this._x*y,this._y=a*_+this._y*y,this._z=l*_+this._z*y,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(),l=2*Math.PI*Math.random();return this.set(e*Math.cos(a),o*Math.sin(l),o*Math.cos(l),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}},mt=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(_g.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(_g.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,o=this.y,a=this.z,l=t.elements;return this.x=l[0]*e+l[3]*o+l[6]*a,this.y=l[1]*e+l[4]*o+l[7]*a,this.z=l[2]*e+l[5]*o+l[8]*a,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,o=this.y,a=this.z,l=t.elements,f=1/(l[3]*e+l[7]*o+l[11]*a+l[15]);return this.x=(l[0]*e+l[4]*o+l[8]*a+l[12])*f,this.y=(l[1]*e+l[5]*o+l[9]*a+l[13])*f,this.z=(l[2]*e+l[6]*o+l[10]*a+l[14])*f,this}applyQuaternion(t){let e=this.x,o=this.y,a=this.z,l=t.x,f=t.y,h=t.z,p=t.w,d=p*e+f*a-h*o,g=p*o+h*e-l*a,_=p*a+l*o-f*e,y=-l*e-f*o-h*a;return this.x=d*p+y*-l+g*-h-_*-f,this.y=g*p+y*-f+_*-l-d*-h,this.z=_*p+y*-h+d*-f-g*-l,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,l=t.elements;return this.x=l[0]*e+l[4]*o+l[8]*a,this.y=l[1]*e+l[5]*o+l[9]*a,this.z=l[2]*e+l[6]*o+l[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,l=t.z,f=e.x,h=e.y,p=e.z;return this.x=a*p-l*h,this.y=l*f-o*p,this.z=o*h-a*f,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 th.copy(this).projectOnVector(t),this.sub(th)}reflect(t){return this.sub(th.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(ui(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}},th=new mt,_g=new Ms,Ks=class{constructor(t=new mt(1/0,1/0,1/0),e=new mt(-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(ko.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,o=t.count;e<o;e++)this.expandByPoint(ko.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=ko.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(),wa.copy(t.boundingBox),wa.applyMatrix4(t.matrixWorld),this.union(wa);else{let a=t.geometry;if(a!==void 0)if(e&&a.attributes!==void 0&&a.attributes.position!==void 0){let l=a.attributes.position;for(let f=0,h=l.count;f<h;f++)ko.fromBufferAttribute(l,f).applyMatrix4(t.matrixWorld),this.expandByPoint(ko)}else a.boundingBox===null&&a.computeBoundingBox(),wa.copy(a.boundingBox),wa.applyMatrix4(t.matrixWorld),this.union(wa)}let o=t.children;for(let a=0,l=o.length;a<l;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,ko),ko.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(Nu),Nl.subVectors(this.max,Nu),Sa.subVectors(t.a,Nu),ba.subVectors(t.b,Nu),Ta.subVectors(t.c,Nu),cs.subVectors(ba,Sa),fs.subVectors(Ta,ba),Vs.subVectors(Sa,Ta);let e=[0,-cs.z,cs.y,0,-fs.z,fs.y,0,-Vs.z,Vs.y,cs.z,0,-cs.x,fs.z,0,-fs.x,Vs.z,0,-Vs.x,-cs.y,cs.x,0,-fs.y,fs.x,0,-Vs.y,Vs.x,0];return!eh(e,Sa,ba,Ta,Nl)||(e=[1,0,0,0,1,0,0,0,1],!eh(e,Sa,ba,Ta,Nl))?!1:(Ol.crossVectors(cs,fs),e=[Ol.x,Ol.y,Ol.z],eh(e,Sa,ba,Ta,Nl))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ko).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(ko).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:(zo[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),zo[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),zo[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),zo[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),zo[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),zo[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),zo[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),zo[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(zo),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)}},zo=[new mt,new mt,new mt,new mt,new mt,new mt,new mt,new mt],ko=new mt,wa=new Ks,Sa=new mt,ba=new mt,Ta=new mt,cs=new mt,fs=new mt,Vs=new mt,Nu=new mt,Nl=new mt,Ol=new mt,Hs=new mt;function eh(r,t,e,o,a){for(let l=0,f=r.length-3;l<=f;l+=3){Hs.fromArray(r,l);let h=a.x*Math.abs(Hs.x)+a.y*Math.abs(Hs.y)+a.z*Math.abs(Hs.z),p=t.dot(Hs),d=e.dot(Hs),g=o.dot(Hs);if(Math.max(-Math.max(p,d,g),Math.min(p,d,g))>h)return!1}return!0}var Jx=new Ks,Ou=new mt,nh=new mt,Vu=class{constructor(t=new mt,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):Jx.setFromPoints(t).getCenter(o);let a=0;for(let l=0,f=t.length;l<f;l++)a=Math.max(a,o.distanceToSquared(t[l]));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;Ou.subVectors(t,this.center);let e=Ou.lengthSq();if(e>this.radius*this.radius){let o=Math.sqrt(e),a=(o-this.radius)*.5;this.center.addScaledVector(Ou,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):(nh.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Ou.copy(t.center).add(nh)),this.expandByPoint(Ou.copy(t.center).sub(nh))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},Go=new mt,rh=new mt,Dl=new mt,hs=new mt,ih=new mt,Fl=new mt,oh=new mt,Ah=class{constructor(t=new mt,e=new mt(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,Go)),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=Go.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Go.copy(this.origin).addScaledVector(this.direction,e),Go.distanceToSquared(t))}distanceSqToSegment(t,e,o,a){rh.copy(t).add(e).multiplyScalar(.5),Dl.copy(e).sub(t).normalize(),hs.copy(this.origin).sub(rh);let l=t.distanceTo(e)*.5,f=-this.direction.dot(Dl),h=hs.dot(this.direction),p=-hs.dot(Dl),d=hs.lengthSq(),g=Math.abs(1-f*f),_,y,M,S;if(g>0)if(_=f*p-h,y=f*h-p,S=l*g,_>=0)if(y>=-S)if(y<=S){let T=1/g;_*=T,y*=T,M=_*(_+f*y+2*h)+y*(f*_+y+2*p)+d}else y=l,_=Math.max(0,-(f*y+h)),M=-_*_+y*(y+2*p)+d;else y=-l,_=Math.max(0,-(f*y+h)),M=-_*_+y*(y+2*p)+d;else y<=-S?(_=Math.max(0,-(-f*l+h)),y=_>0?-l:Math.min(Math.max(-l,-p),l),M=-_*_+y*(y+2*p)+d):y<=S?(_=0,y=Math.min(Math.max(-l,-p),l),M=y*(y+2*p)+d):(_=Math.max(0,-(f*l+h)),y=_>0?l:Math.min(Math.max(-l,-p),l),M=-_*_+y*(y+2*p)+d);else y=f>0?-l:l,_=Math.max(0,-(f*y+h)),M=-_*_+y*(y+2*p)+d;return o&&o.copy(this.origin).addScaledVector(this.direction,_),a&&a.copy(rh).addScaledVector(Dl,y),M}intersectSphere(t,e){Go.subVectors(t.center,this.origin);let o=Go.dot(this.direction),a=Go.dot(Go)-o*o,l=t.radius*t.radius;if(a>l)return null;let f=Math.sqrt(l-a),h=o-f,p=o+f;return p<0?null:h<0?this.at(p,e):this.at(h,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,l,f,h,p,d=1/this.direction.x,g=1/this.direction.y,_=1/this.direction.z,y=this.origin;return d>=0?(o=(t.min.x-y.x)*d,a=(t.max.x-y.x)*d):(o=(t.max.x-y.x)*d,a=(t.min.x-y.x)*d),g>=0?(l=(t.min.y-y.y)*g,f=(t.max.y-y.y)*g):(l=(t.max.y-y.y)*g,f=(t.min.y-y.y)*g),o>f||l>a||((l>o||isNaN(o))&&(o=l),(f<a||isNaN(a))&&(a=f),_>=0?(h=(t.min.z-y.z)*_,p=(t.max.z-y.z)*_):(h=(t.max.z-y.z)*_,p=(t.min.z-y.z)*_),o>p||h>a)||((h>o||o!==o)&&(o=h),(p<a||a!==a)&&(a=p),a<0)?null:this.at(o>=0?o:a,e)}intersectsBox(t){return this.intersectBox(t,Go)!==null}intersectTriangle(t,e,o,a,l){ih.subVectors(e,t),Fl.subVectors(o,t),oh.crossVectors(ih,Fl);let f=this.direction.dot(oh),h;if(f>0){if(a)return null;h=1}else if(f<0)h=-1,f=-f;else return null;hs.subVectors(this.origin,t);let p=h*this.direction.dot(Fl.crossVectors(hs,Fl));if(p<0)return null;let d=h*this.direction.dot(ih.cross(hs));if(d<0||p+d>f)return null;let g=-h*hs.dot(oh);return g<0?null:this.at(g/f,l)}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)}},kr=class r{constructor(t,e,o,a,l,f,h,p,d,g,_,y,M,S,T,x){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,l,f,h,p,d,g,_,y,M,S,T,x)}set(t,e,o,a,l,f,h,p,d,g,_,y,M,S,T,x){let v=this.elements;return v[0]=t,v[4]=e,v[8]=o,v[12]=a,v[1]=l,v[5]=f,v[9]=h,v[13]=p,v[2]=d,v[6]=g,v[10]=_,v[14]=y,v[3]=M,v[7]=S,v[11]=T,v[15]=x,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/Aa.setFromMatrixColumn(t,0).length(),l=1/Aa.setFromMatrixColumn(t,1).length(),f=1/Aa.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]*l,e[5]=o[5]*l,e[6]=o[6]*l,e[7]=0,e[8]=o[8]*f,e[9]=o[9]*f,e[10]=o[10]*f,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,l=t.z,f=Math.cos(o),h=Math.sin(o),p=Math.cos(a),d=Math.sin(a),g=Math.cos(l),_=Math.sin(l);if(t.order==="XYZ"){let y=f*g,M=f*_,S=h*g,T=h*_;e[0]=p*g,e[4]=-p*_,e[8]=d,e[1]=M+S*d,e[5]=y-T*d,e[9]=-h*p,e[2]=T-y*d,e[6]=S+M*d,e[10]=f*p}else if(t.order==="YXZ"){let y=p*g,M=p*_,S=d*g,T=d*_;e[0]=y+T*h,e[4]=S*h-M,e[8]=f*d,e[1]=f*_,e[5]=f*g,e[9]=-h,e[2]=M*h-S,e[6]=T+y*h,e[10]=f*p}else if(t.order==="ZXY"){let y=p*g,M=p*_,S=d*g,T=d*_;e[0]=y-T*h,e[4]=-f*_,e[8]=S+M*h,e[1]=M+S*h,e[5]=f*g,e[9]=T-y*h,e[2]=-f*d,e[6]=h,e[10]=f*p}else if(t.order==="ZYX"){let y=f*g,M=f*_,S=h*g,T=h*_;e[0]=p*g,e[4]=S*d-M,e[8]=y*d+T,e[1]=p*_,e[5]=T*d+y,e[9]=M*d-S,e[2]=-d,e[6]=h*p,e[10]=f*p}else if(t.order==="YZX"){let y=f*p,M=f*d,S=h*p,T=h*d;e[0]=p*g,e[4]=T-y*_,e[8]=S*_+M,e[1]=_,e[5]=f*g,e[9]=-h*g,e[2]=-d*g,e[6]=M*_+S,e[10]=y-T*_}else if(t.order==="XZY"){let y=f*p,M=f*d,S=h*p,T=h*d;e[0]=p*g,e[4]=-_,e[8]=d*g,e[1]=y*_+T,e[5]=f*g,e[9]=M*_-S,e[2]=S*_-M,e[6]=h*g,e[10]=T*_+y}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(Kx,t,Qx)}lookAt(t,e,o){let a=this.elements;return xi.subVectors(t,e),xi.lengthSq()===0&&(xi.z=1),xi.normalize(),ps.crossVectors(o,xi),ps.lengthSq()===0&&(Math.abs(o.z)===1?xi.x+=1e-4:xi.z+=1e-4,xi.normalize(),ps.crossVectors(o,xi)),ps.normalize(),Ul.crossVectors(xi,ps),a[0]=ps.x,a[4]=Ul.x,a[8]=xi.x,a[1]=ps.y,a[5]=Ul.y,a[9]=xi.y,a[2]=ps.z,a[6]=Ul.z,a[10]=xi.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,l=this.elements,f=o[0],h=o[4],p=o[8],d=o[12],g=o[1],_=o[5],y=o[9],M=o[13],S=o[2],T=o[6],x=o[10],v=o[14],C=o[3],w=o[7],O=o[11],F=o[15],G=a[0],z=a[4],L=a[8],D=a[12],q=a[1],nt=a[5],k=a[9],xt=a[13],X=a[2],it=a[6],vt=a[10],pt=a[14],et=a[3],ot=a[7],V=a[11],K=a[15];return l[0]=f*G+h*q+p*X+d*et,l[4]=f*z+h*nt+p*it+d*ot,l[8]=f*L+h*k+p*vt+d*V,l[12]=f*D+h*xt+p*pt+d*K,l[1]=g*G+_*q+y*X+M*et,l[5]=g*z+_*nt+y*it+M*ot,l[9]=g*L+_*k+y*vt+M*V,l[13]=g*D+_*xt+y*pt+M*K,l[2]=S*G+T*q+x*X+v*et,l[6]=S*z+T*nt+x*it+v*ot,l[10]=S*L+T*k+x*vt+v*V,l[14]=S*D+T*xt+x*pt+v*K,l[3]=C*G+w*q+O*X+F*et,l[7]=C*z+w*nt+O*it+F*ot,l[11]=C*L+w*k+O*vt+F*V,l[15]=C*D+w*xt+O*pt+F*K,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],l=t[12],f=t[1],h=t[5],p=t[9],d=t[13],g=t[2],_=t[6],y=t[10],M=t[14],S=t[3],T=t[7],x=t[11],v=t[15];return S*(+l*p*_-a*d*_-l*h*y+o*d*y+a*h*M-o*p*M)+T*(+e*p*M-e*d*y+l*f*y-a*f*M+a*d*g-l*p*g)+x*(+e*d*_-e*h*M-l*f*_+o*f*M+l*h*g-o*d*g)+v*(-a*h*g-e*p*_+e*h*y+a*f*_-o*f*y+o*p*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],l=t[3],f=t[4],h=t[5],p=t[6],d=t[7],g=t[8],_=t[9],y=t[10],M=t[11],S=t[12],T=t[13],x=t[14],v=t[15],C=_*x*d-T*y*d+T*p*M-h*x*M-_*p*v+h*y*v,w=S*y*d-g*x*d-S*p*M+f*x*M+g*p*v-f*y*v,O=g*T*d-S*_*d+S*h*M-f*T*M-g*h*v+f*_*v,F=S*_*p-g*T*p-S*h*y+f*T*y+g*h*x-f*_*x,G=e*C+o*w+a*O+l*F;if(G===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let z=1/G;return t[0]=C*z,t[1]=(T*y*l-_*x*l-T*a*M+o*x*M+_*a*v-o*y*v)*z,t[2]=(h*x*l-T*p*l+T*a*d-o*x*d-h*a*v+o*p*v)*z,t[3]=(_*p*l-h*y*l-_*a*d+o*y*d+h*a*M-o*p*M)*z,t[4]=w*z,t[5]=(g*x*l-S*y*l+S*a*M-e*x*M-g*a*v+e*y*v)*z,t[6]=(S*p*l-f*x*l-S*a*d+e*x*d+f*a*v-e*p*v)*z,t[7]=(f*y*l-g*p*l+g*a*d-e*y*d-f*a*M+e*p*M)*z,t[8]=O*z,t[9]=(S*_*l-g*T*l-S*o*M+e*T*M+g*o*v-e*_*v)*z,t[10]=(f*T*l-S*h*l+S*o*d-e*T*d-f*o*v+e*h*v)*z,t[11]=(g*h*l-f*_*l-g*o*d+e*_*d+f*o*M-e*h*M)*z,t[12]=F*z,t[13]=(g*T*a-S*_*a+S*o*y-e*T*y-g*o*x+e*_*x)*z,t[14]=(S*h*a-f*T*a-S*o*p+e*T*p+f*o*x-e*h*x)*z,t[15]=(f*_*a-g*h*a+g*o*p-e*_*p-f*o*y+e*h*y)*z,this}scale(t){let e=this.elements,o=t.x,a=t.y,l=t.z;return e[0]*=o,e[4]*=a,e[8]*=l,e[1]*=o,e[5]*=a,e[9]*=l,e[2]*=o,e[6]*=a,e[10]*=l,e[3]*=o,e[7]*=a,e[11]*=l,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),l=1-o,f=t.x,h=t.y,p=t.z,d=l*f,g=l*h;return this.set(d*f+o,d*h-a*p,d*p+a*h,0,d*h+a*p,g*h+o,g*p-a*f,0,d*p-a*h,g*p+a*f,l*p*p+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,l,f){return this.set(1,o,l,0,t,1,f,0,e,a,1,0,0,0,0,1),this}compose(t,e,o){let a=this.elements,l=e._x,f=e._y,h=e._z,p=e._w,d=l+l,g=f+f,_=h+h,y=l*d,M=l*g,S=l*_,T=f*g,x=f*_,v=h*_,C=p*d,w=p*g,O=p*_,F=o.x,G=o.y,z=o.z;return a[0]=(1-(T+v))*F,a[1]=(M+O)*F,a[2]=(S-w)*F,a[3]=0,a[4]=(M-O)*G,a[5]=(1-(y+v))*G,a[6]=(x+C)*G,a[7]=0,a[8]=(S+w)*z,a[9]=(x-C)*z,a[10]=(1-(y+T))*z,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,l=Aa.set(a[0],a[1],a[2]).length(),f=Aa.set(a[4],a[5],a[6]).length(),h=Aa.set(a[8],a[9],a[10]).length();this.determinant()<0&&(l=-l),t.x=a[12],t.y=a[13],t.z=a[14],Ki.copy(this);let d=1/l,g=1/f,_=1/h;return Ki.elements[0]*=d,Ki.elements[1]*=d,Ki.elements[2]*=d,Ki.elements[4]*=g,Ki.elements[5]*=g,Ki.elements[6]*=g,Ki.elements[8]*=_,Ki.elements[9]*=_,Ki.elements[10]*=_,e.setFromRotationMatrix(Ki),o.x=l,o.y=f,o.z=h,this}makePerspective(t,e,o,a,l,f,h=$o){let p=this.elements,d=2*l/(e-t),g=2*l/(o-a),_=(e+t)/(e-t),y=(o+a)/(o-a),M,S;if(h===$o)M=-(f+l)/(f-l),S=-2*f*l/(f-l);else if(h===oc)M=-f/(f-l),S=-f*l/(f-l);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+h);return p[0]=d,p[4]=0,p[8]=_,p[12]=0,p[1]=0,p[5]=g,p[9]=y,p[13]=0,p[2]=0,p[6]=0,p[10]=M,p[14]=S,p[3]=0,p[7]=0,p[11]=-1,p[15]=0,this}makeOrthographic(t,e,o,a,l,f,h=$o){let p=this.elements,d=1/(e-t),g=1/(o-a),_=1/(f-l),y=(e+t)*d,M=(o+a)*g,S,T;if(h===$o)S=(f+l)*_,T=-2*_;else if(h===oc)S=l*_,T=-1*_;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+h);return p[0]=2*d,p[4]=0,p[8]=0,p[12]=-y,p[1]=0,p[5]=2*g,p[9]=0,p[13]=-M,p[2]=0,p[6]=0,p[10]=T,p[14]=-S,p[3]=0,p[7]=0,p[11]=0,p[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}},Aa=new mt,Ki=new kr,Kx=new mt(0,0,0),Qx=new mt(1,1,1),ps=new mt,Ul=new mt,xi=new mt,xg=new kr,Eg=new Ms,cc=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,l=a[0],f=a[4],h=a[8],p=a[1],d=a[5],g=a[9],_=a[2],y=a[6],M=a[10];switch(e){case"XYZ":this._y=Math.asin(ui(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-g,M),this._z=Math.atan2(-f,l)):(this._x=Math.atan2(y,d),this._z=0);break;case"YXZ":this._x=Math.asin(-ui(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(h,M),this._z=Math.atan2(p,d)):(this._y=Math.atan2(-_,l),this._z=0);break;case"ZXY":this._x=Math.asin(ui(y,-1,1)),Math.abs(y)<.9999999?(this._y=Math.atan2(-_,M),this._z=Math.atan2(-f,d)):(this._y=0,this._z=Math.atan2(p,l));break;case"ZYX":this._y=Math.asin(-ui(_,-1,1)),Math.abs(_)<.9999999?(this._x=Math.atan2(y,M),this._z=Math.atan2(p,l)):(this._x=0,this._z=Math.atan2(-f,d));break;case"YZX":this._z=Math.asin(ui(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(-g,d),this._y=Math.atan2(-_,l)):(this._x=0,this._y=Math.atan2(h,M));break;case"XZY":this._z=Math.asin(-ui(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(y,d),this._y=Math.atan2(h,l)):(this._x=Math.atan2(-g,M),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 xg.makeRotationFromQuaternion(t),this.setFromRotationMatrix(xg,e,o)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Eg.setFromEuler(this),this.setFromQuaternion(Eg,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}};cc.DEFAULT_ORDER="XYZ";var fc=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}},jx=0,Mg=new mt,Ca=new Ms,Vo=new kr,Bl=new mt,Du=new mt,tE=new mt,eE=new Ms,wg=new mt(1,0,0),Sg=new mt(0,1,0),bg=new mt(0,0,1),nE={type:"added"},rE={type:"removed"},yo=class r extends Es{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:jx++}),this.uuid=qu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new mt,e=new cc,o=new Ms,a=new mt(1,1,1);function l(){o.setFromEuler(e,!1)}function f(){e.setFromQuaternion(o,void 0,!1)}e._onChange(l),o._onChange(f),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 kr},normalMatrix:{value:new ye}}),this.matrix=new kr,this.matrixWorld=new kr,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new fc,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 Ca.setFromAxisAngle(t,e),this.quaternion.multiply(Ca),this}rotateOnWorldAxis(t,e){return Ca.setFromAxisAngle(t,e),this.quaternion.premultiply(Ca),this}rotateX(t){return this.rotateOnAxis(wg,t)}rotateY(t){return this.rotateOnAxis(Sg,t)}rotateZ(t){return this.rotateOnAxis(bg,t)}translateOnAxis(t,e){return Mg.copy(t).applyQuaternion(this.quaternion),this.position.add(Mg.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(wg,t)}translateY(t){return this.translateOnAxis(Sg,t)}translateZ(t){return this.translateOnAxis(bg,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Vo.copy(this.matrixWorld).invert())}lookAt(t,e,o){t.isVector3?Bl.copy(t):Bl.set(t,e,o);let a=this.parent;this.updateWorldMatrix(!0,!1),Du.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Vo.lookAt(Du,Bl,this.up):Vo.lookAt(Bl,Du,this.up),this.quaternion.setFromRotationMatrix(Vo),a&&(Vo.extractRotation(a.matrixWorld),Ca.setFromRotationMatrix(Vo),this.quaternion.premultiply(Ca.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(nE)):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(rE)),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),Vo.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Vo.multiply(t.parent.matrixWorld)),t.applyMatrix4(Vo),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 f=this.children[o].getObjectByProperty(t,e);if(f!==void 0)return f}}getObjectsByProperty(t,e){let o=[];this[t]===e&&o.push(this);for(let a=0,l=this.children.length;a<l;a++){let f=this.children[a].getObjectsByProperty(t,e);f.length>0&&(o=o.concat(f))}return o}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Du,t,tE),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Du,eE,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 l=e[o];(l.matrixWorldAutoUpdate===!0||t===!0)&&l.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 l=0,f=a.length;l<f;l++){let h=a[l];h.matrixWorldAutoUpdate===!0&&h.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 l(h,p){return h[p.uuid]===void 0&&(h[p.uuid]=p.toJSON(t)),p.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=l(t.geometries,this.geometry);let h=this.geometry.parameters;if(h!==void 0&&h.shapes!==void 0){let p=h.shapes;if(Array.isArray(p))for(let d=0,g=p.length;d<g;d++){let _=p[d];l(t.shapes,_)}else l(t.shapes,p)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(l(t.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let h=[];for(let p=0,d=this.material.length;p<d;p++)h.push(l(t.materials,this.material[p]));a.material=h}else a.material=l(t.materials,this.material);if(this.children.length>0){a.children=[];for(let h=0;h<this.children.length;h++)a.children.push(this.children[h].toJSON(t).object)}if(this.animations.length>0){a.animations=[];for(let h=0;h<this.animations.length;h++){let p=this.animations[h];a.animations.push(l(t.animations,p))}}if(e){let h=f(t.geometries),p=f(t.materials),d=f(t.textures),g=f(t.images),_=f(t.shapes),y=f(t.skeletons),M=f(t.animations),S=f(t.nodes);h.length>0&&(o.geometries=h),p.length>0&&(o.materials=p),d.length>0&&(o.textures=d),g.length>0&&(o.images=g),_.length>0&&(o.shapes=_),y.length>0&&(o.skeletons=y),M.length>0&&(o.animations=M),S.length>0&&(o.nodes=S)}return o.object=a,o;function f(h){let p=[];for(let d in h){let g=h[d];delete g.metadata,p.push(g)}return p}}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}};yo.DEFAULT_UP=new mt(0,1,0);yo.DEFAULT_MATRIX_AUTO_UPDATE=!0;yo.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Qi=new mt,Ho=new mt,sh=new mt,Wo=new mt,Pa=new mt,Ia=new mt,Tg=new mt,ah=new mt,uh=new mt,lh=new mt,zl=!1,za=class r{constructor(t=new mt,e=new mt,o=new mt){this.a=t,this.b=e,this.c=o}static getNormal(t,e,o,a){a.subVectors(o,e),Qi.subVectors(t,e),a.cross(Qi);let l=a.lengthSq();return l>0?a.multiplyScalar(1/Math.sqrt(l)):a.set(0,0,0)}static getBarycoord(t,e,o,a,l){Qi.subVectors(a,e),Ho.subVectors(o,e),sh.subVectors(t,e);let f=Qi.dot(Qi),h=Qi.dot(Ho),p=Qi.dot(sh),d=Ho.dot(Ho),g=Ho.dot(sh),_=f*d-h*h;if(_===0)return l.set(-2,-1,-1);let y=1/_,M=(d*p-h*g)*y,S=(f*g-h*p)*y;return l.set(1-M-S,S,M)}static containsPoint(t,e,o,a){return this.getBarycoord(t,e,o,a,Wo),Wo.x>=0&&Wo.y>=0&&Wo.x+Wo.y<=1}static getUV(t,e,o,a,l,f,h,p){return zl===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),zl=!0),this.getInterpolation(t,e,o,a,l,f,h,p)}static getInterpolation(t,e,o,a,l,f,h,p){return this.getBarycoord(t,e,o,a,Wo),p.setScalar(0),p.addScaledVector(l,Wo.x),p.addScaledVector(f,Wo.y),p.addScaledVector(h,Wo.z),p}static isFrontFacing(t,e,o,a){return Qi.subVectors(o,e),Ho.subVectors(t,e),Qi.cross(Ho).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 Qi.subVectors(this.c,this.b),Ho.subVectors(this.a,this.b),Qi.cross(Ho).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,l){return zl===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),zl=!0),r.getInterpolation(t,this.a,this.b,this.c,e,o,a,l)}getInterpolation(t,e,o,a,l){return r.getInterpolation(t,this.a,this.b,this.c,e,o,a,l)}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,l=this.c,f,h;Pa.subVectors(a,o),Ia.subVectors(l,o),ah.subVectors(t,o);let p=Pa.dot(ah),d=Ia.dot(ah);if(p<=0&&d<=0)return e.copy(o);uh.subVectors(t,a);let g=Pa.dot(uh),_=Ia.dot(uh);if(g>=0&&_<=g)return e.copy(a);let y=p*_-g*d;if(y<=0&&p>=0&&g<=0)return f=p/(p-g),e.copy(o).addScaledVector(Pa,f);lh.subVectors(t,l);let M=Pa.dot(lh),S=Ia.dot(lh);if(S>=0&&M<=S)return e.copy(l);let T=M*d-p*S;if(T<=0&&d>=0&&S<=0)return h=d/(d-S),e.copy(o).addScaledVector(Ia,h);let x=g*S-M*_;if(x<=0&&_-g>=0&&M-S>=0)return Tg.subVectors(l,a),h=(_-g)/(_-g+(M-S)),e.copy(a).addScaledVector(Tg,h);let v=1/(x+T+y);return f=T*v,h=y*v,e.copy(o).addScaledVector(Pa,f).addScaledVector(Ia,h)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},iE=0,$a=class extends Es{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:iE++}),this.uuid=qu(),this.name="",this.type="Material",this.blending=Va,this.side=xs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=t0,this.blendDst=e0,this.blendEquation=Ba,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=yh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Fx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=$f,this.stencilZFail=$f,this.stencilZPass=$f,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!==Va&&(o.blending=this.blending),this.side!==xs&&(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(l){let f=[];for(let h in l){let p=l[h];delete p.metadata,f.push(p)}return f}if(e){let l=a(t.textures),f=a(t.images);l.length>0&&(o.textures=l),f.length>0&&(o.images=f)}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 l=0;l!==a;++l)o[l]=e[l].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++}},h0={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},ds={h:0,s:0,l:0},kl={h:0,s:0,l:0};function ch(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 En=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=Tr){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,yn.toWorkingColorSpace(this,e),this}setRGB(t,e,o,a=yn.workingColorSpace){return this.r=t,this.g=e,this.b=o,yn.toWorkingColorSpace(this,a),this}setHSL(t,e,o,a=yn.workingColorSpace){if(t=qx(t,1),e=ui(e,0,1),o=ui(o,0,1),e===0)this.r=this.g=this.b=o;else{let l=o<=.5?o*(1+e):o+e-o*e,f=2*o-l;this.r=ch(f,l,t+1/3),this.g=ch(f,l,t),this.b=ch(f,l,t-1/3)}return yn.toWorkingColorSpace(this,a),this}setStyle(t,e=Tr){function o(l){l!==void 0&&parseFloat(l)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let a;if(a=/^(\\w+)\\(([^\\)]*)\\)/.exec(t)){let l,f=a[1],h=a[2];switch(f){case"rgb":case"rgba":if(l=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(h))return o(l[4]),this.setRGB(Math.min(255,parseInt(l[1],10))/255,Math.min(255,parseInt(l[2],10))/255,Math.min(255,parseInt(l[3],10))/255,e);if(l=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(h))return o(l[4]),this.setRGB(Math.min(100,parseInt(l[1],10))/100,Math.min(100,parseInt(l[2],10))/100,Math.min(100,parseInt(l[3],10))/100,e);break;case"hsl":case"hsla":if(l=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(h))return o(l[4]),this.setHSL(parseFloat(l[1])/360,parseFloat(l[2])/100,parseFloat(l[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(a=/^\\#([A-Fa-f\\d]+)$/.exec(t)){let l=a[1],f=l.length;if(f===3)return this.setRGB(parseInt(l.charAt(0),16)/15,parseInt(l.charAt(1),16)/15,parseInt(l.charAt(2),16)/15,e);if(f===6)return this.setHex(parseInt(l,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=Tr){let o=h0[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=Ha(t.r),this.g=Ha(t.g),this.b=Ha(t.b),this}copyLinearToSRGB(t){return this.r=Qf(t.r),this.g=Qf(t.g),this.b=Qf(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Tr){return yn.fromWorkingColorSpace(zr.copy(this),t),Math.round(ui(zr.r*255,0,255))*65536+Math.round(ui(zr.g*255,0,255))*256+Math.round(ui(zr.b*255,0,255))}getHexString(t=Tr){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=yn.workingColorSpace){yn.fromWorkingColorSpace(zr.copy(this),e);let o=zr.r,a=zr.g,l=zr.b,f=Math.max(o,a,l),h=Math.min(o,a,l),p,d,g=(h+f)/2;if(h===f)p=0,d=0;else{let _=f-h;switch(d=g<=.5?_/(f+h):_/(2-f-h),f){case o:p=(a-l)/_+(a<l?6:0);break;case a:p=(l-o)/_+2;break;case l:p=(o-a)/_+4;break}p/=6}return t.h=p,t.s=d,t.l=g,t}getRGB(t,e=yn.workingColorSpace){return yn.fromWorkingColorSpace(zr.copy(this),e),t.r=zr.r,t.g=zr.g,t.b=zr.b,t}getStyle(t=Tr){yn.fromWorkingColorSpace(zr.copy(this),t);let e=zr.r,o=zr.g,a=zr.b;return t!==Tr?\`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(ds),this.setHSL(ds.h+t,ds.s+e,ds.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(ds),t.getHSL(kl);let o=Jf(ds.h,kl.h,e),a=Jf(ds.s,kl.s,e),l=Jf(ds.l,kl.l,e);return this.setHSL(o,a,l),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,l=t.elements;return this.r=l[0]*e+l[3]*o+l[6]*a,this.g=l[1]*e+l[4]*o+l[7]*a,this.b=l[2]*e+l[5]*o+l[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}},zr=new En;En.NAMES=h0;var hc=class extends $a{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new En(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=n0,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 Jn=new mt,Gl=new fn,Ui=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=pg,this.updateRange={offset:0,count:-1},this.gpuType=gs,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,l=this.itemSize;a<l;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++)Gl.fromBufferAttribute(this,e),Gl.applyMatrix3(t),this.setXY(e,Gl.x,Gl.y);else if(this.itemSize===3)for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.applyMatrix3(t),this.setXYZ(e,Jn.x,Jn.y,Jn.z);return this}applyMatrix4(t){for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.applyMatrix4(t),this.setXYZ(e,Jn.x,Jn.y,Jn.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.applyNormalMatrix(t),this.setXYZ(e,Jn.x,Jn.y,Jn.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)Jn.fromBufferAttribute(this,e),Jn.transformDirection(t),this.setXYZ(e,Jn.x,Jn.y,Jn.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=Lu(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=ai(o,this.array)),this.array[t*this.itemSize+e]=o,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Lu(e,this.array)),e}setX(t,e){return this.normalized&&(e=ai(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Lu(e,this.array)),e}setY(t,e){return this.normalized&&(e=ai(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=Lu(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ai(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=Lu(e,this.array)),e}setW(t,e){return this.normalized&&(e=ai(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,o){return t*=this.itemSize,this.normalized&&(e=ai(e,this.array),o=ai(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=ai(e,this.array),o=ai(o,this.array),a=ai(a,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this}setXYZW(t,e,o,a,l){return t*=this.itemSize,this.normalized&&(e=ai(e,this.array),o=ai(o,this.array),a=ai(a,this.array),l=ai(l,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this.array[t+3]=l,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!==pg&&(t.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(t.updateRange=this.updateRange),t}};var pc=class extends Ui{constructor(t,e,o){super(new Uint16Array(t),e,o)}};var dc=class extends Ui{constructor(t,e,o){super(new Uint32Array(t),e,o)}};var Zo=class extends Ui{constructor(t,e,o){super(new Float32Array(t),e,o)}};var oE=0,Oi=new kr,fh=new yo,Ra=new mt,Ei=new Ks,Fu=new Ks,mr=new mt,Qs=class r extends Es{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:oE++}),this.uuid=qu(),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(f0(t)?dc:pc)(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 l=new ye().getNormalMatrix(t);o.applyNormalMatrix(l),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 Oi.makeRotationFromQuaternion(t),this.applyMatrix4(Oi),this}rotateX(t){return Oi.makeRotationX(t),this.applyMatrix4(Oi),this}rotateY(t){return Oi.makeRotationY(t),this.applyMatrix4(Oi),this}rotateZ(t){return Oi.makeRotationZ(t),this.applyMatrix4(Oi),this}translate(t,e,o){return Oi.makeTranslation(t,e,o),this.applyMatrix4(Oi),this}scale(t,e,o){return Oi.makeScale(t,e,o),this.applyMatrix4(Oi),this}lookAt(t){return fh.lookAt(t),fh.updateMatrix(),this.applyMatrix4(fh.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ra).negate(),this.translate(Ra.x,Ra.y,Ra.z),this}setFromPoints(t){let e=[];for(let o=0,a=t.length;o<a;o++){let l=t[o];e.push(l.x,l.y,l.z||0)}return this.setAttribute("position",new Zo(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ks);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 mt(-1/0,-1/0,-1/0),new mt(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 l=e[o];Ei.setFromBufferAttribute(l),this.morphTargetsRelative?(mr.addVectors(this.boundingBox.min,Ei.min),this.boundingBox.expandByPoint(mr),mr.addVectors(this.boundingBox.max,Ei.max),this.boundingBox.expandByPoint(mr)):(this.boundingBox.expandByPoint(Ei.min),this.boundingBox.expandByPoint(Ei.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 Vu);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 mt,1/0);return}if(t){let o=this.boundingSphere.center;if(Ei.setFromBufferAttribute(t),e)for(let l=0,f=e.length;l<f;l++){let h=e[l];Fu.setFromBufferAttribute(h),this.morphTargetsRelative?(mr.addVectors(Ei.min,Fu.min),Ei.expandByPoint(mr),mr.addVectors(Ei.max,Fu.max),Ei.expandByPoint(mr)):(Ei.expandByPoint(Fu.min),Ei.expandByPoint(Fu.max))}Ei.getCenter(o);let a=0;for(let l=0,f=t.count;l<f;l++)mr.fromBufferAttribute(t,l),a=Math.max(a,o.distanceToSquared(mr));if(e)for(let l=0,f=e.length;l<f;l++){let h=e[l],p=this.morphTargetsRelative;for(let d=0,g=h.count;d<g;d++)mr.fromBufferAttribute(h,d),p&&(Ra.fromBufferAttribute(t,d),mr.add(Ra)),a=Math.max(a,o.distanceToSquared(mr))}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,l=e.normal.array,f=e.uv.array,h=a.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ui(new Float32Array(4*h),4));let p=this.getAttribute("tangent").array,d=[],g=[];for(let q=0;q<h;q++)d[q]=new mt,g[q]=new mt;let _=new mt,y=new mt,M=new mt,S=new fn,T=new fn,x=new fn,v=new mt,C=new mt;function w(q,nt,k){_.fromArray(a,q*3),y.fromArray(a,nt*3),M.fromArray(a,k*3),S.fromArray(f,q*2),T.fromArray(f,nt*2),x.fromArray(f,k*2),y.sub(_),M.sub(_),T.sub(S),x.sub(S);let xt=1/(T.x*x.y-x.x*T.y);isFinite(xt)&&(v.copy(y).multiplyScalar(x.y).addScaledVector(M,-T.y).multiplyScalar(xt),C.copy(M).multiplyScalar(T.x).addScaledVector(y,-x.x).multiplyScalar(xt),d[q].add(v),d[nt].add(v),d[k].add(v),g[q].add(C),g[nt].add(C),g[k].add(C))}let O=this.groups;O.length===0&&(O=[{start:0,count:o.length}]);for(let q=0,nt=O.length;q<nt;++q){let k=O[q],xt=k.start,X=k.count;for(let it=xt,vt=xt+X;it<vt;it+=3)w(o[it+0],o[it+1],o[it+2])}let F=new mt,G=new mt,z=new mt,L=new mt;function D(q){z.fromArray(l,q*3),L.copy(z);let nt=d[q];F.copy(nt),F.sub(z.multiplyScalar(z.dot(nt))).normalize(),G.crossVectors(L,nt);let xt=G.dot(g[q])<0?-1:1;p[q*4]=F.x,p[q*4+1]=F.y,p[q*4+2]=F.z,p[q*4+3]=xt}for(let q=0,nt=O.length;q<nt;++q){let k=O[q],xt=k.start,X=k.count;for(let it=xt,vt=xt+X;it<vt;it+=3)D(o[it+0]),D(o[it+1]),D(o[it+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 Ui(new Float32Array(e.count*3),3),this.setAttribute("normal",o);else for(let y=0,M=o.count;y<M;y++)o.setXYZ(y,0,0,0);let a=new mt,l=new mt,f=new mt,h=new mt,p=new mt,d=new mt,g=new mt,_=new mt;if(t)for(let y=0,M=t.count;y<M;y+=3){let S=t.getX(y+0),T=t.getX(y+1),x=t.getX(y+2);a.fromBufferAttribute(e,S),l.fromBufferAttribute(e,T),f.fromBufferAttribute(e,x),g.subVectors(f,l),_.subVectors(a,l),g.cross(_),h.fromBufferAttribute(o,S),p.fromBufferAttribute(o,T),d.fromBufferAttribute(o,x),h.add(g),p.add(g),d.add(g),o.setXYZ(S,h.x,h.y,h.z),o.setXYZ(T,p.x,p.y,p.z),o.setXYZ(x,d.x,d.y,d.z)}else for(let y=0,M=e.count;y<M;y+=3)a.fromBufferAttribute(e,y+0),l.fromBufferAttribute(e,y+1),f.fromBufferAttribute(e,y+2),g.subVectors(f,l),_.subVectors(a,l),g.cross(_),o.setXYZ(y+0,g.x,g.y,g.z),o.setXYZ(y+1,g.x,g.y,g.z),o.setXYZ(y+2,g.x,g.y,g.z);this.normalizeNormals(),o.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,o=t.count;e<o;e++)mr.fromBufferAttribute(t,e),mr.normalize(),t.setXYZ(e,mr.x,mr.y,mr.z)}toNonIndexed(){function t(h,p){let d=h.array,g=h.itemSize,_=h.normalized,y=new d.constructor(p.length*g),M=0,S=0;for(let T=0,x=p.length;T<x;T++){h.isInterleavedBufferAttribute?M=p[T]*h.data.stride+h.offset:M=p[T]*g;for(let v=0;v<g;v++)y[S++]=d[M++]}return new Ui(y,g,_)}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 h in a){let p=a[h],d=t(p,o);e.setAttribute(h,d)}let l=this.morphAttributes;for(let h in l){let p=[],d=l[h];for(let g=0,_=d.length;g<_;g++){let y=d[g],M=t(y,o);p.push(M)}e.morphAttributes[h]=p}e.morphTargetsRelative=this.morphTargetsRelative;let f=this.groups;for(let h=0,p=f.length;h<p;h++){let d=f[h];e.addGroup(d.start,d.count,d.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 p=this.parameters;for(let d in p)p[d]!==void 0&&(t[d]=p[d]);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 p in o){let d=o[p];t.data.attributes[p]=d.toJSON(t.data)}let a={},l=!1;for(let p in this.morphAttributes){let d=this.morphAttributes[p],g=[];for(let _=0,y=d.length;_<y;_++){let M=d[_];g.push(M.toJSON(t.data))}g.length>0&&(a[p]=g,l=!0)}l&&(t.data.morphAttributes=a,t.data.morphTargetsRelative=this.morphTargetsRelative);let f=this.groups;f.length>0&&(t.data.groups=JSON.parse(JSON.stringify(f)));let h=this.boundingSphere;return h!==null&&(t.data.boundingSphere={center:h.center.toArray(),radius:h.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 d in a){let g=a[d];this.setAttribute(d,g.clone(e))}let l=t.morphAttributes;for(let d in l){let g=[],_=l[d];for(let y=0,M=_.length;y<M;y++)g.push(_[y].clone(e));this.morphAttributes[d]=g}this.morphTargetsRelative=t.morphTargetsRelative;let f=t.groups;for(let d=0,g=f.length;d<g;d++){let _=f[d];this.addGroup(_.start,_.count,_.materialIndex)}let h=t.boundingBox;h!==null&&(this.boundingBox=h.clone());let p=t.boundingSphere;return p!==null&&(this.boundingSphere=p.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},Ag=new kr,Ws=new Ah,Vl=new Vu,Cg=new mt,La=new mt,Na=new mt,Oa=new mt,hh=new mt,Hl=new mt,Wl=new fn,ql=new fn,Xl=new fn,Pg=new mt,Ig=new mt,Rg=new mt,Yl=new mt,$l=new mt,go=class extends yo{constructor(t=new Qs,e=new hc){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 l=0,f=a.length;l<f;l++){let h=a[l].name||String(l);this.morphTargetInfluences.push(0),this.morphTargetDictionary[h]=l}}}}getVertexPosition(t,e){let o=this.geometry,a=o.attributes.position,l=o.morphAttributes.position,f=o.morphTargetsRelative;e.fromBufferAttribute(a,t);let h=this.morphTargetInfluences;if(l&&h){Hl.set(0,0,0);for(let p=0,d=l.length;p<d;p++){let g=h[p],_=l[p];g!==0&&(hh.fromBufferAttribute(_,t),f?Hl.addScaledVector(hh,g):Hl.addScaledVector(hh.sub(e),g))}e.add(Hl)}return e}raycast(t,e){let o=this.geometry,a=this.material,l=this.matrixWorld;a!==void 0&&(o.boundingSphere===null&&o.computeBoundingSphere(),Vl.copy(o.boundingSphere),Vl.applyMatrix4(l),Ws.copy(t.ray).recast(t.near),!(Vl.containsPoint(Ws.origin)===!1&&(Ws.intersectSphere(Vl,Cg)===null||Ws.origin.distanceToSquared(Cg)>(t.far-t.near)**2))&&(Ag.copy(l).invert(),Ws.copy(t.ray).applyMatrix4(Ag),!(o.boundingBox!==null&&Ws.intersectsBox(o.boundingBox)===!1)&&this._computeIntersections(t,e,Ws)))}_computeIntersections(t,e,o){let a,l=this.geometry,f=this.material,h=l.index,p=l.attributes.position,d=l.attributes.uv,g=l.attributes.uv1,_=l.attributes.normal,y=l.groups,M=l.drawRange;if(h!==null)if(Array.isArray(f))for(let S=0,T=y.length;S<T;S++){let x=y[S],v=f[x.materialIndex],C=Math.max(x.start,M.start),w=Math.min(h.count,Math.min(x.start+x.count,M.start+M.count));for(let O=C,F=w;O<F;O+=3){let G=h.getX(O),z=h.getX(O+1),L=h.getX(O+2);a=Zl(this,v,t,o,d,g,_,G,z,L),a&&(a.faceIndex=Math.floor(O/3),a.face.materialIndex=x.materialIndex,e.push(a))}}else{let S=Math.max(0,M.start),T=Math.min(h.count,M.start+M.count);for(let x=S,v=T;x<v;x+=3){let C=h.getX(x),w=h.getX(x+1),O=h.getX(x+2);a=Zl(this,f,t,o,d,g,_,C,w,O),a&&(a.faceIndex=Math.floor(x/3),e.push(a))}}else if(p!==void 0)if(Array.isArray(f))for(let S=0,T=y.length;S<T;S++){let x=y[S],v=f[x.materialIndex],C=Math.max(x.start,M.start),w=Math.min(p.count,Math.min(x.start+x.count,M.start+M.count));for(let O=C,F=w;O<F;O+=3){let G=O,z=O+1,L=O+2;a=Zl(this,v,t,o,d,g,_,G,z,L),a&&(a.faceIndex=Math.floor(O/3),a.face.materialIndex=x.materialIndex,e.push(a))}}else{let S=Math.max(0,M.start),T=Math.min(p.count,M.start+M.count);for(let x=S,v=T;x<v;x+=3){let C=x,w=x+1,O=x+2;a=Zl(this,f,t,o,d,g,_,C,w,O),a&&(a.faceIndex=Math.floor(x/3),e.push(a))}}}};function sE(r,t,e,o,a,l,f,h){let p;if(t.side===li?p=o.intersectTriangle(f,l,a,!0,h):p=o.intersectTriangle(a,l,f,t.side===xs,h),p===null)return null;$l.copy(h),$l.applyMatrix4(r.matrixWorld);let d=e.ray.origin.distanceTo($l);return d<e.near||d>e.far?null:{distance:d,point:$l.clone(),object:r}}function Zl(r,t,e,o,a,l,f,h,p,d){r.getVertexPosition(h,La),r.getVertexPosition(p,Na),r.getVertexPosition(d,Oa);let g=sE(r,t,e,o,La,Na,Oa,Yl);if(g){a&&(Wl.fromBufferAttribute(a,h),ql.fromBufferAttribute(a,p),Xl.fromBufferAttribute(a,d),g.uv=za.getInterpolation(Yl,La,Na,Oa,Wl,ql,Xl,new fn)),l&&(Wl.fromBufferAttribute(l,h),ql.fromBufferAttribute(l,p),Xl.fromBufferAttribute(l,d),g.uv1=za.getInterpolation(Yl,La,Na,Oa,Wl,ql,Xl,new fn),g.uv2=g.uv1),f&&(Pg.fromBufferAttribute(f,h),Ig.fromBufferAttribute(f,p),Rg.fromBufferAttribute(f,d),g.normal=za.getInterpolation(Yl,La,Na,Oa,Pg,Ig,Rg,new mt),g.normal.dot(o.direction)>0&&g.normal.multiplyScalar(-1));let _={a:h,b:p,c:d,normal:new mt,materialIndex:0};za.getNormal(La,Na,Oa,_.normal),g.face=_}return g}var Hu=class r extends Qs{constructor(t=1,e=1,o=1,a=1,l=1,f=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:o,widthSegments:a,heightSegments:l,depthSegments:f};let h=this;a=Math.floor(a),l=Math.floor(l),f=Math.floor(f);let p=[],d=[],g=[],_=[],y=0,M=0;S("z","y","x",-1,-1,o,e,t,f,l,0),S("z","y","x",1,-1,o,e,-t,f,l,1),S("x","z","y",1,1,t,o,e,a,f,2),S("x","z","y",1,-1,t,o,-e,a,f,3),S("x","y","z",1,-1,t,e,o,a,l,4),S("x","y","z",-1,-1,t,e,-o,a,l,5),this.setIndex(p),this.setAttribute("position",new Zo(d,3)),this.setAttribute("normal",new Zo(g,3)),this.setAttribute("uv",new Zo(_,2));function S(T,x,v,C,w,O,F,G,z,L,D){let q=O/z,nt=F/L,k=O/2,xt=F/2,X=G/2,it=z+1,vt=L+1,pt=0,et=0,ot=new mt;for(let V=0;V<vt;V++){let K=V*nt-xt;for(let at=0;at<it;at++){let Tt=at*q-k;ot[T]=Tt*C,ot[x]=K*w,ot[v]=X,d.push(ot.x,ot.y,ot.z),ot[T]=0,ot[x]=0,ot[v]=G>0?1:-1,g.push(ot.x,ot.y,ot.z),_.push(at/z),_.push(1-V/L),pt+=1}}for(let V=0;V<L;V++)for(let K=0;K<z;K++){let at=y+K+it*V,Tt=y+K+it*(V+1),dt=y+(K+1)+it*(V+1),Ct=y+(K+1)+it*V;p.push(at,Tt,Ct),p.push(Tt,dt,Ct),et+=6}h.addGroup(M,et,D),M+=et,y+=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 Za(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 Jr(r){let t={};for(let e=0;e<r.length;e++){let o=Za(r[e]);for(let a in o)t[a]=o[a]}return t}function aE(r){let t=[];for(let e=0;e<r.length;e++)t.push(r[e].clone());return t}function p0(r){return r.getRenderTarget()===null?r.outputColorSpace:yn.workingColorSpace}var uE={clone:Za,merge:Jr},lE=\`void main() {
|
|
95
95
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
96
96
|
}\`,cE=\`void main() {
|
|
97
97
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
131
131
|
|
|
132
132
|
}
|
|
133
|
-
\`},a=new Hu(5,5,5),l=new Qo({name:"CubemapFromEquirect",uniforms:Za(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,side:li,blending:ys});l.uniforms.tEquirect.value=e;let f=new go(a,l),h=e.minFilter;return e.minFilter===ku&&(e.minFilter=Di),new Ch(1,10,this).update(t,f),e.minFilter=h,f.geometry.dispose(),f.material.dispose(),this}clear(t,e,o,a){let l=t.getRenderTarget();for(let f=0;f<6;f++)t.setRenderTarget(this,f),t.clear(e,o,a);t.setRenderTarget(l)}},ph=new mt,fE=new mt,hE=new
|
|
133
|
+
\`},a=new Hu(5,5,5),l=new Qo({name:"CubemapFromEquirect",uniforms:Za(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,side:li,blending:ys});l.uniforms.tEquirect.value=e;let f=new go(a,l),h=e.minFilter;return e.minFilter===ku&&(e.minFilter=Di),new Ch(1,10,this).update(t,f),e.minFilter=h,f.geometry.dispose(),f.material.dispose(),this}clear(t,e,o,a){let l=t.getRenderTarget();for(let f=0;f<6;f++)t.setRenderTarget(this,f),t.clear(e,o,a);t.setRenderTarget(l)}},ph=new mt,fE=new mt,hE=new ye,Xo=class{constructor(t=new mt(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,o,a){return this.normal.set(t,e,o),this.constant=a,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,o){let a=ph.subVectors(o,e).cross(fE.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(a,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){let o=t.delta(ph),a=this.normal.dot(o);if(a===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let l=-(t.start.dot(this.normal)+this.constant)/a;return l<0||l>1?null:e.copy(t.start).addScaledVector(o,l)}intersectsLine(t){let e=this.distanceToPoint(t.start),o=this.distanceToPoint(t.end);return e<0&&o>0||o<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let o=e||hE.getNormalMatrix(t),a=this.coplanarPoint(ph).applyMatrix4(t),l=this.normal.applyMatrix3(o).normalize();return this.constant=-a.dot(l),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}},qs=new Vu,Jl=new mt,yc=class{constructor(t=new Xo,e=new Xo,o=new Xo,a=new Xo,l=new Xo,f=new Xo){this.planes=[t,e,o,a,l,f]}set(t,e,o,a,l,f){let h=this.planes;return h[0].copy(t),h[1].copy(e),h[2].copy(o),h[3].copy(a),h[4].copy(l),h[5].copy(f),this}copy(t){let e=this.planes;for(let o=0;o<6;o++)e[o].copy(t.planes[o]);return this}setFromProjectionMatrix(t,e=$o){let o=this.planes,a=t.elements,l=a[0],f=a[1],h=a[2],p=a[3],d=a[4],g=a[5],_=a[6],y=a[7],M=a[8],S=a[9],T=a[10],x=a[11],v=a[12],C=a[13],w=a[14],O=a[15];if(o[0].setComponents(p-l,y-d,x-M,O-v).normalize(),o[1].setComponents(p+l,y+d,x+M,O+v).normalize(),o[2].setComponents(p+f,y+g,x+S,O+C).normalize(),o[3].setComponents(p-f,y-g,x-S,O-C).normalize(),o[4].setComponents(p-h,y-_,x-T,O-w).normalize(),e===$o)o[5].setComponents(p+h,y+_,x+T,O+w).normalize();else if(e===oc)o[5].setComponents(h,_,T,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),qs.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),qs.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(qs)}intersectsSprite(t){return qs.center.set(0,0,0),qs.radius=.7071067811865476,qs.applyMatrix4(t.matrixWorld),this.intersectsSphere(qs)}intersectsSphere(t){let e=this.planes,o=t.center,a=-t.radius;for(let l=0;l<6;l++)if(e[l].distanceToPoint(o)<a)return!1;return!0}intersectsBox(t){let e=this.planes;for(let o=0;o<6;o++){let a=e[o];if(Jl.x=a.normal.x>0?t.max.x:t.min.x,Jl.y=a.normal.y>0?t.max.y:t.min.y,Jl.z=a.normal.z>0?t.max.z:t.min.z,a.distanceToPoint(Jl)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let o=0;o<6;o++)if(e[o].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function d0(){let r=null,t=!1,e=null,o=null;function a(l,f){e(l,f),o=r.requestAnimationFrame(a)}return{start:function(){t!==!0&&e!==null&&(o=r.requestAnimationFrame(a),t=!0)},stop:function(){r.cancelAnimationFrame(o),t=!1},setAnimationLoop:function(l){e=l},setContext:function(l){r=l}}}function pE(r,t){let e=t.isWebGL2,o=new WeakMap;function a(d,g){let _=d.array,y=d.usage,M=r.createBuffer();r.bindBuffer(g,M),r.bufferData(g,_,y),d.onUploadCallback();let S;if(_ instanceof Float32Array)S=r.FLOAT;else if(_ instanceof Uint16Array)if(d.isFloat16BufferAttribute)if(e)S=r.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else S=r.UNSIGNED_SHORT;else if(_ instanceof Int16Array)S=r.SHORT;else if(_ instanceof Uint32Array)S=r.UNSIGNED_INT;else if(_ instanceof Int32Array)S=r.INT;else if(_ instanceof Int8Array)S=r.BYTE;else if(_ instanceof Uint8Array)S=r.UNSIGNED_BYTE;else if(_ instanceof Uint8ClampedArray)S=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+_);return{buffer:M,type:S,bytesPerElement:_.BYTES_PER_ELEMENT,version:d.version}}function l(d,g,_){let y=g.array,M=g.updateRange;r.bindBuffer(_,d),M.count===-1?r.bufferSubData(_,0,y):(e?r.bufferSubData(_,M.offset*y.BYTES_PER_ELEMENT,y,M.offset,M.count):r.bufferSubData(_,M.offset*y.BYTES_PER_ELEMENT,y.subarray(M.offset,M.offset+M.count)),M.count=-1),g.onUploadCallback()}function f(d){return d.isInterleavedBufferAttribute&&(d=d.data),o.get(d)}function h(d){d.isInterleavedBufferAttribute&&(d=d.data);let g=o.get(d);g&&(r.deleteBuffer(g.buffer),o.delete(d))}function p(d,g){if(d.isGLBufferAttribute){let y=o.get(d);(!y||y.version<d.version)&&o.set(d,{buffer:d.buffer,type:d.type,bytesPerElement:d.elementSize,version:d.version});return}d.isInterleavedBufferAttribute&&(d=d.data);let _=o.get(d);_===void 0?o.set(d,a(d,g)):_.version<d.version&&(l(_.buffer,d,g),_.version=d.version)}return{get:f,remove:h,update:p}}var Ih=class r extends Qs{constructor(t=1,e=1,o=1,a=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:o,heightSegments:a};let l=t/2,f=e/2,h=Math.floor(o),p=Math.floor(a),d=h+1,g=p+1,_=t/h,y=e/p,M=[],S=[],T=[],x=[];for(let v=0;v<g;v++){let C=v*y-f;for(let w=0;w<d;w++){let O=w*_-l;S.push(O,-C,0),T.push(0,0,1),x.push(w/h),x.push(1-v/p)}}for(let v=0;v<p;v++)for(let C=0;C<h;C++){let w=C+d*v,O=C+d*(v+1),F=C+1+d*(v+1),G=C+1+d*v;M.push(w,O,G),M.push(O,F,G)}this.setIndex(M),this.setAttribute("position",new Zo(S,3)),this.setAttribute("normal",new Zo(T,3)),this.setAttribute("uv",new Zo(x,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.width,t.height,t.widthSegments,t.heightSegments)}},dE=\`#ifdef USE_ALPHAHASH
|
|
134
134
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
135
135
|
#endif\`,mE=\`#ifdef USE_ALPHAHASH
|
|
136
136
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
@@ -3459,7 +3459,7 @@ void main() {
|
|
|
3459
3459
|
#include <tonemapping_fragment>
|
|
3460
3460
|
#include <colorspace_fragment>
|
|
3461
3461
|
#include <fog_fragment>
|
|
3462
|
-
}\`,ge={alphahash_fragment:dE,alphahash_pars_fragment:mE,alphamap_fragment:gE,alphamap_pars_fragment:yE,alphatest_fragment:vE,alphatest_pars_fragment:_E,aomap_fragment:xE,aomap_pars_fragment:EE,begin_vertex:ME,beginnormal_vertex:wE,bsdfs:SE,iridescence_fragment:bE,bumpmap_pars_fragment:TE,clipping_planes_fragment:AE,clipping_planes_pars_fragment:CE,clipping_planes_pars_vertex:PE,clipping_planes_vertex:IE,color_fragment:RE,color_pars_fragment:LE,color_pars_vertex:NE,color_vertex:OE,common:DE,cube_uv_reflection_fragment:FE,defaultnormal_vertex:UE,displacementmap_pars_vertex:BE,displacementmap_vertex:zE,emissivemap_fragment:kE,emissivemap_pars_fragment:GE,colorspace_fragment:VE,colorspace_pars_fragment:HE,envmap_fragment:WE,envmap_common_pars_fragment:qE,envmap_pars_fragment:XE,envmap_pars_vertex:YE,envmap_physical_pars_fragment:oM,envmap_vertex:$E,fog_vertex:ZE,fog_pars_vertex:JE,fog_fragment:KE,fog_pars_fragment:QE,gradientmap_pars_fragment:jE,lightmap_fragment:tM,lightmap_pars_fragment:eM,lights_lambert_fragment:nM,lights_lambert_pars_fragment:rM,lights_pars_begin:iM,lights_toon_fragment:sM,lights_toon_pars_fragment:aM,lights_phong_fragment:uM,lights_phong_pars_fragment:lM,lights_physical_fragment:cM,lights_physical_pars_fragment:fM,lights_fragment_begin:hM,lights_fragment_maps:pM,lights_fragment_end:dM,logdepthbuf_fragment:mM,logdepthbuf_pars_fragment:gM,logdepthbuf_pars_vertex:yM,logdepthbuf_vertex:vM,map_fragment:_M,map_pars_fragment:xM,map_particle_fragment:EM,map_particle_pars_fragment:MM,metalnessmap_fragment:wM,metalnessmap_pars_fragment:SM,morphcolor_vertex:bM,morphnormal_vertex:TM,morphtarget_pars_vertex:AM,morphtarget_vertex:CM,normal_fragment_begin:PM,normal_fragment_maps:IM,normal_pars_fragment:RM,normal_pars_vertex:LM,normal_vertex:NM,normalmap_pars_fragment:OM,clearcoat_normal_fragment_begin:DM,clearcoat_normal_fragment_maps:FM,clearcoat_pars_fragment:UM,iridescence_pars_fragment:BM,opaque_fragment:zM,packing:kM,premultiplied_alpha_fragment:GM,project_vertex:VM,dithering_fragment:HM,dithering_pars_fragment:WM,roughnessmap_fragment:qM,roughnessmap_pars_fragment:XM,shadowmap_pars_fragment:YM,shadowmap_pars_vertex:$M,shadowmap_vertex:ZM,shadowmask_pars_fragment:JM,skinbase_vertex:KM,skinning_pars_vertex:QM,skinning_vertex:jM,skinnormal_vertex:tw,specularmap_fragment:ew,specularmap_pars_fragment:nw,tonemapping_fragment:rw,tonemapping_pars_fragment:iw,transmission_fragment:ow,transmission_pars_fragment:sw,uv_pars_fragment:aw,uv_pars_vertex:uw,uv_vertex:lw,worldpos_vertex:cw,background_vert:fw,background_frag:hw,backgroundCube_vert:pw,backgroundCube_frag:dw,cube_vert:mw,cube_frag:gw,depth_vert:yw,depth_frag:vw,distanceRGBA_vert:_w,distanceRGBA_frag:xw,equirect_vert:Ew,equirect_frag:Mw,linedashed_vert:ww,linedashed_frag:Sw,meshbasic_vert:bw,meshbasic_frag:Tw,meshlambert_vert:Aw,meshlambert_frag:Cw,meshmatcap_vert:Pw,meshmatcap_frag:Iw,meshnormal_vert:Rw,meshnormal_frag:Lw,meshphong_vert:Nw,meshphong_frag:Ow,meshphysical_vert:Dw,meshphysical_frag:Fw,meshtoon_vert:Uw,meshtoon_frag:Bw,points_vert:zw,points_frag:kw,shadow_vert:Gw,shadow_frag:Vw,sprite_vert:Hw,sprite_frag:Ww},zt={common:{diffuse:{value:new En(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ve},alphaMap:{value:null},alphaMapTransform:{value:new ve},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ve}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ve}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ve}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ve},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ve},normalScale:{value:new fn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ve},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ve}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ve}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ve}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new En(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new En(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ve},alphaTest:{value:0},uvTransform:{value:new ve}},sprite:{diffuse:{value:new En(16777215)},opacity:{value:1},center:{value:new fn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ve},alphaMap:{value:null},alphaMapTransform:{value:new ve},alphaTest:{value:0}}},mo={basic:{uniforms:Jr([zt.common,zt.specularmap,zt.envmap,zt.aomap,zt.lightmap,zt.fog]),vertexShader:ge.meshbasic_vert,fragmentShader:ge.meshbasic_frag},lambert:{uniforms:Jr([zt.common,zt.specularmap,zt.envmap,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.fog,zt.lights,{emissive:{value:new En(0)}}]),vertexShader:ge.meshlambert_vert,fragmentShader:ge.meshlambert_frag},phong:{uniforms:Jr([zt.common,zt.specularmap,zt.envmap,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.fog,zt.lights,{emissive:{value:new En(0)},specular:{value:new En(1118481)},shininess:{value:30}}]),vertexShader:ge.meshphong_vert,fragmentShader:ge.meshphong_frag},standard:{uniforms:Jr([zt.common,zt.envmap,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.roughnessmap,zt.metalnessmap,zt.fog,zt.lights,{emissive:{value:new En(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ge.meshphysical_vert,fragmentShader:ge.meshphysical_frag},toon:{uniforms:Jr([zt.common,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.gradientmap,zt.fog,zt.lights,{emissive:{value:new En(0)}}]),vertexShader:ge.meshtoon_vert,fragmentShader:ge.meshtoon_frag},matcap:{uniforms:Jr([zt.common,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.fog,{matcap:{value:null}}]),vertexShader:ge.meshmatcap_vert,fragmentShader:ge.meshmatcap_frag},points:{uniforms:Jr([zt.points,zt.fog]),vertexShader:ge.points_vert,fragmentShader:ge.points_frag},dashed:{uniforms:Jr([zt.common,zt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ge.linedashed_vert,fragmentShader:ge.linedashed_frag},depth:{uniforms:Jr([zt.common,zt.displacementmap]),vertexShader:ge.depth_vert,fragmentShader:ge.depth_frag},normal:{uniforms:Jr([zt.common,zt.bumpmap,zt.normalmap,zt.displacementmap,{opacity:{value:1}}]),vertexShader:ge.meshnormal_vert,fragmentShader:ge.meshnormal_frag},sprite:{uniforms:Jr([zt.sprite,zt.fog]),vertexShader:ge.sprite_vert,fragmentShader:ge.sprite_frag},background:{uniforms:{uvTransform:{value:new ve},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ge.background_vert,fragmentShader:ge.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ge.backgroundCube_vert,fragmentShader:ge.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ge.cube_vert,fragmentShader:ge.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ge.equirect_vert,fragmentShader:ge.equirect_frag},distanceRGBA:{uniforms:Jr([zt.common,zt.displacementmap,{referencePosition:{value:new mt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ge.distanceRGBA_vert,fragmentShader:ge.distanceRGBA_frag},shadow:{uniforms:Jr([zt.lights,zt.fog,{color:{value:new En(0)},opacity:{value:1}}]),vertexShader:ge.shadow_vert,fragmentShader:ge.shadow_frag}};mo.physical={uniforms:Jr([mo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ve},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ve},clearcoatNormalScale:{value:new fn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ve},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ve},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ve},sheen:{value:0},sheenColor:{value:new En(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ve},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ve},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ve},transmissionSamplerSize:{value:new fn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ve},attenuationDistance:{value:0},attenuationColor:{value:new En(0)},specularColor:{value:new En(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ve},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ve},anisotropyVector:{value:new fn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ve}}]),vertexShader:ge.meshphysical_vert,fragmentShader:ge.meshphysical_frag};var Kl={r:0,b:0,g:0};function qw(r,t,e,o,a,l,f){let h=new En(0),p=l===!0?0:1,d,g,_=null,y=0,M=null;function S(x,v){let C=!1,w=v.isScene===!0?v.background:null;w&&w.isTexture&&(w=(v.backgroundBlurriness>0?e:t).get(w)),w===null?T(h,p):w&&w.isColor&&(T(w,1),C=!0);let O=r.xr.getEnvironmentBlendMode();O==="additive"?o.buffers.color.setClear(0,0,0,1,f):O==="alpha-blend"&&o.buffers.color.setClear(0,0,0,0,f),(r.autoClear||C)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),w&&(w.isCubeTexture||w.mapping===_c)?(g===void 0&&(g=new go(new Hu(1,1,1),new Qo({name:"BackgroundCubeMaterial",uniforms:Za(mo.backgroundCube.uniforms),vertexShader:mo.backgroundCube.vertexShader,fragmentShader:mo.backgroundCube.fragmentShader,side:li,depthTest:!1,depthWrite:!1,fog:!1})),g.geometry.deleteAttribute("normal"),g.geometry.deleteAttribute("uv"),g.onBeforeRender=function(F,G,z){this.matrixWorld.copyPosition(z.matrixWorld)},Object.defineProperty(g.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(g)),g.material.uniforms.envMap.value=w,g.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,g.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,g.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,g.material.toneMapped=yn.getTransfer(w.colorSpace)!==An,(_!==w||y!==w.version||M!==r.toneMapping)&&(g.material.needsUpdate=!0,_=w,y=w.version,M=r.toneMapping),g.layers.enableAll(),x.unshift(g,g.geometry,g.material,0,0,null)):w&&w.isTexture&&(d===void 0&&(d=new go(new Ih(2,2),new Qo({name:"BackgroundMaterial",uniforms:Za(mo.background.uniforms),vertexShader:mo.background.vertexShader,fragmentShader:mo.background.fragmentShader,side:xs,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(d)),d.material.uniforms.t2D.value=w,d.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,d.material.toneMapped=yn.getTransfer(w.colorSpace)!==An,w.matrixAutoUpdate===!0&&w.updateMatrix(),d.material.uniforms.uvTransform.value.copy(w.matrix),(_!==w||y!==w.version||M!==r.toneMapping)&&(d.material.needsUpdate=!0,_=w,y=w.version,M=r.toneMapping),d.layers.enableAll(),x.unshift(d,d.geometry,d.material,0,0,null))}function T(x,v){x.getRGB(Kl,p0(r)),o.buffers.color.setClear(Kl.r,Kl.g,Kl.b,v,f)}return{getClearColor:function(){return h},setClearColor:function(x,v=1){h.set(x),p=v,T(h,p)},getClearAlpha:function(){return p},setClearAlpha:function(x){p=x,T(h,p)},render:S}}function Xw(r,t,e,o){let a=r.getParameter(r.MAX_VERTEX_ATTRIBS),l=o.isWebGL2?null:t.get("OES_vertex_array_object"),f=o.isWebGL2||l!==null,h={},p=x(null),d=p,g=!1;function _(X,it,vt,pt,et){let ot=!1;if(f){let V=T(pt,vt,it);d!==V&&(d=V,M(d.object)),ot=v(X,pt,vt,et),ot&&C(X,pt,vt,et)}else{let V=it.wireframe===!0;(d.geometry!==pt.id||d.program!==vt.id||d.wireframe!==V)&&(d.geometry=pt.id,d.program=vt.id,d.wireframe=V,ot=!0)}et!==null&&e.update(et,r.ELEMENT_ARRAY_BUFFER),(ot||g)&&(g=!1,L(X,it,vt,pt),et!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(et).buffer))}function y(){return o.isWebGL2?r.createVertexArray():l.createVertexArrayOES()}function M(X){return o.isWebGL2?r.bindVertexArray(X):l.bindVertexArrayOES(X)}function S(X){return o.isWebGL2?r.deleteVertexArray(X):l.deleteVertexArrayOES(X)}function T(X,it,vt){let pt=vt.wireframe===!0,et=h[X.id];et===void 0&&(et={},h[X.id]=et);let ot=et[it.id];ot===void 0&&(ot={},et[it.id]=ot);let V=ot[pt];return V===void 0&&(V=x(y()),ot[pt]=V),V}function x(X){let it=[],vt=[],pt=[];for(let et=0;et<a;et++)it[et]=0,vt[et]=0,pt[et]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:it,enabledAttributes:vt,attributeDivisors:pt,object:X,attributes:{},index:null}}function v(X,it,vt,pt){let et=d.attributes,ot=it.attributes,V=0,K=vt.getAttributes();for(let at in K)if(K[at].location>=0){let dt=et[at],Ct=ot[at];if(Ct===void 0&&(at==="instanceMatrix"&&X.instanceMatrix&&(Ct=X.instanceMatrix),at==="instanceColor"&&X.instanceColor&&(Ct=X.instanceColor)),dt===void 0||dt.attribute!==Ct||Ct&&dt.data!==Ct.data)return!0;V++}return d.attributesNum!==V||d.index!==pt}function C(X,it,vt,pt){let et={},ot=it.attributes,V=0,K=vt.getAttributes();for(let at in K)if(K[at].location>=0){let dt=ot[at];dt===void 0&&(at==="instanceMatrix"&&X.instanceMatrix&&(dt=X.instanceMatrix),at==="instanceColor"&&X.instanceColor&&(dt=X.instanceColor));let Ct={};Ct.attribute=dt,dt&&dt.data&&(Ct.data=dt.data),et[at]=Ct,V++}d.attributes=et,d.attributesNum=V,d.index=pt}function w(){let X=d.newAttributes;for(let it=0,vt=X.length;it<vt;it++)X[it]=0}function O(X){F(X,0)}function F(X,it){let vt=d.newAttributes,pt=d.enabledAttributes,et=d.attributeDivisors;vt[X]=1,pt[X]===0&&(r.enableVertexAttribArray(X),pt[X]=1),et[X]!==it&&((o.isWebGL2?r:t.get("ANGLE_instanced_arrays"))[o.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](X,it),et[X]=it)}function G(){let X=d.newAttributes,it=d.enabledAttributes;for(let vt=0,pt=it.length;vt<pt;vt++)it[vt]!==X[vt]&&(r.disableVertexAttribArray(vt),it[vt]=0)}function z(X,it,vt,pt,et,ot,V){V===!0?r.vertexAttribIPointer(X,it,vt,et,ot):r.vertexAttribPointer(X,it,vt,pt,et,ot)}function L(X,it,vt,pt){if(o.isWebGL2===!1&&(X.isInstancedMesh||pt.isInstancedBufferGeometry)&&t.get("ANGLE_instanced_arrays")===null)return;w();let et=pt.attributes,ot=vt.getAttributes(),V=it.defaultAttributeValues;for(let K in ot){let at=ot[K];if(at.location>=0){let Tt=et[K];if(Tt===void 0&&(K==="instanceMatrix"&&X.instanceMatrix&&(Tt=X.instanceMatrix),K==="instanceColor"&&X.instanceColor&&(Tt=X.instanceColor)),Tt!==void 0){let dt=Tt.normalized,Ct=Tt.itemSize,Yt=e.get(Tt);if(Yt===void 0)continue;let Wt=Yt.buffer,Nt=Yt.type,ne=Yt.bytesPerElement,Pt=o.isWebGL2===!0&&(Nt===r.INT||Nt===r.UNSIGNED_INT||Tt.gpuType===i0);if(Tt.isInterleavedBufferAttribute){let Xt=Tt.data,tt=Xt.stride,nn=Tt.offset;if(Xt.isInstancedInterleavedBuffer){for(let Gt=0;Gt<at.locationSize;Gt++)F(at.location+Gt,Xt.meshPerAttribute);X.isInstancedMesh!==!0&&pt._maxInstanceCount===void 0&&(pt._maxInstanceCount=Xt.meshPerAttribute*Xt.count)}else for(let Gt=0;Gt<at.locationSize;Gt++)O(at.location+Gt);r.bindBuffer(r.ARRAY_BUFFER,Wt);for(let Gt=0;Gt<at.locationSize;Gt++)z(at.location+Gt,Ct/at.locationSize,Nt,dt,tt*ne,(nn+Ct/at.locationSize*Gt)*ne,Pt)}else{if(Tt.isInstancedBufferAttribute){for(let Xt=0;Xt<at.locationSize;Xt++)F(at.location+Xt,Tt.meshPerAttribute);X.isInstancedMesh!==!0&&pt._maxInstanceCount===void 0&&(pt._maxInstanceCount=Tt.meshPerAttribute*Tt.count)}else for(let Xt=0;Xt<at.locationSize;Xt++)O(at.location+Xt);r.bindBuffer(r.ARRAY_BUFFER,Wt);for(let Xt=0;Xt<at.locationSize;Xt++)z(at.location+Xt,Ct/at.locationSize,Nt,dt,Ct*ne,Ct/at.locationSize*Xt*ne,Pt)}}else if(V!==void 0){let dt=V[K];if(dt!==void 0)switch(dt.length){case 2:r.vertexAttrib2fv(at.location,dt);break;case 3:r.vertexAttrib3fv(at.location,dt);break;case 4:r.vertexAttrib4fv(at.location,dt);break;default:r.vertexAttrib1fv(at.location,dt)}}}}G()}function D(){k();for(let X in h){let it=h[X];for(let vt in it){let pt=it[vt];for(let et in pt)S(pt[et].object),delete pt[et];delete it[vt]}delete h[X]}}function q(X){if(h[X.id]===void 0)return;let it=h[X.id];for(let vt in it){let pt=it[vt];for(let et in pt)S(pt[et].object),delete pt[et];delete it[vt]}delete h[X.id]}function nt(X){for(let it in h){let vt=h[it];if(vt[X.id]===void 0)continue;let pt=vt[X.id];for(let et in pt)S(pt[et].object),delete pt[et];delete vt[X.id]}}function k(){xt(),g=!0,d!==p&&(d=p,M(d.object))}function xt(){p.geometry=null,p.program=null,p.wireframe=!1}return{setup:_,reset:k,resetDefaultState:xt,dispose:D,releaseStatesOfGeometry:q,releaseStatesOfProgram:nt,initAttributes:w,enableAttribute:O,disableUnusedAttributes:G}}function Yw(r,t,e,o){let a=o.isWebGL2,l;function f(d){l=d}function h(d,g){r.drawArrays(l,d,g),e.update(g,l,1)}function p(d,g,_){if(_===0)return;let y,M;if(a)y=r,M="drawArraysInstanced";else if(y=t.get("ANGLE_instanced_arrays"),M="drawArraysInstancedANGLE",y===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}y[M](l,d,g,_),e.update(g,l,_)}this.setMode=f,this.render=h,this.renderInstances=p}function $w(r,t,e){let o;function a(){if(o!==void 0)return o;if(t.has("EXT_texture_filter_anisotropic")===!0){let z=t.get("EXT_texture_filter_anisotropic");o=r.getParameter(z.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else o=0;return o}function l(z){if(z==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";z="mediump"}return z==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=typeof WebGL2RenderingContext!="undefined"&&r.constructor.name==="WebGL2RenderingContext",h=e.precision!==void 0?e.precision:"highp",p=l(h);p!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",p,"instead."),h=p);let d=f||t.has("WEBGL_draw_buffers"),g=e.logarithmicDepthBuffer===!0,_=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),y=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=r.getParameter(r.MAX_TEXTURE_SIZE),S=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),T=r.getParameter(r.MAX_VERTEX_ATTRIBS),x=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),v=r.getParameter(r.MAX_VARYING_VECTORS),C=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),w=y>0,O=f||t.has("OES_texture_float"),F=w&&O,G=f?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:f,drawBuffers:d,getMaxAnisotropy:a,getMaxPrecision:l,precision:h,logarithmicDepthBuffer:g,maxTextures:_,maxVertexTextures:y,maxTextureSize:M,maxCubemapSize:S,maxAttributes:T,maxVertexUniforms:x,maxVaryings:v,maxFragmentUniforms:C,vertexTextures:w,floatFragmentTextures:O,floatVertexTextures:F,maxSamples:G}}function Zw(r){let t=this,e=null,o=0,a=!1,l=!1,f=new Xo,h=new ve,p={value:null,needsUpdate:!1};this.uniform=p,this.numPlanes=0,this.numIntersection=0,this.init=function(_,y){let M=_.length!==0||y||o!==0||a;return a=y,o=_.length,M},this.beginShadows=function(){l=!0,g(null)},this.endShadows=function(){l=!1},this.setGlobalState=function(_,y){e=g(_,y,0)},this.setState=function(_,y,M){let S=_.clippingPlanes,T=_.clipIntersection,x=_.clipShadows,v=r.get(_);if(!a||S===null||S.length===0||l&&!x)l?g(null):d();else{let C=l?0:o,w=C*4,O=v.clippingState||null;p.value=O,O=g(S,y,w,M);for(let F=0;F!==w;++F)O[F]=e[F];v.clippingState=O,this.numIntersection=T?this.numPlanes:0,this.numPlanes+=C}};function d(){p.value!==e&&(p.value=e,p.needsUpdate=o>0),t.numPlanes=o,t.numIntersection=0}function g(_,y,M,S){let T=_!==null?_.length:0,x=null;if(T!==0){if(x=p.value,S!==!0||x===null){let v=M+T*4,C=y.matrixWorldInverse;h.getNormalMatrix(C),(x===null||x.length<v)&&(x=new Float32Array(v));for(let w=0,O=M;w!==T;++w,O+=4)f.copy(_[w]).applyMatrix4(C,h),f.normal.toArray(x,O),x[O+3]=f.constant}p.value=x,p.needsUpdate=!0}return t.numPlanes=T,t.numIntersection=0,x}}function Jw(r){let t=new WeakMap;function e(f,h){return h===vh?f.mapping=qa:h===_h&&(f.mapping=Xa),f}function o(f){if(f&&f.isTexture&&f.isRenderTargetTexture===!1){let h=f.mapping;if(h===vh||h===_h)if(t.has(f)){let p=t.get(f).texture;return e(p,f.mapping)}else{let p=f.image;if(p&&p.height>0){let d=new Ph(p.height/2);return d.fromEquirectangularTexture(r,f),t.set(f,d),f.addEventListener("dispose",a),e(d.texture,f.mapping)}else return null}}return f}function a(f){let h=f.target;h.removeEventListener("dispose",a);let p=t.get(h);p!==void 0&&(t.delete(h),p.dispose())}function l(){t=new WeakMap}return{get:o,dispose:l}}var Rh=class extends mc{constructor(t=-1,e=1,o=1,a=-1,l=.1,f=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=o,this.bottom=a,this.near=l,this.far=f,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,o,a,l,f){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=o,this.view.offsetY=a,this.view.width=l,this.view.height=f,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),o=(this.right+this.left)/2,a=(this.top+this.bottom)/2,l=o-t,f=o+t,h=a+e,p=a-e;if(this.view!==null&&this.view.enabled){let d=(this.right-this.left)/this.view.fullWidth/this.zoom,g=(this.top-this.bottom)/this.view.fullHeight/this.zoom;l+=d*this.view.offsetX,f=l+d*this.view.width,h-=g*this.view.offsetY,p=h-g*this.view.height}this.projectionMatrix.makeOrthographic(l,f,h,p,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}},ka=4,Lg=[.125,.215,.35,.446,.526,.582],Ys=20,dh=new Rh,Ng=new En,mh=null,Xs=(1+Math.sqrt(5))/2,Ua=1/Xs,Og=[new mt(1,1,1),new mt(-1,1,1),new mt(1,1,-1),new mt(-1,1,-1),new mt(0,Xs,Ua),new mt(0,Xs,-Ua),new mt(Ua,0,Xs),new mt(-Ua,0,Xs),new mt(Xs,Ua,0),new mt(-Xs,Ua,0)],vc=class{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,o=.1,a=100){mh=this._renderer.getRenderTarget(),this._setSize(256);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(t,o,a,l),e>0&&this._blur(l,0,0,e),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Ug(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Fg(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(mh),t.scissorTest=!1,Ql(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===qa||t.mapping===Xa?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),mh=this._renderer.getRenderTarget();let o=e||this._allocateTargets();return this._textureToCubeUV(t,o),this._applyPMREM(o),this._cleanup(o),o}_allocateTargets(){let t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,o={magFilter:Di,minFilter:Di,generateMipmaps:!1,type:Gu,format:to,colorSpace:Jo,depthBuffer:!1},a=Dg(t,e,o);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Dg(t,e,o);let{_lodMax:l}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Kw(l)),this._blurMaterial=Qw(l,t,e)}return a}_compileMaterial(t){let e=new go(this._lodPlanes[0],t);this._renderer.compile(e,dh)}_sceneToCubeUV(t,e,o,a){let h=new Mi(90,1,e,o),p=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],g=this._renderer,_=g.autoClear,y=g.toneMapping;g.getClearColor(Ng),g.toneMapping=vs,g.autoClear=!1;let M=new hc({name:"PMREM.Background",side:li,depthWrite:!1,depthTest:!1}),S=new go(new Hu,M),T=!1,x=t.background;x?x.isColor&&(M.color.copy(x),t.background=null,T=!0):(M.color.copy(Ng),T=!0);for(let v=0;v<6;v++){let C=v%3;C===0?(h.up.set(0,p[v],0),h.lookAt(d[v],0,0)):C===1?(h.up.set(0,0,p[v]),h.lookAt(0,d[v],0)):(h.up.set(0,p[v],0),h.lookAt(0,0,d[v]));let w=this._cubeSize;Ql(a,C*w,v>2?w:0,w,w),g.setRenderTarget(a),T&&g.render(S,h),g.render(t,h)}S.geometry.dispose(),S.material.dispose(),g.toneMapping=y,g.autoClear=_,t.background=x}_textureToCubeUV(t,e){let o=this._renderer,a=t.mapping===qa||t.mapping===Xa;a?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ug()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Fg());let l=a?this._cubemapMaterial:this._equirectMaterial,f=new go(this._lodPlanes[0],l),h=l.uniforms;h.envMap.value=t;let p=this._cubeSize;Ql(e,0,0,3*p,2*p),o.setRenderTarget(e),o.render(f,dh)}_applyPMREM(t){let e=this._renderer,o=e.autoClear;e.autoClear=!1;for(let a=1;a<this._lodPlanes.length;a++){let l=Math.sqrt(this._sigmas[a]*this._sigmas[a]-this._sigmas[a-1]*this._sigmas[a-1]),f=Og[(a-1)%Og.length];this._blur(t,a-1,a,l,f)}e.autoClear=o}_blur(t,e,o,a,l){let f=this._pingPongRenderTarget;this._halfBlur(t,f,e,o,a,"latitudinal",l),this._halfBlur(f,t,o,o,a,"longitudinal",l)}_halfBlur(t,e,o,a,l,f,h){let p=this._renderer,d=this._blurMaterial;f!=="latitudinal"&&f!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let g=3,_=new go(this._lodPlanes[a],d),y=d.uniforms,M=this._sizeLods[o]-1,S=isFinite(l)?Math.PI/(2*M):2*Math.PI/(2*Ys-1),T=l/S,x=isFinite(l)?1+Math.floor(g*T):Ys;x>Ys&&console.warn(\`sigmaRadians, \${l}, is too large and will clip, as it requested \${x} samples when the maximum is set to \${Ys}\`);let v=[],C=0;for(let z=0;z<Ys;++z){let L=z/T,D=Math.exp(-L*L/2);v.push(D),z===0?C+=D:z<x&&(C+=2*D)}for(let z=0;z<v.length;z++)v[z]=v[z]/C;y.envMap.value=t.texture,y.samples.value=x,y.weights.value=v,y.latitudinal.value=f==="latitudinal",h&&(y.poleAxis.value=h);let{_lodMax:w}=this;y.dTheta.value=S,y.mipInt.value=w-o;let O=this._sizeLods[a],F=3*O*(a>w-ka?a-w+ka:0),G=4*(this._cubeSize-O);Ql(e,F,G,3*O,2*O),p.setRenderTarget(e),p.render(_,dh)}};function Kw(r){let t=[],e=[],o=[],a=r,l=r-ka+1+Lg.length;for(let f=0;f<l;f++){let h=Math.pow(2,a);e.push(h);let p=1/h;f>r-ka?p=Lg[f-r+ka-1]:f===0&&(p=0),o.push(p);let d=1/(h-2),g=-d,_=1+d,y=[g,g,_,g,_,_,g,g,_,_,g,_],M=6,S=6,T=3,x=2,v=1,C=new Float32Array(T*S*M),w=new Float32Array(x*S*M),O=new Float32Array(v*S*M);for(let G=0;G<M;G++){let z=G%3*2/3-1,L=G>2?0:-1,D=[z,L,0,z+2/3,L,0,z+2/3,L+1,0,z,L,0,z+2/3,L+1,0,z,L+1,0];C.set(D,T*S*G),w.set(y,x*S*G);let q=[G,G,G,G,G,G];O.set(q,v*S*G)}let F=new Qs;F.setAttribute("position",new Ui(C,T)),F.setAttribute("uv",new Ui(w,x)),F.setAttribute("faceIndex",new Ui(O,v)),t.push(F),a>ka&&a--}return{lodPlanes:t,sizeLods:e,sigmas:o}}function Dg(r,t,e){let o=new Ko(r,t,e);return o.texture.mapping=_c,o.texture.name="PMREM.cubeUv",o.scissorTest=!0,o}function Ql(r,t,e,o,a){r.viewport.set(t,e,o,a),r.scissor.set(t,e,o,a)}function Qw(r,t,e){let o=new Float32Array(Ys),a=new mt(0,1,0);return new Qo({name:"SphericalGaussianBlur",defines:{n:Ys,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:\`\${r}.0\`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:o},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:a}},vertexShader:ip(),fragmentShader:\`
|
|
3462
|
+
}\`,ge={alphahash_fragment:dE,alphahash_pars_fragment:mE,alphamap_fragment:gE,alphamap_pars_fragment:yE,alphatest_fragment:vE,alphatest_pars_fragment:_E,aomap_fragment:xE,aomap_pars_fragment:EE,begin_vertex:ME,beginnormal_vertex:wE,bsdfs:SE,iridescence_fragment:bE,bumpmap_pars_fragment:TE,clipping_planes_fragment:AE,clipping_planes_pars_fragment:CE,clipping_planes_pars_vertex:PE,clipping_planes_vertex:IE,color_fragment:RE,color_pars_fragment:LE,color_pars_vertex:NE,color_vertex:OE,common:DE,cube_uv_reflection_fragment:FE,defaultnormal_vertex:UE,displacementmap_pars_vertex:BE,displacementmap_vertex:zE,emissivemap_fragment:kE,emissivemap_pars_fragment:GE,colorspace_fragment:VE,colorspace_pars_fragment:HE,envmap_fragment:WE,envmap_common_pars_fragment:qE,envmap_pars_fragment:XE,envmap_pars_vertex:YE,envmap_physical_pars_fragment:oM,envmap_vertex:$E,fog_vertex:ZE,fog_pars_vertex:JE,fog_fragment:KE,fog_pars_fragment:QE,gradientmap_pars_fragment:jE,lightmap_fragment:tM,lightmap_pars_fragment:eM,lights_lambert_fragment:nM,lights_lambert_pars_fragment:rM,lights_pars_begin:iM,lights_toon_fragment:sM,lights_toon_pars_fragment:aM,lights_phong_fragment:uM,lights_phong_pars_fragment:lM,lights_physical_fragment:cM,lights_physical_pars_fragment:fM,lights_fragment_begin:hM,lights_fragment_maps:pM,lights_fragment_end:dM,logdepthbuf_fragment:mM,logdepthbuf_pars_fragment:gM,logdepthbuf_pars_vertex:yM,logdepthbuf_vertex:vM,map_fragment:_M,map_pars_fragment:xM,map_particle_fragment:EM,map_particle_pars_fragment:MM,metalnessmap_fragment:wM,metalnessmap_pars_fragment:SM,morphcolor_vertex:bM,morphnormal_vertex:TM,morphtarget_pars_vertex:AM,morphtarget_vertex:CM,normal_fragment_begin:PM,normal_fragment_maps:IM,normal_pars_fragment:RM,normal_pars_vertex:LM,normal_vertex:NM,normalmap_pars_fragment:OM,clearcoat_normal_fragment_begin:DM,clearcoat_normal_fragment_maps:FM,clearcoat_pars_fragment:UM,iridescence_pars_fragment:BM,opaque_fragment:zM,packing:kM,premultiplied_alpha_fragment:GM,project_vertex:VM,dithering_fragment:HM,dithering_pars_fragment:WM,roughnessmap_fragment:qM,roughnessmap_pars_fragment:XM,shadowmap_pars_fragment:YM,shadowmap_pars_vertex:$M,shadowmap_vertex:ZM,shadowmask_pars_fragment:JM,skinbase_vertex:KM,skinning_pars_vertex:QM,skinning_vertex:jM,skinnormal_vertex:tw,specularmap_fragment:ew,specularmap_pars_fragment:nw,tonemapping_fragment:rw,tonemapping_pars_fragment:iw,transmission_fragment:ow,transmission_pars_fragment:sw,uv_pars_fragment:aw,uv_pars_vertex:uw,uv_vertex:lw,worldpos_vertex:cw,background_vert:fw,background_frag:hw,backgroundCube_vert:pw,backgroundCube_frag:dw,cube_vert:mw,cube_frag:gw,depth_vert:yw,depth_frag:vw,distanceRGBA_vert:_w,distanceRGBA_frag:xw,equirect_vert:Ew,equirect_frag:Mw,linedashed_vert:ww,linedashed_frag:Sw,meshbasic_vert:bw,meshbasic_frag:Tw,meshlambert_vert:Aw,meshlambert_frag:Cw,meshmatcap_vert:Pw,meshmatcap_frag:Iw,meshnormal_vert:Rw,meshnormal_frag:Lw,meshphong_vert:Nw,meshphong_frag:Ow,meshphysical_vert:Dw,meshphysical_frag:Fw,meshtoon_vert:Uw,meshtoon_frag:Bw,points_vert:zw,points_frag:kw,shadow_vert:Gw,shadow_frag:Vw,sprite_vert:Hw,sprite_frag:Ww},zt={common:{diffuse:{value:new En(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ye},alphaMap:{value:null},alphaMapTransform:{value:new ye},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ye}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ye}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ye}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ye},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ye},normalScale:{value:new fn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ye},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ye}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ye}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ye}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new En(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new En(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ye},alphaTest:{value:0},uvTransform:{value:new ye}},sprite:{diffuse:{value:new En(16777215)},opacity:{value:1},center:{value:new fn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ye},alphaMap:{value:null},alphaMapTransform:{value:new ye},alphaTest:{value:0}}},mo={basic:{uniforms:Jr([zt.common,zt.specularmap,zt.envmap,zt.aomap,zt.lightmap,zt.fog]),vertexShader:ge.meshbasic_vert,fragmentShader:ge.meshbasic_frag},lambert:{uniforms:Jr([zt.common,zt.specularmap,zt.envmap,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.fog,zt.lights,{emissive:{value:new En(0)}}]),vertexShader:ge.meshlambert_vert,fragmentShader:ge.meshlambert_frag},phong:{uniforms:Jr([zt.common,zt.specularmap,zt.envmap,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.fog,zt.lights,{emissive:{value:new En(0)},specular:{value:new En(1118481)},shininess:{value:30}}]),vertexShader:ge.meshphong_vert,fragmentShader:ge.meshphong_frag},standard:{uniforms:Jr([zt.common,zt.envmap,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.roughnessmap,zt.metalnessmap,zt.fog,zt.lights,{emissive:{value:new En(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ge.meshphysical_vert,fragmentShader:ge.meshphysical_frag},toon:{uniforms:Jr([zt.common,zt.aomap,zt.lightmap,zt.emissivemap,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.gradientmap,zt.fog,zt.lights,{emissive:{value:new En(0)}}]),vertexShader:ge.meshtoon_vert,fragmentShader:ge.meshtoon_frag},matcap:{uniforms:Jr([zt.common,zt.bumpmap,zt.normalmap,zt.displacementmap,zt.fog,{matcap:{value:null}}]),vertexShader:ge.meshmatcap_vert,fragmentShader:ge.meshmatcap_frag},points:{uniforms:Jr([zt.points,zt.fog]),vertexShader:ge.points_vert,fragmentShader:ge.points_frag},dashed:{uniforms:Jr([zt.common,zt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ge.linedashed_vert,fragmentShader:ge.linedashed_frag},depth:{uniforms:Jr([zt.common,zt.displacementmap]),vertexShader:ge.depth_vert,fragmentShader:ge.depth_frag},normal:{uniforms:Jr([zt.common,zt.bumpmap,zt.normalmap,zt.displacementmap,{opacity:{value:1}}]),vertexShader:ge.meshnormal_vert,fragmentShader:ge.meshnormal_frag},sprite:{uniforms:Jr([zt.sprite,zt.fog]),vertexShader:ge.sprite_vert,fragmentShader:ge.sprite_frag},background:{uniforms:{uvTransform:{value:new ye},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ge.background_vert,fragmentShader:ge.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ge.backgroundCube_vert,fragmentShader:ge.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ge.cube_vert,fragmentShader:ge.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ge.equirect_vert,fragmentShader:ge.equirect_frag},distanceRGBA:{uniforms:Jr([zt.common,zt.displacementmap,{referencePosition:{value:new mt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ge.distanceRGBA_vert,fragmentShader:ge.distanceRGBA_frag},shadow:{uniforms:Jr([zt.lights,zt.fog,{color:{value:new En(0)},opacity:{value:1}}]),vertexShader:ge.shadow_vert,fragmentShader:ge.shadow_frag}};mo.physical={uniforms:Jr([mo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ye},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ye},clearcoatNormalScale:{value:new fn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ye},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ye},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ye},sheen:{value:0},sheenColor:{value:new En(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ye},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ye},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ye},transmissionSamplerSize:{value:new fn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ye},attenuationDistance:{value:0},attenuationColor:{value:new En(0)},specularColor:{value:new En(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ye},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ye},anisotropyVector:{value:new fn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ye}}]),vertexShader:ge.meshphysical_vert,fragmentShader:ge.meshphysical_frag};var Kl={r:0,b:0,g:0};function qw(r,t,e,o,a,l,f){let h=new En(0),p=l===!0?0:1,d,g,_=null,y=0,M=null;function S(x,v){let C=!1,w=v.isScene===!0?v.background:null;w&&w.isTexture&&(w=(v.backgroundBlurriness>0?e:t).get(w)),w===null?T(h,p):w&&w.isColor&&(T(w,1),C=!0);let O=r.xr.getEnvironmentBlendMode();O==="additive"?o.buffers.color.setClear(0,0,0,1,f):O==="alpha-blend"&&o.buffers.color.setClear(0,0,0,0,f),(r.autoClear||C)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),w&&(w.isCubeTexture||w.mapping===_c)?(g===void 0&&(g=new go(new Hu(1,1,1),new Qo({name:"BackgroundCubeMaterial",uniforms:Za(mo.backgroundCube.uniforms),vertexShader:mo.backgroundCube.vertexShader,fragmentShader:mo.backgroundCube.fragmentShader,side:li,depthTest:!1,depthWrite:!1,fog:!1})),g.geometry.deleteAttribute("normal"),g.geometry.deleteAttribute("uv"),g.onBeforeRender=function(F,G,z){this.matrixWorld.copyPosition(z.matrixWorld)},Object.defineProperty(g.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(g)),g.material.uniforms.envMap.value=w,g.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,g.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,g.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,g.material.toneMapped=yn.getTransfer(w.colorSpace)!==An,(_!==w||y!==w.version||M!==r.toneMapping)&&(g.material.needsUpdate=!0,_=w,y=w.version,M=r.toneMapping),g.layers.enableAll(),x.unshift(g,g.geometry,g.material,0,0,null)):w&&w.isTexture&&(d===void 0&&(d=new go(new Ih(2,2),new Qo({name:"BackgroundMaterial",uniforms:Za(mo.background.uniforms),vertexShader:mo.background.vertexShader,fragmentShader:mo.background.fragmentShader,side:xs,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(d)),d.material.uniforms.t2D.value=w,d.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,d.material.toneMapped=yn.getTransfer(w.colorSpace)!==An,w.matrixAutoUpdate===!0&&w.updateMatrix(),d.material.uniforms.uvTransform.value.copy(w.matrix),(_!==w||y!==w.version||M!==r.toneMapping)&&(d.material.needsUpdate=!0,_=w,y=w.version,M=r.toneMapping),d.layers.enableAll(),x.unshift(d,d.geometry,d.material,0,0,null))}function T(x,v){x.getRGB(Kl,p0(r)),o.buffers.color.setClear(Kl.r,Kl.g,Kl.b,v,f)}return{getClearColor:function(){return h},setClearColor:function(x,v=1){h.set(x),p=v,T(h,p)},getClearAlpha:function(){return p},setClearAlpha:function(x){p=x,T(h,p)},render:S}}function Xw(r,t,e,o){let a=r.getParameter(r.MAX_VERTEX_ATTRIBS),l=o.isWebGL2?null:t.get("OES_vertex_array_object"),f=o.isWebGL2||l!==null,h={},p=x(null),d=p,g=!1;function _(X,it,vt,pt,et){let ot=!1;if(f){let V=T(pt,vt,it);d!==V&&(d=V,M(d.object)),ot=v(X,pt,vt,et),ot&&C(X,pt,vt,et)}else{let V=it.wireframe===!0;(d.geometry!==pt.id||d.program!==vt.id||d.wireframe!==V)&&(d.geometry=pt.id,d.program=vt.id,d.wireframe=V,ot=!0)}et!==null&&e.update(et,r.ELEMENT_ARRAY_BUFFER),(ot||g)&&(g=!1,L(X,it,vt,pt),et!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(et).buffer))}function y(){return o.isWebGL2?r.createVertexArray():l.createVertexArrayOES()}function M(X){return o.isWebGL2?r.bindVertexArray(X):l.bindVertexArrayOES(X)}function S(X){return o.isWebGL2?r.deleteVertexArray(X):l.deleteVertexArrayOES(X)}function T(X,it,vt){let pt=vt.wireframe===!0,et=h[X.id];et===void 0&&(et={},h[X.id]=et);let ot=et[it.id];ot===void 0&&(ot={},et[it.id]=ot);let V=ot[pt];return V===void 0&&(V=x(y()),ot[pt]=V),V}function x(X){let it=[],vt=[],pt=[];for(let et=0;et<a;et++)it[et]=0,vt[et]=0,pt[et]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:it,enabledAttributes:vt,attributeDivisors:pt,object:X,attributes:{},index:null}}function v(X,it,vt,pt){let et=d.attributes,ot=it.attributes,V=0,K=vt.getAttributes();for(let at in K)if(K[at].location>=0){let dt=et[at],Ct=ot[at];if(Ct===void 0&&(at==="instanceMatrix"&&X.instanceMatrix&&(Ct=X.instanceMatrix),at==="instanceColor"&&X.instanceColor&&(Ct=X.instanceColor)),dt===void 0||dt.attribute!==Ct||Ct&&dt.data!==Ct.data)return!0;V++}return d.attributesNum!==V||d.index!==pt}function C(X,it,vt,pt){let et={},ot=it.attributes,V=0,K=vt.getAttributes();for(let at in K)if(K[at].location>=0){let dt=ot[at];dt===void 0&&(at==="instanceMatrix"&&X.instanceMatrix&&(dt=X.instanceMatrix),at==="instanceColor"&&X.instanceColor&&(dt=X.instanceColor));let Ct={};Ct.attribute=dt,dt&&dt.data&&(Ct.data=dt.data),et[at]=Ct,V++}d.attributes=et,d.attributesNum=V,d.index=pt}function w(){let X=d.newAttributes;for(let it=0,vt=X.length;it<vt;it++)X[it]=0}function O(X){F(X,0)}function F(X,it){let vt=d.newAttributes,pt=d.enabledAttributes,et=d.attributeDivisors;vt[X]=1,pt[X]===0&&(r.enableVertexAttribArray(X),pt[X]=1),et[X]!==it&&((o.isWebGL2?r:t.get("ANGLE_instanced_arrays"))[o.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](X,it),et[X]=it)}function G(){let X=d.newAttributes,it=d.enabledAttributes;for(let vt=0,pt=it.length;vt<pt;vt++)it[vt]!==X[vt]&&(r.disableVertexAttribArray(vt),it[vt]=0)}function z(X,it,vt,pt,et,ot,V){V===!0?r.vertexAttribIPointer(X,it,vt,et,ot):r.vertexAttribPointer(X,it,vt,pt,et,ot)}function L(X,it,vt,pt){if(o.isWebGL2===!1&&(X.isInstancedMesh||pt.isInstancedBufferGeometry)&&t.get("ANGLE_instanced_arrays")===null)return;w();let et=pt.attributes,ot=vt.getAttributes(),V=it.defaultAttributeValues;for(let K in ot){let at=ot[K];if(at.location>=0){let Tt=et[K];if(Tt===void 0&&(K==="instanceMatrix"&&X.instanceMatrix&&(Tt=X.instanceMatrix),K==="instanceColor"&&X.instanceColor&&(Tt=X.instanceColor)),Tt!==void 0){let dt=Tt.normalized,Ct=Tt.itemSize,Yt=e.get(Tt);if(Yt===void 0)continue;let Wt=Yt.buffer,Nt=Yt.type,ne=Yt.bytesPerElement,Pt=o.isWebGL2===!0&&(Nt===r.INT||Nt===r.UNSIGNED_INT||Tt.gpuType===i0);if(Tt.isInterleavedBufferAttribute){let Xt=Tt.data,tt=Xt.stride,nn=Tt.offset;if(Xt.isInstancedInterleavedBuffer){for(let Gt=0;Gt<at.locationSize;Gt++)F(at.location+Gt,Xt.meshPerAttribute);X.isInstancedMesh!==!0&&pt._maxInstanceCount===void 0&&(pt._maxInstanceCount=Xt.meshPerAttribute*Xt.count)}else for(let Gt=0;Gt<at.locationSize;Gt++)O(at.location+Gt);r.bindBuffer(r.ARRAY_BUFFER,Wt);for(let Gt=0;Gt<at.locationSize;Gt++)z(at.location+Gt,Ct/at.locationSize,Nt,dt,tt*ne,(nn+Ct/at.locationSize*Gt)*ne,Pt)}else{if(Tt.isInstancedBufferAttribute){for(let Xt=0;Xt<at.locationSize;Xt++)F(at.location+Xt,Tt.meshPerAttribute);X.isInstancedMesh!==!0&&pt._maxInstanceCount===void 0&&(pt._maxInstanceCount=Tt.meshPerAttribute*Tt.count)}else for(let Xt=0;Xt<at.locationSize;Xt++)O(at.location+Xt);r.bindBuffer(r.ARRAY_BUFFER,Wt);for(let Xt=0;Xt<at.locationSize;Xt++)z(at.location+Xt,Ct/at.locationSize,Nt,dt,Ct*ne,Ct/at.locationSize*Xt*ne,Pt)}}else if(V!==void 0){let dt=V[K];if(dt!==void 0)switch(dt.length){case 2:r.vertexAttrib2fv(at.location,dt);break;case 3:r.vertexAttrib3fv(at.location,dt);break;case 4:r.vertexAttrib4fv(at.location,dt);break;default:r.vertexAttrib1fv(at.location,dt)}}}}G()}function D(){k();for(let X in h){let it=h[X];for(let vt in it){let pt=it[vt];for(let et in pt)S(pt[et].object),delete pt[et];delete it[vt]}delete h[X]}}function q(X){if(h[X.id]===void 0)return;let it=h[X.id];for(let vt in it){let pt=it[vt];for(let et in pt)S(pt[et].object),delete pt[et];delete it[vt]}delete h[X.id]}function nt(X){for(let it in h){let vt=h[it];if(vt[X.id]===void 0)continue;let pt=vt[X.id];for(let et in pt)S(pt[et].object),delete pt[et];delete vt[X.id]}}function k(){xt(),g=!0,d!==p&&(d=p,M(d.object))}function xt(){p.geometry=null,p.program=null,p.wireframe=!1}return{setup:_,reset:k,resetDefaultState:xt,dispose:D,releaseStatesOfGeometry:q,releaseStatesOfProgram:nt,initAttributes:w,enableAttribute:O,disableUnusedAttributes:G}}function Yw(r,t,e,o){let a=o.isWebGL2,l;function f(d){l=d}function h(d,g){r.drawArrays(l,d,g),e.update(g,l,1)}function p(d,g,_){if(_===0)return;let y,M;if(a)y=r,M="drawArraysInstanced";else if(y=t.get("ANGLE_instanced_arrays"),M="drawArraysInstancedANGLE",y===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}y[M](l,d,g,_),e.update(g,l,_)}this.setMode=f,this.render=h,this.renderInstances=p}function $w(r,t,e){let o;function a(){if(o!==void 0)return o;if(t.has("EXT_texture_filter_anisotropic")===!0){let z=t.get("EXT_texture_filter_anisotropic");o=r.getParameter(z.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else o=0;return o}function l(z){if(z==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";z="mediump"}return z==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=typeof WebGL2RenderingContext!="undefined"&&r.constructor.name==="WebGL2RenderingContext",h=e.precision!==void 0?e.precision:"highp",p=l(h);p!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",p,"instead."),h=p);let d=f||t.has("WEBGL_draw_buffers"),g=e.logarithmicDepthBuffer===!0,_=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),y=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=r.getParameter(r.MAX_TEXTURE_SIZE),S=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),T=r.getParameter(r.MAX_VERTEX_ATTRIBS),x=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),v=r.getParameter(r.MAX_VARYING_VECTORS),C=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),w=y>0,O=f||t.has("OES_texture_float"),F=w&&O,G=f?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:f,drawBuffers:d,getMaxAnisotropy:a,getMaxPrecision:l,precision:h,logarithmicDepthBuffer:g,maxTextures:_,maxVertexTextures:y,maxTextureSize:M,maxCubemapSize:S,maxAttributes:T,maxVertexUniforms:x,maxVaryings:v,maxFragmentUniforms:C,vertexTextures:w,floatFragmentTextures:O,floatVertexTextures:F,maxSamples:G}}function Zw(r){let t=this,e=null,o=0,a=!1,l=!1,f=new Xo,h=new ye,p={value:null,needsUpdate:!1};this.uniform=p,this.numPlanes=0,this.numIntersection=0,this.init=function(_,y){let M=_.length!==0||y||o!==0||a;return a=y,o=_.length,M},this.beginShadows=function(){l=!0,g(null)},this.endShadows=function(){l=!1},this.setGlobalState=function(_,y){e=g(_,y,0)},this.setState=function(_,y,M){let S=_.clippingPlanes,T=_.clipIntersection,x=_.clipShadows,v=r.get(_);if(!a||S===null||S.length===0||l&&!x)l?g(null):d();else{let C=l?0:o,w=C*4,O=v.clippingState||null;p.value=O,O=g(S,y,w,M);for(let F=0;F!==w;++F)O[F]=e[F];v.clippingState=O,this.numIntersection=T?this.numPlanes:0,this.numPlanes+=C}};function d(){p.value!==e&&(p.value=e,p.needsUpdate=o>0),t.numPlanes=o,t.numIntersection=0}function g(_,y,M,S){let T=_!==null?_.length:0,x=null;if(T!==0){if(x=p.value,S!==!0||x===null){let v=M+T*4,C=y.matrixWorldInverse;h.getNormalMatrix(C),(x===null||x.length<v)&&(x=new Float32Array(v));for(let w=0,O=M;w!==T;++w,O+=4)f.copy(_[w]).applyMatrix4(C,h),f.normal.toArray(x,O),x[O+3]=f.constant}p.value=x,p.needsUpdate=!0}return t.numPlanes=T,t.numIntersection=0,x}}function Jw(r){let t=new WeakMap;function e(f,h){return h===vh?f.mapping=qa:h===_h&&(f.mapping=Xa),f}function o(f){if(f&&f.isTexture&&f.isRenderTargetTexture===!1){let h=f.mapping;if(h===vh||h===_h)if(t.has(f)){let p=t.get(f).texture;return e(p,f.mapping)}else{let p=f.image;if(p&&p.height>0){let d=new Ph(p.height/2);return d.fromEquirectangularTexture(r,f),t.set(f,d),f.addEventListener("dispose",a),e(d.texture,f.mapping)}else return null}}return f}function a(f){let h=f.target;h.removeEventListener("dispose",a);let p=t.get(h);p!==void 0&&(t.delete(h),p.dispose())}function l(){t=new WeakMap}return{get:o,dispose:l}}var Rh=class extends mc{constructor(t=-1,e=1,o=1,a=-1,l=.1,f=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=o,this.bottom=a,this.near=l,this.far=f,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,o,a,l,f){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=o,this.view.offsetY=a,this.view.width=l,this.view.height=f,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),o=(this.right+this.left)/2,a=(this.top+this.bottom)/2,l=o-t,f=o+t,h=a+e,p=a-e;if(this.view!==null&&this.view.enabled){let d=(this.right-this.left)/this.view.fullWidth/this.zoom,g=(this.top-this.bottom)/this.view.fullHeight/this.zoom;l+=d*this.view.offsetX,f=l+d*this.view.width,h-=g*this.view.offsetY,p=h-g*this.view.height}this.projectionMatrix.makeOrthographic(l,f,h,p,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}},ka=4,Lg=[.125,.215,.35,.446,.526,.582],Ys=20,dh=new Rh,Ng=new En,mh=null,Xs=(1+Math.sqrt(5))/2,Ua=1/Xs,Og=[new mt(1,1,1),new mt(-1,1,1),new mt(1,1,-1),new mt(-1,1,-1),new mt(0,Xs,Ua),new mt(0,Xs,-Ua),new mt(Ua,0,Xs),new mt(-Ua,0,Xs),new mt(Xs,Ua,0),new mt(-Xs,Ua,0)],vc=class{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,o=.1,a=100){mh=this._renderer.getRenderTarget(),this._setSize(256);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(t,o,a,l),e>0&&this._blur(l,0,0,e),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Ug(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Fg(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(mh),t.scissorTest=!1,Ql(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===qa||t.mapping===Xa?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),mh=this._renderer.getRenderTarget();let o=e||this._allocateTargets();return this._textureToCubeUV(t,o),this._applyPMREM(o),this._cleanup(o),o}_allocateTargets(){let t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,o={magFilter:Di,minFilter:Di,generateMipmaps:!1,type:Gu,format:to,colorSpace:Jo,depthBuffer:!1},a=Dg(t,e,o);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Dg(t,e,o);let{_lodMax:l}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Kw(l)),this._blurMaterial=Qw(l,t,e)}return a}_compileMaterial(t){let e=new go(this._lodPlanes[0],t);this._renderer.compile(e,dh)}_sceneToCubeUV(t,e,o,a){let h=new Mi(90,1,e,o),p=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],g=this._renderer,_=g.autoClear,y=g.toneMapping;g.getClearColor(Ng),g.toneMapping=vs,g.autoClear=!1;let M=new hc({name:"PMREM.Background",side:li,depthWrite:!1,depthTest:!1}),S=new go(new Hu,M),T=!1,x=t.background;x?x.isColor&&(M.color.copy(x),t.background=null,T=!0):(M.color.copy(Ng),T=!0);for(let v=0;v<6;v++){let C=v%3;C===0?(h.up.set(0,p[v],0),h.lookAt(d[v],0,0)):C===1?(h.up.set(0,0,p[v]),h.lookAt(0,d[v],0)):(h.up.set(0,p[v],0),h.lookAt(0,0,d[v]));let w=this._cubeSize;Ql(a,C*w,v>2?w:0,w,w),g.setRenderTarget(a),T&&g.render(S,h),g.render(t,h)}S.geometry.dispose(),S.material.dispose(),g.toneMapping=y,g.autoClear=_,t.background=x}_textureToCubeUV(t,e){let o=this._renderer,a=t.mapping===qa||t.mapping===Xa;a?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ug()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Fg());let l=a?this._cubemapMaterial:this._equirectMaterial,f=new go(this._lodPlanes[0],l),h=l.uniforms;h.envMap.value=t;let p=this._cubeSize;Ql(e,0,0,3*p,2*p),o.setRenderTarget(e),o.render(f,dh)}_applyPMREM(t){let e=this._renderer,o=e.autoClear;e.autoClear=!1;for(let a=1;a<this._lodPlanes.length;a++){let l=Math.sqrt(this._sigmas[a]*this._sigmas[a]-this._sigmas[a-1]*this._sigmas[a-1]),f=Og[(a-1)%Og.length];this._blur(t,a-1,a,l,f)}e.autoClear=o}_blur(t,e,o,a,l){let f=this._pingPongRenderTarget;this._halfBlur(t,f,e,o,a,"latitudinal",l),this._halfBlur(f,t,o,o,a,"longitudinal",l)}_halfBlur(t,e,o,a,l,f,h){let p=this._renderer,d=this._blurMaterial;f!=="latitudinal"&&f!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let g=3,_=new go(this._lodPlanes[a],d),y=d.uniforms,M=this._sizeLods[o]-1,S=isFinite(l)?Math.PI/(2*M):2*Math.PI/(2*Ys-1),T=l/S,x=isFinite(l)?1+Math.floor(g*T):Ys;x>Ys&&console.warn(\`sigmaRadians, \${l}, is too large and will clip, as it requested \${x} samples when the maximum is set to \${Ys}\`);let v=[],C=0;for(let z=0;z<Ys;++z){let L=z/T,D=Math.exp(-L*L/2);v.push(D),z===0?C+=D:z<x&&(C+=2*D)}for(let z=0;z<v.length;z++)v[z]=v[z]/C;y.envMap.value=t.texture,y.samples.value=x,y.weights.value=v,y.latitudinal.value=f==="latitudinal",h&&(y.poleAxis.value=h);let{_lodMax:w}=this;y.dTheta.value=S,y.mipInt.value=w-o;let O=this._sizeLods[a],F=3*O*(a>w-ka?a-w+ka:0),G=4*(this._cubeSize-O);Ql(e,F,G,3*O,2*O),p.setRenderTarget(e),p.render(_,dh)}};function Kw(r){let t=[],e=[],o=[],a=r,l=r-ka+1+Lg.length;for(let f=0;f<l;f++){let h=Math.pow(2,a);e.push(h);let p=1/h;f>r-ka?p=Lg[f-r+ka-1]:f===0&&(p=0),o.push(p);let d=1/(h-2),g=-d,_=1+d,y=[g,g,_,g,_,_,g,g,_,_,g,_],M=6,S=6,T=3,x=2,v=1,C=new Float32Array(T*S*M),w=new Float32Array(x*S*M),O=new Float32Array(v*S*M);for(let G=0;G<M;G++){let z=G%3*2/3-1,L=G>2?0:-1,D=[z,L,0,z+2/3,L,0,z+2/3,L+1,0,z,L,0,z+2/3,L+1,0,z,L+1,0];C.set(D,T*S*G),w.set(y,x*S*G);let q=[G,G,G,G,G,G];O.set(q,v*S*G)}let F=new Qs;F.setAttribute("position",new Ui(C,T)),F.setAttribute("uv",new Ui(w,x)),F.setAttribute("faceIndex",new Ui(O,v)),t.push(F),a>ka&&a--}return{lodPlanes:t,sizeLods:e,sigmas:o}}function Dg(r,t,e){let o=new Ko(r,t,e);return o.texture.mapping=_c,o.texture.name="PMREM.cubeUv",o.scissorTest=!0,o}function Ql(r,t,e,o,a){r.viewport.set(t,e,o,a),r.scissor.set(t,e,o,a)}function Qw(r,t,e){let o=new Float32Array(Ys),a=new mt(0,1,0);return new Qo({name:"SphericalGaussianBlur",defines:{n:Ys,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:\`\${r}.0\`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:o},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:a}},vertexShader:ip(),fragmentShader:\`
|
|
3463
3463
|
|
|
3464
3464
|
precision mediump float;
|
|
3465
3465
|
precision mediump int;
|
|
@@ -3668,7 +3668,7 @@ void main() {
|
|
|
3668
3668
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
3669
3669
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
3670
3670
|
}\`;function Ab(r,t,e){let o=new yc,a=new fn,l=new fn,f=new Ar,h=new Bh({depthPacking:Nx}),p=new zh,d={},g=e.maxTextureSize,_={[xs]:li,[li]:xs,[Yo]:Yo},y=new Qo({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new fn},radius:{value:4}},vertexShader:bb,fragmentShader:Tb}),M=y.clone();M.defines.HORIZONTAL_PASS=1;let S=new Qs;S.setAttribute("position",new Ui(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let T=new go(S,y),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=jg;let v=this.type;this.render=function(F,G,z){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||F.length===0)return;let L=r.getRenderTarget(),D=r.getActiveCubeFace(),q=r.getActiveMipmapLevel(),nt=r.state;nt.setBlending(ys),nt.buffers.color.setClear(1,1,1,1),nt.buffers.depth.setTest(!0),nt.setScissorTest(!1);let k=v!==qo&&this.type===qo,xt=v===qo&&this.type!==qo;for(let X=0,it=F.length;X<it;X++){let vt=F[X],pt=vt.shadow;if(pt===void 0){console.warn("THREE.WebGLShadowMap:",vt,"has no shadow.");continue}if(pt.autoUpdate===!1&&pt.needsUpdate===!1)continue;a.copy(pt.mapSize);let et=pt.getFrameExtents();if(a.multiply(et),l.copy(pt.mapSize),(a.x>g||a.y>g)&&(a.x>g&&(l.x=Math.floor(g/et.x),a.x=l.x*et.x,pt.mapSize.x=l.x),a.y>g&&(l.y=Math.floor(g/et.y),a.y=l.y*et.y,pt.mapSize.y=l.y)),pt.map===null||k===!0||xt===!0){let V=this.type!==qo?{minFilter:Kr,magFilter:Kr}:{};pt.map!==null&&pt.map.dispose(),pt.map=new Ko(a.x,a.y,V),pt.map.texture.name=vt.name+".shadowMap",pt.camera.updateProjectionMatrix()}r.setRenderTarget(pt.map),r.clear();let ot=pt.getViewportCount();for(let V=0;V<ot;V++){let K=pt.getViewport(V);f.set(l.x*K.x,l.y*K.y,l.x*K.z,l.y*K.w),nt.viewport(f),pt.updateMatrices(vt,V),o=pt.getFrustum(),O(G,z,pt.camera,vt,this.type)}pt.isPointLightShadow!==!0&&this.type===qo&&C(pt,z),pt.needsUpdate=!1}v=this.type,x.needsUpdate=!1,r.setRenderTarget(L,D,q)};function C(F,G){let z=t.update(T);y.defines.VSM_SAMPLES!==F.blurSamples&&(y.defines.VSM_SAMPLES=F.blurSamples,M.defines.VSM_SAMPLES=F.blurSamples,y.needsUpdate=!0,M.needsUpdate=!0),F.mapPass===null&&(F.mapPass=new Ko(a.x,a.y)),y.uniforms.shadow_pass.value=F.map.texture,y.uniforms.resolution.value=F.mapSize,y.uniforms.radius.value=F.radius,r.setRenderTarget(F.mapPass),r.clear(),r.renderBufferDirect(G,null,z,y,T,null),M.uniforms.shadow_pass.value=F.mapPass.texture,M.uniforms.resolution.value=F.mapSize,M.uniforms.radius.value=F.radius,r.setRenderTarget(F.map),r.clear(),r.renderBufferDirect(G,null,z,M,T,null)}function w(F,G,z,L){let D=null,q=z.isPointLight===!0?F.customDistanceMaterial:F.customDepthMaterial;if(q!==void 0)D=q;else if(D=z.isPointLight===!0?p:h,r.localClippingEnabled&&G.clipShadows===!0&&Array.isArray(G.clippingPlanes)&&G.clippingPlanes.length!==0||G.displacementMap&&G.displacementScale!==0||G.alphaMap&&G.alphaTest>0||G.map&&G.alphaTest>0){let nt=D.uuid,k=G.uuid,xt=d[nt];xt===void 0&&(xt={},d[nt]=xt);let X=xt[k];X===void 0&&(X=D.clone(),xt[k]=X),D=X}if(D.visible=G.visible,D.wireframe=G.wireframe,L===qo?D.side=G.shadowSide!==null?G.shadowSide:G.side:D.side=G.shadowSide!==null?G.shadowSide:_[G.side],D.alphaMap=G.alphaMap,D.alphaTest=G.alphaTest,D.map=G.map,D.clipShadows=G.clipShadows,D.clippingPlanes=G.clippingPlanes,D.clipIntersection=G.clipIntersection,D.displacementMap=G.displacementMap,D.displacementScale=G.displacementScale,D.displacementBias=G.displacementBias,D.wireframeLinewidth=G.wireframeLinewidth,D.linewidth=G.linewidth,z.isPointLight===!0&&D.isMeshDistanceMaterial===!0){let nt=r.properties.get(D);nt.light=z}return D}function O(F,G,z,L,D){if(F.visible===!1)return;if(F.layers.test(G.layers)&&(F.isMesh||F.isLine||F.isPoints)&&(F.castShadow||F.receiveShadow&&D===qo)&&(!F.frustumCulled||o.intersectsObject(F))){F.modelViewMatrix.multiplyMatrices(z.matrixWorldInverse,F.matrixWorld);let k=t.update(F),xt=F.material;if(Array.isArray(xt)){let X=k.groups;for(let it=0,vt=X.length;it<vt;it++){let pt=X[it],et=xt[pt.materialIndex];if(et&&et.visible){let ot=w(F,et,L,D);r.renderBufferDirect(z,null,k,ot,F,pt)}}}else if(xt.visible){let X=w(F,xt,L,D);r.renderBufferDirect(z,null,k,X,F,null)}}let nt=F.children;for(let k=0,xt=nt.length;k<xt;k++)O(nt[k],G,z,L,D)}}function Cb(r,t,e){let o=e.isWebGL2;function a(){let Y=!1,St=new Ar,Q=null,Ut=new Ar(0,0,0,0);return{setMask:function(Dt){Q!==Dt&&!Y&&(r.colorMask(Dt,Dt,Dt,Dt),Q=Dt)},setLocked:function(Dt){Y=Dt},setClear:function(Dt,ft,Kt,re,gn){gn===!0&&(Dt*=re,ft*=re,Kt*=re),St.set(Dt,ft,Kt,re),Ut.equals(St)===!1&&(r.clearColor(Dt,ft,Kt,re),Ut.copy(St))},reset:function(){Y=!1,Q=null,Ut.set(-1,0,0,0)}}}function l(){let Y=!1,St=null,Q=null,Ut=null;return{setTest:function(Dt){Dt?Wt(r.DEPTH_TEST):Nt(r.DEPTH_TEST)},setMask:function(Dt){St!==Dt&&!Y&&(r.depthMask(Dt),St=Dt)},setFunc:function(Dt){if(Q!==Dt){switch(Dt){case ux:r.depthFunc(r.NEVER);break;case lx:r.depthFunc(r.ALWAYS);break;case cx:r.depthFunc(r.LESS);break;case yh:r.depthFunc(r.LEQUAL);break;case fx:r.depthFunc(r.EQUAL);break;case hx:r.depthFunc(r.GEQUAL);break;case px:r.depthFunc(r.GREATER);break;case dx:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}Q=Dt}},setLocked:function(Dt){Y=Dt},setClear:function(Dt){Ut!==Dt&&(r.clearDepth(Dt),Ut=Dt)},reset:function(){Y=!1,St=null,Q=null,Ut=null}}}function f(){let Y=!1,St=null,Q=null,Ut=null,Dt=null,ft=null,Kt=null,re=null,gn=null;return{setTest:function(He){Y||(He?Wt(r.STENCIL_TEST):Nt(r.STENCIL_TEST))},setMask:function(He){St!==He&&!Y&&(r.stencilMask(He),St=He)},setFunc:function(He,Si,Kn){(Q!==He||Ut!==Si||Dt!==Kn)&&(r.stencilFunc(He,Si,Kn),Q=He,Ut=Si,Dt=Kn)},setOp:function(He,Si,Kn){(ft!==He||Kt!==Si||re!==Kn)&&(r.stencilOp(He,Si,Kn),ft=He,Kt=Si,re=Kn)},setLocked:function(He){Y=He},setClear:function(He){gn!==He&&(r.clearStencil(He),gn=He)},reset:function(){Y=!1,St=null,Q=null,Ut=null,Dt=null,ft=null,Kt=null,re=null,gn=null}}}let h=new a,p=new l,d=new f,g=new WeakMap,_=new WeakMap,y={},M={},S=new WeakMap,T=[],x=null,v=!1,C=null,w=null,O=null,F=null,G=null,z=null,L=null,D=!1,q=null,nt=null,k=null,xt=null,X=null,it=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS),vt=!1,pt=0,et=r.getParameter(r.VERSION);et.indexOf("WebGL")!==-1?(pt=parseFloat(/^WebGL (\\d)/.exec(et)[1]),vt=pt>=1):et.indexOf("OpenGL ES")!==-1&&(pt=parseFloat(/^OpenGL ES (\\d)/.exec(et)[1]),vt=pt>=2);let ot=null,V={},K=r.getParameter(r.SCISSOR_BOX),at=r.getParameter(r.VIEWPORT),Tt=new Ar().fromArray(K),dt=new Ar().fromArray(at);function Ct(Y,St,Q,Ut){let Dt=new Uint8Array(4),ft=r.createTexture();r.bindTexture(Y,ft),r.texParameteri(Y,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(Y,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Kt=0;Kt<Q;Kt++)o&&(Y===r.TEXTURE_3D||Y===r.TEXTURE_2D_ARRAY)?r.texImage3D(St,0,r.RGBA,1,1,Ut,0,r.RGBA,r.UNSIGNED_BYTE,Dt):r.texImage2D(St+Kt,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Dt);return ft}let Yt={};Yt[r.TEXTURE_2D]=Ct(r.TEXTURE_2D,r.TEXTURE_2D,1),Yt[r.TEXTURE_CUBE_MAP]=Ct(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),o&&(Yt[r.TEXTURE_2D_ARRAY]=Ct(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),Yt[r.TEXTURE_3D]=Ct(r.TEXTURE_3D,r.TEXTURE_3D,1,1)),h.setClear(0,0,0,1),p.setClear(1),d.setClear(0),Wt(r.DEPTH_TEST),p.setFunc(yh),qt(!1),J(Lm),Wt(r.CULL_FACE),Gt(ys);function Wt(Y){y[Y]!==!0&&(r.enable(Y),y[Y]=!0)}function Nt(Y){y[Y]!==!1&&(r.disable(Y),y[Y]=!1)}function ne(Y,St){return M[Y]!==St?(r.bindFramebuffer(Y,St),M[Y]=St,o&&(Y===r.DRAW_FRAMEBUFFER&&(M[r.FRAMEBUFFER]=St),Y===r.FRAMEBUFFER&&(M[r.DRAW_FRAMEBUFFER]=St)),!0):!1}function Pt(Y,St){let Q=T,Ut=!1;if(Y)if(Q=S.get(St),Q===void 0&&(Q=[],S.set(St,Q)),Y.isWebGLMultipleRenderTargets){let Dt=Y.texture;if(Q.length!==Dt.length||Q[0]!==r.COLOR_ATTACHMENT0){for(let ft=0,Kt=Dt.length;ft<Kt;ft++)Q[ft]=r.COLOR_ATTACHMENT0+ft;Q.length=Dt.length,Ut=!0}}else Q[0]!==r.COLOR_ATTACHMENT0&&(Q[0]=r.COLOR_ATTACHMENT0,Ut=!0);else Q[0]!==r.BACK&&(Q[0]=r.BACK,Ut=!0);Ut&&(e.isWebGL2?r.drawBuffers(Q):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(Q))}function Xt(Y){return x!==Y?(r.useProgram(Y),x=Y,!0):!1}let tt={[Ba]:r.FUNC_ADD,[K1]:r.FUNC_SUBTRACT,[Q1]:r.FUNC_REVERSE_SUBTRACT};if(o)tt[Fm]=r.MIN,tt[Um]=r.MAX;else{let Y=t.get("EXT_blend_minmax");Y!==null&&(tt[Fm]=Y.MIN_EXT,tt[Um]=Y.MAX_EXT)}let nn={[j1]:r.ZERO,[tx]:r.ONE,[ex]:r.SRC_COLOR,[t0]:r.SRC_ALPHA,[ax]:r.SRC_ALPHA_SATURATE,[ox]:r.DST_COLOR,[rx]:r.DST_ALPHA,[nx]:r.ONE_MINUS_SRC_COLOR,[e0]:r.ONE_MINUS_SRC_ALPHA,[sx]:r.ONE_MINUS_DST_COLOR,[ix]:r.ONE_MINUS_DST_ALPHA};function Gt(Y,St,Q,Ut,Dt,ft,Kt,re){if(Y===ys){v===!0&&(Nt(r.BLEND),v=!1);return}if(v===!1&&(Wt(r.BLEND),v=!0),Y!==J1){if(Y!==C||re!==D){if((w!==Ba||G!==Ba)&&(r.blendEquation(r.FUNC_ADD),w=Ba,G=Ba),re)switch(Y){case Va:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Nm:r.blendFunc(r.ONE,r.ONE);break;case Om:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Dm:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",Y);break}else switch(Y){case Va:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Nm:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case Om:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Dm:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",Y);break}O=null,F=null,z=null,L=null,C=Y,D=re}return}Dt=Dt||St,ft=ft||Q,Kt=Kt||Ut,(St!==w||Dt!==G)&&(r.blendEquationSeparate(tt[St],tt[Dt]),w=St,G=Dt),(Q!==O||Ut!==F||ft!==z||Kt!==L)&&(r.blendFuncSeparate(nn[Q],nn[Ut],nn[ft],nn[Kt]),O=Q,F=Ut,z=ft,L=Kt),C=Y,D=!1}function te(Y,St){Y.side===Yo?Nt(r.CULL_FACE):Wt(r.CULL_FACE);let Q=Y.side===li;St&&(Q=!Q),qt(Q),Y.blending===Va&&Y.transparent===!1?Gt(ys):Gt(Y.blending,Y.blendEquation,Y.blendSrc,Y.blendDst,Y.blendEquationAlpha,Y.blendSrcAlpha,Y.blendDstAlpha,Y.premultipliedAlpha),p.setFunc(Y.depthFunc),p.setTest(Y.depthTest),p.setMask(Y.depthWrite),h.setMask(Y.colorWrite);let Ut=Y.stencilWrite;d.setTest(Ut),Ut&&(d.setMask(Y.stencilWriteMask),d.setFunc(Y.stencilFunc,Y.stencilRef,Y.stencilFuncMask),d.setOp(Y.stencilFail,Y.stencilZFail,Y.stencilZPass)),b(Y.polygonOffset,Y.polygonOffsetFactor,Y.polygonOffsetUnits),Y.alphaToCoverage===!0?Wt(r.SAMPLE_ALPHA_TO_COVERAGE):Nt(r.SAMPLE_ALPHA_TO_COVERAGE)}function qt(Y){q!==Y&&(Y?r.frontFace(r.CW):r.frontFace(r.CCW),q=Y)}function J(Y){Y!==Y1?(Wt(r.CULL_FACE),Y!==nt&&(Y===Lm?r.cullFace(r.BACK):Y===$1?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Nt(r.CULL_FACE),nt=Y}function N(Y){Y!==k&&(vt&&r.lineWidth(Y),k=Y)}function b(Y,St,Q){Y?(Wt(r.POLYGON_OFFSET_FILL),(xt!==St||X!==Q)&&(r.polygonOffset(St,Q),xt=St,X=Q)):Nt(r.POLYGON_OFFSET_FILL)}function R(Y){Y?Wt(r.SCISSOR_TEST):Nt(r.SCISSOR_TEST)}function W(Y){Y===void 0&&(Y=r.TEXTURE0+it-1),ot!==Y&&(r.activeTexture(Y),ot=Y)}function Z(Y,St,Q){Q===void 0&&(ot===null?Q=r.TEXTURE0+it-1:Q=ot);let Ut=V[Q];Ut===void 0&&(Ut={type:void 0,texture:void 0},V[Q]=Ut),(Ut.type!==Y||Ut.texture!==St)&&(ot!==Q&&(r.activeTexture(Q),ot=Q),r.bindTexture(Y,St||Yt[Y]),Ut.type=Y,Ut.texture=St)}function I(){let Y=V[ot];Y!==void 0&&Y.type!==void 0&&(r.bindTexture(Y.type,null),Y.type=void 0,Y.texture=void 0)}function P(){try{r.compressedTexImage2D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function B(){try{r.compressedTexImage3D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function lt(){try{r.texSubImage2D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function ct(){try{r.texSubImage3D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function j(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function wt(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function _t(){try{r.texStorage2D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Mt(){try{r.texStorage3D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Lt(){try{r.texImage2D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Jt(){try{r.texImage3D.apply(r,arguments)}catch(Y){console.error("THREE.WebGLState:",Y)}}function Et(Y){Tt.equals(Y)===!1&&(r.scissor(Y.x,Y.y,Y.z,Y.w),Tt.copy(Y))}function oe(Y){dt.equals(Y)===!1&&(r.viewport(Y.x,Y.y,Y.z,Y.w),dt.copy(Y))}function Qt(Y,St){let Q=_.get(St);Q===void 0&&(Q=new WeakMap,_.set(St,Q));let Ut=Q.get(Y);Ut===void 0&&(Ut=r.getUniformBlockIndex(St,Y.name),Q.set(Y,Ut))}function Ht(Y,St){let Ut=_.get(St).get(Y);g.get(St)!==Ut&&(r.uniformBlockBinding(St,Ut,Y.__bindingPointIndex),g.set(St,Ut))}function Ot(){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),y={},ot=null,V={},M={},S=new WeakMap,T=[],x=null,v=!1,C=null,w=null,O=null,F=null,G=null,z=null,L=null,D=!1,q=null,nt=null,k=null,xt=null,X=null,Tt.set(0,0,r.canvas.width,r.canvas.height),dt.set(0,0,r.canvas.width,r.canvas.height),h.reset(),p.reset(),d.reset()}return{buffers:{color:h,depth:p,stencil:d},enable:Wt,disable:Nt,bindFramebuffer:ne,drawBuffers:Pt,useProgram:Xt,setBlending:Gt,setMaterial:te,setFlipSided:qt,setCullFace:J,setLineWidth:N,setPolygonOffset:b,setScissorTest:R,activeTexture:W,bindTexture:Z,unbindTexture:I,compressedTexImage2D:P,compressedTexImage3D:B,texImage2D:Lt,texImage3D:Jt,updateUBOMapping:Qt,uniformBlockBinding:Ht,texStorage2D:_t,texStorage3D:Mt,texSubImage2D:lt,texSubImage3D:ct,compressedTexSubImage2D:j,compressedTexSubImage3D:wt,scissor:Et,viewport:oe,reset:Ot}}function Pb(r,t,e,o,a,l,f){let h=a.isWebGL2,p=a.maxTextures,d=a.maxCubemapSize,g=a.maxTextureSize,_=a.maxSamples,y=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,M=typeof navigator=="undefined"?!1:/OculusBrowser/g.test(navigator.userAgent),S=new WeakMap,T,x=new WeakMap,v=!1;try{v=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(I){}function C(I,P){return v?new OffscreenCanvas(I,P):sc("canvas")}function w(I,P,B,lt){let ct=1;if((I.width>lt||I.height>lt)&&(ct=lt/Math.max(I.width,I.height)),ct<1||P===!0)if(typeof HTMLImageElement!="undefined"&&I instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&I instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&I instanceof ImageBitmap){let j=P?Sh:Math.floor,wt=j(ct*I.width),_t=j(ct*I.height);T===void 0&&(T=C(wt,_t));let Mt=B?C(wt,_t):T;return Mt.width=wt,Mt.height=_t,Mt.getContext("2d").drawImage(I,0,0,wt,_t),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+I.width+"x"+I.height+") to ("+wt+"x"+_t+")."),Mt}else return"data"in I&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+I.width+"x"+I.height+")."),I;return I}function O(I){return mg(I.width)&&mg(I.height)}function F(I){return h?!1:I.wrapS!==ji||I.wrapT!==ji||I.minFilter!==Kr&&I.minFilter!==Di}function G(I,P){return I.generateMipmaps&&P&&I.minFilter!==Kr&&I.minFilter!==Di}function z(I){r.generateMipmap(I)}function L(I,P,B,lt,ct=!1){if(h===!1)return P;if(I!==null){if(r[I]!==void 0)return r[I];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+I+"'")}let j=P;if(P===r.RED&&(B===r.FLOAT&&(j=r.R32F),B===r.HALF_FLOAT&&(j=r.R16F),B===r.UNSIGNED_BYTE&&(j=r.R8)),P===r.RED_INTEGER&&(B===r.UNSIGNED_BYTE&&(j=r.R8UI),B===r.UNSIGNED_SHORT&&(j=r.R16UI),B===r.UNSIGNED_INT&&(j=r.R32UI),B===r.BYTE&&(j=r.R8I),B===r.SHORT&&(j=r.R16I),B===r.INT&&(j=r.R32I)),P===r.RG&&(B===r.FLOAT&&(j=r.RG32F),B===r.HALF_FLOAT&&(j=r.RG16F),B===r.UNSIGNED_BYTE&&(j=r.RG8)),P===r.RGBA){let wt=ct?nc:yn.getTransfer(lt);B===r.FLOAT&&(j=r.RGBA32F),B===r.HALF_FLOAT&&(j=r.RGBA16F),B===r.UNSIGNED_BYTE&&(j=wt===An?r.SRGB8_ALPHA8:r.RGBA8),B===r.UNSIGNED_SHORT_4_4_4_4&&(j=r.RGBA4),B===r.UNSIGNED_SHORT_5_5_5_1&&(j=r.RGB5_A1)}return(j===r.R16F||j===r.R32F||j===r.RG16F||j===r.RG32F||j===r.RGBA16F||j===r.RGBA32F)&&t.get("EXT_color_buffer_float"),j}function D(I,P,B){return G(I,B)===!0||I.isFramebufferTexture&&I.minFilter!==Kr&&I.minFilter!==Di?Math.log2(Math.max(P.width,P.height))+1:I.mipmaps!==void 0&&I.mipmaps.length>0?I.mipmaps.length:I.isCompressedTexture&&Array.isArray(I.image)?P.mipmaps.length:1}function q(I){return I===Kr||I===Bm||I===Gf?r.NEAREST:r.LINEAR}function nt(I){let P=I.target;P.removeEventListener("dispose",nt),xt(P),P.isVideoTexture&&S.delete(P)}function k(I){let P=I.target;P.removeEventListener("dispose",k),it(P)}function xt(I){let P=o.get(I);if(P.__webglInit===void 0)return;let B=I.source,lt=x.get(B);if(lt){let ct=lt[P.__cacheKey];ct.usedTimes--,ct.usedTimes===0&&X(I),Object.keys(lt).length===0&&x.delete(B)}o.remove(I)}function X(I){let P=o.get(I);r.deleteTexture(P.__webglTexture);let B=I.source,lt=x.get(B);delete lt[P.__cacheKey],f.memory.textures--}function it(I){let P=I.texture,B=o.get(I),lt=o.get(P);if(lt.__webglTexture!==void 0&&(r.deleteTexture(lt.__webglTexture),f.memory.textures--),I.depthTexture&&I.depthTexture.dispose(),I.isWebGLCubeRenderTarget)for(let ct=0;ct<6;ct++){if(Array.isArray(B.__webglFramebuffer[ct]))for(let j=0;j<B.__webglFramebuffer[ct].length;j++)r.deleteFramebuffer(B.__webglFramebuffer[ct][j]);else r.deleteFramebuffer(B.__webglFramebuffer[ct]);B.__webglDepthbuffer&&r.deleteRenderbuffer(B.__webglDepthbuffer[ct])}else{if(Array.isArray(B.__webglFramebuffer))for(let ct=0;ct<B.__webglFramebuffer.length;ct++)r.deleteFramebuffer(B.__webglFramebuffer[ct]);else r.deleteFramebuffer(B.__webglFramebuffer);if(B.__webglDepthbuffer&&r.deleteRenderbuffer(B.__webglDepthbuffer),B.__webglMultisampledFramebuffer&&r.deleteFramebuffer(B.__webglMultisampledFramebuffer),B.__webglColorRenderbuffer)for(let ct=0;ct<B.__webglColorRenderbuffer.length;ct++)B.__webglColorRenderbuffer[ct]&&r.deleteRenderbuffer(B.__webglColorRenderbuffer[ct]);B.__webglDepthRenderbuffer&&r.deleteRenderbuffer(B.__webglDepthRenderbuffer)}if(I.isWebGLMultipleRenderTargets)for(let ct=0,j=P.length;ct<j;ct++){let wt=o.get(P[ct]);wt.__webglTexture&&(r.deleteTexture(wt.__webglTexture),f.memory.textures--),o.remove(P[ct])}o.remove(P),o.remove(I)}let vt=0;function pt(){vt=0}function et(){let I=vt;return I>=p&&console.warn("THREE.WebGLTextures: Trying to use "+I+" texture units while this GPU supports only "+p),vt+=1,I}function ot(I){let P=[];return P.push(I.wrapS),P.push(I.wrapT),P.push(I.wrapR||0),P.push(I.magFilter),P.push(I.minFilter),P.push(I.anisotropy),P.push(I.internalFormat),P.push(I.format),P.push(I.type),P.push(I.generateMipmaps),P.push(I.premultiplyAlpha),P.push(I.flipY),P.push(I.unpackAlignment),P.push(I.colorSpace),P.join()}function V(I,P){let B=o.get(I);if(I.isVideoTexture&&W(I),I.isRenderTargetTexture===!1&&I.version>0&&B.__version!==I.version){let lt=I.image;if(lt===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(lt.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ne(B,I,P);return}}e.bindTexture(r.TEXTURE_2D,B.__webglTexture,r.TEXTURE0+P)}function K(I,P){let B=o.get(I);if(I.version>0&&B.__version!==I.version){ne(B,I,P);return}e.bindTexture(r.TEXTURE_2D_ARRAY,B.__webglTexture,r.TEXTURE0+P)}function at(I,P){let B=o.get(I);if(I.version>0&&B.__version!==I.version){ne(B,I,P);return}e.bindTexture(r.TEXTURE_3D,B.__webglTexture,r.TEXTURE0+P)}function Tt(I,P){let B=o.get(I);if(I.version>0&&B.__version!==I.version){Pt(B,I,P);return}e.bindTexture(r.TEXTURE_CUBE_MAP,B.__webglTexture,r.TEXTURE0+P)}let dt={[xh]:r.REPEAT,[ji]:r.CLAMP_TO_EDGE,[Eh]:r.MIRRORED_REPEAT},Ct={[Kr]:r.NEAREST,[Bm]:r.NEAREST_MIPMAP_NEAREST,[Gf]:r.NEAREST_MIPMAP_LINEAR,[Di]:r.LINEAR,[Mx]:r.LINEAR_MIPMAP_NEAREST,[ku]:r.LINEAR_MIPMAP_LINEAR},Yt={[Ux]:r.NEVER,[Wx]:r.ALWAYS,[Bx]:r.LESS,[kx]:r.LEQUAL,[zx]:r.EQUAL,[Hx]:r.GEQUAL,[Gx]:r.GREATER,[Vx]:r.NOTEQUAL};function Wt(I,P,B){if(B?(r.texParameteri(I,r.TEXTURE_WRAP_S,dt[P.wrapS]),r.texParameteri(I,r.TEXTURE_WRAP_T,dt[P.wrapT]),(I===r.TEXTURE_3D||I===r.TEXTURE_2D_ARRAY)&&r.texParameteri(I,r.TEXTURE_WRAP_R,dt[P.wrapR]),r.texParameteri(I,r.TEXTURE_MAG_FILTER,Ct[P.magFilter]),r.texParameteri(I,r.TEXTURE_MIN_FILTER,Ct[P.minFilter])):(r.texParameteri(I,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(I,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(I===r.TEXTURE_3D||I===r.TEXTURE_2D_ARRAY)&&r.texParameteri(I,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(P.wrapS!==ji||P.wrapT!==ji)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(I,r.TEXTURE_MAG_FILTER,q(P.magFilter)),r.texParameteri(I,r.TEXTURE_MIN_FILTER,q(P.minFilter)),P.minFilter!==Kr&&P.minFilter!==Di&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),P.compareFunction&&(r.texParameteri(I,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(I,r.TEXTURE_COMPARE_FUNC,Yt[P.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){let lt=t.get("EXT_texture_filter_anisotropic");if(P.magFilter===Kr||P.minFilter!==Gf&&P.minFilter!==ku||P.type===gs&&t.has("OES_texture_float_linear")===!1||h===!1&&P.type===Gu&&t.has("OES_texture_half_float_linear")===!1)return;(P.anisotropy>1||o.get(P).__currentAnisotropy)&&(r.texParameterf(I,lt.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(P.anisotropy,a.getMaxAnisotropy())),o.get(P).__currentAnisotropy=P.anisotropy)}}function Nt(I,P){let B=!1;I.__webglInit===void 0&&(I.__webglInit=!0,P.addEventListener("dispose",nt));let lt=P.source,ct=x.get(lt);ct===void 0&&(ct={},x.set(lt,ct));let j=ot(P);if(j!==I.__cacheKey){ct[j]===void 0&&(ct[j]={texture:r.createTexture(),usedTimes:0},f.memory.textures++,B=!0),ct[j].usedTimes++;let wt=ct[I.__cacheKey];wt!==void 0&&(ct[I.__cacheKey].usedTimes--,wt.usedTimes===0&&X(P)),I.__cacheKey=j,I.__webglTexture=ct[j].texture}return B}function ne(I,P,B){let lt=r.TEXTURE_2D;(P.isDataArrayTexture||P.isCompressedArrayTexture)&&(lt=r.TEXTURE_2D_ARRAY),P.isData3DTexture&&(lt=r.TEXTURE_3D);let ct=Nt(I,P),j=P.source;e.bindTexture(lt,I.__webglTexture,r.TEXTURE0+B);let wt=o.get(j);if(j.version!==wt.__version||ct===!0){e.activeTexture(r.TEXTURE0+B);let _t=yn.getPrimaries(yn.workingColorSpace),Mt=P.colorSpace===Fi?null:yn.getPrimaries(P.colorSpace),Lt=P.colorSpace===Fi||_t===Mt?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,P.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,P.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Lt);let Jt=F(P)&&O(P.image)===!1,Et=w(P.image,Jt,!1,g);Et=Z(P,Et);let oe=O(Et)||h,Qt=l.convert(P.format,P.colorSpace),Ht=l.convert(P.type),Ot=L(P.internalFormat,Qt,Ht,P.colorSpace,P.isVideoTexture);Wt(lt,P,oe);let Y,St=P.mipmaps,Q=h&&P.isVideoTexture!==!0,Ut=wt.__version===void 0||ct===!0,Dt=D(P,Et,oe);if(P.isDepthTexture)Ot=r.DEPTH_COMPONENT,h?P.type===gs?Ot=r.DEPTH_COMPONENT32F:P.type===ms?Ot=r.DEPTH_COMPONENT24:P.type===$s?Ot=r.DEPTH24_STENCIL8:Ot=r.DEPTH_COMPONENT16:P.type===gs&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),P.format===Zs&&Ot===r.DEPTH_COMPONENT&&P.type!==np&&P.type!==ms&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),P.type=ms,Ht=l.convert(P.type)),P.format===Ya&&Ot===r.DEPTH_COMPONENT&&(Ot=r.DEPTH_STENCIL,P.type!==$s&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),P.type=$s,Ht=l.convert(P.type))),Ut&&(Q?e.texStorage2D(r.TEXTURE_2D,1,Ot,Et.width,Et.height):e.texImage2D(r.TEXTURE_2D,0,Ot,Et.width,Et.height,0,Qt,Ht,null));else if(P.isDataTexture)if(St.length>0&&oe){Q&&Ut&&e.texStorage2D(r.TEXTURE_2D,Dt,Ot,St[0].width,St[0].height);for(let ft=0,Kt=St.length;ft<Kt;ft++)Y=St[ft],Q?e.texSubImage2D(r.TEXTURE_2D,ft,0,0,Y.width,Y.height,Qt,Ht,Y.data):e.texImage2D(r.TEXTURE_2D,ft,Ot,Y.width,Y.height,0,Qt,Ht,Y.data);P.generateMipmaps=!1}else Q?(Ut&&e.texStorage2D(r.TEXTURE_2D,Dt,Ot,Et.width,Et.height),e.texSubImage2D(r.TEXTURE_2D,0,0,0,Et.width,Et.height,Qt,Ht,Et.data)):e.texImage2D(r.TEXTURE_2D,0,Ot,Et.width,Et.height,0,Qt,Ht,Et.data);else if(P.isCompressedTexture)if(P.isCompressedArrayTexture){Q&&Ut&&e.texStorage3D(r.TEXTURE_2D_ARRAY,Dt,Ot,St[0].width,St[0].height,Et.depth);for(let ft=0,Kt=St.length;ft<Kt;ft++)Y=St[ft],P.format!==to?Qt!==null?Q?e.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ft,0,0,0,Y.width,Y.height,Et.depth,Qt,Y.data,0,0):e.compressedTexImage3D(r.TEXTURE_2D_ARRAY,ft,Ot,Y.width,Y.height,Et.depth,0,Y.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Q?e.texSubImage3D(r.TEXTURE_2D_ARRAY,ft,0,0,0,Y.width,Y.height,Et.depth,Qt,Ht,Y.data):e.texImage3D(r.TEXTURE_2D_ARRAY,ft,Ot,Y.width,Y.height,Et.depth,0,Qt,Ht,Y.data)}else{Q&&Ut&&e.texStorage2D(r.TEXTURE_2D,Dt,Ot,St[0].width,St[0].height);for(let ft=0,Kt=St.length;ft<Kt;ft++)Y=St[ft],P.format!==to?Qt!==null?Q?e.compressedTexSubImage2D(r.TEXTURE_2D,ft,0,0,Y.width,Y.height,Qt,Y.data):e.compressedTexImage2D(r.TEXTURE_2D,ft,Ot,Y.width,Y.height,0,Y.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Q?e.texSubImage2D(r.TEXTURE_2D,ft,0,0,Y.width,Y.height,Qt,Ht,Y.data):e.texImage2D(r.TEXTURE_2D,ft,Ot,Y.width,Y.height,0,Qt,Ht,Y.data)}else if(P.isDataArrayTexture)Q?(Ut&&e.texStorage3D(r.TEXTURE_2D_ARRAY,Dt,Ot,Et.width,Et.height,Et.depth),e.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,Et.width,Et.height,Et.depth,Qt,Ht,Et.data)):e.texImage3D(r.TEXTURE_2D_ARRAY,0,Ot,Et.width,Et.height,Et.depth,0,Qt,Ht,Et.data);else if(P.isData3DTexture)Q?(Ut&&e.texStorage3D(r.TEXTURE_3D,Dt,Ot,Et.width,Et.height,Et.depth),e.texSubImage3D(r.TEXTURE_3D,0,0,0,0,Et.width,Et.height,Et.depth,Qt,Ht,Et.data)):e.texImage3D(r.TEXTURE_3D,0,Ot,Et.width,Et.height,Et.depth,0,Qt,Ht,Et.data);else if(P.isFramebufferTexture){if(Ut)if(Q)e.texStorage2D(r.TEXTURE_2D,Dt,Ot,Et.width,Et.height);else{let ft=Et.width,Kt=Et.height;for(let re=0;re<Dt;re++)e.texImage2D(r.TEXTURE_2D,re,Ot,ft,Kt,0,Qt,Ht,null),ft>>=1,Kt>>=1}}else if(St.length>0&&oe){Q&&Ut&&e.texStorage2D(r.TEXTURE_2D,Dt,Ot,St[0].width,St[0].height);for(let ft=0,Kt=St.length;ft<Kt;ft++)Y=St[ft],Q?e.texSubImage2D(r.TEXTURE_2D,ft,0,0,Qt,Ht,Y):e.texImage2D(r.TEXTURE_2D,ft,Ot,Qt,Ht,Y);P.generateMipmaps=!1}else Q?(Ut&&e.texStorage2D(r.TEXTURE_2D,Dt,Ot,Et.width,Et.height),e.texSubImage2D(r.TEXTURE_2D,0,0,0,Qt,Ht,Et)):e.texImage2D(r.TEXTURE_2D,0,Ot,Qt,Ht,Et);G(P,oe)&&z(lt),wt.__version=j.version,P.onUpdate&&P.onUpdate(P)}I.__version=P.version}function Pt(I,P,B){if(P.image.length!==6)return;let lt=Nt(I,P),ct=P.source;e.bindTexture(r.TEXTURE_CUBE_MAP,I.__webglTexture,r.TEXTURE0+B);let j=o.get(ct);if(ct.version!==j.__version||lt===!0){e.activeTexture(r.TEXTURE0+B);let wt=yn.getPrimaries(yn.workingColorSpace),_t=P.colorSpace===Fi?null:yn.getPrimaries(P.colorSpace),Mt=P.colorSpace===Fi||wt===_t?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,P.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,P.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,P.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Mt);let Lt=P.isCompressedTexture||P.image[0].isCompressedTexture,Jt=P.image[0]&&P.image[0].isDataTexture,Et=[];for(let ft=0;ft<6;ft++)!Lt&&!Jt?Et[ft]=w(P.image[ft],!1,!0,d):Et[ft]=Jt?P.image[ft].image:P.image[ft],Et[ft]=Z(P,Et[ft]);let oe=Et[0],Qt=O(oe)||h,Ht=l.convert(P.format,P.colorSpace),Ot=l.convert(P.type),Y=L(P.internalFormat,Ht,Ot,P.colorSpace),St=h&&P.isVideoTexture!==!0,Q=j.__version===void 0||lt===!0,Ut=D(P,oe,Qt);Wt(r.TEXTURE_CUBE_MAP,P,Qt);let Dt;if(Lt){St&&Q&&e.texStorage2D(r.TEXTURE_CUBE_MAP,Ut,Y,oe.width,oe.height);for(let ft=0;ft<6;ft++){Dt=Et[ft].mipmaps;for(let Kt=0;Kt<Dt.length;Kt++){let re=Dt[Kt];P.format!==to?Ht!==null?St?e.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,Kt,0,0,re.width,re.height,Ht,re.data):e.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,Kt,Y,re.width,re.height,0,re.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):St?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,Kt,0,0,re.width,re.height,Ht,Ot,re.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,Kt,Y,re.width,re.height,0,Ht,Ot,re.data)}}}else{Dt=P.mipmaps,St&&Q&&(Dt.length>0&&Ut++,e.texStorage2D(r.TEXTURE_CUBE_MAP,Ut,Y,Et[0].width,Et[0].height));for(let ft=0;ft<6;ft++)if(Jt){St?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,0,0,0,Et[ft].width,Et[ft].height,Ht,Ot,Et[ft].data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,0,Y,Et[ft].width,Et[ft].height,0,Ht,Ot,Et[ft].data);for(let Kt=0;Kt<Dt.length;Kt++){let gn=Dt[Kt].image[ft].image;St?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,Kt+1,0,0,gn.width,gn.height,Ht,Ot,gn.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,Kt+1,Y,gn.width,gn.height,0,Ht,Ot,gn.data)}}else{St?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,0,0,0,Ht,Ot,Et[ft]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,0,Y,Ht,Ot,Et[ft]);for(let Kt=0;Kt<Dt.length;Kt++){let re=Dt[Kt];St?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,Kt+1,0,0,Ht,Ot,re.image[ft]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ft,Kt+1,Y,Ht,Ot,re.image[ft])}}}G(P,Qt)&&z(r.TEXTURE_CUBE_MAP),j.__version=ct.version,P.onUpdate&&P.onUpdate(P)}I.__version=P.version}function Xt(I,P,B,lt,ct,j){let wt=l.convert(B.format,B.colorSpace),_t=l.convert(B.type),Mt=L(B.internalFormat,wt,_t,B.colorSpace);if(!o.get(P).__hasExternalTextures){let Jt=Math.max(1,P.width>>j),Et=Math.max(1,P.height>>j);ct===r.TEXTURE_3D||ct===r.TEXTURE_2D_ARRAY?e.texImage3D(ct,j,Mt,Jt,Et,P.depth,0,wt,_t,null):e.texImage2D(ct,j,Mt,Jt,Et,0,wt,_t,null)}e.bindFramebuffer(r.FRAMEBUFFER,I),R(P)?y.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,lt,ct,o.get(B).__webglTexture,0,b(P)):(ct===r.TEXTURE_2D||ct>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&ct<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,lt,ct,o.get(B).__webglTexture,j),e.bindFramebuffer(r.FRAMEBUFFER,null)}function tt(I,P,B){if(r.bindRenderbuffer(r.RENDERBUFFER,I),P.depthBuffer&&!P.stencilBuffer){let lt=h===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(B||R(P)){let ct=P.depthTexture;ct&&ct.isDepthTexture&&(ct.type===gs?lt=r.DEPTH_COMPONENT32F:ct.type===ms&&(lt=r.DEPTH_COMPONENT24));let j=b(P);R(P)?y.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,j,lt,P.width,P.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,j,lt,P.width,P.height)}else r.renderbufferStorage(r.RENDERBUFFER,lt,P.width,P.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,I)}else if(P.depthBuffer&&P.stencilBuffer){let lt=b(P);B&&R(P)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,lt,r.DEPTH24_STENCIL8,P.width,P.height):R(P)?y.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,lt,r.DEPTH24_STENCIL8,P.width,P.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,P.width,P.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,I)}else{let lt=P.isWebGLMultipleRenderTargets===!0?P.texture:[P.texture];for(let ct=0;ct<lt.length;ct++){let j=lt[ct],wt=l.convert(j.format,j.colorSpace),_t=l.convert(j.type),Mt=L(j.internalFormat,wt,_t,j.colorSpace),Lt=b(P);B&&R(P)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,Lt,Mt,P.width,P.height):R(P)?y.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Lt,Mt,P.width,P.height):r.renderbufferStorage(r.RENDERBUFFER,Mt,P.width,P.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function nn(I,P){if(P&&P.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(r.FRAMEBUFFER,I),!(P.depthTexture&&P.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!o.get(P.depthTexture).__webglTexture||P.depthTexture.image.width!==P.width||P.depthTexture.image.height!==P.height)&&(P.depthTexture.image.width=P.width,P.depthTexture.image.height=P.height,P.depthTexture.needsUpdate=!0),V(P.depthTexture,0);let lt=o.get(P.depthTexture).__webglTexture,ct=b(P);if(P.depthTexture.format===Zs)R(P)?y.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,lt,0,ct):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,lt,0);else if(P.depthTexture.format===Ya)R(P)?y.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,lt,0,ct):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,lt,0);else throw new Error("Unknown depthTexture format")}function Gt(I){let P=o.get(I),B=I.isWebGLCubeRenderTarget===!0;if(I.depthTexture&&!P.__autoAllocateDepthBuffer){if(B)throw new Error("target.depthTexture not supported in Cube render targets");nn(P.__webglFramebuffer,I)}else if(B){P.__webglDepthbuffer=[];for(let lt=0;lt<6;lt++)e.bindFramebuffer(r.FRAMEBUFFER,P.__webglFramebuffer[lt]),P.__webglDepthbuffer[lt]=r.createRenderbuffer(),tt(P.__webglDepthbuffer[lt],I,!1)}else e.bindFramebuffer(r.FRAMEBUFFER,P.__webglFramebuffer),P.__webglDepthbuffer=r.createRenderbuffer(),tt(P.__webglDepthbuffer,I,!1);e.bindFramebuffer(r.FRAMEBUFFER,null)}function te(I,P,B){let lt=o.get(I);P!==void 0&&Xt(lt.__webglFramebuffer,I,I.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),B!==void 0&&Gt(I)}function qt(I){let P=I.texture,B=o.get(I),lt=o.get(P);I.addEventListener("dispose",k),I.isWebGLMultipleRenderTargets!==!0&&(lt.__webglTexture===void 0&&(lt.__webglTexture=r.createTexture()),lt.__version=P.version,f.memory.textures++);let ct=I.isWebGLCubeRenderTarget===!0,j=I.isWebGLMultipleRenderTargets===!0,wt=O(I)||h;if(ct){B.__webglFramebuffer=[];for(let _t=0;_t<6;_t++)if(h&&P.mipmaps&&P.mipmaps.length>0){B.__webglFramebuffer[_t]=[];for(let Mt=0;Mt<P.mipmaps.length;Mt++)B.__webglFramebuffer[_t][Mt]=r.createFramebuffer()}else B.__webglFramebuffer[_t]=r.createFramebuffer()}else{if(h&&P.mipmaps&&P.mipmaps.length>0){B.__webglFramebuffer=[];for(let _t=0;_t<P.mipmaps.length;_t++)B.__webglFramebuffer[_t]=r.createFramebuffer()}else B.__webglFramebuffer=r.createFramebuffer();if(j)if(a.drawBuffers){let _t=I.texture;for(let Mt=0,Lt=_t.length;Mt<Lt;Mt++){let Jt=o.get(_t[Mt]);Jt.__webglTexture===void 0&&(Jt.__webglTexture=r.createTexture(),f.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(h&&I.samples>0&&R(I)===!1){let _t=j?P:[P];B.__webglMultisampledFramebuffer=r.createFramebuffer(),B.__webglColorRenderbuffer=[],e.bindFramebuffer(r.FRAMEBUFFER,B.__webglMultisampledFramebuffer);for(let Mt=0;Mt<_t.length;Mt++){let Lt=_t[Mt];B.__webglColorRenderbuffer[Mt]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,B.__webglColorRenderbuffer[Mt]);let Jt=l.convert(Lt.format,Lt.colorSpace),Et=l.convert(Lt.type),oe=L(Lt.internalFormat,Jt,Et,Lt.colorSpace,I.isXRRenderTarget===!0),Qt=b(I);r.renderbufferStorageMultisample(r.RENDERBUFFER,Qt,oe,I.width,I.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Mt,r.RENDERBUFFER,B.__webglColorRenderbuffer[Mt])}r.bindRenderbuffer(r.RENDERBUFFER,null),I.depthBuffer&&(B.__webglDepthRenderbuffer=r.createRenderbuffer(),tt(B.__webglDepthRenderbuffer,I,!0)),e.bindFramebuffer(r.FRAMEBUFFER,null)}}if(ct){e.bindTexture(r.TEXTURE_CUBE_MAP,lt.__webglTexture),Wt(r.TEXTURE_CUBE_MAP,P,wt);for(let _t=0;_t<6;_t++)if(h&&P.mipmaps&&P.mipmaps.length>0)for(let Mt=0;Mt<P.mipmaps.length;Mt++)Xt(B.__webglFramebuffer[_t][Mt],I,P,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+_t,Mt);else Xt(B.__webglFramebuffer[_t],I,P,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+_t,0);G(P,wt)&&z(r.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(j){let _t=I.texture;for(let Mt=0,Lt=_t.length;Mt<Lt;Mt++){let Jt=_t[Mt],Et=o.get(Jt);e.bindTexture(r.TEXTURE_2D,Et.__webglTexture),Wt(r.TEXTURE_2D,Jt,wt),Xt(B.__webglFramebuffer,I,Jt,r.COLOR_ATTACHMENT0+Mt,r.TEXTURE_2D,0),G(Jt,wt)&&z(r.TEXTURE_2D)}e.unbindTexture()}else{let _t=r.TEXTURE_2D;if((I.isWebGL3DRenderTarget||I.isWebGLArrayRenderTarget)&&(h?_t=I.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),e.bindTexture(_t,lt.__webglTexture),Wt(_t,P,wt),h&&P.mipmaps&&P.mipmaps.length>0)for(let Mt=0;Mt<P.mipmaps.length;Mt++)Xt(B.__webglFramebuffer[Mt],I,P,r.COLOR_ATTACHMENT0,_t,Mt);else Xt(B.__webglFramebuffer,I,P,r.COLOR_ATTACHMENT0,_t,0);G(P,wt)&&z(_t),e.unbindTexture()}I.depthBuffer&&Gt(I)}function J(I){let P=O(I)||h,B=I.isWebGLMultipleRenderTargets===!0?I.texture:[I.texture];for(let lt=0,ct=B.length;lt<ct;lt++){let j=B[lt];if(G(j,P)){let wt=I.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,_t=o.get(j).__webglTexture;e.bindTexture(wt,_t),z(wt),e.unbindTexture()}}}function N(I){if(h&&I.samples>0&&R(I)===!1){let P=I.isWebGLMultipleRenderTargets?I.texture:[I.texture],B=I.width,lt=I.height,ct=r.COLOR_BUFFER_BIT,j=[],wt=I.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,_t=o.get(I),Mt=I.isWebGLMultipleRenderTargets===!0;if(Mt)for(let Lt=0;Lt<P.length;Lt++)e.bindFramebuffer(r.FRAMEBUFFER,_t.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Lt,r.RENDERBUFFER,null),e.bindFramebuffer(r.FRAMEBUFFER,_t.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Lt,r.TEXTURE_2D,null,0);e.bindFramebuffer(r.READ_FRAMEBUFFER,_t.__webglMultisampledFramebuffer),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,_t.__webglFramebuffer);for(let Lt=0;Lt<P.length;Lt++){j.push(r.COLOR_ATTACHMENT0+Lt),I.depthBuffer&&j.push(wt);let Jt=_t.__ignoreDepthValues!==void 0?_t.__ignoreDepthValues:!1;if(Jt===!1&&(I.depthBuffer&&(ct|=r.DEPTH_BUFFER_BIT),I.stencilBuffer&&(ct|=r.STENCIL_BUFFER_BIT)),Mt&&r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,_t.__webglColorRenderbuffer[Lt]),Jt===!0&&(r.invalidateFramebuffer(r.READ_FRAMEBUFFER,[wt]),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[wt])),Mt){let Et=o.get(P[Lt]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,Et,0)}r.blitFramebuffer(0,0,B,lt,0,0,B,lt,ct,r.NEAREST),M&&r.invalidateFramebuffer(r.READ_FRAMEBUFFER,j)}if(e.bindFramebuffer(r.READ_FRAMEBUFFER,null),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Mt)for(let Lt=0;Lt<P.length;Lt++){e.bindFramebuffer(r.FRAMEBUFFER,_t.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Lt,r.RENDERBUFFER,_t.__webglColorRenderbuffer[Lt]);let Jt=o.get(P[Lt]).__webglTexture;e.bindFramebuffer(r.FRAMEBUFFER,_t.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Lt,r.TEXTURE_2D,Jt,0)}e.bindFramebuffer(r.DRAW_FRAMEBUFFER,_t.__webglMultisampledFramebuffer)}}function b(I){return Math.min(_,I.samples)}function R(I){let P=o.get(I);return h&&I.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&P.__useRenderToTexture!==!1}function W(I){let P=f.render.frame;S.get(I)!==P&&(S.set(I,P),I.update())}function Z(I,P){let B=I.colorSpace,lt=I.format,ct=I.type;return I.isCompressedTexture===!0||I.isVideoTexture===!0||I.format===Mh||B!==Jo&&B!==Fi&&(yn.getTransfer(B)===An?h===!1?t.has("EXT_sRGB")===!0&<===to?(I.format=Mh,I.minFilter=Di,I.generateMipmaps=!1):P=ac.sRGBToLinear(P):(lt!==to||ct!==_s)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",B)),P}this.allocateTextureUnit=et,this.resetTextureUnits=pt,this.setTexture2D=V,this.setTexture2DArray=K,this.setTexture3D=at,this.setTextureCube=Tt,this.rebindTextures=te,this.setupRenderTarget=qt,this.updateRenderTargetMipmap=J,this.updateMultisampleRenderTarget=N,this.setupDepthRenderbuffer=Gt,this.setupFrameBufferTexture=Xt,this.useMultisampledRTT=R}function Ib(r,t,e){let o=e.isWebGL2;function a(l,f=Fi){let h,p=yn.getTransfer(f);if(l===_s)return r.UNSIGNED_BYTE;if(l===o0)return r.UNSIGNED_SHORT_4_4_4_4;if(l===s0)return r.UNSIGNED_SHORT_5_5_5_1;if(l===wx)return r.BYTE;if(l===Sx)return r.SHORT;if(l===np)return r.UNSIGNED_SHORT;if(l===i0)return r.INT;if(l===ms)return r.UNSIGNED_INT;if(l===gs)return r.FLOAT;if(l===Gu)return o?r.HALF_FLOAT:(h=t.get("OES_texture_half_float"),h!==null?h.HALF_FLOAT_OES:null);if(l===bx)return r.ALPHA;if(l===to)return r.RGBA;if(l===Tx)return r.LUMINANCE;if(l===Ax)return r.LUMINANCE_ALPHA;if(l===Zs)return r.DEPTH_COMPONENT;if(l===Ya)return r.DEPTH_STENCIL;if(l===Mh)return h=t.get("EXT_sRGB"),h!==null?h.SRGB_ALPHA_EXT:null;if(l===Cx)return r.RED;if(l===a0)return r.RED_INTEGER;if(l===Px)return r.RG;if(l===u0)return r.RG_INTEGER;if(l===l0)return r.RGBA_INTEGER;if(l===Vf||l===Hf||l===Wf||l===qf)if(p===An)if(h=t.get("WEBGL_compressed_texture_s3tc_srgb"),h!==null){if(l===Vf)return h.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(l===Hf)return h.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(l===Wf)return h.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(l===qf)return h.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(h=t.get("WEBGL_compressed_texture_s3tc"),h!==null){if(l===Vf)return h.COMPRESSED_RGB_S3TC_DXT1_EXT;if(l===Hf)return h.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(l===Wf)return h.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(l===qf)return h.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(l===zm||l===km||l===Gm||l===Vm)if(h=t.get("WEBGL_compressed_texture_pvrtc"),h!==null){if(l===zm)return h.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(l===km)return h.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(l===Gm)return h.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(l===Vm)return h.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(l===Ix)return h=t.get("WEBGL_compressed_texture_etc1"),h!==null?h.COMPRESSED_RGB_ETC1_WEBGL:null;if(l===Hm||l===Wm)if(h=t.get("WEBGL_compressed_texture_etc"),h!==null){if(l===Hm)return p===An?h.COMPRESSED_SRGB8_ETC2:h.COMPRESSED_RGB8_ETC2;if(l===Wm)return p===An?h.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:h.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(l===qm||l===Xm||l===Ym||l===$m||l===Zm||l===Jm||l===Km||l===Qm||l===jm||l===tg||l===eg||l===ng||l===rg||l===ig)if(h=t.get("WEBGL_compressed_texture_astc"),h!==null){if(l===qm)return p===An?h.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:h.COMPRESSED_RGBA_ASTC_4x4_KHR;if(l===Xm)return p===An?h.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:h.COMPRESSED_RGBA_ASTC_5x4_KHR;if(l===Ym)return p===An?h.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:h.COMPRESSED_RGBA_ASTC_5x5_KHR;if(l===$m)return p===An?h.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:h.COMPRESSED_RGBA_ASTC_6x5_KHR;if(l===Zm)return p===An?h.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:h.COMPRESSED_RGBA_ASTC_6x6_KHR;if(l===Jm)return p===An?h.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:h.COMPRESSED_RGBA_ASTC_8x5_KHR;if(l===Km)return p===An?h.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:h.COMPRESSED_RGBA_ASTC_8x6_KHR;if(l===Qm)return p===An?h.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:h.COMPRESSED_RGBA_ASTC_8x8_KHR;if(l===jm)return p===An?h.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:h.COMPRESSED_RGBA_ASTC_10x5_KHR;if(l===tg)return p===An?h.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:h.COMPRESSED_RGBA_ASTC_10x6_KHR;if(l===eg)return p===An?h.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:h.COMPRESSED_RGBA_ASTC_10x8_KHR;if(l===ng)return p===An?h.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:h.COMPRESSED_RGBA_ASTC_10x10_KHR;if(l===rg)return p===An?h.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:h.COMPRESSED_RGBA_ASTC_12x10_KHR;if(l===ig)return p===An?h.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:h.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(l===Xf||l===og||l===sg)if(h=t.get("EXT_texture_compression_bptc"),h!==null){if(l===Xf)return p===An?h.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:h.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(l===og)return h.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(l===sg)return h.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(l===Rx||l===ag||l===ug||l===lg)if(h=t.get("EXT_texture_compression_rgtc"),h!==null){if(l===Xf)return h.COMPRESSED_RED_RGTC1_EXT;if(l===ag)return h.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(l===ug)return h.COMPRESSED_RED_GREEN_RGTC2_EXT;if(l===lg)return h.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return l===$s?o?r.UNSIGNED_INT_24_8:(h=t.get("WEBGL_depth_texture"),h!==null?h.UNSIGNED_INT_24_8_WEBGL:null):r[l]!==void 0?r[l]:null}return{convert:a}}var kh=class extends Mi{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}},Ga=class extends yo{constructor(){super(),this.isGroup=!0,this.type="Group"}},Rb={type:"move"},zu=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ga,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 Ga,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new mt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new mt),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ga,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new mt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new mt),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,l=null,f=null,h=this._targetRay,p=this._grip,d=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(d&&t.hand){f=!0;for(let T of t.hand.values()){let x=e.getJointPose(T,o),v=this._getHandJoint(d,T);x!==null&&(v.matrix.fromArray(x.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=x.radius),v.visible=x!==null}let g=d.joints["index-finger-tip"],_=d.joints["thumb-tip"],y=g.position.distanceTo(_.position),M=.02,S=.005;d.inputState.pinching&&y>M+S?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!d.inputState.pinching&&y<=M-S&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else p!==null&&t.gripSpace&&(l=e.getPose(t.gripSpace,o),l!==null&&(p.matrix.fromArray(l.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,l.linearVelocity?(p.hasLinearVelocity=!0,p.linearVelocity.copy(l.linearVelocity)):p.hasLinearVelocity=!1,l.angularVelocity?(p.hasAngularVelocity=!0,p.angularVelocity.copy(l.angularVelocity)):p.hasAngularVelocity=!1));h!==null&&(a=e.getPose(t.targetRaySpace,o),a===null&&l!==null&&(a=l),a!==null&&(h.matrix.fromArray(a.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,a.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(a.linearVelocity)):h.hasLinearVelocity=!1,a.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(a.angularVelocity)):h.hasAngularVelocity=!1,this.dispatchEvent(Rb)))}return h!==null&&(h.visible=a!==null),p!==null&&(p.visible=l!==null),d!==null&&(d.visible=f!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let o=new Ga;o.matrixAutoUpdate=!1,o.visible=!1,t.joints[e.jointName]=o,t.add(o)}return t.joints[e.jointName]}},Gh=class extends eo{constructor(t,e,o,a,l,f,h,p,d,g){if(g=g!==void 0?g:Zs,g!==Zs&&g!==Ya)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");o===void 0&&g===Zs&&(o=ms),o===void 0&&g===Ya&&(o=$s),super(null,a,l,f,h,p,g,o,d),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=h!==void 0?h:Kr,this.minFilter=p!==void 0?p:Kr,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}},Vh=class extends Es{constructor(t,e){super();let o=this,a=null,l=1,f=null,h="local-floor",p=1,d=null,g=null,_=null,y=null,M=null,S=null,T=e.getContextAttributes(),x=null,v=null,C=[],w=[],O=new Mi;O.layers.enable(1),O.viewport=new Ar;let F=new Mi;F.layers.enable(2),F.viewport=new Ar;let G=[O,F],z=new kh;z.layers.enable(1),z.layers.enable(2);let L=null,D=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(K){let at=C[K];return at===void 0&&(at=new zu,C[K]=at),at.getTargetRaySpace()},this.getControllerGrip=function(K){let at=C[K];return at===void 0&&(at=new zu,C[K]=at),at.getGripSpace()},this.getHand=function(K){let at=C[K];return at===void 0&&(at=new zu,C[K]=at),at.getHandSpace()};function q(K){let at=w.indexOf(K.inputSource);if(at===-1)return;let Tt=C[at];Tt!==void 0&&(Tt.update(K.inputSource,K.frame,d||f),Tt.dispatchEvent({type:K.type,data:K.inputSource}))}function nt(){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",nt),a.removeEventListener("inputsourceschange",k);for(let K=0;K<C.length;K++){let at=w[K];at!==null&&(w[K]=null,C[K].disconnect(at))}L=null,D=null,t.setRenderTarget(x),M=null,y=null,_=null,a=null,v=null,V.stop(),o.isPresenting=!1,o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(K){l=K,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(K){h=K,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||f},this.setReferenceSpace=function(K){d=K},this.getBaseLayer=function(){return y!==null?y:M},this.getBinding=function(){return _},this.getFrame=function(){return S},this.getSession=function(){return a},this.setSession=async function(K){if(a=K,a!==null){if(x=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",nt),a.addEventListener("inputsourceschange",k),T.xrCompatible!==!0&&await e.makeXRCompatible(),a.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let at={antialias:a.renderState.layers===void 0?T.antialias:!0,alpha:!0,depth:T.depth,stencil:T.stencil,framebufferScaleFactor:l};M=new XRWebGLLayer(a,e,at),a.updateRenderState({baseLayer:M}),v=new Ko(M.framebufferWidth,M.framebufferHeight,{format:to,type:_s,colorSpace:t.outputColorSpace,stencilBuffer:T.stencil})}else{let at=null,Tt=null,dt=null;T.depth&&(dt=T.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,at=T.stencil?Ya:Zs,Tt=T.stencil?$s:ms);let Ct={colorFormat:e.RGBA8,depthFormat:dt,scaleFactor:l};_=new XRWebGLBinding(a,e),y=_.createProjectionLayer(Ct),a.updateRenderState({layers:[y]}),v=new Ko(y.textureWidth,y.textureHeight,{format:to,type:_s,depthTexture:new Gh(y.textureWidth,y.textureHeight,Tt,void 0,void 0,void 0,void 0,void 0,void 0,at),stencilBuffer:T.stencil,colorSpace:t.outputColorSpace,samples:T.antialias?4:0});let Yt=t.properties.get(v);Yt.__ignoreDepthValues=y.ignoreDepthValues}v.isXRRenderTarget=!0,this.setFoveation(p),d=null,f=await a.requestReferenceSpace(h),V.setContext(a),V.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(a!==null)return a.environmentBlendMode};function k(K){for(let at=0;at<K.removed.length;at++){let Tt=K.removed[at],dt=w.indexOf(Tt);dt>=0&&(w[dt]=null,C[dt].disconnect(Tt))}for(let at=0;at<K.added.length;at++){let Tt=K.added[at],dt=w.indexOf(Tt);if(dt===-1){for(let Yt=0;Yt<C.length;Yt++)if(Yt>=w.length){w.push(Tt),dt=Yt;break}else if(w[Yt]===null){w[Yt]=Tt,dt=Yt;break}if(dt===-1)break}let Ct=C[dt];Ct&&Ct.connect(Tt)}}let xt=new mt,X=new mt;function it(K,at,Tt){xt.setFromMatrixPosition(at.matrixWorld),X.setFromMatrixPosition(Tt.matrixWorld);let dt=xt.distanceTo(X),Ct=at.projectionMatrix.elements,Yt=Tt.projectionMatrix.elements,Wt=Ct[14]/(Ct[10]-1),Nt=Ct[14]/(Ct[10]+1),ne=(Ct[9]+1)/Ct[5],Pt=(Ct[9]-1)/Ct[5],Xt=(Ct[8]-1)/Ct[0],tt=(Yt[8]+1)/Yt[0],nn=Wt*Xt,Gt=Wt*tt,te=dt/(-Xt+tt),qt=te*-Xt;at.matrixWorld.decompose(K.position,K.quaternion,K.scale),K.translateX(qt),K.translateZ(te),K.matrixWorld.compose(K.position,K.quaternion,K.scale),K.matrixWorldInverse.copy(K.matrixWorld).invert();let J=Wt+te,N=Nt+te,b=nn-qt,R=Gt+(dt-qt),W=ne*Nt/N*J,Z=Pt*Nt/N*J;K.projectionMatrix.makePerspective(b,R,W,Z,J,N),K.projectionMatrixInverse.copy(K.projectionMatrix).invert()}function vt(K,at){at===null?K.matrixWorld.copy(K.matrix):K.matrixWorld.multiplyMatrices(at.matrixWorld,K.matrix),K.matrixWorldInverse.copy(K.matrixWorld).invert()}this.updateCamera=function(K){if(a===null)return;z.near=F.near=O.near=K.near,z.far=F.far=O.far=K.far,(L!==z.near||D!==z.far)&&(a.updateRenderState({depthNear:z.near,depthFar:z.far}),L=z.near,D=z.far);let at=K.parent,Tt=z.cameras;vt(z,at);for(let dt=0;dt<Tt.length;dt++)vt(Tt[dt],at);Tt.length===2?it(z,O,F):z.projectionMatrix.copy(O.projectionMatrix),pt(K,z,at)};function pt(K,at,Tt){Tt===null?K.matrix.copy(at.matrixWorld):(K.matrix.copy(Tt.matrixWorld),K.matrix.invert(),K.matrix.multiply(at.matrixWorld)),K.matrix.decompose(K.position,K.quaternion,K.scale),K.updateMatrixWorld(!0),K.projectionMatrix.copy(at.projectionMatrix),K.projectionMatrixInverse.copy(at.projectionMatrixInverse),K.isPerspectiveCamera&&(K.fov=wh*2*Math.atan(1/K.projectionMatrix.elements[5]),K.zoom=1)}this.getCamera=function(){return z},this.getFoveation=function(){if(!(y===null&&M===null))return p},this.setFoveation=function(K){p=K,y!==null&&(y.fixedFoveation=K),M!==null&&M.fixedFoveation!==void 0&&(M.fixedFoveation=K)};let et=null;function ot(K,at){if(g=at.getViewerPose(d||f),S=at,g!==null){let Tt=g.views;M!==null&&(t.setRenderTargetFramebuffer(v,M.framebuffer),t.setRenderTarget(v));let dt=!1;Tt.length!==z.cameras.length&&(z.cameras.length=0,dt=!0);for(let Ct=0;Ct<Tt.length;Ct++){let Yt=Tt[Ct],Wt=null;if(M!==null)Wt=M.getViewport(Yt);else{let ne=_.getViewSubImage(y,Yt);Wt=ne.viewport,Ct===0&&(t.setRenderTargetTextures(v,ne.colorTexture,y.ignoreDepthValues?void 0:ne.depthStencilTexture),t.setRenderTarget(v))}let Nt=G[Ct];Nt===void 0&&(Nt=new Mi,Nt.layers.enable(Ct),Nt.viewport=new Ar,G[Ct]=Nt),Nt.matrix.fromArray(Yt.transform.matrix),Nt.matrix.decompose(Nt.position,Nt.quaternion,Nt.scale),Nt.projectionMatrix.fromArray(Yt.projectionMatrix),Nt.projectionMatrixInverse.copy(Nt.projectionMatrix).invert(),Nt.viewport.set(Wt.x,Wt.y,Wt.width,Wt.height),Ct===0&&(z.matrix.copy(Nt.matrix),z.matrix.decompose(z.position,z.quaternion,z.scale)),dt===!0&&z.cameras.push(Nt)}}for(let Tt=0;Tt<C.length;Tt++){let dt=w[Tt],Ct=C[Tt];dt!==null&&Ct!==void 0&&Ct.update(dt,at,d||f)}et&&et(K,at),at.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:at}),S=null}let V=new d0;V.setAnimationLoop(ot),this.setAnimationLoop=function(K){et=K},this.dispose=function(){}}};function Lb(r,t){function e(x,v){x.matrixAutoUpdate===!0&&x.updateMatrix(),v.value.copy(x.matrix)}function o(x,v){v.color.getRGB(x.fogColor.value,p0(r)),v.isFog?(x.fogNear.value=v.near,x.fogFar.value=v.far):v.isFogExp2&&(x.fogDensity.value=v.density)}function a(x,v,C,w,O){v.isMeshBasicMaterial||v.isMeshLambertMaterial?l(x,v):v.isMeshToonMaterial?(l(x,v),_(x,v)):v.isMeshPhongMaterial?(l(x,v),g(x,v)):v.isMeshStandardMaterial?(l(x,v),y(x,v),v.isMeshPhysicalMaterial&&M(x,v,O)):v.isMeshMatcapMaterial?(l(x,v),S(x,v)):v.isMeshDepthMaterial?l(x,v):v.isMeshDistanceMaterial?(l(x,v),T(x,v)):v.isMeshNormalMaterial?l(x,v):v.isLineBasicMaterial?(f(x,v),v.isLineDashedMaterial&&h(x,v)):v.isPointsMaterial?p(x,v,C,w):v.isSpriteMaterial?d(x,v):v.isShadowMaterial?(x.color.value.copy(v.color),x.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function l(x,v){x.opacity.value=v.opacity,v.color&&x.diffuse.value.copy(v.color),v.emissive&&x.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(x.map.value=v.map,e(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,e(v.alphaMap,x.alphaMapTransform)),v.bumpMap&&(x.bumpMap.value=v.bumpMap,e(v.bumpMap,x.bumpMapTransform),x.bumpScale.value=v.bumpScale,v.side===li&&(x.bumpScale.value*=-1)),v.normalMap&&(x.normalMap.value=v.normalMap,e(v.normalMap,x.normalMapTransform),x.normalScale.value.copy(v.normalScale),v.side===li&&x.normalScale.value.negate()),v.displacementMap&&(x.displacementMap.value=v.displacementMap,e(v.displacementMap,x.displacementMapTransform),x.displacementScale.value=v.displacementScale,x.displacementBias.value=v.displacementBias),v.emissiveMap&&(x.emissiveMap.value=v.emissiveMap,e(v.emissiveMap,x.emissiveMapTransform)),v.specularMap&&(x.specularMap.value=v.specularMap,e(v.specularMap,x.specularMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest);let C=t.get(v).envMap;if(C&&(x.envMap.value=C,x.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=v.reflectivity,x.ior.value=v.ior,x.refractionRatio.value=v.refractionRatio),v.lightMap){x.lightMap.value=v.lightMap;let w=r._useLegacyLights===!0?Math.PI:1;x.lightMapIntensity.value=v.lightMapIntensity*w,e(v.lightMap,x.lightMapTransform)}v.aoMap&&(x.aoMap.value=v.aoMap,x.aoMapIntensity.value=v.aoMapIntensity,e(v.aoMap,x.aoMapTransform))}function f(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,v.map&&(x.map.value=v.map,e(v.map,x.mapTransform))}function h(x,v){x.dashSize.value=v.dashSize,x.totalSize.value=v.dashSize+v.gapSize,x.scale.value=v.scale}function p(x,v,C,w){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.size.value=v.size*C,x.scale.value=w*.5,v.map&&(x.map.value=v.map,e(v.map,x.uvTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,e(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function d(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.rotation.value=v.rotation,v.map&&(x.map.value=v.map,e(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,e(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function g(x,v){x.specular.value.copy(v.specular),x.shininess.value=Math.max(v.shininess,1e-4)}function _(x,v){v.gradientMap&&(x.gradientMap.value=v.gradientMap)}function y(x,v){x.metalness.value=v.metalness,v.metalnessMap&&(x.metalnessMap.value=v.metalnessMap,e(v.metalnessMap,x.metalnessMapTransform)),x.roughness.value=v.roughness,v.roughnessMap&&(x.roughnessMap.value=v.roughnessMap,e(v.roughnessMap,x.roughnessMapTransform)),t.get(v).envMap&&(x.envMapIntensity.value=v.envMapIntensity)}function M(x,v,C){x.ior.value=v.ior,v.sheen>0&&(x.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),x.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(x.sheenColorMap.value=v.sheenColorMap,e(v.sheenColorMap,x.sheenColorMapTransform)),v.sheenRoughnessMap&&(x.sheenRoughnessMap.value=v.sheenRoughnessMap,e(v.sheenRoughnessMap,x.sheenRoughnessMapTransform))),v.clearcoat>0&&(x.clearcoat.value=v.clearcoat,x.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(x.clearcoatMap.value=v.clearcoatMap,e(v.clearcoatMap,x.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,e(v.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(x.clearcoatNormalMap.value=v.clearcoatNormalMap,e(v.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===li&&x.clearcoatNormalScale.value.negate())),v.iridescence>0&&(x.iridescence.value=v.iridescence,x.iridescenceIOR.value=v.iridescenceIOR,x.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(x.iridescenceMap.value=v.iridescenceMap,e(v.iridescenceMap,x.iridescenceMapTransform)),v.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=v.iridescenceThicknessMap,e(v.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),v.transmission>0&&(x.transmission.value=v.transmission,x.transmissionSamplerMap.value=C.texture,x.transmissionSamplerSize.value.set(C.width,C.height),v.transmissionMap&&(x.transmissionMap.value=v.transmissionMap,e(v.transmissionMap,x.transmissionMapTransform)),x.thickness.value=v.thickness,v.thicknessMap&&(x.thicknessMap.value=v.thicknessMap,e(v.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=v.attenuationDistance,x.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(x.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(x.anisotropyMap.value=v.anisotropyMap,e(v.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=v.specularIntensity,x.specularColor.value.copy(v.specularColor),v.specularColorMap&&(x.specularColorMap.value=v.specularColorMap,e(v.specularColorMap,x.specularColorMapTransform)),v.specularIntensityMap&&(x.specularIntensityMap.value=v.specularIntensityMap,e(v.specularIntensityMap,x.specularIntensityMapTransform))}function S(x,v){v.matcap&&(x.matcap.value=v.matcap)}function T(x,v){let C=t.get(v).light;x.referencePosition.value.setFromMatrixPosition(C.matrixWorld),x.nearDistance.value=C.shadow.camera.near,x.farDistance.value=C.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:a}}function Nb(r,t,e,o){let a={},l={},f=[],h=e.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function p(C,w){let O=w.program;o.uniformBlockBinding(C,O)}function d(C,w){let O=a[C.id];O===void 0&&(S(C),O=g(C),a[C.id]=O,C.addEventListener("dispose",x));let F=w.program;o.updateUBOMapping(C,F);let G=t.render.frame;l[C.id]!==G&&(y(C),l[C.id]=G)}function g(C){let w=_();C.__bindingPointIndex=w;let O=r.createBuffer(),F=C.__size,G=C.usage;return r.bindBuffer(r.UNIFORM_BUFFER,O),r.bufferData(r.UNIFORM_BUFFER,F,G),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,w,O),O}function _(){for(let C=0;C<h;C++)if(f.indexOf(C)===-1)return f.push(C),C;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function y(C){let w=a[C.id],O=C.uniforms,F=C.__cache;r.bindBuffer(r.UNIFORM_BUFFER,w);for(let G=0,z=O.length;G<z;G++){let L=O[G];if(M(L,G,F)===!0){let D=L.__offset,q=Array.isArray(L.value)?L.value:[L.value],nt=0;for(let k=0;k<q.length;k++){let xt=q[k],X=T(xt);typeof xt=="number"?(L.__data[0]=xt,r.bufferSubData(r.UNIFORM_BUFFER,D+nt,L.__data)):xt.isMatrix3?(L.__data[0]=xt.elements[0],L.__data[1]=xt.elements[1],L.__data[2]=xt.elements[2],L.__data[3]=xt.elements[0],L.__data[4]=xt.elements[3],L.__data[5]=xt.elements[4],L.__data[6]=xt.elements[5],L.__data[7]=xt.elements[0],L.__data[8]=xt.elements[6],L.__data[9]=xt.elements[7],L.__data[10]=xt.elements[8],L.__data[11]=xt.elements[0]):(xt.toArray(L.__data,nt),nt+=X.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,D,L.__data)}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function M(C,w,O){let F=C.value;if(O[w]===void 0){if(typeof F=="number")O[w]=F;else{let G=Array.isArray(F)?F:[F],z=[];for(let L=0;L<G.length;L++)z.push(G[L].clone());O[w]=z}return!0}else if(typeof F=="number"){if(O[w]!==F)return O[w]=F,!0}else{let G=Array.isArray(O[w])?O[w]:[O[w]],z=Array.isArray(F)?F:[F];for(let L=0;L<G.length;L++){let D=G[L];if(D.equals(z[L])===!1)return D.copy(z[L]),!0}}return!1}function S(C){let w=C.uniforms,O=0,F=16,G=0;for(let z=0,L=w.length;z<L;z++){let D=w[z],q={boundary:0,storage:0},nt=Array.isArray(D.value)?D.value:[D.value];for(let k=0,xt=nt.length;k<xt;k++){let X=nt[k],it=T(X);q.boundary+=it.boundary,q.storage+=it.storage}if(D.__data=new Float32Array(q.storage/Float32Array.BYTES_PER_ELEMENT),D.__offset=O,z>0){G=O%F;let k=F-G;G!==0&&k-q.boundary<0&&(O+=F-G,D.__offset=O)}O+=q.storage}return G=O%F,G>0&&(O+=F-G),C.__size=O,C.__cache={},this}function T(C){let w={boundary:0,storage:0};return typeof C=="number"?(w.boundary=4,w.storage=4):C.isVector2?(w.boundary=8,w.storage=8):C.isVector3||C.isColor?(w.boundary=16,w.storage=12):C.isVector4?(w.boundary=16,w.storage=16):C.isMatrix3?(w.boundary=48,w.storage=48):C.isMatrix4?(w.boundary=64,w.storage=64):C.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",C),w}function x(C){let w=C.target;w.removeEventListener("dispose",x);let O=f.indexOf(w.__bindingPointIndex);f.splice(O,1),r.deleteBuffer(a[w.id]),delete a[w.id],delete l[w.id]}function v(){for(let C in a)r.deleteBuffer(a[C]);f=[],a={},l={}}return{bind:p,update:d,dispose:v}}var Hh=class{constructor(t={}){let{canvas:e=Xx(),context:o=null,depth:a=!0,stencil:l=!0,alpha:f=!1,antialias:h=!1,premultipliedAlpha:p=!0,preserveDrawingBuffer:d=!1,powerPreference:g="default",failIfMajorPerformanceCaveat:_=!1}=t;this.isWebGLRenderer=!0;let y;o!==null?y=o.getContextAttributes().alpha:y=f;let M=new Uint32Array(4),S=new Int32Array(4),T=null,x=null,v=[],C=[];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=Tr,this._useLegacyLights=!1,this.toneMapping=vs,this.toneMappingExposure=1;let w=this,O=!1,F=0,G=0,z=null,L=-1,D=null,q=new Ar,nt=new Ar,k=null,xt=new En(0),X=0,it=e.width,vt=e.height,pt=1,et=null,ot=null,V=new Ar(0,0,it,vt),K=new Ar(0,0,it,vt),at=!1,Tt=new yc,dt=!1,Ct=!1,Yt=null,Wt=new kr,Nt=new fn,ne=new mt,Pt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Xt(){return z===null?pt:1}let tt=o;function nn(H,rt){for(let gt=0;gt<H.length;gt++){let st=H[gt],yt=e.getContext(st,rt);if(yt!==null)return yt}return null}try{let H={alpha:!0,depth:a,stencil:l,antialias:h,premultipliedAlpha:p,preserveDrawingBuffer:d,powerPreference:g,failIfMajorPerformanceCaveat:_};if("setAttribute"in e&&e.setAttribute("data-engine",\`three.js r\${ep}\`),e.addEventListener("webglcontextlost",St,!1),e.addEventListener("webglcontextrestored",Q,!1),e.addEventListener("webglcontextcreationerror",Ut,!1),tt===null){let rt=["webgl2","webgl","experimental-webgl"];if(w.isWebGL1Renderer===!0&&rt.shift(),tt=nn(rt,H),tt===null)throw nn(rt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&tt instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),tt.getShaderPrecisionFormat===void 0&&(tt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(H){throw console.error("THREE.WebGLRenderer: "+H.message),H}let Gt,te,qt,J,N,b,R,W,Z,I,P,B,lt,ct,j,wt,_t,Mt,Lt,Jt,Et,oe,Qt,Ht;function Ot(){Gt=new tS(tt),te=new $w(tt,Gt,t),Gt.init(te),oe=new Ib(tt,Gt,te),qt=new Cb(tt,Gt,te),J=new rS(tt),N=new gb,b=new Pb(tt,Gt,qt,N,te,oe,J),R=new Jw(w),W=new jw(w),Z=new pE(tt,te),Qt=new Xw(tt,Gt,Z,te),I=new eS(tt,Z,J,Qt),P=new aS(tt,I,Z,J),Lt=new sS(tt,te,b),wt=new Zw(N),B=new mb(w,R,W,Gt,te,Qt,wt),lt=new Lb(w,N),ct=new vb,j=new Sb(Gt,te),Mt=new qw(w,R,W,qt,P,y,p),_t=new Ab(w,P,te),Ht=new Nb(tt,J,te,qt),Jt=new Yw(tt,Gt,J,te),Et=new nS(tt,Gt,J,te),J.programs=B.programs,w.capabilities=te,w.extensions=Gt,w.properties=N,w.renderLists=ct,w.shadowMap=_t,w.state=qt,w.info=J}Ot();let Y=new Vh(w,tt);this.xr=Y,this.getContext=function(){return tt},this.getContextAttributes=function(){return tt.getContextAttributes()},this.forceContextLoss=function(){let H=Gt.get("WEBGL_lose_context");H&&H.loseContext()},this.forceContextRestore=function(){let H=Gt.get("WEBGL_lose_context");H&&H.restoreContext()},this.getPixelRatio=function(){return pt},this.setPixelRatio=function(H){H!==void 0&&(pt=H,this.setSize(it,vt,!1))},this.getSize=function(H){return H.set(it,vt)},this.setSize=function(H,rt,gt=!0){if(Y.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}it=H,vt=rt,e.width=Math.floor(H*pt),e.height=Math.floor(rt*pt),gt===!0&&(e.style.width=H+"px",e.style.height=rt+"px"),this.setViewport(0,0,H,rt)},this.getDrawingBufferSize=function(H){return H.set(it*pt,vt*pt).floor()},this.setDrawingBufferSize=function(H,rt,gt){it=H,vt=rt,pt=gt,e.width=Math.floor(H*gt),e.height=Math.floor(rt*gt),this.setViewport(0,0,H,rt)},this.getCurrentViewport=function(H){return H.copy(q)},this.getViewport=function(H){return H.copy(V)},this.setViewport=function(H,rt,gt,st){H.isVector4?V.set(H.x,H.y,H.z,H.w):V.set(H,rt,gt,st),qt.viewport(q.copy(V).multiplyScalar(pt).floor())},this.getScissor=function(H){return H.copy(K)},this.setScissor=function(H,rt,gt,st){H.isVector4?K.set(H.x,H.y,H.z,H.w):K.set(H,rt,gt,st),qt.scissor(nt.copy(K).multiplyScalar(pt).floor())},this.getScissorTest=function(){return at},this.setScissorTest=function(H){qt.setScissorTest(at=H)},this.setOpaqueSort=function(H){et=H},this.setTransparentSort=function(H){ot=H},this.getClearColor=function(H){return H.copy(Mt.getClearColor())},this.setClearColor=function(){Mt.setClearColor.apply(Mt,arguments)},this.getClearAlpha=function(){return Mt.getClearAlpha()},this.setClearAlpha=function(){Mt.setClearAlpha.apply(Mt,arguments)},this.clear=function(H=!0,rt=!0,gt=!0){let st=0;if(H){let yt=!1;if(z!==null){let It=z.texture.format;yt=It===l0||It===u0||It===a0}if(yt){let It=z.texture.type,Bt=It===_s||It===ms||It===np||It===$s||It===o0||It===s0,se=Mt.getClearColor(),jt=Mt.getClearAlpha(),ce=se.r,Vt=se.g,fe=se.b;Bt?(M[0]=ce,M[1]=Vt,M[2]=fe,M[3]=jt,tt.clearBufferuiv(tt.COLOR,0,M)):(S[0]=ce,S[1]=Vt,S[2]=fe,S[3]=jt,tt.clearBufferiv(tt.COLOR,0,S))}else st|=tt.COLOR_BUFFER_BIT}rt&&(st|=tt.DEPTH_BUFFER_BIT),gt&&(st|=tt.STENCIL_BUFFER_BIT),tt.clear(st)},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",St,!1),e.removeEventListener("webglcontextrestored",Q,!1),e.removeEventListener("webglcontextcreationerror",Ut,!1),ct.dispose(),j.dispose(),N.dispose(),R.dispose(),W.dispose(),P.dispose(),Qt.dispose(),Ht.dispose(),B.dispose(),Y.dispose(),Y.removeEventListener("sessionstart",He),Y.removeEventListener("sessionend",Si),Yt&&(Yt.dispose(),Yt=null),Kn.stop()};function St(H){H.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),O=!0}function Q(){console.log("THREE.WebGLRenderer: Context Restored."),O=!1;let H=J.autoReset,rt=_t.enabled,gt=_t.autoUpdate,st=_t.needsUpdate,yt=_t.type;Ot(),J.autoReset=H,_t.enabled=rt,_t.autoUpdate=gt,_t.needsUpdate=st,_t.type=yt}function Ut(H){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",H.statusMessage)}function Dt(H){let rt=H.target;rt.removeEventListener("dispose",Dt),ft(rt)}function ft(H){Kt(H),N.remove(H)}function Kt(H){let rt=N.get(H).programs;rt!==void 0&&(rt.forEach(function(gt){B.releaseProgram(gt)}),H.isShaderMaterial&&B.releaseShaderCache(H))}this.renderBufferDirect=function(H,rt,gt,st,yt,It){rt===null&&(rt=Pt);let Bt=yt.isMesh&&yt.matrixWorld.determinant()<0,se=ni(H,rt,gt,st,yt);qt.setMaterial(st,Bt);let jt=gt.index,ce=1;if(st.wireframe===!0){if(jt=I.getWireframeAttribute(gt),jt===void 0)return;ce=2}let Vt=gt.drawRange,fe=gt.attributes.position,sn=Vt.start*ce,un=(Vt.start+Vt.count)*ce;It!==null&&(sn=Math.max(sn,It.start*ce),un=Math.min(un,(It.start+It.count)*ce)),jt!==null?(sn=Math.max(sn,0),un=Math.min(un,jt.count)):fe!=null&&(sn=Math.max(sn,0),un=Math.min(un,fe.count));let _n=un-sn;if(_n<0||_n===1/0)return;Qt.setup(yt,st,se,gt,jt);let ri,Mn=Jt;if(jt!==null&&(ri=Z.get(jt),Mn=Et,Mn.setIndex(ri)),yt.isMesh)st.wireframe===!0?(qt.setLineWidth(st.wireframeLinewidth*Xt()),Mn.setMode(tt.LINES)):Mn.setMode(tt.TRIANGLES);else if(yt.isLine){let de=st.linewidth;de===void 0&&(de=1),qt.setLineWidth(de*Xt()),yt.isLineSegments?Mn.setMode(tt.LINES):yt.isLineLoop?Mn.setMode(tt.LINE_LOOP):Mn.setMode(tt.LINE_STRIP)}else yt.isPoints?Mn.setMode(tt.POINTS):yt.isSprite&&Mn.setMode(tt.TRIANGLES);if(yt.isInstancedMesh)Mn.renderInstances(sn,_n,yt.count);else if(gt.isInstancedBufferGeometry){let de=gt._maxInstanceCount!==void 0?gt._maxInstanceCount:1/0,To=Math.min(gt.instanceCount,de);Mn.renderInstances(sn,_n,To)}else Mn.render(sn,_n)},this.compile=function(H,rt){function gt(st,yt,It){st.transparent===!0&&st.side===Yo&&st.forceSinglePass===!1?(st.side=li,st.needsUpdate=!0,pe(st,yt,It),st.side=xs,st.needsUpdate=!0,pe(st,yt,It),st.side=Yo):pe(st,yt,It)}x=j.get(H),x.init(),C.push(x),H.traverseVisible(function(st){st.isLight&&st.layers.test(rt.layers)&&(x.pushLight(st),st.castShadow&&x.pushShadow(st))}),x.setupLights(w._useLegacyLights),H.traverse(function(st){let yt=st.material;if(yt)if(Array.isArray(yt))for(let It=0;It<yt.length;It++){let Bt=yt[It];gt(Bt,H,st)}else gt(yt,H,st)}),C.pop(),x=null};let re=null;function gn(H){re&&re(H)}function He(){Kn.stop()}function Si(){Kn.start()}let Kn=new d0;Kn.setAnimationLoop(gn),typeof self!="undefined"&&Kn.setContext(self),this.setAnimationLoop=function(H){re=H,Y.setAnimationLoop(H),H===null?Kn.stop():Kn.start()},Y.addEventListener("sessionstart",He),Y.addEventListener("sessionend",Si),this.render=function(H,rt){if(rt!==void 0&&rt.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(O===!0)return;H.matrixWorldAutoUpdate===!0&&H.updateMatrixWorld(),rt.parent===null&&rt.matrixWorldAutoUpdate===!0&&rt.updateMatrixWorld(),Y.enabled===!0&&Y.isPresenting===!0&&(Y.cameraAutoUpdate===!0&&Y.updateCamera(rt),rt=Y.getCamera()),H.isScene===!0&&H.onBeforeRender(w,H,rt,z),x=j.get(H,C.length),x.init(),C.push(x),Wt.multiplyMatrices(rt.projectionMatrix,rt.matrixWorldInverse),Tt.setFromProjectionMatrix(Wt),Ct=this.localClippingEnabled,dt=wt.init(this.clippingPlanes,Ct),T=ct.get(H,v.length),T.init(),v.push(T),Ml(H,rt,0,w.sortObjects),T.finish(),w.sortObjects===!0&&T.sort(et,ot),this.info.render.frame++,dt===!0&&wt.beginShadows();let gt=x.state.shadowsArray;if(_t.render(gt,H,rt),dt===!0&&wt.endShadows(),this.info.autoReset===!0&&this.info.reset(),Mt.render(T,H),x.setupLights(w._useLegacyLights),rt.isArrayCamera){let st=rt.cameras;for(let yt=0,It=st.length;yt<It;yt++){let Bt=st[yt];di(T,H,Bt,Bt.viewport)}}else di(T,H,rt);z!==null&&(b.updateMultisampleRenderTarget(z),b.updateRenderTargetMipmap(z)),H.isScene===!0&&H.onAfterRender(w,H,rt),Qt.resetDefaultState(),L=-1,D=null,C.pop(),C.length>0?x=C[C.length-1]:x=null,v.pop(),v.length>0?T=v[v.length-1]:T=null};function Ml(H,rt,gt,st){if(H.visible===!1)return;if(H.layers.test(rt.layers)){if(H.isGroup)gt=H.renderOrder;else if(H.isLOD)H.autoUpdate===!0&&H.update(rt);else if(H.isLight)x.pushLight(H),H.castShadow&&x.pushShadow(H);else if(H.isSprite){if(!H.frustumCulled||Tt.intersectsSprite(H)){st&&ne.setFromMatrixPosition(H.matrixWorld).applyMatrix4(Wt);let Bt=P.update(H),se=H.material;se.visible&&T.push(H,Bt,se,gt,ne.z,null)}}else if((H.isMesh||H.isLine||H.isPoints)&&(!H.frustumCulled||Tt.intersectsObject(H))){let Bt=P.update(H),se=H.material;if(st&&(H.boundingSphere!==void 0?(H.boundingSphere===null&&H.computeBoundingSphere(),ne.copy(H.boundingSphere.center)):(Bt.boundingSphere===null&&Bt.computeBoundingSphere(),ne.copy(Bt.boundingSphere.center)),ne.applyMatrix4(H.matrixWorld).applyMatrix4(Wt)),Array.isArray(se)){let jt=Bt.groups;for(let ce=0,Vt=jt.length;ce<Vt;ce++){let fe=jt[ce],sn=se[fe.materialIndex];sn&&sn.visible&&T.push(H,Bt,sn,gt,ne.z,fe)}}else se.visible&&T.push(H,Bt,se,gt,ne.z,null)}}let It=H.children;for(let Bt=0,se=It.length;Bt<se;Bt++)Ml(It[Bt],rt,gt,st)}function di(H,rt,gt,st){let yt=H.opaque,It=H.transmissive,Bt=H.transparent;x.setupLightsView(gt),dt===!0&&wt.setGlobalState(w.clippingPlanes,gt),It.length>0&&Is(yt,It,rt,gt),st&&qt.viewport(q.copy(st)),yt.length>0&&bo(yt,rt,gt),It.length>0&&bo(It,rt,gt),Bt.length>0&&bo(Bt,rt,gt),qt.buffers.depth.setTest(!0),qt.buffers.depth.setMask(!0),qt.buffers.color.setMask(!0),qt.setPolygonOffset(!1)}function Is(H,rt,gt,st){let yt=te.isWebGL2;Yt===null&&(Yt=new Ko(1,1,{generateMipmaps:!0,type:Gt.has("EXT_color_buffer_half_float")?Gu:_s,minFilter:ku,samples:yt?4:0})),w.getDrawingBufferSize(Nt),yt?Yt.setSize(Nt.x,Nt.y):Yt.setSize(Sh(Nt.x),Sh(Nt.y));let It=w.getRenderTarget();w.setRenderTarget(Yt),w.getClearColor(xt),X=w.getClearAlpha(),X<1&&w.setClearColor(16777215,.5),w.clear();let Bt=w.toneMapping;w.toneMapping=vs,bo(H,gt,st),b.updateMultisampleRenderTarget(Yt),b.updateRenderTargetMipmap(Yt);let se=!1;for(let jt=0,ce=rt.length;jt<ce;jt++){let Vt=rt[jt],fe=Vt.object,sn=Vt.geometry,un=Vt.material,_n=Vt.group;if(un.side===Yo&&fe.layers.test(st.layers)){let ri=un.side;un.side=li,un.needsUpdate=!0,ki(fe,gt,st,sn,un,_n),un.side=ri,un.needsUpdate=!0,se=!0}}se===!0&&(b.updateMultisampleRenderTarget(Yt),b.updateRenderTargetMipmap(Yt)),w.setRenderTarget(It),w.setClearColor(xt,X),w.toneMapping=Bt}function bo(H,rt,gt){let st=rt.isScene===!0?rt.overrideMaterial:null;for(let yt=0,It=H.length;yt<It;yt++){let Bt=H[yt],se=Bt.object,jt=Bt.geometry,ce=st===null?Bt.material:st,Vt=Bt.group;se.layers.test(gt.layers)&&ki(se,rt,gt,jt,ce,Vt)}}function ki(H,rt,gt,st,yt,It){H.onBeforeRender(w,rt,gt,st,yt,It),H.modelViewMatrix.multiplyMatrices(gt.matrixWorldInverse,H.matrixWorld),H.normalMatrix.getNormalMatrix(H.modelViewMatrix),yt.onBeforeRender(w,rt,gt,st,H,It),yt.transparent===!0&&yt.side===Yo&&yt.forceSinglePass===!1?(yt.side=li,yt.needsUpdate=!0,w.renderBufferDirect(gt,rt,st,yt,H,It),yt.side=xs,yt.needsUpdate=!0,w.renderBufferDirect(gt,rt,st,yt,H,It),yt.side=Yo):w.renderBufferDirect(gt,rt,st,yt,H,It),H.onAfterRender(w,rt,gt,st,yt,It)}function pe(H,rt,gt){rt.isScene!==!0&&(rt=Pt);let st=N.get(H),yt=x.state.lights,It=x.state.shadowsArray,Bt=yt.state.version,se=B.getParameters(H,yt.state,It,rt,gt),jt=B.getProgramCacheKey(se),ce=st.programs;st.environment=H.isMeshStandardMaterial?rt.environment:null,st.fog=rt.fog,st.envMap=(H.isMeshStandardMaterial?W:R).get(H.envMap||st.environment),ce===void 0&&(H.addEventListener("dispose",Dt),ce=new Map,st.programs=ce);let Vt=ce.get(jt);if(Vt!==void 0){if(st.currentProgram===Vt&&st.lightsStateVersion===Bt)return Lr(H,se),Vt}else se.uniforms=B.getUniforms(H),H.onBuild(gt,se,w),H.onBeforeCompile(se,w),Vt=B.acquireProgram(se,jt),ce.set(jt,Vt),st.uniforms=se.uniforms;let fe=st.uniforms;(!H.isShaderMaterial&&!H.isRawShaderMaterial||H.clipping===!0)&&(fe.clippingPlanes=wt.uniform),Lr(H,se),st.needsLights=Hn(H),st.lightsStateVersion=Bt,st.needsLights&&(fe.ambientLightColor.value=yt.state.ambient,fe.lightProbe.value=yt.state.probe,fe.directionalLights.value=yt.state.directional,fe.directionalLightShadows.value=yt.state.directionalShadow,fe.spotLights.value=yt.state.spot,fe.spotLightShadows.value=yt.state.spotShadow,fe.rectAreaLights.value=yt.state.rectArea,fe.ltc_1.value=yt.state.rectAreaLTC1,fe.ltc_2.value=yt.state.rectAreaLTC2,fe.pointLights.value=yt.state.point,fe.pointLightShadows.value=yt.state.pointShadow,fe.hemisphereLights.value=yt.state.hemi,fe.directionalShadowMap.value=yt.state.directionalShadowMap,fe.directionalShadowMatrix.value=yt.state.directionalShadowMatrix,fe.spotShadowMap.value=yt.state.spotShadowMap,fe.spotLightMatrix.value=yt.state.spotLightMatrix,fe.spotLightMap.value=yt.state.spotLightMap,fe.pointShadowMap.value=yt.state.pointShadowMap,fe.pointShadowMatrix.value=yt.state.pointShadowMatrix);let sn=Vt.getUniforms(),un=Wa.seqWithValue(sn.seq,fe);return st.currentProgram=Vt,st.uniformsList=un,Vt}function Lr(H,rt){let gt=N.get(H);gt.outputColorSpace=rt.outputColorSpace,gt.instancing=rt.instancing,gt.instancingColor=rt.instancingColor,gt.skinning=rt.skinning,gt.morphTargets=rt.morphTargets,gt.morphNormals=rt.morphNormals,gt.morphColors=rt.morphColors,gt.morphTargetsCount=rt.morphTargetsCount,gt.numClippingPlanes=rt.numClippingPlanes,gt.numIntersection=rt.numClipIntersection,gt.vertexAlphas=rt.vertexAlphas,gt.vertexTangents=rt.vertexTangents,gt.toneMapping=rt.toneMapping}function ni(H,rt,gt,st,yt){rt.isScene!==!0&&(rt=Pt),b.resetTextureUnits();let It=rt.fog,Bt=st.isMeshStandardMaterial?rt.environment:null,se=z===null?w.outputColorSpace:z.isXRRenderTarget===!0?z.texture.colorSpace:Jo,jt=(st.isMeshStandardMaterial?W:R).get(st.envMap||Bt),ce=st.vertexColors===!0&&!!gt.attributes.color&>.attributes.color.itemSize===4,Vt=!!gt.attributes.tangent&&(!!st.normalMap||st.anisotropy>0),fe=!!gt.morphAttributes.position,sn=!!gt.morphAttributes.normal,un=!!gt.morphAttributes.color,_n=vs;st.toneMapped&&(z===null||z.isXRRenderTarget===!0)&&(_n=w.toneMapping);let ri=gt.morphAttributes.position||gt.morphAttributes.normal||gt.morphAttributes.color,Mn=ri!==void 0?ri.length:0,de=N.get(st),To=x.state.lights;if(dt===!0&&(Ct===!0||H!==D)){let Er=H===D&&st.id===L;wt.setState(st,H,Er)}let he=!1;st.version===de.__version?(de.needsLights&&de.lightsStateVersion!==To.state.version||de.outputColorSpace!==se||yt.isInstancedMesh&&de.instancing===!1||!yt.isInstancedMesh&&de.instancing===!0||yt.isSkinnedMesh&&de.skinning===!1||!yt.isSkinnedMesh&&de.skinning===!0||yt.isInstancedMesh&&de.instancingColor===!0&&yt.instanceColor===null||yt.isInstancedMesh&&de.instancingColor===!1&&yt.instanceColor!==null||de.envMap!==jt||st.fog===!0&&de.fog!==It||de.numClippingPlanes!==void 0&&(de.numClippingPlanes!==wt.numPlanes||de.numIntersection!==wt.numIntersection)||de.vertexAlphas!==ce||de.vertexTangents!==Vt||de.morphTargets!==fe||de.morphNormals!==sn||de.morphColors!==un||de.toneMapping!==_n||te.isWebGL2===!0&&de.morphTargetsCount!==Mn)&&(he=!0):(he=!0,de.__version=st.version);let ao=de.currentProgram;he===!0&&(ao=pe(st,rt,yt));let ii=!1,Ao=!1,ca=!1,ie=ao.getUniforms(),Gi=de.uniforms;if(qt.useProgram(ao.program)&&(ii=!0,Ao=!0,ca=!0),st.id!==L&&(L=st.id,Ao=!0),ii||D!==H){ie.setValue(tt,"projectionMatrix",H.projectionMatrix),ie.setValue(tt,"viewMatrix",H.matrixWorldInverse);let Er=ie.map.cameraPosition;Er!==void 0&&Er.setValue(tt,ne.setFromMatrixPosition(H.matrixWorld)),te.logarithmicDepthBuffer&&ie.setValue(tt,"logDepthBufFC",2/(Math.log(H.far+1)/Math.LN2)),(st.isMeshPhongMaterial||st.isMeshToonMaterial||st.isMeshLambertMaterial||st.isMeshBasicMaterial||st.isMeshStandardMaterial||st.isShaderMaterial)&&ie.setValue(tt,"isOrthographic",H.isOrthographicCamera===!0),D!==H&&(D=H,Ao=!0,ca=!0)}if(yt.isSkinnedMesh){ie.setOptional(tt,yt,"bindMatrix"),ie.setOptional(tt,yt,"bindMatrixInverse");let Er=yt.skeleton;Er&&(te.floatVertexTextures?(Er.boneTexture===null&&Er.computeBoneTexture(),ie.setValue(tt,"boneTexture",Er.boneTexture,b),ie.setValue(tt,"boneTextureSize",Er.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 Nr=gt.morphAttributes;if((Nr.position!==void 0||Nr.normal!==void 0||Nr.color!==void 0&&te.isWebGL2===!0)&&Lt.update(yt,gt,ao),(Ao||de.receiveShadow!==yt.receiveShadow)&&(de.receiveShadow=yt.receiveShadow,ie.setValue(tt,"receiveShadow",yt.receiveShadow)),st.isMeshGouraudMaterial&&st.envMap!==null&&(Gi.envMap.value=jt,Gi.flipEnvMap.value=jt.isCubeTexture&&jt.isRenderTargetTexture===!1?-1:1),Ao&&(ie.setValue(tt,"toneMappingExposure",w.toneMappingExposure),de.needsLights&&Hr(Gi,ca),It&&st.fog===!0&<.refreshFogUniforms(Gi,It),lt.refreshMaterialUniforms(Gi,st,pt,vt,Yt),Wa.upload(tt,de.uniformsList,Gi,b)),st.isShaderMaterial&&st.uniformsNeedUpdate===!0&&(Wa.upload(tt,de.uniformsList,Gi,b),st.uniformsNeedUpdate=!1),st.isSpriteMaterial&&ie.setValue(tt,"center",yt.center),ie.setValue(tt,"modelViewMatrix",yt.modelViewMatrix),ie.setValue(tt,"normalMatrix",yt.normalMatrix),ie.setValue(tt,"modelMatrix",yt.matrixWorld),st.isShaderMaterial||st.isRawShaderMaterial){let Er=st.uniformsGroups;for(let le=0,wl=Er.length;le<wl;le++)if(te.isWebGL2){let Sl=Er[le];Ht.update(Sl,ao),Ht.bind(Sl,ao)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return ao}function Hr(H,rt){H.ambientLightColor.needsUpdate=rt,H.lightProbe.needsUpdate=rt,H.directionalLights.needsUpdate=rt,H.directionalLightShadows.needsUpdate=rt,H.pointLights.needsUpdate=rt,H.pointLightShadows.needsUpdate=rt,H.spotLights.needsUpdate=rt,H.spotLightShadows.needsUpdate=rt,H.rectAreaLights.needsUpdate=rt,H.hemisphereLights.needsUpdate=rt}function Hn(H){return H.isMeshLambertMaterial||H.isMeshToonMaterial||H.isMeshPhongMaterial||H.isMeshStandardMaterial||H.isShadowMaterial||H.isShaderMaterial&&H.lights===!0}this.getActiveCubeFace=function(){return F},this.getActiveMipmapLevel=function(){return G},this.getRenderTarget=function(){return z},this.setRenderTargetTextures=function(H,rt,gt){N.get(H.texture).__webglTexture=rt,N.get(H.depthTexture).__webglTexture=gt;let st=N.get(H);st.__hasExternalTextures=!0,st.__hasExternalTextures&&(st.__autoAllocateDepthBuffer=gt===void 0,st.__autoAllocateDepthBuffer||Gt.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),st.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(H,rt){let gt=N.get(H);gt.__webglFramebuffer=rt,gt.__useDefaultFramebuffer=rt===void 0},this.setRenderTarget=function(H,rt=0,gt=0){z=H,F=rt,G=gt;let st=!0,yt=null,It=!1,Bt=!1;if(H){let jt=N.get(H);jt.__useDefaultFramebuffer!==void 0?(qt.bindFramebuffer(tt.FRAMEBUFFER,null),st=!1):jt.__webglFramebuffer===void 0?b.setupRenderTarget(H):jt.__hasExternalTextures&&b.rebindTextures(H,N.get(H.texture).__webglTexture,N.get(H.depthTexture).__webglTexture);let ce=H.texture;(ce.isData3DTexture||ce.isDataArrayTexture||ce.isCompressedArrayTexture)&&(Bt=!0);let Vt=N.get(H).__webglFramebuffer;H.isWebGLCubeRenderTarget?(Array.isArray(Vt[rt])?yt=Vt[rt][gt]:yt=Vt[rt],It=!0):te.isWebGL2&&H.samples>0&&b.useMultisampledRTT(H)===!1?yt=N.get(H).__webglMultisampledFramebuffer:Array.isArray(Vt)?yt=Vt[gt]:yt=Vt,q.copy(H.viewport),nt.copy(H.scissor),k=H.scissorTest}else q.copy(V).multiplyScalar(pt).floor(),nt.copy(K).multiplyScalar(pt).floor(),k=at;if(qt.bindFramebuffer(tt.FRAMEBUFFER,yt)&&te.drawBuffers&&st&&qt.drawBuffers(H,yt),qt.viewport(q),qt.scissor(nt),qt.setScissorTest(k),It){let jt=N.get(H.texture);tt.framebufferTexture2D(tt.FRAMEBUFFER,tt.COLOR_ATTACHMENT0,tt.TEXTURE_CUBE_MAP_POSITIVE_X+rt,jt.__webglTexture,gt)}else if(Bt){let jt=N.get(H.texture),ce=rt||0;tt.framebufferTextureLayer(tt.FRAMEBUFFER,tt.COLOR_ATTACHMENT0,jt.__webglTexture,gt||0,ce)}L=-1},this.readRenderTargetPixels=function(H,rt,gt,st,yt,It,Bt){if(!(H&&H.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let se=N.get(H).__webglFramebuffer;if(H.isWebGLCubeRenderTarget&&Bt!==void 0&&(se=se[Bt]),se){qt.bindFramebuffer(tt.FRAMEBUFFER,se);try{let jt=H.texture,ce=jt.format,Vt=jt.type;if(ce!==to&&oe.convert(ce)!==tt.getParameter(tt.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let fe=Vt===Gu&&(Gt.has("EXT_color_buffer_half_float")||te.isWebGL2&&Gt.has("EXT_color_buffer_float"));if(Vt!==_s&&oe.convert(Vt)!==tt.getParameter(tt.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Vt===gs&&(te.isWebGL2||Gt.has("OES_texture_float")||Gt.has("WEBGL_color_buffer_float")))&&!fe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}rt>=0&&rt<=H.width-st&>>=0&><=H.height-yt&&tt.readPixels(rt,gt,st,yt,oe.convert(ce),oe.convert(Vt),It)}finally{let jt=z!==null?N.get(z).__webglFramebuffer:null;qt.bindFramebuffer(tt.FRAMEBUFFER,jt)}}},this.copyFramebufferToTexture=function(H,rt,gt=0){let st=Math.pow(2,-gt),yt=Math.floor(rt.image.width*st),It=Math.floor(rt.image.height*st);b.setTexture2D(rt,0),tt.copyTexSubImage2D(tt.TEXTURE_2D,gt,0,0,H.x,H.y,yt,It),qt.unbindTexture()},this.copyTextureToTexture=function(H,rt,gt,st=0){let yt=rt.image.width,It=rt.image.height,Bt=oe.convert(gt.format),se=oe.convert(gt.type);b.setTexture2D(gt,0),tt.pixelStorei(tt.UNPACK_FLIP_Y_WEBGL,gt.flipY),tt.pixelStorei(tt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,gt.premultiplyAlpha),tt.pixelStorei(tt.UNPACK_ALIGNMENT,gt.unpackAlignment),rt.isDataTexture?tt.texSubImage2D(tt.TEXTURE_2D,st,H.x,H.y,yt,It,Bt,se,rt.image.data):rt.isCompressedTexture?tt.compressedTexSubImage2D(tt.TEXTURE_2D,st,H.x,H.y,rt.mipmaps[0].width,rt.mipmaps[0].height,Bt,rt.mipmaps[0].data):tt.texSubImage2D(tt.TEXTURE_2D,st,H.x,H.y,Bt,se,rt.image),st===0&>.generateMipmaps&&tt.generateMipmap(tt.TEXTURE_2D),qt.unbindTexture()},this.copyTextureToTexture3D=function(H,rt,gt,st,yt=0){if(w.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let It=H.max.x-H.min.x+1,Bt=H.max.y-H.min.y+1,se=H.max.z-H.min.z+1,jt=oe.convert(st.format),ce=oe.convert(st.type),Vt;if(st.isData3DTexture)b.setTexture3D(st,0),Vt=tt.TEXTURE_3D;else if(st.isDataArrayTexture)b.setTexture2DArray(st,0),Vt=tt.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}tt.pixelStorei(tt.UNPACK_FLIP_Y_WEBGL,st.flipY),tt.pixelStorei(tt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,st.premultiplyAlpha),tt.pixelStorei(tt.UNPACK_ALIGNMENT,st.unpackAlignment);let fe=tt.getParameter(tt.UNPACK_ROW_LENGTH),sn=tt.getParameter(tt.UNPACK_IMAGE_HEIGHT),un=tt.getParameter(tt.UNPACK_SKIP_PIXELS),_n=tt.getParameter(tt.UNPACK_SKIP_ROWS),ri=tt.getParameter(tt.UNPACK_SKIP_IMAGES),Mn=gt.isCompressedTexture?gt.mipmaps[0]:gt.image;tt.pixelStorei(tt.UNPACK_ROW_LENGTH,Mn.width),tt.pixelStorei(tt.UNPACK_IMAGE_HEIGHT,Mn.height),tt.pixelStorei(tt.UNPACK_SKIP_PIXELS,H.min.x),tt.pixelStorei(tt.UNPACK_SKIP_ROWS,H.min.y),tt.pixelStorei(tt.UNPACK_SKIP_IMAGES,H.min.z),gt.isDataTexture||gt.isData3DTexture?tt.texSubImage3D(Vt,yt,rt.x,rt.y,rt.z,It,Bt,se,jt,ce,Mn.data):gt.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),tt.compressedTexSubImage3D(Vt,yt,rt.x,rt.y,rt.z,It,Bt,se,jt,Mn.data)):tt.texSubImage3D(Vt,yt,rt.x,rt.y,rt.z,It,Bt,se,jt,ce,Mn),tt.pixelStorei(tt.UNPACK_ROW_LENGTH,fe),tt.pixelStorei(tt.UNPACK_IMAGE_HEIGHT,sn),tt.pixelStorei(tt.UNPACK_SKIP_PIXELS,un),tt.pixelStorei(tt.UNPACK_SKIP_ROWS,_n),tt.pixelStorei(tt.UNPACK_SKIP_IMAGES,ri),yt===0&&st.generateMipmaps&&tt.generateMipmap(Vt),qt.unbindTexture()},this.initTexture=function(H){H.isCubeTexture?b.setTextureCube(H,0):H.isData3DTexture?b.setTexture3D(H,0):H.isDataArrayTexture||H.isCompressedArrayTexture?b.setTexture2DArray(H,0):b.setTexture2D(H,0),qt.unbindTexture()},this.resetState=function(){F=0,G=0,z=null,qt.reset(),Qt.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return $o}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===rp?"display-p3":"srgb",e.unpackColorSpace=yn.workingColorSpace===xc?"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===Tr?Js:c0}set outputEncoding(t){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=t===Js?Tr:Jo}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}},Wh=class extends Hh{};Wh.prototype.isWebGL1Renderer=!0;function jl(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 Ob(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}var Ja=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],l=e[o-1];n:{t:{let f;e:{r:if(!(t<a)){for(let h=o+2;;){if(a===void 0){if(t<l)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===h)break;if(l=a,a=e[++o],t<a)break t}f=e.length;break e}if(!(t>=l)){let h=e[1];t<h&&(o=2,l=h);for(let p=o-2;;){if(l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===p)break;if(a=l,l=e[--o-1],t>=l)break t}f=o,o=0;break e}break n}for(;o<f;){let h=o+f>>>1;t<e[h]?f=h:o=h+1}if(a=e[o],l=e[o-1],l===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,l,a)}return this.interpolate_(o,l,t,a)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=t*a;for(let f=0;f!==a;++f)e[f]=o[l+f];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},qh=class extends Ja{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:cg,endingEnd:cg}}intervalChanged_(t,e,o){let a=this.parameterPositions,l=t-2,f=t+1,h=a[l],p=a[f];if(h===void 0)switch(this.getSettings_().endingStart){case fg:l=t,h=2*e-o;break;case hg:l=a.length-2,h=e+a[l]-a[l+1];break;default:l=t,h=o}if(p===void 0)switch(this.getSettings_().endingEnd){case fg:f=t,p=2*o-e;break;case hg:f=1,p=o+a[1]-a[0];break;default:f=t-1,p=e}let d=(o-e)*.5,g=this.valueSize;this._weightPrev=d/(e-h),this._weightNext=d/(p-o),this._offsetPrev=l*g,this._offsetNext=f*g}interpolate_(t,e,o,a){let l=this.resultBuffer,f=this.sampleValues,h=this.valueSize,p=t*h,d=p-h,g=this._offsetPrev,_=this._offsetNext,y=this._weightPrev,M=this._weightNext,S=(o-e)/(a-e),T=S*S,x=T*S,v=-y*x+2*y*T-y*S,C=(1+y)*x+(-1.5-2*y)*T+(-.5+y)*S+1,w=(-1-M)*x+(1.5+M)*T+.5*S,O=M*x-M*T;for(let F=0;F!==h;++F)l[F]=v*f[g+F]+C*f[d+F]+w*f[p+F]+O*f[_+F];return l}},Xh=class extends Ja{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,f=this.sampleValues,h=this.valueSize,p=t*h,d=p-h,g=(o-e)/(a-e),_=1-g;for(let y=0;y!==h;++y)l[y]=f[d+y]*_+f[p+y]*g;return l}},Yh=class extends Ja{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t){return this.copySampleValue_(t-1)}},no=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=jl(e,this.TimeBufferType),this.values=jl(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:jl(t.times,Array),values:jl(t.values,Array)};let a=t.getInterpolation();a!==t.DefaultInterpolation&&(o.interpolation=a)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new Yh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Xh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new qh(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case tc:e=this.InterpolantFactoryMethodDiscrete;break;case ec:e=this.InterpolantFactoryMethodLinear;break;case Yf: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 tc;case this.InterpolantFactoryMethodLinear:return ec;case this.InterpolantFactoryMethodSmooth:return Yf}}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,l=0,f=a-1;for(;l!==a&&o[l]<t;)++l;for(;f!==-1&&o[f]>e;)--f;if(++f,l!==0||f!==a){l>=f&&(f=Math.max(f,1),l=f-1);let h=this.getValueSize();this.times=o.slice(l,f),this.values=this.values.slice(l*h,f*h)}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,l=o.length;l===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let f=null;for(let h=0;h!==l;h++){let p=o[h];if(typeof p=="number"&&isNaN(p)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,h,p),t=!1;break}if(f!==null&&f>p){console.error("THREE.KeyframeTrack: Out of order keys.",this,h,p,f),t=!1;break}f=p}if(a!==void 0&&Ob(a))for(let h=0,p=a.length;h!==p;++h){let d=a[h];if(isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,h,d),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),a=this.getInterpolation()===Yf,l=t.length-1,f=1;for(let h=1;h<l;++h){let p=!1,d=t[h],g=t[h+1];if(d!==g&&(h!==1||d!==t[0]))if(a)p=!0;else{let _=h*o,y=_-o,M=_+o;for(let S=0;S!==o;++S){let T=e[_+S];if(T!==e[y+S]||T!==e[M+S]){p=!0;break}}}if(p){if(h!==f){t[f]=t[h];let _=h*o,y=f*o;for(let M=0;M!==o;++M)e[y+M]=e[_+M]}++f}}if(l>0){t[f]=t[l];for(let h=l*o,p=f*o,d=0;d!==o;++d)e[p+d]=e[h+d];++f}return f!==t.length?(this.times=t.slice(0,f),this.values=e.slice(0,f*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}};no.prototype.TimeBufferType=Float32Array;no.prototype.ValueBufferType=Float32Array;no.prototype.DefaultInterpolation=ec;var js=class extends no{};js.prototype.ValueTypeName="bool";js.prototype.ValueBufferType=Array;js.prototype.DefaultInterpolation=tc;js.prototype.InterpolantFactoryMethodLinear=void 0;js.prototype.InterpolantFactoryMethodSmooth=void 0;var $h=class extends no{};$h.prototype.ValueTypeName="color";var Zh=class extends no{};Zh.prototype.ValueTypeName="number";var Jh=class extends Ja{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,f=this.sampleValues,h=this.valueSize,p=(o-e)/(a-e),d=t*h;for(let g=d+h;d!==g;d+=4)Ms.slerpFlat(l,0,f,d-h,f,d,p);return l}},Wu=class extends no{InterpolantFactoryMethodLinear(t){return new Jh(this.times,this.values,this.getValueSize(),t)}};Wu.prototype.ValueTypeName="quaternion";Wu.prototype.DefaultInterpolation=ec;Wu.prototype.InterpolantFactoryMethodSmooth=void 0;var ta=class extends no{};ta.prototype.ValueTypeName="string";ta.prototype.ValueBufferType=Array;ta.prototype.DefaultInterpolation=tc;ta.prototype.InterpolantFactoryMethodLinear=void 0;ta.prototype.InterpolantFactoryMethodSmooth=void 0;var Kh=class extends no{};Kh.prototype.ValueTypeName="vector";var Qh=class{constructor(t,e,o){let a=this,l=!1,f=0,h=0,p,d=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(g){h++,l===!1&&a.onStart!==void 0&&a.onStart(g,f,h),l=!0},this.itemEnd=function(g){f++,a.onProgress!==void 0&&a.onProgress(g,f,h),f===h&&(l=!1,a.onLoad!==void 0&&a.onLoad())},this.itemError=function(g){a.onError!==void 0&&a.onError(g)},this.resolveURL=function(g){return p?p(g):g},this.setURLModifier=function(g){return p=g,this},this.addHandler=function(g,_){return d.push(g,_),this},this.removeHandler=function(g){let _=d.indexOf(g);return _!==-1&&d.splice(_,2),this},this.getHandler=function(g){for(let _=0,y=d.length;_<y;_+=2){let M=d[_],S=d[_+1];if(M.global&&(M.lastIndex=0),M.test(g))return S}return null}}},Db=new Qh,jh=class{constructor(t){this.manager=t!==void 0?t:Db,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(a,l){o.load(t,a,e,l)})}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}};jh.DEFAULT_MATERIAL_NAME="__DEFAULT";var op="\\\\[\\\\]\\\\.:\\\\/",Fb=new RegExp("["+op+"]","g"),sp="[^"+op+"]",Ub="[^"+op.replace("\\\\.","")+"]",Bb=/((?:WC+[\\/:])*)/.source.replace("WC",sp),zb=/(WCOD+)?/.source.replace("WCOD",Ub),kb=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",sp),Gb=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",sp),Vb=new RegExp("^"+Bb+zb+kb+Gb+"$"),Hb=["material","materials","bones","map"],tp=class{constructor(t,e,o){let a=o||Nn.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_,l=o.length;a!==l;++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()}},Nn=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(Fb,"")}static parseTrackName(t){let e=Vb.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 l=o.nodeName.substring(a+1);Hb.indexOf(l)!==-1&&(o.nodeName=o.nodeName.substring(0,a),o.objectName=l)}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(l){for(let f=0;f<l.length;f++){let h=l[f];if(h.name===e||h.uuid===e)return h;let p=o(h.children);if(p)return p}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,l=o.length;a!==l;++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,l=o.length;a!==l;++a)o[a]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++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,l=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 d=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 g=0;g<t.length;g++)if(t[g].name===d){d=g;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(d!==void 0){if(t[d]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[d]}}let f=t[a];if(f===void 0){let d=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+d+"."+a+" but it wasn't found.",t);return}let h=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?h=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(h=this.Versioning.MatrixWorldNeedsUpdate);let p=this.BindingType.Direct;if(l!==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[l]!==void 0&&(l=t.morphTargetDictionary[l])}p=this.BindingType.ArrayElement,this.resolvedProperty=f,this.propertyIndex=l}else f.fromArray!==void 0&&f.toArray!==void 0?(p=this.BindingType.HasFromToArray,this.resolvedProperty=f):Array.isArray(f)?(p=this.BindingType.EntireArray,this.resolvedProperty=f):this.propertyName=a;this.getValue=this.GetterByBindingType[p],this.setValue=this.SetterByBindingTypeAndVersioning[p][h]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Nn.Composite=tp;Nn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Nn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Nn.prototype.GetterByBindingType=[Nn.prototype._getValue_direct,Nn.prototype._getValue_array,Nn.prototype._getValue_arrayElement,Nn.prototype._getValue_toArray];Nn.prototype.SetterByBindingTypeAndVersioning=[[Nn.prototype._setValue_direct,Nn.prototype._setValue_direct_setNeedsUpdate,Nn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Nn.prototype._setValue_array,Nn.prototype._setValue_array_setNeedsUpdate,Nn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Nn.prototype._setValue_arrayElement,Nn.prototype._setValue_arrayElement_setNeedsUpdate,Nn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Nn.prototype._setValue_fromArray,Nn.prototype._setValue_fromArray_setNeedsUpdate,Nn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var _R=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ep}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ep);var gr=63710088e-1,ER={centimeters:gr*100,centimetres:gr*100,degrees:gr/111325,feet:gr*3.28084,inches:gr*39.37,kilometers:gr/1e3,kilometres:gr/1e3,meters:gr,metres:gr,miles:gr/1609.344,millimeters:gr*1e3,millimetres:gr*1e3,nauticalmiles:gr/1852,radians:1,yards:gr*1.0936},MR={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/gr,yards:1.0936133};function Qr(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 Sn(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(!vo(r[0])||!vo(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Qr(o,t,e)}function On(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var f=0;f<l[l.length-1].length;f++)if(l[l.length-1][f]!==l[0][f])throw new Error("First and last Position are not equivalent.")}var h={type:"Polygon",coordinates:r};return Qr(h,t,e)}function yr(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 Qr(o,t,e)}function ap(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Qr(o,t,e)}function vo(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function rr(r,t,e){if(r!==null)for(var o,a,l,f,h,p,d,g=0,_=0,y,M=r.type,S=M==="FeatureCollection",T=M==="Feature",x=S?r.features.length:1,v=0;v<x;v++){d=S?r.features[v].geometry:T?r.geometry:r,y=d?d.type==="GeometryCollection":!1,h=y?d.geometries.length:1;for(var C=0;C<h;C++){var w=0,O=0;if(f=y?d.geometries[C]:d,f!==null){p=f.coordinates;var F=f.type;switch(g=e&&(F==="Polygon"||F==="MultiPolygon")?1:0,F){case null:break;case"Point":if(t(p,_,v,w,O)===!1)return!1;_++,w++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,w,O)===!1)return!1;_++,F==="MultiPoint"&&w++}F==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],_,v,w,O)===!1)return!1;_++}F==="MultiLineString"&&w++,F==="Polygon"&&O++}F==="Polygon"&&w++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(O=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],_,v,w,O)===!1)return!1;_++}O++}w++}break;case"GeometryCollection":for(o=0;o<f.geometries.length;o++)if(rr(f.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function _0(r,t,e,o){var a=e;return rr(r,function(l,f,h,p,d){f===0&&e===void 0?a=l:a=t(a,l,f,h,p,d)},o),a}function ws(r,t){var e,o,a,l,f,h,p,d,g,_,y=0,M=r.type==="FeatureCollection",S=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(h=M?r.features[e].geometry:S?r.geometry:r,d=M?r.features[e].properties:S?r.properties:{},g=M?r.features[e].bbox:S?r.bbox:void 0,_=M?r.features[e].id:S?r.id:void 0,p=h?h.type==="GeometryCollection":!1,f=p?h.geometries.length:1,a=0;a<f;a++){if(l=p?h.geometries[a]:h,l===null){if(t(null,y,d,g,_)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,y,d,g,_)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],y,d,g,_)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}function wi(r,t){ws(r,function(e,o,a,l,f){var h=e===null?null:e.type;switch(h){case null:case"Point":case"LineString":case"Polygon":return t(Qr(e,a,{bbox:l,id:f}),o,0)===!1?!1:void 0}var p;switch(h){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],_={type:p,coordinates:g};if(t(Qr(_,a),o,d)===!1)return!1}})}function up(r){var t=[1/0,1/0,-1/0,-1/0];return rr(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}up.default=up;var jr=up;function Cr(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 lp(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 Pr(r){return r.type==="Feature"?r.geometry:r}var Kb=Ln(Mc(),1);var aT=Ln(U0(),1);function vr(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=Cr(r),a=Pr(t),l=a.type,f=t.bbox,h=a.coordinates;if(f&&uT(o,f)===!1)return!1;l==="Polygon"&&(h=[h]);for(var p=!1,d=0;d<h.length&&!p;d++)if(B0(o,h[d][0],e.ignoreBoundary)){for(var g=!1,_=1;_<h[d].length&&!g;)B0(o,h[d][_],!e.ignoreBoundary)&&(g=!0),_++;g||(p=!0)}return p}function B0(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,l=t.length-1;a<t.length;l=a++){var f=t[a][0],h=t[a][1],p=t[l][0],d=t[l][1],g=r[1]*(f-p)+h*(p-r[0])+d*(r[0]-f)===0&&(f-r[0])*(p-r[0])<=0&&(h-r[1])*(d-r[1])<=0;if(g)return!e;var _=h>r[1]!=d>r[1]&&r[0]<(p-f)*(r[1]-h)/(d-h)+f;_&&(o=!o)}return o}function uT(r,t){return t[0]<=r[0]&&t[1]<=r[1]&&t[2]>=r[0]&&t[3]>=r[1]}var G0=new ArrayBuffer(16),KL=new Float64Array(G0),QL=new Uint32Array(G0);var wT=Ln(bp(),1);var S2=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 l=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,f=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,h=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+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+f),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+h)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+f),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+h)}])}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 l=this.pos(a),f=Math.sqrt((l.x-o.x)*(l.x-o.x)+(l.y-o.y)*(l.y-o.y)+(l.z-o.z)*(l.z-o.z));f>t&&(e.push(a),o=l)}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),l=(this.length-1)*o-a;return ST(l,this.points[a],this.controls[a][1],this.controls[a+1][0],this.points[a+1])},r}();function ST(r,t,e,o,a){var l=bT(r),f={x:a.x*l[0]+o.x*l[1]+e.x*l[2]+t.x*l[3],y:a.y*l[0]+o.y*l[1]+e.y*l[2]+t.y*l[3],z:a.z*l[0]+o.z*l[1]+e.z*l[2]+t.z*l[3]};return f}function bT(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 Zu(r,t){t===void 0&&(t={});var e=Number(r[0]),o=Number(r[1]),a=Number(r[2]),l=Number(r[3]);if(r.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var f=[e,o],h=[e,l],p=[a,l],d=[a,o];return On([[f,d,p,h,f]],t.properties,{bbox:r,id:t.id})}function TT(r){return Zu(jr(r))}var Tp=TT;var HT=Ln(Q0(),1);var gA=Ln(zc(),1);var vA=Ln(Mc(),1);var EA=Ln(bp(),1);var gy=Math.PI/180,yy=180/Math.PI,nl=function(r,t){this.lon=r,this.lat=t,this.x=gy*r,this.y=gy*t};nl.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};nl.prototype.antipode=function(){var r=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new nl(t,r)};var vy=function(){this.coords=[],this.length=0};vy.prototype.move_to=function(r){this.length++,this.coords.push(r)};var Xp=function(r){this.properties=r||{},this.geometries=[]};Xp.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}};Xp.prototype.wkt=function(){for(var r="",t="LINESTRING(",e=function(l){t+=l[0]+" "+l[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 _y=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 nl(r.x,r.y),this.end=new nl(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,a=this.start.y-this.end.y,l=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(l)),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)};_y.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),l=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),f=yy*Math.atan2(l,Math.sqrt(Math.pow(o,2)+Math.pow(a,2))),h=yy*Math.atan2(a,o);return[h,f]};_y.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 l=o*a,f=this.interpolate(l);e.push(f)}for(var h=!1,p=0,d=t&&t.offset?t.offset:10,g=180-d,_=-180+d,y=360-d,M=1;M<e.length;++M){var S=e[M-1][0],T=e[M][0],x=Math.abs(T-S);x>y&&(T>g&&S<_||S>g&&T<_)?h=!0:x>p&&(p=x)}var v=[];if(h&&p<d){var C=[];v.push(C);for(var w=0;w<e.length;++w){var O=parseFloat(e[w][0]);if(w>0&&Math.abs(O-e[w-1][0])>y){var F=parseFloat(e[w-1][0]),G=parseFloat(e[w-1][1]),z=parseFloat(e[w][0]),L=parseFloat(e[w][1]);if(F>-180&&F<_&&z===180&&w+1<e.length&&e[w-1][0]>-180&&e[w-1][0]<_){C.push([-180,e[w][1]]),w++,C.push([e[w][0],e[w][1]]);continue}else if(F>g&&F<180&&z===-180&&w+1<e.length&&e[w-1][0]>g&&e[w-1][0]<180){C.push([180,e[w][1]]),w++,C.push([e[w][0],e[w][1]]);continue}if(F<_&&z>g){var D=F;F=z,z=D;var q=G;G=L,L=q}if(F>g&&z<_&&(z+=360),F<=180&&z>=180&&F<z){var nt=(180-F)/(z-F),k=nt*L+(1-nt)*G;C.push([e[w-1][0]>g?180:-180,k]),C=[],C.push([e[w-1][0]>g?-180:180,k]),v.push(C)}else C=[],v.push(C);C.push([O,e[w][1]])}else C.push([e[w][0],e[w][1]])}}else{var xt=[];v.push(xt);for(var X=0;X<e.length;++X)xt.push([e[X][0],e[X][1]])}for(var it=new Xp(this.properties),vt=0;vt<v.length;++vt){var pt=new vy;it.geometries.push(pt);for(var et=v[vt],ot=0;ot<et.length;++ot)pt.move_to(et[ot])}return it};var SA=Ln(zc(),1);var QC=Ln(zc(),1);var jC=Ln(dd(),1);var nP=Ln(Mc(),1);var _e=[],xe=[],Ee=[],Me=[],we=[],Se=[],be=[],Te=[],Ae=[],Ce=[],Pe=[],Ie=[],Re=[],Le=[],Ne=[],Oe=[],De=[],Fe=[],Ue=[],Be=[],ze=[],ke=[],Ge=[],Ve=[];be[85]=Ce[85]=-1;Te[85]=Pe[85]=0;Ae[85]=Ie[85]=1;Ue[85]=ke[85]=1;Be[85]=Ge[85]=0;ze[85]=Ve[85]=1;_e[85]=Me[85]=0;xe[85]=we[85]=-1;Ee[85]=Ne[85]=0;Oe[85]=Re[85]=0;De[85]=Le[85]=1;Se[85]=Fe[85]=1;ke[1]=ke[169]=0;Ge[1]=Ge[169]=-1;Ve[1]=Ve[169]=0;Re[1]=Re[169]=-1;Le[1]=Le[169]=0;Ne[1]=Ne[169]=0;Ce[4]=Ce[166]=0;Pe[4]=Pe[166]=-1;Ie[4]=Ie[166]=1;Oe[4]=Oe[166]=1;De[4]=De[166]=0;Fe[4]=Fe[166]=0;be[16]=be[154]=0;Te[16]=Te[154]=1;Ae[16]=Ae[154]=1;Me[16]=Me[154]=1;we[16]=we[154]=0;Se[16]=Se[154]=1;Ue[64]=Ue[106]=0;Be[64]=Be[106]=1;ze[64]=ze[106]=0;_e[64]=_e[106]=-1;xe[64]=xe[106]=0;Ee[64]=Ee[106]=1;Ue[2]=Ue[168]=0;Be[2]=Be[168]=-1;ze[2]=ze[168]=1;ke[2]=ke[168]=0;Ge[2]=Ge[168]=-1;Ve[2]=Ve[168]=0;Re[2]=Re[168]=-1;Le[2]=Le[168]=0;Ne[2]=Ne[168]=0;Oe[2]=Oe[168]=-1;De[2]=De[168]=0;Fe[2]=Fe[168]=1;be[8]=be[162]=0;Te[8]=Te[162]=-1;Ae[8]=Ae[162]=0;Ce[8]=Ce[162]=0;Pe[8]=Pe[162]=-1;Ie[8]=Ie[162]=1;Re[8]=Re[162]=1;Le[8]=Le[162]=0;Ne[8]=Ne[162]=1;Oe[8]=Oe[162]=1;De[8]=De[162]=0;Fe[8]=Fe[162]=0;be[32]=be[138]=0;Te[32]=Te[138]=1;Ae[32]=Ae[138]=1;Ce[32]=Ce[138]=0;Pe[32]=Pe[138]=1;Ie[32]=Ie[138]=0;_e[32]=_e[138]=1;xe[32]=xe[138]=0;Ee[32]=Ee[138]=0;Me[32]=Me[138]=1;we[32]=we[138]=0;Se[32]=Se[138]=1;ke[128]=ke[42]=0;Ge[128]=Ge[42]=1;Ve[128]=Ve[42]=1;Ue[128]=Ue[42]=0;Be[128]=Be[42]=1;ze[128]=ze[42]=0;_e[128]=_e[42]=-1;xe[128]=xe[42]=0;Ee[128]=Ee[42]=1;Me[128]=Me[42]=-1;we[128]=we[42]=0;Se[128]=Se[42]=0;Ce[5]=Ce[165]=-1;Pe[5]=Pe[165]=0;Ie[5]=Ie[165]=0;ke[5]=ke[165]=1;Ge[5]=Ge[165]=0;Ve[5]=Ve[165]=0;Oe[20]=Oe[150]=0;De[20]=De[150]=1;Fe[20]=Fe[150]=1;Me[20]=Me[150]=0;we[20]=we[150]=-1;Se[20]=Se[150]=1;be[80]=be[90]=-1;Te[80]=Te[90]=0;Ae[80]=Ae[90]=1;Ue[80]=Ue[90]=1;Be[80]=Be[90]=0;ze[80]=ze[90]=1;Re[65]=Re[105]=0;Le[65]=Le[105]=1;Ne[65]=Ne[105]=0;_e[65]=_e[105]=0;xe[65]=xe[105]=-1;Ee[65]=Ee[105]=0;be[160]=be[10]=-1;Te[160]=Te[10]=0;Ae[160]=Ae[10]=1;Ce[160]=Ce[10]=-1;Pe[160]=Pe[10]=0;Ie[160]=Ie[10]=0;ke[160]=ke[10]=1;Ge[160]=Ge[10]=0;Ve[160]=Ve[10]=0;Ue[160]=Ue[10]=1;Be[160]=Be[10]=0;ze[160]=ze[10]=1;Oe[130]=Oe[40]=0;De[130]=De[40]=1;Fe[130]=Fe[40]=1;Re[130]=Re[40]=0;Le[130]=Le[40]=1;Ne[130]=Ne[40]=0;_e[130]=_e[40]=0;xe[130]=xe[40]=-1;Ee[130]=Ee[40]=0;Me[130]=Me[40]=0;we[130]=we[40]=-1;Se[130]=Se[40]=1;Ce[37]=Ce[133]=0;Pe[37]=Pe[133]=1;Ie[37]=Ie[133]=1;ke[37]=ke[133]=0;Ge[37]=Ge[133]=1;Ve[37]=Ve[133]=0;_e[37]=_e[133]=-1;xe[37]=xe[133]=0;Ee[37]=Ee[133]=0;Me[37]=Me[133]=1;we[37]=we[133]=0;Se[37]=Se[133]=0;Oe[148]=Oe[22]=-1;De[148]=De[22]=0;Fe[148]=Fe[22]=0;ke[148]=ke[22]=0;Ge[148]=Ge[22]=-1;Ve[148]=Ve[22]=1;Ue[148]=Ue[22]=0;Be[148]=Be[22]=1;ze[148]=ze[22]=1;Me[148]=Me[22]=-1;we[148]=we[22]=0;Se[148]=Se[22]=1;be[82]=be[88]=0;Te[82]=Te[88]=-1;Ae[82]=Ae[88]=1;Oe[82]=Oe[88]=1;De[82]=De[88]=0;Fe[82]=Fe[88]=1;Re[82]=Re[88]=-1;Le[82]=Le[88]=0;Ne[82]=Ne[88]=1;Ue[82]=Ue[88]=0;Be[82]=Be[88]=-1;ze[82]=ze[88]=0;be[73]=be[97]=0;Te[73]=Te[97]=1;Ae[73]=Ae[97]=0;Ce[73]=Ce[97]=0;Pe[73]=Pe[97]=-1;Ie[73]=Ie[97]=0;Re[73]=Re[97]=1;Le[73]=Le[97]=0;Ne[73]=Ne[97]=0;_e[73]=_e[97]=1;xe[73]=xe[97]=0;Ee[73]=Ee[97]=1;be[145]=be[25]=0;Te[145]=Te[25]=-1;Ae[145]=Ae[25]=0;Re[145]=Re[25]=1;Le[145]=Le[25]=0;Ne[145]=Ne[25]=1;ke[145]=ke[25]=0;Ge[145]=Ge[25]=1;Ve[145]=Ve[25]=1;Me[145]=Me[25]=-1;we[145]=we[25]=0;Se[145]=Se[25]=0;Ce[70]=Ce[100]=0;Pe[70]=Pe[100]=1;Ie[70]=Ie[100]=0;Oe[70]=Oe[100]=-1;De[70]=De[100]=0;Fe[70]=Fe[100]=1;Ue[70]=Ue[100]=0;Be[70]=Be[100]=-1;ze[70]=ze[100]=1;_e[70]=_e[100]=1;xe[70]=xe[100]=0;Ee[70]=Ee[100]=0;Ce[101]=Ce[69]=0;Pe[101]=Pe[69]=1;Ie[101]=Ie[69]=0;_e[101]=_e[69]=1;xe[101]=xe[69]=0;Ee[101]=Ee[69]=0;ke[149]=ke[21]=0;Ge[149]=Ge[21]=1;Ve[149]=Ve[21]=1;Me[149]=Me[21]=-1;we[149]=we[21]=0;Se[149]=Se[21]=0;Oe[86]=Oe[84]=-1;De[86]=De[84]=0;Fe[86]=Fe[84]=1;Ue[86]=Ue[84]=0;Be[86]=Be[84]=-1;ze[86]=ze[84]=1;be[89]=be[81]=0;Te[89]=Te[81]=-1;Ae[89]=Ae[81]=0;Re[89]=Re[81]=1;Le[89]=Le[81]=0;Ne[89]=Ne[81]=1;be[96]=be[74]=0;Te[96]=Te[74]=1;Ae[96]=Ae[74]=0;Ce[96]=Ce[74]=-1;Pe[96]=Pe[74]=0;Ie[96]=Ie[74]=1;Ue[96]=Ue[74]=1;Be[96]=Be[74]=0;ze[96]=ze[74]=0;_e[96]=_e[74]=1;xe[96]=xe[74]=0;Ee[96]=Ee[74]=1;be[24]=be[146]=0;Te[24]=Te[146]=-1;Ae[24]=Ae[146]=1;Oe[24]=Oe[146]=1;De[24]=De[146]=0;Fe[24]=Fe[146]=1;Re[24]=Re[146]=0;Le[24]=Le[146]=1;Ne[24]=Ne[146]=1;Me[24]=Me[146]=0;we[24]=we[146]=-1;Se[24]=Se[146]=0;Ce[6]=Ce[164]=-1;Pe[6]=Pe[164]=0;Ie[6]=Ie[164]=1;Oe[6]=Oe[164]=-1;De[6]=De[164]=0;Fe[6]=Fe[164]=0;ke[6]=ke[164]=0;Ge[6]=Ge[164]=-1;Ve[6]=Ve[164]=1;Ue[6]=Ue[164]=1;Be[6]=Be[164]=0;ze[6]=ze[164]=0;Re[129]=Re[41]=0;Le[129]=Le[41]=1;Ne[129]=Ne[41]=1;ke[129]=ke[41]=0;Ge[129]=Ge[41]=1;Ve[129]=Ve[41]=0;_e[129]=_e[41]=-1;xe[129]=xe[41]=0;Ee[129]=Ee[41]=0;Me[129]=Me[41]=0;we[129]=we[41]=-1;Se[129]=Se[41]=0;Oe[66]=Oe[104]=0;De[66]=De[104]=1;Fe[66]=Fe[104]=0;Re[66]=Re[104]=-1;Le[66]=Le[104]=0;Ne[66]=Ne[104]=1;Ue[66]=Ue[104]=0;Be[66]=Be[104]=-1;ze[66]=ze[104]=0;_e[66]=_e[104]=0;xe[66]=xe[104]=-1;Ee[66]=Ee[104]=1;be[144]=be[26]=-1;Te[144]=Te[26]=0;Ae[144]=Ae[26]=0;ke[144]=ke[26]=1;Ge[144]=Ge[26]=0;Ve[144]=Ve[26]=1;Ue[144]=Ue[26]=0;Be[144]=Be[26]=1;ze[144]=ze[26]=1;Me[144]=Me[26]=-1;we[144]=we[26]=0;Se[144]=Se[26]=1;Ce[36]=Ce[134]=0;Pe[36]=Pe[134]=1;Ie[36]=Ie[134]=1;Oe[36]=Oe[134]=0;De[36]=De[134]=1;Fe[36]=Fe[134]=0;_e[36]=_e[134]=0;xe[36]=xe[134]=-1;Ee[36]=Ee[134]=1;Me[36]=Me[134]=1;we[36]=we[134]=0;Se[36]=Se[134]=0;be[9]=be[161]=-1;Te[9]=Te[161]=0;Ae[9]=Ae[161]=0;Ce[9]=Ce[161]=0;Pe[9]=Pe[161]=-1;Ie[9]=Ie[161]=0;Re[9]=Re[161]=1;Le[9]=Le[161]=0;Ne[9]=Ne[161]=0;ke[9]=ke[161]=1;Ge[9]=Ge[161]=0;Ve[9]=Ve[161]=1;be[136]=0;Te[136]=1;Ae[136]=1;Ce[136]=0;Pe[136]=1;Ie[136]=0;Oe[136]=-1;De[136]=0;Fe[136]=1;Re[136]=-1;Le[136]=0;Ne[136]=0;ke[136]=0;Ge[136]=-1;Ve[136]=0;Ue[136]=0;Be[136]=-1;ze[136]=1;_e[136]=1;xe[136]=0;Ee[136]=0;Me[136]=1;we[136]=0;Se[136]=1;be[34]=0;Te[34]=-1;Ae[34]=0;Ce[34]=0;Pe[34]=-1;Ie[34]=1;Oe[34]=1;De[34]=0;Fe[34]=0;Re[34]=1;Le[34]=0;Ne[34]=1;ke[34]=0;Ge[34]=1;Ve[34]=1;Ue[34]=0;Be[34]=1;ze[34]=0;_e[34]=-1;xe[34]=0;Ee[34]=1;Me[34]=-1;we[34]=0;Se[34]=0;be[35]=0;Te[35]=1;Ae[35]=1;Ce[35]=0;Pe[35]=-1;Ie[35]=1;Oe[35]=1;De[35]=0;Fe[35]=0;Re[35]=-1;Le[35]=0;Ne[35]=0;ke[35]=0;Ge[35]=-1;Ve[35]=0;Ue[35]=0;Be[35]=1;ze[35]=0;_e[35]=-1;xe[35]=0;Ee[35]=1;Me[35]=1;we[35]=0;Se[35]=1;be[153]=0;Te[153]=1;Ae[153]=1;Re[153]=-1;Le[153]=0;Ne[153]=0;ke[153]=0;Ge[153]=-1;Ve[153]=0;Me[153]=1;we[153]=0;Se[153]=1;Ce[102]=0;Pe[102]=-1;Ie[102]=1;Oe[102]=1;De[102]=0;Fe[102]=0;Ue[102]=0;Be[102]=1;ze[102]=0;_e[102]=-1;xe[102]=0;Ee[102]=1;be[155]=0;Te[155]=-1;Ae[155]=0;Re[155]=1;Le[155]=0;Ne[155]=1;ke[155]=0;Ge[155]=1;Ve[155]=1;Me[155]=-1;we[155]=0;Se[155]=0;Ce[103]=0;Pe[103]=1;Ie[103]=0;Oe[103]=-1;De[103]=0;Fe[103]=1;Ue[103]=0;Be[103]=-1;ze[103]=1;_e[103]=1;xe[103]=0;Ee[103]=0;be[152]=0;Te[152]=1;Ae[152]=1;Oe[152]=-1;De[152]=0;Fe[152]=1;Re[152]=-1;Le[152]=0;Ne[152]=0;ke[152]=0;Ge[152]=-1;Ve[152]=0;Ue[152]=0;Be[152]=-1;ze[152]=1;Me[152]=1;we[152]=0;Se[152]=1;be[156]=0;Te[156]=-1;Ae[156]=1;Oe[156]=1;De[156]=0;Fe[156]=1;Re[156]=-1;Le[156]=0;Ne[156]=0;ke[156]=0;Ge[156]=-1;Ve[156]=0;Ue[156]=0;Be[156]=1;ze[156]=1;Me[156]=-1;we[156]=0;Se[156]=1;be[137]=0;Te[137]=1;Ae[137]=1;Ce[137]=0;Pe[137]=1;Ie[137]=0;Re[137]=-1;Le[137]=0;Ne[137]=0;ke[137]=0;Ge[137]=-1;Ve[137]=0;_e[137]=1;xe[137]=0;Ee[137]=0;Me[137]=1;we[137]=0;Se[137]=1;be[139]=0;Te[139]=1;Ae[139]=1;Ce[139]=0;Pe[139]=-1;Ie[139]=0;Re[139]=1;Le[139]=0;Ne[139]=0;ke[139]=0;Ge[139]=1;Ve[139]=0;_e[139]=-1;xe[139]=0;Ee[139]=0;Me[139]=1;we[139]=0;Se[139]=1;be[98]=0;Te[98]=-1;Ae[98]=0;Ce[98]=0;Pe[98]=-1;Ie[98]=1;Oe[98]=1;De[98]=0;Fe[98]=0;Re[98]=1;Le[98]=0;Ne[98]=1;Ue[98]=0;Be[98]=1;ze[98]=0;_e[98]=-1;xe[98]=0;Ee[98]=1;be[99]=0;Te[99]=1;Ae[99]=0;Ce[99]=0;Pe[99]=-1;Ie[99]=1;Oe[99]=1;De[99]=0;Fe[99]=0;Re[99]=-1;Le[99]=0;Ne[99]=1;Ue[99]=0;Be[99]=-1;ze[99]=0;_e[99]=1;xe[99]=0;Ee[99]=1;Ce[38]=0;Pe[38]=-1;Ie[38]=1;Oe[38]=1;De[38]=0;Fe[38]=0;ke[38]=0;Ge[38]=1;Ve[38]=1;Ue[38]=0;Be[38]=1;ze[38]=0;_e[38]=-1;xe[38]=0;Ee[38]=1;Me[38]=-1;we[38]=0;Se[38]=0;Ce[39]=0;Pe[39]=1;Ie[39]=1;Oe[39]=-1;De[39]=0;Fe[39]=0;ke[39]=0;Ge[39]=-1;Ve[39]=1;Ue[39]=0;Be[39]=1;ze[39]=0;_e[39]=-1;xe[39]=0;Ee[39]=1;Me[39]=1;we[39]=0;Se[39]=0;var md=function(r){return[[r.bottomleft,0],[0,0],[0,r.leftbottom]]},gd=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0]]},yd=function(r){return[[r.topright,1],[1,1],[1,r.righttop]]},vd=function(r){return[[0,r.lefttop],[0,1],[r.topleft,1]]},_d=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop]]},xd=function(r){return[[r.bottomright,0],[r.bottomleft,0],[1,r.righttop],[1,r.rightbottom]]},Ed=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.topleft,1],[r.topright,1]]},Md=function(r){return[[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},rP=function(r){return[[0,0],[0,r.leftbottom],[1,r.rightbottom],[1,0]]},iP=function(r){return[[1,0],[r.bottomright,0],[r.topright,1],[1,1]]},oP=function(r){return[[1,1],[1,r.righttop],[0,r.lefttop],[0,1]]},sP=function(r){return[[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},aP=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.leftbottom],[0,r.lefttop]]},uP=function(r){return[[r.topleft,1],[r.topright,1],[r.bottomright,0],[r.bottomleft,0]]},lP=function(){return[[0,0],[0,1],[1,1],[1,0]]},cP=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,1],[r.topleft,1]]},fP=function(r){return[[r.topright,1],[1,1],[1,0],[0,0],[0,r.leftbottom]]},hP=function(r){return[[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[1,1]]},pP=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,1]]},dP=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.lefttop],[0,1],[r.topleft,1]]},mP=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[r.topright,1]]},gP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop]]},yP=function(r){return[[r.topright,1],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1]]},vP=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},_P=function(r){return[[1,1],[1,r.righttop],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},xP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[r.topleft,1],[r.topright,1]]},EP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom]]},MP=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},wP=function(r){return[[1,1],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},SP=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1]]},bP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},TP=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},AP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},CP=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]]},PP=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},IP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},RP=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},LP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},NP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},OP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},Xe=[],Ye=[],$e=[],Ze=[],Je=[],Ke=[],Qe=[],je=[];Ze[1]=Je[1]=18;Ze[169]=Je[169]=18;$e[4]=Ye[4]=12;$e[166]=Ye[166]=12;Xe[16]=je[16]=4;Xe[154]=je[154]=4;Ke[64]=Qe[64]=22;Ke[106]=Qe[106]=22;$e[2]=Ke[2]=17;Ze[2]=Je[2]=18;$e[168]=Ke[168]=17;Ze[168]=Je[168]=18;Xe[8]=Ze[8]=9;Ye[8]=$e[8]=12;Xe[162]=Ze[162]=9;Ye[162]=$e[162]=12;Xe[32]=je[32]=4;Ye[32]=Qe[32]=1;Xe[138]=je[138]=4;Ye[138]=Qe[138]=1;Je[128]=je[128]=21;Ke[128]=Qe[128]=22;Je[42]=je[42]=21;Ke[42]=Qe[42]=22;Ye[5]=Je[5]=14;Ye[165]=Je[165]=14;$e[20]=je[20]=6;$e[150]=je[150]=6;Xe[80]=Ke[80]=11;Xe[90]=Ke[90]=11;Ze[65]=Qe[65]=3;Ze[105]=Qe[105]=3;Xe[160]=Ke[160]=11;Ye[160]=Je[160]=14;Xe[10]=Ke[10]=11;Ye[10]=Je[10]=14;$e[130]=je[130]=6;Ze[130]=Qe[130]=3;$e[40]=je[40]=6;Ze[40]=Qe[40]=3;Ye[101]=Qe[101]=1;Ye[69]=Qe[69]=1;Je[149]=je[149]=21;Je[21]=je[21]=21;$e[86]=Ke[86]=17;$e[84]=Ke[84]=17;Xe[89]=Ze[89]=9;Xe[81]=Ze[81]=9;Xe[96]=Qe[96]=0;Ye[96]=Ke[96]=15;Xe[74]=Qe[74]=0;Ye[74]=Ke[74]=15;Xe[24]=$e[24]=8;Ze[24]=je[24]=7;Xe[146]=$e[146]=8;Ze[146]=je[146]=7;Ye[6]=Ke[6]=15;$e[6]=Je[6]=16;Ye[164]=Ke[164]=15;$e[164]=Je[164]=16;Ze[129]=je[129]=7;Je[129]=Qe[129]=20;Ze[41]=je[41]=7;Je[41]=Qe[41]=20;$e[66]=Qe[66]=2;Ze[66]=Ke[66]=19;$e[104]=Qe[104]=2;Ze[104]=Ke[104]=19;Xe[144]=Je[144]=10;Ke[144]=je[144]=23;Xe[26]=Je[26]=10;Ke[26]=je[26]=23;Ye[36]=je[36]=5;$e[36]=Qe[36]=2;Ye[134]=je[134]=5;$e[134]=Qe[134]=2;Xe[9]=Je[9]=10;Ye[9]=Ze[9]=13;Xe[161]=Je[161]=10;Ye[161]=Ze[161]=13;Ye[37]=je[37]=5;Je[37]=Qe[37]=20;Ye[133]=je[133]=5;Je[133]=Qe[133]=20;$e[148]=Je[148]=16;Ke[148]=je[148]=23;$e[22]=Je[22]=16;Ke[22]=je[22]=23;Xe[82]=$e[82]=8;Ze[82]=Ke[82]=19;Xe[88]=$e[88]=8;Ze[88]=Ke[88]=19;Xe[73]=Qe[73]=0;Ye[73]=Ze[73]=13;Xe[97]=Qe[97]=0;Ye[97]=Ze[97]=13;Xe[145]=Ze[145]=9;Je[145]=je[145]=21;Xe[25]=Ze[25]=9;Je[25]=je[25]=21;Ye[70]=Qe[70]=1;$e[70]=Ke[70]=17;Ye[100]=Qe[100]=1;$e[100]=Ke[100]=17;Xe[34]=Ze[34]=9;Ye[34]=$e[34]=12;Je[34]=je[34]=21;Ke[34]=Qe[34]=22;Xe[136]=je[136]=4;Ye[136]=Qe[136]=1;$e[136]=Ke[136]=17;Ze[136]=Je[136]=18;Xe[35]=je[35]=4;Ye[35]=$e[35]=12;Ze[35]=Je[35]=18;Ke[35]=Qe[35]=22;Xe[153]=je[153]=4;Ze[153]=Je[153]=18;Ye[102]=$e[102]=12;Ke[102]=Qe[102]=22;Xe[155]=Ze[155]=9;Je[155]=je[155]=23;Ye[103]=Qe[103]=1;$e[103]=Ke[103]=17;Xe[152]=je[152]=4;$e[152]=Ke[152]=17;Ze[152]=Je[152]=18;Xe[156]=$e[156]=8;Ze[156]=Je[156]=18;Ke[156]=je[156]=23;Xe[137]=je[137]=4;Ye[137]=Qe[137]=1;Ze[137]=Je[137]=18;Xe[139]=je[139]=4;Ye[139]=Ze[139]=13;Je[139]=Qe[139]=20;Xe[98]=Ze[98]=9;Ye[98]=$e[98]=12;Ke[98]=Qe[98]=22;Xe[99]=Qe[99]=0;Ye[99]=$e[99]=12;Ze[99]=Ke[99]=19;Ye[38]=$e[38]=12;Je[38]=je[38]=21;Ke[38]=Qe[38]=22;Ye[39]=je[39]=5;$e[39]=Je[39]=16;Ke[39]=Qe[39]=22;var Ft=[];Ft[1]=Ft[169]=md;Ft[4]=Ft[166]=gd;Ft[16]=Ft[154]=yd;Ft[64]=Ft[106]=vd;Ft[168]=Ft[2]=_d;Ft[162]=Ft[8]=xd;Ft[138]=Ft[32]=Ed;Ft[42]=Ft[128]=Md;Ft[5]=Ft[165]=rP;Ft[20]=Ft[150]=iP;Ft[80]=Ft[90]=oP;Ft[65]=Ft[105]=sP;Ft[160]=Ft[10]=aP;Ft[130]=Ft[40]=uP;Ft[85]=lP;Ft[101]=Ft[69]=cP;Ft[149]=Ft[21]=fP;Ft[86]=Ft[84]=hP;Ft[89]=Ft[81]=pP;Ft[96]=Ft[74]=dP;Ft[24]=Ft[146]=mP;Ft[6]=Ft[164]=gP;Ft[129]=Ft[41]=yP;Ft[66]=Ft[104]=vP;Ft[144]=Ft[26]=_P;Ft[36]=Ft[134]=xP;Ft[9]=Ft[161]=EP;Ft[37]=Ft[133]=MP;Ft[148]=Ft[22]=wP;Ft[82]=Ft[88]=SP;Ft[73]=Ft[97]=bP;Ft[145]=Ft[25]=TP;Ft[70]=Ft[100]=AP;Ft[34]=function(r){return[Md(r),xd(r)]};Ft[35]=CP;Ft[136]=function(r){return[Ed(r),_d(r)]};Ft[153]=function(r){return[yd(r),md(r)]};Ft[102]=function(r){return[gd(r),vd(r)]};Ft[155]=PP;Ft[103]=IP;Ft[152]=function(r){return[yd(r),_d(r)]};Ft[156]=RP;Ft[137]=function(r){return[Ed(r),md(r)]};Ft[139]=LP;Ft[98]=function(r){return[xd(r),vd(r)]};Ft[99]=NP;Ft[38]=function(r){return[gd(r),Md(r)]};Ft[39]=OP;function FP(r){return(r>0)-(r<0)||+r}function pu(r,t,e){var o=t[0]-r[0],a=t[1]-r[1],l=e[0]-t[0],f=e[1]-t[1];return FP(o*f-l*a)}function f_(r,t){var e=r.geometry.coordinates[0].map(function(f){return f[0]}),o=r.geometry.coordinates[0].map(function(f){return f[1]}),a=t.geometry.coordinates[0].map(function(f){return f[0]}),l=t.geometry.coordinates[0].map(function(f){return f[1]});return Math.max.apply(null,e)===Math.max.apply(null,a)&&Math.max.apply(null,o)===Math.max.apply(null,l)&&Math.min.apply(null,e)===Math.min.apply(null,a)&&Math.min.apply(null,o)===Math.min.apply(null,l)}function wd(r,t){return t.geometry.coordinates[0].every(function(e){return vr(Sn(e),r)})}function h_(r,t){return r[0]===t[0]&&r[1]===t[1]}var UP=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,l=o.to;if(a.coordinates[0]-t.coordinates[0]>=0&&l.coordinates[0]-t.coordinates[0]<0)return 1;if(a.coordinates[0]-t.coordinates[0]<0&&l.coordinates[0]-t.coordinates[0]>=0)return-1;if(a.coordinates[0]-t.coordinates[0]===0&&l.coordinates[0]-t.coordinates[0]===0)return a.coordinates[1]-t.coordinates[1]>=0||l.coordinates[1]-t.coordinates[1]>=0?a.coordinates[1]-l.coordinates[1]:l.coordinates[1]-a.coordinates[1];var f=pu(t.coordinates,a.coordinates,l.coordinates);if(f<0)return 1;if(f>0)return-1;var h=Math.pow(a.coordinates[0]-t.coordinates[0],2)+Math.pow(a.coordinates[1]-t.coordinates[1],2),p=Math.pow(l.coordinates[0]-t.coordinates[0],2)+Math.pow(l.coordinates[1]-t.coordinates[1],2);return h-p}),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}(),Sd=UP;var BP=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 yr([this.from.coordinates,this.to.coordinates])},r.prototype.compareTo=function(t){return pu(t.from.coordinates,t.to.coordinates,this.to.coordinates)},r}(),p_=BP;var zP=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(f,h,p){return h.from.coordinates[1]>t.edges[f].from.coordinates[1]&&(f=p),f},0),o=(e===0?this.length:e)-1,a=(e+1)%this.length,l=pu(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[a].from.coordinates);return l===0?this.edges[o].from.coordinates[0]>this.edges[a].from.coordinates[0]:l>0},r.prototype.toMultiPoint=function(){return ap(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=On([t])},r.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Tp(this.toPolygon())},r.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),a,l;return e.forEach(function(f){var h=f.getEnvelope();if(l&&(a=l.getEnvelope()),!f_(h,o)&&wd(h,o)){for(var p=t.map(function(S){return S.from.coordinates}),d=void 0,g=function(S){f.some(function(T){return h_(S,T.from.coordinates)})||(d=S)},_=0,y=p;_<y.length;_++){var M=y[_];g(M)}d&&f.inside(Sn(d))&&(!l||wd(a,h))&&(l=f)}}),l},r.prototype.inside=function(t){return vr(t,this.toPolygon())},r}(),bd=zP;function kP(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 oB=function(){function r(){this.edges=[],this.nodes={}}return r.fromGeoJson=function(t){kP(t);var e=new r;return wi(t,function(o){lp(o,"LineString","Graph::fromGeoJson"),_0(o,function(a,l){if(a){var f=e.getNode(a),h=e.getNode(l);e.addEdge(f,h)}return l})}),e},r.prototype.getNode=function(t){var e=Sd.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new Sd(t)),o},r.prototype.addEdge=function(t,e){var o=new p_(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,l,f=o.length-1;f>=0;--f){var h=o[f],p=h.symetric,d=void 0,g=void 0;h.label===e&&(d=h),p.label===e&&(g=p),!(!d||!g)&&(g&&(l=g),d&&(l&&(l.next=d,l=void 0),a||(a=d)))}l&&(l.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 l=0;o.from.getOuterEdges().forEach(function(f){f.label===t.label&&++l}),l>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 bd;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 WP=Ln(Td(),1);var qP=Ln(Td(),1);var YP=Ln(M_(),1);var tI=Ln(L_(),1);function O_(r){for(var t=r,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function nI(){return new D_(function(r){return r.f})}var Id={search:function(r,t,e,o){r.cleanDirty(),o=o||{};var a=o.heuristic||Id.heuristics.manhattan,l=o.closest||!1,f=nI(),h=t;for(t.h=a(t,e),f.push(t);f.size()>0;){var p=f.pop();if(p===e)return O_(p);p.closed=!0;for(var d=r.neighbors(p),g=0,_=d.length;g<_;++g){var y=d[g];if(!(y.closed||y.isWall())){var M=p.g+y.getCost(p),S=y.visited;(!S||M<y.g)&&(y.visited=!0,y.parent=p,y.h=y.h||a(y,e),y.g=M,y.f=y.g+y.h,r.markDirty(y),l&&(y.h<h.h||y.h===h.h&&y.g<h.g)&&(h=y),S?f.rescoreElement(y):f.push(y))}}}return l?O_(h):[]},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),l=Math.abs(t.y-r.y);return e*(a+l)+(o-2*e)*Math.min(a,l)}},cleanNode:function(r){r.f=0,r.g=0,r.h=0,r.visited=!1,r.closed=!1,r.parent=null}};function fl(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 l=new lf(e,o,a[o]);this.grid[e][o]=l,this.nodes.push(l)}}this.init()}fl.prototype.init=function(){this.dirtyNodes=[];for(var r=0;r<this.nodes.length;r++)Id.cleanNode(this.nodes[r])};fl.prototype.cleanDirty=function(){for(var r=0;r<this.dirtyNodes.length;r++)Id.cleanNode(this.dirtyNodes[r]);this.dirtyNodes=[]};fl.prototype.markDirty=function(r){this.dirtyNodes.push(r)};fl.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};fl.prototype.toString=function(){for(var r=[],t=this.grid,e,o,a,l,f=0,h=t.length;f<h;f++){for(e=[],o=t[f],a=0,l=o.length;a<l;a++)e.push(o[a].weight);r.push(e.join(" "))}return r.join(\`
|
|
3671
|
-
\`)};function lf(r,t,e){this.x=r,this.y=t,this.weight=e}lf.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};lf.prototype.getCost=function(r){return r&&r.x!==this.x&&r.y!==this.y?this.weight*1.41421:this.weight};lf.prototype.isWall=function(){return this.weight===0};function D_(r){this.content=[],this.scoreFunction=r}D_.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,l=a-1,f=null,h;if(l<t){var p=this.content[l];h=this.scoreFunction(p),h<o&&(f=l)}if(a<t){var d=this.content[a],g=this.scoreFunction(d);g<(f===null?o:h)&&(f=a)}if(f!==null)this.content[r]=this.content[f],this.content[f]=e,r=f;else break}}};function Rd(){this._=null}function mu(r){r.U=r.C=r.L=r.R=r.P=r.N=null}Rd.prototype={constructor:Rd,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=F_(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&&(hl(this,e),r=e,e=r.U),e.C=!1,o.C=!0,pl(this,o))):(a=o.L,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.L&&(pl(this,e),r=e,e=r.U),e.C=!1,o.C=!0,hl(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,l,f;if(o?a?l=F_(a):l=o:l=a,t?t.L===r?t.L=l:t.R=l:this._=l,o&&a?(f=l.C,l.C=r.C,l.L=o,o.U=l,l!==a?(t=l.U,l.U=r.U,r=l.R,t.L=r,l.R=a,a.U=l):(l.U=t,t=l,r=l.R)):(f=r.C,r=l),r&&(r.U=t),!f){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,hl(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,pl(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,hl(this,t),r=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,pl(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,hl(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,pl(this,t),r=this._;break}e.C=!0,r=t,t=t.U}while(!r.C);r&&(r.C=!1)}}};function hl(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 pl(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 F_(r){for(;r.L;)r=r.L;return r}var Ld=Rd;function gu(r,t,e,o){var a=[null,null],l=xr.push(a)-1;return a.left=r,a.right=t,e&&dl(a,r,t,e),o&&dl(a,t,r,o),ti[r.index].halfedges.push(l),ti[t.index].halfedges.push(l),a}function yu(r,t,e){var o=[t,e];return o.left=r,o}function dl(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 rI(r,t,e,o,a){var l=r[0],f=r[1],h=l[0],p=l[1],d=f[0],g=f[1],_=0,y=1,M=d-h,S=g-p,T;if(T=t-h,!(!M&&T>0)){if(T/=M,M<0){if(T<_)return;T<y&&(y=T)}else if(M>0){if(T>y)return;T>_&&(_=T)}if(T=o-h,!(!M&&T<0)){if(T/=M,M<0){if(T>y)return;T>_&&(_=T)}else if(M>0){if(T<_)return;T<y&&(y=T)}if(T=e-p,!(!S&&T>0)){if(T/=S,S<0){if(T<_)return;T<y&&(y=T)}else if(S>0){if(T>y)return;T>_&&(_=T)}if(T=a-p,!(!S&&T<0)){if(T/=S,S<0){if(T>y)return;T>_&&(_=T)}else if(S>0){if(T<_)return;T<y&&(y=T)}return!(_>0)&&!(y<1)||(_>0&&(r[0]=[h+_*M,p+_*S]),y<1&&(r[1]=[h+y*M,p+y*S])),!0}}}}}function iI(r,t,e,o,a){var l=r[1];if(l)return!0;var f=r[0],h=r.left,p=r.right,d=h[0],g=h[1],_=p[0],y=p[1],M=(d+_)/2,S=(g+y)/2,T,x;if(y===g){if(M<t||M>=o)return;if(d>_){if(!f)f=[M,e];else if(f[1]>=a)return;l=[M,a]}else{if(!f)f=[M,a];else if(f[1]<e)return;l=[M,e]}}else if(T=(d-_)/(y-g),x=S-T*M,T<-1||T>1)if(d>_){if(!f)f=[(e-x)/T,e];else if(f[1]>=a)return;l=[(a-x)/T,a]}else{if(!f)f=[(a-x)/T,a];else if(f[1]<e)return;l=[(e-x)/T,e]}else if(g<y){if(!f)f=[t,T*t+x];else if(f[0]>=o)return;l=[o,T*o+x]}else{if(!f)f=[o,T*o+x];else if(f[0]<t)return;l=[t,T*t+x]}return r[0]=f,r[1]=l,!0}function U_(r,t,e,o){for(var a=xr.length,l;a--;)(!iI(l=xr[a],r,t,e,o)||!rI(l,r,t,e,o)||!(Math.abs(l[0][0]-l[1][0])>vn||Math.abs(l[0][1]-l[1][1])>vn))&&delete xr[a]}function B_(r){return ti[r.index]={site:r,halfedges:[]}}function oI(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 Nd(r,t){return t[+(t.left!==r.site)]}function sI(r,t){return t[+(t.left===r.site)]}function z_(){for(var r=0,t=ti.length,e,o,a,l;r<t;++r)if((e=ti[r])&&(l=(o=e.halfedges).length)){var f=new Array(l),h=new Array(l);for(a=0;a<l;++a)f[a]=a,h[a]=oI(e,xr[o[a]]);for(f.sort(function(p,d){return h[d]-h[p]}),a=0;a<l;++a)h[a]=o[f[a]];for(a=0;a<l;++a)o[a]=h[a]}}function k_(r,t,e,o){var a=ti.length,l,f,h,p,d,g,_,y,M,S,T,x,v=!0;for(l=0;l<a;++l)if(f=ti[l]){for(h=f.site,d=f.halfedges,p=d.length;p--;)xr[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)S=sI(f,xr[d[p]]),T=S[0],x=S[1],_=Nd(f,xr[d[++p%g]]),y=_[0],M=_[1],(Math.abs(T-y)>vn||Math.abs(x-M)>vn)&&(d.splice(p,0,xr.push(yu(h,S,Math.abs(T-r)<vn&&o-x>vn?[r,Math.abs(y-r)<vn?M:o]:Math.abs(x-o)<vn&&e-T>vn?[Math.abs(M-o)<vn?y:e,o]:Math.abs(T-e)<vn&&x-t>vn?[e,Math.abs(y-e)<vn?M:t]:Math.abs(x-t)<vn&&T-r>vn?[Math.abs(M-t)<vn?y:r,t]:null))-1),++g);g&&(v=!1)}if(v){var C,w,O,F=1/0;for(l=0,v=null;l<a;++l)(f=ti[l])&&(h=f.site,C=h[0]-r,w=h[1]-t,O=C*C+w*w,O<F&&(F=O,v=f));if(v){var G=[r,t],z=[r,o],L=[e,o],D=[e,t];v.halfedges.push(xr.push(yu(h=v.site,G,z))-1,xr.push(yu(h,z,L))-1,xr.push(yu(h,L,D))-1,xr.push(yu(h,D,G))-1)}}for(l=0;l<a;++l)(f=ti[l])&&(f.halfedges.length||delete ti[l])}var G_=[],cf;function aI(){mu(this),this.x=this.y=this.arc=this.site=this.cy=null}function oa(r){var t=r.P,e=r.N;if(!(!t||!e)){var o=t.site,a=r.site,l=e.site;if(o!==l){var f=a[0],h=a[1],p=o[0]-f,d=o[1]-h,g=l[0]-f,_=l[1]-h,y=2*(p*_-d*g);if(!(y>=-V_)){var M=p*p+d*d,S=g*g+_*_,T=(_*M-d*S)/y,x=(p*S-g*M)/y,v=G_.pop()||new aI;v.arc=r,v.site=a,v.x=T+f,v.y=(v.cy=x+h)+Math.sqrt(T*T+x*x),r.circle=v;for(var C=null,w=vu._;w;)if(v.y<w.y||v.y===w.y&&v.x<=w.x)if(w.L)w=w.L;else{C=w.P;break}else if(w.R)w=w.R;else{C=w;break}vu.insert(C,v),C||(cf=v)}}}}function sa(r){var t=r.circle;t&&(t.P||(cf=t.N),vu.remove(t),G_.push(t),mu(t),r.circle=null)}var W_=[];function uI(){mu(this),this.edge=this.site=this.circle=null}function H_(r){var t=W_.pop()||new uI;return t.site=r,t}function Od(r){sa(r),aa.remove(r),W_.push(r),mu(r)}function q_(r){var t=r.circle,e=t.x,o=t.cy,a=[e,o],l=r.P,f=r.N,h=[r];Od(r);for(var p=l;p.circle&&Math.abs(e-p.circle.x)<vn&&Math.abs(o-p.circle.cy)<vn;)l=p.P,h.unshift(p),Od(p),p=l;h.unshift(p),sa(p);for(var d=f;d.circle&&Math.abs(e-d.circle.x)<vn&&Math.abs(o-d.circle.cy)<vn;)f=d.N,h.push(d),Od(d),d=f;h.push(d),sa(d);var g=h.length,_;for(_=1;_<g;++_)d=h[_],p=h[_-1],dl(d.edge,p.site,d.site,a);p=h[0],d=h[g-1],d.edge=gu(p.site,d.site,null,a),oa(p),oa(d)}function X_(r){for(var t=r[0],e=r[1],o,a,l,f,h=aa._;h;)if(l=Y_(h,e)-t,l>vn)h=h.L;else if(f=t-lI(h,e),f>vn){if(!h.R){o=h;break}h=h.R}else{l>-vn?(o=h.P,a=h):f>-vn?(o=h,a=h.N):o=a=h;break}B_(r);var p=H_(r);if(aa.insert(o,p),!(!o&&!a)){if(o===a){sa(o),a=H_(o.site),aa.insert(p,a),p.edge=a.edge=gu(o.site,p.site),oa(o),oa(a);return}if(!a){p.edge=gu(o.site,p.site);return}sa(o),sa(a);var d=o.site,g=d[0],_=d[1],y=r[0]-g,M=r[1]-_,S=a.site,T=S[0]-g,x=S[1]-_,v=2*(y*x-M*T),C=y*y+M*M,w=T*T+x*x,O=[(x*C-M*w)/v+g,(y*w-T*C)/v+_];dl(a.edge,d,S,O),p.edge=gu(d,r,null,O),a.edge=gu(r,S,null,O),oa(o),oa(a)}}function Y_(r,t){var e=r.site,o=e[0],a=e[1],l=a-t;if(!l)return o;var f=r.P;if(!f)return-1/0;e=f.site;var h=e[0],p=e[1],d=p-t;if(!d)return h;var g=h-o,_=1/l-1/d,y=g/d;return _?(-y+Math.sqrt(y*y-2*_*(g*g/(-2*d)-p+d/2+a-l/2)))/_+o:(o+h)/2}function lI(r,t){var e=r.N;if(e)return Y_(e,t);var o=r.site;return o[1]===t?o[0]:1/0}var vn=1e-6,V_=1e-12,aa,ti,vu,xr;function cI(r,t,e){return(r[0]-e[0])*(t[1]-r[1])-(r[0]-t[0])*(e[1]-r[1])}function fI(r,t){return t[1]-r[1]||t[0]-r[0]}function ff(r,t){var e=r.sort(fI).pop(),o,a,l;for(xr=[],ti=new Array(r.length),aa=new Ld,vu=new Ld;;)if(l=cf,e&&(!l||e[1]<l.y||e[1]===l.y&&e[0]<l.x))(e[0]!==o||e[1]!==a)&&(X_(e),o=e[0],a=e[1]),e=r.pop();else if(l)q_(l.arc);else break;if(z_(),t){var f=+t[0][0],h=+t[0][1],p=+t[1][0],d=+t[1][1];U_(f,h,p,d),k_(f,h,p,d)}this.edges=xr,this.cells=ti,aa=vu=xr=ti=null}ff.prototype={constructor:ff,polygons:function(){var r=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return Nd(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(h=(l=e.halfedges).length)for(var a=e.site,l,f=-1,h,p,d=t[l[h-1]],g=d.left===a?d.right:d.left;++f<h;)p=g,d=t[l[f]],g=d.left===a?d.right:d.left,p&&g&&o<p.index&&o<g.index&&cI(a,p,g)<0&&r.push([a.data,p.data,g.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,l=o._found||0,f=o.cells.length,h;!(h=o.cells[l]);)if(++l>=f)return null;var p=r-h.site[0],d=t-h.site[1],g=p*p+d*d;do h=o.cells[a=l],l=null,h.halfedges.forEach(function(_){var y=o.edges[_],M=y.left;if(!((M===h.site||!M)&&!(M=y.right))){var S=r-M[0],T=t-M[1],x=S*S+T*T;x<g&&(g=x,l=M.index)}});while(l!==null);return o._found=a,e==null||g<=e*e?h.site:null}};var _I=Ln(_u(),1);var Zd=Ln(K_(),1);function ci(){return new df}function df(){this.reset()}df.prototype={constructor:df,reset:function(){this.s=this.t=0},add:function(r){Q_(pf,r,this.t),Q_(this,pf.s,this.s),this.s?this.t+=pf.t:this.s=pf.t},valueOf:function(){return this.s}};var pf=new df;function Q_(r,t,e){var o=r.s=t+e,a=o-t,l=o-a;r.t=t-l+(e-a)}var cn=1e-6;var mn=Math.PI,sr=mn/2,mf=mn/4,Mo=mn*2,ua=180/mn,fi=mn/180,zn=Math.abs,io=Math.atan,hi=Math.atan2,en=Math.cos;var gf=Math.exp;var ml=Math.log;var ye=Math.sin;var Rr=Math.sqrt,gl=Math.tan;function Ud(r){return r>1?0:r<-1?mn:Math.acos(r)}function ei(r){return r>1?sr:r<-1?-sr:Math.asin(r)}function oo(){}var xI=ci(),jk=ci();function la(r){var t=r[0],e=r[1],o=en(e);return[o*en(t),o*ye(t),ye(e)]}function yl(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 vl(r){var t=Rr(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}var lG=ci();function t1(r,t){return[r>mn?r-Mo:r<-mn?r+Mo:r,t]}t1.invert=t1;function Bd(){var r=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){r.push(t=[])},lineEnd:oo,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function zd(r,t){return zn(r[0]-t[0])<cn&&zn(r[1]-t[1])<cn}function yf(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 kd(r,t,e,o,a){var l=[],f=[],h,p;if(r.forEach(function(S){if(!((T=S.length-1)<=0)){var T,x=S[0],v=S[T],C;if(zd(x,v)){for(a.lineStart(),h=0;h<T;++h)a.point((x=S[h])[0],x[1]);a.lineEnd();return}l.push(C=new yf(x,S,null,!0)),f.push(C.o=new yf(x,null,C,!1)),l.push(C=new yf(v,S,null,!1)),f.push(C.o=new yf(v,null,C,!0))}}),!!l.length){for(f.sort(t),e1(l),e1(f),h=0,p=f.length;h<p;++h)f[h].e=e=!e;for(var d=l[0],g,_;;){for(var y=d,M=!0;y.v;)if((y=y.n)===d)return;g=y.z,a.lineStart();do{if(y.v=y.o.v=!0,y.e){if(M)for(h=0,p=g.length;h<p;++h)a.point((_=g[h])[0],_[1]);else o(y.x,y.n.x,1,a);y=y.n}else{if(M)for(g=y.p.z,h=g.length-1;h>=0;--h)a.point((_=g[h])[0],_[1]);else o(y.x,y.p.x,-1,a);y=y.p}y=y.o,g=y.z,M=!M}while(!y.v);a.lineEnd()}}}function e1(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 Cs(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function Gd(r){return r.length===1&&(r=wI(r)),{left:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)<0?o=l+1:a=l}return o},right:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)>0?a=l:o=l+1}return o}}}function wI(r){return function(t,e){return Cs(r(t),e)}}var n1=Gd(Cs),SI=n1.right,bI=n1.left;var r1=Array.prototype,AI=r1.slice,CI=r1.map;var e4=Math.sqrt(50),n4=Math.sqrt(10),r4=Math.sqrt(2);function _f(r){for(var t=r.length,e,o=-1,a=0,l,f;++o<t;)a+=r[o].length;for(l=new Array(a);--t>=0;)for(f=r[t],e=f.length;--e>=0;)l[--a]=f[e];return l}var FI=1e9,k5=-FI;var Vd=ci();function Hd(r,t){var e=t[0],o=t[1],a=[ye(e),-en(e),0],l=0,f=0;Vd.reset();for(var h=0,p=r.length;h<p;++h)if(g=(d=r[h]).length)for(var d,g,_=d[g-1],y=_[0],M=_[1]/2+mf,S=ye(M),T=en(M),x=0;x<g;++x,y=C,S=O,T=F,_=v){var v=d[x],C=v[0],w=v[1]/2+mf,O=ye(w),F=en(w),G=C-y,z=G>=0?1:-1,L=z*G,D=L>mn,q=S*O;if(Vd.add(hi(q*z*ye(L),T*F+q*en(L))),l+=D?G+z*Mo:G,D^y>=e^C>=e){var nt=yl(la(_),la(v));vl(nt);var k=yl(a,nt);vl(k);var xt=(D^G>=0?-1:1)*ei(k[2]);(o>xt||o===xt&&(nt[0]||nt[1]))&&(f+=D^G>=0?1:-1)}}return(l<-cn||l<cn&&Vd<-cn)^f&1}var J5=ci();var mV=ci(),gV=ci();var zI=1/0;var _V=-zI;function Wd(r){this._context=r}Wd.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,Mo);break}}},result:oo};var PV=ci();function qd(){this._string=[]}qd.prototype={_radius:4.5,_circle:s1(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=s1(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 s1(r){return"m0,"+r+"a"+r+","+r+" 0 1,1 0,"+-2*r+"a"+r+","+r+" 0 1,1 0,"+2*r+"z"}function Xd(r,t,e,o){return function(a,l){var f=t(l),h=a.invert(o[0],o[1]),p=Bd(),d=t(p),g=!1,_,y,M,S={point:T,lineStart:v,lineEnd:C,polygonStart:function(){S.point=w,S.lineStart=O,S.lineEnd=F,y=[],_=[]},polygonEnd:function(){S.point=T,S.lineStart=v,S.lineEnd=C,y=_f(y);var G=Hd(_,h);y.length?(g||(l.polygonStart(),g=!0),kd(y,VI,G,e,l)):G&&(g||(l.polygonStart(),g=!0),l.lineStart(),e(null,null,1,l),l.lineEnd()),g&&(l.polygonEnd(),g=!1),y=_=null},sphere:function(){l.polygonStart(),l.lineStart(),e(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function T(G,z){var L=a(G,z);r(G=L[0],z=L[1])&&l.point(G,z)}function x(G,z){var L=a(G,z);f.point(L[0],L[1])}function v(){S.point=x,f.lineStart()}function C(){S.point=T,f.lineEnd()}function w(G,z){M.push([G,z]);var L=a(G,z);d.point(L[0],L[1])}function O(){d.lineStart(),M=[]}function F(){w(M[0][0],M[0][1]),d.lineEnd();var G=d.clean(),z=p.result(),L,D=z.length,q,nt,k;if(M.pop(),_.push(M),M=null,!!D){if(G&1){if(nt=z[0],(q=nt.length-1)>0){for(g||(l.polygonStart(),g=!0),l.lineStart(),L=0;L<q;++L)l.point((k=nt[L])[0],k[1]);l.lineEnd()}return}D>1&&G&2&&z.push(z.pop().concat(z.shift())),y.push(z.filter(GI))}}return S}}function GI(r){return r.length>1}function VI(r,t){return((r=r.x)[0]<0?r[1]-sr-cn:sr-r[1])-((t=t.x)[0]<0?t[1]-sr-cn:sr-t[1])}var HI=Xd(function(){return!0},WI,XI,[-mn,-sr]);function WI(r){var t=NaN,e=NaN,o=NaN,a;return{lineStart:function(){r.lineStart(),a=1},point:function(l,f){var h=l>0?mn:-mn,p=zn(l-t);zn(p-mn)<cn?(r.point(t,e=(e+f)/2>0?sr:-sr),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(h,e),r.point(l,e),a=0):o!==h&&p>=mn&&(zn(t-o)<cn&&(t-=o*cn),zn(l-h)<cn&&(l-=h*cn),e=qI(t,e,l,f),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(h,e),a=0),r.point(t=l,e=f),o=h},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-a}}}function qI(r,t,e,o){var a,l,f=ye(r-e);return zn(f)>cn?io((ye(t)*(l=en(o))*ye(e)-ye(o)*(a=en(t))*ye(r))/(a*l*f)):(t+o)/2}function XI(r,t,e,o){var a;if(r==null)a=e*sr,o.point(-mn,a),o.point(0,a),o.point(mn,a),o.point(mn,0),o.point(mn,-a),o.point(0,-a),o.point(-mn,-a),o.point(-mn,0),o.point(-mn,a);else if(zn(r[0]-t[0])>cn){var l=r[0]<t[0]?mn:-mn;a=e*l/2,o.point(-l,a),o.point(0,a),o.point(l,a)}else o.point(t[0],t[1])}function xf(r){return function(t){var e=new Yd;for(var o in r)e[o]=r[o];return e.stream=t,e}}function Yd(){}Yd.prototype={constructor:Yd,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 gH=en(30*fi);var IH=xf({point:function(r,t){this.stream.point(r*fi,t*fi)}});function Ef(r){return function(t,e){var o=en(t),a=en(e),l=r(o*a);return[l*a*ye(t),l*ye(e)]}}function wo(r){return function(t,e){var o=Rr(t*t+e*e),a=r(o),l=ye(a),f=en(a);return[hi(t*l,o*f),ei(o&&e*l/o)]}}var p1=Ef(function(r){return Rr(2/(1+r))});p1.invert=wo(function(r){return 2*ei(r/2)});var d1=Ef(function(r){return(r=Ud(r))&&r/ye(r)});d1.invert=wo(function(r){return r});function $d(r,t){return[r,ml(gl((sr+t)/2))]}$d.invert=function(r,t){return[r,2*io(gf(t))-sr]};function Mf(r,t){return[r,t]}Mf.invert=Mf;function m1(r,t){var e=en(t),o=en(r)*e;return[e*ye(r)/o,ye(t)/o]}m1.invert=wo(io);function g1(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)))]}g1.invert=function(r,t){var e=t,o=25,a;do{var l=e*e,f=l*l;e-=a=(e*(1.007226+l*(.015085+f*(-.044475+.028874*l-.005916*f)))-t)/(1.007226+l*(.015085*3+f*(-.044475*7+.028874*9*l-.005916*11*f)))}while(zn(a)>cn&&--o>0);return[r/(.8707+(l=e*e)*(-.131979+l*(-.013791+l*l*l*(.003971-.001529*l)))),e]};function y1(r,t){return[en(t)*ye(r),ye(t)]}y1.invert=wo(ei);function v1(r,t){var e=en(t),o=1+en(r)*e;return[e*ye(r)/o,ye(t)/o]}v1.invert=wo(function(r){return 2*io(r)});function _1(r,t){return[ml(gl((sr+t)/2)),-r]}_1.invert=function(r,t){return[-t,2*io(gf(r))-sr]};var QI=Ln(_u(),1);var jI=Ln(_u(),1);var eR=Ln(_u(),1);var nR=Ln(_u(),1);function so(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}function _l(r){let t=0;for(let e=0;e<r.length-1;e++)t+=so(r[e],r[e+1]);return t}function E1(r,t,e){let o=new fn(t[0]-r[0],t[1]-r[1]),a=new fn(t[0]-e[0],t[1]-e[1]),f=o.angleTo(a)*180/Math.PI,h=new fn(t[0]-r[0],t[1]-r[1]);return new fn(e[0]-r[0],e[1]-r[1]).cross(h)>0?f:-f}var pi="___",wf=class{constructor(t=3){this.lift_priority=t;dn(this,"roadInfo",[]);dn(this,"pointMap",new Map);dn(this,"nodeMap",new Map);dn(this,"facilityMap",new Map);dn(this,"straightLadderMap",new Map);dn(this,"escalatorMap",new Map);dn(this,"staircaseMap",new Map);dn(this,"parkingMap",new Map);dn(this,"lineMap",new Map);dn(this,"baseRoute",new Bi.default);dn(this,"escalatorRoute",new Bi.default);dn(this,"straightLadderRoute",new Bi.default);dn(this,"forwardLineMap",new Map);dn(this,"forwardRoute",new Bi.default)}initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(o=>{let a=\`\${e.floor}\${pi}\${o.id}\`;if(this.pointMap.set(a,o),this.nodeMap.set(\`\${o.floor}\${pi}\${o.nodeId}\`,a),o.type==="straightLadder"){let l=this.straightLadderMap.get(o.name)||[];l.push(ls({},o)),this.straightLadderMap.set(o.name,l)}if(o.type==="staircase"){let l=this.staircaseMap.get(o.name)||[];l.push(ls({},o)),this.staircaseMap.set(o.name,l)}if(o.type==="escalator"){let l=this.escalatorMap.get(o.name)||{};o.escalatorDirection==="exit"?l.end={floor:o.floor,id:o.id}:l.start={floor:o.floor,id:o.id},this.escalatorMap.set(o.name,l)}if(o.type==="facility"){let l=this.facilityMap.get(o.targetId)||[];l.push(ls({},o)),this.facilityMap.set(o.targetId,l)}o.type==="parkingSpace"&&this.parkingMap.set(\`\${o.floor}\${pi}\${o.name}\`,o)}),e.lines.filter(o=>o.direction!=="no").forEach(o=>{var p,d;let a=\`\${e.floor}\${pi}\${o.from}\`,l=\`\${e.floor}\${pi}\${o.to}\`,f=(p=this.pointMap.get(a))==null?void 0:p.cds,h=(d=this.pointMap.get(l))==null?void 0:d.cds;if(f!=null&&f.length&&(h!=null&&h.length)){let g=so(f,h);switch(this.addLineItem(a,l,g),this.addLineItem(l,a,g),o.direction){case"double":this.addLineItem(a,l,g,this.forwardLineMap),this.addLineItem(l,a,g,this.forwardLineMap);break;case"single":this.addLineItem(a,l,g,this.forwardLineMap);break;case"back":this.addLineItem(l,a,g,this.forwardLineMap);break}}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}addLineItem(t,e,o,a=this.lineMap){let l=a.get(t)||new Map;l.set(e,o),a.set(t,l)}addFacilityToLineMap(t,e,o,a){[...this.straightLadderMap,...this.staircaseMap].forEach(([l,f])=>{var h,p;if(!(f.length<2))for(let d=0;d<f.length;d++){let g=\`\${f[d].floor}\${pi}\${f[d].id}\`;for(let _=0;_<f.length;_++)if(d!==_){let y=\`\${f[_].floor}\${pi}\${f[_].id}\`,M=(h=this.pointMap.get(g))==null?void 0:h.cds,S=(p=this.pointMap.get(y))==null?void 0:p.cds;if(M!=null&&M.length&&(S!=null&&S.length))if(f[d].type==="straightLadder"){let T=e;this.addLineItem(g,y,T,a)}else{let T=o;this.addLineItem(g,y,T,a)}}}}),this.escalatorMap.forEach((l,f)=>{var h,p;if(l.start&&l.end){let d=\`\${l.start.floor}\${pi}\${l.start.id}\`,g=\`\${l.end.floor}\${pi}\${l.end.id}\`,_=(h=this.pointMap.get(d))==null?void 0:h.cds,y=(p=this.pointMap.get(g))==null?void 0:p.cds;if(_!=null&&_.length&&(y!=null&&y.length)){let M=t;this.addLineItem(d,g,M,a)}}})}initBaseRoute(){let t=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,t),this.baseRoute=new Bi.default(t)}initEscalatorRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new Bi.default(t)}initStraightLadderRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new Bi.default(t)}initForwardRoute(){this.forwardRoute=new Bi.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}\${pi}\${t.nodeId}\`);if(o){let[a,l]=o.split(pi);return{floor:a,id:l}}}if((e=t.coord)!=null&&e.length){let o=this.roadInfo.find(l=>l.floor===t.floor);if(!o)return null;let a=o.points.reduce((l,f)=>{let h=so(t.coord,f.cds);return h<l.min&&(l.min=h,l.point=f),l},{min:1/0,point:o.points[0]});return{floor:a.point.floor,id:a.point.id}}return null}transformEnd(t){if(t.floor){if(t.parkingSpace){let o=this.parkingMap.get(\`\${t.floor}\${pi}\${t.parkingSpace}\`);if(o)return{floor:o.floor,id:o.id}}let e=this.transformStart(t);if(e)return e}if(t.facility){let e=this.facilityMap.get(t.facility);if(e!=null&&e.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o=""){if(!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let a=this.transformStart(t);if(!a)return"no-start";let l=this.transformEnd(e);if(!l)return"no-end";let f=this.getBasePath.bind(this);switch(o){case"escalator":f=this.getEscalatorPath.bind(this);case"straightLadder":f=this.getStraightLadderPath.bind(this);case"forward":f=this.getForwardPath.bind(this);default:f=this.getBasePath.bind(this)}if(l.id)return f(a,l);if(l.facility){let h=this.facilityMap.get(l.facility).filter(d=>l.floor?d.floor===l.floor:!0);if(!h.length)return null;let p=h.map(d=>f(a,{floor:d.floor,id:d.id})).filter(d=>!!d);return p.reduce((d,g)=>{let _=g.reduce((y,M)=>y+_l(M.points),0);return _<d.distance&&(d.distance=_,d.path=g),d},{distance:1/0,path:p[0]}).path}}getRoutePath(t,e,o){let a=\`\${t.floor}\${pi}\${t.id}\`,l=\`\${e.floor}\${pi}\${e.id}\`,f=o.path(a,l);if(!f)return null;let h=[];return f.map(p=>{var g;let d=this.pointMap.get(p);if(d){let{floor:_}=d;if(((g=h[h.length-1])==null?void 0:g.floor)===_){let y=h[h.length-1];y.points.push(d.cds),y.endType=d.type,y.destId=d.nodeId,y.distance=_l(y.points)}else h.push({floor:_,points:[d.cds],endType:d.type,destId:d.nodeId,distance:0})}}),h}getBasePath(t,e){return this.getRoutePath(t,e,this.baseRoute)}getEscalatorPath(t,e){return this.getRoutePath(t,e,this.escalatorRoute)}getStraightLadderPath(t,e){return this.getRoutePath(t,e,this.straightLadderRoute)}getForwardPath(t,e){return this.getRoutePath(t,e,this.forwardRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new Bi.default,this.escalatorRoute=new Bi.default,this.straightLadderRoute=new Bi.default}};function M1(r,t){return new Promise((e,o)=>{let a=new XMLHttpRequest;a.open("GET",r,!0),Object.keys(t.headers||{}).forEach(l=>{a.setRequestHeader(l,t.headers[l])}),t.responseType&&(a.responseType=t.responseType),a.onload=()=>{if(a.status>=200&&a.status<300)if(t.responseType==="arraybuffer")e(a.response);else try{let l=JSON.parse(a.responseText);e(l)}catch(l){o(l)}else o(a.statusText)},a.onerror=()=>{o(a.statusText)},a.send()})}var fR=Ln(A1(),1);function hR(r,t,e){let o=E1(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 C1(r){let t=[{direction:"start",distance:so(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let o=hR(r[e-2],r[e-1],r[e]);if(o==="front"){let a=t[t.length-1],l=so(r[e-1],r[e]);a.distance+=l,e!==2&&a.points.push(r[e-1])}else t.push({direction:o,distance:so(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}var So=Ln(kf(),1);var zi="___",xl=class{constructor(t=3){this.lift_priority=t;dn(this,"roadInfo",[]);dn(this,"pointMap",new Map);dn(this,"nodeMap",new Map);dn(this,"facilityMap",new Map);dn(this,"straightLadderMap",new Map);dn(this,"escalatorMap",new Map);dn(this,"staircaseMap",new Map);dn(this,"lineMap",new Map);dn(this,"baseRoute",new So.default);dn(this,"escalatorRoute",new So.default);dn(this,"straightLadderRoute",new So.default)}initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(o=>{let a=\`\${e.floor}\${zi}\${o.id}\`;if(this.pointMap.set(a,o),this.nodeMap.set(\`\${o.floor}\${zi}\${o.nodeId}\`,a),o.type==="straightLadder"){let l=this.straightLadderMap.get(o.name)||[];l.push(ls({},o)),this.straightLadderMap.set(o.name,l)}if(o.type==="staircase"){let l=this.staircaseMap.get(o.name)||[];l.push(ls({},o)),this.staircaseMap.set(o.name,l)}if(o.type==="escalator"){let l=this.escalatorMap.get(o.name)||{};o.escalatorDirection==="exit"?l.end={floor:o.floor,id:o.id}:l.start={floor:o.floor,id:o.id},this.escalatorMap.set(o.name,l)}if(o.type==="facility"){let l=this.facilityMap.get(o.targetId)||[];l.push(ls({},o)),this.facilityMap.set(o.targetId,l)}}),e.lines.filter(o=>o.direction!=="no").forEach(o=>{var p,d;let a=\`\${e.floor}\${zi}\${o.from}\`,l=\`\${e.floor}\${zi}\${o.to}\`,f=(p=this.pointMap.get(a))==null?void 0:p.cds,h=(d=this.pointMap.get(l))==null?void 0:d.cds;if(f!=null&&f.length&&(h!=null&&h.length)){let g=so(f,h);this.addLineItem(a,l,g),o.direction==="double"&&this.addLineItem(l,a,g)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(t,e,o,a=this.lineMap){let l=a.get(t)||new Map;l.set(e,o),a.set(t,l)}addFacilityToLineMap(t,e,o,a){[...this.straightLadderMap,...this.staircaseMap].forEach(([l,f])=>{var h,p;if(!(f.length<2))for(let d=0;d<f.length;d++){let g=\`\${f[d].floor}\${zi}\${f[d].id}\`;for(let _=0;_<f.length;_++)if(d!==_){let y=\`\${f[_].floor}\${zi}\${f[_].id}\`,M=(h=this.pointMap.get(g))==null?void 0:h.cds,S=(p=this.pointMap.get(y))==null?void 0:p.cds;if(M!=null&&M.length&&(S!=null&&S.length))if(f[d].type==="straightLadder"){let T=e;this.addLineItem(g,y,T,a)}else{let T=o;this.addLineItem(g,y,T,a)}}}}),this.escalatorMap.forEach((l,f)=>{var h,p;if(l.start&&l.end){let d=\`\${l.start.floor}\${zi}\${l.start.id}\`,g=\`\${l.end.floor}\${zi}\${l.end.id}\`,_=(h=this.pointMap.get(d))==null?void 0:h.cds,y=(p=this.pointMap.get(g))==null?void 0:p.cds;if(_!=null&&_.length&&(y!=null&&y.length)){let M=t;this.addLineItem(d,g,M,a)}}})}initBaseRoute(){let t=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,t),this.baseRoute=new So.default(t)}initEscalatorRoute(){let t=new Map([...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([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new So.default(t)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility?!0:this.checkStart(t)}transformStart(t){var e;if(t.nodeId){let o=this.nodeMap.get(\`\${t.floor}\${zi}\${t.nodeId}\`);if(o){let[a,l]=o.split(zi);return{floor:a,id:l}}}if((e=t.coord)!=null&&e.length){let o=this.roadInfo.find(l=>l.floor===t.floor);if(!o)return null;let a=o.points.reduce((l,f)=>{let h=so(t.coord,f.cds);return h<l.min&&(l.min=h,l.point=f),l},{min:1/0,point:o.points[0]});return{floor:a.point.floor,id:a.point.id}}return null}transformEnd(t){if(t.floor){let e=this.transformStart(t);if(e)return e}if(t.facility){let e=this.facilityMap.get(t.facility);if(e!=null&&e.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o=""){if(!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let a=this.transformStart(t);if(!a)return"no-start";let l=this.transformEnd(e);if(!l)return"no-end";let f=this.getBasePath.bind(this);switch(o){case"escalator":f=this.getEscalatorPath.bind(this);case"straightLadder":f=this.getStraightLadderPath.bind(this);default:f=this.getBasePath.bind(this)}if(console.log(a,l),l.id)return f(a,l);if(l.facility){let h=this.facilityMap.get(l.facility).filter(d=>l.floor?d.floor===l.floor:!0);if(!h.length)return null;let p=h.map(d=>f(a,{floor:d.floor,id:d.id})).filter(d=>!!d);return p.reduce((d,g)=>{let _=g.reduce((y,M)=>y+_l(M.points),0);return _<d.distance&&(d.distance=_,d.path=g),d},{distance:1/0,path:p[0]}).path}}getRoutePath(t,e,o){let a=\`\${t.floor}\${zi}\${t.id}\`,l=\`\${e.floor}\${zi}\${e.id}\`,f=o.path(a,l);if(console.log(a,l,f),!f)return null;let h=[];return f.map(p=>{var g;let d=this.pointMap.get(p);if(d){let{floor:_}=d;if(((g=h[h.length-1])==null?void 0:g.floor)===_){let y=h[h.length-1];y.points.push(d.cds),y.endType=d.type,y.destId=d.nodeId}else h.push({floor:_,points:[d.cds],endType:d.type,destId:d.nodeId})}}),h}getBasePath(t,e){return this.getRoutePath(t,e,this.baseRoute)}getEscalatorPath(t,e){return this.getRoutePath(t,e,this.escalatorRoute)}getStraightLadderPath(t,e){return this.getRoutePath(t,e,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 So.default,this.escalatorRoute=new So.default,this.straightLadderRoute=new So.default}};function P1(r){return r.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}var Sf=class r{constructor(){dn(this,"keySet",new Set)}static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}genUniqueKey(){let t=r.createKey();for(;this.keySet.has(t);)t=r.createKey();return t}removeKey(t){this.keySet.delete(t)}dispose(){this.keySet.clear()}};var K9=new Sf;function I1(r){let t={};for(let o in r)o.startsWith("on")&&(t[P1(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 El=new xl;I1({onChangeRoadNetwork(r){switch(r){case"RoadNetwork":El=new xl;break;case"RoadNetwork2":El=new wf;break}},onLoadRoad:async r=>{let e=(await M1(r.url,r)).data.map(o=>JSON.parse(o.road_info));return El.initRoute(e),e},onSetRoadInfo(r){El.initRoute(r)},onGetPath({start:r,end:t,type:e}){return El.getPath(r,t,e)},onGetDirectionPath(r){return C1(r)}});
|
|
3671
|
+
\`)};function lf(r,t,e){this.x=r,this.y=t,this.weight=e}lf.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};lf.prototype.getCost=function(r){return r&&r.x!==this.x&&r.y!==this.y?this.weight*1.41421:this.weight};lf.prototype.isWall=function(){return this.weight===0};function D_(r){this.content=[],this.scoreFunction=r}D_.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,l=a-1,f=null,h;if(l<t){var p=this.content[l];h=this.scoreFunction(p),h<o&&(f=l)}if(a<t){var d=this.content[a],g=this.scoreFunction(d);g<(f===null?o:h)&&(f=a)}if(f!==null)this.content[r]=this.content[f],this.content[f]=e,r=f;else break}}};function Rd(){this._=null}function mu(r){r.U=r.C=r.L=r.R=r.P=r.N=null}Rd.prototype={constructor:Rd,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=F_(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&&(hl(this,e),r=e,e=r.U),e.C=!1,o.C=!0,pl(this,o))):(a=o.L,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.L&&(pl(this,e),r=e,e=r.U),e.C=!1,o.C=!0,hl(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,l,f;if(o?a?l=F_(a):l=o:l=a,t?t.L===r?t.L=l:t.R=l:this._=l,o&&a?(f=l.C,l.C=r.C,l.L=o,o.U=l,l!==a?(t=l.U,l.U=r.U,r=l.R,t.L=r,l.R=a,a.U=l):(l.U=t,t=l,r=l.R)):(f=r.C,r=l),r&&(r.U=t),!f){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,hl(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,pl(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,hl(this,t),r=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,pl(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,hl(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,pl(this,t),r=this._;break}e.C=!0,r=t,t=t.U}while(!r.C);r&&(r.C=!1)}}};function hl(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 pl(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 F_(r){for(;r.L;)r=r.L;return r}var Ld=Rd;function gu(r,t,e,o){var a=[null,null],l=xr.push(a)-1;return a.left=r,a.right=t,e&&dl(a,r,t,e),o&&dl(a,t,r,o),ti[r.index].halfedges.push(l),ti[t.index].halfedges.push(l),a}function yu(r,t,e){var o=[t,e];return o.left=r,o}function dl(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 rI(r,t,e,o,a){var l=r[0],f=r[1],h=l[0],p=l[1],d=f[0],g=f[1],_=0,y=1,M=d-h,S=g-p,T;if(T=t-h,!(!M&&T>0)){if(T/=M,M<0){if(T<_)return;T<y&&(y=T)}else if(M>0){if(T>y)return;T>_&&(_=T)}if(T=o-h,!(!M&&T<0)){if(T/=M,M<0){if(T>y)return;T>_&&(_=T)}else if(M>0){if(T<_)return;T<y&&(y=T)}if(T=e-p,!(!S&&T>0)){if(T/=S,S<0){if(T<_)return;T<y&&(y=T)}else if(S>0){if(T>y)return;T>_&&(_=T)}if(T=a-p,!(!S&&T<0)){if(T/=S,S<0){if(T>y)return;T>_&&(_=T)}else if(S>0){if(T<_)return;T<y&&(y=T)}return!(_>0)&&!(y<1)||(_>0&&(r[0]=[h+_*M,p+_*S]),y<1&&(r[1]=[h+y*M,p+y*S])),!0}}}}}function iI(r,t,e,o,a){var l=r[1];if(l)return!0;var f=r[0],h=r.left,p=r.right,d=h[0],g=h[1],_=p[0],y=p[1],M=(d+_)/2,S=(g+y)/2,T,x;if(y===g){if(M<t||M>=o)return;if(d>_){if(!f)f=[M,e];else if(f[1]>=a)return;l=[M,a]}else{if(!f)f=[M,a];else if(f[1]<e)return;l=[M,e]}}else if(T=(d-_)/(y-g),x=S-T*M,T<-1||T>1)if(d>_){if(!f)f=[(e-x)/T,e];else if(f[1]>=a)return;l=[(a-x)/T,a]}else{if(!f)f=[(a-x)/T,a];else if(f[1]<e)return;l=[(e-x)/T,e]}else if(g<y){if(!f)f=[t,T*t+x];else if(f[0]>=o)return;l=[o,T*o+x]}else{if(!f)f=[o,T*o+x];else if(f[0]<t)return;l=[t,T*t+x]}return r[0]=f,r[1]=l,!0}function U_(r,t,e,o){for(var a=xr.length,l;a--;)(!iI(l=xr[a],r,t,e,o)||!rI(l,r,t,e,o)||!(Math.abs(l[0][0]-l[1][0])>vn||Math.abs(l[0][1]-l[1][1])>vn))&&delete xr[a]}function B_(r){return ti[r.index]={site:r,halfedges:[]}}function oI(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 Nd(r,t){return t[+(t.left!==r.site)]}function sI(r,t){return t[+(t.left===r.site)]}function z_(){for(var r=0,t=ti.length,e,o,a,l;r<t;++r)if((e=ti[r])&&(l=(o=e.halfedges).length)){var f=new Array(l),h=new Array(l);for(a=0;a<l;++a)f[a]=a,h[a]=oI(e,xr[o[a]]);for(f.sort(function(p,d){return h[d]-h[p]}),a=0;a<l;++a)h[a]=o[f[a]];for(a=0;a<l;++a)o[a]=h[a]}}function k_(r,t,e,o){var a=ti.length,l,f,h,p,d,g,_,y,M,S,T,x,v=!0;for(l=0;l<a;++l)if(f=ti[l]){for(h=f.site,d=f.halfedges,p=d.length;p--;)xr[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)S=sI(f,xr[d[p]]),T=S[0],x=S[1],_=Nd(f,xr[d[++p%g]]),y=_[0],M=_[1],(Math.abs(T-y)>vn||Math.abs(x-M)>vn)&&(d.splice(p,0,xr.push(yu(h,S,Math.abs(T-r)<vn&&o-x>vn?[r,Math.abs(y-r)<vn?M:o]:Math.abs(x-o)<vn&&e-T>vn?[Math.abs(M-o)<vn?y:e,o]:Math.abs(T-e)<vn&&x-t>vn?[e,Math.abs(y-e)<vn?M:t]:Math.abs(x-t)<vn&&T-r>vn?[Math.abs(M-t)<vn?y:r,t]:null))-1),++g);g&&(v=!1)}if(v){var C,w,O,F=1/0;for(l=0,v=null;l<a;++l)(f=ti[l])&&(h=f.site,C=h[0]-r,w=h[1]-t,O=C*C+w*w,O<F&&(F=O,v=f));if(v){var G=[r,t],z=[r,o],L=[e,o],D=[e,t];v.halfedges.push(xr.push(yu(h=v.site,G,z))-1,xr.push(yu(h,z,L))-1,xr.push(yu(h,L,D))-1,xr.push(yu(h,D,G))-1)}}for(l=0;l<a;++l)(f=ti[l])&&(f.halfedges.length||delete ti[l])}var G_=[],cf;function aI(){mu(this),this.x=this.y=this.arc=this.site=this.cy=null}function oa(r){var t=r.P,e=r.N;if(!(!t||!e)){var o=t.site,a=r.site,l=e.site;if(o!==l){var f=a[0],h=a[1],p=o[0]-f,d=o[1]-h,g=l[0]-f,_=l[1]-h,y=2*(p*_-d*g);if(!(y>=-V_)){var M=p*p+d*d,S=g*g+_*_,T=(_*M-d*S)/y,x=(p*S-g*M)/y,v=G_.pop()||new aI;v.arc=r,v.site=a,v.x=T+f,v.y=(v.cy=x+h)+Math.sqrt(T*T+x*x),r.circle=v;for(var C=null,w=vu._;w;)if(v.y<w.y||v.y===w.y&&v.x<=w.x)if(w.L)w=w.L;else{C=w.P;break}else if(w.R)w=w.R;else{C=w;break}vu.insert(C,v),C||(cf=v)}}}}function sa(r){var t=r.circle;t&&(t.P||(cf=t.N),vu.remove(t),G_.push(t),mu(t),r.circle=null)}var W_=[];function uI(){mu(this),this.edge=this.site=this.circle=null}function H_(r){var t=W_.pop()||new uI;return t.site=r,t}function Od(r){sa(r),aa.remove(r),W_.push(r),mu(r)}function q_(r){var t=r.circle,e=t.x,o=t.cy,a=[e,o],l=r.P,f=r.N,h=[r];Od(r);for(var p=l;p.circle&&Math.abs(e-p.circle.x)<vn&&Math.abs(o-p.circle.cy)<vn;)l=p.P,h.unshift(p),Od(p),p=l;h.unshift(p),sa(p);for(var d=f;d.circle&&Math.abs(e-d.circle.x)<vn&&Math.abs(o-d.circle.cy)<vn;)f=d.N,h.push(d),Od(d),d=f;h.push(d),sa(d);var g=h.length,_;for(_=1;_<g;++_)d=h[_],p=h[_-1],dl(d.edge,p.site,d.site,a);p=h[0],d=h[g-1],d.edge=gu(p.site,d.site,null,a),oa(p),oa(d)}function X_(r){for(var t=r[0],e=r[1],o,a,l,f,h=aa._;h;)if(l=Y_(h,e)-t,l>vn)h=h.L;else if(f=t-lI(h,e),f>vn){if(!h.R){o=h;break}h=h.R}else{l>-vn?(o=h.P,a=h):f>-vn?(o=h,a=h.N):o=a=h;break}B_(r);var p=H_(r);if(aa.insert(o,p),!(!o&&!a)){if(o===a){sa(o),a=H_(o.site),aa.insert(p,a),p.edge=a.edge=gu(o.site,p.site),oa(o),oa(a);return}if(!a){p.edge=gu(o.site,p.site);return}sa(o),sa(a);var d=o.site,g=d[0],_=d[1],y=r[0]-g,M=r[1]-_,S=a.site,T=S[0]-g,x=S[1]-_,v=2*(y*x-M*T),C=y*y+M*M,w=T*T+x*x,O=[(x*C-M*w)/v+g,(y*w-T*C)/v+_];dl(a.edge,d,S,O),p.edge=gu(d,r,null,O),a.edge=gu(r,S,null,O),oa(o),oa(a)}}function Y_(r,t){var e=r.site,o=e[0],a=e[1],l=a-t;if(!l)return o;var f=r.P;if(!f)return-1/0;e=f.site;var h=e[0],p=e[1],d=p-t;if(!d)return h;var g=h-o,_=1/l-1/d,y=g/d;return _?(-y+Math.sqrt(y*y-2*_*(g*g/(-2*d)-p+d/2+a-l/2)))/_+o:(o+h)/2}function lI(r,t){var e=r.N;if(e)return Y_(e,t);var o=r.site;return o[1]===t?o[0]:1/0}var vn=1e-6,V_=1e-12,aa,ti,vu,xr;function cI(r,t,e){return(r[0]-e[0])*(t[1]-r[1])-(r[0]-t[0])*(e[1]-r[1])}function fI(r,t){return t[1]-r[1]||t[0]-r[0]}function ff(r,t){var e=r.sort(fI).pop(),o,a,l;for(xr=[],ti=new Array(r.length),aa=new Ld,vu=new Ld;;)if(l=cf,e&&(!l||e[1]<l.y||e[1]===l.y&&e[0]<l.x))(e[0]!==o||e[1]!==a)&&(X_(e),o=e[0],a=e[1]),e=r.pop();else if(l)q_(l.arc);else break;if(z_(),t){var f=+t[0][0],h=+t[0][1],p=+t[1][0],d=+t[1][1];U_(f,h,p,d),k_(f,h,p,d)}this.edges=xr,this.cells=ti,aa=vu=xr=ti=null}ff.prototype={constructor:ff,polygons:function(){var r=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return Nd(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(h=(l=e.halfedges).length)for(var a=e.site,l,f=-1,h,p,d=t[l[h-1]],g=d.left===a?d.right:d.left;++f<h;)p=g,d=t[l[f]],g=d.left===a?d.right:d.left,p&&g&&o<p.index&&o<g.index&&cI(a,p,g)<0&&r.push([a.data,p.data,g.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,l=o._found||0,f=o.cells.length,h;!(h=o.cells[l]);)if(++l>=f)return null;var p=r-h.site[0],d=t-h.site[1],g=p*p+d*d;do h=o.cells[a=l],l=null,h.halfedges.forEach(function(_){var y=o.edges[_],M=y.left;if(!((M===h.site||!M)&&!(M=y.right))){var S=r-M[0],T=t-M[1],x=S*S+T*T;x<g&&(g=x,l=M.index)}});while(l!==null);return o._found=a,e==null||g<=e*e?h.site:null}};var _I=Ln(_u(),1);var Zd=Ln(K_(),1);function ci(){return new df}function df(){this.reset()}df.prototype={constructor:df,reset:function(){this.s=this.t=0},add:function(r){Q_(pf,r,this.t),Q_(this,pf.s,this.s),this.s?this.t+=pf.t:this.s=pf.t},valueOf:function(){return this.s}};var pf=new df;function Q_(r,t,e){var o=r.s=t+e,a=o-t,l=o-a;r.t=t-l+(e-a)}var cn=1e-6;var mn=Math.PI,sr=mn/2,mf=mn/4,Mo=mn*2,ua=180/mn,fi=mn/180,zn=Math.abs,io=Math.atan,hi=Math.atan2,en=Math.cos;var gf=Math.exp;var ml=Math.log;var ve=Math.sin;var Rr=Math.sqrt,gl=Math.tan;function Ud(r){return r>1?0:r<-1?mn:Math.acos(r)}function ei(r){return r>1?sr:r<-1?-sr:Math.asin(r)}function oo(){}var xI=ci(),jk=ci();function la(r){var t=r[0],e=r[1],o=en(e);return[o*en(t),o*ve(t),ve(e)]}function yl(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 vl(r){var t=Rr(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}var lG=ci();function t1(r,t){return[r>mn?r-Mo:r<-mn?r+Mo:r,t]}t1.invert=t1;function Bd(){var r=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){r.push(t=[])},lineEnd:oo,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function zd(r,t){return zn(r[0]-t[0])<cn&&zn(r[1]-t[1])<cn}function yf(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 kd(r,t,e,o,a){var l=[],f=[],h,p;if(r.forEach(function(S){if(!((T=S.length-1)<=0)){var T,x=S[0],v=S[T],C;if(zd(x,v)){for(a.lineStart(),h=0;h<T;++h)a.point((x=S[h])[0],x[1]);a.lineEnd();return}l.push(C=new yf(x,S,null,!0)),f.push(C.o=new yf(x,null,C,!1)),l.push(C=new yf(v,S,null,!1)),f.push(C.o=new yf(v,null,C,!0))}}),!!l.length){for(f.sort(t),e1(l),e1(f),h=0,p=f.length;h<p;++h)f[h].e=e=!e;for(var d=l[0],g,_;;){for(var y=d,M=!0;y.v;)if((y=y.n)===d)return;g=y.z,a.lineStart();do{if(y.v=y.o.v=!0,y.e){if(M)for(h=0,p=g.length;h<p;++h)a.point((_=g[h])[0],_[1]);else o(y.x,y.n.x,1,a);y=y.n}else{if(M)for(g=y.p.z,h=g.length-1;h>=0;--h)a.point((_=g[h])[0],_[1]);else o(y.x,y.p.x,-1,a);y=y.p}y=y.o,g=y.z,M=!M}while(!y.v);a.lineEnd()}}}function e1(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 Cs(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function Gd(r){return r.length===1&&(r=wI(r)),{left:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)<0?o=l+1:a=l}return o},right:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)>0?a=l:o=l+1}return o}}}function wI(r){return function(t,e){return Cs(r(t),e)}}var n1=Gd(Cs),SI=n1.right,bI=n1.left;var r1=Array.prototype,AI=r1.slice,CI=r1.map;var e4=Math.sqrt(50),n4=Math.sqrt(10),r4=Math.sqrt(2);function _f(r){for(var t=r.length,e,o=-1,a=0,l,f;++o<t;)a+=r[o].length;for(l=new Array(a);--t>=0;)for(f=r[t],e=f.length;--e>=0;)l[--a]=f[e];return l}var FI=1e9,k5=-FI;var Vd=ci();function Hd(r,t){var e=t[0],o=t[1],a=[ve(e),-en(e),0],l=0,f=0;Vd.reset();for(var h=0,p=r.length;h<p;++h)if(g=(d=r[h]).length)for(var d,g,_=d[g-1],y=_[0],M=_[1]/2+mf,S=ve(M),T=en(M),x=0;x<g;++x,y=C,S=O,T=F,_=v){var v=d[x],C=v[0],w=v[1]/2+mf,O=ve(w),F=en(w),G=C-y,z=G>=0?1:-1,L=z*G,D=L>mn,q=S*O;if(Vd.add(hi(q*z*ve(L),T*F+q*en(L))),l+=D?G+z*Mo:G,D^y>=e^C>=e){var nt=yl(la(_),la(v));vl(nt);var k=yl(a,nt);vl(k);var xt=(D^G>=0?-1:1)*ei(k[2]);(o>xt||o===xt&&(nt[0]||nt[1]))&&(f+=D^G>=0?1:-1)}}return(l<-cn||l<cn&&Vd<-cn)^f&1}var J5=ci();var mV=ci(),gV=ci();var zI=1/0;var _V=-zI;function Wd(r){this._context=r}Wd.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,Mo);break}}},result:oo};var PV=ci();function qd(){this._string=[]}qd.prototype={_radius:4.5,_circle:s1(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=s1(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 s1(r){return"m0,"+r+"a"+r+","+r+" 0 1,1 0,"+-2*r+"a"+r+","+r+" 0 1,1 0,"+2*r+"z"}function Xd(r,t,e,o){return function(a,l){var f=t(l),h=a.invert(o[0],o[1]),p=Bd(),d=t(p),g=!1,_,y,M,S={point:T,lineStart:v,lineEnd:C,polygonStart:function(){S.point=w,S.lineStart=O,S.lineEnd=F,y=[],_=[]},polygonEnd:function(){S.point=T,S.lineStart=v,S.lineEnd=C,y=_f(y);var G=Hd(_,h);y.length?(g||(l.polygonStart(),g=!0),kd(y,VI,G,e,l)):G&&(g||(l.polygonStart(),g=!0),l.lineStart(),e(null,null,1,l),l.lineEnd()),g&&(l.polygonEnd(),g=!1),y=_=null},sphere:function(){l.polygonStart(),l.lineStart(),e(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function T(G,z){var L=a(G,z);r(G=L[0],z=L[1])&&l.point(G,z)}function x(G,z){var L=a(G,z);f.point(L[0],L[1])}function v(){S.point=x,f.lineStart()}function C(){S.point=T,f.lineEnd()}function w(G,z){M.push([G,z]);var L=a(G,z);d.point(L[0],L[1])}function O(){d.lineStart(),M=[]}function F(){w(M[0][0],M[0][1]),d.lineEnd();var G=d.clean(),z=p.result(),L,D=z.length,q,nt,k;if(M.pop(),_.push(M),M=null,!!D){if(G&1){if(nt=z[0],(q=nt.length-1)>0){for(g||(l.polygonStart(),g=!0),l.lineStart(),L=0;L<q;++L)l.point((k=nt[L])[0],k[1]);l.lineEnd()}return}D>1&&G&2&&z.push(z.pop().concat(z.shift())),y.push(z.filter(GI))}}return S}}function GI(r){return r.length>1}function VI(r,t){return((r=r.x)[0]<0?r[1]-sr-cn:sr-r[1])-((t=t.x)[0]<0?t[1]-sr-cn:sr-t[1])}var HI=Xd(function(){return!0},WI,XI,[-mn,-sr]);function WI(r){var t=NaN,e=NaN,o=NaN,a;return{lineStart:function(){r.lineStart(),a=1},point:function(l,f){var h=l>0?mn:-mn,p=zn(l-t);zn(p-mn)<cn?(r.point(t,e=(e+f)/2>0?sr:-sr),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(h,e),r.point(l,e),a=0):o!==h&&p>=mn&&(zn(t-o)<cn&&(t-=o*cn),zn(l-h)<cn&&(l-=h*cn),e=qI(t,e,l,f),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(h,e),a=0),r.point(t=l,e=f),o=h},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-a}}}function qI(r,t,e,o){var a,l,f=ve(r-e);return zn(f)>cn?io((ve(t)*(l=en(o))*ve(e)-ve(o)*(a=en(t))*ve(r))/(a*l*f)):(t+o)/2}function XI(r,t,e,o){var a;if(r==null)a=e*sr,o.point(-mn,a),o.point(0,a),o.point(mn,a),o.point(mn,0),o.point(mn,-a),o.point(0,-a),o.point(-mn,-a),o.point(-mn,0),o.point(-mn,a);else if(zn(r[0]-t[0])>cn){var l=r[0]<t[0]?mn:-mn;a=e*l/2,o.point(-l,a),o.point(0,a),o.point(l,a)}else o.point(t[0],t[1])}function xf(r){return function(t){var e=new Yd;for(var o in r)e[o]=r[o];return e.stream=t,e}}function Yd(){}Yd.prototype={constructor:Yd,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 gH=en(30*fi);var IH=xf({point:function(r,t){this.stream.point(r*fi,t*fi)}});function Ef(r){return function(t,e){var o=en(t),a=en(e),l=r(o*a);return[l*a*ve(t),l*ve(e)]}}function wo(r){return function(t,e){var o=Rr(t*t+e*e),a=r(o),l=ve(a),f=en(a);return[hi(t*l,o*f),ei(o&&e*l/o)]}}var p1=Ef(function(r){return Rr(2/(1+r))});p1.invert=wo(function(r){return 2*ei(r/2)});var d1=Ef(function(r){return(r=Ud(r))&&r/ve(r)});d1.invert=wo(function(r){return r});function $d(r,t){return[r,ml(gl((sr+t)/2))]}$d.invert=function(r,t){return[r,2*io(gf(t))-sr]};function Mf(r,t){return[r,t]}Mf.invert=Mf;function m1(r,t){var e=en(t),o=en(r)*e;return[e*ve(r)/o,ve(t)/o]}m1.invert=wo(io);function g1(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)))]}g1.invert=function(r,t){var e=t,o=25,a;do{var l=e*e,f=l*l;e-=a=(e*(1.007226+l*(.015085+f*(-.044475+.028874*l-.005916*f)))-t)/(1.007226+l*(.015085*3+f*(-.044475*7+.028874*9*l-.005916*11*f)))}while(zn(a)>cn&&--o>0);return[r/(.8707+(l=e*e)*(-.131979+l*(-.013791+l*l*l*(.003971-.001529*l)))),e]};function y1(r,t){return[en(t)*ve(r),ve(t)]}y1.invert=wo(ei);function v1(r,t){var e=en(t),o=1+en(r)*e;return[e*ve(r)/o,ve(t)/o]}v1.invert=wo(function(r){return 2*io(r)});function _1(r,t){return[ml(gl((sr+t)/2)),-r]}_1.invert=function(r,t){return[-t,2*io(gf(r))-sr]};var QI=Ln(_u(),1);var jI=Ln(_u(),1);var eR=Ln(_u(),1);var nR=Ln(_u(),1);function so(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}function _l(r){let t=0;for(let e=0;e<r.length-1;e++)t+=so(r[e],r[e+1]);return t}function E1(r,t,e){let o=new fn(t[0]-r[0],t[1]-r[1]),a=new fn(t[0]-e[0],t[1]-e[1]),f=o.angleTo(a)*180/Math.PI,h=new fn(t[0]-r[0],t[1]-r[1]);return new fn(e[0]-r[0],e[1]-r[1]).cross(h)>0?f:-f}var pi="___",wf=class{constructor(t=3){this.lift_priority=t;dn(this,"roadInfo",[]);dn(this,"pointMap",new Map);dn(this,"nodeMap",new Map);dn(this,"facilityMap",new Map);dn(this,"straightLadderMap",new Map);dn(this,"escalatorMap",new Map);dn(this,"staircaseMap",new Map);dn(this,"parkingMap",new Map);dn(this,"lineMap",new Map);dn(this,"baseRoute",new Bi.default);dn(this,"escalatorRoute",new Bi.default);dn(this,"straightLadderRoute",new Bi.default);dn(this,"forwardLineMap",new Map);dn(this,"forwardRoute",new Bi.default)}initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(o=>{let a=\`\${e.floor}\${pi}\${o.id}\`;if(this.pointMap.set(a,o),this.nodeMap.set(\`\${o.floor}\${pi}\${o.nodeId}\`,a),o.type==="straightLadder"){let l=this.straightLadderMap.get(o.name)||[];l.push(ls({},o)),this.straightLadderMap.set(o.name,l)}if(o.type==="staircase"){let l=this.staircaseMap.get(o.name)||[];l.push(ls({},o)),this.staircaseMap.set(o.name,l)}if(o.type==="escalator"){let l=this.escalatorMap.get(o.name)||{};o.escalatorDirection==="exit"?l.end={floor:o.floor,id:o.id}:l.start={floor:o.floor,id:o.id},this.escalatorMap.set(o.name,l)}if(o.type==="facility"){let l=this.facilityMap.get(o.targetId)||[];l.push(ls({},o)),this.facilityMap.set(o.targetId,l)}o.type==="parkingSpace"&&this.parkingMap.set(\`\${o.floor}\${pi}\${o.name}\`,o)}),e.lines.filter(o=>o.direction!=="no").forEach(o=>{var p,d;let a=\`\${e.floor}\${pi}\${o.from}\`,l=\`\${e.floor}\${pi}\${o.to}\`,f=(p=this.pointMap.get(a))==null?void 0:p.cds,h=(d=this.pointMap.get(l))==null?void 0:d.cds;if(f!=null&&f.length&&(h!=null&&h.length)){let g=so(f,h);switch(this.addLineItem(a,l,g),this.addLineItem(l,a,g),o.direction){case"double":this.addLineItem(a,l,g,this.forwardLineMap),this.addLineItem(l,a,g,this.forwardLineMap);break;case"single":this.addLineItem(a,l,g,this.forwardLineMap);break;case"back":this.addLineItem(l,a,g,this.forwardLineMap);break}}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}addLineItem(t,e,o,a=this.lineMap){let l=a.get(t)||new Map;l.set(e,o),a.set(t,l)}addFacilityToLineMap(t,e,o,a){[...this.straightLadderMap,...this.staircaseMap].forEach(([l,f])=>{var h,p;if(!(f.length<2))for(let d=0;d<f.length;d++){let g=\`\${f[d].floor}\${pi}\${f[d].id}\`;for(let _=0;_<f.length;_++)if(d!==_){let y=\`\${f[_].floor}\${pi}\${f[_].id}\`,M=(h=this.pointMap.get(g))==null?void 0:h.cds,S=(p=this.pointMap.get(y))==null?void 0:p.cds;if(M!=null&&M.length&&(S!=null&&S.length))if(f[d].type==="straightLadder"){let T=e;this.addLineItem(g,y,T,a)}else{let T=o;this.addLineItem(g,y,T,a)}}}}),this.escalatorMap.forEach((l,f)=>{var h,p;if(l.start&&l.end){let d=\`\${l.start.floor}\${pi}\${l.start.id}\`,g=\`\${l.end.floor}\${pi}\${l.end.id}\`,_=(h=this.pointMap.get(d))==null?void 0:h.cds,y=(p=this.pointMap.get(g))==null?void 0:p.cds;if(_!=null&&_.length&&(y!=null&&y.length)){let M=t;this.addLineItem(d,g,M,a)}}})}initBaseRoute(){let t=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,t),this.baseRoute=new Bi.default(t)}initEscalatorRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new Bi.default(t)}initStraightLadderRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new Bi.default(t)}initForwardRoute(){this.forwardRoute=new Bi.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}\${pi}\${t.nodeId}\`);if(o){let[a,l]=o.split(pi);return{floor:a,id:l}}}if((e=t.coord)!=null&&e.length){let o=this.roadInfo.find(l=>l.floor===t.floor);if(!o)return null;let a=o.points.reduce((l,f)=>{let h=so(t.coord,f.cds);return h<l.min&&(l.min=h,l.point=f),l},{min:1/0,point:o.points[0]});return{floor:a.point.floor,id:a.point.id}}return null}transformEnd(t){if(t.floor){if(t.parkingSpace){let o=this.parkingMap.get(\`\${t.floor}\${pi}\${t.parkingSpace}\`);if(o)return{floor:o.floor,id:o.id}}let e=this.transformStart(t);if(e)return e}if(t.facility){let e=this.facilityMap.get(t.facility);if(e!=null&&e.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o=""){if(!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let a=this.transformStart(t);if(!a)return"no-start";let l=this.transformEnd(e);if(!l)return"no-end";let f=this.getBasePath.bind(this);switch(o){case"escalator":f=this.getEscalatorPath.bind(this);case"straightLadder":f=this.getStraightLadderPath.bind(this);case"forward":f=this.getForwardPath.bind(this);default:f=this.getBasePath.bind(this)}if(l.id)return f(a,l);if(l.facility){let h=this.facilityMap.get(l.facility).filter(d=>l.floor?d.floor===l.floor:!0);if(!h.length)return null;let p=h.map(d=>f(a,{floor:d.floor,id:d.id})).filter(d=>!!d);return p.reduce((d,g)=>{let _=g.reduce((y,M)=>y+_l(M.points),0);return _<d.distance&&(d.distance=_,d.path=g),d},{distance:1/0,path:p[0]}).path}}getRoutePath(t,e,o){let a=\`\${t.floor}\${pi}\${t.id}\`,l=\`\${e.floor}\${pi}\${e.id}\`,f=o.path(a,l);if(!f)return null;let h=[];return f.map(p=>{var g;let d=this.pointMap.get(p);if(d){let{floor:_}=d;if(((g=h[h.length-1])==null?void 0:g.floor)===_){let y=h[h.length-1];y.points.push(d.cds),y.endType=d.type,y.destId=d.nodeId,y.distance=_l(y.points)}else h.push({floor:_,points:[d.cds],endType:d.type,destId:d.nodeId,distance:0})}}),h}getBasePath(t,e){return this.getRoutePath(t,e,this.baseRoute)}getEscalatorPath(t,e){return this.getRoutePath(t,e,this.escalatorRoute)}getStraightLadderPath(t,e){return this.getRoutePath(t,e,this.straightLadderRoute)}getForwardPath(t,e){return this.getRoutePath(t,e,this.forwardRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new Bi.default,this.escalatorRoute=new Bi.default,this.straightLadderRoute=new Bi.default}};function M1(r,t){return new Promise((e,o)=>{let a=new XMLHttpRequest;a.open("GET",r,!0),Object.keys(t.headers||{}).forEach(l=>{a.setRequestHeader(l,t.headers[l])}),t.responseType&&(a.responseType=t.responseType),a.onload=()=>{if(a.status>=200&&a.status<300)if(t.responseType==="arraybuffer")e(a.response);else try{let l=JSON.parse(a.responseText);e(l)}catch(l){o(l)}else o(a.statusText)},a.onerror=()=>{o(a.statusText)},a.send()})}var fR=Ln(A1(),1);function hR(r,t,e){let o=E1(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 C1(r){let t=[{direction:"start",distance:so(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let o=hR(r[e-2],r[e-1],r[e]);if(o==="front"){let a=t[t.length-1],l=so(r[e-1],r[e]);a.distance+=l,e!==2&&a.points.push(r[e-1])}else t.push({direction:o,distance:so(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}var So=Ln(kf(),1);var zi="___",xl=class{constructor(t=3){this.lift_priority=t;dn(this,"roadInfo",[]);dn(this,"pointMap",new Map);dn(this,"nodeMap",new Map);dn(this,"facilityMap",new Map);dn(this,"straightLadderMap",new Map);dn(this,"escalatorMap",new Map);dn(this,"staircaseMap",new Map);dn(this,"lineMap",new Map);dn(this,"baseRoute",new So.default);dn(this,"escalatorRoute",new So.default);dn(this,"straightLadderRoute",new So.default)}initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(o=>{let a=\`\${e.floor}\${zi}\${o.id}\`;if(this.pointMap.set(a,o),this.nodeMap.set(\`\${o.floor}\${zi}\${o.nodeId}\`,a),o.type==="straightLadder"){let l=this.straightLadderMap.get(o.name)||[];l.push(ls({},o)),this.straightLadderMap.set(o.name,l)}if(o.type==="staircase"){let l=this.staircaseMap.get(o.name)||[];l.push(ls({},o)),this.staircaseMap.set(o.name,l)}if(o.type==="escalator"){let l=this.escalatorMap.get(o.name)||{};o.escalatorDirection==="exit"?l.end={floor:o.floor,id:o.id}:l.start={floor:o.floor,id:o.id},this.escalatorMap.set(o.name,l)}if(o.type==="facility"){let l=this.facilityMap.get(o.targetId)||[];l.push(ls({},o)),this.facilityMap.set(o.targetId,l)}}),e.lines.filter(o=>o.direction!=="no").forEach(o=>{var p,d;let a=\`\${e.floor}\${zi}\${o.from}\`,l=\`\${e.floor}\${zi}\${o.to}\`,f=(p=this.pointMap.get(a))==null?void 0:p.cds,h=(d=this.pointMap.get(l))==null?void 0:d.cds;if(f!=null&&f.length&&(h!=null&&h.length)){let g=so(f,h);this.addLineItem(a,l,g),o.direction==="double"&&this.addLineItem(l,a,g)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(t,e,o,a=this.lineMap){let l=a.get(t)||new Map;l.set(e,o),a.set(t,l)}addFacilityToLineMap(t,e,o,a){[...this.straightLadderMap,...this.staircaseMap].forEach(([l,f])=>{var h,p;if(!(f.length<2))for(let d=0;d<f.length;d++){let g=\`\${f[d].floor}\${zi}\${f[d].id}\`;for(let _=0;_<f.length;_++)if(d!==_){let y=\`\${f[_].floor}\${zi}\${f[_].id}\`,M=(h=this.pointMap.get(g))==null?void 0:h.cds,S=(p=this.pointMap.get(y))==null?void 0:p.cds;if(M!=null&&M.length&&(S!=null&&S.length))if(f[d].type==="straightLadder"){let T=e;this.addLineItem(g,y,T,a)}else{let T=o;this.addLineItem(g,y,T,a)}}}}),this.escalatorMap.forEach((l,f)=>{var h,p;if(l.start&&l.end){let d=\`\${l.start.floor}\${zi}\${l.start.id}\`,g=\`\${l.end.floor}\${zi}\${l.end.id}\`,_=(h=this.pointMap.get(d))==null?void 0:h.cds,y=(p=this.pointMap.get(g))==null?void 0:p.cds;if(_!=null&&_.length&&(y!=null&&y.length)){let M=t;this.addLineItem(d,g,M,a)}}})}initBaseRoute(){let t=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,t),this.baseRoute=new So.default(t)}initEscalatorRoute(){let t=new Map([...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([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new So.default(t)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility?!0:this.checkStart(t)}transformStart(t){var e;if(t.nodeId){let o=this.nodeMap.get(\`\${t.floor}\${zi}\${t.nodeId}\`);if(o){let[a,l]=o.split(zi);return{floor:a,id:l}}}if((e=t.coord)!=null&&e.length){let o=this.roadInfo.find(l=>l.floor===t.floor);if(!o)return null;let a=o.points.reduce((l,f)=>{let h=so(t.coord,f.cds);return h<l.min&&(l.min=h,l.point=f),l},{min:1/0,point:o.points[0]});return{floor:a.point.floor,id:a.point.id}}return null}transformEnd(t){if(t.floor){let e=this.transformStart(t);if(e)return e}if(t.facility){let e=this.facilityMap.get(t.facility);if(e!=null&&e.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o=""){if(!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let a=this.transformStart(t);if(!a)return"no-start";let l=this.transformEnd(e);if(!l)return"no-end";let f=this.getBasePath.bind(this);switch(o){case"escalator":f=this.getEscalatorPath.bind(this);case"straightLadder":f=this.getStraightLadderPath.bind(this);default:f=this.getBasePath.bind(this)}if(console.log(a,l),l.id)return f(a,l);if(l.facility){let h=this.facilityMap.get(l.facility).filter(d=>l.floor?d.floor===l.floor:!0);if(!h.length)return null;let p=h.map(d=>f(a,{floor:d.floor,id:d.id})).filter(d=>!!d);return p.reduce((d,g)=>{let _=g.reduce((y,M)=>y+_l(M.points),0);return _<d.distance&&(d.distance=_,d.path=g),d},{distance:1/0,path:p[0]}).path}}getRoutePath(t,e,o){let a=\`\${t.floor}\${zi}\${t.id}\`,l=\`\${e.floor}\${zi}\${e.id}\`,f=o.path(a,l);if(console.log(a,l,f),!f)return null;let h=[];return f.map(p=>{var g;let d=this.pointMap.get(p);if(d){let{floor:_}=d;if(((g=h[h.length-1])==null?void 0:g.floor)===_){let y=h[h.length-1];y.points.push(d.cds),y.endType=d.type,y.destId=d.nodeId}else h.push({floor:_,points:[d.cds],endType:d.type,destId:d.nodeId})}}),h}getBasePath(t,e){return this.getRoutePath(t,e,this.baseRoute)}getEscalatorPath(t,e){return this.getRoutePath(t,e,this.escalatorRoute)}getStraightLadderPath(t,e){return this.getRoutePath(t,e,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 So.default,this.escalatorRoute=new So.default,this.straightLadderRoute=new So.default}};function P1(r){return r.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}var Sf=class r{constructor(){dn(this,"keySet",new Set)}static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}genUniqueKey(){let t=r.createKey();for(;this.keySet.has(t);)t=r.createKey();return t}removeKey(t){this.keySet.delete(t)}dispose(){this.keySet.clear()}};var K9=new Sf;function I1(r){let t={};for(let o in r)o.startsWith("on")&&(t[P1(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 El=new xl;I1({onChangeRoadNetwork(r){switch(r){case"RoadNetwork":El=new xl;break;case"RoadNetwork2":El=new wf;break}},onLoadRoad:async r=>{let e=(await M1(r.url,r)).data.map(o=>JSON.parse(o.road_info));return El.initRoute(e),e},onSetRoadInfo(r){El.initRoute(r)},onGetPath({start:r,end:t,type:e}){return El.getPath(r,t,e)},onGetDirectionPath(r){return C1(r)}});
|
|
3672
3672
|
/*! Bundled license information:
|
|
3673
3673
|
|
|
3674
3674
|
object-assign/index.js:
|
|
@@ -3773,7 +3773,7 @@ three/build/three.module.js:
|
|
|
3773
3773
|
* along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.
|
|
3774
3774
|
*)
|
|
3775
3775
|
*/
|
|
3776
|
-
`)}var
|
|
3777
|
-
`);
|
|
3778
|
-
`);var Nt=class extends m.ShaderMaterial{constructor(n){super({uniforms:Object.assign({},m.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new m.Color(16777215)},opacity:{value:1},resolution:{value:new m.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 m.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1},alphaTest:{value:.2}}),vertexShader:m.ShaderChunk.meshline_vert,fragmentShader:m.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(t){this.uniforms.lineWidth.value=t}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(t){this.uniforms.map.value=t}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(t){this.uniforms.useMap.value=t}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(t){this.uniforms.alphaMap.value=t}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(t){this.uniforms.useAlphaMap.value=t}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(t){this.uniforms.color.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(t){this.uniforms.sizeAttenuation.value=t}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(t){this.uniforms.dashArray.value=t,this.useDash=t!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(t){this.uniforms.dashRatio.value=t}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(t){this.uniforms.useDash.value=t}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(t){this.uniforms.visibility.value=t}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(t){this.uniforms.alphaTest.value=t}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(t){this.uniforms.repeat.value.copy(t)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(t){this.uniforms.thresholdRatio.value=t}}}),this.setValues(n)}};Nt.prototype.copy=function(o){return m.ShaderMaterial.prototype.copy.call(this,o),this.lineWidth=o.lineWidth,this.map=o.map,this.useMap=o.useMap,this.alphaMap=o.alphaMap,this.useAlphaMap=o.useAlphaMap,this.color.copy(o.color),this.opacity=o.opacity,this.resolution.copy(o.resolution),this.sizeAttenuation=o.sizeAttenuation,this.dashArray.copy(o.dashArray),this.dashOffset.copy(o.dashOffset),this.dashRatio.copy(o.dashRatio),this.useDash=o.useDash,this.visibility=o.visibility,this.alphaTest=o.alphaTest,this.repeat.copy(o.repeat),this};var ti="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 ei={texture_url:ti,lineWidth:8,color:16777215},_e=class extends I.Object3D{constructor(t,e){super();this.navigation=t;this.config=Object.assign({},ei,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}mesh=null;geometry=null;material=null;texture=null;config=ei;points=[];pathDistance=0;basicRepeat=1;prevCameraZoom=0;registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate)}onControlChange=()=>{let t=this.navigation.bmap.context.camera.zoom;t!==this.prevCameraZoom&&(this.prevCameraZoom=t,this.changeRepeat())};onUpdate=()=>{this.texture};getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:i,height:r}}}}}=this,s=t.map(([u,l])=>x(new I.Vector3(u,l,0),e,i,r)).map(({x:u,y:l})=>[u,l]);return ut(s)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new I.Vector2(t,1)}loadTexture(t){return new Promise((e,i)=>{new I.TextureLoader().load(t,e,void 0,i)})}transformPoints(t){let e=[];for(let i=0;i<t.length;i++)e.push(...t[i],0);return e}updatePoints(t){this.points=t,this.pathDistance=ut(t),this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){if(!this.material||!this.pathDistance)return;let e=t/this.pathDistance;this.material.thresholdRatio=e}async create(t){let e=this.geometry=new W;if(this.updatePoints(t),!this.texture){let s=this.texture=await this.loadTexture(this.config.texture_url);s.wrapS=s.wrapT=I.RepeatWrapping}let i=this.material=new Nt({useMap:!0,color:new I.Color(this.config.color),transparent:!0,resolution:new I.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!0,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:I.NormalBlending,repeat:new I.Vector2(this.getRepeat(),1)}),r=this.mesh=new I.Mesh(e,i);return r.renderOrder=9,this.add(r),r}dispose(){this.unRegistryEvent(),this.clear(),this.geometry?.dispose(),this.material?.dispose(),this.texture?.dispose()}};var Dt=g("@tweenjs/tween.js"),et=g("three"),Vi={path:{},speed:10,cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},loadRoad:!0,roadNetwork:"RoadNetwork"},ni=class extends st{path=null;worker=De();fetchRoadStatus=!1;uniqueKey=new wt;paths=[];options;pathTween=new Dt.Group;startPoi=null;movedDistance=0;pathStart=[0,0];animationPathOptions={cPathIndex:0};cPath=[];constructor(n,t,e={}){super(n),this.options=Object.assign({},Vi,e);let{apiDomain:i,apiPath:{roadNetwork:r},apiInfo:s}=this.bmap.config;this.registryEvent(),this.options.loadRoad&&Ct(this.worker,"load_road",{url:`${i||location.origin}${r}?project=${t}`,...s}).then(a=>{this.fetchRoadStatus=!0,this.dispatchEvent({type:"fetch-road-status",status:!0}),this.dispatchEvent({type:"fetch-road-data",roadInfo:a})}).catch(a=>{console.log("[\u52A0\u8F7D\u8DEF\u7F51\u5931\u8D25]",a)}),this.options.roadNetwork!=="RoadNetwork"&&Ct(this.worker,"change_road_network",this.options.roadNetwork)}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor)}onUpdate=()=>{this.pathTween.update()};async setRoadData(n){this.fetchRoadStatus=!1,this.dispatchEvent({type:"fetch-road-status",status:!1}),await Ct(this.worker,"set_road_info",n),this.fetchRoadStatus=!0,this.dispatchEvent({type:"fetch-road-status",status:!0})}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.pathTween.getAll().forEach(n=>n.stop()),this.pathTween.removeAll()),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null)}onSwitchFloor=({data:{curFloor:n}})=>{if(this.paths.length){let t=this.paths.find(e=>e.floor===n.name);t?this.renderPath(this.translatePoints(t.points)):this.clearPath()}else this.clearPath()};getDirectionPath(n){return Ct(this.worker,"get_direction_path",n)}addPath(n){this.paths=n;let t=this.bmap.context.currentFloor?.name,e=n.find(i=>i.floor===t);if(e)if(this.bmap.currentBuildGround)this.renderPath(this.translatePoints(e.points));else{let i=()=>{this.bmap.removeEventListener("center-change",i),this.renderPath(this.translatePoints(e.points))};this.bmap.addEventListener("center-change",i)}else this.clearPath()}translatePoints(n){let[t,e]=this.bmap.buildingCenter;return n.map(i=>[i[0]-t,i[1]-e])}getPath(n,t,e=""){return new Promise((i,r)=>{let s=()=>{Ct(this.worker,"get_path",{start:n,end:t,type:e}).then(a=>{a?typeof a=="string"?r(a):i(a):r("no-path")})};if(this.fetchRoadStatus)s();else{let a=({status:u})=>{u&&(this.removeEventListener("fetch-road-status",a),s())};this.addEventListener("fetch-road-status",a)}})}renderPath(n){let t=this.catmullRomCurve3(n);this.cPath=t,this.animationPathOptions={cPathIndex:0},this.movedDistance=0,this.pathStart=t[0],this.path?this.path.updatePoints(t):(this.path=new _e(this,this.options.path),this.path.create(t),this.path.position.z=this.bmap.context.currentFloor.groundMaxHeight+.5,this.bmap.context.scene.add(this.path)),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null),this.options.needStartPoi&&(this.startPoi=new V(this.bmap.context,{...this.options.startPoi,id:"navigation_start_poi",position:{x:t[0][0],y:t[0][1],z:1e-4},collision_enable:!1})||null,this.bmap.context.currentFloor?.poiLayer2.pushPoi(this.startPoi))}catmullRomCurve3(n){return cn(n,!1,!0,.1,150,2.5)}async animationTo(n,t=this.options.speed){if(n.floor!==this.bmap.context.currentFloor?.name||!this.path)return;let{animationPathOptions:{cPathIndex:e}}=this,i=[this.pathStart,...this.cPath.slice(e+1)],r=this.translatePoints([n.pos])[0],{distance:s,pos:a,index:u}=i.reduce((h,y,b,E)=>{if(b===E.length-1)return h;let{distance:S,closestPoint:P}=hn(r,y,E[b+1]);return S<h.distance&&(h.distance=S,h.pos=P,h.index=b),h},{distance:Number.MAX_SAFE_INTEGER,pos:n.pos,index:0});if(s>this.options.cheapMaximumDistance||this.path.points[0][0]===a[0]&&this.path.points[0][1]===a[1])return;let l=0,c=[];if(u===0)l=F(i[0],a),c=[l];else{c=[F(i[0],i[1])];for(let h=1;h<u;h++)c.push(F(i[h],i[h+1]));c.push(F(i[u],a)),l=c.reduce((h,y)=>h+y,0)}let p=l/t;this.pathTween.getAll().forEach(h=>h.stop()),this.pathTween.removeAll();let f={distance:0},d=this.animationPathOptions.cPathIndex,_=0,v=0;return new Promise(h=>{let y=new Dt.Tween(f,this.pathTween).to({distance:l},p*1e3).onUpdate(async()=>{let b=f.distance-_;for(;c.length&&b>c[0];)_+=c.shift(),v++,b=f.distance-_;let E=i[v],S=i[v+1];if(!S)return;let P=pn(E,S,b);if(this.pathStart=P,this.path?.movePath(this.movedDistance+f.distance),this.animationPathOptions.cPathIndex=d+v,this.startPoi){this.startPoi.position.setX(P[0]).setY(P[1]);let U=new et.Vector3(P[0],P[1],0),N=new et.Vector3;N.setFromMatrixColumn(this.bmap.context.camera.matrix,1),N.normalize(),N.multiplyScalar(150/this.bmap.context.camera.zoom),U.add(N),this.bmap.context.setCameraPosition(U,0)}y.pause(),await this.changeCameraToPathUp(200),y.resume(),this.dispatchEvent({type:"path-animation",pathIndex:this.animationPathOptions.cPathIndex})}).onComplete(()=>{this.pathTween.remove(y),this.dispatchEvent({type:"path-animation-end"}),this.movedDistance+=l,h(!0)}).start()})}getPathDirection(){let n=this.cPath.slice(this.animationPathOptions.cPathIndex);if(n.length<3)return null;let t=n[0],e=n[1],i=n[2],r=Ut(t,e,i);if(Math.abs(r)>=179&&Math.abs(r)<=180){let s=new et.Vector3(i[0]-e[0],i[1]-e[1],0).normalize(),a=new et.Vector3(0,1,0).normalize(),u=s.angleTo(a),l=new et.Vector3().crossVectors(a,s);return(Object.is(l.y,0)?-1:1)*u}else return null}async changeCameraToPathUp(n=100){let t=this.getPathDirection();if(t===null)return;let e=this.bmap.context.control.getAzimuthalAngle();if(Math.abs(e-t)>Math.PI&&(e>0?t=Math.PI*2+t:t=t-Math.PI*2),Math.abs(t-this.bmap.context.control.getAzimuthalAngle())<.01)return;let{control:r}=this.bmap.context;return new Promise(s=>{let a={azimuthal:r.getAzimuthalAngle()},u={azimuthal:t},l=new Dt.Tween(a,this.pathTween).to(u,n).onUpdate(()=>{r.target.copy(this.startPoi.position),r.maxAzimuthAngle=a.azimuthal,r.minAzimuthAngle=a.azimuthal,r.update();let c=this.startPoi.position.clone(),p=new et.Vector3;p.setFromMatrixColumn(this.bmap.context.camera.matrix,1),p.normalize(),p.multiplyScalar(150/this.bmap.context.camera.zoom),c.add(p),this.bmap.context.setCameraPosition(c,0)}).onComplete(()=>{r.enabled=!0,this.pathTween.remove(l),s(!0)}).onStart(()=>{r.enabled=!1}).start()})}async initNavigationCamera(){await this.translateCameraToStartPoi(300),await this.changeCameraToPathUp(300)}async translateCameraToStartPoi(n=100){if(!this.startPoi)return;let{clientSize:{width:t,height:e},camera:i,control:r}=this.bmap.context,s=Math.round(t/2),a=Math.round(e/2),u=r.target.clone(),l=x(this.startPoi.position,i,t,e),c=l.x-s,p=a-l.y+150;if(console.log(l,c,p,this.startPoi.position,s,a),!(Math.abs(c)<1&&Math.abs(p)<1)){if(Math.abs(c)>=1){let f=new et.Vector3;f.setFromMatrixColumn(i.matrix,0),f.normalize(),f.multiplyScalar(c/i.zoom),u.add(new et.Vector3(f.x,0,0))}if(Math.abs(p)>=1){let f=new et.Vector3;f.setFromMatrixColumn(i.matrix,1),f.normalize(),f.multiplyScalar(p/i.zoom),u.add(new et.Vector3(0,f.y,0))}return this.bmap.context.setCameraPosition(u,n)}}async initCameraZoom(n=100){if(!this.startPoi)return;let{clientSize:{width:t,height:e},currentFloor:i}=this.bmap.context,{max:r,min:s}=i.box,u=Math.min(t/(r.x-s.x),e/(r.y-s.y))*(r.x-s.x)/20;return this.bmap.context.setZoom(u,this.startPoi.position,n)}dispose(){this.worker.terminate(),this.unRegistryEvent(),this.path?.dispose(),this.uniqueKey.dispose(),this.startPoi?.dispose()}};var ii=class extends st{cacheData=new Map;floorDataLengthMap=new Map;async load(n){let t=tt(n);if(this.cacheData.has(t))return this.cacheData.get(t);console.time("floor/get\u8BF7\u6C42"+n.resource_type_list);let[,e]=await Promise.all([this.loadBuildGround(n),me(n,this.bmap.config)]);console.timeEnd("floor/get\u8BF7\u6C42"+n.resource_type_list);let i=tt({floor:n.floor,ts:n.ts});this.bmap.transformGraphicData(e,this.bmap.buildingCenter,this.floorDataLengthMap.get(i)||0),e.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(t,e);let r=this.floorDataLengthMap.get(i)||0;return this.floorDataLengthMap.set(i,r+e.length),e}isSameFloor(n){return this.bmap.context.currentFloor?.key===tt(n)}switchFloorByData(n,t){if(this.isSameFloor(t)){if(!n.length)return;let e=this.bmap.context.currentFloor,i=e.userData.legacyToGraphicMap,r=e.userData.graphicMap,s=[];for(let a of n){if(a.info.group==="ground")e.createGround(a.info);else{let u=e.addGraphic(a.info);u.userData.data=a,i.set(a.legacy_id,u),s.push(u)}r.set(a.element_uuid,a)}this.bmap.triggerHooks("switch_floor_before",{curFloor:e,graphics:s}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks("switch_floor_after",{curFloor:e,graphics:s})}else{let e=tt(t),{curFloor:i,graphics:r}=this.bmap.createFloor(n);i.name=t.floor,i.key=e;let s=new Map;n.forEach(a=>{s.set(a.element_uuid,a)}),i.userData.graphicMap=s,this.bmap.triggerHooks("switch_floor_before",{curFloor:i,graphics:r}),this.bmap.context.switchFloor(i),this.bmap.initialFloorCamera(),this.bmap.triggerHooks("switch_floor_after",{curFloor:i,graphics:r})}}filterData(n,t){if(!this.isSameFloor(t))return n;let e=this.bmap.context.currentFloor.userData.graphicMap;return n.filter(i=>!e.has(i.element_uuid))}async switchFloorByStoreData(n){let t=await this.load({...n,resource_type_list:"6"}),e=this.filterData(t,n);this.switchFloorByData(e,n)}async switchFloorByOtherData(n){let t=await this.load({...n,resource_type_list:"1,2,3,4"}),e=this.filterData(t,n);this.switchFloorByData(e,n)}async loadBuildGround({brand:n,project:t}){let e=tt({brand:n,project:t});return await this.bmap.loadBuildingGround({brand:n,project:t}),this.bmap.currentBuildGround=this.bmap.buildingGroundMap.get(e)||null,this.bmap.currentBuildGround}async changeFloor(n){return await Promise.all([this.switchFloorByStoreData(n),this.switchFloorByOtherData(n)]),Array.from(this.bmap.context.currentFloor.userData.graphicMap.values())}};var oi=g("three"),ri=class extends st{poiLayer;floors=[];group=new oi.Group;constructor(n){super(n),this.poiLayer=new Pt(n.context)}show(n){let t=n[0].userData.height;n.forEach(r=>{r.poiLayer.pois.forEach(s=>{this.poiLayer.pushPoi(s)}),r.poiLayer.pois.length=0,r.poiLayer.dispose(),r.position.z=t,t+=r.userData.height});let{scene:e,currentFloor:i}=this.bmap.context;i&&(e.remove(i),i.dispose()),this.group.add(this.poiLayer,...n),e.add(this.group),this.floors=n,this.bmap.context.cameraBound.updateBox()}hide(){let{scene:n}=this.bmap.context;n.remove(this.group),this.poiLayer.clear(!0),this.floors.forEach(t=>{t.dispose()}),this.floors=[],this.group.clear()}fitCamera(){let{context:n,config:t,type:e}=this.bmap;n.cameraBound.setEnable(!1),n.control.minZoom=0,n.control.maxZoom=1/0,n.camera.zoom=1,n.setAzimuthalAngle(t.control.defaultAzimuthal,0),n.setPolarAngle(t.control.defaultPolar,0),n.fitCameraToObject(this.group,void 0,0);let i=n.camera.zoom;n.control.minZoom=i,n.control.maxZoom=i*25,e==="3d"&&n.fitCameraToObject(this.group,t.defaultPadding,0,!1),this.bmap.basicZoom=n.camera.zoom,n.control.addEventListener("change",this.bmap.onControlChange.bind(this.bmap)),this.bmap.onControlChange(),n.cameraBound.setEnable(!0)}dispose(){this.poiLayer.dispose(),this.floors.forEach(n=>n.dispose()),this.floors=[]}};var nt;function si(o="aibee_map"){return new Promise((n,t)=>{if(nt)return n({db:nt,type:"success"});let e=indexedDB.open(o);e.onupgradeneeded=function(i){nt=i.target.result,console.log("onupgradeneeded"),n({db:nt,type:"onupgradeneeded"})},e.onsuccess=i=>{nt=i.target.result,n({db:nt,type:"success"})},e.onerror=i=>{t(i)}})}function ai(o,n,t=nt){return new Promise((e,i)=>{t||i("\u6CA1\u6709db");let s=t.transaction([o],"readonly").objectStore(o).get(n);s.onsuccess=()=>{s.result?e(s.result.value):e(null)},s.onerror=a=>{console.log("[getVersionByKey]",a),e(null)}})}function li(o,n,t,e=nt){return new Promise((i,r)=>(e||r("\u6CA1\u6709db"),new Promise((s,a)=>{let l=e.transaction([o],"readwrite").objectStore(o).add({key:n,value:t});l.onsuccess=function(c){s(c)},l.onerror=function(c){a(c)}})))}function ve(o,n=nt){n&&(n.objectStoreNames.contains(o)||n.createObjectStore(o,{keyPath:"key"}))}function ui(){nt?.close(),nt=null}function at(o,n,t=0){o.forEach(e=>{e.geometry.coords=JSON.parse(JSON.stringify(e.geometry.cds)),e.geometry.type==="polygon"?(e.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(r=>{r[0]-=n[0],r[1]-=n[1]})}),e.geometry.otherCds&&(e.geometry.otherCoords=e.geometry.otherCds.map(i=>i.map(r=>xt(r,n))))):e.geometry.coords=xt(e.geometry.cds,n)});for(let e=0;e<o.length;e++){let i=o[e];i.deltaHeight=1e-5*(t+e+1)}}function xt(o,n){return[o[0]-n[0],o[1]-n[1]]}var Iu={loadRoadNetwork:!1},xe="version",Fe="map_data",Ee="road_network_data",ci=class{constructor(n){this.bmap=n;this.initDb()}floors=[];async initDb(){try{let{db:n,type:t}=await si();t==="onupgradeneeded"&&(ve(xe),ve(Fe),ve(Ee))}catch(n){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",n)}}async load(n){if(this.clear(),Array.isArray(n))this.floors=n;else{let t=await fetch(n).then(e=>e.json());t.code==="0"&&(this.floors=t.data.list)}}setCacheData(n,t,e){return li(n,`${t}`,e)}getCacheData(n,t){return ai(n,`${t}`)}getFloorCacheKey(n){return`${n.floor_id}`}async getFloorData(n){let t=this.floors.find(i=>i.floor===n);if(!t)return null;let e=this.getFloorCacheKey(t);try{if(await this.getCacheData(xe,e)===t.version_id){let r=await this.getCacheData(Fe,e);if(r)return this.getDataByJson(r)}return this.getFloorDataByFloorInfo(t)}catch{return this.getFloorDataByFloorInfo(t)}}async getFloorDataByFloorInfo(n){let t=this.getFloorCacheKey(n);console.time("zstd_json");let e=await fetch(n.map_url).then(i=>i.json());return e.floor=n.floor,console.timeEnd("zstd_json"),this.setCacheData(Fe,t,e),this.setCacheData(xe,t,n.version_id),this.getDataByJson(e)}async getRoadNetworkData(){return(await Promise.all(this.floors.map(async t=>{let e=this.getFloorCacheKey(t);try{if(await this.getCacheData(xe,e)===t.version_id){let s=await this.getCacheData(Ee,e);if(s)return s}let r=await fetch(t.route_url).then(s=>s.json());return this.setCacheData(Ee,e,r),r}catch{let i=await fetch(t.route_url).then(r=>r.json());return this.setCacheData(Ee,e,i),i}}))).filter(t=>t.points)}async getOtherDataByFreeTime(){}async getMulFloorsData(n){return Promise.all(n.map(t=>this.getFloorData(t))).then(t=>t.filter(e=>e))}async getDataByUrl(n){let t=await fetch(n).then(e=>e.json());return this.getDataByJson(t)}getDataByJson(n){let t=new pt(this.bmap.context),e=[0,0];return n.layers.forEach(i=>{switch(i.l_type){case"range":let r=i.elements[0];e=[r.center_x,r.center_y];break;case"graph":let s=[],a=new Map;at(i.elements,e);let u=[];i.elements.forEach(h=>{if(h.group==="ground")t.createGround(h);else if(h.canMerge)u.push(h);else{let y=t.addGraphic(h);s.push(y),a.set(h.id,y)}}),t.userData.graphics=s,t.userData.graphicMap=a;let l=u.reduce((h,y)=>{let{fillColor:b,fillOpacity:E,strokeColor:S,strokeOpacity:P,height:U}=y,N=`${b}-${E}-${S}-${P}-${U}`;return h[N]?h[N].push(y):h[N]=[y],h},{});Object.values(l).forEach(h=>{let y=new ae(this.bmap.context,h);t.mergeGraphicLayer.add(y)});break;case"ground":at(i.elements,e);let c=i.elements.map(h=>new B(this.bmap.context,h));t.addGrounds(c);break;case"wall":at(i.elements,e);let p=i.elements.reduce((h,y)=>{let{fillColor:b,fillOpacity:E,strokeColor:S,strokeOpacity:P,height:U}=y,N=`${b}-${E}-${S}-${P}-${U}`;return h[N]?h[N].push(y):h[N]=[y],h},{});Object.values(p).forEach(h=>{let y=new ie(this.bmap.context,h);t.wallLayer.add(y)});break;case"lane":at(i.elements,e);let f=i.elements.reduce((h,y)=>{let{fillColor:b,fillOpacity:E,strokeColor:S,strokeOpacity:P}=y,U=`${b}-${E}-${S}-${P}`;return h[U]?h[U].push(y):h[U]=[y],h},{});Object.values(f).forEach(h=>{let y=new se(this.bmap.context,h);t.laneLayer.add(y)});break;case"texture2d":case"texture3d":at(i.elements,e);let d=new re(this.bmap.context,i.elements);t.textureLayer.add(d);break;case"glb":at(i.elements,e),i.elements.forEach(h=>{let y=xt([h.center_x,h.center_y],e),b=new oe(this.bmap.context,{...h,url:h.secondUrl,rotate:h.secondRotate,width:h.secondWidth,center_x:y[0],center_y:y[1]});t.glbModelLayer.add(b)});break;case"store":at(i.elements,e),i.elements.map(h=>{let y=xt([h.center_x,h.center_y],e),b=t.addGraphic(h);t.userData.graphics.push(b),t.userData.graphicMap.set(h.id,b);let E=new V(this.bmap.context,{id:h.id,icon:h.poi_info.icon,text:h.poi_info.showName||h.store_name||h.poi_info.text,position:{x:y[0],y:y[1],z:h.airHeight+h.height},icon_size:[18,18]});t.poiLayer2.pushPoi(E),E&&(E.userData.type="store",E.userData.data=h)});break;case"facility":at(i.elements,e),i.elements.map(h=>{let y=xt(h.geometry.cds,e),b=t.addGraphic(h);if(t.userData.graphics.push(b),t.userData.graphicMap.set(h.id,b),h.poi_info){let E=new V(this.bmap.context,{id:h.id,icon:h.poi_info.icon,text:h.poi_info.showName||h.store_name||h.poi_info.text,position:{x:y[0],y:y[1],z:h.airHeight+h.height},icon_size:[18,18]});t.poiLayer2.pushPoi(E),E.userData.type="facility",E.userData.data=h}});break;case"parkingSpace":at(i.elements,e);let _=[],v=new Map;i.elements.forEach(h=>{let y=t.addGraphic(h);_.push(y),v.set(h.id,y);let b=xt([h.center_x,h.center_y],e);if(h.texts[0]){let E=new V(this.bmap.context,{id:h.id,text:h.texts[0],position:{x:b[0],y:b[1],z:h.airHeight+h.height}});E&&(E.userData.type="parkingSpace",E.userData.data=h),t.poiLayer2.pushPoi(E)}}),t.userData.parkingSpaces=_,t.userData.parkingSpacesGraphicMap=v;break}}),t.userData.center=e,t.userData.height=n.floorHeight,t.name=n.floor,t.userData.data=n,t.updateBox(),t}clear(){}dispose(){this.clear(),ui()}};})();
|
|
3776
|
+
`)}var D=g("three");var y=g("three"),X=class extends y.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 y.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(n){this.setGeometry(n,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(n){this.setPoints(n,this.widthCallback)}}})}};X.prototype.setMatrixWorld=function(o){this.matrixWorld=o};X.prototype.setGeometry=function(o,n){this._geometry=o,this.setPoints(o.getAttribute("position").array,n)};X.prototype.setPoints=function(o,n){if(!(o instanceof Float32Array)&&!(o instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=o,this.widthCallback=n,this.positions=[],this.counters=[],o.length&&o[0]instanceof y.Vector3)for(var t=0;t<o.length;t++){var e=o[t],i=t/o.length;this.positions.push(e.x,e.y,e.z),this.positions.push(e.x,e.y,e.z),this.counters.push(i),this.counters.push(i)}else for(var t=0;t<o.length;t+=3){var i=t/o.length;this.positions.push(o[t],o[t+1],o[t+2]),this.positions.push(o[t],o[t+1],o[t+2]),this.counters.push(i),this.counters.push(i)}this.process()};function qi(o,n){var t=new y.Matrix4,e=new y.Ray,i=new y.Sphere,r=new y.Vector3,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(this.matrixWorld),o.ray.intersectSphere(i,r)!==!1){t.copy(this.matrixWorld).invert(),e.copy(o.ray).applyMatrix4(t);var a=new y.Vector3,u=new y.Vector3,l=new y.Vector3,c=this instanceof y.LineSegments?2:1,p=s.index,f=s.attributes;if(p!==null)for(var d=p.array,_=f.position.array,v=f.width.array,h=0,m=d.length-1;h<m;h+=c){var x=d[h],b=d[h+1];a.fromArray(_,x*3),u.fromArray(_,b*3);var S=v[Math.floor(h/3)]!==void 0?v[Math.floor(h/3)]:1,P=o.params.Line.threshold+this.material.lineWidth*S/2,B=P*P,O=e.distanceSqToSegment(a,u,r,l);if(!(O>B)){r.applyMatrix4(this.matrixWorld);var Ut=o.ray.origin.distanceTo(r);Ut<o.near||Ut>o.far||(n.push({distance:Ut,point:l.clone().applyMatrix4(this.matrixWorld),index:h,face:null,faceIndex:null,object:this}),h=m)}}}}X.prototype.raycast=qi;X.prototype.compareV3=function(o,n){var t=o*6,e=n*6;return this.positions[t]===this.positions[e]&&this.positions[t+1]===this.positions[e+1]&&this.positions[t+2]===this.positions[e+2]};X.prototype.copyV3=function(o){var n=o*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]};X.prototype.getDistance=function(o){let n=0;for(let t=0;t<o;t++){let e=6*t,i=new y.Vector3(this.positions[e],this.positions[e+1],this.positions[e+2]),r=new y.Vector3(this.positions[e+6],this.positions[e+7],this.positions[e+8]),s=i.distanceTo(r);n+=s}return n};X.prototype.process=function(){var o=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var n;let t=this.getDistance(o-1);var e;this.compareV3(0,o-1)?e=this.copyV3(o-2):e=this.copyV3(0),this.previous.push(e[0],e[1],e[2]),this.previous.push(e[0],e[1],e[2]);for(var i=0;i<o;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?n=this.widthCallback(i/(o-1)):n=1,this.width.push(n),this.width.push(n),i===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(i===o-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(i)/t;this.uvs.push(s,0),this.uvs.push(s,1)}if(i<o-1){e=this.copyV3(i),this.previous.push(e[0],e[1],e[2]),this.previous.push(e[0],e[1],e[2]);var r=i*2;this.indices_array.push(r,r+1,r+2),this.indices_array.push(r+2,r+1,r+3)}i>0&&(e=this.copyV3(i),this.next.push(e[0],e[1],e[2]),this.next.push(e[0],e[1],e[2]))}this.compareV3(o-1,0)?e=this.copyV3(1):e=this.copyV3(o-1),this.next.push(e[0],e[1],e[2]),this.next.push(e[0],e[1],e[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new y.BufferAttribute(new Float32Array(this.positions),3),previous:new y.BufferAttribute(new Float32Array(this.previous),3),next:new y.BufferAttribute(new Float32Array(this.next),3),side:new y.BufferAttribute(new Float32Array(this.side),1),width:new y.BufferAttribute(new Float32Array(this.width),1),uv:new y.BufferAttribute(new Float32Array(this.uvs),2),index:new y.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new y.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Fe(o,n,t,e,i){var r;if(o=o.subarray||o.slice?o:o.buffer,t=t.subarray||t.slice?t:t.buffer,o=n?o.subarray?o.subarray(n,i&&n+i):o.slice(n,i&&n+i):o,t.set)t.set(o,e);else for(r=0;r<o.length;r++)t[r+e]=o[r];return t}X.prototype.advance=function(o){var n=this._attributes.position.array,t=this._attributes.previous.array,e=this._attributes.next.array,i=n.length;Fe(n,0,t,0,i),Fe(n,6,n,0,i-6),n[i-6]=o.x,n[i-5]=o.y,n[i-4]=o.z,n[i-3]=o.x,n[i-2]=o.y,n[i-1]=o.z,Fe(n,6,e,0,i-6),e[i-6]=o.x,e[i-5]=o.y,e[i-4]=o.z,e[i-3]=o.x,e[i-2]=o.y,e[i-1]=o.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};y.ShaderChunk.meshline_vert=["",y.ShaderChunk.logdepthbuf_pars_vertex,y.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;","",y.ShaderChunk.logdepthbuf_vertex,y.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",y.ShaderChunk.fog_vertex,"}"].join(`
|
|
3777
|
+
`);y.ShaderChunk.meshline_frag=["",y.ShaderChunk.fog_pars_fragment,y.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() {","",y.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);","",y.ShaderChunk.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
|
|
3778
|
+
`);var Ot=class extends y.ShaderMaterial{constructor(n){super({uniforms:Object.assign({},y.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new y.Color(16777215)},opacity:{value:1},resolution:{value:new y.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 y.Vector2(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1},alphaTest:{value:.2}}),vertexShader:y.ShaderChunk.meshline_vert,fragmentShader:y.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(t){this.uniforms.lineWidth.value=t}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(t){this.uniforms.map.value=t}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(t){this.uniforms.useMap.value=t}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(t){this.uniforms.alphaMap.value=t}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(t){this.uniforms.useAlphaMap.value=t}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(t){this.uniforms.color.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(t){this.uniforms.sizeAttenuation.value=t}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(t){this.uniforms.dashArray.value=t,this.useDash=t!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(t){this.uniforms.dashRatio.value=t}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(t){this.uniforms.useDash.value=t}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(t){this.uniforms.visibility.value=t}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(t){this.uniforms.alphaTest.value=t}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(t){this.uniforms.repeat.value.copy(t)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(t){this.uniforms.thresholdRatio.value=t}}}),this.setValues(n)}};Ot.prototype.copy=function(o){return y.ShaderMaterial.prototype.copy.call(this,o),this.lineWidth=o.lineWidth,this.map=o.map,this.useMap=o.useMap,this.alphaMap=o.alphaMap,this.useAlphaMap=o.useAlphaMap,this.color.copy(o.color),this.opacity=o.opacity,this.resolution.copy(o.resolution),this.sizeAttenuation=o.sizeAttenuation,this.dashArray.copy(o.dashArray),this.dashOffset.copy(o.dashOffset),this.dashRatio.copy(o.dashRatio),this.useDash=o.useDash,this.visibility=o.visibility,this.alphaTest=o.alphaTest,this.repeat.copy(o.repeat),this};var ei="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 ni={texture_url:ei,lineWidth:8,color:16777215},xe=class extends D.Object3D{constructor(t,e){super();this.navigation=t;this.config=Object.assign({},ni,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}mesh=null;geometry=null;material=null;texture=null;config=ni;points=[];pathDistance=0;basicRepeat=1;prevCameraZoom=0;registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate)}onControlChange=()=>{let t=this.navigation.bmap.context.camera.zoom;t!==this.prevCameraZoom&&(this.prevCameraZoom=t,this.changeRepeat())};onUpdate=()=>{this.texture};getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:i,height:r}}}}}=this,s=t.map(([u,l])=>E(new D.Vector3(u,l,0),e,i,r)).map(({x:u,y:l})=>[u,l]);return ut(s)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new D.Vector2(t,1)}loadTexture(t){return new Promise((e,i)=>{new D.TextureLoader().load(t,e,void 0,i)})}transformPoints(t){let e=[];for(let i=0;i<t.length;i++)e.push(...t[i],0);return e}updatePoints(t){this.points=t,this.pathDistance=ut(t),this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){if(!this.material||!this.pathDistance)return;let e=t/this.pathDistance;this.material.thresholdRatio=e}async create(t){let e=this.geometry=new X;if(this.updatePoints(t),!this.texture){let s=this.texture=await this.loadTexture(this.config.texture_url);s.wrapS=s.wrapT=D.RepeatWrapping}let i=this.material=new Ot({useMap:!0,color:new D.Color(this.config.color),transparent:!0,resolution:new D.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!0,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:D.NormalBlending,repeat:new D.Vector2(this.getRepeat(),1)}),r=this.mesh=new D.Mesh(e,i);return r.renderOrder=9,this.add(r),r}dispose(){this.unRegistryEvent(),this.clear(),this.geometry?.dispose(),this.material?.dispose(),this.texture?.dispose()}};var Ft=g("@tweenjs/tween.js"),nt=g("three"),Yi={path:{},speed:10,cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},loadRoad:!0,roadNetwork:"RoadNetwork"},ii=class extends at{path=null;worker=Oe();fetchRoadStatus=!1;uniqueKey=new Tt;paths=[];options;pathTween=new Ft.Group;startPoi=null;movedDistance=0;pathStart=[0,0];animationPathOptions={cPathIndex:0};cPath=[];constructor(n,t,e={}){super(n),this.options=Object.assign({},Yi,e);let{apiDomain:i,apiPath:{roadNetwork:r},apiInfo:s}=this.bmap.config;this.registryEvent(),this.options.loadRoad&&Pt(this.worker,"load_road",{url:`${i||location.origin}${r}?project=${t}`,...s}).then(a=>{this.fetchRoadStatus=!0,this.dispatchEvent({type:"fetch-road-status",status:!0}),this.dispatchEvent({type:"fetch-road-data",roadInfo:a})}).catch(a=>{console.log("[\u52A0\u8F7D\u8DEF\u7F51\u5931\u8D25]",a)}),this.options.roadNetwork!=="RoadNetwork"&&Pt(this.worker,"change_road_network",this.options.roadNetwork)}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor)}onUpdate=()=>{this.pathTween.update()};async setRoadData(n){this.fetchRoadStatus=!1,this.dispatchEvent({type:"fetch-road-status",status:!1}),await Pt(this.worker,"set_road_info",n),this.fetchRoadStatus=!0,this.dispatchEvent({type:"fetch-road-status",status:!0})}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.pathTween.getAll().forEach(n=>n.stop()),this.pathTween.removeAll()),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null)}onSwitchFloor=({data:{curFloor:n}})=>{if(this.paths.length){let t=this.paths.find(e=>e.floor===n.name);t?this.renderPath(this.translatePoints(t.points)):this.clearPath()}else this.clearPath()};getDirectionPath(n){return Pt(this.worker,"get_direction_path",n)}addPath(n){this.paths=n;let t=this.bmap.context.currentFloor?.name,e=n.find(i=>i.floor===t);if(e)if(this.bmap.currentBuildGround)this.renderPath(this.translatePoints(e.points));else{let i=()=>{this.bmap.removeEventListener("center-change",i),this.renderPath(this.translatePoints(e.points))};this.bmap.addEventListener("center-change",i)}else this.clearPath()}translatePoints(n){let[t,e]=this.bmap.buildingCenter;return n.map(i=>[i[0]-t,i[1]-e])}getPath(n,t,e=""){return new Promise((i,r)=>{let s=()=>{Pt(this.worker,"get_path",{start:n,end:t,type:e}).then(a=>{a?typeof a=="string"?r(a):i(a):r("no-path")})};if(this.fetchRoadStatus)s();else{let a=({status:u})=>{u&&(this.removeEventListener("fetch-road-status",a),s())};this.addEventListener("fetch-road-status",a)}})}renderPath(n){let t=this.catmullRomCurve3(n);this.cPath=t,this.animationPathOptions={cPathIndex:0},this.movedDistance=0,this.pathStart=t[0],this.path?this.path.updatePoints(t):(this.path=new xe(this,this.options.path),this.path.create(t),this.path.position.z=this.bmap.context.currentFloor.groundMaxHeight+.5,this.bmap.context.scene.add(this.path)),this.startPoi&&(this.bmap.context.currentFloor?.poiLayer2.removePoi(this.startPoi),this.startPoi=null),this.options.needStartPoi&&(this.startPoi=new H(this.bmap.context,{...this.options.startPoi,id:"navigation_start_poi",position:{x:t[0][0],y:t[0][1],z:1e-4},collision_enable:!1})||null,this.bmap.context.currentFloor?.poiLayer2.pushPoi(this.startPoi))}catmullRomCurve3(n){return pn(n,!1,!0,.1,150,2.5)}async animationTo(n,t=this.options.speed){if(n.floor!==this.bmap.context.currentFloor?.name||!this.path)return;let{animationPathOptions:{cPathIndex:e}}=this,i=[this.pathStart,...this.cPath.slice(e+1)],r=this.translatePoints([n.pos])[0],{distance:s,pos:a,index:u}=i.reduce((h,m,x,b)=>{if(x===b.length-1)return h;let{distance:S,closestPoint:P}=fn(r,m,b[x+1]);return S<h.distance&&(h.distance=S,h.pos=P,h.index=x),h},{distance:Number.MAX_SAFE_INTEGER,pos:n.pos,index:0});if(s>this.options.cheapMaximumDistance||this.path.points[0][0]===a[0]&&this.path.points[0][1]===a[1])return;let l=0,c=[];if(u===0)l=R(i[0],a),c=[l];else{c=[R(i[0],i[1])];for(let h=1;h<u;h++)c.push(R(i[h],i[h+1]));c.push(R(i[u],a)),l=c.reduce((h,m)=>h+m,0)}let p=l/t;this.pathTween.getAll().forEach(h=>h.stop()),this.pathTween.removeAll();let f={distance:0},d=this.animationPathOptions.cPathIndex,_=0,v=0;return new Promise(h=>{let m=new Ft.Tween(f,this.pathTween).to({distance:l},p*1e3).onUpdate(async()=>{let x=f.distance-_;for(;c.length&&x>c[0];)_+=c.shift(),v++,x=f.distance-_;let b=i[v],S=i[v+1];if(!S)return;let P=dn(b,S,x);if(this.pathStart=P,this.path?.movePath(this.movedDistance+f.distance),this.animationPathOptions.cPathIndex=d+v,this.startPoi){this.startPoi.position.setX(P[0]).setY(P[1]);let B=new nt.Vector3(P[0],P[1],0),O=new nt.Vector3;O.setFromMatrixColumn(this.bmap.context.camera.matrix,1),O.normalize(),O.multiplyScalar(150/this.bmap.context.camera.zoom),B.add(O),this.bmap.context.setCameraPosition(B,0)}m.pause(),await this.changeCameraToPathUp(200),m.resume(),this.dispatchEvent({type:"path-animation",pathIndex:this.animationPathOptions.cPathIndex})}).onComplete(()=>{this.pathTween.remove(m),this.dispatchEvent({type:"path-animation-end"}),this.movedDistance+=l,h(!0)}).start()})}getPathDirection(){let n=this.cPath.slice(this.animationPathOptions.cPathIndex);if(n.length<3)return null;let t=n[0],e=n[1],i=n[2],r=zt(t,e,i);if(Math.abs(r)>=179&&Math.abs(r)<=180){let s=new nt.Vector3(i[0]-e[0],i[1]-e[1],0).normalize(),a=new nt.Vector3(0,1,0).normalize(),u=s.angleTo(a),l=new nt.Vector3().crossVectors(a,s);return(Object.is(l.y,0)?-1:1)*u}else return null}async changeCameraToPathUp(n=100){let t=this.getPathDirection();if(t===null)return;let e=this.bmap.context.control.getAzimuthalAngle();Math.abs(e-t)>Math.PI&&(e>0?t=Math.PI*2+t:t=t-Math.PI*2);let i=Math.abs(t-this.bmap.context.control.getAzimuthalAngle());if(i<.01)return;let{control:r}=this.bmap.context,s=n/Math.PI*4*i*10,a=150/this.bmap.context.camera.zoom,u=this.bmap.context.control.getPolarAngle(),l=this.bmap.context.control.maxPolarAngle,c=this.bmap.context.control.minPolarAngle;return this.bmap.context.control.minPolarAngle=this.bmap.context.control.maxPolarAngle=u,new Promise(p=>{let f={azimuthal:r.getAzimuthalAngle()},d={azimuthal:t},_=new Ft.Tween(f,this.pathTween).to(d,s).onUpdate(async()=>{this.bmap.context.control.target.copy(this.startPoi.position),this.bmap.context.setAzimuthalAngle(f.azimuthal,0);let v=r.target.clone(),h=new nt.Vector3;h.setFromMatrixColumn(this.bmap.context.camera.matrix,1),h.normalize(),h.multiplyScalar(a),v.add(h),this.bmap.context.setCameraPosition(v,0)}).onComplete(()=>{r.enabled=!0,this.pathTween.remove(_),this.bmap.context.control.minPolarAngle=c,this.bmap.context.control.maxPolarAngle=l,p(!0)}).onStart(()=>{r.enabled=!1}).start()})}async initNavigationCamera(){await this.translateCameraToStartPoi(300),await this.changeCameraToPathUp(300)}async translateCameraToStartPoi(n=100){if(!this.startPoi)return;let{clientSize:{width:t,height:e},camera:i,control:r}=this.bmap.context,s=Math.round(t/2),a=Math.round(e/2),u=r.target.clone(),l=E(this.startPoi.position,i,t,e),c=l.x-s,p=a-l.y+150;if(console.log(l,c,p,this.startPoi.position,s,a),!(Math.abs(c)<1&&Math.abs(p)<1)){if(Math.abs(c)>=1){let f=new nt.Vector3;f.setFromMatrixColumn(i.matrix,0),f.normalize(),f.multiplyScalar(c/i.zoom),u.add(new nt.Vector3(f.x,0,0))}if(Math.abs(p)>=1){let f=new nt.Vector3;f.setFromMatrixColumn(i.matrix,1),f.normalize(),f.multiplyScalar(p/i.zoom),u.add(new nt.Vector3(0,f.y,0))}return this.bmap.context.setCameraPosition(u,n)}}async initCameraZoom(n=100){if(!this.startPoi)return;let{clientSize:{width:t,height:e},currentFloor:i}=this.bmap.context,{max:r,min:s}=i.box,u=Math.min(t/(r.x-s.x),e/(r.y-s.y))*(r.x-s.x)/20;return this.bmap.context.setZoom(u,this.startPoi.position,n)}dispose(){this.worker.terminate(),this.unRegistryEvent(),this.path?.dispose(),this.uniqueKey.dispose(),this.startPoi?.dispose()}};var ri=class extends at{cacheData=new Map;floorDataLengthMap=new Map;async load(n){let t=et(n);if(this.cacheData.has(t))return this.cacheData.get(t);console.time("floor/get\u8BF7\u6C42"+n.resource_type_list);let[,e]=await Promise.all([this.loadBuildGround(n),_e(n,this.bmap.config)]);console.timeEnd("floor/get\u8BF7\u6C42"+n.resource_type_list);let i=et({floor:n.floor,ts:n.ts});this.bmap.transformGraphicData(e,this.bmap.buildingCenter,this.floorDataLengthMap.get(i)||0),e.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(t,e);let r=this.floorDataLengthMap.get(i)||0;return this.floorDataLengthMap.set(i,r+e.length),e}isSameFloor(n){return this.bmap.context.currentFloor?.key===et(n)}switchFloorByData(n,t){if(this.isSameFloor(t)){if(!n.length)return;let e=this.bmap.context.currentFloor,i=e.userData.legacyToGraphicMap,r=e.userData.graphicMap,s=[];for(let a of n){if(a.info.group==="ground")e.createGround(a.info);else{let u=e.addGraphic(a.info);u.userData.data=a,i.set(a.legacy_id,u),s.push(u)}r.set(a.element_uuid,a)}this.bmap.triggerHooks("switch_floor_before",{curFloor:e,graphics:s}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks("switch_floor_after",{curFloor:e,graphics:s})}else{let e=et(t),{curFloor:i,graphics:r}=this.bmap.createFloor(n);i.name=t.floor,i.key=e;let s=new Map;n.forEach(a=>{s.set(a.element_uuid,a)}),i.userData.graphicMap=s,this.bmap.triggerHooks("switch_floor_before",{curFloor:i,graphics:r}),this.bmap.context.switchFloor(i),this.bmap.initialFloorCamera(),this.bmap.triggerHooks("switch_floor_after",{curFloor:i,graphics:r})}}filterData(n,t){if(!this.isSameFloor(t))return n;let e=this.bmap.context.currentFloor.userData.graphicMap;return n.filter(i=>!e.has(i.element_uuid))}async switchFloorByStoreData(n){let t=await this.load({...n,resource_type_list:"6"}),e=this.filterData(t,n);this.switchFloorByData(e,n)}async switchFloorByOtherData(n){let t=await this.load({...n,resource_type_list:"1,2,3,4"}),e=this.filterData(t,n);this.switchFloorByData(e,n)}async loadBuildGround({brand:n,project:t}){let e=et({brand:n,project:t});return await this.bmap.loadBuildingGround({brand:n,project:t}),this.bmap.currentBuildGround=this.bmap.buildingGroundMap.get(e)||null,this.bmap.currentBuildGround}async changeFloor(n){return await Promise.all([this.switchFloorByStoreData(n),this.switchFloorByOtherData(n)]),Array.from(this.bmap.context.currentFloor.userData.graphicMap.values())}};var si=g("three"),oi=class extends at{poiLayer;floors=[];group=new si.Group;constructor(n){super(n),this.poiLayer=new Lt(n.context)}show(n){let t=n[0].userData.height;n.forEach(r=>{r.poiLayer.pois.forEach(s=>{this.poiLayer.pushPoi(s)}),r.poiLayer.pois.length=0,r.poiLayer.dispose(),r.position.z=t,t+=r.userData.height});let{scene:e,currentFloor:i}=this.bmap.context;i&&(e.remove(i),i.dispose()),this.group.add(this.poiLayer,...n),e.add(this.group),this.floors=n,this.bmap.context.cameraBound.updateBox()}hide(){let{scene:n}=this.bmap.context;n.remove(this.group),this.poiLayer.clear(!0),this.floors.forEach(t=>{t.dispose()}),this.floors=[],this.group.clear()}fitCamera(){let{context:n,config:t,type:e}=this.bmap;n.cameraBound.setEnable(!1),n.control.minZoom=0,n.control.maxZoom=1/0,n.camera.zoom=1,n.setAzimuthalAngle(t.control.defaultAzimuthal,0),n.setPolarAngle(t.control.defaultPolar,0),n.fitCameraToObject(this.group,void 0,0);let i=n.camera.zoom;n.control.minZoom=i,n.control.maxZoom=i*25,e==="3d"&&n.fitCameraToObject(this.group,t.defaultPadding,0,!1),this.bmap.basicZoom=n.camera.zoom,n.control.addEventListener("change",this.bmap.onControlChange.bind(this.bmap)),this.bmap.onControlChange(),n.cameraBound.setEnable(!0)}dispose(){this.poiLayer.dispose(),this.floors.forEach(n=>n.dispose()),this.floors=[]}};var it;function ai(o="aibee_map"){return new Promise((n,t)=>{if(it)return n({db:it,type:"success"});let e=indexedDB.open(o);e.onupgradeneeded=function(i){it=i.target.result,console.log("onupgradeneeded"),n({db:it,type:"onupgradeneeded"})},e.onsuccess=i=>{it=i.target.result,n({db:it,type:"success"})},e.onerror=i=>{t(i)}})}function li(o,n,t=it){return new Promise((e,i)=>{t||i("\u6CA1\u6709db");let s=t.transaction([o],"readonly").objectStore(o).get(n);s.onsuccess=()=>{s.result?e(s.result.value):e(null)},s.onerror=a=>{console.log("[getVersionByKey]",a),e(null)}})}function ui(o,n,t,e=it){return new Promise((i,r)=>(e||r("\u6CA1\u6709db"),new Promise((s,a)=>{let l=e.transaction([o],"readwrite").objectStore(o).add({key:n,value:t});l.onsuccess=function(c){s(c)},l.onerror=function(c){a(c)}})))}function Ee(o,n=it){n&&(n.objectStoreNames.contains(o)||n.createObjectStore(o,{keyPath:"key"}))}function ci(){it?.close(),it=null}function lt(o,n,t=0){o.forEach(e=>{e.geometry.coords=JSON.parse(JSON.stringify(e.geometry.cds)),e.geometry.type==="polygon"?(e.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(r=>{r[0]-=n[0],r[1]-=n[1]})}),e.geometry.otherCds&&(e.geometry.otherCoords=e.geometry.otherCds.map(i=>i.map(r=>ft(r,n))))):e.geometry.coords=ft(e.geometry.cds,n)});for(let e=0;e<o.length;e++){let i=o[e];i.deltaHeight=1e-5*(t+e+1)}}function ft(o,n){return[o[0]-n[0],o[1]-n[1]]}var hi='data:image/svg+xml,<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1722508608758" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1737" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M671.672075 807.841824l-12.086033-1.711297-5.561715 10.695605a235.303309 235.303309 0 1 1-328.889852-310.172544l8.128659-4.813022v-9.519089c0.855648-28.236397-13.369506-48.45109-38.183309-54.226717l-6.738232-1.497385-5.989538 3.52955a314.450786 314.450786 0 1 0 438.519803 419.695539l3.850418-6.952143-2.887813-7.807792a60.216256 60.216256 0 0 0-50.162388-37.220705z" fill="%23ffffff" p-id="1738"></path><path d="M893.498922 805.167922c-2.994769-21.39121-16.578188-37.541573-30.268562-35.616364l-70.911861 9.839956-57.64931-189.633075a10.695605 10.695605 0 0 1 0-1.069561 37.969398 37.969398 0 0 0-35.830277-25.99032H435.620074V414.029649h157.760173v-78.826609H435.620074v-50.162387a39.466782 39.466782 0 1 0-78.826609 0v305.787346a44.065892 44.065892 0 0 0-1.711297 11.337341 39.680694 39.680694 0 0 0 17.540793 33.156376A37.755486 37.755486 0 0 0 407.918457 641.846035h260.117113l61.71364 203.216494a30.268562 30.268562 0 0 0 28.98509 19.145133h0.855648a48.985871 48.985871 0 0 0 16.364276-2.139121h0.641736l97.330005-13.369506c13.79733-2.887813 22.567726-21.92599 19.572957-43.531113zM406.955852 197.229736a98.613478 98.613478 0 1 0-98.506521-98.506521 98.506522 98.506522 0 0 0 98.506521 98.506521z" fill="%23ffffff" p-id="1739"></path></svg>';var pi='data:image/svg+xml,<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1722508633972" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3840" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M568 171.84v285.312h144.64a12.8 12.8 0 0 1 10.816 19.648l-243.84 382.208a12.8 12.8 0 0 1-23.616-6.848V566.848h-144.64a12.8 12.8 0 0 1-10.816-19.648l243.84-382.208a12.8 12.8 0 0 1 23.616 6.848z" fill="%23ffffff" fill-opacity=".88" p-id="3841"></path></svg>';var fi='data:image/svg+xml,<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1722508689425" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9597" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M354.1 768.4l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m375.5-7.1l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m0 0l-63.1 7.1c-0.1 0.3-0.2 0.7-0.2 1.1v15.9c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-23.5c0.1-0.2 0.1-0.4 0-0.6z m-375.5 7.1l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z m0 0l-63.1-7.1v24.1c0 0.3 0 0.6 0.1 0.9h63.1c0.1-0.3 0.1-0.6 0.1-0.9v-15.9c0-0.3-0.1-0.7-0.2-1.1z" p-id="9598" fill="%23ffffff"></path><path d="M354.3 769.6v15.9c0 0.3 0 0.6-0.1 0.9h-63.1c-0.1-0.3-0.1-0.6-0.1-0.9V762v-0.6l63.1 7.1c0.1 0.3 0.2 0.7 0.2 1.1z" p-id="9599" fill="%23ffffff"></path><path d="M354.3 769.6v15.9c0 0.3 0 0.6-0.1 0.9h-63.1c-0.1-0.3-0.1-0.6-0.1-0.9V762v-0.6l63.1 7.1c0.1 0.3 0.2 0.7 0.2 1.1zM729.7 761.9v23.5c0 0.3 0 0.6-0.1 0.9h-63.1c-0.1-0.3-0.1-0.6-0.1-0.9v-15.9c0-0.4 0.1-0.8 0.2-1.1l63.1-7.1v0.6z" p-id="9600" fill="%23ffffff"></path><path d="M729.7 761.9v23.5c0 0.3 0 0.6-0.1 0.9h-63.1c-0.1-0.3-0.1-0.6-0.1-0.9v-15.9c0-0.4 0.1-0.8 0.2-1.1l63.1-7.1v0.6zM158.3 132.8h50.6v38h-50.6zM253.8 132.8h50.6v38h-50.6zM353.8 132.8h50.6v38h-50.6zM441.3 132.8h139.2v38H441.3zM614.8 132.8h50.6v38h-50.6zM711.6 132.8h50.6v38h-50.6zM809.1 132.8h50.6v38h-50.6z" p-id="9601" fill="%23ffffff"></path><path d="M158.3 132.8h50.6v38h-50.6zM253.8 132.8h50.6v38h-50.6zM353.8 132.8h50.6v38h-50.6zM441.3 132.8h139.2v38H441.3zM614.8 132.8h50.6v38h-50.6zM711.6 132.8h50.6v38h-50.6zM809.1 132.8h50.6v38h-50.6z" p-id="9602" fill="%23ffffff"></path><path d="M967.6 202.4V101.2c0-24.4-19.8-44.3-44.3-44.3H100.7c-24.5 0-44.3 19.8-44.3 44.3v101.3c0 24 19.2 43.6 43 44.3v673.8h-24c-10.5 0-19 8.5-19 19s8.5 19 19 19h873.2c10.5 0 19-8.5 19-19s-8.5-19-19-19h-22.8v-674c23.3-1.3 41.8-20.6 41.8-44.2z m-873.2 0V101.2c0-3.5 2.8-6.3 6.3-6.3h822.6c3.5 0.1 6.3 2.9 6.3 6.3v101.3c0 3.5-2.8 6.3-6.3 6.3H100.7c-3.4-0.1-6.3-3-6.3-6.4zM253 785.5V762c0-11.9 4.9-23 13.5-30.4 7.5-6.6 17.5-9.5 27.4-8.1l66.7 7.5c18.3 2.8 31.6 19.3 31.6 38.6v15.9c0 21.4-16.1 38.9-35.9 38.9H289c-19.9-0.1-36-17.5-36-38.9z m60.3 116c0 10.5-8.5 19-19 19s-19-8.5-19-19V884l38 0.2v17.3z m34.5 19c2.1-6 3.5-12.3 3.5-19v-17.1l159.7 0.8h0.2l155.2-0.8v17.1c0 6.7 1.4 13 3.5 19H347.8z m394.5-19c0 10.5-8.5 19-19 19s-19-8.5-19-19v-17.3l38-0.2v17.5z m25.3-116.1c0 21.4-16.1 38.9-35.9 38.9h-67.3c-19.8 0-35.9-17.4-35.9-38.9v-15.9c0-19.3 13.3-35.8 30.9-38.5l68.1-7.7c9.1-1.4 19 1.6 26.7 8.2 8.6 7.4 13.5 18.5 13.5 30.4v23.5zM611.1 661.7c4.1-12.8 15.9-22.1 30-22.1s26 9.4 30 22.1h-60z m98.8-0.2c-4.7-33.8-33.8-59.9-68.8-59.9-35.1 0-64.2 26.2-68.9 60.1H315.9c-27 0-45.6-10.5-63.7-26.7 2.9-7.8 5.7-15.4 8.2-22.2 3.7-10 6.7-18.2 8.3-22.7 0.9-2.6 1.7-5.2 2.2-7.8l27.9-75.6c20.8-54.4 74.5-55.6 76.7-55.7h270c0.6 0 55.3 0.6 77.9 55.4l27.9 75.8c0.6 2.7 1.3 5.2 2.2 7.8l8.3 22.6c2.4 6.4 5.1 13.9 7.9 21.6-19.7 16.3-35.4 26.3-59.8 27.3z m178 259H776.8c2.1-6 3.5-12.3 3.5-19v-17.7h2c15.1 0.1 29.6-5.8 40.3-16.5 11.3-11.2 17.6-26.4 17.5-42.3v-83.2c0-17.6-13.8-62.2-13.9-62.7-2.7-8.4-15.1-42.4-28.8-79.5l-8.2-22.4c-0.4-1.1-0.7-2.3-0.9-3.5-0.2-1.1-0.5-2.1-0.9-3.1l-28.7-77.9c-32.3-78.7-110-79.6-113.2-79.6h-270c-3.3 0-81.9 0.9-112.2 80.3l-28.4 77.2c-0.4 1-0.7 2.1-0.9 3.1-0.2 1.2-0.5 2.3-0.9 3.5-1.6 4.4-4.6 12.6-8.3 22.5-10.6 28.8-25.2 68.1-28.7 79.5-0.2 0.4-13.9 44.9-13.9 62.6V825c-0.1 15.9 6.2 31.1 17.5 42.3 10.3 10.2 23.9 15.6 37.8 16.3v17.9c0 6.7 1.4 13 3.5 19H137.4V246.7h750.5v673.8z" p-id="9603" fill="%23ffffff"></path><path d="M441.3 132.8h139.2v38H441.3zM353.8 132.8h50.6v38h-50.6zM253.8 132.8h50.6v38h-50.6zM158.3 132.8h50.6v38h-50.6zM809.1 132.8h50.6v38h-50.6zM711.6 132.8h50.6v38h-50.6zM614.8 132.8h50.6v38h-50.6z" p-id="9604" fill="%23ffffff"></path></svg>';var Fu={loadRoadNetwork:!1},be="version",Ue="map_data",Me="road_network_data",di={half:hi,power:pi,mechanical:fi},gi=class{constructor(n){this.bmap=n;this.initDb()}floors=[];async initDb(){try{let{db:n,type:t}=await ai();t==="onupgradeneeded"&&(Ee(be),Ee(Ue),Ee(Me))}catch(n){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",n)}}async load(n){if(this.clear(),Array.isArray(n))this.floors=n;else{let t=await fetch(n).then(e=>e.json());t.code==="0"&&(this.floors=t.data.list)}}setCacheData(n,t,e){return ui(n,`${t}`,e)}getCacheData(n,t){return li(n,`${t}`)}getFloorCacheKey(n){return`${n.floor_id}`}async getFloorData(n){let t=this.floors.find(i=>i.floor===n);if(!t)return null;let e=this.getFloorCacheKey(t);try{if(await this.getCacheData(be,e)===t.version_id){let r=await this.getCacheData(Ue,e);if(r)return this.getDataByJson(r)}return this.getFloorDataByFloorInfo(t)}catch{return this.getFloorDataByFloorInfo(t)}}async getFloorDataByFloorInfo(n){let t=this.getFloorCacheKey(n);console.time("zstd_json");let e=await fetch(n.map_url).then(i=>i.json());return e.floor=n.floor,console.timeEnd("zstd_json"),this.setCacheData(Ue,t,e),this.setCacheData(be,t,n.version_id),this.getDataByJson(e)}async getRoadNetworkData(){return(await Promise.all(this.floors.map(async t=>{let e=this.getFloorCacheKey(t);try{if(await this.getCacheData(be,e)===t.version_id){let s=await this.getCacheData(Me,e);if(s)return s}let r=await fetch(t.route_url).then(s=>s.json());return this.setCacheData(Me,e,r),r}catch{let i=await fetch(t.route_url).then(r=>r.json());return this.setCacheData(Me,e,i),i}}))).filter(t=>t.points)}async getOtherDataByFreeTime(){}async getMulFloorsData(n){return Promise.all(n.map(t=>this.getFloorData(t))).then(t=>t.filter(e=>e))}async getDataByUrl(n){let t=await fetch(n).then(e=>e.json());return this.getDataByJson(t)}getDataByJson(n){let t=new pt(this.bmap.context),e=[0,0];return n.layers.forEach(i=>{switch(i.l_type){case"range":let r=i.elements[0];e=[r.center_x,r.center_y];break;case"graph":let s=[],a=new Map;lt(i.elements,e);let u=[];i.elements.forEach(h=>{if(h.group==="ground")t.createGround(h);else if(h.canMerge)u.push(h);else{let m=t.addGraphic(h);s.push(m),a.set(h.id,m)}}),t.userData.graphics=s,t.userData.graphicMap=a;let l=u.reduce((h,m)=>{let{fillColor:x,fillOpacity:b,strokeColor:S,strokeOpacity:P,height:B}=m,O=`${x}-${b}-${S}-${P}-${B}`;return h[O]?h[O].push(m):h[O]=[m],h},{});Object.values(l).forEach(h=>{let m=new ue(this.bmap.context,h);t.mergeGraphicLayer.add(m)});break;case"ground":lt(i.elements,e);let c=i.elements.map(h=>new G(this.bmap.context,h));t.addGrounds(c);break;case"wall":lt(i.elements,e);let p=i.elements.reduce((h,m)=>{let{fillColor:x,fillOpacity:b,strokeColor:S,strokeOpacity:P,height:B}=m,O=`${x}-${b}-${S}-${P}-${B}`;return h[O]?h[O].push(m):h[O]=[m],h},{});Object.values(p).forEach(h=>{let m=new se(this.bmap.context,h);t.wallLayer.add(m)});break;case"lane":lt(i.elements,e);let f=i.elements.reduce((h,m)=>{let{fillColor:x,fillOpacity:b,strokeColor:S,strokeOpacity:P}=m,B=`${x}-${b}-${S}-${P}`;return h[B]?h[B].push(m):h[B]=[m],h},{});Object.values(f).forEach(h=>{let m=new le(this.bmap.context,h);t.laneLayer.add(m)});break;case"texture2d":case"texture3d":if(lt(i.elements,e),i.elements.length){let h=new Dt(this.bmap.context,i.elements);t.textureLayer.add(h)}break;case"glb":lt(i.elements,e),i.elements.forEach(h=>{let m=ft([h.center_x,h.center_y],e),x=new ae(this.bmap.context,{...h,url:h.secondUrl,rotate:h.secondRotate,width:h.secondWidth,center_x:m[0],center_y:m[1]});t.glbModelLayer.add(x)});break;case"store":lt(i.elements,e),i.elements.map(h=>{let m=ft([h.center_x,h.center_y],e),x=t.addGraphic(h);t.userData.graphics.push(x),t.userData.graphicMap.set(h.id,x);let b=new H(this.bmap.context,{id:h.id,icon:h.poi_info.icon,text:h.poi_info.showName||h.store_name||h.poi_info.text,position:{x:m[0],y:m[1],z:h.airHeight+h.height},icon_size:[18,18]});t.poiLayer2.pushPoi(b),b&&(b.userData.type="store",b.userData.data=h)});break;case"facility":lt(i.elements,e),i.elements.map(h=>{let m=ft(h.geometry.cds,e),x=t.addGraphic(h);if(t.userData.graphics.push(x),t.userData.graphicMap.set(h.id,x),h.poi_info){let b=new H(this.bmap.context,{id:h.id,icon:h.poi_info.icon,text:h.poi_info.showName||h.store_name||h.poi_info.text,position:{x:m[0],y:m[1],z:h.airHeight+h.height},icon_size:[18,18]});t.poiLayer2.pushPoi(b),b.userData.type="facility",b.userData.data=h}});break;case"parkingSpace":lt(i.elements,e);let d=[],_=new Map;i.elements.forEach(h=>{let m=t.addGraphic(h);d.push(m),_.set(h.id,m);let x=ft([h.center_x,h.center_y],e);if(h.texts[0]){let b=new H(this.bmap.context,{id:h.id,text:h.texts[0],position:{x:x[0],y:x[1],z:h.airHeight+h.height}});b&&(b.userData.type="parkingSpace",b.userData.data=h),t.poiLayer2.pushPoi(b)}});let v=i.elements.filter(h=>di[h.parkingType]).map(h=>{let m=ft([h.center_x,h.center_y],e),x=Je(h.geometry.coords,m);return{uuid:h.id,iconUrl:di[h.parkingType],name:h.texts[0],deltaHeight:h.deltaHeight,airHeight:h.airHeight,height:h.height,geometry:{...h.geometry,coords:x},opacity:h.fillOpacity,visible:!0}});if(v.length){let h=new Dt(this.bmap.context,v);t.textureLayer.add(h)}t.userData.parkingSpaces=d,t.userData.parkingSpacesGraphicMap=_;break}}),t.userData.center=e,t.userData.height=n.floorHeight,t.name=n.floor,t.userData.data=n,t.updateBox(),t}clear(){}dispose(){this.clear(),ci()}};})();
|
|
3779
3779
|
//# sourceMappingURL=bmap.min.js.map
|