@aibee/crc-bmap 0.6.2 → 0.6.3
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 +7 -7
- package/lib/bmap.cjs.min.js.map +3 -3
- package/lib/bmap.esm.js +15 -9
- package/lib/bmap.esm.js.map +2 -2
- package/lib/bmap.esm.min.js +6 -6
- package/lib/bmap.esm.min.js.map +3 -3
- package/lib/bmap.min.js +7 -7
- package/lib/bmap.min.js.map +3 -3
- package/package.json +1 -1
package/lib/bmap.esm.js
CHANGED
|
@@ -8399,7 +8399,6 @@ var PositionNavigation = class extends EventDispatcher10 {
|
|
|
8399
8399
|
onAddPaths = ({ paths }) => {
|
|
8400
8400
|
this.paths = paths;
|
|
8401
8401
|
this.resetStatus(paths);
|
|
8402
|
-
this.emitNavigationStatus();
|
|
8403
8402
|
};
|
|
8404
8403
|
onUpdate = () => {
|
|
8405
8404
|
this.tweenUtil.update();
|
|
@@ -8442,12 +8441,16 @@ var PositionNavigation = class extends EventDispatcher10 {
|
|
|
8442
8441
|
...allPath.slice(routeIndex + 1)
|
|
8443
8442
|
];
|
|
8444
8443
|
const { distance, closestPoint, index, i } = paths.reduce((obj, cur, index2) => {
|
|
8444
|
+
console.log("cur", cur.floor, floor);
|
|
8445
8445
|
if (cur.floor !== floor) {
|
|
8446
8446
|
return obj;
|
|
8447
8447
|
}
|
|
8448
8448
|
const { distance: distance2, closestPoint: closestPoint2, index: i2 } = cur.points.reduce((obj2, cur2, index3, arr) => {
|
|
8449
8449
|
if (!arr[index3 + 1]) {
|
|
8450
|
-
return
|
|
8450
|
+
return {
|
|
8451
|
+
...obj2,
|
|
8452
|
+
distance: obj2.distance === Infinity ? getLength(cur2, _position) : obj2.distance
|
|
8453
|
+
};
|
|
8451
8454
|
}
|
|
8452
8455
|
const { distance: distance3, closestPoint: closestPoint3 } = distancePointToSegment(_position, cur2, arr[index3 + 1]);
|
|
8453
8456
|
if (distance3 < obj2.distance) {
|
|
@@ -8464,6 +8467,7 @@ var PositionNavigation = class extends EventDispatcher10 {
|
|
|
8464
8467
|
}
|
|
8465
8468
|
toPosition(floor, pos) {
|
|
8466
8469
|
const adsorbData = this.adsorb(floor, pos);
|
|
8470
|
+
console.log("adsorbData", adsorbData);
|
|
8467
8471
|
if (!adsorbData) {
|
|
8468
8472
|
return;
|
|
8469
8473
|
}
|
|
@@ -8516,6 +8520,8 @@ var PositionNavigation = class extends EventDispatcher10 {
|
|
|
8516
8520
|
}, 200);
|
|
8517
8521
|
const tween = this.simulationTween = new Tween3({ distance: 0 }, this.tweenUtil.group).to({ distance }, time * 1e3).onUpdate(onUpdate).onComplete(() => {
|
|
8518
8522
|
this.tweenUtil.remove(tween);
|
|
8523
|
+
onUpdate.flush();
|
|
8524
|
+
onUpdate.cancel();
|
|
8519
8525
|
if (this.routeIndex + 1 < this.paths.length) {
|
|
8520
8526
|
this.routeIndex++;
|
|
8521
8527
|
this.position = this.paths[this.routeIndex].points[0];
|
|
@@ -8523,7 +8529,7 @@ var PositionNavigation = class extends EventDispatcher10 {
|
|
|
8523
8529
|
resolve(this.startCurRouteSimulation());
|
|
8524
8530
|
} else {
|
|
8525
8531
|
resolve(true);
|
|
8526
|
-
console.log(arr);
|
|
8532
|
+
console.log(arr, this.routeIndex, this.paths);
|
|
8527
8533
|
}
|
|
8528
8534
|
}).start();
|
|
8529
8535
|
});
|
|
@@ -8560,7 +8566,7 @@ var PositionNavigation = class extends EventDispatcher10 {
|
|
|
8560
8566
|
const p2 = curRoutePathPoints[pointIndex + 1];
|
|
8561
8567
|
const p3 = curRoutePathPoints[pointIndex + 2];
|
|
8562
8568
|
if (!p1 || !p2) {
|
|
8563
|
-
return
|
|
8569
|
+
return { dir: "end" /* END */, distance: 0 };
|
|
8564
8570
|
}
|
|
8565
8571
|
const distance = getLength(position, p2);
|
|
8566
8572
|
if (pointIndex === 0) {
|
|
@@ -8691,7 +8697,7 @@ var Navigation = class extends Plugin {
|
|
|
8691
8697
|
if (!this.toPositionPromise) {
|
|
8692
8698
|
this.toPositionPromise = this.toPositionBySpeed(info.pos, this.options.speed);
|
|
8693
8699
|
} else {
|
|
8694
|
-
this.toPositionPromise.
|
|
8700
|
+
this.toPositionPromise.finally(() => {
|
|
8695
8701
|
return this.toPositionBySpeed(info.pos, this.options.speed);
|
|
8696
8702
|
});
|
|
8697
8703
|
}
|
|
@@ -8742,7 +8748,7 @@ var Navigation = class extends Plugin {
|
|
|
8742
8748
|
this.currentPathPosition = path.points[0];
|
|
8743
8749
|
}
|
|
8744
8750
|
this.movedDistance = 0;
|
|
8745
|
-
this.
|
|
8751
|
+
this.clearTween();
|
|
8746
8752
|
}
|
|
8747
8753
|
setCurPathIndex(index) {
|
|
8748
8754
|
this.curPathIndex = index;
|
|
@@ -8997,14 +9003,14 @@ var Navigation = class extends Plugin {
|
|
|
8997
9003
|
if (this.pathTween) {
|
|
8998
9004
|
this.clearTween();
|
|
8999
9005
|
}
|
|
9000
|
-
return new Promise((resolve) => {
|
|
9006
|
+
return timeoutPromise(new Promise((resolve) => {
|
|
9001
9007
|
const tween = this.pathTween = new Tween4({ distance: 0 }, this.tweenUtil.group).to({ distance }, time * 1e3).onUpdate(async (v) => {
|
|
9002
9008
|
this.moveDistance(v.distance + curDistance, tween);
|
|
9003
9009
|
}).onComplete(() => {
|
|
9004
9010
|
this.tweenUtil.remove(tween);
|
|
9005
9011
|
resolve(true);
|
|
9006
9012
|
}).start();
|
|
9007
|
-
});
|
|
9013
|
+
}), time * 1e3 + 500);
|
|
9008
9014
|
}
|
|
9009
9015
|
async moveDistance(distance, tween) {
|
|
9010
9016
|
this.movedDistance = distance;
|
|
@@ -9191,7 +9197,7 @@ import { EventDispatcher as EventDispatcher12 } from "three";
|
|
|
9191
9197
|
|
|
9192
9198
|
// src/plugins/cr-nav-path/cr-path.worker.ts
|
|
9193
9199
|
function Worker3() {
|
|
9194
|
-
return inlineWorker('var $1=Object.create;var Rh=Object.defineProperty;var Z1=Object.getOwnPropertyDescriptor;var J1=Object.getOwnPropertyNames,fm=Object.getOwnPropertySymbols,K1=Object.getPrototypeOf,pm=Object.prototype.hasOwnProperty,j1=Object.prototype.propertyIsEnumerable;var Ih=(r,t,e)=>t in r?Rh(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Sl=(r,t)=>{for(var e in t||(t={}))pm.call(t,e)&&Ih(r,e,t[e]);if(fm)for(var e of fm(t))j1.call(t,e)&&Ih(r,e,t[e]);return r};var Ht=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var Q1=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of J1(t))!pm.call(r,a)&&a!==e&&Rh(r,a,{get:()=>t[a],enumerable:!(o=Z1(t,a))||o.enumerable});return r};var Wn=(r,t,e)=>(e=r!=null?$1(K1(r)):{},Q1(t||!r||!r.__esModule?Rh(e,"default",{value:r,enumerable:!0}):e,r));var Si=(r,t,e)=>Ih(r,typeof t!="symbol"?t+"":t,e);var mm=Ht((PR,dm)=>{var Lh=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError(\'"priority" must be a number\');return this.keys.has(t)?this.queue.map(a=>(a.key===t&&Object.assign(a,{priority:o}),a)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};dm.exports=Lh});var vm=Ht((IR,ym)=>{function gm(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,gm(a,t)):o!==t&&e.set(o,a);return e}ym.exports=gm});var Em=Ht((RR,xm)=>{function tx(r){let t=Number(r);return!(isNaN(t)||t<=0)}function _m(r){let t=new Map;return Object.keys(r).forEach(o=>{let a=r[o];if(a!==null&&typeof a=="object"&&!Array.isArray(a))return t.set(o,_m(a));if(!tx(a))throw new Error(`Could not add node at key "${o}", make sure it\'s a valid node`,a);return t.set(o,Number(a))}),t}xm.exports=_m});var wm=Ht((LR,Sm)=>{function Mm(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){Mm(t);return}if(typeof t!="number"||t<=0)throw new Error(`Values must be numbers greater than 0. Found value ${t} at ${e}`)})}Sm.exports=Mm});var Cm=Ht((NR,Am)=>{var ex=mm(),nx=vm(),bm=Em(),Tm=wm(),Nh=class{constructor(t){t instanceof Map?(Tm(t),this.graph=t):t?this.graph=bm(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(Tm(e),o=e):o=bm(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=nx(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,l=new ex,h=new Map,f=[],p=0,d=[];if(o.avoid&&(d=[].concat(o.avoid)),d.includes(t))throw new Error(`Starting node (${t}) cannot be avoided`);if(d.includes(e))throw new Error(`Ending node (${e}) cannot be avoided`);for(l.set(t,0);!l.isEmpty();){let g=l.next();if(g.key===e){p=g.priority;let y=g.key;for(;h.has(y);)f.push(y),y=h.get(y);break}a.add(g.key),(this.graph.get(g.key)||new Map).forEach((y,M)=>{if(a.has(M)||d.includes(M))return null;if(!l.has(M))return h.set(M,g.key),l.set(M,g.priority+y);let b=l.get(M).priority,T=g.priority+y;return T<b?(h.set(M,g.key),l.set(M,T)):null})}return f.length?(o.trim?f.shift():f=f.concat([t]),o.reverse||(f=f.reverse()),o.cost?{path:f,cost:p}:f):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};Am.exports=Nh});var dc=Ht((VR,v0)=>{"use strict";var y0=Object.getOwnPropertySymbols,rT=Object.prototype.hasOwnProperty,iT=Object.prototype.propertyIsEnumerable;function oT(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function sT(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(l){return t[l]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(l){a[l]=l}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(l){return!1}}v0.exports=sT()?Object.assign:function(r,t){for(var e,o=oT(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var h in e)rT.call(e,h)&&(o[h]=e[h]);if(y0){a=y0(e);for(var f=0;f<a.length;f++)iT.call(e,a[f])&&(o[a[f]]=e[a[f]])}}return o}});var sp=Ht((ip,op)=>{(function(r,t){typeof ip=="object"&&typeof op!="undefined"?op.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(ip,function(){"use strict";function r(x,v,P,S,L){(function N(G,B,I,O,q){for(;O>I;){if(O-I>600){var st=O-I+1,V=B-I+1,Mt=Math.log(st),$=.5*Math.exp(2*Mt/3),ut=.5*Math.sqrt(Mt*$*(st-$)/st)*(V-st/2<0?-1:1),xt=Math.max(I,Math.floor(B-V*$/st+ut)),mt=Math.min(O,Math.floor(B+(st-V)*$/st+ut));N(G,B,xt,mt,q)}var lt=G[B],ht=I,k=O;for(t(G,I,B),q(G[O],lt)>0&&t(G,I,O);ht<k;){for(t(G,ht,k),ht++,k--;q(G[ht],lt)<0;)ht++;for(;q(G[k],lt)>0;)k--}q(G[I],lt)===0?t(G,I,k):t(G,++k,O),k<=B&&(I=k+1),B<=k&&(O=k-1)}})(x,v,P||0,S||x.length-1,L||e)}function t(x,v,P){var S=x[v];x[v]=x[P],x[P]=S}function e(x,v){return x<v?-1:x>v?1:0}var o=function(x){x===void 0&&(x=9),this._maxEntries=Math.max(4,x),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(x,v,P){if(!P)return v.indexOf(x);for(var S=0;S<v.length;S++)if(P(x,v[S]))return S;return-1}function l(x,v){h(x,0,x.children.length,v,x)}function h(x,v,P,S,L){L||(L=b(null)),L.minX=1/0,L.minY=1/0,L.maxX=-1/0,L.maxY=-1/0;for(var N=v;N<P;N++){var G=x.children[N];f(L,x.leaf?S(G):G)}return L}function f(x,v){return x.minX=Math.min(x.minX,v.minX),x.minY=Math.min(x.minY,v.minY),x.maxX=Math.max(x.maxX,v.maxX),x.maxY=Math.max(x.maxY,v.maxY),x}function p(x,v){return x.minX-v.minX}function d(x,v){return x.minY-v.minY}function g(x){return(x.maxX-x.minX)*(x.maxY-x.minY)}function _(x){return x.maxX-x.minX+(x.maxY-x.minY)}function y(x,v){return x.minX<=v.minX&&x.minY<=v.minY&&v.maxX<=x.maxX&&v.maxY<=x.maxY}function M(x,v){return v.minX<=x.maxX&&v.minY<=x.maxY&&v.maxX>=x.minX&&v.maxY>=x.minY}function b(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(x,v,P,S,L){for(var N=[v,P];N.length;)if(!((P=N.pop())-(v=N.pop())<=S)){var G=v+Math.ceil((P-v)/S/2)*S;r(x,G,v,P,L),N.push(v,G,G,P)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(x){var v=this.data,P=[];if(!M(x,v))return P;for(var S=this.toBBox,L=[];v;){for(var N=0;N<v.children.length;N++){var G=v.children[N],B=v.leaf?S(G):G;M(x,B)&&(v.leaf?P.push(G):y(x,B)?this._all(G,P):L.push(G))}v=L.pop()}return P},o.prototype.collides=function(x){var v=this.data;if(!M(x,v))return!1;for(var P=[];v;){for(var S=0;S<v.children.length;S++){var L=v.children[S],N=v.leaf?this.toBBox(L):L;if(M(x,N)){if(v.leaf||y(x,N))return!0;P.push(L)}}v=P.pop()}return!1},o.prototype.load=function(x){if(!x||!x.length)return this;if(x.length<this._minEntries){for(var v=0;v<x.length;v++)this.insert(x[v]);return this}var P=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===P.height)this._splitRoot(this.data,P);else{if(this.data.height<P.height){var S=this.data;this.data=P,P=S}this._insert(P,this.data.height-P.height-1,!0)}else this.data=P;return this},o.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},o.prototype.clear=function(){return this.data=b([]),this},o.prototype.remove=function(x,v){if(!x)return this;for(var P,S,L,N=this.data,G=this.toBBox(x),B=[],I=[];N||B.length;){if(N||(N=B.pop(),S=B[B.length-1],P=I.pop(),L=!0),N.leaf){var O=a(x,N.children,v);if(O!==-1)return N.children.splice(O,1),B.push(N),this._condense(B),this}L||N.leaf||!y(N,G)?S?(P++,N=S.children[P],L=!1):N=null:(B.push(N),I.push(P),P=0,S=N,N=N.children[0])}return this},o.prototype.toBBox=function(x){return x},o.prototype.compareMinX=function(x,v){return x.minX-v.minX},o.prototype.compareMinY=function(x,v){return x.minY-v.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(x){return this.data=x,this},o.prototype._all=function(x,v){for(var P=[];x;)x.leaf?v.push.apply(v,x.children):P.push.apply(P,x.children),x=P.pop();return v},o.prototype._build=function(x,v,P,S){var L,N=P-v+1,G=this._maxEntries;if(N<=G)return l(L=b(x.slice(v,P+1)),this.toBBox),L;S||(S=Math.ceil(Math.log(N)/Math.log(G)),G=Math.ceil(N/Math.pow(G,S-1))),(L=b([])).leaf=!1,L.height=S;var B=Math.ceil(N/G),I=B*Math.ceil(Math.sqrt(G));T(x,v,P,I,this.compareMinX);for(var O=v;O<=P;O+=I){var q=Math.min(O+I-1,P);T(x,O,q,B,this.compareMinY);for(var st=O;st<=q;st+=B){var V=Math.min(st+B-1,q);L.children.push(this._build(x,st,V,S-1))}}return l(L,this.toBBox),L},o.prototype._chooseSubtree=function(x,v,P,S){for(;S.push(v),!v.leaf&&S.length-1!==P;){for(var L=1/0,N=1/0,G=void 0,B=0;B<v.children.length;B++){var I=v.children[B],O=g(I),q=(st=x,V=I,(Math.max(V.maxX,st.maxX)-Math.min(V.minX,st.minX))*(Math.max(V.maxY,st.maxY)-Math.min(V.minY,st.minY))-O);q<N?(N=q,L=O<L?O:L,G=I):q===N&&O<L&&(L=O,G=I)}v=G||v.children[0]}var st,V;return v},o.prototype._insert=function(x,v,P){var S=P?x:this.toBBox(x),L=[],N=this._chooseSubtree(S,this.data,v,L);for(N.children.push(x),f(N,S);v>=0&&L[v].children.length>this._maxEntries;)this._split(L,v),v--;this._adjustParentBBoxes(S,L,v)},o.prototype._split=function(x,v){var P=x[v],S=P.children.length,L=this._minEntries;this._chooseSplitAxis(P,L,S);var N=this._chooseSplitIndex(P,L,S),G=b(P.children.splice(N,P.children.length-N));G.height=P.height,G.leaf=P.leaf,l(P,this.toBBox),l(G,this.toBBox),v?x[v-1].children.push(G):this._splitRoot(P,G)},o.prototype._splitRoot=function(x,v){this.data=b([x,v]),this.data.height=x.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(x,v,P){for(var S,L,N,G,B,I,O,q=1/0,st=1/0,V=v;V<=P-v;V++){var Mt=h(x,0,V,this.toBBox),$=h(x,V,P,this.toBBox),ut=(L=Mt,N=$,G=void 0,B=void 0,I=void 0,O=void 0,G=Math.max(L.minX,N.minX),B=Math.max(L.minY,N.minY),I=Math.min(L.maxX,N.maxX),O=Math.min(L.maxY,N.maxY),Math.max(0,I-G)*Math.max(0,O-B)),xt=g(Mt)+g($);ut<q?(q=ut,S=V,st=xt<st?xt:st):ut===q&&xt<st&&(st=xt,S=V)}return S||P-v},o.prototype._chooseSplitAxis=function(x,v,P){var S=x.leaf?this.compareMinX:p,L=x.leaf?this.compareMinY:d;this._allDistMargin(x,v,P,S)<this._allDistMargin(x,v,P,L)&&x.children.sort(S)},o.prototype._allDistMargin=function(x,v,P,S){x.children.sort(S);for(var L=this.toBBox,N=h(x,0,v,L),G=h(x,P-v,P,L),B=_(N)+_(G),I=v;I<P-v;I++){var O=x.children[I];f(N,x.leaf?L(O):O),B+=_(N)}for(var q=P-v-1;q>=v;q--){var st=x.children[q];f(G,x.leaf?L(st):st),B+=_(G)}return B},o.prototype._adjustParentBBoxes=function(x,v,P){for(var S=P;S>=0;S--)f(v[S],x)},o.prototype._condense=function(x){for(var v=x.length-1,P=void 0;v>=0;v--)x[v].children.length===0?v>0?(P=x[v-1].children).splice(P.indexOf(x[v]),1):this.clear():l(x[v],this.toBBox)},o})});var _0=Ht((ap,up)=>{(function(r,t){typeof ap=="object"&&typeof up!="undefined"?up.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(ap,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var l=(this.length>>1)-1;l>=0;l--)this._down(l)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,l=a.data,h=a.compare,f=l[o];o>0;){var p=o-1>>1,d=l[p];if(h(f,d)>=0)break;l[o]=d,o=p}l[o]=f},r.prototype._down=function(o){for(var a=this,l=a.data,h=a.compare,f=this.length>>1,p=l[o];o<f;){var d=(o<<1)+1,g=l[d],_=d+1;if(_<this.length&&h(l[_],g)<0&&(d=_,g=l[_]),h(g,p)>=0)break;l[o]=g,o=d}l[o]=p};function t(e,o){return e<o?-1:e>o?1:0}return r})});var E0=Ht(($R,x0)=>{x0.exports=function(t,e,o,a){var l=t[0],h=t[1],f=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=(a-o)/2,d=0,g=p-1;d<p;g=d++){var _=e[o+d*2+0],y=e[o+d*2+1],M=e[o+g*2+0],b=e[o+g*2+1],T=y>h!=b>h&&l<(M-_)*(h-y)/(b-y)+_;T&&(f=!f)}return f}});var S0=Ht((ZR,M0)=>{M0.exports=function(t,e,o,a){var l=t[0],h=t[1],f=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=a-o,d=0,g=p-1;d<p;g=d++){var _=e[d+o][0],y=e[d+o][1],M=e[g+o][0],b=e[g+o][1],T=y>h!=b>h&&l<(M-_)*(h-y)/(b-y)+_;T&&(f=!f)}return f}});var T0=Ht((JR,yc)=>{var w0=E0(),b0=S0();yc.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?b0(t,e,o,a):w0(t,e,o,a)};yc.exports.nested=b0;yc.exports.flat=w0});var C0=Ht((vc,A0)=>{(function(r,t){typeof vc=="object"&&typeof A0!="undefined"?t(vc):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(vc,function(r){"use strict";let e=33306690738754706e-32;function o(M,b,T,x,v){let P,S,L,N,G=b[0],B=x[0],I=0,O=0;B>G==B>-G?(P=G,G=b[++I]):(P=B,B=x[++O]);let q=0;if(I<M&&O<T)for(B>G==B>-G?(L=P-((S=G+P)-G),G=b[++I]):(L=P-((S=B+P)-B),B=x[++O]),P=S,L!==0&&(v[q++]=L);I<M&&O<T;)B>G==B>-G?(L=P-((S=P+G)-(N=S-P))+(G-N),G=b[++I]):(L=P-((S=P+B)-(N=S-P))+(B-N),B=x[++O]),P=S,L!==0&&(v[q++]=L);for(;I<M;)L=P-((S=P+G)-(N=S-P))+(G-N),G=b[++I],P=S,L!==0&&(v[q++]=L);for(;O<T;)L=P-((S=P+B)-(N=S-P))+(B-N),B=x[++O],P=S,L!==0&&(v[q++]=L);return P===0&&q!==0||(v[q++]=P),q}function a(M){return new Float64Array(M)}let l=33306690738754716e-32,h=22204460492503146e-32,f=11093356479670487e-47,p=a(4),d=a(8),g=a(12),_=a(16),y=a(4);r.orient2d=function(M,b,T,x,v,P){let S=(b-P)*(T-v),L=(M-v)*(x-P),N=S-L;if(S===0||L===0||S>0!=L>0)return N;let G=Math.abs(S+L);return Math.abs(N)>=l*G?N:-function(B,I,O,q,st,V,Mt){let $,ut,xt,mt,lt,ht,k,nt,ft,Tt,gt,Lt,qt,Xt,Ft,Qt,Ct,ee,it=B-st,rn=O-st,Bt=I-V,Jt=q-V;lt=(Ft=(nt=it-(k=(ht=134217729*it)-(ht-it)))*(Tt=Jt-(ft=(ht=134217729*Jt)-(ht-Jt)))-((Xt=it*Jt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=Bt-(k=(ht=134217729*Bt)-(ht-Bt)))*(Tt=rn-(ft=(ht=134217729*rn)-(ht-rn)))-((Qt=Bt*rn)-k*ft-nt*ft-k*Tt))),p[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),p[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,p[2]=Lt-(ee-lt)+(gt-lt),p[3]=ee;let Yt=function(yn,pn){let X=pn[0];for(let F=1;F<yn;F++)X+=pn[F];return X}(4,p),pe=h*Mt;if(Yt>=pe||-Yt>=pe||($=B-(it+(lt=B-it))+(lt-st),xt=O-(rn+(lt=O-rn))+(lt-st),ut=I-(Bt+(lt=I-Bt))+(lt-V),mt=q-(Jt+(lt=q-Jt))+(lt-V),$===0&&ut===0&&xt===0&&mt===0)||(pe=f*Mt+e*Math.abs(Yt),(Yt+=it*mt+Jt*$-(Bt*xt+rn*ut))>=pe||-Yt>=pe))return Yt;lt=(Ft=(nt=$-(k=(ht=134217729*$)-(ht-$)))*(Tt=Jt-(ft=(ht=134217729*Jt)-(ht-Jt)))-((Xt=$*Jt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=ut-(k=(ht=134217729*ut)-(ht-ut)))*(Tt=rn-(ft=(ht=134217729*rn)-(ht-rn)))-((Qt=ut*rn)-k*ft-nt*ft-k*Tt))),y[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),y[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,y[2]=Lt-(ee-lt)+(gt-lt),y[3]=ee;let le=o(4,p,4,y,d);lt=(Ft=(nt=it-(k=(ht=134217729*it)-(ht-it)))*(Tt=mt-(ft=(ht=134217729*mt)-(ht-mt)))-((Xt=it*mt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=Bt-(k=(ht=134217729*Bt)-(ht-Bt)))*(Tt=xt-(ft=(ht=134217729*xt)-(ht-xt)))-((Qt=Bt*xt)-k*ft-nt*ft-k*Tt))),y[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),y[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,y[2]=Lt-(ee-lt)+(gt-lt),y[3]=ee;let Pt=o(le,d,4,y,g);lt=(Ft=(nt=$-(k=(ht=134217729*$)-(ht-$)))*(Tt=mt-(ft=(ht=134217729*mt)-(ht-mt)))-((Xt=$*mt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=ut-(k=(ht=134217729*ut)-(ht-ut)))*(Tt=xt-(ft=(ht=134217729*xt)-(ht-xt)))-((Qt=ut*xt)-k*ft-nt*ft-k*Tt))),y[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),y[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,y[2]=Lt-(ee-lt)+(gt-lt),y[3]=ee;let te=o(Pt,g,4,y,_);return _[te-1]}(M,b,T,x,v,P,G)},r.orient2dfast=function(M,b,T,x,v,P){return(b-P)*(T-v)-(M-v)*(x-P)},Object.defineProperty(r,"__esModule",{value:!0})})});var O0=Ht((KR,fp)=>{"use strict";var P0=sp(),xc=_0(),uT=T0(),lT=C0().orient2d;xc.default&&(xc=xc.default);fp.exports=N0;fp.exports.default=N0;function N0(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=dT(r),a=new P0(16);a.toBBox=function(P){return{minX:P[0],minY:P[1],maxX:P[0],maxY:P[1]}},a.compareMinX=function(P,S){return P[0]-S[0]},a.compareMinY=function(P,S){return P[1]-S[1]},a.load(r);for(var l=[],h=0,f;h<o.length;h++){var p=o[h];a.remove(p),f=L0(p,f),l.push(f)}var d=new P0(16);for(h=0;h<l.length;h++)d.insert(lp(l[h]));for(var g=t*t,_=e*e;l.length;){var y=l.shift(),M=y.p,b=y.next.p,T=cp(M,b);if(!(T<_)){var x=T/g;p=cT(a,y.prev.p,M,b,y.next.next.p,x,d),p&&Math.min(cp(p,M),cp(p,b))<=x&&(l.push(y),l.push(L0(p,y)),a.remove(p),d.remove(y),d.insert(lp(y)),d.insert(lp(y.next)))}}y=f;var v=[];do v.push(y.p),y=y.next;while(y!==f);return v.push(y.p),v}function cT(r,t,e,o,a,l,h){for(var f=new xc([],hT),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],_=p.leaf?hp(g,e,o):fT(e,o,g);_>l||f.push({node:g,dist:_})}for(;f.length&&!f.peek().node.children;){var y=f.pop(),M=y.node,b=hp(M,t,e),T=hp(M,o,a);if(y.dist<b&&y.dist<T&&R0(e,M,h)&&R0(o,M,h))return M}p=f.pop(),p&&(p=p.node)}return null}function hT(r,t){return r.dist-t.dist}function fT(r,t,e){if(I0(r,e)||I0(t,e))return 0;var o=_c(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=_c(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=_c(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var h=_c(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return h===0?0:Math.min(o,a,l,h)}function I0(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function R0(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),l=Math.max(r[0],t[0]),h=Math.max(r[1],t[1]),f=e.search({minX:o,minY:a,maxX:l,maxY:h}),p=0;p<f.length;p++)if(pT(f[p].p,f[p].next.p,r,t))return!1;return!0}function Ja(r,t,e){return lT(r[0],r[1],t[0],t[1],e[0],e[1])}function pT(r,t,e,o){return r!==o&&t!==e&&Ja(r,t,e)>0!=Ja(r,t,o)>0&&Ja(e,o,r)>0!=Ja(e,o,t)>0}function lp(r){var t=r.p,e=r.next.p;return r.minX=Math.min(t[0],e[0]),r.minY=Math.min(t[1],e[1]),r.maxX=Math.max(t[0],e[0]),r.maxY=Math.max(t[1],e[1]),r}function dT(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],l=0;l<r.length;l++){var h=r[l];h[0]<t[0]&&(t=h),h[0]>o[0]&&(o=h),h[1]<e[1]&&(e=h),h[1]>a[1]&&(a=h)}var f=[t,e,o,a],p=f.slice();for(l=0;l<r.length;l++)uT(r[l],f)||p.push(r[l]);return gT(p)}function L0(r,t){var e={p:r,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function cp(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function hp(r,t,e){var o=t[0],a=t[1],l=e[0]-o,h=e[1]-a;if(l!==0||h!==0){var f=((r[0]-o)*l+(r[1]-a)*h)/(l*l+h*h);f>1?(o=e[0],a=e[1]):f>0&&(o+=l*f,a+=h*f)}return l=r[0]-o,h=r[1]-a,l*l+h*h}function _c(r,t,e,o,a,l,h,f){var p=e-r,d=o-t,g=h-a,_=f-l,y=r-a,M=t-l,b=p*p+d*d,T=p*g+d*_,x=g*g+_*_,v=p*y+d*M,P=g*y+_*M,S=b*x-T*T,L,N,G,B,I=S,O=S;S===0?(N=0,I=1,B=P,O=x):(N=T*P-x*v,B=b*P-T*v,N<0?(N=0,B=P,O=x):N>I&&(N=I,B=P+T,O=x)),B<0?(B=0,-v<0?N=0:-v>b?N=I:(N=-v,I=b)):B>O&&(B=O,-v+T<0?N=0:-v+T>b?N=I:(N=-v+T,I=b)),L=N===0?0:N/I,G=B===0?0:B/O;var q=(1-L)*r+L*e,st=(1-L)*t+L*o,V=(1-G)*a+G*h,Mt=(1-G)*l+G*f,$=V-q,ut=Mt-st;return $*$+ut*ut}function mT(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function gT(r){r.sort(mT);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Ja(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}for(var o=[],a=r.length-1;a>=0;a--){for(;o.length>=2&&Ja(o[o.length-2],o[o.length-1],r[a])<=0;)o.pop();o.push(r[a])}return o.pop(),t.pop(),t.concat(o)}});var k0=Ht((dp,mp)=>{(function(r,t){typeof dp=="object"&&typeof mp!="undefined"?mp.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(dp,function(){"use strict";function r(a,l,h,f,p){t(a,l,h||0,f||a.length-1,p||o)}function t(a,l,h,f,p){for(;f>h;){if(f-h>600){var d=f-h+1,g=l-h+1,_=Math.log(d),y=.5*Math.exp(2*_/3),M=.5*Math.sqrt(_*y*(d-y)/d)*(g-d/2<0?-1:1),b=Math.max(h,Math.floor(l-g*y/d+M)),T=Math.min(f,Math.floor(l+(d-g)*y/d+M));t(a,l,b,T,p)}var x=a[l],v=h,P=f;for(e(a,h,l),p(a[f],x)>0&&e(a,h,f);v<P;){for(e(a,v,P),v++,P--;p(a[v],x)<0;)v++;for(;p(a[P],x)>0;)P--}p(a[h],x)===0?e(a,h,P):(P++,e(a,P,f)),P<=l&&(h=P+1),l<=P&&(f=P-1)}}function e(a,l,h){var f=a[l];a[l]=a[h],a[h]=f}function o(a,l){return a<l?-1:a>l?1:0}return r})});var _p=Ht((S2,vp)=>{"use strict";vp.exports=Xu;vp.exports.default=Xu;var PT=k0();function Xu(r,t){if(!(this instanceof Xu))return new Xu(r,t);this._maxEntries=Math.max(4,r||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}Xu.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!Mc(r,t))return e;for(var a=[],l,h,f,p;t;){for(l=0,h=t.children.length;l<h;l++)f=t.children[l],p=t.leaf?o(f):f,Mc(r,p)&&(t.leaf?e.push(f):yp(r,p)?this._all(f,e):a.push(f));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!Mc(r,t))return!1;for(var o=[],a,l,h,f;t;){for(a=0,l=t.children.length;a<l;a++)if(h=t.children[a],f=t.leaf?e(h):h,Mc(r,f)){if(t.leaf||yp(r,f))return!0;o.push(h)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=Qa([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],l=[],h,f,p,d;e||a.length;){if(e||(e=a.pop(),f=a[a.length-1],h=l.pop(),d=!0),e.leaf&&(p=IT(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&yp(e,o)?(a.push(e),l.push(h),h=0,f=e,e=e.children[0]):f?(h++,e=f.children[h],d=!1):e=null}return this},toBBox:function(r){return r},compareMinX:G0,compareMinY:V0,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,l=this._maxEntries,h;if(a<=l)return h=Qa(r.slice(t,e+1)),ja(h,this.toBBox),h;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),h=Qa([]),h.leaf=!1,h.height=o;var f=Math.ceil(a/l),p=f*Math.ceil(Math.sqrt(l)),d,g,_,y;for(H0(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(_=Math.min(d+p-1,e),H0(r,d,_,f,this.compareMinY),g=d;g<=_;g+=f)y=Math.min(g+f-1,_),h.children.push(this._build(r,g,y,o-1));return ja(h,this.toBBox),h},_chooseSubtree:function(r,t,e,o){for(var a,l,h,f,p,d,g,_;o.push(t),!(t.leaf||o.length-1===e);){for(g=_=1/0,a=0,l=t.children.length;a<l;a++)h=t.children[a],p=gp(h),d=RT(r,h)-p,d<_?(_=d,g=p<g?p:g,f=h):d===_&&p<g&&(g=p,f=h);t=f||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),l=[],h=this._chooseSubtree(a,this.data,t,l);for(h.children.push(r),qu(h,a);t>=0&&l[t].children.length>this._maxEntries;)this._split(l,t),t--;this._adjustParentBBoxes(a,l,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var l=this._chooseSplitIndex(e,a,o),h=Qa(e.children.splice(l,e.children.length-l));h.height=e.height,h.leaf=e.leaf,ja(e,this.toBBox),ja(h,this.toBBox),t?r[t-1].children.push(h):this._splitRoot(e,h)},_splitRoot:function(r,t){this.data=Qa([r,t]),this.data.height=r.height+1,this.data.leaf=!1,ja(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,l,h,f,p,d,g;for(p=d=1/0,o=t;o<=e-t;o++)a=Wu(r,0,o,this.toBBox),l=Wu(r,o,e,this.toBBox),h=LT(a,l),f=gp(a)+gp(l),h<p?(p=h,g=o,d=f<d?f:d):h===p&&f<d&&(d=f,g=o);return g},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:G0,a=r.leaf?this.compareMinY:V0,l=this._allDistMargin(r,t,e,o),h=this._allDistMargin(r,t,e,a);l<h&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,l=Wu(r,0,t,a),h=Wu(r,e-t,e,a),f=Ec(l)+Ec(h),p,d;for(p=t;p<e-t;p++)d=r.children[p],qu(l,r.leaf?a(d):d),f+=Ec(l);for(p=e-t-1;p>=t;p--)d=r.children[p],qu(h,r.leaf?a(d):d),f+=Ec(h);return f},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)qu(t[o],r)},_condense:function(r){for(var t=r.length-1,e;t>=0;t--)r[t].children.length===0?t>0?(e=r[t-1].children,e.splice(e.indexOf(r[t]),1)):this.clear():ja(r[t],this.toBBox)},_initFormat:function(r){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(r[0])),this.compareMinY=new Function("a","b",t.join(r[1])),this.toBBox=new Function("a","return {minX: a"+r[0]+", minY: a"+r[1]+", maxX: a"+r[2]+", maxY: a"+r[3]+"};")}};function IT(r,t,e){if(!e)return t.indexOf(r);for(var o=0;o<t.length;o++)if(e(r,t[o]))return o;return-1}function ja(r,t){Wu(r,0,r.children.length,t,r)}function Wu(r,t,e,o,a){a||(a=Qa(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var l=t,h;l<e;l++)h=r.children[l],qu(a,r.leaf?o(h):h);return a}function qu(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function G0(r,t){return r.minX-t.minX}function V0(r,t){return r.minY-t.minY}function gp(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function Ec(r){return r.maxX-r.minX+(r.maxY-r.minY)}function RT(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function LT(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),l=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,l-o)}function yp(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Mc(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function Qa(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function H0(r,t,e,o,a){for(var l=[t,e],h;l.length;)e=l.pop(),t=l.pop(),!(e-t<=o)&&(h=t+Math.ceil((e-t)/o/2)*o,PT(r,h,t,e,a),l.push(t,h,h,e))}});var Z0=Ht((FO,bp)=>{"use strict";bp.exports=Tc;bp.exports.default=Tc;function Tc(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=X0(r,0,a,e,!0),h=[];if(!l||l.next===l.prev)return h;var f,p,d,g,_,y,M;if(o&&(l=VT(r,t,l,e)),r.length>80*e){f=d=r[0],p=g=r[1];for(var b=e;b<a;b+=e)_=r[b],y=r[b+1],_<f&&(f=_),y<p&&(p=y),_>d&&(d=_),y>g&&(g=y);M=Math.max(d-f,g-p),M=M!==0?32767/M:0}return Zu(l,h,e,f,p,M,0),h}function X0(r,t,e,o,a){var l,h;if(a===wp(r,t,e,o)>0)for(l=t;l<e;l+=o)h=q0(l,r[l],r[l+1],h);else for(l=e-o;l>=t;l-=o)h=q0(l,r[l],r[l+1],h);return h&&Ac(h,h.next)&&(Ku(h),h=h.next),h}function Qs(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(Ac(e,e.next)||Yn(e.prev,e,e.next)===0)){if(Ku(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function Zu(r,t,e,o,a,l,h){if(r){!h&&l&&YT(r,o,a,l);for(var f=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?zT(r,o,a,l):BT(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),Ku(r),r=d.next,f=d.next;continue}if(r=d,r===f){h?h===1?(r=kT(Qs(r),t,e),Zu(r,t,e,o,a,l,2)):h===2&>(r,t,e,o,a,l):Zu(Qs(r),t,e,o,a,l,1);break}}}}function BT(r){var t=r.prev,e=r,o=r.next;if(Yn(t,e,o)>=0)return!1;for(var a=t.x,l=e.x,h=o.x,f=t.y,p=e.y,d=o.y,g=a<l?a<h?a:h:l<h?l:h,_=f<p?f<d?f:d:p<d?p:d,y=a>l?a>h?a:h:l>h?l:h,M=f>p?f>d?f:d:p>d?p:d,b=o.next;b!==t;){if(b.x>=g&&b.x<=y&&b.y>=_&&b.y<=M&&nu(a,f,l,p,h,d,b.x,b.y)&&Yn(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function zT(r,t,e,o){var a=r.prev,l=r,h=r.next;if(Yn(a,l,h)>=0)return!1;for(var f=a.x,p=l.x,d=h.x,g=a.y,_=l.y,y=h.y,M=f<p?f<d?f:d:p<d?p:d,b=g<_?g<y?g:y:_<y?_:y,T=f>p?f>d?f:d:p>d?p:d,x=g>_?g>y?g:y:_>y?_:y,v=Mp(M,b,t,e,o),P=Mp(T,x,t,e,o),S=r.prevZ,L=r.nextZ;S&&S.z>=v&&L&&L.z<=P;){if(S.x>=M&&S.x<=T&&S.y>=b&&S.y<=x&&S!==a&&S!==h&&nu(f,g,p,_,d,y,S.x,S.y)&&Yn(S.prev,S,S.next)>=0||(S=S.prevZ,L.x>=M&&L.x<=T&&L.y>=b&&L.y<=x&&L!==a&&L!==h&&nu(f,g,p,_,d,y,L.x,L.y)&&Yn(L.prev,L,L.next)>=0))return!1;L=L.nextZ}for(;S&&S.z>=v;){if(S.x>=M&&S.x<=T&&S.y>=b&&S.y<=x&&S!==a&&S!==h&&nu(f,g,p,_,d,y,S.x,S.y)&&Yn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;L&&L.z<=P;){if(L.x>=M&&L.x<=T&&L.y>=b&&L.y<=x&&L!==a&&L!==h&&nu(f,g,p,_,d,y,L.x,L.y)&&Yn(L.prev,L,L.next)>=0)return!1;L=L.nextZ}return!0}function kT(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!Ac(a,l)&&Y0(a,o,o.next,l)&&Ju(a,l)&&Ju(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),Ku(o),Ku(o.next),o=r=l),o=o.next}while(o!==r);return Qs(o)}function GT(r,t,e,o,a,l){var h=r;do{for(var f=h.next.next;f!==h.prev;){if(h.i!==f.i&&JT(h,f)){var p=$0(h,f);h=Qs(h,h.next),p=Qs(p,p.next),Zu(h,t,e,o,a,l,0),Zu(p,t,e,o,a,l,0);return}f=f.next}h=h.next}while(h!==r)}function VT(r,t,e,o){var a=[],l,h,f,p,d;for(l=0,h=t.length;l<h;l++)f=t[l]*o,p=l<h-1?t[l+1]*o:r.length,d=X0(r,f,p,o,!1),d===d.next&&(d.steiner=!0),a.push(ZT(d));for(a.sort(HT),l=0;l<a.length;l++)e=WT(a[l],e);return e}function HT(r,t){return r.x-t.x}function WT(r,t){var e=qT(r,t);if(!e)return t;var o=$0(e,r);return Qs(o,o.next),Qs(e,e.next)}function qT(r,t){var e=t,o=r.x,a=r.y,l=-1/0,h;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var f=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(f<=o&&f>l&&(l=f,h=e.x<e.next.x?e:e.next,f===o))return h}e=e.next}while(e!==t);if(!h)return null;var p=h,d=h.x,g=h.y,_=1/0,y;e=h;do o>=e.x&&e.x>=d&&o!==e.x&&nu(a<g?o:l,a,d,g,a<g?l:o,a,e.x,e.y)&&(y=Math.abs(a-e.y)/(o-e.x),Ju(e,r)&&(y<_||y===_&&(e.x>h.x||e.x===h.x&&XT(h,e)))&&(h=e,_=y)),e=e.next;while(e!==p);return h}function XT(r,t){return Yn(r.prev,r,t.prev)<0&&Yn(t.next,r,r.next)<0}function YT(r,t,e,o){var a=r;do a.z===0&&(a.z=Mp(a.x,a.y,t,e,o)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==r);a.prevZ.nextZ=null,a.prevZ=null,$T(a)}function $T(r){var t,e,o,a,l,h,f,p,d=1;do{for(e=r,r=null,l=null,h=0;e;){for(h++,o=e,f=0,t=0;t<d&&(f++,o=o.nextZ,!!o);t++);for(p=d;f>0||p>0&&o;)f!==0&&(p===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,f--):(a=o,o=o.nextZ,p--),l?l.nextZ=a:r=a,a.prevZ=l,l=a;e=o}l.nextZ=null,d*=2}while(h>1);return r}function Mp(r,t,e,o,a){return r=(r-e)*a|0,t=(t-o)*a|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function ZT(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function nu(r,t,e,o,a,l,h,f){return(a-h)*(t-f)>=(r-h)*(l-f)&&(r-h)*(o-f)>=(e-h)*(t-f)&&(e-h)*(l-f)>=(a-h)*(o-f)}function JT(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!KT(r,t)&&(Ju(r,t)&&Ju(t,r)&&jT(r,t)&&(Yn(r.prev,r,t.prev)||Yn(r,t.prev,t))||Ac(r,t)&&Yn(r.prev,r,r.next)>0&&Yn(t.prev,t,t.next)>0)}function Yn(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Ac(r,t){return r.x===t.x&&r.y===t.y}function Y0(r,t,e,o){var a=bc(Yn(r,t,e)),l=bc(Yn(r,t,o)),h=bc(Yn(e,o,r)),f=bc(Yn(e,o,t));return!!(a!==l&&h!==f||a===0&&wc(r,e,t)||l===0&&wc(r,o,t)||h===0&&wc(e,r,o)||f===0&&wc(e,t,o))}function wc(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function bc(r){return r>0?1:r<0?-1:0}function KT(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Y0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Ju(r,t){return Yn(r.prev,r,r.next)<0?Yn(r,t,r.next)>=0&&Yn(r,r.prev,t)>=0:Yn(r,t,r.prev)<0||Yn(r,r.next,t)<0}function jT(r,t){var e=r,o=!1,a=(r.x+t.x)/2,l=(r.y+t.y)/2;do e.y>l!=e.next.y>l&&e.next.y!==e.y&&a<(e.next.x-e.x)*(l-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function $0(r,t){var e=new Sp(r.i,r.x,r.y),o=new Sp(t.i,t.x,t.y),a=r.next,l=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,l.next=o,o.prev=l,o}function q0(r,t,e,o){var a=new Sp(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function Ku(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Sp(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Tc.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,h=Math.abs(wp(r,0,l,e));if(a)for(var f=0,p=t.length;f<p;f++){var d=t[f]*e,g=f<p-1?t[f+1]*e:r.length;h-=Math.abs(wp(r,d,g,e))}var _=0;for(f=0;f<o.length;f+=3){var y=o[f]*e,M=o[f+1]*e,b=o[f+2]*e;_+=Math.abs((r[y]-r[b])*(r[M+1]-r[y+1])-(r[y]-r[M])*(r[b+1]-r[y+1]))}return h===0&&_===0?0:Math.abs((_-h)/h)};function wp(r,t,e,o){for(var a=0,l=t,h=e-o;l<e;l+=o)a+=(r[h]-r[l])*(r[l+1]+r[h+1]),h=l;return a}Tc.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var l=0;l<r[a].length;l++)for(var h=0;h<t;h++)e.vertices.push(r[a][l][h]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var Ip=Ht(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.earthRadius=63710088e-1;ae.factors={centimeters:ae.earthRadius*100,centimetres:ae.earthRadius*100,degrees:ae.earthRadius/111325,feet:ae.earthRadius*3.28084,inches:ae.earthRadius*39.37,kilometers:ae.earthRadius/1e3,kilometres:ae.earthRadius/1e3,meters:ae.earthRadius,metres:ae.earthRadius,miles:ae.earthRadius/1609.344,millimeters:ae.earthRadius*1e3,millimetres:ae.earthRadius*1e3,nauticalmiles:ae.earthRadius/1852,radians:1,yards:ae.earthRadius*1.0936};ae.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/ae.earthRadius,yards:1.0936133};ae.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Ms(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}ae.feature=Ms;function tA(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Tp(t).geometry;case"LineString":return Cp(t).geometry;case"Polygon":return Ap(t).geometry;case"MultiPoint":return K0(t).geometry;case"MultiLineString":return J0(t).geometry;case"MultiPolygon":return j0(t).geometry;default:throw new Error(r+" is invalid")}}ae.geometry=tA;function Tp(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Cc(r[0])||!Cc(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Ms(o,t,e)}ae.point=Tp;function eA(r,t,e){return e===void 0&&(e={}),Pc(r.map(function(o){return Tp(o,t)}),e)}ae.points=eA;function Ap(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<l[l.length-1].length;h++)if(l[l.length-1][h]!==l[0][h])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:r};return Ms(f,t,e)}ae.polygon=Ap;function nA(r,t,e){return e===void 0&&(e={}),Pc(r.map(function(o){return Ap(o,t)}),e)}ae.polygons=nA;function Cp(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return Ms(o,t,e)}ae.lineString=Cp;function rA(r,t,e){return e===void 0&&(e={}),Pc(r.map(function(o){return Cp(o,t)}),e)}ae.lineStrings=rA;function Pc(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}ae.featureCollection=Pc;function J0(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Ms(o,t,e)}ae.multiLineString=J0;function K0(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Ms(o,t,e)}ae.multiPoint=K0;function j0(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Ms(o,t,e)}ae.multiPolygon=j0;function iA(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Ms(o,t,e)}ae.geometryCollection=iA;function oA(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}ae.round=oA;function Q0(r,t){t===void 0&&(t="kilometers");var e=ae.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}ae.radiansToLength=Q0;function Pp(r,t){t===void 0&&(t="kilometers");var e=ae.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}ae.lengthToRadians=Pp;function sA(r,t){return ty(Pp(r,t))}ae.lengthToDegrees=sA;function aA(r){var t=r%360;return t<0&&(t+=360),t}ae.bearingToAzimuth=aA;function ty(r){var t=r%(2*Math.PI);return t*180/Math.PI}ae.radiansToDegrees=ty;function uA(r){var t=r%360;return t*Math.PI/180}ae.degreesToRadians=uA;function lA(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return Q0(Pp(r,t),e)}ae.convertLength=lA;function cA(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=ae.areaFactors[t];if(!o)throw new Error("invalid original units");var a=ae.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}ae.convertArea=cA;function Cc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}ae.isNumber=Cc;function hA(r){return!!r&&r.constructor===Object}ae.isObject=hA;function fA(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!Cc(t))throw new Error("bbox must only contain numbers")})}ae.validateBBox=fA;function pA(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}ae.validateId=pA});var Lp=Ht(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});var Zr=Ip();function ju(r,t,e){if(r!==null)for(var o,a,l,h,f,p,d,g=0,_=0,y,M=r.type,b=M==="FeatureCollection",T=M==="Feature",x=b?r.features.length:1,v=0;v<x;v++){d=b?r.features[v].geometry:T?r.geometry:r,y=d?d.type==="GeometryCollection":!1,f=y?d.geometries.length:1;for(var P=0;P<f;P++){var S=0,L=0;if(h=y?d.geometries[P]:d,h!==null){p=h.coordinates;var N=h.type;switch(g=e&&(N==="Polygon"||N==="MultiPolygon")?1:0,N){case null:break;case"Point":if(t(p,_,v,S,L)===!1)return!1;_++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,S,L)===!1)return!1;_++,N==="MultiPoint"&&S++}N==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],_,v,S,L)===!1)return!1;_++}N==="MultiLineString"&&S++,N==="Polygon"&&L++}N==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(L=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],_,v,S,L)===!1)return!1;_++}L++}S++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(ju(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function dA(r,t,e,o){var a=e;return ju(r,function(l,h,f,p,d){h===0&&e===void 0?a=l:a=t(a,l,h,f,p,d)},o),a}function ey(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}function mA(r,t,e){var o=e;return ey(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function ny(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function gA(r,t,e){var o=e;return ny(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function yA(r){var t=[];return ju(r,function(e){t.push(e)}),t}function Rp(r,t){var e,o,a,l,h,f,p,d,g,_,y=0,M=r.type==="FeatureCollection",b=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(f=M?r.features[e].geometry:b?r.geometry:r,d=M?r.features[e].properties:b?r.properties:{},g=M?r.features[e].bbox:b?r.bbox:void 0,_=M?r.features[e].id:b?r.id:void 0,p=f?f.type==="GeometryCollection":!1,h=p?f.geometries.length:1,a=0;a<h;a++){if(l=p?f.geometries[a]:f,l===null){if(t(null,y,d,g,_)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,y,d,g,_)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],y,d,g,_)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}function vA(r,t,e){var o=e;return Rp(r,function(a,l,h,f,p){l===0&&e===void 0?o=a:o=t(o,a,l,h,f,p)}),o}function Ic(r,t){Rp(r,function(e,o,a,l,h){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(Zr.feature(e,a,{bbox:l,id:h}),o,0)===!1?!1:void 0}var p;switch(f){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],_={type:p,coordinates:g};if(t(Zr.feature(_,a),o,d)===!1)return!1}})}function _A(r,t,e){var o=e;return Ic(r,function(a,l,h){l===0&&h===0&&e===void 0?o=a:o=t(o,a,l,h)}),o}function ry(r,t){Ic(r,function(e,o,a){var l=0;if(e.geometry){var h=e.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var f,p=0,d=0,g=0;if(ju(e,function(_,y,M,b,T){if(f===void 0||o>p||b>d||T>g){f=_,p=o,d=b,g=T,l=0;return}var x=Zr.lineString([f,_],e.properties);if(t(x,o,a,T,l)===!1)return!1;l++,f=_})===!1)return!1}}})}function xA(r,t,e){var o=e,a=!1;return ry(r,function(l,h,f,p,d){a===!1&&e===void 0?o=l:o=t(o,l,h,f,p,d),a=!0}),o}function iy(r,t){if(!r)throw new Error("geojson is required");Ic(r,function(e,o,a){if(e.geometry!==null){var l=e.geometry.type,h=e.geometry.coordinates;switch(l){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var f=0;f<h.length;f++)if(t(Zr.lineString(h[f],e.properties),o,a,f)===!1)return!1;break}}})}function EA(r,t,e){var o=e;return iy(r,function(a,l,h,f){l===0&&e===void 0?o=a:o=t(o,a,l,h,f)}),o}function MA(r,t){if(t=t||{},!Zr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.segmentIndex||0,h=t.properties,f;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),h=h||r.features[e].properties,f=r.features[e].geometry;break;case"Feature":h=h||r.properties,f=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=r;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":case"MultiPoint":return null;case"LineString":return l<0&&(l=p.length+l-1),Zr.lineString([p[l],p[l+1]],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l-1),Zr.lineString([p[a][l],p[a][l+1]],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l-1),Zr.lineString([p[o][l],p[o][l+1]],h,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l-1),Zr.lineString([p[o][a][l],p[o][a][l+1]],h,t)}throw new Error("geojson is invalid")}function SA(r,t){if(t=t||{},!Zr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.coordIndex||0,h=t.properties,f;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),h=h||r.features[e].properties,f=r.features[e].geometry;break;case"Feature":h=h||r.properties,f=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=r;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":return Zr.point(p,h,t);case"MultiPoint":return o<0&&(o=p.length+o),Zr.point(p[o],h,t);case"LineString":return l<0&&(l=p.length+l),Zr.point(p[l],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Zr.point(p[a][l],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Zr.point(p[o][l],h,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l),Zr.point(p[o][a][l],h,t)}throw new Error("geojson is invalid")}pr.coordAll=yA;pr.coordEach=ju;pr.coordReduce=dA;pr.featureEach=ny;pr.featureReduce=gA;pr.findPoint=SA;pr.findSegment=MA;pr.flattenEach=Ic;pr.flattenReduce=_A;pr.geomEach=Rp;pr.geomReduce=vA;pr.lineEach=iy;pr.lineReduce=EA;pr.propEach=ey;pr.propReduce=mA;pr.segmentEach=ry;pr.segmentReduce=xA});var oy=Ht(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});var wA=Lp();function Np(r){var t=[1/0,1/0,-1/0,-1/0];return wA.coordEach(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Np.default=Np;Op.default=Np});var Rc=Ht((jO,Dp)=>{var _o=sp(),ay=Ip(),uy=Lp(),ru=oy().default,bA=uy.featureEach,JO=uy.coordEach,KO=ay.polygon,sy=ay.featureCollection;function ly(r){var t=new _o(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:ru(e),_o.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:ru(a),o.push(a)}):bA(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:ru(a),o.push(a)}),_o.prototype.load.call(this,o)},t.remove=function(e,o){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:ru(e),_o.prototype.remove.call(this,e,o)},t.clear=function(){return _o.prototype.clear.call(this)},t.search=function(e){var o=_o.prototype.search.call(this,this.toBBox(e));return sy(o)},t.collides=function(e){return _o.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=_o.prototype.all.call(this);return sy(e)},t.toJSON=function(){return _o.prototype.toJSON.call(this)},t.fromJSON=function(e){return _o.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var o;if(e.bbox)o=e.bbox;else if(Array.isArray(e)&&e.length===4)o=e;else if(Array.isArray(e)&&e.length===6)o=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")o=ru(e);else if(e.type==="FeatureCollection")o=ru(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Dp.exports=ly;Dp.exports.default=ly});var Gp=Ht((aF,_y)=>{"use strict";var vy=Object.prototype.toString;_y.exports=function(t){var e=vy.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&vy.call(t.callee)==="[object Function]"),o}});var Cy=Ht((uF,Ay)=>{"use strict";var Ty;Object.keys||(el=Object.prototype.hasOwnProperty,Vp=Object.prototype.toString,xy=Gp(),Hp=Object.prototype.propertyIsEnumerable,Ey=!Hp.call({toString:null},"toString"),My=Hp.call(function(){},"prototype"),nl=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Fc=function(r){var t=r.constructor;return t&&t.prototype===r},Sy={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},wy=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!Sy["$"+r]&&el.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Fc(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),by=function(r){if(typeof window=="undefined"||!wy)return Fc(r);try{return Fc(r)}catch(t){return!1}},Ty=function(t){var e=t!==null&&typeof t=="object",o=Vp.call(t)==="[object Function]",a=xy(t),l=e&&Vp.call(t)==="[object String]",h=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var f=My&&o;if(l&&t.length>0&&!el.call(t,0))for(var p=0;p<t.length;++p)h.push(String(p));if(a&&t.length>0)for(var d=0;d<t.length;++d)h.push(String(d));else for(var g in t)!(f&&g==="prototype")&&el.call(t,g)&&h.push(String(g));if(Ey)for(var _=by(t),y=0;y<nl.length;++y)!(_&&nl[y]==="constructor")&&el.call(t,nl[y])&&h.push(nl[y]);return h});var el,Vp,xy,Hp,Ey,My,nl,Fc,Sy,wy,by;Ay.exports=Ty});var Wp=Ht((lF,Ry)=>{"use strict";var DA=Array.prototype.slice,FA=Gp(),Py=Object.keys,Uc=Py?function(t){return Py(t)}:Cy(),Iy=Object.keys;Uc.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(o){return FA(o)?Iy(DA.call(o)):Iy(o)})}else Object.keys=Uc;return Object.keys||Uc};Ry.exports=Uc});var qp=Ht((cF,Ly)=>{"use strict";Ly.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var l=Object.getOwnPropertySymbols(t);if(l.length!==1||l[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var h=Object.getOwnPropertyDescriptor(t,e);if(h.value!==a||h.enumerable!==!0)return!1}return!0}});var Bc=Ht((hF,Ny)=>{"use strict";var UA=qp();Ny.exports=function(){return UA()&&!!Symbol.toStringTag}});var Dy=Ht((fF,Oy)=>{"use strict";Oy.exports=Error});var Uy=Ht((pF,Fy)=>{"use strict";Fy.exports=EvalError});var zy=Ht((dF,By)=>{"use strict";By.exports=RangeError});var Gy=Ht((mF,ky)=>{"use strict";ky.exports=ReferenceError});var Xp=Ht((gF,Vy)=>{"use strict";Vy.exports=SyntaxError});var ta=Ht((yF,Hy)=>{"use strict";Hy.exports=TypeError});var qy=Ht((vF,Wy)=>{"use strict";Wy.exports=URIError});var $y=Ht((_F,Yy)=>{"use strict";var Xy=typeof Symbol!="undefined"&&Symbol,BA=qp();Yy.exports=function(){return typeof Xy!="function"||typeof Symbol!="function"||typeof Xy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:BA()}});var Jy=Ht((xF,Zy)=>{"use strict";var Yp={__proto__:null,foo:{}},zA=Object;Zy.exports=function(){return{__proto__:Yp}.foo===Yp.foo&&!(Yp instanceof zA)}});var Qy=Ht((EF,jy)=>{"use strict";var kA="Function.prototype.bind called on incompatible ",GA=Object.prototype.toString,VA=Math.max,HA="[object Function]",Ky=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var l=0;l<e.length;l+=1)o[l+t.length]=e[l];return o},WA=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},qA=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};jy.exports=function(t){var e=this;if(typeof e!="function"||GA.apply(e)!==HA)throw new TypeError(kA+e);for(var o=WA(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,Ky(o,arguments));return Object(g)===g?g:this}return e.apply(t,Ky(o,arguments))},h=VA(0,e.length-o.length),f=[],p=0;p<h;p++)f[p]="$"+p;if(a=Function("binder","return function ("+qA(f,",")+"){ return binder.apply(this,arguments); }")(l),e.prototype){var d=function(){};d.prototype=e.prototype,a.prototype=new d,d.prototype=null}return a}});var zc=Ht((MF,tv)=>{"use strict";var XA=Qy();tv.exports=Function.prototype.bind||XA});var nv=Ht((SF,ev)=>{"use strict";var YA=Function.prototype.call,$A=Object.prototype.hasOwnProperty,ZA=zc();ev.exports=ZA.call(YA,$A)});var uu=Ht((wF,av)=>{"use strict";var en,JA=Dy(),KA=Uy(),jA=zy(),QA=Gy(),au=Xp(),su=ta(),tC=qy(),sv=Function,$p=function(r){try{return sv(\'"use strict"; return (\'+r+").constructor;")()}catch(t){}},ea=Object.getOwnPropertyDescriptor;if(ea)try{ea({},"")}catch(r){ea=null}var Zp=function(){throw new su},eC=ea?function(){try{return arguments.callee,Zp}catch(r){try{return ea(arguments,"callee").get}catch(t){return Zp}}}():Zp,iu=$y()(),nC=Jy()(),Ar=Object.getPrototypeOf||(nC?function(r){return r.__proto__}:null),ou={},rC=typeof Uint8Array=="undefined"||!Ar?en:Ar(Uint8Array),na={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?en:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?en:ArrayBuffer,"%ArrayIteratorPrototype%":iu&&Ar?Ar([][Symbol.iterator]()):en,"%AsyncFromSyncIteratorPrototype%":en,"%AsyncFunction%":ou,"%AsyncGenerator%":ou,"%AsyncGeneratorFunction%":ou,"%AsyncIteratorPrototype%":ou,"%Atomics%":typeof Atomics=="undefined"?en:Atomics,"%BigInt%":typeof BigInt=="undefined"?en:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?en:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?en:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?en:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":JA,"%eval%":eval,"%EvalError%":KA,"%Float32Array%":typeof Float32Array=="undefined"?en:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?en:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?en:FinalizationRegistry,"%Function%":sv,"%GeneratorFunction%":ou,"%Int8Array%":typeof Int8Array=="undefined"?en:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?en:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?en:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":iu&&Ar?Ar(Ar([][Symbol.iterator]())):en,"%JSON%":typeof JSON=="object"?JSON:en,"%Map%":typeof Map=="undefined"?en:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!iu||!Ar?en:Ar(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?en:Promise,"%Proxy%":typeof Proxy=="undefined"?en:Proxy,"%RangeError%":jA,"%ReferenceError%":QA,"%Reflect%":typeof Reflect=="undefined"?en:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?en:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!iu||!Ar?en:Ar(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?en:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":iu&&Ar?Ar(""[Symbol.iterator]()):en,"%Symbol%":iu?Symbol:en,"%SyntaxError%":au,"%ThrowTypeError%":eC,"%TypedArray%":rC,"%TypeError%":su,"%Uint8Array%":typeof Uint8Array=="undefined"?en:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?en:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?en:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?en:Uint32Array,"%URIError%":tC,"%WeakMap%":typeof WeakMap=="undefined"?en:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?en:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?en:WeakSet};if(Ar)try{null.error}catch(r){rv=Ar(Ar(r)),na["%Error.prototype%"]=rv}var rv,iC=function r(t){var e;if(t==="%AsyncFunction%")e=$p("async function () {}");else if(t==="%GeneratorFunction%")e=$p("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=$p("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&Ar&&(e=Ar(a.prototype))}return na[t]=e,e},iv={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},rl=zc(),kc=nv(),oC=rl.call(Function.call,Array.prototype.concat),sC=rl.call(Function.apply,Array.prototype.splice),ov=rl.call(Function.call,String.prototype.replace),Gc=rl.call(Function.call,String.prototype.slice),aC=rl.call(Function.call,RegExp.prototype.exec),uC=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,lC=/\\\\(\\\\)?/g,cC=function(t){var e=Gc(t,0,1),o=Gc(t,-1);if(e==="%"&&o!=="%")throw new au("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&e!=="%")throw new au("invalid intrinsic syntax, expected opening `%`");var a=[];return ov(t,uC,function(l,h,f,p){a[a.length]=f?ov(p,lC,"$1"):h||l}),a},hC=function(t,e){var o=t,a;if(kc(iv,o)&&(a=iv[o],o="%"+a[0]+"%"),kc(na,o)){var l=na[o];if(l===ou&&(l=iC(o)),typeof l=="undefined"&&!e)throw new su("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new au("intrinsic "+t+" does not exist!")};av.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new su("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new su(\'"allowMissing" argument must be a boolean\');if(aC(/^%?[^%]*%?$/,t)===null)throw new au("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=cC(t),a=o.length>0?o[0]:"",l=hC("%"+a+"%",e),h=l.name,f=l.value,p=!1,d=l.alias;d&&(a=d[0],sC(o,oC([0,1],d)));for(var g=1,_=!0;g<o.length;g+=1){var y=o[g],M=Gc(y,0,1),b=Gc(y,-1);if((M===\'"\'||M==="\'"||M==="`"||b===\'"\'||b==="\'"||b==="`")&&M!==b)throw new au("property names with quotes must have matching quotes");if((y==="constructor"||!_)&&(p=!0),a+="."+y,h="%"+a+"%",kc(na,h))f=na[h];else if(f!=null){if(!(y in f)){if(!e)throw new su("base intrinsic for "+t+" exists, but the property is not available.");return}if(ea&&g+1>=o.length){var T=ea(f,y);_=!!T,_&&"get"in T&&!("originalValue"in T.get)?f=T.get:f=f[y]}else _=kc(f,y),f=f[y];_&&!p&&(na[h]=f)}}return f}});var Hc=Ht((bF,uv)=>{"use strict";var fC=uu(),Vc=fC("%Object.defineProperty%",!0)||!1;if(Vc)try{Vc({},"a",{value:1})}catch(r){Vc=!1}uv.exports=Vc});var Jp=Ht((TF,lv)=>{"use strict";var pC=uu(),Wc=pC("%Object.getOwnPropertyDescriptor%",!0);if(Wc)try{Wc([],"length")}catch(r){Wc=null}lv.exports=Wc});var qc=Ht((AF,fv)=>{"use strict";var cv=Hc(),dC=Xp(),lu=ta(),hv=Jp();fv.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new lu("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new lu("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new lu("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new lu("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new lu("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new lu("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,p=!!hv&&hv(t,e);if(cv)cv(t,e,{configurable:h===null&&p?p.configurable:!h,enumerable:a===null&&p?p.enumerable:!a,value:o,writable:l===null&&p?p.writable:!l});else if(f||!a&&!l&&!h)t[e]=o;else throw new dC("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Xc=Ht((CF,dv)=>{"use strict";var Kp=Hc(),pv=function(){return!!Kp};pv.hasArrayLengthDefineBug=function(){if(!Kp)return null;try{return Kp([],"length",{value:1}).length!==1}catch(t){return!0}};dv.exports=pv});var _v=Ht((PF,vv)=>{"use strict";var mC=uu(),mv=qc(),gC=Xc()(),gv=Jp(),yv=ta(),yC=mC("%Math.floor%");vv.exports=function(t,e){if(typeof t!="function")throw new yv("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||yC(e)!==e)throw new yv("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&gv){var h=gv(t,"length");h&&!h.configurable&&(a=!1),h&&!h.writable&&(l=!1)}return(a||l||!o)&&(gC?mv(t,"length",e,!0,!0):mv(t,"length",e)),t}});var Zc=Ht((IF,Yc)=>{"use strict";var jp=zc(),$c=uu(),vC=_v(),_C=ta(),Mv=$c("%Function.prototype.apply%"),Sv=$c("%Function.prototype.call%"),wv=$c("%Reflect.apply%",!0)||jp.call(Sv,Mv),xv=Hc(),xC=$c("%Math.max%");Yc.exports=function(t){if(typeof t!="function")throw new _C("a function is required");var e=wv(jp,Sv,arguments);return vC(e,1+xC(0,t.length-(arguments.length-1)),!0)};var Ev=function(){return wv(jp,Mv,arguments)};xv?xv(Yc.exports,"apply",{value:Ev}):Yc.exports.apply=Ev});var Qp=Ht((RF,Av)=>{"use strict";var bv=uu(),Tv=Zc(),EC=Tv(bv("String.prototype.indexOf"));Av.exports=function(t,e){var o=bv(t,!!e);return typeof o=="function"&&EC(t,".prototype.")>-1?Tv(o):o}});var Iv=Ht((LF,Pv)=>{"use strict";var MC=Bc()(),SC=Qp(),td=SC("Object.prototype.toString"),Jc=function(t){return MC&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:td(t)==="[object Arguments]"},Cv=function(t){return Jc(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&td(t)!=="[object Array]"&&td(t.callee)==="[object Function]"},wC=function(){return Jc(arguments)}();Jc.isLegacyArguments=Cv;Pv.exports=wC?Jc:Cv});var cu=Ht((NF,Ov)=>{"use strict";var bC=Wp(),TC=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",AC=Object.prototype.toString,CC=Array.prototype.concat,Rv=qc(),PC=function(r){return typeof r=="function"&&AC.call(r)==="[object Function]"},Lv=Xc()(),IC=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!PC(o)||!o())return}Lv?Rv(r,t,e,!0):Rv(r,t,e)},Nv=function(r,t){var e=arguments.length>2?arguments[2]:{},o=bC(t);TC&&(o=CC.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)IC(r,o[a],t[o[a]],e[o[a]])};Nv.supportsDescriptors=!!Lv;Ov.exports=Nv});var ed=Ht((OF,Fv)=>{"use strict";var Dv=function(r){return r!==r};Fv.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||Dv(t)&&Dv(e))}});var nd=Ht((DF,Uv)=>{"use strict";var RC=ed();Uv.exports=function(){return typeof Object.is=="function"?Object.is:RC}});var zv=Ht((FF,Bv)=>{"use strict";var LC=nd(),NC=cu();Bv.exports=function(){var t=LC();return NC(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Hv=Ht((UF,Vv)=>{"use strict";var OC=cu(),DC=Zc(),FC=ed(),kv=nd(),UC=zv(),Gv=DC(kv(),Object);OC(Gv,{getPolyfill:kv,implementation:FC,shim:UC});Vv.exports=Gv});var $v=Ht((BF,Yv)=>{"use strict";var rd=Qp(),Wv=Bc()(),qv,Xv,id,od;Wv&&(qv=rd("Object.prototype.hasOwnProperty"),Xv=rd("RegExp.prototype.exec"),id={},Kc=function(){throw id},od={toString:Kc,valueOf:Kc},typeof Symbol.toPrimitive=="symbol"&&(od[Symbol.toPrimitive]=Kc));var Kc,BC=rd("Object.prototype.toString"),zC=Object.getOwnPropertyDescriptor,kC="[object RegExp]";Yv.exports=Wv?function(t){if(!t||typeof t!="object")return!1;var e=zC(t,"lastIndex"),o=e&&qv(e,"value");if(!o)return!1;try{Xv(t,od)}catch(a){return a===id}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:BC(t)===kC}});var Jv=Ht((zF,Zv)=>{"use strict";var ol=function(){return typeof function(){}.name=="string"},il=Object.getOwnPropertyDescriptor;if(il)try{il([],"length")}catch(r){il=null}ol.functionsHaveConfigurableNames=function(){if(!ol()||!il)return!1;var t=il(function(){},"name");return!!t&&!!t.configurable};var GC=Function.prototype.bind;ol.boundFunctionsHaveNames=function(){return ol()&&typeof GC=="function"&&function(){}.bind().name!==""};Zv.exports=ol});var Qv=Ht((kF,jv)=>{"use strict";var Kv=qc(),VC=Xc()(),HC=Jv().functionsHaveConfigurableNames(),WC=ta();jv.exports=function(t,e){if(typeof t!="function")throw new WC("`fn` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||HC)&&(VC?Kv(t,"name",e,!0,!0):Kv(t,"name",e)),t}});var sd=Ht((GF,t_)=>{"use strict";var qC=Qv(),XC=ta(),YC=Object;t_.exports=qC(function(){if(this==null||this!==YC(this))throw new XC("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0)});var ad=Ht((VF,e_)=>{"use strict";var $C=sd(),ZC=cu().supportsDescriptors,JC=Object.getOwnPropertyDescriptor;e_.exports=function(){if(ZC&&/a/mig.flags==="gim"){var t=JC(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),t.get.call(o),e==="dy")return t.get}}return $C}});var i_=Ht((HF,r_)=>{"use strict";var KC=cu().supportsDescriptors,jC=ad(),QC=Object.getOwnPropertyDescriptor,tP=Object.defineProperty,eP=TypeError,n_=Object.getPrototypeOf,nP=/a/;r_.exports=function(){if(!KC||!n_)throw new eP("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=jC(),e=n_(nP),o=QC(e,"flags");return(!o||o.get!==t)&&tP(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var u_=Ht((WF,a_)=>{"use strict";var rP=cu(),iP=Zc(),oP=sd(),o_=ad(),sP=i_(),s_=iP(o_());rP(s_,{getPolyfill:o_,implementation:oP,shim:sP});a_.exports=s_});var c_=Ht((qF,l_)=>{"use strict";var aP=Date.prototype.getDay,uP=function(t){try{return aP.call(t),!0}catch(e){return!1}},lP=Object.prototype.toString,cP="[object Date]",hP=Bc()();l_.exports=function(t){return typeof t!="object"||t===null?!1:hP?uP(t):lP.call(t)===cP}});var ud=Ht((XF,E_)=>{var h_=Wp(),f_=Iv(),p_=Hv(),d_=$v(),m_=u_(),g_=c_(),y_=Date.prototype.getTime;function x_(r,t,e){var o=e||{};return(o.strict?p_(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?p_(r,t):r==t:fP(r,t,o)}function v_(r){return r==null}function __(r){return!(!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number")}function fP(r,t,e){var o,a;if(typeof r!=typeof t||v_(r)||v_(t)||r.prototype!==t.prototype||f_(r)!==f_(t))return!1;var l=d_(r),h=d_(t);if(l!==h)return!1;if(l||h)return r.source===t.source&&m_(r)===m_(t);if(g_(r)&&g_(t))return y_.call(r)===y_.call(t);var f=__(r),p=__(t);if(f!==p)return!1;if(f||p){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var d=h_(r),g=h_(t)}catch(_){return!1}if(d.length!==g.length)return!1;for(d.sort(),g.sort(),o=d.length-1;o>=0;o--)if(d[o]!=g[o])return!1;for(o=d.length-1;o>=0;o--)if(a=d[o],!x_(r[a],t[a],e))return!1;return!0}E_.exports=x_});var xd=Ht((jB,C_)=>{var nI=ud(),xo=function(r){this.precision=r&&r.precision?r.precision:17,this.direction=r&&r.direction?r.direction:!1,this.pseudoNode=r&&r.pseudoNode?r.pseudoNode:!1,this.objectComparator=r&&r.objectComparator?r.objectComparator:rI};xo.prototype.compare=function(r,t){if(r.type!==t.type||!A_(r,t))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,t.coordinates);case"LineString":return this.compareLine(r.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(r,t);case"Feature":return this.compareFeature(r,t);default:if(r.type.indexOf("Multi")===0){var e=this,o=T_(r),a=T_(t);return o.every(function(l){return this.some(function(h){return e.compare(l,h)})},a)}}return!1};function T_(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function A_(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}xo.prototype.compareCoord=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e++)if(r[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};xo.prototype.compareLine=function(r,t,e,o){if(!A_(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),l=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],l[0])&&(l=this.fixStartIndex(l,a),!l))){var h=this.compareCoord(a[e],l[e]);return this.direction||h?this.comparePath(a,l):this.compareCoord(a[e],l[l.length-(1+e)])?this.comparePath(a.slice().reverse(),l):!1}};xo.prototype.fixStartIndex=function(r,t){for(var e,o=-1,a=0;a<r.length;a++)if(this.compareCoord(r[a],t[0])){o=a;break}return o>=0&&(e=[].concat(r.slice(o,r.length),r.slice(1,o+1))),e};xo.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};xo.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(l){return this.some(function(h){return a.compareLine(l,h,1,!0)})},o)}else return!1};xo.prototype.compareFeature=function(r,t){return r.id!==t.id||!this.objectComparator(r.properties,t.properties)||!this.compareBBox(r,t)?!1:this.compare(r.geometry,t.geometry)};xo.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};xo.prototype.removePseudo=function(r){return r};function rI(r,t){return nI(r,t,{strict:!0})}C_.exports=xo});var P_=Ht((cz,th)=>{function ws(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}ws.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var l=this._regionQuery(a);if(l.length<this.minPts)this.noise.push(a);else{var h=this.clusters.length;this.clusters.push([]),this._addToCluster(a,h),this._expandCluster(h,l)}}return this.clusters};ws.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};ws.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};ws.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};ws.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};ws.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};ws.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof th!="undefined"&&th.exports&&(th.exports=ws)});var I_=Ht((hz,eh)=>{function bs(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}bs.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};bs.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var l=0;l<this.k;l++){for(var h=new Array(g),f=0,p=0;p<g;p++)h[p]=0;for(var d=0;d<e;d++){var g=this.dataset[d].length;if(l===this.assignments[d]){for(var p=0;p<g;p++)h[p]+=this.dataset[d][p];f++}}if(f>0){for(var p=0;p<g;p++)h[p]/=f;this.centroids[l]=h}else this.centroids[l]=this.randomCentroid(),a=!0}}return this.getClusters()};bs.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};bs.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};bs.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};bs.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,l=t.length,h,f=0;f<l;f++)h=e(r,t[f]),h<o&&(o=h,a=f);return a};bs.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof eh!="undefined"&&eh.exports&&(eh.exports=bs)});var Ed=Ht((fz,nh)=>{function Eo(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}Eo.prototype.insert=function(r,t){for(var e=this._queue.length,o=e;o--;){var a=this._priorities[o];this._sorting==="desc"?t>a&&(e=o):t<a&&(e=o)}this._insertAt(r,t,e)};Eo.prototype.remove=function(r){for(var t=this._queue.length;t--;){var e=this._queue[t];if(r===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};Eo.prototype.forEach=function(r){this._queue.forEach(r)};Eo.prototype.getElements=function(){return this._queue};Eo.prototype.getElementPriority=function(r){return this._priorities[r]};Eo.prototype.getPriorities=function(){return this._priorities};Eo.prototype.getElementsWithPriorities=function(){for(var r=[],t=0,e=this._queue.length;t<e;t++)r.push([this._queue[t],this._priorities[t]]);return r};Eo.prototype._init=function(r,t,e){if(r&&t){if(this._queue=[],this._priorities=[],r.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<r.length;o++)this.insert(r[o],t[o])}e&&(this._sorting=e)};Eo.prototype._insertAt=function(r,t,e){this._queue.length===e?(this._queue.push(r),this._priorities.push(t)):(this._queue.splice(e,0,r),this._priorities.splice(e,0,t))};typeof nh!="undefined"&&nh.exports&&(nh.exports=Eo)});var L_=Ht((pz,fu)=>{typeof fu!="undefined"&&fu.exports&&(R_=Ed());var R_;function jo(r,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,t,e,o)}jo.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,l=this.dataset.length;a<l;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var h=this.clusters.length-1;this._orderedList.push(a);var f=new R_(null,null,"asc"),p=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,p,f),this._expandCluster(h,f))}return this.clusters};jo.prototype.getReachabilityPlot=function(){for(var r=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],a=this._reachability[o];r.push([o,a])}return r};jo.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};jo.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var l=o.distance(o.dataset[r],o.dataset[a]),h=Math.max(o._coreDistance,l);o._reachability[a]===void 0?(o._reachability[a]=h,e.insert(a,h)):h<o._reachability[a]&&(o._reachability[a]=h,e.remove(a),e.insert(a,h))}})};jo.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var l=e[o];if(this._processed[l]===void 0){var h=this._regionQuery(l);this._processed[l]=1,this.clusters[r].push(l),this._orderedList.push(l),this._distanceToCore(l)!==void 0&&(this._updateQueue(l,h,t),this._expandCluster(r,t))}}};jo.prototype._distanceToCore=function(r){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(r,e);if(o.length>=this.minPts)return e}};jo.prototype._regionQuery=function(r,t){t=t||this.epsilon;for(var e=[],o=0,a=this.dataset.length;o<a;o++)this.distance(this.dataset[r],this.dataset[o])<t&&e.push(o);return e};jo.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof fu!="undefined"&&fu.exports&&(fu.exports=jo)});var N_=Ht((dz,rh)=>{typeof rh!="undefined"&&rh.exports&&(rh.exports={DBSCAN:P_(),KMEANS:I_(),OPTICS:L_(),PriorityQueue:Ed()})});var Md=Ht((xz,D_)=>{"use strict";D_.exports={eudist:function(t,e,o){for(var a=t.length,l=0,h=0;h<a;h++){var f=(t[h]||0)-(e[h]||0);l+=f*f}return o?Math.sqrt(l):l},mandist:function(t,e,o){for(var a=t.length,l=0,h=0;h<a;h++)l+=Math.abs((t[h]||0)-(e[h]||0));return o?Math.sqrt(l):l},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var B_=Ht((Ez,U_)=>{"use strict";var F_=Md(),lI=F_.eudist,cI=F_.dist;U_.exports={kmrand:function(t,e){for(var o={},a=[],l=e<<2,h=t.length,f=t[0].length>0;a.length<e&&l-- >0;){var p=t[Math.floor(Math.random()*h)],d=f?p.join("_"):""+p;o[d]||(o[d]=!0,a.push(p))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?lI:cI,a=[],l=t.length,h=t[0].length>0,f={},p=t[Math.floor(Math.random()*l)],d=h?p.join("_"):""+p;for(a.push(p),f[d]=!0;a.length<e;){for(var g=[],_=a.length,y=0,M=[],b=0;b<l;b++){for(var T=1/0,x=0;x<_;x++){var v=o(t[b],a[x]);v<=T&&(T=v)}g[b]=T}for(var P=0;P<l;P++)y+=g[P];for(var S=0;S<l;S++)M[S]={i:S,v:t[S],pr:g[S]/y,cs:0};M.sort(function(B,I){return B.pr-I.pr}),M[0].cs=M[0].pr;for(var L=1;L<l;L++)M[L].cs=M[L-1].cs+M[L].pr;for(var N=Math.random(),G=0;G<l-1&&M[G++].cs<N;);a.push(M[G-1].v)}return a}}});var H_=Ht((wz,V_)=>{"use strict";var Sd=Md(),G_=B_(),hI=Sd.eudist,Mz=Sd.mandist,Sz=Sd.dist,fI=G_.kmrand,pI=G_.kmpp,z_=1e4;function k_(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function dI(r,t,e,o){var a=[],l=[],h=[],f=[],p=!1,d=o||z_,g=r.length,_=r[0].length,y=_>0,M=[];if(e)e=="kmrand"?a=fI(r,t):e=="kmpp"?a=pI(r,t):a=e;else for(var b={};a.length<t;){var T=Math.floor(Math.random()*g);b[T]||(b[T]=!0,a.push(r[T]))}do{k_(t,0,M);for(var x=0;x<g;x++){for(var v=1/0,P=0,S=0;S<t;S++){var f=y?hI(r[x],a[S]):Math.abs(r[x]-a[S]);f<=v&&(v=f,P=S)}h[x]=P,M[P]++}for(var L=[],l=[],N=0,G=0;G<t;G++)L[G]=y?k_(_,0,L[G]):0,l[G]=a[G];if(y){for(var B=0;B<t;B++)a[B]=[];for(var I=0;I<g;I++)for(var O=h[I],q=L[O],st=r[I],V=0;V<_;V++)q[V]+=st[V];p=!0;for(var Mt=0;Mt<t;Mt++){for(var $=a[Mt],ut=L[Mt],xt=l[Mt],mt=M[Mt],lt=0;lt<_;lt++)$[lt]=ut[lt]/mt||0;if(p){for(var ht=0;ht<_;ht++)if(xt[ht]!=$[ht]){p=!1;break}}}}else{for(var k=0;k<g;k++){var nt=h[k];L[nt]+=r[k]}for(var ft=0;ft<t;ft++)a[ft]=L[ft]/M[ft]||0;p=!0;for(var Tt=0;Tt<t;Tt++)if(l[Tt]!=a[Tt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:z_-d,k:t,idxs:h,centroids:a}}V_.exports=dI});var yu=Ht((Pd,Id)=>{(function(r,t){typeof Pd=="object"&&typeof Id!="undefined"?Id.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(Pd,function(){"use strict";function r(Y,w){var C={label:0,sent:function(){if(z[0]&1)throw z[1];return z[1]},trys:[],ops:[]},R,H,z,rt;return rt={next:j(0),throw:j(1),return:j(2)},typeof Symbol=="function"&&(rt[Symbol.iterator]=function(){return this}),rt;function j(tt){return function(Z){return D([tt,Z])}}function D(tt){if(R)throw new TypeError("Generator is already executing.");for(;C;)try{if(R=1,H&&(z=tt[0]&2?H.return:tt[0]?H.throw||((z=H.return)&&z.call(H),0):H.next)&&!(z=z.call(H,tt[1])).done)return z;switch(H=0,z&&(tt=[tt[0]&2,z.value]),tt[0]){case 0:case 1:z=tt;break;case 4:return C.label++,{value:tt[1],done:!1};case 5:C.label++,H=tt[1],tt=[0];continue;case 7:tt=C.ops.pop(),C.trys.pop();continue;default:if(z=C.trys,!(z=z.length>0&&z[z.length-1])&&(tt[0]===6||tt[0]===2)){C=0;continue}if(tt[0]===3&&(!z||tt[1]>z[0]&&tt[1]<z[3])){C.label=tt[1];break}if(tt[0]===6&&C.label<z[1]){C.label=z[1],z=tt;break}if(z&&C.label<z[2]){C.label=z[2],C.ops.push(tt);break}z[2]&&C.ops.pop(),C.trys.pop();continue}tt=w.call(Y,C)}catch(Z){tt=[6,Z],H=0}finally{R=z=0}if(tt[0]&5)throw tt[1];return{value:tt[0]?tt[1]:void 0,done:!0}}}var t=function(){function Y(w,C){this.next=null,this.key=w,this.data=C,this.left=null,this.right=null}return Y}();function e(Y,w){return Y>w?1:Y<w?-1:0}function o(Y,w,C){for(var R=new t(null,null),H=R,z=R;;){var rt=C(Y,w.key);if(rt<0){if(w.left===null)break;if(C(Y,w.left.key)<0){var j=w.left;if(w.left=j.right,j.right=w,w=j,w.left===null)break}z.left=w,z=w,w=w.left}else if(rt>0){if(w.right===null)break;if(C(Y,w.right.key)>0){var j=w.right;if(w.right=j.left,j.left=w,w=j,w.right===null)break}H.right=w,H=w,w=w.right}else break}return H.right=w.left,z.left=w.right,w.left=R.right,w.right=R.left,w}function a(Y,w,C,R){var H=new t(Y,w);if(C===null)return H.left=H.right=null,H;C=o(Y,C,R);var z=R(Y,C.key);return z<0?(H.left=C.left,H.right=C,C.left=null):z>=0&&(H.right=C.right,H.left=C,C.right=null),H}function l(Y,w,C){var R=null,H=null;if(w){w=o(Y,w,C);var z=C(w.key,Y);z===0?(R=w.left,H=w.right):z<0?(H=w.right,w.right=null,R=w):(R=w.left,w.left=null,H=w)}return{left:R,right:H}}function h(Y,w,C){return w===null?Y:(Y===null||(w=o(Y.key,w,C),w.left=Y),w)}function f(Y,w,C,R,H){if(Y){R(""+w+(C?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+H(Y)+`\n`);var z=w+(C?" ":"\\u2502 ");Y.left&&f(Y.left,z,!1,R,H),Y.right&&f(Y.right,z,!0,R,H)}}var p=function(){function Y(w){w===void 0&&(w=e),this._root=null,this._size=0,this._comparator=w}return Y.prototype.insert=function(w,C){return this._size++,this._root=a(w,C,this._root,this._comparator)},Y.prototype.add=function(w,C){var R=new t(w,C);this._root===null&&(R.left=R.right=null,this._size++,this._root=R);var H=this._comparator,z=o(w,this._root,H),rt=H(w,z.key);return rt===0?this._root=z:(rt<0?(R.left=z.left,R.right=z,z.left=null):rt>0&&(R.right=z.right,R.left=z,z.right=null),this._size++,this._root=R),this._root},Y.prototype.remove=function(w){this._root=this._remove(w,this._root,this._comparator)},Y.prototype._remove=function(w,C,R){var H;if(C===null)return null;C=o(w,C,R);var z=R(w,C.key);return z===0?(C.left===null?H=C.right:(H=o(w,C.left,R),H.right=C.right),this._size--,H):C},Y.prototype.pop=function(){var w=this._root;if(w){for(;w.left;)w=w.left;return this._root=o(w.key,this._root,this._comparator),this._root=this._remove(w.key,this._root,this._comparator),{key:w.key,data:w.data}}return null},Y.prototype.findStatic=function(w){for(var C=this._root,R=this._comparator;C;){var H=R(w,C.key);if(H===0)return C;H<0?C=C.left:C=C.right}return null},Y.prototype.find=function(w){return this._root&&(this._root=o(w,this._root,this._comparator),this._comparator(w,this._root.key)!==0)?null:this._root},Y.prototype.contains=function(w){for(var C=this._root,R=this._comparator;C;){var H=R(w,C.key);if(H===0)return!0;H<0?C=C.left:C=C.right}return!1},Y.prototype.forEach=function(w,C){for(var R=this._root,H=[],z=!1;!z;)R!==null?(H.push(R),R=R.left):H.length!==0?(R=H.pop(),w.call(C,R),R=R.right):z=!0;return this},Y.prototype.range=function(w,C,R,H){for(var z=[],rt=this._comparator,j=this._root,D;z.length!==0||j;)if(j)z.push(j),j=j.left;else{if(j=z.pop(),D=rt(j.key,C),D>0)break;if(rt(j.key,w)>=0&&R.call(H,j))return this;j=j.right}return this},Y.prototype.keys=function(){var w=[];return this.forEach(function(C){var R=C.key;return w.push(R)}),w},Y.prototype.values=function(){var w=[];return this.forEach(function(C){var R=C.data;return w.push(R)}),w},Y.prototype.min=function(){return this._root?this.minNode(this._root).key:null},Y.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},Y.prototype.minNode=function(w){if(w===void 0&&(w=this._root),w)for(;w.left;)w=w.left;return w},Y.prototype.maxNode=function(w){if(w===void 0&&(w=this._root),w)for(;w.right;)w=w.right;return w},Y.prototype.at=function(w){for(var C=this._root,R=!1,H=0,z=[];!R;)if(C)z.push(C),C=C.left;else if(z.length>0){if(C=z.pop(),H===w)return C;H++,C=C.right}else R=!0;return null},Y.prototype.next=function(w){var C=this._root,R=null;if(w.right){for(R=w.right;R.left;)R=R.left;return R}for(var H=this._comparator;C;){var z=H(w.key,C.key);if(z===0)break;z<0?(R=C,C=C.left):C=C.right}return R},Y.prototype.prev=function(w){var C=this._root,R=null;if(w.left!==null){for(R=w.left;R.right;)R=R.right;return R}for(var H=this._comparator;C;){var z=H(w.key,C.key);if(z===0)break;z<0?C=C.left:(R=C,C=C.right)}return R},Y.prototype.clear=function(){return this._root=null,this._size=0,this},Y.prototype.toList=function(){return _(this._root)},Y.prototype.load=function(w,C,R){C===void 0&&(C=[]),R===void 0&&(R=!1);var H=w.length,z=this._comparator;if(R&&b(w,C,0,H-1,z),this._root===null)this._root=d(w,C,0,H),this._size=H;else{var rt=M(this.toList(),g(w,C),z);H=this._size+H,this._root=y({head:rt},0,H)}return this},Y.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(Y.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(Y.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Y.prototype.toString=function(w){w===void 0&&(w=function(R){return String(R.key)});var C=[];return f(this._root,"",!0,function(R){return C.push(R)},w),C.join("")},Y.prototype.update=function(w,C,R){var H=this._comparator,z=l(w,this._root,H),rt=z.left,j=z.right;H(w,C)<0?j=a(C,R,j,H):rt=a(C,R,rt,H),this._root=h(rt,j,H)},Y.prototype.split=function(w){return l(w,this._root,this._comparator)},Y.prototype[Symbol.iterator]=function(){var w,C,R;return r(this,function(H){switch(H.label){case 0:w=this._root,C=[],R=!1,H.label=1;case 1:return R?[3,6]:w===null?[3,2]:(C.push(w),w=w.left,[3,5]);case 2:return C.length===0?[3,4]:(w=C.pop(),[4,w]);case 3:return H.sent(),w=w.right,[3,5];case 4:R=!0,H.label=5;case 5:return[3,1];case 6:return[2]}})},Y}();function d(Y,w,C,R){var H=R-C;if(H>0){var z=C+Math.floor(H/2),rt=Y[z],j=w[z],D=new t(rt,j);return D.left=d(Y,w,C,z),D.right=d(Y,w,z+1,R),D}return null}function g(Y,w){for(var C=new t(null,null),R=C,H=0;H<Y.length;H++)R=R.next=new t(Y[H],w[H]);return R.next=null,C.next}function _(Y){for(var w=Y,C=[],R=!1,H=new t(null,null),z=H;!R;)w?(C.push(w),w=w.left):C.length>0?(w=z=z.next=C.pop(),w=w.right):R=!0;return z.next=null,H.next}function y(Y,w,C){var R=C-w;if(R>0){var H=w+Math.floor(R/2),z=y(Y,w,H),rt=Y.head;return rt.left=z,Y.head=Y.head.next,rt.right=y(Y,H+1,C),rt}return null}function M(Y,w,C){for(var R=new t(null,null),H=R,z=Y,rt=w;z!==null&&rt!==null;)C(z.key,rt.key)<0?(H.next=z,z=z.next):(H.next=rt,rt=rt.next),H=H.next;return z!==null?H.next=z:rt!==null&&(H.next=rt),R.next}function b(Y,w,C,R,H){if(!(C>=R)){for(var z=Y[C+R>>1],rt=C-1,j=R+1;;){do rt++;while(H(Y[rt],z)<0);do j--;while(H(Y[j],z)>0);if(rt>=j)break;var D=Y[rt];Y[rt]=Y[j],Y[j]=D,D=w[rt],w[rt]=w[j],w[j]=D}b(Y,w,C,j,H),b(Y,w,j+1,R,H)}}let T=(Y,w)=>Y.ll.x<=w.x&&w.x<=Y.ur.x&&Y.ll.y<=w.y&&w.y<=Y.ur.y,x=(Y,w)=>{if(w.ur.x<Y.ll.x||Y.ur.x<w.ll.x||w.ur.y<Y.ll.y||Y.ur.y<w.ll.y)return null;let C=Y.ll.x<w.ll.x?w.ll.x:Y.ll.x,R=Y.ur.x<w.ur.x?Y.ur.x:w.ur.x,H=Y.ll.y<w.ll.y?w.ll.y:Y.ll.y,z=Y.ur.y<w.ur.y?Y.ur.y:w.ur.y;return{ll:{x:C,y:H},ur:{x:R,y:z}}},v=Number.EPSILON;v===void 0&&(v=Math.pow(2,-52));let P=v*v,S=(Y,w)=>{if(-v<Y&&Y<v&&-v<w&&w<v)return 0;let C=Y-w;return C*C<P*Y*w?0:Y<w?-1:1};class L{constructor(){this.reset()}reset(){this.xRounder=new N,this.yRounder=new N}round(w,C){return{x:this.xRounder.round(w),y:this.yRounder.round(C)}}}class N{constructor(){this.tree=new p,this.round(0)}round(w){let C=this.tree.add(w),R=this.tree.prev(C);if(R!==null&&S(C.key,R.key)===0)return this.tree.remove(w),R.key;let H=this.tree.next(C);return H!==null&&S(C.key,H.key)===0?(this.tree.remove(w),H.key):w}}let G=new L,B=11102230246251565e-32,I=134217729,O=(3+8*B)*B;function q(Y,w,C,R,H){let z,rt,j,D,tt=w[0],Z=R[0],et=0,ot=0;Z>tt==Z>-tt?(z=tt,tt=w[++et]):(z=Z,Z=R[++ot]);let Q=0;if(et<Y&&ot<C)for(Z>tt==Z>-tt?(rt=tt+z,j=z-(rt-tt),tt=w[++et]):(rt=Z+z,j=z-(rt-Z),Z=R[++ot]),z=rt,j!==0&&(H[Q++]=j);et<Y&&ot<C;)Z>tt==Z>-tt?(rt=z+tt,D=rt-z,j=z-(rt-D)+(tt-D),tt=w[++et]):(rt=z+Z,D=rt-z,j=z-(rt-D)+(Z-D),Z=R[++ot]),z=rt,j!==0&&(H[Q++]=j);for(;et<Y;)rt=z+tt,D=rt-z,j=z-(rt-D)+(tt-D),tt=w[++et],z=rt,j!==0&&(H[Q++]=j);for(;ot<C;)rt=z+Z,D=rt-z,j=z-(rt-D)+(Z-D),Z=R[++ot],z=rt,j!==0&&(H[Q++]=j);return(z!==0||Q===0)&&(H[Q++]=z),Q}function st(Y,w){let C=w[0];for(let R=1;R<Y;R++)C+=w[R];return C}function V(Y){return new Float64Array(Y)}let Mt=(3+16*B)*B,$=(2+12*B)*B,ut=(9+64*B)*B*B,xt=V(4),mt=V(8),lt=V(12),ht=V(16),k=V(4);function nt(Y,w,C,R,H,z,rt){let j,D,tt,Z,et,ot,Q,St,At,ne,Gt,He,tn,Ln,mn,Fn,$n,xn,re=Y-H,En=C-H,Cn=w-z,wn=R-z;Ln=re*wn,ot=I*re,Q=ot-(ot-re),St=re-Q,ot=I*wn,At=ot-(ot-wn),ne=wn-At,mn=St*ne-(Ln-Q*At-St*At-Q*ne),Fn=Cn*En,ot=I*Cn,Q=ot-(ot-Cn),St=Cn-Q,ot=I*En,At=ot-(ot-En),ne=En-At,$n=St*ne-(Fn-Q*At-St*At-Q*ne),Gt=mn-$n,et=mn-Gt,xt[0]=mn-(Gt+et)+(et-$n),He=Ln+Gt,et=He-Ln,tn=Ln-(He-et)+(Gt-et),Gt=tn-Fn,et=tn-Gt,xt[1]=tn-(Gt+et)+(et-Fn),xn=He+Gt,et=xn-He,xt[2]=He-(xn-et)+(Gt-et),xt[3]=xn;let gn=st(4,xt),W=$*rt;if(gn>=W||-gn>=W||(et=Y-re,j=Y-(re+et)+(et-H),et=C-En,tt=C-(En+et)+(et-H),et=w-Cn,D=w-(Cn+et)+(et-z),et=R-wn,Z=R-(wn+et)+(et-z),j===0&&D===0&&tt===0&&Z===0)||(W=ut*rt+O*Math.abs(gn),gn+=re*Z+wn*j-(Cn*tt+En*D),gn>=W||-gn>=W))return gn;Ln=j*wn,ot=I*j,Q=ot-(ot-j),St=j-Q,ot=I*wn,At=ot-(ot-wn),ne=wn-At,mn=St*ne-(Ln-Q*At-St*At-Q*ne),Fn=D*En,ot=I*D,Q=ot-(ot-D),St=D-Q,ot=I*En,At=ot-(ot-En),ne=En-At,$n=St*ne-(Fn-Q*At-St*At-Q*ne),Gt=mn-$n,et=mn-Gt,k[0]=mn-(Gt+et)+(et-$n),He=Ln+Gt,et=He-Ln,tn=Ln-(He-et)+(Gt-et),Gt=tn-Fn,et=tn-Gt,k[1]=tn-(Gt+et)+(et-Fn),xn=He+Gt,et=xn-He,k[2]=He-(xn-et)+(Gt-et),k[3]=xn;let at=q(4,xt,4,k,mt);Ln=re*Z,ot=I*re,Q=ot-(ot-re),St=re-Q,ot=I*Z,At=ot-(ot-Z),ne=Z-At,mn=St*ne-(Ln-Q*At-St*At-Q*ne),Fn=Cn*tt,ot=I*Cn,Q=ot-(ot-Cn),St=Cn-Q,ot=I*tt,At=ot-(ot-tt),ne=tt-At,$n=St*ne-(Fn-Q*At-St*At-Q*ne),Gt=mn-$n,et=mn-Gt,k[0]=mn-(Gt+et)+(et-$n),He=Ln+Gt,et=He-Ln,tn=Ln-(He-et)+(Gt-et),Gt=tn-Fn,et=tn-Gt,k[1]=tn-(Gt+et)+(et-Fn),xn=He+Gt,et=xn-He,k[2]=He-(xn-et)+(Gt-et),k[3]=xn;let _t=q(at,mt,4,k,lt);Ln=j*Z,ot=I*j,Q=ot-(ot-j),St=j-Q,ot=I*Z,At=ot-(ot-Z),ne=Z-At,mn=St*ne-(Ln-Q*At-St*At-Q*ne),Fn=D*tt,ot=I*D,Q=ot-(ot-D),St=D-Q,ot=I*tt,At=ot-(ot-tt),ne=tt-At,$n=St*ne-(Fn-Q*At-St*At-Q*ne),Gt=mn-$n,et=mn-Gt,k[0]=mn-(Gt+et)+(et-$n),He=Ln+Gt,et=He-Ln,tn=Ln-(He-et)+(Gt-et),Gt=tn-Fn,et=tn-Gt,k[1]=tn-(Gt+et)+(et-Fn),xn=He+Gt,et=xn-He,k[2]=He-(xn-et)+(Gt-et),k[3]=xn;let ct=q(_t,lt,4,k,ht);return ht[ct-1]}function ft(Y,w,C,R,H,z){let rt=(w-z)*(C-H),j=(Y-H)*(R-z),D=rt-j,tt=Math.abs(rt+j);return Math.abs(D)>=Mt*tt?D:-nt(Y,w,C,R,H,z,tt)}let Tt=(Y,w)=>Y.x*w.y-Y.y*w.x,gt=(Y,w)=>Y.x*w.x+Y.y*w.y,Lt=(Y,w,C)=>{let R=ft(Y.x,Y.y,w.x,w.y,C.x,C.y);return R>0?-1:R<0?1:0},qt=Y=>Math.sqrt(gt(Y,Y)),Xt=(Y,w,C)=>{let R={x:w.x-Y.x,y:w.y-Y.y},H={x:C.x-Y.x,y:C.y-Y.y};return Tt(H,R)/qt(H)/qt(R)},Ft=(Y,w,C)=>{let R={x:w.x-Y.x,y:w.y-Y.y},H={x:C.x-Y.x,y:C.y-Y.y};return gt(H,R)/qt(H)/qt(R)},Qt=(Y,w,C)=>w.y===0?null:{x:Y.x+w.x/w.y*(C-Y.y),y:C},Ct=(Y,w,C)=>w.x===0?null:{x:C,y:Y.y+w.y/w.x*(C-Y.x)},ee=(Y,w,C,R)=>{if(w.x===0)return Ct(C,R,Y.x);if(R.x===0)return Ct(Y,w,C.x);if(w.y===0)return Qt(C,R,Y.y);if(R.y===0)return Qt(Y,w,C.y);let H=Tt(w,R);if(H==0)return null;let z={x:C.x-Y.x,y:C.y-Y.y},rt=Tt(z,w)/H,j=Tt(z,R)/H,D=Y.x+j*w.x,tt=C.x+rt*R.x,Z=Y.y+j*w.y,et=C.y+rt*R.y,ot=(D+tt)/2,Q=(Z+et)/2;return{x:ot,y:Q}};class it{static compare(w,C){let R=it.comparePoints(w.point,C.point);return R!==0?R:(w.point!==C.point&&w.link(C),w.isLeft!==C.isLeft?w.isLeft?1:-1:Bt.compare(w.segment,C.segment))}static comparePoints(w,C){return w.x<C.x?-1:w.x>C.x?1:w.y<C.y?-1:w.y>C.y?1:0}constructor(w,C){w.events===void 0?w.events=[this]:w.events.push(this),this.point=w,this.isLeft=C}link(w){if(w.point===this.point)throw new Error("Tried to link already linked events");let C=w.point.events;for(let R=0,H=C.length;R<H;R++){let z=C[R];this.point.events.push(z),z.point=this.point}this.checkForConsuming()}checkForConsuming(){let w=this.point.events.length;for(let C=0;C<w;C++){let R=this.point.events[C];if(R.segment.consumedBy===void 0)for(let H=C+1;H<w;H++){let z=this.point.events[H];z.consumedBy===void 0&&R.otherSE.point.events===z.otherSE.point.events&&R.segment.consume(z.segment)}}}getAvailableLinkedEvents(){let w=[];for(let C=0,R=this.point.events.length;C<R;C++){let H=this.point.events[C];H!==this&&!H.segment.ringOut&&H.segment.isInResult()&&w.push(H)}return w}getLeftmostComparator(w){let C=new Map,R=H=>{let z=H.otherSE;C.set(H,{sine:Xt(this.point,w.point,z.point),cosine:Ft(this.point,w.point,z.point)})};return(H,z)=>{C.has(H)||R(H),C.has(z)||R(z);let{sine:rt,cosine:j}=C.get(H),{sine:D,cosine:tt}=C.get(z);return rt>=0&&D>=0?j<tt?1:j>tt?-1:0:rt<0&&D<0?j<tt?-1:j>tt?1:0:D<rt?-1:D>rt?1:0}}}let rn=0;class Bt{static compare(w,C){let R=w.leftSE.point.x,H=C.leftSE.point.x,z=w.rightSE.point.x,rt=C.rightSE.point.x;if(rt<R)return 1;if(z<H)return-1;let j=w.leftSE.point.y,D=C.leftSE.point.y,tt=w.rightSE.point.y,Z=C.rightSE.point.y;if(R<H){if(D<j&&D<tt)return 1;if(D>j&&D>tt)return-1;let et=w.comparePoint(C.leftSE.point);if(et<0)return 1;if(et>0)return-1;let ot=C.comparePoint(w.rightSE.point);return ot!==0?ot:-1}if(R>H){if(j<D&&j<Z)return-1;if(j>D&&j>Z)return 1;let et=C.comparePoint(w.leftSE.point);if(et!==0)return et;let ot=w.comparePoint(C.rightSE.point);return ot<0?1:ot>0?-1:1}if(j<D)return-1;if(j>D)return 1;if(z<rt){let et=C.comparePoint(w.rightSE.point);if(et!==0)return et}if(z>rt){let et=w.comparePoint(C.rightSE.point);if(et<0)return 1;if(et>0)return-1}if(z!==rt){let et=tt-j,ot=z-R,Q=Z-D,St=rt-H;if(et>ot&&Q<St)return 1;if(et<ot&&Q>St)return-1}return z>rt?1:z<rt||tt<Z?-1:tt>Z?1:w.id<C.id?-1:w.id>C.id?1:0}constructor(w,C,R,H){this.id=++rn,this.leftSE=w,w.segment=this,w.otherSE=C,this.rightSE=C,C.segment=this,C.otherSE=w,this.rings=R,this.windings=H}static fromRing(w,C,R){let H,z,rt,j=it.comparePoints(w,C);if(j<0)H=w,z=C,rt=1;else if(j>0)H=C,z=w,rt=-1;else throw new Error(`Tried to create degenerate segment at [${w.x}, ${w.y}]`);let D=new it(H,!0),tt=new it(z,!1);return new Bt(D,tt,[R],[rt])}replaceRightSE(w){this.rightSE=w,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let w=this.leftSE.point.y,C=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:w<C?w:C},ur:{x:this.rightSE.point.x,y:w>C?w:C}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(w){return w.x===this.leftSE.point.x&&w.y===this.leftSE.point.y||w.x===this.rightSE.point.x&&w.y===this.rightSE.point.y}comparePoint(w){if(this.isAnEndpoint(w))return 0;let C=this.leftSE.point,R=this.rightSE.point,H=this.vector();if(C.x===R.x)return w.x===C.x?0:w.x<C.x?1:-1;let z=(w.y-C.y)/H.y,rt=C.x+z*H.x;if(w.x===rt)return 0;let j=(w.x-C.x)/H.x,D=C.y+j*H.y;return w.y===D?0:w.y<D?-1:1}getIntersection(w){let C=this.bbox(),R=w.bbox(),H=x(C,R);if(H===null)return null;let z=this.leftSE.point,rt=this.rightSE.point,j=w.leftSE.point,D=w.rightSE.point,tt=T(C,j)&&this.comparePoint(j)===0,Z=T(R,z)&&w.comparePoint(z)===0,et=T(C,D)&&this.comparePoint(D)===0,ot=T(R,rt)&&w.comparePoint(rt)===0;if(Z&&tt)return ot&&!et?rt:!ot&&et?D:null;if(Z)return et&&z.x===D.x&&z.y===D.y?null:z;if(tt)return ot&&rt.x===j.x&&rt.y===j.y?null:j;if(ot&&et)return null;if(ot)return rt;if(et)return D;let Q=ee(z,this.vector(),j,w.vector());return Q===null||!T(H,Q)?null:G.round(Q.x,Q.y)}split(w){let C=[],R=w.events!==void 0,H=new it(w,!0),z=new it(w,!1),rt=this.rightSE;this.replaceRightSE(z),C.push(z),C.push(H);let j=new Bt(H,rt,this.rings.slice(),this.windings.slice());return it.comparePoints(j.leftSE.point,j.rightSE.point)>0&&j.swapEvents(),it.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),R&&(H.checkForConsuming(),z.checkForConsuming()),C}swapEvents(){let w=this.rightSE;this.rightSE=this.leftSE,this.leftSE=w,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let C=0,R=this.windings.length;C<R;C++)this.windings[C]*=-1}consume(w){let C=this,R=w;for(;C.consumedBy;)C=C.consumedBy;for(;R.consumedBy;)R=R.consumedBy;let H=Bt.compare(C,R);if(H!==0){if(H>0){let z=C;C=R,R=z}if(C.prev===R){let z=C;C=R,R=z}for(let z=0,rt=R.rings.length;z<rt;z++){let j=R.rings[z],D=R.windings[z],tt=C.rings.indexOf(j);tt===-1?(C.rings.push(j),C.windings.push(D)):C.windings[tt]+=D}R.rings=null,R.windings=null,R.consumedBy=C,R.leftSE.consumedBy=C.leftSE,R.rightSE.consumedBy=C.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let w=this.prev.consumedBy||this.prev;this._beforeState=w.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let w=this.beforeState();this._afterState={rings:w.rings.slice(0),windings:w.windings.slice(0),multiPolys:[]};let C=this._afterState.rings,R=this._afterState.windings,H=this._afterState.multiPolys;for(let j=0,D=this.rings.length;j<D;j++){let tt=this.rings[j],Z=this.windings[j],et=C.indexOf(tt);et===-1?(C.push(tt),R.push(Z)):R[et]+=Z}let z=[],rt=[];for(let j=0,D=C.length;j<D;j++){if(R[j]===0)continue;let tt=C[j],Z=tt.poly;if(rt.indexOf(Z)===-1)if(tt.isExterior)z.push(Z);else{rt.indexOf(Z)===-1&&rt.push(Z);let et=z.indexOf(tt.poly);et!==-1&&z.splice(et,1)}}for(let j=0,D=z.length;j<D;j++){let tt=z[j].multiPoly;H.indexOf(tt)===-1&&H.push(tt)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let w=this.beforeState().multiPolys,C=this.afterState().multiPolys;switch(J.type){case"union":{let R=w.length===0,H=C.length===0;this._isInResult=R!==H;break}case"intersection":{let R,H;w.length<C.length?(R=w.length,H=C.length):(R=C.length,H=w.length),this._isInResult=H===J.numMultiPolys&&R<H;break}case"xor":{let R=Math.abs(w.length-C.length);this._isInResult=R%2===1;break}case"difference":{let R=H=>H.length===1&&H[0].isSubject;this._isInResult=R(w)!==R(C);break}default:throw new Error(`Unrecognized operation type found ${J.type}`)}return this._isInResult}}class Jt{constructor(w,C,R){if(!Array.isArray(w)||w.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=C,this.isExterior=R,this.segments=[],typeof w[0][0]!="number"||typeof w[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let H=G.round(w[0][0],w[0][1]);this.bbox={ll:{x:H.x,y:H.y},ur:{x:H.x,y:H.y}};let z=H;for(let rt=1,j=w.length;rt<j;rt++){if(typeof w[rt][0]!="number"||typeof w[rt][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let D=G.round(w[rt][0],w[rt][1]);D.x===z.x&&D.y===z.y||(this.segments.push(Bt.fromRing(z,D,this)),D.x<this.bbox.ll.x&&(this.bbox.ll.x=D.x),D.y<this.bbox.ll.y&&(this.bbox.ll.y=D.y),D.x>this.bbox.ur.x&&(this.bbox.ur.x=D.x),D.y>this.bbox.ur.y&&(this.bbox.ur.y=D.y),z=D)}(H.x!==z.x||H.y!==z.y)&&this.segments.push(Bt.fromRing(z,H,this))}getSweepEvents(){let w=[];for(let C=0,R=this.segments.length;C<R;C++){let H=this.segments[C];w.push(H.leftSE),w.push(H.rightSE)}return w}}class Yt{constructor(w,C){if(!Array.isArray(w))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Jt(w[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let R=1,H=w.length;R<H;R++){let z=new Jt(w[R],this,!1);z.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=z.bbox.ll.x),z.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=z.bbox.ll.y),z.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=z.bbox.ur.x),z.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=z.bbox.ur.y),this.interiorRings.push(z)}this.multiPoly=C}getSweepEvents(){let w=this.exteriorRing.getSweepEvents();for(let C=0,R=this.interiorRings.length;C<R;C++){let H=this.interiorRings[C].getSweepEvents();for(let z=0,rt=H.length;z<rt;z++)w.push(H[z])}return w}}class pe{constructor(w,C){if(!Array.isArray(w))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof w[0][0][0]=="number"&&(w=[w])}catch(R){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let R=0,H=w.length;R<H;R++){let z=new Yt(w[R],this);z.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=z.bbox.ll.x),z.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=z.bbox.ll.y),z.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=z.bbox.ur.x),z.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=z.bbox.ur.y),this.polys.push(z)}this.isSubject=C}getSweepEvents(){let w=[];for(let C=0,R=this.polys.length;C<R;C++){let H=this.polys[C].getSweepEvents();for(let z=0,rt=H.length;z<rt;z++)w.push(H[z])}return w}}class le{static factory(w){let C=[];for(let R=0,H=w.length;R<H;R++){let z=w[R];if(!z.isInResult()||z.ringOut)continue;let rt=null,j=z.leftSE,D=z.rightSE,tt=[j],Z=j.point,et=[];for(;rt=j,j=D,tt.push(j),j.point!==Z;)for(;;){let ot=j.getAvailableLinkedEvents();if(ot.length===0){let At=tt[0].point,ne=tt[tt.length-1].point;throw new Error(`Unable to complete output ring starting at [${At.x}, ${At.y}]. Last matching segment found ends at [${ne.x}, ${ne.y}].`)}if(ot.length===1){D=ot[0].otherSE;break}let Q=null;for(let At=0,ne=et.length;At<ne;At++)if(et[At].point===j.point){Q=At;break}if(Q!==null){let At=et.splice(Q)[0],ne=tt.splice(At.index);ne.unshift(ne[0].otherSE),C.push(new le(ne.reverse()));continue}et.push({index:tt.length,point:j.point});let St=j.getLeftmostComparator(rt);D=ot.sort(St)[0].otherSE;break}C.push(new le(tt))}return C}constructor(w){this.events=w;for(let C=0,R=w.length;C<R;C++)w[C].segment.ringOut=this;this.poly=null}getGeom(){let w=this.events[0].point,C=[w];for(let tt=1,Z=this.events.length-1;tt<Z;tt++){let et=this.events[tt].point,ot=this.events[tt+1].point;Lt(et,w,ot)!==0&&(C.push(et),w=et)}if(C.length===1)return null;let R=C[0],H=C[1];Lt(R,w,H)===0&&C.shift(),C.push(C[0]);let z=this.isExteriorRing()?1:-1,rt=this.isExteriorRing()?0:C.length-1,j=this.isExteriorRing()?C.length:-1,D=[];for(let tt=rt;tt!=j;tt+=z)D.push([C[tt].x,C[tt].y]);return D}isExteriorRing(){if(this._isExteriorRing===void 0){let w=this.enclosingRing();this._isExteriorRing=w?!w.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let w=this.events[0];for(let H=1,z=this.events.length;H<z;H++){let rt=this.events[H];it.compare(w,rt)>0&&(w=rt)}let C=w.segment.prevInResult(),R=C?C.prevInResult():null;for(;;){if(!C)return null;if(!R)return C.ringOut;if(R.ringOut!==C.ringOut)return R.ringOut.enclosingRing()!==C.ringOut?C.ringOut:C.ringOut.enclosingRing();C=R.prevInResult(),R=C?C.prevInResult():null}}}class Pt{constructor(w){this.exteriorRing=w,w.poly=this,this.interiorRings=[]}addInterior(w){this.interiorRings.push(w),w.poly=this}getGeom(){let w=[this.exteriorRing.getGeom()];if(w[0]===null)return null;for(let C=0,R=this.interiorRings.length;C<R;C++){let H=this.interiorRings[C].getGeom();H!==null&&w.push(H)}return w}}class te{constructor(w){this.rings=w,this.polys=this._composePolys(w)}getGeom(){let w=[];for(let C=0,R=this.polys.length;C<R;C++){let H=this.polys[C].getGeom();H!==null&&w.push(H)}return w}_composePolys(w){let C=[];for(let R=0,H=w.length;R<H;R++){let z=w[R];if(!z.poly)if(z.isExteriorRing())C.push(new Pt(z));else{let rt=z.enclosingRing();rt.poly||C.push(new Pt(rt)),rt.poly.addInterior(z)}}return C}}class yn{constructor(w){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Bt.compare;this.queue=w,this.tree=new p(C),this.segments=[]}process(w){let C=w.segment,R=[];if(w.consumedBy)return w.isLeft?this.queue.remove(w.otherSE):this.tree.remove(C),R;let H=w.isLeft?this.tree.add(C):this.tree.find(C);if(!H)throw new Error(`Unable to find segment #${C.id} [${C.leftSE.point.x}, ${C.leftSE.point.y}] -> [${C.rightSE.point.x}, ${C.rightSE.point.y}] in SweepLine tree.`);let z=H,rt=H,j,D;for(;j===void 0;)z=this.tree.prev(z),z===null?j=null:z.key.consumedBy===void 0&&(j=z.key);for(;D===void 0;)rt=this.tree.next(rt),rt===null?D=null:rt.key.consumedBy===void 0&&(D=rt.key);if(w.isLeft){let tt=null;if(j){let et=j.getIntersection(C);if(et!==null&&(C.isAnEndpoint(et)||(tt=et),!j.isAnEndpoint(et))){let ot=this._splitSafely(j,et);for(let Q=0,St=ot.length;Q<St;Q++)R.push(ot[Q])}}let Z=null;if(D){let et=D.getIntersection(C);if(et!==null&&(C.isAnEndpoint(et)||(Z=et),!D.isAnEndpoint(et))){let ot=this._splitSafely(D,et);for(let Q=0,St=ot.length;Q<St;Q++)R.push(ot[Q])}}if(tt!==null||Z!==null){let et=null;tt===null?et=Z:Z===null?et=tt:et=it.comparePoints(tt,Z)<=0?tt:Z,this.queue.remove(C.rightSE),R.push(C.rightSE);let ot=C.split(et);for(let Q=0,St=ot.length;Q<St;Q++)R.push(ot[Q])}R.length>0?(this.tree.remove(C),R.push(w)):(this.segments.push(C),C.prev=j)}else{if(j&&D){let tt=j.getIntersection(D);if(tt!==null){if(!j.isAnEndpoint(tt)){let Z=this._splitSafely(j,tt);for(let et=0,ot=Z.length;et<ot;et++)R.push(Z[et])}if(!D.isAnEndpoint(tt)){let Z=this._splitSafely(D,tt);for(let et=0,ot=Z.length;et<ot;et++)R.push(Z[et])}}}this.tree.remove(C)}return R}_splitSafely(w,C){this.tree.remove(w);let R=w.rightSE;this.queue.remove(R);let H=w.split(C);return H.push(R),w.consumedBy===void 0&&this.tree.add(w),H}}let pn=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,X=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class F{run(w,C,R){J.type=w,G.reset();let H=[new pe(C,!0)];for(let et=0,ot=R.length;et<ot;et++)H.push(new pe(R[et],!1));if(J.numMultiPolys=H.length,J.type==="difference"){let et=H[0],ot=1;for(;ot<H.length;)x(H[ot].bbox,et.bbox)!==null?ot++:H.splice(ot,1)}if(J.type==="intersection")for(let et=0,ot=H.length;et<ot;et++){let Q=H[et];for(let St=et+1,At=H.length;St<At;St++)if(x(Q.bbox,H[St].bbox)===null)return[]}let z=new p(it.compare);for(let et=0,ot=H.length;et<ot;et++){let Q=H[et].getSweepEvents();for(let St=0,At=Q.length;St<At;St++)if(z.insert(Q[St]),z.size>pn)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let rt=new yn(z),j=z.size,D=z.pop();for(;D;){let et=D.key;if(z.size===j){let Q=et.segment;throw new Error(`Unable to pop() ${et.isLeft?"left":"right"} SweepEvent [${et.point.x}, ${et.point.y}] from segment #${Q.id} [${Q.leftSE.point.x}, ${Q.leftSE.point.y}] -> [${Q.rightSE.point.x}, ${Q.rightSE.point.y}] from queue.`)}if(z.size>pn)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(rt.segments.length>X)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let ot=rt.process(et);for(let Q=0,St=ot.length;Q<St;Q++){let At=ot[Q];At.consumedBy===void 0&&z.insert(At)}j=z.size,D=z.pop()}G.reset();let tt=le.factory(rt.segments);return new te(tt).getGeom()}}let J=new F;var Dt={union:function(Y){for(var w=arguments.length,C=new Array(w>1?w-1:0),R=1;R<w;R++)C[R-1]=arguments[R];return J.run("union",Y,C)},intersection:function(Y){for(var w=arguments.length,C=new Array(w>1?w-1:0),R=1;R<w;R++)C[R-1]=arguments[R];return J.run("intersection",Y,C)},xor:function(Y){for(var w=arguments.length,C=new Array(w>1?w-1:0),R=1;R<w;R++)C[R-1]=arguments[R];return J.run("xor",Y,C)},difference:function(Y){for(var w=arguments.length,C=new Array(w>1?w-1:0),R=1;R<w;R++)C[R-1]=arguments[R];return J.run("difference",Y,C)}};return Dt})});var u1=Ht((ah,a1)=>{(function(r,t){typeof ah=="object"&&typeof a1!="undefined"?t(ah):typeof define=="function"&&define.amd?define(["exports"],t):t(r.jsts={})})(ah,function(r){"use strict";function t(){}function e(n){this.message=n||""}function o(n){this.message=n||""}function a(n){this.message=n||""}function l(){}function h(n){return n===null?mn:n.color}function f(n){return n===null?null:n.parent}function p(n,i){n!==null&&(n.color=i)}function d(n){return n===null?null:n.left}function g(n){return n===null?null:n.right}function _(){this.root_=null,this.size_=0}function y(){}function M(){this.array_=[],arguments[0]instanceof j&&this.addAll(arguments[0])}function b(){}function T(n){this.message=n||""}function x(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(n){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),s=Math.max(Math.min(i.length,9007199254740991),0)||0,u=1 in arguments&&parseInt(Number(arguments[1]),10)||0;u=u<0?Math.max(s+u,0):Math.min(u,s);var c=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:s;for(c=c<0?Math.max(s+arguments[2],0):Math.min(c,s);u<c;)i[u]=n,++u;return i},writable:!0}),Number.isFinite=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},Number.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(n){return n!=n},Math.trunc=Math.trunc||function(n){return n<0?Math.ceil(n):Math.floor(n)};var v=function(){};v.prototype.interfaces_=function(){return[]},v.prototype.getClass=function(){return v},v.prototype.equalsWithTolerance=function(n,i,s){return Math.abs(n-i)<=s};var P=function(n){function i(s){n.call(this,s),this.name="IllegalArgumentException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),S=function(){},L={MAX_VALUE:{configurable:!0}};S.isNaN=function(n){return Number.isNaN(n)},S.doubleToLongBits=function(n){return n},S.longBitsToDouble=function(n){return n},S.isInfinite=function(n){return!Number.isFinite(n)},L.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(S,L);var N=function(){},G=function(){},B=function(){},I=function n(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=n.NULL_ORDINATE;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.z=i.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=n.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},O={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};I.prototype.setOrdinate=function(n,i){switch(n){case I.X:this.x=i;break;case I.Y:this.y=i;break;case I.Z:this.z=i;break;default:throw new P("Invalid ordinate index: "+n)}},I.prototype.equals2D=function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var i=arguments[0],s=arguments[1];return!!v.equalsWithTolerance(this.x,i.x,s)&&!!v.equalsWithTolerance(this.y,i.y,s)}},I.prototype.getOrdinate=function(n){switch(n){case I.X:return this.x;case I.Y:return this.y;case I.Z:return this.z}throw new P("Invalid ordinate index: "+n)},I.prototype.equals3D=function(n){return this.x===n.x&&this.y===n.y&&(this.z===n.z||S.isNaN(this.z))&&S.isNaN(n.z)},I.prototype.equals=function(n){return n instanceof I&&this.equals2D(n)},I.prototype.equalInZ=function(n,i){return v.equalsWithTolerance(this.z,n.z,i)},I.prototype.compareTo=function(n){var i=n;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0},I.prototype.clone=function(){},I.prototype.copy=function(){return new I(this)},I.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},I.prototype.distance3D=function(n){var i=this.x-n.x,s=this.y-n.y,u=this.z-n.z;return Math.sqrt(i*i+s*s+u*u)},I.prototype.distance=function(n){var i=this.x-n.x,s=this.y-n.y;return Math.sqrt(i*i+s*s)},I.prototype.hashCode=function(){var n=17;return n=37*n+I.hashCode(this.x),n=37*n+I.hashCode(this.y)},I.prototype.setCoordinate=function(n){this.x=n.x,this.y=n.y,this.z=n.z},I.prototype.interfaces_=function(){return[N,G,t]},I.prototype.getClass=function(){return I},I.hashCode=function(){if(arguments.length===1){var n=arguments[0],i=S.doubleToLongBits(n);return Math.trunc((i^i)>>>32)}},O.DimensionalComparator.get=function(){return q},O.serialVersionUID.get=function(){return 6683108902428367e3},O.NULL_ORDINATE.get=function(){return S.NaN},O.X.get=function(){return 0},O.Y.get=function(){return 1},O.Z.get=function(){return 2},Object.defineProperties(I,O);var q=function(n){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var i=arguments[0];if(i!==2&&i!==3)throw new P("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};q.prototype.compare=function(n,i){var s=n,u=i,c=q.compare(s.x,u.x);if(c!==0)return c;var m=q.compare(s.y,u.y);return m!==0?m:this._dimensionsToTest<=2?0:q.compare(s.z,u.z)},q.prototype.interfaces_=function(){return[B]},q.prototype.getClass=function(){return q},q.compare=function(n,i){return n<i?-1:n>i?1:S.isNaN(n)?S.isNaN(i)?0:-1:S.isNaN(i)?1:0};var st=function(){};st.prototype.create=function(){},st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st};var V=function(){},Mt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};V.prototype.interfaces_=function(){return[]},V.prototype.getClass=function(){return V},V.toLocationSymbol=function(n){switch(n){case V.EXTERIOR:return"e";case V.BOUNDARY:return"b";case V.INTERIOR:return"i";case V.NONE:return"-"}throw new P("Unknown location value: "+n)},Mt.INTERIOR.get=function(){return 0},Mt.BOUNDARY.get=function(){return 1},Mt.EXTERIOR.get=function(){return 2},Mt.NONE.get=function(){return-1},Object.defineProperties(V,Mt);var $=function(n,i){return n.interfaces_&&n.interfaces_().indexOf(i)>-1},ut=function(){},xt={LOG_10:{configurable:!0}};ut.prototype.interfaces_=function(){return[]},ut.prototype.getClass=function(){return ut},ut.log10=function(n){var i=Math.log(n);return S.isInfinite(i)||S.isNaN(i)?i:i/ut.LOG_10},ut.min=function(n,i,s,u){var c=n;return i<c&&(c=i),s<c&&(c=s),u<c&&(c=u),c},ut.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1],s=arguments[2];return n<i?i:n>s?s:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var u=arguments[0],c=arguments[1],m=arguments[2];return u<c?c:u>m?m:u}},ut.wrap=function(n,i){return n<0?i- -n%i:n%i},ut.max=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2],u=n;return i>u&&(u=i),s>u&&(u=s),u}if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3],U=c;return m>U&&(U=m),E>U&&(U=E),A>U&&(U=A),U}},ut.average=function(n,i){return(n+i)/2},xt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(ut,xt);var mt=function(n){this.str=n};mt.prototype.append=function(n){this.str+=n},mt.prototype.setCharAt=function(n,i){this.str=this.str.substr(0,n)+i+this.str.substr(n+1)},mt.prototype.toString=function(n){return this.str};var lt=function(n){this.value=n};lt.prototype.intValue=function(){return this.value},lt.prototype.compareTo=function(n){return this.value<n?-1:this.value>n?1:0},lt.isNaN=function(n){return Number.isNaN(n)};var ht=function(){};ht.isWhitespace=function(n){return n<=32&&n>=0||n===127},ht.toUpperCase=function(n){return n.toUpperCase()};var k=function n(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var i=arguments[0];this.init(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}else if(typeof arguments[0]=="string"){var u=arguments[0];n.call(this,n.parse(u))}}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.init(c,m)}},nt={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};k.prototype.le=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<=n._lo},k.prototype.extractSignificantDigits=function(n,i){var s=this.abs(),u=k.magnitude(s._hi),c=k.TEN.pow(u);(s=s.divide(c)).gt(k.TEN)?(s=s.divide(k.TEN),u+=1):s.lt(k.ONE)&&(s=s.multiply(k.TEN),u-=1);for(var m=u+1,E=new mt,A=k.MAX_PRINT_DIGITS-1,U=0;U<=A;U++){n&&U===m&&E.append(".");var K=Math.trunc(s._hi);if(K<0)break;var pt=!1,dt=0;K>9?(pt=!0,dt="9"):dt="0"+K,E.append(dt),s=s.subtract(k.valueOf(K)).multiply(k.TEN),pt&&s.selfAdd(k.TEN);var Rt=!0,Ot=k.magnitude(s._hi);if(Ot<0&&Math.abs(Ot)>=A-U&&(Rt=!1),!Rt)break}return i[0]=u,E.toString()},k.prototype.sqr=function(){return this.multiply(this)},k.prototype.doubleValue=function(){return this._hi+this._lo},k.prototype.subtract=function(){if(arguments[0]instanceof k){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},k.prototype.equals=function(){if(arguments.length===1){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}},k.prototype.isZero=function(){return this._hi===0&&this._lo===0},k.prototype.selfSubtract=function(){if(arguments[0]instanceof k){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n._hi,-n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}},k.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},k.prototype.min=function(n){return this.le(n)?this:n},k.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof k){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,A=null,U=null,K=null,pt=null,dt=null;return U=this._hi/s,K=k.SPLIT*U,c=K-U,dt=k.SPLIT*s,c=K-c,m=U-c,E=dt-s,pt=U*s,E=dt-E,A=s-E,dt=c*E-pt+c*A+m*E+m*A,K=(this._hi-pt-dt+this._lo-U*u)/s,dt=U+K,this._hi=dt,this._lo=U-dt+K,this}},k.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},k.prototype.divide=function(){if(arguments[0]instanceof k){var n=arguments[0],i=null,s=null,u=null,c=null,m=null,E=null,A=null,U=null;return s=(m=this._hi/n._hi)-(i=(E=k.SPLIT*m)-(i=E-m)),U=i*(u=(U=k.SPLIT*n._hi)-(u=U-n._hi))-(A=m*n._hi)+i*(c=n._hi-u)+s*u+s*c,E=(this._hi-A-U+this._lo-m*n._lo)/n._hi,new k(U=m+E,m-U+E)}if(typeof arguments[0]=="number"){var K=arguments[0];return S.isNaN(K)?k.createNaN():k.copy(this).selfDivide(K,0)}},k.prototype.ge=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>=n._lo},k.prototype.pow=function(n){if(n===0)return k.valueOf(1);var i=new k(this),s=k.valueOf(1),u=Math.abs(n);if(u>1)for(;u>0;)u%2==1&&s.selfMultiply(i),(u/=2)>0&&(i=i.sqr());else s=i;return n<0?s.reciprocal():s},k.prototype.ceil=function(){if(this.isNaN())return k.NaN;var n=Math.ceil(this._hi),i=0;return n===this._hi&&(i=Math.ceil(this._lo)),new k(n,i)},k.prototype.compareTo=function(n){var i=n;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0},k.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},k.prototype.setValue=function(){if(arguments[0]instanceof k){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},k.prototype.max=function(n){return this.ge(n)?this:n},k.prototype.sqrt=function(){if(this.isZero())return k.valueOf(0);if(this.isNegative())return k.NaN;var n=1/Math.sqrt(this._hi),i=this._hi*n,s=k.valueOf(i),u=this.subtract(s.sqr())._hi*(.5*n);return s.add(u)},k.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof k){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],s=null,u=null,c=null,m=null,E=null,A=null;return c=this._hi+i,E=c-this._hi,m=c-E,m=i-E+(this._hi-m),A=m+this._lo,s=c+A,u=A+(c-s),this._hi=s+u,this._lo=u+(s-this._hi),this}}else if(arguments.length===2){var U=arguments[0],K=arguments[1],pt=null,dt=null,Rt=null,Ot=null,Vt=null,jt=null,sn=null;Ot=this._hi+U,dt=this._lo+K,Vt=Ot-(jt=Ot-this._hi),Rt=dt-(sn=dt-this._lo);var kn=(pt=Ot+(jt=(Vt=U-jt+(this._hi-Vt))+dt))+(jt=(Rt=K-sn+(this._lo-Rt))+(jt+(Ot-pt))),Mr=jt+(pt-kn);return this._hi=kn,this._lo=Mr,this}},k.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof k){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,A=null,U=null,K=null;c=(U=k.SPLIT*this._hi)-this._hi,K=k.SPLIT*s,c=U-c,m=this._hi-c,E=K-s;var pt=(U=this._hi*s)+(K=c*(E=K-E)-U+c*(A=s-E)+m*E+m*A+(this._hi*u+this._lo*s)),dt=K+(c=U-pt);return this._hi=pt,this._lo=dt,this}},k.prototype.selfSqr=function(){return this.selfMultiply(this)},k.prototype.floor=function(){if(this.isNaN())return k.NaN;var n=Math.floor(this._hi),i=0;return n===this._hi&&(i=Math.floor(this._lo)),new k(n,i)},k.prototype.negate=function(){return this.isNaN()?this:new k(-this._hi,-this._lo)},k.prototype.clone=function(){},k.prototype.multiply=function(){if(arguments[0]instanceof k){var n=arguments[0];return n.isNaN()?k.createNaN():k.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return S.isNaN(i)?k.createNaN():k.copy(this).selfMultiply(i,0)}},k.prototype.isNaN=function(){return S.isNaN(this._hi)},k.prototype.intValue=function(){return Math.trunc(this._hi)},k.prototype.toString=function(){var n=k.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()},k.prototype.toStandardNotation=function(){var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!0,i),u=i[0]+1,c=s;if(s.charAt(0)===".")c="0"+s;else if(u<0)c="0."+k.stringOfChar("0",-u)+s;else if(s.indexOf(".")===-1){var m=u-s.length;c=s+k.stringOfChar("0",m)+".0"}return this.isNegative()?"-"+c:c},k.prototype.reciprocal=function(){var n=null,i=null,s=null,u=null,c=null,m=null,E=null,A=null;i=(c=1/this._hi)-(n=(m=k.SPLIT*c)-(n=m-c)),s=(A=k.SPLIT*this._hi)-this._hi;var U=c+(m=(1-(E=c*this._hi)-(A=n*(s=A-s)-E+n*(u=this._hi-s)+i*s+i*u)-c*this._lo)/this._hi);return new k(U,c-U+m)},k.prototype.toSciNotation=function(){if(this.isZero())return k.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!1,i),u=k.SCI_NOT_EXPONENT_CHAR+i[0];if(s.charAt(0)==="0")throw new Error("Found leading zero: "+s);var c="";s.length>1&&(c=s.substring(1));var m=s.charAt(0)+"."+c;return this.isNegative()?"-"+m+u:m+u},k.prototype.abs=function(){return this.isNaN()?k.NaN:this.isNegative()?this.negate():new k(this)},k.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},k.prototype.lt=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<n._lo},k.prototype.add=function(){if(arguments[0]instanceof k){var n=arguments[0];return k.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return k.copy(this).selfAdd(i)}},k.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this._hi=n,this._lo=0}else if(arguments[0]instanceof k){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._hi=s,this._lo=u}},k.prototype.gt=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>n._lo},k.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},k.prototype.trunc=function(){return this.isNaN()?k.NaN:this.isPositive()?this.floor():this.ceil()},k.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},k.prototype.interfaces_=function(){return[t,N,G]},k.prototype.getClass=function(){return k},k.sqr=function(n){return k.valueOf(n).selfMultiply(n)},k.valueOf=function(){if(typeof arguments[0]=="string"){var n=arguments[0];return k.parse(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return new k(i)}},k.sqrt=function(n){return k.valueOf(n).sqrt()},k.parse=function(n){for(var i=0,s=n.length;ht.isWhitespace(n.charAt(i));)i++;var u=!1;if(i<s){var c=n.charAt(i);c!=="-"&&c!=="+"||(i++,c==="-"&&(u=!0))}for(var m=new k,E=0,A=0,U=0;!(i>=s);){var K=n.charAt(i);if(i++,ht.isDigit(K)){var pt=K-"0";m.selfMultiply(k.TEN),m.selfAdd(pt),E++}else{if(K!=="."){if(K==="e"||K==="E"){var dt=n.substring(i);try{U=lt.parseInt(dt)}catch(sn){throw sn instanceof Error?new Error("Invalid exponent "+dt+" in string "+n):sn}break}throw new Error("Unexpected character \'"+K+"\' at position "+i+" in string "+n)}A=E}}var Rt=m,Ot=E-A-U;if(Ot===0)Rt=m;else if(Ot>0){var Vt=k.TEN.pow(Ot);Rt=m.divide(Vt)}else if(Ot<0){var jt=k.TEN.pow(-Ot);Rt=m.multiply(jt)}return u?Rt.negate():Rt},k.createNaN=function(){return new k(S.NaN,S.NaN)},k.copy=function(n){return new k(n)},k.magnitude=function(n){var i=Math.abs(n),s=Math.log(i)/Math.log(10),u=Math.trunc(Math.floor(s));return 10*Math.pow(10,u)<=i&&(u+=1),u},k.stringOfChar=function(n,i){for(var s=new mt,u=0;u<i;u++)s.append(n);return s.toString()},nt.PI.get=function(){return new k(3.141592653589793,12246467991473532e-32)},nt.TWO_PI.get=function(){return new k(6.283185307179586,24492935982947064e-32)},nt.PI_2.get=function(){return new k(1.5707963267948966,6123233995736766e-32)},nt.E.get=function(){return new k(2.718281828459045,14456468917292502e-32)},nt.NaN.get=function(){return new k(S.NaN,S.NaN)},nt.EPS.get=function(){return 123259516440783e-46},nt.SPLIT.get=function(){return 134217729},nt.MAX_PRINT_DIGITS.get=function(){return 32},nt.TEN.get=function(){return k.valueOf(10)},nt.ONE.get=function(){return k.valueOf(1)},nt.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},nt.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(k,nt);var ft=function(){},Tt={DP_SAFE_EPSILON:{configurable:!0}};ft.prototype.interfaces_=function(){return[]},ft.prototype.getClass=function(){return ft},ft.orientationIndex=function(n,i,s){var u=ft.orientationIndexFilter(n,i,s);if(u<=1)return u;var c=k.valueOf(i.x).selfAdd(-n.x),m=k.valueOf(i.y).selfAdd(-n.y),E=k.valueOf(s.x).selfAdd(-i.x),A=k.valueOf(s.y).selfAdd(-i.y);return c.selfMultiply(A).selfSubtract(m.selfMultiply(E)).signum()},ft.signOfDet2x2=function(n,i,s,u){return n.multiply(u).selfSubtract(i.multiply(s)).signum()},ft.intersection=function(n,i,s,u){var c=k.valueOf(u.y).selfSubtract(s.y).selfMultiply(k.valueOf(i.x).selfSubtract(n.x)),m=k.valueOf(u.x).selfSubtract(s.x).selfMultiply(k.valueOf(i.y).selfSubtract(n.y)),E=c.subtract(m),A=k.valueOf(u.x).selfSubtract(s.x).selfMultiply(k.valueOf(n.y).selfSubtract(s.y)),U=k.valueOf(u.y).selfSubtract(s.y).selfMultiply(k.valueOf(n.x).selfSubtract(s.x)),K=A.subtract(U).selfDivide(E).doubleValue(),pt=k.valueOf(n.x).selfAdd(k.valueOf(i.x).selfSubtract(n.x).selfMultiply(K)).doubleValue(),dt=k.valueOf(i.x).selfSubtract(n.x).selfMultiply(k.valueOf(n.y).selfSubtract(s.y)),Rt=k.valueOf(i.y).selfSubtract(n.y).selfMultiply(k.valueOf(n.x).selfSubtract(s.x)),Ot=dt.subtract(Rt).selfDivide(E).doubleValue(),Vt=k.valueOf(s.y).selfAdd(k.valueOf(u.y).selfSubtract(s.y).selfMultiply(Ot)).doubleValue();return new I(pt,Vt)},ft.orientationIndexFilter=function(n,i,s){var u=null,c=(n.x-s.x)*(i.y-s.y),m=(n.y-s.y)*(i.x-s.x),E=c-m;if(c>0){if(m<=0)return ft.signum(E);u=c+m}else{if(!(c<0)||m>=0)return ft.signum(E);u=-c-m}var A=ft.DP_SAFE_EPSILON*u;return E>=A||-E>=A?ft.signum(E):2},ft.signum=function(n){return n>0?1:n<0?-1:0},Tt.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(ft,Tt);var gt=function(){},Lt={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Lt.X.get=function(){return 0},Lt.Y.get=function(){return 1},Lt.Z.get=function(){return 2},Lt.M.get=function(){return 3},gt.prototype.setOrdinate=function(n,i,s){},gt.prototype.size=function(){},gt.prototype.getOrdinate=function(n,i){},gt.prototype.getCoordinate=function(){},gt.prototype.getCoordinateCopy=function(n){},gt.prototype.getDimension=function(){},gt.prototype.getX=function(n){},gt.prototype.clone=function(){},gt.prototype.expandEnvelope=function(n){},gt.prototype.copy=function(){},gt.prototype.getY=function(n){},gt.prototype.toCoordinateArray=function(){},gt.prototype.interfaces_=function(){return[G]},gt.prototype.getClass=function(){return gt},Object.defineProperties(gt,Lt);var qt=function(){},Xt=function(n){function i(){n.call(this,"Projective point not representable on the Cartesian plane.")}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(qt),Ft=function(){};Ft.arraycopy=function(n,i,s,u,c){for(var m=0,E=i;E<i+c;E++)s[u+m]=n[E],m++},Ft.getProperty=function(n){return{"line.separator":`\n`}[n]};var Qt=function n(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1];this.x=s,this.y=u,this.w=1}else if(arguments[0]instanceof n&&arguments[1]instanceof n){var c=arguments[0],m=arguments[1];this.x=c.y*m.w-m.y*c.w,this.y=m.x*c.w-c.x*m.w,this.w=c.x*m.y-m.x*c.y}else if(arguments[0]instanceof I&&arguments[1]instanceof I){var E=arguments[0],A=arguments[1];this.x=E.y-A.y,this.y=A.x-E.x,this.w=E.x*A.y-A.x*E.y}}else if(arguments.length===3){var U=arguments[0],K=arguments[1],pt=arguments[2];this.x=U,this.y=K,this.w=pt}else if(arguments.length===4){var dt=arguments[0],Rt=arguments[1],Ot=arguments[2],Vt=arguments[3],jt=dt.y-Rt.y,sn=Rt.x-dt.x,kn=dt.x*Rt.y-Rt.x*dt.y,Mr=Ot.y-Vt.y,Ki=Vt.x-Ot.x,Uo=Ot.x*Vt.y-Vt.x*Ot.y;this.x=sn*Uo-Ki*kn,this.y=Mr*kn-jt*Uo,this.w=jt*Ki-Mr*sn}};Qt.prototype.getY=function(){var n=this.y/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new Xt;return n},Qt.prototype.getX=function(){var n=this.x/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new Xt;return n},Qt.prototype.getCoordinate=function(){var n=new I;return n.x=this.getX(),n.y=this.getY(),n},Qt.prototype.interfaces_=function(){return[]},Qt.prototype.getClass=function(){return Qt},Qt.intersection=function(n,i,s,u){var c=n.y-i.y,m=i.x-n.x,E=n.x*i.y-i.x*n.y,A=s.y-u.y,U=u.x-s.x,K=s.x*u.y-u.x*s.y,pt=c*U-A*m,dt=(m*K-U*E)/pt,Rt=(A*E-c*K)/pt;if(S.isNaN(dt)||S.isInfinite(dt)||S.isNaN(Rt)||S.isInfinite(Rt))throw new Xt;return new I(dt,Rt)};var Ct=function n(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof I){var i=arguments[0];this.init(i.x,i.x,i.y,i.y)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.init(u.x,c.x,u.y,c.y)}else if(arguments.length===4){var m=arguments[0],E=arguments[1],A=arguments[2],U=arguments[3];this.init(m,E,A,U)}},ee={serialVersionUID:{configurable:!0}};Ct.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Ct.prototype.equals=function(n){if(!(n instanceof Ct))return!1;var i=n;return this.isNull()?i.isNull():this._maxx===i.getMaxX()&&this._maxy===i.getMaxY()&&this._minx===i.getMinX()&&this._miny===i.getMinY()},Ct.prototype.intersection=function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new Ct;var i=this._minx>n._minx?this._minx:n._minx,s=this._miny>n._miny?this._miny:n._miny,u=this._maxx<n._maxx?this._maxx:n._maxx,c=this._maxy<n._maxy?this._maxy:n._maxy;return new Ct(i,u,s,c)},Ct.prototype.isNull=function(){return this._maxx<this._minx},Ct.prototype.getMaxX=function(){return this._maxx},Ct.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof Ct){var i=arguments[0];return!this.isNull()&&!i.isNull()&&i.getMinX()>=this._minx&&i.getMaxX()<=this._maxx&&i.getMinY()>=this._miny&&i.getMaxY()<=this._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&s>=this._minx&&s<=this._maxx&&u>=this._miny&&u<=this._maxy}},Ct.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Ct){var n=arguments[0];return!this.isNull()&&!n.isNull()&&!(n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny)}if(arguments[0]instanceof I){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&!(s>this._maxx||s<this._minx||u>this._maxy||u<this._miny)}},Ct.prototype.getMinY=function(){return this._miny},Ct.prototype.getMinX=function(){return this._minx},Ct.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof Ct){var i=arguments[0];if(i.isNull())return null;this.isNull()?(this._minx=i.getMinX(),this._maxx=i.getMaxX(),this._miny=i.getMinY(),this._maxy=i.getMaxY()):(i._minx<this._minx&&(this._minx=i._minx),i._maxx>this._maxx&&(this._maxx=i._maxx),i._miny<this._miny&&(this._miny=i._miny),i._maxy>this._maxy&&(this._maxy=i._maxy))}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.isNull()?(this._minx=s,this._maxx=s,this._miny=u,this._maxy=u):(s<this._minx&&(this._minx=s),s>this._maxx&&(this._maxx=s),u<this._miny&&(this._miny=u),u>this._maxy&&(this._maxy=u))}},Ct.prototype.minExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n<i?n:i},Ct.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Ct.prototype.compareTo=function(n){var i=n;return this.isNull()?i.isNull()?0:-1:i.isNull()?1:this._minx<i._minx?-1:this._minx>i._minx?1:this._miny<i._miny?-1:this._miny>i._miny?1:this._maxx<i._maxx?-1:this._maxx>i._maxx?1:this._maxy<i._maxy?-1:this._maxy>i._maxy?1:0},Ct.prototype.translate=function(n,i){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+i,this.getMaxY()+i)},Ct.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Ct.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Ct.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Ct.prototype.maxExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n>i?n:i},Ct.prototype.expandBy=function(){if(arguments.length===1){var n=arguments[0];this.expandBy(n,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this.isNull())return null;this._minx-=i,this._maxx+=i,this._miny-=s,this._maxy+=s,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},Ct.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Ct){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof I){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.covers(s,u)}},Ct.prototype.centre=function(){return this.isNull()?null:new I((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Ct.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof Ct){var i=arguments[0];this._minx=i._minx,this._maxx=i._maxx,this._miny=i._miny,this._maxy=i._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.init(s.x,u.x,s.y,u.y)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];c<m?(this._minx=c,this._maxx=m):(this._minx=m,this._maxx=c),E<A?(this._miny=E,this._maxy=A):(this._miny=A,this._maxy=E)}},Ct.prototype.getMaxY=function(){return this._maxy},Ct.prototype.distance=function(n){if(this.intersects(n))return 0;var i=0;this._maxx<n._minx?i=n._minx-this._maxx:this._minx>n._maxx&&(i=this._minx-n._maxx);var s=0;return this._maxy<n._miny?s=n._miny-this._maxy:this._miny>n._maxy&&(s=this._miny-n._maxy),i===0?s:s===0?i:Math.sqrt(i*i+s*s)},Ct.prototype.hashCode=function(){var n=17;return n=37*n+I.hashCode(this._minx),n=37*n+I.hashCode(this._maxx),n=37*n+I.hashCode(this._miny),n=37*n+I.hashCode(this._maxy)},Ct.prototype.interfaces_=function(){return[N,t]},Ct.prototype.getClass=function(){return Ct},Ct.intersects=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];return s.x>=(n.x<i.x?n.x:i.x)&&s.x<=(n.x>i.x?n.x:i.x)&&s.y>=(n.y<i.y?n.y:i.y)&&s.y<=(n.y>i.y?n.y:i.y)}if(arguments.length===4){var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],A=Math.min(m.x,E.x),U=Math.max(m.x,E.x),K=Math.min(u.x,c.x),pt=Math.max(u.x,c.x);return!(K>U)&&!(pt<A)&&(A=Math.min(m.y,E.y),U=Math.max(m.y,E.y),K=Math.min(u.y,c.y),pt=Math.max(u.y,c.y),!(K>U)&&!(pt<A))}},ee.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Ct,ee);var it={typeStr:/^\\s*(\\w+)\\s*\\(\\s*(.*)\\s*\\)\\s*$/,emptyTypeStr:/^\\s*(\\w+)\\s*EMPTY\\s*$/,spaces:/\\s+/,parenComma:/\\)\\s*,\\s*\\(/,doubleParenComma:/\\)\\s*\\)\\s*,\\s*\\(\\s*\\(/,trimParens:/^\\s*\\(?(.*?)\\)?\\s*$/},rn=function(n){this.geometryFactory=n||new ue};rn.prototype.read=function(n){var i,s,u;n=n.replace(/[\\n\\r]/g," ");var c=it.typeStr.exec(n);if(n.search("EMPTY")!==-1&&((c=it.emptyTypeStr.exec(n))[2]=void 0),c&&(s=c[1].toLowerCase(),u=c[2],Jt[s]&&(i=Jt[s].apply(this,[u]))),i===void 0)throw new Error("Could not parse WKT "+n);return i},rn.prototype.write=function(n){return this.extractGeometry(n)},rn.prototype.extractGeometry=function(n){var i=n.getGeometryType().toLowerCase();if(!Bt[i])return null;var s=i.toUpperCase();return n.isEmpty()?s+" EMPTY":s+"("+Bt[i].apply(this,[n])+")"};var Bt={coordinate:function(n){return n.x+" "+n.y},point:function(n){return Bt.coordinate.call(this,n._coordinates._coordinates[0])},multipoint:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Bt.point.apply(this,[n._geometries[s]])+")");return i.join(",")},linestring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(Bt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},linearring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(Bt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},multilinestring:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Bt.linestring.apply(this,[n._geometries[s]])+")");return i.join(",")},polygon:function(n){var i=[];i.push("("+Bt.linestring.apply(this,[n._shell])+")");for(var s=0,u=n._holes.length;s<u;++s)i.push("("+Bt.linestring.apply(this,[n._holes[s]])+")");return i.join(",")},multipolygon:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Bt.polygon.apply(this,[n._geometries[s]])+")");return i.join(",")},geometrycollection:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push(this.extractGeometry(n._geometries[s]));return i.join(",")}},Jt={point:function(n){if(n===void 0)return this.geometryFactory.createPoint();var i=n.trim().split(it.spaces);return this.geometryFactory.createPoint(new I(Number.parseFloat(i[0]),Number.parseFloat(i[1])))},multipoint:function(n){if(n===void 0)return this.geometryFactory.createMultiPoint();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(it.trimParens,"$1"),u.push(Jt.point.apply(this,[i]));return this.geometryFactory.createMultiPoint(u)},linestring:function(n){if(n===void 0)return this.geometryFactory.createLineString();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(it.spaces),u.push(new I(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(u)},linearring:function(n){if(n===void 0)return this.geometryFactory.createLinearRing();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(it.spaces),u.push(new I(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(u)},multilinestring:function(n){if(n===void 0)return this.geometryFactory.createMultiLineString();for(var i,s=n.trim().split(it.parenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(it.trimParens,"$1"),u.push(Jt.linestring.apply(this,[i]));return this.geometryFactory.createMultiLineString(u)},polygon:function(n){if(n===void 0)return this.geometryFactory.createPolygon();for(var i,s,u,c,m=n.trim().split(it.parenComma),E=[],A=0,U=m.length;A<U;++A)i=m[A].replace(it.trimParens,"$1"),s=Jt.linestring.apply(this,[i]),u=this.geometryFactory.createLinearRing(s._points),A===0?c=u:E.push(u);return this.geometryFactory.createPolygon(c,E)},multipolygon:function(n){if(n===void 0)return this.geometryFactory.createMultiPolygon();for(var i,s=n.trim().split(it.doubleParenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(it.trimParens,"$1"),u.push(Jt.polygon.apply(this,[i]));return this.geometryFactory.createMultiPolygon(u)},geometrycollection:function(n){if(n===void 0)return this.geometryFactory.createGeometryCollection();for(var i=(n=n.replace(/,\\s*([A-Za-z])/g,"|$1")).trim().split("|"),s=[],u=0,c=i.length;u<c;++u)s.push(this.read(i[u]));return this.geometryFactory.createGeometryCollection(s)}},Yt=function(n){this.parser=new rn(n)};Yt.prototype.write=function(n){return this.parser.write(n)},Yt.toLineString=function(n,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+n.x+" "+n.y+", "+i.x+" "+i.y+" )"};var pe=function(n){function i(s){n.call(this,s),this.name="RuntimeException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),le=function(n){function i(){if(n.call(this),arguments.length===0)n.call(this);else if(arguments.length===1){var s=arguments[0];n.call(this,s)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(pe),Pt=function(){};Pt.prototype.interfaces_=function(){return[]},Pt.prototype.getClass=function(){return Pt},Pt.shouldNeverReachHere=function(){if(arguments.length===0)Pt.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new le("Should never reach here"+(n!==null?": "+n:""))}},Pt.isTrue=function(){var n,i;if(arguments.length===1)n=arguments[0],Pt.isTrue(n,null);else if(arguments.length===2&&(n=arguments[0],i=arguments[1],!n))throw i===null?new le:new le(i)},Pt.equals=function(){var n,i,s;if(arguments.length===2)n=arguments[0],i=arguments[1],Pt.equals(n,i,null);else if(arguments.length===3&&(n=arguments[0],i=arguments[1],s=arguments[2],!i.equals(n)))throw new le("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))};var te=function(){this._result=null,this._inputLines=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new I,this._intPt[1]=new I,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},yn={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};te.prototype.getIndexAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intLineIndex[n][i]},te.prototype.getTopologySummary=function(){var n=new mt;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()},te.prototype.computeIntersection=function(n,i,s,u){this._inputLines[0][0]=n,this._inputLines[0][1]=i,this._inputLines[1][0]=s,this._inputLines[1][1]=u,this._result=this.computeIntersect(n,i,s,u)},te.prototype.getIntersectionNum=function(){return this._result},te.prototype.computeIntLineIndex=function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var n=arguments[0];this.getEdgeDistance(n,0)>this.getEdgeDistance(n,1)?(this._intLineIndex[n][0]=0,this._intLineIndex[n][1]=1):(this._intLineIndex[n][0]=1,this._intLineIndex[n][1]=0)}},te.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},te.prototype.setPrecisionModel=function(n){this._precisionModel=n},te.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var n=arguments[0],i=0;i<this._result;i++)if(!this._intPt[i].equals2D(this._inputLines[n][0])&&!this._intPt[i].equals2D(this._inputLines[n][1]))return!0;return!1}},te.prototype.getIntersection=function(n){return this._intPt[n]},te.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},te.prototype.hasIntersection=function(){return this._result!==te.NO_INTERSECTION},te.prototype.getEdgeDistance=function(n,i){return te.computeEdgeDistance(this._intPt[i],this._inputLines[n][0],this._inputLines[n][1])},te.prototype.isCollinear=function(){return this._result===te.COLLINEAR_INTERSECTION},te.prototype.toString=function(){return Yt.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Yt.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},te.prototype.getEndpoint=function(n,i){return this._inputLines[n][i]},te.prototype.isIntersection=function(n){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(n))return!0;return!1},te.prototype.getIntersectionAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][i]]},te.prototype.interfaces_=function(){return[]},te.prototype.getClass=function(){return te},te.computeEdgeDistance=function(n,i,s){var u=Math.abs(s.x-i.x),c=Math.abs(s.y-i.y),m=-1;if(n.equals(i))m=0;else if(n.equals(s))m=u>c?u:c;else{var E=Math.abs(n.x-i.x),A=Math.abs(n.y-i.y);(m=u>c?E:A)!==0||n.equals(i)||(m=Math.max(E,A))}return Pt.isTrue(!(m===0&&!n.equals(i)),"Bad distance calculation"),m},te.nonRobustComputeEdgeDistance=function(n,i,s){var u=n.x-i.x,c=n.y-i.y,m=Math.sqrt(u*u+c*c);return Pt.isTrue(!(m===0&&!n.equals(i)),"Invalid distance calculation"),m},yn.DONT_INTERSECT.get=function(){return 0},yn.DO_INTERSECT.get=function(){return 1},yn.COLLINEAR.get=function(){return 2},yn.NO_INTERSECTION.get=function(){return 0},yn.POINT_INTERSECTION.get=function(){return 1},yn.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(te,yn);var pn=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isInSegmentEnvelopes=function(s){var u=new Ct(this._inputLines[0][0],this._inputLines[0][1]),c=new Ct(this._inputLines[1][0],this._inputLines[1][1]);return u.contains(s)&&c.contains(s)},i.prototype.computeIntersection=function(){if(arguments.length!==3)return n.prototype.computeIntersection.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2];if(this._isProper=!1,Ct.intersects(u,c,s)&&J.orientationIndex(u,c,s)===0&&J.orientationIndex(c,u,s)===0)return this._isProper=!0,(s.equals(u)||s.equals(c))&&(this._isProper=!1),this._result=n.POINT_INTERSECTION,null;this._result=n.NO_INTERSECTION},i.prototype.normalizeToMinimum=function(s,u,c,m,E){E.x=this.smallestInAbsValue(s.x,u.x,c.x,m.x),E.y=this.smallestInAbsValue(s.y,u.y,c.y,m.y),s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.safeHCoordinateIntersection=function(s,u,c,m){var E=null;try{E=Qt.intersection(s,u,c,m)}catch(A){if(!(A instanceof Xt))throw A;E=i.nearestEndpoint(s,u,c,m)}return E},i.prototype.intersection=function(s,u,c,m){var E=this.intersectionWithNormalization(s,u,c,m);return this.isInSegmentEnvelopes(E)||(E=new I(i.nearestEndpoint(s,u,c,m))),this._precisionModel!==null&&this._precisionModel.makePrecise(E),E},i.prototype.smallestInAbsValue=function(s,u,c,m){var E=s,A=Math.abs(E);return Math.abs(u)<A&&(E=u,A=Math.abs(u)),Math.abs(c)<A&&(E=c,A=Math.abs(c)),Math.abs(m)<A&&(E=m),E},i.prototype.checkDD=function(s,u,c,m,E){var A=ft.intersection(s,u,c,m),U=this.isInSegmentEnvelopes(A);Ft.out.println("DD in env = "+U+" --------------------- "+A),E.distance(A)>1e-4&&Ft.out.println("Distance = "+E.distance(A))},i.prototype.intersectionWithNormalization=function(s,u,c,m){var E=new I(s),A=new I(u),U=new I(c),K=new I(m),pt=new I;this.normalizeToEnvCentre(E,A,U,K,pt);var dt=this.safeHCoordinateIntersection(E,A,U,K);return dt.x+=pt.x,dt.y+=pt.y,dt},i.prototype.computeCollinearIntersection=function(s,u,c,m){var E=Ct.intersects(s,u,c),A=Ct.intersects(s,u,m),U=Ct.intersects(c,m,s),K=Ct.intersects(c,m,u);return E&&A?(this._intPt[0]=c,this._intPt[1]=m,n.COLLINEAR_INTERSECTION):U&&K?(this._intPt[0]=s,this._intPt[1]=u,n.COLLINEAR_INTERSECTION):E&&U?(this._intPt[0]=c,this._intPt[1]=s,!c.equals(s)||A||K?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):E&&K?(this._intPt[0]=c,this._intPt[1]=u,!c.equals(u)||A||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):A&&U?(this._intPt[0]=m,this._intPt[1]=s,!m.equals(s)||E||K?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):A&&K?(this._intPt[0]=m,this._intPt[1]=u,!m.equals(u)||E||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):n.NO_INTERSECTION},i.prototype.normalizeToEnvCentre=function(s,u,c,m,E){var A=s.x<u.x?s.x:u.x,U=s.y<u.y?s.y:u.y,K=s.x>u.x?s.x:u.x,pt=s.y>u.y?s.y:u.y,dt=c.x<m.x?c.x:m.x,Rt=c.y<m.y?c.y:m.y,Ot=c.x>m.x?c.x:m.x,Vt=c.y>m.y?c.y:m.y,jt=((A>dt?A:dt)+(K<Ot?K:Ot))/2,sn=((U>Rt?U:Rt)+(pt<Vt?pt:Vt))/2;E.x=jt,E.y=sn,s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.computeIntersect=function(s,u,c,m){if(this._isProper=!1,!Ct.intersects(s,u,c,m))return n.NO_INTERSECTION;var E=J.orientationIndex(s,u,c),A=J.orientationIndex(s,u,m);if(E>0&&A>0||E<0&&A<0)return n.NO_INTERSECTION;var U=J.orientationIndex(c,m,s),K=J.orientationIndex(c,m,u);return U>0&&K>0||U<0&&K<0?n.NO_INTERSECTION:E===0&&A===0&&U===0&&K===0?this.computeCollinearIntersection(s,u,c,m):(E===0||A===0||U===0||K===0?(this._isProper=!1,s.equals2D(c)||s.equals2D(m)?this._intPt[0]=s:u.equals2D(c)||u.equals2D(m)?this._intPt[0]=u:E===0?this._intPt[0]=new I(c):A===0?this._intPt[0]=new I(m):U===0?this._intPt[0]=new I(s):K===0&&(this._intPt[0]=new I(u))):(this._isProper=!0,this._intPt[0]=this.intersection(s,u,c,m)),n.POINT_INTERSECTION)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.nearestEndpoint=function(s,u,c,m){var E=s,A=J.distancePointLine(s,c,m),U=J.distancePointLine(u,c,m);return U<A&&(A=U,E=u),(U=J.distancePointLine(c,s,u))<A&&(A=U,E=c),(U=J.distancePointLine(m,s,u))<A&&(A=U,E=m),E},i}(te),X=function(){};X.prototype.interfaces_=function(){return[]},X.prototype.getClass=function(){return X},X.orientationIndex=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=s.x-i.x,E=s.y-i.y;return X.signOfDet2x2(u,c,m,E)},X.signOfDet2x2=function(n,i,s,u){var c=null,m=null,E=null;if(c=1,n===0||u===0)return i===0||s===0?0:i>0?s>0?-c:c:s>0?c:-c;if(i===0||s===0)return u>0?n>0?c:-c:n>0?-c:c;if(i>0?u>0?i<=u||(c=-c,m=n,n=s,s=m,m=i,i=u,u=m):i<=-u?(c=-c,s=-s,u=-u):(m=n,n=-s,s=m,m=i,i=-u,u=m):u>0?-i<=u?(c=-c,n=-n,i=-i):(m=-n,n=s,s=m,m=-i,i=u,u=m):i>=u?(n=-n,i=-i,s=-s,u=-u):(c=-c,m=-n,n=-s,s=m,m=-i,i=-u,u=m),n>0){if(!(s>0)||!(n<=s))return c}else{if(s>0||!(n>=s))return-c;c=-c,n=-n,s=-s}for(;;){if(E=Math.floor(s/n),s-=E*n,(u-=E*i)<0)return-c;if(u>i)return c;if(n>s+s){if(i<u+u)return c}else{if(i>u+u)return-c;s=n-s,u=i-u,c=-c}if(u===0)return s===0?0:-c;if(s===0||(E=Math.floor(n/s),n-=E*s,(i-=E*u)<0))return c;if(i>u)return-c;if(s>n+n){if(u<i+i)return-c}else{if(u>i+i)return c;n=s-n,i=u-i,c=-c}if(i===0)return n===0?0:c;if(n===0)return-c}};var F=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n};F.prototype.countSegment=function(n,i){if(n.x<this._p.x&&i.x<this._p.x)return null;if(this._p.x===i.x&&this._p.y===i.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&i.y===this._p.y){var s=n.x,u=i.x;return s>u&&(s=i.x,u=n.x),this._p.x>=s&&this._p.x<=u&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&i.y<=this._p.y||i.y>this._p.y&&n.y<=this._p.y){var c=n.x-this._p.x,m=n.y-this._p.y,E=i.x-this._p.x,A=i.y-this._p.y,U=X.signOfDet2x2(c,m,E,A);if(U===0)return this._isPointOnSegment=!0,null;A<m&&(U=-U),U>0&&this._crossingCount++}},F.prototype.isPointInPolygon=function(){return this.getLocation()!==V.EXTERIOR},F.prototype.getLocation=function(){return this._isPointOnSegment?V.BOUNDARY:this._crossingCount%2==1?V.INTERIOR:V.EXTERIOR},F.prototype.isOnSegment=function(){return this._isPointOnSegment},F.prototype.interfaces_=function(){return[]},F.prototype.getClass=function(){return F},F.locatePointInRing=function(){if(arguments[0]instanceof I&&$(arguments[1],gt)){for(var n=arguments[0],i=arguments[1],s=new F(n),u=new I,c=new I,m=1;m<i.size();m++)if(i.getCoordinate(m,u),i.getCoordinate(m-1,c),s.countSegment(u,c),s.isOnSegment())return s.getLocation();return s.getLocation()}if(arguments[0]instanceof I&&arguments[1]instanceof Array){for(var E=arguments[0],A=arguments[1],U=new F(E),K=1;K<A.length;K++){var pt=A[K],dt=A[K-1];if(U.countSegment(pt,dt),U.isOnSegment())return U.getLocation()}return U.getLocation()}};var J=function(){},It={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};J.prototype.interfaces_=function(){return[]},J.prototype.getClass=function(){return J},J.orientationIndex=function(n,i,s){return ft.orientationIndex(n,i,s)},J.signedArea=function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var i=0,s=n[0].x,u=1;u<n.length-1;u++){var c=n[u].x-s,m=n[u+1].y;i+=c*(n[u-1].y-m)}return i/2}if($(arguments[0],gt)){var E=arguments[0],A=E.size();if(A<3)return 0;var U=new I,K=new I,pt=new I;E.getCoordinate(0,K),E.getCoordinate(1,pt);var dt=K.x;pt.x-=dt;for(var Rt=0,Ot=1;Ot<A-1;Ot++)U.y=K.y,K.x=pt.x,K.y=pt.y,E.getCoordinate(Ot+1,pt),pt.x-=dt,Rt+=K.x*(U.y-pt.y);return Rt/2}},J.distanceLineLine=function(n,i,s,u){if(n.equals(i))return J.distancePointLine(n,s,u);if(s.equals(u))return J.distancePointLine(u,n,i);var c=!1;if(Ct.intersects(n,i,s,u)){var m=(i.x-n.x)*(u.y-s.y)-(i.y-n.y)*(u.x-s.x);if(m===0)c=!0;else{var E=(n.y-s.y)*(u.x-s.x)-(n.x-s.x)*(u.y-s.y),A=((n.y-s.y)*(i.x-n.x)-(n.x-s.x)*(i.y-n.y))/m,U=E/m;(U<0||U>1||A<0||A>1)&&(c=!0)}}else c=!0;return c?ut.min(J.distancePointLine(n,s,u),J.distancePointLine(i,s,u),J.distancePointLine(s,n,i),J.distancePointLine(u,n,i)):0},J.isPointInRing=function(n,i){return J.locatePointInRing(n,i)!==V.EXTERIOR},J.computeLength=function(n){var i=n.size();if(i<=1)return 0;var s=0,u=new I;n.getCoordinate(0,u);for(var c=u.x,m=u.y,E=1;E<i;E++){n.getCoordinate(E,u);var A=u.x,U=u.y,K=A-c,pt=U-m;s+=Math.sqrt(K*K+pt*pt),c=A,m=U}return s},J.isCCW=function(n){var i=n.length-1;if(i<3)throw new P("Ring has fewer than 4 points, so orientation cannot be determined");for(var s=n[0],u=0,c=1;c<=i;c++){var m=n[c];m.y>s.y&&(s=m,u=c)}var E=u;do(E-=1)<0&&(E=i);while(n[E].equals2D(s)&&E!==u);var A=u;do A=(A+1)%i;while(n[A].equals2D(s)&&A!==u);var U=n[E],K=n[A];if(U.equals2D(s)||K.equals2D(s)||U.equals2D(K))return!1;var pt=J.computeOrientation(U,s,K),dt=!1;return dt=pt===0?U.x>K.x:pt>0,dt},J.locatePointInRing=function(n,i){return F.locatePointInRing(n,i)},J.distancePointLinePerpendicular=function(n,i,s){var u=(s.x-i.x)*(s.x-i.x)+(s.y-i.y)*(s.y-i.y),c=((i.y-n.y)*(s.x-i.x)-(i.x-n.x)*(s.y-i.y))/u;return Math.abs(c)*Math.sqrt(u)},J.computeOrientation=function(n,i,s){return J.orientationIndex(n,i,s)},J.distancePointLine=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(i.length===0)throw new P("Line array must contain at least one vertex");for(var s=n.distance(i[0]),u=0;u<i.length-1;u++){var c=J.distancePointLine(n,i[u],i[u+1]);c<s&&(s=c)}return s}if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];if(E.x===A.x&&E.y===A.y)return m.distance(E);var U=(A.x-E.x)*(A.x-E.x)+(A.y-E.y)*(A.y-E.y),K=((m.x-E.x)*(A.x-E.x)+(m.y-E.y)*(A.y-E.y))/U;if(K<=0)return m.distance(E);if(K>=1)return m.distance(A);var pt=((E.y-m.y)*(A.x-E.x)-(E.x-m.x)*(A.y-E.y))/U;return Math.abs(pt)*Math.sqrt(U)}},J.isOnLine=function(n,i){for(var s=new pn,u=1;u<i.length;u++){var c=i[u-1],m=i[u];if(s.computeIntersection(n,c,m),s.hasIntersection())return!0}return!1},It.CLOCKWISE.get=function(){return-1},It.RIGHT.get=function(){return J.CLOCKWISE},It.COUNTERCLOCKWISE.get=function(){return 1},It.LEFT.get=function(){return J.COUNTERCLOCKWISE},It.COLLINEAR.get=function(){return 0},It.STRAIGHT.get=function(){return J.COLLINEAR},Object.defineProperties(J,It);var wt=function(){};wt.prototype.filter=function(n){},wt.prototype.interfaces_=function(){return[]},wt.prototype.getClass=function(){return wt};var yt=function(){var n=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=n,this._SRID=n.getSRID()},$t={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};yt.prototype.isGeometryCollection=function(){return this.getSortIndex()===yt.SORTINDEX_GEOMETRYCOLLECTION},yt.prototype.getFactory=function(){return this._factory},yt.prototype.getGeometryN=function(n){return this},yt.prototype.getArea=function(){return 0},yt.prototype.isRectangle=function(){return!1},yt.prototype.equals=function(){if(arguments[0]instanceof yt){var n=arguments[0];return n!==null&&this.equalsTopo(n)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof yt))return!1;var s=i;return this.equalsExact(s)}},yt.prototype.equalsExact=function(n){return this===n||this.equalsExact(n,0)},yt.prototype.geometryChanged=function(){this.apply(yt.geometryChangedFilter)},yt.prototype.geometryChangedAction=function(){this._envelope=null},yt.prototype.equalsNorm=function(n){return n!==null&&this.norm().equalsExact(n.norm())},yt.prototype.getLength=function(){return 0},yt.prototype.getNumGeometries=function(){return 1},yt.prototype.compareTo=function(){if(arguments.length===1){var n=arguments[0],i=n;return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(n)}if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.getSortIndex()!==s.getSortIndex()?this.getSortIndex()-s.getSortIndex():this.isEmpty()&&s.isEmpty()?0:this.isEmpty()?-1:s.isEmpty()?1:this.compareToSameClass(s,u)}},yt.prototype.getUserData=function(){return this._userData},yt.prototype.getSRID=function(){return this._SRID},yt.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},yt.prototype.checkNotGeometryCollection=function(n){if(n.getSortIndex()===yt.SORTINDEX_GEOMETRYCOLLECTION)throw new P("This method does not support GeometryCollection arguments")},yt.prototype.equal=function(n,i,s){return s===0?n.equals(i):n.distance(i)<=s},yt.prototype.norm=function(){var n=this.copy();return n.normalize(),n},yt.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},yt.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Ct(this._envelope)},yt.prototype.setSRID=function(n){this._SRID=n},yt.prototype.setUserData=function(n){this._userData=n},yt.prototype.compare=function(n,i){for(var s=n.iterator(),u=i.iterator();s.hasNext()&&u.hasNext();){var c=s.next(),m=u.next(),E=c.compareTo(m);if(E!==0)return E}return s.hasNext()?1:u.hasNext()?-1:0},yt.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},yt.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===yt.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===yt.SORTINDEX_MULTIPOINT||this.getSortIndex()===yt.SORTINDEX_MULTILINESTRING||this.getSortIndex()===yt.SORTINDEX_MULTIPOLYGON},yt.prototype.interfaces_=function(){return[G,N,t]},yt.prototype.getClass=function(){return yt},yt.hasNonEmptyElements=function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1},yt.hasNullElements=function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1},$t.serialVersionUID.get=function(){return 8763622679187377e3},$t.SORTINDEX_POINT.get=function(){return 0},$t.SORTINDEX_MULTIPOINT.get=function(){return 1},$t.SORTINDEX_LINESTRING.get=function(){return 2},$t.SORTINDEX_LINEARRING.get=function(){return 3},$t.SORTINDEX_MULTILINESTRING.get=function(){return 4},$t.SORTINDEX_POLYGON.get=function(){return 5},$t.SORTINDEX_MULTIPOLYGON.get=function(){return 6},$t.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},$t.geometryChangedFilter.get=function(){return Dt},Object.defineProperties(yt,$t);var Dt=function(){};Dt.interfaces_=function(){return[wt]},Dt.filter=function(n){n.geometryChangedAction()};var Y=function(){};Y.prototype.filter=function(n){},Y.prototype.interfaces_=function(){return[]},Y.prototype.getClass=function(){return Y};var w=function(){},C={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};w.prototype.isInBoundary=function(n){},w.prototype.interfaces_=function(){return[]},w.prototype.getClass=function(){return w},C.Mod2BoundaryNodeRule.get=function(){return R},C.EndPointBoundaryNodeRule.get=function(){return H},C.MultiValentEndPointBoundaryNodeRule.get=function(){return z},C.MonoValentEndPointBoundaryNodeRule.get=function(){return rt},C.MOD2_BOUNDARY_RULE.get=function(){return new R},C.ENDPOINT_BOUNDARY_RULE.get=function(){return new H},C.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new z},C.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new rt},C.OGC_SFS_BOUNDARY_RULE.get=function(){return w.MOD2_BOUNDARY_RULE},Object.defineProperties(w,C);var R=function(){};R.prototype.isInBoundary=function(n){return n%2==1},R.prototype.interfaces_=function(){return[w]},R.prototype.getClass=function(){return R};var H=function(){};H.prototype.isInBoundary=function(n){return n>0},H.prototype.interfaces_=function(){return[w]},H.prototype.getClass=function(){return H};var z=function(){};z.prototype.isInBoundary=function(n){return n>1},z.prototype.interfaces_=function(){return[w]},z.prototype.getClass=function(){return z};var rt=function(){};rt.prototype.isInBoundary=function(n){return n===1},rt.prototype.interfaces_=function(){return[w]},rt.prototype.getClass=function(){return rt};var j=function(){};j.prototype.add=function(){},j.prototype.addAll=function(){},j.prototype.isEmpty=function(){},j.prototype.iterator=function(){},j.prototype.size=function(){},j.prototype.toArray=function(){},j.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var D=function(){};D.prototype.hasNext=function(){},D.prototype.next=function(){},D.prototype.remove=function(){};var tt=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(){},i.prototype.set=function(){},i.prototype.isEmpty=function(){},i}(j);(o.prototype=new Error).name="NoSuchElementException";var Z=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof j&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.ensureCapacity=function(){},i.prototype.interfaces_=function(){return[n,j]},i.prototype.add=function(s){return arguments.length===1?this.array_.push(s):this.array_.splice(arguments[0],arguments[1]),!0},i.prototype.clear=function(){this.array_=[]},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.set=function(s,u){var c=this.array_[s];return this.array_[s]=u,c},i.prototype.iterator=function(){return new et(this)},i.prototype.get=function(s){if(s<0||s>=this.size())throw new e;return this.array_[s]},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.size=function(){return this.array_.length},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.remove=function(s){for(var u=!1,c=0,m=this.array_.length;c<m;c++)if(this.array_[c]===s){this.array_.splice(c,1),u=!0;break}return u},i}(tt),et=function(n){function i(s){n.call(this),this.arrayList_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new o;return this.arrayList_.get(this.position_++)},i.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},i.prototype.set=function(s){return this.arrayList_.set(this.position_-1,s)},i.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},i}(D),ot=function(n){function i(){if(n.call(this),arguments.length!==0){if(arguments.length===1){var u=arguments[0];this.ensureCapacity(u.length),this.add(u,!0)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.ensureCapacity(c.length),this.add(c,m)}}}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={coordArrayType:{configurable:!0}};return s.coordArrayType.get=function(){return new Array(0).fill(null)},i.prototype.getCoordinate=function(u){return this.get(u)},i.prototype.addAll=function(){if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m=!1,E=u.iterator();E.hasNext();)this.add(E.next(),c),m=!0;return m}return n.prototype.addAll.apply(this,arguments)},i.prototype.clone=function(){for(var u=n.prototype.clone.call(this),c=0;c<this.size();c++)u.add(c,this.get(c).copy());return u},i.prototype.toCoordinateArray=function(){return this.toArray(i.coordArrayType)},i.prototype.add=function(){if(arguments.length===1){var u=arguments[0];n.prototype.add.call(this,u)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var c=arguments[0],m=arguments[1];return this.add(c,m,!0),!0}if(arguments[0]instanceof I&&typeof arguments[1]=="boolean"){var E=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(E))return null;n.prototype.add.call(this,E)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var A=arguments[0],U=arguments[1];return this.add(A,U),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var K=arguments[0],pt=arguments[1];if(arguments[2])for(var dt=0;dt<K.length;dt++)this.add(K[dt],pt);else for(var Rt=K.length-1;Rt>=0;Rt--)this.add(K[Rt],pt);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof I){var Ot=arguments[0],Vt=arguments[1];if(!arguments[2]){var jt=this.size();if(jt>0&&(Ot>0&&this.get(Ot-1).equals2D(Vt)||Ot<jt&&this.get(Ot).equals2D(Vt)))return null}n.prototype.add.call(this,Ot,Vt)}}else if(arguments.length===4){var sn=arguments[0],kn=arguments[1],Mr=arguments[2],Ki=arguments[3],Uo=1;Mr>Ki&&(Uo=-1);for(var Ph=Mr;Ph!==Ki;Ph+=Uo)this.add(sn[Ph],kn);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new I(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,s),i}(Z),Q=function(){},St={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};St.ForwardComparator.get=function(){return At},St.BidirectionalComparator.get=function(){return ne},St.coordArrayType.get=function(){return new Array(0).fill(null)},Q.prototype.interfaces_=function(){return[]},Q.prototype.getClass=function(){return Q},Q.isRing=function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])},Q.ptNotInList=function(n,i){for(var s=0;s<n.length;s++){var u=n[s];if(Q.indexOf(u,i)<0)return u}return null},Q.scroll=function(n,i){var s=Q.indexOf(i,n);if(s<0)return null;var u=new Array(n.length).fill(null);Ft.arraycopy(n,s,u,0,n.length-s),Ft.arraycopy(n,0,u,n.length-s,s),Ft.arraycopy(u,0,n,0,n.length)},Q.equals=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(n===i)return!0;if(n===null||i===null||n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(!n[s].equals(i[s]))return!1;return!0}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];if(u===c)return!0;if(u===null||c===null||u.length!==c.length)return!1;for(var E=0;E<u.length;E++)if(m.compare(u[E],c[E])!==0)return!1;return!0}},Q.intersection=function(n,i){for(var s=new ot,u=0;u<n.length;u++)i.intersects(n[u])&&s.add(n[u],!0);return s.toCoordinateArray()},Q.hasRepeatedPoints=function(n){for(var i=1;i<n.length;i++)if(n[i-1].equals(n[i]))return!0;return!1},Q.removeRepeatedPoints=function(n){return Q.hasRepeatedPoints(n)?new ot(n,!1).toCoordinateArray():n},Q.reverse=function(n){for(var i=n.length-1,s=Math.trunc(i/2),u=0;u<=s;u++){var c=n[u];n[u]=n[i-u],n[i-u]=c}},Q.removeNull=function(n){for(var i=0,s=0;s<n.length;s++)n[s]!==null&&i++;var u=new Array(i).fill(null);if(i===0)return u;for(var c=0,m=0;m<n.length;m++)n[m]!==null&&(u[c++]=n[m]);return u},Q.copyDeep=function(){if(arguments.length===1){for(var n=arguments[0],i=new Array(n.length).fill(null),s=0;s<n.length;s++)i[s]=new I(n[s]);return i}if(arguments.length===5)for(var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],A=arguments[4],U=0;U<A;U++)m[E+U]=new I(u[c+U])},Q.isEqualReversed=function(n,i){for(var s=0;s<n.length;s++){var u=n[s],c=i[n.length-s-1];if(u.compareTo(c)!==0)return!1}return!0},Q.envelope=function(n){for(var i=new Ct,s=0;s<n.length;s++)i.expandToInclude(n[s]);return i},Q.toCoordinateArray=function(n){return n.toArray(Q.coordArrayType)},Q.atLeastNCoordinatesOrNothing=function(n,i){return i.length>=n?i:[]},Q.indexOf=function(n,i){for(var s=0;s<i.length;s++)if(n.equals(i[s]))return s;return-1},Q.increasingDirection=function(n){for(var i=0;i<Math.trunc(n.length/2);i++){var s=n.length-1-i,u=n[i].compareTo(n[s]);if(u!==0)return u}return 1},Q.compare=function(n,i){for(var s=0;s<n.length&&s<i.length;){var u=n[s].compareTo(i[s]);if(u!==0)return u;s++}return s<i.length?-1:s<n.length?1:0},Q.minCoordinate=function(n){for(var i=null,s=0;s<n.length;s++)(i===null||i.compareTo(n[s])>0)&&(i=n[s]);return i},Q.extract=function(n,i,s){i=ut.clamp(i,0,n.length);var u=(s=ut.clamp(s,-1,n.length))-i+1;s<0&&(u=0),i>=n.length&&(u=0),s<i&&(u=0);var c=new Array(u).fill(null);if(u===0)return c;for(var m=0,E=i;E<=s;E++)c[m++]=n[E];return c},Object.defineProperties(Q,St);var At=function(){};At.prototype.compare=function(n,i){return Q.compare(n,i)},At.prototype.interfaces_=function(){return[B]},At.prototype.getClass=function(){return At};var ne=function(){};ne.prototype.compare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;var c=Q.compare(s,u);return Q.isEqualReversed(s,u)?0:c},ne.prototype.OLDcompare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;for(var c=Q.increasingDirection(s),m=Q.increasingDirection(u),E=c>0?0:s.length-1,A=m>0?0:s.length-1,U=0;U<s.length;U++){var K=s[E].compareTo(u[A]);if(K!==0)return K;E+=c,A+=m}return 0},ne.prototype.interfaces_=function(){return[B]},ne.prototype.getClass=function(){return ne};var Gt=function(){};Gt.prototype.get=function(){},Gt.prototype.put=function(){},Gt.prototype.size=function(){},Gt.prototype.values=function(){},Gt.prototype.entrySet=function(){};var He=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Gt);(a.prototype=new Error).name="OperationNotSupported",(l.prototype=new j).contains=function(){};var tn=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof j&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.contains=function(s){for(var u=0,c=this.array_.length;u<c;u++)if(this.array_[u]===s)return!0;return!1},i.prototype.add=function(s){return!this.contains(s)&&(this.array_.push(s),!0)},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.remove=function(s){throw new Error},i.prototype.size=function(){return this.array_.length},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.iterator=function(){return new Ln(this)},i}(l),Ln=function(n){function i(s){n.call(this),this.hashSet_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new o;return this.hashSet_.array_[this.position_++]},i.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},i.prototype.remove=function(){throw new a},i}(D),mn=0;(_.prototype=new He).get=function(n){for(var i=this.root_;i!==null;){var s=n.compareTo(i.key);if(s<0)i=i.left;else{if(!(s>0))return i.value;i=i.right}}return null},_.prototype.put=function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:mn,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var s,u,c=this.root_;do if(s=c,(u=n.compareTo(c.key))<0)c=c.left;else{if(!(u>0)){var m=c.value;return c.value=i,m}c=c.right}while(c!==null);var E={key:n,left:null,right:null,value:i,parent:s,color:mn,getValue:function(){return this.value},getKey:function(){return this.key}};return u<0?s.left=E:s.right=E,this.fixAfterInsertion(E),this.size_++,null},_.prototype.fixAfterInsertion=function(n){for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)if(f(n)===d(f(f(n)))){var i=g(f(f(n)));h(i)===1?(p(f(n),mn),p(i,mn),p(f(f(n)),1),n=f(f(n))):(n===g(f(n))&&(n=f(n),this.rotateLeft(n)),p(f(n),mn),p(f(f(n)),1),this.rotateRight(f(f(n))))}else{var s=d(f(f(n)));h(s)===1?(p(f(n),mn),p(s,mn),p(f(f(n)),1),n=f(f(n))):(n===d(f(n))&&(n=f(n),this.rotateRight(n)),p(f(n),mn),p(f(f(n)),1),this.rotateLeft(f(f(n))))}this.root_.color=mn},_.prototype.values=function(){var n=new Z,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=_.successor(i))!==null;)n.add(i.value);return n},_.prototype.entrySet=function(){var n=new tn,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=_.successor(i))!==null;)n.add(i);return n},_.prototype.rotateLeft=function(n){if(n!=null){var i=n.right;n.right=i.left,i.left!=null&&(i.left.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.left===n?n.parent.left=i:n.parent.right=i,i.left=n,n.parent=i}},_.prototype.rotateRight=function(n){if(n!=null){var i=n.left;n.left=i.right,i.right!=null&&(i.right.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.right===n?n.parent.right=i:n.parent.left=i,i.right=n,n.parent=i}},_.prototype.getFirstEntry=function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n},_.successor=function(n){if(n===null)return null;if(n.right!==null){for(var i=n.right;i.left!==null;)i=i.left;return i}for(var s=n.parent,u=n;s!==null&&u===s.right;)u=s,s=s.parent;return s},_.prototype.size=function(){return this.size_};var Fn=function(){};Fn.prototype.interfaces_=function(){return[]},Fn.prototype.getClass=function(){return Fn},y.prototype=new l,(M.prototype=new y).contains=function(n){for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===0)return!0;return!1},M.prototype.add=function(n){if(this.contains(n))return!1;for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===1)return this.array_.splice(i,0,n),!0;return this.array_.push(n),!0},M.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next());return!0},M.prototype.remove=function(n){throw new a},M.prototype.size=function(){return this.array_.length},M.prototype.isEmpty=function(){return this.array_.length===0},M.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n},M.prototype.iterator=function(){return new $n(this)};var $n=function(n){this.treeSet_=n,this.position_=0};$n.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},$n.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},$n.prototype.remove=function(){throw new a};var xn=function(){};xn.sort=function(){var n,i,s,u,c=arguments[0];if(arguments.length===1)u=function(E,A){return E.compareTo(A)},c.sort(u);else if(arguments.length===2)s=arguments[1],u=function(E,A){return s.compare(E,A)},c.sort(u);else if(arguments.length===3){(i=c.slice(arguments[1],arguments[2])).sort();var m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length));for(c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])}else if(arguments.length===4)for(i=c.slice(arguments[1],arguments[2]),s=arguments[3],u=function(E,A){return s.compare(E,A)},i.sort(u),m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length)),c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])},xn.asList=function(n){for(var i=new Z,s=0,u=n.length;s<u;s++)i.add(n[s]);return i};var re=function(){},En={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};En.P.get=function(){return 0},En.L.get=function(){return 1},En.A.get=function(){return 2},En.FALSE.get=function(){return-1},En.TRUE.get=function(){return-2},En.DONTCARE.get=function(){return-3},En.SYM_FALSE.get=function(){return"F"},En.SYM_TRUE.get=function(){return"T"},En.SYM_DONTCARE.get=function(){return"*"},En.SYM_P.get=function(){return"0"},En.SYM_L.get=function(){return"1"},En.SYM_A.get=function(){return"2"},re.prototype.interfaces_=function(){return[]},re.prototype.getClass=function(){return re},re.toDimensionSymbol=function(n){switch(n){case re.FALSE:return re.SYM_FALSE;case re.TRUE:return re.SYM_TRUE;case re.DONTCARE:return re.SYM_DONTCARE;case re.P:return re.SYM_P;case re.L:return re.SYM_L;case re.A:return re.SYM_A}throw new P("Unknown dimension value: "+n)},re.toDimensionValue=function(n){switch(ht.toUpperCase(n)){case re.SYM_FALSE:return re.FALSE;case re.SYM_TRUE:return re.TRUE;case re.SYM_DONTCARE:return re.DONTCARE;case re.SYM_P:return re.P;case re.SYM_L:return re.L;case re.SYM_A:return re.A}throw new P("Unknown dimension symbol: "+n)},Object.defineProperties(re,En);var Cn=function(){};Cn.prototype.filter=function(n){},Cn.prototype.interfaces_=function(){return[]},Cn.prototype.getClass=function(){return Cn};var wn=function(){};wn.prototype.filter=function(n,i){},wn.prototype.isDone=function(){},wn.prototype.isGeometryChanged=function(){},wn.prototype.interfaces_=function(){return[]},wn.prototype.getClass=function(){return wn};var gn=function(n){function i(u,c){if(n.call(this,c),this._geometries=u||[],n.hasNullElements(this._geometries))throw new P("geometries must not contain null elements")}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){for(var u=new Ct,c=0;c<this._geometries.length;c++)u.expandToInclude(this._geometries[c].getEnvelopeInternal());return u},i.prototype.getGeometryN=function(u){return this._geometries[u]},i.prototype.getSortIndex=function(){return n.SORTINDEX_GEOMETRYCOLLECTION},i.prototype.getCoordinates=function(){for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=0;m<this._geometries.length;m++)for(var E=this._geometries[m].getCoordinates(),A=0;A<E.length;A++)u[++c]=E[A];return u},i.prototype.getArea=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getArea();return u},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._geometries.length!==m._geometries.length)return!1;for(var E=0;E<this._geometries.length;E++)if(!this._geometries[E].equalsExact(m._geometries[E],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<this._geometries.length;u++)this._geometries[u].normalize();xn.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var u=re.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getBoundaryDimension());return u},i.prototype.getDimension=function(){for(var u=re.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getDimension());return u},i.prototype.getLength=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getNumPoints();return u},i.prototype.getNumGeometries=function(){return this._geometries.length},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createGeometryCollection(c)},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=new M(xn.asList(this._geometries)),m=new M(xn.asList(u._geometries));return this.compare(c,m)}if(arguments.length===2){for(var E=arguments[0],A=arguments[1],U=E,K=this.getNumGeometries(),pt=U.getNumGeometries(),dt=0;dt<K&&dt<pt;){var Rt=this.getGeometryN(dt),Ot=U.getGeometryN(dt),Vt=Rt.compareToSameClass(Ot,A);if(Vt!==0)return Vt;dt++}return dt<K?1:dt<pt?-1:0}},i.prototype.apply=function(){if($(arguments[0],Y))for(var u=arguments[0],c=0;c<this._geometries.length;c++)this._geometries[c].apply(u);else if($(arguments[0],wn)){var m=arguments[0];if(this._geometries.length===0)return null;for(var E=0;E<this._geometries.length&&(this._geometries[E].apply(m),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else if($(arguments[0],Cn)){var A=arguments[0];A.filter(this);for(var U=0;U<this._geometries.length;U++)this._geometries[U].apply(A)}else if($(arguments[0],wt)){var K=arguments[0];K.filter(this);for(var pt=0;pt<this._geometries.length;pt++)this._geometries[pt].apply(K)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),Pt.shouldNeverReachHere(),null},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._geometries=new Array(this._geometries.length).fill(null);for(var c=0;c<this._geometries.length;c++)u._geometries[c]=this._geometries[c].clone();return u},i.prototype.getGeometryType=function(){return"GeometryCollection"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.isEmpty=function(){for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isEmpty())return!1;return!0},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(i,s),i}(yt),W=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return yt.SORTINDEX_MULTILINESTRING},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?re.FALSE:0},i.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isClosed())return!1;return!0},i.prototype.getDimension=function(){return 1},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[u-1-m]=this._geometries[m].reverse();return this.getFactory().createMultiLineString(c)},i.prototype.getBoundary=function(){return new at(this).getBoundary()},i.prototype.getGeometryType=function(){return"MultiLineString"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[Fn]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,s),i}(gn),at=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var n=arguments[0],i=w.MOD2_BOUNDARY_RULE;this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._geom=s,this._geomFact=s.getFactory(),this._bnRule=u}};at.prototype.boundaryMultiLineString=function(n){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var i=this.computeBoundaryCoordinates(n);return i.length===1?this._geomFact.createPoint(i[0]):this._geomFact.createMultiPointFromCoords(i)},at.prototype.getBoundary=function(){return this._geom instanceof zt?this.boundaryLineString(this._geom):this._geom instanceof W?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},at.prototype.boundaryLineString=function(n){return this._geom.isEmpty()?this.getEmptyMultiPoint():n.isClosed()?this._bnRule.isInBoundary(2)?n.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([n.getStartPoint(),n.getEndPoint()])},at.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},at.prototype.computeBoundaryCoordinates=function(n){var i=new Z;this._endpointMap=new _;for(var s=0;s<n.getNumGeometries();s++){var u=n.getGeometryN(s);u.getNumPoints()!==0&&(this.addEndpoint(u.getCoordinateN(0)),this.addEndpoint(u.getCoordinateN(u.getNumPoints()-1)))}for(var c=this._endpointMap.entrySet().iterator();c.hasNext();){var m=c.next(),E=m.getValue().count;this._bnRule.isInBoundary(E)&&i.add(m.getKey())}return Q.toCoordinateArray(i)},at.prototype.addEndpoint=function(n){var i=this._endpointMap.get(n);i===null&&(i=new _t,this._endpointMap.put(n,i)),i.count++},at.prototype.interfaces_=function(){return[]},at.prototype.getClass=function(){return at},at.getBoundary=function(){if(arguments.length===1){var n=arguments[0];return new at(n).getBoundary()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new at(i,s).getBoundary()}};var _t=function(){this.count=null};_t.prototype.interfaces_=function(){return[]},_t.prototype.getClass=function(){return _t};var ct=function(){},Et={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};ct.prototype.interfaces_=function(){return[]},ct.prototype.getClass=function(){return ct},ct.chars=function(n,i){for(var s=new Array(i).fill(null),u=0;u<i;u++)s[u]=n;return String(s)},ct.getStackTrace=function(){if(arguments.length===1){var n=arguments[0],i=new function(){},s=new function(){}(i);return n.printStackTrace(s),i.toString()}if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m="",E=new function(){}(new function(){}(ct.getStackTrace(u))),A=0;A<c;A++)try{m+=E.readLine()+ct.NEWLINE}catch(U){if(!(U instanceof b))throw U;Pt.shouldNeverReachHere()}return m}},ct.split=function(n,i){for(var s=i.length,u=new Z,c=""+n,m=c.indexOf(i);m>=0;){var E=c.substring(0,m);u.add(E),m=(c=c.substring(m+s)).indexOf(i)}c.length>0&&u.add(c);for(var A=new Array(u.size()).fill(null),U=0;U<A.length;U++)A[U]=u.get(U);return A},ct.toString=function(){if(arguments.length===1){var n=arguments[0];return ct.SIMPLE_ORDINATE_FORMAT.format(n)}},ct.spaces=function(n){return ct.chars(" ",n)},Et.NEWLINE.get=function(){return Ft.getProperty("line.separator")},Et.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(ct,Et);var Nt=function(){};Nt.prototype.interfaces_=function(){return[]},Nt.prototype.getClass=function(){return Nt},Nt.copyCoord=function(n,i,s,u){for(var c=Math.min(n.getDimension(),s.getDimension()),m=0;m<c;m++)s.setOrdinate(u,m,n.getOrdinate(i,m))},Nt.isRing=function(n){var i=n.size();return i===0||!(i<=3)&&n.getOrdinate(0,gt.X)===n.getOrdinate(i-1,gt.X)&&n.getOrdinate(0,gt.Y)===n.getOrdinate(i-1,gt.Y)},Nt.isEqual=function(n,i){var s=n.size();if(s!==i.size())return!1;for(var u=Math.min(n.getDimension(),i.getDimension()),c=0;c<s;c++)for(var m=0;m<u;m++){var E=n.getOrdinate(c,m),A=i.getOrdinate(c,m);if(n.getOrdinate(c,m)!==i.getOrdinate(c,m)&&(!S.isNaN(E)||!S.isNaN(A)))return!1}return!0},Nt.extend=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();if(Nt.copy(i,0,u,0,c),c>0)for(var m=c;m<s;m++)Nt.copy(i,c-1,u,m,1);return u},Nt.reverse=function(n){for(var i=n.size()-1,s=Math.trunc(i/2),u=0;u<=s;u++)Nt.swap(n,u,i-u)},Nt.swap=function(n,i,s){if(i===s)return null;for(var u=0;u<n.getDimension();u++){var c=n.getOrdinate(i,u);n.setOrdinate(i,u,n.getOrdinate(s,u)),n.setOrdinate(s,u,c)}},Nt.copy=function(n,i,s,u,c){for(var m=0;m<c;m++)Nt.copyCoord(n,i+m,s,u+m)},Nt.toString=function(){if(arguments.length===1){var n=arguments[0],i=n.size();if(i===0)return"()";var s=n.getDimension(),u=new mt;u.append("(");for(var c=0;c<i;c++){c>0&&u.append(" ");for(var m=0;m<s;m++)m>0&&u.append(","),u.append(ct.toString(n.getOrdinate(c,m)))}return u.append(")"),u.toString()}},Nt.ensureValidRing=function(n,i){var s=i.size();return s===0?i:s<=3?Nt.createClosedRing(n,i,4):i.getOrdinate(0,gt.X)===i.getOrdinate(s-1,gt.X)&&i.getOrdinate(0,gt.Y)===i.getOrdinate(s-1,gt.Y)?i:Nt.createClosedRing(n,i,s+1)},Nt.createClosedRing=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();Nt.copy(i,0,u,0,c);for(var m=c;m<s;m++)Nt.copy(i,0,u,m,1);return u};var zt=function(n){function i(u,c){n.call(this,c),this._points=null,this.init(u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new Ct:this._points.expandEnvelope(new Ct)},i.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},i.prototype.getSortIndex=function(){return n.SORTINDEX_LINESTRING},i.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._points.size()!==m._points.size())return!1;for(var E=0;E<this._points.size();E++)if(!this.equal(this._points.getCoordinate(E),m._points.getCoordinate(E),c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<Math.trunc(this._points.size()/2);u++){var c=this._points.size()-1-u;if(!this._points.getCoordinate(u).equals(this._points.getCoordinate(c)))return this._points.getCoordinate(u).compareTo(this._points.getCoordinate(c))>0&&Nt.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?re.FALSE:0},i.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},i.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},i.prototype.getDimension=function(){return 1},i.prototype.getLength=function(){return J.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var u=this._points.copy();return Nt.reverse(u),this.getFactory().createLineString(u)},i.prototype.compareToSameClass=function(){if(arguments.length===1){for(var u=arguments[0],c=0,m=0;c<this._points.size()&&m<u._points.size();){var E=this._points.getCoordinate(c).compareTo(u._points.getCoordinate(m));if(E!==0)return E;c++,m++}return c<this._points.size()?1:m<u._points.size()?-1:0}if(arguments.length===2){var A=arguments[0];return arguments[1].compare(this._points,A._points)}},i.prototype.apply=function(){if($(arguments[0],Y))for(var u=arguments[0],c=0;c<this._points.size();c++)u.filter(this._points.getCoordinate(c));else if($(arguments[0],wn)){var m=arguments[0];if(this._points.size()===0)return null;for(var E=0;E<this._points.size()&&(m.filter(this._points,E),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else $(arguments[0],Cn)?arguments[0].filter(this):$(arguments[0],wt)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new at(this).getBoundary()},i.prototype.isEquivalentClass=function(u){return u instanceof i},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._points=this._points.clone(),u},i.prototype.getCoordinateN=function(u){return this._points.getCoordinate(u)},i.prototype.getGeometryType=function(){return"LineString"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._points},i.prototype.isEmpty=function(){return this._points.size()===0},i.prototype.init=function(u){if(u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),u.size()===1)throw new P("Invalid number of points in LineString (found "+u.size()+" - must be 0 or >= 2)");this._points=u},i.prototype.isCoordinate=function(u){for(var c=0;c<this._points.size();c++)if(this._points.getCoordinate(c).equals(u))return!0;return!1},i.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},i.prototype.getPointN=function(u){return this.getFactory().createPoint(this._points.getCoordinate(u))},i.prototype.interfaces_=function(){return[Fn]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,s),i}(yt),oe=function(){};oe.prototype.interfaces_=function(){return[]},oe.prototype.getClass=function(){return oe};var Kt=function(n){function i(u,c){n.call(this,c),this._coordinates=u||null,this.init(this._coordinates)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new Ct;var u=new Ct;return u.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),u},i.prototype.getSortIndex=function(){return n.SORTINDEX_POINT},i.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&(!(!this.isEmpty()||!u.isEmpty())||this.isEmpty()===u.isEmpty()&&this.equal(u.getCoordinate(),this.getCoordinate(),c))}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){},i.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},i.prototype.getBoundaryDimension=function(){return re.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getNumPoints=function(){return this.isEmpty()?0:1},i.prototype.reverse=function(){return this.copy()},i.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0];return this.getCoordinate().compareTo(u.getCoordinate())}if(arguments.length===2){var c=arguments[0];return arguments[1].compare(this._coordinates,c._coordinates)}},i.prototype.apply=function(){if($(arguments[0],Y)){var u=arguments[0];if(this.isEmpty())return null;u.filter(this.getCoordinate())}else if($(arguments[0],wn)){var c=arguments[0];if(this.isEmpty())return null;c.filter(this._coordinates,0),c.isGeometryChanged()&&this.geometryChanged()}else $(arguments[0],Cn)?arguments[0].filter(this):$(arguments[0],wt)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._coordinates=this._coordinates.clone(),u},i.prototype.getGeometryType=function(){return"Point"},i.prototype.copy=function(){return new i(this._coordinates.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._coordinates},i.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},i.prototype.isEmpty=function(){return this._coordinates.size()===0},i.prototype.init=function(u){u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),Pt.isTrue(u.size()<=1),this._coordinates=u},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[oe]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,s),i}(yt),ce=function(){};ce.prototype.interfaces_=function(){return[]},ce.prototype.getClass=function(){return ce};var Wt=function(n){function i(u,c,m){if(n.call(this,m),this._shell=null,this._holes=null,u===null&&(u=this.getFactory().createLinearRing()),c===null&&(c=[]),n.hasNullElements(c))throw new P("holes must not contain null elements");if(u.isEmpty()&&n.hasNonEmptyElements(c))throw new P("shell is empty but holes are not");this._shell=u,this._holes=c}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},i.prototype.getSortIndex=function(){return n.SORTINDEX_POLYGON},i.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=this._shell.getCoordinates(),E=0;E<m.length;E++)u[++c]=m[E];for(var A=0;A<this._holes.length;A++)for(var U=this._holes[A].getCoordinates(),K=0;K<U.length;K++)u[++c]=U[K];return u},i.prototype.getArea=function(){var u=0;u+=Math.abs(J.signedArea(this._shell.getCoordinateSequence()));for(var c=0;c<this._holes.length;c++)u-=Math.abs(J.signedArea(this._holes[c].getCoordinateSequence()));return u},i.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var u=this._shell.getCoordinateSequence(),c=this.getEnvelopeInternal(),m=0;m<5;m++){var E=u.getX(m);if(E!==c.getMinX()&&E!==c.getMaxX())return!1;var A=u.getY(m);if(A!==c.getMinY()&&A!==c.getMaxY())return!1}for(var U=u.getX(0),K=u.getY(0),pt=1;pt<=4;pt++){var dt=u.getX(pt),Rt=u.getY(pt);if(dt!==U==(Rt!==K))return!1;U=dt,K=Rt}return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u,E=this._shell,A=m._shell;if(!E.equalsExact(A,c)||this._holes.length!==m._holes.length)return!1;for(var U=0;U<this._holes.length;U++)if(!this._holes[U].equalsExact(m._holes[U],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var u=0;u<this._holes.length;u++)this.normalize(this._holes[u],!1);xn.sort(this._holes)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];if(c.isEmpty())return null;var E=new Array(c.getCoordinates().length-1).fill(null);Ft.arraycopy(c.getCoordinates(),0,E,0,E.length);var A=Q.minCoordinate(c.getCoordinates());Q.scroll(E,A),Ft.arraycopy(E,0,c.getCoordinates(),0,E.length),c.getCoordinates()[E.length]=E[0],J.isCCW(c.getCoordinates())===m&&Q.reverse(c.getCoordinates())}},i.prototype.getCoordinate=function(){return this._shell.getCoordinate()},i.prototype.getNumInteriorRing=function(){return this._holes.length},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.getLength=function(){var u=0;u+=this._shell.getLength();for(var c=0;c<this._holes.length;c++)u+=this._holes[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=this._shell.getNumPoints(),c=0;c<this._holes.length;c++)u+=this._holes[c].getNumPoints();return u},i.prototype.reverse=function(){var u=this.copy();u._shell=this._shell.copy().reverse(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].copy().reverse();return u},i.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=this._shell,m=u._shell;return c.compareToSameClass(m)}if(arguments.length===2){var E=arguments[0],A=arguments[1],U=E,K=this._shell,pt=U._shell,dt=K.compareToSameClass(pt,A);if(dt!==0)return dt;for(var Rt=this.getNumInteriorRing(),Ot=U.getNumInteriorRing(),Vt=0;Vt<Rt&&Vt<Ot;){var jt=this.getInteriorRingN(Vt),sn=U.getInteriorRingN(Vt),kn=jt.compareToSameClass(sn,A);if(kn!==0)return kn;Vt++}return Vt<Rt?1:Vt<Ot?-1:0}},i.prototype.apply=function(u){if($(u,Y)){this._shell.apply(u);for(var c=0;c<this._holes.length;c++)this._holes[c].apply(u)}else if($(u,wn)){if(this._shell.apply(u),!u.isDone())for(var m=0;m<this._holes.length&&(this._holes[m].apply(u),!u.isDone());m++);u.isGeometryChanged()&&this.geometryChanged()}else if($(u,Cn))u.filter(this);else if($(u,wt)){u.filter(this),this._shell.apply(u);for(var E=0;E<this._holes.length;E++)this._holes[E].apply(u)}},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var u=new Array(this._holes.length+1).fill(null);u[0]=this._shell;for(var c=0;c<this._holes.length;c++)u[c+1]=this._holes[c];return u.length<=1?this.getFactory().createLinearRing(u[0].getCoordinateSequence()):this.getFactory().createMultiLineString(u)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._shell=this._shell.clone(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].clone();return u},i.prototype.getGeometryType=function(){return"Polygon"},i.prototype.copy=function(){for(var u=this._shell.copy(),c=new Array(this._holes.length).fill(null),m=0;m<c.length;m++)c[m]=this._holes[m].copy();return new i(u,c,this._factory)},i.prototype.getExteriorRing=function(){return this._shell},i.prototype.isEmpty=function(){return this._shell.isEmpty()},i.prototype.getInteriorRingN=function(u){return this._holes[u]},i.prototype.interfaces_=function(){return[ce]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(i,s),i}(yt),he=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return yt.SORTINDEX_MULTIPOINT},i.prototype.isValid=function(){return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getCoordinate=function(){if(arguments.length===1){var u=arguments[0];return this._geometries[u].getCoordinate()}return n.prototype.getCoordinate.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return re.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.getGeometryType=function(){return"MultiPoint"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[oe]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,s),i}(gn),an=function(n){function i(u,c){u instanceof I&&c instanceof ue&&(u=c.getCoordinateSequenceFactory().create(u)),n.call(this,u,c),this.validateConstruction()}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return yt.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return re.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},i.prototype.reverse=function(){var u=this._points.copy();return Nt.reverse(u),this.getFactory().createLinearRing(u)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new P("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new P("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},i.prototype.getGeometryType=function(){return"LinearRing"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.MINIMUM_VALID_SIZE.get=function(){return 4},s.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(i,s),i}(zt),ln=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return yt.SORTINDEX_MULTIPOLYGON},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createMultiPolygon(c)},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var u=new Z,c=0;c<this._geometries.length;c++)for(var m=this._geometries[c].getBoundary(),E=0;E<m.getNumGeometries();E++)u.add(m.getGeometryN(E));var A=new Array(u.size()).fill(null);return this.getFactory().createMultiLineString(u.toArray(A))},i.prototype.getGeometryType=function(){return"MultiPolygon"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[ce]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(i,s),i}(gn),bn=function(n){this._factory=n||null,this._isUserDataCopied=!1},ui={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};bn.prototype.setCopyUserData=function(n){this._isUserDataCopied=n},bn.prototype.edit=function(n,i){if(n===null)return null;var s=this.editInternal(n,i);return this._isUserDataCopied&&s.setUserData(n.getUserData()),s},bn.prototype.editInternal=function(n,i){return this._factory===null&&(this._factory=n.getFactory()),n instanceof gn?this.editGeometryCollection(n,i):n instanceof Wt?this.editPolygon(n,i):n instanceof Kt?i.edit(n,this._factory):n instanceof zt?i.edit(n,this._factory):(Pt.shouldNeverReachHere("Unsupported Geometry class: "+n.getClass().getName()),null)},bn.prototype.editGeometryCollection=function(n,i){for(var s=i.edit(n,this._factory),u=new Z,c=0;c<s.getNumGeometries();c++){var m=this.edit(s.getGeometryN(c),i);m===null||m.isEmpty()||u.add(m)}return s.getClass()===he?this._factory.createMultiPoint(u.toArray([])):s.getClass()===W?this._factory.createMultiLineString(u.toArray([])):s.getClass()===ln?this._factory.createMultiPolygon(u.toArray([])):this._factory.createGeometryCollection(u.toArray([]))},bn.prototype.editPolygon=function(n,i){var s=i.edit(n,this._factory);if(s===null&&(s=this._factory.createPolygon(null)),s.isEmpty())return s;var u=this.edit(s.getExteriorRing(),i);if(u===null||u.isEmpty())return this._factory.createPolygon();for(var c=new Z,m=0;m<s.getNumInteriorRing();m++){var E=this.edit(s.getInteriorRingN(m),i);E===null||E.isEmpty()||c.add(E)}return this._factory.createPolygon(u,c.toArray([]))},bn.prototype.interfaces_=function(){return[]},bn.prototype.getClass=function(){return bn},bn.GeometryEditorOperation=function(){},ui.NoOpGeometryOperation.get=function(){return Pn},ui.CoordinateOperation.get=function(){return de},ui.CoordinateSequenceOperation.get=function(){return bo},Object.defineProperties(bn,ui);var Pn=function(){};Pn.prototype.edit=function(n,i){return n},Pn.prototype.interfaces_=function(){return[bn.GeometryEditorOperation]},Pn.prototype.getClass=function(){return Pn};var de=function(){};de.prototype.edit=function(n,i){var s=this.editCoordinates(n.getCoordinates(),n);return s===null?n:n instanceof an?i.createLinearRing(s):n instanceof zt?i.createLineString(s):n instanceof Kt?s.length>0?i.createPoint(s[0]):i.createPoint():n},de.prototype.interfaces_=function(){return[bn.GeometryEditorOperation]},de.prototype.getClass=function(){return de};var bo=function(){};bo.prototype.edit=function(n,i){return n instanceof an?i.createLinearRing(this.edit(n.getCoordinateSequence(),n)):n instanceof zt?i.createLineString(this.edit(n.getCoordinateSequence(),n)):n instanceof Kt?i.createPoint(this.edit(n.getCoordinateSequence(),n)):n},bo.prototype.interfaces_=function(){return[bn.GeometryEditorOperation]},bo.prototype.getClass=function(){return bo};var fe=function(){if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=new Array(n).fill(null);for(var i=0;i<n;i++)this._coordinates[i]=new I}else if($(arguments[0],gt)){var s=arguments[0];if(s===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=s.getDimension(),this._coordinates=new Array(s.size()).fill(null);for(var u=0;u<this._coordinates.length;u++)this._coordinates[u]=s.getCoordinateCopy(u)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var c=arguments[0],m=arguments[1];this._coordinates=c,this._dimension=m,c===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var E=arguments[0],A=arguments[1];this._coordinates=new Array(E).fill(null),this._dimension=A;for(var U=0;U<E;U++)this._coordinates[U]=new I}}},ao={serialVersionUID:{configurable:!0}};fe.prototype.setOrdinate=function(n,i,s){switch(i){case gt.X:this._coordinates[n].x=s;break;case gt.Y:this._coordinates[n].y=s;break;case gt.Z:this._coordinates[n].z=s;break;default:throw new P("invalid ordinateIndex")}},fe.prototype.size=function(){return this._coordinates.length},fe.prototype.getOrdinate=function(n,i){switch(i){case gt.X:return this._coordinates[n].x;case gt.Y:return this._coordinates[n].y;case gt.Z:return this._coordinates[n].z}return S.NaN},fe.prototype.getCoordinate=function(){if(arguments.length===1){var n=arguments[0];return this._coordinates[n]}if(arguments.length===2){var i=arguments[0],s=arguments[1];s.x=this._coordinates[i].x,s.y=this._coordinates[i].y,s.z=this._coordinates[i].z}},fe.prototype.getCoordinateCopy=function(n){return new I(this._coordinates[n])},fe.prototype.getDimension=function(){return this._dimension},fe.prototype.getX=function(n){return this._coordinates[n].x},fe.prototype.clone=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].clone();return new fe(n,this._dimension)},fe.prototype.expandEnvelope=function(n){for(var i=0;i<this._coordinates.length;i++)n.expandToInclude(this._coordinates[i]);return n},fe.prototype.copy=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].copy();return new fe(n,this._dimension)},fe.prototype.toString=function(){if(this._coordinates.length>0){var n=new mt(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var i=1;i<this._coordinates.length;i++)n.append(", "),n.append(this._coordinates[i]);return n.append(")"),n.toString()}return"()"},fe.prototype.getY=function(n){return this._coordinates[n].y},fe.prototype.toCoordinateArray=function(){return this._coordinates},fe.prototype.interfaces_=function(){return[gt,t]},fe.prototype.getClass=function(){return fe},ao.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(fe,ao);var li=function(){},To={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};li.prototype.readResolve=function(){return li.instance()},li.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new fe(n)}if($(arguments[0],gt)){var i=arguments[0];return new fe(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return u>3&&(u=3),u<2?new fe(s):new fe(s,u)}},li.prototype.interfaces_=function(){return[st,t]},li.prototype.getClass=function(){return li},li.instance=function(){return li.instanceObject},To.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},To.instanceObject.get=function(){return new li},Object.defineProperties(li,To);var ua=function(n){function i(){n.call(this),this.map_=new Map}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(s){return this.map_.get(s)||null},i.prototype.put=function(s,u){return this.map_.set(s,u),u},i.prototype.values=function(){for(var s=new Z,u=this.map_.values(),c=u.next();!c.done;)s.add(c.value),c=u.next();return s},i.prototype.entrySet=function(){var s=new tn;return this.map_.entries().forEach(function(u){return s.add(u)}),s},i.prototype.size=function(){return this.map_.size()},i}(Gt),ie=function n(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=n.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof kr){var i=arguments[0];this._modelType=i,i===n.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var s=arguments[0];this._modelType=n.FIXED,this.setScale(s)}else if(arguments[0]instanceof n){var u=arguments[0];this._modelType=u._modelType,this._scale=u._scale}}},Vi={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};ie.prototype.equals=function(n){if(!(n instanceof ie))return!1;var i=n;return this._modelType===i._modelType&&this._scale===i._scale},ie.prototype.compareTo=function(n){var i=n,s=this.getMaximumSignificantDigits(),u=i.getMaximumSignificantDigits();return new lt(s).compareTo(new lt(u))},ie.prototype.getScale=function(){return this._scale},ie.prototype.isFloating=function(){return this._modelType===ie.FLOATING||this._modelType===ie.FLOATING_SINGLE},ie.prototype.getType=function(){return this._modelType},ie.prototype.toString=function(){var n="UNKNOWN";return this._modelType===ie.FLOATING?n="Floating":this._modelType===ie.FLOATING_SINGLE?n="Floating-Single":this._modelType===ie.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n},ie.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var n=arguments[0];return S.isNaN(n)||this._modelType===ie.FLOATING_SINGLE?n:this._modelType===ie.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof I){var i=arguments[0];if(this._modelType===ie.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}},ie.prototype.getMaximumSignificantDigits=function(){var n=16;return this._modelType===ie.FLOATING?n=16:this._modelType===ie.FLOATING_SINGLE?n=6:this._modelType===ie.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n},ie.prototype.setScale=function(n){this._scale=Math.abs(n)},ie.prototype.interfaces_=function(){return[t,N]},ie.prototype.getClass=function(){return ie},ie.mostPrecise=function(n,i){return n.compareTo(i)>=0?n:i},Vi.serialVersionUID.get=function(){return 7777263578777804e3},Vi.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ie,Vi);var kr=function n(i){this._name=i||null,n.nameToTypeMap.put(i,this)},Pr={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};kr.prototype.readResolve=function(){return kr.nameToTypeMap.get(this._name)},kr.prototype.toString=function(){return this._name},kr.prototype.interfaces_=function(){return[t]},kr.prototype.getClass=function(){return kr},Pr.serialVersionUID.get=function(){return-552860263173159e4},Pr.nameToTypeMap.get=function(){return new ua},Object.defineProperties(kr,Pr),ie.Type=kr,ie.FIXED=new kr("FIXED"),ie.FLOATING=new kr("FLOATING"),ie.FLOATING_SINGLE=new kr("FLOATING SINGLE");var ue=function n(){this._precisionModel=new ie,this._SRID=0,this._coordinateSequenceFactory=n.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?$(arguments[0],st)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof ie&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},dl={serialVersionUID:{configurable:!0}};ue.prototype.toGeometry=function(n){return n.isNull()?this.createPoint(null):n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new I(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new I(n.getMinX(),n.getMinY()),new I(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new I(n.getMinX(),n.getMinY()),new I(n.getMinX(),n.getMaxY()),new I(n.getMaxX(),n.getMaxY()),new I(n.getMaxX(),n.getMinY()),new I(n.getMinX(),n.getMinY())]),null)},ue.prototype.createLineString=function(n){return n?n instanceof Array?new zt(this.getCoordinateSequenceFactory().create(n),this):$(n,gt)?new zt(n,this):void 0:new zt(this.getCoordinateSequenceFactory().create([]),this)},ue.prototype.createMultiLineString=function(){if(arguments.length===0)return new W(null,this);if(arguments.length===1){var n=arguments[0];return new W(n,this)}},ue.prototype.buildGeometry=function(n){for(var i=null,s=!1,u=!1,c=n.iterator();c.hasNext();){var m=c.next(),E=m.getClass();i===null&&(i=E),E!==i&&(s=!0),m.isGeometryCollectionOrDerived()&&(u=!0)}if(i===null)return this.createGeometryCollection();if(s||u)return this.createGeometryCollection(ue.toGeometryArray(n));var A=n.iterator().next();if(n.size()>1){if(A instanceof Wt)return this.createMultiPolygon(ue.toPolygonArray(n));if(A instanceof zt)return this.createMultiLineString(ue.toLineStringArray(n));if(A instanceof Kt)return this.createMultiPoint(ue.toPointArray(n));Pt.shouldNeverReachHere("Unhandled class: "+A.getClass().getName())}return A},ue.prototype.createMultiPointFromCoords=function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)},ue.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if($(arguments[0],gt)){var i=arguments[0];return new Kt(i,this)}}},ue.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},ue.prototype.createPolygon=function(){if(arguments.length===0)return new Wt(null,null,this);if(arguments.length===1){if($(arguments[0],gt)){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof Array){var i=arguments[0];return this.createPolygon(this.createLinearRing(i))}if(arguments[0]instanceof an){var s=arguments[0];return this.createPolygon(s,null)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];return new Wt(u,c,this)}},ue.prototype.getSRID=function(){return this._SRID},ue.prototype.createGeometryCollection=function(){if(arguments.length===0)return new gn(null,this);if(arguments.length===1){var n=arguments[0];return new gn(n,this)}},ue.prototype.createGeometry=function(n){return new bn(this).edit(n,{edit:function(){if(arguments.length===2){var i=arguments[0];return this._coordinateSequenceFactory.create(i)}}})},ue.prototype.getPrecisionModel=function(){return this._precisionModel},ue.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if($(arguments[0],gt)){var i=arguments[0];return new an(i,this)}}},ue.prototype.createMultiPolygon=function(){if(arguments.length===0)return new ln(null,this);if(arguments.length===1){var n=arguments[0];return new ln(n,this)}},ue.prototype.createMultiPoint=function(){if(arguments.length===0)return new he(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new he(n,this)}if(arguments[0]instanceof Array){var i=arguments[0];return this.createMultiPoint(i!==null?this.getCoordinateSequenceFactory().create(i):null)}if($(arguments[0],gt)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var u=new Array(s.size()).fill(null),c=0;c<s.size();c++){var m=this.getCoordinateSequenceFactory().create(1,s.getDimension());Nt.copy(s,c,m,0,1),u[c]=this.createPoint(m)}return this.createMultiPoint(u)}}},ue.prototype.interfaces_=function(){return[t]},ue.prototype.getClass=function(){return ue},ue.toMultiPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toGeometryArray=function(n){if(n===null)return null;var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.getDefaultCoordinateSequenceFactory=function(){return li.instance()},ue.toMultiLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toMultiPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toLinearRingArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.createPointFromInternalCoord=function(n,i){return i.getPrecisionModel().makePrecise(n),i.getFactory().createPoint(n)},dl.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(ue,dl);var ml=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],gl=function(n){this.geometryFactory=n||new ue};gl.prototype.read=function(n){var i,s=(i=typeof n=="string"?JSON.parse(n):n).type;if(!Ci[s])throw new Error("Unknown GeoJSON type: "+i.type);return ml.indexOf(s)!==-1?Ci[s].apply(this,[i.coordinates]):s==="GeometryCollection"?Ci[s].apply(this,[i.geometries]):Ci[s].apply(this,[i])},gl.prototype.write=function(n){var i=n.getGeometryType();if(!uo[i])throw new Error("Geometry is not supported");return uo[i].apply(this,[n])};var Ci={Feature:function(n){var i={};for(var s in n)i[s]=n[s];if(n.geometry){var u=n.geometry.type;if(!Ci[u])throw new Error("Unknown GeoJSON type: "+n.type);i.geometry=this.read(n.geometry)}return n.bbox&&(i.bbox=Ci.bbox.apply(this,[n.bbox])),i},FeatureCollection:function(n){var i={};if(n.features){i.features=[];for(var s=0;s<n.features.length;++s)i.features.push(this.read(n.features[s]))}return n.bbox&&(i.bbox=this.parse.bbox.apply(this,[n.bbox])),i},coordinates:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(new I(u[0],u[1]))}return i},bbox:function(n){return this.geometryFactory.createLinearRing([new I(n[0],n[1]),new I(n[2],n[1]),new I(n[2],n[3]),new I(n[0],n[3]),new I(n[0],n[1])])},Point:function(n){var i=new I(n[0],n[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(n){for(var i=[],s=0;s<n.length;++s)i.push(Ci.Point.apply(this,[n[s]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(n){var i=Ci.coordinates.apply(this,[n]);return this.geometryFactory.createLineString(i)},MultiLineString:function(n){for(var i=[],s=0;s<n.length;++s)i.push(Ci.LineString.apply(this,[n[s]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(n){for(var i=Ci.coordinates.apply(this,[n[0]]),s=this.geometryFactory.createLinearRing(i),u=[],c=1;c<n.length;++c){var m=n[c],E=Ci.coordinates.apply(this,[m]),A=this.geometryFactory.createLinearRing(E);u.push(A)}return this.geometryFactory.createPolygon(s,u)},MultiPolygon:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(Ci.Polygon.apply(this,[u]))}return this.geometryFactory.createMultiPolygon(i)},GeometryCollection:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(this.read(u))}return this.geometryFactory.createGeometryCollection(i)}},uo={coordinate:function(n){return[n.x,n.y]},Point:function(n){return{type:"Point",coordinates:uo.coordinate.apply(this,[n.getCoordinate()])}},MultiPoint:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=uo.Point.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPoint",coordinates:i}},LineString:function(n){for(var i=[],s=n.getCoordinates(),u=0;u<s.length;++u){var c=s[u];i.push(uo.coordinate.apply(this,[c]))}return{type:"LineString",coordinates:i}},MultiLineString:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=uo.LineString.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(n){var i=[],s=uo.LineString.apply(this,[n._shell]);i.push(s.coordinates);for(var u=0;u<n._holes.length;++u){var c=n._holes[u],m=uo.LineString.apply(this,[c]);i.push(m.coordinates)}return{type:"Polygon",coordinates:i}},MultiPolygon:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=uo.Polygon.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPolygon",coordinates:i}},GeometryCollection:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=u.getGeometryType();i.push(uo[c].apply(this,[u]))}return{type:"GeometryCollection",geometries:i}}},_h=function(n){this.geometryFactory=n||new ue,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new gl(this.geometryFactory)};_h.prototype.read=function(n){var i=this.parser.read(n);return this.precisionModel.getType()===ie.FIXED&&this.reducePrecision(i),i},_h.prototype.reducePrecision=function(n){var i,s;if(n.coordinate)this.precisionModel.makePrecise(n.coordinate);else if(n.points)for(i=0,s=n.points.length;i<s;i++)this.precisionModel.makePrecise(n.points[i]);else if(n.geometries)for(i=0,s=n.geometries.length;i<s;i++)this.reducePrecision(n.geometries[i])};var Xd=function(){this.parser=new gl(this.geometryFactory)};Xd.prototype.write=function(n){return this.parser.write(n)};var bt=function(){},yl={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};bt.prototype.interfaces_=function(){return[]},bt.prototype.getClass=function(){return bt},bt.opposite=function(n){return n===bt.LEFT?bt.RIGHT:n===bt.RIGHT?bt.LEFT:n},yl.ON.get=function(){return 0},yl.LEFT.get=function(){return 1},yl.RIGHT.get=function(){return 2},Object.defineProperties(bt,yl),(T.prototype=new Error).name="EmptyStackException",(x.prototype=new tt).add=function(n){return this.array_.push(n),!0},x.prototype.get=function(n){if(n<0||n>=this.size())throw new Error;return this.array_[n]},x.prototype.push=function(n){return this.array_.push(n),n},x.prototype.pop=function(n){if(this.array_.length===0)throw new T;return this.array_.pop()},x.prototype.peek=function(){if(this.array_.length===0)throw new T;return this.array_[this.array_.length-1]},x.prototype.empty=function(){return this.array_.length===0},x.prototype.isEmpty=function(){return this.empty()},x.prototype.search=function(n){return this.array_.indexOf(n)},x.prototype.size=function(){return this.array_.length},x.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n};var Pi=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Pi.prototype.getCoordinate=function(){return this._minCoord},Pi.prototype.getRightmostSide=function(n,i){var s=this.getRightmostSideOfSegment(n,i);return s<0&&(s=this.getRightmostSideOfSegment(n,i-1)),s<0&&(this._minCoord=null,this.checkForRightmostCoordinate(n)),s},Pi.prototype.findRightmostEdgeAtVertex=function(){var n=this._minDe.getEdge().getCoordinates();Pt.isTrue(this._minIndex>0&&this._minIndex<n.length,"rightmost point expected to be interior vertex of edge");var i=n[this._minIndex-1],s=n[this._minIndex+1],u=J.computeOrientation(this._minCoord,s,i),c=!1;(i.y<this._minCoord.y&&s.y<this._minCoord.y&&u===J.COUNTERCLOCKWISE||i.y>this._minCoord.y&&s.y>this._minCoord.y&&u===J.CLOCKWISE)&&(c=!0),c&&(this._minIndex=this._minIndex-1)},Pi.prototype.getRightmostSideOfSegment=function(n,i){var s=n.getEdge().getCoordinates();if(i<0||i+1>=s.length||s[i].y===s[i+1].y)return-1;var u=bt.LEFT;return s[i].y<s[i+1].y&&(u=bt.RIGHT),u},Pi.prototype.getEdge=function(){return this._orientedDe},Pi.prototype.checkForRightmostCoordinate=function(n){for(var i=n.getEdge().getCoordinates(),s=0;s<i.length-1;s++)(this._minCoord===null||i[s].x>this._minCoord.x)&&(this._minDe=n,this._minIndex=s,this._minCoord=i[s])},Pi.prototype.findRightmostEdgeAtNode=function(){var n=this._minDe.getNode().getEdges();this._minDe=n.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},Pi.prototype.findEdge=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isForward()&&this.checkForRightmostCoordinate(s)}Pt.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===bt.LEFT&&(this._orientedDe=this._minDe.getSym())},Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi};var lo=function(n){function i(s,u){n.call(this,i.msgWithCoord(s,u)),this.pt=u?new I(u):null,this.name="TopologyException"}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getCoordinate=function(){return this.pt},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.msgWithCoord=function(s,u){return u?s:s+" [ "+u+" ]"},i}(pe),vl=function(){this.array_=[]};vl.prototype.addLast=function(n){this.array_.push(n)},vl.prototype.removeFirst=function(){return this.array_.shift()},vl.prototype.isEmpty=function(){return this.array_.length===0};var mr=function(){this._finder=null,this._dirEdgeList=new Z,this._nodes=new Z,this._rightMostCoord=null,this._env=null,this._finder=new Pi};mr.prototype.clearVisitedEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();)n.next().setVisited(!1)},mr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},mr.prototype.computeNodeDepth=function(n){for(var i=null,s=n.getEdges().iterator();s.hasNext();){var u=s.next();if(u.isVisited()||u.getSym().isVisited()){i=u;break}}if(i===null)throw new lo("unable to find edge to compute depths at "+n.getCoordinate());n.getEdges().computeDepths(i);for(var c=n.getEdges().iterator();c.hasNext();){var m=c.next();m.setVisited(!0),this.copySymDepths(m)}},mr.prototype.computeDepth=function(n){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(bt.RIGHT,n),this.copySymDepths(i),this.computeDepths(i)},mr.prototype.create=function(n){this.addReachable(n),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},mr.prototype.findResultEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();){var i=n.next();i.getDepth(bt.RIGHT)>=1&&i.getDepth(bt.LEFT)<=0&&!i.isInteriorAreaEdge()&&i.setInResult(!0)}},mr.prototype.computeDepths=function(n){var i=new tn,s=new vl,u=n.getNode();for(s.addLast(u),i.add(u),n.setVisited(!0);!s.isEmpty();){var c=s.removeFirst();i.add(c),this.computeNodeDepth(c);for(var m=c.getEdges().iterator();m.hasNext();){var E=m.next().getSym();if(!E.isVisited()){var A=E.getNode();i.contains(A)||(s.addLast(A),i.add(A))}}}},mr.prototype.compareTo=function(n){var i=n;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},mr.prototype.getEnvelope=function(){if(this._env===null){for(var n=new Ct,i=this._dirEdgeList.iterator();i.hasNext();)for(var s=i.next().getEdge().getCoordinates(),u=0;u<s.length-1;u++)n.expandToInclude(s[u]);this._env=n}return this._env},mr.prototype.addReachable=function(n){var i=new x;for(i.add(n);!i.empty();){var s=i.pop();this.add(s,i)}},mr.prototype.copySymDepths=function(n){var i=n.getSym();i.setDepth(bt.LEFT,n.getDepth(bt.RIGHT)),i.setDepth(bt.RIGHT,n.getDepth(bt.LEFT))},mr.prototype.add=function(n,i){n.setVisited(!0),this._nodes.add(n);for(var s=n.getEdges().iterator();s.hasNext();){var u=s.next();this._dirEdgeList.add(u);var c=u.getSym().getNode();c.isVisited()||i.push(c)}},mr.prototype.getNodes=function(){return this._nodes},mr.prototype.getDirectedEdges=function(){return this._dirEdgeList},mr.prototype.interfaces_=function(){return[N]},mr.prototype.getClass=function(){return mr};var dn=function n(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var i=arguments[0];this.init(i.length)}else if(Number.isInteger(arguments[0])){var s=arguments[0];this.init(1),this.location[bt.ON]=s}else if(arguments[0]instanceof n){var u=arguments[0];if(this.init(u.location.length),u!==null)for(var c=0;c<this.location.length;c++)this.location[c]=u.location[c]}}else if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];this.init(3),this.location[bt.ON]=m,this.location[bt.LEFT]=E,this.location[bt.RIGHT]=A}};dn.prototype.setAllLocations=function(n){for(var i=0;i<this.location.length;i++)this.location[i]=n},dn.prototype.isNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==V.NONE)return!1;return!0},dn.prototype.setAllLocationsIfNull=function(n){for(var i=0;i<this.location.length;i++)this.location[i]===V.NONE&&(this.location[i]=n)},dn.prototype.isLine=function(){return this.location.length===1},dn.prototype.merge=function(n){if(n.location.length>this.location.length){var i=new Array(3).fill(null);i[bt.ON]=this.location[bt.ON],i[bt.LEFT]=V.NONE,i[bt.RIGHT]=V.NONE,this.location=i}for(var s=0;s<this.location.length;s++)this.location[s]===V.NONE&&s<n.location.length&&(this.location[s]=n.location[s])},dn.prototype.getLocations=function(){return this.location},dn.prototype.flip=function(){if(this.location.length<=1)return null;var n=this.location[bt.LEFT];this.location[bt.LEFT]=this.location[bt.RIGHT],this.location[bt.RIGHT]=n},dn.prototype.toString=function(){var n=new mt;return this.location.length>1&&n.append(V.toLocationSymbol(this.location[bt.LEFT])),n.append(V.toLocationSymbol(this.location[bt.ON])),this.location.length>1&&n.append(V.toLocationSymbol(this.location[bt.RIGHT])),n.toString()},dn.prototype.setLocations=function(n,i,s){this.location[bt.ON]=n,this.location[bt.LEFT]=i,this.location[bt.RIGHT]=s},dn.prototype.get=function(n){return n<this.location.length?this.location[n]:V.NONE},dn.prototype.isArea=function(){return this.location.length>1},dn.prototype.isAnyNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===V.NONE)return!0;return!1},dn.prototype.setLocation=function(){if(arguments.length===1){var n=arguments[0];this.setLocation(bt.ON,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.location[i]=s}},dn.prototype.init=function(n){this.location=new Array(n).fill(null),this.setAllLocations(V.NONE)},dn.prototype.isEqualOnSide=function(n,i){return this.location[i]===n.location[i]},dn.prototype.allPositionsEqual=function(n){for(var i=0;i<this.location.length;i++)if(this.location[i]!==n)return!1;return!0},dn.prototype.interfaces_=function(){return[]},dn.prototype.getClass=function(){return dn};var on=function n(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var i=arguments[0];this.elt[0]=new dn(i),this.elt[1]=new dn(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.elt[0]=new dn(s.elt[0]),this.elt[1]=new dn(s.elt[1])}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.elt[0]=new dn(V.NONE),this.elt[1]=new dn(V.NONE),this.elt[u].setLocation(c)}else if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];this.elt[0]=new dn(m,E,A),this.elt[1]=new dn(m,E,A)}else if(arguments.length===4){var U=arguments[0],K=arguments[1],pt=arguments[2],dt=arguments[3];this.elt[0]=new dn(V.NONE,V.NONE,V.NONE),this.elt[1]=new dn(V.NONE,V.NONE,V.NONE),this.elt[U].setLocations(K,pt,dt)}};on.prototype.getGeometryCount=function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n},on.prototype.setAllLocations=function(n,i){this.elt[n].setAllLocations(i)},on.prototype.isNull=function(n){return this.elt[n].isNull()},on.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var n=arguments[0];this.setAllLocationsIfNull(0,n),this.setAllLocationsIfNull(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.elt[i].setAllLocationsIfNull(s)}},on.prototype.isLine=function(n){return this.elt[n].isLine()},on.prototype.merge=function(n){for(var i=0;i<2;i++)this.elt[i]===null&&n.elt[i]!==null?this.elt[i]=new dn(n.elt[i]):this.elt[i].merge(n.elt[i])},on.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},on.prototype.getLocation=function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(bt.ON)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.elt[i].get(s)}},on.prototype.toString=function(){var n=new mt;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()},on.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var n=arguments[0];return this.elt[n].isArea()}},on.prototype.isAnyNull=function(n){return this.elt[n].isAnyNull()},on.prototype.setLocation=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setLocation(bt.ON,i)}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this.elt[s].setLocation(u,c)}},on.prototype.isEqualOnSide=function(n,i){return this.elt[0].isEqualOnSide(n.elt[0],i)&&this.elt[1].isEqualOnSide(n.elt[1],i)},on.prototype.allPositionsEqual=function(n,i){return this.elt[n].allPositionsEqual(i)},on.prototype.toLine=function(n){this.elt[n].isArea()&&(this.elt[n]=new dn(this.elt[n].location[0]))},on.prototype.interfaces_=function(){return[]},on.prototype.getClass=function(){return on},on.toLineLabel=function(n){for(var i=new on(V.NONE),s=0;s<2;s++)i.setLocation(s,n.getLocation(s));return i};var Un=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new Z,this._pts=new Z,this._label=new on(V.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new Z,this._geometryFactory=null;var n=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(n),this.computeRing()};Un.prototype.computeRing=function(){if(this._ring!==null)return null;for(var n=new Array(this._pts.size()).fill(null),i=0;i<this._pts.size();i++)n[i]=this._pts.get(i);this._ring=this._geometryFactory.createLinearRing(n),this._isHole=J.isCCW(this._ring.getCoordinates())},Un.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},Un.prototype.computePoints=function(n){this._startDe=n;var i=n,s=!0;do{if(i===null)throw new lo("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new lo("Directed Edge visited twice during ring-building at "+i.getCoordinate());this._edges.add(i);var u=i.getLabel();Pt.isTrue(u.isArea()),this.mergeLabel(u),this.addPoints(i.getEdge(),i.isForward(),s),s=!1,this.setEdgeRing(i,this),i=this.getNext(i)}while(i!==this._startDe)},Un.prototype.getLinearRing=function(){return this._ring},Un.prototype.getCoordinate=function(n){return this._pts.get(n)},Un.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var n=this._startDe;do{var i=n.getNode().getEdges().getOutgoingDegree(this);i>this._maxNodeDegree&&(this._maxNodeDegree=i),n=this.getNext(n)}while(n!==this._startDe);this._maxNodeDegree*=2},Un.prototype.addPoints=function(n,i,s){var u=n.getCoordinates();if(i){var c=1;s&&(c=0);for(var m=c;m<u.length;m++)this._pts.add(u[m])}else{var E=u.length-2;s&&(E=u.length-1);for(var A=E;A>=0;A--)this._pts.add(u[A])}},Un.prototype.isHole=function(){return this._isHole},Un.prototype.setInResult=function(){var n=this._startDe;do n.getEdge().setInResult(!0),n=n.getNext();while(n!==this._startDe)},Un.prototype.containsPoint=function(n){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(n)||!J.isPointInRing(n,i.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();)if(s.next().containsPoint(n))return!1;return!0},Un.prototype.addHole=function(n){this._holes.add(n)},Un.prototype.isShell=function(){return this._shell===null},Un.prototype.getLabel=function(){return this._label},Un.prototype.getEdges=function(){return this._edges},Un.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Un.prototype.getShell=function(){return this._shell},Un.prototype.mergeLabel=function(){if(arguments.length===1){var n=arguments[0];this.mergeLabel(n,0),this.mergeLabel(n,1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=i.getLocation(s,bt.RIGHT);if(u===V.NONE)return null;if(this._label.getLocation(s)===V.NONE)return this._label.setLocation(s,u),null}},Un.prototype.setShell=function(n){this._shell=n,n!==null&&n.addHole(this)},Un.prototype.toPolygon=function(n){for(var i=new Array(this._holes.size()).fill(null),s=0;s<this._holes.size();s++)i[s]=this._holes.get(s).getLinearRing();return n.createPolygon(this.getLinearRing(),i)},Un.prototype.interfaces_=function(){return[]},Un.prototype.getClass=function(){return Un};var G1=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.setEdgeRing=function(s,u){s.setMinEdgeRing(u)},i.prototype.getNext=function(s){return s.getNextMin()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Un),V1=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildMinimalRings=function(){var s=new Z,u=this._startDe;do{if(u.getMinEdgeRing()===null){var c=new G1(u,this._geometryFactory);s.add(c)}u=u.getNext()}while(u!==this._startDe);return s},i.prototype.setEdgeRing=function(s,u){s.setEdgeRing(u)},i.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var s=this._startDe;do s.getNode().getEdges().linkMinimalDirectedEdges(this),s=s.getNext();while(s!==this._startDe)},i.prototype.getNext=function(s){return s.getNext()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Un),Jr=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._label=n}}};Jr.prototype.setVisited=function(n){this._isVisited=n},Jr.prototype.setInResult=function(n){this._isInResult=n},Jr.prototype.isCovered=function(){return this._isCovered},Jr.prototype.isCoveredSet=function(){return this._isCoveredSet},Jr.prototype.setLabel=function(n){this._label=n},Jr.prototype.getLabel=function(){return this._label},Jr.prototype.setCovered=function(n){this._isCovered=n,this._isCoveredSet=!0},Jr.prototype.updateIM=function(n){Pt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(n)},Jr.prototype.isInResult=function(){return this._isInResult},Jr.prototype.isVisited=function(){return this._isVisited},Jr.prototype.interfaces_=function(){return[]},Jr.prototype.getClass=function(){return Jr};var _l=function(n){function i(){n.call(this),this._coord=null,this._edges=null;var s=arguments[0],u=arguments[1];this._coord=s,this._edges=u,this._label=new on(0,V.NONE)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isIncidentEdgeInResult=function(){for(var s=this.getEdges().getEdges().iterator();s.hasNext();)if(s.next().getEdge().isInResult())return!0;return!1},i.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},i.prototype.getCoordinate=function(){return this._coord},i.prototype.print=function(s){s.println("node "+this._coord+" lbl: "+this._label)},i.prototype.computeIM=function(s){},i.prototype.computeMergedLocation=function(s,u){var c=V.NONE;if(c=this._label.getLocation(u),!s.isNull(u)){var m=s.getLocation(u);c!==V.BOUNDARY&&(c=m)}return c},i.prototype.setLabel=function(){if(arguments.length!==2)return n.prototype.setLabel.apply(this,arguments);var s=arguments[0],u=arguments[1];this._label===null?this._label=new on(s,u):this._label.setLocation(s,u)},i.prototype.getEdges=function(){return this._edges},i.prototype.mergeLabel=function(){if(arguments[0]instanceof i){var s=arguments[0];this.mergeLabel(s._label)}else if(arguments[0]instanceof on)for(var u=arguments[0],c=0;c<2;c++){var m=this.computeMergedLocation(u,c);this._label.getLocation(c)===V.NONE&&this._label.setLocation(c,m)}},i.prototype.add=function(s){this._edges.insert(s),s.setNode(this)},i.prototype.setLabelBoundary=function(s){if(this._label===null)return null;var u=V.NONE;this._label!==null&&(u=this._label.getLocation(s));var c=null;switch(u){case V.BOUNDARY:c=V.INTERIOR;break;case V.INTERIOR:default:c=V.BOUNDARY}this._label.setLocation(s,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Jr),Ii=function(){this.nodeMap=new _,this.nodeFact=null;var n=arguments[0];this.nodeFact=n};Ii.prototype.find=function(n){return this.nodeMap.get(n)},Ii.prototype.addNode=function(){if(arguments[0]instanceof I){var n=arguments[0],i=this.nodeMap.get(n);return i===null&&(i=this.nodeFact.createNode(n),this.nodeMap.put(n,i)),i}if(arguments[0]instanceof _l){var s=arguments[0],u=this.nodeMap.get(s.getCoordinate());return u===null?(this.nodeMap.put(s.getCoordinate(),s),s):(u.mergeLabel(s),u)}},Ii.prototype.print=function(n){for(var i=this.iterator();i.hasNext();)i.next().print(n)},Ii.prototype.iterator=function(){return this.nodeMap.values().iterator()},Ii.prototype.values=function(){return this.nodeMap.values()},Ii.prototype.getBoundaryNodes=function(n){for(var i=new Z,s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().getLocation(n)===V.BOUNDARY&&i.add(u)}return i},Ii.prototype.add=function(n){var i=n.getCoordinate();this.addNode(i).add(n)},Ii.prototype.interfaces_=function(){return[]},Ii.prototype.getClass=function(){return Ii};var cn=function(){},_u={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};cn.prototype.interfaces_=function(){return[]},cn.prototype.getClass=function(){return cn},cn.isNorthern=function(n){return n===cn.NE||n===cn.NW},cn.isOpposite=function(n,i){return n===i?!1:(n-i+4)%4===2},cn.commonHalfPlane=function(n,i){if(n===i)return n;if((n-i+4)%4===2)return-1;var s=n<i?n:i;return s===0&&(n>i?n:i)===3?3:s},cn.isInHalfPlane=function(n,i){return i===cn.SE?n===cn.SE||n===cn.SW:n===i||n===i+1},cn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new P("Cannot compute the quadrant for point ( "+n+", "+i+" )");return n>=0?i>=0?cn.NE:cn.SE:i>=0?cn.NW:cn.SW}if(arguments[0]instanceof I&&arguments[1]instanceof I){var s=arguments[0],u=arguments[1];if(u.x===s.x&&u.y===s.y)throw new P("Cannot compute the quadrant for two identical points "+s);return u.x>=s.x?u.y>=s.y?cn.NE:cn.SE:u.y>=s.y?cn.NW:cn.SW}},_u.NE.get=function(){return 0},_u.NW.get=function(){return 1},_u.SW.get=function(){return 2},_u.SE.get=function(){return 3},Object.defineProperties(cn,_u);var sr=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2];this._edge=i,this.init(s,u),this._label=null}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];this._edge=c,this.init(m,E),this._label=A}};sr.prototype.compareDirection=function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:J.computeOrientation(n._p0,n._p1,this._p1)},sr.prototype.getDy=function(){return this._dy},sr.prototype.getCoordinate=function(){return this._p0},sr.prototype.setNode=function(n){this._node=n},sr.prototype.print=function(n){var i=Math.atan2(this._dy,this._dx),s=this.getClass().getName(),u=s.lastIndexOf("."),c=s.substring(u+1);n.print(" "+c+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)},sr.prototype.compareTo=function(n){var i=n;return this.compareDirection(i)},sr.prototype.getDirectedCoordinate=function(){return this._p1},sr.prototype.getDx=function(){return this._dx},sr.prototype.getLabel=function(){return this._label},sr.prototype.getEdge=function(){return this._edge},sr.prototype.getQuadrant=function(){return this._quadrant},sr.prototype.getNode=function(){return this._node},sr.prototype.toString=function(){var n=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),s=i.lastIndexOf(".");return" "+i.substring(s+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label},sr.prototype.computeLabel=function(n){},sr.prototype.init=function(n,i){this._p0=n,this._p1=i,this._dx=i.x-n.x,this._dy=i.y-n.y,this._quadrant=cn.quadrant(this._dx,this._dy),Pt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},sr.prototype.interfaces_=function(){return[N]},sr.prototype.getClass=function(){return sr};var xh=function(n){function i(){var s=arguments[0],u=arguments[1];if(n.call(this,s),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=u,u)this.init(s.getCoordinate(0),s.getCoordinate(1));else{var c=s.getNumPoints()-1;this.init(s.getCoordinate(c),s.getCoordinate(c-1))}this.computeDirectedLabel()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getNextMin=function(){return this._nextMin},i.prototype.getDepth=function(s){return this._depth[s]},i.prototype.setVisited=function(s){this._isVisited=s},i.prototype.computeDirectedLabel=function(){this._label=new on(this._edge.getLabel()),this._isForward||this._label.flip()},i.prototype.getNext=function(){return this._next},i.prototype.setDepth=function(s,u){if(this._depth[s]!==-999&&this._depth[s]!==u)throw new lo("assigned depths do not match",this.getCoordinate());this._depth[s]=u},i.prototype.isInteriorAreaEdge=function(){for(var s=!0,u=0;u<2;u++)this._label.isArea(u)&&this._label.getLocation(u,bt.LEFT)===V.INTERIOR&&this._label.getLocation(u,bt.RIGHT)===V.INTERIOR||(s=!1);return s},i.prototype.setNextMin=function(s){this._nextMin=s},i.prototype.print=function(s){n.prototype.print.call(this,s),s.print(" "+this._depth[bt.LEFT]+"/"+this._depth[bt.RIGHT]),s.print(" ("+this.getDepthDelta()+")"),this._isInResult&&s.print(" inResult")},i.prototype.setMinEdgeRing=function(s){this._minEdgeRing=s},i.prototype.isLineEdge=function(){var s=this._label.isLine(0)||this._label.isLine(1),u=!this._label.isArea(0)||this._label.allPositionsEqual(0,V.EXTERIOR),c=!this._label.isArea(1)||this._label.allPositionsEqual(1,V.EXTERIOR);return s&&u&&c},i.prototype.setEdgeRing=function(s){this._edgeRing=s},i.prototype.getMinEdgeRing=function(){return this._minEdgeRing},i.prototype.getDepthDelta=function(){var s=this._edge.getDepthDelta();return this._isForward||(s=-s),s},i.prototype.setInResult=function(s){this._isInResult=s},i.prototype.getSym=function(){return this._sym},i.prototype.isForward=function(){return this._isForward},i.prototype.getEdge=function(){return this._edge},i.prototype.printEdge=function(s){this.print(s),s.print(" "),this._isForward?this._edge.print(s):this._edge.printReverse(s)},i.prototype.setSym=function(s){this._sym=s},i.prototype.setVisitedEdge=function(s){this.setVisited(s),this._sym.setVisited(s)},i.prototype.setEdgeDepths=function(s,u){var c=this.getEdge().getDepthDelta();this._isForward||(c=-c);var m=1;s===bt.LEFT&&(m=-1);var E=bt.opposite(s),A=u+c*m;this.setDepth(s,u),this.setDepth(E,A)},i.prototype.getEdgeRing=function(){return this._edgeRing},i.prototype.isInResult=function(){return this._isInResult},i.prototype.setNext=function(s){this._next=s},i.prototype.isVisited=function(){return this._isVisited},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.depthFactor=function(s,u){return s===V.EXTERIOR&&u===V.INTERIOR?1:s===V.INTERIOR&&u===V.EXTERIOR?-1:0},i}(sr),la=function(){};la.prototype.createNode=function(n){return new _l(n,null)},la.prototype.interfaces_=function(){return[]},la.prototype.getClass=function(){return la};var Tn=function(){if(this._edges=new Z,this._nodes=null,this._edgeEndList=new Z,arguments.length===0)this._nodes=new Ii(new la);else if(arguments.length===1){var n=arguments[0];this._nodes=new Ii(n)}};Tn.prototype.printEdges=function(n){n.println("Edges:");for(var i=0;i<this._edges.size();i++){n.println("edge "+i+":");var s=this._edges.get(i);s.print(n),s.eiList.print(n)}},Tn.prototype.find=function(n){return this._nodes.find(n)},Tn.prototype.addNode=function(){if(arguments[0]instanceof _l){var n=arguments[0];return this._nodes.addNode(n)}if(arguments[0]instanceof I){var i=arguments[0];return this._nodes.addNode(i)}},Tn.prototype.getNodeIterator=function(){return this._nodes.iterator()},Tn.prototype.linkResultDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()},Tn.prototype.debugPrintln=function(n){Ft.out.println(n)},Tn.prototype.isBoundaryNode=function(n,i){var s=this._nodes.find(i);if(s===null)return!1;var u=s.getLabel();return u!==null&&u.getLocation(n)===V.BOUNDARY},Tn.prototype.linkAllDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkAllDirectedEdges()},Tn.prototype.matchInSameDirection=function(n,i,s,u){return!!n.equals(s)&&J.computeOrientation(n,i,u)===J.COLLINEAR&&cn.quadrant(n,i)===cn.quadrant(s,u)},Tn.prototype.getEdgeEnds=function(){return this._edgeEndList},Tn.prototype.debugPrint=function(n){Ft.out.print(n)},Tn.prototype.getEdgeIterator=function(){return this._edges.iterator()},Tn.prototype.findEdgeInSameDirection=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(this.matchInSameDirection(n,i,c[0],c[1])||this.matchInSameDirection(n,i,c[c.length-1],c[c.length-2]))return u}return null},Tn.prototype.insertEdge=function(n){this._edges.add(n)},Tn.prototype.findEdgeEnd=function(n){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var s=i.next();if(s.getEdge()===n)return s}return null},Tn.prototype.addEdges=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();this._edges.add(s);var u=new xh(s,!0),c=new xh(s,!1);u.setSym(c),c.setSym(u),this.add(u),this.add(c)}},Tn.prototype.add=function(n){this._nodes.add(n),this._edgeEndList.add(n)},Tn.prototype.getNodes=function(){return this._nodes.values()},Tn.prototype.findEdge=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(n.equals(c[0])&&i.equals(c[1]))return u}return null},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn},Tn.linkResultDirectedEdges=function(n){for(var i=n.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var Gr=function(){this._geometryFactory=null,this._shellList=new Z;var n=arguments[0];this._geometryFactory=n};Gr.prototype.sortShellsAndHoles=function(n,i,s){for(var u=n.iterator();u.hasNext();){var c=u.next();c.isHole()?s.add(c):i.add(c)}},Gr.prototype.computePolygons=function(n){for(var i=new Z,s=n.iterator();s.hasNext();){var u=s.next().toPolygon(this._geometryFactory);i.add(u)}return i},Gr.prototype.placeFreeHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();if(u.getShell()===null){var c=this.findEdgeRingContaining(u,n);if(c===null)throw new lo("unable to assign hole to a shell",u.getCoordinate(0));u.setShell(c)}}},Gr.prototype.buildMinimalEdgeRings=function(n,i,s){for(var u=new Z,c=n.iterator();c.hasNext();){var m=c.next();if(m.getMaxNodeDegree()>2){m.linkDirectedEdgesForMinimalEdgeRings();var E=m.buildMinimalRings(),A=this.findShell(E);A!==null?(this.placePolygonHoles(A,E),i.add(A)):s.addAll(E)}else u.add(m)}return u},Gr.prototype.containsPoint=function(n){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(n))return!0;return!1},Gr.prototype.buildMaximalEdgeRings=function(n){for(var i=new Z,s=n.iterator();s.hasNext();){var u=s.next();if(u.isInResult()&&u.getLabel().isArea()&&u.getEdgeRing()===null){var c=new V1(u,this._geometryFactory);i.add(c),c.setInResult()}}return i},Gr.prototype.placePolygonHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();u.isHole()&&u.setShell(n)}},Gr.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Gr.prototype.findEdgeRingContaining=function(n,i){for(var s=n.getLinearRing(),u=s.getEnvelopeInternal(),c=s.getCoordinateN(0),m=null,E=null,A=i.iterator();A.hasNext();){var U=A.next(),K=U.getLinearRing(),pt=K.getEnvelopeInternal();m!==null&&(E=m.getLinearRing().getEnvelopeInternal());var dt=!1;pt.contains(u)&&J.isPointInRing(c,K.getCoordinates())&&(dt=!0),dt&&(m===null||E.contains(pt))&&(m=U)}return m},Gr.prototype.findShell=function(n){for(var i=0,s=null,u=n.iterator();u.hasNext();){var c=u.next();c.isHole()||(s=c,i++)}return Pt.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),s},Gr.prototype.add=function(){if(arguments.length===1){var n=arguments[0];this.add(n.getEdgeEnds(),n.getNodes())}else if(arguments.length===2){var i=arguments[0],s=arguments[1];Tn.linkResultDirectedEdges(s);var u=this.buildMaximalEdgeRings(i),c=new Z,m=this.buildMinimalEdgeRings(u,this._shellList,c);this.sortShellsAndHoles(m,this._shellList,c),this.placeFreeHoles(this._shellList,c)}},Gr.prototype.interfaces_=function(){return[]},Gr.prototype.getClass=function(){return Gr};var ca=function(){};ca.prototype.getBounds=function(){},ca.prototype.interfaces_=function(){return[]},ca.prototype.getClass=function(){return ca};var vi=function(){this._bounds=null,this._item=null;var n=arguments[0],i=arguments[1];this._bounds=n,this._item=i};vi.prototype.getItem=function(){return this._item},vi.prototype.getBounds=function(){return this._bounds},vi.prototype.interfaces_=function(){return[ca,t]},vi.prototype.getClass=function(){return vi};var co=function(){this._size=null,this._items=null,this._size=0,this._items=new Z,this._items.add(null)};co.prototype.poll=function(){if(this.isEmpty())return null;var n=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),n},co.prototype.size=function(){return this._size},co.prototype.reorder=function(n){for(var i=null,s=this._items.get(n);2*n<=this._size&&((i=2*n)!==this._size&&this._items.get(i+1).compareTo(this._items.get(i))<0&&i++,this._items.get(i).compareTo(s)<0);n=i)this._items.set(n,this._items.get(i));this._items.set(n,s)},co.prototype.clear=function(){this._size=0,this._items.clear()},co.prototype.isEmpty=function(){return this._size===0},co.prototype.add=function(n){this._items.add(null),this._size+=1;var i=this._size;for(this._items.set(0,n);n.compareTo(this._items.get(Math.trunc(i/2)))<0;i/=2)this._items.set(i,this._items.get(Math.trunc(i/2)));this._items.set(i,n)},co.prototype.interfaces_=function(){return[]},co.prototype.getClass=function(){return co};var Ao=function(){};Ao.prototype.visitItem=function(n){},Ao.prototype.interfaces_=function(){return[]},Ao.prototype.getClass=function(){return Ao};var Ps=function(){};Ps.prototype.insert=function(n,i){},Ps.prototype.remove=function(n,i){},Ps.prototype.query=function(){},Ps.prototype.interfaces_=function(){return[]},Ps.prototype.getClass=function(){return Ps};var Hn=function(){if(this._childBoundables=new Z,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._level=n}}},Yd={serialVersionUID:{configurable:!0}};Hn.prototype.getLevel=function(){return this._level},Hn.prototype.size=function(){return this._childBoundables.size()},Hn.prototype.getChildBoundables=function(){return this._childBoundables},Hn.prototype.addChildBoundable=function(n){Pt.isTrue(this._bounds===null),this._childBoundables.add(n)},Hn.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Hn.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Hn.prototype.interfaces_=function(){return[ca,t]},Hn.prototype.getClass=function(){return Hn},Yd.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Hn,Yd);var _i=function(){};_i.reverseOrder=function(){return{compare:function(n,i){return i.compareTo(n)}}},_i.min=function(n){return _i.sort(n),n.get(0)},_i.sort=function(n,i){var s=n.toArray();i?xn.sort(s,i):xn.sort(s);for(var u=n.iterator(),c=0,m=s.length;c<m;c++)u.next(),u.set(s[c])},_i.singletonList=function(n){var i=new Z;return i.add(n),i};var Bn=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var n=arguments[0],i=arguments[1],s=arguments[2];this._boundable1=n,this._boundable2=i,this._itemDistance=s,this._distance=this.distance()};Bn.prototype.expandToQueue=function(n,i){var s=Bn.isComposite(this._boundable1),u=Bn.isComposite(this._boundable2);if(s&&u)return Bn.area(this._boundable1)>Bn.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,n,i),null):(this.expand(this._boundable2,this._boundable1,n,i),null);if(s)return this.expand(this._boundable1,this._boundable2,n,i),null;if(u)return this.expand(this._boundable2,this._boundable1,n,i),null;throw new P("neither boundable is composite")},Bn.prototype.isLeaves=function(){return!(Bn.isComposite(this._boundable1)||Bn.isComposite(this._boundable2))},Bn.prototype.compareTo=function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0},Bn.prototype.expand=function(n,i,s,u){for(var c=n.getChildBoundables().iterator();c.hasNext();){var m=c.next(),E=new Bn(m,i,this._itemDistance);E.getDistance()<u&&s.add(E)}},Bn.prototype.getBoundable=function(n){return n===0?this._boundable1:this._boundable2},Bn.prototype.getDistance=function(){return this._distance},Bn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Bn.prototype.interfaces_=function(){return[N]},Bn.prototype.getClass=function(){return Bn},Bn.area=function(n){return n.getBounds().getArea()},Bn.isComposite=function(n){return n instanceof Hn};var Jn=function n(){if(this._root=null,this._built=!1,this._itemBoundables=new Z,this._nodeCapacity=null,arguments.length===0){var i=n.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var s=arguments[0];Pt.isTrue(s>1,"Node capacity must be greater than 1"),this._nodeCapacity=s}},xl={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Jn.prototype.getNodeCapacity=function(){return this._nodeCapacity},Jn.prototype.lastNode=function(n){return n.get(n.size()-1)},Jn.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof Hn?n+=this.size(s):s instanceof vi&&(n+=1)}return n}},Jn.prototype.removeItem=function(n,i){for(var s=null,u=n.getChildBoundables().iterator();u.hasNext();){var c=u.next();c instanceof vi&&c.getItem()===i&&(s=c)}return s!==null&&(n.getChildBoundables().remove(s),!0)},Jn.prototype.itemsTree=function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new Z:n}if(arguments.length===1){for(var i=arguments[0],s=new Z,u=i.getChildBoundables().iterator();u.hasNext();){var c=u.next();if(c instanceof Hn){var m=this.itemsTree(c);m!==null&&s.add(m)}else c instanceof vi?s.add(c.getItem()):Pt.shouldNeverReachHere()}return s.size()<=0?null:s}},Jn.prototype.insert=function(n,i){Pt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new vi(n,i))},Jn.prototype.boundablesAtLevel=function(){if(arguments.length===1){var n=arguments[0],i=new Z;return this.boundablesAtLevel(n,this._root,i),i}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];if(Pt.isTrue(s>-2),u.getLevel()===s)return c.add(u),null;for(var m=u.getChildBoundables().iterator();m.hasNext();){var E=m.next();E instanceof Hn?this.boundablesAtLevel(s,E,c):(Pt.isTrue(E instanceof vi),s===-1&&c.add(E))}return null}},Jn.prototype.query=function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new Z;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i),i}if(arguments.length===2){var s=arguments[0],u=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,u)}else if(arguments.length===3){if($(arguments[2],Ao)&&arguments[0]instanceof Object&&arguments[1]instanceof Hn)for(var c=arguments[0],m=arguments[1],E=arguments[2],A=m.getChildBoundables(),U=0;U<A.size();U++){var K=A.get(U);this.getIntersectsOp().intersects(K.getBounds(),c)&&(K instanceof Hn?this.query(c,K,E):K instanceof vi?E.visitItem(K.getItem()):Pt.shouldNeverReachHere())}else if($(arguments[2],tt)&&arguments[0]instanceof Object&&arguments[1]instanceof Hn)for(var pt=arguments[0],dt=arguments[1],Rt=arguments[2],Ot=dt.getChildBoundables(),Vt=0;Vt<Ot.size();Vt++){var jt=Ot.get(Vt);this.getIntersectsOp().intersects(jt.getBounds(),pt)&&(jt instanceof Hn?this.query(pt,jt,Rt):jt instanceof vi?Rt.add(jt.getItem()):Pt.shouldNeverReachHere())}}},Jn.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},Jn.prototype.getRoot=function(){return this.build(),this._root},Jn.prototype.remove=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,i)}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=this.removeItem(u,c);if(m)return!0;for(var E=null,A=u.getChildBoundables().iterator();A.hasNext();){var U=A.next();if(this.getIntersectsOp().intersects(U.getBounds(),s)&&U instanceof Hn&&(m=this.remove(s,U,c))){E=U;break}}return E!==null&&E.getChildBoundables().isEmpty()&&u.getChildBoundables().remove(E),m}},Jn.prototype.createHigherLevels=function(n,i){Pt.isTrue(!n.isEmpty());var s=this.createParentBoundables(n,i+1);return s.size()===1?s.get(0):this.createHigherLevels(s,i+1)},Jn.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();if(s instanceof Hn){var u=this.depth(s);u>n&&(n=u)}}return n+1}},Jn.prototype.createParentBoundables=function(n,i){Pt.isTrue(!n.isEmpty());var s=new Z;s.add(this.createNode(i));var u=new Z(n);_i.sort(u,this.getComparator());for(var c=u.iterator();c.hasNext();){var m=c.next();this.lastNode(s).getChildBoundables().size()===this.getNodeCapacity()&&s.add(this.createNode(i)),this.lastNode(s).addChildBoundable(m)}return s},Jn.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Jn.prototype.interfaces_=function(){return[t]},Jn.prototype.getClass=function(){return Jn},Jn.compareDoubles=function(n,i){return n>i?1:n<i?-1:0},xl.IntersectsOp.get=function(){return H1},xl.serialVersionUID.get=function(){return-3886435814360241e3},xl.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Jn,xl);var H1=function(){},ha=function(){};ha.prototype.distance=function(n,i){},ha.prototype.interfaces_=function(){return[]},ha.prototype.getClass=function(){return ha};var $d=function(n){function i(u){u=u||i.DEFAULT_NODE_CAPACITY,n.call(this,u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return i.prototype.createParentBoundablesFromVerticalSlices=function(u,c){Pt.isTrue(u.length>0);for(var m=new Z,E=0;E<u.length;E++)m.addAll(this.createParentBoundablesFromVerticalSlice(u[E],c));return m},i.prototype.createNode=function(u){return new Zd(u)},i.prototype.size=function(){return arguments.length===0?n.prototype.size.call(this):n.prototype.size.apply(this,arguments)},i.prototype.insert=function(){if(arguments.length!==2)return n.prototype.insert.apply(this,arguments);var u=arguments[0],c=arguments[1];if(u.isNull())return null;n.prototype.insert.call(this,u,c)},i.prototype.getIntersectsOp=function(){return i.intersectsOp},i.prototype.verticalSlices=function(u,c){for(var m=Math.trunc(Math.ceil(u.size()/c)),E=new Array(c).fill(null),A=u.iterator(),U=0;U<c;U++){E[U]=new Z;for(var K=0;A.hasNext()&&K<m;){var pt=A.next();E[U].add(pt),K++}}return E},i.prototype.query=function(){if(arguments.length===1){var u=arguments[0];return n.prototype.query.call(this,u)}if(arguments.length===2){var c=arguments[0],m=arguments[1];n.prototype.query.call(this,c,m)}else if(arguments.length===3){if($(arguments[2],Ao)&&arguments[0]instanceof Object&&arguments[1]instanceof Hn){var E=arguments[0],A=arguments[1],U=arguments[2];n.prototype.query.call(this,E,A,U)}else if($(arguments[2],tt)&&arguments[0]instanceof Object&&arguments[1]instanceof Hn){var K=arguments[0],pt=arguments[1],dt=arguments[2];n.prototype.query.call(this,K,pt,dt)}}},i.prototype.getComparator=function(){return i.yComparator},i.prototype.createParentBoundablesFromVerticalSlice=function(u,c){return n.prototype.createParentBoundables.call(this,u,c)},i.prototype.remove=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return n.prototype.remove.call(this,u,c)}return n.prototype.remove.apply(this,arguments)},i.prototype.depth=function(){return arguments.length===0?n.prototype.depth.call(this):n.prototype.depth.apply(this,arguments)},i.prototype.createParentBoundables=function(u,c){Pt.isTrue(!u.isEmpty());var m=Math.trunc(Math.ceil(u.size()/this.getNodeCapacity())),E=new Z(u);_i.sort(E,i.xComparator);var A=this.verticalSlices(E,Math.trunc(Math.ceil(Math.sqrt(m))));return this.createParentBoundablesFromVerticalSlices(A,c)},i.prototype.nearestNeighbour=function(){if(arguments.length===1){if($(arguments[0],ha)){var u=arguments[0],c=new Bn(this.getRoot(),this.getRoot(),u);return this.nearestNeighbour(c)}if(arguments[0]instanceof Bn){var m=arguments[0];return this.nearestNeighbour(m,S.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&$(arguments[1],ha)){var E=arguments[0],A=arguments[1],U=new Bn(this.getRoot(),E.getRoot(),A);return this.nearestNeighbour(U)}if(arguments[0]instanceof Bn&&typeof arguments[1]=="number"){var K=arguments[0],pt=arguments[1],dt=null,Rt=new co;for(Rt.add(K);!Rt.isEmpty()&&pt>0;){var Ot=Rt.poll(),Vt=Ot.getDistance();if(Vt>=pt)break;Ot.isLeaves()?(pt=Vt,dt=Ot):Ot.expandToQueue(Rt,pt)}return[dt.getBoundable(0).getItem(),dt.getBoundable(1).getItem()]}}else if(arguments.length===3){var jt=arguments[0],sn=arguments[1],kn=arguments[2],Mr=new vi(jt,sn),Ki=new Bn(this.getRoot(),Mr,kn);return this.nearestNeighbour(Ki)[0]}},i.prototype.interfaces_=function(){return[Ps,t]},i.prototype.getClass=function(){return i},i.centreX=function(u){return i.avg(u.getMinX(),u.getMaxX())},i.avg=function(u,c){return(u+c)/2},i.centreY=function(u){return i.avg(u.getMinY(),u.getMaxY())},s.STRtreeNode.get=function(){return Zd},s.serialVersionUID.get=function(){return 0x39920f7d5f261e0},s.xComparator.get=function(){return{interfaces_:function(){return[B]},compare:function(u,c){return n.compareDoubles(i.centreX(u.getBounds()),i.centreX(c.getBounds()))}}},s.yComparator.get=function(){return{interfaces_:function(){return[B]},compare:function(u,c){return n.compareDoubles(i.centreY(u.getBounds()),i.centreY(c.getBounds()))}}},s.intersectsOp.get=function(){return{interfaces_:function(){return[n.IntersectsOp]},intersects:function(u,c){return u.intersects(c)}}},s.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(i,s),i}(Jn),Zd=function(n){function i(){var s=arguments[0];n.call(this,s)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.computeBounds=function(){for(var s=null,u=this.getChildBoundables().iterator();u.hasNext();){var c=u.next();s===null?s=new Ct(c.getBounds()):s.expandToInclude(c.getBounds())}return s},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Hn),Ir=function(){};Ir.prototype.interfaces_=function(){return[]},Ir.prototype.getClass=function(){return Ir},Ir.relativeSign=function(n,i){return n<i?-1:n>i?1:0},Ir.compare=function(n,i,s){if(i.equals2D(s))return 0;var u=Ir.relativeSign(i.x,s.x),c=Ir.relativeSign(i.y,s.y);switch(n){case 0:return Ir.compareValue(u,c);case 1:return Ir.compareValue(c,u);case 2:return Ir.compareValue(c,-u);case 3:return Ir.compareValue(-u,c);case 4:return Ir.compareValue(-u,-c);case 5:return Ir.compareValue(-c,-u);case 6:return Ir.compareValue(-c,u);case 7:return Ir.compareValue(u,-c)}return Pt.shouldNeverReachHere("invalid octant value"),0},Ir.compareValue=function(n,i){return n<0?-1:n>0?1:i<0?-1:i>0?1:0};var Co=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._segString=n,this.coord=new I(i),this.segmentIndex=s,this._segmentOctant=u,this._isInterior=!i.equals2D(n.getCoordinate(s))};Co.prototype.getCoordinate=function(){return this.coord},Co.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex)},Co.prototype.compareTo=function(n){var i=n;return this.segmentIndex<i.segmentIndex?-1:this.segmentIndex>i.segmentIndex?1:this.coord.equals2D(i.coord)?0:Ir.compare(this._segmentOctant,this.coord,i.coord)},Co.prototype.isEndPoint=function(n){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===n},Co.prototype.isInterior=function(){return this._isInterior},Co.prototype.interfaces_=function(){return[N]},Co.prototype.getClass=function(){return Co};var gr=function(){this._nodeMap=new _,this._edge=null;var n=arguments[0];this._edge=n};gr.prototype.getSplitCoordinates=function(){var n=new ot;this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next();this.addEdgeCoordinates(s,u,n),s=u}return n.toCoordinateArray()},gr.prototype.addCollapsedNodes=function(){var n=new Z;this.findCollapsesFromInsertedNodes(n),this.findCollapsesFromExistingVertices(n);for(var i=n.iterator();i.hasNext();){var s=i.next().intValue();this.add(this._edge.getCoordinate(s),s)}},gr.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},gr.prototype.findCollapsesFromExistingVertices=function(n){for(var i=0;i<this._edge.size()-2;i++){var s=this._edge.getCoordinate(i),u=this._edge.getCoordinate(i+2);s.equals2D(u)&&n.add(new lt(i+1))}},gr.prototype.addEdgeCoordinates=function(n,i,s){var u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);s.add(new I(n.coord),!1);for(var m=n.segmentIndex+1;m<=i.segmentIndex;m++)s.add(this._edge.getCoordinate(m));c&&s.add(new I(i.coord))},gr.prototype.iterator=function(){return this._nodeMap.values().iterator()},gr.prototype.addSplitEdges=function(n){this.addEndpoints(),this.addCollapsedNodes();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next(),c=this.createSplitEdge(s,u);n.add(c),s=u}},gr.prototype.findCollapseIndex=function(n,i,s){if(!n.coord.equals2D(i.coord))return!1;var u=i.segmentIndex-n.segmentIndex;return i.isInterior()||u--,u===1&&(s[0]=n.segmentIndex+1,!0)},gr.prototype.findCollapsesFromInsertedNodes=function(n){for(var i=new Array(1).fill(null),s=this.iterator(),u=s.next();s.hasNext();){var c=s.next();this.findCollapseIndex(u,c,i)&&n.add(new lt(i[0])),u=c}},gr.prototype.getEdge=function(){return this._edge},gr.prototype.addEndpoints=function(){var n=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(n),n)},gr.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);c||s--;var m=new Array(s).fill(null),E=0;m[E++]=new I(n.coord);for(var A=n.segmentIndex+1;A<=i.segmentIndex;A++)m[E++]=this._edge.getCoordinate(A);return c&&(m[E]=new I(i.coord)),new Nn(m,this._edge.getData())},gr.prototype.add=function(n,i){var s=new Co(this._edge,n,i,this._edge.getSegmentOctant(i)),u=this._nodeMap.get(s);return u!==null?(Pt.isTrue(u.coord.equals2D(n),"Found equal nodes with different coordinates"),u):(this._nodeMap.put(s,s),s)},gr.prototype.checkSplitEdgesCorrectness=function(n){var i=this._edge.getCoordinates(),s=n.get(0).getCoordinate(0);if(!s.equals2D(i[0]))throw new pe("bad split edge start point at "+s);var u=n.get(n.size()-1).getCoordinates(),c=u[u.length-1];if(!c.equals2D(i[i.length-1]))throw new pe("bad split edge end point at "+c)},gr.prototype.interfaces_=function(){return[]},gr.prototype.getClass=function(){return gr};var Is=function(){};Is.prototype.interfaces_=function(){return[]},Is.prototype.getClass=function(){return Is},Is.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new P("Cannot compute the octant for point ( "+n+", "+i+" )");var s=Math.abs(n),u=Math.abs(i);return n>=0?i>=0?s>=u?0:1:s>=u?7:6:i>=0?s>=u?3:2:s>=u?4:5}if(arguments[0]instanceof I&&arguments[1]instanceof I){var c=arguments[0],m=arguments[1],E=m.x-c.x,A=m.y-c.y;if(E===0&&A===0)throw new P("Cannot compute the octant for two identical points "+c);return Is.octant(E,A)}};var Hi=function(){};Hi.prototype.getCoordinates=function(){},Hi.prototype.size=function(){},Hi.prototype.getCoordinate=function(n){},Hi.prototype.isClosed=function(){},Hi.prototype.setData=function(n){},Hi.prototype.getData=function(){},Hi.prototype.interfaces_=function(){return[]},Hi.prototype.getClass=function(){return Hi};var xu=function(){};xu.prototype.addIntersection=function(n,i){},xu.prototype.interfaces_=function(){return[Hi]},xu.prototype.getClass=function(){return xu};var Nn=function(){this._nodeList=new gr(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};Nn.prototype.getCoordinates=function(){return this._pts},Nn.prototype.size=function(){return this._pts.length},Nn.prototype.getCoordinate=function(n){return this._pts[n]},Nn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Nn.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))},Nn.prototype.setData=function(n){this._data=n},Nn.prototype.safeOctant=function(n,i){return n.equals2D(i)?0:Is.octant(n,i)},Nn.prototype.getData=function(){return this._data},Nn.prototype.addIntersection=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.addIntersectionNode(n,i)}else if(arguments.length===4){var s=arguments[0],u=arguments[1],c=arguments[3],m=new I(s.getIntersection(c));this.addIntersection(m,u)}},Nn.prototype.toString=function(){return Yt.toLineString(new fe(this._pts))},Nn.prototype.getNodeList=function(){return this._nodeList},Nn.prototype.addIntersectionNode=function(n,i){var s=i,u=s+1;if(u<this._pts.length){var c=this._pts[u];n.equals2D(c)&&(s=u)}return this._nodeList.add(n,s)},Nn.prototype.addIntersections=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++)this.addIntersection(n,i,s,u)},Nn.prototype.interfaces_=function(){return[xu]},Nn.prototype.getClass=function(){return Nn},Nn.getNodedSubstrings=function(){if(arguments.length===1){var n=arguments[0],i=new Z;return Nn.getNodedSubstrings(n,i),i}if(arguments.length===2)for(var s=arguments[0],u=arguments[1],c=s.iterator();c.hasNext();)c.next().getNodeList().addSplitEdges(u)};var Zt=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new I,this.p1=new I;else if(arguments.length===1){var n=arguments[0];this.p0=new I(n.p0),this.p1=new I(n.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var i=arguments[0],s=arguments[1],u=arguments[2],c=arguments[3];this.p0=new I(i,s),this.p1=new I(u,c)}},Jd={serialVersionUID:{configurable:!0}};Zt.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Zt.prototype.orientationIndex=function(){if(arguments[0]instanceof Zt){var n=arguments[0],i=J.orientationIndex(this.p0,this.p1,n.p0),s=J.orientationIndex(this.p0,this.p1,n.p1);return i>=0&&s>=0||i<=0&&s<=0?Math.max(i,s):0}if(arguments[0]instanceof I){var u=arguments[0];return J.orientationIndex(this.p0,this.p1,u)}},Zt.prototype.toGeometry=function(n){return n.createLineString([this.p0,this.p1])},Zt.prototype.isVertical=function(){return this.p0.x===this.p1.x},Zt.prototype.equals=function(n){if(!(n instanceof Zt))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},Zt.prototype.intersection=function(n){var i=new pn;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null},Zt.prototype.project=function(){if(arguments[0]instanceof I){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new I(n);var i=this.projectionFactor(n),s=new I;return s.x=this.p0.x+i*(this.p1.x-this.p0.x),s.y=this.p0.y+i*(this.p1.y-this.p0.y),s}if(arguments[0]instanceof Zt){var u=arguments[0],c=this.projectionFactor(u.p0),m=this.projectionFactor(u.p1);if(c>=1&&m>=1||c<=0&&m<=0)return null;var E=this.project(u.p0);c<0&&(E=this.p0),c>1&&(E=this.p1);var A=this.project(u.p1);return m<0&&(A=this.p0),m>1&&(A=this.p1),new Zt(E,A)}},Zt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Zt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Zt.prototype.getCoordinate=function(n){return n===0?this.p0:this.p1},Zt.prototype.distancePerpendicular=function(n){return J.distancePointLinePerpendicular(n,this.p0,this.p1)},Zt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Zt.prototype.midPoint=function(){return Zt.midPoint(this.p0,this.p1)},Zt.prototype.projectionFactor=function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var i=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,u=i*i+s*s;return u<=0?S.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*s)/u},Zt.prototype.closestPoints=function(n){var i=this.intersection(n);if(i!==null)return[i,i];var s=new Array(2).fill(null),u=S.MAX_VALUE,c=null,m=this.closestPoint(n.p0);u=m.distance(n.p0),s[0]=m,s[1]=n.p0;var E=this.closestPoint(n.p1);(c=E.distance(n.p1))<u&&(u=c,s[0]=E,s[1]=n.p1);var A=n.closestPoint(this.p0);(c=A.distance(this.p0))<u&&(u=c,s[0]=this.p0,s[1]=A);var U=n.closestPoint(this.p1);return(c=U.distance(this.p1))<u&&(u=c,s[0]=this.p1,s[1]=U),s},Zt.prototype.closestPoint=function(n){var i=this.projectionFactor(n);return i>0&&i<1?this.project(n):this.p0.distance(n)<this.p1.distance(n)?this.p0:this.p1},Zt.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Zt.prototype.getLength=function(){return this.p0.distance(this.p1)},Zt.prototype.compareTo=function(n){var i=n,s=this.p0.compareTo(i.p0);return s!==0?s:this.p1.compareTo(i.p1)},Zt.prototype.reverse=function(){var n=this.p0;this.p0=this.p1,this.p1=n},Zt.prototype.equalsTopo=function(n){return this.p0.equals(n.p0)&&(this.p1.equals(n.p1)||this.p0.equals(n.p1))&&this.p1.equals(n.p0)},Zt.prototype.lineIntersection=function(n){try{return Qt.intersection(this.p0,this.p1,n.p0,n.p1)}catch(i){if(!(i instanceof Xt))throw i}return null},Zt.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Zt.prototype.pointAlongOffset=function(n,i){var s=this.p0.x+n*(this.p1.x-this.p0.x),u=this.p0.y+n*(this.p1.y-this.p0.y),c=this.p1.x-this.p0.x,m=this.p1.y-this.p0.y,E=Math.sqrt(c*c+m*m),A=0,U=0;if(i!==0){if(E<=0)throw new Error("Cannot compute offset from zero-length line segment");A=i*c/E,U=i*m/E}return new I(s-U,u+A)},Zt.prototype.setCoordinates=function(){if(arguments.length===1){var n=arguments[0];this.setCoordinates(n.p0,n.p1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.p0.x=i.x,this.p0.y=i.y,this.p1.x=s.x,this.p1.y=s.y}},Zt.prototype.segmentFraction=function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||S.isNaN(i))&&(i=1),i},Zt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Zt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Zt.prototype.distance=function(){if(arguments[0]instanceof Zt){var n=arguments[0];return J.distanceLineLine(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof I){var i=arguments[0];return J.distancePointLine(i,this.p0,this.p1)}},Zt.prototype.pointAlong=function(n){var i=new I;return i.x=this.p0.x+n*(this.p1.x-this.p0.x),i.y=this.p0.y+n*(this.p1.y-this.p0.y),i},Zt.prototype.hashCode=function(){var n=S.doubleToLongBits(this.p0.x);n^=31*S.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),s=S.doubleToLongBits(this.p1.x);return s^=31*S.doubleToLongBits(this.p1.y),i^(Math.trunc(s)^Math.trunc(s>>32))},Zt.prototype.interfaces_=function(){return[N,t]},Zt.prototype.getClass=function(){return Zt},Zt.midPoint=function(n,i){return new I((n.x+i.x)/2,(n.y+i.y)/2)},Jd.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Zt,Jd);var Eu=function(){this.tempEnv1=new Ct,this.tempEnv2=new Ct,this._overlapSeg1=new Zt,this._overlapSeg2=new Zt};Eu.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];n.getLineSegment(i,this._overlapSeg1),s.getLineSegment(u,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},Eu.prototype.interfaces_=function(){return[]},Eu.prototype.getClass=function(){return Eu};var Vr=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._pts=n,this._start=i,this._end=s,this._context=u};Vr.prototype.getLineSegment=function(n,i){i.p0=this._pts[n],i.p1=this._pts[n+1]},Vr.prototype.computeSelect=function(n,i,s,u){var c=this._pts[i],m=this._pts[s];if(u.tempEnv1.init(c,m),s-i==1)return u.select(this,i),null;if(!n.intersects(u.tempEnv1))return null;var E=Math.trunc((i+s)/2);i<E&&this.computeSelect(n,i,E,u),E<s&&this.computeSelect(n,E,s,u)},Vr.prototype.getCoordinates=function(){for(var n=new Array(this._end-this._start+1).fill(null),i=0,s=this._start;s<=this._end;s++)n[i++]=this._pts[s];return n},Vr.prototype.computeOverlaps=function(n,i){this.computeOverlapsInternal(this._start,this._end,n,n._start,n._end,i)},Vr.prototype.setId=function(n){this._id=n},Vr.prototype.select=function(n,i){this.computeSelect(n,this._start,this._end,i)},Vr.prototype.getEnvelope=function(){if(this._env===null){var n=this._pts[this._start],i=this._pts[this._end];this._env=new Ct(n,i)}return this._env},Vr.prototype.getEndIndex=function(){return this._end},Vr.prototype.getStartIndex=function(){return this._start},Vr.prototype.getContext=function(){return this._context},Vr.prototype.getId=function(){return this._id},Vr.prototype.computeOverlapsInternal=function(n,i,s,u,c,m){var E=this._pts[n],A=this._pts[i],U=s._pts[u],K=s._pts[c];if(i-n==1&&c-u==1)return m.overlap(this,n,s,u),null;if(m.tempEnv1.init(E,A),m.tempEnv2.init(U,K),!m.tempEnv1.intersects(m.tempEnv2))return null;var pt=Math.trunc((n+i)/2),dt=Math.trunc((u+c)/2);n<pt&&(u<dt&&this.computeOverlapsInternal(n,pt,s,u,dt,m),dt<c&&this.computeOverlapsInternal(n,pt,s,dt,c,m)),pt<i&&(u<dt&&this.computeOverlapsInternal(pt,i,s,u,dt,m),dt<c&&this.computeOverlapsInternal(pt,i,s,dt,c,m))},Vr.prototype.interfaces_=function(){return[]},Vr.prototype.getClass=function(){return Vr};var Ri=function(){};Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri},Ri.getChainStartIndices=function(n){var i=0,s=new Z;s.add(new lt(i));do{var u=Ri.findChainEnd(n,i);s.add(new lt(u)),i=u}while(i<n.length-1);return Ri.toIntArray(s)},Ri.findChainEnd=function(n,i){for(var s=i;s<n.length-1&&n[s].equals2D(n[s+1]);)s++;if(s>=n.length-1)return n.length-1;for(var u=cn.quadrant(n[s],n[s+1]),c=i+1;c<n.length&&!(!n[c-1].equals2D(n[c])&&cn.quadrant(n[c-1],n[c])!==u);)c++;return c-1},Ri.getChains=function(){if(arguments.length===1){var n=arguments[0];return Ri.getChains(n,null)}if(arguments.length===2){for(var i=arguments[0],s=arguments[1],u=new Z,c=Ri.getChainStartIndices(i),m=0;m<c.length-1;m++){var E=new Vr(i,c[m],c[m+1],s);u.add(E)}return u}},Ri.toIntArray=function(n){for(var i=new Array(n.size()).fill(null),s=0;s<i.length;s++)i[s]=n.get(s).intValue();return i};var Qo=function(){};Qo.prototype.computeNodes=function(n){},Qo.prototype.getNodedSubstrings=function(){},Qo.prototype.interfaces_=function(){return[]},Qo.prototype.getClass=function(){return Qo};var Mu=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setSegmentIntersector(n)}}};Mu.prototype.setSegmentIntersector=function(n){this._segInt=n},Mu.prototype.interfaces_=function(){return[Qo]},Mu.prototype.getClass=function(){return Mu};var Eh=function(n){function i(u){u?n.call(this,u):n.call(this),this._monoChains=new Z,this._index=new $d,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={SegmentOverlapAction:{configurable:!0}};return i.prototype.getMonotoneChains=function(){return this._monoChains},i.prototype.getNodedSubstrings=function(){return Nn.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(u){for(var c=Ri.getChains(u.getCoordinates(),u).iterator();c.hasNext();){var m=c.next();m.setId(this._idCounter++),this._index.insert(m.getEnvelope(),m),this._monoChains.add(m)}},i.prototype.computeNodes=function(u){this._nodedSegStrings=u;for(var c=u.iterator();c.hasNext();)this.add(c.next());this.intersectChains()},i.prototype.intersectChains=function(){for(var u=new Kd(this._segInt),c=this._monoChains.iterator();c.hasNext();)for(var m=c.next(),E=this._index.query(m.getEnvelope()).iterator();E.hasNext();){var A=E.next();if(A.getId()>m.getId()&&(m.computeOverlaps(A,u),this._nOverlaps++),this._segInt.isDone())return null}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.SegmentOverlapAction.get=function(){return Kd},Object.defineProperties(i,s),i}(Mu),Kd=function(n){function i(){n.call(this),this._si=null;var s=arguments[0];this._si=s}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.overlap=function(){if(arguments.length!==4)return n.prototype.overlap.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2],m=arguments[3],E=s.getContext(),A=c.getContext();this._si.processIntersections(E,u,A,m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Eu),We=function n(){if(this._quadrantSegments=n.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=n.CAP_ROUND,this._joinStyle=n.JOIN_ROUND,this._mitreLimit=n.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=n.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setQuadrantSegments(i)}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.setQuadrantSegments(s),this.setEndCapStyle(u)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];this.setQuadrantSegments(c),this.setEndCapStyle(m),this.setJoinStyle(E),this.setMitreLimit(A)}}},ho={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};We.prototype.getEndCapStyle=function(){return this._endCapStyle},We.prototype.isSingleSided=function(){return this._isSingleSided},We.prototype.setQuadrantSegments=function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=We.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=We.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==We.JOIN_ROUND&&(this._quadrantSegments=We.DEFAULT_QUADRANT_SEGMENTS)},We.prototype.getJoinStyle=function(){return this._joinStyle},We.prototype.setJoinStyle=function(n){this._joinStyle=n},We.prototype.setSimplifyFactor=function(n){this._simplifyFactor=n<0?0:n},We.prototype.getSimplifyFactor=function(){return this._simplifyFactor},We.prototype.getQuadrantSegments=function(){return this._quadrantSegments},We.prototype.setEndCapStyle=function(n){this._endCapStyle=n},We.prototype.getMitreLimit=function(){return this._mitreLimit},We.prototype.setMitreLimit=function(n){this._mitreLimit=n},We.prototype.setSingleSided=function(n){this._isSingleSided=n},We.prototype.interfaces_=function(){return[]},We.prototype.getClass=function(){return We},We.bufferDistanceError=function(n){var i=Math.PI/2/n;return 1-Math.cos(i/2)},ho.CAP_ROUND.get=function(){return 1},ho.CAP_FLAT.get=function(){return 2},ho.CAP_SQUARE.get=function(){return 3},ho.JOIN_ROUND.get=function(){return 1},ho.JOIN_MITRE.get=function(){return 2},ho.JOIN_BEVEL.get=function(){return 3},ho.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},ho.DEFAULT_MITRE_LIMIT.get=function(){return 5},ho.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(We,ho);var In=function(n){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=J.COUNTERCLOCKWISE,this._inputLine=n||null},Su={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};In.prototype.isDeletable=function(n,i,s,u){var c=this._inputLine[n],m=this._inputLine[i],E=this._inputLine[s];return!!this.isConcave(c,m,E)&&!!this.isShallow(c,m,E,u)&&this.isShallowSampled(c,m,n,s,u)},In.prototype.deleteShallowConcavities=function(){for(var n=1,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i),u=!1;s<this._inputLine.length;){var c=!1;this.isDeletable(n,i,s,this._distanceTol)&&(this._isDeleted[i]=In.DELETE,c=!0,u=!0),n=c?s:i,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i)}return u},In.prototype.isShallowConcavity=function(n,i,s,u){return J.computeOrientation(n,i,s)!==this._angleOrientation?!1:J.distancePointLine(i,n,s)<u},In.prototype.isShallowSampled=function(n,i,s,u,c){var m=Math.trunc((u-s)/In.NUM_PTS_TO_CHECK);m<=0&&(m=1);for(var E=s;E<u;E+=m)if(!this.isShallow(n,i,this._inputLine[E],c))return!1;return!0},In.prototype.isConcave=function(n,i,s){var u=J.computeOrientation(n,i,s)===this._angleOrientation;return u},In.prototype.simplify=function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=J.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},In.prototype.findNextNonDeletedIndex=function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===In.DELETE;)i++;return i},In.prototype.isShallow=function(n,i,s,u){return J.distancePointLine(i,n,s)<u},In.prototype.collapseLine=function(){for(var n=new ot,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==In.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()},In.prototype.interfaces_=function(){return[]},In.prototype.getClass=function(){return In},In.simplify=function(n,i){return new In(n).simplify(i)},Su.INIT.get=function(){return 0},Su.DELETE.get=function(){return 1},Su.KEEP.get=function(){return 1},Su.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(In,Su);var Kr=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new Z},jd={COORDINATE_ARRAY_TYPE:{configurable:!0}};Kr.prototype.getCoordinates=function(){return this._ptList.toArray(Kr.COORDINATE_ARRAY_TYPE)},Kr.prototype.setPrecisionModel=function(n){this._precisionModel=n},Kr.prototype.addPt=function(n){var i=new I(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},Kr.prototype.revere=function(){},Kr.prototype.addPts=function(n,i){if(i)for(var s=0;s<n.length;s++)this.addPt(n[s]);else for(var u=n.length-1;u>=0;u--)this.addPt(n[u])},Kr.prototype.isRedundant=function(n){if(this._ptList.size()<1)return!1;var i=this._ptList.get(this._ptList.size()-1);return n.distance(i)<this._minimimVertexDistance},Kr.prototype.toString=function(){return new ue().createLineString(this.getCoordinates()).toString()},Kr.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var n=new I(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(n.equals(i))return null;this._ptList.add(n)},Kr.prototype.setMinimumVertexDistance=function(n){this._minimimVertexDistance=n},Kr.prototype.interfaces_=function(){return[]},Kr.prototype.getClass=function(){return Kr},jd.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Kr,jd);var me=function(){},Rs={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};me.prototype.interfaces_=function(){return[]},me.prototype.getClass=function(){return me},me.toDegrees=function(n){return 180*n/Math.PI},me.normalize=function(n){for(;n>Math.PI;)n-=me.PI_TIMES_2;for(;n<=-Math.PI;)n+=me.PI_TIMES_2;return n},me.angle=function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var i=arguments[0],s=arguments[1],u=s.x-i.x,c=s.y-i.y;return Math.atan2(c,u)}},me.isAcute=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)>0},me.isObtuse=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)<0},me.interiorAngle=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s);return Math.abs(c-u)},me.normalizePositive=function(n){if(n<0){for(;n<0;)n+=me.PI_TIMES_2;n>=me.PI_TIMES_2&&(n=0)}else{for(;n>=me.PI_TIMES_2;)n-=me.PI_TIMES_2;n<0&&(n=0)}return n},me.angleBetween=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s);return me.diff(u,c)},me.diff=function(n,i){var s=null;return(s=n<i?i-n:n-i)>Math.PI&&(s=2*Math.PI-s),s},me.toRadians=function(n){return n*Math.PI/180},me.getTurn=function(n,i){var s=Math.sin(i-n);return s>0?me.COUNTERCLOCKWISE:s<0?me.CLOCKWISE:me.NONE},me.angleBetweenOriented=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s)-u;return c<=-Math.PI?c+me.PI_TIMES_2:c>Math.PI?c-me.PI_TIMES_2:c},Rs.PI_TIMES_2.get=function(){return 2*Math.PI},Rs.PI_OVER_2.get=function(){return Math.PI/2},Rs.PI_OVER_4.get=function(){return Math.PI/4},Rs.COUNTERCLOCKWISE.get=function(){return J.COUNTERCLOCKWISE},Rs.CLOCKWISE.get=function(){return J.CLOCKWISE},Rs.NONE.get=function(){return J.COLLINEAR},Object.defineProperties(me,Rs);var vn=function n(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Zt,this._seg1=new Zt,this._offset0=new Zt,this._offset1=new Zt,this._side=0,this._hasNarrowConcaveAngle=!1;var i=arguments[0],s=arguments[1],u=arguments[2];this._precisionModel=i,this._bufParams=s,this._li=new pn,this._filletAngleQuantum=Math.PI/2/s.getQuadrantSegments(),s.getQuadrantSegments()>=8&&s.getJoinStyle()===We.JOIN_ROUND&&(this._closingSegLengthFactor=n.MAX_CLOSING_SEG_LEN_FACTOR),this.init(u)},wu={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};vn.prototype.addNextSegment=function(n,i){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var s=J.computeOrientation(this._s0,this._s1,this._s2),u=s===J.CLOCKWISE&&this._side===bt.LEFT||s===J.COUNTERCLOCKWISE&&this._side===bt.RIGHT;s===0?this.addCollinear(i):u?this.addOutsideTurn(s,i):this.addInsideTurn(s,i)},vn.prototype.addLineEndCap=function(n,i){var s=new Zt(n,i),u=new Zt;this.computeOffsetSegment(s,bt.LEFT,this._distance,u);var c=new Zt;this.computeOffsetSegment(s,bt.RIGHT,this._distance,c);var m=i.x-n.x,E=i.y-n.y,A=Math.atan2(E,m);switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:this._segList.addPt(u.p1),this.addFilletArc(i,A+Math.PI/2,A-Math.PI/2,J.CLOCKWISE,this._distance),this._segList.addPt(c.p1);break;case We.CAP_FLAT:this._segList.addPt(u.p1),this._segList.addPt(c.p1);break;case We.CAP_SQUARE:var U=new I;U.x=Math.abs(this._distance)*Math.cos(A),U.y=Math.abs(this._distance)*Math.sin(A);var K=new I(u.p1.x+U.x,u.p1.y+U.y),pt=new I(c.p1.x+U.x,c.p1.y+U.y);this._segList.addPt(K),this._segList.addPt(pt)}},vn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},vn.prototype.addMitreJoin=function(n,i,s,u){var c=!0,m=null;try{m=Qt.intersection(i.p0,i.p1,s.p0,s.p1),(u<=0?1:m.distance(n)/Math.abs(u))>this._bufParams.getMitreLimit()&&(c=!1)}catch(E){if(!(E instanceof Xt))throw E;m=new I(0,0),c=!1}c?this._segList.addPt(m):this.addLimitedMitreJoin(i,s,u,this._bufParams.getMitreLimit())},vn.prototype.addFilletCorner=function(n,i,s,u,c){var m=i.x-n.x,E=i.y-n.y,A=Math.atan2(E,m),U=s.x-n.x,K=s.y-n.y,pt=Math.atan2(K,U);u===J.CLOCKWISE?A<=pt&&(A+=2*Math.PI):A>=pt&&(A-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(n,A,pt,u,c),this._segList.addPt(s)},vn.prototype.addOutsideTurn=function(n,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*vn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===We.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===We.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(i&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))},vn.prototype.createSquare=function(n){this._segList.addPt(new I(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new I(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new I(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new I(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()},vn.prototype.addSegments=function(n,i){this._segList.addPts(n,i)},vn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},vn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},vn.prototype.initSideSegments=function(n,i,s){this._s1=n,this._s2=i,this._side=s,this._seg1.setCoordinates(n,i),this.computeOffsetSegment(this._seg1,s,this._distance,this._offset1)},vn.prototype.addLimitedMitreJoin=function(n,i,s,u){var c=this._seg0.p1,m=me.angle(c,this._seg0.p0),E=me.angleBetweenOriented(this._seg0.p0,c,this._seg1.p1)/2,A=me.normalize(m+E),U=me.normalize(A+Math.PI),K=u*s,pt=s-K*Math.abs(Math.sin(E)),dt=c.x+K*Math.cos(U),Rt=c.y+K*Math.sin(U),Ot=new I(dt,Rt),Vt=new Zt(c,Ot),jt=Vt.pointAlongOffset(1,pt),sn=Vt.pointAlongOffset(1,-pt);this._side===bt.LEFT?(this._segList.addPt(jt),this._segList.addPt(sn)):(this._segList.addPt(sn),this._segList.addPt(jt))},vn.prototype.computeOffsetSegment=function(n,i,s,u){var c=i===bt.LEFT?1:-1,m=n.p1.x-n.p0.x,E=n.p1.y-n.p0.y,A=Math.sqrt(m*m+E*E),U=c*s*m/A,K=c*s*E/A;u.p0.x=n.p0.x-K,u.p0.y=n.p0.y+U,u.p1.x=n.p1.x-K,u.p1.y=n.p1.y+U},vn.prototype.addFilletArc=function(n,i,s,u,c){var m=u===J.CLOCKWISE?-1:1,E=Math.abs(i-s),A=Math.trunc(E/this._filletAngleQuantum+.5);if(A<1)return null;for(var U=E/A,K=0,pt=new I;K<E;){var dt=i+m*K;pt.x=n.x+c*Math.cos(dt),pt.y=n.y+c*Math.sin(dt),this._segList.addPt(pt),K+=U}},vn.prototype.addInsideTurn=function(n,i){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*vn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var s=new I((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(s);var u=new I((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(u)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},vn.prototype.createCircle=function(n){var i=new I(n.x+this._distance,n.y);this._segList.addPt(i),this.addFilletArc(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},vn.prototype.addBevelJoin=function(n,i){this._segList.addPt(n.p1),this._segList.addPt(i.p0)},vn.prototype.init=function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Kr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*vn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},vn.prototype.addCollinear=function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===We.JOIN_BEVEL||this._bufParams.getJoinStyle()===We.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,J.CLOCKWISE,this._distance))},vn.prototype.closeRing=function(){this._segList.closeRing()},vn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},vn.prototype.interfaces_=function(){return[]},vn.prototype.getClass=function(){return vn},wu.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},wu.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},wu.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},wu.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(vn,wu);var Rr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i};Rr.prototype.getOffsetCurve=function(n,i){if(this._distance=i,i===0)return null;var s=i<0,u=Math.abs(i),c=this.getSegGen(u);n.length<=1?this.computePointCurve(n[0],c):this.computeOffsetCurve(n,s,c);var m=c.getCoordinates();return s&&Q.reverse(m),m},Rr.prototype.computeSingleSidedBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){s.addSegments(n,!0);var c=In.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],bt.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{s.addSegments(n,!1);var A=In.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var K=2;K<=U;K++)s.addNextSegment(A[K],!0)}s.addLastSegment(),s.closeRing()},Rr.prototype.computeRingBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);i===bt.RIGHT&&(u=-u);var c=In.simplify(n,u),m=c.length-1;s.initSideSegments(c[m-1],c[0],i);for(var E=1;E<=m;E++){var A=E!==1;s.addNextSegment(c[E],A)}s.closeRing()},Rr.prototype.computeLineBufferCurve=function(n,i){var s=this.simplifyTolerance(this._distance),u=In.simplify(n,s),c=u.length-1;i.initSideSegments(u[0],u[1],bt.LEFT);for(var m=2;m<=c;m++)i.addNextSegment(u[m],!0);i.addLastSegment(),i.addLineEndCap(u[c-1],u[c]);var E=In.simplify(n,-s),A=E.length-1;i.initSideSegments(E[A],E[A-1],bt.LEFT);for(var U=A-2;U>=0;U--)i.addNextSegment(E[U],!0);i.addLastSegment(),i.addLineEndCap(E[1],E[0]),i.closeRing()},Rr.prototype.computePointCurve=function(n,i){switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:i.createCircle(n);break;case We.CAP_SQUARE:i.createSquare(n)}},Rr.prototype.getLineCurve=function(n,i){if(this._distance=i,i<0&&!this._bufParams.isSingleSided()||i===0)return null;var s=Math.abs(i),u=this.getSegGen(s);if(n.length<=1)this.computePointCurve(n[0],u);else if(this._bufParams.isSingleSided()){var c=i<0;this.computeSingleSidedBufferCurve(n,c,u)}else this.computeLineBufferCurve(n,u);return u.getCoordinates()},Rr.prototype.getBufferParameters=function(){return this._bufParams},Rr.prototype.simplifyTolerance=function(n){return n*this._bufParams.getSimplifyFactor()},Rr.prototype.getRingCurve=function(n,i,s){if(this._distance=s,n.length<=2)return this.getLineCurve(n,s);if(s===0)return Rr.copyCoordinates(n);var u=this.getSegGen(s);return this.computeRingBufferCurve(n,i,u),u.getCoordinates()},Rr.prototype.computeOffsetCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){var c=In.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],bt.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{var A=In.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var K=2;K<=U;K++)s.addNextSegment(A[K],!0)}s.addLastSegment()},Rr.prototype.getSegGen=function(n){return new vn(this._precisionModel,this._bufParams,n)},Rr.prototype.interfaces_=function(){return[]},Rr.prototype.getClass=function(){return Rr},Rr.copyCoordinates=function(n){for(var i=new Array(n.length).fill(null),s=0;s<i.length;s++)i[s]=new I(n[s]);return i};var Ls=function(){this._subgraphs=null,this._seg=new Zt,this._cga=new J;var n=arguments[0];this._subgraphs=n},Qd={DepthSegment:{configurable:!0}};Ls.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var n=arguments[0],i=new Z,s=this._subgraphs.iterator();s.hasNext();){var u=s.next(),c=u.getEnvelope();n.y<c.getMinY()||n.y>c.getMaxY()||this.findStabbedSegments(n,u.getDirectedEdges(),i)}return i}if(arguments.length===3){if($(arguments[2],tt)&&arguments[0]instanceof I&&arguments[1]instanceof xh){for(var m=arguments[0],E=arguments[1],A=arguments[2],U=E.getEdge().getCoordinates(),K=0;K<U.length-1;K++)if(this._seg.p0=U[K],this._seg.p1=U[K+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<m.x)&&!(this._seg.isHorizontal()||m.y<this._seg.p0.y||m.y>this._seg.p1.y||J.computeOrientation(this._seg.p0,this._seg.p1,m)===J.RIGHT)){var pt=E.getDepth(bt.LEFT);this._seg.p0.equals(U[K])||(pt=E.getDepth(bt.RIGHT));var dt=new ts(this._seg,pt);A.add(dt)}}else if($(arguments[2],tt)&&arguments[0]instanceof I&&$(arguments[1],tt))for(var Rt=arguments[0],Ot=arguments[1],Vt=arguments[2],jt=Ot.iterator();jt.hasNext();){var sn=jt.next();sn.isForward()&&this.findStabbedSegments(Rt,sn,Vt)}}},Ls.prototype.getDepth=function(n){var i=this.findStabbedSegments(n);return i.size()===0?0:_i.min(i)._leftDepth},Ls.prototype.interfaces_=function(){return[]},Ls.prototype.getClass=function(){return Ls},Qd.DepthSegment.get=function(){return ts},Object.defineProperties(Ls,Qd);var ts=function(){this._upwardSeg=null,this._leftDepth=null;var n=arguments[0],i=arguments[1];this._upwardSeg=new Zt(n),this._leftDepth=i};ts.prototype.compareTo=function(n){var i=n;if(this._upwardSeg.minX()>=i._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=i._upwardSeg.minX())return-1;var s=this._upwardSeg.orientationIndex(i._upwardSeg);return s!==0||(s=-1*i._upwardSeg.orientationIndex(this._upwardSeg))!=0?s:this._upwardSeg.compareTo(i._upwardSeg)},ts.prototype.compareX=function(n,i){var s=n.p0.compareTo(i.p0);return s!==0?s:n.p1.compareTo(i.p1)},ts.prototype.toString=function(){return this._upwardSeg.toString()},ts.prototype.interfaces_=function(){return[N]},ts.prototype.getClass=function(){return ts};var qe=function(n,i,s){this.p0=n||null,this.p1=i||null,this.p2=s||null};qe.prototype.area=function(){return qe.area(this.p0,this.p1,this.p2)},qe.prototype.signedArea=function(){return qe.signedArea(this.p0,this.p1,this.p2)},qe.prototype.interpolateZ=function(n){if(n===null)throw new P("Supplied point is null.");return qe.interpolateZ(n,this.p0,this.p1,this.p2)},qe.prototype.longestSideLength=function(){return qe.longestSideLength(this.p0,this.p1,this.p2)},qe.prototype.isAcute=function(){return qe.isAcute(this.p0,this.p1,this.p2)},qe.prototype.circumcentre=function(){return qe.circumcentre(this.p0,this.p1,this.p2)},qe.prototype.area3D=function(){return qe.area3D(this.p0,this.p1,this.p2)},qe.prototype.centroid=function(){return qe.centroid(this.p0,this.p1,this.p2)},qe.prototype.inCentre=function(){return qe.inCentre(this.p0,this.p1,this.p2)},qe.prototype.interfaces_=function(){return[]},qe.prototype.getClass=function(){return qe},qe.area=function(n,i,s){return Math.abs(((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2)},qe.signedArea=function(n,i,s){return((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2},qe.det=function(n,i,s,u){return n*u-i*s},qe.interpolateZ=function(n,i,s,u){var c=i.x,m=i.y,E=s.x-c,A=u.x-c,U=s.y-m,K=u.y-m,pt=E*K-A*U,dt=n.x-c,Rt=n.y-m,Ot=(K*dt-A*Rt)/pt,Vt=(-U*dt+E*Rt)/pt;return i.z+Ot*(s.z-i.z)+Vt*(u.z-i.z)},qe.longestSideLength=function(n,i,s){var u=n.distance(i),c=i.distance(s),m=s.distance(n),E=u;return c>E&&(E=c),m>E&&(E=m),E},qe.isAcute=function(n,i,s){return!!me.isAcute(n,i,s)&&!!me.isAcute(i,s,n)&&!!me.isAcute(s,n,i)},qe.circumcentre=function(n,i,s){var u=s.x,c=s.y,m=n.x-u,E=n.y-c,A=i.x-u,U=i.y-c,K=2*qe.det(m,E,A,U),pt=qe.det(E,m*m+E*E,U,A*A+U*U),dt=qe.det(m,m*m+E*E,A,A*A+U*U);return new I(u-pt/K,c+dt/K)},qe.perpendicularBisector=function(n,i){var s=i.x-n.x,u=i.y-n.y,c=new Qt(n.x+s/2,n.y+u/2,1),m=new Qt(n.x-u+s/2,n.y+s+u/2,1);return new Qt(c,m)},qe.angleBisector=function(n,i,s){var u=i.distance(n),c=u/(u+i.distance(s)),m=s.x-n.x,E=s.y-n.y;return new I(n.x+c*m,n.y+c*E)},qe.area3D=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=i.z-n.z,E=s.x-n.x,A=s.y-n.y,U=s.z-n.z,K=c*U-m*A,pt=m*E-u*U,dt=u*A-c*E,Rt=K*K+pt*pt+dt*dt,Ot=Math.sqrt(Rt)/2;return Ot},qe.centroid=function(n,i,s){var u=(n.x+i.x+s.x)/3,c=(n.y+i.y+s.y)/3;return new I(u,c)},qe.inCentre=function(n,i,s){var u=i.distance(s),c=n.distance(s),m=n.distance(i),E=u+c+m,A=(u*n.x+c*i.x+m*s.x)/E,U=(u*n.y+c*i.y+m*s.y)/E;return new I(A,U)};var ci=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Z;var n=arguments[0],i=arguments[1],s=arguments[2];this._inputGeom=n,this._distance=i,this._curveBuilder=s};ci.prototype.addPoint=function(n){if(this._distance<=0)return null;var i=n.getCoordinates(),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,V.EXTERIOR,V.INTERIOR)},ci.prototype.addPolygon=function(n){var i=this._distance,s=bt.LEFT;this._distance<0&&(i=-this._distance,s=bt.RIGHT);var u=n.getExteriorRing(),c=Q.removeRepeatedPoints(u.getCoordinates());if(this._distance<0&&this.isErodedCompletely(u,this._distance)||this._distance<=0&&c.length<3)return null;this.addPolygonRing(c,i,s,V.EXTERIOR,V.INTERIOR);for(var m=0;m<n.getNumInteriorRing();m++){var E=n.getInteriorRingN(m),A=Q.removeRepeatedPoints(E.getCoordinates());this._distance>0&&this.isErodedCompletely(E,-this._distance)||this.addPolygonRing(A,i,bt.opposite(s),V.INTERIOR,V.EXTERIOR)}},ci.prototype.isTriangleErodedCompletely=function(n,i){var s=new qe(n[0],n[1],n[2]),u=s.inCentre();return J.distancePointLine(u,s.p0,s.p1)<Math.abs(i)},ci.prototype.addLineString=function(n){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=Q.removeRepeatedPoints(n.getCoordinates()),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,V.EXTERIOR,V.INTERIOR)},ci.prototype.addCurve=function(n,i,s){if(n===null||n.length<2)return null;var u=new Nn(n,new on(0,V.BOUNDARY,i,s));this._curveList.add(u)},ci.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},ci.prototype.addPolygonRing=function(n,i,s,u,c){if(i===0&&n.length<an.MINIMUM_VALID_SIZE)return null;var m=u,E=c;n.length>=an.MINIMUM_VALID_SIZE&&J.isCCW(n)&&(m=c,E=u,s=bt.opposite(s));var A=this._curveBuilder.getRingCurve(n,s,i);this.addCurve(A,m,E)},ci.prototype.add=function(n){if(n.isEmpty())return null;n instanceof Wt?this.addPolygon(n):n instanceof zt?this.addLineString(n):n instanceof Kt?this.addPoint(n):n instanceof he?this.addCollection(n):n instanceof W?this.addCollection(n):n instanceof ln?this.addCollection(n):n instanceof gn&&this.addCollection(n)},ci.prototype.isErodedCompletely=function(n,i){var s=n.getCoordinates();if(s.length<4)return i<0;if(s.length===4)return this.isTriangleErodedCompletely(s,i);var u=n.getEnvelopeInternal(),c=Math.min(u.getHeight(),u.getWidth());return i<0&&2*Math.abs(i)>c},ci.prototype.addCollection=function(n){for(var i=0;i<n.getNumGeometries();i++){var s=n.getGeometryN(i);this.add(s)}},ci.prototype.interfaces_=function(){return[]},ci.prototype.getClass=function(){return ci};var fa=function(){};fa.prototype.locate=function(n){},fa.prototype.interfaces_=function(){return[]},fa.prototype.getClass=function(){return fa};var Wi=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var n=arguments[0];this._parent=n,this._atStart=!0,this._index=0,this._max=n.getNumGeometries()};Wi.prototype.next=function(){if(this._atStart)return this._atStart=!1,Wi.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new o;var n=this._parent.getGeometryN(this._index++);return n instanceof gn?(this._subcollectionIterator=new Wi(n),this._subcollectionIterator.next()):n},Wi.prototype.remove=function(){throw new Error(this.getClass().getName())},Wi.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Wi.prototype.interfaces_=function(){return[D]},Wi.prototype.getClass=function(){return Wi},Wi.isAtomic=function(n){return!(n instanceof gn)};var jr=function(){this._geom=null;var n=arguments[0];this._geom=n};jr.prototype.locate=function(n){return jr.locate(n,this._geom)},jr.prototype.interfaces_=function(){return[fa]},jr.prototype.getClass=function(){return jr},jr.isPointInRing=function(n,i){return!!i.getEnvelopeInternal().intersects(n)&&J.isPointInRing(n,i.getCoordinates())},jr.containsPointInPolygon=function(n,i){if(i.isEmpty())return!1;var s=i.getExteriorRing();if(!jr.isPointInRing(n,s))return!1;for(var u=0;u<i.getNumInteriorRing();u++){var c=i.getInteriorRingN(u);if(jr.isPointInRing(n,c))return!1}return!0},jr.containsPoint=function(n,i){if(i instanceof Wt)return jr.containsPointInPolygon(n,i);if(i instanceof gn)for(var s=new Wi(i);s.hasNext();){var u=s.next();if(u!==i&&jr.containsPoint(n,u))return!0}return!1},jr.locate=function(n,i){return i.isEmpty()?V.EXTERIOR:jr.containsPoint(n,i)?V.INTERIOR:V.EXTERIOR};var ar=function(){this._edgeMap=new _,this._edgeList=null,this._ptInAreaLocation=[V.NONE,V.NONE]};ar.prototype.getNextCW=function(n){this.getEdges();var i=this._edgeList.indexOf(n),s=i-1;return i===0&&(s=this._edgeList.size()-1),this._edgeList.get(s)},ar.prototype.propagateSideLabels=function(n){for(var i=V.NONE,s=this.iterator();s.hasNext();){var u=s.next().getLabel();u.isArea(n)&&u.getLocation(n,bt.LEFT)!==V.NONE&&(i=u.getLocation(n,bt.LEFT))}if(i===V.NONE)return null;for(var c=i,m=this.iterator();m.hasNext();){var E=m.next(),A=E.getLabel();if(A.getLocation(n,bt.ON)===V.NONE&&A.setLocation(n,bt.ON,c),A.isArea(n)){var U=A.getLocation(n,bt.LEFT),K=A.getLocation(n,bt.RIGHT);if(K!==V.NONE){if(K!==c)throw new lo("side location conflict",E.getCoordinate());U===V.NONE&&Pt.shouldNeverReachHere("found single null side (at "+E.getCoordinate()+")"),c=U}else Pt.isTrue(A.getLocation(n,bt.LEFT)===V.NONE,"found single null side"),A.setLocation(n,bt.RIGHT,c),A.setLocation(n,bt.LEFT,c)}}},ar.prototype.getCoordinate=function(){var n=this.iterator();return n.hasNext()?n.next().getCoordinate():null},ar.prototype.print=function(n){Ft.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(n)},ar.prototype.isAreaLabelsConsistent=function(n){return this.computeEdgeEndLabels(n.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},ar.prototype.checkAreaLabelsConsistent=function(n){var i=this.getEdges();if(i.size()<=0)return!0;var s=i.size()-1,u=i.get(s).getLabel().getLocation(n,bt.LEFT);Pt.isTrue(u!==V.NONE,"Found unlabelled area edge");for(var c=u,m=this.iterator();m.hasNext();){var E=m.next().getLabel();Pt.isTrue(E.isArea(n),"Found non-area edge");var A=E.getLocation(n,bt.LEFT),U=E.getLocation(n,bt.RIGHT);if(A===U||U!==c)return!1;c=A}return!0},ar.prototype.findIndex=function(n){this.iterator();for(var i=0;i<this._edgeList.size();i++)if(this._edgeList.get(i)===n)return i;return-1},ar.prototype.iterator=function(){return this.getEdges().iterator()},ar.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new Z(this._edgeMap.values())),this._edgeList},ar.prototype.getLocation=function(n,i,s){return this._ptInAreaLocation[n]===V.NONE&&(this._ptInAreaLocation[n]=jr.locate(i,s[n].getGeometry())),this._ptInAreaLocation[n]},ar.prototype.toString=function(){var n=new mt;n.append("EdgeEndStar: "+this.getCoordinate()),n.append(`\n`);for(var i=this.iterator();i.hasNext();){var s=i.next();n.append(s),n.append(`\n`)}return n.toString()},ar.prototype.computeEdgeEndLabels=function(n){for(var i=this.iterator();i.hasNext();)i.next().computeLabel(n)},ar.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)===V.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=V.NONE;if(i[U])K=V.EXTERIOR;else{var pt=E.getCoordinate();K=this.getLocation(U,pt,n)}A.setAllLocationsIfNull(U,K)}},ar.prototype.getDegree=function(){return this._edgeMap.size()},ar.prototype.insertEdgeEnd=function(n,i){this._edgeMap.put(n,i),this._edgeList=null},ar.prototype.interfaces_=function(){return[]},ar.prototype.getClass=function(){return ar};var W1=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());Pt.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 cn.isNorthern(E)&&cn.isNorthern(A)?c:cn.isNorthern(E)||cn.isNorthern(A)?c.getDy()!==0?c:m.getDy()!==0?m:(Pt.shouldNeverReachHere("found two horizontal edges incident on node"),null):m},i.prototype.print=function(s){Ft.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 Z;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],K=arguments[2],pt=A;pt<U;pt++){var dt=this._edgeList.get(pt);dt.setEdgeDepths(bt.RIGHT,K),K=dt.getDepth(bt.LEFT)}return K}},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&&(Pt.isTrue(u!==null,"found null for first outgoing dirEdge"),Pt.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=V.NONE,u=this.iterator();u.hasNext();){var c=u.next(),m=c.getSym();if(!c.isLineEdge()){if(c.isInResult()){s=V.INTERIOR;break}if(m.isInResult()){s=V.EXTERIOR;break}}}if(s===V.NONE)return null;for(var E=s,A=this.iterator();A.hasNext();){var U=A.next(),K=U.getSym();U.isLineEdge()?U.getEdge().setCovered(E===V.INTERIOR):(U.isInResult()&&(E=V.EXTERIOR),K.isInResult()&&(E=V.INTERIOR))}},i.prototype.computeLabelling=function(s){n.prototype.computeLabelling.call(this,s),this._label=new on(V.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!==V.INTERIOR&&E!==V.BOUNDARY||this._label.setLocation(m,V.INTERIOR)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ar),tm=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 _l(s,new W1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(la),Po=function n(){this._pts=null,this._orientation=null;var i=arguments[0];this._pts=i,this._orientation=n.orientation(i)};Po.prototype.compareTo=function(n){var i=n;return Po.compareOriented(this._pts,this._orientation,i._pts,i._orientation)},Po.prototype.interfaces_=function(){return[N]},Po.prototype.getClass=function(){return Po},Po.orientation=function(n){return Q.increasingDirection(n)===1},Po.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,K=u?0:s.length-1;;){var pt=n[U].compareTo(s[K]);if(pt!==0)return pt;var dt=(U+=c)===E,Rt=(K+=m)===A;if(dt&&!Rt)return-1;if(!dt&&Rt)return 1;if(dt&&Rt)return 0}};var xi=function(){this._edges=new Z,this._ocaMap=new _};xi.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(") ")},xi.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next())},xi.prototype.findEdgeIndex=function(n){for(var i=0;i<this._edges.size();i++)if(this._edges.get(i).equals(n))return i;return-1},xi.prototype.iterator=function(){return this._edges.iterator()},xi.prototype.getEdges=function(){return this._edges},xi.prototype.get=function(n){return this._edges.get(n)},xi.prototype.findEqualEdge=function(n){var i=new Po(n.getCoordinates());return this._ocaMap.get(i)},xi.prototype.add=function(n){this._edges.add(n);var i=new Po(n.getCoordinates());this._ocaMap.put(i,n)},xi.prototype.interfaces_=function(){return[]},xi.prototype.getClass=function(){return xi};var es=function(){};es.prototype.processIntersections=function(n,i,s,u){},es.prototype.isDone=function(){},es.prototype.interfaces_=function(){return[]},es.prototype.getClass=function(){return es};var Qr=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};Qr.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(Qr.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},Qr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Qr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Qr.prototype.getLineIntersector=function(){return this._li},Qr.prototype.hasProperIntersection=function(){return this._hasProper},Qr.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)))},Qr.prototype.hasIntersection=function(){return this._hasIntersection},Qr.prototype.isDone=function(){return!1},Qr.prototype.hasInteriorIntersection=function(){return this._hasInterior},Qr.prototype.interfaces_=function(){return[es]},Qr.prototype.getClass=function(){return Qr},Qr.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var Li=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var n=arguments[0],i=arguments[1],s=arguments[2];this.coord=new I(n),this.segmentIndex=i,this.dist=s};Li.prototype.getSegmentIndex=function(){return this.segmentIndex},Li.prototype.getCoordinate=function(){return this.coord},Li.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex),n.println(" dist = "+this.dist)},Li.prototype.compareTo=function(n){var i=n;return this.compare(i.segmentIndex,i.dist)},Li.prototype.isEndPoint=function(n){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===n},Li.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Li.prototype.getDistance=function(){return this.dist},Li.prototype.compare=function(n,i){return this.segmentIndex<n?-1:this.segmentIndex>n?1:this.dist<i?-1:this.dist>i?1:0},Li.prototype.interfaces_=function(){return[N]},Li.prototype.getClass=function(){return Li};var qi=function(){this._nodeMap=new _,this.edge=null;var n=arguments[0];this.edge=n};qi.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},qi.prototype.iterator=function(){return this._nodeMap.values().iterator()},qi.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}},qi.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)},qi.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 I(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 El(m,new on(this.edge._label))},qi.prototype.add=function(n,i,s){var u=new Li(n,i,s),c=this._nodeMap.get(u);return c!==null?c:(this._nodeMap.put(u,u),u)},qi.prototype.isIntersection=function(n){for(var i=this.iterator();i.hasNext();)if(i.next().coord.equals(n))return!0;return!1},qi.prototype.interfaces_=function(){return[]},qi.prototype.getClass=function(){return qi};var ns=function(){};ns.prototype.getChainStartIndices=function(n){var i=0,s=new Z;s.add(new lt(i));do{var u=this.findChainEnd(n,i);s.add(new lt(u)),i=u}while(i<n.length-1);return ns.toIntArray(s)},ns.prototype.findChainEnd=function(n,i){for(var s=cn.quadrant(n[i],n[i+1]),u=i+1;u<n.length&&cn.quadrant(n[u-1],n[u])===s;)u++;return u-1},ns.prototype.interfaces_=function(){return[]},ns.prototype.getClass=function(){return ns},ns.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 fo=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new Ct,this.env2=new Ct;var n=arguments[0];this.e=n,this.pts=n.getCoordinates();var i=new ns;this.startIndex=i.getChainStartIndices(this.pts)};fo.prototype.getCoordinates=function(){return this.pts},fo.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},fo.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},fo.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],K=arguments[5],pt=this.pts[c],dt=this.pts[m],Rt=E.pts[A],Ot=E.pts[U];if(m-c==1&&U-A==1)return K.addIntersections(this.e,c,E.e,A),null;if(this.env1.init(pt,dt),this.env2.init(Rt,Ot),!this.env1.intersects(this.env2))return null;var Vt=Math.trunc((c+m)/2),jt=Math.trunc((A+U)/2);c<Vt&&(A<jt&&this.computeIntersectsForChain(c,Vt,E,A,jt,K),jt<U&&this.computeIntersectsForChain(c,Vt,E,jt,U,K)),Vt<m&&(A<jt&&this.computeIntersectsForChain(Vt,m,E,A,jt,K),jt<U&&this.computeIntersectsForChain(Vt,m,E,jt,U,K))}},fo.prototype.getStartIndexes=function(){return this.startIndex},fo.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)},fo.prototype.interfaces_=function(){return[]},fo.prototype.getClass=function(){return fo};var Qn=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},em={NULL_VALUE:{configurable:!0}};Qn.prototype.getDepth=function(n,i){return this._depth[n][i]},Qn.prototype.setDepth=function(n,i,s){this._depth[n][i]=s},Qn.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]!==Qn.NULL_VALUE)return!1;return!0}if(arguments.length===1){var s=arguments[0];return this._depth[s][1]===Qn.NULL_VALUE}if(arguments.length===2){var u=arguments[0],c=arguments[1];return this._depth[u][c]===Qn.NULL_VALUE}},Qn.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}}},Qn.prototype.getDelta=function(n){return this._depth[n][bt.RIGHT]-this._depth[n][bt.LEFT]},Qn.prototype.getLocation=function(n,i){return this._depth[n][i]<=0?V.EXTERIOR:V.INTERIOR},Qn.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Qn.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!==V.EXTERIOR&&u!==V.INTERIOR||(this.isNull(i,s)?this._depth[i][s]=Qn.depthAtLocation(u):this._depth[i][s]+=Qn.depthAtLocation(u))}else if(arguments.length===3){var c=arguments[0],m=arguments[1];arguments[2]===V.INTERIOR&&this._depth[c][m]++}},Qn.prototype.interfaces_=function(){return[]},Qn.prototype.getClass=function(){return Qn},Qn.depthAtLocation=function(n){return n===V.EXTERIOR?0:n===V.INTERIOR?1:Qn.NULL_VALUE},em.NULL_VALUE.get=function(){return-1},Object.defineProperties(Qn,em);var El=function(n){function i(){if(n.call(this),this.pts=null,this._env=null,this.eiList=new qi(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Qn,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,on.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 fo(this)),this._mce},i.prototype.getEnvelope=function(){if(this._env===null){this._env=new Ct;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 I(s.getIntersection(m)),A=u,U=s.getEdgeDistance(c,m),K=A+1;if(K<this.pts.length){var pt=this.pts[K];E.equals2D(pt)&&(A=K,U=0)}this.eiList.add(E,A,U)},i.prototype.toString=function(){var s=new mt;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}(Jr),yr=function(n){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new xi,this._bufParams=n||null};yr.prototype.setWorkingPrecisionModel=function(n){this._workingPrecisionModel=n},yr.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 on(n.getLabel())).flip(),s.merge(u);var c=yr.depthDelta(u),m=i.getDepthDelta()+c;i.setDepthDelta(m)}else this._edgeList.add(n),n.setDepthDelta(yr.depthDelta(n.getLabel()))},yr.prototype.buildSubgraphs=function(n,i){for(var s=new Z,u=n.iterator();u.hasNext();){var c=u.next(),m=c.getRightmostCoordinate(),E=new Ls(s).getDepth(m);c.computeDepth(E),c.findResultEdges(),s.add(c),i.add(c.getDirectedEdges(),c.getNodes())}},yr.prototype.createSubgraphs=function(n){for(var i=new Z,s=n.getNodes().iterator();s.hasNext();){var u=s.next();if(!u.isVisited()){var c=new mr;c.create(u),i.add(c)}}return _i.sort(i,_i.reverseOrder()),i},yr.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},yr.prototype.getNoder=function(n){if(this._workingNoder!==null)return this._workingNoder;var i=new Eh,s=new pn;return s.setPrecisionModel(n),i.setSegmentIntersector(new Qr(s)),i},yr.prototype.buffer=function(n,i){var s=this._workingPrecisionModel;s===null&&(s=n.getPrecisionModel()),this._geomFact=n.getFactory();var u=new Rr(s,this._bufParams),c=new ci(n,i,u).getCurves();if(c.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(c,s),this._graph=new Tn(new tm),this._graph.addEdges(this._edgeList.getEdges());var m=this.createSubgraphs(this._graph),E=new Gr(this._geomFact);this.buildSubgraphs(m,E);var A=E.getPolygons();return A.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(A)},yr.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 El(c.getCoordinates(),new on(E));this.insertUniqueEdge(A)}}},yr.prototype.setNoder=function(n){this._workingNoder=n},yr.prototype.interfaces_=function(){return[]},yr.prototype.getClass=function(){return yr},yr.depthDelta=function(n){var i=n.getLocation(0,bt.LEFT),s=n.getLocation(0,bt.RIGHT);return i===V.INTERIOR&&s===V.EXTERIOR?1:i===V.EXTERIOR&&s===V.INTERIOR?-1:0},yr.convertSegStrings=function(n){for(var i=new ue,s=new Z;n.hasNext();){var u=n.next(),c=i.createLineString(u.getCoordinates());s.add(c)}return i.buildGeometry(s)};var Io=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()}};Io.prototype.rescale=function(){if($(arguments[0],j))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])&&Ft.out.println(s)}},Io.prototype.scale=function(){if($(arguments[0],j)){for(var n=arguments[0],i=new Z,s=n.iterator();s.hasNext();){var u=s.next();i.add(new Nn(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 I(Math.round((c[E].x-this._offsetX)*this._scaleFactor),Math.round((c[E].y-this._offsetY)*this._scaleFactor),c[E].z);return Q.removeRepeatedPoints(m)}},Io.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},Io.prototype.getNodedSubstrings=function(){var n=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(n),n},Io.prototype.computeNodes=function(n){var i=n;this._isScaled&&(i=this.scale(n)),this._noder.computeNodes(i)},Io.prototype.interfaces_=function(){return[Qo]},Io.prototype.getClass=function(){return Io};var Ni=function(){this._li=new pn,this._segStrings=null;var n=arguments[0];this._segStrings=n},nm={fact:{configurable:!0}};Ni.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 pe("found endpt/interior pt intersection at index "+m+" :pt "+s)}},Ni.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 K=0;K<A.length-1;K++)this.checkInteriorIntersections(c,U,m,K);else if(arguments.length===4){var pt=arguments[0],dt=arguments[1],Rt=arguments[2],Ot=arguments[3];if(pt===Rt&&dt===Ot)return null;var Vt=pt.getCoordinates()[dt],jt=pt.getCoordinates()[dt+1],sn=Rt.getCoordinates()[Ot],kn=Rt.getCoordinates()[Ot+1];if(this._li.computeIntersection(Vt,jt,sn,kn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,Vt,jt)||this.hasInteriorIntersection(this._li,sn,kn)))throw new pe("found non-noded intersection at "+Vt+"-"+jt+" and "+sn+"-"+kn)}},Ni.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},Ni.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])},Ni.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},Ni.prototype.checkCollapse=function(n,i,s){if(n.equals(s))throw new pe("found non-noded collapse at "+Ni.fact.createLineString([n,i,s]))},Ni.prototype.interfaces_=function(){return[]},Ni.prototype.getClass=function(){return Ni},nm.fact.get=function(){return new ue},Object.defineProperties(Ni,nm);var Lr=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 P("Scale factor must be non-zero");i!==1&&(this._pt=new I(this.scale(n.x),this.scale(n.y)),this._p0Scaled=new I,this._p1Scaled=new I),this.initCorners(this._pt)},rm={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Lr.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 Pt.isTrue(!(E&&A),"Found bad envelope test"),A},Lr.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 I(this._maxx,this._maxy),this._corner[1]=new I(this._minx,this._maxy),this._corner[2]=new I(this._minx,this._miny),this._corner[3]=new I(this._maxx,this._miny)},Lr.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))},Lr.prototype.scale=function(n){return Math.round(n*this._scaleFactor)},Lr.prototype.getCoordinate=function(){return this._originalPt},Lr.prototype.copyScaled=function(n,i){i.x=this.scale(n.x),i.y=this.scale(n.y)},Lr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var n=Lr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Ct(this._originalPt.x-n,this._originalPt.x+n,this._originalPt.y-n,this._originalPt.y+n)}return this._safeEnv},Lr.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())))},Lr.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))))},Lr.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)},Lr.prototype.interfaces_=function(){return[]},Lr.prototype.getClass=function(){return Lr},rm.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(Lr,rm);var bu=function(){this.tempEnv1=new Ct,this.selectedSegment=new Zt};bu.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)}}},bu.prototype.interfaces_=function(){return[]},bu.prototype.getClass=function(){return bu};var pa=function(){this._index=null;var n=arguments[0];this._index=n},im={HotPixelSnapAction:{configurable:!0}};pa.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 om(i,s,u);return this._index.query(c,{interfaces_:function(){return[Ao]},visitItem:function(E){E.select(c,m)}}),m.isNodeAdded()}},pa.prototype.interfaces_=function(){return[]},pa.prototype.getClass=function(){return pa},im.HotPixelSnapAction.get=function(){return om},Object.defineProperties(pa,im);var om=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}(bu),Ns=function(){this._li=null,this._interiorIntersections=null;var n=arguments[0];this._li=n,this._interiorIntersections=new Z};Ns.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)}},Ns.prototype.isDone=function(){return!1},Ns.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Ns.prototype.interfaces_=function(){return[es]},Ns.prototype.getClass=function(){return Ns};var Xi=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 pn,this._li.setPrecisionModel(n),this._scaleFactor=n.getScale()};Xi.prototype.checkCorrectness=function(n){var i=Nn.getNodedSubstrings(n),s=new Ni(i);try{s.checkValid()}catch(u){if(!(u instanceof qt))throw u;u.printStackTrace()}},Xi.prototype.getNodedSubstrings=function(){return Nn.getNodedSubstrings(this._nodedSegStrings)},Xi.prototype.snapRound=function(n,i){var s=this.findInteriorIntersections(n,i);this.computeIntersectionSnaps(s),this.computeVertexSnaps(n)},Xi.prototype.findInteriorIntersections=function(n,i){var s=new Ns(i);return this._noder.setSegmentIntersector(s),this._noder.computeNodes(n),s.getInteriorIntersections()},Xi.prototype.computeVertexSnaps=function(){if($(arguments[0],j))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.computeVertexSnaps(i)}else if(arguments[0]instanceof Nn)for(var s=arguments[0],u=s.getCoordinates(),c=0;c<u.length;c++){var m=new Lr(u[c],this._scaleFactor,this._li);this._pointSnapper.snap(m,s,c)&&s.addIntersection(u[c],c)}},Xi.prototype.computeNodes=function(n){this._nodedSegStrings=n,this._noder=new Eh,this._pointSnapper=new pa(this._noder.getIndex()),this.snapRound(n,this._li)},Xi.prototype.computeIntersectionSnaps=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),u=new Lr(s,this._scaleFactor,this._li);this._pointSnapper.snap(u)}},Xi.prototype.interfaces_=function(){return[Qo]},Xi.prototype.getClass=function(){return Xi};var tr=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}},da={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};tr.prototype.bufferFixedPrecision=function(n){var i=new Io(new Xi(new ie(1)),n.getScale()),s=new yr(this._bufParams);s.setWorkingPrecisionModel(n),s.setNoder(i),this._resultGeometry=s.buffer(this._argGeom,this._distance)},tr.prototype.bufferReducedPrecision=function(){var n=this;if(arguments.length===0){for(var i=tr.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=tr.precisionScaleFactor(this._argGeom,this._distance,s),c=new ie(u);this.bufferFixedPrecision(c)}},tr.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()},tr.prototype.setQuadrantSegments=function(n){this._bufParams.setQuadrantSegments(n)},tr.prototype.bufferOriginalPrecision=function(){try{var n=new yr(this._bufParams);this._resultGeometry=n.buffer(this._argGeom,this._distance)}catch(i){if(!(i instanceof pe))throw i;this._saveException=i}},tr.prototype.getResultGeometry=function(n){return this._distance=n,this.computeGeometry(),this._resultGeometry},tr.prototype.setEndCapStyle=function(n){this._bufParams.setEndCapStyle(n)},tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr},tr.bufferOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new tr(n).getResultGeometry(i)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof yt&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1],c=arguments[2],m=new tr(s);return m.setQuadrantSegments(c),m.getResultGeometry(u)}if(arguments[2]instanceof We&&arguments[0]instanceof yt&&typeof arguments[1]=="number"){var E=arguments[0],A=arguments[1],U=arguments[2];return new tr(E,U).getResultGeometry(A)}}else if(arguments.length===4){var K=arguments[0],pt=arguments[1],dt=arguments[2],Rt=arguments[3],Ot=new tr(K);return Ot.setQuadrantSegments(dt),Ot.setEndCapStyle(Rt),Ot.getResultGeometry(pt)}},tr.precisionScaleFactor=function(n,i,s){var u=n.getEnvelopeInternal(),c=ut.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)},da.CAP_ROUND.get=function(){return We.CAP_ROUND},da.CAP_BUTT.get=function(){return We.CAP_FLAT},da.CAP_FLAT.get=function(){return We.CAP_FLAT},da.CAP_SQUARE.get=function(){return We.CAP_SQUARE},da.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(tr,da);var vr=function(){this._pt=[new I,new I],this._distance=S.NaN,this._isNull=!0};vr.prototype.getCoordinates=function(){return this._pt},vr.prototype.getCoordinate=function(n){return this._pt[n]},vr.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)}},vr.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}},vr.prototype.getDistance=function(){return this._distance},vr.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)}},vr.prototype.interfaces_=function(){return[]},vr.prototype.getClass=function(){return vr};var Yi=function(){};Yi.prototype.interfaces_=function(){return[]},Yi.prototype.getClass=function(){return Yi},Yi.computeDistance=function(){if(arguments[2]instanceof vr&&arguments[0]instanceof zt&&arguments[1]instanceof I)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=n.getCoordinates(),c=new Zt,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 vr&&arguments[0]instanceof Wt&&arguments[1]instanceof I){var A=arguments[0],U=arguments[1],K=arguments[2];Yi.computeDistance(A.getExteriorRing(),U,K);for(var pt=0;pt<A.getNumInteriorRing();pt++)Yi.computeDistance(A.getInteriorRingN(pt),U,K)}else if(arguments[2]instanceof vr&&arguments[0]instanceof yt&&arguments[1]instanceof I){var dt=arguments[0],Rt=arguments[1],Ot=arguments[2];if(dt instanceof zt)Yi.computeDistance(dt,Rt,Ot);else if(dt instanceof Wt)Yi.computeDistance(dt,Rt,Ot);else if(dt instanceof gn)for(var Vt=dt,jt=0;jt<Vt.getNumGeometries();jt++){var sn=Vt.getGeometryN(jt);Yi.computeDistance(sn,Rt,Ot)}else Ot.setMinimum(dt.getCoordinate(),Rt)}else if(arguments[2]instanceof vr&&arguments[0]instanceof Zt&&arguments[1]instanceof I){var kn=arguments[0],Mr=arguments[1],Ki=arguments[2],Uo=kn.closestPoint(Mr);Ki.setMinimum(Uo,Mr)}};var rs=function(n){this._maxPtDist=new vr,this._inputGeom=n||null},Mh={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};rs.prototype.computeMaxMidpointDistance=function(n){var i=new Ro(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},rs.prototype.computeMaxVertexDistance=function(n){var i=new Os(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},rs.prototype.findDistance=function(n){return this.computeMaxVertexDistance(n),this.computeMaxMidpointDistance(n),this._maxPtDist.getDistance()},rs.prototype.getDistancePoints=function(){return this._maxPtDist},rs.prototype.interfaces_=function(){return[]},rs.prototype.getClass=function(){return rs},Mh.MaxPointDistanceFilter.get=function(){return Os},Mh.MaxMidpointDistanceFilter.get=function(){return Ro},Object.defineProperties(rs,Mh);var Os=function(n){this._maxPtDist=new vr,this._minPtDist=new vr,this._geom=n||null};Os.prototype.filter=function(n){this._minPtDist.initialize(),Yi.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Os.prototype.getMaxPointDistance=function(){return this._maxPtDist},Os.prototype.interfaces_=function(){return[Y]},Os.prototype.getClass=function(){return Os};var Ro=function(n){this._maxPtDist=new vr,this._minPtDist=new vr,this._geom=n||null};Ro.prototype.filter=function(n,i){if(i===0)return null;var s=n.getCoordinate(i-1),u=n.getCoordinate(i),c=new I((s.x+u.x)/2,(s.y+u.y)/2);this._minPtDist.initialize(),Yi.computeDistance(this._geom,c,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Ro.prototype.isDone=function(){return!1},Ro.prototype.isGeometryChanged=function(){return!1},Ro.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ro.prototype.interfaces_=function(){return[wn]},Ro.prototype.getClass=function(){return Ro};var po=function(n){this._comps=n||null};po.prototype.filter=function(n){n instanceof Wt&&this._comps.add(n)},po.prototype.interfaces_=function(){return[Cn]},po.prototype.getClass=function(){return po},po.getPolygons=function(){if(arguments.length===1){var n=arguments[0];return po.getPolygons(n,new Z)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof Wt?s.add(i):i instanceof gn&&i.apply(new po(s)),s}};var er=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}};er.prototype.filter=function(n){if(this._isForcedToLineString&&n instanceof an){var i=n.getFactory().createLineString(n.getCoordinateSequence());return this._lines.add(i),null}n instanceof zt&&this._lines.add(n)},er.prototype.setForceToLineString=function(n){this._isForcedToLineString=n},er.prototype.interfaces_=function(){return[wt]},er.prototype.getClass=function(){return er},er.getGeometry=function(){if(arguments.length===1){var n=arguments[0];return n.getFactory().buildGeometry(er.getLines(n))}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().buildGeometry(er.getLines(i,s))}},er.getLines=function(){if(arguments.length===1){var n=arguments[0];return er.getLines(n,!1)}if(arguments.length===2){if($(arguments[0],j)&&$(arguments[1],j)){for(var i=arguments[0],s=arguments[1],u=i.iterator();u.hasNext();){var c=u.next();er.getLines(c,s)}return s}if(arguments[0]instanceof yt&&typeof arguments[1]=="boolean"){var m=arguments[0],E=arguments[1],A=new Z;return m.apply(new er(A,E)),A}if(arguments[0]instanceof yt&&$(arguments[1],j)){var U=arguments[0],K=arguments[1];return U instanceof zt?K.add(U):U.apply(new er(K)),K}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&$(arguments[0],j)&&$(arguments[1],j)){for(var pt=arguments[0],dt=arguments[1],Rt=arguments[2],Ot=pt.iterator();Ot.hasNext();){var Vt=Ot.next();er.getLines(Vt,dt,Rt)}return dt}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof yt&&$(arguments[1],j)){var jt=arguments[0],sn=arguments[1],kn=arguments[2];return jt.apply(new er(sn,kn)),sn}}};var Ei=function(){if(this._boundaryRule=w.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 P("Rule must be non-null");this._boundaryRule=n}}};Ei.prototype.locateInternal=function(){if(arguments[0]instanceof I&&arguments[1]instanceof Wt){var n=arguments[0],i=arguments[1];if(i.isEmpty())return V.EXTERIOR;var s=i.getExteriorRing(),u=this.locateInPolygonRing(n,s);if(u===V.EXTERIOR)return V.EXTERIOR;if(u===V.BOUNDARY)return V.BOUNDARY;for(var c=0;c<i.getNumInteriorRing();c++){var m=i.getInteriorRingN(c),E=this.locateInPolygonRing(n,m);if(E===V.INTERIOR)return V.EXTERIOR;if(E===V.BOUNDARY)return V.BOUNDARY}return V.INTERIOR}if(arguments[0]instanceof I&&arguments[1]instanceof zt){var A=arguments[0],U=arguments[1];if(!U.getEnvelopeInternal().intersects(A))return V.EXTERIOR;var K=U.getCoordinates();return U.isClosed()||!A.equals(K[0])&&!A.equals(K[K.length-1])?J.isOnLine(A,K)?V.INTERIOR:V.EXTERIOR:V.BOUNDARY}if(arguments[0]instanceof I&&arguments[1]instanceof Kt){var pt=arguments[0];return arguments[1].getCoordinate().equals2D(pt)?V.INTERIOR:V.EXTERIOR}},Ei.prototype.locateInPolygonRing=function(n,i){return i.getEnvelopeInternal().intersects(n)?J.locatePointInRing(n,i.getCoordinates()):V.EXTERIOR},Ei.prototype.intersects=function(n,i){return this.locate(n,i)!==V.EXTERIOR},Ei.prototype.updateLocationInfo=function(n){n===V.INTERIOR&&(this._isIn=!0),n===V.BOUNDARY&&this._numBoundaries++},Ei.prototype.computeLocation=function(n,i){if(i instanceof Kt&&this.updateLocationInfo(this.locateInternal(n,i)),i instanceof zt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof Wt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof W)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 ln)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 gn)for(var U=new Wi(i);U.hasNext();){var K=U.next();K!==i&&this.computeLocation(n,K)}},Ei.prototype.locate=function(n,i){return i.isEmpty()?V.EXTERIOR:i instanceof zt?this.locateInternal(n,i):i instanceof Wt?this.locateInternal(n,i):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(n,i),this._boundaryRule.isInBoundary(this._numBoundaries)?V.BOUNDARY:this._numBoundaries>0||this._isIn?V.INTERIOR:V.EXTERIOR)},Ei.prototype.interfaces_=function(){return[]},Ei.prototype.getClass=function(){return Ei};var _r=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}},sm={INSIDE_AREA:{configurable:!0}};_r.prototype.isInsideArea=function(){return this._segIndex===_r.INSIDE_AREA},_r.prototype.getCoordinate=function(){return this._pt},_r.prototype.getGeometryComponent=function(){return this._component},_r.prototype.getSegmentIndex=function(){return this._segIndex},_r.prototype.interfaces_=function(){return[]},_r.prototype.getClass=function(){return _r},sm.INSIDE_AREA.get=function(){return-1},Object.defineProperties(_r,sm);var Lo=function(n){this._pts=n||null};Lo.prototype.filter=function(n){n instanceof Kt&&this._pts.add(n)},Lo.prototype.interfaces_=function(){return[Cn]},Lo.prototype.getClass=function(){return Lo},Lo.getPoints=function(){if(arguments.length===1){var n=arguments[0];return n instanceof Kt?_i.singletonList(n):Lo.getPoints(n,new Z)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof Kt?s.add(i):i instanceof gn&&i.apply(new Lo(s)),s}};var Ds=function(){this._locations=null;var n=arguments[0];this._locations=n};Ds.prototype.filter=function(n){(n instanceof Kt||n instanceof zt||n instanceof Wt)&&this._locations.add(new _r(n,0,n.getCoordinate()))},Ds.prototype.interfaces_=function(){return[Cn]},Ds.prototype.getClass=function(){return Ds},Ds.getLocations=function(n){var i=new Z;return n.apply(new Ds(i)),i};var nr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Ei,this._minDistanceLocation=null,this._minDistance=S.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}};nr.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=Ds.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&&$(arguments[0],tt)&&$(arguments[1],tt)){for(var E=arguments[0],A=arguments[1],U=arguments[2],K=0;K<E.size();K++)for(var pt=E.get(K),dt=0;dt<A.size();dt++)if(this.computeContainmentDistance(pt,A.get(dt),U),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof _r&&arguments[1]instanceof Wt){var Rt=arguments[0],Ot=arguments[1],Vt=arguments[2],jt=Rt.getCoordinate();if(V.EXTERIOR!==this._ptLocator.locate(jt,Ot))return this._minDistance=0,Vt[0]=Rt,Vt[1]=new _r(Ot,jt),null}}},nr.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}},nr.prototype.computeFacetDistance=function(){var n=new Array(2).fill(null),i=er.getLines(this._geom[0]),s=er.getLines(this._geom[1]),u=Lo.getPoints(this._geom[0]),c=Lo.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))))},nr.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},nr.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])},nr.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},nr.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 zt&&arguments[1]instanceof Kt){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=J.distancePointLine(c,u[m],u[m+1]);if(E<this._minDistance){this._minDistance=E;var A=new Zt(u[m],u[m+1]).closestPoint(c);s[0]=new _r(n,m,A),s[1]=new _r(i,0,c)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof zt&&arguments[1]instanceof zt){var U=arguments[0],K=arguments[1],pt=arguments[2];if(U.getEnvelopeInternal().distance(K.getEnvelopeInternal())>this._minDistance)return null;for(var dt=U.getCoordinates(),Rt=K.getCoordinates(),Ot=0;Ot<dt.length-1;Ot++)for(var Vt=0;Vt<Rt.length-1;Vt++){var jt=J.distanceLineLine(dt[Ot],dt[Ot+1],Rt[Vt],Rt[Vt+1]);if(jt<this._minDistance){this._minDistance=jt;var sn=new Zt(dt[Ot],dt[Ot+1]),kn=new Zt(Rt[Vt],Rt[Vt+1]),Mr=sn.closestPoints(kn);pt[0]=new _r(U,Ot,Mr[0]),pt[1]=new _r(K,Vt,Mr[1])}if(this._minDistance<=this._terminateDistance)return null}}}},nr.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 _r(c,0,c.getCoordinate()),s[1]=new _r(E,0,E.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},nr.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new P("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},nr.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}},nr.prototype.interfaces_=function(){return[]},nr.prototype.getClass=function(){return nr},nr.distance=function(n,i){return new nr(n,i).distance()},nr.isWithinDistance=function(n,i,s){return new nr(n,i,s).distance()<=s},nr.nearestPoints=function(n,i){return new nr(n,i).nearestPoints()};var ur=function(){this._pt=[new I,new I],this._distance=S.NaN,this._isNull=!0};ur.prototype.getCoordinates=function(){return this._pt},ur.prototype.getCoordinate=function(n){return this._pt[n]},ur.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)}},ur.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}},ur.prototype.toString=function(){return Yt.toLineString(this._pt[0],this._pt[1])},ur.prototype.getDistance=function(){return this._distance},ur.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)}},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur};var Oi=function(){};Oi.prototype.interfaces_=function(){return[]},Oi.prototype.getClass=function(){return Oi},Oi.computeDistance=function(){if(arguments[2]instanceof ur&&arguments[0]instanceof zt&&arguments[1]instanceof I)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=new Zt,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 ur&&arguments[0]instanceof Wt&&arguments[1]instanceof I){var A=arguments[0],U=arguments[1],K=arguments[2];Oi.computeDistance(A.getExteriorRing(),U,K);for(var pt=0;pt<A.getNumInteriorRing();pt++)Oi.computeDistance(A.getInteriorRingN(pt),U,K)}else if(arguments[2]instanceof ur&&arguments[0]instanceof yt&&arguments[1]instanceof I){var dt=arguments[0],Rt=arguments[1],Ot=arguments[2];if(dt instanceof zt)Oi.computeDistance(dt,Rt,Ot);else if(dt instanceof Wt)Oi.computeDistance(dt,Rt,Ot);else if(dt instanceof gn)for(var Vt=dt,jt=0;jt<Vt.getNumGeometries();jt++){var sn=Vt.getGeometryN(jt);Oi.computeDistance(sn,Rt,Ot)}else Ot.setMinimum(dt.getCoordinate(),Rt)}else if(arguments[2]instanceof ur&&arguments[0]instanceof Zt&&arguments[1]instanceof I){var kn=arguments[0],Mr=arguments[1],Ki=arguments[2],Uo=kn.closestPoint(Mr);Ki.setMinimum(Uo,Mr)}};var hi=function(){this._g0=null,this._g1=null,this._ptDist=new ur,this._densifyFrac=0;var n=arguments[0],i=arguments[1];this._g0=n,this._g1=i},Sh={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};hi.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},hi.prototype.setDensifyFraction=function(n){if(n>1||n<=0)throw new P("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=n},hi.prototype.compute=function(n,i){this.computeOrientedDistance(n,i,this._ptDist),this.computeOrientedDistance(i,n,this._ptDist)},hi.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},hi.prototype.computeOrientedDistance=function(n,i,s){var u=new Fs(i);if(n.apply(u),s.setMaximum(u.getMaxPointDistance()),this._densifyFrac>0){var c=new No(i,this._densifyFrac);n.apply(c),s.setMaximum(c.getMaxPointDistance())}},hi.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},hi.prototype.interfaces_=function(){return[]},hi.prototype.getClass=function(){return hi},hi.distance=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new hi(n,i).distance()}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=new hi(s,u);return m.setDensifyFraction(c),m.distance()}},Sh.MaxPointDistanceFilter.get=function(){return Fs},Sh.MaxDensifiedByFractionDistanceFilter.get=function(){return No},Object.defineProperties(hi,Sh);var Fs=function(){this._maxPtDist=new ur,this._minPtDist=new ur,this._euclideanDist=new Oi,this._geom=null;var n=arguments[0];this._geom=n};Fs.prototype.filter=function(n){this._minPtDist.initialize(),Oi.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Fs.prototype.getMaxPointDistance=function(){return this._maxPtDist},Fs.prototype.interfaces_=function(){return[Y]},Fs.prototype.getClass=function(){return Fs};var No=function(){this._maxPtDist=new ur,this._minPtDist=new ur,this._geom=null,this._numSubSegs=0;var n=arguments[0],i=arguments[1];this._geom=n,this._numSubSegs=Math.trunc(Math.round(1/i))};No.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,K=new I(A,U);this._minPtDist.initialize(),Oi.computeDistance(this._geom,K,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},No.prototype.isDone=function(){return!1},No.prototype.isGeometryChanged=function(){return!1},No.prototype.getMaxPointDistance=function(){return this._maxPtDist},No.prototype.interfaces_=function(){return[wn]},No.prototype.getClass=function(){return No};var Hr=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},wh={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Hr.prototype.checkMaximumDistance=function(n,i,s){var u=new hi(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 "+Yt.toLineString(c[0],c[1])+")"}},Hr.prototype.isValid=function(){var n=Math.abs(this._bufDistance),i=Hr.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(),Hr.VERBOSE&&Ft.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Hr.prototype.checkNegativeValid=function(){if(!(this._input instanceof Wt||this._input instanceof ln||this._input instanceof gn))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)},Hr.prototype.getErrorIndicator=function(){return this._errorIndicator},Hr.prototype.checkMinimumDistance=function(n,i,s){var u=new nr(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 "+Yt.toLineString(c[0],c[1])+" )"}},Hr.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)},Hr.prototype.getErrorLocation=function(){return this._errorLocation},Hr.prototype.getPolygonLines=function(n){for(var i=new Z,s=new er(i),u=po.getPolygons(n).iterator();u.hasNext();)u.next().apply(s);return n.getFactory().buildGeometry(i)},Hr.prototype.getErrorMessage=function(){return this._errMsg},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr},wh.VERBOSE.get=function(){return!1},wh.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Hr,wh);var rr=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},bh={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};rr.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},rr.prototype.checkEnvelope=function(){if(this._distance<0)return null;var n=this._distance*rr.MAX_ENV_DIFF_FRAC;n===0&&(n=.001);var i=new Ct(this._input.getEnvelopeInternal());i.expandBy(this._distance);var s=new Ct(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")},rr.prototype.checkDistance=function(){var n=new Hr(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")},rr.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")},rr.prototype.checkPolygonal=function(){this._result instanceof Wt||this._result instanceof ln||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},rr.prototype.getErrorIndicator=function(){return this._errorIndicator},rr.prototype.getErrorLocation=function(){return this._errorLocation},rr.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"))},rr.prototype.report=function(n){if(!rr.VERBOSE)return null;Ft.out.println("Check "+n+": "+(this._isValid?"passed":"FAILED"))},rr.prototype.getErrorMessage=function(){return this._errorMsg},rr.prototype.interfaces_=function(){return[]},rr.prototype.getClass=function(){return rr},rr.isValidMsg=function(n,i,s){var u=new rr(n,i,s);return u.isValid()?null:u.getErrorMessage()},rr.isValid=function(n,i,s){return!!new rr(n,i,s).isValid()},bh.VERBOSE.get=function(){return!1},bh.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(rr,bh);var Di=function(){this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};Di.prototype.getCoordinates=function(){return this._pts},Di.prototype.size=function(){return this._pts.length},Di.prototype.getCoordinate=function(n){return this._pts[n]},Di.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Di.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:Is.octant(this.getCoordinate(n),this.getCoordinate(n+1))},Di.prototype.setData=function(n){this._data=n},Di.prototype.getData=function(){return this._data},Di.prototype.toString=function(){return Yt.toLineString(new fe(this._pts))},Di.prototype.interfaces_=function(){return[Hi]},Di.prototype.getClass=function(){return Di};var Kn=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new Z,this._intersectionCount=0,this._keepIntersections=!0;var n=arguments[0];this._li=n,this._interiorIntersection=null};Kn.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Kn.prototype.setCheckEndSegmentsOnly=function(n){this._isCheckEndSegmentsOnly=n},Kn.prototype.getIntersectionSegments=function(){return this._intSegments},Kn.prototype.count=function(){return this._intersectionCount},Kn.prototype.getIntersections=function(){return this._intersections},Kn.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},Kn.prototype.setKeepIntersections=function(n){this._keepIntersections=n},Kn.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++)},Kn.prototype.isEndSegment=function(n,i){return i===0||i>=n.size()-2},Kn.prototype.hasIntersection=function(){return this._interiorIntersection!==null},Kn.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},Kn.prototype.interfaces_=function(){return[es]},Kn.prototype.getClass=function(){return Kn},Kn.createAllIntersectionsFinder=function(n){var i=new Kn(n);return i.setFindAllIntersections(!0),i},Kn.createAnyIntersectionFinder=function(n){return new Kn(n)},Kn.createIntersectionCounter=function(n){var i=new Kn(n);return i.setFindAllIntersections(!0),i.setKeepIntersections(!1),i};var Mi=function(){this._li=new pn,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var n=arguments[0];this._segStrings=n};Mi.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},Mi.prototype.getIntersections=function(){return this._segInt.getIntersections()},Mi.prototype.isValid=function(){return this.execute(),this._isValid},Mi.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},Mi.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Kn(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var n=new Eh;if(n.setSegmentIntersector(this._segInt),n.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Mi.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new lo(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Mi.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var n=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Yt.toLineString(n[0],n[1])+" and "+Yt.toLineString(n[2],n[3])},Mi.prototype.interfaces_=function(){return[]},Mi.prototype.getClass=function(){return Mi},Mi.computeIntersections=function(n){var i=new Mi(n);return i.setFindAllIntersections(!0),i.isValid(),i.getIntersections()};var is=function n(){this._nv=null;var i=arguments[0];this._nv=new Mi(n.toSegmentStrings(i))};is.prototype.checkValid=function(){this._nv.checkValid()},is.prototype.interfaces_=function(){return[]},is.prototype.getClass=function(){return is},is.toSegmentStrings=function(n){for(var i=new Z,s=n.iterator();s.hasNext();){var u=s.next();i.add(new Di(u.getCoordinates(),u))}return i},is.checkValid=function(n){new is(n).checkValid()};var Us=function(n){this._mapOp=n};Us.prototype.map=function(n){for(var i=new Z,s=0;s<n.getNumGeometries();s++){var u=this._mapOp.map(n.getGeometryN(s));u.isEmpty()||i.add(u)}return n.getFactory().createGeometryCollection(ue.toGeometryArray(i))},Us.prototype.interfaces_=function(){return[]},Us.prototype.getClass=function(){return Us},Us.map=function(n,i){return new Us(i).map(n)};var Fi=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new Z,this._resultLineList=new Z;var n=arguments[0],i=arguments[1],s=arguments[2];this._op=n,this._geometryFactory=i,this._ptLocator=s};Fi.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)}},Fi.prototype.labelIsolatedLine=function(n,i){var s=this._ptLocator.locate(n.getCoordinate(),this._op.getArgGeometry(i));n.getLabel().setLocation(i,s)},Fi.prototype.build=function(n){return this.findCoveredLineEdges(),this.collectLines(n),this.buildLines(n),this._resultLineList},Fi.prototype.collectLineEdge=function(n,i,s){var u=n.getLabel(),c=n.getEdge();n.isLineEdge()&&(n.isVisited()||!se.isResultOfOp(u,i)||c.isCovered()||(s.add(c),n.setVisitedEdge(!0)))},Fi.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)}}},Fi.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))}},Fi.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)}},Fi.prototype.collectBoundaryTouchEdge=function(n,i,s){var u=n.getLabel();return n.isLineEdge()||n.isVisited()||n.isInteriorAreaEdge()||n.getEdge().isInResult()?null:(Pt.isTrue(!(n.isInResult()||n.getSym().isInResult())||!n.getEdge().isInResult()),void(se.isResultOfOp(u,i)&&i===se.INTERSECTION&&(s.add(n.getEdge()),n.setVisitedEdge(!0))))},Fi.prototype.interfaces_=function(){return[]},Fi.prototype.getClass=function(){return Fi};var Bs=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new Z;var n=arguments[0],i=arguments[1];this._op=n,this._geometryFactory=i};Bs.prototype.filterCoveredNodeToPoint=function(n){var i=n.getCoordinate();if(!this._op.isCoveredByLA(i)){var s=this._geometryFactory.createPoint(i);this._resultPointList.add(s)}},Bs.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===se.INTERSECTION)){var u=s.getLabel();se.isResultOfOp(u,n)&&this.filterCoveredNodeToPoint(s)}}},Bs.prototype.build=function(n){return this.extractNonCoveredResultNodes(n),this._resultPointList},Bs.prototype.interfaces_=function(){return[]},Bs.prototype.getClass=function(){return Bs};var Nr=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Nr.prototype.transformPoint=function(n,i){return this._factory.createPoint(this.transformCoordinates(n.getCoordinateSequence(),n))},Nr.prototype.transformPolygon=function(n,i){var s=!0,u=this.transformLinearRing(n.getExteriorRing(),n);u!==null&&u instanceof an&&!u.isEmpty()||(s=!1);for(var c=new Z,m=0;m<n.getNumInteriorRing();m++){var E=this.transformLinearRing(n.getInteriorRingN(m),n);E===null||E.isEmpty()||(E instanceof an||(s=!1),c.add(E))}if(s)return this._factory.createPolygon(u,c.toArray([]));var A=new Z;return u!==null&&A.add(u),A.addAll(c),this._factory.buildGeometry(A)},Nr.prototype.createCoordinateSequence=function(n){return this._factory.getCoordinateSequenceFactory().create(n)},Nr.prototype.getInputGeometry=function(){return this._inputGeom},Nr.prototype.transformMultiLineString=function(n,i){for(var s=new Z,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)},Nr.prototype.transformCoordinates=function(n,i){return this.copy(n)},Nr.prototype.transformLineString=function(n,i){return this._factory.createLineString(this.transformCoordinates(n.getCoordinateSequence(),n))},Nr.prototype.transformMultiPoint=function(n,i){for(var s=new Z,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)},Nr.prototype.transformMultiPolygon=function(n,i){for(var s=new Z,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)},Nr.prototype.copy=function(n){return n.copy()},Nr.prototype.transformGeometryCollection=function(n,i){for(var s=new Z,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(ue.toGeometryArray(s)):this._factory.buildGeometry(s)},Nr.prototype.transform=function(n){if(this._inputGeom=n,this._factory=n.getFactory(),n instanceof Kt)return this.transformPoint(n,null);if(n instanceof he)return this.transformMultiPoint(n,null);if(n instanceof an)return this.transformLinearRing(n,null);if(n instanceof zt)return this.transformLineString(n,null);if(n instanceof W)return this.transformMultiLineString(n,null);if(n instanceof Wt)return this.transformPolygon(n,null);if(n instanceof ln)return this.transformMultiPolygon(n,null);if(n instanceof gn)return this.transformGeometryCollection(n,null);throw new P("Unknown Geometry subtype: "+n.getClass().getName())},Nr.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)},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr};var $i=function n(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Zt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof zt&&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}};$i.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 I(m)),u===0&&this._isClosed&&n.set(n.size()-1,new I(m)))}},$i.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},$i.prototype.snapTo=function(n){var i=new ot(this._srcPts);return this.snapVertices(i,n),this.snapSegments(i,n),i.toCoordinateArray()},$i.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 I(c),!1)}},$i.prototype.findSegmentIndexToSnap=function(n,i){for(var s=S.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},$i.prototype.setAllowSnappingToSourceVertices=function(n){this._allowSnappingToSourceVertices=n},$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i},$i.isClosed=function(n){return!(n.length<=1)&&n[0].equals2D(n[n.length-1])};var On=function(n){this._srcGeom=n||null},am={SNAP_PRECISION_FACTOR:{configurable:!0}};On.prototype.snapTo=function(n,i){var s=this.extractTargetCoordinates(n);return new um(i,s).transform(this._srcGeom)},On.prototype.snapToSelf=function(n,i){var s=this.extractTargetCoordinates(this._srcGeom),u=new um(n,s,!0).transform(this._srcGeom),c=u;return i&&$(c,ce)&&(c=u.buffer(0)),c},On.prototype.computeSnapTolerance=function(n){return this.computeMinimumSegmentLength(n)/10},On.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))},On.prototype.computeMinimumSegmentLength=function(n){for(var i=S.MAX_VALUE,s=0;s<n.length-1;s++){var u=n[s].distance(n[s+1]);u<i&&(i=u)}return i},On.prototype.interfaces_=function(){return[]},On.prototype.getClass=function(){return On},On.snap=function(n,i,s){var u=new Array(2).fill(null),c=new On(n);u[0]=c.snapTo(i,s);var m=new On(i);return u[1]=m.snapTo(u[0],s),u},On.computeOverlaySnapTolerance=function(){if(arguments.length===1){var n=arguments[0],i=On.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(On.computeOverlaySnapTolerance(c),On.computeOverlaySnapTolerance(m))}},On.computeSizeBasedSnapTolerance=function(n){var i=n.getEnvelopeInternal();return Math.min(i.getHeight(),i.getWidth())*On.SNAP_PRECISION_FACTOR},On.snapToSelf=function(n,i,s){return new On(n).snapToSelf(i,s)},am.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(On,am);var um=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 $i(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}(Nr),xr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};xr.prototype.getCommon=function(){return S.longBitsToDouble(this._commonBits)},xr.prototype.add=function(n){var i=S.doubleToLongBits(n);if(this._isFirst)return this._commonBits=i,this._commonSignExp=xr.signExpBits(this._commonBits),this._isFirst=!1,null;if(xr.signExpBits(i)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=xr.numCommonMostSigMantissaBits(this._commonBits,i),this._commonBits=xr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},xr.prototype.toString=function(){if(arguments.length===1){var n=arguments[0],i=S.longBitsToDouble(n),s="0000000000000000000000000000000000000000000000000000000000000000"+S.toBinaryString(n),u=s.substring(s.length-64);return u.substring(0,1)+" "+u.substring(1,12)+"(exp) "+u.substring(12)+" [ "+i+" ]"}},xr.prototype.interfaces_=function(){return[]},xr.prototype.getClass=function(){return xr},xr.getBit=function(n,i){return n&1<<i?1:0},xr.signExpBits=function(n){return n>>52},xr.zeroLowerBits=function(n,i){return n&~((1<<i)-1)},xr.numCommonMostSigMantissaBits=function(n,i){for(var s=0,u=52;u>=0;u--){if(xr.getBit(n,u)!==xr.getBit(i,u))return s;s++}return 52};var Oo=function(){this._commonCoord=null,this._ccFilter=new zs},Th={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Oo.prototype.addCommonBits=function(n){var i=new Do(this._commonCoord);n.apply(i),n.geometryChanged()},Oo.prototype.removeCommonBits=function(n){if(this._commonCoord.x===0&&this._commonCoord.y===0)return n;var i=new I(this._commonCoord);i.x=-i.x,i.y=-i.y;var s=new Do(i);return n.apply(s),n.geometryChanged(),n},Oo.prototype.getCommonCoordinate=function(){return this._commonCoord},Oo.prototype.add=function(n){n.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Oo.prototype.interfaces_=function(){return[]},Oo.prototype.getClass=function(){return Oo},Th.CommonCoordinateFilter.get=function(){return zs},Th.Translater.get=function(){return Do},Object.defineProperties(Oo,Th);var zs=function(){this._commonBitsX=new xr,this._commonBitsY=new xr};zs.prototype.filter=function(n){this._commonBitsX.add(n.x),this._commonBitsY.add(n.y)},zs.prototype.getCommonCoordinate=function(){return new I(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},zs.prototype.interfaces_=function(){return[Y]},zs.prototype.getClass=function(){return zs};var Do=function(){this.trans=null;var n=arguments[0];this.trans=n};Do.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)},Do.prototype.isDone=function(){return!1},Do.prototype.isGeometryChanged=function(){return!0},Do.prototype.interfaces_=function(){return[wn]},Do.prototype.getClass=function(){return Do};var jn=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()};jn.prototype.selfSnap=function(n){return new On(n).snapTo(n,this._snapTolerance)},jn.prototype.removeCommonBits=function(n){this._cbr=new Oo,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},jn.prototype.prepareResult=function(n){return this._cbr.addCommonBits(n),n},jn.prototype.getResultGeometry=function(n){var i=this.snap(this._geom),s=se.overlayOp(i[0],i[1],n);return this.prepareResult(s)},jn.prototype.checkValid=function(n){n.isValid()||Ft.out.println("Snapped geometry is invalid")},jn.prototype.computeSnapTolerance=function(){this._snapTolerance=On.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},jn.prototype.snap=function(n){var i=this.removeCommonBits(n);return On.snap(i[0],i[1],this._snapTolerance)},jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn},jn.overlayOp=function(n,i,s){return new jn(n,i).getResultGeometry(s)},jn.union=function(n,i){return jn.overlayOp(n,i,se.UNION)},jn.intersection=function(n,i){return jn.overlayOp(n,i,se.INTERSECTION)},jn.symDifference=function(n,i){return jn.overlayOp(n,i,se.SYMDIFFERENCE)},jn.difference=function(n,i){return jn.overlayOp(n,i,se.DIFFERENCE)};var Er=function(n,i){this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i};Er.prototype.getResultGeometry=function(n){var i=null,s=!1,u=null;try{i=se.overlayOp(this._geom[0],this._geom[1],n),s=!0}catch(c){if(!(c instanceof pe))throw c;u=c}if(!s)try{i=jn.overlayOp(this._geom[0],this._geom[1],n)}catch(c){throw c instanceof pe?u:c}return i},Er.prototype.interfaces_=function(){return[]},Er.prototype.getClass=function(){return Er},Er.overlayOp=function(n,i,s){return new Er(n,i).getResultGeometry(s)},Er.union=function(n,i){return Er.overlayOp(n,i,se.UNION)},Er.intersection=function(n,i){return Er.overlayOp(n,i,se.INTERSECTION)},Er.symDifference=function(n,i){return Er.overlayOp(n,i,se.SYMDIFFERENCE)},Er.difference=function(n,i){return Er.overlayOp(n,i,se.DIFFERENCE)};var Tu=function(){this.mce=null,this.chainIndex=null;var n=arguments[0],i=arguments[1];this.mce=n,this.chainIndex=i};Tu.prototype.computeIntersections=function(n,i){this.mce.computeIntersectsForChain(this.chainIndex,n.mce,n.chainIndex,i)},Tu.prototype.interfaces_=function(){return[]},Tu.prototype.getClass=function(){return Tu};var Wr=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}},Ah={INSERT:{configurable:!0},DELETE:{configurable:!0}};Wr.prototype.isDelete=function(){return this._eventType===Wr.DELETE},Wr.prototype.setDeleteEventIndex=function(n){this._deleteEventIndex=n},Wr.prototype.getObject=function(){return this._obj},Wr.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},Wr.prototype.getInsertEvent=function(){return this._insertEvent},Wr.prototype.isInsert=function(){return this._eventType===Wr.INSERT},Wr.prototype.isSameLabel=function(n){return this._label!==null&&this._label===n._label},Wr.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Wr.prototype.interfaces_=function(){return[N]},Wr.prototype.getClass=function(){return Wr},Ah.INSERT.get=function(){return 1},Ah.DELETE.get=function(){return 2},Object.defineProperties(Wr,Ah);var Ml=function(){};Ml.prototype.interfaces_=function(){return[]},Ml.prototype.getClass=function(){return Ml};var ir=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};ir.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(ir.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},ir.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},ir.prototype.setIsDoneIfProperInt=function(n){this._isDoneWhenProperInt=n},ir.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},ir.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},ir.prototype.hasProperIntersection=function(){return this._hasProper},ir.prototype.hasIntersection=function(){return this._hasIntersection},ir.prototype.isDone=function(){return this._isDone},ir.prototype.isBoundaryPoint=function(n,i){return i!==null&&(!!this.isBoundaryPointInternal(n,i[0])||!!this.isBoundaryPointInternal(n,i[1]))},ir.prototype.setBoundaryNodes=function(n,i){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=n,this._bdyNodes[1]=i},ir.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))))},ir.prototype.interfaces_=function(){return[]},ir.prototype.getClass=function(){return ir},ir.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var q1=function(n){function i(){n.call(this),this.events=new Z,this.nOverlaps=null}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.prepareEvents=function(){_i.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 ir&&$(arguments[0],tt)&&$(arguments[1],tt)){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"&&$(arguments[0],tt)&&arguments[1]instanceof ir){var U=arguments[0],K=arguments[1];arguments[2]?this.addEdges(U,null):this.addEdges(U),this.computeIntersections(K)}}},i.prototype.addEdge=function(s,u){for(var c=s.getMonotoneChainEdge(),m=c.getStartIndexes(),E=0;E<m.length-1;E++){var A=new Tu(c,E),U=new Wr(u,c.getMinX(E),A);this.events.add(U),this.events.add(new Wr(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 K=U.getObject();c.isSameLabel(U)||(E.computeIntersections(K,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}(Ml),Zi=function(){this._min=S.POSITIVE_INFINITY,this._max=S.NEGATIVE_INFINITY},lm={NodeComparator:{configurable:!0}};Zi.prototype.getMin=function(){return this._min},Zi.prototype.intersects=function(n,i){return!(this._min>i||this._max<n)},Zi.prototype.getMax=function(){return this._max},Zi.prototype.toString=function(){return Yt.toLineString(new I(this._min,0),new I(this._max,0))},Zi.prototype.interfaces_=function(){return[]},Zi.prototype.getClass=function(){return Zi},lm.NodeComparator.get=function(){return Au},Object.defineProperties(Zi,lm);var Au=function(){};Au.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},Au.prototype.interfaces_=function(){return[B]},Au.prototype.getClass=function(){return Au};var X1=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}(Zi),Y1=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}(Zi),Ji=function(){this._leaves=new Z,this._root=null,this._level=0};Ji.prototype.buildTree=function(){_i.sort(this._leaves,new Zi.NodeComparator);for(var n=this._leaves,i=null,s=new Z;;){if(this.buildLevel(n,s),s.size()===1)return s.get(0);i=n,n=s,s=i}},Ji.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 X1(n,i,s))},Ji.prototype.query=function(n,i,s){this.init(),this._root.query(n,i,s)},Ji.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},Ji.prototype.printNode=function(n){Ft.out.println(Yt.toLineString(new I(n._min,this._level),new I(n._max,this._level)))},Ji.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},Ji.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 Y1(n.get(s),n.get(s+1));i.add(c)}}},Ji.prototype.interfaces_=function(){return[]},Ji.prototype.getClass=function(){return Ji};var ma=function(){this._items=new Z};ma.prototype.visitItem=function(n){this._items.add(n)},ma.prototype.getItems=function(){return this._items},ma.prototype.interfaces_=function(){return[Ao]},ma.prototype.getClass=function(){return ma};var ga=function(){this._index=null;var n=arguments[0];if(!$(n,ce))throw new P("Argument must be Polygonal");this._index=new os(n)},Ch={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};ga.prototype.locate=function(n){var i=new F(n),s=new ya(i);return this._index.query(n.y,n.y,s),i.getLocation()},ga.prototype.interfaces_=function(){return[fa]},ga.prototype.getClass=function(){return ga},Ch.SegmentVisitor.get=function(){return ya},Ch.IntervalIndexedGeometry.get=function(){return os},Object.defineProperties(ga,Ch);var ya=function(){this._counter=null;var n=arguments[0];this._counter=n};ya.prototype.visitItem=function(n){var i=n;this._counter.countSegment(i.getCoordinate(0),i.getCoordinate(1))},ya.prototype.interfaces_=function(){return[Ao]},ya.prototype.getClass=function(){return ya};var os=function(){this._index=new Ji;var n=arguments[0];this.init(n)};os.prototype.init=function(n){for(var i=er.getLines(n).iterator();i.hasNext();){var s=i.next().getCoordinates();this.addLine(s)}},os.prototype.addLine=function(n){for(var i=1;i<n.length;i++){var s=new Zt(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)}},os.prototype.query=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new ma;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)}},os.prototype.interfaces_=function(){return[]},os.prototype.getClass=function(){return os};var Cu=function(n){function i(){if(n.call(this),this._parentGeom=null,this._lineEdgeMap=new ua,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Ei,arguments.length===2){var s=arguments[0],u=arguments[1],c=w.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;V.NONE,c.getLocation(s,bt.ON)===V.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 ir(c,!0,!1);A.setIsDoneIfProperInt(E);var U=this.createEdgeSetIntersector(),K=this._parentGeom instanceof an||this._parentGeom instanceof Wt||this._parentGeom instanceof ln,pt=m||!K;return U.computeIntersections(this._edges,A,pt),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 ir(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 Kt){var s=arguments[0].getCoordinate();this.insertPoint(this._argIndex,s,V.INTERIOR)}else if(arguments[0]instanceof I){var u=arguments[0];this.insertPoint(this._argIndex,u,V.INTERIOR)}},i.prototype.addPolygon=function(s){this.addPolygonRing(s.getExteriorRing(),V.EXTERIOR,V.INTERIOR);for(var u=0;u<s.getNumInteriorRing();u++){var c=s.getInteriorRingN(u);this.addPolygonRing(c,V.INTERIOR,V.EXTERIOR)}},i.prototype.addEdge=function(s){this.insertEdge(s);var u=s.getCoordinates();this.insertPoint(this._argIndex,u[0],V.BOUNDARY),this.insertPoint(this._argIndex,u[u.length-1],V.BOUNDARY)},i.prototype.addLineString=function(s){var u=Q.removeRepeatedPoints(s.getCoordinates());if(u.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=u[0],null;var c=new El(u,new on(this._argIndex,V.INTERIOR));this._lineEdgeMap.put(s,c),this.insertEdge(c),Pt.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===V.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=Q.removeRepeatedPoints(s.getCoordinates());if(m.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=m[0],null;var E=u,A=c;J.isCCW(m)&&(E=c,A=u);var U=new El(m,new on(this._argIndex,V.BOUNDARY,E,A));this._lineEdgeMap.put(s,U),this.insertEdge(U),this.insertPoint(this._argIndex,m[0],V.BOUNDARY)},i.prototype.insertPoint=function(s,u,c){var m=this._nodes.addNode(u),E=m.getLabel();E===null?m._label=new on(s,c):E.setLocation(s,c)},i.prototype.createEdgeSetIntersector=function(){return new q1},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 ln&&(this._useBoundaryDeterminationRule=!1),s instanceof Wt)this.addPolygon(s);else if(s instanceof zt)this.addLineString(s);else if(s instanceof Kt)this.addPoint(s);else if(s instanceof he)this.addCollection(s);else if(s instanceof W)this.addCollection(s);else if(s instanceof ln)this.addCollection(s);else{if(!(s instanceof gn))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 $(this._parentGeom,ce)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new ga(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)?V.BOUNDARY:V.INTERIOR},i}(Tn),va=function(){if(this._li=new pn,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 Cu(0,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=w.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 Cu(0,i,u),this._arg[1]=new Cu(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 Cu(0,c,E),this._arg[1]=new Cu(1,m,E)}};va.prototype.getArgGeometry=function(n){return this._arg[n].getGeometry()},va.prototype.setComputationPrecision=function(n){this._resultPrecisionModel=n,this._li.setPrecisionModel(this._resultPrecisionModel)},va.prototype.interfaces_=function(){return[]},va.prototype.getClass=function(){return va};var ss=function(){};ss.prototype.interfaces_=function(){return[]},ss.prototype.getClass=function(){return ss},ss.map=function(){if(arguments[0]instanceof yt&&$(arguments[1],ss.MapOp)){for(var n=arguments[0],i=arguments[1],s=new Z,u=0;u<n.getNumGeometries();u++){var c=i.map(n.getGeometryN(u));c!==null&&s.add(c)}return n.getFactory().buildGeometry(s)}if($(arguments[0],j)&&$(arguments[1],ss.MapOp)){for(var m=arguments[0],E=arguments[1],A=new Z,U=m.iterator();U.hasNext();){var K=U.next(),pt=E.map(K);pt!==null&&A.add(pt)}return A}},ss.MapOp=function(){};var se=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u),this._ptLocator=new Ei,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new xi,this._resultPolyList=new Z,this._resultLineList=new Z,this._resultPointList=new Z,this._graph=new Tn(new tm),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 on(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 Z;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)!==V.EXTERIOR)return!0}return!1},i.prototype.replaceCollapsedEdges=function(){for(var s=new Z,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 Z;this._arg[0].computeSplitEdges(u),this._arg[1].computeSplitEdges(u),this.insertUniqueEdges(u),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),is.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(s),this.cancelDuplicateResultEdges();var c=new Gr(this._geomFact);c.add(this._graph),this._resultPolyList=c.getPolygons();var m=new Fi(this,this._geomFact,this._ptLocator);this._resultLineList=m.build(s);var E=new Bs(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):(Pt.isTrue(!m.isNull(E,bt.LEFT),"depth of LEFT side has not been initialized"),c.setLocation(E,bt.LEFT,m.getLocation(E,bt.LEFT)),Pt.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}(va);se.overlayOp=function(n,i,s){return new se(n,i).getResultGeometry(s)},se.intersection=function(n,i){if(n.isEmpty()||i.isEmpty())return se.createEmptyResult(se.INTERSECTION,n,i,n.getFactory());if(n.isGeometryCollection()){var s=i;return Us.map(n,{interfaces_:function(){return[ss.MapOp]},map:function(u){return u.intersection(s)}})}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),Er.overlayOp(n,i,se.INTERSECTION)},se.symDifference=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return se.createEmptyResult(se.SYMDIFFERENCE,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),Er.overlayOp(n,i,se.SYMDIFFERENCE)},se.resultDimension=function(n,i,s){var u=i.getDimension(),c=s.getDimension(),m=-1;switch(n){case se.INTERSECTION:m=Math.min(u,c);break;case se.UNION:m=Math.max(u,c);break;case se.DIFFERENCE:m=u;break;case se.SYMDIFFERENCE:m=Math.max(u,c)}return m},se.createEmptyResult=function(n,i,s,u){var c=null;switch(se.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},se.difference=function(n,i){return n.isEmpty()?se.createEmptyResult(se.DIFFERENCE,n,i,n.getFactory()):i.isEmpty()?n.copy():(n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),Er.overlayOp(n,i,se.DIFFERENCE))},se.isResultOfOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=n.getLocation(0),u=n.getLocation(1);return se.isResultOfOp(s,u,i)}if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2];switch(c===V.BOUNDARY&&(c=V.INTERIOR),m===V.BOUNDARY&&(m=V.INTERIOR),E){case se.INTERSECTION:return c===V.INTERIOR&&m===V.INTERIOR;case se.UNION:return c===V.INTERIOR||m===V.INTERIOR;case se.DIFFERENCE:return c===V.INTERIOR&&m!==V.INTERIOR;case se.SYMDIFFERENCE:return c===V.INTERIOR&&m!==V.INTERIOR||c!==V.INTERIOR&&m===V.INTERIOR}return!1}},se.INTERSECTION=1,se.UNION=2,se.DIFFERENCE=3,se.SYMDIFFERENCE=4;var Fo=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Ei,this._seg=new Zt;var n=arguments[0],i=arguments[1];this._g=n,this._boundaryDistanceTolerance=i,this._linework=this.extractLinework(n)};Fo.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},Fo.prototype.getLocation=function(n){return this.isWithinToleranceOfBoundary(n)?V.BOUNDARY:this._ptLocator.locate(n,this._g)},Fo.prototype.extractLinework=function(n){var i=new _a;n.apply(i);var s=i.getLinework(),u=ue.toLineStringArray(s);return n.getFactory().createMultiLineString(u)},Fo.prototype.interfaces_=function(){return[]},Fo.prototype.getClass=function(){return Fo};var _a=function(){this._linework=null,this._linework=new Z};_a.prototype.getLinework=function(){return this._linework},_a.prototype.filter=function(n){if(n instanceof Wt){var i=n;this._linework.add(i.getExteriorRing());for(var s=0;s<i.getNumInteriorRing();s++)this._linework.add(i.getInteriorRingN(s))}},_a.prototype.interfaces_=function(){return[Cn]},_a.prototype.getClass=function(){return _a};var as=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var n=arguments[0];this._g=n};as.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)},as.prototype.setSidesToGenerate=function(n,i){this._doLeft=n,this._doRight=i},as.prototype.getPoints=function(n){for(var i=new Z,s=er.getLines(this._g).iterator();s.hasNext();){var u=s.next();this.extractPoints(u,n,i)}return i},as.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,K=(i.x+n.x)/2,pt=(i.y+n.y)/2;if(this._doLeft){var dt=new I(K-U,pt+A);u.add(dt)}if(this._doRight){var Rt=new I(K+U,pt-A);u.add(Rt)}},as.prototype.interfaces_=function(){return[]},as.prototype.getClass=function(){return as};var ti=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 Z;var i=arguments[0],s=arguments[1],u=arguments[2];this._boundaryDistanceTolerance=n.computeBoundaryDistanceTolerance(i,s),this._geom=[i,s,u],this._locFinder=[new Fo(this._geom[0],this._boundaryDistanceTolerance),new Fo(this._geom[1],this._boundaryDistanceTolerance),new Fo(this._geom[2],this._boundaryDistanceTolerance)]},cm={TOLERANCE:{configurable:!0}};ti.prototype.reportResult=function(n,i,s){Ft.out.println("Overlay result invalid - A:"+V.toLocationSymbol(i[0])+" B:"+V.toLocationSymbol(i[1])+" expected:"+(s?"i":"e")+" actual:"+V.toLocationSymbol(i[2]))},ti.prototype.isValid=function(n){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var i=this.checkValid(n);return i},ti.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),!!ti.hasLocation(this._location,V.BOUNDARY)||this.isValidResult(u,this._location)}},ti.prototype.addTestPts=function(n){var i=new as(n);this._testCoords.addAll(i.getPoints(5*this._boundaryDistanceTolerance))},ti.prototype.isValidResult=function(n,i){var s=se.isResultOfOp(i[0],i[1],n),u=!(s^i[2]===V.INTERIOR);return u||this.reportResult(n,i,s),u},ti.prototype.getInvalidLocation=function(){return this._invalidLocation},ti.prototype.interfaces_=function(){return[]},ti.prototype.getClass=function(){return ti},ti.hasLocation=function(n,i){for(var s=0;s<3;s++)if(n[s]===i)return!0;return!1},ti.computeBoundaryDistanceTolerance=function(n,i){return Math.min(On.computeSizeBasedSnapTolerance(n),On.computeSizeBasedSnapTolerance(i))},ti.isValid=function(n,i,s,u){return new ti(n,i,u).isValid(s)},cm.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(ti,cm);var ei=function n(i){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=n.extractFactory(i),this._inputGeoms=i};ei.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)}},ei.prototype.combine=function(){for(var n=new Z,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)},ei.prototype.interfaces_=function(){return[]},ei.prototype.getClass=function(){return ei},ei.combine=function(){if(arguments.length===1){var n=arguments[0];return new ei(n).combine()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new ei(ei.createList(i,s)).combine()}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];return new ei(ei.createList(u,c,m)).combine()}},ei.extractFactory=function(n){return n.isEmpty()?null:n.iterator().next().getFactory()},ei.createList=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new Z;return s.add(n),s.add(i),s}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2],E=new Z;return E.add(u),E.add(c),E.add(m),E}};var zn=function(){this._inputPolys=null,this._geomFactory=null;var n=arguments[0];this._inputPolys=n,this._inputPolys===null&&(this._inputPolys=new Z)},hm={STRTREE_NODE_CAPACITY:{configurable:!0}};zn.prototype.reduceToGeometries=function(n){for(var i=new Z,s=n.iterator();s.hasNext();){var u=s.next(),c=null;$(u,tt)?c=this.unionTree(u):u instanceof yt&&(c=u),i.add(c)}return i},zn.prototype.extractByEnvelope=function(n,i,s){for(var u=new Z,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)},zn.prototype.unionOptimized=function(n,i){var s=n.getEnvelopeInternal(),u=i.getEnvelopeInternal();if(!s.intersects(u))return ei.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)},zn.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 $d(zn.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)},zn.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=zn.getGeometry(i,s);return this.unionSafe(c,null)}if(u-s==2)return this.unionSafe(zn.getGeometry(i,s),zn.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)}},zn.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},zn.prototype.unionSafe=function(n,i){return n===null&&i===null?null:n===null?i.copy():i===null?n.copy():this.unionOptimized(n,i)},zn.prototype.unionActual=function(n,i){return zn.restrictToPolygons(n.union(i))},zn.prototype.unionTree=function(n){var i=this.reduceToGeometries(n);return this.binaryUnion(i)},zn.prototype.unionUsingEnvelopeIntersection=function(n,i,s){var u=new Z,c=this.extractByEnvelope(s,n,u),m=this.extractByEnvelope(s,i,u),E=this.unionActual(c,m);return u.add(E),ei.combine(u)},zn.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)}},zn.prototype.interfaces_=function(){return[]},zn.prototype.getClass=function(){return zn},zn.restrictToPolygons=function(n){if($(n,ce))return n;var i=po.getPolygons(n);return i.size()===1?i.get(0):n.getFactory().createMultiPolygon(ue.toPolygonArray(i))},zn.getGeometry=function(n,i){return i>=n.size()?null:n.get(i)},zn.union=function(n){return new zn(n).union()},hm.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(zn,hm);var Pu=function(){};Pu.prototype.interfaces_=function(){return[]},Pu.prototype.getClass=function(){return Pu},Pu.union=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return se.createEmptyResult(se.UNION,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),Er.overlayOp(n,i,se.UNION)},r.GeoJSONReader=_h,r.GeoJSONWriter=Xd,r.OverlayOp=se,r.UnionOp=Pu,r.BufferOp=tr,Object.defineProperty(r,"__esModule",{value:!0})})});var O1=Ht((a7,N1)=>{N1.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}});var U1=Ht((u7,F1)=>{var D1=O1();F1.exports=function(r,t){Array.isArray(t)||(t=[]),r.length>0&&t.push(D1([0,0],r[0]));for(var e=0;e<r.length-1;e++){var o=r[e],a=r[e+1],l=o[0],h=o[1],f=a[0],p=a[1],d=[.75*l+.25*f,.75*h+.25*p],g=[.25*l+.75*f,.25*h+.75*p];t.push(d),t.push(g)}return r.length>1&&t.push(D1([0,0],r[r.length-1])),t}});var wo=Wn(Cm(),1);var Zf="157";var rx=0,Pm=1,ix=2;var Jg=1,ox=2,Wo=3,vs=0,di=1,Xo=2;var ms=0,ka=1,Im=2,Rm=3,Lm=4,sx=5,Fa=100,ax=101,ux=102,Nm=103,Om=104,lx=200,cx=201,hx=202,fx=203,Kg=204,jg=205,px=206,dx=207,mx=208,gx=209,yx=210,vx=0,_x=1,xx=2,hf=3,Ex=4,Mx=5,Sx=6,wx=7,Qg=0,bx=1,Tx=2,gs=0,Ax=1,Cx=2,Px=3,Ix=4,Rx=5,t0=300,Ha=301,Wa=302,ff=303,pf=304,hc=306,df=1e3,to=1001,mf=1002,ri=1003,Dm=1004;var Oh=1005;var Bi=1006,Lx=1007;var Bu=1008;var ys=1009,Nx=1010,Ox=1011,Jf=1012,e0=1013,ps=1014,ds=1015,zu=1016,n0=1017,r0=1018,Xs=1020,Dx=1021,eo=1023,Fx=1024,Ux=1025,Ys=1026,qa=1027,Bx=1028,i0=1029,zx=1030,o0=1031,s0=1033,Dh=33776,Fh=33777,Uh=33778,Bh=33779,Fm=35840,Um=35841,Bm=35842,zm=35843,kx=36196,km=37492,Gm=37496,Vm=37808,Hm=37809,Wm=37810,qm=37811,Xm=37812,Ym=37813,$m=37814,Zm=37815,Jm=37816,Km=37817,jm=37818,Qm=37819,tg=37820,eg=37821,zh=36492,ng=36494,rg=36495,Gx=36283,ig=36284,og=36285,sg=36286;var Xl=2300,Yl=2301,kh=2302,ag=2400,ug=2401,lg=2402;var a0=3e3,$s=3001,Vx=3200,Hx=3201,Wx=0,qx=1,zi="",Or="srgb",Zo="srgb-linear",Kf="display-p3",fc="display-p3-linear",$l="linear",Dn="srgb",Zl="rec709",Jl="p3";var Gh=7680;var Xx=519,Yx=512,$x=513,Zx=514,Jx=515,Kx=516,jx=517,Qx=518,tE=519,cg=35044;var hg="300 es",gf=1035,Yo=2e3,Kl=2001,_s=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,h=a.length;l<h;l++)a[l].call(this,t);t.target=null}}},qr=["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 Vh=Math.PI/180,yf=180/Math.PI;function Hu(){let r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(qr[r&255]+qr[r>>8&255]+qr[r>>16&255]+qr[r>>24&255]+"-"+qr[t&255]+qr[t>>8&255]+"-"+qr[t>>16&15|64]+qr[t>>24&255]+"-"+qr[e&63|128]+qr[e>>8&255]+"-"+qr[e>>16&255]+qr[e>>24&255]+qr[o&255]+qr[o>>8&255]+qr[o>>16&255]+qr[o>>24&255]).toLowerCase()}function pi(r,t,e){return Math.max(t,Math.min(e,r))}function eE(r,t){return(r%t+t)%t}function Hh(r,t,e){return(1-e)*r+e*t}function fg(r){return(r&r-1)===0&&r!==0}function vf(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Iu(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 fi(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(pi(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,h=this.y-t.y;return this.x=l*o-h*a+t.x,this.y=l*a+h*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,h,f,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,h,f,p,d)}set(t,e,o,a,l,h,f,p,d){let g=this.elements;return g[0]=t,g[1]=a,g[2]=f,g[3]=e,g[4]=l,g[5]=p,g[6]=o,g[7]=h,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,h=o[0],f=o[3],p=o[6],d=o[1],g=o[4],_=o[7],y=o[2],M=o[5],b=o[8],T=a[0],x=a[3],v=a[6],P=a[1],S=a[4],L=a[7],N=a[2],G=a[5],B=a[8];return l[0]=h*T+f*P+p*N,l[3]=h*x+f*S+p*G,l[6]=h*v+f*L+p*B,l[1]=d*T+g*P+_*N,l[4]=d*x+g*S+_*G,l[7]=d*v+g*L+_*B,l[2]=y*T+M*P+b*N,l[5]=y*x+M*S+b*G,l[8]=y*v+M*L+b*B,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],h=t[4],f=t[5],p=t[6],d=t[7],g=t[8];return e*h*g-e*f*d-o*l*g+o*f*p+a*l*d-a*h*p}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],l=t[3],h=t[4],f=t[5],p=t[6],d=t[7],g=t[8],_=g*h-f*d,y=f*p-g*l,M=d*l-h*p,b=e*_+o*y+a*M;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);let T=1/b;return t[0]=_*T,t[1]=(a*d-g*o)*T,t[2]=(f*o-a*h)*T,t[3]=y*T,t[4]=(g*e-a*p)*T,t[5]=(a*l-f*e)*T,t[6]=M*T,t[7]=(o*p-d*e)*T,t[8]=(h*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,h,f){let p=Math.cos(l),d=Math.sin(l);return this.set(o*p,o*d,-o*(p*h+d*f)+h+t,-a*d,a*p,-a*(-d*h+p*f)+f+e,0,0,1),this}scale(t,e){return this.premultiply(Wh.makeScale(t,e)),this}rotate(t){return this.premultiply(Wh.makeRotation(-t)),this}translate(t,e){return this.premultiply(Wh.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)}},Wh=new ye;function u0(r){for(let t=r.length-1;t>=0;--t)if(r[t]>=65535)return!0;return!1}function jl(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function nE(){let r=jl("canvas");return r.style.display="block",r}var pg={};function Fu(r){r in pg||(pg[r]=!0,console.warn(r))}var dg=new ye().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),mg=new ye().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),wl={[Zo]:{transfer:$l,primaries:Zl,toReference:r=>r,fromReference:r=>r},[Or]:{transfer:Dn,primaries:Zl,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[fc]:{transfer:$l,primaries:Jl,toReference:r=>r.applyMatrix3(mg),fromReference:r=>r.applyMatrix3(dg)},[Kf]:{transfer:Dn,primaries:Jl,toReference:r=>r.convertSRGBToLinear().applyMatrix3(mg),fromReference:r=>r.applyMatrix3(dg).convertLinearToSRGB()}},rE=new Set([Zo,fc]),Mn={enabled:!0,_workingColorSpace:Zo,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(!rE.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=wl[t].toReference,a=wl[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 wl[r].primaries},getTransfer:function(r){return r===zi?$l:wl[r].transfer}};function Ga(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function qh(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var xa,Ql=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{xa===void 0&&(xa=jl("canvas")),xa.width=t.width,xa.height=t.height;let o=xa.getContext("2d");t instanceof ImageData?o.putImageData(t,0,0):o.drawImage(t,0,0,t.width,t.height),e=xa}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=jl("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 h=0;h<l.length;h++)l[h]=Ga(l[h]/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(Ga(e[o]/255)*255):e[o]=Ga(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}},iE=0,tc=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:iE++}),this.uuid=Hu(),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 h=0,f=a.length;h<f;h++)a[h].isDataTexture?l.push(Xh(a[h].image)):l.push(Xh(a[h]))}else l=Xh(a);o.url=l}return e||(t.images[this.uuid]=o),o}};function Xh(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?Ql.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 oE=0,no=class r extends _s{constructor(t=r.DEFAULT_IMAGE,e=r.DEFAULT_MAPPING,o=to,a=to,l=Bi,h=Bu,f=eo,p=ys,d=r.DEFAULT_ANISOTROPY,g=zi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:oE++}),this.uuid=Hu(),this.name="",this.source=new tc(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=o,this.wrapT=a,this.magFilter=l,this.minFilter=h,this.anisotropy=d,this.format=f,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:(Fu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=g===$s?Or:zi),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!==t0)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case df:t.x=t.x-Math.floor(t.x);break;case to:t.x=t.x<0?0:1;break;case mf: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 df:t.y=t.y-Math.floor(t.y);break;case to:t.y=t.y<0?0:1;break;case mf: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 Fu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Or?$s:a0}set encoding(t){Fu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===$s?Or:zi}};no.DEFAULT_IMAGE=null;no.DEFAULT_MAPPING=t0;no.DEFAULT_ANISOTROPY=1;var Dr=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,h=t.elements;return this.x=h[0]*e+h[4]*o+h[8]*a+h[12]*l,this.y=h[1]*e+h[5]*o+h[9]*a+h[13]*l,this.z=h[2]*e+h[6]*o+h[10]*a+h[14]*l,this.w=h[3]*e+h[7]*o+h[11]*a+h[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],b=p[9],T=p[2],x=p[6],v=p[10];if(Math.abs(g-y)<.01&&Math.abs(_-T)<.01&&Math.abs(b-x)<.01){if(Math.abs(g+y)<.1&&Math.abs(_+T)<.1&&Math.abs(b+x)<.1&&Math.abs(d+M+v-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let S=(d+1)/2,L=(M+1)/2,N=(v+1)/2,G=(g+y)/4,B=(_+T)/4,I=(b+x)/4;return S>L&&S>N?S<.01?(o=0,a=.707106781,l=.707106781):(o=Math.sqrt(S),a=G/o,l=B/o):L>N?L<.01?(o=.707106781,a=0,l=.707106781):(a=Math.sqrt(L),o=G/a,l=I/a):N<.01?(o=.707106781,a=.707106781,l=0):(l=Math.sqrt(N),o=B/l,a=I/l),this.set(o,a,l,e),this}let P=Math.sqrt((x-b)*(x-b)+(_-T)*(_-T)+(y-g)*(y-g));return Math.abs(P)<.001&&(P=1),this.x=(x-b)/P,this.y=(_-T)/P,this.z=(y-g)/P,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}},_f=class extends _s{constructor(t=1,e=1,o={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Dr(0,0,t,e),this.scissorTest=!1,this.viewport=new Dr(0,0,t,e);let a={width:t,height:e,depth:1};o.encoding!==void 0&&(Fu("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),o.colorSpace=o.encoding===$s?Or:zi),o=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Bi,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},o),this.texture=new no(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 tc(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"})}},Jo=class extends _f{constructor(t=1,e=1,o={}){super(t,e,o),this.isWebGLRenderTarget=!0}},ec=class extends no{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=ri,this.minFilter=ri,this.wrapR=to,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var xf=class extends no{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=ri,this.minFilter=ri,this.wrapR=to,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var xs=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,h,f){let p=o[a+0],d=o[a+1],g=o[a+2],_=o[a+3],y=l[h+0],M=l[h+1],b=l[h+2],T=l[h+3];if(f===0){t[e+0]=p,t[e+1]=d,t[e+2]=g,t[e+3]=_;return}if(f===1){t[e+0]=y,t[e+1]=M,t[e+2]=b,t[e+3]=T;return}if(_!==T||p!==y||d!==M||g!==b){let x=1-f,v=p*y+d*M+g*b+_*T,P=v>=0?1:-1,S=1-v*v;if(S>Number.EPSILON){let N=Math.sqrt(S),G=Math.atan2(N,v*P);x=Math.sin(x*G)/N,f=Math.sin(f*G)/N}let L=f*P;if(p=p*x+y*L,d=d*x+M*L,g=g*x+b*L,_=_*x+T*L,x===1-f){let N=1/Math.sqrt(p*p+d*d+g*g+_*_);p*=N,d*=N,g*=N,_*=N}}t[e]=p,t[e+1]=d,t[e+2]=g,t[e+3]=_}static multiplyQuaternionsFlat(t,e,o,a,l,h){let f=o[a],p=o[a+1],d=o[a+2],g=o[a+3],_=l[h],y=l[h+1],M=l[h+2],b=l[h+3];return t[e]=f*b+g*_+p*M-d*y,t[e+1]=p*b+g*y+d*_-f*M,t[e+2]=d*b+g*M+f*y-p*_,t[e+3]=g*b-f*_-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,h=t._order,f=Math.cos,p=Math.sin,d=f(o/2),g=f(a/2),_=f(l/2),y=p(o/2),M=p(a/2),b=p(l/2);switch(h){case"XYZ":this._x=y*g*_+d*M*b,this._y=d*M*_-y*g*b,this._z=d*g*b+y*M*_,this._w=d*g*_-y*M*b;break;case"YXZ":this._x=y*g*_+d*M*b,this._y=d*M*_-y*g*b,this._z=d*g*b-y*M*_,this._w=d*g*_+y*M*b;break;case"ZXY":this._x=y*g*_-d*M*b,this._y=d*M*_+y*g*b,this._z=d*g*b+y*M*_,this._w=d*g*_-y*M*b;break;case"ZYX":this._x=y*g*_-d*M*b,this._y=d*M*_+y*g*b,this._z=d*g*b-y*M*_,this._w=d*g*_+y*M*b;break;case"YZX":this._x=y*g*_+d*M*b,this._y=d*M*_+y*g*b,this._z=d*g*b-y*M*_,this._w=d*g*_-y*M*b;break;case"XZY":this._x=y*g*_-d*M*b,this._y=d*M*_-y*g*b,this._z=d*g*b+y*M*_,this._w=d*g*_+y*M*b;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+h)}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],h=e[1],f=e[5],p=e[9],d=e[2],g=e[6],_=e[10],y=o+f+_;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=(h-a)*M}else if(o>f&&o>_){let M=2*Math.sqrt(1+o-f-_);this._w=(g-p)/M,this._x=.25*M,this._y=(a+h)/M,this._z=(l+d)/M}else if(f>_){let M=2*Math.sqrt(1+f-o-_);this._w=(l-d)/M,this._x=(a+h)/M,this._y=.25*M,this._z=(p+g)/M}else{let M=2*Math.sqrt(1+_-o-f);this._w=(h-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(pi(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,h=t._w,f=e._x,p=e._y,d=e._z,g=e._w;return this._x=o*g+h*f+a*d-l*p,this._y=a*g+h*p+l*f-o*d,this._z=l*g+h*d+o*p-a*f,this._w=h*g-o*f-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,h=this._w,f=h*t._w+o*t._x+a*t._y+l*t._z;if(f<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,f=-f):this.copy(t),f>=1)return this._w=h,this._x=o,this._y=a,this._z=l,this;let p=1-f*f;if(p<=Number.EPSILON){let M=1-e;return this._w=M*h+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,f),_=Math.sin((1-e)*g)/d,y=Math.sin(e*g)/d;return this._w=h*_+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}},vt=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(gg.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(gg.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,h=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])*h,this.y=(l[1]*e+l[5]*o+l[9]*a+l[13])*h,this.z=(l[2]*e+l[6]*o+l[10]*a+l[14])*h,this}applyQuaternion(t){let e=this.x,o=this.y,a=this.z,l=t.x,h=t.y,f=t.z,p=t.w,d=p*e+h*a-f*o,g=p*o+f*e-l*a,_=p*a+l*o-h*e,y=-l*e-h*o-f*a;return this.x=d*p+y*-l+g*-f-_*-h,this.y=g*p+y*-h+_*-l-d*-f,this.z=_*p+y*-f+d*-h-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,h=e.x,f=e.y,p=e.z;return this.x=a*p-l*f,this.y=l*h-o*p,this.z=o*f-a*h,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 Yh.copy(this).projectOnVector(t),this.sub(Yh)}reflect(t){return this.sub(Yh.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(pi(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}},Yh=new vt,gg=new xs,Zs=class{constructor(t=new vt(1/0,1/0,1/0),e=new vt(-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(zo.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,o=t.count;e<o;e++)this.expandByPoint(zo.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=zo.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(),Ea.copy(t.boundingBox),Ea.applyMatrix4(t.matrixWorld),this.union(Ea);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 h=0,f=l.count;h<f;h++)zo.fromBufferAttribute(l,h).applyMatrix4(t.matrixWorld),this.expandByPoint(zo)}else a.boundingBox===null&&a.computeBoundingBox(),Ea.copy(a.boundingBox),Ea.applyMatrix4(t.matrixWorld),this.union(Ea)}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,zo),zo.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(Ru),bl.subVectors(this.max,Ru),Ma.subVectors(t.a,Ru),Sa.subVectors(t.b,Ru),wa.subVectors(t.c,Ru),us.subVectors(Sa,Ma),ls.subVectors(wa,Sa),ks.subVectors(Ma,wa);let e=[0,-us.z,us.y,0,-ls.z,ls.y,0,-ks.z,ks.y,us.z,0,-us.x,ls.z,0,-ls.x,ks.z,0,-ks.x,-us.y,us.x,0,-ls.y,ls.x,0,-ks.y,ks.x,0];return!$h(e,Ma,Sa,wa,bl)||(e=[1,0,0,0,1,0,0,0,1],!$h(e,Ma,Sa,wa,bl))?!1:(Tl.crossVectors(us,ls),e=[Tl.x,Tl.y,Tl.z],$h(e,Ma,Sa,wa,bl))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,zo).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(zo).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:(Bo[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Bo[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Bo[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Bo[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Bo[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Bo[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Bo[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Bo[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Bo),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)}},Bo=[new vt,new vt,new vt,new vt,new vt,new vt,new vt,new vt],zo=new vt,Ea=new Zs,Ma=new vt,Sa=new vt,wa=new vt,us=new vt,ls=new vt,ks=new vt,Ru=new vt,bl=new vt,Tl=new vt,Gs=new vt;function $h(r,t,e,o,a){for(let l=0,h=r.length-3;l<=h;l+=3){Gs.fromArray(r,l);let f=a.x*Math.abs(Gs.x)+a.y*Math.abs(Gs.y)+a.z*Math.abs(Gs.z),p=t.dot(Gs),d=e.dot(Gs),g=o.dot(Gs);if(Math.max(-Math.max(p,d,g),Math.min(p,d,g))>f)return!1}return!0}var sE=new Zs,Lu=new vt,Zh=new vt,ku=class{constructor(t=new vt,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):sE.setFromPoints(t).getCenter(o);let a=0;for(let l=0,h=t.length;l<h;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;Lu.subVectors(t,this.center);let e=Lu.lengthSq();if(e>this.radius*this.radius){let o=Math.sqrt(e),a=(o-this.radius)*.5;this.center.addScaledVector(Lu,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):(Zh.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Lu.copy(t.center).add(Zh)),this.expandByPoint(Lu.copy(t.center).sub(Zh))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},ko=new vt,Jh=new vt,Al=new vt,cs=new vt,Kh=new vt,Cl=new vt,jh=new vt,Ef=class{constructor(t=new vt,e=new vt(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,ko)),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=ko.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ko.copy(this.origin).addScaledVector(this.direction,e),ko.distanceToSquared(t))}distanceSqToSegment(t,e,o,a){Jh.copy(t).add(e).multiplyScalar(.5),Al.copy(e).sub(t).normalize(),cs.copy(this.origin).sub(Jh);let l=t.distanceTo(e)*.5,h=-this.direction.dot(Al),f=cs.dot(this.direction),p=-cs.dot(Al),d=cs.lengthSq(),g=Math.abs(1-h*h),_,y,M,b;if(g>0)if(_=h*p-f,y=h*f-p,b=l*g,_>=0)if(y>=-b)if(y<=b){let T=1/g;_*=T,y*=T,M=_*(_+h*y+2*f)+y*(h*_+y+2*p)+d}else y=l,_=Math.max(0,-(h*y+f)),M=-_*_+y*(y+2*p)+d;else y=-l,_=Math.max(0,-(h*y+f)),M=-_*_+y*(y+2*p)+d;else y<=-b?(_=Math.max(0,-(-h*l+f)),y=_>0?-l:Math.min(Math.max(-l,-p),l),M=-_*_+y*(y+2*p)+d):y<=b?(_=0,y=Math.min(Math.max(-l,-p),l),M=y*(y+2*p)+d):(_=Math.max(0,-(h*l+f)),y=_>0?l:Math.min(Math.max(-l,-p),l),M=-_*_+y*(y+2*p)+d);else y=h>0?-l:l,_=Math.max(0,-(h*y+f)),M=-_*_+y*(y+2*p)+d;return o&&o.copy(this.origin).addScaledVector(this.direction,_),a&&a.copy(Jh).addScaledVector(Al,y),M}intersectSphere(t,e){ko.subVectors(t.center,this.origin);let o=ko.dot(this.direction),a=ko.dot(ko)-o*o,l=t.radius*t.radius;if(a>l)return null;let h=Math.sqrt(l-a),f=o-h,p=o+h;return p<0?null:f<0?this.at(p,e):this.at(f,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,h,f,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,h=(t.max.y-y.y)*g):(l=(t.max.y-y.y)*g,h=(t.min.y-y.y)*g),o>h||l>a||((l>o||isNaN(o))&&(o=l),(h<a||isNaN(a))&&(a=h),_>=0?(f=(t.min.z-y.z)*_,p=(t.max.z-y.z)*_):(f=(t.max.z-y.z)*_,p=(t.min.z-y.z)*_),o>p||f>a)||((f>o||o!==o)&&(o=f),(p<a||a!==a)&&(a=p),a<0)?null:this.at(o>=0?o:a,e)}intersectsBox(t){return this.intersectBox(t,ko)!==null}intersectTriangle(t,e,o,a,l){Kh.subVectors(e,t),Cl.subVectors(o,t),jh.crossVectors(Kh,Cl);let h=this.direction.dot(jh),f;if(h>0){if(a)return null;f=1}else if(h<0)f=-1,h=-h;else return null;cs.subVectors(this.origin,t);let p=f*this.direction.dot(Cl.crossVectors(cs,Cl));if(p<0)return null;let d=f*this.direction.dot(Kh.cross(cs));if(d<0||p+d>h)return null;let g=-f*cs.dot(jh);return g<0?null:this.at(g/h,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)}},Yr=class r{constructor(t,e,o,a,l,h,f,p,d,g,_,y,M,b,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,h,f,p,d,g,_,y,M,b,T,x)}set(t,e,o,a,l,h,f,p,d,g,_,y,M,b,T,x){let v=this.elements;return v[0]=t,v[4]=e,v[8]=o,v[12]=a,v[1]=l,v[5]=h,v[9]=f,v[13]=p,v[2]=d,v[6]=g,v[10]=_,v[14]=y,v[3]=M,v[7]=b,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/ba.setFromMatrixColumn(t,0).length(),l=1/ba.setFromMatrixColumn(t,1).length(),h=1/ba.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]*h,e[9]=o[9]*h,e[10]=o[10]*h,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,h=Math.cos(o),f=Math.sin(o),p=Math.cos(a),d=Math.sin(a),g=Math.cos(l),_=Math.sin(l);if(t.order==="XYZ"){let y=h*g,M=h*_,b=f*g,T=f*_;e[0]=p*g,e[4]=-p*_,e[8]=d,e[1]=M+b*d,e[5]=y-T*d,e[9]=-f*p,e[2]=T-y*d,e[6]=b+M*d,e[10]=h*p}else if(t.order==="YXZ"){let y=p*g,M=p*_,b=d*g,T=d*_;e[0]=y+T*f,e[4]=b*f-M,e[8]=h*d,e[1]=h*_,e[5]=h*g,e[9]=-f,e[2]=M*f-b,e[6]=T+y*f,e[10]=h*p}else if(t.order==="ZXY"){let y=p*g,M=p*_,b=d*g,T=d*_;e[0]=y-T*f,e[4]=-h*_,e[8]=b+M*f,e[1]=M+b*f,e[5]=h*g,e[9]=T-y*f,e[2]=-h*d,e[6]=f,e[10]=h*p}else if(t.order==="ZYX"){let y=h*g,M=h*_,b=f*g,T=f*_;e[0]=p*g,e[4]=b*d-M,e[8]=y*d+T,e[1]=p*_,e[5]=T*d+y,e[9]=M*d-b,e[2]=-d,e[6]=f*p,e[10]=h*p}else if(t.order==="YZX"){let y=h*p,M=h*d,b=f*p,T=f*d;e[0]=p*g,e[4]=T-y*_,e[8]=b*_+M,e[1]=_,e[5]=h*g,e[9]=-f*g,e[2]=-d*g,e[6]=M*_+b,e[10]=y-T*_}else if(t.order==="XZY"){let y=h*p,M=h*d,b=f*p,T=f*d;e[0]=p*g,e[4]=-_,e[8]=d*g,e[1]=y*_+T,e[5]=h*g,e[9]=M*_-b,e[2]=b*_-M,e[6]=f*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(aE,t,uE)}lookAt(t,e,o){let a=this.elements;return wi.subVectors(t,e),wi.lengthSq()===0&&(wi.z=1),wi.normalize(),hs.crossVectors(o,wi),hs.lengthSq()===0&&(Math.abs(o.z)===1?wi.x+=1e-4:wi.z+=1e-4,wi.normalize(),hs.crossVectors(o,wi)),hs.normalize(),Pl.crossVectors(wi,hs),a[0]=hs.x,a[4]=Pl.x,a[8]=wi.x,a[1]=hs.y,a[5]=Pl.y,a[9]=wi.y,a[2]=hs.z,a[6]=Pl.z,a[10]=wi.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,h=o[0],f=o[4],p=o[8],d=o[12],g=o[1],_=o[5],y=o[9],M=o[13],b=o[2],T=o[6],x=o[10],v=o[14],P=o[3],S=o[7],L=o[11],N=o[15],G=a[0],B=a[4],I=a[8],O=a[12],q=a[1],st=a[5],V=a[9],Mt=a[13],$=a[2],ut=a[6],xt=a[10],mt=a[14],lt=a[3],ht=a[7],k=a[11],nt=a[15];return l[0]=h*G+f*q+p*$+d*lt,l[4]=h*B+f*st+p*ut+d*ht,l[8]=h*I+f*V+p*xt+d*k,l[12]=h*O+f*Mt+p*mt+d*nt,l[1]=g*G+_*q+y*$+M*lt,l[5]=g*B+_*st+y*ut+M*ht,l[9]=g*I+_*V+y*xt+M*k,l[13]=g*O+_*Mt+y*mt+M*nt,l[2]=b*G+T*q+x*$+v*lt,l[6]=b*B+T*st+x*ut+v*ht,l[10]=b*I+T*V+x*xt+v*k,l[14]=b*O+T*Mt+x*mt+v*nt,l[3]=P*G+S*q+L*$+N*lt,l[7]=P*B+S*st+L*ut+N*ht,l[11]=P*I+S*V+L*xt+N*k,l[15]=P*O+S*Mt+L*mt+N*nt,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],h=t[1],f=t[5],p=t[9],d=t[13],g=t[2],_=t[6],y=t[10],M=t[14],b=t[3],T=t[7],x=t[11],v=t[15];return b*(+l*p*_-a*d*_-l*f*y+o*d*y+a*f*M-o*p*M)+T*(+e*p*M-e*d*y+l*h*y-a*h*M+a*d*g-l*p*g)+x*(+e*d*_-e*f*M-l*h*_+o*h*M+l*f*g-o*d*g)+v*(-a*f*g-e*p*_+e*f*y+a*h*_-o*h*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],h=t[4],f=t[5],p=t[6],d=t[7],g=t[8],_=t[9],y=t[10],M=t[11],b=t[12],T=t[13],x=t[14],v=t[15],P=_*x*d-T*y*d+T*p*M-f*x*M-_*p*v+f*y*v,S=b*y*d-g*x*d-b*p*M+h*x*M+g*p*v-h*y*v,L=g*T*d-b*_*d+b*f*M-h*T*M-g*f*v+h*_*v,N=b*_*p-g*T*p-b*f*y+h*T*y+g*f*x-h*_*x,G=e*P+o*S+a*L+l*N;if(G===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let B=1/G;return t[0]=P*B,t[1]=(T*y*l-_*x*l-T*a*M+o*x*M+_*a*v-o*y*v)*B,t[2]=(f*x*l-T*p*l+T*a*d-o*x*d-f*a*v+o*p*v)*B,t[3]=(_*p*l-f*y*l-_*a*d+o*y*d+f*a*M-o*p*M)*B,t[4]=S*B,t[5]=(g*x*l-b*y*l+b*a*M-e*x*M-g*a*v+e*y*v)*B,t[6]=(b*p*l-h*x*l-b*a*d+e*x*d+h*a*v-e*p*v)*B,t[7]=(h*y*l-g*p*l+g*a*d-e*y*d-h*a*M+e*p*M)*B,t[8]=L*B,t[9]=(b*_*l-g*T*l-b*o*M+e*T*M+g*o*v-e*_*v)*B,t[10]=(h*T*l-b*f*l+b*o*d-e*T*d-h*o*v+e*f*v)*B,t[11]=(g*f*l-h*_*l-g*o*d+e*_*d+h*o*M-e*f*M)*B,t[12]=N*B,t[13]=(g*T*a-b*_*a+b*o*y-e*T*y-g*o*x+e*_*x)*B,t[14]=(b*f*a-h*T*a-b*o*p+e*T*p+h*o*x-e*f*x)*B,t[15]=(h*_*a-g*f*a+g*o*p-e*_*p-h*o*y+e*f*y)*B,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,h=t.x,f=t.y,p=t.z,d=l*h,g=l*f;return this.set(d*h+o,d*f-a*p,d*p+a*f,0,d*f+a*p,g*f+o,g*p-a*h,0,d*p-a*f,g*p+a*h,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,h){return this.set(1,o,l,0,t,1,h,0,e,a,1,0,0,0,0,1),this}compose(t,e,o){let a=this.elements,l=e._x,h=e._y,f=e._z,p=e._w,d=l+l,g=h+h,_=f+f,y=l*d,M=l*g,b=l*_,T=h*g,x=h*_,v=f*_,P=p*d,S=p*g,L=p*_,N=o.x,G=o.y,B=o.z;return a[0]=(1-(T+v))*N,a[1]=(M+L)*N,a[2]=(b-S)*N,a[3]=0,a[4]=(M-L)*G,a[5]=(1-(y+v))*G,a[6]=(x+P)*G,a[7]=0,a[8]=(b+S)*B,a[9]=(x-P)*B,a[10]=(1-(y+T))*B,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=ba.set(a[0],a[1],a[2]).length(),h=ba.set(a[4],a[5],a[6]).length(),f=ba.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],ji.copy(this);let d=1/l,g=1/h,_=1/f;return ji.elements[0]*=d,ji.elements[1]*=d,ji.elements[2]*=d,ji.elements[4]*=g,ji.elements[5]*=g,ji.elements[6]*=g,ji.elements[8]*=_,ji.elements[9]*=_,ji.elements[10]*=_,e.setFromRotationMatrix(ji),o.x=l,o.y=h,o.z=f,this}makePerspective(t,e,o,a,l,h,f=Yo){let p=this.elements,d=2*l/(e-t),g=2*l/(o-a),_=(e+t)/(e-t),y=(o+a)/(o-a),M,b;if(f===Yo)M=-(h+l)/(h-l),b=-2*h*l/(h-l);else if(f===Kl)M=-h/(h-l),b=-h*l/(h-l);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+f);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]=b,p[3]=0,p[7]=0,p[11]=-1,p[15]=0,this}makeOrthographic(t,e,o,a,l,h,f=Yo){let p=this.elements,d=1/(e-t),g=1/(o-a),_=1/(h-l),y=(e+t)*d,M=(o+a)*g,b,T;if(f===Yo)b=(h+l)*_,T=-2*_;else if(f===Kl)b=l*_,T=-1*_;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+f);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]=-b,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}},ba=new vt,ji=new Yr,aE=new vt(0,0,0),uE=new vt(1,1,1),hs=new vt,Pl=new vt,wi=new vt,yg=new Yr,vg=new xs,nc=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],h=a[4],f=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(pi(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(-g,M),this._z=Math.atan2(-h,l)):(this._x=Math.atan2(y,d),this._z=0);break;case"YXZ":this._x=Math.asin(-pi(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(f,M),this._z=Math.atan2(p,d)):(this._y=Math.atan2(-_,l),this._z=0);break;case"ZXY":this._x=Math.asin(pi(y,-1,1)),Math.abs(y)<.9999999?(this._y=Math.atan2(-_,M),this._z=Math.atan2(-h,d)):(this._y=0,this._z=Math.atan2(p,l));break;case"ZYX":this._y=Math.asin(-pi(_,-1,1)),Math.abs(_)<.9999999?(this._x=Math.atan2(y,M),this._z=Math.atan2(p,l)):(this._x=0,this._z=Math.atan2(-h,d));break;case"YZX":this._z=Math.asin(pi(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(f,M));break;case"XZY":this._z=Math.asin(-pi(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(y,d),this._y=Math.atan2(f,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 yg.makeRotationFromQuaternion(t),this.setFromRotationMatrix(yg,e,o)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return vg.setFromEuler(this),this.setFromQuaternion(vg,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}};nc.DEFAULT_ORDER="XYZ";var rc=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}},lE=0,_g=new vt,Ta=new xs,Go=new Yr,Il=new vt,Nu=new vt,cE=new vt,hE=new xs,xg=new vt(1,0,0),Eg=new vt(0,1,0),Mg=new vt(0,0,1),fE={type:"added"},pE={type:"removed"},yo=class r extends _s{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:lE++}),this.uuid=Hu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new vt,e=new nc,o=new xs,a=new vt(1,1,1);function l(){o.setFromEuler(e,!1)}function h(){e.setFromQuaternion(o,void 0,!1)}e._onChange(l),o._onChange(h),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 Yr},normalMatrix:{value:new ye}}),this.matrix=new Yr,this.matrixWorld=new Yr,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new rc,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 Ta.setFromAxisAngle(t,e),this.quaternion.multiply(Ta),this}rotateOnWorldAxis(t,e){return Ta.setFromAxisAngle(t,e),this.quaternion.premultiply(Ta),this}rotateX(t){return this.rotateOnAxis(xg,t)}rotateY(t){return this.rotateOnAxis(Eg,t)}rotateZ(t){return this.rotateOnAxis(Mg,t)}translateOnAxis(t,e){return _g.copy(t).applyQuaternion(this.quaternion),this.position.add(_g.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(xg,t)}translateY(t){return this.translateOnAxis(Eg,t)}translateZ(t){return this.translateOnAxis(Mg,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Go.copy(this.matrixWorld).invert())}lookAt(t,e,o){t.isVector3?Il.copy(t):Il.set(t,e,o);let a=this.parent;this.updateWorldMatrix(!0,!1),Nu.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Go.lookAt(Nu,Il,this.up):Go.lookAt(Il,Nu,this.up),this.quaternion.setFromRotationMatrix(Go),a&&(Go.extractRotation(a.matrixWorld),Ta.setFromRotationMatrix(Go),this.quaternion.premultiply(Ta.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(fE)):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(pE)),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),Go.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Go.multiply(t.parent.matrixWorld)),t.applyMatrix4(Go),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 h=this.children[o].getObjectByProperty(t,e);if(h!==void 0)return h}}getObjectsByProperty(t,e){let o=[];this[t]===e&&o.push(this);for(let a=0,l=this.children.length;a<l;a++){let h=this.children[a].getObjectsByProperty(t,e);h.length>0&&(o=o.concat(h))}return o}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Nu,t,cE),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Nu,hE,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,h=a.length;l<h;l++){let f=a[l];f.matrixWorldAutoUpdate===!0&&f.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(f,p){return f[p.uuid]===void 0&&(f[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 f=this.geometry.parameters;if(f!==void 0&&f.shapes!==void 0){let p=f.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 f=[];for(let p=0,d=this.material.length;p<d;p++)f.push(l(t.materials,this.material[p]));a.material=f}else a.material=l(t.materials,this.material);if(this.children.length>0){a.children=[];for(let f=0;f<this.children.length;f++)a.children.push(this.children[f].toJSON(t).object)}if(this.animations.length>0){a.animations=[];for(let f=0;f<this.animations.length;f++){let p=this.animations[f];a.animations.push(l(t.animations,p))}}if(e){let f=h(t.geometries),p=h(t.materials),d=h(t.textures),g=h(t.images),_=h(t.shapes),y=h(t.skeletons),M=h(t.animations),b=h(t.nodes);f.length>0&&(o.geometries=f),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),b.length>0&&(o.nodes=b)}return o.object=a,o;function h(f){let p=[];for(let d in f){let g=f[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 vt(0,1,0);yo.DEFAULT_MATRIX_AUTO_UPDATE=!0;yo.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Qi=new vt,Vo=new vt,Qh=new vt,Ho=new vt,Aa=new vt,Ca=new vt,Sg=new vt,tf=new vt,ef=new vt,nf=new vt,Rl=!1,Ua=class r{constructor(t=new vt,e=new vt,o=new vt){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),Vo.subVectors(o,e),Qh.subVectors(t,e);let h=Qi.dot(Qi),f=Qi.dot(Vo),p=Qi.dot(Qh),d=Vo.dot(Vo),g=Vo.dot(Qh),_=h*d-f*f;if(_===0)return l.set(-2,-1,-1);let y=1/_,M=(d*p-f*g)*y,b=(h*g-f*p)*y;return l.set(1-M-b,b,M)}static containsPoint(t,e,o,a){return this.getBarycoord(t,e,o,a,Ho),Ho.x>=0&&Ho.y>=0&&Ho.x+Ho.y<=1}static getUV(t,e,o,a,l,h,f,p){return Rl===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Rl=!0),this.getInterpolation(t,e,o,a,l,h,f,p)}static getInterpolation(t,e,o,a,l,h,f,p){return this.getBarycoord(t,e,o,a,Ho),p.setScalar(0),p.addScaledVector(l,Ho.x),p.addScaledVector(h,Ho.y),p.addScaledVector(f,Ho.z),p}static isFrontFacing(t,e,o,a){return Qi.subVectors(o,e),Vo.subVectors(t,e),Qi.cross(Vo).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),Vo.subVectors(this.a,this.b),Qi.cross(Vo).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 Rl===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Rl=!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,h,f;Aa.subVectors(a,o),Ca.subVectors(l,o),tf.subVectors(t,o);let p=Aa.dot(tf),d=Ca.dot(tf);if(p<=0&&d<=0)return e.copy(o);ef.subVectors(t,a);let g=Aa.dot(ef),_=Ca.dot(ef);if(g>=0&&_<=g)return e.copy(a);let y=p*_-g*d;if(y<=0&&p>=0&&g<=0)return h=p/(p-g),e.copy(o).addScaledVector(Aa,h);nf.subVectors(t,l);let M=Aa.dot(nf),b=Ca.dot(nf);if(b>=0&&M<=b)return e.copy(l);let T=M*d-p*b;if(T<=0&&d>=0&&b<=0)return f=d/(d-b),e.copy(o).addScaledVector(Ca,f);let x=g*b-M*_;if(x<=0&&_-g>=0&&M-b>=0)return Sg.subVectors(l,a),f=(_-g)/(_-g+(M-b)),e.copy(a).addScaledVector(Sg,f);let v=1/(x+T+y);return h=T*v,f=y*v,e.copy(o).addScaledVector(Aa,h).addScaledVector(Ca,f)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},dE=0,Xa=class extends _s{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:dE++}),this.uuid=Hu(),this.name="",this.type="Material",this.blending=ka,this.side=vs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Kg,this.blendDst=jg,this.blendEquation=Fa,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=hf,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Xx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Gh,this.stencilZFail=Gh,this.stencilZPass=Gh,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!==ka&&(o.blending=this.blending),this.side!==vs&&(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 h=[];for(let f in l){let p=l[f];delete p.metadata,h.push(p)}return h}if(e){let l=a(t.textures),h=a(t.images);l.length>0&&(o.textures=l),h.length>0&&(o.images=h)}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++}},l0={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},fs={h:0,s:0,l:0},Ll={h:0,s:0,l:0};function rf(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 An=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=Or){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Mn.toWorkingColorSpace(this,e),this}setRGB(t,e,o,a=Mn.workingColorSpace){return this.r=t,this.g=e,this.b=o,Mn.toWorkingColorSpace(this,a),this}setHSL(t,e,o,a=Mn.workingColorSpace){if(t=eE(t,1),e=pi(e,0,1),o=pi(o,0,1),e===0)this.r=this.g=this.b=o;else{let l=o<=.5?o*(1+e):o+e-o*e,h=2*o-l;this.r=rf(h,l,t+1/3),this.g=rf(h,l,t),this.b=rf(h,l,t-1/3)}return Mn.toWorkingColorSpace(this,a),this}setStyle(t,e=Or){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,h=a[1],f=a[2];switch(h){case"rgb":case"rgba":if(l=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(f))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(f))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(f))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],h=l.length;if(h===3)return this.setRGB(parseInt(l.charAt(0),16)/15,parseInt(l.charAt(1),16)/15,parseInt(l.charAt(2),16)/15,e);if(h===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=Or){let o=l0[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=Ga(t.r),this.g=Ga(t.g),this.b=Ga(t.b),this}copyLinearToSRGB(t){return this.r=qh(t.r),this.g=qh(t.g),this.b=qh(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Or){return Mn.fromWorkingColorSpace(Xr.copy(this),t),Math.round(pi(Xr.r*255,0,255))*65536+Math.round(pi(Xr.g*255,0,255))*256+Math.round(pi(Xr.b*255,0,255))}getHexString(t=Or){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Mn.workingColorSpace){Mn.fromWorkingColorSpace(Xr.copy(this),e);let o=Xr.r,a=Xr.g,l=Xr.b,h=Math.max(o,a,l),f=Math.min(o,a,l),p,d,g=(f+h)/2;if(f===h)p=0,d=0;else{let _=h-f;switch(d=g<=.5?_/(h+f):_/(2-h-f),h){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=Mn.workingColorSpace){return Mn.fromWorkingColorSpace(Xr.copy(this),e),t.r=Xr.r,t.g=Xr.g,t.b=Xr.b,t}getStyle(t=Or){Mn.fromWorkingColorSpace(Xr.copy(this),t);let e=Xr.r,o=Xr.g,a=Xr.b;return t!==Or?`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(fs),this.setHSL(fs.h+t,fs.s+e,fs.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(fs),t.getHSL(Ll);let o=Hh(fs.h,Ll.h,e),a=Hh(fs.s,Ll.s,e),l=Hh(fs.l,Ll.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}},Xr=new An;An.NAMES=l0;var ic=class extends Xa{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new An(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=Qg,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 or=new vt,Nl=new fn,ki=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=cg,this.updateRange={offset:0,count:-1},this.gpuType=ds,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++)Nl.fromBufferAttribute(this,e),Nl.applyMatrix3(t),this.setXY(e,Nl.x,Nl.y);else if(this.itemSize===3)for(let e=0,o=this.count;e<o;e++)or.fromBufferAttribute(this,e),or.applyMatrix3(t),this.setXYZ(e,or.x,or.y,or.z);return this}applyMatrix4(t){for(let e=0,o=this.count;e<o;e++)or.fromBufferAttribute(this,e),or.applyMatrix4(t),this.setXYZ(e,or.x,or.y,or.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)or.fromBufferAttribute(this,e),or.applyNormalMatrix(t),this.setXYZ(e,or.x,or.y,or.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)or.fromBufferAttribute(this,e),or.transformDirection(t),this.setXYZ(e,or.x,or.y,or.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=Iu(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=fi(o,this.array)),this.array[t*this.itemSize+e]=o,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Iu(e,this.array)),e}setX(t,e){return this.normalized&&(e=fi(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Iu(e,this.array)),e}setY(t,e){return this.normalized&&(e=fi(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=Iu(e,this.array)),e}setZ(t,e){return this.normalized&&(e=fi(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=Iu(e,this.array)),e}setW(t,e){return this.normalized&&(e=fi(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,o){return t*=this.itemSize,this.normalized&&(e=fi(e,this.array),o=fi(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=fi(e,this.array),o=fi(o,this.array),a=fi(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=fi(e,this.array),o=fi(o,this.array),a=fi(a,this.array),l=fi(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!==cg&&(t.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(t.updateRange=this.updateRange),t}};var oc=class extends ki{constructor(t,e,o){super(new Uint16Array(t),e,o)}};var sc=class extends ki{constructor(t,e,o){super(new Uint32Array(t),e,o)}};var $o=class extends ki{constructor(t,e,o){super(new Float32Array(t),e,o)}};var mE=0,Ui=new Yr,of=new yo,Pa=new vt,bi=new Zs,Ou=new Zs,Sr=new vt,Js=class r extends _s{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:mE++}),this.uuid=Hu(),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(u0(t)?sc:oc)(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 Ui.makeRotationFromQuaternion(t),this.applyMatrix4(Ui),this}rotateX(t){return Ui.makeRotationX(t),this.applyMatrix4(Ui),this}rotateY(t){return Ui.makeRotationY(t),this.applyMatrix4(Ui),this}rotateZ(t){return Ui.makeRotationZ(t),this.applyMatrix4(Ui),this}translate(t,e,o){return Ui.makeTranslation(t,e,o),this.applyMatrix4(Ui),this}scale(t,e,o){return Ui.makeScale(t,e,o),this.applyMatrix4(Ui),this}lookAt(t){return of.lookAt(t),of.updateMatrix(),this.applyMatrix4(of.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Pa).negate(),this.translate(Pa.x,Pa.y,Pa.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 $o(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zs);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 vt(-1/0,-1/0,-1/0),new vt(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];bi.setFromBufferAttribute(l),this.morphTargetsRelative?(Sr.addVectors(this.boundingBox.min,bi.min),this.boundingBox.expandByPoint(Sr),Sr.addVectors(this.boundingBox.max,bi.max),this.boundingBox.expandByPoint(Sr)):(this.boundingBox.expandByPoint(bi.min),this.boundingBox.expandByPoint(bi.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 ku);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 vt,1/0);return}if(t){let o=this.boundingSphere.center;if(bi.setFromBufferAttribute(t),e)for(let l=0,h=e.length;l<h;l++){let f=e[l];Ou.setFromBufferAttribute(f),this.morphTargetsRelative?(Sr.addVectors(bi.min,Ou.min),bi.expandByPoint(Sr),Sr.addVectors(bi.max,Ou.max),bi.expandByPoint(Sr)):(bi.expandByPoint(Ou.min),bi.expandByPoint(Ou.max))}bi.getCenter(o);let a=0;for(let l=0,h=t.count;l<h;l++)Sr.fromBufferAttribute(t,l),a=Math.max(a,o.distanceToSquared(Sr));if(e)for(let l=0,h=e.length;l<h;l++){let f=e[l],p=this.morphTargetsRelative;for(let d=0,g=f.count;d<g;d++)Sr.fromBufferAttribute(f,d),p&&(Pa.fromBufferAttribute(t,d),Sr.add(Pa)),a=Math.max(a,o.distanceToSquared(Sr))}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,h=e.uv.array,f=a.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ki(new Float32Array(4*f),4));let p=this.getAttribute("tangent").array,d=[],g=[];for(let q=0;q<f;q++)d[q]=new vt,g[q]=new vt;let _=new vt,y=new vt,M=new vt,b=new fn,T=new fn,x=new fn,v=new vt,P=new vt;function S(q,st,V){_.fromArray(a,q*3),y.fromArray(a,st*3),M.fromArray(a,V*3),b.fromArray(h,q*2),T.fromArray(h,st*2),x.fromArray(h,V*2),y.sub(_),M.sub(_),T.sub(b),x.sub(b);let Mt=1/(T.x*x.y-x.x*T.y);isFinite(Mt)&&(v.copy(y).multiplyScalar(x.y).addScaledVector(M,-T.y).multiplyScalar(Mt),P.copy(M).multiplyScalar(T.x).addScaledVector(y,-x.x).multiplyScalar(Mt),d[q].add(v),d[st].add(v),d[V].add(v),g[q].add(P),g[st].add(P),g[V].add(P))}let L=this.groups;L.length===0&&(L=[{start:0,count:o.length}]);for(let q=0,st=L.length;q<st;++q){let V=L[q],Mt=V.start,$=V.count;for(let ut=Mt,xt=Mt+$;ut<xt;ut+=3)S(o[ut+0],o[ut+1],o[ut+2])}let N=new vt,G=new vt,B=new vt,I=new vt;function O(q){B.fromArray(l,q*3),I.copy(B);let st=d[q];N.copy(st),N.sub(B.multiplyScalar(B.dot(st))).normalize(),G.crossVectors(I,st);let Mt=G.dot(g[q])<0?-1:1;p[q*4]=N.x,p[q*4+1]=N.y,p[q*4+2]=N.z,p[q*4+3]=Mt}for(let q=0,st=L.length;q<st;++q){let V=L[q],Mt=V.start,$=V.count;for(let ut=Mt,xt=Mt+$;ut<xt;ut+=3)O(o[ut+0]),O(o[ut+1]),O(o[ut+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 ki(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 vt,l=new vt,h=new vt,f=new vt,p=new vt,d=new vt,g=new vt,_=new vt;if(t)for(let y=0,M=t.count;y<M;y+=3){let b=t.getX(y+0),T=t.getX(y+1),x=t.getX(y+2);a.fromBufferAttribute(e,b),l.fromBufferAttribute(e,T),h.fromBufferAttribute(e,x),g.subVectors(h,l),_.subVectors(a,l),g.cross(_),f.fromBufferAttribute(o,b),p.fromBufferAttribute(o,T),d.fromBufferAttribute(o,x),f.add(g),p.add(g),d.add(g),o.setXYZ(b,f.x,f.y,f.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),h.fromBufferAttribute(e,y+2),g.subVectors(h,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++)Sr.fromBufferAttribute(t,e),Sr.normalize(),t.setXYZ(e,Sr.x,Sr.y,Sr.z)}toNonIndexed(){function t(f,p){let d=f.array,g=f.itemSize,_=f.normalized,y=new d.constructor(p.length*g),M=0,b=0;for(let T=0,x=p.length;T<x;T++){f.isInterleavedBufferAttribute?M=p[T]*f.data.stride+f.offset:M=p[T]*g;for(let v=0;v<g;v++)y[b++]=d[M++]}return new ki(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 f in a){let p=a[f],d=t(p,o);e.setAttribute(f,d)}let l=this.morphAttributes;for(let f in l){let p=[],d=l[f];for(let g=0,_=d.length;g<_;g++){let y=d[g],M=t(y,o);p.push(M)}e.morphAttributes[f]=p}e.morphTargetsRelative=this.morphTargetsRelative;let h=this.groups;for(let f=0,p=h.length;f<p;f++){let d=h[f];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 h=this.groups;h.length>0&&(t.data.groups=JSON.parse(JSON.stringify(h)));let f=this.boundingSphere;return f!==null&&(t.data.boundingSphere={center:f.center.toArray(),radius:f.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 h=t.groups;for(let d=0,g=h.length;d<g;d++){let _=h[d];this.addGroup(_.start,_.count,_.materialIndex)}let f=t.boundingBox;f!==null&&(this.boundingBox=f.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"})}},wg=new Yr,Vs=new Ef,Ol=new ku,bg=new vt,Ia=new vt,Ra=new vt,La=new vt,sf=new vt,Dl=new vt,Fl=new fn,Ul=new fn,Bl=new fn,Tg=new vt,Ag=new vt,Cg=new vt,zl=new vt,kl=new vt,go=class extends yo{constructor(t=new Js,e=new ic){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,h=a.length;l<h;l++){let f=a[l].name||String(l);this.morphTargetInfluences.push(0),this.morphTargetDictionary[f]=l}}}}getVertexPosition(t,e){let o=this.geometry,a=o.attributes.position,l=o.morphAttributes.position,h=o.morphTargetsRelative;e.fromBufferAttribute(a,t);let f=this.morphTargetInfluences;if(l&&f){Dl.set(0,0,0);for(let p=0,d=l.length;p<d;p++){let g=f[p],_=l[p];g!==0&&(sf.fromBufferAttribute(_,t),h?Dl.addScaledVector(sf,g):Dl.addScaledVector(sf.sub(e),g))}e.add(Dl)}return e}raycast(t,e){let o=this.geometry,a=this.material,l=this.matrixWorld;a!==void 0&&(o.boundingSphere===null&&o.computeBoundingSphere(),Ol.copy(o.boundingSphere),Ol.applyMatrix4(l),Vs.copy(t.ray).recast(t.near),!(Ol.containsPoint(Vs.origin)===!1&&(Vs.intersectSphere(Ol,bg)===null||Vs.origin.distanceToSquared(bg)>(t.far-t.near)**2))&&(wg.copy(l).invert(),Vs.copy(t.ray).applyMatrix4(wg),!(o.boundingBox!==null&&Vs.intersectsBox(o.boundingBox)===!1)&&this._computeIntersections(t,e,Vs)))}_computeIntersections(t,e,o){let a,l=this.geometry,h=this.material,f=l.index,p=l.attributes.position,d=l.attributes.uv,g=l.attributes.uv1,_=l.attributes.normal,y=l.groups,M=l.drawRange;if(f!==null)if(Array.isArray(h))for(let b=0,T=y.length;b<T;b++){let x=y[b],v=h[x.materialIndex],P=Math.max(x.start,M.start),S=Math.min(f.count,Math.min(x.start+x.count,M.start+M.count));for(let L=P,N=S;L<N;L+=3){let G=f.getX(L),B=f.getX(L+1),I=f.getX(L+2);a=Gl(this,v,t,o,d,g,_,G,B,I),a&&(a.faceIndex=Math.floor(L/3),a.face.materialIndex=x.materialIndex,e.push(a))}}else{let b=Math.max(0,M.start),T=Math.min(f.count,M.start+M.count);for(let x=b,v=T;x<v;x+=3){let P=f.getX(x),S=f.getX(x+1),L=f.getX(x+2);a=Gl(this,h,t,o,d,g,_,P,S,L),a&&(a.faceIndex=Math.floor(x/3),e.push(a))}}else if(p!==void 0)if(Array.isArray(h))for(let b=0,T=y.length;b<T;b++){let x=y[b],v=h[x.materialIndex],P=Math.max(x.start,M.start),S=Math.min(p.count,Math.min(x.start+x.count,M.start+M.count));for(let L=P,N=S;L<N;L+=3){let G=L,B=L+1,I=L+2;a=Gl(this,v,t,o,d,g,_,G,B,I),a&&(a.faceIndex=Math.floor(L/3),a.face.materialIndex=x.materialIndex,e.push(a))}}else{let b=Math.max(0,M.start),T=Math.min(p.count,M.start+M.count);for(let x=b,v=T;x<v;x+=3){let P=x,S=x+1,L=x+2;a=Gl(this,h,t,o,d,g,_,P,S,L),a&&(a.faceIndex=Math.floor(x/3),e.push(a))}}}};function gE(r,t,e,o,a,l,h,f){let p;if(t.side===di?p=o.intersectTriangle(h,l,a,!0,f):p=o.intersectTriangle(a,l,h,t.side===vs,f),p===null)return null;kl.copy(f),kl.applyMatrix4(r.matrixWorld);let d=e.ray.origin.distanceTo(kl);return d<e.near||d>e.far?null:{distance:d,point:kl.clone(),object:r}}function Gl(r,t,e,o,a,l,h,f,p,d){r.getVertexPosition(f,Ia),r.getVertexPosition(p,Ra),r.getVertexPosition(d,La);let g=gE(r,t,e,o,Ia,Ra,La,zl);if(g){a&&(Fl.fromBufferAttribute(a,f),Ul.fromBufferAttribute(a,p),Bl.fromBufferAttribute(a,d),g.uv=Ua.getInterpolation(zl,Ia,Ra,La,Fl,Ul,Bl,new fn)),l&&(Fl.fromBufferAttribute(l,f),Ul.fromBufferAttribute(l,p),Bl.fromBufferAttribute(l,d),g.uv1=Ua.getInterpolation(zl,Ia,Ra,La,Fl,Ul,Bl,new fn),g.uv2=g.uv1),h&&(Tg.fromBufferAttribute(h,f),Ag.fromBufferAttribute(h,p),Cg.fromBufferAttribute(h,d),g.normal=Ua.getInterpolation(zl,Ia,Ra,La,Tg,Ag,Cg,new vt),g.normal.dot(o.direction)>0&&g.normal.multiplyScalar(-1));let _={a:f,b:p,c:d,normal:new vt,materialIndex:0};Ua.getNormal(Ia,Ra,La,_.normal),g.face=_}return g}var Gu=class r extends Js{constructor(t=1,e=1,o=1,a=1,l=1,h=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:o,widthSegments:a,heightSegments:l,depthSegments:h};let f=this;a=Math.floor(a),l=Math.floor(l),h=Math.floor(h);let p=[],d=[],g=[],_=[],y=0,M=0;b("z","y","x",-1,-1,o,e,t,h,l,0),b("z","y","x",1,-1,o,e,-t,h,l,1),b("x","z","y",1,1,t,o,e,a,h,2),b("x","z","y",1,-1,t,o,-e,a,h,3),b("x","y","z",1,-1,t,e,o,a,l,4),b("x","y","z",-1,-1,t,e,-o,a,l,5),this.setIndex(p),this.setAttribute("position",new $o(d,3)),this.setAttribute("normal",new $o(g,3)),this.setAttribute("uv",new $o(_,2));function b(T,x,v,P,S,L,N,G,B,I,O){let q=L/B,st=N/I,V=L/2,Mt=N/2,$=G/2,ut=B+1,xt=I+1,mt=0,lt=0,ht=new vt;for(let k=0;k<xt;k++){let nt=k*st-Mt;for(let ft=0;ft<ut;ft++){let Tt=ft*q-V;ht[T]=Tt*P,ht[x]=nt*S,ht[v]=$,d.push(ht.x,ht.y,ht.z),ht[T]=0,ht[x]=0,ht[v]=G>0?1:-1,g.push(ht.x,ht.y,ht.z),_.push(ft/B),_.push(1-k/I),mt+=1}}for(let k=0;k<I;k++)for(let nt=0;nt<B;nt++){let ft=y+nt+ut*k,Tt=y+nt+ut*(k+1),gt=y+(nt+1)+ut*(k+1),Lt=y+(nt+1)+ut*k;p.push(ft,Tt,Lt),p.push(Tt,gt,Lt),lt+=6}f.addGroup(M,lt,O),M+=lt,y+=mt}}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 Ya(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 ni(r){let t={};for(let e=0;e<r.length;e++){let o=Ya(r[e]);for(let a in o)t[a]=o[a]}return t}function yE(r){let t=[];for(let e=0;e<r.length;e++)t.push(r[e].clone());return t}function c0(r){return r.getRenderTarget()===null?r.outputColorSpace:Mn.workingColorSpace}var vE={clone:Ya,merge:ni},_E=`void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}`,xE=`void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}`,Ko=class extends Xa{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=_E,this.fragmentShader=xE,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ya(t.uniforms),this.uniformsGroups=yE(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){let e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(let a in this.uniforms){let h=this.uniforms[a].value;h&&h.isTexture?e.uniforms[a]={type:"t",value:h.toJSON(t).uuid}:h&&h.isColor?e.uniforms[a]={type:"c",value:h.getHex()}:h&&h.isVector2?e.uniforms[a]={type:"v2",value:h.toArray()}:h&&h.isVector3?e.uniforms[a]={type:"v3",value:h.toArray()}:h&&h.isVector4?e.uniforms[a]={type:"v4",value:h.toArray()}:h&&h.isMatrix3?e.uniforms[a]={type:"m3",value:h.toArray()}:h&&h.isMatrix4?e.uniforms[a]={type:"m4",value:h.toArray()}:e.uniforms[a]={value:h}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let o={};for(let a in this.extensions)this.extensions[a]===!0&&(o[a]=!0);return Object.keys(o).length>0&&(e.extensions=o),e}},ac=class extends yo{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Yr,this.projectionMatrix=new Yr,this.projectionMatrixInverse=new Yr,this.coordinateSystem=Yo}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},Ti=class extends ac{constructor(t=50,e=1,o=.1,a=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=o,this.far=a,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=yf*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(Vh*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return yf*2*Math.atan(Math.tan(Vh*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,o,a,l,h){this.aspect=t/e,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=h,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(Vh*.5*this.fov)/this.zoom,o=2*e,a=this.aspect*o,l=-.5*a,h=this.view;if(this.view!==null&&this.view.enabled){let p=h.fullWidth,d=h.fullHeight;l+=h.offsetX*a/p,e-=h.offsetY*o/d,a*=h.width/p,o*=h.height/d}let f=this.filmOffset;f!==0&&(l+=t*f/this.getFilmWidth()),this.projectionMatrix.makePerspective(l,l+a,e,e-o,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}},Na=-90,Oa=1,Mf=class extends yo{constructor(t,e,o){super(),this.type="CubeCamera",this.renderTarget=o,this.coordinateSystem=null,this.activeMipmapLevel=0;let a=new Ti(Na,Oa,t,e);a.layers=this.layers,this.add(a);let l=new Ti(Na,Oa,t,e);l.layers=this.layers,this.add(l);let h=new Ti(Na,Oa,t,e);h.layers=this.layers,this.add(h);let f=new Ti(Na,Oa,t,e);f.layers=this.layers,this.add(f);let p=new Ti(Na,Oa,t,e);p.layers=this.layers,this.add(p);let d=new Ti(Na,Oa,t,e);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[o,a,l,h,f,p]=e;for(let d of e)this.remove(d);if(t===Yo)o.up.set(0,1,0),o.lookAt(1,0,0),a.up.set(0,1,0),a.lookAt(-1,0,0),l.up.set(0,0,-1),l.lookAt(0,1,0),h.up.set(0,0,1),h.lookAt(0,-1,0),f.up.set(0,1,0),f.lookAt(0,0,1),p.up.set(0,1,0),p.lookAt(0,0,-1);else if(t===Kl)o.up.set(0,-1,0),o.lookAt(-1,0,0),a.up.set(0,-1,0),a.lookAt(1,0,0),l.up.set(0,0,1),l.lookAt(0,1,0),h.up.set(0,0,-1),h.lookAt(0,-1,0),f.up.set(0,-1,0),f.lookAt(0,0,1),p.up.set(0,-1,0),p.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let d of e)this.add(d),d.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();let{renderTarget:o,activeMipmapLevel:a}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[l,h,f,p,d,g]=this.children,_=t.getRenderTarget(),y=t.getActiveCubeFace(),M=t.getActiveMipmapLevel(),b=t.xr.enabled;t.xr.enabled=!1;let T=o.texture.generateMipmaps;o.texture.generateMipmaps=!1,t.setRenderTarget(o,0,a),t.render(e,l),t.setRenderTarget(o,1,a),t.render(e,h),t.setRenderTarget(o,2,a),t.render(e,f),t.setRenderTarget(o,3,a),t.render(e,p),t.setRenderTarget(o,4,a),t.render(e,d),o.texture.generateMipmaps=T,t.setRenderTarget(o,5,a),t.render(e,g),t.setRenderTarget(_,y,M),t.xr.enabled=b,o.texture.needsPMREMUpdate=!0}},uc=class extends no{constructor(t,e,o,a,l,h,f,p,d,g){t=t!==void 0?t:[],e=e!==void 0?e:Ha,super(t,e,o,a,l,h,f,p,d,g),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},Sf=class extends Jo{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;let o={width:t,height:t,depth:1},a=[o,o,o,o,o,o];e.encoding!==void 0&&(Fu("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),e.colorSpace=e.encoding===$s?Or:zi),this.texture=new uc(a,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=e.generateMipmaps!==void 0?e.generateMipmaps:!1,this.texture.minFilter=e.minFilter!==void 0?e.minFilter:Bi}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let o={uniforms:{tEquirect:{value:null}},vertexShader:`\n\n varying vec3 vWorldDirection;\n\n vec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n }\n\n void main() {\n\n vWorldDirection = transformDirection( position, modelMatrix );\n\n #include <begin_vertex>\n #include <project_vertex>\n\n }\n `,fragmentShader:`\n\n uniform sampler2D tEquirect;\n\n varying vec3 vWorldDirection;\n\n #include <common>\n\n void main() {\n\n vec3 direction = normalize( vWorldDirection );\n\n vec2 sampleUV = equirectUv( direction );\n\n gl_FragColor = texture2D( tEquirect, sampleUV );\n\n }\n `},a=new Gu(5,5,5),l=new Ko({name:"CubemapFromEquirect",uniforms:Ya(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,side:di,blending:ms});l.uniforms.tEquirect.value=e;let h=new go(a,l),f=e.minFilter;return e.minFilter===Bu&&(e.minFilter=Bi),new Mf(1,10,this).update(t,h),e.minFilter=f,h.geometry.dispose(),h.material.dispose(),this}clear(t,e,o,a){let l=t.getRenderTarget();for(let h=0;h<6;h++)t.setRenderTarget(this,h),t.clear(e,o,a);t.setRenderTarget(l)}},af=new vt,EE=new vt,ME=new ye,qo=class{constructor(t=new vt(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=af.subVectors(o,e).cross(EE.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(af),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||ME.getNormalMatrix(t),a=this.coplanarPoint(af).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)}},Hs=new ku,Vl=new vt,lc=class{constructor(t=new qo,e=new qo,o=new qo,a=new qo,l=new qo,h=new qo){this.planes=[t,e,o,a,l,h]}set(t,e,o,a,l,h){let f=this.planes;return f[0].copy(t),f[1].copy(e),f[2].copy(o),f[3].copy(a),f[4].copy(l),f[5].copy(h),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=Yo){let o=this.planes,a=t.elements,l=a[0],h=a[1],f=a[2],p=a[3],d=a[4],g=a[5],_=a[6],y=a[7],M=a[8],b=a[9],T=a[10],x=a[11],v=a[12],P=a[13],S=a[14],L=a[15];if(o[0].setComponents(p-l,y-d,x-M,L-v).normalize(),o[1].setComponents(p+l,y+d,x+M,L+v).normalize(),o[2].setComponents(p+h,y+g,x+b,L+P).normalize(),o[3].setComponents(p-h,y-g,x-b,L-P).normalize(),o[4].setComponents(p-f,y-_,x-T,L-S).normalize(),e===Yo)o[5].setComponents(p+f,y+_,x+T,L+S).normalize();else if(e===Kl)o[5].setComponents(f,_,T,S).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(),Hs.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Hs.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Hs)}intersectsSprite(t){return Hs.center.set(0,0,0),Hs.radius=.7071067811865476,Hs.applyMatrix4(t.matrixWorld),this.intersectsSphere(Hs)}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(Vl.x=a.normal.x>0?t.max.x:t.min.x,Vl.y=a.normal.y>0?t.max.y:t.min.y,Vl.z=a.normal.z>0?t.max.z:t.min.z,a.distanceToPoint(Vl)<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 h0(){let r=null,t=!1,e=null,o=null;function a(l,h){e(l,h),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 SE(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 b;if(_ instanceof Float32Array)b=r.FLOAT;else if(_ instanceof Uint16Array)if(d.isFloat16BufferAttribute)if(e)b=r.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else b=r.UNSIGNED_SHORT;else if(_ instanceof Int16Array)b=r.SHORT;else if(_ instanceof Uint32Array)b=r.UNSIGNED_INT;else if(_ instanceof Int32Array)b=r.INT;else if(_ instanceof Int8Array)b=r.BYTE;else if(_ instanceof Uint8Array)b=r.UNSIGNED_BYTE;else if(_ instanceof Uint8ClampedArray)b=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+_);return{buffer:M,type:b,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 h(d){return d.isInterleavedBufferAttribute&&(d=d.data),o.get(d)}function f(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:h,remove:f,update:p}}var wf=class r extends Js{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,h=e/2,f=Math.floor(o),p=Math.floor(a),d=f+1,g=p+1,_=t/f,y=e/p,M=[],b=[],T=[],x=[];for(let v=0;v<g;v++){let P=v*y-h;for(let S=0;S<d;S++){let L=S*_-l;b.push(L,-P,0),T.push(0,0,1),x.push(S/f),x.push(1-v/p)}}for(let v=0;v<p;v++)for(let P=0;P<f;P++){let S=P+d*v,L=P+d*(v+1),N=P+1+d*(v+1),G=P+1+d*v;M.push(S,L,G),M.push(L,N,G)}this.setIndex(M),this.setAttribute("position",new $o(b,3)),this.setAttribute("normal",new $o(T,3)),this.setAttribute("uv",new $o(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)}},wE=`#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif`,bE=`#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif`,TE=`#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif`,AE=`#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,CE=`#ifdef USE_ALPHATEST\n if ( diffuseColor.a < alphaTest ) discard;\n#endif`,PE=`#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif`,IE=`#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif`,RE=`#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif`,LE=`vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif`,NE=`vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif`,OE=`float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated`,DE=`#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif`,FE=`#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = dFdx( surf_pos.xyz );\n vec3 vSigmaY = dFdy( surf_pos.xyz );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif`,UE=`#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n#endif`,BE=`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif`,zE=`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif`,kE=`#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif`,GE=`#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif`,VE=`#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif`,HE=`#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n varying vec3 vColor;\n#endif`,WE=`#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif`,qE=`#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n return dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated`,XE=`#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_v0 0.339\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_v1 0.276\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_v4 0.046\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_v5 0.016\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_v6 0.0038\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif`,YE=`vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n mat3 m = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n transformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif`,$E=`#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif`,ZE=`#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif`,JE=`#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif`,KE=`#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif`,jE="gl_FragColor = linearToOutputTexel( gl_FragColor );",QE=`\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n vec3( 0.8224621, 0.177538, 0.0 ),\n vec3( 0.0331941, 0.9668058, 0.0 ),\n vec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n vec3( 1.2249401, - 0.2249404, 0.0 ),\n vec3( - 0.0420569, 1.0420571, 0.0 ),\n vec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return sRGBTransferOETF( value );\n}`,tM=`#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif`,eM=`#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif`,nM=`#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif`,rM=`#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif`,iM=`#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif`,oM=`#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif`,sM=`#ifdef USE_FOG\n varying float vFogDepth;\n#endif`,aM=`#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif`,uM=`#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif`,lM=`#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}`,cM=`#ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n reflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif`,hM=`#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif`,fM=`LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;`,pM=`varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,dM=`uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n #if defined ( LEGACY_LIGHTS )\n if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n }\n return 1.0;\n #else\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n #endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif`,mM=`#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif`,gM=`ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;`,yM=`varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,vM=`BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`,_M=`varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,xM=`PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif`,EM=`struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return saturate(v);\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColor;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}`,MM=`\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal;\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif`,SM=`#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif`,wM=`#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif`,bM=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif`,TM=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif`,AM=`#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n varying float vFragDepth;\n varying float vIsPerspective;\n #else\n uniform float logDepthBufFC;\n #endif\n#endif`,CM=`#ifdef USE_LOGDEPTHBUF\n #ifdef USE_LOGDEPTHBUF_EXT\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n #else\n if ( isPerspectiveMatrix( projectionMatrix ) ) {\n gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n gl_Position.z *= gl_Position.w;\n }\n #endif\n#endif`,PM=`#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n \n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif`,IM=`#ifdef USE_MAP\n uniform sampler2D map;\n#endif`,RM=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif`,LM=`#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,NM=`float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif`,OM=`#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif`,DM=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif`,FM=`#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n #endif\n#endif`,UM=`#ifdef USE_MORPHTARGETS\n uniform float morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n #else\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n #endif\n#endif`,BM=`#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n #endif\n #endif\n#endif`,zM=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;`,kM=`#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif`,GM=`#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif`,VM=`#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif`,HM=`#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif`,WM=`#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif`,qM=`#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif`,XM=`#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif`,YM=`#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif`,$M=`#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif`,ZM=`#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );`,JM=`vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n return packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}`,KM=`#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif`,jM=`vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;`,QM=`#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif`,tS=`#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif`,eS=`float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif`,nS=`#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif`,rS=`#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n vec3 lightToPosition = shadowCoord.xyz;\n float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n return (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n#endif`,iS=`#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif`,oS=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif`,sS=`float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}`,aS=`#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif`,uS=`#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n uniform int boneTextureSize;\n mat4 getBoneMatrix( const in float i ) {\n float j = i * 4.0;\n float x = mod( j, float( boneTextureSize ) );\n float y = floor( j / float( boneTextureSize ) );\n float dx = 1.0 / float( boneTextureSize );\n float dy = 1.0 / float( boneTextureSize );\n y = dy * ( y + 0.5 );\n vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n mat4 bone = mat4( v1, v2, v3, v4 );\n return bone;\n }\n#endif`,lS=`#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif`,cS=`#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif`,hS=`float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif`,fS=`#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif`,pS=`#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif`,dS=`#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }`,mS=`#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif`,gS=`#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif`,yS=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif`,vS=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif`,_S=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif`,xS=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif`,ES=`varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}`,MS=`uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}`,SS=`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}`,wS=`#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}`,bS=`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}`,TS=`uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}`,AS=`#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}`,CS=`#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <logdepthbuf_fragment>\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}`,PS=`#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <skinbase_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}`,IS=`#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( 1.0 );\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}`,RS=`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}`,LS=`uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}`,NS=`uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}`,OS=`uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}`,DS=`#include <common>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}`,FS=`uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,US=`#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,BS=`#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,zS=`#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}`,kS=`#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,GS=`#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}`,VS=`#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}`,HS=`#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,WS=`#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,qS=`#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}`,XS=`#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n #endif\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,YS=`#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,$S=`#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4( diffuse, opacity );\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}`,ZS=`uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}`,JS=`uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}`,KS=`#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}`,jS=`uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}`,QS=`uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}`,tw=`uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}`,ge={alphahash_fragment:wE,alphahash_pars_fragment:bE,alphamap_fragment:TE,alphamap_pars_fragment:AE,alphatest_fragment:CE,alphatest_pars_fragment:PE,aomap_fragment:IE,aomap_pars_fragment:RE,begin_vertex:LE,beginnormal_vertex:NE,bsdfs:OE,iridescence_fragment:DE,bumpmap_pars_fragment:FE,clipping_planes_fragment:UE,clipping_planes_pars_fragment:BE,clipping_planes_pars_vertex:zE,clipping_planes_vertex:kE,color_fragment:GE,color_pars_fragment:VE,color_pars_vertex:HE,color_vertex:WE,common:qE,cube_uv_reflection_fragment:XE,defaultnormal_vertex:YE,displacementmap_pars_vertex:$E,displacementmap_vertex:ZE,emissivemap_fragment:JE,emissivemap_pars_fragment:KE,colorspace_fragment:jE,colorspace_pars_fragment:QE,envmap_fragment:tM,envmap_common_pars_fragment:eM,envmap_pars_fragment:nM,envmap_pars_vertex:rM,envmap_physical_pars_fragment:mM,envmap_vertex:iM,fog_vertex:oM,fog_pars_vertex:sM,fog_fragment:aM,fog_pars_fragment:uM,gradientmap_pars_fragment:lM,lightmap_fragment:cM,lightmap_pars_fragment:hM,lights_lambert_fragment:fM,lights_lambert_pars_fragment:pM,lights_pars_begin:dM,lights_toon_fragment:gM,lights_toon_pars_fragment:yM,lights_phong_fragment:vM,lights_phong_pars_fragment:_M,lights_physical_fragment:xM,lights_physical_pars_fragment:EM,lights_fragment_begin:MM,lights_fragment_maps:SM,lights_fragment_end:wM,logdepthbuf_fragment:bM,logdepthbuf_pars_fragment:TM,logdepthbuf_pars_vertex:AM,logdepthbuf_vertex:CM,map_fragment:PM,map_pars_fragment:IM,map_particle_fragment:RM,map_particle_pars_fragment:LM,metalnessmap_fragment:NM,metalnessmap_pars_fragment:OM,morphcolor_vertex:DM,morphnormal_vertex:FM,morphtarget_pars_vertex:UM,morphtarget_vertex:BM,normal_fragment_begin:zM,normal_fragment_maps:kM,normal_pars_fragment:GM,normal_pars_vertex:VM,normal_vertex:HM,normalmap_pars_fragment:WM,clearcoat_normal_fragment_begin:qM,clearcoat_normal_fragment_maps:XM,clearcoat_pars_fragment:YM,iridescence_pars_fragment:$M,opaque_fragment:ZM,packing:JM,premultiplied_alpha_fragment:KM,project_vertex:jM,dithering_fragment:QM,dithering_pars_fragment:tS,roughnessmap_fragment:eS,roughnessmap_pars_fragment:nS,shadowmap_pars_fragment:rS,shadowmap_pars_vertex:iS,shadowmap_vertex:oS,shadowmask_pars_fragment:sS,skinbase_vertex:aS,skinning_pars_vertex:uS,skinning_vertex:lS,skinnormal_vertex:cS,specularmap_fragment:hS,specularmap_pars_fragment:fS,tonemapping_fragment:pS,tonemapping_pars_fragment:dS,transmission_fragment:mS,transmission_pars_fragment:gS,uv_pars_fragment:yS,uv_pars_vertex:vS,uv_vertex:_S,worldpos_vertex:xS,background_vert:ES,background_frag:MS,backgroundCube_vert:SS,backgroundCube_frag:wS,cube_vert:bS,cube_frag:TS,depth_vert:AS,depth_frag:CS,distanceRGBA_vert:PS,distanceRGBA_frag:IS,equirect_vert:RS,equirect_frag:LS,linedashed_vert:NS,linedashed_frag:OS,meshbasic_vert:DS,meshbasic_frag:FS,meshlambert_vert:US,meshlambert_frag:BS,meshmatcap_vert:zS,meshmatcap_frag:kS,meshnormal_vert:GS,meshnormal_frag:VS,meshphong_vert:HS,meshphong_frag:WS,meshphysical_vert:qS,meshphysical_frag:XS,meshtoon_vert:YS,meshtoon_frag:$S,points_vert:ZS,points_frag:JS,shadow_vert:KS,shadow_frag:jS,sprite_vert:QS,sprite_frag:tw},kt={common:{diffuse:{value:new An(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 An(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 An(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 An(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:ni([kt.common,kt.specularmap,kt.envmap,kt.aomap,kt.lightmap,kt.fog]),vertexShader:ge.meshbasic_vert,fragmentShader:ge.meshbasic_frag},lambert:{uniforms:ni([kt.common,kt.specularmap,kt.envmap,kt.aomap,kt.lightmap,kt.emissivemap,kt.bumpmap,kt.normalmap,kt.displacementmap,kt.fog,kt.lights,{emissive:{value:new An(0)}}]),vertexShader:ge.meshlambert_vert,fragmentShader:ge.meshlambert_frag},phong:{uniforms:ni([kt.common,kt.specularmap,kt.envmap,kt.aomap,kt.lightmap,kt.emissivemap,kt.bumpmap,kt.normalmap,kt.displacementmap,kt.fog,kt.lights,{emissive:{value:new An(0)},specular:{value:new An(1118481)},shininess:{value:30}}]),vertexShader:ge.meshphong_vert,fragmentShader:ge.meshphong_frag},standard:{uniforms:ni([kt.common,kt.envmap,kt.aomap,kt.lightmap,kt.emissivemap,kt.bumpmap,kt.normalmap,kt.displacementmap,kt.roughnessmap,kt.metalnessmap,kt.fog,kt.lights,{emissive:{value:new An(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ge.meshphysical_vert,fragmentShader:ge.meshphysical_frag},toon:{uniforms:ni([kt.common,kt.aomap,kt.lightmap,kt.emissivemap,kt.bumpmap,kt.normalmap,kt.displacementmap,kt.gradientmap,kt.fog,kt.lights,{emissive:{value:new An(0)}}]),vertexShader:ge.meshtoon_vert,fragmentShader:ge.meshtoon_frag},matcap:{uniforms:ni([kt.common,kt.bumpmap,kt.normalmap,kt.displacementmap,kt.fog,{matcap:{value:null}}]),vertexShader:ge.meshmatcap_vert,fragmentShader:ge.meshmatcap_frag},points:{uniforms:ni([kt.points,kt.fog]),vertexShader:ge.points_vert,fragmentShader:ge.points_frag},dashed:{uniforms:ni([kt.common,kt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ge.linedashed_vert,fragmentShader:ge.linedashed_frag},depth:{uniforms:ni([kt.common,kt.displacementmap]),vertexShader:ge.depth_vert,fragmentShader:ge.depth_frag},normal:{uniforms:ni([kt.common,kt.bumpmap,kt.normalmap,kt.displacementmap,{opacity:{value:1}}]),vertexShader:ge.meshnormal_vert,fragmentShader:ge.meshnormal_frag},sprite:{uniforms:ni([kt.sprite,kt.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:ni([kt.common,kt.displacementmap,{referencePosition:{value:new vt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ge.distanceRGBA_vert,fragmentShader:ge.distanceRGBA_frag},shadow:{uniforms:ni([kt.lights,kt.fog,{color:{value:new An(0)},opacity:{value:1}}]),vertexShader:ge.shadow_vert,fragmentShader:ge.shadow_frag}};mo.physical={uniforms:ni([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 An(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 An(0)},specularColor:{value:new An(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 Hl={r:0,b:0,g:0};function ew(r,t,e,o,a,l,h){let f=new An(0),p=l===!0?0:1,d,g,_=null,y=0,M=null;function b(x,v){let P=!1,S=v.isScene===!0?v.background:null;S&&S.isTexture&&(S=(v.backgroundBlurriness>0?e:t).get(S)),S===null?T(f,p):S&&S.isColor&&(T(S,1),P=!0);let L=r.xr.getEnvironmentBlendMode();L==="additive"?o.buffers.color.setClear(0,0,0,1,h):L==="alpha-blend"&&o.buffers.color.setClear(0,0,0,0,h),(r.autoClear||P)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),S&&(S.isCubeTexture||S.mapping===hc)?(g===void 0&&(g=new go(new Gu(1,1,1),new Ko({name:"BackgroundCubeMaterial",uniforms:Ya(mo.backgroundCube.uniforms),vertexShader:mo.backgroundCube.vertexShader,fragmentShader:mo.backgroundCube.fragmentShader,side:di,depthTest:!1,depthWrite:!1,fog:!1})),g.geometry.deleteAttribute("normal"),g.geometry.deleteAttribute("uv"),g.onBeforeRender=function(N,G,B){this.matrixWorld.copyPosition(B.matrixWorld)},Object.defineProperty(g.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(g)),g.material.uniforms.envMap.value=S,g.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,g.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,g.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,g.material.toneMapped=Mn.getTransfer(S.colorSpace)!==Dn,(_!==S||y!==S.version||M!==r.toneMapping)&&(g.material.needsUpdate=!0,_=S,y=S.version,M=r.toneMapping),g.layers.enableAll(),x.unshift(g,g.geometry,g.material,0,0,null)):S&&S.isTexture&&(d===void 0&&(d=new go(new wf(2,2),new Ko({name:"BackgroundMaterial",uniforms:Ya(mo.background.uniforms),vertexShader:mo.background.vertexShader,fragmentShader:mo.background.fragmentShader,side:vs,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=S,d.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,d.material.toneMapped=Mn.getTransfer(S.colorSpace)!==Dn,S.matrixAutoUpdate===!0&&S.updateMatrix(),d.material.uniforms.uvTransform.value.copy(S.matrix),(_!==S||y!==S.version||M!==r.toneMapping)&&(d.material.needsUpdate=!0,_=S,y=S.version,M=r.toneMapping),d.layers.enableAll(),x.unshift(d,d.geometry,d.material,0,0,null))}function T(x,v){x.getRGB(Hl,c0(r)),o.buffers.color.setClear(Hl.r,Hl.g,Hl.b,v,h)}return{getClearColor:function(){return f},setClearColor:function(x,v=1){f.set(x),p=v,T(f,p)},getClearAlpha:function(){return p},setClearAlpha:function(x){p=x,T(f,p)},render:b}}function nw(r,t,e,o){let a=r.getParameter(r.MAX_VERTEX_ATTRIBS),l=o.isWebGL2?null:t.get("OES_vertex_array_object"),h=o.isWebGL2||l!==null,f={},p=x(null),d=p,g=!1;function _($,ut,xt,mt,lt){let ht=!1;if(h){let k=T(mt,xt,ut);d!==k&&(d=k,M(d.object)),ht=v($,mt,xt,lt),ht&&P($,mt,xt,lt)}else{let k=ut.wireframe===!0;(d.geometry!==mt.id||d.program!==xt.id||d.wireframe!==k)&&(d.geometry=mt.id,d.program=xt.id,d.wireframe=k,ht=!0)}lt!==null&&e.update(lt,r.ELEMENT_ARRAY_BUFFER),(ht||g)&&(g=!1,I($,ut,xt,mt),lt!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(lt).buffer))}function y(){return o.isWebGL2?r.createVertexArray():l.createVertexArrayOES()}function M($){return o.isWebGL2?r.bindVertexArray($):l.bindVertexArrayOES($)}function b($){return o.isWebGL2?r.deleteVertexArray($):l.deleteVertexArrayOES($)}function T($,ut,xt){let mt=xt.wireframe===!0,lt=f[$.id];lt===void 0&&(lt={},f[$.id]=lt);let ht=lt[ut.id];ht===void 0&&(ht={},lt[ut.id]=ht);let k=ht[mt];return k===void 0&&(k=x(y()),ht[mt]=k),k}function x($){let ut=[],xt=[],mt=[];for(let lt=0;lt<a;lt++)ut[lt]=0,xt[lt]=0,mt[lt]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:ut,enabledAttributes:xt,attributeDivisors:mt,object:$,attributes:{},index:null}}function v($,ut,xt,mt){let lt=d.attributes,ht=ut.attributes,k=0,nt=xt.getAttributes();for(let ft in nt)if(nt[ft].location>=0){let gt=lt[ft],Lt=ht[ft];if(Lt===void 0&&(ft==="instanceMatrix"&&$.instanceMatrix&&(Lt=$.instanceMatrix),ft==="instanceColor"&&$.instanceColor&&(Lt=$.instanceColor)),gt===void 0||gt.attribute!==Lt||Lt&>.data!==Lt.data)return!0;k++}return d.attributesNum!==k||d.index!==mt}function P($,ut,xt,mt){let lt={},ht=ut.attributes,k=0,nt=xt.getAttributes();for(let ft in nt)if(nt[ft].location>=0){let gt=ht[ft];gt===void 0&&(ft==="instanceMatrix"&&$.instanceMatrix&&(gt=$.instanceMatrix),ft==="instanceColor"&&$.instanceColor&&(gt=$.instanceColor));let Lt={};Lt.attribute=gt,gt&>.data&&(Lt.data=gt.data),lt[ft]=Lt,k++}d.attributes=lt,d.attributesNum=k,d.index=mt}function S(){let $=d.newAttributes;for(let ut=0,xt=$.length;ut<xt;ut++)$[ut]=0}function L($){N($,0)}function N($,ut){let xt=d.newAttributes,mt=d.enabledAttributes,lt=d.attributeDivisors;xt[$]=1,mt[$]===0&&(r.enableVertexAttribArray($),mt[$]=1),lt[$]!==ut&&((o.isWebGL2?r:t.get("ANGLE_instanced_arrays"))[o.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"]($,ut),lt[$]=ut)}function G(){let $=d.newAttributes,ut=d.enabledAttributes;for(let xt=0,mt=ut.length;xt<mt;xt++)ut[xt]!==$[xt]&&(r.disableVertexAttribArray(xt),ut[xt]=0)}function B($,ut,xt,mt,lt,ht,k){k===!0?r.vertexAttribIPointer($,ut,xt,lt,ht):r.vertexAttribPointer($,ut,xt,mt,lt,ht)}function I($,ut,xt,mt){if(o.isWebGL2===!1&&($.isInstancedMesh||mt.isInstancedBufferGeometry)&&t.get("ANGLE_instanced_arrays")===null)return;S();let lt=mt.attributes,ht=xt.getAttributes(),k=ut.defaultAttributeValues;for(let nt in ht){let ft=ht[nt];if(ft.location>=0){let Tt=lt[nt];if(Tt===void 0&&(nt==="instanceMatrix"&&$.instanceMatrix&&(Tt=$.instanceMatrix),nt==="instanceColor"&&$.instanceColor&&(Tt=$.instanceColor)),Tt!==void 0){let gt=Tt.normalized,Lt=Tt.itemSize,qt=e.get(Tt);if(qt===void 0)continue;let Xt=qt.buffer,Ft=qt.type,Qt=qt.bytesPerElement,Ct=o.isWebGL2===!0&&(Ft===r.INT||Ft===r.UNSIGNED_INT||Tt.gpuType===e0);if(Tt.isInterleavedBufferAttribute){let ee=Tt.data,it=ee.stride,rn=Tt.offset;if(ee.isInstancedInterleavedBuffer){for(let Bt=0;Bt<ft.locationSize;Bt++)N(ft.location+Bt,ee.meshPerAttribute);$.isInstancedMesh!==!0&&mt._maxInstanceCount===void 0&&(mt._maxInstanceCount=ee.meshPerAttribute*ee.count)}else for(let Bt=0;Bt<ft.locationSize;Bt++)L(ft.location+Bt);r.bindBuffer(r.ARRAY_BUFFER,Xt);for(let Bt=0;Bt<ft.locationSize;Bt++)B(ft.location+Bt,Lt/ft.locationSize,Ft,gt,it*Qt,(rn+Lt/ft.locationSize*Bt)*Qt,Ct)}else{if(Tt.isInstancedBufferAttribute){for(let ee=0;ee<ft.locationSize;ee++)N(ft.location+ee,Tt.meshPerAttribute);$.isInstancedMesh!==!0&&mt._maxInstanceCount===void 0&&(mt._maxInstanceCount=Tt.meshPerAttribute*Tt.count)}else for(let ee=0;ee<ft.locationSize;ee++)L(ft.location+ee);r.bindBuffer(r.ARRAY_BUFFER,Xt);for(let ee=0;ee<ft.locationSize;ee++)B(ft.location+ee,Lt/ft.locationSize,Ft,gt,Lt*Qt,Lt/ft.locationSize*ee*Qt,Ct)}}else if(k!==void 0){let gt=k[nt];if(gt!==void 0)switch(gt.length){case 2:r.vertexAttrib2fv(ft.location,gt);break;case 3:r.vertexAttrib3fv(ft.location,gt);break;case 4:r.vertexAttrib4fv(ft.location,gt);break;default:r.vertexAttrib1fv(ft.location,gt)}}}}G()}function O(){V();for(let $ in f){let ut=f[$];for(let xt in ut){let mt=ut[xt];for(let lt in mt)b(mt[lt].object),delete mt[lt];delete ut[xt]}delete f[$]}}function q($){if(f[$.id]===void 0)return;let ut=f[$.id];for(let xt in ut){let mt=ut[xt];for(let lt in mt)b(mt[lt].object),delete mt[lt];delete ut[xt]}delete f[$.id]}function st($){for(let ut in f){let xt=f[ut];if(xt[$.id]===void 0)continue;let mt=xt[$.id];for(let lt in mt)b(mt[lt].object),delete mt[lt];delete xt[$.id]}}function V(){Mt(),g=!0,d!==p&&(d=p,M(d.object))}function Mt(){p.geometry=null,p.program=null,p.wireframe=!1}return{setup:_,reset:V,resetDefaultState:Mt,dispose:O,releaseStatesOfGeometry:q,releaseStatesOfProgram:st,initAttributes:S,enableAttribute:L,disableUnusedAttributes:G}}function rw(r,t,e,o){let a=o.isWebGL2,l;function h(d){l=d}function f(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=h,this.render=f,this.renderInstances=p}function iw(r,t,e){let o;function a(){if(o!==void 0)return o;if(t.has("EXT_texture_filter_anisotropic")===!0){let B=t.get("EXT_texture_filter_anisotropic");o=r.getParameter(B.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else o=0;return o}function l(B){if(B==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";B="mediump"}return B==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=typeof WebGL2RenderingContext!="undefined"&&r.constructor.name==="WebGL2RenderingContext",f=e.precision!==void 0?e.precision:"highp",p=l(f);p!==f&&(console.warn("THREE.WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);let d=h||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),b=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),P=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),S=y>0,L=h||t.has("OES_texture_float"),N=S&&L,G=h?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:h,drawBuffers:d,getMaxAnisotropy:a,getMaxPrecision:l,precision:f,logarithmicDepthBuffer:g,maxTextures:_,maxVertexTextures:y,maxTextureSize:M,maxCubemapSize:b,maxAttributes:T,maxVertexUniforms:x,maxVaryings:v,maxFragmentUniforms:P,vertexTextures:S,floatFragmentTextures:L,floatVertexTextures:N,maxSamples:G}}function ow(r){let t=this,e=null,o=0,a=!1,l=!1,h=new qo,f=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 b=_.clippingPlanes,T=_.clipIntersection,x=_.clipShadows,v=r.get(_);if(!a||b===null||b.length===0||l&&!x)l?g(null):d();else{let P=l?0:o,S=P*4,L=v.clippingState||null;p.value=L,L=g(b,y,S,M);for(let N=0;N!==S;++N)L[N]=e[N];v.clippingState=L,this.numIntersection=T?this.numPlanes:0,this.numPlanes+=P}};function d(){p.value!==e&&(p.value=e,p.needsUpdate=o>0),t.numPlanes=o,t.numIntersection=0}function g(_,y,M,b){let T=_!==null?_.length:0,x=null;if(T!==0){if(x=p.value,b!==!0||x===null){let v=M+T*4,P=y.matrixWorldInverse;f.getNormalMatrix(P),(x===null||x.length<v)&&(x=new Float32Array(v));for(let S=0,L=M;S!==T;++S,L+=4)h.copy(_[S]).applyMatrix4(P,f),h.normal.toArray(x,L),x[L+3]=h.constant}p.value=x,p.needsUpdate=!0}return t.numPlanes=T,t.numIntersection=0,x}}function sw(r){let t=new WeakMap;function e(h,f){return f===ff?h.mapping=Ha:f===pf&&(h.mapping=Wa),h}function o(h){if(h&&h.isTexture&&h.isRenderTargetTexture===!1){let f=h.mapping;if(f===ff||f===pf)if(t.has(h)){let p=t.get(h).texture;return e(p,h.mapping)}else{let p=h.image;if(p&&p.height>0){let d=new Sf(p.height/2);return d.fromEquirectangularTexture(r,h),t.set(h,d),h.addEventListener("dispose",a),e(d.texture,h.mapping)}else return null}}return h}function a(h){let f=h.target;f.removeEventListener("dispose",a);let p=t.get(f);p!==void 0&&(t.delete(f),p.dispose())}function l(){t=new WeakMap}return{get:o,dispose:l}}var bf=class extends ac{constructor(t=-1,e=1,o=1,a=-1,l=.1,h=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=h,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,h){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=h,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,h=o+t,f=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,h=l+d*this.view.width,f-=g*this.view.offsetY,p=f-g*this.view.height}this.projectionMatrix.makeOrthographic(l,h,f,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}},Ba=4,Pg=[.125,.215,.35,.446,.526,.582],qs=20,uf=new bf,Ig=new An,lf=null,Ws=(1+Math.sqrt(5))/2,Da=1/Ws,Rg=[new vt(1,1,1),new vt(-1,1,1),new vt(1,1,-1),new vt(-1,1,-1),new vt(0,Ws,Da),new vt(0,Ws,-Da),new vt(Da,0,Ws),new vt(-Da,0,Ws),new vt(Ws,Da,0),new vt(-Ws,Da,0)],cc=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){lf=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=Og(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Ng(),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(lf),t.scissorTest=!1,Wl(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===Ha||t.mapping===Wa?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),lf=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:Bi,minFilter:Bi,generateMipmaps:!1,type:zu,format:eo,colorSpace:Zo,depthBuffer:!1},a=Lg(t,e,o);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Lg(t,e,o);let{_lodMax:l}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=aw(l)),this._blurMaterial=uw(l,t,e)}return a}_compileMaterial(t){let e=new go(this._lodPlanes[0],t);this._renderer.compile(e,uf)}_sceneToCubeUV(t,e,o,a){let f=new Ti(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(Ig),g.toneMapping=gs,g.autoClear=!1;let M=new ic({name:"PMREM.Background",side:di,depthWrite:!1,depthTest:!1}),b=new go(new Gu,M),T=!1,x=t.background;x?x.isColor&&(M.color.copy(x),t.background=null,T=!0):(M.color.copy(Ig),T=!0);for(let v=0;v<6;v++){let P=v%3;P===0?(f.up.set(0,p[v],0),f.lookAt(d[v],0,0)):P===1?(f.up.set(0,0,p[v]),f.lookAt(0,d[v],0)):(f.up.set(0,p[v],0),f.lookAt(0,0,d[v]));let S=this._cubeSize;Wl(a,P*S,v>2?S:0,S,S),g.setRenderTarget(a),T&&g.render(b,f),g.render(t,f)}b.geometry.dispose(),b.material.dispose(),g.toneMapping=y,g.autoClear=_,t.background=x}_textureToCubeUV(t,e){let o=this._renderer,a=t.mapping===Ha||t.mapping===Wa;a?(this._cubemapMaterial===null&&(this._cubemapMaterial=Og()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Ng());let l=a?this._cubemapMaterial:this._equirectMaterial,h=new go(this._lodPlanes[0],l),f=l.uniforms;f.envMap.value=t;let p=this._cubeSize;Wl(e,0,0,3*p,2*p),o.setRenderTarget(e),o.render(h,uf)}_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]),h=Rg[(a-1)%Rg.length];this._blur(t,a-1,a,l,h)}e.autoClear=o}_blur(t,e,o,a,l){let h=this._pingPongRenderTarget;this._halfBlur(t,h,e,o,a,"latitudinal",l),this._halfBlur(h,t,o,o,a,"longitudinal",l)}_halfBlur(t,e,o,a,l,h,f){let p=this._renderer,d=this._blurMaterial;h!=="latitudinal"&&h!=="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,b=isFinite(l)?Math.PI/(2*M):2*Math.PI/(2*qs-1),T=l/b,x=isFinite(l)?1+Math.floor(g*T):qs;x>qs&&console.warn(`sigmaRadians, ${l}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${qs}`);let v=[],P=0;for(let B=0;B<qs;++B){let I=B/T,O=Math.exp(-I*I/2);v.push(O),B===0?P+=O:B<x&&(P+=2*O)}for(let B=0;B<v.length;B++)v[B]=v[B]/P;y.envMap.value=t.texture,y.samples.value=x,y.weights.value=v,y.latitudinal.value=h==="latitudinal",f&&(y.poleAxis.value=f);let{_lodMax:S}=this;y.dTheta.value=b,y.mipInt.value=S-o;let L=this._sizeLods[a],N=3*L*(a>S-Ba?a-S+Ba:0),G=4*(this._cubeSize-L);Wl(e,N,G,3*L,2*L),p.setRenderTarget(e),p.render(_,uf)}};function aw(r){let t=[],e=[],o=[],a=r,l=r-Ba+1+Pg.length;for(let h=0;h<l;h++){let f=Math.pow(2,a);e.push(f);let p=1/f;h>r-Ba?p=Pg[h-r+Ba-1]:h===0&&(p=0),o.push(p);let d=1/(f-2),g=-d,_=1+d,y=[g,g,_,g,_,_,g,g,_,_,g,_],M=6,b=6,T=3,x=2,v=1,P=new Float32Array(T*b*M),S=new Float32Array(x*b*M),L=new Float32Array(v*b*M);for(let G=0;G<M;G++){let B=G%3*2/3-1,I=G>2?0:-1,O=[B,I,0,B+2/3,I,0,B+2/3,I+1,0,B,I,0,B+2/3,I+1,0,B,I+1,0];P.set(O,T*b*G),S.set(y,x*b*G);let q=[G,G,G,G,G,G];L.set(q,v*b*G)}let N=new Js;N.setAttribute("position",new ki(P,T)),N.setAttribute("uv",new ki(S,x)),N.setAttribute("faceIndex",new ki(L,v)),t.push(N),a>Ba&&a--}return{lodPlanes:t,sizeLods:e,sigmas:o}}function Lg(r,t,e){let o=new Jo(r,t,e);return o.texture.mapping=hc,o.texture.name="PMREM.cubeUv",o.scissorTest=!0,o}function Wl(r,t,e,o,a){r.viewport.set(t,e,o,a),r.scissor.set(t,e,o,a)}function uw(r,t,e){let o=new Float32Array(qs),a=new vt(0,1,0);return new Ko({name:"SphericalGaussianBlur",defines:{n:qs,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:jf(),fragmentShader:`\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform float mipInt;\n uniform vec3 poleAxis;\n\n #define ENVMAP_TYPE_CUBE_UV\n #include <cube_uv_reflection_fragment>\n\n vec3 getSample( float theta, vec3 axis ) {\n\n float cosTheta = cos( theta );\n // Rodrigues\' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n return bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n }\n\n void main() {\n\n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n }\n\n axis = normalize( axis );\n\n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n for ( int i = 1; i < n; i++ ) {\n\n if ( i >= samples ) {\n\n break;\n\n }\n\n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n }\n\n }\n `,blending:ms,depthTest:!1,depthWrite:!1})}function Ng(){return new Ko({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:jf(),fragmentShader:`\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n\n #include <common>\n\n void main() {\n\n vec3 outputDirection = normalize( vOutputDirection );\n vec2 uv = equirectUv( outputDirection );\n\n gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n }\n `,blending:ms,depthTest:!1,depthWrite:!1})}function Og(){return new Ko({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:jf(),fragmentShader:`\n\n precision mediump float;\n precision mediump int;\n\n uniform float flipEnvMap;\n\n varying vec3 vOutputDirection;\n\n uniform samplerCube envMap;\n\n void main() {\n\n gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n }\n `,blending:ms,depthTest:!1,depthWrite:!1})}function jf(){return`\n\n precision mediump float;\n precision mediump int;\n\n attribute float faceIndex;\n\n varying vec3 vOutputDirection;\n\n // RH coordinate system; PMREM face-indexing convention\n vec3 getDirection( vec2 uv, float face ) {\n\n uv = 2.0 * uv - 1.0;\n\n vec3 direction = vec3( uv, 1.0 );\n\n if ( face == 0.0 ) {\n\n direction = direction.zyx; // ( 1, v, u ) pos x\n\n } else if ( face == 1.0 ) {\n\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n } else if ( face == 2.0 ) {\n\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n\n } else if ( face == 3.0 ) {\n\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n\n } else if ( face == 4.0 ) {\n\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n\n } else if ( face == 5.0 ) {\n\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n\n }\n\n return direction;\n\n }\n\n void main() {\n\n vOutputDirection = getDirection( uv, faceIndex );\n gl_Position = vec4( position, 1.0 );\n\n }\n `}function lw(r){let t=new WeakMap,e=null;function o(f){if(f&&f.isTexture){let p=f.mapping,d=p===ff||p===pf,g=p===Ha||p===Wa;if(d||g)if(f.isRenderTargetTexture&&f.needsPMREMUpdate===!0){f.needsPMREMUpdate=!1;let _=t.get(f);return e===null&&(e=new cc(r)),_=d?e.fromEquirectangular(f,_):e.fromCubemap(f,_),t.set(f,_),_.texture}else{if(t.has(f))return t.get(f).texture;{let _=f.image;if(d&&_&&_.height>0||g&&_&&a(_)){e===null&&(e=new cc(r));let y=d?e.fromEquirectangular(f):e.fromCubemap(f);return t.set(f,y),f.addEventListener("dispose",l),y.texture}else return null}}}return f}function a(f){let p=0,d=6;for(let g=0;g<d;g++)f[g]!==void 0&&p++;return p===d}function l(f){let p=f.target;p.removeEventListener("dispose",l);let d=t.get(p);d!==void 0&&(t.delete(p),d.dispose())}function h(){t=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:o,dispose:h}}function cw(r){let t={};function e(o){if(t[o]!==void 0)return t[o];let a;switch(o){case"WEBGL_depth_texture":a=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":a=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":a=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":a=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:a=r.getExtension(o)}return t[o]=a,a}return{has:function(o){return e(o)!==null},init:function(o){o.isWebGL2?e("EXT_color_buffer_float"):(e("WEBGL_depth_texture"),e("OES_texture_float"),e("OES_texture_half_float"),e("OES_texture_half_float_linear"),e("OES_standard_derivatives"),e("OES_element_index_uint"),e("OES_vertex_array_object"),e("ANGLE_instanced_arrays")),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture")},get:function(o){let a=e(o);return a===null&&console.warn("THREE.WebGLRenderer: "+o+" extension not supported."),a}}}function hw(r,t,e,o){let a={},l=new WeakMap;function h(_){let y=_.target;y.index!==null&&t.remove(y.index);for(let b in y.attributes)t.remove(y.attributes[b]);for(let b in y.morphAttributes){let T=y.morphAttributes[b];for(let x=0,v=T.length;x<v;x++)t.remove(T[x])}y.removeEventListener("dispose",h),delete a[y.id];let M=l.get(y);M&&(t.remove(M),l.delete(y)),o.releaseStatesOfGeometry(y),y.isInstancedBufferGeometry===!0&&delete y._maxInstanceCount,e.memory.geometries--}function f(_,y){return a[y.id]===!0||(y.addEventListener("dispose",h),a[y.id]=!0,e.memory.geometries++),y}function p(_){let y=_.attributes;for(let b in y)t.update(y[b],r.ARRAY_BUFFER);let M=_.morphAttributes;for(let b in M){let T=M[b];for(let x=0,v=T.length;x<v;x++)t.update(T[x],r.ARRAY_BUFFER)}}function d(_){let y=[],M=_.index,b=_.attributes.position,T=0;if(M!==null){let P=M.array;T=M.version;for(let S=0,L=P.length;S<L;S+=3){let N=P[S+0],G=P[S+1],B=P[S+2];y.push(N,G,G,B,B,N)}}else if(b!==void 0){let P=b.array;T=b.version;for(let S=0,L=P.length/3-1;S<L;S+=3){let N=S+0,G=S+1,B=S+2;y.push(N,G,G,B,B,N)}}else return;let x=new(u0(y)?sc:oc)(y,1);x.version=T;let v=l.get(_);v&&t.remove(v),l.set(_,x)}function g(_){let y=l.get(_);if(y){let M=_.index;M!==null&&y.version<M.version&&d(_)}else d(_);return l.get(_)}return{get:f,update:p,getWireframeAttribute:g}}function fw(r,t,e,o){let a=o.isWebGL2,l;function h(y){l=y}let f,p;function d(y){f=y.type,p=y.bytesPerElement}function g(y,M){r.drawElements(l,M,f,y*p),e.update(M,l,1)}function _(y,M,b){if(b===0)return;let T,x;if(a)T=r,x="drawElementsInstanced";else if(T=t.get("ANGLE_instanced_arrays"),x="drawElementsInstancedANGLE",T===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}T[x](l,M,f,y*p,b),e.update(M,l,b)}this.setMode=h,this.setIndex=d,this.render=g,this.renderInstances=_}function pw(r){let t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function o(l,h,f){switch(e.calls++,h){case r.TRIANGLES:e.triangles+=f*(l/3);break;case r.LINES:e.lines+=f*(l/2);break;case r.LINE_STRIP:e.lines+=f*(l-1);break;case r.LINE_LOOP:e.lines+=f*l;break;case r.POINTS:e.points+=f*l;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",h);break}}function a(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:a,update:o}}function dw(r,t){return r[0]-t[0]}function mw(r,t){return Math.abs(t[1])-Math.abs(r[1])}function gw(r,t,e){let o={},a=new Float32Array(8),l=new WeakMap,h=new Dr,f=[];for(let d=0;d<8;d++)f[d]=[d,0];function p(d,g,_){let y=d.morphTargetInfluences;if(t.isWebGL2===!0){let M=g.morphAttributes.position||g.morphAttributes.normal||g.morphAttributes.color,b=M!==void 0?M.length:0,T=l.get(g);if(T===void 0||T.count!==b){let $=function(){V.dispose(),l.delete(g),g.removeEventListener("dispose",$)};T!==void 0&&T.texture.dispose();let P=g.morphAttributes.position!==void 0,S=g.morphAttributes.normal!==void 0,L=g.morphAttributes.color!==void 0,N=g.morphAttributes.position||[],G=g.morphAttributes.normal||[],B=g.morphAttributes.color||[],I=0;P===!0&&(I=1),S===!0&&(I=2),L===!0&&(I=3);let O=g.attributes.position.count*I,q=1;O>t.maxTextureSize&&(q=Math.ceil(O/t.maxTextureSize),O=t.maxTextureSize);let st=new Float32Array(O*q*4*b),V=new ec(st,O,q,b);V.type=ds,V.needsUpdate=!0;let Mt=I*4;for(let ut=0;ut<b;ut++){let xt=N[ut],mt=G[ut],lt=B[ut],ht=O*q*4*ut;for(let k=0;k<xt.count;k++){let nt=k*Mt;P===!0&&(h.fromBufferAttribute(xt,k),st[ht+nt+0]=h.x,st[ht+nt+1]=h.y,st[ht+nt+2]=h.z,st[ht+nt+3]=0),S===!0&&(h.fromBufferAttribute(mt,k),st[ht+nt+4]=h.x,st[ht+nt+5]=h.y,st[ht+nt+6]=h.z,st[ht+nt+7]=0),L===!0&&(h.fromBufferAttribute(lt,k),st[ht+nt+8]=h.x,st[ht+nt+9]=h.y,st[ht+nt+10]=h.z,st[ht+nt+11]=lt.itemSize===4?h.w:1)}}T={count:b,texture:V,size:new fn(O,q)},l.set(g,T),g.addEventListener("dispose",$)}let x=0;for(let P=0;P<y.length;P++)x+=y[P];let v=g.morphTargetsRelative?1:1-x;_.getUniforms().setValue(r,"morphTargetBaseInfluence",v),_.getUniforms().setValue(r,"morphTargetInfluences",y),_.getUniforms().setValue(r,"morphTargetsTexture",T.texture,e),_.getUniforms().setValue(r,"morphTargetsTextureSize",T.size)}else{let M=y===void 0?0:y.length,b=o[g.id];if(b===void 0||b.length!==M){b=[];for(let S=0;S<M;S++)b[S]=[S,0];o[g.id]=b}for(let S=0;S<M;S++){let L=b[S];L[0]=S,L[1]=y[S]}b.sort(mw);for(let S=0;S<8;S++)S<M&&b[S][1]?(f[S][0]=b[S][0],f[S][1]=b[S][1]):(f[S][0]=Number.MAX_SAFE_INTEGER,f[S][1]=0);f.sort(dw);let T=g.morphAttributes.position,x=g.morphAttributes.normal,v=0;for(let S=0;S<8;S++){let L=f[S],N=L[0],G=L[1];N!==Number.MAX_SAFE_INTEGER&&G?(T&&g.getAttribute("morphTarget"+S)!==T[N]&&g.setAttribute("morphTarget"+S,T[N]),x&&g.getAttribute("morphNormal"+S)!==x[N]&&g.setAttribute("morphNormal"+S,x[N]),a[S]=G,v+=G):(T&&g.hasAttribute("morphTarget"+S)===!0&&g.deleteAttribute("morphTarget"+S),x&&g.hasAttribute("morphNormal"+S)===!0&&g.deleteAttribute("morphNormal"+S),a[S]=0)}let P=g.morphTargetsRelative?1:1-v;_.getUniforms().setValue(r,"morphTargetBaseInfluence",P),_.getUniforms().setValue(r,"morphTargetInfluences",a)}}return{update:p}}function yw(r,t,e,o){let a=new WeakMap;function l(p){let d=o.render.frame,g=p.geometry,_=t.get(p,g);if(a.get(_)!==d&&(t.update(_),a.set(_,d)),p.isInstancedMesh&&(p.hasEventListener("dispose",f)===!1&&p.addEventListener("dispose",f),a.get(p)!==d&&(e.update(p.instanceMatrix,r.ARRAY_BUFFER),p.instanceColor!==null&&e.update(p.instanceColor,r.ARRAY_BUFFER),a.set(p,d))),p.isSkinnedMesh){let y=p.skeleton;a.get(y)!==d&&(y.update(),a.set(y,d))}return _}function h(){a=new WeakMap}function f(p){let d=p.target;d.removeEventListener("dispose",f),e.remove(d.instanceMatrix),d.instanceColor!==null&&e.remove(d.instanceColor)}return{update:l,dispose:h}}var f0=new no,p0=new ec,d0=new xf,m0=new uc,Dg=[],Fg=[],Ug=new Float32Array(16),Bg=new Float32Array(9),zg=new Float32Array(4);function Za(r,t,e){let o=r[0];if(o<=0||o>0)return r;let a=t*e,l=Dg[a];if(l===void 0&&(l=new Float32Array(a),Dg[a]=l),t!==0){o.toArray(l,0);for(let h=1,f=0;h!==t;++h)f+=e,r[h].toArray(l,f)}return l}function lr(r,t){if(r.length!==t.length)return!1;for(let e=0,o=r.length;e<o;e++)if(r[e]!==t[e])return!1;return!0}function cr(r,t){for(let e=0,o=t.length;e<o;e++)r[e]=t[e]}function pc(r,t){let e=Fg[t];e===void 0&&(e=new Int32Array(t),Fg[t]=e);for(let o=0;o!==t;++o)e[o]=r.allocateTextureUnit();return e}function vw(r,t){let e=this.cache;e[0]!==t&&(r.uniform1f(this.addr,t),e[0]=t)}function _w(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(lr(e,t))return;r.uniform2fv(this.addr,t),cr(e,t)}}function xw(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(r.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(lr(e,t))return;r.uniform3fv(this.addr,t),cr(e,t)}}function Ew(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(lr(e,t))return;r.uniform4fv(this.addr,t),cr(e,t)}}function Mw(r,t){let e=this.cache,o=t.elements;if(o===void 0){if(lr(e,t))return;r.uniformMatrix2fv(this.addr,!1,t),cr(e,t)}else{if(lr(e,o))return;zg.set(o),r.uniformMatrix2fv(this.addr,!1,zg),cr(e,o)}}function Sw(r,t){let e=this.cache,o=t.elements;if(o===void 0){if(lr(e,t))return;r.uniformMatrix3fv(this.addr,!1,t),cr(e,t)}else{if(lr(e,o))return;Bg.set(o),r.uniformMatrix3fv(this.addr,!1,Bg),cr(e,o)}}function ww(r,t){let e=this.cache,o=t.elements;if(o===void 0){if(lr(e,t))return;r.uniformMatrix4fv(this.addr,!1,t),cr(e,t)}else{if(lr(e,o))return;Ug.set(o),r.uniformMatrix4fv(this.addr,!1,Ug),cr(e,o)}}function bw(r,t){let e=this.cache;e[0]!==t&&(r.uniform1i(this.addr,t),e[0]=t)}function Tw(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(lr(e,t))return;r.uniform2iv(this.addr,t),cr(e,t)}}function Aw(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(lr(e,t))return;r.uniform3iv(this.addr,t),cr(e,t)}}function Cw(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(lr(e,t))return;r.uniform4iv(this.addr,t),cr(e,t)}}function Pw(r,t){let e=this.cache;e[0]!==t&&(r.uniform1ui(this.addr,t),e[0]=t)}function Iw(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(lr(e,t))return;r.uniform2uiv(this.addr,t),cr(e,t)}}function Rw(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(lr(e,t))return;r.uniform3uiv(this.addr,t),cr(e,t)}}function Lw(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(lr(e,t))return;r.uniform4uiv(this.addr,t),cr(e,t)}}function Nw(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTexture2D(t||f0,a)}function Ow(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTexture3D(t||d0,a)}function Dw(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTextureCube(t||m0,a)}function Fw(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTexture2DArray(t||p0,a)}function Uw(r){switch(r){case 5126:return vw;case 35664:return _w;case 35665:return xw;case 35666:return Ew;case 35674:return Mw;case 35675:return Sw;case 35676:return ww;case 5124:case 35670:return bw;case 35667:case 35671:return Tw;case 35668:case 35672:return Aw;case 35669:case 35673:return Cw;case 5125:return Pw;case 36294:return Iw;case 36295:return Rw;case 36296:return Lw;case 35678:case 36198:case 36298:case 36306:case 35682:return Nw;case 35679:case 36299:case 36307:return Ow;case 35680:case 36300:case 36308:case 36293:return Dw;case 36289:case 36303:case 36311:case 36292:return Fw}}function Bw(r,t){r.uniform1fv(this.addr,t)}function zw(r,t){let e=Za(t,this.size,2);r.uniform2fv(this.addr,e)}function kw(r,t){let e=Za(t,this.size,3);r.uniform3fv(this.addr,e)}function Gw(r,t){let e=Za(t,this.size,4);r.uniform4fv(this.addr,e)}function Vw(r,t){let e=Za(t,this.size,4);r.uniformMatrix2fv(this.addr,!1,e)}function Hw(r,t){let e=Za(t,this.size,9);r.uniformMatrix3fv(this.addr,!1,e)}function Ww(r,t){let e=Za(t,this.size,16);r.uniformMatrix4fv(this.addr,!1,e)}function qw(r,t){r.uniform1iv(this.addr,t)}function Xw(r,t){r.uniform2iv(this.addr,t)}function Yw(r,t){r.uniform3iv(this.addr,t)}function $w(r,t){r.uniform4iv(this.addr,t)}function Zw(r,t){r.uniform1uiv(this.addr,t)}function Jw(r,t){r.uniform2uiv(this.addr,t)}function Kw(r,t){r.uniform3uiv(this.addr,t)}function jw(r,t){r.uniform4uiv(this.addr,t)}function Qw(r,t,e){let o=this.cache,a=t.length,l=pc(e,a);lr(o,l)||(r.uniform1iv(this.addr,l),cr(o,l));for(let h=0;h!==a;++h)e.setTexture2D(t[h]||f0,l[h])}function tb(r,t,e){let o=this.cache,a=t.length,l=pc(e,a);lr(o,l)||(r.uniform1iv(this.addr,l),cr(o,l));for(let h=0;h!==a;++h)e.setTexture3D(t[h]||d0,l[h])}function eb(r,t,e){let o=this.cache,a=t.length,l=pc(e,a);lr(o,l)||(r.uniform1iv(this.addr,l),cr(o,l));for(let h=0;h!==a;++h)e.setTextureCube(t[h]||m0,l[h])}function nb(r,t,e){let o=this.cache,a=t.length,l=pc(e,a);lr(o,l)||(r.uniform1iv(this.addr,l),cr(o,l));for(let h=0;h!==a;++h)e.setTexture2DArray(t[h]||p0,l[h])}function rb(r){switch(r){case 5126:return Bw;case 35664:return zw;case 35665:return kw;case 35666:return Gw;case 35674:return Vw;case 35675:return Hw;case 35676:return Ww;case 5124:case 35670:return qw;case 35667:case 35671:return Xw;case 35668:case 35672:return Yw;case 35669:case 35673:return $w;case 5125:return Zw;case 36294:return Jw;case 36295:return Kw;case 36296:return jw;case 35678:case 36198:case 36298:case 36306:case 35682:return Qw;case 35679:case 36299:case 36307:return tb;case 35680:case 36300:case 36308:case 36293:return eb;case 36289:case 36303:case 36311:case 36292:return nb}}var Tf=class{constructor(t,e,o){this.id=t,this.addr=o,this.cache=[],this.setValue=Uw(e.type)}},Af=class{constructor(t,e,o){this.id=t,this.addr=o,this.cache=[],this.size=e.size,this.setValue=rb(e.type)}},Cf=class{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,o){let a=this.seq;for(let l=0,h=a.length;l!==h;++l){let f=a[l];f.setValue(t,e[f.id],o)}}},cf=/(\\w+)(\\])?(\\[|\\.)?/g;function kg(r,t){r.seq.push(t),r.map[t.id]=t}function ib(r,t,e){let o=r.name,a=o.length;for(cf.lastIndex=0;;){let l=cf.exec(o),h=cf.lastIndex,f=l[1],p=l[2]==="]",d=l[3];if(p&&(f=f|0),d===void 0||d==="["&&h+2===a){kg(e,d===void 0?new Tf(f,r,t):new Af(f,r,t));break}else{let _=e.map[f];_===void 0&&(_=new Cf(f),kg(e,_)),e=_}}}var Va=class{constructor(t,e){this.seq=[],this.map={};let o=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let a=0;a<o;++a){let l=t.getActiveUniform(e,a),h=t.getUniformLocation(e,l.name);ib(l,h,this)}}setValue(t,e,o,a){let l=this.map[e];l!==void 0&&l.setValue(t,o,a)}setOptional(t,e,o){let a=e[o];a!==void 0&&this.setValue(t,o,a)}static upload(t,e,o,a){for(let l=0,h=e.length;l!==h;++l){let f=e[l],p=o[f.id];p.needsUpdate!==!1&&f.setValue(t,p.value,a)}}static seqWithValue(t,e){let o=[];for(let a=0,l=t.length;a!==l;++a){let h=t[a];h.id in e&&o.push(h)}return o}};function Gg(r,t,e){let o=r.createShader(t);return r.shaderSource(o,e),r.compileShader(o),o}var ob=0;function sb(r,t){let e=r.split(`\n`),o=[],a=Math.max(t-6,0),l=Math.min(t+6,e.length);for(let h=a;h<l;h++){let f=h+1;o.push(`${f===t?">":" "} ${f}: ${e[h]}`)}return o.join(`\n`)}function ab(r){let t=Mn.getPrimaries(Mn.workingColorSpace),e=Mn.getPrimaries(r),o;switch(t===e?o="":t===Jl&&e===Zl?o="LinearDisplayP3ToLinearSRGB":t===Zl&&e===Jl&&(o="LinearSRGBToLinearDisplayP3"),r){case Zo:case fc:return[o,"LinearTransferOETF"];case Or:case Kf:return[o,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[o,"LinearTransferOETF"]}}function Vg(r,t,e){let o=r.getShaderParameter(t,r.COMPILE_STATUS),a=r.getShaderInfoLog(t).trim();if(o&&a==="")return"";let l=/ERROR: 0:(\\d+)/.exec(a);if(l){let h=parseInt(l[1]);return e.toUpperCase()+`\n\n`+a+`\n\n`+sb(r.getShaderSource(t),h)}else return a}function ub(r,t){let e=ab(t);return`vec4 ${r}( vec4 value ) { return ${e[0]}( ${e[1]}( value ) ); }`}function lb(r,t){let e;switch(t){case Ax:e="Linear";break;case Cx:e="Reinhard";break;case Px:e="OptimizedCineon";break;case Ix:e="ACESFilmic";break;case Rx:e="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),e="Linear"}return"vec3 "+r+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}function cb(r){return[r.extensionDerivatives||r.envMapCubeUVHeight||r.bumpMap||r.normalMapTangentSpace||r.clearcoatNormalMap||r.flatShading||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Du).join(`\n`)}function hb(r){let t=[];for(let e in r){let o=r[e];o!==!1&&t.push("#define "+e+" "+o)}return t.join(`\n`)}function fb(r,t){let e={},o=r.getProgramParameter(t,r.ACTIVE_ATTRIBUTES);for(let a=0;a<o;a++){let l=r.getActiveAttrib(t,a),h=l.name,f=1;l.type===r.FLOAT_MAT2&&(f=2),l.type===r.FLOAT_MAT3&&(f=3),l.type===r.FLOAT_MAT4&&(f=4),e[h]={type:l.type,location:r.getAttribLocation(t,h),locationSize:f}}return e}function Du(r){return r!==""}function Hg(r,t){let e=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function Wg(r,t){return r.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var pb=/^[ \\t]*#include +<([\\w\\d./]+)>/gm;function Pf(r){return r.replace(pb,mb)}var db=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function mb(r,t){let e=ge[t];if(e===void 0){let o=db.get(t);if(o!==void 0)e=ge[o],console.warn(\'THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.\',t,o);else throw new Error("Can not resolve #include <"+t+">")}return Pf(e)}var gb=/#pragma unroll_loop_start\\s+for\\s*\\(\\s*int\\s+i\\s*=\\s*(\\d+)\\s*;\\s*i\\s*<\\s*(\\d+)\\s*;\\s*i\\s*\\+\\+\\s*\\)\\s*{([\\s\\S]+?)}\\s+#pragma unroll_loop_end/g;function qg(r){return r.replace(gb,yb)}function yb(r,t,e,o){let a="";for(let l=parseInt(t);l<parseInt(e);l++)a+=o.replace(/\\[\\s*i\\s*\\]/g,"[ "+l+" ]").replace(/UNROLLED_LOOP_INDEX/g,l);return a}function Xg(r){let t="precision "+r.precision+` float;\nprecision `+r.precision+" int;";return r.precision==="highp"?t+=`\n#define HIGH_PRECISION`:r.precision==="mediump"?t+=`\n#define MEDIUM_PRECISION`:r.precision==="lowp"&&(t+=`\n#define LOW_PRECISION`),t}function vb(r){let t="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===Jg?t="SHADOWMAP_TYPE_PCF":r.shadowMapType===ox?t="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===Wo&&(t="SHADOWMAP_TYPE_VSM"),t}function _b(r){let t="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case Ha:case Wa:t="ENVMAP_TYPE_CUBE";break;case hc:t="ENVMAP_TYPE_CUBE_UV";break}return t}function xb(r){let t="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case Wa:t="ENVMAP_MODE_REFRACTION";break}return t}function Eb(r){let t="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case Qg:t="ENVMAP_BLENDING_MULTIPLY";break;case bx:t="ENVMAP_BLENDING_MIX";break;case Tx:t="ENVMAP_BLENDING_ADD";break}return t}function Mb(r){let t=r.envMapCubeUVHeight;if(t===null)return null;let e=Math.log2(t)-2,o=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),7*16)),texelHeight:o,maxMip:e}}function Sb(r,t,e,o){let a=r.getContext(),l=e.defines,h=e.vertexShader,f=e.fragmentShader,p=vb(e),d=_b(e),g=xb(e),_=Eb(e),y=Mb(e),M=e.isWebGL2?"":cb(e),b=hb(l),T=a.createProgram(),x,v,P=e.glslVersion?"#version "+e.glslVersion+`\n`:"";e.isRawShaderMaterial?(x=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,b].filter(Du).join(`\n`),x.length>0&&(x+=`\n`),v=[M,"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,b].filter(Du).join(`\n`),v.length>0&&(v+=`\n`)):(x=[Xg(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,b,e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+g:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors&&e.isWebGL2?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0&&e.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",e.morphTargetsCount>0&&e.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0&&e.isWebGL2?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+p:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.logarithmicDepthBuffer&&e.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`\n`].filter(Du).join(`\n`),v=[M,Xg(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,b,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+d:"",e.envMap?"#define "+g:"",e.envMap?"#define "+_:"",y?"#define CUBEUV_TEXEL_WIDTH "+y.texelWidth:"",y?"#define CUBEUV_TEXEL_HEIGHT "+y.texelHeight:"",y?"#define CUBEUV_MAX_MIP "+y.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+p:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.useLegacyLights?"#define LEGACY_LIGHTS":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",e.logarithmicDepthBuffer&&e.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==gs?"#define TONE_MAPPING":"",e.toneMapping!==gs?ge.tonemapping_pars_fragment:"",e.toneMapping!==gs?lb("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",ge.colorspace_pars_fragment,ub("linearToOutputTexel",e.outputColorSpace),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",`\n`].filter(Du).join(`\n`)),h=Pf(h),h=Hg(h,e),h=Wg(h,e),f=Pf(f),f=Hg(f,e),f=Wg(f,e),h=qg(h),f=qg(f),e.isWebGL2&&e.isRawShaderMaterial!==!0&&(P=`#version 300 es\n`,x=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`\n`)+`\n`+x,v=["#define varying in",e.glslVersion===hg?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===hg?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`\n`)+`\n`+v);let S=P+x+h,L=P+v+f,N=Gg(a,a.VERTEX_SHADER,S),G=Gg(a,a.FRAGMENT_SHADER,L);if(a.attachShader(T,N),a.attachShader(T,G),e.index0AttributeName!==void 0?a.bindAttribLocation(T,0,e.index0AttributeName):e.morphTargets===!0&&a.bindAttribLocation(T,0,"position"),a.linkProgram(T),r.debug.checkShaderErrors){let O=a.getProgramInfoLog(T).trim(),q=a.getShaderInfoLog(N).trim(),st=a.getShaderInfoLog(G).trim(),V=!0,Mt=!0;if(a.getProgramParameter(T,a.LINK_STATUS)===!1)if(V=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(a,T,N,G);else{let $=Vg(a,N,"vertex"),ut=Vg(a,G,"fragment");console.error("THREE.WebGLProgram: Shader Error "+a.getError()+" - VALIDATE_STATUS "+a.getProgramParameter(T,a.VALIDATE_STATUS)+`\n\nProgram Info Log: `+O+`\n`+$+`\n`+ut)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):(q===""||st==="")&&(Mt=!1);Mt&&(this.diagnostics={runnable:V,programLog:O,vertexShader:{log:q,prefix:x},fragmentShader:{log:st,prefix:v}})}a.deleteShader(N),a.deleteShader(G);let B;this.getUniforms=function(){return B===void 0&&(B=new Va(a,T)),B};let I;return this.getAttributes=function(){return I===void 0&&(I=fb(a,T)),I},this.destroy=function(){o.releaseStatesOfProgram(this),a.deleteProgram(T),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=ob++,this.cacheKey=t,this.usedTimes=1,this.program=T,this.vertexShader=N,this.fragmentShader=G,this}var wb=0,If=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){let e=t.vertexShader,o=t.fragmentShader,a=this._getShaderStage(e),l=this._getShaderStage(o),h=this._getShaderCacheForMaterial(t);return h.has(a)===!1&&(h.add(a),a.usedTimes++),h.has(l)===!1&&(h.add(l),l.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let o of e)o.usedTimes--,o.usedTimes===0&&this.shaderCache.delete(o.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,o=e.get(t);return o===void 0&&(o=new Set,e.set(t,o)),o}_getShaderStage(t){let e=this.shaderCache,o=e.get(t);return o===void 0&&(o=new Rf(t),e.set(t,o)),o}},Rf=class{constructor(t){this.id=wb++,this.code=t,this.usedTimes=0}};function bb(r,t,e,o,a,l,h){let f=new rc,p=new If,d=[],g=a.isWebGL2,_=a.logarithmicDepthBuffer,y=a.vertexTextures,M=a.precision,b={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function T(O){return O===0?"uv":`uv${O}`}function x(O,q,st,V,Mt){let $=V.fog,ut=Mt.geometry,xt=O.isMeshStandardMaterial?V.environment:null,mt=(O.isMeshStandardMaterial?e:t).get(O.envMap||xt),lt=mt&&mt.mapping===hc?mt.image.height:null,ht=b[O.type];O.precision!==null&&(M=a.getMaxPrecision(O.precision),M!==O.precision&&console.warn("THREE.WebGLProgram.getParameters:",O.precision,"not supported, using",M,"instead."));let k=ut.morphAttributes.position||ut.morphAttributes.normal||ut.morphAttributes.color,nt=k!==void 0?k.length:0,ft=0;ut.morphAttributes.position!==void 0&&(ft=1),ut.morphAttributes.normal!==void 0&&(ft=2),ut.morphAttributes.color!==void 0&&(ft=3);let Tt,gt,Lt,qt;if(ht){let Gt=mo[ht];Tt=Gt.vertexShader,gt=Gt.fragmentShader}else Tt=O.vertexShader,gt=O.fragmentShader,p.update(O),Lt=p.getVertexShaderID(O),qt=p.getFragmentShaderID(O);let Xt=r.getRenderTarget(),Ft=Mt.isInstancedMesh===!0,Qt=!!O.map,Ct=!!O.matcap,ee=!!mt,it=!!O.aoMap,rn=!!O.lightMap,Bt=!!O.bumpMap,Jt=!!O.normalMap,Yt=!!O.displacementMap,pe=!!O.emissiveMap,le=!!O.metalnessMap,Pt=!!O.roughnessMap,te=O.anisotropy>0,yn=O.clearcoat>0,pn=O.iridescence>0,X=O.sheen>0,F=O.transmission>0,J=te&&!!O.anisotropyMap,It=yn&&!!O.clearcoatMap,wt=yn&&!!O.clearcoatNormalMap,yt=yn&&!!O.clearcoatRoughnessMap,$t=pn&&!!O.iridescenceMap,Dt=pn&&!!O.iridescenceThicknessMap,Y=X&&!!O.sheenColorMap,w=X&&!!O.sheenRoughnessMap,C=!!O.specularMap,R=!!O.specularColorMap,H=!!O.specularIntensityMap,z=F&&!!O.transmissionMap,rt=F&&!!O.thicknessMap,j=!!O.gradientMap,D=!!O.alphaMap,tt=O.alphaTest>0,Z=!!O.alphaHash,et=!!O.extensions,ot=!!ut.attributes.uv1,Q=!!ut.attributes.uv2,St=!!ut.attributes.uv3,At=gs;return O.toneMapped&&(Xt===null||Xt.isXRRenderTarget===!0)&&(At=r.toneMapping),{isWebGL2:g,shaderID:ht,shaderType:O.type,shaderName:O.name,vertexShader:Tt,fragmentShader:gt,defines:O.defines,customVertexShaderID:Lt,customFragmentShaderID:qt,isRawShaderMaterial:O.isRawShaderMaterial===!0,glslVersion:O.glslVersion,precision:M,instancing:Ft,instancingColor:Ft&&Mt.instanceColor!==null,supportsVertexTextures:y,outputColorSpace:Xt===null?r.outputColorSpace:Xt.isXRRenderTarget===!0?Xt.texture.colorSpace:Zo,map:Qt,matcap:Ct,envMap:ee,envMapMode:ee&&mt.mapping,envMapCubeUVHeight:lt,aoMap:it,lightMap:rn,bumpMap:Bt,normalMap:Jt,displacementMap:y&&Yt,emissiveMap:pe,normalMapObjectSpace:Jt&&O.normalMapType===qx,normalMapTangentSpace:Jt&&O.normalMapType===Wx,metalnessMap:le,roughnessMap:Pt,anisotropy:te,anisotropyMap:J,clearcoat:yn,clearcoatMap:It,clearcoatNormalMap:wt,clearcoatRoughnessMap:yt,iridescence:pn,iridescenceMap:$t,iridescenceThicknessMap:Dt,sheen:X,sheenColorMap:Y,sheenRoughnessMap:w,specularMap:C,specularColorMap:R,specularIntensityMap:H,transmission:F,transmissionMap:z,thicknessMap:rt,gradientMap:j,opaque:O.transparent===!1&&O.blending===ka,alphaMap:D,alphaTest:tt,alphaHash:Z,combine:O.combine,mapUv:Qt&&T(O.map.channel),aoMapUv:it&&T(O.aoMap.channel),lightMapUv:rn&&T(O.lightMap.channel),bumpMapUv:Bt&&T(O.bumpMap.channel),normalMapUv:Jt&&T(O.normalMap.channel),displacementMapUv:Yt&&T(O.displacementMap.channel),emissiveMapUv:pe&&T(O.emissiveMap.channel),metalnessMapUv:le&&T(O.metalnessMap.channel),roughnessMapUv:Pt&&T(O.roughnessMap.channel),anisotropyMapUv:J&&T(O.anisotropyMap.channel),clearcoatMapUv:It&&T(O.clearcoatMap.channel),clearcoatNormalMapUv:wt&&T(O.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:yt&&T(O.clearcoatRoughnessMap.channel),iridescenceMapUv:$t&&T(O.iridescenceMap.channel),iridescenceThicknessMapUv:Dt&&T(O.iridescenceThicknessMap.channel),sheenColorMapUv:Y&&T(O.sheenColorMap.channel),sheenRoughnessMapUv:w&&T(O.sheenRoughnessMap.channel),specularMapUv:C&&T(O.specularMap.channel),specularColorMapUv:R&&T(O.specularColorMap.channel),specularIntensityMapUv:H&&T(O.specularIntensityMap.channel),transmissionMapUv:z&&T(O.transmissionMap.channel),thicknessMapUv:rt&&T(O.thicknessMap.channel),alphaMapUv:D&&T(O.alphaMap.channel),vertexTangents:!!ut.attributes.tangent&&(Jt||te),vertexColors:O.vertexColors,vertexAlphas:O.vertexColors===!0&&!!ut.attributes.color&&ut.attributes.color.itemSize===4,vertexUv1s:ot,vertexUv2s:Q,vertexUv3s:St,pointsUvs:Mt.isPoints===!0&&!!ut.attributes.uv&&(Qt||D),fog:!!$,useFog:O.fog===!0,fogExp2:$&&$.isFogExp2,flatShading:O.flatShading===!0,sizeAttenuation:O.sizeAttenuation===!0,logarithmicDepthBuffer:_,skinning:Mt.isSkinnedMesh===!0,morphTargets:ut.morphAttributes.position!==void 0,morphNormals:ut.morphAttributes.normal!==void 0,morphColors:ut.morphAttributes.color!==void 0,morphTargetsCount:nt,morphTextureStride:ft,numDirLights:q.directional.length,numPointLights:q.point.length,numSpotLights:q.spot.length,numSpotLightMaps:q.spotLightMap.length,numRectAreaLights:q.rectArea.length,numHemiLights:q.hemi.length,numDirLightShadows:q.directionalShadowMap.length,numPointLightShadows:q.pointShadowMap.length,numSpotLightShadows:q.spotShadowMap.length,numSpotLightShadowsWithMaps:q.numSpotLightShadowsWithMaps,numLightProbes:q.numLightProbes,numClippingPlanes:h.numPlanes,numClipIntersection:h.numIntersection,dithering:O.dithering,shadowMapEnabled:r.shadowMap.enabled&&st.length>0,shadowMapType:r.shadowMap.type,toneMapping:At,useLegacyLights:r._useLegacyLights,decodeVideoTexture:Qt&&O.map.isVideoTexture===!0&&Mn.getTransfer(O.map.colorSpace)===Dn,premultipliedAlpha:O.premultipliedAlpha,doubleSided:O.side===Xo,flipSided:O.side===di,useDepthPacking:O.depthPacking>=0,depthPacking:O.depthPacking||0,index0AttributeName:O.index0AttributeName,extensionDerivatives:et&&O.extensions.derivatives===!0,extensionFragDepth:et&&O.extensions.fragDepth===!0,extensionDrawBuffers:et&&O.extensions.drawBuffers===!0,extensionShaderTextureLOD:et&&O.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:g||o.has("EXT_frag_depth"),rendererExtensionDrawBuffers:g||o.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:g||o.has("EXT_shader_texture_lod"),customProgramCacheKey:O.customProgramCacheKey()}}function v(O){let q=[];if(O.shaderID?q.push(O.shaderID):(q.push(O.customVertexShaderID),q.push(O.customFragmentShaderID)),O.defines!==void 0)for(let st in O.defines)q.push(st),q.push(O.defines[st]);return O.isRawShaderMaterial===!1&&(P(q,O),S(q,O),q.push(r.outputColorSpace)),q.push(O.customProgramCacheKey),q.join()}function P(O,q){O.push(q.precision),O.push(q.outputColorSpace),O.push(q.envMapMode),O.push(q.envMapCubeUVHeight),O.push(q.mapUv),O.push(q.alphaMapUv),O.push(q.lightMapUv),O.push(q.aoMapUv),O.push(q.bumpMapUv),O.push(q.normalMapUv),O.push(q.displacementMapUv),O.push(q.emissiveMapUv),O.push(q.metalnessMapUv),O.push(q.roughnessMapUv),O.push(q.anisotropyMapUv),O.push(q.clearcoatMapUv),O.push(q.clearcoatNormalMapUv),O.push(q.clearcoatRoughnessMapUv),O.push(q.iridescenceMapUv),O.push(q.iridescenceThicknessMapUv),O.push(q.sheenColorMapUv),O.push(q.sheenRoughnessMapUv),O.push(q.specularMapUv),O.push(q.specularColorMapUv),O.push(q.specularIntensityMapUv),O.push(q.transmissionMapUv),O.push(q.thicknessMapUv),O.push(q.combine),O.push(q.fogExp2),O.push(q.sizeAttenuation),O.push(q.morphTargetsCount),O.push(q.morphAttributeCount),O.push(q.numDirLights),O.push(q.numPointLights),O.push(q.numSpotLights),O.push(q.numSpotLightMaps),O.push(q.numHemiLights),O.push(q.numRectAreaLights),O.push(q.numDirLightShadows),O.push(q.numPointLightShadows),O.push(q.numSpotLightShadows),O.push(q.numSpotLightShadowsWithMaps),O.push(q.numLightProbes),O.push(q.shadowMapType),O.push(q.toneMapping),O.push(q.numClippingPlanes),O.push(q.numClipIntersection),O.push(q.depthPacking)}function S(O,q){f.disableAll(),q.isWebGL2&&f.enable(0),q.supportsVertexTextures&&f.enable(1),q.instancing&&f.enable(2),q.instancingColor&&f.enable(3),q.matcap&&f.enable(4),q.envMap&&f.enable(5),q.normalMapObjectSpace&&f.enable(6),q.normalMapTangentSpace&&f.enable(7),q.clearcoat&&f.enable(8),q.iridescence&&f.enable(9),q.alphaTest&&f.enable(10),q.vertexColors&&f.enable(11),q.vertexAlphas&&f.enable(12),q.vertexUv1s&&f.enable(13),q.vertexUv2s&&f.enable(14),q.vertexUv3s&&f.enable(15),q.vertexTangents&&f.enable(16),q.anisotropy&&f.enable(17),O.push(f.mask),f.disableAll(),q.fog&&f.enable(0),q.useFog&&f.enable(1),q.flatShading&&f.enable(2),q.logarithmicDepthBuffer&&f.enable(3),q.skinning&&f.enable(4),q.morphTargets&&f.enable(5),q.morphNormals&&f.enable(6),q.morphColors&&f.enable(7),q.premultipliedAlpha&&f.enable(8),q.shadowMapEnabled&&f.enable(9),q.useLegacyLights&&f.enable(10),q.doubleSided&&f.enable(11),q.flipSided&&f.enable(12),q.useDepthPacking&&f.enable(13),q.dithering&&f.enable(14),q.transmission&&f.enable(15),q.sheen&&f.enable(16),q.opaque&&f.enable(17),q.pointsUvs&&f.enable(18),q.decodeVideoTexture&&f.enable(19),O.push(f.mask)}function L(O){let q=b[O.type],st;if(q){let V=mo[q];st=vE.clone(V.uniforms)}else st=O.uniforms;return st}function N(O,q){let st;for(let V=0,Mt=d.length;V<Mt;V++){let $=d[V];if($.cacheKey===q){st=$,++st.usedTimes;break}}return st===void 0&&(st=new Sb(r,q,O,l),d.push(st)),st}function G(O){if(--O.usedTimes===0){let q=d.indexOf(O);d[q]=d[d.length-1],d.pop(),O.destroy()}}function B(O){p.remove(O)}function I(){p.dispose()}return{getParameters:x,getProgramCacheKey:v,getUniforms:L,acquireProgram:N,releaseProgram:G,releaseShaderCache:B,programs:d,dispose:I}}function Tb(){let r=new WeakMap;function t(l){let h=r.get(l);return h===void 0&&(h={},r.set(l,h)),h}function e(l){r.delete(l)}function o(l,h,f){r.get(l)[h]=f}function a(){r=new WeakMap}return{get:t,remove:e,update:o,dispose:a}}function Ab(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.material.id!==t.material.id?r.material.id-t.material.id:r.z!==t.z?r.z-t.z:r.id-t.id}function Yg(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.z!==t.z?t.z-r.z:r.id-t.id}function $g(){let r=[],t=0,e=[],o=[],a=[];function l(){t=0,e.length=0,o.length=0,a.length=0}function h(_,y,M,b,T,x){let v=r[t];return v===void 0?(v={id:_.id,object:_,geometry:y,material:M,groupOrder:b,renderOrder:_.renderOrder,z:T,group:x},r[t]=v):(v.id=_.id,v.object=_,v.geometry=y,v.material=M,v.groupOrder=b,v.renderOrder=_.renderOrder,v.z=T,v.group=x),t++,v}function f(_,y,M,b,T,x){let v=h(_,y,M,b,T,x);M.transmission>0?o.push(v):M.transparent===!0?a.push(v):e.push(v)}function p(_,y,M,b,T,x){let v=h(_,y,M,b,T,x);M.transmission>0?o.unshift(v):M.transparent===!0?a.unshift(v):e.unshift(v)}function d(_,y){e.length>1&&e.sort(_||Ab),o.length>1&&o.sort(y||Yg),a.length>1&&a.sort(y||Yg)}function g(){for(let _=t,y=r.length;_<y;_++){let M=r[_];if(M.id===null)break;M.id=null,M.object=null,M.geometry=null,M.material=null,M.group=null}}return{opaque:e,transmissive:o,transparent:a,init:l,push:f,unshift:p,finish:g,sort:d}}function Cb(){let r=new WeakMap;function t(o,a){let l=r.get(o),h;return l===void 0?(h=new $g,r.set(o,[h])):a>=l.length?(h=new $g,l.push(h)):h=l[a],h}function e(){r=new WeakMap}return{get:t,dispose:e}}function Pb(){let r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new vt,color:new An};break;case"SpotLight":e={position:new vt,direction:new vt,color:new An,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new vt,color:new An,distance:0,decay:0};break;case"HemisphereLight":e={direction:new vt,skyColor:new An,groundColor:new An};break;case"RectAreaLight":e={color:new An,position:new vt,halfWidth:new vt,halfHeight:new vt};break}return r[t.id]=e,e}}}function Ib(){let r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fn};break;case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fn};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fn,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[t.id]=e,e}}}var Rb=0;function Lb(r,t){return(t.castShadow?2:0)-(r.castShadow?2:0)+(t.map?1:0)-(r.map?1:0)}function Nb(r,t){let e=new Pb,o=Ib(),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let g=0;g<9;g++)a.probe.push(new vt);let l=new vt,h=new Yr,f=new Yr;function p(g,_){let y=0,M=0,b=0;for(let V=0;V<9;V++)a.probe[V].set(0,0,0);let T=0,x=0,v=0,P=0,S=0,L=0,N=0,G=0,B=0,I=0,O=0;g.sort(Lb);let q=_===!0?Math.PI:1;for(let V=0,Mt=g.length;V<Mt;V++){let $=g[V],ut=$.color,xt=$.intensity,mt=$.distance,lt=$.shadow&&$.shadow.map?$.shadow.map.texture:null;if($.isAmbientLight)y+=ut.r*xt*q,M+=ut.g*xt*q,b+=ut.b*xt*q;else if($.isLightProbe){for(let ht=0;ht<9;ht++)a.probe[ht].addScaledVector($.sh.coefficients[ht],xt);O++}else if($.isDirectionalLight){let ht=e.get($);if(ht.color.copy($.color).multiplyScalar($.intensity*q),$.castShadow){let k=$.shadow,nt=o.get($);nt.shadowBias=k.bias,nt.shadowNormalBias=k.normalBias,nt.shadowRadius=k.radius,nt.shadowMapSize=k.mapSize,a.directionalShadow[T]=nt,a.directionalShadowMap[T]=lt,a.directionalShadowMatrix[T]=$.shadow.matrix,L++}a.directional[T]=ht,T++}else if($.isSpotLight){let ht=e.get($);ht.position.setFromMatrixPosition($.matrixWorld),ht.color.copy(ut).multiplyScalar(xt*q),ht.distance=mt,ht.coneCos=Math.cos($.angle),ht.penumbraCos=Math.cos($.angle*(1-$.penumbra)),ht.decay=$.decay,a.spot[v]=ht;let k=$.shadow;if($.map&&(a.spotLightMap[B]=$.map,B++,k.updateMatrices($),$.castShadow&&I++),a.spotLightMatrix[v]=k.matrix,$.castShadow){let nt=o.get($);nt.shadowBias=k.bias,nt.shadowNormalBias=k.normalBias,nt.shadowRadius=k.radius,nt.shadowMapSize=k.mapSize,a.spotShadow[v]=nt,a.spotShadowMap[v]=lt,G++}v++}else if($.isRectAreaLight){let ht=e.get($);ht.color.copy(ut).multiplyScalar(xt),ht.halfWidth.set($.width*.5,0,0),ht.halfHeight.set(0,$.height*.5,0),a.rectArea[P]=ht,P++}else if($.isPointLight){let ht=e.get($);if(ht.color.copy($.color).multiplyScalar($.intensity*q),ht.distance=$.distance,ht.decay=$.decay,$.castShadow){let k=$.shadow,nt=o.get($);nt.shadowBias=k.bias,nt.shadowNormalBias=k.normalBias,nt.shadowRadius=k.radius,nt.shadowMapSize=k.mapSize,nt.shadowCameraNear=k.camera.near,nt.shadowCameraFar=k.camera.far,a.pointShadow[x]=nt,a.pointShadowMap[x]=lt,a.pointShadowMatrix[x]=$.shadow.matrix,N++}a.point[x]=ht,x++}else if($.isHemisphereLight){let ht=e.get($);ht.skyColor.copy($.color).multiplyScalar(xt*q),ht.groundColor.copy($.groundColor).multiplyScalar(xt*q),a.hemi[S]=ht,S++}}P>0&&(t.isWebGL2||r.has("OES_texture_float_linear")===!0?(a.rectAreaLTC1=kt.LTC_FLOAT_1,a.rectAreaLTC2=kt.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(a.rectAreaLTC1=kt.LTC_HALF_1,a.rectAreaLTC2=kt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=y,a.ambient[1]=M,a.ambient[2]=b;let st=a.hash;(st.directionalLength!==T||st.pointLength!==x||st.spotLength!==v||st.rectAreaLength!==P||st.hemiLength!==S||st.numDirectionalShadows!==L||st.numPointShadows!==N||st.numSpotShadows!==G||st.numSpotMaps!==B||st.numLightProbes!==O)&&(a.directional.length=T,a.spot.length=v,a.rectArea.length=P,a.point.length=x,a.hemi.length=S,a.directionalShadow.length=L,a.directionalShadowMap.length=L,a.pointShadow.length=N,a.pointShadowMap.length=N,a.spotShadow.length=G,a.spotShadowMap.length=G,a.directionalShadowMatrix.length=L,a.pointShadowMatrix.length=N,a.spotLightMatrix.length=G+B-I,a.spotLightMap.length=B,a.numSpotLightShadowsWithMaps=I,a.numLightProbes=O,st.directionalLength=T,st.pointLength=x,st.spotLength=v,st.rectAreaLength=P,st.hemiLength=S,st.numDirectionalShadows=L,st.numPointShadows=N,st.numSpotShadows=G,st.numSpotMaps=B,st.numLightProbes=O,a.version=Rb++)}function d(g,_){let y=0,M=0,b=0,T=0,x=0,v=_.matrixWorldInverse;for(let P=0,S=g.length;P<S;P++){let L=g[P];if(L.isDirectionalLight){let N=a.directional[y];N.direction.setFromMatrixPosition(L.matrixWorld),l.setFromMatrixPosition(L.target.matrixWorld),N.direction.sub(l),N.direction.transformDirection(v),y++}else if(L.isSpotLight){let N=a.spot[b];N.position.setFromMatrixPosition(L.matrixWorld),N.position.applyMatrix4(v),N.direction.setFromMatrixPosition(L.matrixWorld),l.setFromMatrixPosition(L.target.matrixWorld),N.direction.sub(l),N.direction.transformDirection(v),b++}else if(L.isRectAreaLight){let N=a.rectArea[T];N.position.setFromMatrixPosition(L.matrixWorld),N.position.applyMatrix4(v),f.identity(),h.copy(L.matrixWorld),h.premultiply(v),f.extractRotation(h),N.halfWidth.set(L.width*.5,0,0),N.halfHeight.set(0,L.height*.5,0),N.halfWidth.applyMatrix4(f),N.halfHeight.applyMatrix4(f),T++}else if(L.isPointLight){let N=a.point[M];N.position.setFromMatrixPosition(L.matrixWorld),N.position.applyMatrix4(v),M++}else if(L.isHemisphereLight){let N=a.hemi[x];N.direction.setFromMatrixPosition(L.matrixWorld),N.direction.transformDirection(v),x++}}}return{setup:p,setupView:d,state:a}}function Zg(r,t){let e=new Nb(r,t),o=[],a=[];function l(){o.length=0,a.length=0}function h(_){o.push(_)}function f(_){a.push(_)}function p(_){e.setup(o,_)}function d(_){e.setupView(o,_)}return{init:l,state:{lightsArray:o,shadowsArray:a,lights:e},setupLights:p,setupLightsView:d,pushLight:h,pushShadow:f}}function Ob(r,t){let e=new WeakMap;function o(l,h=0){let f=e.get(l),p;return f===void 0?(p=new Zg(r,t),e.set(l,[p])):h>=f.length?(p=new Zg(r,t),f.push(p)):p=f[h],p}function a(){e=new WeakMap}return{get:o,dispose:a}}var Lf=class extends Xa{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Vx,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}},Nf=class extends Xa{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}},Db=`void main() {\n gl_Position = vec4( position, 1.0 );\n}`,Fb=`uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}`;function Ub(r,t,e){let o=new lc,a=new fn,l=new fn,h=new Dr,f=new Lf({depthPacking:Hx}),p=new Nf,d={},g=e.maxTextureSize,_={[vs]:di,[di]:vs,[Xo]:Xo},y=new Ko({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new fn},radius:{value:4}},vertexShader:Db,fragmentShader:Fb}),M=y.clone();M.defines.HORIZONTAL_PASS=1;let b=new Js;b.setAttribute("position",new ki(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let T=new go(b,y),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Jg;let v=this.type;this.render=function(N,G,B){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||N.length===0)return;let I=r.getRenderTarget(),O=r.getActiveCubeFace(),q=r.getActiveMipmapLevel(),st=r.state;st.setBlending(ms),st.buffers.color.setClear(1,1,1,1),st.buffers.depth.setTest(!0),st.setScissorTest(!1);let V=v!==Wo&&this.type===Wo,Mt=v===Wo&&this.type!==Wo;for(let $=0,ut=N.length;$<ut;$++){let xt=N[$],mt=xt.shadow;if(mt===void 0){console.warn("THREE.WebGLShadowMap:",xt,"has no shadow.");continue}if(mt.autoUpdate===!1&&mt.needsUpdate===!1)continue;a.copy(mt.mapSize);let lt=mt.getFrameExtents();if(a.multiply(lt),l.copy(mt.mapSize),(a.x>g||a.y>g)&&(a.x>g&&(l.x=Math.floor(g/lt.x),a.x=l.x*lt.x,mt.mapSize.x=l.x),a.y>g&&(l.y=Math.floor(g/lt.y),a.y=l.y*lt.y,mt.mapSize.y=l.y)),mt.map===null||V===!0||Mt===!0){let k=this.type!==Wo?{minFilter:ri,magFilter:ri}:{};mt.map!==null&&mt.map.dispose(),mt.map=new Jo(a.x,a.y,k),mt.map.texture.name=xt.name+".shadowMap",mt.camera.updateProjectionMatrix()}r.setRenderTarget(mt.map),r.clear();let ht=mt.getViewportCount();for(let k=0;k<ht;k++){let nt=mt.getViewport(k);h.set(l.x*nt.x,l.y*nt.y,l.x*nt.z,l.y*nt.w),st.viewport(h),mt.updateMatrices(xt,k),o=mt.getFrustum(),L(G,B,mt.camera,xt,this.type)}mt.isPointLightShadow!==!0&&this.type===Wo&&P(mt,B),mt.needsUpdate=!1}v=this.type,x.needsUpdate=!1,r.setRenderTarget(I,O,q)};function P(N,G){let B=t.update(T);y.defines.VSM_SAMPLES!==N.blurSamples&&(y.defines.VSM_SAMPLES=N.blurSamples,M.defines.VSM_SAMPLES=N.blurSamples,y.needsUpdate=!0,M.needsUpdate=!0),N.mapPass===null&&(N.mapPass=new Jo(a.x,a.y)),y.uniforms.shadow_pass.value=N.map.texture,y.uniforms.resolution.value=N.mapSize,y.uniforms.radius.value=N.radius,r.setRenderTarget(N.mapPass),r.clear(),r.renderBufferDirect(G,null,B,y,T,null),M.uniforms.shadow_pass.value=N.mapPass.texture,M.uniforms.resolution.value=N.mapSize,M.uniforms.radius.value=N.radius,r.setRenderTarget(N.map),r.clear(),r.renderBufferDirect(G,null,B,M,T,null)}function S(N,G,B,I){let O=null,q=B.isPointLight===!0?N.customDistanceMaterial:N.customDepthMaterial;if(q!==void 0)O=q;else if(O=B.isPointLight===!0?p:f,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 st=O.uuid,V=G.uuid,Mt=d[st];Mt===void 0&&(Mt={},d[st]=Mt);let $=Mt[V];$===void 0&&($=O.clone(),Mt[V]=$),O=$}if(O.visible=G.visible,O.wireframe=G.wireframe,I===Wo?O.side=G.shadowSide!==null?G.shadowSide:G.side:O.side=G.shadowSide!==null?G.shadowSide:_[G.side],O.alphaMap=G.alphaMap,O.alphaTest=G.alphaTest,O.map=G.map,O.clipShadows=G.clipShadows,O.clippingPlanes=G.clippingPlanes,O.clipIntersection=G.clipIntersection,O.displacementMap=G.displacementMap,O.displacementScale=G.displacementScale,O.displacementBias=G.displacementBias,O.wireframeLinewidth=G.wireframeLinewidth,O.linewidth=G.linewidth,B.isPointLight===!0&&O.isMeshDistanceMaterial===!0){let st=r.properties.get(O);st.light=B}return O}function L(N,G,B,I,O){if(N.visible===!1)return;if(N.layers.test(G.layers)&&(N.isMesh||N.isLine||N.isPoints)&&(N.castShadow||N.receiveShadow&&O===Wo)&&(!N.frustumCulled||o.intersectsObject(N))){N.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,N.matrixWorld);let V=t.update(N),Mt=N.material;if(Array.isArray(Mt)){let $=V.groups;for(let ut=0,xt=$.length;ut<xt;ut++){let mt=$[ut],lt=Mt[mt.materialIndex];if(lt&<.visible){let ht=S(N,lt,I,O);r.renderBufferDirect(B,null,V,ht,N,mt)}}}else if(Mt.visible){let $=S(N,Mt,I,O);r.renderBufferDirect(B,null,V,$,N,null)}}let st=N.children;for(let V=0,Mt=st.length;V<Mt;V++)L(st[V],G,B,I,O)}}function Bb(r,t,e){let o=e.isWebGL2;function a(){let D=!1,tt=new Dr,Z=null,et=new Dr(0,0,0,0);return{setMask:function(ot){Z!==ot&&!D&&(r.colorMask(ot,ot,ot,ot),Z=ot)},setLocked:function(ot){D=ot},setClear:function(ot,Q,St,At,ne){ne===!0&&(ot*=At,Q*=At,St*=At),tt.set(ot,Q,St,At),et.equals(tt)===!1&&(r.clearColor(ot,Q,St,At),et.copy(tt))},reset:function(){D=!1,Z=null,et.set(-1,0,0,0)}}}function l(){let D=!1,tt=null,Z=null,et=null;return{setTest:function(ot){ot?Xt(r.DEPTH_TEST):Ft(r.DEPTH_TEST)},setMask:function(ot){tt!==ot&&!D&&(r.depthMask(ot),tt=ot)},setFunc:function(ot){if(Z!==ot){switch(ot){case vx:r.depthFunc(r.NEVER);break;case _x:r.depthFunc(r.ALWAYS);break;case xx:r.depthFunc(r.LESS);break;case hf:r.depthFunc(r.LEQUAL);break;case Ex:r.depthFunc(r.EQUAL);break;case Mx:r.depthFunc(r.GEQUAL);break;case Sx:r.depthFunc(r.GREATER);break;case wx:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}Z=ot}},setLocked:function(ot){D=ot},setClear:function(ot){et!==ot&&(r.clearDepth(ot),et=ot)},reset:function(){D=!1,tt=null,Z=null,et=null}}}function h(){let D=!1,tt=null,Z=null,et=null,ot=null,Q=null,St=null,At=null,ne=null;return{setTest:function(Gt){D||(Gt?Xt(r.STENCIL_TEST):Ft(r.STENCIL_TEST))},setMask:function(Gt){tt!==Gt&&!D&&(r.stencilMask(Gt),tt=Gt)},setFunc:function(Gt,He,tn){(Z!==Gt||et!==He||ot!==tn)&&(r.stencilFunc(Gt,He,tn),Z=Gt,et=He,ot=tn)},setOp:function(Gt,He,tn){(Q!==Gt||St!==He||At!==tn)&&(r.stencilOp(Gt,He,tn),Q=Gt,St=He,At=tn)},setLocked:function(Gt){D=Gt},setClear:function(Gt){ne!==Gt&&(r.clearStencil(Gt),ne=Gt)},reset:function(){D=!1,tt=null,Z=null,et=null,ot=null,Q=null,St=null,At=null,ne=null}}}let f=new a,p=new l,d=new h,g=new WeakMap,_=new WeakMap,y={},M={},b=new WeakMap,T=[],x=null,v=!1,P=null,S=null,L=null,N=null,G=null,B=null,I=null,O=!1,q=null,st=null,V=null,Mt=null,$=null,ut=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS),xt=!1,mt=0,lt=r.getParameter(r.VERSION);lt.indexOf("WebGL")!==-1?(mt=parseFloat(/^WebGL (\\d)/.exec(lt)[1]),xt=mt>=1):lt.indexOf("OpenGL ES")!==-1&&(mt=parseFloat(/^OpenGL ES (\\d)/.exec(lt)[1]),xt=mt>=2);let ht=null,k={},nt=r.getParameter(r.SCISSOR_BOX),ft=r.getParameter(r.VIEWPORT),Tt=new Dr().fromArray(nt),gt=new Dr().fromArray(ft);function Lt(D,tt,Z,et){let ot=new Uint8Array(4),Q=r.createTexture();r.bindTexture(D,Q),r.texParameteri(D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(D,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let St=0;St<Z;St++)o&&(D===r.TEXTURE_3D||D===r.TEXTURE_2D_ARRAY)?r.texImage3D(tt,0,r.RGBA,1,1,et,0,r.RGBA,r.UNSIGNED_BYTE,ot):r.texImage2D(tt+St,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,ot);return Q}let qt={};qt[r.TEXTURE_2D]=Lt(r.TEXTURE_2D,r.TEXTURE_2D,1),qt[r.TEXTURE_CUBE_MAP]=Lt(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),o&&(qt[r.TEXTURE_2D_ARRAY]=Lt(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),qt[r.TEXTURE_3D]=Lt(r.TEXTURE_3D,r.TEXTURE_3D,1,1)),f.setClear(0,0,0,1),p.setClear(1),d.setClear(0),Xt(r.DEPTH_TEST),p.setFunc(hf),Yt(!1),pe(Pm),Xt(r.CULL_FACE),Bt(ms);function Xt(D){y[D]!==!0&&(r.enable(D),y[D]=!0)}function Ft(D){y[D]!==!1&&(r.disable(D),y[D]=!1)}function Qt(D,tt){return M[D]!==tt?(r.bindFramebuffer(D,tt),M[D]=tt,o&&(D===r.DRAW_FRAMEBUFFER&&(M[r.FRAMEBUFFER]=tt),D===r.FRAMEBUFFER&&(M[r.DRAW_FRAMEBUFFER]=tt)),!0):!1}function Ct(D,tt){let Z=T,et=!1;if(D)if(Z=b.get(tt),Z===void 0&&(Z=[],b.set(tt,Z)),D.isWebGLMultipleRenderTargets){let ot=D.texture;if(Z.length!==ot.length||Z[0]!==r.COLOR_ATTACHMENT0){for(let Q=0,St=ot.length;Q<St;Q++)Z[Q]=r.COLOR_ATTACHMENT0+Q;Z.length=ot.length,et=!0}}else Z[0]!==r.COLOR_ATTACHMENT0&&(Z[0]=r.COLOR_ATTACHMENT0,et=!0);else Z[0]!==r.BACK&&(Z[0]=r.BACK,et=!0);et&&(e.isWebGL2?r.drawBuffers(Z):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(Z))}function ee(D){return x!==D?(r.useProgram(D),x=D,!0):!1}let it={[Fa]:r.FUNC_ADD,[ax]:r.FUNC_SUBTRACT,[ux]:r.FUNC_REVERSE_SUBTRACT};if(o)it[Nm]=r.MIN,it[Om]=r.MAX;else{let D=t.get("EXT_blend_minmax");D!==null&&(it[Nm]=D.MIN_EXT,it[Om]=D.MAX_EXT)}let rn={[lx]:r.ZERO,[cx]:r.ONE,[hx]:r.SRC_COLOR,[Kg]:r.SRC_ALPHA,[yx]:r.SRC_ALPHA_SATURATE,[mx]:r.DST_COLOR,[px]:r.DST_ALPHA,[fx]:r.ONE_MINUS_SRC_COLOR,[jg]:r.ONE_MINUS_SRC_ALPHA,[gx]:r.ONE_MINUS_DST_COLOR,[dx]:r.ONE_MINUS_DST_ALPHA};function Bt(D,tt,Z,et,ot,Q,St,At){if(D===ms){v===!0&&(Ft(r.BLEND),v=!1);return}if(v===!1&&(Xt(r.BLEND),v=!0),D!==sx){if(D!==P||At!==O){if((S!==Fa||G!==Fa)&&(r.blendEquation(r.FUNC_ADD),S=Fa,G=Fa),At)switch(D){case ka:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Im:r.blendFunc(r.ONE,r.ONE);break;case Rm:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Lm:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}else switch(D){case ka:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Im:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case Rm:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Lm:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}L=null,N=null,B=null,I=null,P=D,O=At}return}ot=ot||tt,Q=Q||Z,St=St||et,(tt!==S||ot!==G)&&(r.blendEquationSeparate(it[tt],it[ot]),S=tt,G=ot),(Z!==L||et!==N||Q!==B||St!==I)&&(r.blendFuncSeparate(rn[Z],rn[et],rn[Q],rn[St]),L=Z,N=et,B=Q,I=St),P=D,O=!1}function Jt(D,tt){D.side===Xo?Ft(r.CULL_FACE):Xt(r.CULL_FACE);let Z=D.side===di;tt&&(Z=!Z),Yt(Z),D.blending===ka&&D.transparent===!1?Bt(ms):Bt(D.blending,D.blendEquation,D.blendSrc,D.blendDst,D.blendEquationAlpha,D.blendSrcAlpha,D.blendDstAlpha,D.premultipliedAlpha),p.setFunc(D.depthFunc),p.setTest(D.depthTest),p.setMask(D.depthWrite),f.setMask(D.colorWrite);let et=D.stencilWrite;d.setTest(et),et&&(d.setMask(D.stencilWriteMask),d.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),d.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),Pt(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?Xt(r.SAMPLE_ALPHA_TO_COVERAGE):Ft(r.SAMPLE_ALPHA_TO_COVERAGE)}function Yt(D){q!==D&&(D?r.frontFace(r.CW):r.frontFace(r.CCW),q=D)}function pe(D){D!==rx?(Xt(r.CULL_FACE),D!==st&&(D===Pm?r.cullFace(r.BACK):D===ix?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Ft(r.CULL_FACE),st=D}function le(D){D!==V&&(xt&&r.lineWidth(D),V=D)}function Pt(D,tt,Z){D?(Xt(r.POLYGON_OFFSET_FILL),(Mt!==tt||$!==Z)&&(r.polygonOffset(tt,Z),Mt=tt,$=Z)):Ft(r.POLYGON_OFFSET_FILL)}function te(D){D?Xt(r.SCISSOR_TEST):Ft(r.SCISSOR_TEST)}function yn(D){D===void 0&&(D=r.TEXTURE0+ut-1),ht!==D&&(r.activeTexture(D),ht=D)}function pn(D,tt,Z){Z===void 0&&(ht===null?Z=r.TEXTURE0+ut-1:Z=ht);let et=k[Z];et===void 0&&(et={type:void 0,texture:void 0},k[Z]=et),(et.type!==D||et.texture!==tt)&&(ht!==Z&&(r.activeTexture(Z),ht=Z),r.bindTexture(D,tt||qt[D]),et.type=D,et.texture=tt)}function X(){let D=k[ht];D!==void 0&&D.type!==void 0&&(r.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function F(){try{r.compressedTexImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function J(){try{r.compressedTexImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function It(){try{r.texSubImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function wt(){try{r.texSubImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function yt(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function $t(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Dt(){try{r.texStorage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Y(){try{r.texStorage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function w(){try{r.texImage2D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function C(){try{r.texImage3D.apply(r,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function R(D){Tt.equals(D)===!1&&(r.scissor(D.x,D.y,D.z,D.w),Tt.copy(D))}function H(D){gt.equals(D)===!1&&(r.viewport(D.x,D.y,D.z,D.w),gt.copy(D))}function z(D,tt){let Z=_.get(tt);Z===void 0&&(Z=new WeakMap,_.set(tt,Z));let et=Z.get(D);et===void 0&&(et=r.getUniformBlockIndex(tt,D.name),Z.set(D,et))}function rt(D,tt){let et=_.get(tt).get(D);g.get(tt)!==et&&(r.uniformBlockBinding(tt,et,D.__bindingPointIndex),g.set(tt,et))}function j(){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={},ht=null,k={},M={},b=new WeakMap,T=[],x=null,v=!1,P=null,S=null,L=null,N=null,G=null,B=null,I=null,O=!1,q=null,st=null,V=null,Mt=null,$=null,Tt.set(0,0,r.canvas.width,r.canvas.height),gt.set(0,0,r.canvas.width,r.canvas.height),f.reset(),p.reset(),d.reset()}return{buffers:{color:f,depth:p,stencil:d},enable:Xt,disable:Ft,bindFramebuffer:Qt,drawBuffers:Ct,useProgram:ee,setBlending:Bt,setMaterial:Jt,setFlipSided:Yt,setCullFace:pe,setLineWidth:le,setPolygonOffset:Pt,setScissorTest:te,activeTexture:yn,bindTexture:pn,unbindTexture:X,compressedTexImage2D:F,compressedTexImage3D:J,texImage2D:w,texImage3D:C,updateUBOMapping:z,uniformBlockBinding:rt,texStorage2D:Dt,texStorage3D:Y,texSubImage2D:It,texSubImage3D:wt,compressedTexSubImage2D:yt,compressedTexSubImage3D:$t,scissor:R,viewport:H,reset:j}}function zb(r,t,e,o,a,l,h){let f=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),b=new WeakMap,T,x=new WeakMap,v=!1;try{v=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(X){}function P(X,F){return v?new OffscreenCanvas(X,F):jl("canvas")}function S(X,F,J,It){let wt=1;if((X.width>It||X.height>It)&&(wt=It/Math.max(X.width,X.height)),wt<1||F===!0)if(typeof HTMLImageElement!="undefined"&&X instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&X instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&X instanceof ImageBitmap){let yt=F?vf:Math.floor,$t=yt(wt*X.width),Dt=yt(wt*X.height);T===void 0&&(T=P($t,Dt));let Y=J?P($t,Dt):T;return Y.width=$t,Y.height=Dt,Y.getContext("2d").drawImage(X,0,0,$t,Dt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+X.width+"x"+X.height+") to ("+$t+"x"+Dt+")."),Y}else return"data"in X&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+X.width+"x"+X.height+")."),X;return X}function L(X){return fg(X.width)&&fg(X.height)}function N(X){return f?!1:X.wrapS!==to||X.wrapT!==to||X.minFilter!==ri&&X.minFilter!==Bi}function G(X,F){return X.generateMipmaps&&F&&X.minFilter!==ri&&X.minFilter!==Bi}function B(X){r.generateMipmap(X)}function I(X,F,J,It,wt=!1){if(f===!1)return F;if(X!==null){if(r[X]!==void 0)return r[X];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \'"+X+"\'")}let yt=F;if(F===r.RED&&(J===r.FLOAT&&(yt=r.R32F),J===r.HALF_FLOAT&&(yt=r.R16F),J===r.UNSIGNED_BYTE&&(yt=r.R8)),F===r.RED_INTEGER&&(J===r.UNSIGNED_BYTE&&(yt=r.R8UI),J===r.UNSIGNED_SHORT&&(yt=r.R16UI),J===r.UNSIGNED_INT&&(yt=r.R32UI),J===r.BYTE&&(yt=r.R8I),J===r.SHORT&&(yt=r.R16I),J===r.INT&&(yt=r.R32I)),F===r.RG&&(J===r.FLOAT&&(yt=r.RG32F),J===r.HALF_FLOAT&&(yt=r.RG16F),J===r.UNSIGNED_BYTE&&(yt=r.RG8)),F===r.RGBA){let $t=wt?$l:Mn.getTransfer(It);J===r.FLOAT&&(yt=r.RGBA32F),J===r.HALF_FLOAT&&(yt=r.RGBA16F),J===r.UNSIGNED_BYTE&&(yt=$t===Dn?r.SRGB8_ALPHA8:r.RGBA8),J===r.UNSIGNED_SHORT_4_4_4_4&&(yt=r.RGBA4),J===r.UNSIGNED_SHORT_5_5_5_1&&(yt=r.RGB5_A1)}return(yt===r.R16F||yt===r.R32F||yt===r.RG16F||yt===r.RG32F||yt===r.RGBA16F||yt===r.RGBA32F)&&t.get("EXT_color_buffer_float"),yt}function O(X,F,J){return G(X,J)===!0||X.isFramebufferTexture&&X.minFilter!==ri&&X.minFilter!==Bi?Math.log2(Math.max(F.width,F.height))+1:X.mipmaps!==void 0&&X.mipmaps.length>0?X.mipmaps.length:X.isCompressedTexture&&Array.isArray(X.image)?F.mipmaps.length:1}function q(X){return X===ri||X===Dm||X===Oh?r.NEAREST:r.LINEAR}function st(X){let F=X.target;F.removeEventListener("dispose",st),Mt(F),F.isVideoTexture&&b.delete(F)}function V(X){let F=X.target;F.removeEventListener("dispose",V),ut(F)}function Mt(X){let F=o.get(X);if(F.__webglInit===void 0)return;let J=X.source,It=x.get(J);if(It){let wt=It[F.__cacheKey];wt.usedTimes--,wt.usedTimes===0&&$(X),Object.keys(It).length===0&&x.delete(J)}o.remove(X)}function $(X){let F=o.get(X);r.deleteTexture(F.__webglTexture);let J=X.source,It=x.get(J);delete It[F.__cacheKey],h.memory.textures--}function ut(X){let F=X.texture,J=o.get(X),It=o.get(F);if(It.__webglTexture!==void 0&&(r.deleteTexture(It.__webglTexture),h.memory.textures--),X.depthTexture&&X.depthTexture.dispose(),X.isWebGLCubeRenderTarget)for(let wt=0;wt<6;wt++){if(Array.isArray(J.__webglFramebuffer[wt]))for(let yt=0;yt<J.__webglFramebuffer[wt].length;yt++)r.deleteFramebuffer(J.__webglFramebuffer[wt][yt]);else r.deleteFramebuffer(J.__webglFramebuffer[wt]);J.__webglDepthbuffer&&r.deleteRenderbuffer(J.__webglDepthbuffer[wt])}else{if(Array.isArray(J.__webglFramebuffer))for(let wt=0;wt<J.__webglFramebuffer.length;wt++)r.deleteFramebuffer(J.__webglFramebuffer[wt]);else r.deleteFramebuffer(J.__webglFramebuffer);if(J.__webglDepthbuffer&&r.deleteRenderbuffer(J.__webglDepthbuffer),J.__webglMultisampledFramebuffer&&r.deleteFramebuffer(J.__webglMultisampledFramebuffer),J.__webglColorRenderbuffer)for(let wt=0;wt<J.__webglColorRenderbuffer.length;wt++)J.__webglColorRenderbuffer[wt]&&r.deleteRenderbuffer(J.__webglColorRenderbuffer[wt]);J.__webglDepthRenderbuffer&&r.deleteRenderbuffer(J.__webglDepthRenderbuffer)}if(X.isWebGLMultipleRenderTargets)for(let wt=0,yt=F.length;wt<yt;wt++){let $t=o.get(F[wt]);$t.__webglTexture&&(r.deleteTexture($t.__webglTexture),h.memory.textures--),o.remove(F[wt])}o.remove(F),o.remove(X)}let xt=0;function mt(){xt=0}function lt(){let X=xt;return X>=p&&console.warn("THREE.WebGLTextures: Trying to use "+X+" texture units while this GPU supports only "+p),xt+=1,X}function ht(X){let F=[];return F.push(X.wrapS),F.push(X.wrapT),F.push(X.wrapR||0),F.push(X.magFilter),F.push(X.minFilter),F.push(X.anisotropy),F.push(X.internalFormat),F.push(X.format),F.push(X.type),F.push(X.generateMipmaps),F.push(X.premultiplyAlpha),F.push(X.flipY),F.push(X.unpackAlignment),F.push(X.colorSpace),F.join()}function k(X,F){let J=o.get(X);if(X.isVideoTexture&&yn(X),X.isRenderTargetTexture===!1&&X.version>0&&J.__version!==X.version){let It=X.image;if(It===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(It.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Qt(J,X,F);return}}e.bindTexture(r.TEXTURE_2D,J.__webglTexture,r.TEXTURE0+F)}function nt(X,F){let J=o.get(X);if(X.version>0&&J.__version!==X.version){Qt(J,X,F);return}e.bindTexture(r.TEXTURE_2D_ARRAY,J.__webglTexture,r.TEXTURE0+F)}function ft(X,F){let J=o.get(X);if(X.version>0&&J.__version!==X.version){Qt(J,X,F);return}e.bindTexture(r.TEXTURE_3D,J.__webglTexture,r.TEXTURE0+F)}function Tt(X,F){let J=o.get(X);if(X.version>0&&J.__version!==X.version){Ct(J,X,F);return}e.bindTexture(r.TEXTURE_CUBE_MAP,J.__webglTexture,r.TEXTURE0+F)}let gt={[df]:r.REPEAT,[to]:r.CLAMP_TO_EDGE,[mf]:r.MIRRORED_REPEAT},Lt={[ri]:r.NEAREST,[Dm]:r.NEAREST_MIPMAP_NEAREST,[Oh]:r.NEAREST_MIPMAP_LINEAR,[Bi]:r.LINEAR,[Lx]:r.LINEAR_MIPMAP_NEAREST,[Bu]:r.LINEAR_MIPMAP_LINEAR},qt={[Yx]:r.NEVER,[tE]:r.ALWAYS,[$x]:r.LESS,[Jx]:r.LEQUAL,[Zx]:r.EQUAL,[Qx]:r.GEQUAL,[Kx]:r.GREATER,[jx]:r.NOTEQUAL};function Xt(X,F,J){if(J?(r.texParameteri(X,r.TEXTURE_WRAP_S,gt[F.wrapS]),r.texParameteri(X,r.TEXTURE_WRAP_T,gt[F.wrapT]),(X===r.TEXTURE_3D||X===r.TEXTURE_2D_ARRAY)&&r.texParameteri(X,r.TEXTURE_WRAP_R,gt[F.wrapR]),r.texParameteri(X,r.TEXTURE_MAG_FILTER,Lt[F.magFilter]),r.texParameteri(X,r.TEXTURE_MIN_FILTER,Lt[F.minFilter])):(r.texParameteri(X,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(X,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(X===r.TEXTURE_3D||X===r.TEXTURE_2D_ARRAY)&&r.texParameteri(X,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(F.wrapS!==to||F.wrapT!==to)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(X,r.TEXTURE_MAG_FILTER,q(F.magFilter)),r.texParameteri(X,r.TEXTURE_MIN_FILTER,q(F.minFilter)),F.minFilter!==ri&&F.minFilter!==Bi&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),F.compareFunction&&(r.texParameteri(X,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(X,r.TEXTURE_COMPARE_FUNC,qt[F.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){let It=t.get("EXT_texture_filter_anisotropic");if(F.magFilter===ri||F.minFilter!==Oh&&F.minFilter!==Bu||F.type===ds&&t.has("OES_texture_float_linear")===!1||f===!1&&F.type===zu&&t.has("OES_texture_half_float_linear")===!1)return;(F.anisotropy>1||o.get(F).__currentAnisotropy)&&(r.texParameterf(X,It.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(F.anisotropy,a.getMaxAnisotropy())),o.get(F).__currentAnisotropy=F.anisotropy)}}function Ft(X,F){let J=!1;X.__webglInit===void 0&&(X.__webglInit=!0,F.addEventListener("dispose",st));let It=F.source,wt=x.get(It);wt===void 0&&(wt={},x.set(It,wt));let yt=ht(F);if(yt!==X.__cacheKey){wt[yt]===void 0&&(wt[yt]={texture:r.createTexture(),usedTimes:0},h.memory.textures++,J=!0),wt[yt].usedTimes++;let $t=wt[X.__cacheKey];$t!==void 0&&(wt[X.__cacheKey].usedTimes--,$t.usedTimes===0&&$(F)),X.__cacheKey=yt,X.__webglTexture=wt[yt].texture}return J}function Qt(X,F,J){let It=r.TEXTURE_2D;(F.isDataArrayTexture||F.isCompressedArrayTexture)&&(It=r.TEXTURE_2D_ARRAY),F.isData3DTexture&&(It=r.TEXTURE_3D);let wt=Ft(X,F),yt=F.source;e.bindTexture(It,X.__webglTexture,r.TEXTURE0+J);let $t=o.get(yt);if(yt.version!==$t.__version||wt===!0){e.activeTexture(r.TEXTURE0+J);let Dt=Mn.getPrimaries(Mn.workingColorSpace),Y=F.colorSpace===zi?null:Mn.getPrimaries(F.colorSpace),w=F.colorSpace===zi||Dt===Y?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,F.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,F.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,w);let C=N(F)&&L(F.image)===!1,R=S(F.image,C,!1,g);R=pn(F,R);let H=L(R)||f,z=l.convert(F.format,F.colorSpace),rt=l.convert(F.type),j=I(F.internalFormat,z,rt,F.colorSpace,F.isVideoTexture);Xt(It,F,H);let D,tt=F.mipmaps,Z=f&&F.isVideoTexture!==!0,et=$t.__version===void 0||wt===!0,ot=O(F,R,H);if(F.isDepthTexture)j=r.DEPTH_COMPONENT,f?F.type===ds?j=r.DEPTH_COMPONENT32F:F.type===ps?j=r.DEPTH_COMPONENT24:F.type===Xs?j=r.DEPTH24_STENCIL8:j=r.DEPTH_COMPONENT16:F.type===ds&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),F.format===Ys&&j===r.DEPTH_COMPONENT&&F.type!==Jf&&F.type!==ps&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),F.type=ps,rt=l.convert(F.type)),F.format===qa&&j===r.DEPTH_COMPONENT&&(j=r.DEPTH_STENCIL,F.type!==Xs&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),F.type=Xs,rt=l.convert(F.type))),et&&(Z?e.texStorage2D(r.TEXTURE_2D,1,j,R.width,R.height):e.texImage2D(r.TEXTURE_2D,0,j,R.width,R.height,0,z,rt,null));else if(F.isDataTexture)if(tt.length>0&&H){Z&&et&&e.texStorage2D(r.TEXTURE_2D,ot,j,tt[0].width,tt[0].height);for(let Q=0,St=tt.length;Q<St;Q++)D=tt[Q],Z?e.texSubImage2D(r.TEXTURE_2D,Q,0,0,D.width,D.height,z,rt,D.data):e.texImage2D(r.TEXTURE_2D,Q,j,D.width,D.height,0,z,rt,D.data);F.generateMipmaps=!1}else Z?(et&&e.texStorage2D(r.TEXTURE_2D,ot,j,R.width,R.height),e.texSubImage2D(r.TEXTURE_2D,0,0,0,R.width,R.height,z,rt,R.data)):e.texImage2D(r.TEXTURE_2D,0,j,R.width,R.height,0,z,rt,R.data);else if(F.isCompressedTexture)if(F.isCompressedArrayTexture){Z&&et&&e.texStorage3D(r.TEXTURE_2D_ARRAY,ot,j,tt[0].width,tt[0].height,R.depth);for(let Q=0,St=tt.length;Q<St;Q++)D=tt[Q],F.format!==eo?z!==null?Z?e.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,Q,0,0,0,D.width,D.height,R.depth,z,D.data,0,0):e.compressedTexImage3D(r.TEXTURE_2D_ARRAY,Q,j,D.width,D.height,R.depth,0,D.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Z?e.texSubImage3D(r.TEXTURE_2D_ARRAY,Q,0,0,0,D.width,D.height,R.depth,z,rt,D.data):e.texImage3D(r.TEXTURE_2D_ARRAY,Q,j,D.width,D.height,R.depth,0,z,rt,D.data)}else{Z&&et&&e.texStorage2D(r.TEXTURE_2D,ot,j,tt[0].width,tt[0].height);for(let Q=0,St=tt.length;Q<St;Q++)D=tt[Q],F.format!==eo?z!==null?Z?e.compressedTexSubImage2D(r.TEXTURE_2D,Q,0,0,D.width,D.height,z,D.data):e.compressedTexImage2D(r.TEXTURE_2D,Q,j,D.width,D.height,0,D.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Z?e.texSubImage2D(r.TEXTURE_2D,Q,0,0,D.width,D.height,z,rt,D.data):e.texImage2D(r.TEXTURE_2D,Q,j,D.width,D.height,0,z,rt,D.data)}else if(F.isDataArrayTexture)Z?(et&&e.texStorage3D(r.TEXTURE_2D_ARRAY,ot,j,R.width,R.height,R.depth),e.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,R.width,R.height,R.depth,z,rt,R.data)):e.texImage3D(r.TEXTURE_2D_ARRAY,0,j,R.width,R.height,R.depth,0,z,rt,R.data);else if(F.isData3DTexture)Z?(et&&e.texStorage3D(r.TEXTURE_3D,ot,j,R.width,R.height,R.depth),e.texSubImage3D(r.TEXTURE_3D,0,0,0,0,R.width,R.height,R.depth,z,rt,R.data)):e.texImage3D(r.TEXTURE_3D,0,j,R.width,R.height,R.depth,0,z,rt,R.data);else if(F.isFramebufferTexture){if(et)if(Z)e.texStorage2D(r.TEXTURE_2D,ot,j,R.width,R.height);else{let Q=R.width,St=R.height;for(let At=0;At<ot;At++)e.texImage2D(r.TEXTURE_2D,At,j,Q,St,0,z,rt,null),Q>>=1,St>>=1}}else if(tt.length>0&&H){Z&&et&&e.texStorage2D(r.TEXTURE_2D,ot,j,tt[0].width,tt[0].height);for(let Q=0,St=tt.length;Q<St;Q++)D=tt[Q],Z?e.texSubImage2D(r.TEXTURE_2D,Q,0,0,z,rt,D):e.texImage2D(r.TEXTURE_2D,Q,j,z,rt,D);F.generateMipmaps=!1}else Z?(et&&e.texStorage2D(r.TEXTURE_2D,ot,j,R.width,R.height),e.texSubImage2D(r.TEXTURE_2D,0,0,0,z,rt,R)):e.texImage2D(r.TEXTURE_2D,0,j,z,rt,R);G(F,H)&&B(It),$t.__version=yt.version,F.onUpdate&&F.onUpdate(F)}X.__version=F.version}function Ct(X,F,J){if(F.image.length!==6)return;let It=Ft(X,F),wt=F.source;e.bindTexture(r.TEXTURE_CUBE_MAP,X.__webglTexture,r.TEXTURE0+J);let yt=o.get(wt);if(wt.version!==yt.__version||It===!0){e.activeTexture(r.TEXTURE0+J);let $t=Mn.getPrimaries(Mn.workingColorSpace),Dt=F.colorSpace===zi?null:Mn.getPrimaries(F.colorSpace),Y=F.colorSpace===zi||$t===Dt?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,F.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,F.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Y);let w=F.isCompressedTexture||F.image[0].isCompressedTexture,C=F.image[0]&&F.image[0].isDataTexture,R=[];for(let Q=0;Q<6;Q++)!w&&!C?R[Q]=S(F.image[Q],!1,!0,d):R[Q]=C?F.image[Q].image:F.image[Q],R[Q]=pn(F,R[Q]);let H=R[0],z=L(H)||f,rt=l.convert(F.format,F.colorSpace),j=l.convert(F.type),D=I(F.internalFormat,rt,j,F.colorSpace),tt=f&&F.isVideoTexture!==!0,Z=yt.__version===void 0||It===!0,et=O(F,H,z);Xt(r.TEXTURE_CUBE_MAP,F,z);let ot;if(w){tt&&Z&&e.texStorage2D(r.TEXTURE_CUBE_MAP,et,D,H.width,H.height);for(let Q=0;Q<6;Q++){ot=R[Q].mipmaps;for(let St=0;St<ot.length;St++){let At=ot[St];F.format!==eo?rt!==null?tt?e.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,St,0,0,At.width,At.height,rt,At.data):e.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,St,D,At.width,At.height,0,At.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):tt?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,St,0,0,At.width,At.height,rt,j,At.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,St,D,At.width,At.height,0,rt,j,At.data)}}}else{ot=F.mipmaps,tt&&Z&&(ot.length>0&&et++,e.texStorage2D(r.TEXTURE_CUBE_MAP,et,D,R[0].width,R[0].height));for(let Q=0;Q<6;Q++)if(C){tt?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,0,0,R[Q].width,R[Q].height,rt,j,R[Q].data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,D,R[Q].width,R[Q].height,0,rt,j,R[Q].data);for(let St=0;St<ot.length;St++){let ne=ot[St].image[Q].image;tt?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,St+1,0,0,ne.width,ne.height,rt,j,ne.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,St+1,D,ne.width,ne.height,0,rt,j,ne.data)}}else{tt?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,0,0,rt,j,R[Q]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,0,D,rt,j,R[Q]);for(let St=0;St<ot.length;St++){let At=ot[St];tt?e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,St+1,0,0,rt,j,At.image[Q]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Q,St+1,D,rt,j,At.image[Q])}}}G(F,z)&&B(r.TEXTURE_CUBE_MAP),yt.__version=wt.version,F.onUpdate&&F.onUpdate(F)}X.__version=F.version}function ee(X,F,J,It,wt,yt){let $t=l.convert(J.format,J.colorSpace),Dt=l.convert(J.type),Y=I(J.internalFormat,$t,Dt,J.colorSpace);if(!o.get(F).__hasExternalTextures){let C=Math.max(1,F.width>>yt),R=Math.max(1,F.height>>yt);wt===r.TEXTURE_3D||wt===r.TEXTURE_2D_ARRAY?e.texImage3D(wt,yt,Y,C,R,F.depth,0,$t,Dt,null):e.texImage2D(wt,yt,Y,C,R,0,$t,Dt,null)}e.bindFramebuffer(r.FRAMEBUFFER,X),te(F)?y.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,It,wt,o.get(J).__webglTexture,0,Pt(F)):(wt===r.TEXTURE_2D||wt>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&wt<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,It,wt,o.get(J).__webglTexture,yt),e.bindFramebuffer(r.FRAMEBUFFER,null)}function it(X,F,J){if(r.bindRenderbuffer(r.RENDERBUFFER,X),F.depthBuffer&&!F.stencilBuffer){let It=f===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(J||te(F)){let wt=F.depthTexture;wt&&wt.isDepthTexture&&(wt.type===ds?It=r.DEPTH_COMPONENT32F:wt.type===ps&&(It=r.DEPTH_COMPONENT24));let yt=Pt(F);te(F)?y.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,yt,It,F.width,F.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,yt,It,F.width,F.height)}else r.renderbufferStorage(r.RENDERBUFFER,It,F.width,F.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,X)}else if(F.depthBuffer&&F.stencilBuffer){let It=Pt(F);J&&te(F)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,It,r.DEPTH24_STENCIL8,F.width,F.height):te(F)?y.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,It,r.DEPTH24_STENCIL8,F.width,F.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,F.width,F.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,X)}else{let It=F.isWebGLMultipleRenderTargets===!0?F.texture:[F.texture];for(let wt=0;wt<It.length;wt++){let yt=It[wt],$t=l.convert(yt.format,yt.colorSpace),Dt=l.convert(yt.type),Y=I(yt.internalFormat,$t,Dt,yt.colorSpace),w=Pt(F);J&&te(F)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,w,Y,F.width,F.height):te(F)?y.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,w,Y,F.width,F.height):r.renderbufferStorage(r.RENDERBUFFER,Y,F.width,F.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function rn(X,F){if(F&&F.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(r.FRAMEBUFFER,X),!(F.depthTexture&&F.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!o.get(F.depthTexture).__webglTexture||F.depthTexture.image.width!==F.width||F.depthTexture.image.height!==F.height)&&(F.depthTexture.image.width=F.width,F.depthTexture.image.height=F.height,F.depthTexture.needsUpdate=!0),k(F.depthTexture,0);let It=o.get(F.depthTexture).__webglTexture,wt=Pt(F);if(F.depthTexture.format===Ys)te(F)?y.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,It,0,wt):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,It,0);else if(F.depthTexture.format===qa)te(F)?y.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,It,0,wt):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,It,0);else throw new Error("Unknown depthTexture format")}function Bt(X){let F=o.get(X),J=X.isWebGLCubeRenderTarget===!0;if(X.depthTexture&&!F.__autoAllocateDepthBuffer){if(J)throw new Error("target.depthTexture not supported in Cube render targets");rn(F.__webglFramebuffer,X)}else if(J){F.__webglDepthbuffer=[];for(let It=0;It<6;It++)e.bindFramebuffer(r.FRAMEBUFFER,F.__webglFramebuffer[It]),F.__webglDepthbuffer[It]=r.createRenderbuffer(),it(F.__webglDepthbuffer[It],X,!1)}else e.bindFramebuffer(r.FRAMEBUFFER,F.__webglFramebuffer),F.__webglDepthbuffer=r.createRenderbuffer(),it(F.__webglDepthbuffer,X,!1);e.bindFramebuffer(r.FRAMEBUFFER,null)}function Jt(X,F,J){let It=o.get(X);F!==void 0&&ee(It.__webglFramebuffer,X,X.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),J!==void 0&&Bt(X)}function Yt(X){let F=X.texture,J=o.get(X),It=o.get(F);X.addEventListener("dispose",V),X.isWebGLMultipleRenderTargets!==!0&&(It.__webglTexture===void 0&&(It.__webglTexture=r.createTexture()),It.__version=F.version,h.memory.textures++);let wt=X.isWebGLCubeRenderTarget===!0,yt=X.isWebGLMultipleRenderTargets===!0,$t=L(X)||f;if(wt){J.__webglFramebuffer=[];for(let Dt=0;Dt<6;Dt++)if(f&&F.mipmaps&&F.mipmaps.length>0){J.__webglFramebuffer[Dt]=[];for(let Y=0;Y<F.mipmaps.length;Y++)J.__webglFramebuffer[Dt][Y]=r.createFramebuffer()}else J.__webglFramebuffer[Dt]=r.createFramebuffer()}else{if(f&&F.mipmaps&&F.mipmaps.length>0){J.__webglFramebuffer=[];for(let Dt=0;Dt<F.mipmaps.length;Dt++)J.__webglFramebuffer[Dt]=r.createFramebuffer()}else J.__webglFramebuffer=r.createFramebuffer();if(yt)if(a.drawBuffers){let Dt=X.texture;for(let Y=0,w=Dt.length;Y<w;Y++){let C=o.get(Dt[Y]);C.__webglTexture===void 0&&(C.__webglTexture=r.createTexture(),h.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(f&&X.samples>0&&te(X)===!1){let Dt=yt?F:[F];J.__webglMultisampledFramebuffer=r.createFramebuffer(),J.__webglColorRenderbuffer=[],e.bindFramebuffer(r.FRAMEBUFFER,J.__webglMultisampledFramebuffer);for(let Y=0;Y<Dt.length;Y++){let w=Dt[Y];J.__webglColorRenderbuffer[Y]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,J.__webglColorRenderbuffer[Y]);let C=l.convert(w.format,w.colorSpace),R=l.convert(w.type),H=I(w.internalFormat,C,R,w.colorSpace,X.isXRRenderTarget===!0),z=Pt(X);r.renderbufferStorageMultisample(r.RENDERBUFFER,z,H,X.width,X.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Y,r.RENDERBUFFER,J.__webglColorRenderbuffer[Y])}r.bindRenderbuffer(r.RENDERBUFFER,null),X.depthBuffer&&(J.__webglDepthRenderbuffer=r.createRenderbuffer(),it(J.__webglDepthRenderbuffer,X,!0)),e.bindFramebuffer(r.FRAMEBUFFER,null)}}if(wt){e.bindTexture(r.TEXTURE_CUBE_MAP,It.__webglTexture),Xt(r.TEXTURE_CUBE_MAP,F,$t);for(let Dt=0;Dt<6;Dt++)if(f&&F.mipmaps&&F.mipmaps.length>0)for(let Y=0;Y<F.mipmaps.length;Y++)ee(J.__webglFramebuffer[Dt][Y],X,F,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Dt,Y);else ee(J.__webglFramebuffer[Dt],X,F,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Dt,0);G(F,$t)&&B(r.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(yt){let Dt=X.texture;for(let Y=0,w=Dt.length;Y<w;Y++){let C=Dt[Y],R=o.get(C);e.bindTexture(r.TEXTURE_2D,R.__webglTexture),Xt(r.TEXTURE_2D,C,$t),ee(J.__webglFramebuffer,X,C,r.COLOR_ATTACHMENT0+Y,r.TEXTURE_2D,0),G(C,$t)&&B(r.TEXTURE_2D)}e.unbindTexture()}else{let Dt=r.TEXTURE_2D;if((X.isWebGL3DRenderTarget||X.isWebGLArrayRenderTarget)&&(f?Dt=X.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),e.bindTexture(Dt,It.__webglTexture),Xt(Dt,F,$t),f&&F.mipmaps&&F.mipmaps.length>0)for(let Y=0;Y<F.mipmaps.length;Y++)ee(J.__webglFramebuffer[Y],X,F,r.COLOR_ATTACHMENT0,Dt,Y);else ee(J.__webglFramebuffer,X,F,r.COLOR_ATTACHMENT0,Dt,0);G(F,$t)&&B(Dt),e.unbindTexture()}X.depthBuffer&&Bt(X)}function pe(X){let F=L(X)||f,J=X.isWebGLMultipleRenderTargets===!0?X.texture:[X.texture];for(let It=0,wt=J.length;It<wt;It++){let yt=J[It];if(G(yt,F)){let $t=X.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,Dt=o.get(yt).__webglTexture;e.bindTexture($t,Dt),B($t),e.unbindTexture()}}}function le(X){if(f&&X.samples>0&&te(X)===!1){let F=X.isWebGLMultipleRenderTargets?X.texture:[X.texture],J=X.width,It=X.height,wt=r.COLOR_BUFFER_BIT,yt=[],$t=X.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Dt=o.get(X),Y=X.isWebGLMultipleRenderTargets===!0;if(Y)for(let w=0;w<F.length;w++)e.bindFramebuffer(r.FRAMEBUFFER,Dt.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+w,r.RENDERBUFFER,null),e.bindFramebuffer(r.FRAMEBUFFER,Dt.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+w,r.TEXTURE_2D,null,0);e.bindFramebuffer(r.READ_FRAMEBUFFER,Dt.__webglMultisampledFramebuffer),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,Dt.__webglFramebuffer);for(let w=0;w<F.length;w++){yt.push(r.COLOR_ATTACHMENT0+w),X.depthBuffer&&yt.push($t);let C=Dt.__ignoreDepthValues!==void 0?Dt.__ignoreDepthValues:!1;if(C===!1&&(X.depthBuffer&&(wt|=r.DEPTH_BUFFER_BIT),X.stencilBuffer&&(wt|=r.STENCIL_BUFFER_BIT)),Y&&r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Dt.__webglColorRenderbuffer[w]),C===!0&&(r.invalidateFramebuffer(r.READ_FRAMEBUFFER,[$t]),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[$t])),Y){let R=o.get(F[w]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,R,0)}r.blitFramebuffer(0,0,J,It,0,0,J,It,wt,r.NEAREST),M&&r.invalidateFramebuffer(r.READ_FRAMEBUFFER,yt)}if(e.bindFramebuffer(r.READ_FRAMEBUFFER,null),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Y)for(let w=0;w<F.length;w++){e.bindFramebuffer(r.FRAMEBUFFER,Dt.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+w,r.RENDERBUFFER,Dt.__webglColorRenderbuffer[w]);let C=o.get(F[w]).__webglTexture;e.bindFramebuffer(r.FRAMEBUFFER,Dt.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+w,r.TEXTURE_2D,C,0)}e.bindFramebuffer(r.DRAW_FRAMEBUFFER,Dt.__webglMultisampledFramebuffer)}}function Pt(X){return Math.min(_,X.samples)}function te(X){let F=o.get(X);return f&&X.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&F.__useRenderToTexture!==!1}function yn(X){let F=h.render.frame;b.get(X)!==F&&(b.set(X,F),X.update())}function pn(X,F){let J=X.colorSpace,It=X.format,wt=X.type;return X.isCompressedTexture===!0||X.isVideoTexture===!0||X.format===gf||J!==Zo&&J!==zi&&(Mn.getTransfer(J)===Dn?f===!1?t.has("EXT_sRGB")===!0&&It===eo?(X.format=gf,X.minFilter=Bi,X.generateMipmaps=!1):F=Ql.sRGBToLinear(F):(It!==eo||wt!==ys)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",J)),F}this.allocateTextureUnit=lt,this.resetTextureUnits=mt,this.setTexture2D=k,this.setTexture2DArray=nt,this.setTexture3D=ft,this.setTextureCube=Tt,this.rebindTextures=Jt,this.setupRenderTarget=Yt,this.updateRenderTargetMipmap=pe,this.updateMultisampleRenderTarget=le,this.setupDepthRenderbuffer=Bt,this.setupFrameBufferTexture=ee,this.useMultisampledRTT=te}function kb(r,t,e){let o=e.isWebGL2;function a(l,h=zi){let f,p=Mn.getTransfer(h);if(l===ys)return r.UNSIGNED_BYTE;if(l===n0)return r.UNSIGNED_SHORT_4_4_4_4;if(l===r0)return r.UNSIGNED_SHORT_5_5_5_1;if(l===Nx)return r.BYTE;if(l===Ox)return r.SHORT;if(l===Jf)return r.UNSIGNED_SHORT;if(l===e0)return r.INT;if(l===ps)return r.UNSIGNED_INT;if(l===ds)return r.FLOAT;if(l===zu)return o?r.HALF_FLOAT:(f=t.get("OES_texture_half_float"),f!==null?f.HALF_FLOAT_OES:null);if(l===Dx)return r.ALPHA;if(l===eo)return r.RGBA;if(l===Fx)return r.LUMINANCE;if(l===Ux)return r.LUMINANCE_ALPHA;if(l===Ys)return r.DEPTH_COMPONENT;if(l===qa)return r.DEPTH_STENCIL;if(l===gf)return f=t.get("EXT_sRGB"),f!==null?f.SRGB_ALPHA_EXT:null;if(l===Bx)return r.RED;if(l===i0)return r.RED_INTEGER;if(l===zx)return r.RG;if(l===o0)return r.RG_INTEGER;if(l===s0)return r.RGBA_INTEGER;if(l===Dh||l===Fh||l===Uh||l===Bh)if(p===Dn)if(f=t.get("WEBGL_compressed_texture_s3tc_srgb"),f!==null){if(l===Dh)return f.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(l===Fh)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(l===Uh)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(l===Bh)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(f=t.get("WEBGL_compressed_texture_s3tc"),f!==null){if(l===Dh)return f.COMPRESSED_RGB_S3TC_DXT1_EXT;if(l===Fh)return f.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(l===Uh)return f.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(l===Bh)return f.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(l===Fm||l===Um||l===Bm||l===zm)if(f=t.get("WEBGL_compressed_texture_pvrtc"),f!==null){if(l===Fm)return f.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(l===Um)return f.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(l===Bm)return f.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(l===zm)return f.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(l===kx)return f=t.get("WEBGL_compressed_texture_etc1"),f!==null?f.COMPRESSED_RGB_ETC1_WEBGL:null;if(l===km||l===Gm)if(f=t.get("WEBGL_compressed_texture_etc"),f!==null){if(l===km)return p===Dn?f.COMPRESSED_SRGB8_ETC2:f.COMPRESSED_RGB8_ETC2;if(l===Gm)return p===Dn?f.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:f.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(l===Vm||l===Hm||l===Wm||l===qm||l===Xm||l===Ym||l===$m||l===Zm||l===Jm||l===Km||l===jm||l===Qm||l===tg||l===eg)if(f=t.get("WEBGL_compressed_texture_astc"),f!==null){if(l===Vm)return p===Dn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:f.COMPRESSED_RGBA_ASTC_4x4_KHR;if(l===Hm)return p===Dn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:f.COMPRESSED_RGBA_ASTC_5x4_KHR;if(l===Wm)return p===Dn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:f.COMPRESSED_RGBA_ASTC_5x5_KHR;if(l===qm)return p===Dn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:f.COMPRESSED_RGBA_ASTC_6x5_KHR;if(l===Xm)return p===Dn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:f.COMPRESSED_RGBA_ASTC_6x6_KHR;if(l===Ym)return p===Dn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:f.COMPRESSED_RGBA_ASTC_8x5_KHR;if(l===$m)return p===Dn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:f.COMPRESSED_RGBA_ASTC_8x6_KHR;if(l===Zm)return p===Dn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:f.COMPRESSED_RGBA_ASTC_8x8_KHR;if(l===Jm)return p===Dn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:f.COMPRESSED_RGBA_ASTC_10x5_KHR;if(l===Km)return p===Dn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:f.COMPRESSED_RGBA_ASTC_10x6_KHR;if(l===jm)return p===Dn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:f.COMPRESSED_RGBA_ASTC_10x8_KHR;if(l===Qm)return p===Dn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:f.COMPRESSED_RGBA_ASTC_10x10_KHR;if(l===tg)return p===Dn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:f.COMPRESSED_RGBA_ASTC_12x10_KHR;if(l===eg)return p===Dn?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:f.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(l===zh||l===ng||l===rg)if(f=t.get("EXT_texture_compression_bptc"),f!==null){if(l===zh)return p===Dn?f.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:f.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(l===ng)return f.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(l===rg)return f.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(l===Gx||l===ig||l===og||l===sg)if(f=t.get("EXT_texture_compression_rgtc"),f!==null){if(l===zh)return f.COMPRESSED_RED_RGTC1_EXT;if(l===ig)return f.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(l===og)return f.COMPRESSED_RED_GREEN_RGTC2_EXT;if(l===sg)return f.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return l===Xs?o?r.UNSIGNED_INT_24_8:(f=t.get("WEBGL_depth_texture"),f!==null?f.UNSIGNED_INT_24_8_WEBGL:null):r[l]!==void 0?r[l]:null}return{convert:a}}var Of=class extends Ti{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}},za=class extends yo{constructor(){super(),this.isGroup=!0,this.type="Group"}},Gb={type:"move"},Uu=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new za,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 za,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new vt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new vt),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new za,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new vt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new vt),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,h=null,f=this._targetRay,p=this._grip,d=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(d&&t.hand){h=!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,b=.005;d.inputState.pinching&&y>M+b?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!d.inputState.pinching&&y<=M-b&&(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));f!==null&&(a=e.getPose(t.targetRaySpace,o),a===null&&l!==null&&(a=l),a!==null&&(f.matrix.fromArray(a.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,a.linearVelocity?(f.hasLinearVelocity=!0,f.linearVelocity.copy(a.linearVelocity)):f.hasLinearVelocity=!1,a.angularVelocity?(f.hasAngularVelocity=!0,f.angularVelocity.copy(a.angularVelocity)):f.hasAngularVelocity=!1,this.dispatchEvent(Gb)))}return f!==null&&(f.visible=a!==null),p!==null&&(p.visible=l!==null),d!==null&&(d.visible=h!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let o=new za;o.matrixAutoUpdate=!1,o.visible=!1,t.joints[e.jointName]=o,t.add(o)}return t.joints[e.jointName]}},Df=class extends no{constructor(t,e,o,a,l,h,f,p,d,g){if(g=g!==void 0?g:Ys,g!==Ys&&g!==qa)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");o===void 0&&g===Ys&&(o=ps),o===void 0&&g===qa&&(o=Xs),super(null,a,l,h,f,p,g,o,d),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=f!==void 0?f:ri,this.minFilter=p!==void 0?p:ri,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}},Ff=class extends _s{constructor(t,e){super();let o=this,a=null,l=1,h=null,f="local-floor",p=1,d=null,g=null,_=null,y=null,M=null,b=null,T=e.getContextAttributes(),x=null,v=null,P=[],S=[],L=new Ti;L.layers.enable(1),L.viewport=new Dr;let N=new Ti;N.layers.enable(2),N.viewport=new Dr;let G=[L,N],B=new Of;B.layers.enable(1),B.layers.enable(2);let I=null,O=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(nt){let ft=P[nt];return ft===void 0&&(ft=new Uu,P[nt]=ft),ft.getTargetRaySpace()},this.getControllerGrip=function(nt){let ft=P[nt];return ft===void 0&&(ft=new Uu,P[nt]=ft),ft.getGripSpace()},this.getHand=function(nt){let ft=P[nt];return ft===void 0&&(ft=new Uu,P[nt]=ft),ft.getHandSpace()};function q(nt){let ft=S.indexOf(nt.inputSource);if(ft===-1)return;let Tt=P[ft];Tt!==void 0&&(Tt.update(nt.inputSource,nt.frame,d||h),Tt.dispatchEvent({type:nt.type,data:nt.inputSource}))}function st(){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",st),a.removeEventListener("inputsourceschange",V);for(let nt=0;nt<P.length;nt++){let ft=S[nt];ft!==null&&(S[nt]=null,P[nt].disconnect(ft))}I=null,O=null,t.setRenderTarget(x),M=null,y=null,_=null,a=null,v=null,k.stop(),o.isPresenting=!1,o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(nt){l=nt,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(nt){f=nt,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||h},this.setReferenceSpace=function(nt){d=nt},this.getBaseLayer=function(){return y!==null?y:M},this.getBinding=function(){return _},this.getFrame=function(){return b},this.getSession=function(){return a},this.setSession=async function(nt){if(a=nt,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",st),a.addEventListener("inputsourceschange",V),T.xrCompatible!==!0&&await e.makeXRCompatible(),a.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let ft={antialias:a.renderState.layers===void 0?T.antialias:!0,alpha:!0,depth:T.depth,stencil:T.stencil,framebufferScaleFactor:l};M=new XRWebGLLayer(a,e,ft),a.updateRenderState({baseLayer:M}),v=new Jo(M.framebufferWidth,M.framebufferHeight,{format:eo,type:ys,colorSpace:t.outputColorSpace,stencilBuffer:T.stencil})}else{let ft=null,Tt=null,gt=null;T.depth&&(gt=T.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,ft=T.stencil?qa:Ys,Tt=T.stencil?Xs:ps);let Lt={colorFormat:e.RGBA8,depthFormat:gt,scaleFactor:l};_=new XRWebGLBinding(a,e),y=_.createProjectionLayer(Lt),a.updateRenderState({layers:[y]}),v=new Jo(y.textureWidth,y.textureHeight,{format:eo,type:ys,depthTexture:new Df(y.textureWidth,y.textureHeight,Tt,void 0,void 0,void 0,void 0,void 0,void 0,ft),stencilBuffer:T.stencil,colorSpace:t.outputColorSpace,samples:T.antialias?4:0});let qt=t.properties.get(v);qt.__ignoreDepthValues=y.ignoreDepthValues}v.isXRRenderTarget=!0,this.setFoveation(p),d=null,h=await a.requestReferenceSpace(f),k.setContext(a),k.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(a!==null)return a.environmentBlendMode};function V(nt){for(let ft=0;ft<nt.removed.length;ft++){let Tt=nt.removed[ft],gt=S.indexOf(Tt);gt>=0&&(S[gt]=null,P[gt].disconnect(Tt))}for(let ft=0;ft<nt.added.length;ft++){let Tt=nt.added[ft],gt=S.indexOf(Tt);if(gt===-1){for(let qt=0;qt<P.length;qt++)if(qt>=S.length){S.push(Tt),gt=qt;break}else if(S[qt]===null){S[qt]=Tt,gt=qt;break}if(gt===-1)break}let Lt=P[gt];Lt&&Lt.connect(Tt)}}let Mt=new vt,$=new vt;function ut(nt,ft,Tt){Mt.setFromMatrixPosition(ft.matrixWorld),$.setFromMatrixPosition(Tt.matrixWorld);let gt=Mt.distanceTo($),Lt=ft.projectionMatrix.elements,qt=Tt.projectionMatrix.elements,Xt=Lt[14]/(Lt[10]-1),Ft=Lt[14]/(Lt[10]+1),Qt=(Lt[9]+1)/Lt[5],Ct=(Lt[9]-1)/Lt[5],ee=(Lt[8]-1)/Lt[0],it=(qt[8]+1)/qt[0],rn=Xt*ee,Bt=Xt*it,Jt=gt/(-ee+it),Yt=Jt*-ee;ft.matrixWorld.decompose(nt.position,nt.quaternion,nt.scale),nt.translateX(Yt),nt.translateZ(Jt),nt.matrixWorld.compose(nt.position,nt.quaternion,nt.scale),nt.matrixWorldInverse.copy(nt.matrixWorld).invert();let pe=Xt+Jt,le=Ft+Jt,Pt=rn-Yt,te=Bt+(gt-Yt),yn=Qt*Ft/le*pe,pn=Ct*Ft/le*pe;nt.projectionMatrix.makePerspective(Pt,te,yn,pn,pe,le),nt.projectionMatrixInverse.copy(nt.projectionMatrix).invert()}function xt(nt,ft){ft===null?nt.matrixWorld.copy(nt.matrix):nt.matrixWorld.multiplyMatrices(ft.matrixWorld,nt.matrix),nt.matrixWorldInverse.copy(nt.matrixWorld).invert()}this.updateCamera=function(nt){if(a===null)return;B.near=N.near=L.near=nt.near,B.far=N.far=L.far=nt.far,(I!==B.near||O!==B.far)&&(a.updateRenderState({depthNear:B.near,depthFar:B.far}),I=B.near,O=B.far);let ft=nt.parent,Tt=B.cameras;xt(B,ft);for(let gt=0;gt<Tt.length;gt++)xt(Tt[gt],ft);Tt.length===2?ut(B,L,N):B.projectionMatrix.copy(L.projectionMatrix),mt(nt,B,ft)};function mt(nt,ft,Tt){Tt===null?nt.matrix.copy(ft.matrixWorld):(nt.matrix.copy(Tt.matrixWorld),nt.matrix.invert(),nt.matrix.multiply(ft.matrixWorld)),nt.matrix.decompose(nt.position,nt.quaternion,nt.scale),nt.updateMatrixWorld(!0),nt.projectionMatrix.copy(ft.projectionMatrix),nt.projectionMatrixInverse.copy(ft.projectionMatrixInverse),nt.isPerspectiveCamera&&(nt.fov=yf*2*Math.atan(1/nt.projectionMatrix.elements[5]),nt.zoom=1)}this.getCamera=function(){return B},this.getFoveation=function(){if(!(y===null&&M===null))return p},this.setFoveation=function(nt){p=nt,y!==null&&(y.fixedFoveation=nt),M!==null&&M.fixedFoveation!==void 0&&(M.fixedFoveation=nt)};let lt=null;function ht(nt,ft){if(g=ft.getViewerPose(d||h),b=ft,g!==null){let Tt=g.views;M!==null&&(t.setRenderTargetFramebuffer(v,M.framebuffer),t.setRenderTarget(v));let gt=!1;Tt.length!==B.cameras.length&&(B.cameras.length=0,gt=!0);for(let Lt=0;Lt<Tt.length;Lt++){let qt=Tt[Lt],Xt=null;if(M!==null)Xt=M.getViewport(qt);else{let Qt=_.getViewSubImage(y,qt);Xt=Qt.viewport,Lt===0&&(t.setRenderTargetTextures(v,Qt.colorTexture,y.ignoreDepthValues?void 0:Qt.depthStencilTexture),t.setRenderTarget(v))}let Ft=G[Lt];Ft===void 0&&(Ft=new Ti,Ft.layers.enable(Lt),Ft.viewport=new Dr,G[Lt]=Ft),Ft.matrix.fromArray(qt.transform.matrix),Ft.matrix.decompose(Ft.position,Ft.quaternion,Ft.scale),Ft.projectionMatrix.fromArray(qt.projectionMatrix),Ft.projectionMatrixInverse.copy(Ft.projectionMatrix).invert(),Ft.viewport.set(Xt.x,Xt.y,Xt.width,Xt.height),Lt===0&&(B.matrix.copy(Ft.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),gt===!0&&B.cameras.push(Ft)}}for(let Tt=0;Tt<P.length;Tt++){let gt=S[Tt],Lt=P[Tt];gt!==null&&Lt!==void 0&&Lt.update(gt,ft,d||h)}lt&<(nt,ft),ft.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:ft}),b=null}let k=new h0;k.setAnimationLoop(ht),this.setAnimationLoop=function(nt){lt=nt},this.dispose=function(){}}};function Vb(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,c0(r)),v.isFog?(x.fogNear.value=v.near,x.fogFar.value=v.far):v.isFogExp2&&(x.fogDensity.value=v.density)}function a(x,v,P,S,L){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,L)):v.isMeshMatcapMaterial?(l(x,v),b(x,v)):v.isMeshDepthMaterial?l(x,v):v.isMeshDistanceMaterial?(l(x,v),T(x,v)):v.isMeshNormalMaterial?l(x,v):v.isLineBasicMaterial?(h(x,v),v.isLineDashedMaterial&&f(x,v)):v.isPointsMaterial?p(x,v,P,S):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===di&&(x.bumpScale.value*=-1)),v.normalMap&&(x.normalMap.value=v.normalMap,e(v.normalMap,x.normalMapTransform),x.normalScale.value.copy(v.normalScale),v.side===di&&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 P=t.get(v).envMap;if(P&&(x.envMap.value=P,x.flipEnvMap.value=P.isCubeTexture&&P.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 S=r._useLegacyLights===!0?Math.PI:1;x.lightMapIntensity.value=v.lightMapIntensity*S,e(v.lightMap,x.lightMapTransform)}v.aoMap&&(x.aoMap.value=v.aoMap,x.aoMapIntensity.value=v.aoMapIntensity,e(v.aoMap,x.aoMapTransform))}function h(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 f(x,v){x.dashSize.value=v.dashSize,x.totalSize.value=v.dashSize+v.gapSize,x.scale.value=v.scale}function p(x,v,P,S){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.size.value=v.size*P,x.scale.value=S*.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,P){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===di&&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=P.texture,x.transmissionSamplerSize.value.set(P.width,P.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 b(x,v){v.matcap&&(x.matcap.value=v.matcap)}function T(x,v){let P=t.get(v).light;x.referencePosition.value.setFromMatrixPosition(P.matrixWorld),x.nearDistance.value=P.shadow.camera.near,x.farDistance.value=P.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:a}}function Hb(r,t,e,o){let a={},l={},h=[],f=e.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function p(P,S){let L=S.program;o.uniformBlockBinding(P,L)}function d(P,S){let L=a[P.id];L===void 0&&(b(P),L=g(P),a[P.id]=L,P.addEventListener("dispose",x));let N=S.program;o.updateUBOMapping(P,N);let G=t.render.frame;l[P.id]!==G&&(y(P),l[P.id]=G)}function g(P){let S=_();P.__bindingPointIndex=S;let L=r.createBuffer(),N=P.__size,G=P.usage;return r.bindBuffer(r.UNIFORM_BUFFER,L),r.bufferData(r.UNIFORM_BUFFER,N,G),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,S,L),L}function _(){for(let P=0;P<f;P++)if(h.indexOf(P)===-1)return h.push(P),P;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function y(P){let S=a[P.id],L=P.uniforms,N=P.__cache;r.bindBuffer(r.UNIFORM_BUFFER,S);for(let G=0,B=L.length;G<B;G++){let I=L[G];if(M(I,G,N)===!0){let O=I.__offset,q=Array.isArray(I.value)?I.value:[I.value],st=0;for(let V=0;V<q.length;V++){let Mt=q[V],$=T(Mt);typeof Mt=="number"?(I.__data[0]=Mt,r.bufferSubData(r.UNIFORM_BUFFER,O+st,I.__data)):Mt.isMatrix3?(I.__data[0]=Mt.elements[0],I.__data[1]=Mt.elements[1],I.__data[2]=Mt.elements[2],I.__data[3]=Mt.elements[0],I.__data[4]=Mt.elements[3],I.__data[5]=Mt.elements[4],I.__data[6]=Mt.elements[5],I.__data[7]=Mt.elements[0],I.__data[8]=Mt.elements[6],I.__data[9]=Mt.elements[7],I.__data[10]=Mt.elements[8],I.__data[11]=Mt.elements[0]):(Mt.toArray(I.__data,st),st+=$.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,O,I.__data)}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function M(P,S,L){let N=P.value;if(L[S]===void 0){if(typeof N=="number")L[S]=N;else{let G=Array.isArray(N)?N:[N],B=[];for(let I=0;I<G.length;I++)B.push(G[I].clone());L[S]=B}return!0}else if(typeof N=="number"){if(L[S]!==N)return L[S]=N,!0}else{let G=Array.isArray(L[S])?L[S]:[L[S]],B=Array.isArray(N)?N:[N];for(let I=0;I<G.length;I++){let O=G[I];if(O.equals(B[I])===!1)return O.copy(B[I]),!0}}return!1}function b(P){let S=P.uniforms,L=0,N=16,G=0;for(let B=0,I=S.length;B<I;B++){let O=S[B],q={boundary:0,storage:0},st=Array.isArray(O.value)?O.value:[O.value];for(let V=0,Mt=st.length;V<Mt;V++){let $=st[V],ut=T($);q.boundary+=ut.boundary,q.storage+=ut.storage}if(O.__data=new Float32Array(q.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=L,B>0){G=L%N;let V=N-G;G!==0&&V-q.boundary<0&&(L+=N-G,O.__offset=L)}L+=q.storage}return G=L%N,G>0&&(L+=N-G),P.__size=L,P.__cache={},this}function T(P){let S={boundary:0,storage:0};return typeof P=="number"?(S.boundary=4,S.storage=4):P.isVector2?(S.boundary=8,S.storage=8):P.isVector3||P.isColor?(S.boundary=16,S.storage=12):P.isVector4?(S.boundary=16,S.storage=16):P.isMatrix3?(S.boundary=48,S.storage=48):P.isMatrix4?(S.boundary=64,S.storage=64):P.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",P),S}function x(P){let S=P.target;S.removeEventListener("dispose",x);let L=h.indexOf(S.__bindingPointIndex);h.splice(L,1),r.deleteBuffer(a[S.id]),delete a[S.id],delete l[S.id]}function v(){for(let P in a)r.deleteBuffer(a[P]);h=[],a={},l={}}return{bind:p,update:d,dispose:v}}var Uf=class{constructor(t={}){let{canvas:e=nE(),context:o=null,depth:a=!0,stencil:l=!0,alpha:h=!1,antialias:f=!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=h;let M=new Uint32Array(4),b=new Int32Array(4),T=null,x=null,v=[],P=[];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=Or,this._useLegacyLights=!1,this.toneMapping=gs,this.toneMappingExposure=1;let S=this,L=!1,N=0,G=0,B=null,I=-1,O=null,q=new Dr,st=new Dr,V=null,Mt=new An(0),$=0,ut=e.width,xt=e.height,mt=1,lt=null,ht=null,k=new Dr(0,0,ut,xt),nt=new Dr(0,0,ut,xt),ft=!1,Tt=new lc,gt=!1,Lt=!1,qt=null,Xt=new Yr,Ft=new fn,Qt=new vt,Ct={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ee(){return B===null?mt:1}let it=o;function rn(W,at){for(let _t=0;_t<W.length;_t++){let ct=W[_t],Et=e.getContext(ct,at);if(Et!==null)return Et}return null}try{let W={alpha:!0,depth:a,stencil:l,antialias:f,premultipliedAlpha:p,preserveDrawingBuffer:d,powerPreference:g,failIfMajorPerformanceCaveat:_};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Zf}`),e.addEventListener("webglcontextlost",tt,!1),e.addEventListener("webglcontextrestored",Z,!1),e.addEventListener("webglcontextcreationerror",et,!1),it===null){let at=["webgl2","webgl","experimental-webgl"];if(S.isWebGL1Renderer===!0&&at.shift(),it=rn(at,W),it===null)throw rn(at)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&it instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),it.getShaderPrecisionFormat===void 0&&(it.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(W){throw console.error("THREE.WebGLRenderer: "+W.message),W}let Bt,Jt,Yt,pe,le,Pt,te,yn,pn,X,F,J,It,wt,yt,$t,Dt,Y,w,C,R,H,z,rt;function j(){Bt=new cw(it),Jt=new iw(it,Bt,t),Bt.init(Jt),H=new kb(it,Bt,Jt),Yt=new Bb(it,Bt,Jt),pe=new pw(it),le=new Tb,Pt=new zb(it,Bt,Yt,le,Jt,H,pe),te=new sw(S),yn=new lw(S),pn=new SE(it,Jt),z=new nw(it,Bt,pn,Jt),X=new hw(it,pn,pe,z),F=new yw(it,X,pn,pe),w=new gw(it,Jt,Pt),$t=new ow(le),J=new bb(S,te,yn,Bt,Jt,z,$t),It=new Vb(S,le),wt=new Cb,yt=new Ob(Bt,Jt),Y=new ew(S,te,yn,Yt,F,y,p),Dt=new Ub(S,F,Jt),rt=new Hb(it,pe,Jt,Yt),C=new rw(it,Bt,pe,Jt),R=new fw(it,Bt,pe,Jt),pe.programs=J.programs,S.capabilities=Jt,S.extensions=Bt,S.properties=le,S.renderLists=wt,S.shadowMap=Dt,S.state=Yt,S.info=pe}j();let D=new Ff(S,it);this.xr=D,this.getContext=function(){return it},this.getContextAttributes=function(){return it.getContextAttributes()},this.forceContextLoss=function(){let W=Bt.get("WEBGL_lose_context");W&&W.loseContext()},this.forceContextRestore=function(){let W=Bt.get("WEBGL_lose_context");W&&W.restoreContext()},this.getPixelRatio=function(){return mt},this.setPixelRatio=function(W){W!==void 0&&(mt=W,this.setSize(ut,xt,!1))},this.getSize=function(W){return W.set(ut,xt)},this.setSize=function(W,at,_t=!0){if(D.isPresenting){console.warn("THREE.WebGLRenderer: Can\'t change size while VR device is presenting.");return}ut=W,xt=at,e.width=Math.floor(W*mt),e.height=Math.floor(at*mt),_t===!0&&(e.style.width=W+"px",e.style.height=at+"px"),this.setViewport(0,0,W,at)},this.getDrawingBufferSize=function(W){return W.set(ut*mt,xt*mt).floor()},this.setDrawingBufferSize=function(W,at,_t){ut=W,xt=at,mt=_t,e.width=Math.floor(W*_t),e.height=Math.floor(at*_t),this.setViewport(0,0,W,at)},this.getCurrentViewport=function(W){return W.copy(q)},this.getViewport=function(W){return W.copy(k)},this.setViewport=function(W,at,_t,ct){W.isVector4?k.set(W.x,W.y,W.z,W.w):k.set(W,at,_t,ct),Yt.viewport(q.copy(k).multiplyScalar(mt).floor())},this.getScissor=function(W){return W.copy(nt)},this.setScissor=function(W,at,_t,ct){W.isVector4?nt.set(W.x,W.y,W.z,W.w):nt.set(W,at,_t,ct),Yt.scissor(st.copy(nt).multiplyScalar(mt).floor())},this.getScissorTest=function(){return ft},this.setScissorTest=function(W){Yt.setScissorTest(ft=W)},this.setOpaqueSort=function(W){lt=W},this.setTransparentSort=function(W){ht=W},this.getClearColor=function(W){return W.copy(Y.getClearColor())},this.setClearColor=function(){Y.setClearColor.apply(Y,arguments)},this.getClearAlpha=function(){return Y.getClearAlpha()},this.setClearAlpha=function(){Y.setClearAlpha.apply(Y,arguments)},this.clear=function(W=!0,at=!0,_t=!0){let ct=0;if(W){let Et=!1;if(B!==null){let Nt=B.texture.format;Et=Nt===s0||Nt===o0||Nt===i0}if(Et){let Nt=B.texture.type,zt=Nt===ys||Nt===ps||Nt===Jf||Nt===Xs||Nt===n0||Nt===r0,oe=Y.getClearColor(),Kt=Y.getClearAlpha(),ce=oe.r,Wt=oe.g,he=oe.b;zt?(M[0]=ce,M[1]=Wt,M[2]=he,M[3]=Kt,it.clearBufferuiv(it.COLOR,0,M)):(b[0]=ce,b[1]=Wt,b[2]=he,b[3]=Kt,it.clearBufferiv(it.COLOR,0,b))}else ct|=it.COLOR_BUFFER_BIT}at&&(ct|=it.DEPTH_BUFFER_BIT),_t&&(ct|=it.STENCIL_BUFFER_BIT),it.clear(ct)},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",tt,!1),e.removeEventListener("webglcontextrestored",Z,!1),e.removeEventListener("webglcontextcreationerror",et,!1),wt.dispose(),yt.dispose(),le.dispose(),te.dispose(),yn.dispose(),F.dispose(),z.dispose(),rt.dispose(),J.dispose(),D.dispose(),D.removeEventListener("sessionstart",Gt),D.removeEventListener("sessionend",He),qt&&(qt.dispose(),qt=null),tn.stop()};function tt(W){W.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),L=!0}function Z(){console.log("THREE.WebGLRenderer: Context Restored."),L=!1;let W=pe.autoReset,at=Dt.enabled,_t=Dt.autoUpdate,ct=Dt.needsUpdate,Et=Dt.type;j(),pe.autoReset=W,Dt.enabled=at,Dt.autoUpdate=_t,Dt.needsUpdate=ct,Dt.type=Et}function et(W){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",W.statusMessage)}function ot(W){let at=W.target;at.removeEventListener("dispose",ot),Q(at)}function Q(W){St(W),le.remove(W)}function St(W){let at=le.get(W).programs;at!==void 0&&(at.forEach(function(_t){J.releaseProgram(_t)}),W.isShaderMaterial&&J.releaseShaderCache(W))}this.renderBufferDirect=function(W,at,_t,ct,Et,Nt){at===null&&(at=Ct);let zt=Et.isMesh&&Et.matrixWorld.determinant()<0,oe=Cn(W,at,_t,ct,Et);Yt.setMaterial(ct,zt);let Kt=_t.index,ce=1;if(ct.wireframe===!0){if(Kt=X.getWireframeAttribute(_t),Kt===void 0)return;ce=2}let Wt=_t.drawRange,he=_t.attributes.position,an=Wt.start*ce,ln=(Wt.start+Wt.count)*ce;Nt!==null&&(an=Math.max(an,Nt.start*ce),ln=Math.min(ln,(Nt.start+Nt.count)*ce)),Kt!==null?(an=Math.max(an,0),ln=Math.min(ln,Kt.count)):he!=null&&(an=Math.max(an,0),ln=Math.min(ln,he.count));let bn=ln-an;if(bn<0||bn===1/0)return;z.setup(Et,ct,oe,_t,Kt);let ui,Pn=C;if(Kt!==null&&(ui=pn.get(Kt),Pn=R,Pn.setIndex(ui)),Et.isMesh)ct.wireframe===!0?(Yt.setLineWidth(ct.wireframeLinewidth*ee()),Pn.setMode(it.LINES)):Pn.setMode(it.TRIANGLES);else if(Et.isLine){let de=ct.linewidth;de===void 0&&(de=1),Yt.setLineWidth(de*ee()),Et.isLineSegments?Pn.setMode(it.LINES):Et.isLineLoop?Pn.setMode(it.LINE_LOOP):Pn.setMode(it.LINE_STRIP)}else Et.isPoints?Pn.setMode(it.POINTS):Et.isSprite&&Pn.setMode(it.TRIANGLES);if(Et.isInstancedMesh)Pn.renderInstances(an,bn,Et.count);else if(_t.isInstancedBufferGeometry){let de=_t._maxInstanceCount!==void 0?_t._maxInstanceCount:1/0,bo=Math.min(_t.instanceCount,de);Pn.renderInstances(an,bn,bo)}else Pn.render(an,bn)},this.compile=function(W,at){function _t(ct,Et,Nt){ct.transparent===!0&&ct.side===Xo&&ct.forceSinglePass===!1?(ct.side=di,ct.needsUpdate=!0,re(ct,Et,Nt),ct.side=vs,ct.needsUpdate=!0,re(ct,Et,Nt),ct.side=Xo):re(ct,Et,Nt)}x=yt.get(W),x.init(),P.push(x),W.traverseVisible(function(ct){ct.isLight&&ct.layers.test(at.layers)&&(x.pushLight(ct),ct.castShadow&&x.pushShadow(ct))}),x.setupLights(S._useLegacyLights),W.traverse(function(ct){let Et=ct.material;if(Et)if(Array.isArray(Et))for(let Nt=0;Nt<Et.length;Nt++){let zt=Et[Nt];_t(zt,W,ct)}else _t(Et,W,ct)}),P.pop(),x=null};let At=null;function ne(W){At&&At(W)}function Gt(){tn.stop()}function He(){tn.start()}let tn=new h0;tn.setAnimationLoop(ne),typeof self!="undefined"&&tn.setContext(self),this.setAnimationLoop=function(W){At=W,D.setAnimationLoop(W),W===null?tn.stop():tn.start()},D.addEventListener("sessionstart",Gt),D.addEventListener("sessionend",He),this.render=function(W,at){if(at!==void 0&&at.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;W.matrixWorldAutoUpdate===!0&&W.updateMatrixWorld(),at.parent===null&&at.matrixWorldAutoUpdate===!0&&at.updateMatrixWorld(),D.enabled===!0&&D.isPresenting===!0&&(D.cameraAutoUpdate===!0&&D.updateCamera(at),at=D.getCamera()),W.isScene===!0&&W.onBeforeRender(S,W,at,B),x=yt.get(W,P.length),x.init(),P.push(x),Xt.multiplyMatrices(at.projectionMatrix,at.matrixWorldInverse),Tt.setFromProjectionMatrix(Xt),Lt=this.localClippingEnabled,gt=$t.init(this.clippingPlanes,Lt),T=wt.get(W,v.length),T.init(),v.push(T),Ln(W,at,0,S.sortObjects),T.finish(),S.sortObjects===!0&&T.sort(lt,ht),this.info.render.frame++,gt===!0&&$t.beginShadows();let _t=x.state.shadowsArray;if(Dt.render(_t,W,at),gt===!0&&$t.endShadows(),this.info.autoReset===!0&&this.info.reset(),Y.render(T,W),x.setupLights(S._useLegacyLights),at.isArrayCamera){let ct=at.cameras;for(let Et=0,Nt=ct.length;Et<Nt;Et++){let zt=ct[Et];mn(T,W,zt,zt.viewport)}}else mn(T,W,at);B!==null&&(Pt.updateMultisampleRenderTarget(B),Pt.updateRenderTargetMipmap(B)),W.isScene===!0&&W.onAfterRender(S,W,at),z.resetDefaultState(),I=-1,O=null,P.pop(),P.length>0?x=P[P.length-1]:x=null,v.pop(),v.length>0?T=v[v.length-1]:T=null};function Ln(W,at,_t,ct){if(W.visible===!1)return;if(W.layers.test(at.layers)){if(W.isGroup)_t=W.renderOrder;else if(W.isLOD)W.autoUpdate===!0&&W.update(at);else if(W.isLight)x.pushLight(W),W.castShadow&&x.pushShadow(W);else if(W.isSprite){if(!W.frustumCulled||Tt.intersectsSprite(W)){ct&&Qt.setFromMatrixPosition(W.matrixWorld).applyMatrix4(Xt);let zt=F.update(W),oe=W.material;oe.visible&&T.push(W,zt,oe,_t,Qt.z,null)}}else if((W.isMesh||W.isLine||W.isPoints)&&(!W.frustumCulled||Tt.intersectsObject(W))){let zt=F.update(W),oe=W.material;if(ct&&(W.boundingSphere!==void 0?(W.boundingSphere===null&&W.computeBoundingSphere(),Qt.copy(W.boundingSphere.center)):(zt.boundingSphere===null&&zt.computeBoundingSphere(),Qt.copy(zt.boundingSphere.center)),Qt.applyMatrix4(W.matrixWorld).applyMatrix4(Xt)),Array.isArray(oe)){let Kt=zt.groups;for(let ce=0,Wt=Kt.length;ce<Wt;ce++){let he=Kt[ce],an=oe[he.materialIndex];an&&an.visible&&T.push(W,zt,an,_t,Qt.z,he)}}else oe.visible&&T.push(W,zt,oe,_t,Qt.z,null)}}let Nt=W.children;for(let zt=0,oe=Nt.length;zt<oe;zt++)Ln(Nt[zt],at,_t,ct)}function mn(W,at,_t,ct){let Et=W.opaque,Nt=W.transmissive,zt=W.transparent;x.setupLightsView(_t),gt===!0&&$t.setGlobalState(S.clippingPlanes,_t),Nt.length>0&&Fn(Et,Nt,at,_t),ct&&Yt.viewport(q.copy(ct)),Et.length>0&&$n(Et,at,_t),Nt.length>0&&$n(Nt,at,_t),zt.length>0&&$n(zt,at,_t),Yt.buffers.depth.setTest(!0),Yt.buffers.depth.setMask(!0),Yt.buffers.color.setMask(!0),Yt.setPolygonOffset(!1)}function Fn(W,at,_t,ct){let Et=Jt.isWebGL2;qt===null&&(qt=new Jo(1,1,{generateMipmaps:!0,type:Bt.has("EXT_color_buffer_half_float")?zu:ys,minFilter:Bu,samples:Et?4:0})),S.getDrawingBufferSize(Ft),Et?qt.setSize(Ft.x,Ft.y):qt.setSize(vf(Ft.x),vf(Ft.y));let Nt=S.getRenderTarget();S.setRenderTarget(qt),S.getClearColor(Mt),$=S.getClearAlpha(),$<1&&S.setClearColor(16777215,.5),S.clear();let zt=S.toneMapping;S.toneMapping=gs,$n(W,_t,ct),Pt.updateMultisampleRenderTarget(qt),Pt.updateRenderTargetMipmap(qt);let oe=!1;for(let Kt=0,ce=at.length;Kt<ce;Kt++){let Wt=at[Kt],he=Wt.object,an=Wt.geometry,ln=Wt.material,bn=Wt.group;if(ln.side===Xo&&he.layers.test(ct.layers)){let ui=ln.side;ln.side=di,ln.needsUpdate=!0,xn(he,_t,ct,an,ln,bn),ln.side=ui,ln.needsUpdate=!0,oe=!0}}oe===!0&&(Pt.updateMultisampleRenderTarget(qt),Pt.updateRenderTargetMipmap(qt)),S.setRenderTarget(Nt),S.setClearColor(Mt,$),S.toneMapping=zt}function $n(W,at,_t){let ct=at.isScene===!0?at.overrideMaterial:null;for(let Et=0,Nt=W.length;Et<Nt;Et++){let zt=W[Et],oe=zt.object,Kt=zt.geometry,ce=ct===null?zt.material:ct,Wt=zt.group;oe.layers.test(_t.layers)&&xn(oe,at,_t,Kt,ce,Wt)}}function xn(W,at,_t,ct,Et,Nt){W.onBeforeRender(S,at,_t,ct,Et,Nt),W.modelViewMatrix.multiplyMatrices(_t.matrixWorldInverse,W.matrixWorld),W.normalMatrix.getNormalMatrix(W.modelViewMatrix),Et.onBeforeRender(S,at,_t,ct,W,Nt),Et.transparent===!0&&Et.side===Xo&&Et.forceSinglePass===!1?(Et.side=di,Et.needsUpdate=!0,S.renderBufferDirect(_t,at,ct,Et,W,Nt),Et.side=vs,Et.needsUpdate=!0,S.renderBufferDirect(_t,at,ct,Et,W,Nt),Et.side=Xo):S.renderBufferDirect(_t,at,ct,Et,W,Nt),W.onAfterRender(S,at,_t,ct,Et,Nt)}function re(W,at,_t){at.isScene!==!0&&(at=Ct);let ct=le.get(W),Et=x.state.lights,Nt=x.state.shadowsArray,zt=Et.state.version,oe=J.getParameters(W,Et.state,Nt,at,_t),Kt=J.getProgramCacheKey(oe),ce=ct.programs;ct.environment=W.isMeshStandardMaterial?at.environment:null,ct.fog=at.fog,ct.envMap=(W.isMeshStandardMaterial?yn:te).get(W.envMap||ct.environment),ce===void 0&&(W.addEventListener("dispose",ot),ce=new Map,ct.programs=ce);let Wt=ce.get(Kt);if(Wt!==void 0){if(ct.currentProgram===Wt&&ct.lightsStateVersion===zt)return En(W,oe),Wt}else oe.uniforms=J.getUniforms(W),W.onBuild(_t,oe,S),W.onBeforeCompile(oe,S),Wt=J.acquireProgram(oe,Kt),ce.set(Kt,Wt),ct.uniforms=oe.uniforms;let he=ct.uniforms;(!W.isShaderMaterial&&!W.isRawShaderMaterial||W.clipping===!0)&&(he.clippingPlanes=$t.uniform),En(W,oe),ct.needsLights=gn(W),ct.lightsStateVersion=zt,ct.needsLights&&(he.ambientLightColor.value=Et.state.ambient,he.lightProbe.value=Et.state.probe,he.directionalLights.value=Et.state.directional,he.directionalLightShadows.value=Et.state.directionalShadow,he.spotLights.value=Et.state.spot,he.spotLightShadows.value=Et.state.spotShadow,he.rectAreaLights.value=Et.state.rectArea,he.ltc_1.value=Et.state.rectAreaLTC1,he.ltc_2.value=Et.state.rectAreaLTC2,he.pointLights.value=Et.state.point,he.pointLightShadows.value=Et.state.pointShadow,he.hemisphereLights.value=Et.state.hemi,he.directionalShadowMap.value=Et.state.directionalShadowMap,he.directionalShadowMatrix.value=Et.state.directionalShadowMatrix,he.spotShadowMap.value=Et.state.spotShadowMap,he.spotLightMatrix.value=Et.state.spotLightMatrix,he.spotLightMap.value=Et.state.spotLightMap,he.pointShadowMap.value=Et.state.pointShadowMap,he.pointShadowMatrix.value=Et.state.pointShadowMatrix);let an=Wt.getUniforms(),ln=Va.seqWithValue(an.seq,he);return ct.currentProgram=Wt,ct.uniformsList=ln,Wt}function En(W,at){let _t=le.get(W);_t.outputColorSpace=at.outputColorSpace,_t.instancing=at.instancing,_t.instancingColor=at.instancingColor,_t.skinning=at.skinning,_t.morphTargets=at.morphTargets,_t.morphNormals=at.morphNormals,_t.morphColors=at.morphColors,_t.morphTargetsCount=at.morphTargetsCount,_t.numClippingPlanes=at.numClippingPlanes,_t.numIntersection=at.numClipIntersection,_t.vertexAlphas=at.vertexAlphas,_t.vertexTangents=at.vertexTangents,_t.toneMapping=at.toneMapping}function Cn(W,at,_t,ct,Et){at.isScene!==!0&&(at=Ct),Pt.resetTextureUnits();let Nt=at.fog,zt=ct.isMeshStandardMaterial?at.environment:null,oe=B===null?S.outputColorSpace:B.isXRRenderTarget===!0?B.texture.colorSpace:Zo,Kt=(ct.isMeshStandardMaterial?yn:te).get(ct.envMap||zt),ce=ct.vertexColors===!0&&!!_t.attributes.color&&_t.attributes.color.itemSize===4,Wt=!!_t.attributes.tangent&&(!!ct.normalMap||ct.anisotropy>0),he=!!_t.morphAttributes.position,an=!!_t.morphAttributes.normal,ln=!!_t.morphAttributes.color,bn=gs;ct.toneMapped&&(B===null||B.isXRRenderTarget===!0)&&(bn=S.toneMapping);let ui=_t.morphAttributes.position||_t.morphAttributes.normal||_t.morphAttributes.color,Pn=ui!==void 0?ui.length:0,de=le.get(ct),bo=x.state.lights;if(gt===!0&&(Lt===!0||W!==O)){let Pr=W===O&&ct.id===I;$t.setState(ct,W,Pr)}let fe=!1;ct.version===de.__version?(de.needsLights&&de.lightsStateVersion!==bo.state.version||de.outputColorSpace!==oe||Et.isInstancedMesh&&de.instancing===!1||!Et.isInstancedMesh&&de.instancing===!0||Et.isSkinnedMesh&&de.skinning===!1||!Et.isSkinnedMesh&&de.skinning===!0||Et.isInstancedMesh&&de.instancingColor===!0&&Et.instanceColor===null||Et.isInstancedMesh&&de.instancingColor===!1&&Et.instanceColor!==null||de.envMap!==Kt||ct.fog===!0&&de.fog!==Nt||de.numClippingPlanes!==void 0&&(de.numClippingPlanes!==$t.numPlanes||de.numIntersection!==$t.numIntersection)||de.vertexAlphas!==ce||de.vertexTangents!==Wt||de.morphTargets!==he||de.morphNormals!==an||de.morphColors!==ln||de.toneMapping!==bn||Jt.isWebGL2===!0&&de.morphTargetsCount!==Pn)&&(fe=!0):(fe=!0,de.__version=ct.version);let ao=de.currentProgram;fe===!0&&(ao=re(ct,at,Et));let li=!1,To=!1,ua=!1,ie=ao.getUniforms(),Vi=de.uniforms;if(Yt.useProgram(ao.program)&&(li=!0,To=!0,ua=!0),ct.id!==I&&(I=ct.id,To=!0),li||O!==W){ie.setValue(it,"projectionMatrix",W.projectionMatrix),ie.setValue(it,"viewMatrix",W.matrixWorldInverse);let Pr=ie.map.cameraPosition;Pr!==void 0&&Pr.setValue(it,Qt.setFromMatrixPosition(W.matrixWorld)),Jt.logarithmicDepthBuffer&&ie.setValue(it,"logDepthBufFC",2/(Math.log(W.far+1)/Math.LN2)),(ct.isMeshPhongMaterial||ct.isMeshToonMaterial||ct.isMeshLambertMaterial||ct.isMeshBasicMaterial||ct.isMeshStandardMaterial||ct.isShaderMaterial)&&ie.setValue(it,"isOrthographic",W.isOrthographicCamera===!0),O!==W&&(O=W,To=!0,ua=!0)}if(Et.isSkinnedMesh){ie.setOptional(it,Et,"bindMatrix"),ie.setOptional(it,Et,"bindMatrixInverse");let Pr=Et.skeleton;Pr&&(Jt.floatVertexTextures?(Pr.boneTexture===null&&Pr.computeBoneTexture(),ie.setValue(it,"boneTexture",Pr.boneTexture,Pt),ie.setValue(it,"boneTextureSize",Pr.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 kr=_t.morphAttributes;if((kr.position!==void 0||kr.normal!==void 0||kr.color!==void 0&&Jt.isWebGL2===!0)&&w.update(Et,_t,ao),(To||de.receiveShadow!==Et.receiveShadow)&&(de.receiveShadow=Et.receiveShadow,ie.setValue(it,"receiveShadow",Et.receiveShadow)),ct.isMeshGouraudMaterial&&ct.envMap!==null&&(Vi.envMap.value=Kt,Vi.flipEnvMap.value=Kt.isCubeTexture&&Kt.isRenderTargetTexture===!1?-1:1),To&&(ie.setValue(it,"toneMappingExposure",S.toneMappingExposure),de.needsLights&&wn(Vi,ua),Nt&&ct.fog===!0&&It.refreshFogUniforms(Vi,Nt),It.refreshMaterialUniforms(Vi,ct,mt,xt,qt),Va.upload(it,de.uniformsList,Vi,Pt)),ct.isShaderMaterial&&ct.uniformsNeedUpdate===!0&&(Va.upload(it,de.uniformsList,Vi,Pt),ct.uniformsNeedUpdate=!1),ct.isSpriteMaterial&&ie.setValue(it,"center",Et.center),ie.setValue(it,"modelViewMatrix",Et.modelViewMatrix),ie.setValue(it,"normalMatrix",Et.normalMatrix),ie.setValue(it,"modelMatrix",Et.matrixWorld),ct.isShaderMaterial||ct.isRawShaderMaterial){let Pr=ct.uniformsGroups;for(let ue=0,dl=Pr.length;ue<dl;ue++)if(Jt.isWebGL2){let ml=Pr[ue];rt.update(ml,ao),rt.bind(ml,ao)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return ao}function wn(W,at){W.ambientLightColor.needsUpdate=at,W.lightProbe.needsUpdate=at,W.directionalLights.needsUpdate=at,W.directionalLightShadows.needsUpdate=at,W.pointLights.needsUpdate=at,W.pointLightShadows.needsUpdate=at,W.spotLights.needsUpdate=at,W.spotLightShadows.needsUpdate=at,W.rectAreaLights.needsUpdate=at,W.hemisphereLights.needsUpdate=at}function gn(W){return W.isMeshLambertMaterial||W.isMeshToonMaterial||W.isMeshPhongMaterial||W.isMeshStandardMaterial||W.isShadowMaterial||W.isShaderMaterial&&W.lights===!0}this.getActiveCubeFace=function(){return N},this.getActiveMipmapLevel=function(){return G},this.getRenderTarget=function(){return B},this.setRenderTargetTextures=function(W,at,_t){le.get(W.texture).__webglTexture=at,le.get(W.depthTexture).__webglTexture=_t;let ct=le.get(W);ct.__hasExternalTextures=!0,ct.__hasExternalTextures&&(ct.__autoAllocateDepthBuffer=_t===void 0,ct.__autoAllocateDepthBuffer||Bt.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ct.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(W,at){let _t=le.get(W);_t.__webglFramebuffer=at,_t.__useDefaultFramebuffer=at===void 0},this.setRenderTarget=function(W,at=0,_t=0){B=W,N=at,G=_t;let ct=!0,Et=null,Nt=!1,zt=!1;if(W){let Kt=le.get(W);Kt.__useDefaultFramebuffer!==void 0?(Yt.bindFramebuffer(it.FRAMEBUFFER,null),ct=!1):Kt.__webglFramebuffer===void 0?Pt.setupRenderTarget(W):Kt.__hasExternalTextures&&Pt.rebindTextures(W,le.get(W.texture).__webglTexture,le.get(W.depthTexture).__webglTexture);let ce=W.texture;(ce.isData3DTexture||ce.isDataArrayTexture||ce.isCompressedArrayTexture)&&(zt=!0);let Wt=le.get(W).__webglFramebuffer;W.isWebGLCubeRenderTarget?(Array.isArray(Wt[at])?Et=Wt[at][_t]:Et=Wt[at],Nt=!0):Jt.isWebGL2&&W.samples>0&&Pt.useMultisampledRTT(W)===!1?Et=le.get(W).__webglMultisampledFramebuffer:Array.isArray(Wt)?Et=Wt[_t]:Et=Wt,q.copy(W.viewport),st.copy(W.scissor),V=W.scissorTest}else q.copy(k).multiplyScalar(mt).floor(),st.copy(nt).multiplyScalar(mt).floor(),V=ft;if(Yt.bindFramebuffer(it.FRAMEBUFFER,Et)&&Jt.drawBuffers&&ct&&Yt.drawBuffers(W,Et),Yt.viewport(q),Yt.scissor(st),Yt.setScissorTest(V),Nt){let Kt=le.get(W.texture);it.framebufferTexture2D(it.FRAMEBUFFER,it.COLOR_ATTACHMENT0,it.TEXTURE_CUBE_MAP_POSITIVE_X+at,Kt.__webglTexture,_t)}else if(zt){let Kt=le.get(W.texture),ce=at||0;it.framebufferTextureLayer(it.FRAMEBUFFER,it.COLOR_ATTACHMENT0,Kt.__webglTexture,_t||0,ce)}I=-1},this.readRenderTargetPixels=function(W,at,_t,ct,Et,Nt,zt){if(!(W&&W.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let oe=le.get(W).__webglFramebuffer;if(W.isWebGLCubeRenderTarget&&zt!==void 0&&(oe=oe[zt]),oe){Yt.bindFramebuffer(it.FRAMEBUFFER,oe);try{let Kt=W.texture,ce=Kt.format,Wt=Kt.type;if(ce!==eo&&H.convert(ce)!==it.getParameter(it.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let he=Wt===zu&&(Bt.has("EXT_color_buffer_half_float")||Jt.isWebGL2&&Bt.has("EXT_color_buffer_float"));if(Wt!==ys&&H.convert(Wt)!==it.getParameter(it.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Wt===ds&&(Jt.isWebGL2||Bt.has("OES_texture_float")||Bt.has("WEBGL_color_buffer_float")))&&!he){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}at>=0&&at<=W.width-ct&&_t>=0&&_t<=W.height-Et&&it.readPixels(at,_t,ct,Et,H.convert(ce),H.convert(Wt),Nt)}finally{let Kt=B!==null?le.get(B).__webglFramebuffer:null;Yt.bindFramebuffer(it.FRAMEBUFFER,Kt)}}},this.copyFramebufferToTexture=function(W,at,_t=0){let ct=Math.pow(2,-_t),Et=Math.floor(at.image.width*ct),Nt=Math.floor(at.image.height*ct);Pt.setTexture2D(at,0),it.copyTexSubImage2D(it.TEXTURE_2D,_t,0,0,W.x,W.y,Et,Nt),Yt.unbindTexture()},this.copyTextureToTexture=function(W,at,_t,ct=0){let Et=at.image.width,Nt=at.image.height,zt=H.convert(_t.format),oe=H.convert(_t.type);Pt.setTexture2D(_t,0),it.pixelStorei(it.UNPACK_FLIP_Y_WEBGL,_t.flipY),it.pixelStorei(it.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_t.premultiplyAlpha),it.pixelStorei(it.UNPACK_ALIGNMENT,_t.unpackAlignment),at.isDataTexture?it.texSubImage2D(it.TEXTURE_2D,ct,W.x,W.y,Et,Nt,zt,oe,at.image.data):at.isCompressedTexture?it.compressedTexSubImage2D(it.TEXTURE_2D,ct,W.x,W.y,at.mipmaps[0].width,at.mipmaps[0].height,zt,at.mipmaps[0].data):it.texSubImage2D(it.TEXTURE_2D,ct,W.x,W.y,zt,oe,at.image),ct===0&&_t.generateMipmaps&&it.generateMipmap(it.TEXTURE_2D),Yt.unbindTexture()},this.copyTextureToTexture3D=function(W,at,_t,ct,Et=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Nt=W.max.x-W.min.x+1,zt=W.max.y-W.min.y+1,oe=W.max.z-W.min.z+1,Kt=H.convert(ct.format),ce=H.convert(ct.type),Wt;if(ct.isData3DTexture)Pt.setTexture3D(ct,0),Wt=it.TEXTURE_3D;else if(ct.isDataArrayTexture)Pt.setTexture2DArray(ct,0),Wt=it.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}it.pixelStorei(it.UNPACK_FLIP_Y_WEBGL,ct.flipY),it.pixelStorei(it.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ct.premultiplyAlpha),it.pixelStorei(it.UNPACK_ALIGNMENT,ct.unpackAlignment);let he=it.getParameter(it.UNPACK_ROW_LENGTH),an=it.getParameter(it.UNPACK_IMAGE_HEIGHT),ln=it.getParameter(it.UNPACK_SKIP_PIXELS),bn=it.getParameter(it.UNPACK_SKIP_ROWS),ui=it.getParameter(it.UNPACK_SKIP_IMAGES),Pn=_t.isCompressedTexture?_t.mipmaps[0]:_t.image;it.pixelStorei(it.UNPACK_ROW_LENGTH,Pn.width),it.pixelStorei(it.UNPACK_IMAGE_HEIGHT,Pn.height),it.pixelStorei(it.UNPACK_SKIP_PIXELS,W.min.x),it.pixelStorei(it.UNPACK_SKIP_ROWS,W.min.y),it.pixelStorei(it.UNPACK_SKIP_IMAGES,W.min.z),_t.isDataTexture||_t.isData3DTexture?it.texSubImage3D(Wt,Et,at.x,at.y,at.z,Nt,zt,oe,Kt,ce,Pn.data):_t.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),it.compressedTexSubImage3D(Wt,Et,at.x,at.y,at.z,Nt,zt,oe,Kt,Pn.data)):it.texSubImage3D(Wt,Et,at.x,at.y,at.z,Nt,zt,oe,Kt,ce,Pn),it.pixelStorei(it.UNPACK_ROW_LENGTH,he),it.pixelStorei(it.UNPACK_IMAGE_HEIGHT,an),it.pixelStorei(it.UNPACK_SKIP_PIXELS,ln),it.pixelStorei(it.UNPACK_SKIP_ROWS,bn),it.pixelStorei(it.UNPACK_SKIP_IMAGES,ui),Et===0&&ct.generateMipmaps&&it.generateMipmap(Wt),Yt.unbindTexture()},this.initTexture=function(W){W.isCubeTexture?Pt.setTextureCube(W,0):W.isData3DTexture?Pt.setTexture3D(W,0):W.isDataArrayTexture||W.isCompressedArrayTexture?Pt.setTexture2DArray(W,0):Pt.setTexture2D(W,0),Yt.unbindTexture()},this.resetState=function(){N=0,G=0,B=null,Yt.reset(),z.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Yo}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Kf?"display-p3":"srgb",e.unpackColorSpace=Mn.workingColorSpace===fc?"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===Or?$s:a0}set outputEncoding(t){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=t===$s?Or:Zo}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}},Bf=class extends Uf{};Bf.prototype.isWebGL1Renderer=!0;function ql(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 Wb(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}var $a=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 h;e:{r:if(!(t<a)){for(let f=o+2;;){if(a===void 0){if(t<l)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===f)break;if(l=a,a=e[++o],t<a)break t}h=e.length;break e}if(!(t>=l)){let f=e[1];t<f&&(o=2,l=f);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}h=o,o=0;break e}break n}for(;o<h;){let f=o+h>>>1;t<e[f]?h=f:o=f+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 h=0;h!==a;++h)e[h]=o[l+h];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},zf=class extends $a{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:ag,endingEnd:ag}}intervalChanged_(t,e,o){let a=this.parameterPositions,l=t-2,h=t+1,f=a[l],p=a[h];if(f===void 0)switch(this.getSettings_().endingStart){case ug:l=t,f=2*e-o;break;case lg:l=a.length-2,f=e+a[l]-a[l+1];break;default:l=t,f=o}if(p===void 0)switch(this.getSettings_().endingEnd){case ug:h=t,p=2*o-e;break;case lg:h=1,p=o+a[1]-a[0];break;default:h=t-1,p=e}let d=(o-e)*.5,g=this.valueSize;this._weightPrev=d/(e-f),this._weightNext=d/(p-o),this._offsetPrev=l*g,this._offsetNext=h*g}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=this._offsetPrev,_=this._offsetNext,y=this._weightPrev,M=this._weightNext,b=(o-e)/(a-e),T=b*b,x=T*b,v=-y*x+2*y*T-y*b,P=(1+y)*x+(-1.5-2*y)*T+(-.5+y)*b+1,S=(-1-M)*x+(1.5+M)*T+.5*b,L=M*x-M*T;for(let N=0;N!==f;++N)l[N]=v*h[g+N]+P*h[d+N]+S*h[p+N]+L*h[_+N];return l}},kf=class extends $a{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=(o-e)/(a-e),_=1-g;for(let y=0;y!==f;++y)l[y]=h[d+y]*_+h[p+y]*g;return l}},Gf=class extends $a{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t){return this.copySampleValue_(t-1)}},ro=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=ql(e,this.TimeBufferType),this.values=ql(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:ql(t.times,Array),values:ql(t.values,Array)};let a=t.getInterpolation();a!==t.DefaultInterpolation&&(o.interpolation=a)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new Gf(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new kf(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new zf(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Xl:e=this.InterpolantFactoryMethodDiscrete;break;case Yl:e=this.InterpolantFactoryMethodLinear;break;case kh: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 Xl;case this.InterpolantFactoryMethodLinear:return Yl;case this.InterpolantFactoryMethodSmooth:return kh}}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,h=a-1;for(;l!==a&&o[l]<t;)++l;for(;h!==-1&&o[h]>e;)--h;if(++h,l!==0||h!==a){l>=h&&(h=Math.max(h,1),l=h-1);let f=this.getValueSize();this.times=o.slice(l,h),this.values=this.values.slice(l*f,h*f)}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 h=null;for(let f=0;f!==l;f++){let p=o[f];if(typeof p=="number"&&isNaN(p)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,p),t=!1;break}if(h!==null&&h>p){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,p,h),t=!1;break}h=p}if(a!==void 0&&Wb(a))for(let f=0,p=a.length;f!==p;++f){let d=a[f];if(isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,f,d),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),a=this.getInterpolation()===kh,l=t.length-1,h=1;for(let f=1;f<l;++f){let p=!1,d=t[f],g=t[f+1];if(d!==g&&(f!==1||d!==t[0]))if(a)p=!0;else{let _=f*o,y=_-o,M=_+o;for(let b=0;b!==o;++b){let T=e[_+b];if(T!==e[y+b]||T!==e[M+b]){p=!0;break}}}if(p){if(f!==h){t[h]=t[f];let _=f*o,y=h*o;for(let M=0;M!==o;++M)e[y+M]=e[_+M]}++h}}if(l>0){t[h]=t[l];for(let f=l*o,p=h*o,d=0;d!==o;++d)e[p+d]=e[f+d];++h}return h!==t.length?(this.times=t.slice(0,h),this.values=e.slice(0,h*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}};ro.prototype.TimeBufferType=Float32Array;ro.prototype.ValueBufferType=Float32Array;ro.prototype.DefaultInterpolation=Yl;var Ks=class extends ro{};Ks.prototype.ValueTypeName="bool";Ks.prototype.ValueBufferType=Array;Ks.prototype.DefaultInterpolation=Xl;Ks.prototype.InterpolantFactoryMethodLinear=void 0;Ks.prototype.InterpolantFactoryMethodSmooth=void 0;var Vf=class extends ro{};Vf.prototype.ValueTypeName="color";var Hf=class extends ro{};Hf.prototype.ValueTypeName="number";var Wf=class extends $a{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=(o-e)/(a-e),d=t*f;for(let g=d+f;d!==g;d+=4)xs.slerpFlat(l,0,h,d-f,h,d,p);return l}},Vu=class extends ro{InterpolantFactoryMethodLinear(t){return new Wf(this.times,this.values,this.getValueSize(),t)}};Vu.prototype.ValueTypeName="quaternion";Vu.prototype.DefaultInterpolation=Yl;Vu.prototype.InterpolantFactoryMethodSmooth=void 0;var js=class extends ro{};js.prototype.ValueTypeName="string";js.prototype.ValueBufferType=Array;js.prototype.DefaultInterpolation=Xl;js.prototype.InterpolantFactoryMethodLinear=void 0;js.prototype.InterpolantFactoryMethodSmooth=void 0;var qf=class extends ro{};qf.prototype.ValueTypeName="vector";var Xf=class{constructor(t,e,o){let a=this,l=!1,h=0,f=0,p,d=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(g){f++,l===!1&&a.onStart!==void 0&&a.onStart(g,h,f),l=!0},this.itemEnd=function(g){h++,a.onProgress!==void 0&&a.onProgress(g,h,f),h===f&&(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[_],b=d[_+1];if(M.global&&(M.lastIndex=0),M.test(g))return b}return null}}},qb=new Xf,Yf=class{constructor(t){this.manager=t!==void 0?t:qb,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}};Yf.DEFAULT_MATERIAL_NAME="__DEFAULT";var Qf="\\\\[\\\\]\\\\.:\\\\/",Xb=new RegExp("["+Qf+"]","g"),tp="[^"+Qf+"]",Yb="[^"+Qf.replace("\\\\.","")+"]",$b=/((?:WC+[\\/:])*)/.source.replace("WC",tp),Zb=/(WCOD+)?/.source.replace("WCOD",Yb),Jb=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",tp),Kb=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",tp),jb=new RegExp("^"+$b+Zb+Jb+Kb+"$"),Qb=["material","materials","bones","map"],$f=class{constructor(t,e,o){let a=o||Gn.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()}},Gn=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(Xb,"")}static parseTrackName(t){let e=jb.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);Qb.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 h=0;h<l.length;h++){let f=l[h];if(f.name===e||f.uuid===e)return f;let p=o(f.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 h=t[a];if(h===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 f=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?f=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(f=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=h,this.propertyIndex=l}else h.fromArray!==void 0&&h.toArray!==void 0?(p=this.BindingType.HasFromToArray,this.resolvedProperty=h):Array.isArray(h)?(p=this.BindingType.EntireArray,this.resolvedProperty=h):this.propertyName=a;this.getValue=this.GetterByBindingType[p],this.setValue=this.SetterByBindingTypeAndVersioning[p][f]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Gn.Composite=$f;Gn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Gn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Gn.prototype.GetterByBindingType=[Gn.prototype._getValue_direct,Gn.prototype._getValue_array,Gn.prototype._getValue_arrayElement,Gn.prototype._getValue_toArray];Gn.prototype.SetterByBindingTypeAndVersioning=[[Gn.prototype._setValue_direct,Gn.prototype._setValue_direct_setNeedsUpdate,Gn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Gn.prototype._setValue_array,Gn.prototype._setValue_array_setNeedsUpdate,Gn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Gn.prototype._setValue_arrayElement,Gn.prototype._setValue_arrayElement_setNeedsUpdate,Gn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Gn.prototype._setValue_fromArray,Gn.prototype._setValue_fromArray_setNeedsUpdate,Gn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var OR=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Zf}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Zf);var wr=63710088e-1,FR={centimeters:wr*100,centimetres:wr*100,degrees:wr/111325,feet:wr*3.28084,inches:wr*39.37,kilometers:wr/1e3,kilometres:wr/1e3,meters:wr,metres:wr,miles:wr/1609.344,millimeters:wr*1e3,millimetres:wr*1e3,nauticalmiles:wr/1852,radians:1,yards:wr*1.0936},UR={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/wr,yards:1.0936133};function ii(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 Rn(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 ii(o,t,e)}function Vn(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<l[l.length-1].length;h++)if(l[l.length-1][h]!==l[0][h])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:r};return ii(f,t,e)}function br(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 ii(o,t,e)}function ep(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return ii(o,t,e)}function vo(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function hr(r,t,e){if(r!==null)for(var o,a,l,h,f,p,d,g=0,_=0,y,M=r.type,b=M==="FeatureCollection",T=M==="Feature",x=b?r.features.length:1,v=0;v<x;v++){d=b?r.features[v].geometry:T?r.geometry:r,y=d?d.type==="GeometryCollection":!1,f=y?d.geometries.length:1;for(var P=0;P<f;P++){var S=0,L=0;if(h=y?d.geometries[P]:d,h!==null){p=h.coordinates;var N=h.type;switch(g=e&&(N==="Polygon"||N==="MultiPolygon")?1:0,N){case null:break;case"Point":if(t(p,_,v,S,L)===!1)return!1;_++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,S,L)===!1)return!1;_++,N==="MultiPoint"&&S++}N==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],_,v,S,L)===!1)return!1;_++}N==="MultiLineString"&&S++,N==="Polygon"&&L++}N==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(L=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],_,v,S,L)===!1)return!1;_++}L++}S++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(hr(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function g0(r,t,e,o){var a=e;return hr(r,function(l,h,f,p,d){h===0&&e===void 0?a=l:a=t(a,l,h,f,p,d)},o),a}function Es(r,t){var e,o,a,l,h,f,p,d,g,_,y=0,M=r.type==="FeatureCollection",b=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(f=M?r.features[e].geometry:b?r.geometry:r,d=M?r.features[e].properties:b?r.properties:{},g=M?r.features[e].bbox:b?r.bbox:void 0,_=M?r.features[e].id:b?r.id:void 0,p=f?f.type==="GeometryCollection":!1,h=p?f.geometries.length:1,a=0;a<h;a++){if(l=p?f.geometries[a]:f,l===null){if(t(null,y,d,g,_)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,y,d,g,_)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],y,d,g,_)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}function Ai(r,t){Es(r,function(e,o,a,l,h){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(ii(e,a,{bbox:l,id:h}),o,0)===!1?!1:void 0}var p;switch(f){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],_={type:p,coordinates:g};if(t(ii(_,a),o,d)===!1)return!1}})}function np(r){var t=[1/0,1/0,-1/0,-1/0];return hr(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}np.default=np;var oi=np;function Fr(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 rp(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 Ur(r){return r.type==="Feature"?r.geometry:r}var aT=Wn(dc(),1);var yT=Wn(O0(),1);function Tr(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=Fr(r),a=Ur(t),l=a.type,h=t.bbox,f=a.coordinates;if(h&&vT(o,h)===!1)return!1;l==="Polygon"&&(f=[f]);for(var p=!1,d=0;d<f.length&&!p;d++)if(D0(o,f[d][0],e.ignoreBoundary)){for(var g=!1,_=1;_<f[d].length&&!g;)D0(o,f[d][_],!e.ignoreBoundary)&&(g=!0),_++;g||(p=!0)}return p}function D0(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 h=t[a][0],f=t[a][1],p=t[l][0],d=t[l][1],g=r[1]*(h-p)+f*(p-r[0])+d*(r[0]-h)===0&&(h-r[0])*(p-r[0])<=0&&(f-r[1])*(d-r[1])<=0;if(g)return!e;var _=f>r[1]!=d>r[1]&&r[0]<(p-h)*(r[1]-f)/(d-f)+h;_&&(o=!o)}return o}function vT(r,t){return t[0]<=r[0]&&t[1]<=r[1]&&t[2]>=r[0]&&t[3]>=r[1]}var B0=new ArrayBuffer(16),fN=new Float64Array(B0),pN=new Uint32Array(B0);var NT=Wn(_p(),1);var z2=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,h=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,f=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+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+f)},{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+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+f)}])}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),h=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));h>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 OT(l,this.points[a],this.controls[a][1],this.controls[a+1][0],this.points[a+1])},r}();function OT(r,t,e,o,a){var l=DT(r),h={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 h}function DT(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 Yu(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 h=[e,o],f=[e,l],p=[a,l],d=[a,o];return Vn([[h,d,p,f,h]],t.properties,{bbox:r,id:t.id})}function FT(r){return Yu(oi(r))}var xp=FT;var QT=Wn(Z0(),1);var TA=Wn(Rc(),1);var CA=Wn(dc(),1);var RA=Wn(_p(),1);var py=Math.PI/180,dy=180/Math.PI,tl=function(r,t){this.lon=r,this.lat=t,this.x=py*r,this.y=py*t};tl.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};tl.prototype.antipode=function(){var r=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new tl(t,r)};var my=function(){this.coords=[],this.length=0};my.prototype.move_to=function(r){this.length++,this.coords.push(r)};var kp=function(r){this.properties=r||{},this.geometries=[]};kp.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}};kp.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 gy=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 tl(r.x,r.y),this.end=new tl(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)};gy.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),h=dy*Math.atan2(l,Math.sqrt(Math.pow(o,2)+Math.pow(a,2))),f=dy*Math.atan2(a,o);return[f,h]};gy.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,h=this.interpolate(l);e.push(h)}for(var f=!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 b=e[M-1][0],T=e[M][0],x=Math.abs(T-b);x>y&&(T>g&&b<_||b>g&&T<_)?f=!0:x>p&&(p=x)}var v=[];if(f&&p<d){var P=[];v.push(P);for(var S=0;S<e.length;++S){var L=parseFloat(e[S][0]);if(S>0&&Math.abs(L-e[S-1][0])>y){var N=parseFloat(e[S-1][0]),G=parseFloat(e[S-1][1]),B=parseFloat(e[S][0]),I=parseFloat(e[S][1]);if(N>-180&&N<_&&B===180&&S+1<e.length&&e[S-1][0]>-180&&e[S-1][0]<_){P.push([-180,e[S][1]]),S++,P.push([e[S][0],e[S][1]]);continue}else if(N>g&&N<180&&B===-180&&S+1<e.length&&e[S-1][0]>g&&e[S-1][0]<180){P.push([180,e[S][1]]),S++,P.push([e[S][0],e[S][1]]);continue}if(N<_&&B>g){var O=N;N=B,B=O;var q=G;G=I,I=q}if(N>g&&B<_&&(B+=360),N<=180&&B>=180&&N<B){var st=(180-N)/(B-N),V=st*I+(1-st)*G;P.push([e[S-1][0]>g?180:-180,V]),P=[],P.push([e[S-1][0]>g?-180:180,V]),v.push(P)}else P=[],v.push(P);P.push([L,e[S][1]])}else P.push([e[S][0],e[S][1]])}}else{var Mt=[];v.push(Mt);for(var $=0;$<e.length;++$)Mt.push([e[$][0],e[$][1]])}for(var ut=new kp(this.properties),xt=0;xt<v.length;++xt){var mt=new my;ut.geometries.push(mt);for(var lt=v[xt],ht=0;ht<lt.length;++ht)mt.move_to(lt[ht])}return ut};var OA=Wn(Rc(),1);var pP=Wn(Rc(),1);var dP=Wn(ud(),1);var yP=Wn(dc(),1);var _e=[],xe=[],Ee=[],Me=[],Se=[],we=[],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]=Se[85]=-1;Ee[85]=Ne[85]=0;Oe[85]=Re[85]=0;De[85]=Le[85]=1;we[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;Se[16]=Se[154]=0;we[16]=we[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;Se[32]=Se[138]=0;we[32]=we[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;Se[128]=Se[42]=0;we[128]=we[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;Se[20]=Se[150]=-1;we[20]=we[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;Se[130]=Se[40]=-1;we[130]=we[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;Se[37]=Se[133]=0;we[37]=we[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;Se[148]=Se[22]=0;we[148]=we[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;Se[145]=Se[25]=0;we[145]=we[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;Se[149]=Se[21]=0;we[149]=we[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;Se[24]=Se[146]=-1;we[24]=we[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;Se[129]=Se[41]=-1;we[129]=we[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;Se[144]=Se[26]=0;we[144]=we[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;Se[36]=Se[134]=0;we[36]=we[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;Se[136]=0;we[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;Se[34]=0;we[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;Se[35]=0;we[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;Se[153]=0;we[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;Se[155]=0;we[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;Se[152]=0;we[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;Se[156]=0;we[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;Se[137]=0;we[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;Se[139]=0;we[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;Se[38]=0;we[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;Se[39]=0;we[39]=0;var ld=function(r){return[[r.bottomleft,0],[0,0],[0,r.leftbottom]]},cd=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0]]},hd=function(r){return[[r.topright,1],[1,1],[1,r.righttop]]},fd=function(r){return[[0,r.lefttop],[0,1],[r.topleft,1]]},pd=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop]]},dd=function(r){return[[r.bottomright,0],[r.bottomleft,0],[1,r.righttop],[1,r.rightbottom]]},md=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.topleft,1],[r.topright,1]]},gd=function(r){return[[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},vP=function(r){return[[0,0],[0,r.leftbottom],[1,r.rightbottom],[1,0]]},_P=function(r){return[[1,0],[r.bottomright,0],[r.topright,1],[1,1]]},xP=function(r){return[[1,1],[1,r.righttop],[0,r.lefttop],[0,1]]},EP=function(r){return[[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},MP=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.leftbottom],[0,r.lefttop]]},SP=function(r){return[[r.topleft,1],[r.topright,1],[r.bottomright,0],[r.bottomleft,0]]},wP=function(){return[[0,0],[0,1],[1,1],[1,0]]},bP=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,1],[r.topleft,1]]},TP=function(r){return[[r.topright,1],[1,1],[1,0],[0,0],[0,r.leftbottom]]},AP=function(r){return[[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[1,1]]},CP=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,1]]},PP=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.lefttop],[0,1],[r.topleft,1]]},IP=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[r.topright,1]]},RP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop]]},LP=function(r){return[[r.topright,1],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1]]},NP=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},OP=function(r){return[[1,1],[1,r.righttop],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},DP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[r.topleft,1],[r.topright,1]]},FP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom]]},UP=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},BP=function(r){return[[1,1],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},zP=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1]]},kP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},GP=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},VP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},HP=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]]},WP=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},qP=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},XP=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},YP=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},$P=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},ZP=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=[],je=[],Qe=[];Ze[1]=Je[1]=18;Ze[169]=Je[169]=18;$e[4]=Ye[4]=12;$e[166]=Ye[166]=12;Xe[16]=Qe[16]=4;Xe[154]=Qe[154]=4;Ke[64]=je[64]=22;Ke[106]=je[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]=Qe[32]=4;Ye[32]=je[32]=1;Xe[138]=Qe[138]=4;Ye[138]=je[138]=1;Je[128]=Qe[128]=21;Ke[128]=je[128]=22;Je[42]=Qe[42]=21;Ke[42]=je[42]=22;Ye[5]=Je[5]=14;Ye[165]=Je[165]=14;$e[20]=Qe[20]=6;$e[150]=Qe[150]=6;Xe[80]=Ke[80]=11;Xe[90]=Ke[90]=11;Ze[65]=je[65]=3;Ze[105]=je[105]=3;Xe[160]=Ke[160]=11;Ye[160]=Je[160]=14;Xe[10]=Ke[10]=11;Ye[10]=Je[10]=14;$e[130]=Qe[130]=6;Ze[130]=je[130]=3;$e[40]=Qe[40]=6;Ze[40]=je[40]=3;Ye[101]=je[101]=1;Ye[69]=je[69]=1;Je[149]=Qe[149]=21;Je[21]=Qe[21]=21;$e[86]=Ke[86]=17;$e[84]=Ke[84]=17;Xe[89]=Ze[89]=9;Xe[81]=Ze[81]=9;Xe[96]=je[96]=0;Ye[96]=Ke[96]=15;Xe[74]=je[74]=0;Ye[74]=Ke[74]=15;Xe[24]=$e[24]=8;Ze[24]=Qe[24]=7;Xe[146]=$e[146]=8;Ze[146]=Qe[146]=7;Ye[6]=Ke[6]=15;$e[6]=Je[6]=16;Ye[164]=Ke[164]=15;$e[164]=Je[164]=16;Ze[129]=Qe[129]=7;Je[129]=je[129]=20;Ze[41]=Qe[41]=7;Je[41]=je[41]=20;$e[66]=je[66]=2;Ze[66]=Ke[66]=19;$e[104]=je[104]=2;Ze[104]=Ke[104]=19;Xe[144]=Je[144]=10;Ke[144]=Qe[144]=23;Xe[26]=Je[26]=10;Ke[26]=Qe[26]=23;Ye[36]=Qe[36]=5;$e[36]=je[36]=2;Ye[134]=Qe[134]=5;$e[134]=je[134]=2;Xe[9]=Je[9]=10;Ye[9]=Ze[9]=13;Xe[161]=Je[161]=10;Ye[161]=Ze[161]=13;Ye[37]=Qe[37]=5;Je[37]=je[37]=20;Ye[133]=Qe[133]=5;Je[133]=je[133]=20;$e[148]=Je[148]=16;Ke[148]=Qe[148]=23;$e[22]=Je[22]=16;Ke[22]=Qe[22]=23;Xe[82]=$e[82]=8;Ze[82]=Ke[82]=19;Xe[88]=$e[88]=8;Ze[88]=Ke[88]=19;Xe[73]=je[73]=0;Ye[73]=Ze[73]=13;Xe[97]=je[97]=0;Ye[97]=Ze[97]=13;Xe[145]=Ze[145]=9;Je[145]=Qe[145]=21;Xe[25]=Ze[25]=9;Je[25]=Qe[25]=21;Ye[70]=je[70]=1;$e[70]=Ke[70]=17;Ye[100]=je[100]=1;$e[100]=Ke[100]=17;Xe[34]=Ze[34]=9;Ye[34]=$e[34]=12;Je[34]=Qe[34]=21;Ke[34]=je[34]=22;Xe[136]=Qe[136]=4;Ye[136]=je[136]=1;$e[136]=Ke[136]=17;Ze[136]=Je[136]=18;Xe[35]=Qe[35]=4;Ye[35]=$e[35]=12;Ze[35]=Je[35]=18;Ke[35]=je[35]=22;Xe[153]=Qe[153]=4;Ze[153]=Je[153]=18;Ye[102]=$e[102]=12;Ke[102]=je[102]=22;Xe[155]=Ze[155]=9;Je[155]=Qe[155]=23;Ye[103]=je[103]=1;$e[103]=Ke[103]=17;Xe[152]=Qe[152]=4;$e[152]=Ke[152]=17;Ze[152]=Je[152]=18;Xe[156]=$e[156]=8;Ze[156]=Je[156]=18;Ke[156]=Qe[156]=23;Xe[137]=Qe[137]=4;Ye[137]=je[137]=1;Ze[137]=Je[137]=18;Xe[139]=Qe[139]=4;Ye[139]=Ze[139]=13;Je[139]=je[139]=20;Xe[98]=Ze[98]=9;Ye[98]=$e[98]=12;Ke[98]=je[98]=22;Xe[99]=je[99]=0;Ye[99]=$e[99]=12;Ze[99]=Ke[99]=19;Ye[38]=$e[38]=12;Je[38]=Qe[38]=21;Ke[38]=je[38]=22;Ye[39]=Qe[39]=5;$e[39]=Je[39]=16;Ke[39]=je[39]=22;var Ut=[];Ut[1]=Ut[169]=ld;Ut[4]=Ut[166]=cd;Ut[16]=Ut[154]=hd;Ut[64]=Ut[106]=fd;Ut[168]=Ut[2]=pd;Ut[162]=Ut[8]=dd;Ut[138]=Ut[32]=md;Ut[42]=Ut[128]=gd;Ut[5]=Ut[165]=vP;Ut[20]=Ut[150]=_P;Ut[80]=Ut[90]=xP;Ut[65]=Ut[105]=EP;Ut[160]=Ut[10]=MP;Ut[130]=Ut[40]=SP;Ut[85]=wP;Ut[101]=Ut[69]=bP;Ut[149]=Ut[21]=TP;Ut[86]=Ut[84]=AP;Ut[89]=Ut[81]=CP;Ut[96]=Ut[74]=PP;Ut[24]=Ut[146]=IP;Ut[6]=Ut[164]=RP;Ut[129]=Ut[41]=LP;Ut[66]=Ut[104]=NP;Ut[144]=Ut[26]=OP;Ut[36]=Ut[134]=DP;Ut[9]=Ut[161]=FP;Ut[37]=Ut[133]=UP;Ut[148]=Ut[22]=BP;Ut[82]=Ut[88]=zP;Ut[73]=Ut[97]=kP;Ut[145]=Ut[25]=GP;Ut[70]=Ut[100]=VP;Ut[34]=function(r){return[gd(r),dd(r)]};Ut[35]=HP;Ut[136]=function(r){return[md(r),pd(r)]};Ut[153]=function(r){return[hd(r),ld(r)]};Ut[102]=function(r){return[cd(r),fd(r)]};Ut[155]=WP;Ut[103]=qP;Ut[152]=function(r){return[hd(r),pd(r)]};Ut[156]=XP;Ut[137]=function(r){return[md(r),ld(r)]};Ut[139]=YP;Ut[98]=function(r){return[dd(r),fd(r)]};Ut[99]=$P;Ut[38]=function(r){return[cd(r),gd(r)]};Ut[39]=ZP;function KP(r){return(r>0)-(r<0)||+r}function hu(r,t,e){var o=t[0]-r[0],a=t[1]-r[1],l=e[0]-t[0],h=e[1]-t[1];return KP(o*h-l*a)}function M_(r,t){var e=r.geometry.coordinates[0].map(function(h){return h[0]}),o=r.geometry.coordinates[0].map(function(h){return h[1]}),a=t.geometry.coordinates[0].map(function(h){return h[0]}),l=t.geometry.coordinates[0].map(function(h){return h[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 yd(r,t){return t.geometry.coordinates[0].every(function(e){return Tr(Rn(e),r)})}function S_(r,t){return r[0]===t[0]&&r[1]===t[1]}var jP=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 h=hu(t.coordinates,a.coordinates,l.coordinates);if(h<0)return 1;if(h>0)return-1;var f=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 f-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}(),vd=jP;var QP=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 br([this.from.coordinates,this.to.coordinates])},r.prototype.compareTo=function(t){return hu(t.from.coordinates,t.to.coordinates,this.to.coordinates)},r}(),w_=QP;var tI=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(h,f,p){return f.from.coordinates[1]>t.edges[h].from.coordinates[1]&&(h=p),h},0),o=(e===0?this.length:e)-1,a=(e+1)%this.length,l=hu(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 ep(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=Vn([t])},r.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=xp(this.toPolygon())},r.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),a,l;return e.forEach(function(h){var f=h.getEnvelope();if(l&&(a=l.getEnvelope()),!M_(f,o)&&yd(f,o)){for(var p=t.map(function(b){return b.from.coordinates}),d=void 0,g=function(b){h.some(function(T){return S_(b,T.from.coordinates)})||(d=b)},_=0,y=p;_<y.length;_++){var M=y[_];g(M)}d&&h.inside(Rn(d))&&(!l||yd(a,f))&&(l=h)}}),l},r.prototype.inside=function(t){return Tr(t,this.toPolygon())},r}(),_d=tI;function eI(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 CB=function(){function r(){this.edges=[],this.nodes={}}return r.fromGeoJson=function(t){eI(t);var e=new r;return Ai(t,function(o){rp(o,"LineString","Graph::fromGeoJson"),g0(o,function(a,l){if(a){var h=e.getNode(a),f=e.getNode(l);e.addEdge(h,f)}return l})}),e},r.prototype.getNode=function(t){var e=vd.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new vd(t)),o},r.prototype.addEdge=function(t,e){var o=new w_(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,h=o.length-1;h>=0;--h){var f=o[h],p=f.symetric,d=void 0,g=void 0;f.label===e&&(d=f),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(h){h.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 _d;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 oI=Wn(xd(),1);var sI=Wn(xd(),1);var uI=Wn(N_(),1);var mI=Wn(H_(),1);function q_(r){for(var t=r,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function yI(){return new X_(function(r){return r.f})}var wd={search:function(r,t,e,o){r.cleanDirty(),o=o||{};var a=o.heuristic||wd.heuristics.manhattan,l=o.closest||!1,h=yI(),f=t;for(t.h=a(t,e),h.push(t);h.size()>0;){var p=h.pop();if(p===e)return q_(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),b=y.visited;(!b||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<f.h||y.h===f.h&&y.g<f.g)&&(f=y),b?h.rescoreElement(y):h.push(y))}}}return l?q_(f):[]},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 sl(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 ih(e,o,a[o]);this.grid[e][o]=l,this.nodes.push(l)}}this.init()}sl.prototype.init=function(){this.dirtyNodes=[];for(var r=0;r<this.nodes.length;r++)wd.cleanNode(this.nodes[r])};sl.prototype.cleanDirty=function(){for(var r=0;r<this.dirtyNodes.length;r++)wd.cleanNode(this.dirtyNodes[r]);this.dirtyNodes=[]};sl.prototype.markDirty=function(r){this.dirtyNodes.push(r)};sl.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};sl.prototype.toString=function(){for(var r=[],t=this.grid,e,o,a,l,h=0,f=t.length;h<f;h++){for(e=[],o=t[h],a=0,l=o.length;a<l;a++)e.push(o[a].weight);r.push(e.join(" "))}return r.join(`\n`)};function ih(r,t,e){this.x=r,this.y=t,this.weight=e}ih.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};ih.prototype.getCost=function(r){return r&&r.x!==this.x&&r.y!==this.y?this.weight*1.41421:this.weight};ih.prototype.isWall=function(){return this.weight===0};function X_(r){this.content=[],this.scoreFunction=r}X_.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,h=null,f;if(l<t){var p=this.content[l];f=this.scoreFunction(p),f<o&&(h=l)}if(a<t){var d=this.content[a],g=this.scoreFunction(d);g<(h===null?o:f)&&(h=a)}if(h!==null)this.content[r]=this.content[h],this.content[h]=e,r=h;else break}}};function bd(){this._=null}function pu(r){r.U=r.C=r.L=r.R=r.P=r.N=null}bd.prototype={constructor:bd,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=Y_(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&&(al(this,e),r=e,e=r.U),e.C=!1,o.C=!0,ul(this,o))):(a=o.L,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.L&&(ul(this,e),r=e,e=r.U),e.C=!1,o.C=!0,al(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,h;if(o?a?l=Y_(a):l=o:l=a,t?t.L===r?t.L=l:t.R=l:this._=l,o&&a?(h=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)):(h=r.C,r=l),r&&(r.U=t),!h){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,al(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,ul(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,al(this,t),r=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,ul(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,al(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,ul(this,t),r=this._;break}e.C=!0,r=t,t=t.U}while(!r.C);r&&(r.C=!1)}}};function al(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 ul(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 Y_(r){for(;r.L;)r=r.L;return r}var Td=bd;function du(r,t,e,o){var a=[null,null],l=Cr.push(a)-1;return a.left=r,a.right=t,e&&ll(a,r,t,e),o&&ll(a,t,r,o),si[r.index].halfedges.push(l),si[t.index].halfedges.push(l),a}function mu(r,t,e){var o=[t,e];return o.left=r,o}function ll(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 vI(r,t,e,o,a){var l=r[0],h=r[1],f=l[0],p=l[1],d=h[0],g=h[1],_=0,y=1,M=d-f,b=g-p,T;if(T=t-f,!(!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-f,!(!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,!(!b&&T>0)){if(T/=b,b<0){if(T<_)return;T<y&&(y=T)}else if(b>0){if(T>y)return;T>_&&(_=T)}if(T=a-p,!(!b&&T<0)){if(T/=b,b<0){if(T>y)return;T>_&&(_=T)}else if(b>0){if(T<_)return;T<y&&(y=T)}return!(_>0)&&!(y<1)||(_>0&&(r[0]=[f+_*M,p+_*b]),y<1&&(r[1]=[f+y*M,p+y*b])),!0}}}}}function _I(r,t,e,o,a){var l=r[1];if(l)return!0;var h=r[0],f=r.left,p=r.right,d=f[0],g=f[1],_=p[0],y=p[1],M=(d+_)/2,b=(g+y)/2,T,x;if(y===g){if(M<t||M>=o)return;if(d>_){if(!h)h=[M,e];else if(h[1]>=a)return;l=[M,a]}else{if(!h)h=[M,a];else if(h[1]<e)return;l=[M,e]}}else if(T=(d-_)/(y-g),x=b-T*M,T<-1||T>1)if(d>_){if(!h)h=[(e-x)/T,e];else if(h[1]>=a)return;l=[(a-x)/T,a]}else{if(!h)h=[(a-x)/T,a];else if(h[1]<e)return;l=[(e-x)/T,e]}else if(g<y){if(!h)h=[t,T*t+x];else if(h[0]>=o)return;l=[o,T*o+x]}else{if(!h)h=[o,T*o+x];else if(h[0]<t)return;l=[t,T*t+x]}return r[0]=h,r[1]=l,!0}function $_(r,t,e,o){for(var a=Cr.length,l;a--;)(!_I(l=Cr[a],r,t,e,o)||!vI(l,r,t,e,o)||!(Math.abs(l[0][0]-l[1][0])>Sn||Math.abs(l[0][1]-l[1][1])>Sn))&&delete Cr[a]}function Z_(r){return si[r.index]={site:r,halfedges:[]}}function xI(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 Ad(r,t){return t[+(t.left!==r.site)]}function EI(r,t){return t[+(t.left===r.site)]}function J_(){for(var r=0,t=si.length,e,o,a,l;r<t;++r)if((e=si[r])&&(l=(o=e.halfedges).length)){var h=new Array(l),f=new Array(l);for(a=0;a<l;++a)h[a]=a,f[a]=xI(e,Cr[o[a]]);for(h.sort(function(p,d){return f[d]-f[p]}),a=0;a<l;++a)f[a]=o[h[a]];for(a=0;a<l;++a)o[a]=f[a]}}function K_(r,t,e,o){var a=si.length,l,h,f,p,d,g,_,y,M,b,T,x,v=!0;for(l=0;l<a;++l)if(h=si[l]){for(f=h.site,d=h.halfedges,p=d.length;p--;)Cr[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)b=EI(h,Cr[d[p]]),T=b[0],x=b[1],_=Ad(h,Cr[d[++p%g]]),y=_[0],M=_[1],(Math.abs(T-y)>Sn||Math.abs(x-M)>Sn)&&(d.splice(p,0,Cr.push(mu(f,b,Math.abs(T-r)<Sn&&o-x>Sn?[r,Math.abs(y-r)<Sn?M:o]:Math.abs(x-o)<Sn&&e-T>Sn?[Math.abs(M-o)<Sn?y:e,o]:Math.abs(T-e)<Sn&&x-t>Sn?[e,Math.abs(y-e)<Sn?M:t]:Math.abs(x-t)<Sn&&T-r>Sn?[Math.abs(M-t)<Sn?y:r,t]:null))-1),++g);g&&(v=!1)}if(v){var P,S,L,N=1/0;for(l=0,v=null;l<a;++l)(h=si[l])&&(f=h.site,P=f[0]-r,S=f[1]-t,L=P*P+S*S,L<N&&(N=L,v=h));if(v){var G=[r,t],B=[r,o],I=[e,o],O=[e,t];v.halfedges.push(Cr.push(mu(f=v.site,G,B))-1,Cr.push(mu(f,B,I))-1,Cr.push(mu(f,I,O))-1,Cr.push(mu(f,O,G))-1)}}for(l=0;l<a;++l)(h=si[l])&&(h.halfedges.length||delete si[l])}var j_=[],oh;function MI(){pu(this),this.x=this.y=this.arc=this.site=this.cy=null}function ra(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 h=a[0],f=a[1],p=o[0]-h,d=o[1]-f,g=l[0]-h,_=l[1]-f,y=2*(p*_-d*g);if(!(y>=-Q_)){var M=p*p+d*d,b=g*g+_*_,T=(_*M-d*b)/y,x=(p*b-g*M)/y,v=j_.pop()||new MI;v.arc=r,v.site=a,v.x=T+h,v.y=(v.cy=x+f)+Math.sqrt(T*T+x*x),r.circle=v;for(var P=null,S=gu._;S;)if(v.y<S.y||v.y===S.y&&v.x<=S.x)if(S.L)S=S.L;else{P=S.P;break}else if(S.R)S=S.R;else{P=S;break}gu.insert(P,v),P||(oh=v)}}}}function ia(r){var t=r.circle;t&&(t.P||(oh=t.N),gu.remove(t),j_.push(t),pu(t),r.circle=null)}var e1=[];function SI(){pu(this),this.edge=this.site=this.circle=null}function t1(r){var t=e1.pop()||new SI;return t.site=r,t}function Cd(r){ia(r),oa.remove(r),e1.push(r),pu(r)}function n1(r){var t=r.circle,e=t.x,o=t.cy,a=[e,o],l=r.P,h=r.N,f=[r];Cd(r);for(var p=l;p.circle&&Math.abs(e-p.circle.x)<Sn&&Math.abs(o-p.circle.cy)<Sn;)l=p.P,f.unshift(p),Cd(p),p=l;f.unshift(p),ia(p);for(var d=h;d.circle&&Math.abs(e-d.circle.x)<Sn&&Math.abs(o-d.circle.cy)<Sn;)h=d.N,f.push(d),Cd(d),d=h;f.push(d),ia(d);var g=f.length,_;for(_=1;_<g;++_)d=f[_],p=f[_-1],ll(d.edge,p.site,d.site,a);p=f[0],d=f[g-1],d.edge=du(p.site,d.site,null,a),ra(p),ra(d)}function r1(r){for(var t=r[0],e=r[1],o,a,l,h,f=oa._;f;)if(l=i1(f,e)-t,l>Sn)f=f.L;else if(h=t-wI(f,e),h>Sn){if(!f.R){o=f;break}f=f.R}else{l>-Sn?(o=f.P,a=f):h>-Sn?(o=f,a=f.N):o=a=f;break}Z_(r);var p=t1(r);if(oa.insert(o,p),!(!o&&!a)){if(o===a){ia(o),a=t1(o.site),oa.insert(p,a),p.edge=a.edge=du(o.site,p.site),ra(o),ra(a);return}if(!a){p.edge=du(o.site,p.site);return}ia(o),ia(a);var d=o.site,g=d[0],_=d[1],y=r[0]-g,M=r[1]-_,b=a.site,T=b[0]-g,x=b[1]-_,v=2*(y*x-M*T),P=y*y+M*M,S=T*T+x*x,L=[(x*P-M*S)/v+g,(y*S-T*P)/v+_];ll(a.edge,d,b,L),p.edge=du(d,r,null,L),a.edge=du(r,b,null,L),ra(o),ra(a)}}function i1(r,t){var e=r.site,o=e[0],a=e[1],l=a-t;if(!l)return o;var h=r.P;if(!h)return-1/0;e=h.site;var f=e[0],p=e[1],d=p-t;if(!d)return f;var g=f-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+f)/2}function wI(r,t){var e=r.N;if(e)return i1(e,t);var o=r.site;return o[1]===t?o[0]:1/0}var Sn=1e-6,Q_=1e-12,oa,si,gu,Cr;function bI(r,t,e){return(r[0]-e[0])*(t[1]-r[1])-(r[0]-t[0])*(e[1]-r[1])}function TI(r,t){return t[1]-r[1]||t[0]-r[0]}function sh(r,t){var e=r.sort(TI).pop(),o,a,l;for(Cr=[],si=new Array(r.length),oa=new Td,gu=new Td;;)if(l=oh,e&&(!l||e[1]<l.y||e[1]===l.y&&e[0]<l.x))(e[0]!==o||e[1]!==a)&&(r1(e),o=e[0],a=e[1]),e=r.pop();else if(l)n1(l.arc);else break;if(J_(),t){var h=+t[0][0],f=+t[0][1],p=+t[1][0],d=+t[1][1];$_(h,f,p,d),K_(h,f,p,d)}this.edges=Cr,this.cells=si,oa=gu=Cr=si=null}sh.prototype={constructor:sh,polygons:function(){var r=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return Ad(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(f=(l=e.halfedges).length)for(var a=e.site,l,h=-1,f,p,d=t[l[f-1]],g=d.left===a?d.right:d.left;++h<f;)p=g,d=t[l[h]],g=d.left===a?d.right:d.left,p&&g&&o<p.index&&o<g.index&&bI(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,h=o.cells.length,f;!(f=o.cells[l]);)if(++l>=h)return null;var p=r-f.site[0],d=t-f.site[1],g=p*p+d*d;do f=o.cells[a=l],l=null,f.halfedges.forEach(function(_){var y=o.edges[_],M=y.left;if(!((M===f.site||!M)&&!(M=y.right))){var b=r-M[0],T=t-M[1],x=b*b+T*T;x<g&&(g=x,l=M.index)}});while(l!==null);return o._found=a,e==null||g<=e*e?f.site:null}};var OI=Wn(yu(),1);var Hd=Wn(u1(),1);function mi(){return new lh}function lh(){this.reset()}lh.prototype={constructor:lh,reset:function(){this.s=this.t=0},add:function(r){l1(uh,r,this.t),l1(this,uh.s,this.s),this.s?this.t+=uh.t:this.s=uh.t},valueOf:function(){return this.s}};var uh=new lh;function l1(r,t,e){var o=r.s=t+e,a=o-t,l=o-a;r.t=t-l+(e-a)}var hn=1e-6;var _n=Math.PI,dr=_n/2,ch=_n/4,Mo=_n*2,sa=180/_n,gi=_n/180,Zn=Math.abs,oo=Math.atan,yi=Math.atan2,nn=Math.cos;var hh=Math.exp;var cl=Math.log;var ve=Math.sin;var zr=Math.sqrt,hl=Math.tan;function Rd(r){return r>1?0:r<-1?_n:Math.acos(r)}function ai(r){return r>1?dr:r<-1?-dr:Math.asin(r)}function so(){}var DI=mi(),M4=mi();function aa(r){var t=r[0],e=r[1],o=nn(e);return[o*nn(t),o*ve(t),ve(e)]}function fl(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 pl(r){var t=zr(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}var L4=mi();function h1(r,t){return[r>_n?r-Mo:r<-_n?r+Mo:r,t]}h1.invert=h1;function Ld(){var r=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){r.push(t=[])},lineEnd:so,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function Nd(r,t){return Zn(r[0]-t[0])<hn&&Zn(r[1]-t[1])<hn}function fh(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 Od(r,t,e,o,a){var l=[],h=[],f,p;if(r.forEach(function(b){if(!((T=b.length-1)<=0)){var T,x=b[0],v=b[T],P;if(Nd(x,v)){for(a.lineStart(),f=0;f<T;++f)a.point((x=b[f])[0],x[1]);a.lineEnd();return}l.push(P=new fh(x,b,null,!0)),h.push(P.o=new fh(x,null,P,!1)),l.push(P=new fh(v,b,null,!1)),h.push(P.o=new fh(v,null,P,!0))}}),!!l.length){for(h.sort(t),f1(l),f1(h),f=0,p=h.length;f<p;++f)h[f].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(f=0,p=g.length;f<p;++f)a.point((_=g[f])[0],_[1]);else o(y.x,y.n.x,1,a);y=y.n}else{if(M)for(g=y.p.z,f=g.length-1;f>=0;--f)a.point((_=g[f])[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 f1(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 Ts(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function Dd(r){return r.length===1&&(r=BI(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 BI(r){return function(t,e){return Ts(r(t),e)}}var p1=Dd(Ts),zI=p1.right,kI=p1.left;var d1=Array.prototype,VI=d1.slice,HI=d1.map;var wG=Math.sqrt(50),bG=Math.sqrt(10),TG=Math.sqrt(2);function dh(r){for(var t=r.length,e,o=-1,a=0,l,h;++o<t;)a+=r[o].length;for(l=new Array(a);--t>=0;)for(h=r[t],e=h.length;--e>=0;)l[--a]=h[e];return l}var KI=1e9,lV=-KI;var Fd=mi();function Ud(r,t){var e=t[0],o=t[1],a=[ve(e),-nn(e),0],l=0,h=0;Fd.reset();for(var f=0,p=r.length;f<p;++f)if(g=(d=r[f]).length)for(var d,g,_=d[g-1],y=_[0],M=_[1]/2+ch,b=ve(M),T=nn(M),x=0;x<g;++x,y=P,b=L,T=N,_=v){var v=d[x],P=v[0],S=v[1]/2+ch,L=ve(S),N=nn(S),G=P-y,B=G>=0?1:-1,I=B*G,O=I>_n,q=b*L;if(Fd.add(yi(q*B*ve(I),T*N+q*nn(I))),l+=O?G+B*Mo:G,O^y>=e^P>=e){var st=fl(aa(_),aa(v));pl(st);var V=fl(a,st);pl(V);var Mt=(O^G>=0?-1:1)*ai(V[2]);(o>Mt||o===Mt&&(st[0]||st[1]))&&(h+=O^G>=0?1:-1)}}return(l<-hn||l<hn&&Fd<-hn)^h&1}var _V=mi();var BV=mi(),zV=mi();var tR=1/0;var VV=-tR;function Bd(r){this._context=r}Bd.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:so};var jV=mi();function zd(){this._string=[]}zd.prototype={_radius:4.5,_circle:y1(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=y1(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 y1(r){return"m0,"+r+"a"+r+","+r+" 0 1,1 0,"+-2*r+"a"+r+","+r+" 0 1,1 0,"+2*r+"z"}function kd(r,t,e,o){return function(a,l){var h=t(l),f=a.invert(o[0],o[1]),p=Ld(),d=t(p),g=!1,_,y,M,b={point:T,lineStart:v,lineEnd:P,polygonStart:function(){b.point=S,b.lineStart=L,b.lineEnd=N,y=[],_=[]},polygonEnd:function(){b.point=T,b.lineStart=v,b.lineEnd=P,y=dh(y);var G=Ud(_,f);y.length?(g||(l.polygonStart(),g=!0),Od(y,rR,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,B){var I=a(G,B);r(G=I[0],B=I[1])&&l.point(G,B)}function x(G,B){var I=a(G,B);h.point(I[0],I[1])}function v(){b.point=x,h.lineStart()}function P(){b.point=T,h.lineEnd()}function S(G,B){M.push([G,B]);var I=a(G,B);d.point(I[0],I[1])}function L(){d.lineStart(),M=[]}function N(){S(M[0][0],M[0][1]),d.lineEnd();var G=d.clean(),B=p.result(),I,O=B.length,q,st,V;if(M.pop(),_.push(M),M=null,!!O){if(G&1){if(st=B[0],(q=st.length-1)>0){for(g||(l.polygonStart(),g=!0),l.lineStart(),I=0;I<q;++I)l.point((V=st[I])[0],V[1]);l.lineEnd()}return}O>1&&G&2&&B.push(B.pop().concat(B.shift())),y.push(B.filter(nR))}}return b}}function nR(r){return r.length>1}function rR(r,t){return((r=r.x)[0]<0?r[1]-dr-hn:dr-r[1])-((t=t.x)[0]<0?t[1]-dr-hn:dr-t[1])}var iR=kd(function(){return!0},oR,aR,[-_n,-dr]);function oR(r){var t=NaN,e=NaN,o=NaN,a;return{lineStart:function(){r.lineStart(),a=1},point:function(l,h){var f=l>0?_n:-_n,p=Zn(l-t);Zn(p-_n)<hn?(r.point(t,e=(e+h)/2>0?dr:-dr),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(f,e),r.point(l,e),a=0):o!==f&&p>=_n&&(Zn(t-o)<hn&&(t-=o*hn),Zn(l-f)<hn&&(l-=f*hn),e=sR(t,e,l,h),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(f,e),a=0),r.point(t=l,e=h),o=f},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-a}}}function sR(r,t,e,o){var a,l,h=ve(r-e);return Zn(h)>hn?oo((ve(t)*(l=nn(o))*ve(e)-ve(o)*(a=nn(t))*ve(r))/(a*l*h)):(t+o)/2}function aR(r,t,e,o){var a;if(r==null)a=e*dr,o.point(-_n,a),o.point(0,a),o.point(_n,a),o.point(_n,0),o.point(_n,-a),o.point(0,-a),o.point(-_n,-a),o.point(-_n,0),o.point(-_n,a);else if(Zn(r[0]-t[0])>hn){var l=r[0]<t[0]?_n:-_n;a=e*l/2,o.point(-l,a),o.point(0,a),o.point(l,a)}else o.point(t[0],t[1])}function mh(r){return function(t){var e=new Gd;for(var o in r)e[o]=r[o];return e.stream=t,e}}function Gd(){}Gd.prototype={constructor:Gd,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 zH=nn(30*gi);var QH=mh({point:function(r,t){this.stream.point(r*gi,t*gi)}});function gh(r){return function(t,e){var o=nn(t),a=nn(e),l=r(o*a);return[l*a*ve(t),l*ve(e)]}}function So(r){return function(t,e){var o=zr(t*t+e*e),a=r(o),l=ve(a),h=nn(a);return[yi(t*l,o*h),ai(o&&e*l/o)]}}var w1=gh(function(r){return zr(2/(1+r))});w1.invert=So(function(r){return 2*ai(r/2)});var b1=gh(function(r){return(r=Rd(r))&&r/ve(r)});b1.invert=So(function(r){return r});function Vd(r,t){return[r,cl(hl((dr+t)/2))]}Vd.invert=function(r,t){return[r,2*oo(hh(t))-dr]};function yh(r,t){return[r,t]}yh.invert=yh;function T1(r,t){var e=nn(t),o=nn(r)*e;return[e*ve(r)/o,ve(t)/o]}T1.invert=So(oo);function A1(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)))]}A1.invert=function(r,t){var e=t,o=25,a;do{var l=e*e,h=l*l;e-=a=(e*(1.007226+l*(.015085+h*(-.044475+.028874*l-.005916*h)))-t)/(1.007226+l*(.015085*3+h*(-.044475*7+.028874*9*l-.005916*11*h)))}while(Zn(a)>hn&&--o>0);return[r/(.8707+(l=e*e)*(-.131979+l*(-.013791+l*l*l*(.003971-.001529*l)))),e]};function C1(r,t){return[nn(t)*ve(r),ve(t)]}C1.invert=So(ai);function P1(r,t){var e=nn(t),o=1+nn(r)*e;return[e*ve(r)/o,ve(t)/o]}P1.invert=So(function(r){return 2*oo(r)});function I1(r,t){return[cl(hl((dr+t)/2)),-r]}I1.invert=function(r,t){return[-t,2*oo(hh(r))-dr]};var pR=Wn(yu(),1);var dR=Wn(yu(),1);var gR=Wn(yu(),1);var yR=Wn(yu(),1);function Cs(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}function Wd(r){let t=0;for(let e=0;e<r.length-1;e++)t+=Cs(r[e],r[e+1]);return t}function L1(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]),h=o.angleTo(a)*180/Math.PI,f=new fn(t[0]-r[0],t[1]-r[1]);return new fn(e[0]-r[0],e[1]-r[1]).cross(f)>0?h:-h}var Gi="___",vh=class{constructor(t=3){this.lift_priority=t;Si(this,"roadInfo",[]);Si(this,"pointMap",new Map);Si(this,"nodeMap",new Map);Si(this,"facilityMap",new Map);Si(this,"straightLadderMap",new Map);Si(this,"escalatorMap",new Map);Si(this,"staircaseMap",new Map);Si(this,"lineMap",new Map);Si(this,"baseRoute",new wo.default);Si(this,"escalatorRoute",new wo.default);Si(this,"straightLadderRoute",new wo.default)}initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(o=>{let a=`${e.floor}${Gi}${o.id}`;if(this.pointMap.set(a,o),this.nodeMap.set(`${o.floor}${Gi}${o.nodeId}`,a),o.type==="straightLadder"){let l=this.straightLadderMap.get(o.name)||[];l.push(Sl({},o)),this.straightLadderMap.set(o.name,l)}if(o.type==="staircase"){let l=this.staircaseMap.get(o.name)||[];l.push(Sl({},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(Sl({},o)),this.facilityMap.set(o.targetId,l)}}),e.lines.filter(o=>o.direction!=="no").forEach(o=>{var p,d;let a=`${e.floor}${Gi}${o.from}`,l=`${e.floor}${Gi}${o.to}`,h=(p=this.pointMap.get(a))==null?void 0:p.cds,f=(d=this.pointMap.get(l))==null?void 0:d.cds;if(h!=null&&h.length&&(f!=null&&f.length)){let g=Cs(h,f);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,h])=>{var f,p;if(!(h.length<2))for(let d=0;d<h.length;d++){let g=`${h[d].floor}${Gi}${h[d].id}`;for(let _=0;_<h.length;_++)if(d!==_){let y=`${h[_].floor}${Gi}${h[_].id}`,M=(f=this.pointMap.get(g))==null?void 0:f.cds,b=(p=this.pointMap.get(y))==null?void 0:p.cds;if(M!=null&&M.length&&(b!=null&&b.length))if(h[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,h)=>{var f,p;if(l.start&&l.end){let d=`${l.start.floor}${Gi}${l.start.id}`,g=`${l.end.floor}${Gi}${l.end.id}`,_=(f=this.pointMap.get(d))==null?void 0:f.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 wo.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 wo.default(t)}initStraightLadderRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new wo.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}${Gi}${t.nodeId}`);if(o){let[a,l]=o.split(Gi);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,h)=>{let f=Cs(t.coord,h.cds);return f<l.min&&(l.min=f,l.point=h),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 h=this.getBasePath.bind(this);switch(o){case"escalator":h=this.getEscalatorPath.bind(this);break;case"straightLadder":h=this.getStraightLadderPath.bind(this);break;default:h=this.getBasePath.bind(this);break}if(l.id)return h(a,l);if(l.facility){let f=this.facilityMap.get(l.facility).filter(d=>l.floor?d.floor===l.floor:!0);if(!f.length)return null;let p=f.map(d=>h(a,{floor:d.floor,id:d.id})).filter(d=>!!d);return p.reduce((d,g)=>{let _=g.reduce((y,M)=>y+Wd(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}${Gi}${t.id}`,l=`${e.floor}${Gi}${e.id}`,h=o.path(a,l);if(!h)return null;let f=[];return h.map(p=>{var g;let d=this.pointMap.get(p);if(d){let{floor:_}=d;if(((g=f[f.length-1])==null?void 0:g.floor)===_){let y=f[f.length-1];y.points.push(d.cds),y.endType=d.type,y.destId=d.nodeId,y.distance=Wd(y.points)}else f.push({floor:_,points:[d.cds],endType:d.type,destId:d.nodeId,distance:0})}}),f}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 wo.default,this.escalatorRoute=new wo.default,this.straightLadderRoute=new wo.default}};var TR=Wn(U1(),1);function AR(r,t,e){let o=L1(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 B1(r){if(!r.length)return[];let t=[{direction:"start",distance:Cs(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let o=AR(r[e-2],r[e-1],r[e]);if(o==="front"){let a=t[t.length-1],l=Cs(r[e-1],r[e]);a.distance+=l,e!==2&&a.points.push(r[e-1])}else t.push({direction:o,distance:Cs(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}function z1(r){return r.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function k1(r){let t={};for(let o in r)o.startsWith("on")&&(t[z1(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 qd=new vh;k1({onSetRoadInfo({roadData:r}){qd.initRoute(r)},onGetPath({start:r,end:t,type:e}){return qd.getPath(r,t,e)},onGetDirectionPath(r){return B1(r)},onClear(){qd.clear()}});\n/*! Bundled license information:\n\nobject-assign/index.js:\n (*\n object-assign\n (c) Sindre Sorhus\n @license MIT\n *)\n\npolygon-clipping/dist/polygon-clipping.umd.js:\n (**\n * splaytree v3.1.2\n * Fast Splay tree for Node and browser\n *\n * @author Alexander Milevski <info@w8r.name>\n * @license MIT\n * @preserve\n *)\n (*! *****************************************************************************\n Copyright (c) Microsoft Corporation. All rights reserved.\n Licensed under the Apache License, Version 2.0 (the "License"); you may not use\n this file except in compliance with the License. You may obtain a copy of the\n License at http://www.apache.org/licenses/LICENSE-2.0\n \n THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n MERCHANTABLITY OR NON-INFRINGEMENT.\n \n See the Apache Version 2.0 License for specific language governing permissions\n and limitations under the License.\n ***************************************************************************** *)\n\nthree/build/three.module.js:\n (**\n * @license\n * Copyright 2010-2023 Three.js Authors\n * SPDX-License-Identifier: MIT\n *)\n\n@turf/isolines/dist/es/index.js:\n (**\n * @license GNU Affero General Public License.\n * Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>\n * v. 1.2.0\n * https://github.com/RaumZeit/MarchingSquares.js\n *\n * MarchingSquaresJS is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * MarchingSquaresJS is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * As additional permission under GNU Affero General Public License version 3\n * section 7, third-party projects (personal or commercial) may distribute,\n * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the\n * requirement that said third-party project for that reason alone becomes\n * subject to any requirement of the GNU Affero General Public License version 3.\n * Any modifications to MarchingSquaresJS, however, must be shared with the public\n * and made available.\n *\n * In summary this:\n * - allows you to use MarchingSquaresJS at no cost\n * - allows you to use MarchingSquaresJS for both personal and commercial purposes\n * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any\n * license as long as this license notice is included\n * - enables you to keep the source code of your program that uses MarchingSquaresJS\n * undisclosed\n * - forces you to share any modifications you have made to MarchingSquaresJS,\n * e.g. bug-fixes\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.\n *)\n\n@turf/isobands/dist/es/index.js:\n (*!\n * @license GNU Affero General Public License.\n * Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>\n * v. 1.2.0\n * https://github.com/RaumZeit/MarchingSquares.js\n *\n * MarchingSquaresJS is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * MarchingSquaresJS is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * As additional permission under GNU Affero General Public License version 3\n * section 7, third-party projects (personal or commercial) may distribute,\n * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the\n * requirement that said third-party project for that reason alone becomes\n * subject to any requirement of the GNU Affero General Public License version 3.\n * Any modifications to MarchingSquaresJS, however, must be shared with the public\n * and made available.\n *\n * In summary this:\n * - allows you to use MarchingSquaresJS at no cost\n * - allows you to use MarchingSquaresJS for both personal and commercial purposes\n * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any\n * license as long as this license notice is included\n * - enables you to keep the source code of your program that uses MarchingSquaresJS\n * undisclosed\n * - forces you to share any modifications you have made to MarchingSquaresJS,\n * e.g. bug-fixes\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.\n *)\n*/\n');
|
|
9200
|
+
return inlineWorker('var $1=Object.create;var Rh=Object.defineProperty;var Z1=Object.getOwnPropertyDescriptor;var J1=Object.getOwnPropertyNames,fm=Object.getOwnPropertySymbols,K1=Object.getPrototypeOf,pm=Object.prototype.hasOwnProperty,j1=Object.prototype.propertyIsEnumerable;var Ih=(r,t,e)=>t in r?Rh(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Sl=(r,t)=>{for(var e in t||(t={}))pm.call(t,e)&&Ih(r,e,t[e]);if(fm)for(var e of fm(t))j1.call(t,e)&&Ih(r,e,t[e]);return r};var Ht=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var Q1=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of J1(t))!pm.call(r,a)&&a!==e&&Rh(r,a,{get:()=>t[a],enumerable:!(o=Z1(t,a))||o.enumerable});return r};var Wn=(r,t,e)=>(e=r!=null?$1(K1(r)):{},Q1(t||!r||!r.__esModule?Rh(e,"default",{value:r,enumerable:!0}):e,r));var Si=(r,t,e)=>Ih(r,typeof t!="symbol"?t+"":t,e);var mm=Ht((PR,dm)=>{var Lh=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError(\'"priority" must be a number\');return this.keys.has(t)?this.queue.map(a=>(a.key===t&&Object.assign(a,{priority:o}),a)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};dm.exports=Lh});var vm=Ht((IR,ym)=>{function gm(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,gm(a,t)):o!==t&&e.set(o,a);return e}ym.exports=gm});var Em=Ht((RR,xm)=>{function tx(r){let t=Number(r);return!(isNaN(t)||t<=0)}function _m(r){let t=new Map;return Object.keys(r).forEach(o=>{let a=r[o];if(a!==null&&typeof a=="object"&&!Array.isArray(a))return t.set(o,_m(a));if(!tx(a))throw new Error(`Could not add node at key "${o}", make sure it\'s a valid node`,a);return t.set(o,Number(a))}),t}xm.exports=_m});var wm=Ht((LR,Sm)=>{function Mm(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){Mm(t);return}if(typeof t!="number"||t<=0)throw new Error(`Values must be numbers greater than 0. Found value ${t} at ${e}`)})}Sm.exports=Mm});var Cm=Ht((NR,Am)=>{var ex=mm(),nx=vm(),bm=Em(),Tm=wm(),Nh=class{constructor(t){t instanceof Map?(Tm(t),this.graph=t):t?this.graph=bm(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(Tm(e),o=e):o=bm(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=nx(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,l=new ex,h=new Map,f=[],p=0,d=[];if(o.avoid&&(d=[].concat(o.avoid)),d.includes(t))throw new Error(`Starting node (${t}) cannot be avoided`);if(d.includes(e))throw new Error(`Ending node (${e}) cannot be avoided`);for(l.set(t,0);!l.isEmpty();){let g=l.next();if(g.key===e){p=g.priority;let y=g.key;for(;h.has(y);)f.push(y),y=h.get(y);break}a.add(g.key),(this.graph.get(g.key)||new Map).forEach((y,M)=>{if(a.has(M)||d.includes(M))return null;if(!l.has(M))return h.set(M,g.key),l.set(M,g.priority+y);let b=l.get(M).priority,T=g.priority+y;return T<b?(h.set(M,g.key),l.set(M,T)):null})}return f.length?(o.trim?f.shift():f=f.concat([t]),o.reverse||(f=f.reverse()),o.cost?{path:f,cost:p}:f):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};Am.exports=Nh});var dc=Ht((VR,v0)=>{"use strict";var y0=Object.getOwnPropertySymbols,rT=Object.prototype.hasOwnProperty,iT=Object.prototype.propertyIsEnumerable;function oT(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function sT(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(l){return t[l]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(l){a[l]=l}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(l){return!1}}v0.exports=sT()?Object.assign:function(r,t){for(var e,o=oT(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var h in e)rT.call(e,h)&&(o[h]=e[h]);if(y0){a=y0(e);for(var f=0;f<a.length;f++)iT.call(e,a[f])&&(o[a[f]]=e[a[f]])}}return o}});var sp=Ht((ip,op)=>{(function(r,t){typeof ip=="object"&&typeof op!="undefined"?op.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(ip,function(){"use strict";function r(x,v,P,S,L){(function N(G,B,I,O,q){for(;O>I;){if(O-I>600){var st=O-I+1,V=B-I+1,Mt=Math.log(st),$=.5*Math.exp(2*Mt/3),ut=.5*Math.sqrt(Mt*$*(st-$)/st)*(V-st/2<0?-1:1),xt=Math.max(I,Math.floor(B-V*$/st+ut)),mt=Math.min(O,Math.floor(B+(st-V)*$/st+ut));N(G,B,xt,mt,q)}var lt=G[B],ht=I,k=O;for(t(G,I,B),q(G[O],lt)>0&&t(G,I,O);ht<k;){for(t(G,ht,k),ht++,k--;q(G[ht],lt)<0;)ht++;for(;q(G[k],lt)>0;)k--}q(G[I],lt)===0?t(G,I,k):t(G,++k,O),k<=B&&(I=k+1),B<=k&&(O=k-1)}})(x,v,P||0,S||x.length-1,L||e)}function t(x,v,P){var S=x[v];x[v]=x[P],x[P]=S}function e(x,v){return x<v?-1:x>v?1:0}var o=function(x){x===void 0&&(x=9),this._maxEntries=Math.max(4,x),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(x,v,P){if(!P)return v.indexOf(x);for(var S=0;S<v.length;S++)if(P(x,v[S]))return S;return-1}function l(x,v){h(x,0,x.children.length,v,x)}function h(x,v,P,S,L){L||(L=b(null)),L.minX=1/0,L.minY=1/0,L.maxX=-1/0,L.maxY=-1/0;for(var N=v;N<P;N++){var G=x.children[N];f(L,x.leaf?S(G):G)}return L}function f(x,v){return x.minX=Math.min(x.minX,v.minX),x.minY=Math.min(x.minY,v.minY),x.maxX=Math.max(x.maxX,v.maxX),x.maxY=Math.max(x.maxY,v.maxY),x}function p(x,v){return x.minX-v.minX}function d(x,v){return x.minY-v.minY}function g(x){return(x.maxX-x.minX)*(x.maxY-x.minY)}function _(x){return x.maxX-x.minX+(x.maxY-x.minY)}function y(x,v){return x.minX<=v.minX&&x.minY<=v.minY&&v.maxX<=x.maxX&&v.maxY<=x.maxY}function M(x,v){return v.minX<=x.maxX&&v.minY<=x.maxY&&v.maxX>=x.minX&&v.maxY>=x.minY}function b(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(x,v,P,S,L){for(var N=[v,P];N.length;)if(!((P=N.pop())-(v=N.pop())<=S)){var G=v+Math.ceil((P-v)/S/2)*S;r(x,G,v,P,L),N.push(v,G,G,P)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(x){var v=this.data,P=[];if(!M(x,v))return P;for(var S=this.toBBox,L=[];v;){for(var N=0;N<v.children.length;N++){var G=v.children[N],B=v.leaf?S(G):G;M(x,B)&&(v.leaf?P.push(G):y(x,B)?this._all(G,P):L.push(G))}v=L.pop()}return P},o.prototype.collides=function(x){var v=this.data;if(!M(x,v))return!1;for(var P=[];v;){for(var S=0;S<v.children.length;S++){var L=v.children[S],N=v.leaf?this.toBBox(L):L;if(M(x,N)){if(v.leaf||y(x,N))return!0;P.push(L)}}v=P.pop()}return!1},o.prototype.load=function(x){if(!x||!x.length)return this;if(x.length<this._minEntries){for(var v=0;v<x.length;v++)this.insert(x[v]);return this}var P=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===P.height)this._splitRoot(this.data,P);else{if(this.data.height<P.height){var S=this.data;this.data=P,P=S}this._insert(P,this.data.height-P.height-1,!0)}else this.data=P;return this},o.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},o.prototype.clear=function(){return this.data=b([]),this},o.prototype.remove=function(x,v){if(!x)return this;for(var P,S,L,N=this.data,G=this.toBBox(x),B=[],I=[];N||B.length;){if(N||(N=B.pop(),S=B[B.length-1],P=I.pop(),L=!0),N.leaf){var O=a(x,N.children,v);if(O!==-1)return N.children.splice(O,1),B.push(N),this._condense(B),this}L||N.leaf||!y(N,G)?S?(P++,N=S.children[P],L=!1):N=null:(B.push(N),I.push(P),P=0,S=N,N=N.children[0])}return this},o.prototype.toBBox=function(x){return x},o.prototype.compareMinX=function(x,v){return x.minX-v.minX},o.prototype.compareMinY=function(x,v){return x.minY-v.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(x){return this.data=x,this},o.prototype._all=function(x,v){for(var P=[];x;)x.leaf?v.push.apply(v,x.children):P.push.apply(P,x.children),x=P.pop();return v},o.prototype._build=function(x,v,P,S){var L,N=P-v+1,G=this._maxEntries;if(N<=G)return l(L=b(x.slice(v,P+1)),this.toBBox),L;S||(S=Math.ceil(Math.log(N)/Math.log(G)),G=Math.ceil(N/Math.pow(G,S-1))),(L=b([])).leaf=!1,L.height=S;var B=Math.ceil(N/G),I=B*Math.ceil(Math.sqrt(G));T(x,v,P,I,this.compareMinX);for(var O=v;O<=P;O+=I){var q=Math.min(O+I-1,P);T(x,O,q,B,this.compareMinY);for(var st=O;st<=q;st+=B){var V=Math.min(st+B-1,q);L.children.push(this._build(x,st,V,S-1))}}return l(L,this.toBBox),L},o.prototype._chooseSubtree=function(x,v,P,S){for(;S.push(v),!v.leaf&&S.length-1!==P;){for(var L=1/0,N=1/0,G=void 0,B=0;B<v.children.length;B++){var I=v.children[B],O=g(I),q=(st=x,V=I,(Math.max(V.maxX,st.maxX)-Math.min(V.minX,st.minX))*(Math.max(V.maxY,st.maxY)-Math.min(V.minY,st.minY))-O);q<N?(N=q,L=O<L?O:L,G=I):q===N&&O<L&&(L=O,G=I)}v=G||v.children[0]}var st,V;return v},o.prototype._insert=function(x,v,P){var S=P?x:this.toBBox(x),L=[],N=this._chooseSubtree(S,this.data,v,L);for(N.children.push(x),f(N,S);v>=0&&L[v].children.length>this._maxEntries;)this._split(L,v),v--;this._adjustParentBBoxes(S,L,v)},o.prototype._split=function(x,v){var P=x[v],S=P.children.length,L=this._minEntries;this._chooseSplitAxis(P,L,S);var N=this._chooseSplitIndex(P,L,S),G=b(P.children.splice(N,P.children.length-N));G.height=P.height,G.leaf=P.leaf,l(P,this.toBBox),l(G,this.toBBox),v?x[v-1].children.push(G):this._splitRoot(P,G)},o.prototype._splitRoot=function(x,v){this.data=b([x,v]),this.data.height=x.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(x,v,P){for(var S,L,N,G,B,I,O,q=1/0,st=1/0,V=v;V<=P-v;V++){var Mt=h(x,0,V,this.toBBox),$=h(x,V,P,this.toBBox),ut=(L=Mt,N=$,G=void 0,B=void 0,I=void 0,O=void 0,G=Math.max(L.minX,N.minX),B=Math.max(L.minY,N.minY),I=Math.min(L.maxX,N.maxX),O=Math.min(L.maxY,N.maxY),Math.max(0,I-G)*Math.max(0,O-B)),xt=g(Mt)+g($);ut<q?(q=ut,S=V,st=xt<st?xt:st):ut===q&&xt<st&&(st=xt,S=V)}return S||P-v},o.prototype._chooseSplitAxis=function(x,v,P){var S=x.leaf?this.compareMinX:p,L=x.leaf?this.compareMinY:d;this._allDistMargin(x,v,P,S)<this._allDistMargin(x,v,P,L)&&x.children.sort(S)},o.prototype._allDistMargin=function(x,v,P,S){x.children.sort(S);for(var L=this.toBBox,N=h(x,0,v,L),G=h(x,P-v,P,L),B=_(N)+_(G),I=v;I<P-v;I++){var O=x.children[I];f(N,x.leaf?L(O):O),B+=_(N)}for(var q=P-v-1;q>=v;q--){var st=x.children[q];f(G,x.leaf?L(st):st),B+=_(G)}return B},o.prototype._adjustParentBBoxes=function(x,v,P){for(var S=P;S>=0;S--)f(v[S],x)},o.prototype._condense=function(x){for(var v=x.length-1,P=void 0;v>=0;v--)x[v].children.length===0?v>0?(P=x[v-1].children).splice(P.indexOf(x[v]),1):this.clear():l(x[v],this.toBBox)},o})});var _0=Ht((ap,up)=>{(function(r,t){typeof ap=="object"&&typeof up!="undefined"?up.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(ap,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var l=(this.length>>1)-1;l>=0;l--)this._down(l)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,l=a.data,h=a.compare,f=l[o];o>0;){var p=o-1>>1,d=l[p];if(h(f,d)>=0)break;l[o]=d,o=p}l[o]=f},r.prototype._down=function(o){for(var a=this,l=a.data,h=a.compare,f=this.length>>1,p=l[o];o<f;){var d=(o<<1)+1,g=l[d],_=d+1;if(_<this.length&&h(l[_],g)<0&&(d=_,g=l[_]),h(g,p)>=0)break;l[o]=g,o=d}l[o]=p};function t(e,o){return e<o?-1:e>o?1:0}return r})});var E0=Ht(($R,x0)=>{x0.exports=function(t,e,o,a){var l=t[0],h=t[1],f=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=(a-o)/2,d=0,g=p-1;d<p;g=d++){var _=e[o+d*2+0],y=e[o+d*2+1],M=e[o+g*2+0],b=e[o+g*2+1],T=y>h!=b>h&&l<(M-_)*(h-y)/(b-y)+_;T&&(f=!f)}return f}});var S0=Ht((ZR,M0)=>{M0.exports=function(t,e,o,a){var l=t[0],h=t[1],f=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=a-o,d=0,g=p-1;d<p;g=d++){var _=e[d+o][0],y=e[d+o][1],M=e[g+o][0],b=e[g+o][1],T=y>h!=b>h&&l<(M-_)*(h-y)/(b-y)+_;T&&(f=!f)}return f}});var T0=Ht((JR,yc)=>{var w0=E0(),b0=S0();yc.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?b0(t,e,o,a):w0(t,e,o,a)};yc.exports.nested=b0;yc.exports.flat=w0});var C0=Ht((vc,A0)=>{(function(r,t){typeof vc=="object"&&typeof A0!="undefined"?t(vc):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(vc,function(r){"use strict";let e=33306690738754706e-32;function o(M,b,T,x,v){let P,S,L,N,G=b[0],B=x[0],I=0,O=0;B>G==B>-G?(P=G,G=b[++I]):(P=B,B=x[++O]);let q=0;if(I<M&&O<T)for(B>G==B>-G?(L=P-((S=G+P)-G),G=b[++I]):(L=P-((S=B+P)-B),B=x[++O]),P=S,L!==0&&(v[q++]=L);I<M&&O<T;)B>G==B>-G?(L=P-((S=P+G)-(N=S-P))+(G-N),G=b[++I]):(L=P-((S=P+B)-(N=S-P))+(B-N),B=x[++O]),P=S,L!==0&&(v[q++]=L);for(;I<M;)L=P-((S=P+G)-(N=S-P))+(G-N),G=b[++I],P=S,L!==0&&(v[q++]=L);for(;O<T;)L=P-((S=P+B)-(N=S-P))+(B-N),B=x[++O],P=S,L!==0&&(v[q++]=L);return P===0&&q!==0||(v[q++]=P),q}function a(M){return new Float64Array(M)}let l=33306690738754716e-32,h=22204460492503146e-32,f=11093356479670487e-47,p=a(4),d=a(8),g=a(12),_=a(16),y=a(4);r.orient2d=function(M,b,T,x,v,P){let S=(b-P)*(T-v),L=(M-v)*(x-P),N=S-L;if(S===0||L===0||S>0!=L>0)return N;let G=Math.abs(S+L);return Math.abs(N)>=l*G?N:-function(B,I,O,q,st,V,Mt){let $,ut,xt,mt,lt,ht,k,nt,ft,Tt,gt,Lt,qt,Xt,Ft,Qt,Ct,ee,it=B-st,rn=O-st,Bt=I-V,Jt=q-V;lt=(Ft=(nt=it-(k=(ht=134217729*it)-(ht-it)))*(Tt=Jt-(ft=(ht=134217729*Jt)-(ht-Jt)))-((Xt=it*Jt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=Bt-(k=(ht=134217729*Bt)-(ht-Bt)))*(Tt=rn-(ft=(ht=134217729*rn)-(ht-rn)))-((Qt=Bt*rn)-k*ft-nt*ft-k*Tt))),p[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),p[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,p[2]=Lt-(ee-lt)+(gt-lt),p[3]=ee;let Yt=function(yn,pn){let X=pn[0];for(let F=1;F<yn;F++)X+=pn[F];return X}(4,p),pe=h*Mt;if(Yt>=pe||-Yt>=pe||($=B-(it+(lt=B-it))+(lt-st),xt=O-(rn+(lt=O-rn))+(lt-st),ut=I-(Bt+(lt=I-Bt))+(lt-V),mt=q-(Jt+(lt=q-Jt))+(lt-V),$===0&&ut===0&&xt===0&&mt===0)||(pe=f*Mt+e*Math.abs(Yt),(Yt+=it*mt+Jt*$-(Bt*xt+rn*ut))>=pe||-Yt>=pe))return Yt;lt=(Ft=(nt=$-(k=(ht=134217729*$)-(ht-$)))*(Tt=Jt-(ft=(ht=134217729*Jt)-(ht-Jt)))-((Xt=$*Jt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=ut-(k=(ht=134217729*ut)-(ht-ut)))*(Tt=rn-(ft=(ht=134217729*rn)-(ht-rn)))-((Qt=ut*rn)-k*ft-nt*ft-k*Tt))),y[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),y[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,y[2]=Lt-(ee-lt)+(gt-lt),y[3]=ee;let le=o(4,p,4,y,d);lt=(Ft=(nt=it-(k=(ht=134217729*it)-(ht-it)))*(Tt=mt-(ft=(ht=134217729*mt)-(ht-mt)))-((Xt=it*mt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=Bt-(k=(ht=134217729*Bt)-(ht-Bt)))*(Tt=xt-(ft=(ht=134217729*xt)-(ht-xt)))-((Qt=Bt*xt)-k*ft-nt*ft-k*Tt))),y[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),y[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,y[2]=Lt-(ee-lt)+(gt-lt),y[3]=ee;let Pt=o(le,d,4,y,g);lt=(Ft=(nt=$-(k=(ht=134217729*$)-(ht-$)))*(Tt=mt-(ft=(ht=134217729*mt)-(ht-mt)))-((Xt=$*mt)-k*ft-nt*ft-k*Tt))-(gt=Ft-(Ct=(nt=ut-(k=(ht=134217729*ut)-(ht-ut)))*(Tt=xt-(ft=(ht=134217729*xt)-(ht-xt)))-((Qt=ut*xt)-k*ft-nt*ft-k*Tt))),y[0]=Ft-(gt+lt)+(lt-Ct),lt=(qt=Xt-((Lt=Xt+gt)-(lt=Lt-Xt))+(gt-lt))-(gt=qt-Qt),y[1]=qt-(gt+lt)+(lt-Qt),lt=(ee=Lt+gt)-Lt,y[2]=Lt-(ee-lt)+(gt-lt),y[3]=ee;let te=o(Pt,g,4,y,_);return _[te-1]}(M,b,T,x,v,P,G)},r.orient2dfast=function(M,b,T,x,v,P){return(b-P)*(T-v)-(M-v)*(x-P)},Object.defineProperty(r,"__esModule",{value:!0})})});var O0=Ht((KR,fp)=>{"use strict";var P0=sp(),xc=_0(),uT=T0(),lT=C0().orient2d;xc.default&&(xc=xc.default);fp.exports=N0;fp.exports.default=N0;function N0(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=dT(r),a=new P0(16);a.toBBox=function(P){return{minX:P[0],minY:P[1],maxX:P[0],maxY:P[1]}},a.compareMinX=function(P,S){return P[0]-S[0]},a.compareMinY=function(P,S){return P[1]-S[1]},a.load(r);for(var l=[],h=0,f;h<o.length;h++){var p=o[h];a.remove(p),f=L0(p,f),l.push(f)}var d=new P0(16);for(h=0;h<l.length;h++)d.insert(lp(l[h]));for(var g=t*t,_=e*e;l.length;){var y=l.shift(),M=y.p,b=y.next.p,T=cp(M,b);if(!(T<_)){var x=T/g;p=cT(a,y.prev.p,M,b,y.next.next.p,x,d),p&&Math.min(cp(p,M),cp(p,b))<=x&&(l.push(y),l.push(L0(p,y)),a.remove(p),d.remove(y),d.insert(lp(y)),d.insert(lp(y.next)))}}y=f;var v=[];do v.push(y.p),y=y.next;while(y!==f);return v.push(y.p),v}function cT(r,t,e,o,a,l,h){for(var f=new xc([],hT),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],_=p.leaf?hp(g,e,o):fT(e,o,g);_>l||f.push({node:g,dist:_})}for(;f.length&&!f.peek().node.children;){var y=f.pop(),M=y.node,b=hp(M,t,e),T=hp(M,o,a);if(y.dist<b&&y.dist<T&&R0(e,M,h)&&R0(o,M,h))return M}p=f.pop(),p&&(p=p.node)}return null}function hT(r,t){return r.dist-t.dist}function fT(r,t,e){if(I0(r,e)||I0(t,e))return 0;var o=_c(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=_c(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=_c(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var h=_c(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return h===0?0:Math.min(o,a,l,h)}function I0(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function R0(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),l=Math.max(r[0],t[0]),h=Math.max(r[1],t[1]),f=e.search({minX:o,minY:a,maxX:l,maxY:h}),p=0;p<f.length;p++)if(pT(f[p].p,f[p].next.p,r,t))return!1;return!0}function Ja(r,t,e){return lT(r[0],r[1],t[0],t[1],e[0],e[1])}function pT(r,t,e,o){return r!==o&&t!==e&&Ja(r,t,e)>0!=Ja(r,t,o)>0&&Ja(e,o,r)>0!=Ja(e,o,t)>0}function lp(r){var t=r.p,e=r.next.p;return r.minX=Math.min(t[0],e[0]),r.minY=Math.min(t[1],e[1]),r.maxX=Math.max(t[0],e[0]),r.maxY=Math.max(t[1],e[1]),r}function dT(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],l=0;l<r.length;l++){var h=r[l];h[0]<t[0]&&(t=h),h[0]>o[0]&&(o=h),h[1]<e[1]&&(e=h),h[1]>a[1]&&(a=h)}var f=[t,e,o,a],p=f.slice();for(l=0;l<r.length;l++)uT(r[l],f)||p.push(r[l]);return gT(p)}function L0(r,t){var e={p:r,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function cp(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function hp(r,t,e){var o=t[0],a=t[1],l=e[0]-o,h=e[1]-a;if(l!==0||h!==0){var f=((r[0]-o)*l+(r[1]-a)*h)/(l*l+h*h);f>1?(o=e[0],a=e[1]):f>0&&(o+=l*f,a+=h*f)}return l=r[0]-o,h=r[1]-a,l*l+h*h}function _c(r,t,e,o,a,l,h,f){var p=e-r,d=o-t,g=h-a,_=f-l,y=r-a,M=t-l,b=p*p+d*d,T=p*g+d*_,x=g*g+_*_,v=p*y+d*M,P=g*y+_*M,S=b*x-T*T,L,N,G,B,I=S,O=S;S===0?(N=0,I=1,B=P,O=x):(N=T*P-x*v,B=b*P-T*v,N<0?(N=0,B=P,O=x):N>I&&(N=I,B=P+T,O=x)),B<0?(B=0,-v<0?N=0:-v>b?N=I:(N=-v,I=b)):B>O&&(B=O,-v+T<0?N=0:-v+T>b?N=I:(N=-v+T,I=b)),L=N===0?0:N/I,G=B===0?0:B/O;var q=(1-L)*r+L*e,st=(1-L)*t+L*o,V=(1-G)*a+G*h,Mt=(1-G)*l+G*f,$=V-q,ut=Mt-st;return $*$+ut*ut}function mT(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function gT(r){r.sort(mT);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Ja(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}for(var o=[],a=r.length-1;a>=0;a--){for(;o.length>=2&&Ja(o[o.length-2],o[o.length-1],r[a])<=0;)o.pop();o.push(r[a])}return o.pop(),t.pop(),t.concat(o)}});var k0=Ht((dp,mp)=>{(function(r,t){typeof dp=="object"&&typeof mp!="undefined"?mp.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(dp,function(){"use strict";function r(a,l,h,f,p){t(a,l,h||0,f||a.length-1,p||o)}function t(a,l,h,f,p){for(;f>h;){if(f-h>600){var d=f-h+1,g=l-h+1,_=Math.log(d),y=.5*Math.exp(2*_/3),M=.5*Math.sqrt(_*y*(d-y)/d)*(g-d/2<0?-1:1),b=Math.max(h,Math.floor(l-g*y/d+M)),T=Math.min(f,Math.floor(l+(d-g)*y/d+M));t(a,l,b,T,p)}var x=a[l],v=h,P=f;for(e(a,h,l),p(a[f],x)>0&&e(a,h,f);v<P;){for(e(a,v,P),v++,P--;p(a[v],x)<0;)v++;for(;p(a[P],x)>0;)P--}p(a[h],x)===0?e(a,h,P):(P++,e(a,P,f)),P<=l&&(h=P+1),l<=P&&(f=P-1)}}function e(a,l,h){var f=a[l];a[l]=a[h],a[h]=f}function o(a,l){return a<l?-1:a>l?1:0}return r})});var _p=Ht((S2,vp)=>{"use strict";vp.exports=Xu;vp.exports.default=Xu;var PT=k0();function Xu(r,t){if(!(this instanceof Xu))return new Xu(r,t);this._maxEntries=Math.max(4,r||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}Xu.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!Mc(r,t))return e;for(var a=[],l,h,f,p;t;){for(l=0,h=t.children.length;l<h;l++)f=t.children[l],p=t.leaf?o(f):f,Mc(r,p)&&(t.leaf?e.push(f):yp(r,p)?this._all(f,e):a.push(f));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!Mc(r,t))return!1;for(var o=[],a,l,h,f;t;){for(a=0,l=t.children.length;a<l;a++)if(h=t.children[a],f=t.leaf?e(h):h,Mc(r,f)){if(t.leaf||yp(r,f))return!0;o.push(h)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=Qa([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],l=[],h,f,p,d;e||a.length;){if(e||(e=a.pop(),f=a[a.length-1],h=l.pop(),d=!0),e.leaf&&(p=IT(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&yp(e,o)?(a.push(e),l.push(h),h=0,f=e,e=e.children[0]):f?(h++,e=f.children[h],d=!1):e=null}return this},toBBox:function(r){return r},compareMinX:G0,compareMinY:V0,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,l=this._maxEntries,h;if(a<=l)return h=Qa(r.slice(t,e+1)),ja(h,this.toBBox),h;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),h=Qa([]),h.leaf=!1,h.height=o;var f=Math.ceil(a/l),p=f*Math.ceil(Math.sqrt(l)),d,g,_,y;for(H0(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(_=Math.min(d+p-1,e),H0(r,d,_,f,this.compareMinY),g=d;g<=_;g+=f)y=Math.min(g+f-1,_),h.children.push(this._build(r,g,y,o-1));return ja(h,this.toBBox),h},_chooseSubtree:function(r,t,e,o){for(var a,l,h,f,p,d,g,_;o.push(t),!(t.leaf||o.length-1===e);){for(g=_=1/0,a=0,l=t.children.length;a<l;a++)h=t.children[a],p=gp(h),d=RT(r,h)-p,d<_?(_=d,g=p<g?p:g,f=h):d===_&&p<g&&(g=p,f=h);t=f||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),l=[],h=this._chooseSubtree(a,this.data,t,l);for(h.children.push(r),qu(h,a);t>=0&&l[t].children.length>this._maxEntries;)this._split(l,t),t--;this._adjustParentBBoxes(a,l,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var l=this._chooseSplitIndex(e,a,o),h=Qa(e.children.splice(l,e.children.length-l));h.height=e.height,h.leaf=e.leaf,ja(e,this.toBBox),ja(h,this.toBBox),t?r[t-1].children.push(h):this._splitRoot(e,h)},_splitRoot:function(r,t){this.data=Qa([r,t]),this.data.height=r.height+1,this.data.leaf=!1,ja(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,l,h,f,p,d,g;for(p=d=1/0,o=t;o<=e-t;o++)a=Wu(r,0,o,this.toBBox),l=Wu(r,o,e,this.toBBox),h=LT(a,l),f=gp(a)+gp(l),h<p?(p=h,g=o,d=f<d?f:d):h===p&&f<d&&(d=f,g=o);return g},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:G0,a=r.leaf?this.compareMinY:V0,l=this._allDistMargin(r,t,e,o),h=this._allDistMargin(r,t,e,a);l<h&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,l=Wu(r,0,t,a),h=Wu(r,e-t,e,a),f=Ec(l)+Ec(h),p,d;for(p=t;p<e-t;p++)d=r.children[p],qu(l,r.leaf?a(d):d),f+=Ec(l);for(p=e-t-1;p>=t;p--)d=r.children[p],qu(h,r.leaf?a(d):d),f+=Ec(h);return f},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)qu(t[o],r)},_condense:function(r){for(var t=r.length-1,e;t>=0;t--)r[t].children.length===0?t>0?(e=r[t-1].children,e.splice(e.indexOf(r[t]),1)):this.clear():ja(r[t],this.toBBox)},_initFormat:function(r){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(r[0])),this.compareMinY=new Function("a","b",t.join(r[1])),this.toBBox=new Function("a","return {minX: a"+r[0]+", minY: a"+r[1]+", maxX: a"+r[2]+", maxY: a"+r[3]+"};")}};function IT(r,t,e){if(!e)return t.indexOf(r);for(var o=0;o<t.length;o++)if(e(r,t[o]))return o;return-1}function ja(r,t){Wu(r,0,r.children.length,t,r)}function Wu(r,t,e,o,a){a||(a=Qa(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var l=t,h;l<e;l++)h=r.children[l],qu(a,r.leaf?o(h):h);return a}function qu(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function G0(r,t){return r.minX-t.minX}function V0(r,t){return r.minY-t.minY}function gp(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function Ec(r){return r.maxX-r.minX+(r.maxY-r.minY)}function RT(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function LT(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),l=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,l-o)}function yp(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Mc(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function Qa(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function H0(r,t,e,o,a){for(var l=[t,e],h;l.length;)e=l.pop(),t=l.pop(),!(e-t<=o)&&(h=t+Math.ceil((e-t)/o/2)*o,PT(r,h,t,e,a),l.push(t,h,h,e))}});var Z0=Ht((FO,bp)=>{"use strict";bp.exports=Tc;bp.exports.default=Tc;function Tc(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=X0(r,0,a,e,!0),h=[];if(!l||l.next===l.prev)return h;var f,p,d,g,_,y,M;if(o&&(l=VT(r,t,l,e)),r.length>80*e){f=d=r[0],p=g=r[1];for(var b=e;b<a;b+=e)_=r[b],y=r[b+1],_<f&&(f=_),y<p&&(p=y),_>d&&(d=_),y>g&&(g=y);M=Math.max(d-f,g-p),M=M!==0?32767/M:0}return Zu(l,h,e,f,p,M,0),h}function X0(r,t,e,o,a){var l,h;if(a===wp(r,t,e,o)>0)for(l=t;l<e;l+=o)h=q0(l,r[l],r[l+1],h);else for(l=e-o;l>=t;l-=o)h=q0(l,r[l],r[l+1],h);return h&&Ac(h,h.next)&&(Ku(h),h=h.next),h}function Qs(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(Ac(e,e.next)||Yn(e.prev,e,e.next)===0)){if(Ku(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function Zu(r,t,e,o,a,l,h){if(r){!h&&l&&YT(r,o,a,l);for(var f=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?zT(r,o,a,l):BT(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),Ku(r),r=d.next,f=d.next;continue}if(r=d,r===f){h?h===1?(r=kT(Qs(r),t,e),Zu(r,t,e,o,a,l,2)):h===2&>(r,t,e,o,a,l):Zu(Qs(r),t,e,o,a,l,1);break}}}}function BT(r){var t=r.prev,e=r,o=r.next;if(Yn(t,e,o)>=0)return!1;for(var a=t.x,l=e.x,h=o.x,f=t.y,p=e.y,d=o.y,g=a<l?a<h?a:h:l<h?l:h,_=f<p?f<d?f:d:p<d?p:d,y=a>l?a>h?a:h:l>h?l:h,M=f>p?f>d?f:d:p>d?p:d,b=o.next;b!==t;){if(b.x>=g&&b.x<=y&&b.y>=_&&b.y<=M&&nu(a,f,l,p,h,d,b.x,b.y)&&Yn(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function zT(r,t,e,o){var a=r.prev,l=r,h=r.next;if(Yn(a,l,h)>=0)return!1;for(var f=a.x,p=l.x,d=h.x,g=a.y,_=l.y,y=h.y,M=f<p?f<d?f:d:p<d?p:d,b=g<_?g<y?g:y:_<y?_:y,T=f>p?f>d?f:d:p>d?p:d,x=g>_?g>y?g:y:_>y?_:y,v=Mp(M,b,t,e,o),P=Mp(T,x,t,e,o),S=r.prevZ,L=r.nextZ;S&&S.z>=v&&L&&L.z<=P;){if(S.x>=M&&S.x<=T&&S.y>=b&&S.y<=x&&S!==a&&S!==h&&nu(f,g,p,_,d,y,S.x,S.y)&&Yn(S.prev,S,S.next)>=0||(S=S.prevZ,L.x>=M&&L.x<=T&&L.y>=b&&L.y<=x&&L!==a&&L!==h&&nu(f,g,p,_,d,y,L.x,L.y)&&Yn(L.prev,L,L.next)>=0))return!1;L=L.nextZ}for(;S&&S.z>=v;){if(S.x>=M&&S.x<=T&&S.y>=b&&S.y<=x&&S!==a&&S!==h&&nu(f,g,p,_,d,y,S.x,S.y)&&Yn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;L&&L.z<=P;){if(L.x>=M&&L.x<=T&&L.y>=b&&L.y<=x&&L!==a&&L!==h&&nu(f,g,p,_,d,y,L.x,L.y)&&Yn(L.prev,L,L.next)>=0)return!1;L=L.nextZ}return!0}function kT(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!Ac(a,l)&&Y0(a,o,o.next,l)&&Ju(a,l)&&Ju(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),Ku(o),Ku(o.next),o=r=l),o=o.next}while(o!==r);return Qs(o)}function GT(r,t,e,o,a,l){var h=r;do{for(var f=h.next.next;f!==h.prev;){if(h.i!==f.i&&JT(h,f)){var p=$0(h,f);h=Qs(h,h.next),p=Qs(p,p.next),Zu(h,t,e,o,a,l,0),Zu(p,t,e,o,a,l,0);return}f=f.next}h=h.next}while(h!==r)}function VT(r,t,e,o){var a=[],l,h,f,p,d;for(l=0,h=t.length;l<h;l++)f=t[l]*o,p=l<h-1?t[l+1]*o:r.length,d=X0(r,f,p,o,!1),d===d.next&&(d.steiner=!0),a.push(ZT(d));for(a.sort(HT),l=0;l<a.length;l++)e=WT(a[l],e);return e}function HT(r,t){return r.x-t.x}function WT(r,t){var e=qT(r,t);if(!e)return t;var o=$0(e,r);return Qs(o,o.next),Qs(e,e.next)}function qT(r,t){var e=t,o=r.x,a=r.y,l=-1/0,h;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var f=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(f<=o&&f>l&&(l=f,h=e.x<e.next.x?e:e.next,f===o))return h}e=e.next}while(e!==t);if(!h)return null;var p=h,d=h.x,g=h.y,_=1/0,y;e=h;do o>=e.x&&e.x>=d&&o!==e.x&&nu(a<g?o:l,a,d,g,a<g?l:o,a,e.x,e.y)&&(y=Math.abs(a-e.y)/(o-e.x),Ju(e,r)&&(y<_||y===_&&(e.x>h.x||e.x===h.x&&XT(h,e)))&&(h=e,_=y)),e=e.next;while(e!==p);return h}function XT(r,t){return Yn(r.prev,r,t.prev)<0&&Yn(t.next,r,r.next)<0}function YT(r,t,e,o){var a=r;do a.z===0&&(a.z=Mp(a.x,a.y,t,e,o)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==r);a.prevZ.nextZ=null,a.prevZ=null,$T(a)}function $T(r){var t,e,o,a,l,h,f,p,d=1;do{for(e=r,r=null,l=null,h=0;e;){for(h++,o=e,f=0,t=0;t<d&&(f++,o=o.nextZ,!!o);t++);for(p=d;f>0||p>0&&o;)f!==0&&(p===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,f--):(a=o,o=o.nextZ,p--),l?l.nextZ=a:r=a,a.prevZ=l,l=a;e=o}l.nextZ=null,d*=2}while(h>1);return r}function Mp(r,t,e,o,a){return r=(r-e)*a|0,t=(t-o)*a|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function ZT(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function nu(r,t,e,o,a,l,h,f){return(a-h)*(t-f)>=(r-h)*(l-f)&&(r-h)*(o-f)>=(e-h)*(t-f)&&(e-h)*(l-f)>=(a-h)*(o-f)}function JT(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!KT(r,t)&&(Ju(r,t)&&Ju(t,r)&&jT(r,t)&&(Yn(r.prev,r,t.prev)||Yn(r,t.prev,t))||Ac(r,t)&&Yn(r.prev,r,r.next)>0&&Yn(t.prev,t,t.next)>0)}function Yn(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Ac(r,t){return r.x===t.x&&r.y===t.y}function Y0(r,t,e,o){var a=bc(Yn(r,t,e)),l=bc(Yn(r,t,o)),h=bc(Yn(e,o,r)),f=bc(Yn(e,o,t));return!!(a!==l&&h!==f||a===0&&wc(r,e,t)||l===0&&wc(r,o,t)||h===0&&wc(e,r,o)||f===0&&wc(e,t,o))}function wc(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function bc(r){return r>0?1:r<0?-1:0}function KT(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Y0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Ju(r,t){return Yn(r.prev,r,r.next)<0?Yn(r,t,r.next)>=0&&Yn(r,r.prev,t)>=0:Yn(r,t,r.prev)<0||Yn(r,r.next,t)<0}function jT(r,t){var e=r,o=!1,a=(r.x+t.x)/2,l=(r.y+t.y)/2;do e.y>l!=e.next.y>l&&e.next.y!==e.y&&a<(e.next.x-e.x)*(l-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function $0(r,t){var e=new Sp(r.i,r.x,r.y),o=new Sp(t.i,t.x,t.y),a=r.next,l=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,l.next=o,o.prev=l,o}function q0(r,t,e,o){var a=new Sp(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function Ku(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Sp(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Tc.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,h=Math.abs(wp(r,0,l,e));if(a)for(var f=0,p=t.length;f<p;f++){var d=t[f]*e,g=f<p-1?t[f+1]*e:r.length;h-=Math.abs(wp(r,d,g,e))}var _=0;for(f=0;f<o.length;f+=3){var y=o[f]*e,M=o[f+1]*e,b=o[f+2]*e;_+=Math.abs((r[y]-r[b])*(r[M+1]-r[y+1])-(r[y]-r[M])*(r[b+1]-r[y+1]))}return h===0&&_===0?0:Math.abs((_-h)/h)};function wp(r,t,e,o){for(var a=0,l=t,h=e-o;l<e;l+=o)a+=(r[h]-r[l])*(r[l+1]+r[h+1]),h=l;return a}Tc.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var l=0;l<r[a].length;l++)for(var h=0;h<t;h++)e.vertices.push(r[a][l][h]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var Ip=Ht(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.earthRadius=63710088e-1;ae.factors={centimeters:ae.earthRadius*100,centimetres:ae.earthRadius*100,degrees:ae.earthRadius/111325,feet:ae.earthRadius*3.28084,inches:ae.earthRadius*39.37,kilometers:ae.earthRadius/1e3,kilometres:ae.earthRadius/1e3,meters:ae.earthRadius,metres:ae.earthRadius,miles:ae.earthRadius/1609.344,millimeters:ae.earthRadius*1e3,millimetres:ae.earthRadius*1e3,nauticalmiles:ae.earthRadius/1852,radians:1,yards:ae.earthRadius*1.0936};ae.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/ae.earthRadius,yards:1.0936133};ae.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Ms(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}ae.feature=Ms;function tA(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Tp(t).geometry;case"LineString":return Cp(t).geometry;case"Polygon":return Ap(t).geometry;case"MultiPoint":return K0(t).geometry;case"MultiLineString":return J0(t).geometry;case"MultiPolygon":return j0(t).geometry;default:throw new Error(r+" is invalid")}}ae.geometry=tA;function Tp(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Cc(r[0])||!Cc(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Ms(o,t,e)}ae.point=Tp;function eA(r,t,e){return e===void 0&&(e={}),Pc(r.map(function(o){return Tp(o,t)}),e)}ae.points=eA;function Ap(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<l[l.length-1].length;h++)if(l[l.length-1][h]!==l[0][h])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:r};return Ms(f,t,e)}ae.polygon=Ap;function nA(r,t,e){return e===void 0&&(e={}),Pc(r.map(function(o){return Ap(o,t)}),e)}ae.polygons=nA;function Cp(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return Ms(o,t,e)}ae.lineString=Cp;function rA(r,t,e){return e===void 0&&(e={}),Pc(r.map(function(o){return Cp(o,t)}),e)}ae.lineStrings=rA;function Pc(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}ae.featureCollection=Pc;function J0(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Ms(o,t,e)}ae.multiLineString=J0;function K0(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Ms(o,t,e)}ae.multiPoint=K0;function j0(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Ms(o,t,e)}ae.multiPolygon=j0;function iA(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Ms(o,t,e)}ae.geometryCollection=iA;function oA(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}ae.round=oA;function Q0(r,t){t===void 0&&(t="kilometers");var e=ae.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}ae.radiansToLength=Q0;function Pp(r,t){t===void 0&&(t="kilometers");var e=ae.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}ae.lengthToRadians=Pp;function sA(r,t){return ty(Pp(r,t))}ae.lengthToDegrees=sA;function aA(r){var t=r%360;return t<0&&(t+=360),t}ae.bearingToAzimuth=aA;function ty(r){var t=r%(2*Math.PI);return t*180/Math.PI}ae.radiansToDegrees=ty;function uA(r){var t=r%360;return t*Math.PI/180}ae.degreesToRadians=uA;function lA(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return Q0(Pp(r,t),e)}ae.convertLength=lA;function cA(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=ae.areaFactors[t];if(!o)throw new Error("invalid original units");var a=ae.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}ae.convertArea=cA;function Cc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}ae.isNumber=Cc;function hA(r){return!!r&&r.constructor===Object}ae.isObject=hA;function fA(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!Cc(t))throw new Error("bbox must only contain numbers")})}ae.validateBBox=fA;function pA(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}ae.validateId=pA});var Lp=Ht(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});var Zr=Ip();function ju(r,t,e){if(r!==null)for(var o,a,l,h,f,p,d,g=0,_=0,y,M=r.type,b=M==="FeatureCollection",T=M==="Feature",x=b?r.features.length:1,v=0;v<x;v++){d=b?r.features[v].geometry:T?r.geometry:r,y=d?d.type==="GeometryCollection":!1,f=y?d.geometries.length:1;for(var P=0;P<f;P++){var S=0,L=0;if(h=y?d.geometries[P]:d,h!==null){p=h.coordinates;var N=h.type;switch(g=e&&(N==="Polygon"||N==="MultiPolygon")?1:0,N){case null:break;case"Point":if(t(p,_,v,S,L)===!1)return!1;_++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,S,L)===!1)return!1;_++,N==="MultiPoint"&&S++}N==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],_,v,S,L)===!1)return!1;_++}N==="MultiLineString"&&S++,N==="Polygon"&&L++}N==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(L=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],_,v,S,L)===!1)return!1;_++}L++}S++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(ju(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function dA(r,t,e,o){var a=e;return ju(r,function(l,h,f,p,d){h===0&&e===void 0?a=l:a=t(a,l,h,f,p,d)},o),a}function ey(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}function mA(r,t,e){var o=e;return ey(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function ny(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function gA(r,t,e){var o=e;return ny(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function yA(r){var t=[];return ju(r,function(e){t.push(e)}),t}function Rp(r,t){var e,o,a,l,h,f,p,d,g,_,y=0,M=r.type==="FeatureCollection",b=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(f=M?r.features[e].geometry:b?r.geometry:r,d=M?r.features[e].properties:b?r.properties:{},g=M?r.features[e].bbox:b?r.bbox:void 0,_=M?r.features[e].id:b?r.id:void 0,p=f?f.type==="GeometryCollection":!1,h=p?f.geometries.length:1,a=0;a<h;a++){if(l=p?f.geometries[a]:f,l===null){if(t(null,y,d,g,_)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,y,d,g,_)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],y,d,g,_)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}function vA(r,t,e){var o=e;return Rp(r,function(a,l,h,f,p){l===0&&e===void 0?o=a:o=t(o,a,l,h,f,p)}),o}function Ic(r,t){Rp(r,function(e,o,a,l,h){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(Zr.feature(e,a,{bbox:l,id:h}),o,0)===!1?!1:void 0}var p;switch(f){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],_={type:p,coordinates:g};if(t(Zr.feature(_,a),o,d)===!1)return!1}})}function _A(r,t,e){var o=e;return Ic(r,function(a,l,h){l===0&&h===0&&e===void 0?o=a:o=t(o,a,l,h)}),o}function ry(r,t){Ic(r,function(e,o,a){var l=0;if(e.geometry){var h=e.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var f,p=0,d=0,g=0;if(ju(e,function(_,y,M,b,T){if(f===void 0||o>p||b>d||T>g){f=_,p=o,d=b,g=T,l=0;return}var x=Zr.lineString([f,_],e.properties);if(t(x,o,a,T,l)===!1)return!1;l++,f=_})===!1)return!1}}})}function xA(r,t,e){var o=e,a=!1;return ry(r,function(l,h,f,p,d){a===!1&&e===void 0?o=l:o=t(o,l,h,f,p,d),a=!0}),o}function iy(r,t){if(!r)throw new Error("geojson is required");Ic(r,function(e,o,a){if(e.geometry!==null){var l=e.geometry.type,h=e.geometry.coordinates;switch(l){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var f=0;f<h.length;f++)if(t(Zr.lineString(h[f],e.properties),o,a,f)===!1)return!1;break}}})}function EA(r,t,e){var o=e;return iy(r,function(a,l,h,f){l===0&&e===void 0?o=a:o=t(o,a,l,h,f)}),o}function MA(r,t){if(t=t||{},!Zr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.segmentIndex||0,h=t.properties,f;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),h=h||r.features[e].properties,f=r.features[e].geometry;break;case"Feature":h=h||r.properties,f=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=r;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":case"MultiPoint":return null;case"LineString":return l<0&&(l=p.length+l-1),Zr.lineString([p[l],p[l+1]],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l-1),Zr.lineString([p[a][l],p[a][l+1]],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l-1),Zr.lineString([p[o][l],p[o][l+1]],h,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l-1),Zr.lineString([p[o][a][l],p[o][a][l+1]],h,t)}throw new Error("geojson is invalid")}function SA(r,t){if(t=t||{},!Zr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.coordIndex||0,h=t.properties,f;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),h=h||r.features[e].properties,f=r.features[e].geometry;break;case"Feature":h=h||r.properties,f=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=r;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":return Zr.point(p,h,t);case"MultiPoint":return o<0&&(o=p.length+o),Zr.point(p[o],h,t);case"LineString":return l<0&&(l=p.length+l),Zr.point(p[l],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Zr.point(p[a][l],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Zr.point(p[o][l],h,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l),Zr.point(p[o][a][l],h,t)}throw new Error("geojson is invalid")}pr.coordAll=yA;pr.coordEach=ju;pr.coordReduce=dA;pr.featureEach=ny;pr.featureReduce=gA;pr.findPoint=SA;pr.findSegment=MA;pr.flattenEach=Ic;pr.flattenReduce=_A;pr.geomEach=Rp;pr.geomReduce=vA;pr.lineEach=iy;pr.lineReduce=EA;pr.propEach=ey;pr.propReduce=mA;pr.segmentEach=ry;pr.segmentReduce=xA});var oy=Ht(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});var wA=Lp();function Np(r){var t=[1/0,1/0,-1/0,-1/0];return wA.coordEach(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Np.default=Np;Op.default=Np});var Rc=Ht((jO,Dp)=>{var _o=sp(),ay=Ip(),uy=Lp(),ru=oy().default,bA=uy.featureEach,JO=uy.coordEach,KO=ay.polygon,sy=ay.featureCollection;function ly(r){var t=new _o(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:ru(e),_o.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:ru(a),o.push(a)}):bA(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:ru(a),o.push(a)}),_o.prototype.load.call(this,o)},t.remove=function(e,o){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:ru(e),_o.prototype.remove.call(this,e,o)},t.clear=function(){return _o.prototype.clear.call(this)},t.search=function(e){var o=_o.prototype.search.call(this,this.toBBox(e));return sy(o)},t.collides=function(e){return _o.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=_o.prototype.all.call(this);return sy(e)},t.toJSON=function(){return _o.prototype.toJSON.call(this)},t.fromJSON=function(e){return _o.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var o;if(e.bbox)o=e.bbox;else if(Array.isArray(e)&&e.length===4)o=e;else if(Array.isArray(e)&&e.length===6)o=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")o=ru(e);else if(e.type==="FeatureCollection")o=ru(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Dp.exports=ly;Dp.exports.default=ly});var Gp=Ht((aF,_y)=>{"use strict";var vy=Object.prototype.toString;_y.exports=function(t){var e=vy.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&vy.call(t.callee)==="[object Function]"),o}});var Cy=Ht((uF,Ay)=>{"use strict";var Ty;Object.keys||(el=Object.prototype.hasOwnProperty,Vp=Object.prototype.toString,xy=Gp(),Hp=Object.prototype.propertyIsEnumerable,Ey=!Hp.call({toString:null},"toString"),My=Hp.call(function(){},"prototype"),nl=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Fc=function(r){var t=r.constructor;return t&&t.prototype===r},Sy={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},wy=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!Sy["$"+r]&&el.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Fc(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),by=function(r){if(typeof window=="undefined"||!wy)return Fc(r);try{return Fc(r)}catch(t){return!1}},Ty=function(t){var e=t!==null&&typeof t=="object",o=Vp.call(t)==="[object Function]",a=xy(t),l=e&&Vp.call(t)==="[object String]",h=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var f=My&&o;if(l&&t.length>0&&!el.call(t,0))for(var p=0;p<t.length;++p)h.push(String(p));if(a&&t.length>0)for(var d=0;d<t.length;++d)h.push(String(d));else for(var g in t)!(f&&g==="prototype")&&el.call(t,g)&&h.push(String(g));if(Ey)for(var _=by(t),y=0;y<nl.length;++y)!(_&&nl[y]==="constructor")&&el.call(t,nl[y])&&h.push(nl[y]);return h});var el,Vp,xy,Hp,Ey,My,nl,Fc,Sy,wy,by;Ay.exports=Ty});var Wp=Ht((lF,Ry)=>{"use strict";var DA=Array.prototype.slice,FA=Gp(),Py=Object.keys,Uc=Py?function(t){return Py(t)}:Cy(),Iy=Object.keys;Uc.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(o){return FA(o)?Iy(DA.call(o)):Iy(o)})}else Object.keys=Uc;return Object.keys||Uc};Ry.exports=Uc});var qp=Ht((cF,Ly)=>{"use strict";Ly.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var l=Object.getOwnPropertySymbols(t);if(l.length!==1||l[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var h=Object.getOwnPropertyDescriptor(t,e);if(h.value!==a||h.enumerable!==!0)return!1}return!0}});var Bc=Ht((hF,Ny)=>{"use strict";var UA=qp();Ny.exports=function(){return UA()&&!!Symbol.toStringTag}});var Dy=Ht((fF,Oy)=>{"use strict";Oy.exports=Error});var Uy=Ht((pF,Fy)=>{"use strict";Fy.exports=EvalError});var zy=Ht((dF,By)=>{"use strict";By.exports=RangeError});var Gy=Ht((mF,ky)=>{"use strict";ky.exports=ReferenceError});var Xp=Ht((gF,Vy)=>{"use strict";Vy.exports=SyntaxError});var ta=Ht((yF,Hy)=>{"use strict";Hy.exports=TypeError});var qy=Ht((vF,Wy)=>{"use strict";Wy.exports=URIError});var $y=Ht((_F,Yy)=>{"use strict";var Xy=typeof Symbol!="undefined"&&Symbol,BA=qp();Yy.exports=function(){return typeof Xy!="function"||typeof Symbol!="function"||typeof Xy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:BA()}});var Jy=Ht((xF,Zy)=>{"use strict";var Yp={__proto__:null,foo:{}},zA=Object;Zy.exports=function(){return{__proto__:Yp}.foo===Yp.foo&&!(Yp instanceof zA)}});var Qy=Ht((EF,jy)=>{"use strict";var kA="Function.prototype.bind called on incompatible ",GA=Object.prototype.toString,VA=Math.max,HA="[object Function]",Ky=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var l=0;l<e.length;l+=1)o[l+t.length]=e[l];return o},WA=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},qA=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};jy.exports=function(t){var e=this;if(typeof e!="function"||GA.apply(e)!==HA)throw new TypeError(kA+e);for(var o=WA(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,Ky(o,arguments));return Object(g)===g?g:this}return e.apply(t,Ky(o,arguments))},h=VA(0,e.length-o.length),f=[],p=0;p<h;p++)f[p]="$"+p;if(a=Function("binder","return function ("+qA(f,",")+"){ return binder.apply(this,arguments); }")(l),e.prototype){var d=function(){};d.prototype=e.prototype,a.prototype=new d,d.prototype=null}return a}});var zc=Ht((MF,tv)=>{"use strict";var XA=Qy();tv.exports=Function.prototype.bind||XA});var nv=Ht((SF,ev)=>{"use strict";var YA=Function.prototype.call,$A=Object.prototype.hasOwnProperty,ZA=zc();ev.exports=ZA.call(YA,$A)});var uu=Ht((wF,av)=>{"use strict";var en,JA=Dy(),KA=Uy(),jA=zy(),QA=Gy(),au=Xp(),su=ta(),tC=qy(),sv=Function,$p=function(r){try{return sv(\'"use strict"; return (\'+r+").constructor;")()}catch(t){}},ea=Object.getOwnPropertyDescriptor;if(ea)try{ea({},"")}catch(r){ea=null}var Zp=function(){throw new su},eC=ea?function(){try{return arguments.callee,Zp}catch(r){try{return ea(arguments,"callee").get}catch(t){return Zp}}}():Zp,iu=$y()(),nC=Jy()(),Ar=Object.getPrototypeOf||(nC?function(r){return r.__proto__}:null),ou={},rC=typeof Uint8Array=="undefined"||!Ar?en:Ar(Uint8Array),na={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?en:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?en:ArrayBuffer,"%ArrayIteratorPrototype%":iu&&Ar?Ar([][Symbol.iterator]()):en,"%AsyncFromSyncIteratorPrototype%":en,"%AsyncFunction%":ou,"%AsyncGenerator%":ou,"%AsyncGeneratorFunction%":ou,"%AsyncIteratorPrototype%":ou,"%Atomics%":typeof Atomics=="undefined"?en:Atomics,"%BigInt%":typeof BigInt=="undefined"?en:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?en:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?en:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?en:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":JA,"%eval%":eval,"%EvalError%":KA,"%Float32Array%":typeof Float32Array=="undefined"?en:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?en:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?en:FinalizationRegistry,"%Function%":sv,"%GeneratorFunction%":ou,"%Int8Array%":typeof Int8Array=="undefined"?en:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?en:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?en:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":iu&&Ar?Ar(Ar([][Symbol.iterator]())):en,"%JSON%":typeof JSON=="object"?JSON:en,"%Map%":typeof Map=="undefined"?en:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!iu||!Ar?en:Ar(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?en:Promise,"%Proxy%":typeof Proxy=="undefined"?en:Proxy,"%RangeError%":jA,"%ReferenceError%":QA,"%Reflect%":typeof Reflect=="undefined"?en:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?en:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!iu||!Ar?en:Ar(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?en:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":iu&&Ar?Ar(""[Symbol.iterator]()):en,"%Symbol%":iu?Symbol:en,"%SyntaxError%":au,"%ThrowTypeError%":eC,"%TypedArray%":rC,"%TypeError%":su,"%Uint8Array%":typeof Uint8Array=="undefined"?en:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?en:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?en:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?en:Uint32Array,"%URIError%":tC,"%WeakMap%":typeof WeakMap=="undefined"?en:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?en:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?en:WeakSet};if(Ar)try{null.error}catch(r){rv=Ar(Ar(r)),na["%Error.prototype%"]=rv}var rv,iC=function r(t){var e;if(t==="%AsyncFunction%")e=$p("async function () {}");else if(t==="%GeneratorFunction%")e=$p("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=$p("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&Ar&&(e=Ar(a.prototype))}return na[t]=e,e},iv={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},rl=zc(),kc=nv(),oC=rl.call(Function.call,Array.prototype.concat),sC=rl.call(Function.apply,Array.prototype.splice),ov=rl.call(Function.call,String.prototype.replace),Gc=rl.call(Function.call,String.prototype.slice),aC=rl.call(Function.call,RegExp.prototype.exec),uC=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,lC=/\\\\(\\\\)?/g,cC=function(t){var e=Gc(t,0,1),o=Gc(t,-1);if(e==="%"&&o!=="%")throw new au("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&e!=="%")throw new au("invalid intrinsic syntax, expected opening `%`");var a=[];return ov(t,uC,function(l,h,f,p){a[a.length]=f?ov(p,lC,"$1"):h||l}),a},hC=function(t,e){var o=t,a;if(kc(iv,o)&&(a=iv[o],o="%"+a[0]+"%"),kc(na,o)){var l=na[o];if(l===ou&&(l=iC(o)),typeof l=="undefined"&&!e)throw new su("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new au("intrinsic "+t+" does not exist!")};av.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new su("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new su(\'"allowMissing" argument must be a boolean\');if(aC(/^%?[^%]*%?$/,t)===null)throw new au("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=cC(t),a=o.length>0?o[0]:"",l=hC("%"+a+"%",e),h=l.name,f=l.value,p=!1,d=l.alias;d&&(a=d[0],sC(o,oC([0,1],d)));for(var g=1,_=!0;g<o.length;g+=1){var y=o[g],M=Gc(y,0,1),b=Gc(y,-1);if((M===\'"\'||M==="\'"||M==="`"||b===\'"\'||b==="\'"||b==="`")&&M!==b)throw new au("property names with quotes must have matching quotes");if((y==="constructor"||!_)&&(p=!0),a+="."+y,h="%"+a+"%",kc(na,h))f=na[h];else if(f!=null){if(!(y in f)){if(!e)throw new su("base intrinsic for "+t+" exists, but the property is not available.");return}if(ea&&g+1>=o.length){var T=ea(f,y);_=!!T,_&&"get"in T&&!("originalValue"in T.get)?f=T.get:f=f[y]}else _=kc(f,y),f=f[y];_&&!p&&(na[h]=f)}}return f}});var Hc=Ht((bF,uv)=>{"use strict";var fC=uu(),Vc=fC("%Object.defineProperty%",!0)||!1;if(Vc)try{Vc({},"a",{value:1})}catch(r){Vc=!1}uv.exports=Vc});var Jp=Ht((TF,lv)=>{"use strict";var pC=uu(),Wc=pC("%Object.getOwnPropertyDescriptor%",!0);if(Wc)try{Wc([],"length")}catch(r){Wc=null}lv.exports=Wc});var qc=Ht((AF,fv)=>{"use strict";var cv=Hc(),dC=Xp(),lu=ta(),hv=Jp();fv.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new lu("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new lu("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new lu("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new lu("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new lu("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new lu("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,p=!!hv&&hv(t,e);if(cv)cv(t,e,{configurable:h===null&&p?p.configurable:!h,enumerable:a===null&&p?p.enumerable:!a,value:o,writable:l===null&&p?p.writable:!l});else if(f||!a&&!l&&!h)t[e]=o;else throw new dC("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Xc=Ht((CF,dv)=>{"use strict";var Kp=Hc(),pv=function(){return!!Kp};pv.hasArrayLengthDefineBug=function(){if(!Kp)return null;try{return Kp([],"length",{value:1}).length!==1}catch(t){return!0}};dv.exports=pv});var _v=Ht((PF,vv)=>{"use strict";var mC=uu(),mv=qc(),gC=Xc()(),gv=Jp(),yv=ta(),yC=mC("%Math.floor%");vv.exports=function(t,e){if(typeof t!="function")throw new yv("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||yC(e)!==e)throw new yv("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&gv){var h=gv(t,"length");h&&!h.configurable&&(a=!1),h&&!h.writable&&(l=!1)}return(a||l||!o)&&(gC?mv(t,"length",e,!0,!0):mv(t,"length",e)),t}});var Zc=Ht((IF,Yc)=>{"use strict";var jp=zc(),$c=uu(),vC=_v(),_C=ta(),Mv=$c("%Function.prototype.apply%"),Sv=$c("%Function.prototype.call%"),wv=$c("%Reflect.apply%",!0)||jp.call(Sv,Mv),xv=Hc(),xC=$c("%Math.max%");Yc.exports=function(t){if(typeof t!="function")throw new _C("a function is required");var e=wv(jp,Sv,arguments);return vC(e,1+xC(0,t.length-(arguments.length-1)),!0)};var Ev=function(){return wv(jp,Mv,arguments)};xv?xv(Yc.exports,"apply",{value:Ev}):Yc.exports.apply=Ev});var Qp=Ht((RF,Av)=>{"use strict";var bv=uu(),Tv=Zc(),EC=Tv(bv("String.prototype.indexOf"));Av.exports=function(t,e){var o=bv(t,!!e);return typeof o=="function"&&EC(t,".prototype.")>-1?Tv(o):o}});var Iv=Ht((LF,Pv)=>{"use strict";var MC=Bc()(),SC=Qp(),td=SC("Object.prototype.toString"),Jc=function(t){return MC&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:td(t)==="[object Arguments]"},Cv=function(t){return Jc(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&td(t)!=="[object Array]"&&td(t.callee)==="[object Function]"},wC=function(){return Jc(arguments)}();Jc.isLegacyArguments=Cv;Pv.exports=wC?Jc:Cv});var cu=Ht((NF,Ov)=>{"use strict";var bC=Wp(),TC=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",AC=Object.prototype.toString,CC=Array.prototype.concat,Rv=qc(),PC=function(r){return typeof r=="function"&&AC.call(r)==="[object Function]"},Lv=Xc()(),IC=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!PC(o)||!o())return}Lv?Rv(r,t,e,!0):Rv(r,t,e)},Nv=function(r,t){var e=arguments.length>2?arguments[2]:{},o=bC(t);TC&&(o=CC.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)IC(r,o[a],t[o[a]],e[o[a]])};Nv.supportsDescriptors=!!Lv;Ov.exports=Nv});var ed=Ht((OF,Fv)=>{"use strict";var Dv=function(r){return r!==r};Fv.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||Dv(t)&&Dv(e))}});var nd=Ht((DF,Uv)=>{"use strict";var RC=ed();Uv.exports=function(){return typeof Object.is=="function"?Object.is:RC}});var zv=Ht((FF,Bv)=>{"use strict";var LC=nd(),NC=cu();Bv.exports=function(){var t=LC();return NC(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Hv=Ht((UF,Vv)=>{"use strict";var OC=cu(),DC=Zc(),FC=ed(),kv=nd(),UC=zv(),Gv=DC(kv(),Object);OC(Gv,{getPolyfill:kv,implementation:FC,shim:UC});Vv.exports=Gv});var $v=Ht((BF,Yv)=>{"use strict";var rd=Qp(),Wv=Bc()(),qv,Xv,id,od;Wv&&(qv=rd("Object.prototype.hasOwnProperty"),Xv=rd("RegExp.prototype.exec"),id={},Kc=function(){throw id},od={toString:Kc,valueOf:Kc},typeof Symbol.toPrimitive=="symbol"&&(od[Symbol.toPrimitive]=Kc));var Kc,BC=rd("Object.prototype.toString"),zC=Object.getOwnPropertyDescriptor,kC="[object RegExp]";Yv.exports=Wv?function(t){if(!t||typeof t!="object")return!1;var e=zC(t,"lastIndex"),o=e&&qv(e,"value");if(!o)return!1;try{Xv(t,od)}catch(a){return a===id}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:BC(t)===kC}});var Jv=Ht((zF,Zv)=>{"use strict";var ol=function(){return typeof function(){}.name=="string"},il=Object.getOwnPropertyDescriptor;if(il)try{il([],"length")}catch(r){il=null}ol.functionsHaveConfigurableNames=function(){if(!ol()||!il)return!1;var t=il(function(){},"name");return!!t&&!!t.configurable};var GC=Function.prototype.bind;ol.boundFunctionsHaveNames=function(){return ol()&&typeof GC=="function"&&function(){}.bind().name!==""};Zv.exports=ol});var Qv=Ht((kF,jv)=>{"use strict";var Kv=qc(),VC=Xc()(),HC=Jv().functionsHaveConfigurableNames(),WC=ta();jv.exports=function(t,e){if(typeof t!="function")throw new WC("`fn` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||HC)&&(VC?Kv(t,"name",e,!0,!0):Kv(t,"name",e)),t}});var sd=Ht((GF,t_)=>{"use strict";var qC=Qv(),XC=ta(),YC=Object;t_.exports=qC(function(){if(this==null||this!==YC(this))throw new XC("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0)});var ad=Ht((VF,e_)=>{"use strict";var $C=sd(),ZC=cu().supportsDescriptors,JC=Object.getOwnPropertyDescriptor;e_.exports=function(){if(ZC&&/a/mig.flags==="gim"){var t=JC(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),t.get.call(o),e==="dy")return t.get}}return $C}});var i_=Ht((HF,r_)=>{"use strict";var KC=cu().supportsDescriptors,jC=ad(),QC=Object.getOwnPropertyDescriptor,tP=Object.defineProperty,eP=TypeError,n_=Object.getPrototypeOf,nP=/a/;r_.exports=function(){if(!KC||!n_)throw new eP("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=jC(),e=n_(nP),o=QC(e,"flags");return(!o||o.get!==t)&&tP(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var u_=Ht((WF,a_)=>{"use strict";var rP=cu(),iP=Zc(),oP=sd(),o_=ad(),sP=i_(),s_=iP(o_());rP(s_,{getPolyfill:o_,implementation:oP,shim:sP});a_.exports=s_});var c_=Ht((qF,l_)=>{"use strict";var aP=Date.prototype.getDay,uP=function(t){try{return aP.call(t),!0}catch(e){return!1}},lP=Object.prototype.toString,cP="[object Date]",hP=Bc()();l_.exports=function(t){return typeof t!="object"||t===null?!1:hP?uP(t):lP.call(t)===cP}});var ud=Ht((XF,E_)=>{var h_=Wp(),f_=Iv(),p_=Hv(),d_=$v(),m_=u_(),g_=c_(),y_=Date.prototype.getTime;function x_(r,t,e){var o=e||{};return(o.strict?p_(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?p_(r,t):r==t:fP(r,t,o)}function v_(r){return r==null}function __(r){return!(!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number")}function fP(r,t,e){var o,a;if(typeof r!=typeof t||v_(r)||v_(t)||r.prototype!==t.prototype||f_(r)!==f_(t))return!1;var l=d_(r),h=d_(t);if(l!==h)return!1;if(l||h)return r.source===t.source&&m_(r)===m_(t);if(g_(r)&&g_(t))return y_.call(r)===y_.call(t);var f=__(r),p=__(t);if(f!==p)return!1;if(f||p){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var d=h_(r),g=h_(t)}catch(_){return!1}if(d.length!==g.length)return!1;for(d.sort(),g.sort(),o=d.length-1;o>=0;o--)if(d[o]!=g[o])return!1;for(o=d.length-1;o>=0;o--)if(a=d[o],!x_(r[a],t[a],e))return!1;return!0}E_.exports=x_});var xd=Ht((jB,C_)=>{var nI=ud(),xo=function(r){this.precision=r&&r.precision?r.precision:17,this.direction=r&&r.direction?r.direction:!1,this.pseudoNode=r&&r.pseudoNode?r.pseudoNode:!1,this.objectComparator=r&&r.objectComparator?r.objectComparator:rI};xo.prototype.compare=function(r,t){if(r.type!==t.type||!A_(r,t))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,t.coordinates);case"LineString":return this.compareLine(r.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(r,t);case"Feature":return this.compareFeature(r,t);default:if(r.type.indexOf("Multi")===0){var e=this,o=T_(r),a=T_(t);return o.every(function(l){return this.some(function(h){return e.compare(l,h)})},a)}}return!1};function T_(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function A_(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}xo.prototype.compareCoord=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e++)if(r[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};xo.prototype.compareLine=function(r,t,e,o){if(!A_(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),l=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],l[0])&&(l=this.fixStartIndex(l,a),!l))){var h=this.compareCoord(a[e],l[e]);return this.direction||h?this.comparePath(a,l):this.compareCoord(a[e],l[l.length-(1+e)])?this.comparePath(a.slice().reverse(),l):!1}};xo.prototype.fixStartIndex=function(r,t){for(var e,o=-1,a=0;a<r.length;a++)if(this.compareCoord(r[a],t[0])){o=a;break}return o>=0&&(e=[].concat(r.slice(o,r.length),r.slice(1,o+1))),e};xo.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};xo.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(l){return this.some(function(h){return a.compareLine(l,h,1,!0)})},o)}else return!1};xo.prototype.compareFeature=function(r,t){return r.id!==t.id||!this.objectComparator(r.properties,t.properties)||!this.compareBBox(r,t)?!1:this.compare(r.geometry,t.geometry)};xo.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};xo.prototype.removePseudo=function(r){return r};function rI(r,t){return nI(r,t,{strict:!0})}C_.exports=xo});var P_=Ht((cz,th)=>{function ws(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}ws.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var l=this._regionQuery(a);if(l.length<this.minPts)this.noise.push(a);else{var h=this.clusters.length;this.clusters.push([]),this._addToCluster(a,h),this._expandCluster(h,l)}}return this.clusters};ws.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};ws.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};ws.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};ws.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};ws.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};ws.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof th!="undefined"&&th.exports&&(th.exports=ws)});var I_=Ht((hz,eh)=>{function bs(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}bs.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};bs.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var l=0;l<this.k;l++){for(var h=new Array(g),f=0,p=0;p<g;p++)h[p]=0;for(var d=0;d<e;d++){var g=this.dataset[d].length;if(l===this.assignments[d]){for(var p=0;p<g;p++)h[p]+=this.dataset[d][p];f++}}if(f>0){for(var p=0;p<g;p++)h[p]/=f;this.centroids[l]=h}else this.centroids[l]=this.randomCentroid(),a=!0}}return this.getClusters()};bs.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};bs.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};bs.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};bs.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,l=t.length,h,f=0;f<l;f++)h=e(r,t[f]),h<o&&(o=h,a=f);return a};bs.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof eh!="undefined"&&eh.exports&&(eh.exports=bs)});var Ed=Ht((fz,nh)=>{function Eo(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}Eo.prototype.insert=function(r,t){for(var e=this._queue.length,o=e;o--;){var a=this._priorities[o];this._sorting==="desc"?t>a&&(e=o):t<a&&(e=o)}this._insertAt(r,t,e)};Eo.prototype.remove=function(r){for(var t=this._queue.length;t--;){var e=this._queue[t];if(r===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};Eo.prototype.forEach=function(r){this._queue.forEach(r)};Eo.prototype.getElements=function(){return this._queue};Eo.prototype.getElementPriority=function(r){return this._priorities[r]};Eo.prototype.getPriorities=function(){return this._priorities};Eo.prototype.getElementsWithPriorities=function(){for(var r=[],t=0,e=this._queue.length;t<e;t++)r.push([this._queue[t],this._priorities[t]]);return r};Eo.prototype._init=function(r,t,e){if(r&&t){if(this._queue=[],this._priorities=[],r.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<r.length;o++)this.insert(r[o],t[o])}e&&(this._sorting=e)};Eo.prototype._insertAt=function(r,t,e){this._queue.length===e?(this._queue.push(r),this._priorities.push(t)):(this._queue.splice(e,0,r),this._priorities.splice(e,0,t))};typeof nh!="undefined"&&nh.exports&&(nh.exports=Eo)});var L_=Ht((pz,fu)=>{typeof fu!="undefined"&&fu.exports&&(R_=Ed());var R_;function jo(r,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,t,e,o)}jo.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,l=this.dataset.length;a<l;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var h=this.clusters.length-1;this._orderedList.push(a);var f=new R_(null,null,"asc"),p=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,p,f),this._expandCluster(h,f))}return this.clusters};jo.prototype.getReachabilityPlot=function(){for(var r=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],a=this._reachability[o];r.push([o,a])}return r};jo.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};jo.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var l=o.distance(o.dataset[r],o.dataset[a]),h=Math.max(o._coreDistance,l);o._reachability[a]===void 0?(o._reachability[a]=h,e.insert(a,h)):h<o._reachability[a]&&(o._reachability[a]=h,e.remove(a),e.insert(a,h))}})};jo.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var l=e[o];if(this._processed[l]===void 0){var h=this._regionQuery(l);this._processed[l]=1,this.clusters[r].push(l),this._orderedList.push(l),this._distanceToCore(l)!==void 0&&(this._updateQueue(l,h,t),this._expandCluster(r,t))}}};jo.prototype._distanceToCore=function(r){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(r,e);if(o.length>=this.minPts)return e}};jo.prototype._regionQuery=function(r,t){t=t||this.epsilon;for(var e=[],o=0,a=this.dataset.length;o<a;o++)this.distance(this.dataset[r],this.dataset[o])<t&&e.push(o);return e};jo.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof fu!="undefined"&&fu.exports&&(fu.exports=jo)});var N_=Ht((dz,rh)=>{typeof rh!="undefined"&&rh.exports&&(rh.exports={DBSCAN:P_(),KMEANS:I_(),OPTICS:L_(),PriorityQueue:Ed()})});var Md=Ht((xz,D_)=>{"use strict";D_.exports={eudist:function(t,e,o){for(var a=t.length,l=0,h=0;h<a;h++){var f=(t[h]||0)-(e[h]||0);l+=f*f}return o?Math.sqrt(l):l},mandist:function(t,e,o){for(var a=t.length,l=0,h=0;h<a;h++)l+=Math.abs((t[h]||0)-(e[h]||0));return o?Math.sqrt(l):l},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var B_=Ht((Ez,U_)=>{"use strict";var F_=Md(),lI=F_.eudist,cI=F_.dist;U_.exports={kmrand:function(t,e){for(var o={},a=[],l=e<<2,h=t.length,f=t[0].length>0;a.length<e&&l-- >0;){var p=t[Math.floor(Math.random()*h)],d=f?p.join("_"):""+p;o[d]||(o[d]=!0,a.push(p))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?lI:cI,a=[],l=t.length,h=t[0].length>0,f={},p=t[Math.floor(Math.random()*l)],d=h?p.join("_"):""+p;for(a.push(p),f[d]=!0;a.length<e;){for(var g=[],_=a.length,y=0,M=[],b=0;b<l;b++){for(var T=1/0,x=0;x<_;x++){var v=o(t[b],a[x]);v<=T&&(T=v)}g[b]=T}for(var P=0;P<l;P++)y+=g[P];for(var S=0;S<l;S++)M[S]={i:S,v:t[S],pr:g[S]/y,cs:0};M.sort(function(B,I){return B.pr-I.pr}),M[0].cs=M[0].pr;for(var L=1;L<l;L++)M[L].cs=M[L-1].cs+M[L].pr;for(var N=Math.random(),G=0;G<l-1&&M[G++].cs<N;);a.push(M[G-1].v)}return a}}});var H_=Ht((wz,V_)=>{"use strict";var Sd=Md(),G_=B_(),hI=Sd.eudist,Mz=Sd.mandist,Sz=Sd.dist,fI=G_.kmrand,pI=G_.kmpp,z_=1e4;function k_(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function dI(r,t,e,o){var a=[],l=[],h=[],f=[],p=!1,d=o||z_,g=r.length,_=r[0].length,y=_>0,M=[];if(e)e=="kmrand"?a=fI(r,t):e=="kmpp"?a=pI(r,t):a=e;else for(var b={};a.length<t;){var T=Math.floor(Math.random()*g);b[T]||(b[T]=!0,a.push(r[T]))}do{k_(t,0,M);for(var x=0;x<g;x++){for(var v=1/0,P=0,S=0;S<t;S++){var f=y?hI(r[x],a[S]):Math.abs(r[x]-a[S]);f<=v&&(v=f,P=S)}h[x]=P,M[P]++}for(var L=[],l=[],N=0,G=0;G<t;G++)L[G]=y?k_(_,0,L[G]):0,l[G]=a[G];if(y){for(var B=0;B<t;B++)a[B]=[];for(var I=0;I<g;I++)for(var O=h[I],q=L[O],st=r[I],V=0;V<_;V++)q[V]+=st[V];p=!0;for(var Mt=0;Mt<t;Mt++){for(var $=a[Mt],ut=L[Mt],xt=l[Mt],mt=M[Mt],lt=0;lt<_;lt++)$[lt]=ut[lt]/mt||0;if(p){for(var ht=0;ht<_;ht++)if(xt[ht]!=$[ht]){p=!1;break}}}}else{for(var k=0;k<g;k++){var nt=h[k];L[nt]+=r[k]}for(var ft=0;ft<t;ft++)a[ft]=L[ft]/M[ft]||0;p=!0;for(var Tt=0;Tt<t;Tt++)if(l[Tt]!=a[Tt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:z_-d,k:t,idxs:h,centroids:a}}V_.exports=dI});var yu=Ht((Pd,Id)=>{(function(r,t){typeof Pd=="object"&&typeof Id!="undefined"?Id.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(Pd,function(){"use strict";function r(Y,w){var C={label:0,sent:function(){if(z[0]&1)throw z[1];return z[1]},trys:[],ops:[]},R,H,z,rt;return rt={next:j(0),throw:j(1),return:j(2)},typeof Symbol=="function"&&(rt[Symbol.iterator]=function(){return this}),rt;function j(tt){return function(Z){return D([tt,Z])}}function D(tt){if(R)throw new TypeError("Generator is already executing.");for(;C;)try{if(R=1,H&&(z=tt[0]&2?H.return:tt[0]?H.throw||((z=H.return)&&z.call(H),0):H.next)&&!(z=z.call(H,tt[1])).done)return z;switch(H=0,z&&(tt=[tt[0]&2,z.value]),tt[0]){case 0:case 1:z=tt;break;case 4:return C.label++,{value:tt[1],done:!1};case 5:C.label++,H=tt[1],tt=[0];continue;case 7:tt=C.ops.pop(),C.trys.pop();continue;default:if(z=C.trys,!(z=z.length>0&&z[z.length-1])&&(tt[0]===6||tt[0]===2)){C=0;continue}if(tt[0]===3&&(!z||tt[1]>z[0]&&tt[1]<z[3])){C.label=tt[1];break}if(tt[0]===6&&C.label<z[1]){C.label=z[1],z=tt;break}if(z&&C.label<z[2]){C.label=z[2],C.ops.push(tt);break}z[2]&&C.ops.pop(),C.trys.pop();continue}tt=w.call(Y,C)}catch(Z){tt=[6,Z],H=0}finally{R=z=0}if(tt[0]&5)throw tt[1];return{value:tt[0]?tt[1]:void 0,done:!0}}}var t=function(){function Y(w,C){this.next=null,this.key=w,this.data=C,this.left=null,this.right=null}return Y}();function e(Y,w){return Y>w?1:Y<w?-1:0}function o(Y,w,C){for(var R=new t(null,null),H=R,z=R;;){var rt=C(Y,w.key);if(rt<0){if(w.left===null)break;if(C(Y,w.left.key)<0){var j=w.left;if(w.left=j.right,j.right=w,w=j,w.left===null)break}z.left=w,z=w,w=w.left}else if(rt>0){if(w.right===null)break;if(C(Y,w.right.key)>0){var j=w.right;if(w.right=j.left,j.left=w,w=j,w.right===null)break}H.right=w,H=w,w=w.right}else break}return H.right=w.left,z.left=w.right,w.left=R.right,w.right=R.left,w}function a(Y,w,C,R){var H=new t(Y,w);if(C===null)return H.left=H.right=null,H;C=o(Y,C,R);var z=R(Y,C.key);return z<0?(H.left=C.left,H.right=C,C.left=null):z>=0&&(H.right=C.right,H.left=C,C.right=null),H}function l(Y,w,C){var R=null,H=null;if(w){w=o(Y,w,C);var z=C(w.key,Y);z===0?(R=w.left,H=w.right):z<0?(H=w.right,w.right=null,R=w):(R=w.left,w.left=null,H=w)}return{left:R,right:H}}function h(Y,w,C){return w===null?Y:(Y===null||(w=o(Y.key,w,C),w.left=Y),w)}function f(Y,w,C,R,H){if(Y){R(""+w+(C?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+H(Y)+`\n`);var z=w+(C?" ":"\\u2502 ");Y.left&&f(Y.left,z,!1,R,H),Y.right&&f(Y.right,z,!0,R,H)}}var p=function(){function Y(w){w===void 0&&(w=e),this._root=null,this._size=0,this._comparator=w}return Y.prototype.insert=function(w,C){return this._size++,this._root=a(w,C,this._root,this._comparator)},Y.prototype.add=function(w,C){var R=new t(w,C);this._root===null&&(R.left=R.right=null,this._size++,this._root=R);var H=this._comparator,z=o(w,this._root,H),rt=H(w,z.key);return rt===0?this._root=z:(rt<0?(R.left=z.left,R.right=z,z.left=null):rt>0&&(R.right=z.right,R.left=z,z.right=null),this._size++,this._root=R),this._root},Y.prototype.remove=function(w){this._root=this._remove(w,this._root,this._comparator)},Y.prototype._remove=function(w,C,R){var H;if(C===null)return null;C=o(w,C,R);var z=R(w,C.key);return z===0?(C.left===null?H=C.right:(H=o(w,C.left,R),H.right=C.right),this._size--,H):C},Y.prototype.pop=function(){var w=this._root;if(w){for(;w.left;)w=w.left;return this._root=o(w.key,this._root,this._comparator),this._root=this._remove(w.key,this._root,this._comparator),{key:w.key,data:w.data}}return null},Y.prototype.findStatic=function(w){for(var C=this._root,R=this._comparator;C;){var H=R(w,C.key);if(H===0)return C;H<0?C=C.left:C=C.right}return null},Y.prototype.find=function(w){return this._root&&(this._root=o(w,this._root,this._comparator),this._comparator(w,this._root.key)!==0)?null:this._root},Y.prototype.contains=function(w){for(var C=this._root,R=this._comparator;C;){var H=R(w,C.key);if(H===0)return!0;H<0?C=C.left:C=C.right}return!1},Y.prototype.forEach=function(w,C){for(var R=this._root,H=[],z=!1;!z;)R!==null?(H.push(R),R=R.left):H.length!==0?(R=H.pop(),w.call(C,R),R=R.right):z=!0;return this},Y.prototype.range=function(w,C,R,H){for(var z=[],rt=this._comparator,j=this._root,D;z.length!==0||j;)if(j)z.push(j),j=j.left;else{if(j=z.pop(),D=rt(j.key,C),D>0)break;if(rt(j.key,w)>=0&&R.call(H,j))return this;j=j.right}return this},Y.prototype.keys=function(){var w=[];return this.forEach(function(C){var R=C.key;return w.push(R)}),w},Y.prototype.values=function(){var w=[];return this.forEach(function(C){var R=C.data;return w.push(R)}),w},Y.prototype.min=function(){return this._root?this.minNode(this._root).key:null},Y.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},Y.prototype.minNode=function(w){if(w===void 0&&(w=this._root),w)for(;w.left;)w=w.left;return w},Y.prototype.maxNode=function(w){if(w===void 0&&(w=this._root),w)for(;w.right;)w=w.right;return w},Y.prototype.at=function(w){for(var C=this._root,R=!1,H=0,z=[];!R;)if(C)z.push(C),C=C.left;else if(z.length>0){if(C=z.pop(),H===w)return C;H++,C=C.right}else R=!0;return null},Y.prototype.next=function(w){var C=this._root,R=null;if(w.right){for(R=w.right;R.left;)R=R.left;return R}for(var H=this._comparator;C;){var z=H(w.key,C.key);if(z===0)break;z<0?(R=C,C=C.left):C=C.right}return R},Y.prototype.prev=function(w){var C=this._root,R=null;if(w.left!==null){for(R=w.left;R.right;)R=R.right;return R}for(var H=this._comparator;C;){var z=H(w.key,C.key);if(z===0)break;z<0?C=C.left:(R=C,C=C.right)}return R},Y.prototype.clear=function(){return this._root=null,this._size=0,this},Y.prototype.toList=function(){return _(this._root)},Y.prototype.load=function(w,C,R){C===void 0&&(C=[]),R===void 0&&(R=!1);var H=w.length,z=this._comparator;if(R&&b(w,C,0,H-1,z),this._root===null)this._root=d(w,C,0,H),this._size=H;else{var rt=M(this.toList(),g(w,C),z);H=this._size+H,this._root=y({head:rt},0,H)}return this},Y.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(Y.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(Y.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Y.prototype.toString=function(w){w===void 0&&(w=function(R){return String(R.key)});var C=[];return f(this._root,"",!0,function(R){return C.push(R)},w),C.join("")},Y.prototype.update=function(w,C,R){var H=this._comparator,z=l(w,this._root,H),rt=z.left,j=z.right;H(w,C)<0?j=a(C,R,j,H):rt=a(C,R,rt,H),this._root=h(rt,j,H)},Y.prototype.split=function(w){return l(w,this._root,this._comparator)},Y.prototype[Symbol.iterator]=function(){var w,C,R;return r(this,function(H){switch(H.label){case 0:w=this._root,C=[],R=!1,H.label=1;case 1:return R?[3,6]:w===null?[3,2]:(C.push(w),w=w.left,[3,5]);case 2:return C.length===0?[3,4]:(w=C.pop(),[4,w]);case 3:return H.sent(),w=w.right,[3,5];case 4:R=!0,H.label=5;case 5:return[3,1];case 6:return[2]}})},Y}();function d(Y,w,C,R){var H=R-C;if(H>0){var z=C+Math.floor(H/2),rt=Y[z],j=w[z],D=new t(rt,j);return D.left=d(Y,w,C,z),D.right=d(Y,w,z+1,R),D}return null}function g(Y,w){for(var C=new t(null,null),R=C,H=0;H<Y.length;H++)R=R.next=new t(Y[H],w[H]);return R.next=null,C.next}function _(Y){for(var w=Y,C=[],R=!1,H=new t(null,null),z=H;!R;)w?(C.push(w),w=w.left):C.length>0?(w=z=z.next=C.pop(),w=w.right):R=!0;return z.next=null,H.next}function y(Y,w,C){var R=C-w;if(R>0){var H=w+Math.floor(R/2),z=y(Y,w,H),rt=Y.head;return rt.left=z,Y.head=Y.head.next,rt.right=y(Y,H+1,C),rt}return null}function M(Y,w,C){for(var R=new t(null,null),H=R,z=Y,rt=w;z!==null&&rt!==null;)C(z.key,rt.key)<0?(H.next=z,z=z.next):(H.next=rt,rt=rt.next),H=H.next;return z!==null?H.next=z:rt!==null&&(H.next=rt),R.next}function b(Y,w,C,R,H){if(!(C>=R)){for(var z=Y[C+R>>1],rt=C-1,j=R+1;;){do rt++;while(H(Y[rt],z)<0);do j--;while(H(Y[j],z)>0);if(rt>=j)break;var D=Y[rt];Y[rt]=Y[j],Y[j]=D,D=w[rt],w[rt]=w[j],w[j]=D}b(Y,w,C,j,H),b(Y,w,j+1,R,H)}}let T=(Y,w)=>Y.ll.x<=w.x&&w.x<=Y.ur.x&&Y.ll.y<=w.y&&w.y<=Y.ur.y,x=(Y,w)=>{if(w.ur.x<Y.ll.x||Y.ur.x<w.ll.x||w.ur.y<Y.ll.y||Y.ur.y<w.ll.y)return null;let C=Y.ll.x<w.ll.x?w.ll.x:Y.ll.x,R=Y.ur.x<w.ur.x?Y.ur.x:w.ur.x,H=Y.ll.y<w.ll.y?w.ll.y:Y.ll.y,z=Y.ur.y<w.ur.y?Y.ur.y:w.ur.y;return{ll:{x:C,y:H},ur:{x:R,y:z}}},v=Number.EPSILON;v===void 0&&(v=Math.pow(2,-52));let P=v*v,S=(Y,w)=>{if(-v<Y&&Y<v&&-v<w&&w<v)return 0;let C=Y-w;return C*C<P*Y*w?0:Y<w?-1:1};class L{constructor(){this.reset()}reset(){this.xRounder=new N,this.yRounder=new N}round(w,C){return{x:this.xRounder.round(w),y:this.yRounder.round(C)}}}class N{constructor(){this.tree=new p,this.round(0)}round(w){let C=this.tree.add(w),R=this.tree.prev(C);if(R!==null&&S(C.key,R.key)===0)return this.tree.remove(w),R.key;let H=this.tree.next(C);return H!==null&&S(C.key,H.key)===0?(this.tree.remove(w),H.key):w}}let G=new L,B=11102230246251565e-32,I=134217729,O=(3+8*B)*B;function q(Y,w,C,R,H){let z,rt,j,D,tt=w[0],Z=R[0],et=0,ot=0;Z>tt==Z>-tt?(z=tt,tt=w[++et]):(z=Z,Z=R[++ot]);let Q=0;if(et<Y&&ot<C)for(Z>tt==Z>-tt?(rt=tt+z,j=z-(rt-tt),tt=w[++et]):(rt=Z+z,j=z-(rt-Z),Z=R[++ot]),z=rt,j!==0&&(H[Q++]=j);et<Y&&ot<C;)Z>tt==Z>-tt?(rt=z+tt,D=rt-z,j=z-(rt-D)+(tt-D),tt=w[++et]):(rt=z+Z,D=rt-z,j=z-(rt-D)+(Z-D),Z=R[++ot]),z=rt,j!==0&&(H[Q++]=j);for(;et<Y;)rt=z+tt,D=rt-z,j=z-(rt-D)+(tt-D),tt=w[++et],z=rt,j!==0&&(H[Q++]=j);for(;ot<C;)rt=z+Z,D=rt-z,j=z-(rt-D)+(Z-D),Z=R[++ot],z=rt,j!==0&&(H[Q++]=j);return(z!==0||Q===0)&&(H[Q++]=z),Q}function st(Y,w){let C=w[0];for(let R=1;R<Y;R++)C+=w[R];return C}function V(Y){return new Float64Array(Y)}let Mt=(3+16*B)*B,$=(2+12*B)*B,ut=(9+64*B)*B*B,xt=V(4),mt=V(8),lt=V(12),ht=V(16),k=V(4);function nt(Y,w,C,R,H,z,rt){let j,D,tt,Z,et,ot,Q,St,At,ne,Gt,He,tn,Ln,mn,Fn,$n,xn,re=Y-H,En=C-H,Cn=w-z,wn=R-z;Ln=re*wn,ot=I*re,Q=ot-(ot-re),St=re-Q,ot=I*wn,At=ot-(ot-wn),ne=wn-At,mn=St*ne-(Ln-Q*At-St*At-Q*ne),Fn=Cn*En,ot=I*Cn,Q=ot-(ot-Cn),St=Cn-Q,ot=I*En,At=ot-(ot-En),ne=En-At,$n=St*ne-(Fn-Q*At-St*At-Q*ne),Gt=mn-$n,et=mn-Gt,xt[0]=mn-(Gt+et)+(et-$n),He=Ln+Gt,et=He-Ln,tn=Ln-(He-et)+(Gt-et),Gt=tn-Fn,et=tn-Gt,xt[1]=tn-(Gt+et)+(et-Fn),xn=He+Gt,et=xn-He,xt[2]=He-(xn-et)+(Gt-et),xt[3]=xn;let gn=st(4,xt),W=$*rt;if(gn>=W||-gn>=W||(et=Y-re,j=Y-(re+et)+(et-H),et=C-En,tt=C-(En+et)+(et-H),et=w-Cn,D=w-(Cn+et)+(et-z),et=R-wn,Z=R-(wn+et)+(et-z),j===0&&D===0&&tt===0&&Z===0)||(W=ut*rt+O*Math.abs(gn),gn+=re*Z+wn*j-(Cn*tt+En*D),gn>=W||-gn>=W))return gn;Ln=j*wn,ot=I*j,Q=ot-(ot-j),St=j-Q,ot=I*wn,At=ot-(ot-wn),ne=wn-At,mn=St*ne-(Ln-Q*At-St*At-Q*ne),Fn=D*En,ot=I*D,Q=ot-(ot-D),St=D-Q,ot=I*En,At=ot-(ot-En),ne=En-At,$n=St*ne-(Fn-Q*At-St*At-Q*ne),Gt=mn-$n,et=mn-Gt,k[0]=mn-(Gt+et)+(et-$n),He=Ln+Gt,et=He-Ln,tn=Ln-(He-et)+(Gt-et),Gt=tn-Fn,et=tn-Gt,k[1]=tn-(Gt+et)+(et-Fn),xn=He+Gt,et=xn-He,k[2]=He-(xn-et)+(Gt-et),k[3]=xn;let at=q(4,xt,4,k,mt);Ln=re*Z,ot=I*re,Q=ot-(ot-re),St=re-Q,ot=I*Z,At=ot-(ot-Z),ne=Z-At,mn=St*ne-(Ln-Q*At-St*At-Q*ne),Fn=Cn*tt,ot=I*Cn,Q=ot-(ot-Cn),St=Cn-Q,ot=I*tt,At=ot-(ot-tt),ne=tt-At,$n=St*ne-(Fn-Q*At-St*At-Q*ne),Gt=mn-$n,et=mn-Gt,k[0]=mn-(Gt+et)+(et-$n),He=Ln+Gt,et=He-Ln,tn=Ln-(He-et)+(Gt-et),Gt=tn-Fn,et=tn-Gt,k[1]=tn-(Gt+et)+(et-Fn),xn=He+Gt,et=xn-He,k[2]=He-(xn-et)+(Gt-et),k[3]=xn;let _t=q(at,mt,4,k,lt);Ln=j*Z,ot=I*j,Q=ot-(ot-j),St=j-Q,ot=I*Z,At=ot-(ot-Z),ne=Z-At,mn=St*ne-(Ln-Q*At-St*At-Q*ne),Fn=D*tt,ot=I*D,Q=ot-(ot-D),St=D-Q,ot=I*tt,At=ot-(ot-tt),ne=tt-At,$n=St*ne-(Fn-Q*At-St*At-Q*ne),Gt=mn-$n,et=mn-Gt,k[0]=mn-(Gt+et)+(et-$n),He=Ln+Gt,et=He-Ln,tn=Ln-(He-et)+(Gt-et),Gt=tn-Fn,et=tn-Gt,k[1]=tn-(Gt+et)+(et-Fn),xn=He+Gt,et=xn-He,k[2]=He-(xn-et)+(Gt-et),k[3]=xn;let ct=q(_t,lt,4,k,ht);return ht[ct-1]}function ft(Y,w,C,R,H,z){let rt=(w-z)*(C-H),j=(Y-H)*(R-z),D=rt-j,tt=Math.abs(rt+j);return Math.abs(D)>=Mt*tt?D:-nt(Y,w,C,R,H,z,tt)}let Tt=(Y,w)=>Y.x*w.y-Y.y*w.x,gt=(Y,w)=>Y.x*w.x+Y.y*w.y,Lt=(Y,w,C)=>{let R=ft(Y.x,Y.y,w.x,w.y,C.x,C.y);return R>0?-1:R<0?1:0},qt=Y=>Math.sqrt(gt(Y,Y)),Xt=(Y,w,C)=>{let R={x:w.x-Y.x,y:w.y-Y.y},H={x:C.x-Y.x,y:C.y-Y.y};return Tt(H,R)/qt(H)/qt(R)},Ft=(Y,w,C)=>{let R={x:w.x-Y.x,y:w.y-Y.y},H={x:C.x-Y.x,y:C.y-Y.y};return gt(H,R)/qt(H)/qt(R)},Qt=(Y,w,C)=>w.y===0?null:{x:Y.x+w.x/w.y*(C-Y.y),y:C},Ct=(Y,w,C)=>w.x===0?null:{x:C,y:Y.y+w.y/w.x*(C-Y.x)},ee=(Y,w,C,R)=>{if(w.x===0)return Ct(C,R,Y.x);if(R.x===0)return Ct(Y,w,C.x);if(w.y===0)return Qt(C,R,Y.y);if(R.y===0)return Qt(Y,w,C.y);let H=Tt(w,R);if(H==0)return null;let z={x:C.x-Y.x,y:C.y-Y.y},rt=Tt(z,w)/H,j=Tt(z,R)/H,D=Y.x+j*w.x,tt=C.x+rt*R.x,Z=Y.y+j*w.y,et=C.y+rt*R.y,ot=(D+tt)/2,Q=(Z+et)/2;return{x:ot,y:Q}};class it{static compare(w,C){let R=it.comparePoints(w.point,C.point);return R!==0?R:(w.point!==C.point&&w.link(C),w.isLeft!==C.isLeft?w.isLeft?1:-1:Bt.compare(w.segment,C.segment))}static comparePoints(w,C){return w.x<C.x?-1:w.x>C.x?1:w.y<C.y?-1:w.y>C.y?1:0}constructor(w,C){w.events===void 0?w.events=[this]:w.events.push(this),this.point=w,this.isLeft=C}link(w){if(w.point===this.point)throw new Error("Tried to link already linked events");let C=w.point.events;for(let R=0,H=C.length;R<H;R++){let z=C[R];this.point.events.push(z),z.point=this.point}this.checkForConsuming()}checkForConsuming(){let w=this.point.events.length;for(let C=0;C<w;C++){let R=this.point.events[C];if(R.segment.consumedBy===void 0)for(let H=C+1;H<w;H++){let z=this.point.events[H];z.consumedBy===void 0&&R.otherSE.point.events===z.otherSE.point.events&&R.segment.consume(z.segment)}}}getAvailableLinkedEvents(){let w=[];for(let C=0,R=this.point.events.length;C<R;C++){let H=this.point.events[C];H!==this&&!H.segment.ringOut&&H.segment.isInResult()&&w.push(H)}return w}getLeftmostComparator(w){let C=new Map,R=H=>{let z=H.otherSE;C.set(H,{sine:Xt(this.point,w.point,z.point),cosine:Ft(this.point,w.point,z.point)})};return(H,z)=>{C.has(H)||R(H),C.has(z)||R(z);let{sine:rt,cosine:j}=C.get(H),{sine:D,cosine:tt}=C.get(z);return rt>=0&&D>=0?j<tt?1:j>tt?-1:0:rt<0&&D<0?j<tt?-1:j>tt?1:0:D<rt?-1:D>rt?1:0}}}let rn=0;class Bt{static compare(w,C){let R=w.leftSE.point.x,H=C.leftSE.point.x,z=w.rightSE.point.x,rt=C.rightSE.point.x;if(rt<R)return 1;if(z<H)return-1;let j=w.leftSE.point.y,D=C.leftSE.point.y,tt=w.rightSE.point.y,Z=C.rightSE.point.y;if(R<H){if(D<j&&D<tt)return 1;if(D>j&&D>tt)return-1;let et=w.comparePoint(C.leftSE.point);if(et<0)return 1;if(et>0)return-1;let ot=C.comparePoint(w.rightSE.point);return ot!==0?ot:-1}if(R>H){if(j<D&&j<Z)return-1;if(j>D&&j>Z)return 1;let et=C.comparePoint(w.leftSE.point);if(et!==0)return et;let ot=w.comparePoint(C.rightSE.point);return ot<0?1:ot>0?-1:1}if(j<D)return-1;if(j>D)return 1;if(z<rt){let et=C.comparePoint(w.rightSE.point);if(et!==0)return et}if(z>rt){let et=w.comparePoint(C.rightSE.point);if(et<0)return 1;if(et>0)return-1}if(z!==rt){let et=tt-j,ot=z-R,Q=Z-D,St=rt-H;if(et>ot&&Q<St)return 1;if(et<ot&&Q>St)return-1}return z>rt?1:z<rt||tt<Z?-1:tt>Z?1:w.id<C.id?-1:w.id>C.id?1:0}constructor(w,C,R,H){this.id=++rn,this.leftSE=w,w.segment=this,w.otherSE=C,this.rightSE=C,C.segment=this,C.otherSE=w,this.rings=R,this.windings=H}static fromRing(w,C,R){let H,z,rt,j=it.comparePoints(w,C);if(j<0)H=w,z=C,rt=1;else if(j>0)H=C,z=w,rt=-1;else throw new Error(`Tried to create degenerate segment at [${w.x}, ${w.y}]`);let D=new it(H,!0),tt=new it(z,!1);return new Bt(D,tt,[R],[rt])}replaceRightSE(w){this.rightSE=w,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let w=this.leftSE.point.y,C=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:w<C?w:C},ur:{x:this.rightSE.point.x,y:w>C?w:C}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(w){return w.x===this.leftSE.point.x&&w.y===this.leftSE.point.y||w.x===this.rightSE.point.x&&w.y===this.rightSE.point.y}comparePoint(w){if(this.isAnEndpoint(w))return 0;let C=this.leftSE.point,R=this.rightSE.point,H=this.vector();if(C.x===R.x)return w.x===C.x?0:w.x<C.x?1:-1;let z=(w.y-C.y)/H.y,rt=C.x+z*H.x;if(w.x===rt)return 0;let j=(w.x-C.x)/H.x,D=C.y+j*H.y;return w.y===D?0:w.y<D?-1:1}getIntersection(w){let C=this.bbox(),R=w.bbox(),H=x(C,R);if(H===null)return null;let z=this.leftSE.point,rt=this.rightSE.point,j=w.leftSE.point,D=w.rightSE.point,tt=T(C,j)&&this.comparePoint(j)===0,Z=T(R,z)&&w.comparePoint(z)===0,et=T(C,D)&&this.comparePoint(D)===0,ot=T(R,rt)&&w.comparePoint(rt)===0;if(Z&&tt)return ot&&!et?rt:!ot&&et?D:null;if(Z)return et&&z.x===D.x&&z.y===D.y?null:z;if(tt)return ot&&rt.x===j.x&&rt.y===j.y?null:j;if(ot&&et)return null;if(ot)return rt;if(et)return D;let Q=ee(z,this.vector(),j,w.vector());return Q===null||!T(H,Q)?null:G.round(Q.x,Q.y)}split(w){let C=[],R=w.events!==void 0,H=new it(w,!0),z=new it(w,!1),rt=this.rightSE;this.replaceRightSE(z),C.push(z),C.push(H);let j=new Bt(H,rt,this.rings.slice(),this.windings.slice());return it.comparePoints(j.leftSE.point,j.rightSE.point)>0&&j.swapEvents(),it.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),R&&(H.checkForConsuming(),z.checkForConsuming()),C}swapEvents(){let w=this.rightSE;this.rightSE=this.leftSE,this.leftSE=w,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let C=0,R=this.windings.length;C<R;C++)this.windings[C]*=-1}consume(w){let C=this,R=w;for(;C.consumedBy;)C=C.consumedBy;for(;R.consumedBy;)R=R.consumedBy;let H=Bt.compare(C,R);if(H!==0){if(H>0){let z=C;C=R,R=z}if(C.prev===R){let z=C;C=R,R=z}for(let z=0,rt=R.rings.length;z<rt;z++){let j=R.rings[z],D=R.windings[z],tt=C.rings.indexOf(j);tt===-1?(C.rings.push(j),C.windings.push(D)):C.windings[tt]+=D}R.rings=null,R.windings=null,R.consumedBy=C,R.leftSE.consumedBy=C.leftSE,R.rightSE.consumedBy=C.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let w=this.prev.consumedBy||this.prev;this._beforeState=w.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let w=this.beforeState();this._afterState={rings:w.rings.slice(0),windings:w.windings.slice(0),multiPolys:[]};let C=this._afterState.rings,R=this._afterState.windings,H=this._afterState.multiPolys;for(let j=0,D=this.rings.length;j<D;j++){let tt=this.rings[j],Z=this.windings[j],et=C.indexOf(tt);et===-1?(C.push(tt),R.push(Z)):R[et]+=Z}let z=[],rt=[];for(let j=0,D=C.length;j<D;j++){if(R[j]===0)continue;let tt=C[j],Z=tt.poly;if(rt.indexOf(Z)===-1)if(tt.isExterior)z.push(Z);else{rt.indexOf(Z)===-1&&rt.push(Z);let et=z.indexOf(tt.poly);et!==-1&&z.splice(et,1)}}for(let j=0,D=z.length;j<D;j++){let tt=z[j].multiPoly;H.indexOf(tt)===-1&&H.push(tt)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let w=this.beforeState().multiPolys,C=this.afterState().multiPolys;switch(J.type){case"union":{let R=w.length===0,H=C.length===0;this._isInResult=R!==H;break}case"intersection":{let R,H;w.length<C.length?(R=w.length,H=C.length):(R=C.length,H=w.length),this._isInResult=H===J.numMultiPolys&&R<H;break}case"xor":{let R=Math.abs(w.length-C.length);this._isInResult=R%2===1;break}case"difference":{let R=H=>H.length===1&&H[0].isSubject;this._isInResult=R(w)!==R(C);break}default:throw new Error(`Unrecognized operation type found ${J.type}`)}return this._isInResult}}class Jt{constructor(w,C,R){if(!Array.isArray(w)||w.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=C,this.isExterior=R,this.segments=[],typeof w[0][0]!="number"||typeof w[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let H=G.round(w[0][0],w[0][1]);this.bbox={ll:{x:H.x,y:H.y},ur:{x:H.x,y:H.y}};let z=H;for(let rt=1,j=w.length;rt<j;rt++){if(typeof w[rt][0]!="number"||typeof w[rt][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let D=G.round(w[rt][0],w[rt][1]);D.x===z.x&&D.y===z.y||(this.segments.push(Bt.fromRing(z,D,this)),D.x<this.bbox.ll.x&&(this.bbox.ll.x=D.x),D.y<this.bbox.ll.y&&(this.bbox.ll.y=D.y),D.x>this.bbox.ur.x&&(this.bbox.ur.x=D.x),D.y>this.bbox.ur.y&&(this.bbox.ur.y=D.y),z=D)}(H.x!==z.x||H.y!==z.y)&&this.segments.push(Bt.fromRing(z,H,this))}getSweepEvents(){let w=[];for(let C=0,R=this.segments.length;C<R;C++){let H=this.segments[C];w.push(H.leftSE),w.push(H.rightSE)}return w}}class Yt{constructor(w,C){if(!Array.isArray(w))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Jt(w[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let R=1,H=w.length;R<H;R++){let z=new Jt(w[R],this,!1);z.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=z.bbox.ll.x),z.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=z.bbox.ll.y),z.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=z.bbox.ur.x),z.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=z.bbox.ur.y),this.interiorRings.push(z)}this.multiPoly=C}getSweepEvents(){let w=this.exteriorRing.getSweepEvents();for(let C=0,R=this.interiorRings.length;C<R;C++){let H=this.interiorRings[C].getSweepEvents();for(let z=0,rt=H.length;z<rt;z++)w.push(H[z])}return w}}class pe{constructor(w,C){if(!Array.isArray(w))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof w[0][0][0]=="number"&&(w=[w])}catch(R){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let R=0,H=w.length;R<H;R++){let z=new Yt(w[R],this);z.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=z.bbox.ll.x),z.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=z.bbox.ll.y),z.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=z.bbox.ur.x),z.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=z.bbox.ur.y),this.polys.push(z)}this.isSubject=C}getSweepEvents(){let w=[];for(let C=0,R=this.polys.length;C<R;C++){let H=this.polys[C].getSweepEvents();for(let z=0,rt=H.length;z<rt;z++)w.push(H[z])}return w}}class le{static factory(w){let C=[];for(let R=0,H=w.length;R<H;R++){let z=w[R];if(!z.isInResult()||z.ringOut)continue;let rt=null,j=z.leftSE,D=z.rightSE,tt=[j],Z=j.point,et=[];for(;rt=j,j=D,tt.push(j),j.point!==Z;)for(;;){let ot=j.getAvailableLinkedEvents();if(ot.length===0){let At=tt[0].point,ne=tt[tt.length-1].point;throw new Error(`Unable to complete output ring starting at [${At.x}, ${At.y}]. Last matching segment found ends at [${ne.x}, ${ne.y}].`)}if(ot.length===1){D=ot[0].otherSE;break}let Q=null;for(let At=0,ne=et.length;At<ne;At++)if(et[At].point===j.point){Q=At;break}if(Q!==null){let At=et.splice(Q)[0],ne=tt.splice(At.index);ne.unshift(ne[0].otherSE),C.push(new le(ne.reverse()));continue}et.push({index:tt.length,point:j.point});let St=j.getLeftmostComparator(rt);D=ot.sort(St)[0].otherSE;break}C.push(new le(tt))}return C}constructor(w){this.events=w;for(let C=0,R=w.length;C<R;C++)w[C].segment.ringOut=this;this.poly=null}getGeom(){let w=this.events[0].point,C=[w];for(let tt=1,Z=this.events.length-1;tt<Z;tt++){let et=this.events[tt].point,ot=this.events[tt+1].point;Lt(et,w,ot)!==0&&(C.push(et),w=et)}if(C.length===1)return null;let R=C[0],H=C[1];Lt(R,w,H)===0&&C.shift(),C.push(C[0]);let z=this.isExteriorRing()?1:-1,rt=this.isExteriorRing()?0:C.length-1,j=this.isExteriorRing()?C.length:-1,D=[];for(let tt=rt;tt!=j;tt+=z)D.push([C[tt].x,C[tt].y]);return D}isExteriorRing(){if(this._isExteriorRing===void 0){let w=this.enclosingRing();this._isExteriorRing=w?!w.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let w=this.events[0];for(let H=1,z=this.events.length;H<z;H++){let rt=this.events[H];it.compare(w,rt)>0&&(w=rt)}let C=w.segment.prevInResult(),R=C?C.prevInResult():null;for(;;){if(!C)return null;if(!R)return C.ringOut;if(R.ringOut!==C.ringOut)return R.ringOut.enclosingRing()!==C.ringOut?C.ringOut:C.ringOut.enclosingRing();C=R.prevInResult(),R=C?C.prevInResult():null}}}class Pt{constructor(w){this.exteriorRing=w,w.poly=this,this.interiorRings=[]}addInterior(w){this.interiorRings.push(w),w.poly=this}getGeom(){let w=[this.exteriorRing.getGeom()];if(w[0]===null)return null;for(let C=0,R=this.interiorRings.length;C<R;C++){let H=this.interiorRings[C].getGeom();H!==null&&w.push(H)}return w}}class te{constructor(w){this.rings=w,this.polys=this._composePolys(w)}getGeom(){let w=[];for(let C=0,R=this.polys.length;C<R;C++){let H=this.polys[C].getGeom();H!==null&&w.push(H)}return w}_composePolys(w){let C=[];for(let R=0,H=w.length;R<H;R++){let z=w[R];if(!z.poly)if(z.isExteriorRing())C.push(new Pt(z));else{let rt=z.enclosingRing();rt.poly||C.push(new Pt(rt)),rt.poly.addInterior(z)}}return C}}class yn{constructor(w){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Bt.compare;this.queue=w,this.tree=new p(C),this.segments=[]}process(w){let C=w.segment,R=[];if(w.consumedBy)return w.isLeft?this.queue.remove(w.otherSE):this.tree.remove(C),R;let H=w.isLeft?this.tree.add(C):this.tree.find(C);if(!H)throw new Error(`Unable to find segment #${C.id} [${C.leftSE.point.x}, ${C.leftSE.point.y}] -> [${C.rightSE.point.x}, ${C.rightSE.point.y}] in SweepLine tree.`);let z=H,rt=H,j,D;for(;j===void 0;)z=this.tree.prev(z),z===null?j=null:z.key.consumedBy===void 0&&(j=z.key);for(;D===void 0;)rt=this.tree.next(rt),rt===null?D=null:rt.key.consumedBy===void 0&&(D=rt.key);if(w.isLeft){let tt=null;if(j){let et=j.getIntersection(C);if(et!==null&&(C.isAnEndpoint(et)||(tt=et),!j.isAnEndpoint(et))){let ot=this._splitSafely(j,et);for(let Q=0,St=ot.length;Q<St;Q++)R.push(ot[Q])}}let Z=null;if(D){let et=D.getIntersection(C);if(et!==null&&(C.isAnEndpoint(et)||(Z=et),!D.isAnEndpoint(et))){let ot=this._splitSafely(D,et);for(let Q=0,St=ot.length;Q<St;Q++)R.push(ot[Q])}}if(tt!==null||Z!==null){let et=null;tt===null?et=Z:Z===null?et=tt:et=it.comparePoints(tt,Z)<=0?tt:Z,this.queue.remove(C.rightSE),R.push(C.rightSE);let ot=C.split(et);for(let Q=0,St=ot.length;Q<St;Q++)R.push(ot[Q])}R.length>0?(this.tree.remove(C),R.push(w)):(this.segments.push(C),C.prev=j)}else{if(j&&D){let tt=j.getIntersection(D);if(tt!==null){if(!j.isAnEndpoint(tt)){let Z=this._splitSafely(j,tt);for(let et=0,ot=Z.length;et<ot;et++)R.push(Z[et])}if(!D.isAnEndpoint(tt)){let Z=this._splitSafely(D,tt);for(let et=0,ot=Z.length;et<ot;et++)R.push(Z[et])}}}this.tree.remove(C)}return R}_splitSafely(w,C){this.tree.remove(w);let R=w.rightSE;this.queue.remove(R);let H=w.split(C);return H.push(R),w.consumedBy===void 0&&this.tree.add(w),H}}let pn=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,X=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class F{run(w,C,R){J.type=w,G.reset();let H=[new pe(C,!0)];for(let et=0,ot=R.length;et<ot;et++)H.push(new pe(R[et],!1));if(J.numMultiPolys=H.length,J.type==="difference"){let et=H[0],ot=1;for(;ot<H.length;)x(H[ot].bbox,et.bbox)!==null?ot++:H.splice(ot,1)}if(J.type==="intersection")for(let et=0,ot=H.length;et<ot;et++){let Q=H[et];for(let St=et+1,At=H.length;St<At;St++)if(x(Q.bbox,H[St].bbox)===null)return[]}let z=new p(it.compare);for(let et=0,ot=H.length;et<ot;et++){let Q=H[et].getSweepEvents();for(let St=0,At=Q.length;St<At;St++)if(z.insert(Q[St]),z.size>pn)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let rt=new yn(z),j=z.size,D=z.pop();for(;D;){let et=D.key;if(z.size===j){let Q=et.segment;throw new Error(`Unable to pop() ${et.isLeft?"left":"right"} SweepEvent [${et.point.x}, ${et.point.y}] from segment #${Q.id} [${Q.leftSE.point.x}, ${Q.leftSE.point.y}] -> [${Q.rightSE.point.x}, ${Q.rightSE.point.y}] from queue.`)}if(z.size>pn)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(rt.segments.length>X)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let ot=rt.process(et);for(let Q=0,St=ot.length;Q<St;Q++){let At=ot[Q];At.consumedBy===void 0&&z.insert(At)}j=z.size,D=z.pop()}G.reset();let tt=le.factory(rt.segments);return new te(tt).getGeom()}}let J=new F;var Dt={union:function(Y){for(var w=arguments.length,C=new Array(w>1?w-1:0),R=1;R<w;R++)C[R-1]=arguments[R];return J.run("union",Y,C)},intersection:function(Y){for(var w=arguments.length,C=new Array(w>1?w-1:0),R=1;R<w;R++)C[R-1]=arguments[R];return J.run("intersection",Y,C)},xor:function(Y){for(var w=arguments.length,C=new Array(w>1?w-1:0),R=1;R<w;R++)C[R-1]=arguments[R];return J.run("xor",Y,C)},difference:function(Y){for(var w=arguments.length,C=new Array(w>1?w-1:0),R=1;R<w;R++)C[R-1]=arguments[R];return J.run("difference",Y,C)}};return Dt})});var u1=Ht((ah,a1)=>{(function(r,t){typeof ah=="object"&&typeof a1!="undefined"?t(ah):typeof define=="function"&&define.amd?define(["exports"],t):t(r.jsts={})})(ah,function(r){"use strict";function t(){}function e(n){this.message=n||""}function o(n){this.message=n||""}function a(n){this.message=n||""}function l(){}function h(n){return n===null?mn:n.color}function f(n){return n===null?null:n.parent}function p(n,i){n!==null&&(n.color=i)}function d(n){return n===null?null:n.left}function g(n){return n===null?null:n.right}function _(){this.root_=null,this.size_=0}function y(){}function M(){this.array_=[],arguments[0]instanceof j&&this.addAll(arguments[0])}function b(){}function T(n){this.message=n||""}function x(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(n){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),s=Math.max(Math.min(i.length,9007199254740991),0)||0,u=1 in arguments&&parseInt(Number(arguments[1]),10)||0;u=u<0?Math.max(s+u,0):Math.min(u,s);var c=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:s;for(c=c<0?Math.max(s+arguments[2],0):Math.min(c,s);u<c;)i[u]=n,++u;return i},writable:!0}),Number.isFinite=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},Number.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(n){return n!=n},Math.trunc=Math.trunc||function(n){return n<0?Math.ceil(n):Math.floor(n)};var v=function(){};v.prototype.interfaces_=function(){return[]},v.prototype.getClass=function(){return v},v.prototype.equalsWithTolerance=function(n,i,s){return Math.abs(n-i)<=s};var P=function(n){function i(s){n.call(this,s),this.name="IllegalArgumentException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),S=function(){},L={MAX_VALUE:{configurable:!0}};S.isNaN=function(n){return Number.isNaN(n)},S.doubleToLongBits=function(n){return n},S.longBitsToDouble=function(n){return n},S.isInfinite=function(n){return!Number.isFinite(n)},L.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(S,L);var N=function(){},G=function(){},B=function(){},I=function n(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=n.NULL_ORDINATE;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.z=i.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=n.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},O={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};I.prototype.setOrdinate=function(n,i){switch(n){case I.X:this.x=i;break;case I.Y:this.y=i;break;case I.Z:this.z=i;break;default:throw new P("Invalid ordinate index: "+n)}},I.prototype.equals2D=function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var i=arguments[0],s=arguments[1];return!!v.equalsWithTolerance(this.x,i.x,s)&&!!v.equalsWithTolerance(this.y,i.y,s)}},I.prototype.getOrdinate=function(n){switch(n){case I.X:return this.x;case I.Y:return this.y;case I.Z:return this.z}throw new P("Invalid ordinate index: "+n)},I.prototype.equals3D=function(n){return this.x===n.x&&this.y===n.y&&(this.z===n.z||S.isNaN(this.z))&&S.isNaN(n.z)},I.prototype.equals=function(n){return n instanceof I&&this.equals2D(n)},I.prototype.equalInZ=function(n,i){return v.equalsWithTolerance(this.z,n.z,i)},I.prototype.compareTo=function(n){var i=n;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0},I.prototype.clone=function(){},I.prototype.copy=function(){return new I(this)},I.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},I.prototype.distance3D=function(n){var i=this.x-n.x,s=this.y-n.y,u=this.z-n.z;return Math.sqrt(i*i+s*s+u*u)},I.prototype.distance=function(n){var i=this.x-n.x,s=this.y-n.y;return Math.sqrt(i*i+s*s)},I.prototype.hashCode=function(){var n=17;return n=37*n+I.hashCode(this.x),n=37*n+I.hashCode(this.y)},I.prototype.setCoordinate=function(n){this.x=n.x,this.y=n.y,this.z=n.z},I.prototype.interfaces_=function(){return[N,G,t]},I.prototype.getClass=function(){return I},I.hashCode=function(){if(arguments.length===1){var n=arguments[0],i=S.doubleToLongBits(n);return Math.trunc((i^i)>>>32)}},O.DimensionalComparator.get=function(){return q},O.serialVersionUID.get=function(){return 6683108902428367e3},O.NULL_ORDINATE.get=function(){return S.NaN},O.X.get=function(){return 0},O.Y.get=function(){return 1},O.Z.get=function(){return 2},Object.defineProperties(I,O);var q=function(n){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var i=arguments[0];if(i!==2&&i!==3)throw new P("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};q.prototype.compare=function(n,i){var s=n,u=i,c=q.compare(s.x,u.x);if(c!==0)return c;var m=q.compare(s.y,u.y);return m!==0?m:this._dimensionsToTest<=2?0:q.compare(s.z,u.z)},q.prototype.interfaces_=function(){return[B]},q.prototype.getClass=function(){return q},q.compare=function(n,i){return n<i?-1:n>i?1:S.isNaN(n)?S.isNaN(i)?0:-1:S.isNaN(i)?1:0};var st=function(){};st.prototype.create=function(){},st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st};var V=function(){},Mt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};V.prototype.interfaces_=function(){return[]},V.prototype.getClass=function(){return V},V.toLocationSymbol=function(n){switch(n){case V.EXTERIOR:return"e";case V.BOUNDARY:return"b";case V.INTERIOR:return"i";case V.NONE:return"-"}throw new P("Unknown location value: "+n)},Mt.INTERIOR.get=function(){return 0},Mt.BOUNDARY.get=function(){return 1},Mt.EXTERIOR.get=function(){return 2},Mt.NONE.get=function(){return-1},Object.defineProperties(V,Mt);var $=function(n,i){return n.interfaces_&&n.interfaces_().indexOf(i)>-1},ut=function(){},xt={LOG_10:{configurable:!0}};ut.prototype.interfaces_=function(){return[]},ut.prototype.getClass=function(){return ut},ut.log10=function(n){var i=Math.log(n);return S.isInfinite(i)||S.isNaN(i)?i:i/ut.LOG_10},ut.min=function(n,i,s,u){var c=n;return i<c&&(c=i),s<c&&(c=s),u<c&&(c=u),c},ut.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1],s=arguments[2];return n<i?i:n>s?s:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var u=arguments[0],c=arguments[1],m=arguments[2];return u<c?c:u>m?m:u}},ut.wrap=function(n,i){return n<0?i- -n%i:n%i},ut.max=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2],u=n;return i>u&&(u=i),s>u&&(u=s),u}if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3],U=c;return m>U&&(U=m),E>U&&(U=E),A>U&&(U=A),U}},ut.average=function(n,i){return(n+i)/2},xt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(ut,xt);var mt=function(n){this.str=n};mt.prototype.append=function(n){this.str+=n},mt.prototype.setCharAt=function(n,i){this.str=this.str.substr(0,n)+i+this.str.substr(n+1)},mt.prototype.toString=function(n){return this.str};var lt=function(n){this.value=n};lt.prototype.intValue=function(){return this.value},lt.prototype.compareTo=function(n){return this.value<n?-1:this.value>n?1:0},lt.isNaN=function(n){return Number.isNaN(n)};var ht=function(){};ht.isWhitespace=function(n){return n<=32&&n>=0||n===127},ht.toUpperCase=function(n){return n.toUpperCase()};var k=function n(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var i=arguments[0];this.init(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}else if(typeof arguments[0]=="string"){var u=arguments[0];n.call(this,n.parse(u))}}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.init(c,m)}},nt={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};k.prototype.le=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<=n._lo},k.prototype.extractSignificantDigits=function(n,i){var s=this.abs(),u=k.magnitude(s._hi),c=k.TEN.pow(u);(s=s.divide(c)).gt(k.TEN)?(s=s.divide(k.TEN),u+=1):s.lt(k.ONE)&&(s=s.multiply(k.TEN),u-=1);for(var m=u+1,E=new mt,A=k.MAX_PRINT_DIGITS-1,U=0;U<=A;U++){n&&U===m&&E.append(".");var K=Math.trunc(s._hi);if(K<0)break;var pt=!1,dt=0;K>9?(pt=!0,dt="9"):dt="0"+K,E.append(dt),s=s.subtract(k.valueOf(K)).multiply(k.TEN),pt&&s.selfAdd(k.TEN);var Rt=!0,Ot=k.magnitude(s._hi);if(Ot<0&&Math.abs(Ot)>=A-U&&(Rt=!1),!Rt)break}return i[0]=u,E.toString()},k.prototype.sqr=function(){return this.multiply(this)},k.prototype.doubleValue=function(){return this._hi+this._lo},k.prototype.subtract=function(){if(arguments[0]instanceof k){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},k.prototype.equals=function(){if(arguments.length===1){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}},k.prototype.isZero=function(){return this._hi===0&&this._lo===0},k.prototype.selfSubtract=function(){if(arguments[0]instanceof k){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n._hi,-n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}},k.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},k.prototype.min=function(n){return this.le(n)?this:n},k.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof k){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,A=null,U=null,K=null,pt=null,dt=null;return U=this._hi/s,K=k.SPLIT*U,c=K-U,dt=k.SPLIT*s,c=K-c,m=U-c,E=dt-s,pt=U*s,E=dt-E,A=s-E,dt=c*E-pt+c*A+m*E+m*A,K=(this._hi-pt-dt+this._lo-U*u)/s,dt=U+K,this._hi=dt,this._lo=U-dt+K,this}},k.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},k.prototype.divide=function(){if(arguments[0]instanceof k){var n=arguments[0],i=null,s=null,u=null,c=null,m=null,E=null,A=null,U=null;return s=(m=this._hi/n._hi)-(i=(E=k.SPLIT*m)-(i=E-m)),U=i*(u=(U=k.SPLIT*n._hi)-(u=U-n._hi))-(A=m*n._hi)+i*(c=n._hi-u)+s*u+s*c,E=(this._hi-A-U+this._lo-m*n._lo)/n._hi,new k(U=m+E,m-U+E)}if(typeof arguments[0]=="number"){var K=arguments[0];return S.isNaN(K)?k.createNaN():k.copy(this).selfDivide(K,0)}},k.prototype.ge=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>=n._lo},k.prototype.pow=function(n){if(n===0)return k.valueOf(1);var i=new k(this),s=k.valueOf(1),u=Math.abs(n);if(u>1)for(;u>0;)u%2==1&&s.selfMultiply(i),(u/=2)>0&&(i=i.sqr());else s=i;return n<0?s.reciprocal():s},k.prototype.ceil=function(){if(this.isNaN())return k.NaN;var n=Math.ceil(this._hi),i=0;return n===this._hi&&(i=Math.ceil(this._lo)),new k(n,i)},k.prototype.compareTo=function(n){var i=n;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0},k.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},k.prototype.setValue=function(){if(arguments[0]instanceof k){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},k.prototype.max=function(n){return this.ge(n)?this:n},k.prototype.sqrt=function(){if(this.isZero())return k.valueOf(0);if(this.isNegative())return k.NaN;var n=1/Math.sqrt(this._hi),i=this._hi*n,s=k.valueOf(i),u=this.subtract(s.sqr())._hi*(.5*n);return s.add(u)},k.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof k){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],s=null,u=null,c=null,m=null,E=null,A=null;return c=this._hi+i,E=c-this._hi,m=c-E,m=i-E+(this._hi-m),A=m+this._lo,s=c+A,u=A+(c-s),this._hi=s+u,this._lo=u+(s-this._hi),this}}else if(arguments.length===2){var U=arguments[0],K=arguments[1],pt=null,dt=null,Rt=null,Ot=null,Vt=null,jt=null,sn=null;Ot=this._hi+U,dt=this._lo+K,Vt=Ot-(jt=Ot-this._hi),Rt=dt-(sn=dt-this._lo);var kn=(pt=Ot+(jt=(Vt=U-jt+(this._hi-Vt))+dt))+(jt=(Rt=K-sn+(this._lo-Rt))+(jt+(Ot-pt))),Mr=jt+(pt-kn);return this._hi=kn,this._lo=Mr,this}},k.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof k){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,A=null,U=null,K=null;c=(U=k.SPLIT*this._hi)-this._hi,K=k.SPLIT*s,c=U-c,m=this._hi-c,E=K-s;var pt=(U=this._hi*s)+(K=c*(E=K-E)-U+c*(A=s-E)+m*E+m*A+(this._hi*u+this._lo*s)),dt=K+(c=U-pt);return this._hi=pt,this._lo=dt,this}},k.prototype.selfSqr=function(){return this.selfMultiply(this)},k.prototype.floor=function(){if(this.isNaN())return k.NaN;var n=Math.floor(this._hi),i=0;return n===this._hi&&(i=Math.floor(this._lo)),new k(n,i)},k.prototype.negate=function(){return this.isNaN()?this:new k(-this._hi,-this._lo)},k.prototype.clone=function(){},k.prototype.multiply=function(){if(arguments[0]instanceof k){var n=arguments[0];return n.isNaN()?k.createNaN():k.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return S.isNaN(i)?k.createNaN():k.copy(this).selfMultiply(i,0)}},k.prototype.isNaN=function(){return S.isNaN(this._hi)},k.prototype.intValue=function(){return Math.trunc(this._hi)},k.prototype.toString=function(){var n=k.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()},k.prototype.toStandardNotation=function(){var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!0,i),u=i[0]+1,c=s;if(s.charAt(0)===".")c="0"+s;else if(u<0)c="0."+k.stringOfChar("0",-u)+s;else if(s.indexOf(".")===-1){var m=u-s.length;c=s+k.stringOfChar("0",m)+".0"}return this.isNegative()?"-"+c:c},k.prototype.reciprocal=function(){var n=null,i=null,s=null,u=null,c=null,m=null,E=null,A=null;i=(c=1/this._hi)-(n=(m=k.SPLIT*c)-(n=m-c)),s=(A=k.SPLIT*this._hi)-this._hi;var U=c+(m=(1-(E=c*this._hi)-(A=n*(s=A-s)-E+n*(u=this._hi-s)+i*s+i*u)-c*this._lo)/this._hi);return new k(U,c-U+m)},k.prototype.toSciNotation=function(){if(this.isZero())return k.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!1,i),u=k.SCI_NOT_EXPONENT_CHAR+i[0];if(s.charAt(0)==="0")throw new Error("Found leading zero: "+s);var c="";s.length>1&&(c=s.substring(1));var m=s.charAt(0)+"."+c;return this.isNegative()?"-"+m+u:m+u},k.prototype.abs=function(){return this.isNaN()?k.NaN:this.isNegative()?this.negate():new k(this)},k.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},k.prototype.lt=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<n._lo},k.prototype.add=function(){if(arguments[0]instanceof k){var n=arguments[0];return k.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return k.copy(this).selfAdd(i)}},k.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this._hi=n,this._lo=0}else if(arguments[0]instanceof k){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._hi=s,this._lo=u}},k.prototype.gt=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>n._lo},k.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},k.prototype.trunc=function(){return this.isNaN()?k.NaN:this.isPositive()?this.floor():this.ceil()},k.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},k.prototype.interfaces_=function(){return[t,N,G]},k.prototype.getClass=function(){return k},k.sqr=function(n){return k.valueOf(n).selfMultiply(n)},k.valueOf=function(){if(typeof arguments[0]=="string"){var n=arguments[0];return k.parse(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return new k(i)}},k.sqrt=function(n){return k.valueOf(n).sqrt()},k.parse=function(n){for(var i=0,s=n.length;ht.isWhitespace(n.charAt(i));)i++;var u=!1;if(i<s){var c=n.charAt(i);c!=="-"&&c!=="+"||(i++,c==="-"&&(u=!0))}for(var m=new k,E=0,A=0,U=0;!(i>=s);){var K=n.charAt(i);if(i++,ht.isDigit(K)){var pt=K-"0";m.selfMultiply(k.TEN),m.selfAdd(pt),E++}else{if(K!=="."){if(K==="e"||K==="E"){var dt=n.substring(i);try{U=lt.parseInt(dt)}catch(sn){throw sn instanceof Error?new Error("Invalid exponent "+dt+" in string "+n):sn}break}throw new Error("Unexpected character \'"+K+"\' at position "+i+" in string "+n)}A=E}}var Rt=m,Ot=E-A-U;if(Ot===0)Rt=m;else if(Ot>0){var Vt=k.TEN.pow(Ot);Rt=m.divide(Vt)}else if(Ot<0){var jt=k.TEN.pow(-Ot);Rt=m.multiply(jt)}return u?Rt.negate():Rt},k.createNaN=function(){return new k(S.NaN,S.NaN)},k.copy=function(n){return new k(n)},k.magnitude=function(n){var i=Math.abs(n),s=Math.log(i)/Math.log(10),u=Math.trunc(Math.floor(s));return 10*Math.pow(10,u)<=i&&(u+=1),u},k.stringOfChar=function(n,i){for(var s=new mt,u=0;u<i;u++)s.append(n);return s.toString()},nt.PI.get=function(){return new k(3.141592653589793,12246467991473532e-32)},nt.TWO_PI.get=function(){return new k(6.283185307179586,24492935982947064e-32)},nt.PI_2.get=function(){return new k(1.5707963267948966,6123233995736766e-32)},nt.E.get=function(){return new k(2.718281828459045,14456468917292502e-32)},nt.NaN.get=function(){return new k(S.NaN,S.NaN)},nt.EPS.get=function(){return 123259516440783e-46},nt.SPLIT.get=function(){return 134217729},nt.MAX_PRINT_DIGITS.get=function(){return 32},nt.TEN.get=function(){return k.valueOf(10)},nt.ONE.get=function(){return k.valueOf(1)},nt.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},nt.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(k,nt);var ft=function(){},Tt={DP_SAFE_EPSILON:{configurable:!0}};ft.prototype.interfaces_=function(){return[]},ft.prototype.getClass=function(){return ft},ft.orientationIndex=function(n,i,s){var u=ft.orientationIndexFilter(n,i,s);if(u<=1)return u;var c=k.valueOf(i.x).selfAdd(-n.x),m=k.valueOf(i.y).selfAdd(-n.y),E=k.valueOf(s.x).selfAdd(-i.x),A=k.valueOf(s.y).selfAdd(-i.y);return c.selfMultiply(A).selfSubtract(m.selfMultiply(E)).signum()},ft.signOfDet2x2=function(n,i,s,u){return n.multiply(u).selfSubtract(i.multiply(s)).signum()},ft.intersection=function(n,i,s,u){var c=k.valueOf(u.y).selfSubtract(s.y).selfMultiply(k.valueOf(i.x).selfSubtract(n.x)),m=k.valueOf(u.x).selfSubtract(s.x).selfMultiply(k.valueOf(i.y).selfSubtract(n.y)),E=c.subtract(m),A=k.valueOf(u.x).selfSubtract(s.x).selfMultiply(k.valueOf(n.y).selfSubtract(s.y)),U=k.valueOf(u.y).selfSubtract(s.y).selfMultiply(k.valueOf(n.x).selfSubtract(s.x)),K=A.subtract(U).selfDivide(E).doubleValue(),pt=k.valueOf(n.x).selfAdd(k.valueOf(i.x).selfSubtract(n.x).selfMultiply(K)).doubleValue(),dt=k.valueOf(i.x).selfSubtract(n.x).selfMultiply(k.valueOf(n.y).selfSubtract(s.y)),Rt=k.valueOf(i.y).selfSubtract(n.y).selfMultiply(k.valueOf(n.x).selfSubtract(s.x)),Ot=dt.subtract(Rt).selfDivide(E).doubleValue(),Vt=k.valueOf(s.y).selfAdd(k.valueOf(u.y).selfSubtract(s.y).selfMultiply(Ot)).doubleValue();return new I(pt,Vt)},ft.orientationIndexFilter=function(n,i,s){var u=null,c=(n.x-s.x)*(i.y-s.y),m=(n.y-s.y)*(i.x-s.x),E=c-m;if(c>0){if(m<=0)return ft.signum(E);u=c+m}else{if(!(c<0)||m>=0)return ft.signum(E);u=-c-m}var A=ft.DP_SAFE_EPSILON*u;return E>=A||-E>=A?ft.signum(E):2},ft.signum=function(n){return n>0?1:n<0?-1:0},Tt.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(ft,Tt);var gt=function(){},Lt={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Lt.X.get=function(){return 0},Lt.Y.get=function(){return 1},Lt.Z.get=function(){return 2},Lt.M.get=function(){return 3},gt.prototype.setOrdinate=function(n,i,s){},gt.prototype.size=function(){},gt.prototype.getOrdinate=function(n,i){},gt.prototype.getCoordinate=function(){},gt.prototype.getCoordinateCopy=function(n){},gt.prototype.getDimension=function(){},gt.prototype.getX=function(n){},gt.prototype.clone=function(){},gt.prototype.expandEnvelope=function(n){},gt.prototype.copy=function(){},gt.prototype.getY=function(n){},gt.prototype.toCoordinateArray=function(){},gt.prototype.interfaces_=function(){return[G]},gt.prototype.getClass=function(){return gt},Object.defineProperties(gt,Lt);var qt=function(){},Xt=function(n){function i(){n.call(this,"Projective point not representable on the Cartesian plane.")}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(qt),Ft=function(){};Ft.arraycopy=function(n,i,s,u,c){for(var m=0,E=i;E<i+c;E++)s[u+m]=n[E],m++},Ft.getProperty=function(n){return{"line.separator":`\n`}[n]};var Qt=function n(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1];this.x=s,this.y=u,this.w=1}else if(arguments[0]instanceof n&&arguments[1]instanceof n){var c=arguments[0],m=arguments[1];this.x=c.y*m.w-m.y*c.w,this.y=m.x*c.w-c.x*m.w,this.w=c.x*m.y-m.x*c.y}else if(arguments[0]instanceof I&&arguments[1]instanceof I){var E=arguments[0],A=arguments[1];this.x=E.y-A.y,this.y=A.x-E.x,this.w=E.x*A.y-A.x*E.y}}else if(arguments.length===3){var U=arguments[0],K=arguments[1],pt=arguments[2];this.x=U,this.y=K,this.w=pt}else if(arguments.length===4){var dt=arguments[0],Rt=arguments[1],Ot=arguments[2],Vt=arguments[3],jt=dt.y-Rt.y,sn=Rt.x-dt.x,kn=dt.x*Rt.y-Rt.x*dt.y,Mr=Ot.y-Vt.y,Ki=Vt.x-Ot.x,Uo=Ot.x*Vt.y-Vt.x*Ot.y;this.x=sn*Uo-Ki*kn,this.y=Mr*kn-jt*Uo,this.w=jt*Ki-Mr*sn}};Qt.prototype.getY=function(){var n=this.y/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new Xt;return n},Qt.prototype.getX=function(){var n=this.x/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new Xt;return n},Qt.prototype.getCoordinate=function(){var n=new I;return n.x=this.getX(),n.y=this.getY(),n},Qt.prototype.interfaces_=function(){return[]},Qt.prototype.getClass=function(){return Qt},Qt.intersection=function(n,i,s,u){var c=n.y-i.y,m=i.x-n.x,E=n.x*i.y-i.x*n.y,A=s.y-u.y,U=u.x-s.x,K=s.x*u.y-u.x*s.y,pt=c*U-A*m,dt=(m*K-U*E)/pt,Rt=(A*E-c*K)/pt;if(S.isNaN(dt)||S.isInfinite(dt)||S.isNaN(Rt)||S.isInfinite(Rt))throw new Xt;return new I(dt,Rt)};var Ct=function n(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof I){var i=arguments[0];this.init(i.x,i.x,i.y,i.y)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.init(u.x,c.x,u.y,c.y)}else if(arguments.length===4){var m=arguments[0],E=arguments[1],A=arguments[2],U=arguments[3];this.init(m,E,A,U)}},ee={serialVersionUID:{configurable:!0}};Ct.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Ct.prototype.equals=function(n){if(!(n instanceof Ct))return!1;var i=n;return this.isNull()?i.isNull():this._maxx===i.getMaxX()&&this._maxy===i.getMaxY()&&this._minx===i.getMinX()&&this._miny===i.getMinY()},Ct.prototype.intersection=function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new Ct;var i=this._minx>n._minx?this._minx:n._minx,s=this._miny>n._miny?this._miny:n._miny,u=this._maxx<n._maxx?this._maxx:n._maxx,c=this._maxy<n._maxy?this._maxy:n._maxy;return new Ct(i,u,s,c)},Ct.prototype.isNull=function(){return this._maxx<this._minx},Ct.prototype.getMaxX=function(){return this._maxx},Ct.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof Ct){var i=arguments[0];return!this.isNull()&&!i.isNull()&&i.getMinX()>=this._minx&&i.getMaxX()<=this._maxx&&i.getMinY()>=this._miny&&i.getMaxY()<=this._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&s>=this._minx&&s<=this._maxx&&u>=this._miny&&u<=this._maxy}},Ct.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Ct){var n=arguments[0];return!this.isNull()&&!n.isNull()&&!(n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny)}if(arguments[0]instanceof I){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&!(s>this._maxx||s<this._minx||u>this._maxy||u<this._miny)}},Ct.prototype.getMinY=function(){return this._miny},Ct.prototype.getMinX=function(){return this._minx},Ct.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof Ct){var i=arguments[0];if(i.isNull())return null;this.isNull()?(this._minx=i.getMinX(),this._maxx=i.getMaxX(),this._miny=i.getMinY(),this._maxy=i.getMaxY()):(i._minx<this._minx&&(this._minx=i._minx),i._maxx>this._maxx&&(this._maxx=i._maxx),i._miny<this._miny&&(this._miny=i._miny),i._maxy>this._maxy&&(this._maxy=i._maxy))}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.isNull()?(this._minx=s,this._maxx=s,this._miny=u,this._maxy=u):(s<this._minx&&(this._minx=s),s>this._maxx&&(this._maxx=s),u<this._miny&&(this._miny=u),u>this._maxy&&(this._maxy=u))}},Ct.prototype.minExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n<i?n:i},Ct.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Ct.prototype.compareTo=function(n){var i=n;return this.isNull()?i.isNull()?0:-1:i.isNull()?1:this._minx<i._minx?-1:this._minx>i._minx?1:this._miny<i._miny?-1:this._miny>i._miny?1:this._maxx<i._maxx?-1:this._maxx>i._maxx?1:this._maxy<i._maxy?-1:this._maxy>i._maxy?1:0},Ct.prototype.translate=function(n,i){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+i,this.getMaxY()+i)},Ct.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Ct.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Ct.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Ct.prototype.maxExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n>i?n:i},Ct.prototype.expandBy=function(){if(arguments.length===1){var n=arguments[0];this.expandBy(n,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this.isNull())return null;this._minx-=i,this._maxx+=i,this._miny-=s,this._maxy+=s,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},Ct.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Ct){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof I){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.covers(s,u)}},Ct.prototype.centre=function(){return this.isNull()?null:new I((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Ct.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof Ct){var i=arguments[0];this._minx=i._minx,this._maxx=i._maxx,this._miny=i._miny,this._maxy=i._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.init(s.x,u.x,s.y,u.y)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];c<m?(this._minx=c,this._maxx=m):(this._minx=m,this._maxx=c),E<A?(this._miny=E,this._maxy=A):(this._miny=A,this._maxy=E)}},Ct.prototype.getMaxY=function(){return this._maxy},Ct.prototype.distance=function(n){if(this.intersects(n))return 0;var i=0;this._maxx<n._minx?i=n._minx-this._maxx:this._minx>n._maxx&&(i=this._minx-n._maxx);var s=0;return this._maxy<n._miny?s=n._miny-this._maxy:this._miny>n._maxy&&(s=this._miny-n._maxy),i===0?s:s===0?i:Math.sqrt(i*i+s*s)},Ct.prototype.hashCode=function(){var n=17;return n=37*n+I.hashCode(this._minx),n=37*n+I.hashCode(this._maxx),n=37*n+I.hashCode(this._miny),n=37*n+I.hashCode(this._maxy)},Ct.prototype.interfaces_=function(){return[N,t]},Ct.prototype.getClass=function(){return Ct},Ct.intersects=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];return s.x>=(n.x<i.x?n.x:i.x)&&s.x<=(n.x>i.x?n.x:i.x)&&s.y>=(n.y<i.y?n.y:i.y)&&s.y<=(n.y>i.y?n.y:i.y)}if(arguments.length===4){var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],A=Math.min(m.x,E.x),U=Math.max(m.x,E.x),K=Math.min(u.x,c.x),pt=Math.max(u.x,c.x);return!(K>U)&&!(pt<A)&&(A=Math.min(m.y,E.y),U=Math.max(m.y,E.y),K=Math.min(u.y,c.y),pt=Math.max(u.y,c.y),!(K>U)&&!(pt<A))}},ee.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Ct,ee);var it={typeStr:/^\\s*(\\w+)\\s*\\(\\s*(.*)\\s*\\)\\s*$/,emptyTypeStr:/^\\s*(\\w+)\\s*EMPTY\\s*$/,spaces:/\\s+/,parenComma:/\\)\\s*,\\s*\\(/,doubleParenComma:/\\)\\s*\\)\\s*,\\s*\\(\\s*\\(/,trimParens:/^\\s*\\(?(.*?)\\)?\\s*$/},rn=function(n){this.geometryFactory=n||new ue};rn.prototype.read=function(n){var i,s,u;n=n.replace(/[\\n\\r]/g," ");var c=it.typeStr.exec(n);if(n.search("EMPTY")!==-1&&((c=it.emptyTypeStr.exec(n))[2]=void 0),c&&(s=c[1].toLowerCase(),u=c[2],Jt[s]&&(i=Jt[s].apply(this,[u]))),i===void 0)throw new Error("Could not parse WKT "+n);return i},rn.prototype.write=function(n){return this.extractGeometry(n)},rn.prototype.extractGeometry=function(n){var i=n.getGeometryType().toLowerCase();if(!Bt[i])return null;var s=i.toUpperCase();return n.isEmpty()?s+" EMPTY":s+"("+Bt[i].apply(this,[n])+")"};var Bt={coordinate:function(n){return n.x+" "+n.y},point:function(n){return Bt.coordinate.call(this,n._coordinates._coordinates[0])},multipoint:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Bt.point.apply(this,[n._geometries[s]])+")");return i.join(",")},linestring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(Bt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},linearring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(Bt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},multilinestring:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Bt.linestring.apply(this,[n._geometries[s]])+")");return i.join(",")},polygon:function(n){var i=[];i.push("("+Bt.linestring.apply(this,[n._shell])+")");for(var s=0,u=n._holes.length;s<u;++s)i.push("("+Bt.linestring.apply(this,[n._holes[s]])+")");return i.join(",")},multipolygon:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Bt.polygon.apply(this,[n._geometries[s]])+")");return i.join(",")},geometrycollection:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push(this.extractGeometry(n._geometries[s]));return i.join(",")}},Jt={point:function(n){if(n===void 0)return this.geometryFactory.createPoint();var i=n.trim().split(it.spaces);return this.geometryFactory.createPoint(new I(Number.parseFloat(i[0]),Number.parseFloat(i[1])))},multipoint:function(n){if(n===void 0)return this.geometryFactory.createMultiPoint();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(it.trimParens,"$1"),u.push(Jt.point.apply(this,[i]));return this.geometryFactory.createMultiPoint(u)},linestring:function(n){if(n===void 0)return this.geometryFactory.createLineString();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(it.spaces),u.push(new I(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(u)},linearring:function(n){if(n===void 0)return this.geometryFactory.createLinearRing();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(it.spaces),u.push(new I(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(u)},multilinestring:function(n){if(n===void 0)return this.geometryFactory.createMultiLineString();for(var i,s=n.trim().split(it.parenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(it.trimParens,"$1"),u.push(Jt.linestring.apply(this,[i]));return this.geometryFactory.createMultiLineString(u)},polygon:function(n){if(n===void 0)return this.geometryFactory.createPolygon();for(var i,s,u,c,m=n.trim().split(it.parenComma),E=[],A=0,U=m.length;A<U;++A)i=m[A].replace(it.trimParens,"$1"),s=Jt.linestring.apply(this,[i]),u=this.geometryFactory.createLinearRing(s._points),A===0?c=u:E.push(u);return this.geometryFactory.createPolygon(c,E)},multipolygon:function(n){if(n===void 0)return this.geometryFactory.createMultiPolygon();for(var i,s=n.trim().split(it.doubleParenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(it.trimParens,"$1"),u.push(Jt.polygon.apply(this,[i]));return this.geometryFactory.createMultiPolygon(u)},geometrycollection:function(n){if(n===void 0)return this.geometryFactory.createGeometryCollection();for(var i=(n=n.replace(/,\\s*([A-Za-z])/g,"|$1")).trim().split("|"),s=[],u=0,c=i.length;u<c;++u)s.push(this.read(i[u]));return this.geometryFactory.createGeometryCollection(s)}},Yt=function(n){this.parser=new rn(n)};Yt.prototype.write=function(n){return this.parser.write(n)},Yt.toLineString=function(n,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+n.x+" "+n.y+", "+i.x+" "+i.y+" )"};var pe=function(n){function i(s){n.call(this,s),this.name="RuntimeException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),le=function(n){function i(){if(n.call(this),arguments.length===0)n.call(this);else if(arguments.length===1){var s=arguments[0];n.call(this,s)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(pe),Pt=function(){};Pt.prototype.interfaces_=function(){return[]},Pt.prototype.getClass=function(){return Pt},Pt.shouldNeverReachHere=function(){if(arguments.length===0)Pt.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new le("Should never reach here"+(n!==null?": "+n:""))}},Pt.isTrue=function(){var n,i;if(arguments.length===1)n=arguments[0],Pt.isTrue(n,null);else if(arguments.length===2&&(n=arguments[0],i=arguments[1],!n))throw i===null?new le:new le(i)},Pt.equals=function(){var n,i,s;if(arguments.length===2)n=arguments[0],i=arguments[1],Pt.equals(n,i,null);else if(arguments.length===3&&(n=arguments[0],i=arguments[1],s=arguments[2],!i.equals(n)))throw new le("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))};var te=function(){this._result=null,this._inputLines=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new I,this._intPt[1]=new I,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},yn={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};te.prototype.getIndexAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intLineIndex[n][i]},te.prototype.getTopologySummary=function(){var n=new mt;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()},te.prototype.computeIntersection=function(n,i,s,u){this._inputLines[0][0]=n,this._inputLines[0][1]=i,this._inputLines[1][0]=s,this._inputLines[1][1]=u,this._result=this.computeIntersect(n,i,s,u)},te.prototype.getIntersectionNum=function(){return this._result},te.prototype.computeIntLineIndex=function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var n=arguments[0];this.getEdgeDistance(n,0)>this.getEdgeDistance(n,1)?(this._intLineIndex[n][0]=0,this._intLineIndex[n][1]=1):(this._intLineIndex[n][0]=1,this._intLineIndex[n][1]=0)}},te.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},te.prototype.setPrecisionModel=function(n){this._precisionModel=n},te.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var n=arguments[0],i=0;i<this._result;i++)if(!this._intPt[i].equals2D(this._inputLines[n][0])&&!this._intPt[i].equals2D(this._inputLines[n][1]))return!0;return!1}},te.prototype.getIntersection=function(n){return this._intPt[n]},te.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},te.prototype.hasIntersection=function(){return this._result!==te.NO_INTERSECTION},te.prototype.getEdgeDistance=function(n,i){return te.computeEdgeDistance(this._intPt[i],this._inputLines[n][0],this._inputLines[n][1])},te.prototype.isCollinear=function(){return this._result===te.COLLINEAR_INTERSECTION},te.prototype.toString=function(){return Yt.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Yt.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},te.prototype.getEndpoint=function(n,i){return this._inputLines[n][i]},te.prototype.isIntersection=function(n){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(n))return!0;return!1},te.prototype.getIntersectionAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][i]]},te.prototype.interfaces_=function(){return[]},te.prototype.getClass=function(){return te},te.computeEdgeDistance=function(n,i,s){var u=Math.abs(s.x-i.x),c=Math.abs(s.y-i.y),m=-1;if(n.equals(i))m=0;else if(n.equals(s))m=u>c?u:c;else{var E=Math.abs(n.x-i.x),A=Math.abs(n.y-i.y);(m=u>c?E:A)!==0||n.equals(i)||(m=Math.max(E,A))}return Pt.isTrue(!(m===0&&!n.equals(i)),"Bad distance calculation"),m},te.nonRobustComputeEdgeDistance=function(n,i,s){var u=n.x-i.x,c=n.y-i.y,m=Math.sqrt(u*u+c*c);return Pt.isTrue(!(m===0&&!n.equals(i)),"Invalid distance calculation"),m},yn.DONT_INTERSECT.get=function(){return 0},yn.DO_INTERSECT.get=function(){return 1},yn.COLLINEAR.get=function(){return 2},yn.NO_INTERSECTION.get=function(){return 0},yn.POINT_INTERSECTION.get=function(){return 1},yn.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(te,yn);var pn=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isInSegmentEnvelopes=function(s){var u=new Ct(this._inputLines[0][0],this._inputLines[0][1]),c=new Ct(this._inputLines[1][0],this._inputLines[1][1]);return u.contains(s)&&c.contains(s)},i.prototype.computeIntersection=function(){if(arguments.length!==3)return n.prototype.computeIntersection.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2];if(this._isProper=!1,Ct.intersects(u,c,s)&&J.orientationIndex(u,c,s)===0&&J.orientationIndex(c,u,s)===0)return this._isProper=!0,(s.equals(u)||s.equals(c))&&(this._isProper=!1),this._result=n.POINT_INTERSECTION,null;this._result=n.NO_INTERSECTION},i.prototype.normalizeToMinimum=function(s,u,c,m,E){E.x=this.smallestInAbsValue(s.x,u.x,c.x,m.x),E.y=this.smallestInAbsValue(s.y,u.y,c.y,m.y),s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.safeHCoordinateIntersection=function(s,u,c,m){var E=null;try{E=Qt.intersection(s,u,c,m)}catch(A){if(!(A instanceof Xt))throw A;E=i.nearestEndpoint(s,u,c,m)}return E},i.prototype.intersection=function(s,u,c,m){var E=this.intersectionWithNormalization(s,u,c,m);return this.isInSegmentEnvelopes(E)||(E=new I(i.nearestEndpoint(s,u,c,m))),this._precisionModel!==null&&this._precisionModel.makePrecise(E),E},i.prototype.smallestInAbsValue=function(s,u,c,m){var E=s,A=Math.abs(E);return Math.abs(u)<A&&(E=u,A=Math.abs(u)),Math.abs(c)<A&&(E=c,A=Math.abs(c)),Math.abs(m)<A&&(E=m),E},i.prototype.checkDD=function(s,u,c,m,E){var A=ft.intersection(s,u,c,m),U=this.isInSegmentEnvelopes(A);Ft.out.println("DD in env = "+U+" --------------------- "+A),E.distance(A)>1e-4&&Ft.out.println("Distance = "+E.distance(A))},i.prototype.intersectionWithNormalization=function(s,u,c,m){var E=new I(s),A=new I(u),U=new I(c),K=new I(m),pt=new I;this.normalizeToEnvCentre(E,A,U,K,pt);var dt=this.safeHCoordinateIntersection(E,A,U,K);return dt.x+=pt.x,dt.y+=pt.y,dt},i.prototype.computeCollinearIntersection=function(s,u,c,m){var E=Ct.intersects(s,u,c),A=Ct.intersects(s,u,m),U=Ct.intersects(c,m,s),K=Ct.intersects(c,m,u);return E&&A?(this._intPt[0]=c,this._intPt[1]=m,n.COLLINEAR_INTERSECTION):U&&K?(this._intPt[0]=s,this._intPt[1]=u,n.COLLINEAR_INTERSECTION):E&&U?(this._intPt[0]=c,this._intPt[1]=s,!c.equals(s)||A||K?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):E&&K?(this._intPt[0]=c,this._intPt[1]=u,!c.equals(u)||A||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):A&&U?(this._intPt[0]=m,this._intPt[1]=s,!m.equals(s)||E||K?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):A&&K?(this._intPt[0]=m,this._intPt[1]=u,!m.equals(u)||E||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):n.NO_INTERSECTION},i.prototype.normalizeToEnvCentre=function(s,u,c,m,E){var A=s.x<u.x?s.x:u.x,U=s.y<u.y?s.y:u.y,K=s.x>u.x?s.x:u.x,pt=s.y>u.y?s.y:u.y,dt=c.x<m.x?c.x:m.x,Rt=c.y<m.y?c.y:m.y,Ot=c.x>m.x?c.x:m.x,Vt=c.y>m.y?c.y:m.y,jt=((A>dt?A:dt)+(K<Ot?K:Ot))/2,sn=((U>Rt?U:Rt)+(pt<Vt?pt:Vt))/2;E.x=jt,E.y=sn,s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.computeIntersect=function(s,u,c,m){if(this._isProper=!1,!Ct.intersects(s,u,c,m))return n.NO_INTERSECTION;var E=J.orientationIndex(s,u,c),A=J.orientationIndex(s,u,m);if(E>0&&A>0||E<0&&A<0)return n.NO_INTERSECTION;var U=J.orientationIndex(c,m,s),K=J.orientationIndex(c,m,u);return U>0&&K>0||U<0&&K<0?n.NO_INTERSECTION:E===0&&A===0&&U===0&&K===0?this.computeCollinearIntersection(s,u,c,m):(E===0||A===0||U===0||K===0?(this._isProper=!1,s.equals2D(c)||s.equals2D(m)?this._intPt[0]=s:u.equals2D(c)||u.equals2D(m)?this._intPt[0]=u:E===0?this._intPt[0]=new I(c):A===0?this._intPt[0]=new I(m):U===0?this._intPt[0]=new I(s):K===0&&(this._intPt[0]=new I(u))):(this._isProper=!0,this._intPt[0]=this.intersection(s,u,c,m)),n.POINT_INTERSECTION)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.nearestEndpoint=function(s,u,c,m){var E=s,A=J.distancePointLine(s,c,m),U=J.distancePointLine(u,c,m);return U<A&&(A=U,E=u),(U=J.distancePointLine(c,s,u))<A&&(A=U,E=c),(U=J.distancePointLine(m,s,u))<A&&(A=U,E=m),E},i}(te),X=function(){};X.prototype.interfaces_=function(){return[]},X.prototype.getClass=function(){return X},X.orientationIndex=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=s.x-i.x,E=s.y-i.y;return X.signOfDet2x2(u,c,m,E)},X.signOfDet2x2=function(n,i,s,u){var c=null,m=null,E=null;if(c=1,n===0||u===0)return i===0||s===0?0:i>0?s>0?-c:c:s>0?c:-c;if(i===0||s===0)return u>0?n>0?c:-c:n>0?-c:c;if(i>0?u>0?i<=u||(c=-c,m=n,n=s,s=m,m=i,i=u,u=m):i<=-u?(c=-c,s=-s,u=-u):(m=n,n=-s,s=m,m=i,i=-u,u=m):u>0?-i<=u?(c=-c,n=-n,i=-i):(m=-n,n=s,s=m,m=-i,i=u,u=m):i>=u?(n=-n,i=-i,s=-s,u=-u):(c=-c,m=-n,n=-s,s=m,m=-i,i=-u,u=m),n>0){if(!(s>0)||!(n<=s))return c}else{if(s>0||!(n>=s))return-c;c=-c,n=-n,s=-s}for(;;){if(E=Math.floor(s/n),s-=E*n,(u-=E*i)<0)return-c;if(u>i)return c;if(n>s+s){if(i<u+u)return c}else{if(i>u+u)return-c;s=n-s,u=i-u,c=-c}if(u===0)return s===0?0:-c;if(s===0||(E=Math.floor(n/s),n-=E*s,(i-=E*u)<0))return c;if(i>u)return-c;if(s>n+n){if(u<i+i)return-c}else{if(u>i+i)return c;n=s-n,i=u-i,c=-c}if(i===0)return n===0?0:c;if(n===0)return-c}};var F=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n};F.prototype.countSegment=function(n,i){if(n.x<this._p.x&&i.x<this._p.x)return null;if(this._p.x===i.x&&this._p.y===i.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&i.y===this._p.y){var s=n.x,u=i.x;return s>u&&(s=i.x,u=n.x),this._p.x>=s&&this._p.x<=u&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&i.y<=this._p.y||i.y>this._p.y&&n.y<=this._p.y){var c=n.x-this._p.x,m=n.y-this._p.y,E=i.x-this._p.x,A=i.y-this._p.y,U=X.signOfDet2x2(c,m,E,A);if(U===0)return this._isPointOnSegment=!0,null;A<m&&(U=-U),U>0&&this._crossingCount++}},F.prototype.isPointInPolygon=function(){return this.getLocation()!==V.EXTERIOR},F.prototype.getLocation=function(){return this._isPointOnSegment?V.BOUNDARY:this._crossingCount%2==1?V.INTERIOR:V.EXTERIOR},F.prototype.isOnSegment=function(){return this._isPointOnSegment},F.prototype.interfaces_=function(){return[]},F.prototype.getClass=function(){return F},F.locatePointInRing=function(){if(arguments[0]instanceof I&&$(arguments[1],gt)){for(var n=arguments[0],i=arguments[1],s=new F(n),u=new I,c=new I,m=1;m<i.size();m++)if(i.getCoordinate(m,u),i.getCoordinate(m-1,c),s.countSegment(u,c),s.isOnSegment())return s.getLocation();return s.getLocation()}if(arguments[0]instanceof I&&arguments[1]instanceof Array){for(var E=arguments[0],A=arguments[1],U=new F(E),K=1;K<A.length;K++){var pt=A[K],dt=A[K-1];if(U.countSegment(pt,dt),U.isOnSegment())return U.getLocation()}return U.getLocation()}};var J=function(){},It={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};J.prototype.interfaces_=function(){return[]},J.prototype.getClass=function(){return J},J.orientationIndex=function(n,i,s){return ft.orientationIndex(n,i,s)},J.signedArea=function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var i=0,s=n[0].x,u=1;u<n.length-1;u++){var c=n[u].x-s,m=n[u+1].y;i+=c*(n[u-1].y-m)}return i/2}if($(arguments[0],gt)){var E=arguments[0],A=E.size();if(A<3)return 0;var U=new I,K=new I,pt=new I;E.getCoordinate(0,K),E.getCoordinate(1,pt);var dt=K.x;pt.x-=dt;for(var Rt=0,Ot=1;Ot<A-1;Ot++)U.y=K.y,K.x=pt.x,K.y=pt.y,E.getCoordinate(Ot+1,pt),pt.x-=dt,Rt+=K.x*(U.y-pt.y);return Rt/2}},J.distanceLineLine=function(n,i,s,u){if(n.equals(i))return J.distancePointLine(n,s,u);if(s.equals(u))return J.distancePointLine(u,n,i);var c=!1;if(Ct.intersects(n,i,s,u)){var m=(i.x-n.x)*(u.y-s.y)-(i.y-n.y)*(u.x-s.x);if(m===0)c=!0;else{var E=(n.y-s.y)*(u.x-s.x)-(n.x-s.x)*(u.y-s.y),A=((n.y-s.y)*(i.x-n.x)-(n.x-s.x)*(i.y-n.y))/m,U=E/m;(U<0||U>1||A<0||A>1)&&(c=!0)}}else c=!0;return c?ut.min(J.distancePointLine(n,s,u),J.distancePointLine(i,s,u),J.distancePointLine(s,n,i),J.distancePointLine(u,n,i)):0},J.isPointInRing=function(n,i){return J.locatePointInRing(n,i)!==V.EXTERIOR},J.computeLength=function(n){var i=n.size();if(i<=1)return 0;var s=0,u=new I;n.getCoordinate(0,u);for(var c=u.x,m=u.y,E=1;E<i;E++){n.getCoordinate(E,u);var A=u.x,U=u.y,K=A-c,pt=U-m;s+=Math.sqrt(K*K+pt*pt),c=A,m=U}return s},J.isCCW=function(n){var i=n.length-1;if(i<3)throw new P("Ring has fewer than 4 points, so orientation cannot be determined");for(var s=n[0],u=0,c=1;c<=i;c++){var m=n[c];m.y>s.y&&(s=m,u=c)}var E=u;do(E-=1)<0&&(E=i);while(n[E].equals2D(s)&&E!==u);var A=u;do A=(A+1)%i;while(n[A].equals2D(s)&&A!==u);var U=n[E],K=n[A];if(U.equals2D(s)||K.equals2D(s)||U.equals2D(K))return!1;var pt=J.computeOrientation(U,s,K),dt=!1;return dt=pt===0?U.x>K.x:pt>0,dt},J.locatePointInRing=function(n,i){return F.locatePointInRing(n,i)},J.distancePointLinePerpendicular=function(n,i,s){var u=(s.x-i.x)*(s.x-i.x)+(s.y-i.y)*(s.y-i.y),c=((i.y-n.y)*(s.x-i.x)-(i.x-n.x)*(s.y-i.y))/u;return Math.abs(c)*Math.sqrt(u)},J.computeOrientation=function(n,i,s){return J.orientationIndex(n,i,s)},J.distancePointLine=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(i.length===0)throw new P("Line array must contain at least one vertex");for(var s=n.distance(i[0]),u=0;u<i.length-1;u++){var c=J.distancePointLine(n,i[u],i[u+1]);c<s&&(s=c)}return s}if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];if(E.x===A.x&&E.y===A.y)return m.distance(E);var U=(A.x-E.x)*(A.x-E.x)+(A.y-E.y)*(A.y-E.y),K=((m.x-E.x)*(A.x-E.x)+(m.y-E.y)*(A.y-E.y))/U;if(K<=0)return m.distance(E);if(K>=1)return m.distance(A);var pt=((E.y-m.y)*(A.x-E.x)-(E.x-m.x)*(A.y-E.y))/U;return Math.abs(pt)*Math.sqrt(U)}},J.isOnLine=function(n,i){for(var s=new pn,u=1;u<i.length;u++){var c=i[u-1],m=i[u];if(s.computeIntersection(n,c,m),s.hasIntersection())return!0}return!1},It.CLOCKWISE.get=function(){return-1},It.RIGHT.get=function(){return J.CLOCKWISE},It.COUNTERCLOCKWISE.get=function(){return 1},It.LEFT.get=function(){return J.COUNTERCLOCKWISE},It.COLLINEAR.get=function(){return 0},It.STRAIGHT.get=function(){return J.COLLINEAR},Object.defineProperties(J,It);var wt=function(){};wt.prototype.filter=function(n){},wt.prototype.interfaces_=function(){return[]},wt.prototype.getClass=function(){return wt};var yt=function(){var n=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=n,this._SRID=n.getSRID()},$t={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};yt.prototype.isGeometryCollection=function(){return this.getSortIndex()===yt.SORTINDEX_GEOMETRYCOLLECTION},yt.prototype.getFactory=function(){return this._factory},yt.prototype.getGeometryN=function(n){return this},yt.prototype.getArea=function(){return 0},yt.prototype.isRectangle=function(){return!1},yt.prototype.equals=function(){if(arguments[0]instanceof yt){var n=arguments[0];return n!==null&&this.equalsTopo(n)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof yt))return!1;var s=i;return this.equalsExact(s)}},yt.prototype.equalsExact=function(n){return this===n||this.equalsExact(n,0)},yt.prototype.geometryChanged=function(){this.apply(yt.geometryChangedFilter)},yt.prototype.geometryChangedAction=function(){this._envelope=null},yt.prototype.equalsNorm=function(n){return n!==null&&this.norm().equalsExact(n.norm())},yt.prototype.getLength=function(){return 0},yt.prototype.getNumGeometries=function(){return 1},yt.prototype.compareTo=function(){if(arguments.length===1){var n=arguments[0],i=n;return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(n)}if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.getSortIndex()!==s.getSortIndex()?this.getSortIndex()-s.getSortIndex():this.isEmpty()&&s.isEmpty()?0:this.isEmpty()?-1:s.isEmpty()?1:this.compareToSameClass(s,u)}},yt.prototype.getUserData=function(){return this._userData},yt.prototype.getSRID=function(){return this._SRID},yt.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},yt.prototype.checkNotGeometryCollection=function(n){if(n.getSortIndex()===yt.SORTINDEX_GEOMETRYCOLLECTION)throw new P("This method does not support GeometryCollection arguments")},yt.prototype.equal=function(n,i,s){return s===0?n.equals(i):n.distance(i)<=s},yt.prototype.norm=function(){var n=this.copy();return n.normalize(),n},yt.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},yt.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Ct(this._envelope)},yt.prototype.setSRID=function(n){this._SRID=n},yt.prototype.setUserData=function(n){this._userData=n},yt.prototype.compare=function(n,i){for(var s=n.iterator(),u=i.iterator();s.hasNext()&&u.hasNext();){var c=s.next(),m=u.next(),E=c.compareTo(m);if(E!==0)return E}return s.hasNext()?1:u.hasNext()?-1:0},yt.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},yt.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===yt.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===yt.SORTINDEX_MULTIPOINT||this.getSortIndex()===yt.SORTINDEX_MULTILINESTRING||this.getSortIndex()===yt.SORTINDEX_MULTIPOLYGON},yt.prototype.interfaces_=function(){return[G,N,t]},yt.prototype.getClass=function(){return yt},yt.hasNonEmptyElements=function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1},yt.hasNullElements=function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1},$t.serialVersionUID.get=function(){return 8763622679187377e3},$t.SORTINDEX_POINT.get=function(){return 0},$t.SORTINDEX_MULTIPOINT.get=function(){return 1},$t.SORTINDEX_LINESTRING.get=function(){return 2},$t.SORTINDEX_LINEARRING.get=function(){return 3},$t.SORTINDEX_MULTILINESTRING.get=function(){return 4},$t.SORTINDEX_POLYGON.get=function(){return 5},$t.SORTINDEX_MULTIPOLYGON.get=function(){return 6},$t.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},$t.geometryChangedFilter.get=function(){return Dt},Object.defineProperties(yt,$t);var Dt=function(){};Dt.interfaces_=function(){return[wt]},Dt.filter=function(n){n.geometryChangedAction()};var Y=function(){};Y.prototype.filter=function(n){},Y.prototype.interfaces_=function(){return[]},Y.prototype.getClass=function(){return Y};var w=function(){},C={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};w.prototype.isInBoundary=function(n){},w.prototype.interfaces_=function(){return[]},w.prototype.getClass=function(){return w},C.Mod2BoundaryNodeRule.get=function(){return R},C.EndPointBoundaryNodeRule.get=function(){return H},C.MultiValentEndPointBoundaryNodeRule.get=function(){return z},C.MonoValentEndPointBoundaryNodeRule.get=function(){return rt},C.MOD2_BOUNDARY_RULE.get=function(){return new R},C.ENDPOINT_BOUNDARY_RULE.get=function(){return new H},C.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new z},C.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new rt},C.OGC_SFS_BOUNDARY_RULE.get=function(){return w.MOD2_BOUNDARY_RULE},Object.defineProperties(w,C);var R=function(){};R.prototype.isInBoundary=function(n){return n%2==1},R.prototype.interfaces_=function(){return[w]},R.prototype.getClass=function(){return R};var H=function(){};H.prototype.isInBoundary=function(n){return n>0},H.prototype.interfaces_=function(){return[w]},H.prototype.getClass=function(){return H};var z=function(){};z.prototype.isInBoundary=function(n){return n>1},z.prototype.interfaces_=function(){return[w]},z.prototype.getClass=function(){return z};var rt=function(){};rt.prototype.isInBoundary=function(n){return n===1},rt.prototype.interfaces_=function(){return[w]},rt.prototype.getClass=function(){return rt};var j=function(){};j.prototype.add=function(){},j.prototype.addAll=function(){},j.prototype.isEmpty=function(){},j.prototype.iterator=function(){},j.prototype.size=function(){},j.prototype.toArray=function(){},j.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var D=function(){};D.prototype.hasNext=function(){},D.prototype.next=function(){},D.prototype.remove=function(){};var tt=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(){},i.prototype.set=function(){},i.prototype.isEmpty=function(){},i}(j);(o.prototype=new Error).name="NoSuchElementException";var Z=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof j&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.ensureCapacity=function(){},i.prototype.interfaces_=function(){return[n,j]},i.prototype.add=function(s){return arguments.length===1?this.array_.push(s):this.array_.splice(arguments[0],arguments[1]),!0},i.prototype.clear=function(){this.array_=[]},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.set=function(s,u){var c=this.array_[s];return this.array_[s]=u,c},i.prototype.iterator=function(){return new et(this)},i.prototype.get=function(s){if(s<0||s>=this.size())throw new e;return this.array_[s]},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.size=function(){return this.array_.length},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.remove=function(s){for(var u=!1,c=0,m=this.array_.length;c<m;c++)if(this.array_[c]===s){this.array_.splice(c,1),u=!0;break}return u},i}(tt),et=function(n){function i(s){n.call(this),this.arrayList_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new o;return this.arrayList_.get(this.position_++)},i.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},i.prototype.set=function(s){return this.arrayList_.set(this.position_-1,s)},i.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},i}(D),ot=function(n){function i(){if(n.call(this),arguments.length!==0){if(arguments.length===1){var u=arguments[0];this.ensureCapacity(u.length),this.add(u,!0)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.ensureCapacity(c.length),this.add(c,m)}}}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={coordArrayType:{configurable:!0}};return s.coordArrayType.get=function(){return new Array(0).fill(null)},i.prototype.getCoordinate=function(u){return this.get(u)},i.prototype.addAll=function(){if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m=!1,E=u.iterator();E.hasNext();)this.add(E.next(),c),m=!0;return m}return n.prototype.addAll.apply(this,arguments)},i.prototype.clone=function(){for(var u=n.prototype.clone.call(this),c=0;c<this.size();c++)u.add(c,this.get(c).copy());return u},i.prototype.toCoordinateArray=function(){return this.toArray(i.coordArrayType)},i.prototype.add=function(){if(arguments.length===1){var u=arguments[0];n.prototype.add.call(this,u)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var c=arguments[0],m=arguments[1];return this.add(c,m,!0),!0}if(arguments[0]instanceof I&&typeof arguments[1]=="boolean"){var E=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(E))return null;n.prototype.add.call(this,E)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var A=arguments[0],U=arguments[1];return this.add(A,U),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var K=arguments[0],pt=arguments[1];if(arguments[2])for(var dt=0;dt<K.length;dt++)this.add(K[dt],pt);else for(var Rt=K.length-1;Rt>=0;Rt--)this.add(K[Rt],pt);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof I){var Ot=arguments[0],Vt=arguments[1];if(!arguments[2]){var jt=this.size();if(jt>0&&(Ot>0&&this.get(Ot-1).equals2D(Vt)||Ot<jt&&this.get(Ot).equals2D(Vt)))return null}n.prototype.add.call(this,Ot,Vt)}}else if(arguments.length===4){var sn=arguments[0],kn=arguments[1],Mr=arguments[2],Ki=arguments[3],Uo=1;Mr>Ki&&(Uo=-1);for(var Ph=Mr;Ph!==Ki;Ph+=Uo)this.add(sn[Ph],kn);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new I(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,s),i}(Z),Q=function(){},St={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};St.ForwardComparator.get=function(){return At},St.BidirectionalComparator.get=function(){return ne},St.coordArrayType.get=function(){return new Array(0).fill(null)},Q.prototype.interfaces_=function(){return[]},Q.prototype.getClass=function(){return Q},Q.isRing=function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])},Q.ptNotInList=function(n,i){for(var s=0;s<n.length;s++){var u=n[s];if(Q.indexOf(u,i)<0)return u}return null},Q.scroll=function(n,i){var s=Q.indexOf(i,n);if(s<0)return null;var u=new Array(n.length).fill(null);Ft.arraycopy(n,s,u,0,n.length-s),Ft.arraycopy(n,0,u,n.length-s,s),Ft.arraycopy(u,0,n,0,n.length)},Q.equals=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(n===i)return!0;if(n===null||i===null||n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(!n[s].equals(i[s]))return!1;return!0}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];if(u===c)return!0;if(u===null||c===null||u.length!==c.length)return!1;for(var E=0;E<u.length;E++)if(m.compare(u[E],c[E])!==0)return!1;return!0}},Q.intersection=function(n,i){for(var s=new ot,u=0;u<n.length;u++)i.intersects(n[u])&&s.add(n[u],!0);return s.toCoordinateArray()},Q.hasRepeatedPoints=function(n){for(var i=1;i<n.length;i++)if(n[i-1].equals(n[i]))return!0;return!1},Q.removeRepeatedPoints=function(n){return Q.hasRepeatedPoints(n)?new ot(n,!1).toCoordinateArray():n},Q.reverse=function(n){for(var i=n.length-1,s=Math.trunc(i/2),u=0;u<=s;u++){var c=n[u];n[u]=n[i-u],n[i-u]=c}},Q.removeNull=function(n){for(var i=0,s=0;s<n.length;s++)n[s]!==null&&i++;var u=new Array(i).fill(null);if(i===0)return u;for(var c=0,m=0;m<n.length;m++)n[m]!==null&&(u[c++]=n[m]);return u},Q.copyDeep=function(){if(arguments.length===1){for(var n=arguments[0],i=new Array(n.length).fill(null),s=0;s<n.length;s++)i[s]=new I(n[s]);return i}if(arguments.length===5)for(var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],A=arguments[4],U=0;U<A;U++)m[E+U]=new I(u[c+U])},Q.isEqualReversed=function(n,i){for(var s=0;s<n.length;s++){var u=n[s],c=i[n.length-s-1];if(u.compareTo(c)!==0)return!1}return!0},Q.envelope=function(n){for(var i=new Ct,s=0;s<n.length;s++)i.expandToInclude(n[s]);return i},Q.toCoordinateArray=function(n){return n.toArray(Q.coordArrayType)},Q.atLeastNCoordinatesOrNothing=function(n,i){return i.length>=n?i:[]},Q.indexOf=function(n,i){for(var s=0;s<i.length;s++)if(n.equals(i[s]))return s;return-1},Q.increasingDirection=function(n){for(var i=0;i<Math.trunc(n.length/2);i++){var s=n.length-1-i,u=n[i].compareTo(n[s]);if(u!==0)return u}return 1},Q.compare=function(n,i){for(var s=0;s<n.length&&s<i.length;){var u=n[s].compareTo(i[s]);if(u!==0)return u;s++}return s<i.length?-1:s<n.length?1:0},Q.minCoordinate=function(n){for(var i=null,s=0;s<n.length;s++)(i===null||i.compareTo(n[s])>0)&&(i=n[s]);return i},Q.extract=function(n,i,s){i=ut.clamp(i,0,n.length);var u=(s=ut.clamp(s,-1,n.length))-i+1;s<0&&(u=0),i>=n.length&&(u=0),s<i&&(u=0);var c=new Array(u).fill(null);if(u===0)return c;for(var m=0,E=i;E<=s;E++)c[m++]=n[E];return c},Object.defineProperties(Q,St);var At=function(){};At.prototype.compare=function(n,i){return Q.compare(n,i)},At.prototype.interfaces_=function(){return[B]},At.prototype.getClass=function(){return At};var ne=function(){};ne.prototype.compare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;var c=Q.compare(s,u);return Q.isEqualReversed(s,u)?0:c},ne.prototype.OLDcompare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;for(var c=Q.increasingDirection(s),m=Q.increasingDirection(u),E=c>0?0:s.length-1,A=m>0?0:s.length-1,U=0;U<s.length;U++){var K=s[E].compareTo(u[A]);if(K!==0)return K;E+=c,A+=m}return 0},ne.prototype.interfaces_=function(){return[B]},ne.prototype.getClass=function(){return ne};var Gt=function(){};Gt.prototype.get=function(){},Gt.prototype.put=function(){},Gt.prototype.size=function(){},Gt.prototype.values=function(){},Gt.prototype.entrySet=function(){};var He=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Gt);(a.prototype=new Error).name="OperationNotSupported",(l.prototype=new j).contains=function(){};var tn=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof j&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.contains=function(s){for(var u=0,c=this.array_.length;u<c;u++)if(this.array_[u]===s)return!0;return!1},i.prototype.add=function(s){return!this.contains(s)&&(this.array_.push(s),!0)},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.remove=function(s){throw new Error},i.prototype.size=function(){return this.array_.length},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.iterator=function(){return new Ln(this)},i}(l),Ln=function(n){function i(s){n.call(this),this.hashSet_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new o;return this.hashSet_.array_[this.position_++]},i.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},i.prototype.remove=function(){throw new a},i}(D),mn=0;(_.prototype=new He).get=function(n){for(var i=this.root_;i!==null;){var s=n.compareTo(i.key);if(s<0)i=i.left;else{if(!(s>0))return i.value;i=i.right}}return null},_.prototype.put=function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:mn,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var s,u,c=this.root_;do if(s=c,(u=n.compareTo(c.key))<0)c=c.left;else{if(!(u>0)){var m=c.value;return c.value=i,m}c=c.right}while(c!==null);var E={key:n,left:null,right:null,value:i,parent:s,color:mn,getValue:function(){return this.value},getKey:function(){return this.key}};return u<0?s.left=E:s.right=E,this.fixAfterInsertion(E),this.size_++,null},_.prototype.fixAfterInsertion=function(n){for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)if(f(n)===d(f(f(n)))){var i=g(f(f(n)));h(i)===1?(p(f(n),mn),p(i,mn),p(f(f(n)),1),n=f(f(n))):(n===g(f(n))&&(n=f(n),this.rotateLeft(n)),p(f(n),mn),p(f(f(n)),1),this.rotateRight(f(f(n))))}else{var s=d(f(f(n)));h(s)===1?(p(f(n),mn),p(s,mn),p(f(f(n)),1),n=f(f(n))):(n===d(f(n))&&(n=f(n),this.rotateRight(n)),p(f(n),mn),p(f(f(n)),1),this.rotateLeft(f(f(n))))}this.root_.color=mn},_.prototype.values=function(){var n=new Z,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=_.successor(i))!==null;)n.add(i.value);return n},_.prototype.entrySet=function(){var n=new tn,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=_.successor(i))!==null;)n.add(i);return n},_.prototype.rotateLeft=function(n){if(n!=null){var i=n.right;n.right=i.left,i.left!=null&&(i.left.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.left===n?n.parent.left=i:n.parent.right=i,i.left=n,n.parent=i}},_.prototype.rotateRight=function(n){if(n!=null){var i=n.left;n.left=i.right,i.right!=null&&(i.right.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.right===n?n.parent.right=i:n.parent.left=i,i.right=n,n.parent=i}},_.prototype.getFirstEntry=function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n},_.successor=function(n){if(n===null)return null;if(n.right!==null){for(var i=n.right;i.left!==null;)i=i.left;return i}for(var s=n.parent,u=n;s!==null&&u===s.right;)u=s,s=s.parent;return s},_.prototype.size=function(){return this.size_};var Fn=function(){};Fn.prototype.interfaces_=function(){return[]},Fn.prototype.getClass=function(){return Fn},y.prototype=new l,(M.prototype=new y).contains=function(n){for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===0)return!0;return!1},M.prototype.add=function(n){if(this.contains(n))return!1;for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===1)return this.array_.splice(i,0,n),!0;return this.array_.push(n),!0},M.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next());return!0},M.prototype.remove=function(n){throw new a},M.prototype.size=function(){return this.array_.length},M.prototype.isEmpty=function(){return this.array_.length===0},M.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n},M.prototype.iterator=function(){return new $n(this)};var $n=function(n){this.treeSet_=n,this.position_=0};$n.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},$n.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},$n.prototype.remove=function(){throw new a};var xn=function(){};xn.sort=function(){var n,i,s,u,c=arguments[0];if(arguments.length===1)u=function(E,A){return E.compareTo(A)},c.sort(u);else if(arguments.length===2)s=arguments[1],u=function(E,A){return s.compare(E,A)},c.sort(u);else if(arguments.length===3){(i=c.slice(arguments[1],arguments[2])).sort();var m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length));for(c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])}else if(arguments.length===4)for(i=c.slice(arguments[1],arguments[2]),s=arguments[3],u=function(E,A){return s.compare(E,A)},i.sort(u),m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length)),c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])},xn.asList=function(n){for(var i=new Z,s=0,u=n.length;s<u;s++)i.add(n[s]);return i};var re=function(){},En={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};En.P.get=function(){return 0},En.L.get=function(){return 1},En.A.get=function(){return 2},En.FALSE.get=function(){return-1},En.TRUE.get=function(){return-2},En.DONTCARE.get=function(){return-3},En.SYM_FALSE.get=function(){return"F"},En.SYM_TRUE.get=function(){return"T"},En.SYM_DONTCARE.get=function(){return"*"},En.SYM_P.get=function(){return"0"},En.SYM_L.get=function(){return"1"},En.SYM_A.get=function(){return"2"},re.prototype.interfaces_=function(){return[]},re.prototype.getClass=function(){return re},re.toDimensionSymbol=function(n){switch(n){case re.FALSE:return re.SYM_FALSE;case re.TRUE:return re.SYM_TRUE;case re.DONTCARE:return re.SYM_DONTCARE;case re.P:return re.SYM_P;case re.L:return re.SYM_L;case re.A:return re.SYM_A}throw new P("Unknown dimension value: "+n)},re.toDimensionValue=function(n){switch(ht.toUpperCase(n)){case re.SYM_FALSE:return re.FALSE;case re.SYM_TRUE:return re.TRUE;case re.SYM_DONTCARE:return re.DONTCARE;case re.SYM_P:return re.P;case re.SYM_L:return re.L;case re.SYM_A:return re.A}throw new P("Unknown dimension symbol: "+n)},Object.defineProperties(re,En);var Cn=function(){};Cn.prototype.filter=function(n){},Cn.prototype.interfaces_=function(){return[]},Cn.prototype.getClass=function(){return Cn};var wn=function(){};wn.prototype.filter=function(n,i){},wn.prototype.isDone=function(){},wn.prototype.isGeometryChanged=function(){},wn.prototype.interfaces_=function(){return[]},wn.prototype.getClass=function(){return wn};var gn=function(n){function i(u,c){if(n.call(this,c),this._geometries=u||[],n.hasNullElements(this._geometries))throw new P("geometries must not contain null elements")}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){for(var u=new Ct,c=0;c<this._geometries.length;c++)u.expandToInclude(this._geometries[c].getEnvelopeInternal());return u},i.prototype.getGeometryN=function(u){return this._geometries[u]},i.prototype.getSortIndex=function(){return n.SORTINDEX_GEOMETRYCOLLECTION},i.prototype.getCoordinates=function(){for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=0;m<this._geometries.length;m++)for(var E=this._geometries[m].getCoordinates(),A=0;A<E.length;A++)u[++c]=E[A];return u},i.prototype.getArea=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getArea();return u},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._geometries.length!==m._geometries.length)return!1;for(var E=0;E<this._geometries.length;E++)if(!this._geometries[E].equalsExact(m._geometries[E],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<this._geometries.length;u++)this._geometries[u].normalize();xn.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var u=re.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getBoundaryDimension());return u},i.prototype.getDimension=function(){for(var u=re.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getDimension());return u},i.prototype.getLength=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getNumPoints();return u},i.prototype.getNumGeometries=function(){return this._geometries.length},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createGeometryCollection(c)},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=new M(xn.asList(this._geometries)),m=new M(xn.asList(u._geometries));return this.compare(c,m)}if(arguments.length===2){for(var E=arguments[0],A=arguments[1],U=E,K=this.getNumGeometries(),pt=U.getNumGeometries(),dt=0;dt<K&&dt<pt;){var Rt=this.getGeometryN(dt),Ot=U.getGeometryN(dt),Vt=Rt.compareToSameClass(Ot,A);if(Vt!==0)return Vt;dt++}return dt<K?1:dt<pt?-1:0}},i.prototype.apply=function(){if($(arguments[0],Y))for(var u=arguments[0],c=0;c<this._geometries.length;c++)this._geometries[c].apply(u);else if($(arguments[0],wn)){var m=arguments[0];if(this._geometries.length===0)return null;for(var E=0;E<this._geometries.length&&(this._geometries[E].apply(m),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else if($(arguments[0],Cn)){var A=arguments[0];A.filter(this);for(var U=0;U<this._geometries.length;U++)this._geometries[U].apply(A)}else if($(arguments[0],wt)){var K=arguments[0];K.filter(this);for(var pt=0;pt<this._geometries.length;pt++)this._geometries[pt].apply(K)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),Pt.shouldNeverReachHere(),null},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._geometries=new Array(this._geometries.length).fill(null);for(var c=0;c<this._geometries.length;c++)u._geometries[c]=this._geometries[c].clone();return u},i.prototype.getGeometryType=function(){return"GeometryCollection"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.isEmpty=function(){for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isEmpty())return!1;return!0},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(i,s),i}(yt),W=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return yt.SORTINDEX_MULTILINESTRING},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?re.FALSE:0},i.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isClosed())return!1;return!0},i.prototype.getDimension=function(){return 1},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[u-1-m]=this._geometries[m].reverse();return this.getFactory().createMultiLineString(c)},i.prototype.getBoundary=function(){return new at(this).getBoundary()},i.prototype.getGeometryType=function(){return"MultiLineString"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[Fn]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,s),i}(gn),at=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var n=arguments[0],i=w.MOD2_BOUNDARY_RULE;this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._geom=s,this._geomFact=s.getFactory(),this._bnRule=u}};at.prototype.boundaryMultiLineString=function(n){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var i=this.computeBoundaryCoordinates(n);return i.length===1?this._geomFact.createPoint(i[0]):this._geomFact.createMultiPointFromCoords(i)},at.prototype.getBoundary=function(){return this._geom instanceof zt?this.boundaryLineString(this._geom):this._geom instanceof W?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},at.prototype.boundaryLineString=function(n){return this._geom.isEmpty()?this.getEmptyMultiPoint():n.isClosed()?this._bnRule.isInBoundary(2)?n.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([n.getStartPoint(),n.getEndPoint()])},at.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},at.prototype.computeBoundaryCoordinates=function(n){var i=new Z;this._endpointMap=new _;for(var s=0;s<n.getNumGeometries();s++){var u=n.getGeometryN(s);u.getNumPoints()!==0&&(this.addEndpoint(u.getCoordinateN(0)),this.addEndpoint(u.getCoordinateN(u.getNumPoints()-1)))}for(var c=this._endpointMap.entrySet().iterator();c.hasNext();){var m=c.next(),E=m.getValue().count;this._bnRule.isInBoundary(E)&&i.add(m.getKey())}return Q.toCoordinateArray(i)},at.prototype.addEndpoint=function(n){var i=this._endpointMap.get(n);i===null&&(i=new _t,this._endpointMap.put(n,i)),i.count++},at.prototype.interfaces_=function(){return[]},at.prototype.getClass=function(){return at},at.getBoundary=function(){if(arguments.length===1){var n=arguments[0];return new at(n).getBoundary()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new at(i,s).getBoundary()}};var _t=function(){this.count=null};_t.prototype.interfaces_=function(){return[]},_t.prototype.getClass=function(){return _t};var ct=function(){},Et={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};ct.prototype.interfaces_=function(){return[]},ct.prototype.getClass=function(){return ct},ct.chars=function(n,i){for(var s=new Array(i).fill(null),u=0;u<i;u++)s[u]=n;return String(s)},ct.getStackTrace=function(){if(arguments.length===1){var n=arguments[0],i=new function(){},s=new function(){}(i);return n.printStackTrace(s),i.toString()}if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m="",E=new function(){}(new function(){}(ct.getStackTrace(u))),A=0;A<c;A++)try{m+=E.readLine()+ct.NEWLINE}catch(U){if(!(U instanceof b))throw U;Pt.shouldNeverReachHere()}return m}},ct.split=function(n,i){for(var s=i.length,u=new Z,c=""+n,m=c.indexOf(i);m>=0;){var E=c.substring(0,m);u.add(E),m=(c=c.substring(m+s)).indexOf(i)}c.length>0&&u.add(c);for(var A=new Array(u.size()).fill(null),U=0;U<A.length;U++)A[U]=u.get(U);return A},ct.toString=function(){if(arguments.length===1){var n=arguments[0];return ct.SIMPLE_ORDINATE_FORMAT.format(n)}},ct.spaces=function(n){return ct.chars(" ",n)},Et.NEWLINE.get=function(){return Ft.getProperty("line.separator")},Et.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(ct,Et);var Nt=function(){};Nt.prototype.interfaces_=function(){return[]},Nt.prototype.getClass=function(){return Nt},Nt.copyCoord=function(n,i,s,u){for(var c=Math.min(n.getDimension(),s.getDimension()),m=0;m<c;m++)s.setOrdinate(u,m,n.getOrdinate(i,m))},Nt.isRing=function(n){var i=n.size();return i===0||!(i<=3)&&n.getOrdinate(0,gt.X)===n.getOrdinate(i-1,gt.X)&&n.getOrdinate(0,gt.Y)===n.getOrdinate(i-1,gt.Y)},Nt.isEqual=function(n,i){var s=n.size();if(s!==i.size())return!1;for(var u=Math.min(n.getDimension(),i.getDimension()),c=0;c<s;c++)for(var m=0;m<u;m++){var E=n.getOrdinate(c,m),A=i.getOrdinate(c,m);if(n.getOrdinate(c,m)!==i.getOrdinate(c,m)&&(!S.isNaN(E)||!S.isNaN(A)))return!1}return!0},Nt.extend=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();if(Nt.copy(i,0,u,0,c),c>0)for(var m=c;m<s;m++)Nt.copy(i,c-1,u,m,1);return u},Nt.reverse=function(n){for(var i=n.size()-1,s=Math.trunc(i/2),u=0;u<=s;u++)Nt.swap(n,u,i-u)},Nt.swap=function(n,i,s){if(i===s)return null;for(var u=0;u<n.getDimension();u++){var c=n.getOrdinate(i,u);n.setOrdinate(i,u,n.getOrdinate(s,u)),n.setOrdinate(s,u,c)}},Nt.copy=function(n,i,s,u,c){for(var m=0;m<c;m++)Nt.copyCoord(n,i+m,s,u+m)},Nt.toString=function(){if(arguments.length===1){var n=arguments[0],i=n.size();if(i===0)return"()";var s=n.getDimension(),u=new mt;u.append("(");for(var c=0;c<i;c++){c>0&&u.append(" ");for(var m=0;m<s;m++)m>0&&u.append(","),u.append(ct.toString(n.getOrdinate(c,m)))}return u.append(")"),u.toString()}},Nt.ensureValidRing=function(n,i){var s=i.size();return s===0?i:s<=3?Nt.createClosedRing(n,i,4):i.getOrdinate(0,gt.X)===i.getOrdinate(s-1,gt.X)&&i.getOrdinate(0,gt.Y)===i.getOrdinate(s-1,gt.Y)?i:Nt.createClosedRing(n,i,s+1)},Nt.createClosedRing=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();Nt.copy(i,0,u,0,c);for(var m=c;m<s;m++)Nt.copy(i,0,u,m,1);return u};var zt=function(n){function i(u,c){n.call(this,c),this._points=null,this.init(u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new Ct:this._points.expandEnvelope(new Ct)},i.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},i.prototype.getSortIndex=function(){return n.SORTINDEX_LINESTRING},i.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._points.size()!==m._points.size())return!1;for(var E=0;E<this._points.size();E++)if(!this.equal(this._points.getCoordinate(E),m._points.getCoordinate(E),c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<Math.trunc(this._points.size()/2);u++){var c=this._points.size()-1-u;if(!this._points.getCoordinate(u).equals(this._points.getCoordinate(c)))return this._points.getCoordinate(u).compareTo(this._points.getCoordinate(c))>0&&Nt.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?re.FALSE:0},i.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},i.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},i.prototype.getDimension=function(){return 1},i.prototype.getLength=function(){return J.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var u=this._points.copy();return Nt.reverse(u),this.getFactory().createLineString(u)},i.prototype.compareToSameClass=function(){if(arguments.length===1){for(var u=arguments[0],c=0,m=0;c<this._points.size()&&m<u._points.size();){var E=this._points.getCoordinate(c).compareTo(u._points.getCoordinate(m));if(E!==0)return E;c++,m++}return c<this._points.size()?1:m<u._points.size()?-1:0}if(arguments.length===2){var A=arguments[0];return arguments[1].compare(this._points,A._points)}},i.prototype.apply=function(){if($(arguments[0],Y))for(var u=arguments[0],c=0;c<this._points.size();c++)u.filter(this._points.getCoordinate(c));else if($(arguments[0],wn)){var m=arguments[0];if(this._points.size()===0)return null;for(var E=0;E<this._points.size()&&(m.filter(this._points,E),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else $(arguments[0],Cn)?arguments[0].filter(this):$(arguments[0],wt)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new at(this).getBoundary()},i.prototype.isEquivalentClass=function(u){return u instanceof i},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._points=this._points.clone(),u},i.prototype.getCoordinateN=function(u){return this._points.getCoordinate(u)},i.prototype.getGeometryType=function(){return"LineString"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._points},i.prototype.isEmpty=function(){return this._points.size()===0},i.prototype.init=function(u){if(u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),u.size()===1)throw new P("Invalid number of points in LineString (found "+u.size()+" - must be 0 or >= 2)");this._points=u},i.prototype.isCoordinate=function(u){for(var c=0;c<this._points.size();c++)if(this._points.getCoordinate(c).equals(u))return!0;return!1},i.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},i.prototype.getPointN=function(u){return this.getFactory().createPoint(this._points.getCoordinate(u))},i.prototype.interfaces_=function(){return[Fn]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,s),i}(yt),oe=function(){};oe.prototype.interfaces_=function(){return[]},oe.prototype.getClass=function(){return oe};var Kt=function(n){function i(u,c){n.call(this,c),this._coordinates=u||null,this.init(this._coordinates)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new Ct;var u=new Ct;return u.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),u},i.prototype.getSortIndex=function(){return n.SORTINDEX_POINT},i.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&(!(!this.isEmpty()||!u.isEmpty())||this.isEmpty()===u.isEmpty()&&this.equal(u.getCoordinate(),this.getCoordinate(),c))}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){},i.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},i.prototype.getBoundaryDimension=function(){return re.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getNumPoints=function(){return this.isEmpty()?0:1},i.prototype.reverse=function(){return this.copy()},i.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0];return this.getCoordinate().compareTo(u.getCoordinate())}if(arguments.length===2){var c=arguments[0];return arguments[1].compare(this._coordinates,c._coordinates)}},i.prototype.apply=function(){if($(arguments[0],Y)){var u=arguments[0];if(this.isEmpty())return null;u.filter(this.getCoordinate())}else if($(arguments[0],wn)){var c=arguments[0];if(this.isEmpty())return null;c.filter(this._coordinates,0),c.isGeometryChanged()&&this.geometryChanged()}else $(arguments[0],Cn)?arguments[0].filter(this):$(arguments[0],wt)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._coordinates=this._coordinates.clone(),u},i.prototype.getGeometryType=function(){return"Point"},i.prototype.copy=function(){return new i(this._coordinates.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._coordinates},i.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},i.prototype.isEmpty=function(){return this._coordinates.size()===0},i.prototype.init=function(u){u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),Pt.isTrue(u.size()<=1),this._coordinates=u},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[oe]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,s),i}(yt),ce=function(){};ce.prototype.interfaces_=function(){return[]},ce.prototype.getClass=function(){return ce};var Wt=function(n){function i(u,c,m){if(n.call(this,m),this._shell=null,this._holes=null,u===null&&(u=this.getFactory().createLinearRing()),c===null&&(c=[]),n.hasNullElements(c))throw new P("holes must not contain null elements");if(u.isEmpty()&&n.hasNonEmptyElements(c))throw new P("shell is empty but holes are not");this._shell=u,this._holes=c}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},i.prototype.getSortIndex=function(){return n.SORTINDEX_POLYGON},i.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=this._shell.getCoordinates(),E=0;E<m.length;E++)u[++c]=m[E];for(var A=0;A<this._holes.length;A++)for(var U=this._holes[A].getCoordinates(),K=0;K<U.length;K++)u[++c]=U[K];return u},i.prototype.getArea=function(){var u=0;u+=Math.abs(J.signedArea(this._shell.getCoordinateSequence()));for(var c=0;c<this._holes.length;c++)u-=Math.abs(J.signedArea(this._holes[c].getCoordinateSequence()));return u},i.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var u=this._shell.getCoordinateSequence(),c=this.getEnvelopeInternal(),m=0;m<5;m++){var E=u.getX(m);if(E!==c.getMinX()&&E!==c.getMaxX())return!1;var A=u.getY(m);if(A!==c.getMinY()&&A!==c.getMaxY())return!1}for(var U=u.getX(0),K=u.getY(0),pt=1;pt<=4;pt++){var dt=u.getX(pt),Rt=u.getY(pt);if(dt!==U==(Rt!==K))return!1;U=dt,K=Rt}return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u,E=this._shell,A=m._shell;if(!E.equalsExact(A,c)||this._holes.length!==m._holes.length)return!1;for(var U=0;U<this._holes.length;U++)if(!this._holes[U].equalsExact(m._holes[U],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var u=0;u<this._holes.length;u++)this.normalize(this._holes[u],!1);xn.sort(this._holes)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];if(c.isEmpty())return null;var E=new Array(c.getCoordinates().length-1).fill(null);Ft.arraycopy(c.getCoordinates(),0,E,0,E.length);var A=Q.minCoordinate(c.getCoordinates());Q.scroll(E,A),Ft.arraycopy(E,0,c.getCoordinates(),0,E.length),c.getCoordinates()[E.length]=E[0],J.isCCW(c.getCoordinates())===m&&Q.reverse(c.getCoordinates())}},i.prototype.getCoordinate=function(){return this._shell.getCoordinate()},i.prototype.getNumInteriorRing=function(){return this._holes.length},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.getLength=function(){var u=0;u+=this._shell.getLength();for(var c=0;c<this._holes.length;c++)u+=this._holes[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=this._shell.getNumPoints(),c=0;c<this._holes.length;c++)u+=this._holes[c].getNumPoints();return u},i.prototype.reverse=function(){var u=this.copy();u._shell=this._shell.copy().reverse(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].copy().reverse();return u},i.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=this._shell,m=u._shell;return c.compareToSameClass(m)}if(arguments.length===2){var E=arguments[0],A=arguments[1],U=E,K=this._shell,pt=U._shell,dt=K.compareToSameClass(pt,A);if(dt!==0)return dt;for(var Rt=this.getNumInteriorRing(),Ot=U.getNumInteriorRing(),Vt=0;Vt<Rt&&Vt<Ot;){var jt=this.getInteriorRingN(Vt),sn=U.getInteriorRingN(Vt),kn=jt.compareToSameClass(sn,A);if(kn!==0)return kn;Vt++}return Vt<Rt?1:Vt<Ot?-1:0}},i.prototype.apply=function(u){if($(u,Y)){this._shell.apply(u);for(var c=0;c<this._holes.length;c++)this._holes[c].apply(u)}else if($(u,wn)){if(this._shell.apply(u),!u.isDone())for(var m=0;m<this._holes.length&&(this._holes[m].apply(u),!u.isDone());m++);u.isGeometryChanged()&&this.geometryChanged()}else if($(u,Cn))u.filter(this);else if($(u,wt)){u.filter(this),this._shell.apply(u);for(var E=0;E<this._holes.length;E++)this._holes[E].apply(u)}},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var u=new Array(this._holes.length+1).fill(null);u[0]=this._shell;for(var c=0;c<this._holes.length;c++)u[c+1]=this._holes[c];return u.length<=1?this.getFactory().createLinearRing(u[0].getCoordinateSequence()):this.getFactory().createMultiLineString(u)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._shell=this._shell.clone(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].clone();return u},i.prototype.getGeometryType=function(){return"Polygon"},i.prototype.copy=function(){for(var u=this._shell.copy(),c=new Array(this._holes.length).fill(null),m=0;m<c.length;m++)c[m]=this._holes[m].copy();return new i(u,c,this._factory)},i.prototype.getExteriorRing=function(){return this._shell},i.prototype.isEmpty=function(){return this._shell.isEmpty()},i.prototype.getInteriorRingN=function(u){return this._holes[u]},i.prototype.interfaces_=function(){return[ce]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(i,s),i}(yt),he=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return yt.SORTINDEX_MULTIPOINT},i.prototype.isValid=function(){return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getCoordinate=function(){if(arguments.length===1){var u=arguments[0];return this._geometries[u].getCoordinate()}return n.prototype.getCoordinate.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return re.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.getGeometryType=function(){return"MultiPoint"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[oe]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,s),i}(gn),an=function(n){function i(u,c){u instanceof I&&c instanceof ue&&(u=c.getCoordinateSequenceFactory().create(u)),n.call(this,u,c),this.validateConstruction()}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return yt.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return re.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},i.prototype.reverse=function(){var u=this._points.copy();return Nt.reverse(u),this.getFactory().createLinearRing(u)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new P("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new P("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},i.prototype.getGeometryType=function(){return"LinearRing"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.MINIMUM_VALID_SIZE.get=function(){return 4},s.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(i,s),i}(zt),ln=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return yt.SORTINDEX_MULTIPOLYGON},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createMultiPolygon(c)},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var u=new Z,c=0;c<this._geometries.length;c++)for(var m=this._geometries[c].getBoundary(),E=0;E<m.getNumGeometries();E++)u.add(m.getGeometryN(E));var A=new Array(u.size()).fill(null);return this.getFactory().createMultiLineString(u.toArray(A))},i.prototype.getGeometryType=function(){return"MultiPolygon"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[ce]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(i,s),i}(gn),bn=function(n){this._factory=n||null,this._isUserDataCopied=!1},ui={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};bn.prototype.setCopyUserData=function(n){this._isUserDataCopied=n},bn.prototype.edit=function(n,i){if(n===null)return null;var s=this.editInternal(n,i);return this._isUserDataCopied&&s.setUserData(n.getUserData()),s},bn.prototype.editInternal=function(n,i){return this._factory===null&&(this._factory=n.getFactory()),n instanceof gn?this.editGeometryCollection(n,i):n instanceof Wt?this.editPolygon(n,i):n instanceof Kt?i.edit(n,this._factory):n instanceof zt?i.edit(n,this._factory):(Pt.shouldNeverReachHere("Unsupported Geometry class: "+n.getClass().getName()),null)},bn.prototype.editGeometryCollection=function(n,i){for(var s=i.edit(n,this._factory),u=new Z,c=0;c<s.getNumGeometries();c++){var m=this.edit(s.getGeometryN(c),i);m===null||m.isEmpty()||u.add(m)}return s.getClass()===he?this._factory.createMultiPoint(u.toArray([])):s.getClass()===W?this._factory.createMultiLineString(u.toArray([])):s.getClass()===ln?this._factory.createMultiPolygon(u.toArray([])):this._factory.createGeometryCollection(u.toArray([]))},bn.prototype.editPolygon=function(n,i){var s=i.edit(n,this._factory);if(s===null&&(s=this._factory.createPolygon(null)),s.isEmpty())return s;var u=this.edit(s.getExteriorRing(),i);if(u===null||u.isEmpty())return this._factory.createPolygon();for(var c=new Z,m=0;m<s.getNumInteriorRing();m++){var E=this.edit(s.getInteriorRingN(m),i);E===null||E.isEmpty()||c.add(E)}return this._factory.createPolygon(u,c.toArray([]))},bn.prototype.interfaces_=function(){return[]},bn.prototype.getClass=function(){return bn},bn.GeometryEditorOperation=function(){},ui.NoOpGeometryOperation.get=function(){return Pn},ui.CoordinateOperation.get=function(){return de},ui.CoordinateSequenceOperation.get=function(){return bo},Object.defineProperties(bn,ui);var Pn=function(){};Pn.prototype.edit=function(n,i){return n},Pn.prototype.interfaces_=function(){return[bn.GeometryEditorOperation]},Pn.prototype.getClass=function(){return Pn};var de=function(){};de.prototype.edit=function(n,i){var s=this.editCoordinates(n.getCoordinates(),n);return s===null?n:n instanceof an?i.createLinearRing(s):n instanceof zt?i.createLineString(s):n instanceof Kt?s.length>0?i.createPoint(s[0]):i.createPoint():n},de.prototype.interfaces_=function(){return[bn.GeometryEditorOperation]},de.prototype.getClass=function(){return de};var bo=function(){};bo.prototype.edit=function(n,i){return n instanceof an?i.createLinearRing(this.edit(n.getCoordinateSequence(),n)):n instanceof zt?i.createLineString(this.edit(n.getCoordinateSequence(),n)):n instanceof Kt?i.createPoint(this.edit(n.getCoordinateSequence(),n)):n},bo.prototype.interfaces_=function(){return[bn.GeometryEditorOperation]},bo.prototype.getClass=function(){return bo};var fe=function(){if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=new Array(n).fill(null);for(var i=0;i<n;i++)this._coordinates[i]=new I}else if($(arguments[0],gt)){var s=arguments[0];if(s===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=s.getDimension(),this._coordinates=new Array(s.size()).fill(null);for(var u=0;u<this._coordinates.length;u++)this._coordinates[u]=s.getCoordinateCopy(u)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var c=arguments[0],m=arguments[1];this._coordinates=c,this._dimension=m,c===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var E=arguments[0],A=arguments[1];this._coordinates=new Array(E).fill(null),this._dimension=A;for(var U=0;U<E;U++)this._coordinates[U]=new I}}},ao={serialVersionUID:{configurable:!0}};fe.prototype.setOrdinate=function(n,i,s){switch(i){case gt.X:this._coordinates[n].x=s;break;case gt.Y:this._coordinates[n].y=s;break;case gt.Z:this._coordinates[n].z=s;break;default:throw new P("invalid ordinateIndex")}},fe.prototype.size=function(){return this._coordinates.length},fe.prototype.getOrdinate=function(n,i){switch(i){case gt.X:return this._coordinates[n].x;case gt.Y:return this._coordinates[n].y;case gt.Z:return this._coordinates[n].z}return S.NaN},fe.prototype.getCoordinate=function(){if(arguments.length===1){var n=arguments[0];return this._coordinates[n]}if(arguments.length===2){var i=arguments[0],s=arguments[1];s.x=this._coordinates[i].x,s.y=this._coordinates[i].y,s.z=this._coordinates[i].z}},fe.prototype.getCoordinateCopy=function(n){return new I(this._coordinates[n])},fe.prototype.getDimension=function(){return this._dimension},fe.prototype.getX=function(n){return this._coordinates[n].x},fe.prototype.clone=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].clone();return new fe(n,this._dimension)},fe.prototype.expandEnvelope=function(n){for(var i=0;i<this._coordinates.length;i++)n.expandToInclude(this._coordinates[i]);return n},fe.prototype.copy=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].copy();return new fe(n,this._dimension)},fe.prototype.toString=function(){if(this._coordinates.length>0){var n=new mt(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var i=1;i<this._coordinates.length;i++)n.append(", "),n.append(this._coordinates[i]);return n.append(")"),n.toString()}return"()"},fe.prototype.getY=function(n){return this._coordinates[n].y},fe.prototype.toCoordinateArray=function(){return this._coordinates},fe.prototype.interfaces_=function(){return[gt,t]},fe.prototype.getClass=function(){return fe},ao.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(fe,ao);var li=function(){},To={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};li.prototype.readResolve=function(){return li.instance()},li.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new fe(n)}if($(arguments[0],gt)){var i=arguments[0];return new fe(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return u>3&&(u=3),u<2?new fe(s):new fe(s,u)}},li.prototype.interfaces_=function(){return[st,t]},li.prototype.getClass=function(){return li},li.instance=function(){return li.instanceObject},To.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},To.instanceObject.get=function(){return new li},Object.defineProperties(li,To);var ua=function(n){function i(){n.call(this),this.map_=new Map}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(s){return this.map_.get(s)||null},i.prototype.put=function(s,u){return this.map_.set(s,u),u},i.prototype.values=function(){for(var s=new Z,u=this.map_.values(),c=u.next();!c.done;)s.add(c.value),c=u.next();return s},i.prototype.entrySet=function(){var s=new tn;return this.map_.entries().forEach(function(u){return s.add(u)}),s},i.prototype.size=function(){return this.map_.size()},i}(Gt),ie=function n(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=n.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof kr){var i=arguments[0];this._modelType=i,i===n.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var s=arguments[0];this._modelType=n.FIXED,this.setScale(s)}else if(arguments[0]instanceof n){var u=arguments[0];this._modelType=u._modelType,this._scale=u._scale}}},Vi={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};ie.prototype.equals=function(n){if(!(n instanceof ie))return!1;var i=n;return this._modelType===i._modelType&&this._scale===i._scale},ie.prototype.compareTo=function(n){var i=n,s=this.getMaximumSignificantDigits(),u=i.getMaximumSignificantDigits();return new lt(s).compareTo(new lt(u))},ie.prototype.getScale=function(){return this._scale},ie.prototype.isFloating=function(){return this._modelType===ie.FLOATING||this._modelType===ie.FLOATING_SINGLE},ie.prototype.getType=function(){return this._modelType},ie.prototype.toString=function(){var n="UNKNOWN";return this._modelType===ie.FLOATING?n="Floating":this._modelType===ie.FLOATING_SINGLE?n="Floating-Single":this._modelType===ie.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n},ie.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var n=arguments[0];return S.isNaN(n)||this._modelType===ie.FLOATING_SINGLE?n:this._modelType===ie.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof I){var i=arguments[0];if(this._modelType===ie.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}},ie.prototype.getMaximumSignificantDigits=function(){var n=16;return this._modelType===ie.FLOATING?n=16:this._modelType===ie.FLOATING_SINGLE?n=6:this._modelType===ie.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n},ie.prototype.setScale=function(n){this._scale=Math.abs(n)},ie.prototype.interfaces_=function(){return[t,N]},ie.prototype.getClass=function(){return ie},ie.mostPrecise=function(n,i){return n.compareTo(i)>=0?n:i},Vi.serialVersionUID.get=function(){return 7777263578777804e3},Vi.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ie,Vi);var kr=function n(i){this._name=i||null,n.nameToTypeMap.put(i,this)},Pr={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};kr.prototype.readResolve=function(){return kr.nameToTypeMap.get(this._name)},kr.prototype.toString=function(){return this._name},kr.prototype.interfaces_=function(){return[t]},kr.prototype.getClass=function(){return kr},Pr.serialVersionUID.get=function(){return-552860263173159e4},Pr.nameToTypeMap.get=function(){return new ua},Object.defineProperties(kr,Pr),ie.Type=kr,ie.FIXED=new kr("FIXED"),ie.FLOATING=new kr("FLOATING"),ie.FLOATING_SINGLE=new kr("FLOATING SINGLE");var ue=function n(){this._precisionModel=new ie,this._SRID=0,this._coordinateSequenceFactory=n.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?$(arguments[0],st)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof ie&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},dl={serialVersionUID:{configurable:!0}};ue.prototype.toGeometry=function(n){return n.isNull()?this.createPoint(null):n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new I(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new I(n.getMinX(),n.getMinY()),new I(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new I(n.getMinX(),n.getMinY()),new I(n.getMinX(),n.getMaxY()),new I(n.getMaxX(),n.getMaxY()),new I(n.getMaxX(),n.getMinY()),new I(n.getMinX(),n.getMinY())]),null)},ue.prototype.createLineString=function(n){return n?n instanceof Array?new zt(this.getCoordinateSequenceFactory().create(n),this):$(n,gt)?new zt(n,this):void 0:new zt(this.getCoordinateSequenceFactory().create([]),this)},ue.prototype.createMultiLineString=function(){if(arguments.length===0)return new W(null,this);if(arguments.length===1){var n=arguments[0];return new W(n,this)}},ue.prototype.buildGeometry=function(n){for(var i=null,s=!1,u=!1,c=n.iterator();c.hasNext();){var m=c.next(),E=m.getClass();i===null&&(i=E),E!==i&&(s=!0),m.isGeometryCollectionOrDerived()&&(u=!0)}if(i===null)return this.createGeometryCollection();if(s||u)return this.createGeometryCollection(ue.toGeometryArray(n));var A=n.iterator().next();if(n.size()>1){if(A instanceof Wt)return this.createMultiPolygon(ue.toPolygonArray(n));if(A instanceof zt)return this.createMultiLineString(ue.toLineStringArray(n));if(A instanceof Kt)return this.createMultiPoint(ue.toPointArray(n));Pt.shouldNeverReachHere("Unhandled class: "+A.getClass().getName())}return A},ue.prototype.createMultiPointFromCoords=function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)},ue.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if($(arguments[0],gt)){var i=arguments[0];return new Kt(i,this)}}},ue.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},ue.prototype.createPolygon=function(){if(arguments.length===0)return new Wt(null,null,this);if(arguments.length===1){if($(arguments[0],gt)){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof Array){var i=arguments[0];return this.createPolygon(this.createLinearRing(i))}if(arguments[0]instanceof an){var s=arguments[0];return this.createPolygon(s,null)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];return new Wt(u,c,this)}},ue.prototype.getSRID=function(){return this._SRID},ue.prototype.createGeometryCollection=function(){if(arguments.length===0)return new gn(null,this);if(arguments.length===1){var n=arguments[0];return new gn(n,this)}},ue.prototype.createGeometry=function(n){return new bn(this).edit(n,{edit:function(){if(arguments.length===2){var i=arguments[0];return this._coordinateSequenceFactory.create(i)}}})},ue.prototype.getPrecisionModel=function(){return this._precisionModel},ue.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if($(arguments[0],gt)){var i=arguments[0];return new an(i,this)}}},ue.prototype.createMultiPolygon=function(){if(arguments.length===0)return new ln(null,this);if(arguments.length===1){var n=arguments[0];return new ln(n,this)}},ue.prototype.createMultiPoint=function(){if(arguments.length===0)return new he(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new he(n,this)}if(arguments[0]instanceof Array){var i=arguments[0];return this.createMultiPoint(i!==null?this.getCoordinateSequenceFactory().create(i):null)}if($(arguments[0],gt)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var u=new Array(s.size()).fill(null),c=0;c<s.size();c++){var m=this.getCoordinateSequenceFactory().create(1,s.getDimension());Nt.copy(s,c,m,0,1),u[c]=this.createPoint(m)}return this.createMultiPoint(u)}}},ue.prototype.interfaces_=function(){return[t]},ue.prototype.getClass=function(){return ue},ue.toMultiPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toGeometryArray=function(n){if(n===null)return null;var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.getDefaultCoordinateSequenceFactory=function(){return li.instance()},ue.toMultiLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toMultiPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toLinearRingArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.toPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},ue.createPointFromInternalCoord=function(n,i){return i.getPrecisionModel().makePrecise(n),i.getFactory().createPoint(n)},dl.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(ue,dl);var ml=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],gl=function(n){this.geometryFactory=n||new ue};gl.prototype.read=function(n){var i,s=(i=typeof n=="string"?JSON.parse(n):n).type;if(!Ci[s])throw new Error("Unknown GeoJSON type: "+i.type);return ml.indexOf(s)!==-1?Ci[s].apply(this,[i.coordinates]):s==="GeometryCollection"?Ci[s].apply(this,[i.geometries]):Ci[s].apply(this,[i])},gl.prototype.write=function(n){var i=n.getGeometryType();if(!uo[i])throw new Error("Geometry is not supported");return uo[i].apply(this,[n])};var Ci={Feature:function(n){var i={};for(var s in n)i[s]=n[s];if(n.geometry){var u=n.geometry.type;if(!Ci[u])throw new Error("Unknown GeoJSON type: "+n.type);i.geometry=this.read(n.geometry)}return n.bbox&&(i.bbox=Ci.bbox.apply(this,[n.bbox])),i},FeatureCollection:function(n){var i={};if(n.features){i.features=[];for(var s=0;s<n.features.length;++s)i.features.push(this.read(n.features[s]))}return n.bbox&&(i.bbox=this.parse.bbox.apply(this,[n.bbox])),i},coordinates:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(new I(u[0],u[1]))}return i},bbox:function(n){return this.geometryFactory.createLinearRing([new I(n[0],n[1]),new I(n[2],n[1]),new I(n[2],n[3]),new I(n[0],n[3]),new I(n[0],n[1])])},Point:function(n){var i=new I(n[0],n[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(n){for(var i=[],s=0;s<n.length;++s)i.push(Ci.Point.apply(this,[n[s]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(n){var i=Ci.coordinates.apply(this,[n]);return this.geometryFactory.createLineString(i)},MultiLineString:function(n){for(var i=[],s=0;s<n.length;++s)i.push(Ci.LineString.apply(this,[n[s]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(n){for(var i=Ci.coordinates.apply(this,[n[0]]),s=this.geometryFactory.createLinearRing(i),u=[],c=1;c<n.length;++c){var m=n[c],E=Ci.coordinates.apply(this,[m]),A=this.geometryFactory.createLinearRing(E);u.push(A)}return this.geometryFactory.createPolygon(s,u)},MultiPolygon:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(Ci.Polygon.apply(this,[u]))}return this.geometryFactory.createMultiPolygon(i)},GeometryCollection:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(this.read(u))}return this.geometryFactory.createGeometryCollection(i)}},uo={coordinate:function(n){return[n.x,n.y]},Point:function(n){return{type:"Point",coordinates:uo.coordinate.apply(this,[n.getCoordinate()])}},MultiPoint:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=uo.Point.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPoint",coordinates:i}},LineString:function(n){for(var i=[],s=n.getCoordinates(),u=0;u<s.length;++u){var c=s[u];i.push(uo.coordinate.apply(this,[c]))}return{type:"LineString",coordinates:i}},MultiLineString:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=uo.LineString.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(n){var i=[],s=uo.LineString.apply(this,[n._shell]);i.push(s.coordinates);for(var u=0;u<n._holes.length;++u){var c=n._holes[u],m=uo.LineString.apply(this,[c]);i.push(m.coordinates)}return{type:"Polygon",coordinates:i}},MultiPolygon:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=uo.Polygon.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPolygon",coordinates:i}},GeometryCollection:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=u.getGeometryType();i.push(uo[c].apply(this,[u]))}return{type:"GeometryCollection",geometries:i}}},_h=function(n){this.geometryFactory=n||new ue,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new gl(this.geometryFactory)};_h.prototype.read=function(n){var i=this.parser.read(n);return this.precisionModel.getType()===ie.FIXED&&this.reducePrecision(i),i},_h.prototype.reducePrecision=function(n){var i,s;if(n.coordinate)this.precisionModel.makePrecise(n.coordinate);else if(n.points)for(i=0,s=n.points.length;i<s;i++)this.precisionModel.makePrecise(n.points[i]);else if(n.geometries)for(i=0,s=n.geometries.length;i<s;i++)this.reducePrecision(n.geometries[i])};var Xd=function(){this.parser=new gl(this.geometryFactory)};Xd.prototype.write=function(n){return this.parser.write(n)};var bt=function(){},yl={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};bt.prototype.interfaces_=function(){return[]},bt.prototype.getClass=function(){return bt},bt.opposite=function(n){return n===bt.LEFT?bt.RIGHT:n===bt.RIGHT?bt.LEFT:n},yl.ON.get=function(){return 0},yl.LEFT.get=function(){return 1},yl.RIGHT.get=function(){return 2},Object.defineProperties(bt,yl),(T.prototype=new Error).name="EmptyStackException",(x.prototype=new tt).add=function(n){return this.array_.push(n),!0},x.prototype.get=function(n){if(n<0||n>=this.size())throw new Error;return this.array_[n]},x.prototype.push=function(n){return this.array_.push(n),n},x.prototype.pop=function(n){if(this.array_.length===0)throw new T;return this.array_.pop()},x.prototype.peek=function(){if(this.array_.length===0)throw new T;return this.array_[this.array_.length-1]},x.prototype.empty=function(){return this.array_.length===0},x.prototype.isEmpty=function(){return this.empty()},x.prototype.search=function(n){return this.array_.indexOf(n)},x.prototype.size=function(){return this.array_.length},x.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n};var Pi=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Pi.prototype.getCoordinate=function(){return this._minCoord},Pi.prototype.getRightmostSide=function(n,i){var s=this.getRightmostSideOfSegment(n,i);return s<0&&(s=this.getRightmostSideOfSegment(n,i-1)),s<0&&(this._minCoord=null,this.checkForRightmostCoordinate(n)),s},Pi.prototype.findRightmostEdgeAtVertex=function(){var n=this._minDe.getEdge().getCoordinates();Pt.isTrue(this._minIndex>0&&this._minIndex<n.length,"rightmost point expected to be interior vertex of edge");var i=n[this._minIndex-1],s=n[this._minIndex+1],u=J.computeOrientation(this._minCoord,s,i),c=!1;(i.y<this._minCoord.y&&s.y<this._minCoord.y&&u===J.COUNTERCLOCKWISE||i.y>this._minCoord.y&&s.y>this._minCoord.y&&u===J.CLOCKWISE)&&(c=!0),c&&(this._minIndex=this._minIndex-1)},Pi.prototype.getRightmostSideOfSegment=function(n,i){var s=n.getEdge().getCoordinates();if(i<0||i+1>=s.length||s[i].y===s[i+1].y)return-1;var u=bt.LEFT;return s[i].y<s[i+1].y&&(u=bt.RIGHT),u},Pi.prototype.getEdge=function(){return this._orientedDe},Pi.prototype.checkForRightmostCoordinate=function(n){for(var i=n.getEdge().getCoordinates(),s=0;s<i.length-1;s++)(this._minCoord===null||i[s].x>this._minCoord.x)&&(this._minDe=n,this._minIndex=s,this._minCoord=i[s])},Pi.prototype.findRightmostEdgeAtNode=function(){var n=this._minDe.getNode().getEdges();this._minDe=n.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},Pi.prototype.findEdge=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isForward()&&this.checkForRightmostCoordinate(s)}Pt.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===bt.LEFT&&(this._orientedDe=this._minDe.getSym())},Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi};var lo=function(n){function i(s,u){n.call(this,i.msgWithCoord(s,u)),this.pt=u?new I(u):null,this.name="TopologyException"}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getCoordinate=function(){return this.pt},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.msgWithCoord=function(s,u){return u?s:s+" [ "+u+" ]"},i}(pe),vl=function(){this.array_=[]};vl.prototype.addLast=function(n){this.array_.push(n)},vl.prototype.removeFirst=function(){return this.array_.shift()},vl.prototype.isEmpty=function(){return this.array_.length===0};var mr=function(){this._finder=null,this._dirEdgeList=new Z,this._nodes=new Z,this._rightMostCoord=null,this._env=null,this._finder=new Pi};mr.prototype.clearVisitedEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();)n.next().setVisited(!1)},mr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},mr.prototype.computeNodeDepth=function(n){for(var i=null,s=n.getEdges().iterator();s.hasNext();){var u=s.next();if(u.isVisited()||u.getSym().isVisited()){i=u;break}}if(i===null)throw new lo("unable to find edge to compute depths at "+n.getCoordinate());n.getEdges().computeDepths(i);for(var c=n.getEdges().iterator();c.hasNext();){var m=c.next();m.setVisited(!0),this.copySymDepths(m)}},mr.prototype.computeDepth=function(n){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(bt.RIGHT,n),this.copySymDepths(i),this.computeDepths(i)},mr.prototype.create=function(n){this.addReachable(n),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},mr.prototype.findResultEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();){var i=n.next();i.getDepth(bt.RIGHT)>=1&&i.getDepth(bt.LEFT)<=0&&!i.isInteriorAreaEdge()&&i.setInResult(!0)}},mr.prototype.computeDepths=function(n){var i=new tn,s=new vl,u=n.getNode();for(s.addLast(u),i.add(u),n.setVisited(!0);!s.isEmpty();){var c=s.removeFirst();i.add(c),this.computeNodeDepth(c);for(var m=c.getEdges().iterator();m.hasNext();){var E=m.next().getSym();if(!E.isVisited()){var A=E.getNode();i.contains(A)||(s.addLast(A),i.add(A))}}}},mr.prototype.compareTo=function(n){var i=n;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},mr.prototype.getEnvelope=function(){if(this._env===null){for(var n=new Ct,i=this._dirEdgeList.iterator();i.hasNext();)for(var s=i.next().getEdge().getCoordinates(),u=0;u<s.length-1;u++)n.expandToInclude(s[u]);this._env=n}return this._env},mr.prototype.addReachable=function(n){var i=new x;for(i.add(n);!i.empty();){var s=i.pop();this.add(s,i)}},mr.prototype.copySymDepths=function(n){var i=n.getSym();i.setDepth(bt.LEFT,n.getDepth(bt.RIGHT)),i.setDepth(bt.RIGHT,n.getDepth(bt.LEFT))},mr.prototype.add=function(n,i){n.setVisited(!0),this._nodes.add(n);for(var s=n.getEdges().iterator();s.hasNext();){var u=s.next();this._dirEdgeList.add(u);var c=u.getSym().getNode();c.isVisited()||i.push(c)}},mr.prototype.getNodes=function(){return this._nodes},mr.prototype.getDirectedEdges=function(){return this._dirEdgeList},mr.prototype.interfaces_=function(){return[N]},mr.prototype.getClass=function(){return mr};var dn=function n(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var i=arguments[0];this.init(i.length)}else if(Number.isInteger(arguments[0])){var s=arguments[0];this.init(1),this.location[bt.ON]=s}else if(arguments[0]instanceof n){var u=arguments[0];if(this.init(u.location.length),u!==null)for(var c=0;c<this.location.length;c++)this.location[c]=u.location[c]}}else if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];this.init(3),this.location[bt.ON]=m,this.location[bt.LEFT]=E,this.location[bt.RIGHT]=A}};dn.prototype.setAllLocations=function(n){for(var i=0;i<this.location.length;i++)this.location[i]=n},dn.prototype.isNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==V.NONE)return!1;return!0},dn.prototype.setAllLocationsIfNull=function(n){for(var i=0;i<this.location.length;i++)this.location[i]===V.NONE&&(this.location[i]=n)},dn.prototype.isLine=function(){return this.location.length===1},dn.prototype.merge=function(n){if(n.location.length>this.location.length){var i=new Array(3).fill(null);i[bt.ON]=this.location[bt.ON],i[bt.LEFT]=V.NONE,i[bt.RIGHT]=V.NONE,this.location=i}for(var s=0;s<this.location.length;s++)this.location[s]===V.NONE&&s<n.location.length&&(this.location[s]=n.location[s])},dn.prototype.getLocations=function(){return this.location},dn.prototype.flip=function(){if(this.location.length<=1)return null;var n=this.location[bt.LEFT];this.location[bt.LEFT]=this.location[bt.RIGHT],this.location[bt.RIGHT]=n},dn.prototype.toString=function(){var n=new mt;return this.location.length>1&&n.append(V.toLocationSymbol(this.location[bt.LEFT])),n.append(V.toLocationSymbol(this.location[bt.ON])),this.location.length>1&&n.append(V.toLocationSymbol(this.location[bt.RIGHT])),n.toString()},dn.prototype.setLocations=function(n,i,s){this.location[bt.ON]=n,this.location[bt.LEFT]=i,this.location[bt.RIGHT]=s},dn.prototype.get=function(n){return n<this.location.length?this.location[n]:V.NONE},dn.prototype.isArea=function(){return this.location.length>1},dn.prototype.isAnyNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===V.NONE)return!0;return!1},dn.prototype.setLocation=function(){if(arguments.length===1){var n=arguments[0];this.setLocation(bt.ON,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.location[i]=s}},dn.prototype.init=function(n){this.location=new Array(n).fill(null),this.setAllLocations(V.NONE)},dn.prototype.isEqualOnSide=function(n,i){return this.location[i]===n.location[i]},dn.prototype.allPositionsEqual=function(n){for(var i=0;i<this.location.length;i++)if(this.location[i]!==n)return!1;return!0},dn.prototype.interfaces_=function(){return[]},dn.prototype.getClass=function(){return dn};var on=function n(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var i=arguments[0];this.elt[0]=new dn(i),this.elt[1]=new dn(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.elt[0]=new dn(s.elt[0]),this.elt[1]=new dn(s.elt[1])}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.elt[0]=new dn(V.NONE),this.elt[1]=new dn(V.NONE),this.elt[u].setLocation(c)}else if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];this.elt[0]=new dn(m,E,A),this.elt[1]=new dn(m,E,A)}else if(arguments.length===4){var U=arguments[0],K=arguments[1],pt=arguments[2],dt=arguments[3];this.elt[0]=new dn(V.NONE,V.NONE,V.NONE),this.elt[1]=new dn(V.NONE,V.NONE,V.NONE),this.elt[U].setLocations(K,pt,dt)}};on.prototype.getGeometryCount=function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n},on.prototype.setAllLocations=function(n,i){this.elt[n].setAllLocations(i)},on.prototype.isNull=function(n){return this.elt[n].isNull()},on.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var n=arguments[0];this.setAllLocationsIfNull(0,n),this.setAllLocationsIfNull(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.elt[i].setAllLocationsIfNull(s)}},on.prototype.isLine=function(n){return this.elt[n].isLine()},on.prototype.merge=function(n){for(var i=0;i<2;i++)this.elt[i]===null&&n.elt[i]!==null?this.elt[i]=new dn(n.elt[i]):this.elt[i].merge(n.elt[i])},on.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},on.prototype.getLocation=function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(bt.ON)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.elt[i].get(s)}},on.prototype.toString=function(){var n=new mt;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()},on.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var n=arguments[0];return this.elt[n].isArea()}},on.prototype.isAnyNull=function(n){return this.elt[n].isAnyNull()},on.prototype.setLocation=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setLocation(bt.ON,i)}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this.elt[s].setLocation(u,c)}},on.prototype.isEqualOnSide=function(n,i){return this.elt[0].isEqualOnSide(n.elt[0],i)&&this.elt[1].isEqualOnSide(n.elt[1],i)},on.prototype.allPositionsEqual=function(n,i){return this.elt[n].allPositionsEqual(i)},on.prototype.toLine=function(n){this.elt[n].isArea()&&(this.elt[n]=new dn(this.elt[n].location[0]))},on.prototype.interfaces_=function(){return[]},on.prototype.getClass=function(){return on},on.toLineLabel=function(n){for(var i=new on(V.NONE),s=0;s<2;s++)i.setLocation(s,n.getLocation(s));return i};var Un=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new Z,this._pts=new Z,this._label=new on(V.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new Z,this._geometryFactory=null;var n=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(n),this.computeRing()};Un.prototype.computeRing=function(){if(this._ring!==null)return null;for(var n=new Array(this._pts.size()).fill(null),i=0;i<this._pts.size();i++)n[i]=this._pts.get(i);this._ring=this._geometryFactory.createLinearRing(n),this._isHole=J.isCCW(this._ring.getCoordinates())},Un.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},Un.prototype.computePoints=function(n){this._startDe=n;var i=n,s=!0;do{if(i===null)throw new lo("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new lo("Directed Edge visited twice during ring-building at "+i.getCoordinate());this._edges.add(i);var u=i.getLabel();Pt.isTrue(u.isArea()),this.mergeLabel(u),this.addPoints(i.getEdge(),i.isForward(),s),s=!1,this.setEdgeRing(i,this),i=this.getNext(i)}while(i!==this._startDe)},Un.prototype.getLinearRing=function(){return this._ring},Un.prototype.getCoordinate=function(n){return this._pts.get(n)},Un.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var n=this._startDe;do{var i=n.getNode().getEdges().getOutgoingDegree(this);i>this._maxNodeDegree&&(this._maxNodeDegree=i),n=this.getNext(n)}while(n!==this._startDe);this._maxNodeDegree*=2},Un.prototype.addPoints=function(n,i,s){var u=n.getCoordinates();if(i){var c=1;s&&(c=0);for(var m=c;m<u.length;m++)this._pts.add(u[m])}else{var E=u.length-2;s&&(E=u.length-1);for(var A=E;A>=0;A--)this._pts.add(u[A])}},Un.prototype.isHole=function(){return this._isHole},Un.prototype.setInResult=function(){var n=this._startDe;do n.getEdge().setInResult(!0),n=n.getNext();while(n!==this._startDe)},Un.prototype.containsPoint=function(n){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(n)||!J.isPointInRing(n,i.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();)if(s.next().containsPoint(n))return!1;return!0},Un.prototype.addHole=function(n){this._holes.add(n)},Un.prototype.isShell=function(){return this._shell===null},Un.prototype.getLabel=function(){return this._label},Un.prototype.getEdges=function(){return this._edges},Un.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Un.prototype.getShell=function(){return this._shell},Un.prototype.mergeLabel=function(){if(arguments.length===1){var n=arguments[0];this.mergeLabel(n,0),this.mergeLabel(n,1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=i.getLocation(s,bt.RIGHT);if(u===V.NONE)return null;if(this._label.getLocation(s)===V.NONE)return this._label.setLocation(s,u),null}},Un.prototype.setShell=function(n){this._shell=n,n!==null&&n.addHole(this)},Un.prototype.toPolygon=function(n){for(var i=new Array(this._holes.size()).fill(null),s=0;s<this._holes.size();s++)i[s]=this._holes.get(s).getLinearRing();return n.createPolygon(this.getLinearRing(),i)},Un.prototype.interfaces_=function(){return[]},Un.prototype.getClass=function(){return Un};var G1=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.setEdgeRing=function(s,u){s.setMinEdgeRing(u)},i.prototype.getNext=function(s){return s.getNextMin()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Un),V1=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildMinimalRings=function(){var s=new Z,u=this._startDe;do{if(u.getMinEdgeRing()===null){var c=new G1(u,this._geometryFactory);s.add(c)}u=u.getNext()}while(u!==this._startDe);return s},i.prototype.setEdgeRing=function(s,u){s.setEdgeRing(u)},i.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var s=this._startDe;do s.getNode().getEdges().linkMinimalDirectedEdges(this),s=s.getNext();while(s!==this._startDe)},i.prototype.getNext=function(s){return s.getNext()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Un),Jr=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._label=n}}};Jr.prototype.setVisited=function(n){this._isVisited=n},Jr.prototype.setInResult=function(n){this._isInResult=n},Jr.prototype.isCovered=function(){return this._isCovered},Jr.prototype.isCoveredSet=function(){return this._isCoveredSet},Jr.prototype.setLabel=function(n){this._label=n},Jr.prototype.getLabel=function(){return this._label},Jr.prototype.setCovered=function(n){this._isCovered=n,this._isCoveredSet=!0},Jr.prototype.updateIM=function(n){Pt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(n)},Jr.prototype.isInResult=function(){return this._isInResult},Jr.prototype.isVisited=function(){return this._isVisited},Jr.prototype.interfaces_=function(){return[]},Jr.prototype.getClass=function(){return Jr};var _l=function(n){function i(){n.call(this),this._coord=null,this._edges=null;var s=arguments[0],u=arguments[1];this._coord=s,this._edges=u,this._label=new on(0,V.NONE)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isIncidentEdgeInResult=function(){for(var s=this.getEdges().getEdges().iterator();s.hasNext();)if(s.next().getEdge().isInResult())return!0;return!1},i.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},i.prototype.getCoordinate=function(){return this._coord},i.prototype.print=function(s){s.println("node "+this._coord+" lbl: "+this._label)},i.prototype.computeIM=function(s){},i.prototype.computeMergedLocation=function(s,u){var c=V.NONE;if(c=this._label.getLocation(u),!s.isNull(u)){var m=s.getLocation(u);c!==V.BOUNDARY&&(c=m)}return c},i.prototype.setLabel=function(){if(arguments.length!==2)return n.prototype.setLabel.apply(this,arguments);var s=arguments[0],u=arguments[1];this._label===null?this._label=new on(s,u):this._label.setLocation(s,u)},i.prototype.getEdges=function(){return this._edges},i.prototype.mergeLabel=function(){if(arguments[0]instanceof i){var s=arguments[0];this.mergeLabel(s._label)}else if(arguments[0]instanceof on)for(var u=arguments[0],c=0;c<2;c++){var m=this.computeMergedLocation(u,c);this._label.getLocation(c)===V.NONE&&this._label.setLocation(c,m)}},i.prototype.add=function(s){this._edges.insert(s),s.setNode(this)},i.prototype.setLabelBoundary=function(s){if(this._label===null)return null;var u=V.NONE;this._label!==null&&(u=this._label.getLocation(s));var c=null;switch(u){case V.BOUNDARY:c=V.INTERIOR;break;case V.INTERIOR:default:c=V.BOUNDARY}this._label.setLocation(s,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Jr),Ii=function(){this.nodeMap=new _,this.nodeFact=null;var n=arguments[0];this.nodeFact=n};Ii.prototype.find=function(n){return this.nodeMap.get(n)},Ii.prototype.addNode=function(){if(arguments[0]instanceof I){var n=arguments[0],i=this.nodeMap.get(n);return i===null&&(i=this.nodeFact.createNode(n),this.nodeMap.put(n,i)),i}if(arguments[0]instanceof _l){var s=arguments[0],u=this.nodeMap.get(s.getCoordinate());return u===null?(this.nodeMap.put(s.getCoordinate(),s),s):(u.mergeLabel(s),u)}},Ii.prototype.print=function(n){for(var i=this.iterator();i.hasNext();)i.next().print(n)},Ii.prototype.iterator=function(){return this.nodeMap.values().iterator()},Ii.prototype.values=function(){return this.nodeMap.values()},Ii.prototype.getBoundaryNodes=function(n){for(var i=new Z,s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().getLocation(n)===V.BOUNDARY&&i.add(u)}return i},Ii.prototype.add=function(n){var i=n.getCoordinate();this.addNode(i).add(n)},Ii.prototype.interfaces_=function(){return[]},Ii.prototype.getClass=function(){return Ii};var cn=function(){},_u={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};cn.prototype.interfaces_=function(){return[]},cn.prototype.getClass=function(){return cn},cn.isNorthern=function(n){return n===cn.NE||n===cn.NW},cn.isOpposite=function(n,i){return n===i?!1:(n-i+4)%4===2},cn.commonHalfPlane=function(n,i){if(n===i)return n;if((n-i+4)%4===2)return-1;var s=n<i?n:i;return s===0&&(n>i?n:i)===3?3:s},cn.isInHalfPlane=function(n,i){return i===cn.SE?n===cn.SE||n===cn.SW:n===i||n===i+1},cn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new P("Cannot compute the quadrant for point ( "+n+", "+i+" )");return n>=0?i>=0?cn.NE:cn.SE:i>=0?cn.NW:cn.SW}if(arguments[0]instanceof I&&arguments[1]instanceof I){var s=arguments[0],u=arguments[1];if(u.x===s.x&&u.y===s.y)throw new P("Cannot compute the quadrant for two identical points "+s);return u.x>=s.x?u.y>=s.y?cn.NE:cn.SE:u.y>=s.y?cn.NW:cn.SW}},_u.NE.get=function(){return 0},_u.NW.get=function(){return 1},_u.SW.get=function(){return 2},_u.SE.get=function(){return 3},Object.defineProperties(cn,_u);var sr=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2];this._edge=i,this.init(s,u),this._label=null}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];this._edge=c,this.init(m,E),this._label=A}};sr.prototype.compareDirection=function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:J.computeOrientation(n._p0,n._p1,this._p1)},sr.prototype.getDy=function(){return this._dy},sr.prototype.getCoordinate=function(){return this._p0},sr.prototype.setNode=function(n){this._node=n},sr.prototype.print=function(n){var i=Math.atan2(this._dy,this._dx),s=this.getClass().getName(),u=s.lastIndexOf("."),c=s.substring(u+1);n.print(" "+c+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)},sr.prototype.compareTo=function(n){var i=n;return this.compareDirection(i)},sr.prototype.getDirectedCoordinate=function(){return this._p1},sr.prototype.getDx=function(){return this._dx},sr.prototype.getLabel=function(){return this._label},sr.prototype.getEdge=function(){return this._edge},sr.prototype.getQuadrant=function(){return this._quadrant},sr.prototype.getNode=function(){return this._node},sr.prototype.toString=function(){var n=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),s=i.lastIndexOf(".");return" "+i.substring(s+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label},sr.prototype.computeLabel=function(n){},sr.prototype.init=function(n,i){this._p0=n,this._p1=i,this._dx=i.x-n.x,this._dy=i.y-n.y,this._quadrant=cn.quadrant(this._dx,this._dy),Pt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},sr.prototype.interfaces_=function(){return[N]},sr.prototype.getClass=function(){return sr};var xh=function(n){function i(){var s=arguments[0],u=arguments[1];if(n.call(this,s),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=u,u)this.init(s.getCoordinate(0),s.getCoordinate(1));else{var c=s.getNumPoints()-1;this.init(s.getCoordinate(c),s.getCoordinate(c-1))}this.computeDirectedLabel()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getNextMin=function(){return this._nextMin},i.prototype.getDepth=function(s){return this._depth[s]},i.prototype.setVisited=function(s){this._isVisited=s},i.prototype.computeDirectedLabel=function(){this._label=new on(this._edge.getLabel()),this._isForward||this._label.flip()},i.prototype.getNext=function(){return this._next},i.prototype.setDepth=function(s,u){if(this._depth[s]!==-999&&this._depth[s]!==u)throw new lo("assigned depths do not match",this.getCoordinate());this._depth[s]=u},i.prototype.isInteriorAreaEdge=function(){for(var s=!0,u=0;u<2;u++)this._label.isArea(u)&&this._label.getLocation(u,bt.LEFT)===V.INTERIOR&&this._label.getLocation(u,bt.RIGHT)===V.INTERIOR||(s=!1);return s},i.prototype.setNextMin=function(s){this._nextMin=s},i.prototype.print=function(s){n.prototype.print.call(this,s),s.print(" "+this._depth[bt.LEFT]+"/"+this._depth[bt.RIGHT]),s.print(" ("+this.getDepthDelta()+")"),this._isInResult&&s.print(" inResult")},i.prototype.setMinEdgeRing=function(s){this._minEdgeRing=s},i.prototype.isLineEdge=function(){var s=this._label.isLine(0)||this._label.isLine(1),u=!this._label.isArea(0)||this._label.allPositionsEqual(0,V.EXTERIOR),c=!this._label.isArea(1)||this._label.allPositionsEqual(1,V.EXTERIOR);return s&&u&&c},i.prototype.setEdgeRing=function(s){this._edgeRing=s},i.prototype.getMinEdgeRing=function(){return this._minEdgeRing},i.prototype.getDepthDelta=function(){var s=this._edge.getDepthDelta();return this._isForward||(s=-s),s},i.prototype.setInResult=function(s){this._isInResult=s},i.prototype.getSym=function(){return this._sym},i.prototype.isForward=function(){return this._isForward},i.prototype.getEdge=function(){return this._edge},i.prototype.printEdge=function(s){this.print(s),s.print(" "),this._isForward?this._edge.print(s):this._edge.printReverse(s)},i.prototype.setSym=function(s){this._sym=s},i.prototype.setVisitedEdge=function(s){this.setVisited(s),this._sym.setVisited(s)},i.prototype.setEdgeDepths=function(s,u){var c=this.getEdge().getDepthDelta();this._isForward||(c=-c);var m=1;s===bt.LEFT&&(m=-1);var E=bt.opposite(s),A=u+c*m;this.setDepth(s,u),this.setDepth(E,A)},i.prototype.getEdgeRing=function(){return this._edgeRing},i.prototype.isInResult=function(){return this._isInResult},i.prototype.setNext=function(s){this._next=s},i.prototype.isVisited=function(){return this._isVisited},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.depthFactor=function(s,u){return s===V.EXTERIOR&&u===V.INTERIOR?1:s===V.INTERIOR&&u===V.EXTERIOR?-1:0},i}(sr),la=function(){};la.prototype.createNode=function(n){return new _l(n,null)},la.prototype.interfaces_=function(){return[]},la.prototype.getClass=function(){return la};var Tn=function(){if(this._edges=new Z,this._nodes=null,this._edgeEndList=new Z,arguments.length===0)this._nodes=new Ii(new la);else if(arguments.length===1){var n=arguments[0];this._nodes=new Ii(n)}};Tn.prototype.printEdges=function(n){n.println("Edges:");for(var i=0;i<this._edges.size();i++){n.println("edge "+i+":");var s=this._edges.get(i);s.print(n),s.eiList.print(n)}},Tn.prototype.find=function(n){return this._nodes.find(n)},Tn.prototype.addNode=function(){if(arguments[0]instanceof _l){var n=arguments[0];return this._nodes.addNode(n)}if(arguments[0]instanceof I){var i=arguments[0];return this._nodes.addNode(i)}},Tn.prototype.getNodeIterator=function(){return this._nodes.iterator()},Tn.prototype.linkResultDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()},Tn.prototype.debugPrintln=function(n){Ft.out.println(n)},Tn.prototype.isBoundaryNode=function(n,i){var s=this._nodes.find(i);if(s===null)return!1;var u=s.getLabel();return u!==null&&u.getLocation(n)===V.BOUNDARY},Tn.prototype.linkAllDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkAllDirectedEdges()},Tn.prototype.matchInSameDirection=function(n,i,s,u){return!!n.equals(s)&&J.computeOrientation(n,i,u)===J.COLLINEAR&&cn.quadrant(n,i)===cn.quadrant(s,u)},Tn.prototype.getEdgeEnds=function(){return this._edgeEndList},Tn.prototype.debugPrint=function(n){Ft.out.print(n)},Tn.prototype.getEdgeIterator=function(){return this._edges.iterator()},Tn.prototype.findEdgeInSameDirection=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(this.matchInSameDirection(n,i,c[0],c[1])||this.matchInSameDirection(n,i,c[c.length-1],c[c.length-2]))return u}return null},Tn.prototype.insertEdge=function(n){this._edges.add(n)},Tn.prototype.findEdgeEnd=function(n){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var s=i.next();if(s.getEdge()===n)return s}return null},Tn.prototype.addEdges=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();this._edges.add(s);var u=new xh(s,!0),c=new xh(s,!1);u.setSym(c),c.setSym(u),this.add(u),this.add(c)}},Tn.prototype.add=function(n){this._nodes.add(n),this._edgeEndList.add(n)},Tn.prototype.getNodes=function(){return this._nodes.values()},Tn.prototype.findEdge=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(n.equals(c[0])&&i.equals(c[1]))return u}return null},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn},Tn.linkResultDirectedEdges=function(n){for(var i=n.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var Gr=function(){this._geometryFactory=null,this._shellList=new Z;var n=arguments[0];this._geometryFactory=n};Gr.prototype.sortShellsAndHoles=function(n,i,s){for(var u=n.iterator();u.hasNext();){var c=u.next();c.isHole()?s.add(c):i.add(c)}},Gr.prototype.computePolygons=function(n){for(var i=new Z,s=n.iterator();s.hasNext();){var u=s.next().toPolygon(this._geometryFactory);i.add(u)}return i},Gr.prototype.placeFreeHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();if(u.getShell()===null){var c=this.findEdgeRingContaining(u,n);if(c===null)throw new lo("unable to assign hole to a shell",u.getCoordinate(0));u.setShell(c)}}},Gr.prototype.buildMinimalEdgeRings=function(n,i,s){for(var u=new Z,c=n.iterator();c.hasNext();){var m=c.next();if(m.getMaxNodeDegree()>2){m.linkDirectedEdgesForMinimalEdgeRings();var E=m.buildMinimalRings(),A=this.findShell(E);A!==null?(this.placePolygonHoles(A,E),i.add(A)):s.addAll(E)}else u.add(m)}return u},Gr.prototype.containsPoint=function(n){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(n))return!0;return!1},Gr.prototype.buildMaximalEdgeRings=function(n){for(var i=new Z,s=n.iterator();s.hasNext();){var u=s.next();if(u.isInResult()&&u.getLabel().isArea()&&u.getEdgeRing()===null){var c=new V1(u,this._geometryFactory);i.add(c),c.setInResult()}}return i},Gr.prototype.placePolygonHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();u.isHole()&&u.setShell(n)}},Gr.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Gr.prototype.findEdgeRingContaining=function(n,i){for(var s=n.getLinearRing(),u=s.getEnvelopeInternal(),c=s.getCoordinateN(0),m=null,E=null,A=i.iterator();A.hasNext();){var U=A.next(),K=U.getLinearRing(),pt=K.getEnvelopeInternal();m!==null&&(E=m.getLinearRing().getEnvelopeInternal());var dt=!1;pt.contains(u)&&J.isPointInRing(c,K.getCoordinates())&&(dt=!0),dt&&(m===null||E.contains(pt))&&(m=U)}return m},Gr.prototype.findShell=function(n){for(var i=0,s=null,u=n.iterator();u.hasNext();){var c=u.next();c.isHole()||(s=c,i++)}return Pt.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),s},Gr.prototype.add=function(){if(arguments.length===1){var n=arguments[0];this.add(n.getEdgeEnds(),n.getNodes())}else if(arguments.length===2){var i=arguments[0],s=arguments[1];Tn.linkResultDirectedEdges(s);var u=this.buildMaximalEdgeRings(i),c=new Z,m=this.buildMinimalEdgeRings(u,this._shellList,c);this.sortShellsAndHoles(m,this._shellList,c),this.placeFreeHoles(this._shellList,c)}},Gr.prototype.interfaces_=function(){return[]},Gr.prototype.getClass=function(){return Gr};var ca=function(){};ca.prototype.getBounds=function(){},ca.prototype.interfaces_=function(){return[]},ca.prototype.getClass=function(){return ca};var vi=function(){this._bounds=null,this._item=null;var n=arguments[0],i=arguments[1];this._bounds=n,this._item=i};vi.prototype.getItem=function(){return this._item},vi.prototype.getBounds=function(){return this._bounds},vi.prototype.interfaces_=function(){return[ca,t]},vi.prototype.getClass=function(){return vi};var co=function(){this._size=null,this._items=null,this._size=0,this._items=new Z,this._items.add(null)};co.prototype.poll=function(){if(this.isEmpty())return null;var n=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),n},co.prototype.size=function(){return this._size},co.prototype.reorder=function(n){for(var i=null,s=this._items.get(n);2*n<=this._size&&((i=2*n)!==this._size&&this._items.get(i+1).compareTo(this._items.get(i))<0&&i++,this._items.get(i).compareTo(s)<0);n=i)this._items.set(n,this._items.get(i));this._items.set(n,s)},co.prototype.clear=function(){this._size=0,this._items.clear()},co.prototype.isEmpty=function(){return this._size===0},co.prototype.add=function(n){this._items.add(null),this._size+=1;var i=this._size;for(this._items.set(0,n);n.compareTo(this._items.get(Math.trunc(i/2)))<0;i/=2)this._items.set(i,this._items.get(Math.trunc(i/2)));this._items.set(i,n)},co.prototype.interfaces_=function(){return[]},co.prototype.getClass=function(){return co};var Ao=function(){};Ao.prototype.visitItem=function(n){},Ao.prototype.interfaces_=function(){return[]},Ao.prototype.getClass=function(){return Ao};var Ps=function(){};Ps.prototype.insert=function(n,i){},Ps.prototype.remove=function(n,i){},Ps.prototype.query=function(){},Ps.prototype.interfaces_=function(){return[]},Ps.prototype.getClass=function(){return Ps};var Hn=function(){if(this._childBoundables=new Z,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._level=n}}},Yd={serialVersionUID:{configurable:!0}};Hn.prototype.getLevel=function(){return this._level},Hn.prototype.size=function(){return this._childBoundables.size()},Hn.prototype.getChildBoundables=function(){return this._childBoundables},Hn.prototype.addChildBoundable=function(n){Pt.isTrue(this._bounds===null),this._childBoundables.add(n)},Hn.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Hn.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Hn.prototype.interfaces_=function(){return[ca,t]},Hn.prototype.getClass=function(){return Hn},Yd.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Hn,Yd);var _i=function(){};_i.reverseOrder=function(){return{compare:function(n,i){return i.compareTo(n)}}},_i.min=function(n){return _i.sort(n),n.get(0)},_i.sort=function(n,i){var s=n.toArray();i?xn.sort(s,i):xn.sort(s);for(var u=n.iterator(),c=0,m=s.length;c<m;c++)u.next(),u.set(s[c])},_i.singletonList=function(n){var i=new Z;return i.add(n),i};var Bn=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var n=arguments[0],i=arguments[1],s=arguments[2];this._boundable1=n,this._boundable2=i,this._itemDistance=s,this._distance=this.distance()};Bn.prototype.expandToQueue=function(n,i){var s=Bn.isComposite(this._boundable1),u=Bn.isComposite(this._boundable2);if(s&&u)return Bn.area(this._boundable1)>Bn.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,n,i),null):(this.expand(this._boundable2,this._boundable1,n,i),null);if(s)return this.expand(this._boundable1,this._boundable2,n,i),null;if(u)return this.expand(this._boundable2,this._boundable1,n,i),null;throw new P("neither boundable is composite")},Bn.prototype.isLeaves=function(){return!(Bn.isComposite(this._boundable1)||Bn.isComposite(this._boundable2))},Bn.prototype.compareTo=function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0},Bn.prototype.expand=function(n,i,s,u){for(var c=n.getChildBoundables().iterator();c.hasNext();){var m=c.next(),E=new Bn(m,i,this._itemDistance);E.getDistance()<u&&s.add(E)}},Bn.prototype.getBoundable=function(n){return n===0?this._boundable1:this._boundable2},Bn.prototype.getDistance=function(){return this._distance},Bn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Bn.prototype.interfaces_=function(){return[N]},Bn.prototype.getClass=function(){return Bn},Bn.area=function(n){return n.getBounds().getArea()},Bn.isComposite=function(n){return n instanceof Hn};var Jn=function n(){if(this._root=null,this._built=!1,this._itemBoundables=new Z,this._nodeCapacity=null,arguments.length===0){var i=n.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var s=arguments[0];Pt.isTrue(s>1,"Node capacity must be greater than 1"),this._nodeCapacity=s}},xl={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Jn.prototype.getNodeCapacity=function(){return this._nodeCapacity},Jn.prototype.lastNode=function(n){return n.get(n.size()-1)},Jn.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof Hn?n+=this.size(s):s instanceof vi&&(n+=1)}return n}},Jn.prototype.removeItem=function(n,i){for(var s=null,u=n.getChildBoundables().iterator();u.hasNext();){var c=u.next();c instanceof vi&&c.getItem()===i&&(s=c)}return s!==null&&(n.getChildBoundables().remove(s),!0)},Jn.prototype.itemsTree=function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new Z:n}if(arguments.length===1){for(var i=arguments[0],s=new Z,u=i.getChildBoundables().iterator();u.hasNext();){var c=u.next();if(c instanceof Hn){var m=this.itemsTree(c);m!==null&&s.add(m)}else c instanceof vi?s.add(c.getItem()):Pt.shouldNeverReachHere()}return s.size()<=0?null:s}},Jn.prototype.insert=function(n,i){Pt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new vi(n,i))},Jn.prototype.boundablesAtLevel=function(){if(arguments.length===1){var n=arguments[0],i=new Z;return this.boundablesAtLevel(n,this._root,i),i}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];if(Pt.isTrue(s>-2),u.getLevel()===s)return c.add(u),null;for(var m=u.getChildBoundables().iterator();m.hasNext();){var E=m.next();E instanceof Hn?this.boundablesAtLevel(s,E,c):(Pt.isTrue(E instanceof vi),s===-1&&c.add(E))}return null}},Jn.prototype.query=function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new Z;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i),i}if(arguments.length===2){var s=arguments[0],u=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,u)}else if(arguments.length===3){if($(arguments[2],Ao)&&arguments[0]instanceof Object&&arguments[1]instanceof Hn)for(var c=arguments[0],m=arguments[1],E=arguments[2],A=m.getChildBoundables(),U=0;U<A.size();U++){var K=A.get(U);this.getIntersectsOp().intersects(K.getBounds(),c)&&(K instanceof Hn?this.query(c,K,E):K instanceof vi?E.visitItem(K.getItem()):Pt.shouldNeverReachHere())}else if($(arguments[2],tt)&&arguments[0]instanceof Object&&arguments[1]instanceof Hn)for(var pt=arguments[0],dt=arguments[1],Rt=arguments[2],Ot=dt.getChildBoundables(),Vt=0;Vt<Ot.size();Vt++){var jt=Ot.get(Vt);this.getIntersectsOp().intersects(jt.getBounds(),pt)&&(jt instanceof Hn?this.query(pt,jt,Rt):jt instanceof vi?Rt.add(jt.getItem()):Pt.shouldNeverReachHere())}}},Jn.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},Jn.prototype.getRoot=function(){return this.build(),this._root},Jn.prototype.remove=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,i)}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=this.removeItem(u,c);if(m)return!0;for(var E=null,A=u.getChildBoundables().iterator();A.hasNext();){var U=A.next();if(this.getIntersectsOp().intersects(U.getBounds(),s)&&U instanceof Hn&&(m=this.remove(s,U,c))){E=U;break}}return E!==null&&E.getChildBoundables().isEmpty()&&u.getChildBoundables().remove(E),m}},Jn.prototype.createHigherLevels=function(n,i){Pt.isTrue(!n.isEmpty());var s=this.createParentBoundables(n,i+1);return s.size()===1?s.get(0):this.createHigherLevels(s,i+1)},Jn.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();if(s instanceof Hn){var u=this.depth(s);u>n&&(n=u)}}return n+1}},Jn.prototype.createParentBoundables=function(n,i){Pt.isTrue(!n.isEmpty());var s=new Z;s.add(this.createNode(i));var u=new Z(n);_i.sort(u,this.getComparator());for(var c=u.iterator();c.hasNext();){var m=c.next();this.lastNode(s).getChildBoundables().size()===this.getNodeCapacity()&&s.add(this.createNode(i)),this.lastNode(s).addChildBoundable(m)}return s},Jn.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Jn.prototype.interfaces_=function(){return[t]},Jn.prototype.getClass=function(){return Jn},Jn.compareDoubles=function(n,i){return n>i?1:n<i?-1:0},xl.IntersectsOp.get=function(){return H1},xl.serialVersionUID.get=function(){return-3886435814360241e3},xl.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Jn,xl);var H1=function(){},ha=function(){};ha.prototype.distance=function(n,i){},ha.prototype.interfaces_=function(){return[]},ha.prototype.getClass=function(){return ha};var $d=function(n){function i(u){u=u||i.DEFAULT_NODE_CAPACITY,n.call(this,u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return i.prototype.createParentBoundablesFromVerticalSlices=function(u,c){Pt.isTrue(u.length>0);for(var m=new Z,E=0;E<u.length;E++)m.addAll(this.createParentBoundablesFromVerticalSlice(u[E],c));return m},i.prototype.createNode=function(u){return new Zd(u)},i.prototype.size=function(){return arguments.length===0?n.prototype.size.call(this):n.prototype.size.apply(this,arguments)},i.prototype.insert=function(){if(arguments.length!==2)return n.prototype.insert.apply(this,arguments);var u=arguments[0],c=arguments[1];if(u.isNull())return null;n.prototype.insert.call(this,u,c)},i.prototype.getIntersectsOp=function(){return i.intersectsOp},i.prototype.verticalSlices=function(u,c){for(var m=Math.trunc(Math.ceil(u.size()/c)),E=new Array(c).fill(null),A=u.iterator(),U=0;U<c;U++){E[U]=new Z;for(var K=0;A.hasNext()&&K<m;){var pt=A.next();E[U].add(pt),K++}}return E},i.prototype.query=function(){if(arguments.length===1){var u=arguments[0];return n.prototype.query.call(this,u)}if(arguments.length===2){var c=arguments[0],m=arguments[1];n.prototype.query.call(this,c,m)}else if(arguments.length===3){if($(arguments[2],Ao)&&arguments[0]instanceof Object&&arguments[1]instanceof Hn){var E=arguments[0],A=arguments[1],U=arguments[2];n.prototype.query.call(this,E,A,U)}else if($(arguments[2],tt)&&arguments[0]instanceof Object&&arguments[1]instanceof Hn){var K=arguments[0],pt=arguments[1],dt=arguments[2];n.prototype.query.call(this,K,pt,dt)}}},i.prototype.getComparator=function(){return i.yComparator},i.prototype.createParentBoundablesFromVerticalSlice=function(u,c){return n.prototype.createParentBoundables.call(this,u,c)},i.prototype.remove=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return n.prototype.remove.call(this,u,c)}return n.prototype.remove.apply(this,arguments)},i.prototype.depth=function(){return arguments.length===0?n.prototype.depth.call(this):n.prototype.depth.apply(this,arguments)},i.prototype.createParentBoundables=function(u,c){Pt.isTrue(!u.isEmpty());var m=Math.trunc(Math.ceil(u.size()/this.getNodeCapacity())),E=new Z(u);_i.sort(E,i.xComparator);var A=this.verticalSlices(E,Math.trunc(Math.ceil(Math.sqrt(m))));return this.createParentBoundablesFromVerticalSlices(A,c)},i.prototype.nearestNeighbour=function(){if(arguments.length===1){if($(arguments[0],ha)){var u=arguments[0],c=new Bn(this.getRoot(),this.getRoot(),u);return this.nearestNeighbour(c)}if(arguments[0]instanceof Bn){var m=arguments[0];return this.nearestNeighbour(m,S.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&$(arguments[1],ha)){var E=arguments[0],A=arguments[1],U=new Bn(this.getRoot(),E.getRoot(),A);return this.nearestNeighbour(U)}if(arguments[0]instanceof Bn&&typeof arguments[1]=="number"){var K=arguments[0],pt=arguments[1],dt=null,Rt=new co;for(Rt.add(K);!Rt.isEmpty()&&pt>0;){var Ot=Rt.poll(),Vt=Ot.getDistance();if(Vt>=pt)break;Ot.isLeaves()?(pt=Vt,dt=Ot):Ot.expandToQueue(Rt,pt)}return[dt.getBoundable(0).getItem(),dt.getBoundable(1).getItem()]}}else if(arguments.length===3){var jt=arguments[0],sn=arguments[1],kn=arguments[2],Mr=new vi(jt,sn),Ki=new Bn(this.getRoot(),Mr,kn);return this.nearestNeighbour(Ki)[0]}},i.prototype.interfaces_=function(){return[Ps,t]},i.prototype.getClass=function(){return i},i.centreX=function(u){return i.avg(u.getMinX(),u.getMaxX())},i.avg=function(u,c){return(u+c)/2},i.centreY=function(u){return i.avg(u.getMinY(),u.getMaxY())},s.STRtreeNode.get=function(){return Zd},s.serialVersionUID.get=function(){return 0x39920f7d5f261e0},s.xComparator.get=function(){return{interfaces_:function(){return[B]},compare:function(u,c){return n.compareDoubles(i.centreX(u.getBounds()),i.centreX(c.getBounds()))}}},s.yComparator.get=function(){return{interfaces_:function(){return[B]},compare:function(u,c){return n.compareDoubles(i.centreY(u.getBounds()),i.centreY(c.getBounds()))}}},s.intersectsOp.get=function(){return{interfaces_:function(){return[n.IntersectsOp]},intersects:function(u,c){return u.intersects(c)}}},s.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(i,s),i}(Jn),Zd=function(n){function i(){var s=arguments[0];n.call(this,s)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.computeBounds=function(){for(var s=null,u=this.getChildBoundables().iterator();u.hasNext();){var c=u.next();s===null?s=new Ct(c.getBounds()):s.expandToInclude(c.getBounds())}return s},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Hn),Ir=function(){};Ir.prototype.interfaces_=function(){return[]},Ir.prototype.getClass=function(){return Ir},Ir.relativeSign=function(n,i){return n<i?-1:n>i?1:0},Ir.compare=function(n,i,s){if(i.equals2D(s))return 0;var u=Ir.relativeSign(i.x,s.x),c=Ir.relativeSign(i.y,s.y);switch(n){case 0:return Ir.compareValue(u,c);case 1:return Ir.compareValue(c,u);case 2:return Ir.compareValue(c,-u);case 3:return Ir.compareValue(-u,c);case 4:return Ir.compareValue(-u,-c);case 5:return Ir.compareValue(-c,-u);case 6:return Ir.compareValue(-c,u);case 7:return Ir.compareValue(u,-c)}return Pt.shouldNeverReachHere("invalid octant value"),0},Ir.compareValue=function(n,i){return n<0?-1:n>0?1:i<0?-1:i>0?1:0};var Co=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._segString=n,this.coord=new I(i),this.segmentIndex=s,this._segmentOctant=u,this._isInterior=!i.equals2D(n.getCoordinate(s))};Co.prototype.getCoordinate=function(){return this.coord},Co.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex)},Co.prototype.compareTo=function(n){var i=n;return this.segmentIndex<i.segmentIndex?-1:this.segmentIndex>i.segmentIndex?1:this.coord.equals2D(i.coord)?0:Ir.compare(this._segmentOctant,this.coord,i.coord)},Co.prototype.isEndPoint=function(n){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===n},Co.prototype.isInterior=function(){return this._isInterior},Co.prototype.interfaces_=function(){return[N]},Co.prototype.getClass=function(){return Co};var gr=function(){this._nodeMap=new _,this._edge=null;var n=arguments[0];this._edge=n};gr.prototype.getSplitCoordinates=function(){var n=new ot;this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next();this.addEdgeCoordinates(s,u,n),s=u}return n.toCoordinateArray()},gr.prototype.addCollapsedNodes=function(){var n=new Z;this.findCollapsesFromInsertedNodes(n),this.findCollapsesFromExistingVertices(n);for(var i=n.iterator();i.hasNext();){var s=i.next().intValue();this.add(this._edge.getCoordinate(s),s)}},gr.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},gr.prototype.findCollapsesFromExistingVertices=function(n){for(var i=0;i<this._edge.size()-2;i++){var s=this._edge.getCoordinate(i),u=this._edge.getCoordinate(i+2);s.equals2D(u)&&n.add(new lt(i+1))}},gr.prototype.addEdgeCoordinates=function(n,i,s){var u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);s.add(new I(n.coord),!1);for(var m=n.segmentIndex+1;m<=i.segmentIndex;m++)s.add(this._edge.getCoordinate(m));c&&s.add(new I(i.coord))},gr.prototype.iterator=function(){return this._nodeMap.values().iterator()},gr.prototype.addSplitEdges=function(n){this.addEndpoints(),this.addCollapsedNodes();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next(),c=this.createSplitEdge(s,u);n.add(c),s=u}},gr.prototype.findCollapseIndex=function(n,i,s){if(!n.coord.equals2D(i.coord))return!1;var u=i.segmentIndex-n.segmentIndex;return i.isInterior()||u--,u===1&&(s[0]=n.segmentIndex+1,!0)},gr.prototype.findCollapsesFromInsertedNodes=function(n){for(var i=new Array(1).fill(null),s=this.iterator(),u=s.next();s.hasNext();){var c=s.next();this.findCollapseIndex(u,c,i)&&n.add(new lt(i[0])),u=c}},gr.prototype.getEdge=function(){return this._edge},gr.prototype.addEndpoints=function(){var n=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(n),n)},gr.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);c||s--;var m=new Array(s).fill(null),E=0;m[E++]=new I(n.coord);for(var A=n.segmentIndex+1;A<=i.segmentIndex;A++)m[E++]=this._edge.getCoordinate(A);return c&&(m[E]=new I(i.coord)),new Nn(m,this._edge.getData())},gr.prototype.add=function(n,i){var s=new Co(this._edge,n,i,this._edge.getSegmentOctant(i)),u=this._nodeMap.get(s);return u!==null?(Pt.isTrue(u.coord.equals2D(n),"Found equal nodes with different coordinates"),u):(this._nodeMap.put(s,s),s)},gr.prototype.checkSplitEdgesCorrectness=function(n){var i=this._edge.getCoordinates(),s=n.get(0).getCoordinate(0);if(!s.equals2D(i[0]))throw new pe("bad split edge start point at "+s);var u=n.get(n.size()-1).getCoordinates(),c=u[u.length-1];if(!c.equals2D(i[i.length-1]))throw new pe("bad split edge end point at "+c)},gr.prototype.interfaces_=function(){return[]},gr.prototype.getClass=function(){return gr};var Is=function(){};Is.prototype.interfaces_=function(){return[]},Is.prototype.getClass=function(){return Is},Is.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new P("Cannot compute the octant for point ( "+n+", "+i+" )");var s=Math.abs(n),u=Math.abs(i);return n>=0?i>=0?s>=u?0:1:s>=u?7:6:i>=0?s>=u?3:2:s>=u?4:5}if(arguments[0]instanceof I&&arguments[1]instanceof I){var c=arguments[0],m=arguments[1],E=m.x-c.x,A=m.y-c.y;if(E===0&&A===0)throw new P("Cannot compute the octant for two identical points "+c);return Is.octant(E,A)}};var Hi=function(){};Hi.prototype.getCoordinates=function(){},Hi.prototype.size=function(){},Hi.prototype.getCoordinate=function(n){},Hi.prototype.isClosed=function(){},Hi.prototype.setData=function(n){},Hi.prototype.getData=function(){},Hi.prototype.interfaces_=function(){return[]},Hi.prototype.getClass=function(){return Hi};var xu=function(){};xu.prototype.addIntersection=function(n,i){},xu.prototype.interfaces_=function(){return[Hi]},xu.prototype.getClass=function(){return xu};var Nn=function(){this._nodeList=new gr(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};Nn.prototype.getCoordinates=function(){return this._pts},Nn.prototype.size=function(){return this._pts.length},Nn.prototype.getCoordinate=function(n){return this._pts[n]},Nn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Nn.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))},Nn.prototype.setData=function(n){this._data=n},Nn.prototype.safeOctant=function(n,i){return n.equals2D(i)?0:Is.octant(n,i)},Nn.prototype.getData=function(){return this._data},Nn.prototype.addIntersection=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.addIntersectionNode(n,i)}else if(arguments.length===4){var s=arguments[0],u=arguments[1],c=arguments[3],m=new I(s.getIntersection(c));this.addIntersection(m,u)}},Nn.prototype.toString=function(){return Yt.toLineString(new fe(this._pts))},Nn.prototype.getNodeList=function(){return this._nodeList},Nn.prototype.addIntersectionNode=function(n,i){var s=i,u=s+1;if(u<this._pts.length){var c=this._pts[u];n.equals2D(c)&&(s=u)}return this._nodeList.add(n,s)},Nn.prototype.addIntersections=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++)this.addIntersection(n,i,s,u)},Nn.prototype.interfaces_=function(){return[xu]},Nn.prototype.getClass=function(){return Nn},Nn.getNodedSubstrings=function(){if(arguments.length===1){var n=arguments[0],i=new Z;return Nn.getNodedSubstrings(n,i),i}if(arguments.length===2)for(var s=arguments[0],u=arguments[1],c=s.iterator();c.hasNext();)c.next().getNodeList().addSplitEdges(u)};var Zt=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new I,this.p1=new I;else if(arguments.length===1){var n=arguments[0];this.p0=new I(n.p0),this.p1=new I(n.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var i=arguments[0],s=arguments[1],u=arguments[2],c=arguments[3];this.p0=new I(i,s),this.p1=new I(u,c)}},Jd={serialVersionUID:{configurable:!0}};Zt.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Zt.prototype.orientationIndex=function(){if(arguments[0]instanceof Zt){var n=arguments[0],i=J.orientationIndex(this.p0,this.p1,n.p0),s=J.orientationIndex(this.p0,this.p1,n.p1);return i>=0&&s>=0||i<=0&&s<=0?Math.max(i,s):0}if(arguments[0]instanceof I){var u=arguments[0];return J.orientationIndex(this.p0,this.p1,u)}},Zt.prototype.toGeometry=function(n){return n.createLineString([this.p0,this.p1])},Zt.prototype.isVertical=function(){return this.p0.x===this.p1.x},Zt.prototype.equals=function(n){if(!(n instanceof Zt))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},Zt.prototype.intersection=function(n){var i=new pn;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null},Zt.prototype.project=function(){if(arguments[0]instanceof I){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new I(n);var i=this.projectionFactor(n),s=new I;return s.x=this.p0.x+i*(this.p1.x-this.p0.x),s.y=this.p0.y+i*(this.p1.y-this.p0.y),s}if(arguments[0]instanceof Zt){var u=arguments[0],c=this.projectionFactor(u.p0),m=this.projectionFactor(u.p1);if(c>=1&&m>=1||c<=0&&m<=0)return null;var E=this.project(u.p0);c<0&&(E=this.p0),c>1&&(E=this.p1);var A=this.project(u.p1);return m<0&&(A=this.p0),m>1&&(A=this.p1),new Zt(E,A)}},Zt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Zt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Zt.prototype.getCoordinate=function(n){return n===0?this.p0:this.p1},Zt.prototype.distancePerpendicular=function(n){return J.distancePointLinePerpendicular(n,this.p0,this.p1)},Zt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Zt.prototype.midPoint=function(){return Zt.midPoint(this.p0,this.p1)},Zt.prototype.projectionFactor=function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var i=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,u=i*i+s*s;return u<=0?S.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*s)/u},Zt.prototype.closestPoints=function(n){var i=this.intersection(n);if(i!==null)return[i,i];var s=new Array(2).fill(null),u=S.MAX_VALUE,c=null,m=this.closestPoint(n.p0);u=m.distance(n.p0),s[0]=m,s[1]=n.p0;var E=this.closestPoint(n.p1);(c=E.distance(n.p1))<u&&(u=c,s[0]=E,s[1]=n.p1);var A=n.closestPoint(this.p0);(c=A.distance(this.p0))<u&&(u=c,s[0]=this.p0,s[1]=A);var U=n.closestPoint(this.p1);return(c=U.distance(this.p1))<u&&(u=c,s[0]=this.p1,s[1]=U),s},Zt.prototype.closestPoint=function(n){var i=this.projectionFactor(n);return i>0&&i<1?this.project(n):this.p0.distance(n)<this.p1.distance(n)?this.p0:this.p1},Zt.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Zt.prototype.getLength=function(){return this.p0.distance(this.p1)},Zt.prototype.compareTo=function(n){var i=n,s=this.p0.compareTo(i.p0);return s!==0?s:this.p1.compareTo(i.p1)},Zt.prototype.reverse=function(){var n=this.p0;this.p0=this.p1,this.p1=n},Zt.prototype.equalsTopo=function(n){return this.p0.equals(n.p0)&&(this.p1.equals(n.p1)||this.p0.equals(n.p1))&&this.p1.equals(n.p0)},Zt.prototype.lineIntersection=function(n){try{return Qt.intersection(this.p0,this.p1,n.p0,n.p1)}catch(i){if(!(i instanceof Xt))throw i}return null},Zt.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Zt.prototype.pointAlongOffset=function(n,i){var s=this.p0.x+n*(this.p1.x-this.p0.x),u=this.p0.y+n*(this.p1.y-this.p0.y),c=this.p1.x-this.p0.x,m=this.p1.y-this.p0.y,E=Math.sqrt(c*c+m*m),A=0,U=0;if(i!==0){if(E<=0)throw new Error("Cannot compute offset from zero-length line segment");A=i*c/E,U=i*m/E}return new I(s-U,u+A)},Zt.prototype.setCoordinates=function(){if(arguments.length===1){var n=arguments[0];this.setCoordinates(n.p0,n.p1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.p0.x=i.x,this.p0.y=i.y,this.p1.x=s.x,this.p1.y=s.y}},Zt.prototype.segmentFraction=function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||S.isNaN(i))&&(i=1),i},Zt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Zt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Zt.prototype.distance=function(){if(arguments[0]instanceof Zt){var n=arguments[0];return J.distanceLineLine(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof I){var i=arguments[0];return J.distancePointLine(i,this.p0,this.p1)}},Zt.prototype.pointAlong=function(n){var i=new I;return i.x=this.p0.x+n*(this.p1.x-this.p0.x),i.y=this.p0.y+n*(this.p1.y-this.p0.y),i},Zt.prototype.hashCode=function(){var n=S.doubleToLongBits(this.p0.x);n^=31*S.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),s=S.doubleToLongBits(this.p1.x);return s^=31*S.doubleToLongBits(this.p1.y),i^(Math.trunc(s)^Math.trunc(s>>32))},Zt.prototype.interfaces_=function(){return[N,t]},Zt.prototype.getClass=function(){return Zt},Zt.midPoint=function(n,i){return new I((n.x+i.x)/2,(n.y+i.y)/2)},Jd.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Zt,Jd);var Eu=function(){this.tempEnv1=new Ct,this.tempEnv2=new Ct,this._overlapSeg1=new Zt,this._overlapSeg2=new Zt};Eu.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];n.getLineSegment(i,this._overlapSeg1),s.getLineSegment(u,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},Eu.prototype.interfaces_=function(){return[]},Eu.prototype.getClass=function(){return Eu};var Vr=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._pts=n,this._start=i,this._end=s,this._context=u};Vr.prototype.getLineSegment=function(n,i){i.p0=this._pts[n],i.p1=this._pts[n+1]},Vr.prototype.computeSelect=function(n,i,s,u){var c=this._pts[i],m=this._pts[s];if(u.tempEnv1.init(c,m),s-i==1)return u.select(this,i),null;if(!n.intersects(u.tempEnv1))return null;var E=Math.trunc((i+s)/2);i<E&&this.computeSelect(n,i,E,u),E<s&&this.computeSelect(n,E,s,u)},Vr.prototype.getCoordinates=function(){for(var n=new Array(this._end-this._start+1).fill(null),i=0,s=this._start;s<=this._end;s++)n[i++]=this._pts[s];return n},Vr.prototype.computeOverlaps=function(n,i){this.computeOverlapsInternal(this._start,this._end,n,n._start,n._end,i)},Vr.prototype.setId=function(n){this._id=n},Vr.prototype.select=function(n,i){this.computeSelect(n,this._start,this._end,i)},Vr.prototype.getEnvelope=function(){if(this._env===null){var n=this._pts[this._start],i=this._pts[this._end];this._env=new Ct(n,i)}return this._env},Vr.prototype.getEndIndex=function(){return this._end},Vr.prototype.getStartIndex=function(){return this._start},Vr.prototype.getContext=function(){return this._context},Vr.prototype.getId=function(){return this._id},Vr.prototype.computeOverlapsInternal=function(n,i,s,u,c,m){var E=this._pts[n],A=this._pts[i],U=s._pts[u],K=s._pts[c];if(i-n==1&&c-u==1)return m.overlap(this,n,s,u),null;if(m.tempEnv1.init(E,A),m.tempEnv2.init(U,K),!m.tempEnv1.intersects(m.tempEnv2))return null;var pt=Math.trunc((n+i)/2),dt=Math.trunc((u+c)/2);n<pt&&(u<dt&&this.computeOverlapsInternal(n,pt,s,u,dt,m),dt<c&&this.computeOverlapsInternal(n,pt,s,dt,c,m)),pt<i&&(u<dt&&this.computeOverlapsInternal(pt,i,s,u,dt,m),dt<c&&this.computeOverlapsInternal(pt,i,s,dt,c,m))},Vr.prototype.interfaces_=function(){return[]},Vr.prototype.getClass=function(){return Vr};var Ri=function(){};Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri},Ri.getChainStartIndices=function(n){var i=0,s=new Z;s.add(new lt(i));do{var u=Ri.findChainEnd(n,i);s.add(new lt(u)),i=u}while(i<n.length-1);return Ri.toIntArray(s)},Ri.findChainEnd=function(n,i){for(var s=i;s<n.length-1&&n[s].equals2D(n[s+1]);)s++;if(s>=n.length-1)return n.length-1;for(var u=cn.quadrant(n[s],n[s+1]),c=i+1;c<n.length&&!(!n[c-1].equals2D(n[c])&&cn.quadrant(n[c-1],n[c])!==u);)c++;return c-1},Ri.getChains=function(){if(arguments.length===1){var n=arguments[0];return Ri.getChains(n,null)}if(arguments.length===2){for(var i=arguments[0],s=arguments[1],u=new Z,c=Ri.getChainStartIndices(i),m=0;m<c.length-1;m++){var E=new Vr(i,c[m],c[m+1],s);u.add(E)}return u}},Ri.toIntArray=function(n){for(var i=new Array(n.size()).fill(null),s=0;s<i.length;s++)i[s]=n.get(s).intValue();return i};var Qo=function(){};Qo.prototype.computeNodes=function(n){},Qo.prototype.getNodedSubstrings=function(){},Qo.prototype.interfaces_=function(){return[]},Qo.prototype.getClass=function(){return Qo};var Mu=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setSegmentIntersector(n)}}};Mu.prototype.setSegmentIntersector=function(n){this._segInt=n},Mu.prototype.interfaces_=function(){return[Qo]},Mu.prototype.getClass=function(){return Mu};var Eh=function(n){function i(u){u?n.call(this,u):n.call(this),this._monoChains=new Z,this._index=new $d,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={SegmentOverlapAction:{configurable:!0}};return i.prototype.getMonotoneChains=function(){return this._monoChains},i.prototype.getNodedSubstrings=function(){return Nn.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(u){for(var c=Ri.getChains(u.getCoordinates(),u).iterator();c.hasNext();){var m=c.next();m.setId(this._idCounter++),this._index.insert(m.getEnvelope(),m),this._monoChains.add(m)}},i.prototype.computeNodes=function(u){this._nodedSegStrings=u;for(var c=u.iterator();c.hasNext();)this.add(c.next());this.intersectChains()},i.prototype.intersectChains=function(){for(var u=new Kd(this._segInt),c=this._monoChains.iterator();c.hasNext();)for(var m=c.next(),E=this._index.query(m.getEnvelope()).iterator();E.hasNext();){var A=E.next();if(A.getId()>m.getId()&&(m.computeOverlaps(A,u),this._nOverlaps++),this._segInt.isDone())return null}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.SegmentOverlapAction.get=function(){return Kd},Object.defineProperties(i,s),i}(Mu),Kd=function(n){function i(){n.call(this),this._si=null;var s=arguments[0];this._si=s}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.overlap=function(){if(arguments.length!==4)return n.prototype.overlap.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2],m=arguments[3],E=s.getContext(),A=c.getContext();this._si.processIntersections(E,u,A,m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Eu),We=function n(){if(this._quadrantSegments=n.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=n.CAP_ROUND,this._joinStyle=n.JOIN_ROUND,this._mitreLimit=n.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=n.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setQuadrantSegments(i)}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.setQuadrantSegments(s),this.setEndCapStyle(u)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];this.setQuadrantSegments(c),this.setEndCapStyle(m),this.setJoinStyle(E),this.setMitreLimit(A)}}},ho={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};We.prototype.getEndCapStyle=function(){return this._endCapStyle},We.prototype.isSingleSided=function(){return this._isSingleSided},We.prototype.setQuadrantSegments=function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=We.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=We.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==We.JOIN_ROUND&&(this._quadrantSegments=We.DEFAULT_QUADRANT_SEGMENTS)},We.prototype.getJoinStyle=function(){return this._joinStyle},We.prototype.setJoinStyle=function(n){this._joinStyle=n},We.prototype.setSimplifyFactor=function(n){this._simplifyFactor=n<0?0:n},We.prototype.getSimplifyFactor=function(){return this._simplifyFactor},We.prototype.getQuadrantSegments=function(){return this._quadrantSegments},We.prototype.setEndCapStyle=function(n){this._endCapStyle=n},We.prototype.getMitreLimit=function(){return this._mitreLimit},We.prototype.setMitreLimit=function(n){this._mitreLimit=n},We.prototype.setSingleSided=function(n){this._isSingleSided=n},We.prototype.interfaces_=function(){return[]},We.prototype.getClass=function(){return We},We.bufferDistanceError=function(n){var i=Math.PI/2/n;return 1-Math.cos(i/2)},ho.CAP_ROUND.get=function(){return 1},ho.CAP_FLAT.get=function(){return 2},ho.CAP_SQUARE.get=function(){return 3},ho.JOIN_ROUND.get=function(){return 1},ho.JOIN_MITRE.get=function(){return 2},ho.JOIN_BEVEL.get=function(){return 3},ho.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},ho.DEFAULT_MITRE_LIMIT.get=function(){return 5},ho.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(We,ho);var In=function(n){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=J.COUNTERCLOCKWISE,this._inputLine=n||null},Su={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};In.prototype.isDeletable=function(n,i,s,u){var c=this._inputLine[n],m=this._inputLine[i],E=this._inputLine[s];return!!this.isConcave(c,m,E)&&!!this.isShallow(c,m,E,u)&&this.isShallowSampled(c,m,n,s,u)},In.prototype.deleteShallowConcavities=function(){for(var n=1,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i),u=!1;s<this._inputLine.length;){var c=!1;this.isDeletable(n,i,s,this._distanceTol)&&(this._isDeleted[i]=In.DELETE,c=!0,u=!0),n=c?s:i,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i)}return u},In.prototype.isShallowConcavity=function(n,i,s,u){return J.computeOrientation(n,i,s)!==this._angleOrientation?!1:J.distancePointLine(i,n,s)<u},In.prototype.isShallowSampled=function(n,i,s,u,c){var m=Math.trunc((u-s)/In.NUM_PTS_TO_CHECK);m<=0&&(m=1);for(var E=s;E<u;E+=m)if(!this.isShallow(n,i,this._inputLine[E],c))return!1;return!0},In.prototype.isConcave=function(n,i,s){var u=J.computeOrientation(n,i,s)===this._angleOrientation;return u},In.prototype.simplify=function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=J.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},In.prototype.findNextNonDeletedIndex=function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===In.DELETE;)i++;return i},In.prototype.isShallow=function(n,i,s,u){return J.distancePointLine(i,n,s)<u},In.prototype.collapseLine=function(){for(var n=new ot,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==In.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()},In.prototype.interfaces_=function(){return[]},In.prototype.getClass=function(){return In},In.simplify=function(n,i){return new In(n).simplify(i)},Su.INIT.get=function(){return 0},Su.DELETE.get=function(){return 1},Su.KEEP.get=function(){return 1},Su.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(In,Su);var Kr=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new Z},jd={COORDINATE_ARRAY_TYPE:{configurable:!0}};Kr.prototype.getCoordinates=function(){return this._ptList.toArray(Kr.COORDINATE_ARRAY_TYPE)},Kr.prototype.setPrecisionModel=function(n){this._precisionModel=n},Kr.prototype.addPt=function(n){var i=new I(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},Kr.prototype.revere=function(){},Kr.prototype.addPts=function(n,i){if(i)for(var s=0;s<n.length;s++)this.addPt(n[s]);else for(var u=n.length-1;u>=0;u--)this.addPt(n[u])},Kr.prototype.isRedundant=function(n){if(this._ptList.size()<1)return!1;var i=this._ptList.get(this._ptList.size()-1);return n.distance(i)<this._minimimVertexDistance},Kr.prototype.toString=function(){return new ue().createLineString(this.getCoordinates()).toString()},Kr.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var n=new I(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(n.equals(i))return null;this._ptList.add(n)},Kr.prototype.setMinimumVertexDistance=function(n){this._minimimVertexDistance=n},Kr.prototype.interfaces_=function(){return[]},Kr.prototype.getClass=function(){return Kr},jd.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Kr,jd);var me=function(){},Rs={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};me.prototype.interfaces_=function(){return[]},me.prototype.getClass=function(){return me},me.toDegrees=function(n){return 180*n/Math.PI},me.normalize=function(n){for(;n>Math.PI;)n-=me.PI_TIMES_2;for(;n<=-Math.PI;)n+=me.PI_TIMES_2;return n},me.angle=function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var i=arguments[0],s=arguments[1],u=s.x-i.x,c=s.y-i.y;return Math.atan2(c,u)}},me.isAcute=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)>0},me.isObtuse=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)<0},me.interiorAngle=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s);return Math.abs(c-u)},me.normalizePositive=function(n){if(n<0){for(;n<0;)n+=me.PI_TIMES_2;n>=me.PI_TIMES_2&&(n=0)}else{for(;n>=me.PI_TIMES_2;)n-=me.PI_TIMES_2;n<0&&(n=0)}return n},me.angleBetween=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s);return me.diff(u,c)},me.diff=function(n,i){var s=null;return(s=n<i?i-n:n-i)>Math.PI&&(s=2*Math.PI-s),s},me.toRadians=function(n){return n*Math.PI/180},me.getTurn=function(n,i){var s=Math.sin(i-n);return s>0?me.COUNTERCLOCKWISE:s<0?me.CLOCKWISE:me.NONE},me.angleBetweenOriented=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s)-u;return c<=-Math.PI?c+me.PI_TIMES_2:c>Math.PI?c-me.PI_TIMES_2:c},Rs.PI_TIMES_2.get=function(){return 2*Math.PI},Rs.PI_OVER_2.get=function(){return Math.PI/2},Rs.PI_OVER_4.get=function(){return Math.PI/4},Rs.COUNTERCLOCKWISE.get=function(){return J.COUNTERCLOCKWISE},Rs.CLOCKWISE.get=function(){return J.CLOCKWISE},Rs.NONE.get=function(){return J.COLLINEAR},Object.defineProperties(me,Rs);var vn=function n(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Zt,this._seg1=new Zt,this._offset0=new Zt,this._offset1=new Zt,this._side=0,this._hasNarrowConcaveAngle=!1;var i=arguments[0],s=arguments[1],u=arguments[2];this._precisionModel=i,this._bufParams=s,this._li=new pn,this._filletAngleQuantum=Math.PI/2/s.getQuadrantSegments(),s.getQuadrantSegments()>=8&&s.getJoinStyle()===We.JOIN_ROUND&&(this._closingSegLengthFactor=n.MAX_CLOSING_SEG_LEN_FACTOR),this.init(u)},wu={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};vn.prototype.addNextSegment=function(n,i){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var s=J.computeOrientation(this._s0,this._s1,this._s2),u=s===J.CLOCKWISE&&this._side===bt.LEFT||s===J.COUNTERCLOCKWISE&&this._side===bt.RIGHT;s===0?this.addCollinear(i):u?this.addOutsideTurn(s,i):this.addInsideTurn(s,i)},vn.prototype.addLineEndCap=function(n,i){var s=new Zt(n,i),u=new Zt;this.computeOffsetSegment(s,bt.LEFT,this._distance,u);var c=new Zt;this.computeOffsetSegment(s,bt.RIGHT,this._distance,c);var m=i.x-n.x,E=i.y-n.y,A=Math.atan2(E,m);switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:this._segList.addPt(u.p1),this.addFilletArc(i,A+Math.PI/2,A-Math.PI/2,J.CLOCKWISE,this._distance),this._segList.addPt(c.p1);break;case We.CAP_FLAT:this._segList.addPt(u.p1),this._segList.addPt(c.p1);break;case We.CAP_SQUARE:var U=new I;U.x=Math.abs(this._distance)*Math.cos(A),U.y=Math.abs(this._distance)*Math.sin(A);var K=new I(u.p1.x+U.x,u.p1.y+U.y),pt=new I(c.p1.x+U.x,c.p1.y+U.y);this._segList.addPt(K),this._segList.addPt(pt)}},vn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},vn.prototype.addMitreJoin=function(n,i,s,u){var c=!0,m=null;try{m=Qt.intersection(i.p0,i.p1,s.p0,s.p1),(u<=0?1:m.distance(n)/Math.abs(u))>this._bufParams.getMitreLimit()&&(c=!1)}catch(E){if(!(E instanceof Xt))throw E;m=new I(0,0),c=!1}c?this._segList.addPt(m):this.addLimitedMitreJoin(i,s,u,this._bufParams.getMitreLimit())},vn.prototype.addFilletCorner=function(n,i,s,u,c){var m=i.x-n.x,E=i.y-n.y,A=Math.atan2(E,m),U=s.x-n.x,K=s.y-n.y,pt=Math.atan2(K,U);u===J.CLOCKWISE?A<=pt&&(A+=2*Math.PI):A>=pt&&(A-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(n,A,pt,u,c),this._segList.addPt(s)},vn.prototype.addOutsideTurn=function(n,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*vn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===We.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===We.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(i&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))},vn.prototype.createSquare=function(n){this._segList.addPt(new I(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new I(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new I(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new I(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()},vn.prototype.addSegments=function(n,i){this._segList.addPts(n,i)},vn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},vn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},vn.prototype.initSideSegments=function(n,i,s){this._s1=n,this._s2=i,this._side=s,this._seg1.setCoordinates(n,i),this.computeOffsetSegment(this._seg1,s,this._distance,this._offset1)},vn.prototype.addLimitedMitreJoin=function(n,i,s,u){var c=this._seg0.p1,m=me.angle(c,this._seg0.p0),E=me.angleBetweenOriented(this._seg0.p0,c,this._seg1.p1)/2,A=me.normalize(m+E),U=me.normalize(A+Math.PI),K=u*s,pt=s-K*Math.abs(Math.sin(E)),dt=c.x+K*Math.cos(U),Rt=c.y+K*Math.sin(U),Ot=new I(dt,Rt),Vt=new Zt(c,Ot),jt=Vt.pointAlongOffset(1,pt),sn=Vt.pointAlongOffset(1,-pt);this._side===bt.LEFT?(this._segList.addPt(jt),this._segList.addPt(sn)):(this._segList.addPt(sn),this._segList.addPt(jt))},vn.prototype.computeOffsetSegment=function(n,i,s,u){var c=i===bt.LEFT?1:-1,m=n.p1.x-n.p0.x,E=n.p1.y-n.p0.y,A=Math.sqrt(m*m+E*E),U=c*s*m/A,K=c*s*E/A;u.p0.x=n.p0.x-K,u.p0.y=n.p0.y+U,u.p1.x=n.p1.x-K,u.p1.y=n.p1.y+U},vn.prototype.addFilletArc=function(n,i,s,u,c){var m=u===J.CLOCKWISE?-1:1,E=Math.abs(i-s),A=Math.trunc(E/this._filletAngleQuantum+.5);if(A<1)return null;for(var U=E/A,K=0,pt=new I;K<E;){var dt=i+m*K;pt.x=n.x+c*Math.cos(dt),pt.y=n.y+c*Math.sin(dt),this._segList.addPt(pt),K+=U}},vn.prototype.addInsideTurn=function(n,i){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*vn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var s=new I((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(s);var u=new I((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(u)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},vn.prototype.createCircle=function(n){var i=new I(n.x+this._distance,n.y);this._segList.addPt(i),this.addFilletArc(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},vn.prototype.addBevelJoin=function(n,i){this._segList.addPt(n.p1),this._segList.addPt(i.p0)},vn.prototype.init=function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Kr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*vn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},vn.prototype.addCollinear=function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===We.JOIN_BEVEL||this._bufParams.getJoinStyle()===We.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,J.CLOCKWISE,this._distance))},vn.prototype.closeRing=function(){this._segList.closeRing()},vn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},vn.prototype.interfaces_=function(){return[]},vn.prototype.getClass=function(){return vn},wu.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},wu.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},wu.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},wu.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(vn,wu);var Rr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i};Rr.prototype.getOffsetCurve=function(n,i){if(this._distance=i,i===0)return null;var s=i<0,u=Math.abs(i),c=this.getSegGen(u);n.length<=1?this.computePointCurve(n[0],c):this.computeOffsetCurve(n,s,c);var m=c.getCoordinates();return s&&Q.reverse(m),m},Rr.prototype.computeSingleSidedBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){s.addSegments(n,!0);var c=In.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],bt.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{s.addSegments(n,!1);var A=In.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var K=2;K<=U;K++)s.addNextSegment(A[K],!0)}s.addLastSegment(),s.closeRing()},Rr.prototype.computeRingBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);i===bt.RIGHT&&(u=-u);var c=In.simplify(n,u),m=c.length-1;s.initSideSegments(c[m-1],c[0],i);for(var E=1;E<=m;E++){var A=E!==1;s.addNextSegment(c[E],A)}s.closeRing()},Rr.prototype.computeLineBufferCurve=function(n,i){var s=this.simplifyTolerance(this._distance),u=In.simplify(n,s),c=u.length-1;i.initSideSegments(u[0],u[1],bt.LEFT);for(var m=2;m<=c;m++)i.addNextSegment(u[m],!0);i.addLastSegment(),i.addLineEndCap(u[c-1],u[c]);var E=In.simplify(n,-s),A=E.length-1;i.initSideSegments(E[A],E[A-1],bt.LEFT);for(var U=A-2;U>=0;U--)i.addNextSegment(E[U],!0);i.addLastSegment(),i.addLineEndCap(E[1],E[0]),i.closeRing()},Rr.prototype.computePointCurve=function(n,i){switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:i.createCircle(n);break;case We.CAP_SQUARE:i.createSquare(n)}},Rr.prototype.getLineCurve=function(n,i){if(this._distance=i,i<0&&!this._bufParams.isSingleSided()||i===0)return null;var s=Math.abs(i),u=this.getSegGen(s);if(n.length<=1)this.computePointCurve(n[0],u);else if(this._bufParams.isSingleSided()){var c=i<0;this.computeSingleSidedBufferCurve(n,c,u)}else this.computeLineBufferCurve(n,u);return u.getCoordinates()},Rr.prototype.getBufferParameters=function(){return this._bufParams},Rr.prototype.simplifyTolerance=function(n){return n*this._bufParams.getSimplifyFactor()},Rr.prototype.getRingCurve=function(n,i,s){if(this._distance=s,n.length<=2)return this.getLineCurve(n,s);if(s===0)return Rr.copyCoordinates(n);var u=this.getSegGen(s);return this.computeRingBufferCurve(n,i,u),u.getCoordinates()},Rr.prototype.computeOffsetCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){var c=In.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],bt.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{var A=In.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var K=2;K<=U;K++)s.addNextSegment(A[K],!0)}s.addLastSegment()},Rr.prototype.getSegGen=function(n){return new vn(this._precisionModel,this._bufParams,n)},Rr.prototype.interfaces_=function(){return[]},Rr.prototype.getClass=function(){return Rr},Rr.copyCoordinates=function(n){for(var i=new Array(n.length).fill(null),s=0;s<i.length;s++)i[s]=new I(n[s]);return i};var Ls=function(){this._subgraphs=null,this._seg=new Zt,this._cga=new J;var n=arguments[0];this._subgraphs=n},Qd={DepthSegment:{configurable:!0}};Ls.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var n=arguments[0],i=new Z,s=this._subgraphs.iterator();s.hasNext();){var u=s.next(),c=u.getEnvelope();n.y<c.getMinY()||n.y>c.getMaxY()||this.findStabbedSegments(n,u.getDirectedEdges(),i)}return i}if(arguments.length===3){if($(arguments[2],tt)&&arguments[0]instanceof I&&arguments[1]instanceof xh){for(var m=arguments[0],E=arguments[1],A=arguments[2],U=E.getEdge().getCoordinates(),K=0;K<U.length-1;K++)if(this._seg.p0=U[K],this._seg.p1=U[K+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<m.x)&&!(this._seg.isHorizontal()||m.y<this._seg.p0.y||m.y>this._seg.p1.y||J.computeOrientation(this._seg.p0,this._seg.p1,m)===J.RIGHT)){var pt=E.getDepth(bt.LEFT);this._seg.p0.equals(U[K])||(pt=E.getDepth(bt.RIGHT));var dt=new ts(this._seg,pt);A.add(dt)}}else if($(arguments[2],tt)&&arguments[0]instanceof I&&$(arguments[1],tt))for(var Rt=arguments[0],Ot=arguments[1],Vt=arguments[2],jt=Ot.iterator();jt.hasNext();){var sn=jt.next();sn.isForward()&&this.findStabbedSegments(Rt,sn,Vt)}}},Ls.prototype.getDepth=function(n){var i=this.findStabbedSegments(n);return i.size()===0?0:_i.min(i)._leftDepth},Ls.prototype.interfaces_=function(){return[]},Ls.prototype.getClass=function(){return Ls},Qd.DepthSegment.get=function(){return ts},Object.defineProperties(Ls,Qd);var ts=function(){this._upwardSeg=null,this._leftDepth=null;var n=arguments[0],i=arguments[1];this._upwardSeg=new Zt(n),this._leftDepth=i};ts.prototype.compareTo=function(n){var i=n;if(this._upwardSeg.minX()>=i._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=i._upwardSeg.minX())return-1;var s=this._upwardSeg.orientationIndex(i._upwardSeg);return s!==0||(s=-1*i._upwardSeg.orientationIndex(this._upwardSeg))!=0?s:this._upwardSeg.compareTo(i._upwardSeg)},ts.prototype.compareX=function(n,i){var s=n.p0.compareTo(i.p0);return s!==0?s:n.p1.compareTo(i.p1)},ts.prototype.toString=function(){return this._upwardSeg.toString()},ts.prototype.interfaces_=function(){return[N]},ts.prototype.getClass=function(){return ts};var qe=function(n,i,s){this.p0=n||null,this.p1=i||null,this.p2=s||null};qe.prototype.area=function(){return qe.area(this.p0,this.p1,this.p2)},qe.prototype.signedArea=function(){return qe.signedArea(this.p0,this.p1,this.p2)},qe.prototype.interpolateZ=function(n){if(n===null)throw new P("Supplied point is null.");return qe.interpolateZ(n,this.p0,this.p1,this.p2)},qe.prototype.longestSideLength=function(){return qe.longestSideLength(this.p0,this.p1,this.p2)},qe.prototype.isAcute=function(){return qe.isAcute(this.p0,this.p1,this.p2)},qe.prototype.circumcentre=function(){return qe.circumcentre(this.p0,this.p1,this.p2)},qe.prototype.area3D=function(){return qe.area3D(this.p0,this.p1,this.p2)},qe.prototype.centroid=function(){return qe.centroid(this.p0,this.p1,this.p2)},qe.prototype.inCentre=function(){return qe.inCentre(this.p0,this.p1,this.p2)},qe.prototype.interfaces_=function(){return[]},qe.prototype.getClass=function(){return qe},qe.area=function(n,i,s){return Math.abs(((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2)},qe.signedArea=function(n,i,s){return((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2},qe.det=function(n,i,s,u){return n*u-i*s},qe.interpolateZ=function(n,i,s,u){var c=i.x,m=i.y,E=s.x-c,A=u.x-c,U=s.y-m,K=u.y-m,pt=E*K-A*U,dt=n.x-c,Rt=n.y-m,Ot=(K*dt-A*Rt)/pt,Vt=(-U*dt+E*Rt)/pt;return i.z+Ot*(s.z-i.z)+Vt*(u.z-i.z)},qe.longestSideLength=function(n,i,s){var u=n.distance(i),c=i.distance(s),m=s.distance(n),E=u;return c>E&&(E=c),m>E&&(E=m),E},qe.isAcute=function(n,i,s){return!!me.isAcute(n,i,s)&&!!me.isAcute(i,s,n)&&!!me.isAcute(s,n,i)},qe.circumcentre=function(n,i,s){var u=s.x,c=s.y,m=n.x-u,E=n.y-c,A=i.x-u,U=i.y-c,K=2*qe.det(m,E,A,U),pt=qe.det(E,m*m+E*E,U,A*A+U*U),dt=qe.det(m,m*m+E*E,A,A*A+U*U);return new I(u-pt/K,c+dt/K)},qe.perpendicularBisector=function(n,i){var s=i.x-n.x,u=i.y-n.y,c=new Qt(n.x+s/2,n.y+u/2,1),m=new Qt(n.x-u+s/2,n.y+s+u/2,1);return new Qt(c,m)},qe.angleBisector=function(n,i,s){var u=i.distance(n),c=u/(u+i.distance(s)),m=s.x-n.x,E=s.y-n.y;return new I(n.x+c*m,n.y+c*E)},qe.area3D=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=i.z-n.z,E=s.x-n.x,A=s.y-n.y,U=s.z-n.z,K=c*U-m*A,pt=m*E-u*U,dt=u*A-c*E,Rt=K*K+pt*pt+dt*dt,Ot=Math.sqrt(Rt)/2;return Ot},qe.centroid=function(n,i,s){var u=(n.x+i.x+s.x)/3,c=(n.y+i.y+s.y)/3;return new I(u,c)},qe.inCentre=function(n,i,s){var u=i.distance(s),c=n.distance(s),m=n.distance(i),E=u+c+m,A=(u*n.x+c*i.x+m*s.x)/E,U=(u*n.y+c*i.y+m*s.y)/E;return new I(A,U)};var ci=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Z;var n=arguments[0],i=arguments[1],s=arguments[2];this._inputGeom=n,this._distance=i,this._curveBuilder=s};ci.prototype.addPoint=function(n){if(this._distance<=0)return null;var i=n.getCoordinates(),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,V.EXTERIOR,V.INTERIOR)},ci.prototype.addPolygon=function(n){var i=this._distance,s=bt.LEFT;this._distance<0&&(i=-this._distance,s=bt.RIGHT);var u=n.getExteriorRing(),c=Q.removeRepeatedPoints(u.getCoordinates());if(this._distance<0&&this.isErodedCompletely(u,this._distance)||this._distance<=0&&c.length<3)return null;this.addPolygonRing(c,i,s,V.EXTERIOR,V.INTERIOR);for(var m=0;m<n.getNumInteriorRing();m++){var E=n.getInteriorRingN(m),A=Q.removeRepeatedPoints(E.getCoordinates());this._distance>0&&this.isErodedCompletely(E,-this._distance)||this.addPolygonRing(A,i,bt.opposite(s),V.INTERIOR,V.EXTERIOR)}},ci.prototype.isTriangleErodedCompletely=function(n,i){var s=new qe(n[0],n[1],n[2]),u=s.inCentre();return J.distancePointLine(u,s.p0,s.p1)<Math.abs(i)},ci.prototype.addLineString=function(n){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=Q.removeRepeatedPoints(n.getCoordinates()),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,V.EXTERIOR,V.INTERIOR)},ci.prototype.addCurve=function(n,i,s){if(n===null||n.length<2)return null;var u=new Nn(n,new on(0,V.BOUNDARY,i,s));this._curveList.add(u)},ci.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},ci.prototype.addPolygonRing=function(n,i,s,u,c){if(i===0&&n.length<an.MINIMUM_VALID_SIZE)return null;var m=u,E=c;n.length>=an.MINIMUM_VALID_SIZE&&J.isCCW(n)&&(m=c,E=u,s=bt.opposite(s));var A=this._curveBuilder.getRingCurve(n,s,i);this.addCurve(A,m,E)},ci.prototype.add=function(n){if(n.isEmpty())return null;n instanceof Wt?this.addPolygon(n):n instanceof zt?this.addLineString(n):n instanceof Kt?this.addPoint(n):n instanceof he?this.addCollection(n):n instanceof W?this.addCollection(n):n instanceof ln?this.addCollection(n):n instanceof gn&&this.addCollection(n)},ci.prototype.isErodedCompletely=function(n,i){var s=n.getCoordinates();if(s.length<4)return i<0;if(s.length===4)return this.isTriangleErodedCompletely(s,i);var u=n.getEnvelopeInternal(),c=Math.min(u.getHeight(),u.getWidth());return i<0&&2*Math.abs(i)>c},ci.prototype.addCollection=function(n){for(var i=0;i<n.getNumGeometries();i++){var s=n.getGeometryN(i);this.add(s)}},ci.prototype.interfaces_=function(){return[]},ci.prototype.getClass=function(){return ci};var fa=function(){};fa.prototype.locate=function(n){},fa.prototype.interfaces_=function(){return[]},fa.prototype.getClass=function(){return fa};var Wi=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var n=arguments[0];this._parent=n,this._atStart=!0,this._index=0,this._max=n.getNumGeometries()};Wi.prototype.next=function(){if(this._atStart)return this._atStart=!1,Wi.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new o;var n=this._parent.getGeometryN(this._index++);return n instanceof gn?(this._subcollectionIterator=new Wi(n),this._subcollectionIterator.next()):n},Wi.prototype.remove=function(){throw new Error(this.getClass().getName())},Wi.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Wi.prototype.interfaces_=function(){return[D]},Wi.prototype.getClass=function(){return Wi},Wi.isAtomic=function(n){return!(n instanceof gn)};var jr=function(){this._geom=null;var n=arguments[0];this._geom=n};jr.prototype.locate=function(n){return jr.locate(n,this._geom)},jr.prototype.interfaces_=function(){return[fa]},jr.prototype.getClass=function(){return jr},jr.isPointInRing=function(n,i){return!!i.getEnvelopeInternal().intersects(n)&&J.isPointInRing(n,i.getCoordinates())},jr.containsPointInPolygon=function(n,i){if(i.isEmpty())return!1;var s=i.getExteriorRing();if(!jr.isPointInRing(n,s))return!1;for(var u=0;u<i.getNumInteriorRing();u++){var c=i.getInteriorRingN(u);if(jr.isPointInRing(n,c))return!1}return!0},jr.containsPoint=function(n,i){if(i instanceof Wt)return jr.containsPointInPolygon(n,i);if(i instanceof gn)for(var s=new Wi(i);s.hasNext();){var u=s.next();if(u!==i&&jr.containsPoint(n,u))return!0}return!1},jr.locate=function(n,i){return i.isEmpty()?V.EXTERIOR:jr.containsPoint(n,i)?V.INTERIOR:V.EXTERIOR};var ar=function(){this._edgeMap=new _,this._edgeList=null,this._ptInAreaLocation=[V.NONE,V.NONE]};ar.prototype.getNextCW=function(n){this.getEdges();var i=this._edgeList.indexOf(n),s=i-1;return i===0&&(s=this._edgeList.size()-1),this._edgeList.get(s)},ar.prototype.propagateSideLabels=function(n){for(var i=V.NONE,s=this.iterator();s.hasNext();){var u=s.next().getLabel();u.isArea(n)&&u.getLocation(n,bt.LEFT)!==V.NONE&&(i=u.getLocation(n,bt.LEFT))}if(i===V.NONE)return null;for(var c=i,m=this.iterator();m.hasNext();){var E=m.next(),A=E.getLabel();if(A.getLocation(n,bt.ON)===V.NONE&&A.setLocation(n,bt.ON,c),A.isArea(n)){var U=A.getLocation(n,bt.LEFT),K=A.getLocation(n,bt.RIGHT);if(K!==V.NONE){if(K!==c)throw new lo("side location conflict",E.getCoordinate());U===V.NONE&&Pt.shouldNeverReachHere("found single null side (at "+E.getCoordinate()+")"),c=U}else Pt.isTrue(A.getLocation(n,bt.LEFT)===V.NONE,"found single null side"),A.setLocation(n,bt.RIGHT,c),A.setLocation(n,bt.LEFT,c)}}},ar.prototype.getCoordinate=function(){var n=this.iterator();return n.hasNext()?n.next().getCoordinate():null},ar.prototype.print=function(n){Ft.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(n)},ar.prototype.isAreaLabelsConsistent=function(n){return this.computeEdgeEndLabels(n.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},ar.prototype.checkAreaLabelsConsistent=function(n){var i=this.getEdges();if(i.size()<=0)return!0;var s=i.size()-1,u=i.get(s).getLabel().getLocation(n,bt.LEFT);Pt.isTrue(u!==V.NONE,"Found unlabelled area edge");for(var c=u,m=this.iterator();m.hasNext();){var E=m.next().getLabel();Pt.isTrue(E.isArea(n),"Found non-area edge");var A=E.getLocation(n,bt.LEFT),U=E.getLocation(n,bt.RIGHT);if(A===U||U!==c)return!1;c=A}return!0},ar.prototype.findIndex=function(n){this.iterator();for(var i=0;i<this._edgeList.size();i++)if(this._edgeList.get(i)===n)return i;return-1},ar.prototype.iterator=function(){return this.getEdges().iterator()},ar.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new Z(this._edgeMap.values())),this._edgeList},ar.prototype.getLocation=function(n,i,s){return this._ptInAreaLocation[n]===V.NONE&&(this._ptInAreaLocation[n]=jr.locate(i,s[n].getGeometry())),this._ptInAreaLocation[n]},ar.prototype.toString=function(){var n=new mt;n.append("EdgeEndStar: "+this.getCoordinate()),n.append(`\n`);for(var i=this.iterator();i.hasNext();){var s=i.next();n.append(s),n.append(`\n`)}return n.toString()},ar.prototype.computeEdgeEndLabels=function(n){for(var i=this.iterator();i.hasNext();)i.next().computeLabel(n)},ar.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)===V.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=V.NONE;if(i[U])K=V.EXTERIOR;else{var pt=E.getCoordinate();K=this.getLocation(U,pt,n)}A.setAllLocationsIfNull(U,K)}},ar.prototype.getDegree=function(){return this._edgeMap.size()},ar.prototype.insertEdgeEnd=function(n,i){this._edgeMap.put(n,i),this._edgeList=null},ar.prototype.interfaces_=function(){return[]},ar.prototype.getClass=function(){return ar};var W1=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());Pt.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 cn.isNorthern(E)&&cn.isNorthern(A)?c:cn.isNorthern(E)||cn.isNorthern(A)?c.getDy()!==0?c:m.getDy()!==0?m:(Pt.shouldNeverReachHere("found two horizontal edges incident on node"),null):m},i.prototype.print=function(s){Ft.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 Z;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],K=arguments[2],pt=A;pt<U;pt++){var dt=this._edgeList.get(pt);dt.setEdgeDepths(bt.RIGHT,K),K=dt.getDepth(bt.LEFT)}return K}},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&&(Pt.isTrue(u!==null,"found null for first outgoing dirEdge"),Pt.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=V.NONE,u=this.iterator();u.hasNext();){var c=u.next(),m=c.getSym();if(!c.isLineEdge()){if(c.isInResult()){s=V.INTERIOR;break}if(m.isInResult()){s=V.EXTERIOR;break}}}if(s===V.NONE)return null;for(var E=s,A=this.iterator();A.hasNext();){var U=A.next(),K=U.getSym();U.isLineEdge()?U.getEdge().setCovered(E===V.INTERIOR):(U.isInResult()&&(E=V.EXTERIOR),K.isInResult()&&(E=V.INTERIOR))}},i.prototype.computeLabelling=function(s){n.prototype.computeLabelling.call(this,s),this._label=new on(V.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!==V.INTERIOR&&E!==V.BOUNDARY||this._label.setLocation(m,V.INTERIOR)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ar),tm=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 _l(s,new W1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(la),Po=function n(){this._pts=null,this._orientation=null;var i=arguments[0];this._pts=i,this._orientation=n.orientation(i)};Po.prototype.compareTo=function(n){var i=n;return Po.compareOriented(this._pts,this._orientation,i._pts,i._orientation)},Po.prototype.interfaces_=function(){return[N]},Po.prototype.getClass=function(){return Po},Po.orientation=function(n){return Q.increasingDirection(n)===1},Po.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,K=u?0:s.length-1;;){var pt=n[U].compareTo(s[K]);if(pt!==0)return pt;var dt=(U+=c)===E,Rt=(K+=m)===A;if(dt&&!Rt)return-1;if(!dt&&Rt)return 1;if(dt&&Rt)return 0}};var xi=function(){this._edges=new Z,this._ocaMap=new _};xi.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(") ")},xi.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next())},xi.prototype.findEdgeIndex=function(n){for(var i=0;i<this._edges.size();i++)if(this._edges.get(i).equals(n))return i;return-1},xi.prototype.iterator=function(){return this._edges.iterator()},xi.prototype.getEdges=function(){return this._edges},xi.prototype.get=function(n){return this._edges.get(n)},xi.prototype.findEqualEdge=function(n){var i=new Po(n.getCoordinates());return this._ocaMap.get(i)},xi.prototype.add=function(n){this._edges.add(n);var i=new Po(n.getCoordinates());this._ocaMap.put(i,n)},xi.prototype.interfaces_=function(){return[]},xi.prototype.getClass=function(){return xi};var es=function(){};es.prototype.processIntersections=function(n,i,s,u){},es.prototype.isDone=function(){},es.prototype.interfaces_=function(){return[]},es.prototype.getClass=function(){return es};var Qr=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};Qr.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(Qr.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},Qr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Qr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Qr.prototype.getLineIntersector=function(){return this._li},Qr.prototype.hasProperIntersection=function(){return this._hasProper},Qr.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)))},Qr.prototype.hasIntersection=function(){return this._hasIntersection},Qr.prototype.isDone=function(){return!1},Qr.prototype.hasInteriorIntersection=function(){return this._hasInterior},Qr.prototype.interfaces_=function(){return[es]},Qr.prototype.getClass=function(){return Qr},Qr.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var Li=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var n=arguments[0],i=arguments[1],s=arguments[2];this.coord=new I(n),this.segmentIndex=i,this.dist=s};Li.prototype.getSegmentIndex=function(){return this.segmentIndex},Li.prototype.getCoordinate=function(){return this.coord},Li.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex),n.println(" dist = "+this.dist)},Li.prototype.compareTo=function(n){var i=n;return this.compare(i.segmentIndex,i.dist)},Li.prototype.isEndPoint=function(n){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===n},Li.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Li.prototype.getDistance=function(){return this.dist},Li.prototype.compare=function(n,i){return this.segmentIndex<n?-1:this.segmentIndex>n?1:this.dist<i?-1:this.dist>i?1:0},Li.prototype.interfaces_=function(){return[N]},Li.prototype.getClass=function(){return Li};var qi=function(){this._nodeMap=new _,this.edge=null;var n=arguments[0];this.edge=n};qi.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},qi.prototype.iterator=function(){return this._nodeMap.values().iterator()},qi.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}},qi.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)},qi.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 I(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 El(m,new on(this.edge._label))},qi.prototype.add=function(n,i,s){var u=new Li(n,i,s),c=this._nodeMap.get(u);return c!==null?c:(this._nodeMap.put(u,u),u)},qi.prototype.isIntersection=function(n){for(var i=this.iterator();i.hasNext();)if(i.next().coord.equals(n))return!0;return!1},qi.prototype.interfaces_=function(){return[]},qi.prototype.getClass=function(){return qi};var ns=function(){};ns.prototype.getChainStartIndices=function(n){var i=0,s=new Z;s.add(new lt(i));do{var u=this.findChainEnd(n,i);s.add(new lt(u)),i=u}while(i<n.length-1);return ns.toIntArray(s)},ns.prototype.findChainEnd=function(n,i){for(var s=cn.quadrant(n[i],n[i+1]),u=i+1;u<n.length&&cn.quadrant(n[u-1],n[u])===s;)u++;return u-1},ns.prototype.interfaces_=function(){return[]},ns.prototype.getClass=function(){return ns},ns.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 fo=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new Ct,this.env2=new Ct;var n=arguments[0];this.e=n,this.pts=n.getCoordinates();var i=new ns;this.startIndex=i.getChainStartIndices(this.pts)};fo.prototype.getCoordinates=function(){return this.pts},fo.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},fo.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},fo.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],K=arguments[5],pt=this.pts[c],dt=this.pts[m],Rt=E.pts[A],Ot=E.pts[U];if(m-c==1&&U-A==1)return K.addIntersections(this.e,c,E.e,A),null;if(this.env1.init(pt,dt),this.env2.init(Rt,Ot),!this.env1.intersects(this.env2))return null;var Vt=Math.trunc((c+m)/2),jt=Math.trunc((A+U)/2);c<Vt&&(A<jt&&this.computeIntersectsForChain(c,Vt,E,A,jt,K),jt<U&&this.computeIntersectsForChain(c,Vt,E,jt,U,K)),Vt<m&&(A<jt&&this.computeIntersectsForChain(Vt,m,E,A,jt,K),jt<U&&this.computeIntersectsForChain(Vt,m,E,jt,U,K))}},fo.prototype.getStartIndexes=function(){return this.startIndex},fo.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)},fo.prototype.interfaces_=function(){return[]},fo.prototype.getClass=function(){return fo};var Qn=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},em={NULL_VALUE:{configurable:!0}};Qn.prototype.getDepth=function(n,i){return this._depth[n][i]},Qn.prototype.setDepth=function(n,i,s){this._depth[n][i]=s},Qn.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]!==Qn.NULL_VALUE)return!1;return!0}if(arguments.length===1){var s=arguments[0];return this._depth[s][1]===Qn.NULL_VALUE}if(arguments.length===2){var u=arguments[0],c=arguments[1];return this._depth[u][c]===Qn.NULL_VALUE}},Qn.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}}},Qn.prototype.getDelta=function(n){return this._depth[n][bt.RIGHT]-this._depth[n][bt.LEFT]},Qn.prototype.getLocation=function(n,i){return this._depth[n][i]<=0?V.EXTERIOR:V.INTERIOR},Qn.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Qn.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!==V.EXTERIOR&&u!==V.INTERIOR||(this.isNull(i,s)?this._depth[i][s]=Qn.depthAtLocation(u):this._depth[i][s]+=Qn.depthAtLocation(u))}else if(arguments.length===3){var c=arguments[0],m=arguments[1];arguments[2]===V.INTERIOR&&this._depth[c][m]++}},Qn.prototype.interfaces_=function(){return[]},Qn.prototype.getClass=function(){return Qn},Qn.depthAtLocation=function(n){return n===V.EXTERIOR?0:n===V.INTERIOR?1:Qn.NULL_VALUE},em.NULL_VALUE.get=function(){return-1},Object.defineProperties(Qn,em);var El=function(n){function i(){if(n.call(this),this.pts=null,this._env=null,this.eiList=new qi(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Qn,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,on.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 fo(this)),this._mce},i.prototype.getEnvelope=function(){if(this._env===null){this._env=new Ct;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 I(s.getIntersection(m)),A=u,U=s.getEdgeDistance(c,m),K=A+1;if(K<this.pts.length){var pt=this.pts[K];E.equals2D(pt)&&(A=K,U=0)}this.eiList.add(E,A,U)},i.prototype.toString=function(){var s=new mt;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}(Jr),yr=function(n){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new xi,this._bufParams=n||null};yr.prototype.setWorkingPrecisionModel=function(n){this._workingPrecisionModel=n},yr.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 on(n.getLabel())).flip(),s.merge(u);var c=yr.depthDelta(u),m=i.getDepthDelta()+c;i.setDepthDelta(m)}else this._edgeList.add(n),n.setDepthDelta(yr.depthDelta(n.getLabel()))},yr.prototype.buildSubgraphs=function(n,i){for(var s=new Z,u=n.iterator();u.hasNext();){var c=u.next(),m=c.getRightmostCoordinate(),E=new Ls(s).getDepth(m);c.computeDepth(E),c.findResultEdges(),s.add(c),i.add(c.getDirectedEdges(),c.getNodes())}},yr.prototype.createSubgraphs=function(n){for(var i=new Z,s=n.getNodes().iterator();s.hasNext();){var u=s.next();if(!u.isVisited()){var c=new mr;c.create(u),i.add(c)}}return _i.sort(i,_i.reverseOrder()),i},yr.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},yr.prototype.getNoder=function(n){if(this._workingNoder!==null)return this._workingNoder;var i=new Eh,s=new pn;return s.setPrecisionModel(n),i.setSegmentIntersector(new Qr(s)),i},yr.prototype.buffer=function(n,i){var s=this._workingPrecisionModel;s===null&&(s=n.getPrecisionModel()),this._geomFact=n.getFactory();var u=new Rr(s,this._bufParams),c=new ci(n,i,u).getCurves();if(c.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(c,s),this._graph=new Tn(new tm),this._graph.addEdges(this._edgeList.getEdges());var m=this.createSubgraphs(this._graph),E=new Gr(this._geomFact);this.buildSubgraphs(m,E);var A=E.getPolygons();return A.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(A)},yr.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 El(c.getCoordinates(),new on(E));this.insertUniqueEdge(A)}}},yr.prototype.setNoder=function(n){this._workingNoder=n},yr.prototype.interfaces_=function(){return[]},yr.prototype.getClass=function(){return yr},yr.depthDelta=function(n){var i=n.getLocation(0,bt.LEFT),s=n.getLocation(0,bt.RIGHT);return i===V.INTERIOR&&s===V.EXTERIOR?1:i===V.EXTERIOR&&s===V.INTERIOR?-1:0},yr.convertSegStrings=function(n){for(var i=new ue,s=new Z;n.hasNext();){var u=n.next(),c=i.createLineString(u.getCoordinates());s.add(c)}return i.buildGeometry(s)};var Io=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()}};Io.prototype.rescale=function(){if($(arguments[0],j))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])&&Ft.out.println(s)}},Io.prototype.scale=function(){if($(arguments[0],j)){for(var n=arguments[0],i=new Z,s=n.iterator();s.hasNext();){var u=s.next();i.add(new Nn(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 I(Math.round((c[E].x-this._offsetX)*this._scaleFactor),Math.round((c[E].y-this._offsetY)*this._scaleFactor),c[E].z);return Q.removeRepeatedPoints(m)}},Io.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},Io.prototype.getNodedSubstrings=function(){var n=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(n),n},Io.prototype.computeNodes=function(n){var i=n;this._isScaled&&(i=this.scale(n)),this._noder.computeNodes(i)},Io.prototype.interfaces_=function(){return[Qo]},Io.prototype.getClass=function(){return Io};var Ni=function(){this._li=new pn,this._segStrings=null;var n=arguments[0];this._segStrings=n},nm={fact:{configurable:!0}};Ni.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 pe("found endpt/interior pt intersection at index "+m+" :pt "+s)}},Ni.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 K=0;K<A.length-1;K++)this.checkInteriorIntersections(c,U,m,K);else if(arguments.length===4){var pt=arguments[0],dt=arguments[1],Rt=arguments[2],Ot=arguments[3];if(pt===Rt&&dt===Ot)return null;var Vt=pt.getCoordinates()[dt],jt=pt.getCoordinates()[dt+1],sn=Rt.getCoordinates()[Ot],kn=Rt.getCoordinates()[Ot+1];if(this._li.computeIntersection(Vt,jt,sn,kn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,Vt,jt)||this.hasInteriorIntersection(this._li,sn,kn)))throw new pe("found non-noded intersection at "+Vt+"-"+jt+" and "+sn+"-"+kn)}},Ni.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},Ni.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])},Ni.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},Ni.prototype.checkCollapse=function(n,i,s){if(n.equals(s))throw new pe("found non-noded collapse at "+Ni.fact.createLineString([n,i,s]))},Ni.prototype.interfaces_=function(){return[]},Ni.prototype.getClass=function(){return Ni},nm.fact.get=function(){return new ue},Object.defineProperties(Ni,nm);var Lr=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 P("Scale factor must be non-zero");i!==1&&(this._pt=new I(this.scale(n.x),this.scale(n.y)),this._p0Scaled=new I,this._p1Scaled=new I),this.initCorners(this._pt)},rm={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Lr.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 Pt.isTrue(!(E&&A),"Found bad envelope test"),A},Lr.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 I(this._maxx,this._maxy),this._corner[1]=new I(this._minx,this._maxy),this._corner[2]=new I(this._minx,this._miny),this._corner[3]=new I(this._maxx,this._miny)},Lr.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))},Lr.prototype.scale=function(n){return Math.round(n*this._scaleFactor)},Lr.prototype.getCoordinate=function(){return this._originalPt},Lr.prototype.copyScaled=function(n,i){i.x=this.scale(n.x),i.y=this.scale(n.y)},Lr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var n=Lr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Ct(this._originalPt.x-n,this._originalPt.x+n,this._originalPt.y-n,this._originalPt.y+n)}return this._safeEnv},Lr.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())))},Lr.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))))},Lr.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)},Lr.prototype.interfaces_=function(){return[]},Lr.prototype.getClass=function(){return Lr},rm.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(Lr,rm);var bu=function(){this.tempEnv1=new Ct,this.selectedSegment=new Zt};bu.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)}}},bu.prototype.interfaces_=function(){return[]},bu.prototype.getClass=function(){return bu};var pa=function(){this._index=null;var n=arguments[0];this._index=n},im={HotPixelSnapAction:{configurable:!0}};pa.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 om(i,s,u);return this._index.query(c,{interfaces_:function(){return[Ao]},visitItem:function(E){E.select(c,m)}}),m.isNodeAdded()}},pa.prototype.interfaces_=function(){return[]},pa.prototype.getClass=function(){return pa},im.HotPixelSnapAction.get=function(){return om},Object.defineProperties(pa,im);var om=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}(bu),Ns=function(){this._li=null,this._interiorIntersections=null;var n=arguments[0];this._li=n,this._interiorIntersections=new Z};Ns.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)}},Ns.prototype.isDone=function(){return!1},Ns.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Ns.prototype.interfaces_=function(){return[es]},Ns.prototype.getClass=function(){return Ns};var Xi=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 pn,this._li.setPrecisionModel(n),this._scaleFactor=n.getScale()};Xi.prototype.checkCorrectness=function(n){var i=Nn.getNodedSubstrings(n),s=new Ni(i);try{s.checkValid()}catch(u){if(!(u instanceof qt))throw u;u.printStackTrace()}},Xi.prototype.getNodedSubstrings=function(){return Nn.getNodedSubstrings(this._nodedSegStrings)},Xi.prototype.snapRound=function(n,i){var s=this.findInteriorIntersections(n,i);this.computeIntersectionSnaps(s),this.computeVertexSnaps(n)},Xi.prototype.findInteriorIntersections=function(n,i){var s=new Ns(i);return this._noder.setSegmentIntersector(s),this._noder.computeNodes(n),s.getInteriorIntersections()},Xi.prototype.computeVertexSnaps=function(){if($(arguments[0],j))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.computeVertexSnaps(i)}else if(arguments[0]instanceof Nn)for(var s=arguments[0],u=s.getCoordinates(),c=0;c<u.length;c++){var m=new Lr(u[c],this._scaleFactor,this._li);this._pointSnapper.snap(m,s,c)&&s.addIntersection(u[c],c)}},Xi.prototype.computeNodes=function(n){this._nodedSegStrings=n,this._noder=new Eh,this._pointSnapper=new pa(this._noder.getIndex()),this.snapRound(n,this._li)},Xi.prototype.computeIntersectionSnaps=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),u=new Lr(s,this._scaleFactor,this._li);this._pointSnapper.snap(u)}},Xi.prototype.interfaces_=function(){return[Qo]},Xi.prototype.getClass=function(){return Xi};var tr=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}},da={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};tr.prototype.bufferFixedPrecision=function(n){var i=new Io(new Xi(new ie(1)),n.getScale()),s=new yr(this._bufParams);s.setWorkingPrecisionModel(n),s.setNoder(i),this._resultGeometry=s.buffer(this._argGeom,this._distance)},tr.prototype.bufferReducedPrecision=function(){var n=this;if(arguments.length===0){for(var i=tr.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=tr.precisionScaleFactor(this._argGeom,this._distance,s),c=new ie(u);this.bufferFixedPrecision(c)}},tr.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()},tr.prototype.setQuadrantSegments=function(n){this._bufParams.setQuadrantSegments(n)},tr.prototype.bufferOriginalPrecision=function(){try{var n=new yr(this._bufParams);this._resultGeometry=n.buffer(this._argGeom,this._distance)}catch(i){if(!(i instanceof pe))throw i;this._saveException=i}},tr.prototype.getResultGeometry=function(n){return this._distance=n,this.computeGeometry(),this._resultGeometry},tr.prototype.setEndCapStyle=function(n){this._bufParams.setEndCapStyle(n)},tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr},tr.bufferOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new tr(n).getResultGeometry(i)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof yt&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1],c=arguments[2],m=new tr(s);return m.setQuadrantSegments(c),m.getResultGeometry(u)}if(arguments[2]instanceof We&&arguments[0]instanceof yt&&typeof arguments[1]=="number"){var E=arguments[0],A=arguments[1],U=arguments[2];return new tr(E,U).getResultGeometry(A)}}else if(arguments.length===4){var K=arguments[0],pt=arguments[1],dt=arguments[2],Rt=arguments[3],Ot=new tr(K);return Ot.setQuadrantSegments(dt),Ot.setEndCapStyle(Rt),Ot.getResultGeometry(pt)}},tr.precisionScaleFactor=function(n,i,s){var u=n.getEnvelopeInternal(),c=ut.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)},da.CAP_ROUND.get=function(){return We.CAP_ROUND},da.CAP_BUTT.get=function(){return We.CAP_FLAT},da.CAP_FLAT.get=function(){return We.CAP_FLAT},da.CAP_SQUARE.get=function(){return We.CAP_SQUARE},da.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(tr,da);var vr=function(){this._pt=[new I,new I],this._distance=S.NaN,this._isNull=!0};vr.prototype.getCoordinates=function(){return this._pt},vr.prototype.getCoordinate=function(n){return this._pt[n]},vr.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)}},vr.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}},vr.prototype.getDistance=function(){return this._distance},vr.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)}},vr.prototype.interfaces_=function(){return[]},vr.prototype.getClass=function(){return vr};var Yi=function(){};Yi.prototype.interfaces_=function(){return[]},Yi.prototype.getClass=function(){return Yi},Yi.computeDistance=function(){if(arguments[2]instanceof vr&&arguments[0]instanceof zt&&arguments[1]instanceof I)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=n.getCoordinates(),c=new Zt,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 vr&&arguments[0]instanceof Wt&&arguments[1]instanceof I){var A=arguments[0],U=arguments[1],K=arguments[2];Yi.computeDistance(A.getExteriorRing(),U,K);for(var pt=0;pt<A.getNumInteriorRing();pt++)Yi.computeDistance(A.getInteriorRingN(pt),U,K)}else if(arguments[2]instanceof vr&&arguments[0]instanceof yt&&arguments[1]instanceof I){var dt=arguments[0],Rt=arguments[1],Ot=arguments[2];if(dt instanceof zt)Yi.computeDistance(dt,Rt,Ot);else if(dt instanceof Wt)Yi.computeDistance(dt,Rt,Ot);else if(dt instanceof gn)for(var Vt=dt,jt=0;jt<Vt.getNumGeometries();jt++){var sn=Vt.getGeometryN(jt);Yi.computeDistance(sn,Rt,Ot)}else Ot.setMinimum(dt.getCoordinate(),Rt)}else if(arguments[2]instanceof vr&&arguments[0]instanceof Zt&&arguments[1]instanceof I){var kn=arguments[0],Mr=arguments[1],Ki=arguments[2],Uo=kn.closestPoint(Mr);Ki.setMinimum(Uo,Mr)}};var rs=function(n){this._maxPtDist=new vr,this._inputGeom=n||null},Mh={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};rs.prototype.computeMaxMidpointDistance=function(n){var i=new Ro(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},rs.prototype.computeMaxVertexDistance=function(n){var i=new Os(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},rs.prototype.findDistance=function(n){return this.computeMaxVertexDistance(n),this.computeMaxMidpointDistance(n),this._maxPtDist.getDistance()},rs.prototype.getDistancePoints=function(){return this._maxPtDist},rs.prototype.interfaces_=function(){return[]},rs.prototype.getClass=function(){return rs},Mh.MaxPointDistanceFilter.get=function(){return Os},Mh.MaxMidpointDistanceFilter.get=function(){return Ro},Object.defineProperties(rs,Mh);var Os=function(n){this._maxPtDist=new vr,this._minPtDist=new vr,this._geom=n||null};Os.prototype.filter=function(n){this._minPtDist.initialize(),Yi.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Os.prototype.getMaxPointDistance=function(){return this._maxPtDist},Os.prototype.interfaces_=function(){return[Y]},Os.prototype.getClass=function(){return Os};var Ro=function(n){this._maxPtDist=new vr,this._minPtDist=new vr,this._geom=n||null};Ro.prototype.filter=function(n,i){if(i===0)return null;var s=n.getCoordinate(i-1),u=n.getCoordinate(i),c=new I((s.x+u.x)/2,(s.y+u.y)/2);this._minPtDist.initialize(),Yi.computeDistance(this._geom,c,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Ro.prototype.isDone=function(){return!1},Ro.prototype.isGeometryChanged=function(){return!1},Ro.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ro.prototype.interfaces_=function(){return[wn]},Ro.prototype.getClass=function(){return Ro};var po=function(n){this._comps=n||null};po.prototype.filter=function(n){n instanceof Wt&&this._comps.add(n)},po.prototype.interfaces_=function(){return[Cn]},po.prototype.getClass=function(){return po},po.getPolygons=function(){if(arguments.length===1){var n=arguments[0];return po.getPolygons(n,new Z)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof Wt?s.add(i):i instanceof gn&&i.apply(new po(s)),s}};var er=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}};er.prototype.filter=function(n){if(this._isForcedToLineString&&n instanceof an){var i=n.getFactory().createLineString(n.getCoordinateSequence());return this._lines.add(i),null}n instanceof zt&&this._lines.add(n)},er.prototype.setForceToLineString=function(n){this._isForcedToLineString=n},er.prototype.interfaces_=function(){return[wt]},er.prototype.getClass=function(){return er},er.getGeometry=function(){if(arguments.length===1){var n=arguments[0];return n.getFactory().buildGeometry(er.getLines(n))}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().buildGeometry(er.getLines(i,s))}},er.getLines=function(){if(arguments.length===1){var n=arguments[0];return er.getLines(n,!1)}if(arguments.length===2){if($(arguments[0],j)&&$(arguments[1],j)){for(var i=arguments[0],s=arguments[1],u=i.iterator();u.hasNext();){var c=u.next();er.getLines(c,s)}return s}if(arguments[0]instanceof yt&&typeof arguments[1]=="boolean"){var m=arguments[0],E=arguments[1],A=new Z;return m.apply(new er(A,E)),A}if(arguments[0]instanceof yt&&$(arguments[1],j)){var U=arguments[0],K=arguments[1];return U instanceof zt?K.add(U):U.apply(new er(K)),K}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&$(arguments[0],j)&&$(arguments[1],j)){for(var pt=arguments[0],dt=arguments[1],Rt=arguments[2],Ot=pt.iterator();Ot.hasNext();){var Vt=Ot.next();er.getLines(Vt,dt,Rt)}return dt}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof yt&&$(arguments[1],j)){var jt=arguments[0],sn=arguments[1],kn=arguments[2];return jt.apply(new er(sn,kn)),sn}}};var Ei=function(){if(this._boundaryRule=w.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 P("Rule must be non-null");this._boundaryRule=n}}};Ei.prototype.locateInternal=function(){if(arguments[0]instanceof I&&arguments[1]instanceof Wt){var n=arguments[0],i=arguments[1];if(i.isEmpty())return V.EXTERIOR;var s=i.getExteriorRing(),u=this.locateInPolygonRing(n,s);if(u===V.EXTERIOR)return V.EXTERIOR;if(u===V.BOUNDARY)return V.BOUNDARY;for(var c=0;c<i.getNumInteriorRing();c++){var m=i.getInteriorRingN(c),E=this.locateInPolygonRing(n,m);if(E===V.INTERIOR)return V.EXTERIOR;if(E===V.BOUNDARY)return V.BOUNDARY}return V.INTERIOR}if(arguments[0]instanceof I&&arguments[1]instanceof zt){var A=arguments[0],U=arguments[1];if(!U.getEnvelopeInternal().intersects(A))return V.EXTERIOR;var K=U.getCoordinates();return U.isClosed()||!A.equals(K[0])&&!A.equals(K[K.length-1])?J.isOnLine(A,K)?V.INTERIOR:V.EXTERIOR:V.BOUNDARY}if(arguments[0]instanceof I&&arguments[1]instanceof Kt){var pt=arguments[0];return arguments[1].getCoordinate().equals2D(pt)?V.INTERIOR:V.EXTERIOR}},Ei.prototype.locateInPolygonRing=function(n,i){return i.getEnvelopeInternal().intersects(n)?J.locatePointInRing(n,i.getCoordinates()):V.EXTERIOR},Ei.prototype.intersects=function(n,i){return this.locate(n,i)!==V.EXTERIOR},Ei.prototype.updateLocationInfo=function(n){n===V.INTERIOR&&(this._isIn=!0),n===V.BOUNDARY&&this._numBoundaries++},Ei.prototype.computeLocation=function(n,i){if(i instanceof Kt&&this.updateLocationInfo(this.locateInternal(n,i)),i instanceof zt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof Wt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof W)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 ln)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 gn)for(var U=new Wi(i);U.hasNext();){var K=U.next();K!==i&&this.computeLocation(n,K)}},Ei.prototype.locate=function(n,i){return i.isEmpty()?V.EXTERIOR:i instanceof zt?this.locateInternal(n,i):i instanceof Wt?this.locateInternal(n,i):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(n,i),this._boundaryRule.isInBoundary(this._numBoundaries)?V.BOUNDARY:this._numBoundaries>0||this._isIn?V.INTERIOR:V.EXTERIOR)},Ei.prototype.interfaces_=function(){return[]},Ei.prototype.getClass=function(){return Ei};var _r=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}},sm={INSIDE_AREA:{configurable:!0}};_r.prototype.isInsideArea=function(){return this._segIndex===_r.INSIDE_AREA},_r.prototype.getCoordinate=function(){return this._pt},_r.prototype.getGeometryComponent=function(){return this._component},_r.prototype.getSegmentIndex=function(){return this._segIndex},_r.prototype.interfaces_=function(){return[]},_r.prototype.getClass=function(){return _r},sm.INSIDE_AREA.get=function(){return-1},Object.defineProperties(_r,sm);var Lo=function(n){this._pts=n||null};Lo.prototype.filter=function(n){n instanceof Kt&&this._pts.add(n)},Lo.prototype.interfaces_=function(){return[Cn]},Lo.prototype.getClass=function(){return Lo},Lo.getPoints=function(){if(arguments.length===1){var n=arguments[0];return n instanceof Kt?_i.singletonList(n):Lo.getPoints(n,new Z)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof Kt?s.add(i):i instanceof gn&&i.apply(new Lo(s)),s}};var Ds=function(){this._locations=null;var n=arguments[0];this._locations=n};Ds.prototype.filter=function(n){(n instanceof Kt||n instanceof zt||n instanceof Wt)&&this._locations.add(new _r(n,0,n.getCoordinate()))},Ds.prototype.interfaces_=function(){return[Cn]},Ds.prototype.getClass=function(){return Ds},Ds.getLocations=function(n){var i=new Z;return n.apply(new Ds(i)),i};var nr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Ei,this._minDistanceLocation=null,this._minDistance=S.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}};nr.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=Ds.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&&$(arguments[0],tt)&&$(arguments[1],tt)){for(var E=arguments[0],A=arguments[1],U=arguments[2],K=0;K<E.size();K++)for(var pt=E.get(K),dt=0;dt<A.size();dt++)if(this.computeContainmentDistance(pt,A.get(dt),U),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof _r&&arguments[1]instanceof Wt){var Rt=arguments[0],Ot=arguments[1],Vt=arguments[2],jt=Rt.getCoordinate();if(V.EXTERIOR!==this._ptLocator.locate(jt,Ot))return this._minDistance=0,Vt[0]=Rt,Vt[1]=new _r(Ot,jt),null}}},nr.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}},nr.prototype.computeFacetDistance=function(){var n=new Array(2).fill(null),i=er.getLines(this._geom[0]),s=er.getLines(this._geom[1]),u=Lo.getPoints(this._geom[0]),c=Lo.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))))},nr.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},nr.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])},nr.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},nr.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 zt&&arguments[1]instanceof Kt){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=J.distancePointLine(c,u[m],u[m+1]);if(E<this._minDistance){this._minDistance=E;var A=new Zt(u[m],u[m+1]).closestPoint(c);s[0]=new _r(n,m,A),s[1]=new _r(i,0,c)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof zt&&arguments[1]instanceof zt){var U=arguments[0],K=arguments[1],pt=arguments[2];if(U.getEnvelopeInternal().distance(K.getEnvelopeInternal())>this._minDistance)return null;for(var dt=U.getCoordinates(),Rt=K.getCoordinates(),Ot=0;Ot<dt.length-1;Ot++)for(var Vt=0;Vt<Rt.length-1;Vt++){var jt=J.distanceLineLine(dt[Ot],dt[Ot+1],Rt[Vt],Rt[Vt+1]);if(jt<this._minDistance){this._minDistance=jt;var sn=new Zt(dt[Ot],dt[Ot+1]),kn=new Zt(Rt[Vt],Rt[Vt+1]),Mr=sn.closestPoints(kn);pt[0]=new _r(U,Ot,Mr[0]),pt[1]=new _r(K,Vt,Mr[1])}if(this._minDistance<=this._terminateDistance)return null}}}},nr.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 _r(c,0,c.getCoordinate()),s[1]=new _r(E,0,E.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},nr.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new P("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},nr.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}},nr.prototype.interfaces_=function(){return[]},nr.prototype.getClass=function(){return nr},nr.distance=function(n,i){return new nr(n,i).distance()},nr.isWithinDistance=function(n,i,s){return new nr(n,i,s).distance()<=s},nr.nearestPoints=function(n,i){return new nr(n,i).nearestPoints()};var ur=function(){this._pt=[new I,new I],this._distance=S.NaN,this._isNull=!0};ur.prototype.getCoordinates=function(){return this._pt},ur.prototype.getCoordinate=function(n){return this._pt[n]},ur.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)}},ur.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}},ur.prototype.toString=function(){return Yt.toLineString(this._pt[0],this._pt[1])},ur.prototype.getDistance=function(){return this._distance},ur.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)}},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur};var Oi=function(){};Oi.prototype.interfaces_=function(){return[]},Oi.prototype.getClass=function(){return Oi},Oi.computeDistance=function(){if(arguments[2]instanceof ur&&arguments[0]instanceof zt&&arguments[1]instanceof I)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=new Zt,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 ur&&arguments[0]instanceof Wt&&arguments[1]instanceof I){var A=arguments[0],U=arguments[1],K=arguments[2];Oi.computeDistance(A.getExteriorRing(),U,K);for(var pt=0;pt<A.getNumInteriorRing();pt++)Oi.computeDistance(A.getInteriorRingN(pt),U,K)}else if(arguments[2]instanceof ur&&arguments[0]instanceof yt&&arguments[1]instanceof I){var dt=arguments[0],Rt=arguments[1],Ot=arguments[2];if(dt instanceof zt)Oi.computeDistance(dt,Rt,Ot);else if(dt instanceof Wt)Oi.computeDistance(dt,Rt,Ot);else if(dt instanceof gn)for(var Vt=dt,jt=0;jt<Vt.getNumGeometries();jt++){var sn=Vt.getGeometryN(jt);Oi.computeDistance(sn,Rt,Ot)}else Ot.setMinimum(dt.getCoordinate(),Rt)}else if(arguments[2]instanceof ur&&arguments[0]instanceof Zt&&arguments[1]instanceof I){var kn=arguments[0],Mr=arguments[1],Ki=arguments[2],Uo=kn.closestPoint(Mr);Ki.setMinimum(Uo,Mr)}};var hi=function(){this._g0=null,this._g1=null,this._ptDist=new ur,this._densifyFrac=0;var n=arguments[0],i=arguments[1];this._g0=n,this._g1=i},Sh={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};hi.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},hi.prototype.setDensifyFraction=function(n){if(n>1||n<=0)throw new P("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=n},hi.prototype.compute=function(n,i){this.computeOrientedDistance(n,i,this._ptDist),this.computeOrientedDistance(i,n,this._ptDist)},hi.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},hi.prototype.computeOrientedDistance=function(n,i,s){var u=new Fs(i);if(n.apply(u),s.setMaximum(u.getMaxPointDistance()),this._densifyFrac>0){var c=new No(i,this._densifyFrac);n.apply(c),s.setMaximum(c.getMaxPointDistance())}},hi.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},hi.prototype.interfaces_=function(){return[]},hi.prototype.getClass=function(){return hi},hi.distance=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new hi(n,i).distance()}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=new hi(s,u);return m.setDensifyFraction(c),m.distance()}},Sh.MaxPointDistanceFilter.get=function(){return Fs},Sh.MaxDensifiedByFractionDistanceFilter.get=function(){return No},Object.defineProperties(hi,Sh);var Fs=function(){this._maxPtDist=new ur,this._minPtDist=new ur,this._euclideanDist=new Oi,this._geom=null;var n=arguments[0];this._geom=n};Fs.prototype.filter=function(n){this._minPtDist.initialize(),Oi.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Fs.prototype.getMaxPointDistance=function(){return this._maxPtDist},Fs.prototype.interfaces_=function(){return[Y]},Fs.prototype.getClass=function(){return Fs};var No=function(){this._maxPtDist=new ur,this._minPtDist=new ur,this._geom=null,this._numSubSegs=0;var n=arguments[0],i=arguments[1];this._geom=n,this._numSubSegs=Math.trunc(Math.round(1/i))};No.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,K=new I(A,U);this._minPtDist.initialize(),Oi.computeDistance(this._geom,K,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},No.prototype.isDone=function(){return!1},No.prototype.isGeometryChanged=function(){return!1},No.prototype.getMaxPointDistance=function(){return this._maxPtDist},No.prototype.interfaces_=function(){return[wn]},No.prototype.getClass=function(){return No};var Hr=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},wh={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Hr.prototype.checkMaximumDistance=function(n,i,s){var u=new hi(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 "+Yt.toLineString(c[0],c[1])+")"}},Hr.prototype.isValid=function(){var n=Math.abs(this._bufDistance),i=Hr.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(),Hr.VERBOSE&&Ft.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Hr.prototype.checkNegativeValid=function(){if(!(this._input instanceof Wt||this._input instanceof ln||this._input instanceof gn))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)},Hr.prototype.getErrorIndicator=function(){return this._errorIndicator},Hr.prototype.checkMinimumDistance=function(n,i,s){var u=new nr(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 "+Yt.toLineString(c[0],c[1])+" )"}},Hr.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)},Hr.prototype.getErrorLocation=function(){return this._errorLocation},Hr.prototype.getPolygonLines=function(n){for(var i=new Z,s=new er(i),u=po.getPolygons(n).iterator();u.hasNext();)u.next().apply(s);return n.getFactory().buildGeometry(i)},Hr.prototype.getErrorMessage=function(){return this._errMsg},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr},wh.VERBOSE.get=function(){return!1},wh.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Hr,wh);var rr=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},bh={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};rr.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},rr.prototype.checkEnvelope=function(){if(this._distance<0)return null;var n=this._distance*rr.MAX_ENV_DIFF_FRAC;n===0&&(n=.001);var i=new Ct(this._input.getEnvelopeInternal());i.expandBy(this._distance);var s=new Ct(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")},rr.prototype.checkDistance=function(){var n=new Hr(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")},rr.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")},rr.prototype.checkPolygonal=function(){this._result instanceof Wt||this._result instanceof ln||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},rr.prototype.getErrorIndicator=function(){return this._errorIndicator},rr.prototype.getErrorLocation=function(){return this._errorLocation},rr.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"))},rr.prototype.report=function(n){if(!rr.VERBOSE)return null;Ft.out.println("Check "+n+": "+(this._isValid?"passed":"FAILED"))},rr.prototype.getErrorMessage=function(){return this._errorMsg},rr.prototype.interfaces_=function(){return[]},rr.prototype.getClass=function(){return rr},rr.isValidMsg=function(n,i,s){var u=new rr(n,i,s);return u.isValid()?null:u.getErrorMessage()},rr.isValid=function(n,i,s){return!!new rr(n,i,s).isValid()},bh.VERBOSE.get=function(){return!1},bh.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(rr,bh);var Di=function(){this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};Di.prototype.getCoordinates=function(){return this._pts},Di.prototype.size=function(){return this._pts.length},Di.prototype.getCoordinate=function(n){return this._pts[n]},Di.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Di.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:Is.octant(this.getCoordinate(n),this.getCoordinate(n+1))},Di.prototype.setData=function(n){this._data=n},Di.prototype.getData=function(){return this._data},Di.prototype.toString=function(){return Yt.toLineString(new fe(this._pts))},Di.prototype.interfaces_=function(){return[Hi]},Di.prototype.getClass=function(){return Di};var Kn=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new Z,this._intersectionCount=0,this._keepIntersections=!0;var n=arguments[0];this._li=n,this._interiorIntersection=null};Kn.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Kn.prototype.setCheckEndSegmentsOnly=function(n){this._isCheckEndSegmentsOnly=n},Kn.prototype.getIntersectionSegments=function(){return this._intSegments},Kn.prototype.count=function(){return this._intersectionCount},Kn.prototype.getIntersections=function(){return this._intersections},Kn.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},Kn.prototype.setKeepIntersections=function(n){this._keepIntersections=n},Kn.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++)},Kn.prototype.isEndSegment=function(n,i){return i===0||i>=n.size()-2},Kn.prototype.hasIntersection=function(){return this._interiorIntersection!==null},Kn.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},Kn.prototype.interfaces_=function(){return[es]},Kn.prototype.getClass=function(){return Kn},Kn.createAllIntersectionsFinder=function(n){var i=new Kn(n);return i.setFindAllIntersections(!0),i},Kn.createAnyIntersectionFinder=function(n){return new Kn(n)},Kn.createIntersectionCounter=function(n){var i=new Kn(n);return i.setFindAllIntersections(!0),i.setKeepIntersections(!1),i};var Mi=function(){this._li=new pn,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var n=arguments[0];this._segStrings=n};Mi.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},Mi.prototype.getIntersections=function(){return this._segInt.getIntersections()},Mi.prototype.isValid=function(){return this.execute(),this._isValid},Mi.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},Mi.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Kn(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var n=new Eh;if(n.setSegmentIntersector(this._segInt),n.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Mi.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new lo(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Mi.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var n=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Yt.toLineString(n[0],n[1])+" and "+Yt.toLineString(n[2],n[3])},Mi.prototype.interfaces_=function(){return[]},Mi.prototype.getClass=function(){return Mi},Mi.computeIntersections=function(n){var i=new Mi(n);return i.setFindAllIntersections(!0),i.isValid(),i.getIntersections()};var is=function n(){this._nv=null;var i=arguments[0];this._nv=new Mi(n.toSegmentStrings(i))};is.prototype.checkValid=function(){this._nv.checkValid()},is.prototype.interfaces_=function(){return[]},is.prototype.getClass=function(){return is},is.toSegmentStrings=function(n){for(var i=new Z,s=n.iterator();s.hasNext();){var u=s.next();i.add(new Di(u.getCoordinates(),u))}return i},is.checkValid=function(n){new is(n).checkValid()};var Us=function(n){this._mapOp=n};Us.prototype.map=function(n){for(var i=new Z,s=0;s<n.getNumGeometries();s++){var u=this._mapOp.map(n.getGeometryN(s));u.isEmpty()||i.add(u)}return n.getFactory().createGeometryCollection(ue.toGeometryArray(i))},Us.prototype.interfaces_=function(){return[]},Us.prototype.getClass=function(){return Us},Us.map=function(n,i){return new Us(i).map(n)};var Fi=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new Z,this._resultLineList=new Z;var n=arguments[0],i=arguments[1],s=arguments[2];this._op=n,this._geometryFactory=i,this._ptLocator=s};Fi.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)}},Fi.prototype.labelIsolatedLine=function(n,i){var s=this._ptLocator.locate(n.getCoordinate(),this._op.getArgGeometry(i));n.getLabel().setLocation(i,s)},Fi.prototype.build=function(n){return this.findCoveredLineEdges(),this.collectLines(n),this.buildLines(n),this._resultLineList},Fi.prototype.collectLineEdge=function(n,i,s){var u=n.getLabel(),c=n.getEdge();n.isLineEdge()&&(n.isVisited()||!se.isResultOfOp(u,i)||c.isCovered()||(s.add(c),n.setVisitedEdge(!0)))},Fi.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)}}},Fi.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))}},Fi.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)}},Fi.prototype.collectBoundaryTouchEdge=function(n,i,s){var u=n.getLabel();return n.isLineEdge()||n.isVisited()||n.isInteriorAreaEdge()||n.getEdge().isInResult()?null:(Pt.isTrue(!(n.isInResult()||n.getSym().isInResult())||!n.getEdge().isInResult()),void(se.isResultOfOp(u,i)&&i===se.INTERSECTION&&(s.add(n.getEdge()),n.setVisitedEdge(!0))))},Fi.prototype.interfaces_=function(){return[]},Fi.prototype.getClass=function(){return Fi};var Bs=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new Z;var n=arguments[0],i=arguments[1];this._op=n,this._geometryFactory=i};Bs.prototype.filterCoveredNodeToPoint=function(n){var i=n.getCoordinate();if(!this._op.isCoveredByLA(i)){var s=this._geometryFactory.createPoint(i);this._resultPointList.add(s)}},Bs.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===se.INTERSECTION)){var u=s.getLabel();se.isResultOfOp(u,n)&&this.filterCoveredNodeToPoint(s)}}},Bs.prototype.build=function(n){return this.extractNonCoveredResultNodes(n),this._resultPointList},Bs.prototype.interfaces_=function(){return[]},Bs.prototype.getClass=function(){return Bs};var Nr=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Nr.prototype.transformPoint=function(n,i){return this._factory.createPoint(this.transformCoordinates(n.getCoordinateSequence(),n))},Nr.prototype.transformPolygon=function(n,i){var s=!0,u=this.transformLinearRing(n.getExteriorRing(),n);u!==null&&u instanceof an&&!u.isEmpty()||(s=!1);for(var c=new Z,m=0;m<n.getNumInteriorRing();m++){var E=this.transformLinearRing(n.getInteriorRingN(m),n);E===null||E.isEmpty()||(E instanceof an||(s=!1),c.add(E))}if(s)return this._factory.createPolygon(u,c.toArray([]));var A=new Z;return u!==null&&A.add(u),A.addAll(c),this._factory.buildGeometry(A)},Nr.prototype.createCoordinateSequence=function(n){return this._factory.getCoordinateSequenceFactory().create(n)},Nr.prototype.getInputGeometry=function(){return this._inputGeom},Nr.prototype.transformMultiLineString=function(n,i){for(var s=new Z,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)},Nr.prototype.transformCoordinates=function(n,i){return this.copy(n)},Nr.prototype.transformLineString=function(n,i){return this._factory.createLineString(this.transformCoordinates(n.getCoordinateSequence(),n))},Nr.prototype.transformMultiPoint=function(n,i){for(var s=new Z,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)},Nr.prototype.transformMultiPolygon=function(n,i){for(var s=new Z,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)},Nr.prototype.copy=function(n){return n.copy()},Nr.prototype.transformGeometryCollection=function(n,i){for(var s=new Z,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(ue.toGeometryArray(s)):this._factory.buildGeometry(s)},Nr.prototype.transform=function(n){if(this._inputGeom=n,this._factory=n.getFactory(),n instanceof Kt)return this.transformPoint(n,null);if(n instanceof he)return this.transformMultiPoint(n,null);if(n instanceof an)return this.transformLinearRing(n,null);if(n instanceof zt)return this.transformLineString(n,null);if(n instanceof W)return this.transformMultiLineString(n,null);if(n instanceof Wt)return this.transformPolygon(n,null);if(n instanceof ln)return this.transformMultiPolygon(n,null);if(n instanceof gn)return this.transformGeometryCollection(n,null);throw new P("Unknown Geometry subtype: "+n.getClass().getName())},Nr.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)},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr};var $i=function n(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Zt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof zt&&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}};$i.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 I(m)),u===0&&this._isClosed&&n.set(n.size()-1,new I(m)))}},$i.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},$i.prototype.snapTo=function(n){var i=new ot(this._srcPts);return this.snapVertices(i,n),this.snapSegments(i,n),i.toCoordinateArray()},$i.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 I(c),!1)}},$i.prototype.findSegmentIndexToSnap=function(n,i){for(var s=S.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},$i.prototype.setAllowSnappingToSourceVertices=function(n){this._allowSnappingToSourceVertices=n},$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i},$i.isClosed=function(n){return!(n.length<=1)&&n[0].equals2D(n[n.length-1])};var On=function(n){this._srcGeom=n||null},am={SNAP_PRECISION_FACTOR:{configurable:!0}};On.prototype.snapTo=function(n,i){var s=this.extractTargetCoordinates(n);return new um(i,s).transform(this._srcGeom)},On.prototype.snapToSelf=function(n,i){var s=this.extractTargetCoordinates(this._srcGeom),u=new um(n,s,!0).transform(this._srcGeom),c=u;return i&&$(c,ce)&&(c=u.buffer(0)),c},On.prototype.computeSnapTolerance=function(n){return this.computeMinimumSegmentLength(n)/10},On.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))},On.prototype.computeMinimumSegmentLength=function(n){for(var i=S.MAX_VALUE,s=0;s<n.length-1;s++){var u=n[s].distance(n[s+1]);u<i&&(i=u)}return i},On.prototype.interfaces_=function(){return[]},On.prototype.getClass=function(){return On},On.snap=function(n,i,s){var u=new Array(2).fill(null),c=new On(n);u[0]=c.snapTo(i,s);var m=new On(i);return u[1]=m.snapTo(u[0],s),u},On.computeOverlaySnapTolerance=function(){if(arguments.length===1){var n=arguments[0],i=On.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(On.computeOverlaySnapTolerance(c),On.computeOverlaySnapTolerance(m))}},On.computeSizeBasedSnapTolerance=function(n){var i=n.getEnvelopeInternal();return Math.min(i.getHeight(),i.getWidth())*On.SNAP_PRECISION_FACTOR},On.snapToSelf=function(n,i,s){return new On(n).snapToSelf(i,s)},am.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(On,am);var um=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 $i(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}(Nr),xr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};xr.prototype.getCommon=function(){return S.longBitsToDouble(this._commonBits)},xr.prototype.add=function(n){var i=S.doubleToLongBits(n);if(this._isFirst)return this._commonBits=i,this._commonSignExp=xr.signExpBits(this._commonBits),this._isFirst=!1,null;if(xr.signExpBits(i)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=xr.numCommonMostSigMantissaBits(this._commonBits,i),this._commonBits=xr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},xr.prototype.toString=function(){if(arguments.length===1){var n=arguments[0],i=S.longBitsToDouble(n),s="0000000000000000000000000000000000000000000000000000000000000000"+S.toBinaryString(n),u=s.substring(s.length-64);return u.substring(0,1)+" "+u.substring(1,12)+"(exp) "+u.substring(12)+" [ "+i+" ]"}},xr.prototype.interfaces_=function(){return[]},xr.prototype.getClass=function(){return xr},xr.getBit=function(n,i){return n&1<<i?1:0},xr.signExpBits=function(n){return n>>52},xr.zeroLowerBits=function(n,i){return n&~((1<<i)-1)},xr.numCommonMostSigMantissaBits=function(n,i){for(var s=0,u=52;u>=0;u--){if(xr.getBit(n,u)!==xr.getBit(i,u))return s;s++}return 52};var Oo=function(){this._commonCoord=null,this._ccFilter=new zs},Th={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Oo.prototype.addCommonBits=function(n){var i=new Do(this._commonCoord);n.apply(i),n.geometryChanged()},Oo.prototype.removeCommonBits=function(n){if(this._commonCoord.x===0&&this._commonCoord.y===0)return n;var i=new I(this._commonCoord);i.x=-i.x,i.y=-i.y;var s=new Do(i);return n.apply(s),n.geometryChanged(),n},Oo.prototype.getCommonCoordinate=function(){return this._commonCoord},Oo.prototype.add=function(n){n.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Oo.prototype.interfaces_=function(){return[]},Oo.prototype.getClass=function(){return Oo},Th.CommonCoordinateFilter.get=function(){return zs},Th.Translater.get=function(){return Do},Object.defineProperties(Oo,Th);var zs=function(){this._commonBitsX=new xr,this._commonBitsY=new xr};zs.prototype.filter=function(n){this._commonBitsX.add(n.x),this._commonBitsY.add(n.y)},zs.prototype.getCommonCoordinate=function(){return new I(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},zs.prototype.interfaces_=function(){return[Y]},zs.prototype.getClass=function(){return zs};var Do=function(){this.trans=null;var n=arguments[0];this.trans=n};Do.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)},Do.prototype.isDone=function(){return!1},Do.prototype.isGeometryChanged=function(){return!0},Do.prototype.interfaces_=function(){return[wn]},Do.prototype.getClass=function(){return Do};var jn=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()};jn.prototype.selfSnap=function(n){return new On(n).snapTo(n,this._snapTolerance)},jn.prototype.removeCommonBits=function(n){this._cbr=new Oo,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},jn.prototype.prepareResult=function(n){return this._cbr.addCommonBits(n),n},jn.prototype.getResultGeometry=function(n){var i=this.snap(this._geom),s=se.overlayOp(i[0],i[1],n);return this.prepareResult(s)},jn.prototype.checkValid=function(n){n.isValid()||Ft.out.println("Snapped geometry is invalid")},jn.prototype.computeSnapTolerance=function(){this._snapTolerance=On.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},jn.prototype.snap=function(n){var i=this.removeCommonBits(n);return On.snap(i[0],i[1],this._snapTolerance)},jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn},jn.overlayOp=function(n,i,s){return new jn(n,i).getResultGeometry(s)},jn.union=function(n,i){return jn.overlayOp(n,i,se.UNION)},jn.intersection=function(n,i){return jn.overlayOp(n,i,se.INTERSECTION)},jn.symDifference=function(n,i){return jn.overlayOp(n,i,se.SYMDIFFERENCE)},jn.difference=function(n,i){return jn.overlayOp(n,i,se.DIFFERENCE)};var Er=function(n,i){this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i};Er.prototype.getResultGeometry=function(n){var i=null,s=!1,u=null;try{i=se.overlayOp(this._geom[0],this._geom[1],n),s=!0}catch(c){if(!(c instanceof pe))throw c;u=c}if(!s)try{i=jn.overlayOp(this._geom[0],this._geom[1],n)}catch(c){throw c instanceof pe?u:c}return i},Er.prototype.interfaces_=function(){return[]},Er.prototype.getClass=function(){return Er},Er.overlayOp=function(n,i,s){return new Er(n,i).getResultGeometry(s)},Er.union=function(n,i){return Er.overlayOp(n,i,se.UNION)},Er.intersection=function(n,i){return Er.overlayOp(n,i,se.INTERSECTION)},Er.symDifference=function(n,i){return Er.overlayOp(n,i,se.SYMDIFFERENCE)},Er.difference=function(n,i){return Er.overlayOp(n,i,se.DIFFERENCE)};var Tu=function(){this.mce=null,this.chainIndex=null;var n=arguments[0],i=arguments[1];this.mce=n,this.chainIndex=i};Tu.prototype.computeIntersections=function(n,i){this.mce.computeIntersectsForChain(this.chainIndex,n.mce,n.chainIndex,i)},Tu.prototype.interfaces_=function(){return[]},Tu.prototype.getClass=function(){return Tu};var Wr=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}},Ah={INSERT:{configurable:!0},DELETE:{configurable:!0}};Wr.prototype.isDelete=function(){return this._eventType===Wr.DELETE},Wr.prototype.setDeleteEventIndex=function(n){this._deleteEventIndex=n},Wr.prototype.getObject=function(){return this._obj},Wr.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},Wr.prototype.getInsertEvent=function(){return this._insertEvent},Wr.prototype.isInsert=function(){return this._eventType===Wr.INSERT},Wr.prototype.isSameLabel=function(n){return this._label!==null&&this._label===n._label},Wr.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Wr.prototype.interfaces_=function(){return[N]},Wr.prototype.getClass=function(){return Wr},Ah.INSERT.get=function(){return 1},Ah.DELETE.get=function(){return 2},Object.defineProperties(Wr,Ah);var Ml=function(){};Ml.prototype.interfaces_=function(){return[]},Ml.prototype.getClass=function(){return Ml};var ir=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};ir.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(ir.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},ir.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},ir.prototype.setIsDoneIfProperInt=function(n){this._isDoneWhenProperInt=n},ir.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},ir.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},ir.prototype.hasProperIntersection=function(){return this._hasProper},ir.prototype.hasIntersection=function(){return this._hasIntersection},ir.prototype.isDone=function(){return this._isDone},ir.prototype.isBoundaryPoint=function(n,i){return i!==null&&(!!this.isBoundaryPointInternal(n,i[0])||!!this.isBoundaryPointInternal(n,i[1]))},ir.prototype.setBoundaryNodes=function(n,i){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=n,this._bdyNodes[1]=i},ir.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))))},ir.prototype.interfaces_=function(){return[]},ir.prototype.getClass=function(){return ir},ir.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var q1=function(n){function i(){n.call(this),this.events=new Z,this.nOverlaps=null}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.prepareEvents=function(){_i.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 ir&&$(arguments[0],tt)&&$(arguments[1],tt)){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"&&$(arguments[0],tt)&&arguments[1]instanceof ir){var U=arguments[0],K=arguments[1];arguments[2]?this.addEdges(U,null):this.addEdges(U),this.computeIntersections(K)}}},i.prototype.addEdge=function(s,u){for(var c=s.getMonotoneChainEdge(),m=c.getStartIndexes(),E=0;E<m.length-1;E++){var A=new Tu(c,E),U=new Wr(u,c.getMinX(E),A);this.events.add(U),this.events.add(new Wr(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 K=U.getObject();c.isSameLabel(U)||(E.computeIntersections(K,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}(Ml),Zi=function(){this._min=S.POSITIVE_INFINITY,this._max=S.NEGATIVE_INFINITY},lm={NodeComparator:{configurable:!0}};Zi.prototype.getMin=function(){return this._min},Zi.prototype.intersects=function(n,i){return!(this._min>i||this._max<n)},Zi.prototype.getMax=function(){return this._max},Zi.prototype.toString=function(){return Yt.toLineString(new I(this._min,0),new I(this._max,0))},Zi.prototype.interfaces_=function(){return[]},Zi.prototype.getClass=function(){return Zi},lm.NodeComparator.get=function(){return Au},Object.defineProperties(Zi,lm);var Au=function(){};Au.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},Au.prototype.interfaces_=function(){return[B]},Au.prototype.getClass=function(){return Au};var X1=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}(Zi),Y1=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}(Zi),Ji=function(){this._leaves=new Z,this._root=null,this._level=0};Ji.prototype.buildTree=function(){_i.sort(this._leaves,new Zi.NodeComparator);for(var n=this._leaves,i=null,s=new Z;;){if(this.buildLevel(n,s),s.size()===1)return s.get(0);i=n,n=s,s=i}},Ji.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 X1(n,i,s))},Ji.prototype.query=function(n,i,s){this.init(),this._root.query(n,i,s)},Ji.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},Ji.prototype.printNode=function(n){Ft.out.println(Yt.toLineString(new I(n._min,this._level),new I(n._max,this._level)))},Ji.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},Ji.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 Y1(n.get(s),n.get(s+1));i.add(c)}}},Ji.prototype.interfaces_=function(){return[]},Ji.prototype.getClass=function(){return Ji};var ma=function(){this._items=new Z};ma.prototype.visitItem=function(n){this._items.add(n)},ma.prototype.getItems=function(){return this._items},ma.prototype.interfaces_=function(){return[Ao]},ma.prototype.getClass=function(){return ma};var ga=function(){this._index=null;var n=arguments[0];if(!$(n,ce))throw new P("Argument must be Polygonal");this._index=new os(n)},Ch={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};ga.prototype.locate=function(n){var i=new F(n),s=new ya(i);return this._index.query(n.y,n.y,s),i.getLocation()},ga.prototype.interfaces_=function(){return[fa]},ga.prototype.getClass=function(){return ga},Ch.SegmentVisitor.get=function(){return ya},Ch.IntervalIndexedGeometry.get=function(){return os},Object.defineProperties(ga,Ch);var ya=function(){this._counter=null;var n=arguments[0];this._counter=n};ya.prototype.visitItem=function(n){var i=n;this._counter.countSegment(i.getCoordinate(0),i.getCoordinate(1))},ya.prototype.interfaces_=function(){return[Ao]},ya.prototype.getClass=function(){return ya};var os=function(){this._index=new Ji;var n=arguments[0];this.init(n)};os.prototype.init=function(n){for(var i=er.getLines(n).iterator();i.hasNext();){var s=i.next().getCoordinates();this.addLine(s)}},os.prototype.addLine=function(n){for(var i=1;i<n.length;i++){var s=new Zt(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)}},os.prototype.query=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new ma;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)}},os.prototype.interfaces_=function(){return[]},os.prototype.getClass=function(){return os};var Cu=function(n){function i(){if(n.call(this),this._parentGeom=null,this._lineEdgeMap=new ua,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Ei,arguments.length===2){var s=arguments[0],u=arguments[1],c=w.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;V.NONE,c.getLocation(s,bt.ON)===V.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 ir(c,!0,!1);A.setIsDoneIfProperInt(E);var U=this.createEdgeSetIntersector(),K=this._parentGeom instanceof an||this._parentGeom instanceof Wt||this._parentGeom instanceof ln,pt=m||!K;return U.computeIntersections(this._edges,A,pt),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 ir(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 Kt){var s=arguments[0].getCoordinate();this.insertPoint(this._argIndex,s,V.INTERIOR)}else if(arguments[0]instanceof I){var u=arguments[0];this.insertPoint(this._argIndex,u,V.INTERIOR)}},i.prototype.addPolygon=function(s){this.addPolygonRing(s.getExteriorRing(),V.EXTERIOR,V.INTERIOR);for(var u=0;u<s.getNumInteriorRing();u++){var c=s.getInteriorRingN(u);this.addPolygonRing(c,V.INTERIOR,V.EXTERIOR)}},i.prototype.addEdge=function(s){this.insertEdge(s);var u=s.getCoordinates();this.insertPoint(this._argIndex,u[0],V.BOUNDARY),this.insertPoint(this._argIndex,u[u.length-1],V.BOUNDARY)},i.prototype.addLineString=function(s){var u=Q.removeRepeatedPoints(s.getCoordinates());if(u.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=u[0],null;var c=new El(u,new on(this._argIndex,V.INTERIOR));this._lineEdgeMap.put(s,c),this.insertEdge(c),Pt.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===V.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=Q.removeRepeatedPoints(s.getCoordinates());if(m.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=m[0],null;var E=u,A=c;J.isCCW(m)&&(E=c,A=u);var U=new El(m,new on(this._argIndex,V.BOUNDARY,E,A));this._lineEdgeMap.put(s,U),this.insertEdge(U),this.insertPoint(this._argIndex,m[0],V.BOUNDARY)},i.prototype.insertPoint=function(s,u,c){var m=this._nodes.addNode(u),E=m.getLabel();E===null?m._label=new on(s,c):E.setLocation(s,c)},i.prototype.createEdgeSetIntersector=function(){return new q1},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 ln&&(this._useBoundaryDeterminationRule=!1),s instanceof Wt)this.addPolygon(s);else if(s instanceof zt)this.addLineString(s);else if(s instanceof Kt)this.addPoint(s);else if(s instanceof he)this.addCollection(s);else if(s instanceof W)this.addCollection(s);else if(s instanceof ln)this.addCollection(s);else{if(!(s instanceof gn))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 $(this._parentGeom,ce)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new ga(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)?V.BOUNDARY:V.INTERIOR},i}(Tn),va=function(){if(this._li=new pn,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 Cu(0,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=w.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 Cu(0,i,u),this._arg[1]=new Cu(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 Cu(0,c,E),this._arg[1]=new Cu(1,m,E)}};va.prototype.getArgGeometry=function(n){return this._arg[n].getGeometry()},va.prototype.setComputationPrecision=function(n){this._resultPrecisionModel=n,this._li.setPrecisionModel(this._resultPrecisionModel)},va.prototype.interfaces_=function(){return[]},va.prototype.getClass=function(){return va};var ss=function(){};ss.prototype.interfaces_=function(){return[]},ss.prototype.getClass=function(){return ss},ss.map=function(){if(arguments[0]instanceof yt&&$(arguments[1],ss.MapOp)){for(var n=arguments[0],i=arguments[1],s=new Z,u=0;u<n.getNumGeometries();u++){var c=i.map(n.getGeometryN(u));c!==null&&s.add(c)}return n.getFactory().buildGeometry(s)}if($(arguments[0],j)&&$(arguments[1],ss.MapOp)){for(var m=arguments[0],E=arguments[1],A=new Z,U=m.iterator();U.hasNext();){var K=U.next(),pt=E.map(K);pt!==null&&A.add(pt)}return A}},ss.MapOp=function(){};var se=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u),this._ptLocator=new Ei,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new xi,this._resultPolyList=new Z,this._resultLineList=new Z,this._resultPointList=new Z,this._graph=new Tn(new tm),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 on(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 Z;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)!==V.EXTERIOR)return!0}return!1},i.prototype.replaceCollapsedEdges=function(){for(var s=new Z,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 Z;this._arg[0].computeSplitEdges(u),this._arg[1].computeSplitEdges(u),this.insertUniqueEdges(u),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),is.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(s),this.cancelDuplicateResultEdges();var c=new Gr(this._geomFact);c.add(this._graph),this._resultPolyList=c.getPolygons();var m=new Fi(this,this._geomFact,this._ptLocator);this._resultLineList=m.build(s);var E=new Bs(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):(Pt.isTrue(!m.isNull(E,bt.LEFT),"depth of LEFT side has not been initialized"),c.setLocation(E,bt.LEFT,m.getLocation(E,bt.LEFT)),Pt.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}(va);se.overlayOp=function(n,i,s){return new se(n,i).getResultGeometry(s)},se.intersection=function(n,i){if(n.isEmpty()||i.isEmpty())return se.createEmptyResult(se.INTERSECTION,n,i,n.getFactory());if(n.isGeometryCollection()){var s=i;return Us.map(n,{interfaces_:function(){return[ss.MapOp]},map:function(u){return u.intersection(s)}})}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),Er.overlayOp(n,i,se.INTERSECTION)},se.symDifference=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return se.createEmptyResult(se.SYMDIFFERENCE,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),Er.overlayOp(n,i,se.SYMDIFFERENCE)},se.resultDimension=function(n,i,s){var u=i.getDimension(),c=s.getDimension(),m=-1;switch(n){case se.INTERSECTION:m=Math.min(u,c);break;case se.UNION:m=Math.max(u,c);break;case se.DIFFERENCE:m=u;break;case se.SYMDIFFERENCE:m=Math.max(u,c)}return m},se.createEmptyResult=function(n,i,s,u){var c=null;switch(se.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},se.difference=function(n,i){return n.isEmpty()?se.createEmptyResult(se.DIFFERENCE,n,i,n.getFactory()):i.isEmpty()?n.copy():(n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),Er.overlayOp(n,i,se.DIFFERENCE))},se.isResultOfOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=n.getLocation(0),u=n.getLocation(1);return se.isResultOfOp(s,u,i)}if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2];switch(c===V.BOUNDARY&&(c=V.INTERIOR),m===V.BOUNDARY&&(m=V.INTERIOR),E){case se.INTERSECTION:return c===V.INTERIOR&&m===V.INTERIOR;case se.UNION:return c===V.INTERIOR||m===V.INTERIOR;case se.DIFFERENCE:return c===V.INTERIOR&&m!==V.INTERIOR;case se.SYMDIFFERENCE:return c===V.INTERIOR&&m!==V.INTERIOR||c!==V.INTERIOR&&m===V.INTERIOR}return!1}},se.INTERSECTION=1,se.UNION=2,se.DIFFERENCE=3,se.SYMDIFFERENCE=4;var Fo=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Ei,this._seg=new Zt;var n=arguments[0],i=arguments[1];this._g=n,this._boundaryDistanceTolerance=i,this._linework=this.extractLinework(n)};Fo.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},Fo.prototype.getLocation=function(n){return this.isWithinToleranceOfBoundary(n)?V.BOUNDARY:this._ptLocator.locate(n,this._g)},Fo.prototype.extractLinework=function(n){var i=new _a;n.apply(i);var s=i.getLinework(),u=ue.toLineStringArray(s);return n.getFactory().createMultiLineString(u)},Fo.prototype.interfaces_=function(){return[]},Fo.prototype.getClass=function(){return Fo};var _a=function(){this._linework=null,this._linework=new Z};_a.prototype.getLinework=function(){return this._linework},_a.prototype.filter=function(n){if(n instanceof Wt){var i=n;this._linework.add(i.getExteriorRing());for(var s=0;s<i.getNumInteriorRing();s++)this._linework.add(i.getInteriorRingN(s))}},_a.prototype.interfaces_=function(){return[Cn]},_a.prototype.getClass=function(){return _a};var as=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var n=arguments[0];this._g=n};as.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)},as.prototype.setSidesToGenerate=function(n,i){this._doLeft=n,this._doRight=i},as.prototype.getPoints=function(n){for(var i=new Z,s=er.getLines(this._g).iterator();s.hasNext();){var u=s.next();this.extractPoints(u,n,i)}return i},as.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,K=(i.x+n.x)/2,pt=(i.y+n.y)/2;if(this._doLeft){var dt=new I(K-U,pt+A);u.add(dt)}if(this._doRight){var Rt=new I(K+U,pt-A);u.add(Rt)}},as.prototype.interfaces_=function(){return[]},as.prototype.getClass=function(){return as};var ti=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 Z;var i=arguments[0],s=arguments[1],u=arguments[2];this._boundaryDistanceTolerance=n.computeBoundaryDistanceTolerance(i,s),this._geom=[i,s,u],this._locFinder=[new Fo(this._geom[0],this._boundaryDistanceTolerance),new Fo(this._geom[1],this._boundaryDistanceTolerance),new Fo(this._geom[2],this._boundaryDistanceTolerance)]},cm={TOLERANCE:{configurable:!0}};ti.prototype.reportResult=function(n,i,s){Ft.out.println("Overlay result invalid - A:"+V.toLocationSymbol(i[0])+" B:"+V.toLocationSymbol(i[1])+" expected:"+(s?"i":"e")+" actual:"+V.toLocationSymbol(i[2]))},ti.prototype.isValid=function(n){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var i=this.checkValid(n);return i},ti.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),!!ti.hasLocation(this._location,V.BOUNDARY)||this.isValidResult(u,this._location)}},ti.prototype.addTestPts=function(n){var i=new as(n);this._testCoords.addAll(i.getPoints(5*this._boundaryDistanceTolerance))},ti.prototype.isValidResult=function(n,i){var s=se.isResultOfOp(i[0],i[1],n),u=!(s^i[2]===V.INTERIOR);return u||this.reportResult(n,i,s),u},ti.prototype.getInvalidLocation=function(){return this._invalidLocation},ti.prototype.interfaces_=function(){return[]},ti.prototype.getClass=function(){return ti},ti.hasLocation=function(n,i){for(var s=0;s<3;s++)if(n[s]===i)return!0;return!1},ti.computeBoundaryDistanceTolerance=function(n,i){return Math.min(On.computeSizeBasedSnapTolerance(n),On.computeSizeBasedSnapTolerance(i))},ti.isValid=function(n,i,s,u){return new ti(n,i,u).isValid(s)},cm.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(ti,cm);var ei=function n(i){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=n.extractFactory(i),this._inputGeoms=i};ei.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)}},ei.prototype.combine=function(){for(var n=new Z,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)},ei.prototype.interfaces_=function(){return[]},ei.prototype.getClass=function(){return ei},ei.combine=function(){if(arguments.length===1){var n=arguments[0];return new ei(n).combine()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new ei(ei.createList(i,s)).combine()}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];return new ei(ei.createList(u,c,m)).combine()}},ei.extractFactory=function(n){return n.isEmpty()?null:n.iterator().next().getFactory()},ei.createList=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new Z;return s.add(n),s.add(i),s}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2],E=new Z;return E.add(u),E.add(c),E.add(m),E}};var zn=function(){this._inputPolys=null,this._geomFactory=null;var n=arguments[0];this._inputPolys=n,this._inputPolys===null&&(this._inputPolys=new Z)},hm={STRTREE_NODE_CAPACITY:{configurable:!0}};zn.prototype.reduceToGeometries=function(n){for(var i=new Z,s=n.iterator();s.hasNext();){var u=s.next(),c=null;$(u,tt)?c=this.unionTree(u):u instanceof yt&&(c=u),i.add(c)}return i},zn.prototype.extractByEnvelope=function(n,i,s){for(var u=new Z,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)},zn.prototype.unionOptimized=function(n,i){var s=n.getEnvelopeInternal(),u=i.getEnvelopeInternal();if(!s.intersects(u))return ei.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)},zn.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 $d(zn.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)},zn.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=zn.getGeometry(i,s);return this.unionSafe(c,null)}if(u-s==2)return this.unionSafe(zn.getGeometry(i,s),zn.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)}},zn.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},zn.prototype.unionSafe=function(n,i){return n===null&&i===null?null:n===null?i.copy():i===null?n.copy():this.unionOptimized(n,i)},zn.prototype.unionActual=function(n,i){return zn.restrictToPolygons(n.union(i))},zn.prototype.unionTree=function(n){var i=this.reduceToGeometries(n);return this.binaryUnion(i)},zn.prototype.unionUsingEnvelopeIntersection=function(n,i,s){var u=new Z,c=this.extractByEnvelope(s,n,u),m=this.extractByEnvelope(s,i,u),E=this.unionActual(c,m);return u.add(E),ei.combine(u)},zn.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)}},zn.prototype.interfaces_=function(){return[]},zn.prototype.getClass=function(){return zn},zn.restrictToPolygons=function(n){if($(n,ce))return n;var i=po.getPolygons(n);return i.size()===1?i.get(0):n.getFactory().createMultiPolygon(ue.toPolygonArray(i))},zn.getGeometry=function(n,i){return i>=n.size()?null:n.get(i)},zn.union=function(n){return new zn(n).union()},hm.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(zn,hm);var Pu=function(){};Pu.prototype.interfaces_=function(){return[]},Pu.prototype.getClass=function(){return Pu},Pu.union=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return se.createEmptyResult(se.UNION,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),Er.overlayOp(n,i,se.UNION)},r.GeoJSONReader=_h,r.GeoJSONWriter=Xd,r.OverlayOp=se,r.UnionOp=Pu,r.BufferOp=tr,Object.defineProperty(r,"__esModule",{value:!0})})});var O1=Ht((a7,N1)=>{N1.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}});var U1=Ht((u7,F1)=>{var D1=O1();F1.exports=function(r,t){Array.isArray(t)||(t=[]),r.length>0&&t.push(D1([0,0],r[0]));for(var e=0;e<r.length-1;e++){var o=r[e],a=r[e+1],l=o[0],h=o[1],f=a[0],p=a[1],d=[.75*l+.25*f,.75*h+.25*p],g=[.25*l+.75*f,.25*h+.75*p];t.push(d),t.push(g)}return r.length>1&&t.push(D1([0,0],r[r.length-1])),t}});var wo=Wn(Cm(),1);var Zf="157";var rx=0,Pm=1,ix=2;var Jg=1,ox=2,Wo=3,vs=0,di=1,Xo=2;var ms=0,ka=1,Im=2,Rm=3,Lm=4,sx=5,Fa=100,ax=101,ux=102,Nm=103,Om=104,lx=200,cx=201,hx=202,fx=203,Kg=204,jg=205,px=206,dx=207,mx=208,gx=209,yx=210,vx=0,_x=1,xx=2,hf=3,Ex=4,Mx=5,Sx=6,wx=7,Qg=0,bx=1,Tx=2,gs=0,Ax=1,Cx=2,Px=3,Ix=4,Rx=5,t0=300,Ha=301,Wa=302,ff=303,pf=304,hc=306,df=1e3,to=1001,mf=1002,ri=1003,Dm=1004;var Oh=1005;var Bi=1006,Lx=1007;var Bu=1008;var ys=1009,Nx=1010,Ox=1011,Jf=1012,e0=1013,ps=1014,ds=1015,zu=1016,n0=1017,r0=1018,Xs=1020,Dx=1021,eo=1023,Fx=1024,Ux=1025,Ys=1026,qa=1027,Bx=1028,i0=1029,zx=1030,o0=1031,s0=1033,Dh=33776,Fh=33777,Uh=33778,Bh=33779,Fm=35840,Um=35841,Bm=35842,zm=35843,kx=36196,km=37492,Gm=37496,Vm=37808,Hm=37809,Wm=37810,qm=37811,Xm=37812,Ym=37813,$m=37814,Zm=37815,Jm=37816,Km=37817,jm=37818,Qm=37819,tg=37820,eg=37821,zh=36492,ng=36494,rg=36495,Gx=36283,ig=36284,og=36285,sg=36286;var Xl=2300,Yl=2301,kh=2302,ag=2400,ug=2401,lg=2402;var a0=3e3,$s=3001,Vx=3200,Hx=3201,Wx=0,qx=1,zi="",Or="srgb",Zo="srgb-linear",Kf="display-p3",fc="display-p3-linear",$l="linear",Dn="srgb",Zl="rec709",Jl="p3";var Gh=7680;var Xx=519,Yx=512,$x=513,Zx=514,Jx=515,Kx=516,jx=517,Qx=518,tE=519,cg=35044;var hg="300 es",gf=1035,Yo=2e3,Kl=2001,_s=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,h=a.length;l<h;l++)a[l].call(this,t);t.target=null}}},qr=["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 Vh=Math.PI/180,yf=180/Math.PI;function Hu(){let r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(qr[r&255]+qr[r>>8&255]+qr[r>>16&255]+qr[r>>24&255]+"-"+qr[t&255]+qr[t>>8&255]+"-"+qr[t>>16&15|64]+qr[t>>24&255]+"-"+qr[e&63|128]+qr[e>>8&255]+"-"+qr[e>>16&255]+qr[e>>24&255]+qr[o&255]+qr[o>>8&255]+qr[o>>16&255]+qr[o>>24&255]).toLowerCase()}function pi(r,t,e){return Math.max(t,Math.min(e,r))}function eE(r,t){return(r%t+t)%t}function Hh(r,t,e){return(1-e)*r+e*t}function fg(r){return(r&r-1)===0&&r!==0}function vf(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Iu(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 fi(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(pi(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,h=this.y-t.y;return this.x=l*o-h*a+t.x,this.y=l*a+h*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,h,f,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,h,f,p,d)}set(t,e,o,a,l,h,f,p,d){let g=this.elements;return g[0]=t,g[1]=a,g[2]=f,g[3]=e,g[4]=l,g[5]=p,g[6]=o,g[7]=h,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,h=o[0],f=o[3],p=o[6],d=o[1],g=o[4],_=o[7],y=o[2],M=o[5],b=o[8],T=a[0],x=a[3],v=a[6],P=a[1],S=a[4],L=a[7],N=a[2],G=a[5],B=a[8];return l[0]=h*T+f*P+p*N,l[3]=h*x+f*S+p*G,l[6]=h*v+f*L+p*B,l[1]=d*T+g*P+_*N,l[4]=d*x+g*S+_*G,l[7]=d*v+g*L+_*B,l[2]=y*T+M*P+b*N,l[5]=y*x+M*S+b*G,l[8]=y*v+M*L+b*B,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],h=t[4],f=t[5],p=t[6],d=t[7],g=t[8];return e*h*g-e*f*d-o*l*g+o*f*p+a*l*d-a*h*p}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],l=t[3],h=t[4],f=t[5],p=t[6],d=t[7],g=t[8],_=g*h-f*d,y=f*p-g*l,M=d*l-h*p,b=e*_+o*y+a*M;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);let T=1/b;return t[0]=_*T,t[1]=(a*d-g*o)*T,t[2]=(f*o-a*h)*T,t[3]=y*T,t[4]=(g*e-a*p)*T,t[5]=(a*l-f*e)*T,t[6]=M*T,t[7]=(o*p-d*e)*T,t[8]=(h*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,h,f){let p=Math.cos(l),d=Math.sin(l);return this.set(o*p,o*d,-o*(p*h+d*f)+h+t,-a*d,a*p,-a*(-d*h+p*f)+f+e,0,0,1),this}scale(t,e){return this.premultiply(Wh.makeScale(t,e)),this}rotate(t){return this.premultiply(Wh.makeRotation(-t)),this}translate(t,e){return this.premultiply(Wh.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)}},Wh=new ye;function u0(r){for(let t=r.length-1;t>=0;--t)if(r[t]>=65535)return!0;return!1}function jl(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function nE(){let r=jl("canvas");return r.style.display="block",r}var pg={};function Fu(r){r in pg||(pg[r]=!0,console.warn(r))}var dg=new ye().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),mg=new ye().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),wl={[Zo]:{transfer:$l,primaries:Zl,toReference:r=>r,fromReference:r=>r},[Or]:{transfer:Dn,primaries:Zl,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[fc]:{transfer:$l,primaries:Jl,toReference:r=>r.applyMatrix3(mg),fromReference:r=>r.applyMatrix3(dg)},[Kf]:{transfer:Dn,primaries:Jl,toReference:r=>r.convertSRGBToLinear().applyMatrix3(mg),fromReference:r=>r.applyMatrix3(dg).convertLinearToSRGB()}},rE=new Set([Zo,fc]),Mn={enabled:!0,_workingColorSpace:Zo,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(!rE.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=wl[t].toReference,a=wl[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 wl[r].primaries},getTransfer:function(r){return r===zi?$l:wl[r].transfer}};function Ga(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function qh(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var xa,Ql=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{xa===void 0&&(xa=jl("canvas")),xa.width=t.width,xa.height=t.height;let o=xa.getContext("2d");t instanceof ImageData?o.putImageData(t,0,0):o.drawImage(t,0,0,t.width,t.height),e=xa}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=jl("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 h=0;h<l.length;h++)l[h]=Ga(l[h]/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(Ga(e[o]/255)*255):e[o]=Ga(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}},iE=0,tc=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:iE++}),this.uuid=Hu(),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 h=0,f=a.length;h<f;h++)a[h].isDataTexture?l.push(Xh(a[h].image)):l.push(Xh(a[h]))}else l=Xh(a);o.url=l}return e||(t.images[this.uuid]=o),o}};function Xh(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?Ql.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 oE=0,no=class r extends _s{constructor(t=r.DEFAULT_IMAGE,e=r.DEFAULT_MAPPING,o=to,a=to,l=Bi,h=Bu,f=eo,p=ys,d=r.DEFAULT_ANISOTROPY,g=zi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:oE++}),this.uuid=Hu(),this.name="",this.source=new tc(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=o,this.wrapT=a,this.magFilter=l,this.minFilter=h,this.anisotropy=d,this.format=f,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:(Fu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=g===$s?Or:zi),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!==t0)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case df:t.x=t.x-Math.floor(t.x);break;case to:t.x=t.x<0?0:1;break;case mf: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 df:t.y=t.y-Math.floor(t.y);break;case to:t.y=t.y<0?0:1;break;case mf: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 Fu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Or?$s:a0}set encoding(t){Fu("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===$s?Or:zi}};no.DEFAULT_IMAGE=null;no.DEFAULT_MAPPING=t0;no.DEFAULT_ANISOTROPY=1;var Dr=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,h=t.elements;return this.x=h[0]*e+h[4]*o+h[8]*a+h[12]*l,this.y=h[1]*e+h[5]*o+h[9]*a+h[13]*l,this.z=h[2]*e+h[6]*o+h[10]*a+h[14]*l,this.w=h[3]*e+h[7]*o+h[11]*a+h[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],b=p[9],T=p[2],x=p[6],v=p[10];if(Math.abs(g-y)<.01&&Math.abs(_-T)<.01&&Math.abs(b-x)<.01){if(Math.abs(g+y)<.1&&Math.abs(_+T)<.1&&Math.abs(b+x)<.1&&Math.abs(d+M+v-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let S=(d+1)/2,L=(M+1)/2,N=(v+1)/2,G=(g+y)/4,B=(_+T)/4,I=(b+x)/4;return S>L&&S>N?S<.01?(o=0,a=.707106781,l=.707106781):(o=Math.sqrt(S),a=G/o,l=B/o):L>N?L<.01?(o=.707106781,a=0,l=.707106781):(a=Math.sqrt(L),o=G/a,l=I/a):N<.01?(o=.707106781,a=.707106781,l=0):(l=Math.sqrt(N),o=B/l,a=I/l),this.set(o,a,l,e),this}let P=Math.sqrt((x-b)*(x-b)+(_-T)*(_-T)+(y-g)*(y-g));return Math.abs(P)<.001&&(P=1),this.x=(x-b)/P,this.y=(_-T)/P,this.z=(y-g)/P,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}},_f=class extends _s{constructor(t=1,e=1,o={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Dr(0,0,t,e),this.scissorTest=!1,this.viewport=new Dr(0,0,t,e);let a={width:t,height:e,depth:1};o.encoding!==void 0&&(Fu("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),o.colorSpace=o.encoding===$s?Or:zi),o=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Bi,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},o),this.texture=new no(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 tc(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"})}},Jo=class extends _f{constructor(t=1,e=1,o={}){super(t,e,o),this.isWebGLRenderTarget=!0}},ec=class extends no{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=ri,this.minFilter=ri,this.wrapR=to,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var xf=class extends no{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=ri,this.minFilter=ri,this.wrapR=to,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var xs=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,h,f){let p=o[a+0],d=o[a+1],g=o[a+2],_=o[a+3],y=l[h+0],M=l[h+1],b=l[h+2],T=l[h+3];if(f===0){t[e+0]=p,t[e+1]=d,t[e+2]=g,t[e+3]=_;return}if(f===1){t[e+0]=y,t[e+1]=M,t[e+2]=b,t[e+3]=T;return}if(_!==T||p!==y||d!==M||g!==b){let x=1-f,v=p*y+d*M+g*b+_*T,P=v>=0?1:-1,S=1-v*v;if(S>Number.EPSILON){let N=Math.sqrt(S),G=Math.atan2(N,v*P);x=Math.sin(x*G)/N,f=Math.sin(f*G)/N}let L=f*P;if(p=p*x+y*L,d=d*x+M*L,g=g*x+b*L,_=_*x+T*L,x===1-f){let N=1/Math.sqrt(p*p+d*d+g*g+_*_);p*=N,d*=N,g*=N,_*=N}}t[e]=p,t[e+1]=d,t[e+2]=g,t[e+3]=_}static multiplyQuaternionsFlat(t,e,o,a,l,h){let f=o[a],p=o[a+1],d=o[a+2],g=o[a+3],_=l[h],y=l[h+1],M=l[h+2],b=l[h+3];return t[e]=f*b+g*_+p*M-d*y,t[e+1]=p*b+g*y+d*_-f*M,t[e+2]=d*b+g*M+f*y-p*_,t[e+3]=g*b-f*_-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,h=t._order,f=Math.cos,p=Math.sin,d=f(o/2),g=f(a/2),_=f(l/2),y=p(o/2),M=p(a/2),b=p(l/2);switch(h){case"XYZ":this._x=y*g*_+d*M*b,this._y=d*M*_-y*g*b,this._z=d*g*b+y*M*_,this._w=d*g*_-y*M*b;break;case"YXZ":this._x=y*g*_+d*M*b,this._y=d*M*_-y*g*b,this._z=d*g*b-y*M*_,this._w=d*g*_+y*M*b;break;case"ZXY":this._x=y*g*_-d*M*b,this._y=d*M*_+y*g*b,this._z=d*g*b+y*M*_,this._w=d*g*_-y*M*b;break;case"ZYX":this._x=y*g*_-d*M*b,this._y=d*M*_+y*g*b,this._z=d*g*b-y*M*_,this._w=d*g*_+y*M*b;break;case"YZX":this._x=y*g*_+d*M*b,this._y=d*M*_+y*g*b,this._z=d*g*b-y*M*_,this._w=d*g*_-y*M*b;break;case"XZY":this._x=y*g*_-d*M*b,this._y=d*M*_-y*g*b,this._z=d*g*b+y*M*_,this._w=d*g*_+y*M*b;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+h)}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],h=e[1],f=e[5],p=e[9],d=e[2],g=e[6],_=e[10],y=o+f+_;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=(h-a)*M}else if(o>f&&o>_){let M=2*Math.sqrt(1+o-f-_);this._w=(g-p)/M,this._x=.25*M,this._y=(a+h)/M,this._z=(l+d)/M}else if(f>_){let M=2*Math.sqrt(1+f-o-_);this._w=(l-d)/M,this._x=(a+h)/M,this._y=.25*M,this._z=(p+g)/M}else{let M=2*Math.sqrt(1+_-o-f);this._w=(h-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(pi(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,h=t._w,f=e._x,p=e._y,d=e._z,g=e._w;return this._x=o*g+h*f+a*d-l*p,this._y=a*g+h*p+l*f-o*d,this._z=l*g+h*d+o*p-a*f,this._w=h*g-o*f-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,h=this._w,f=h*t._w+o*t._x+a*t._y+l*t._z;if(f<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,f=-f):this.copy(t),f>=1)return this._w=h,this._x=o,this._y=a,this._z=l,this;let p=1-f*f;if(p<=Number.EPSILON){let M=1-e;return this._w=M*h+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,f),_=Math.sin((1-e)*g)/d,y=Math.sin(e*g)/d;return this._w=h*_+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}},vt=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(gg.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(gg.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,h=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])*h,this.y=(l[1]*e+l[5]*o+l[9]*a+l[13])*h,this.z=(l[2]*e+l[6]*o+l[10]*a+l[14])*h,this}applyQuaternion(t){let e=this.x,o=this.y,a=this.z,l=t.x,h=t.y,f=t.z,p=t.w,d=p*e+h*a-f*o,g=p*o+f*e-l*a,_=p*a+l*o-h*e,y=-l*e-h*o-f*a;return this.x=d*p+y*-l+g*-f-_*-h,this.y=g*p+y*-h+_*-l-d*-f,this.z=_*p+y*-f+d*-h-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,h=e.x,f=e.y,p=e.z;return this.x=a*p-l*f,this.y=l*h-o*p,this.z=o*f-a*h,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 Yh.copy(this).projectOnVector(t),this.sub(Yh)}reflect(t){return this.sub(Yh.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(pi(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}},Yh=new vt,gg=new xs,Zs=class{constructor(t=new vt(1/0,1/0,1/0),e=new vt(-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(zo.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,o=t.count;e<o;e++)this.expandByPoint(zo.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=zo.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(),Ea.copy(t.boundingBox),Ea.applyMatrix4(t.matrixWorld),this.union(Ea);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 h=0,f=l.count;h<f;h++)zo.fromBufferAttribute(l,h).applyMatrix4(t.matrixWorld),this.expandByPoint(zo)}else a.boundingBox===null&&a.computeBoundingBox(),Ea.copy(a.boundingBox),Ea.applyMatrix4(t.matrixWorld),this.union(Ea)}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,zo),zo.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(Ru),bl.subVectors(this.max,Ru),Ma.subVectors(t.a,Ru),Sa.subVectors(t.b,Ru),wa.subVectors(t.c,Ru),us.subVectors(Sa,Ma),ls.subVectors(wa,Sa),ks.subVectors(Ma,wa);let e=[0,-us.z,us.y,0,-ls.z,ls.y,0,-ks.z,ks.y,us.z,0,-us.x,ls.z,0,-ls.x,ks.z,0,-ks.x,-us.y,us.x,0,-ls.y,ls.x,0,-ks.y,ks.x,0];return!$h(e,Ma,Sa,wa,bl)||(e=[1,0,0,0,1,0,0,0,1],!$h(e,Ma,Sa,wa,bl))?!1:(Tl.crossVectors(us,ls),e=[Tl.x,Tl.y,Tl.z],$h(e,Ma,Sa,wa,bl))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,zo).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(zo).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:(Bo[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Bo[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Bo[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Bo[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Bo[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Bo[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Bo[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Bo[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Bo),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)}},Bo=[new vt,new vt,new vt,new vt,new vt,new vt,new vt,new vt],zo=new vt,Ea=new Zs,Ma=new vt,Sa=new vt,wa=new vt,us=new vt,ls=new vt,ks=new vt,Ru=new vt,bl=new vt,Tl=new vt,Gs=new vt;function $h(r,t,e,o,a){for(let l=0,h=r.length-3;l<=h;l+=3){Gs.fromArray(r,l);let f=a.x*Math.abs(Gs.x)+a.y*Math.abs(Gs.y)+a.z*Math.abs(Gs.z),p=t.dot(Gs),d=e.dot(Gs),g=o.dot(Gs);if(Math.max(-Math.max(p,d,g),Math.min(p,d,g))>f)return!1}return!0}var sE=new Zs,Lu=new vt,Zh=new vt,ku=class{constructor(t=new vt,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):sE.setFromPoints(t).getCenter(o);let a=0;for(let l=0,h=t.length;l<h;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;Lu.subVectors(t,this.center);let e=Lu.lengthSq();if(e>this.radius*this.radius){let o=Math.sqrt(e),a=(o-this.radius)*.5;this.center.addScaledVector(Lu,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):(Zh.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Lu.copy(t.center).add(Zh)),this.expandByPoint(Lu.copy(t.center).sub(Zh))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},ko=new vt,Jh=new vt,Al=new vt,cs=new vt,Kh=new vt,Cl=new vt,jh=new vt,Ef=class{constructor(t=new vt,e=new vt(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,ko)),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=ko.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ko.copy(this.origin).addScaledVector(this.direction,e),ko.distanceToSquared(t))}distanceSqToSegment(t,e,o,a){Jh.copy(t).add(e).multiplyScalar(.5),Al.copy(e).sub(t).normalize(),cs.copy(this.origin).sub(Jh);let l=t.distanceTo(e)*.5,h=-this.direction.dot(Al),f=cs.dot(this.direction),p=-cs.dot(Al),d=cs.lengthSq(),g=Math.abs(1-h*h),_,y,M,b;if(g>0)if(_=h*p-f,y=h*f-p,b=l*g,_>=0)if(y>=-b)if(y<=b){let T=1/g;_*=T,y*=T,M=_*(_+h*y+2*f)+y*(h*_+y+2*p)+d}else y=l,_=Math.max(0,-(h*y+f)),M=-_*_+y*(y+2*p)+d;else y=-l,_=Math.max(0,-(h*y+f)),M=-_*_+y*(y+2*p)+d;else y<=-b?(_=Math.max(0,-(-h*l+f)),y=_>0?-l:Math.min(Math.max(-l,-p),l),M=-_*_+y*(y+2*p)+d):y<=b?(_=0,y=Math.min(Math.max(-l,-p),l),M=y*(y+2*p)+d):(_=Math.max(0,-(h*l+f)),y=_>0?l:Math.min(Math.max(-l,-p),l),M=-_*_+y*(y+2*p)+d);else y=h>0?-l:l,_=Math.max(0,-(h*y+f)),M=-_*_+y*(y+2*p)+d;return o&&o.copy(this.origin).addScaledVector(this.direction,_),a&&a.copy(Jh).addScaledVector(Al,y),M}intersectSphere(t,e){ko.subVectors(t.center,this.origin);let o=ko.dot(this.direction),a=ko.dot(ko)-o*o,l=t.radius*t.radius;if(a>l)return null;let h=Math.sqrt(l-a),f=o-h,p=o+h;return p<0?null:f<0?this.at(p,e):this.at(f,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,h,f,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,h=(t.max.y-y.y)*g):(l=(t.max.y-y.y)*g,h=(t.min.y-y.y)*g),o>h||l>a||((l>o||isNaN(o))&&(o=l),(h<a||isNaN(a))&&(a=h),_>=0?(f=(t.min.z-y.z)*_,p=(t.max.z-y.z)*_):(f=(t.max.z-y.z)*_,p=(t.min.z-y.z)*_),o>p||f>a)||((f>o||o!==o)&&(o=f),(p<a||a!==a)&&(a=p),a<0)?null:this.at(o>=0?o:a,e)}intersectsBox(t){return this.intersectBox(t,ko)!==null}intersectTriangle(t,e,o,a,l){Kh.subVectors(e,t),Cl.subVectors(o,t),jh.crossVectors(Kh,Cl);let h=this.direction.dot(jh),f;if(h>0){if(a)return null;f=1}else if(h<0)f=-1,h=-h;else return null;cs.subVectors(this.origin,t);let p=f*this.direction.dot(Cl.crossVectors(cs,Cl));if(p<0)return null;let d=f*this.direction.dot(Kh.cross(cs));if(d<0||p+d>h)return null;let g=-f*cs.dot(jh);return g<0?null:this.at(g/h,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)}},Yr=class r{constructor(t,e,o,a,l,h,f,p,d,g,_,y,M,b,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,h,f,p,d,g,_,y,M,b,T,x)}set(t,e,o,a,l,h,f,p,d,g,_,y,M,b,T,x){let v=this.elements;return v[0]=t,v[4]=e,v[8]=o,v[12]=a,v[1]=l,v[5]=h,v[9]=f,v[13]=p,v[2]=d,v[6]=g,v[10]=_,v[14]=y,v[3]=M,v[7]=b,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/ba.setFromMatrixColumn(t,0).length(),l=1/ba.setFromMatrixColumn(t,1).length(),h=1/ba.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]*h,e[9]=o[9]*h,e[10]=o[10]*h,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,h=Math.cos(o),f=Math.sin(o),p=Math.cos(a),d=Math.sin(a),g=Math.cos(l),_=Math.sin(l);if(t.order==="XYZ"){let y=h*g,M=h*_,b=f*g,T=f*_;e[0]=p*g,e[4]=-p*_,e[8]=d,e[1]=M+b*d,e[5]=y-T*d,e[9]=-f*p,e[2]=T-y*d,e[6]=b+M*d,e[10]=h*p}else if(t.order==="YXZ"){let y=p*g,M=p*_,b=d*g,T=d*_;e[0]=y+T*f,e[4]=b*f-M,e[8]=h*d,e[1]=h*_,e[5]=h*g,e[9]=-f,e[2]=M*f-b,e[6]=T+y*f,e[10]=h*p}else if(t.order==="ZXY"){let y=p*g,M=p*_,b=d*g,T=d*_;e[0]=y-T*f,e[4]=-h*_,e[8]=b+M*f,e[1]=M+b*f,e[5]=h*g,e[9]=T-y*f,e[2]=-h*d,e[6]=f,e[10]=h*p}else if(t.order==="ZYX"){let y=h*g,M=h*_,b=f*g,T=f*_;e[0]=p*g,e[4]=b*d-M,e[8]=y*d+T,e[1]=p*_,e[5]=T*d+y,e[9]=M*d-b,e[2]=-d,e[6]=f*p,e[10]=h*p}else if(t.order==="YZX"){let y=h*p,M=h*d,b=f*p,T=f*d;e[0]=p*g,e[4]=T-y*_,e[8]=b*_+M,e[1]=_,e[5]=h*g,e[9]=-f*g,e[2]=-d*g,e[6]=M*_+b,e[10]=y-T*_}else if(t.order==="XZY"){let y=h*p,M=h*d,b=f*p,T=f*d;e[0]=p*g,e[4]=-_,e[8]=d*g,e[1]=y*_+T,e[5]=h*g,e[9]=M*_-b,e[2]=b*_-M,e[6]=f*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(aE,t,uE)}lookAt(t,e,o){let a=this.elements;return wi.subVectors(t,e),wi.lengthSq()===0&&(wi.z=1),wi.normalize(),hs.crossVectors(o,wi),hs.lengthSq()===0&&(Math.abs(o.z)===1?wi.x+=1e-4:wi.z+=1e-4,wi.normalize(),hs.crossVectors(o,wi)),hs.normalize(),Pl.crossVectors(wi,hs),a[0]=hs.x,a[4]=Pl.x,a[8]=wi.x,a[1]=hs.y,a[5]=Pl.y,a[9]=wi.y,a[2]=hs.z,a[6]=Pl.z,a[10]=wi.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,h=o[0],f=o[4],p=o[8],d=o[12],g=o[1],_=o[5],y=o[9],M=o[13],b=o[2],T=o[6],x=o[10],v=o[14],P=o[3],S=o[7],L=o[11],N=o[15],G=a[0],B=a[4],I=a[8],O=a[12],q=a[1],st=a[5],V=a[9],Mt=a[13],$=a[2],ut=a[6],xt=a[10],mt=a[14],lt=a[3],ht=a[7],k=a[11],nt=a[15];return l[0]=h*G+f*q+p*$+d*lt,l[4]=h*B+f*st+p*ut+d*ht,l[8]=h*I+f*V+p*xt+d*k,l[12]=h*O+f*Mt+p*mt+d*nt,l[1]=g*G+_*q+y*$+M*lt,l[5]=g*B+_*st+y*ut+M*ht,l[9]=g*I+_*V+y*xt+M*k,l[13]=g*O+_*Mt+y*mt+M*nt,l[2]=b*G+T*q+x*$+v*lt,l[6]=b*B+T*st+x*ut+v*ht,l[10]=b*I+T*V+x*xt+v*k,l[14]=b*O+T*Mt+x*mt+v*nt,l[3]=P*G+S*q+L*$+N*lt,l[7]=P*B+S*st+L*ut+N*ht,l[11]=P*I+S*V+L*xt+N*k,l[15]=P*O+S*Mt+L*mt+N*nt,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],h=t[1],f=t[5],p=t[9],d=t[13],g=t[2],_=t[6],y=t[10],M=t[14],b=t[3],T=t[7],x=t[11],v=t[15];return b*(+l*p*_-a*d*_-l*f*y+o*d*y+a*f*M-o*p*M)+T*(+e*p*M-e*d*y+l*h*y-a*h*M+a*d*g-l*p*g)+x*(+e*d*_-e*f*M-l*h*_+o*h*M+l*f*g-o*d*g)+v*(-a*f*g-e*p*_+e*f*y+a*h*_-o*h*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],h=t[4],f=t[5],p=t[6],d=t[7],g=t[8],_=t[9],y=t[10],M=t[11],b=t[12],T=t[13],x=t[14],v=t[15],P=_*x*d-T*y*d+T*p*M-f*x*M-_*p*v+f*y*v,S=b*y*d-g*x*d-b*p*M+h*x*M+g*p*v-h*y*v,L=g*T*d-b*_*d+b*f*M-h*T*M-g*f*v+h*_*v,N=b*_*p-g*T*p-b*f*y+h*T*y+g*f*x-h*_*x,G=e*P+o*S+a*L+l*N;if(G===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let B=1/G;return t[0]=P*B,t[1]=(T*y*l-_*x*l-T*a*M+o*x*M+_*a*v-o*y*v)*B,t[2]=(f*x*l-T*p*l+T*a*d-o*x*d-f*a*v+o*p*v)*B,t[3]=(_*p*l-f*y*l-_*a*d+o*y*d+f*a*M-o*p*M)*B,t[4]=S*B,t[5]=(g*x*l-b*y*l+b*a*M-e*x*M-g*a*v+e*y*v)*B,t[6]=(b*p*l-h*x*l-b*a*d+e*x*d+h*a*v-e*p*v)*B,t[7]=(h*y*l-g*p*l+g*a*d-e*y*d-h*a*M+e*p*M)*B,t[8]=L*B,t[9]=(b*_*l-g*T*l-b*o*M+e*T*M+g*o*v-e*_*v)*B,t[10]=(h*T*l-b*f*l+b*o*d-e*T*d-h*o*v+e*f*v)*B,t[11]=(g*f*l-h*_*l-g*o*d+e*_*d+h*o*M-e*f*M)*B,t[12]=N*B,t[13]=(g*T*a-b*_*a+b*o*y-e*T*y-g*o*x+e*_*x)*B,t[14]=(b*f*a-h*T*a-b*o*p+e*T*p+h*o*x-e*f*x)*B,t[15]=(h*_*a-g*f*a+g*o*p-e*_*p-h*o*y+e*f*y)*B,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,h=t.x,f=t.y,p=t.z,d=l*h,g=l*f;return this.set(d*h+o,d*f-a*p,d*p+a*f,0,d*f+a*p,g*f+o,g*p-a*h,0,d*p-a*f,g*p+a*h,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,h){return this.set(1,o,l,0,t,1,h,0,e,a,1,0,0,0,0,1),this}compose(t,e,o){let a=this.elements,l=e._x,h=e._y,f=e._z,p=e._w,d=l+l,g=h+h,_=f+f,y=l*d,M=l*g,b=l*_,T=h*g,x=h*_,v=f*_,P=p*d,S=p*g,L=p*_,N=o.x,G=o.y,B=o.z;return a[0]=(1-(T+v))*N,a[1]=(M+L)*N,a[2]=(b-S)*N,a[3]=0,a[4]=(M-L)*G,a[5]=(1-(y+v))*G,a[6]=(x+P)*G,a[7]=0,a[8]=(b+S)*B,a[9]=(x-P)*B,a[10]=(1-(y+T))*B,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=ba.set(a[0],a[1],a[2]).length(),h=ba.set(a[4],a[5],a[6]).length(),f=ba.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],ji.copy(this);let d=1/l,g=1/h,_=1/f;return ji.elements[0]*=d,ji.elements[1]*=d,ji.elements[2]*=d,ji.elements[4]*=g,ji.elements[5]*=g,ji.elements[6]*=g,ji.elements[8]*=_,ji.elements[9]*=_,ji.elements[10]*=_,e.setFromRotationMatrix(ji),o.x=l,o.y=h,o.z=f,this}makePerspective(t,e,o,a,l,h,f=Yo){let p=this.elements,d=2*l/(e-t),g=2*l/(o-a),_=(e+t)/(e-t),y=(o+a)/(o-a),M,b;if(f===Yo)M=-(h+l)/(h-l),b=-2*h*l/(h-l);else if(f===Kl)M=-h/(h-l),b=-h*l/(h-l);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+f);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]=b,p[3]=0,p[7]=0,p[11]=-1,p[15]=0,this}makeOrthographic(t,e,o,a,l,h,f=Yo){let p=this.elements,d=1/(e-t),g=1/(o-a),_=1/(h-l),y=(e+t)*d,M=(o+a)*g,b,T;if(f===Yo)b=(h+l)*_,T=-2*_;else if(f===Kl)b=l*_,T=-1*_;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+f);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]=-b,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}},ba=new vt,ji=new Yr,aE=new vt(0,0,0),uE=new vt(1,1,1),hs=new vt,Pl=new vt,wi=new vt,yg=new Yr,vg=new xs,nc=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],h=a[4],f=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(pi(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(-g,M),this._z=Math.atan2(-h,l)):(this._x=Math.atan2(y,d),this._z=0);break;case"YXZ":this._x=Math.asin(-pi(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(f,M),this._z=Math.atan2(p,d)):(this._y=Math.atan2(-_,l),this._z=0);break;case"ZXY":this._x=Math.asin(pi(y,-1,1)),Math.abs(y)<.9999999?(this._y=Math.atan2(-_,M),this._z=Math.atan2(-h,d)):(this._y=0,this._z=Math.atan2(p,l));break;case"ZYX":this._y=Math.asin(-pi(_,-1,1)),Math.abs(_)<.9999999?(this._x=Math.atan2(y,M),this._z=Math.atan2(p,l)):(this._x=0,this._z=Math.atan2(-h,d));break;case"YZX":this._z=Math.asin(pi(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(f,M));break;case"XZY":this._z=Math.asin(-pi(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(y,d),this._y=Math.atan2(f,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 yg.makeRotationFromQuaternion(t),this.setFromRotationMatrix(yg,e,o)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return vg.setFromEuler(this),this.setFromQuaternion(vg,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}};nc.DEFAULT_ORDER="XYZ";var rc=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}},lE=0,_g=new vt,Ta=new xs,Go=new Yr,Il=new vt,Nu=new vt,cE=new vt,hE=new xs,xg=new vt(1,0,0),Eg=new vt(0,1,0),Mg=new vt(0,0,1),fE={type:"added"},pE={type:"removed"},yo=class r extends _s{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:lE++}),this.uuid=Hu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new vt,e=new nc,o=new xs,a=new vt(1,1,1);function l(){o.setFromEuler(e,!1)}function h(){e.setFromQuaternion(o,void 0,!1)}e._onChange(l),o._onChange(h),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 Yr},normalMatrix:{value:new ye}}),this.matrix=new Yr,this.matrixWorld=new Yr,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new rc,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 Ta.setFromAxisAngle(t,e),this.quaternion.multiply(Ta),this}rotateOnWorldAxis(t,e){return Ta.setFromAxisAngle(t,e),this.quaternion.premultiply(Ta),this}rotateX(t){return this.rotateOnAxis(xg,t)}rotateY(t){return this.rotateOnAxis(Eg,t)}rotateZ(t){return this.rotateOnAxis(Mg,t)}translateOnAxis(t,e){return _g.copy(t).applyQuaternion(this.quaternion),this.position.add(_g.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(xg,t)}translateY(t){return this.translateOnAxis(Eg,t)}translateZ(t){return this.translateOnAxis(Mg,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Go.copy(this.matrixWorld).invert())}lookAt(t,e,o){t.isVector3?Il.copy(t):Il.set(t,e,o);let a=this.parent;this.updateWorldMatrix(!0,!1),Nu.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Go.lookAt(Nu,Il,this.up):Go.lookAt(Il,Nu,this.up),this.quaternion.setFromRotationMatrix(Go),a&&(Go.extractRotation(a.matrixWorld),Ta.setFromRotationMatrix(Go),this.quaternion.premultiply(Ta.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(fE)):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(pE)),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),Go.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Go.multiply(t.parent.matrixWorld)),t.applyMatrix4(Go),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 h=this.children[o].getObjectByProperty(t,e);if(h!==void 0)return h}}getObjectsByProperty(t,e){let o=[];this[t]===e&&o.push(this);for(let a=0,l=this.children.length;a<l;a++){let h=this.children[a].getObjectsByProperty(t,e);h.length>0&&(o=o.concat(h))}return o}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Nu,t,cE),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Nu,hE,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,h=a.length;l<h;l++){let f=a[l];f.matrixWorldAutoUpdate===!0&&f.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(f,p){return f[p.uuid]===void 0&&(f[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 f=this.geometry.parameters;if(f!==void 0&&f.shapes!==void 0){let p=f.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 f=[];for(let p=0,d=this.material.length;p<d;p++)f.push(l(t.materials,this.material[p]));a.material=f}else a.material=l(t.materials,this.material);if(this.children.length>0){a.children=[];for(let f=0;f<this.children.length;f++)a.children.push(this.children[f].toJSON(t).object)}if(this.animations.length>0){a.animations=[];for(let f=0;f<this.animations.length;f++){let p=this.animations[f];a.animations.push(l(t.animations,p))}}if(e){let f=h(t.geometries),p=h(t.materials),d=h(t.textures),g=h(t.images),_=h(t.shapes),y=h(t.skeletons),M=h(t.animations),b=h(t.nodes);f.length>0&&(o.geometries=f),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),b.length>0&&(o.nodes=b)}return o.object=a,o;function h(f){let p=[];for(let d in f){let g=f[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 vt(0,1,0);yo.DEFAULT_MATRIX_AUTO_UPDATE=!0;yo.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Qi=new vt,Vo=new vt,Qh=new vt,Ho=new vt,Aa=new vt,Ca=new vt,Sg=new vt,tf=new vt,ef=new vt,nf=new vt,Rl=!1,Ua=class r{constructor(t=new vt,e=new vt,o=new vt){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),Vo.subVectors(o,e),Qh.subVectors(t,e);let h=Qi.dot(Qi),f=Qi.dot(Vo),p=Qi.dot(Qh),d=Vo.dot(Vo),g=Vo.dot(Qh),_=h*d-f*f;if(_===0)return l.set(-2,-1,-1);let y=1/_,M=(d*p-f*g)*y,b=(h*g-f*p)*y;return l.set(1-M-b,b,M)}static containsPoint(t,e,o,a){return this.getBarycoord(t,e,o,a,Ho),Ho.x>=0&&Ho.y>=0&&Ho.x+Ho.y<=1}static getUV(t,e,o,a,l,h,f,p){return Rl===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Rl=!0),this.getInterpolation(t,e,o,a,l,h,f,p)}static getInterpolation(t,e,o,a,l,h,f,p){return this.getBarycoord(t,e,o,a,Ho),p.setScalar(0),p.addScaledVector(l,Ho.x),p.addScaledVector(h,Ho.y),p.addScaledVector(f,Ho.z),p}static isFrontFacing(t,e,o,a){return Qi.subVectors(o,e),Vo.subVectors(t,e),Qi.cross(Vo).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),Vo.subVectors(this.a,this.b),Qi.cross(Vo).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 Rl===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Rl=!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,h,f;Aa.subVectors(a,o),Ca.subVectors(l,o),tf.subVectors(t,o);let p=Aa.dot(tf),d=Ca.dot(tf);if(p<=0&&d<=0)return e.copy(o);ef.subVectors(t,a);let g=Aa.dot(ef),_=Ca.dot(ef);if(g>=0&&_<=g)return e.copy(a);let y=p*_-g*d;if(y<=0&&p>=0&&g<=0)return h=p/(p-g),e.copy(o).addScaledVector(Aa,h);nf.subVectors(t,l);let M=Aa.dot(nf),b=Ca.dot(nf);if(b>=0&&M<=b)return e.copy(l);let T=M*d-p*b;if(T<=0&&d>=0&&b<=0)return f=d/(d-b),e.copy(o).addScaledVector(Ca,f);let x=g*b-M*_;if(x<=0&&_-g>=0&&M-b>=0)return Sg.subVectors(l,a),f=(_-g)/(_-g+(M-b)),e.copy(a).addScaledVector(Sg,f);let v=1/(x+T+y);return h=T*v,f=y*v,e.copy(o).addScaledVector(Aa,h).addScaledVector(Ca,f)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},dE=0,Xa=class extends _s{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:dE++}),this.uuid=Hu(),this.name="",this.type="Material",this.blending=ka,this.side=vs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Kg,this.blendDst=jg,this.blendEquation=Fa,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=hf,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Xx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Gh,this.stencilZFail=Gh,this.stencilZPass=Gh,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.specula');
|
|
9195
9201
|
}
|
|
9196
9202
|
|
|
9197
9203
|
// src/plugins/cr-nav-path/cr-nav-path.ts
|