@aibee/crc-bmap 0.8.5 → 0.8.7
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 +8 -8
- package/lib/bmap.esm.js +21 -16
- package/lib/bmap.esm.min.js +9 -9
- package/lib/bmap.min.js +9 -9
- package/package.json +1 -1
package/lib/bmap.esm.js
CHANGED
|
@@ -2127,10 +2127,10 @@ var Events = class {
|
|
|
2127
2127
|
};
|
|
2128
2128
|
|
|
2129
2129
|
// src/utils/event-name.ts
|
|
2130
|
-
var HooksName = /* @__PURE__ */ ((
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
return
|
|
2130
|
+
var HooksName = /* @__PURE__ */ ((HooksName2) => {
|
|
2131
|
+
HooksName2["SWITCH_FLOOR_BEFORE"] = "switch_floor_before";
|
|
2132
|
+
HooksName2["SWITCH_FLOOR_AFTER"] = "switch_floor_after";
|
|
2133
|
+
return HooksName2;
|
|
2134
2134
|
})(HooksName || {});
|
|
2135
2135
|
|
|
2136
2136
|
// src/utils/obj-utils.ts
|
|
@@ -6805,7 +6805,7 @@ import { cloneDeep as cloneDeep3 } from "lodash";
|
|
|
6805
6805
|
var defaultOptions4 = {
|
|
6806
6806
|
text: "",
|
|
6807
6807
|
icon: "",
|
|
6808
|
-
icon_size: [
|
|
6808
|
+
icon_size: [22, 22],
|
|
6809
6809
|
level: 1,
|
|
6810
6810
|
collision_enable: true,
|
|
6811
6811
|
opacity: 1,
|
|
@@ -7724,7 +7724,7 @@ var OrbitControls = class extends EventDispatcher7 {
|
|
|
7724
7724
|
this.zoom0 = this.object.zoom;
|
|
7725
7725
|
this._domElementKeyEvents = null;
|
|
7726
7726
|
this.getPolarAngle = function() {
|
|
7727
|
-
return
|
|
7727
|
+
return spherical.phi;
|
|
7728
7728
|
};
|
|
7729
7729
|
this.getAzimuthalAngle = function() {
|
|
7730
7730
|
return spherical.theta;
|
|
@@ -8468,7 +8468,7 @@ var Control = class extends OrbitControls {
|
|
|
8468
8468
|
);
|
|
8469
8469
|
}
|
|
8470
8470
|
setAzimuthalAngle(azimuthAngle, force) {
|
|
8471
|
-
const { maxAzimuthAngle, minAzimuthAngle
|
|
8471
|
+
const { maxAzimuthAngle, minAzimuthAngle } = this;
|
|
8472
8472
|
const disable = maxAzimuthAngle === minAzimuthAngle;
|
|
8473
8473
|
if (force || azimuthAngle <= maxAzimuthAngle && azimuthAngle >= minAzimuthAngle) {
|
|
8474
8474
|
this.maxAzimuthAngle = azimuthAngle;
|
|
@@ -8526,9 +8526,6 @@ var Control = class extends OrbitControls {
|
|
|
8526
8526
|
this.update();
|
|
8527
8527
|
}).onComplete(() => {
|
|
8528
8528
|
this.tweenGroup.remove(tween);
|
|
8529
|
-
this.camera.position.copy(newTarget.clone().sub(lookAtVector));
|
|
8530
|
-
this.target.copy(newTarget.clone());
|
|
8531
|
-
this.update();
|
|
8532
8529
|
this.enabled = true;
|
|
8533
8530
|
resolve(true);
|
|
8534
8531
|
}).onStart(() => {
|
|
@@ -10255,7 +10252,7 @@ var arrow_default = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAMAA
|
|
|
10255
10252
|
// src/plugins/navigation/path.ts
|
|
10256
10253
|
var defaultConfig2 = {
|
|
10257
10254
|
texture_url: arrow_default,
|
|
10258
|
-
lineWidth:
|
|
10255
|
+
lineWidth: 10,
|
|
10259
10256
|
color: 16777215
|
|
10260
10257
|
};
|
|
10261
10258
|
var Path2 = class extends Object3D18 {
|
|
@@ -11304,6 +11301,10 @@ var Navigation = class extends Plugin {
|
|
|
11304
11301
|
return timeoutPromise(new Promise((resolve) => {
|
|
11305
11302
|
const start = { azimuthal: control.getAzimuthalAngle() };
|
|
11306
11303
|
const end = { azimuthal: angle };
|
|
11304
|
+
const polar = control.getPolarAngle();
|
|
11305
|
+
const { maxPolarAngle, minPolarAngle } = control;
|
|
11306
|
+
control.maxPolarAngle = polar;
|
|
11307
|
+
control.minPolarAngle = polar;
|
|
11307
11308
|
const tween = new Tween4(start, this.tweenUtil.group).to(end, time).easing(Easing.Quadratic.InOut).onUpdate(async () => {
|
|
11308
11309
|
if (this.startPoi) {
|
|
11309
11310
|
control.target.copy(this.startPoi.position);
|
|
@@ -11313,6 +11314,8 @@ var Navigation = class extends Plugin {
|
|
|
11313
11314
|
}).onComplete(() => {
|
|
11314
11315
|
control.enabled = true;
|
|
11315
11316
|
this.tweenUtil.remove(tween);
|
|
11317
|
+
control.maxPolarAngle = maxPolarAngle;
|
|
11318
|
+
control.minPolarAngle = minPolarAngle;
|
|
11316
11319
|
resolve(true);
|
|
11317
11320
|
}).onStart(() => {
|
|
11318
11321
|
control.enabled = false;
|
|
@@ -11663,7 +11666,7 @@ import { EventDispatcher as EventDispatcher15 } from "three";
|
|
|
11663
11666
|
|
|
11664
11667
|
// src/plugins/cr-nav-path/cr-path.worker.ts
|
|
11665
11668
|
function Worker3() {
|
|
11666
|
-
return inlineWorker('var D0=Object.create;var pl=Object.defineProperty;var O0=Object.getOwnPropertyDescriptor;var F0=Object.getOwnPropertyNames,rf=Object.getOwnPropertySymbols,U0=Object.getPrototypeOf,of=Object.prototype.hasOwnProperty,B0=Object.prototype.propertyIsEnumerable;var fl=(o,e,r)=>e in o?pl(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,js=(o,e)=>{for(var r in e||(e={}))of.call(e,r)&&fl(o,r,e[r]);if(rf)for(var r of rf(e))B0.call(e,r)&&fl(o,r,e[r]);return o};var ct=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var z0=(o,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of F0(e))!of.call(o,u)&&u!==r&&pl(o,u,{get:()=>e[u],enumerable:!(a=O0(e,u))||a.enumerable});return o};var ln=(o,e,r)=>(r=o!=null?D0(U0(o)):{},z0(e||!o||!o.__esModule?pl(r,"default",{value:o,enumerable:!0}):r,o));var Wr=(o,e,r)=>fl(o,typeof e!="symbol"?e+"":e,r);var af=ct((wS,sf)=>{var dl=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,r)=>e.priority-r.priority)}set(e,r){let a=Number(r);if(isNaN(a))throw new TypeError(\'"priority" must be a number\');return this.keys.has(e)?this.queue.map(u=>(u.key===e&&Object.assign(u,{priority:a}),u)):(this.keys.add(e),this.queue.push({key:e,priority:a})),this.sort(),this.queue.length}next(){let e=this.queue.shift();return this.keys.delete(e.key),e}isEmpty(){return this.queue.length===0}has(e){return this.keys.has(e)}get(e){return this.queue.find(r=>r.key===e)}};sf.exports=dl});var cf=ct((SS,lf)=>{function uf(o,e){let r=new Map;for(let[a,u]of o)a!==e&&u instanceof Map?r.set(a,uf(u,e)):a!==e&&r.set(a,u);return r}lf.exports=uf});var pf=ct((bS,ff)=>{function k0(o){let e=Number(o);return!(isNaN(e)||e<=0)}function hf(o){let e=new Map;return Object.keys(o).forEach(a=>{let u=o[a];if(u!==null&&typeof u=="object"&&!Array.isArray(u))return e.set(a,hf(u));if(!k0(u))throw new Error(`Could not add node at key "${a}", make sure it\'s a valid node`,u);return e.set(a,Number(u))}),e}ff.exports=hf});var gf=ct((AS,mf)=>{function df(o){if(!(o instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof o}`);o.forEach((e,r)=>{if(typeof e=="object"&&e instanceof Map){df(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${r}`)})}mf.exports=df});var xf=ct((TS,_f)=>{var G0=af(),V0=cf(),yf=pf(),vf=gf(),ml=class{constructor(e){e instanceof Map?(vf(e),this.graph=e):e?this.graph=yf(e):this.graph=new Map}addNode(e,r){let a;return r instanceof Map?(vf(r),a=r):a=yf(r),this.graph.set(e,a),this}addVertex(e,r){return this.addNode(e,r)}removeNode(e){return this.graph=V0(this.graph,e),this}path(e,r,a={}){if(!this.graph.size)return a.cost?{path:null,cost:0}:null;let u=new Set,c=new G0,h=new Map,p=[],d=0,g=[];if(a.avoid&&(g=[].concat(a.avoid)),g.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(g.includes(r))throw new Error(`Ending node (${r}) cannot be avoided`);for(c.set(e,0);!c.isEmpty();){let v=c.next();if(v.key===r){d=v.priority;let M=v.key;for(;h.has(M);)p.push(M),M=h.get(M);break}u.add(v.key),(this.graph.get(v.key)||new Map).forEach((M,w)=>{if(u.has(w)||g.includes(w))return null;if(!c.has(w))return h.set(w,v.key),c.set(w,v.priority+M);let I=c.get(w).priority,D=v.priority+M;return D<I?(h.set(w,v.key),c.set(w,D)):null})}return p.length?(a.trim?p.shift():p=p.concat([e]),a.reverse||(p=p.reverse()),a.cost?{path:p,cost:d}:p):a.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};_f.exports=ml});var Xa=ct((WS,rp)=>{"use strict";var np=Object.getOwnPropertySymbols,K_=Object.prototype.hasOwnProperty,Q_=Object.prototype.propertyIsEnumerable;function j_(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function t1(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var a=Object.getOwnPropertyNames(e).map(function(c){return e[c]});if(a.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(c){u[c]=c}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch(c){return!1}}rp.exports=t1()?Object.assign:function(o,e){for(var r,a=j_(o),u,c=1;c<arguments.length;c++){r=Object(arguments[c]);for(var h in r)K_.call(r,h)&&(a[h]=r[h]);if(np){u=np(r);for(var p=0;p<u.length;p++)Q_.call(r,u[p])&&(a[u[p]]=r[u[p]])}}return a}});var $l=ct((Xl,Yl)=>{(function(o,e){typeof Xl=="object"&&typeof Yl!="undefined"?Yl.exports=e():typeof define=="function"&&define.amd?define(e):(o=o||self).RBush=e()})(Xl,function(){"use strict";function o(b,T,L,P,z){(function k(Y,q,C,ot,pt){for(;ot>C;){if(ot-C>600){var dt=ot-C+1,F=q-C+1,ye=Math.log(dt),et=.5*Math.exp(2*ye/3),St=.5*Math.sqrt(ye*et*(dt-et)/dt)*(F-dt/2<0?-1:1),Pt=Math.max(C,Math.floor(q-F*et/dt+St)),Rt=Math.min(ot,Math.floor(q+(dt-F)*et/dt+St));k(Y,q,Pt,Rt,pt)}var it=Y[q],mt=C,U=ot;for(e(Y,C,q),pt(Y[ot],it)>0&&e(Y,C,ot);mt<U;){for(e(Y,mt,U),mt++,U--;pt(Y[mt],it)<0;)mt++;for(;pt(Y[U],it)>0;)U--}pt(Y[C],it)===0?e(Y,C,U):e(Y,++U,ot),U<=q&&(C=U+1),q<=U&&(ot=U-1)}})(b,T,L||0,P||b.length-1,z||r)}function e(b,T,L){var P=b[T];b[T]=b[L],b[L]=P}function r(b,T){return b<T?-1:b>T?1:0}var a=function(b){b===void 0&&(b=9),this._maxEntries=Math.max(4,b),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function u(b,T,L){if(!L)return T.indexOf(b);for(var P=0;P<T.length;P++)if(L(b,T[P]))return P;return-1}function c(b,T){h(b,0,b.children.length,T,b)}function h(b,T,L,P,z){z||(z=I(null)),z.minX=1/0,z.minY=1/0,z.maxX=-1/0,z.maxY=-1/0;for(var k=T;k<L;k++){var Y=b.children[k];p(z,b.leaf?P(Y):Y)}return z}function p(b,T){return b.minX=Math.min(b.minX,T.minX),b.minY=Math.min(b.minY,T.minY),b.maxX=Math.max(b.maxX,T.maxX),b.maxY=Math.max(b.maxY,T.maxY),b}function d(b,T){return b.minX-T.minX}function g(b,T){return b.minY-T.minY}function v(b){return(b.maxX-b.minX)*(b.maxY-b.minY)}function x(b){return b.maxX-b.minX+(b.maxY-b.minY)}function M(b,T){return b.minX<=T.minX&&b.minY<=T.minY&&T.maxX<=b.maxX&&T.maxY<=b.maxY}function w(b,T){return T.minX<=b.maxX&&T.minY<=b.maxY&&T.maxX>=b.minX&&T.maxY>=b.minY}function I(b){return{children:b,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function D(b,T,L,P,z){for(var k=[T,L];k.length;)if(!((L=k.pop())-(T=k.pop())<=P)){var Y=T+Math.ceil((L-T)/P/2)*P;o(b,Y,T,L,z),k.push(T,Y,Y,L)}}return a.prototype.all=function(){return this._all(this.data,[])},a.prototype.search=function(b){var T=this.data,L=[];if(!w(b,T))return L;for(var P=this.toBBox,z=[];T;){for(var k=0;k<T.children.length;k++){var Y=T.children[k],q=T.leaf?P(Y):Y;w(b,q)&&(T.leaf?L.push(Y):M(b,q)?this._all(Y,L):z.push(Y))}T=z.pop()}return L},a.prototype.collides=function(b){var T=this.data;if(!w(b,T))return!1;for(var L=[];T;){for(var P=0;P<T.children.length;P++){var z=T.children[P],k=T.leaf?this.toBBox(z):z;if(w(b,k)){if(T.leaf||M(b,k))return!0;L.push(z)}}T=L.pop()}return!1},a.prototype.load=function(b){if(!b||!b.length)return this;if(b.length<this._minEntries){for(var T=0;T<b.length;T++)this.insert(b[T]);return this}var L=this._build(b.slice(),0,b.length-1,0);if(this.data.children.length)if(this.data.height===L.height)this._splitRoot(this.data,L);else{if(this.data.height<L.height){var P=this.data;this.data=L,L=P}this._insert(L,this.data.height-L.height-1,!0)}else this.data=L;return this},a.prototype.insert=function(b){return b&&this._insert(b,this.data.height-1),this},a.prototype.clear=function(){return this.data=I([]),this},a.prototype.remove=function(b,T){if(!b)return this;for(var L,P,z,k=this.data,Y=this.toBBox(b),q=[],C=[];k||q.length;){if(k||(k=q.pop(),P=q[q.length-1],L=C.pop(),z=!0),k.leaf){var ot=u(b,k.children,T);if(ot!==-1)return k.children.splice(ot,1),q.push(k),this._condense(q),this}z||k.leaf||!M(k,Y)?P?(L++,k=P.children[L],z=!1):k=null:(q.push(k),C.push(L),L=0,P=k,k=k.children[0])}return this},a.prototype.toBBox=function(b){return b},a.prototype.compareMinX=function(b,T){return b.minX-T.minX},a.prototype.compareMinY=function(b,T){return b.minY-T.minY},a.prototype.toJSON=function(){return this.data},a.prototype.fromJSON=function(b){return this.data=b,this},a.prototype._all=function(b,T){for(var L=[];b;)b.leaf?T.push.apply(T,b.children):L.push.apply(L,b.children),b=L.pop();return T},a.prototype._build=function(b,T,L,P){var z,k=L-T+1,Y=this._maxEntries;if(k<=Y)return c(z=I(b.slice(T,L+1)),this.toBBox),z;P||(P=Math.ceil(Math.log(k)/Math.log(Y)),Y=Math.ceil(k/Math.pow(Y,P-1))),(z=I([])).leaf=!1,z.height=P;var q=Math.ceil(k/Y),C=q*Math.ceil(Math.sqrt(Y));D(b,T,L,C,this.compareMinX);for(var ot=T;ot<=L;ot+=C){var pt=Math.min(ot+C-1,L);D(b,ot,pt,q,this.compareMinY);for(var dt=ot;dt<=pt;dt+=q){var F=Math.min(dt+q-1,pt);z.children.push(this._build(b,dt,F,P-1))}}return c(z,this.toBBox),z},a.prototype._chooseSubtree=function(b,T,L,P){for(;P.push(T),!T.leaf&&P.length-1!==L;){for(var z=1/0,k=1/0,Y=void 0,q=0;q<T.children.length;q++){var C=T.children[q],ot=v(C),pt=(dt=b,F=C,(Math.max(F.maxX,dt.maxX)-Math.min(F.minX,dt.minX))*(Math.max(F.maxY,dt.maxY)-Math.min(F.minY,dt.minY))-ot);pt<k?(k=pt,z=ot<z?ot:z,Y=C):pt===k&&ot<z&&(z=ot,Y=C)}T=Y||T.children[0]}var dt,F;return T},a.prototype._insert=function(b,T,L){var P=L?b:this.toBBox(b),z=[],k=this._chooseSubtree(P,this.data,T,z);for(k.children.push(b),p(k,P);T>=0&&z[T].children.length>this._maxEntries;)this._split(z,T),T--;this._adjustParentBBoxes(P,z,T)},a.prototype._split=function(b,T){var L=b[T],P=L.children.length,z=this._minEntries;this._chooseSplitAxis(L,z,P);var k=this._chooseSplitIndex(L,z,P),Y=I(L.children.splice(k,L.children.length-k));Y.height=L.height,Y.leaf=L.leaf,c(L,this.toBBox),c(Y,this.toBBox),T?b[T-1].children.push(Y):this._splitRoot(L,Y)},a.prototype._splitRoot=function(b,T){this.data=I([b,T]),this.data.height=b.height+1,this.data.leaf=!1,c(this.data,this.toBBox)},a.prototype._chooseSplitIndex=function(b,T,L){for(var P,z,k,Y,q,C,ot,pt=1/0,dt=1/0,F=T;F<=L-T;F++){var ye=h(b,0,F,this.toBBox),et=h(b,F,L,this.toBBox),St=(z=ye,k=et,Y=void 0,q=void 0,C=void 0,ot=void 0,Y=Math.max(z.minX,k.minX),q=Math.max(z.minY,k.minY),C=Math.min(z.maxX,k.maxX),ot=Math.min(z.maxY,k.maxY),Math.max(0,C-Y)*Math.max(0,ot-q)),Pt=v(ye)+v(et);St<pt?(pt=St,P=F,dt=Pt<dt?Pt:dt):St===pt&&Pt<dt&&(dt=Pt,P=F)}return P||L-T},a.prototype._chooseSplitAxis=function(b,T,L){var P=b.leaf?this.compareMinX:d,z=b.leaf?this.compareMinY:g;this._allDistMargin(b,T,L,P)<this._allDistMargin(b,T,L,z)&&b.children.sort(P)},a.prototype._allDistMargin=function(b,T,L,P){b.children.sort(P);for(var z=this.toBBox,k=h(b,0,T,z),Y=h(b,L-T,L,z),q=x(k)+x(Y),C=T;C<L-T;C++){var ot=b.children[C];p(k,b.leaf?z(ot):ot),q+=x(k)}for(var pt=L-T-1;pt>=T;pt--){var dt=b.children[pt];p(Y,b.leaf?z(dt):dt),q+=x(Y)}return q},a.prototype._adjustParentBBoxes=function(b,T,L){for(var P=L;P>=0;P--)p(T[P],b)},a.prototype._condense=function(b){for(var T=b.length-1,L=void 0;T>=0;T--)b[T].children.length===0?T>0?(L=b[T-1].children).splice(L.indexOf(b[T]),1):this.clear():c(b[T],this.toBBox)},a})});var ip=ct((Zl,Jl)=>{(function(o,e){typeof Zl=="object"&&typeof Jl!="undefined"?Jl.exports=e():typeof define=="function"&&define.amd?define(e):(o=o||self,o.TinyQueue=e())})(Zl,function(){"use strict";var o=function(a,u){if(a===void 0&&(a=[]),u===void 0&&(u=e),this.data=a,this.length=this.data.length,this.compare=u,this.length>0)for(var c=(this.length>>1)-1;c>=0;c--)this._down(c)};o.prototype.push=function(a){this.data.push(a),this.length++,this._up(this.length-1)},o.prototype.pop=function(){if(this.length!==0){var a=this.data[0],u=this.data.pop();return this.length--,this.length>0&&(this.data[0]=u,this._down(0)),a}},o.prototype.peek=function(){return this.data[0]},o.prototype._up=function(a){for(var u=this,c=u.data,h=u.compare,p=c[a];a>0;){var d=a-1>>1,g=c[d];if(h(p,g)>=0)break;c[a]=g,a=d}c[a]=p},o.prototype._down=function(a){for(var u=this,c=u.data,h=u.compare,p=this.length>>1,d=c[a];a<p;){var g=(a<<1)+1,v=c[g],x=g+1;if(x<this.length&&h(c[x],v)<0&&(g=x,v=c[x]),h(v,d)>=0)break;c[a]=v,a=g}c[a]=d};function e(r,a){return r<a?-1:r>a?1:0}return o})});var sp=ct((KS,op)=>{op.exports=function(e,r,a,u){var c=e[0],h=e[1],p=!1;a===void 0&&(a=0),u===void 0&&(u=r.length);for(var d=(u-a)/2,g=0,v=d-1;g<d;v=g++){var x=r[a+g*2+0],M=r[a+g*2+1],w=r[a+v*2+0],I=r[a+v*2+1],D=M>h!=I>h&&c<(w-x)*(h-M)/(I-M)+x;D&&(p=!p)}return p}});var up=ct((QS,ap)=>{ap.exports=function(e,r,a,u){var c=e[0],h=e[1],p=!1;a===void 0&&(a=0),u===void 0&&(u=r.length);for(var d=u-a,g=0,v=d-1;g<d;v=g++){var x=r[g+a][0],M=r[g+a][1],w=r[v+a][0],I=r[v+a][1],D=M>h!=I>h&&c<(w-x)*(h-M)/(I-M)+x;D&&(p=!p)}return p}});var hp=ct((jS,Za)=>{var lp=sp(),cp=up();Za.exports=function(e,r,a,u){return r.length>0&&Array.isArray(r[0])?cp(e,r,a,u):lp(e,r,a,u)};Za.exports.nested=cp;Za.exports.flat=lp});var pp=ct((Ja,fp)=>{(function(o,e){typeof Ja=="object"&&typeof fp!="undefined"?e(Ja):typeof define=="function"&&define.amd?define(["exports"],e):e((o=o||self).predicates={})})(Ja,function(o){"use strict";let r=33306690738754706e-32;function a(w,I,D,b,T){let L,P,z,k,Y=I[0],q=b[0],C=0,ot=0;q>Y==q>-Y?(L=Y,Y=I[++C]):(L=q,q=b[++ot]);let pt=0;if(C<w&&ot<D)for(q>Y==q>-Y?(z=L-((P=Y+L)-Y),Y=I[++C]):(z=L-((P=q+L)-q),q=b[++ot]),L=P,z!==0&&(T[pt++]=z);C<w&&ot<D;)q>Y==q>-Y?(z=L-((P=L+Y)-(k=P-L))+(Y-k),Y=I[++C]):(z=L-((P=L+q)-(k=P-L))+(q-k),q=b[++ot]),L=P,z!==0&&(T[pt++]=z);for(;C<w;)z=L-((P=L+Y)-(k=P-L))+(Y-k),Y=I[++C],L=P,z!==0&&(T[pt++]=z);for(;ot<D;)z=L-((P=L+q)-(k=P-L))+(q-k),q=b[++ot],L=P,z!==0&&(T[pt++]=z);return L===0&&pt!==0||(T[pt++]=L),pt}function u(w){return new Float64Array(w)}let c=33306690738754716e-32,h=22204460492503146e-32,p=11093356479670487e-47,d=u(4),g=u(8),v=u(12),x=u(16),M=u(4);o.orient2d=function(w,I,D,b,T,L){let P=(I-L)*(D-T),z=(w-T)*(b-L),k=P-z;if(P===0||z===0||P>0!=z>0)return k;let Y=Math.abs(P+z);return Math.abs(k)>=c*Y?k:-function(q,C,ot,pt,dt,F,ye){let et,St,Pt,Rt,it,mt,U,Nt,Mt,Re,ut,Ne,xn,qe,Ee,Le,at,Kn,oe=q-dt,Fn=ot-dt,Te=C-F,gn=pt-F;it=(Ee=(Nt=oe-(U=(mt=134217729*oe)-(mt-oe)))*(Re=gn-(Mt=(mt=134217729*gn)-(mt-gn)))-((qe=oe*gn)-U*Mt-Nt*Mt-U*Re))-(ut=Ee-(at=(Nt=Te-(U=(mt=134217729*Te)-(mt-Te)))*(Re=Fn-(Mt=(mt=134217729*Fn)-(mt-Fn)))-((Le=Te*Fn)-U*Mt-Nt*Mt-U*Re))),d[0]=Ee-(ut+it)+(it-at),it=(xn=qe-((Ne=qe+ut)-(it=Ne-qe))+(ut-it))-(ut=xn-Le),d[1]=xn-(ut+it)+(it-Le),it=(Kn=Ne+ut)-Ne,d[2]=Ne-(Kn-it)+(ut-it),d[3]=Kn;let Qe=function(ui,Pr){let $r=Pr[0];for(let Un=1;Un<ui;Un++)$r+=Pr[Un];return $r}(4,d),Cn=h*ye;if(Qe>=Cn||-Qe>=Cn||(et=q-(oe+(it=q-oe))+(it-dt),Pt=ot-(Fn+(it=ot-Fn))+(it-dt),St=C-(Te+(it=C-Te))+(it-F),Rt=pt-(gn+(it=pt-gn))+(it-F),et===0&&St===0&&Pt===0&&Rt===0)||(Cn=p*ye+r*Math.abs(Qe),(Qe+=oe*Rt+gn*et-(Te*Pt+Fn*St))>=Cn||-Qe>=Cn))return Qe;it=(Ee=(Nt=et-(U=(mt=134217729*et)-(mt-et)))*(Re=gn-(Mt=(mt=134217729*gn)-(mt-gn)))-((qe=et*gn)-U*Mt-Nt*Mt-U*Re))-(ut=Ee-(at=(Nt=St-(U=(mt=134217729*St)-(mt-St)))*(Re=Fn-(Mt=(mt=134217729*Fn)-(mt-Fn)))-((Le=St*Fn)-U*Mt-Nt*Mt-U*Re))),M[0]=Ee-(ut+it)+(it-at),it=(xn=qe-((Ne=qe+ut)-(it=Ne-qe))+(ut-it))-(ut=xn-Le),M[1]=xn-(ut+it)+(it-Le),it=(Kn=Ne+ut)-Ne,M[2]=Ne-(Kn-it)+(ut-it),M[3]=Kn;let ai=a(4,d,4,M,g);it=(Ee=(Nt=oe-(U=(mt=134217729*oe)-(mt-oe)))*(Re=Rt-(Mt=(mt=134217729*Rt)-(mt-Rt)))-((qe=oe*Rt)-U*Mt-Nt*Mt-U*Re))-(ut=Ee-(at=(Nt=Te-(U=(mt=134217729*Te)-(mt-Te)))*(Re=Pt-(Mt=(mt=134217729*Pt)-(mt-Pt)))-((Le=Te*Pt)-U*Mt-Nt*Mt-U*Re))),M[0]=Ee-(ut+it)+(it-at),it=(xn=qe-((Ne=qe+ut)-(it=Ne-qe))+(ut-it))-(ut=xn-Le),M[1]=xn-(ut+it)+(it-Le),it=(Kn=Ne+ut)-Ne,M[2]=Ne-(Kn-it)+(ut-it),M[3]=Kn;let _t=a(ai,g,4,M,v);it=(Ee=(Nt=et-(U=(mt=134217729*et)-(mt-et)))*(Re=Rt-(Mt=(mt=134217729*Rt)-(mt-Rt)))-((qe=et*Rt)-U*Mt-Nt*Mt-U*Re))-(ut=Ee-(at=(Nt=St-(U=(mt=134217729*St)-(mt-St)))*(Re=Pt-(Mt=(mt=134217729*Pt)-(mt-Pt)))-((Le=St*Pt)-U*Mt-Nt*Mt-U*Re))),M[0]=Ee-(ut+it)+(it-at),it=(xn=qe-((Ne=qe+ut)-(it=Ne-qe))+(ut-it))-(ut=xn-Le),M[1]=xn-(ut+it)+(it-Le),it=(Kn=Ne+ut)-Ne,M[2]=Ne-(Kn-it)+(ut-it),M[3]=Kn;let Ce=a(_t,v,4,M,x);return x[Ce-1]}(w,I,D,b,T,L,Y)},o.orient2dfast=function(w,I,D,b,T,L){return(I-L)*(D-T)-(w-T)*(b-L)},Object.defineProperty(o,"__esModule",{value:!0})})});var _p=ct((tb,tc)=>{"use strict";var dp=$l(),Qa=ip(),n1=hp(),r1=pp().orient2d;Qa.default&&(Qa=Qa.default);tc.exports=vp;tc.exports.default=vp;function vp(o,e,r){e=Math.max(0,e===void 0?2:e),r=r||0;var a=u1(o),u=new dp(16);u.toBBox=function(L){return{minX:L[0],minY:L[1],maxX:L[0],maxY:L[1]}},u.compareMinX=function(L,P){return L[0]-P[0]},u.compareMinY=function(L,P){return L[1]-P[1]},u.load(o);for(var c=[],h=0,p;h<a.length;h++){var d=a[h];u.remove(d),p=yp(d,p),c.push(p)}var g=new dp(16);for(h=0;h<c.length;h++)g.insert(Kl(c[h]));for(var v=e*e,x=r*r;c.length;){var M=c.shift(),w=M.p,I=M.next.p,D=Ql(w,I);if(!(D<x)){var b=D/v;d=i1(u,M.prev.p,w,I,M.next.next.p,b,g),d&&Math.min(Ql(d,w),Ql(d,I))<=b&&(c.push(M),c.push(yp(d,M)),u.remove(d),g.remove(M),g.insert(Kl(M)),g.insert(Kl(M.next)))}}M=p;var T=[];do T.push(M.p),M=M.next;while(M!==p);return T.push(M.p),T}function i1(o,e,r,a,u,c,h){for(var p=new Qa([],o1),d=o.data;d;){for(var g=0;g<d.children.length;g++){var v=d.children[g],x=d.leaf?jl(v,r,a):s1(r,a,v);x>c||p.push({node:v,dist:x})}for(;p.length&&!p.peek().node.children;){var M=p.pop(),w=M.node,I=jl(w,e,r),D=jl(w,a,u);if(M.dist<I&&M.dist<D&&gp(r,w,h)&&gp(a,w,h))return w}d=p.pop(),d&&(d=d.node)}return null}function o1(o,e){return o.dist-e.dist}function s1(o,e,r){if(mp(o,r)||mp(e,r))return 0;var a=Ka(o[0],o[1],e[0],e[1],r.minX,r.minY,r.maxX,r.minY);if(a===0)return 0;var u=Ka(o[0],o[1],e[0],e[1],r.minX,r.minY,r.minX,r.maxY);if(u===0)return 0;var c=Ka(o[0],o[1],e[0],e[1],r.maxX,r.minY,r.maxX,r.maxY);if(c===0)return 0;var h=Ka(o[0],o[1],e[0],e[1],r.minX,r.maxY,r.maxX,r.maxY);return h===0?0:Math.min(a,u,c,h)}function mp(o,e){return o[0]>=e.minX&&o[0]<=e.maxX&&o[1]>=e.minY&&o[1]<=e.maxY}function gp(o,e,r){for(var a=Math.min(o[0],e[0]),u=Math.min(o[1],e[1]),c=Math.max(o[0],e[0]),h=Math.max(o[1],e[1]),p=r.search({minX:a,minY:u,maxX:c,maxY:h}),d=0;d<p.length;d++)if(a1(p[d].p,p[d].next.p,o,e))return!1;return!0}function ds(o,e,r){return r1(o[0],o[1],e[0],e[1],r[0],r[1])}function a1(o,e,r,a){return o!==a&&e!==r&&ds(o,e,r)>0!=ds(o,e,a)>0&&ds(r,a,o)>0!=ds(r,a,e)>0}function Kl(o){var e=o.p,r=o.next.p;return o.minX=Math.min(e[0],r[0]),o.minY=Math.min(e[1],r[1]),o.maxX=Math.max(e[0],r[0]),o.maxY=Math.max(e[1],r[1]),o}function u1(o){for(var e=o[0],r=o[0],a=o[0],u=o[0],c=0;c<o.length;c++){var h=o[c];h[0]<e[0]&&(e=h),h[0]>a[0]&&(a=h),h[1]<r[1]&&(r=h),h[1]>u[1]&&(u=h)}var p=[e,r,a,u],d=p.slice();for(c=0;c<o.length;c++)n1(o[c],p)||d.push(o[c]);return c1(d)}function yp(o,e){var r={p:o,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function Ql(o,e){var r=o[0]-e[0],a=o[1]-e[1];return r*r+a*a}function jl(o,e,r){var a=e[0],u=e[1],c=r[0]-a,h=r[1]-u;if(c!==0||h!==0){var p=((o[0]-a)*c+(o[1]-u)*h)/(c*c+h*h);p>1?(a=r[0],u=r[1]):p>0&&(a+=c*p,u+=h*p)}return c=o[0]-a,h=o[1]-u,c*c+h*h}function Ka(o,e,r,a,u,c,h,p){var d=r-o,g=a-e,v=h-u,x=p-c,M=o-u,w=e-c,I=d*d+g*g,D=d*v+g*x,b=v*v+x*x,T=d*M+g*w,L=v*M+x*w,P=I*b-D*D,z,k,Y,q,C=P,ot=P;P===0?(k=0,C=1,q=L,ot=b):(k=D*L-b*T,q=I*L-D*T,k<0?(k=0,q=L,ot=b):k>C&&(k=C,q=L+D,ot=b)),q<0?(q=0,-T<0?k=0:-T>I?k=C:(k=-T,C=I)):q>ot&&(q=ot,-T+D<0?k=0:-T+D>I?k=C:(k=-T+D,C=I)),z=k===0?0:k/C,Y=q===0?0:q/ot;var pt=(1-z)*o+z*r,dt=(1-z)*e+z*a,F=(1-Y)*u+Y*h,ye=(1-Y)*c+Y*p,et=F-pt,St=ye-dt;return et*et+St*St}function l1(o,e){return o[0]===e[0]?o[1]-e[1]:o[0]-e[0]}function c1(o){o.sort(l1);for(var e=[],r=0;r<o.length;r++){for(;e.length>=2&&ds(e[e.length-2],e[e.length-1],o[r])<=0;)e.pop();e.push(o[r])}for(var a=[],u=o.length-1;u>=0;u--){for(;a.length>=2&&ds(a[a.length-2],a[a.length-1],o[u])<=0;)a.pop();a.push(o[u])}return a.pop(),e.pop(),e.concat(a)}});var bp=ct((nc,rc)=>{(function(o,e){typeof nc=="object"&&typeof rc!="undefined"?rc.exports=e():typeof define=="function"&&define.amd?define(e):o.quickselect=e()})(nc,function(){"use strict";function o(u,c,h,p,d){e(u,c,h||0,p||u.length-1,d||a)}function e(u,c,h,p,d){for(;p>h;){if(p-h>600){var g=p-h+1,v=c-h+1,x=Math.log(g),M=.5*Math.exp(2*x/3),w=.5*Math.sqrt(x*M*(g-M)/g)*(v-g/2<0?-1:1),I=Math.max(h,Math.floor(c-v*M/g+w)),D=Math.min(p,Math.floor(c+(g-v)*M/g+w));e(u,c,I,D,d)}var b=u[c],T=h,L=p;for(r(u,h,c),d(u[p],b)>0&&r(u,h,p);T<L;){for(r(u,T,L),T++,L--;d(u[T],b)<0;)T++;for(;d(u[L],b)>0;)L--}d(u[h],b)===0?r(u,h,L):(L++,r(u,L,p)),L<=c&&(h=L+1),c<=L&&(p=L-1)}}function r(u,c,h){var p=u[c];u[c]=u[h],u[h]=p}function a(u,c){return u<c?-1:u>c?1:0}return o})});var ac=ct((AT,sc)=>{"use strict";sc.exports=sa;sc.exports.default=sa;var w1=bp();function sa(o,e){if(!(this instanceof sa))return new sa(o,e);this._maxEntries=Math.max(4,o||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),e&&this._initFormat(e),this.clear()}sa.prototype={all:function(){return this._all(this.data,[])},search:function(o){var e=this.data,r=[],a=this.toBBox;if(!tu(o,e))return r;for(var u=[],c,h,p,d;e;){for(c=0,h=e.children.length;c<h;c++)p=e.children[c],d=e.leaf?a(p):p,tu(o,d)&&(e.leaf?r.push(p):oc(o,d)?this._all(p,r):u.push(p));e=u.pop()}return r},collides:function(o){var e=this.data,r=this.toBBox;if(!tu(o,e))return!1;for(var a=[],u,c,h,p;e;){for(u=0,c=e.children.length;u<c;u++)if(h=e.children[u],p=e.leaf?r(h):h,tu(o,p)){if(e.leaf||oc(o,p))return!0;a.push(h)}e=a.pop()}return!1},load:function(o){if(!(o&&o.length))return this;if(o.length<this._minEntries){for(var e=0,r=o.length;e<r;e++)this.insert(o[e]);return this}var a=this._build(o.slice(),0,o.length-1,0);if(!this.data.children.length)this.data=a;else if(this.data.height===a.height)this._splitRoot(this.data,a);else{if(this.data.height<a.height){var u=this.data;this.data=a,a=u}this._insert(a,this.data.height-a.height-1,!0)}return this},insert:function(o){return o&&this._insert(o,this.data.height-1),this},clear:function(){return this.data=ys([]),this},remove:function(o,e){if(!o)return this;for(var r=this.data,a=this.toBBox(o),u=[],c=[],h,p,d,g;r||u.length;){if(r||(r=u.pop(),p=u[u.length-1],h=c.pop(),g=!0),r.leaf&&(d=S1(o,r.children,e),d!==-1))return r.children.splice(d,1),u.push(r),this._condense(u),this;!g&&!r.leaf&&oc(r,a)?(u.push(r),c.push(h),h=0,p=r,r=r.children[0]):p?(h++,r=p.children[h],g=!1):r=null}return this},toBBox:function(o){return o},compareMinX:Ap,compareMinY:Tp,toJSON:function(){return this.data},fromJSON:function(o){return this.data=o,this},_all:function(o,e){for(var r=[];o;)o.leaf?e.push.apply(e,o.children):r.push.apply(r,o.children),o=r.pop();return e},_build:function(o,e,r,a){var u=r-e+1,c=this._maxEntries,h;if(u<=c)return h=ys(o.slice(e,r+1)),gs(h,this.toBBox),h;a||(a=Math.ceil(Math.log(u)/Math.log(c)),c=Math.ceil(u/Math.pow(c,a-1))),h=ys([]),h.leaf=!1,h.height=a;var p=Math.ceil(u/c),d=p*Math.ceil(Math.sqrt(c)),g,v,x,M;for(Cp(o,e,r,d,this.compareMinX),g=e;g<=r;g+=d)for(x=Math.min(g+d-1,r),Cp(o,g,x,p,this.compareMinY),v=g;v<=x;v+=p)M=Math.min(v+p-1,x),h.children.push(this._build(o,v,M,a-1));return gs(h,this.toBBox),h},_chooseSubtree:function(o,e,r,a){for(var u,c,h,p,d,g,v,x;a.push(e),!(e.leaf||a.length-1===r);){for(v=x=1/0,u=0,c=e.children.length;u<c;u++)h=e.children[u],d=ic(h),g=b1(o,h)-d,g<x?(x=g,v=d<v?d:v,p=h):g===x&&d<v&&(v=d,p=h);e=p||e.children[0]}return e},_insert:function(o,e,r){var a=this.toBBox,u=r?o:a(o),c=[],h=this._chooseSubtree(u,this.data,e,c);for(h.children.push(o),oa(h,u);e>=0&&c[e].children.length>this._maxEntries;)this._split(c,e),e--;this._adjustParentBBoxes(u,c,e)},_split:function(o,e){var r=o[e],a=r.children.length,u=this._minEntries;this._chooseSplitAxis(r,u,a);var c=this._chooseSplitIndex(r,u,a),h=ys(r.children.splice(c,r.children.length-c));h.height=r.height,h.leaf=r.leaf,gs(r,this.toBBox),gs(h,this.toBBox),e?o[e-1].children.push(h):this._splitRoot(r,h)},_splitRoot:function(o,e){this.data=ys([o,e]),this.data.height=o.height+1,this.data.leaf=!1,gs(this.data,this.toBBox)},_chooseSplitIndex:function(o,e,r){var a,u,c,h,p,d,g,v;for(d=g=1/0,a=e;a<=r-e;a++)u=ia(o,0,a,this.toBBox),c=ia(o,a,r,this.toBBox),h=A1(u,c),p=ic(u)+ic(c),h<d?(d=h,v=a,g=p<g?p:g):h===d&&p<g&&(g=p,v=a);return v},_chooseSplitAxis:function(o,e,r){var a=o.leaf?this.compareMinX:Ap,u=o.leaf?this.compareMinY:Tp,c=this._allDistMargin(o,e,r,a),h=this._allDistMargin(o,e,r,u);c<h&&o.children.sort(a)},_allDistMargin:function(o,e,r,a){o.children.sort(a);var u=this.toBBox,c=ia(o,0,e,u),h=ia(o,r-e,r,u),p=ja(c)+ja(h),d,g;for(d=e;d<r-e;d++)g=o.children[d],oa(c,o.leaf?u(g):g),p+=ja(c);for(d=r-e-1;d>=e;d--)g=o.children[d],oa(h,o.leaf?u(g):g),p+=ja(h);return p},_adjustParentBBoxes:function(o,e,r){for(var a=r;a>=0;a--)oa(e[a],o)},_condense:function(o){for(var e=o.length-1,r;e>=0;e--)o[e].children.length===0?e>0?(r=o[e-1].children,r.splice(r.indexOf(o[e]),1)):this.clear():gs(o[e],this.toBBox)},_initFormat:function(o){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(o[0])),this.compareMinY=new Function("a","b",e.join(o[1])),this.toBBox=new Function("a","return {minX: a"+o[0]+", minY: a"+o[1]+", maxX: a"+o[2]+", maxY: a"+o[3]+"};")}};function S1(o,e,r){if(!r)return e.indexOf(o);for(var a=0;a<e.length;a++)if(r(o,e[a]))return a;return-1}function gs(o,e){ia(o,0,o.children.length,e,o)}function ia(o,e,r,a,u){u||(u=ys(null)),u.minX=1/0,u.minY=1/0,u.maxX=-1/0,u.maxY=-1/0;for(var c=e,h;c<r;c++)h=o.children[c],oa(u,o.leaf?a(h):h);return u}function oa(o,e){return o.minX=Math.min(o.minX,e.minX),o.minY=Math.min(o.minY,e.minY),o.maxX=Math.max(o.maxX,e.maxX),o.maxY=Math.max(o.maxY,e.maxY),o}function Ap(o,e){return o.minX-e.minX}function Tp(o,e){return o.minY-e.minY}function ic(o){return(o.maxX-o.minX)*(o.maxY-o.minY)}function ja(o){return o.maxX-o.minX+(o.maxY-o.minY)}function b1(o,e){return(Math.max(e.maxX,o.maxX)-Math.min(e.minX,o.minX))*(Math.max(e.maxY,o.maxY)-Math.min(e.minY,o.minY))}function A1(o,e){var r=Math.max(o.minX,e.minX),a=Math.max(o.minY,e.minY),u=Math.min(o.maxX,e.maxX),c=Math.min(o.maxY,e.maxY);return Math.max(0,u-r)*Math.max(0,c-a)}function oc(o,e){return o.minX<=e.minX&&o.minY<=e.minY&&e.maxX<=o.maxX&&e.maxY<=o.maxY}function tu(o,e){return e.minX<=o.maxX&&e.minY<=o.maxY&&e.maxX>=o.minX&&e.maxY>=o.minY}function ys(o){return{children:o,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Cp(o,e,r,a,u){for(var c=[e,r],h;c.length;)r=c.pop(),e=c.pop(),!(r-e<=a)&&(h=e+Math.ceil((r-e)/a/2)*a,w1(o,h,e,r,u),c.push(e,h,h,r))}});var Dp=ct((zC,pc)=>{"use strict";pc.exports=iu;pc.exports.default=iu;function iu(o,e,r){r=r||2;var a=e&&e.length,u=a?e[0]*r:o.length,c=Rp(o,0,u,r,!0),h=[];if(!c||c.next===c.prev)return h;var p,d,g,v,x,M,w;if(a&&(c=F1(o,e,c,r)),o.length>80*r){p=g=o[0],d=v=o[1];for(var I=r;I<u;I+=r)x=o[I],M=o[I+1],x<p&&(p=x),M<d&&(d=M),x>g&&(g=x),M>v&&(v=M);w=Math.max(g-p,v-d),w=w!==0?32767/w:0}return la(c,h,r,p,d,w,0),h}function Rp(o,e,r,a,u){var c,h;if(u===fc(o,e,r,a)>0)for(c=e;c<r;c+=a)h=Pp(c,o[c],o[c+1],h);else for(c=r-a;c>=e;c-=a)h=Pp(c,o[c],o[c+1],h);return h&&ou(h,h.next)&&(ha(h),h=h.next),h}function zo(o,e){if(!o)return o;e||(e=o);var r=o,a;do if(a=!1,!r.steiner&&(ou(r,r.next)||fn(r.prev,r,r.next)===0)){if(ha(r),r=e=r.prev,r===r.next)break;a=!0}else r=r.next;while(a||r!==e);return e}function la(o,e,r,a,u,c,h){if(o){!h&&c&&G1(o,a,u,c);for(var p=o,d,g;o.prev!==o.next;){if(d=o.prev,g=o.next,c?L1(o,a,u,c):N1(o)){e.push(d.i/r|0),e.push(o.i/r|0),e.push(g.i/r|0),ha(o),o=g.next,p=g.next;continue}if(o=g,o===p){h?h===1?(o=D1(zo(o),e,r),la(o,e,r,a,u,c,2)):h===2&&O1(o,e,r,a,u,c):la(zo(o),e,r,a,u,c,1);break}}}}function N1(o){var e=o.prev,r=o,a=o.next;if(fn(e,r,a)>=0)return!1;for(var u=e.x,c=r.x,h=a.x,p=e.y,d=r.y,g=a.y,v=u<c?u<h?u:h:c<h?c:h,x=p<d?p<g?p:g:d<g?d:g,M=u>c?u>h?u:h:c>h?c:h,w=p>d?p>g?p:g:d>g?d:g,I=a.next;I!==e;){if(I.x>=v&&I.x<=M&&I.y>=x&&I.y<=w&&xs(u,p,c,d,h,g,I.x,I.y)&&fn(I.prev,I,I.next)>=0)return!1;I=I.next}return!0}function L1(o,e,r,a){var u=o.prev,c=o,h=o.next;if(fn(u,c,h)>=0)return!1;for(var p=u.x,d=c.x,g=h.x,v=u.y,x=c.y,M=h.y,w=p<d?p<g?p:g:d<g?d:g,I=v<x?v<M?v:M:x<M?x:M,D=p>d?p>g?p:g:d>g?d:g,b=v>x?v>M?v:M:x>M?x:M,T=cc(w,I,e,r,a),L=cc(D,b,e,r,a),P=o.prevZ,z=o.nextZ;P&&P.z>=T&&z&&z.z<=L;){if(P.x>=w&&P.x<=D&&P.y>=I&&P.y<=b&&P!==u&&P!==h&&xs(p,v,d,x,g,M,P.x,P.y)&&fn(P.prev,P,P.next)>=0||(P=P.prevZ,z.x>=w&&z.x<=D&&z.y>=I&&z.y<=b&&z!==u&&z!==h&&xs(p,v,d,x,g,M,z.x,z.y)&&fn(z.prev,z,z.next)>=0))return!1;z=z.nextZ}for(;P&&P.z>=T;){if(P.x>=w&&P.x<=D&&P.y>=I&&P.y<=b&&P!==u&&P!==h&&xs(p,v,d,x,g,M,P.x,P.y)&&fn(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;z&&z.z<=L;){if(z.x>=w&&z.x<=D&&z.y>=I&&z.y<=b&&z!==u&&z!==h&&xs(p,v,d,x,g,M,z.x,z.y)&&fn(z.prev,z,z.next)>=0)return!1;z=z.nextZ}return!0}function D1(o,e,r){var a=o;do{var u=a.prev,c=a.next.next;!ou(u,c)&&Np(u,a,a.next,c)&&ca(u,c)&&ca(c,u)&&(e.push(u.i/r|0),e.push(a.i/r|0),e.push(c.i/r|0),ha(a),ha(a.next),a=o=c),a=a.next}while(a!==o);return zo(a)}function O1(o,e,r,a,u,c){var h=o;do{for(var p=h.next.next;p!==h.prev;){if(h.i!==p.i&&q1(h,p)){var d=Lp(h,p);h=zo(h,h.next),d=zo(d,d.next),la(h,e,r,a,u,c,0),la(d,e,r,a,u,c,0);return}p=p.next}h=h.next}while(h!==o)}function F1(o,e,r,a){var u=[],c,h,p,d,g;for(c=0,h=e.length;c<h;c++)p=e[c]*a,d=c<h-1?e[c+1]*a:o.length,g=Rp(o,p,d,a,!1),g===g.next&&(g.steiner=!0),u.push(H1(g));for(u.sort(U1),c=0;c<u.length;c++)r=B1(u[c],r);return r}function U1(o,e){return o.x-e.x}function B1(o,e){var r=z1(o,e);if(!r)return e;var a=Lp(r,o);return zo(a,a.next),zo(r,r.next)}function z1(o,e){var r=e,a=o.x,u=o.y,c=-1/0,h;do{if(u<=r.y&&u>=r.next.y&&r.next.y!==r.y){var p=r.x+(u-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(p<=a&&p>c&&(c=p,h=r.x<r.next.x?r:r.next,p===a))return h}r=r.next}while(r!==e);if(!h)return null;var d=h,g=h.x,v=h.y,x=1/0,M;r=h;do a>=r.x&&r.x>=g&&a!==r.x&&xs(u<v?a:c,u,g,v,u<v?c:a,u,r.x,r.y)&&(M=Math.abs(u-r.y)/(a-r.x),ca(r,o)&&(M<x||M===x&&(r.x>h.x||r.x===h.x&&k1(h,r)))&&(h=r,x=M)),r=r.next;while(r!==d);return h}function k1(o,e){return fn(o.prev,o,e.prev)<0&&fn(e.next,o,o.next)<0}function G1(o,e,r,a){var u=o;do u.z===0&&(u.z=cc(u.x,u.y,e,r,a)),u.prevZ=u.prev,u.nextZ=u.next,u=u.next;while(u!==o);u.prevZ.nextZ=null,u.prevZ=null,V1(u)}function V1(o){var e,r,a,u,c,h,p,d,g=1;do{for(r=o,o=null,c=null,h=0;r;){for(h++,a=r,p=0,e=0;e<g&&(p++,a=a.nextZ,!!a);e++);for(d=g;p>0||d>0&&a;)p!==0&&(d===0||!a||r.z<=a.z)?(u=r,r=r.nextZ,p--):(u=a,a=a.nextZ,d--),c?c.nextZ=u:o=u,u.prevZ=c,c=u;r=a}c.nextZ=null,g*=2}while(h>1);return o}function cc(o,e,r,a,u){return o=(o-r)*u|0,e=(e-a)*u|0,o=(o|o<<8)&16711935,o=(o|o<<4)&252645135,o=(o|o<<2)&858993459,o=(o|o<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,o|e<<1}function H1(o){var e=o,r=o;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==o);return r}function xs(o,e,r,a,u,c,h,p){return(u-h)*(e-p)>=(o-h)*(c-p)&&(o-h)*(a-p)>=(r-h)*(e-p)&&(r-h)*(c-p)>=(u-h)*(a-p)}function q1(o,e){return o.next.i!==e.i&&o.prev.i!==e.i&&!W1(o,e)&&(ca(o,e)&&ca(e,o)&&X1(o,e)&&(fn(o.prev,o,e.prev)||fn(o,e.prev,e))||ou(o,e)&&fn(o.prev,o,o.next)>0&&fn(e.prev,e,e.next)>0)}function fn(o,e,r){return(e.y-o.y)*(r.x-e.x)-(e.x-o.x)*(r.y-e.y)}function ou(o,e){return o.x===e.x&&o.y===e.y}function Np(o,e,r,a){var u=ru(fn(o,e,r)),c=ru(fn(o,e,a)),h=ru(fn(r,a,o)),p=ru(fn(r,a,e));return!!(u!==c&&h!==p||u===0&&nu(o,r,e)||c===0&&nu(o,a,e)||h===0&&nu(r,o,a)||p===0&&nu(r,e,a))}function nu(o,e,r){return e.x<=Math.max(o.x,r.x)&&e.x>=Math.min(o.x,r.x)&&e.y<=Math.max(o.y,r.y)&&e.y>=Math.min(o.y,r.y)}function ru(o){return o>0?1:o<0?-1:0}function W1(o,e){var r=o;do{if(r.i!==o.i&&r.next.i!==o.i&&r.i!==e.i&&r.next.i!==e.i&&Np(r,r.next,o,e))return!0;r=r.next}while(r!==o);return!1}function ca(o,e){return fn(o.prev,o,o.next)<0?fn(o,e,o.next)>=0&&fn(o,o.prev,e)>=0:fn(o,e,o.prev)<0||fn(o,o.next,e)<0}function X1(o,e){var r=o,a=!1,u=(o.x+e.x)/2,c=(o.y+e.y)/2;do r.y>c!=r.next.y>c&&r.next.y!==r.y&&u<(r.next.x-r.x)*(c-r.y)/(r.next.y-r.y)+r.x&&(a=!a),r=r.next;while(r!==o);return a}function Lp(o,e){var r=new hc(o.i,o.x,o.y),a=new hc(e.i,e.x,e.y),u=o.next,c=e.prev;return o.next=e,e.prev=o,r.next=u,u.prev=r,a.next=r,r.prev=a,c.next=a,a.prev=c,a}function Pp(o,e,r,a){var u=new hc(o,e,r);return a?(u.next=a.next,u.prev=a,a.next.prev=u,a.next=u):(u.prev=u,u.next=u),u}function ha(o){o.next.prev=o.prev,o.prev.next=o.next,o.prevZ&&(o.prevZ.nextZ=o.nextZ),o.nextZ&&(o.nextZ.prevZ=o.prevZ)}function hc(o,e,r){this.i=o,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}iu.deviation=function(o,e,r,a){var u=e&&e.length,c=u?e[0]*r:o.length,h=Math.abs(fc(o,0,c,r));if(u)for(var p=0,d=e.length;p<d;p++){var g=e[p]*r,v=p<d-1?e[p+1]*r:o.length;h-=Math.abs(fc(o,g,v,r))}var x=0;for(p=0;p<a.length;p+=3){var M=a[p]*r,w=a[p+1]*r,I=a[p+2]*r;x+=Math.abs((o[M]-o[I])*(o[w+1]-o[M+1])-(o[M]-o[w])*(o[I+1]-o[M+1]))}return h===0&&x===0?0:Math.abs((x-h)/h)};function fc(o,e,r,a){for(var u=0,c=e,h=r-a;c<r;c+=a)u+=(o[h]-o[c])*(o[c+1]+o[h+1]),h=c;return u}iu.flatten=function(o){for(var e=o[0][0].length,r={vertices:[],holes:[],dimensions:e},a=0,u=0;u<o.length;u++){for(var c=0;c<o[u].length;c++)for(var h=0;h<e;h++)r.vertices.push(o[u][c][h]);u>0&&(a+=o[u-1].length,r.holes.push(a))}return r}});var vc=ct(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.earthRadius=63710088e-1;Et.factors={centimeters:Et.earthRadius*100,centimetres:Et.earthRadius*100,degrees:Et.earthRadius/111325,feet:Et.earthRadius*3.28084,inches:Et.earthRadius*39.37,kilometers:Et.earthRadius/1e3,kilometres:Et.earthRadius/1e3,meters:Et.earthRadius,metres:Et.earthRadius,miles:Et.earthRadius/1609.344,millimeters:Et.earthRadius*1e3,millimetres:Et.earthRadius*1e3,nauticalmiles:Et.earthRadius/1852,radians:1,yards:Et.earthRadius*1.0936};Et.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/Et.earthRadius,yards:1.0936133};Et.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 vo(o,e,r){r===void 0&&(r={});var a={type:"Feature"};return(r.id===0||r.id)&&(a.id=r.id),r.bbox&&(a.bbox=r.bbox),a.properties=e||{},a.geometry=o,a}Et.feature=vo;function $1(o,e,r){switch(r===void 0&&(r={}),o){case"Point":return dc(e).geometry;case"LineString":return gc(e).geometry;case"Polygon":return mc(e).geometry;case"MultiPoint":return Fp(e).geometry;case"MultiLineString":return Op(e).geometry;case"MultiPolygon":return Up(e).geometry;default:throw new Error(o+" is invalid")}}Et.geometry=$1;function dc(o,e,r){if(r===void 0&&(r={}),!o)throw new Error("coordinates is required");if(!Array.isArray(o))throw new Error("coordinates must be an Array");if(o.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!su(o[0])||!su(o[1]))throw new Error("coordinates must contain numbers");var a={type:"Point",coordinates:o};return vo(a,e,r)}Et.point=dc;function Z1(o,e,r){return r===void 0&&(r={}),au(o.map(function(a){return dc(a,e)}),r)}Et.points=Z1;function mc(o,e,r){r===void 0&&(r={});for(var a=0,u=o;a<u.length;a++){var c=u[a];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<c[c.length-1].length;h++)if(c[c.length-1][h]!==c[0][h])throw new Error("First and last Position are not equivalent.")}var p={type:"Polygon",coordinates:o};return vo(p,e,r)}Et.polygon=mc;function J1(o,e,r){return r===void 0&&(r={}),au(o.map(function(a){return mc(a,e)}),r)}Et.polygons=J1;function gc(o,e,r){if(r===void 0&&(r={}),o.length<2)throw new Error("coordinates must be an array of two or more positions");var a={type:"LineString",coordinates:o};return vo(a,e,r)}Et.lineString=gc;function K1(o,e,r){return r===void 0&&(r={}),au(o.map(function(a){return gc(a,e)}),r)}Et.lineStrings=K1;function au(o,e){e===void 0&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=o,r}Et.featureCollection=au;function Op(o,e,r){r===void 0&&(r={});var a={type:"MultiLineString",coordinates:o};return vo(a,e,r)}Et.multiLineString=Op;function Fp(o,e,r){r===void 0&&(r={});var a={type:"MultiPoint",coordinates:o};return vo(a,e,r)}Et.multiPoint=Fp;function Up(o,e,r){r===void 0&&(r={});var a={type:"MultiPolygon",coordinates:o};return vo(a,e,r)}Et.multiPolygon=Up;function Q1(o,e,r){r===void 0&&(r={});var a={type:"GeometryCollection",geometries:o};return vo(a,e,r)}Et.geometryCollection=Q1;function j1(o,e){if(e===void 0&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(o*r)/r}Et.round=j1;function Bp(o,e){e===void 0&&(e="kilometers");var r=Et.factors[e];if(!r)throw new Error(e+" units is invalid");return o*r}Et.radiansToLength=Bp;function yc(o,e){e===void 0&&(e="kilometers");var r=Et.factors[e];if(!r)throw new Error(e+" units is invalid");return o/r}Et.lengthToRadians=yc;function tx(o,e){return zp(yc(o,e))}Et.lengthToDegrees=tx;function ex(o){var e=o%360;return e<0&&(e+=360),e}Et.bearingToAzimuth=ex;function zp(o){var e=o%(2*Math.PI);return e*180/Math.PI}Et.radiansToDegrees=zp;function nx(o){var e=o%360;return e*Math.PI/180}Et.degreesToRadians=nx;function rx(o,e,r){if(e===void 0&&(e="kilometers"),r===void 0&&(r="kilometers"),!(o>=0))throw new Error("length must be a positive number");return Bp(yc(o,e),r)}Et.convertLength=rx;function ix(o,e,r){if(e===void 0&&(e="meters"),r===void 0&&(r="kilometers"),!(o>=0))throw new Error("area must be a positive number");var a=Et.areaFactors[e];if(!a)throw new Error("invalid original units");var u=Et.areaFactors[r];if(!u)throw new Error("invalid final units");return o/a*u}Et.convertArea=ix;function su(o){return!isNaN(o)&&o!==null&&!Array.isArray(o)}Et.isNumber=su;function ox(o){return!!o&&o.constructor===Object}Et.isObject=ox;function sx(o){if(!o)throw new Error("bbox is required");if(!Array.isArray(o))throw new Error("bbox must be an Array");if(o.length!==4&&o.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");o.forEach(function(e){if(!su(e))throw new Error("bbox must only contain numbers")})}Et.validateBBox=sx;function ax(o){if(!o)throw new Error("id is required");if(["string","number"].indexOf(typeof o)===-1)throw new Error("id must be a number or a string")}Et.validateId=ax});var xc=ct(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});var vr=vc();function fa(o,e,r){if(o!==null)for(var a,u,c,h,p,d,g,v=0,x=0,M,w=o.type,I=w==="FeatureCollection",D=w==="Feature",b=I?o.features.length:1,T=0;T<b;T++){g=I?o.features[T].geometry:D?o.geometry:o,M=g?g.type==="GeometryCollection":!1,p=M?g.geometries.length:1;for(var L=0;L<p;L++){var P=0,z=0;if(h=M?g.geometries[L]:g,h!==null){d=h.coordinates;var k=h.type;switch(v=r&&(k==="Polygon"||k==="MultiPolygon")?1:0,k){case null:break;case"Point":if(e(d,x,T,P,z)===!1)return!1;x++,P++;break;case"LineString":case"MultiPoint":for(a=0;a<d.length;a++){if(e(d[a],x,T,P,z)===!1)return!1;x++,k==="MultiPoint"&&P++}k==="LineString"&&P++;break;case"Polygon":case"MultiLineString":for(a=0;a<d.length;a++){for(u=0;u<d[a].length-v;u++){if(e(d[a][u],x,T,P,z)===!1)return!1;x++}k==="MultiLineString"&&P++,k==="Polygon"&&z++}k==="Polygon"&&P++;break;case"MultiPolygon":for(a=0;a<d.length;a++){for(z=0,u=0;u<d[a].length;u++){for(c=0;c<d[a][u].length-v;c++){if(e(d[a][u][c],x,T,P,z)===!1)return!1;x++}z++}P++}break;case"GeometryCollection":for(a=0;a<h.geometries.length;a++)if(fa(h.geometries[a],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ux(o,e,r,a){var u=r;return fa(o,function(c,h,p,d,g){h===0&&r===void 0?u=c:u=e(u,c,h,p,d,g)},a),u}function kp(o,e){var r;switch(o.type){case"FeatureCollection":for(r=0;r<o.features.length&&e(o.features[r].properties,r)!==!1;r++);break;case"Feature":e(o.properties,0);break}}function lx(o,e,r){var a=r;return kp(o,function(u,c){c===0&&r===void 0?a=u:a=e(a,u,c)}),a}function Gp(o,e){if(o.type==="Feature")e(o,0);else if(o.type==="FeatureCollection")for(var r=0;r<o.features.length&&e(o.features[r],r)!==!1;r++);}function cx(o,e,r){var a=r;return Gp(o,function(u,c){c===0&&r===void 0?a=u:a=e(a,u,c)}),a}function hx(o){var e=[];return fa(o,function(r){e.push(r)}),e}function _c(o,e){var r,a,u,c,h,p,d,g,v,x,M=0,w=o.type==="FeatureCollection",I=o.type==="Feature",D=w?o.features.length:1;for(r=0;r<D;r++){for(p=w?o.features[r].geometry:I?o.geometry:o,g=w?o.features[r].properties:I?o.properties:{},v=w?o.features[r].bbox:I?o.bbox:void 0,x=w?o.features[r].id:I?o.id:void 0,d=p?p.type==="GeometryCollection":!1,h=d?p.geometries.length:1,u=0;u<h;u++){if(c=d?p.geometries[u]:p,c===null){if(e(null,M,g,v,x)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(c,M,g,v,x)===!1)return!1;break}case"GeometryCollection":{for(a=0;a<c.geometries.length;a++)if(e(c.geometries[a],M,g,v,x)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}M++}}function fx(o,e,r){var a=r;return _c(o,function(u,c,h,p,d){c===0&&r===void 0?a=u:a=e(a,u,c,h,p,d)}),a}function uu(o,e){_c(o,function(r,a,u,c,h){var p=r===null?null:r.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return e(vr.feature(r,u,{bbox:c,id:h}),a,0)===!1?!1:void 0}var d;switch(p){case"MultiPoint":d="Point";break;case"MultiLineString":d="LineString";break;case"MultiPolygon":d="Polygon";break}for(var g=0;g<r.coordinates.length;g++){var v=r.coordinates[g],x={type:d,coordinates:v};if(e(vr.feature(x,u),a,g)===!1)return!1}})}function px(o,e,r){var a=r;return uu(o,function(u,c,h){c===0&&h===0&&r===void 0?a=u:a=e(a,u,c,h)}),a}function Vp(o,e){uu(o,function(r,a,u){var c=0;if(r.geometry){var h=r.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var p,d=0,g=0,v=0;if(fa(r,function(x,M,w,I,D){if(p===void 0||a>d||I>g||D>v){p=x,d=a,g=I,v=D,c=0;return}var b=vr.lineString([p,x],r.properties);if(e(b,a,u,D,c)===!1)return!1;c++,p=x})===!1)return!1}}})}function dx(o,e,r){var a=r,u=!1;return Vp(o,function(c,h,p,d,g){u===!1&&r===void 0?a=c:a=e(a,c,h,p,d,g),u=!0}),a}function Hp(o,e){if(!o)throw new Error("geojson is required");uu(o,function(r,a,u){if(r.geometry!==null){var c=r.geometry.type,h=r.geometry.coordinates;switch(c){case"LineString":if(e(r,a,u,0,0)===!1)return!1;break;case"Polygon":for(var p=0;p<h.length;p++)if(e(vr.lineString(h[p],r.properties),a,u,p)===!1)return!1;break}}})}function mx(o,e,r){var a=r;return Hp(o,function(u,c,h,p){c===0&&r===void 0?a=u:a=e(a,u,c,h,p)}),a}function gx(o,e){if(e=e||{},!vr.isObject(e))throw new Error("options is invalid");var r=e.featureIndex||0,a=e.multiFeatureIndex||0,u=e.geometryIndex||0,c=e.segmentIndex||0,h=e.properties,p;switch(o.type){case"FeatureCollection":r<0&&(r=o.features.length+r),h=h||o.features[r].properties,p=o.features[r].geometry;break;case"Feature":h=h||o.properties,p=o.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=o;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var d=p.coordinates;switch(p.type){case"Point":case"MultiPoint":return null;case"LineString":return c<0&&(c=d.length+c-1),vr.lineString([d[c],d[c+1]],h,e);case"Polygon":return u<0&&(u=d.length+u),c<0&&(c=d[u].length+c-1),vr.lineString([d[u][c],d[u][c+1]],h,e);case"MultiLineString":return a<0&&(a=d.length+a),c<0&&(c=d[a].length+c-1),vr.lineString([d[a][c],d[a][c+1]],h,e);case"MultiPolygon":return a<0&&(a=d.length+a),u<0&&(u=d[a].length+u),c<0&&(c=d[a][u].length-c-1),vr.lineString([d[a][u][c],d[a][u][c+1]],h,e)}throw new Error("geojson is invalid")}function yx(o,e){if(e=e||{},!vr.isObject(e))throw new Error("options is invalid");var r=e.featureIndex||0,a=e.multiFeatureIndex||0,u=e.geometryIndex||0,c=e.coordIndex||0,h=e.properties,p;switch(o.type){case"FeatureCollection":r<0&&(r=o.features.length+r),h=h||o.features[r].properties,p=o.features[r].geometry;break;case"Feature":h=h||o.properties,p=o.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=o;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var d=p.coordinates;switch(p.type){case"Point":return vr.point(d,h,e);case"MultiPoint":return a<0&&(a=d.length+a),vr.point(d[a],h,e);case"LineString":return c<0&&(c=d.length+c),vr.point(d[c],h,e);case"Polygon":return u<0&&(u=d.length+u),c<0&&(c=d[u].length+c),vr.point(d[u][c],h,e);case"MultiLineString":return a<0&&(a=d.length+a),c<0&&(c=d[a].length+c),vr.point(d[a][c],h,e);case"MultiPolygon":return a<0&&(a=d.length+a),u<0&&(u=d[a].length+u),c<0&&(c=d[a][u].length-c),vr.point(d[a][u][c],h,e)}throw new Error("geojson is invalid")}Dn.coordAll=hx;Dn.coordEach=fa;Dn.coordReduce=ux;Dn.featureEach=Gp;Dn.featureReduce=cx;Dn.findPoint=yx;Dn.findSegment=gx;Dn.flattenEach=uu;Dn.flattenReduce=px;Dn.geomEach=_c;Dn.geomReduce=fx;Dn.lineEach=Hp;Dn.lineReduce=mx;Dn.propEach=kp;Dn.propReduce=lx;Dn.segmentEach=Vp;Dn.segmentReduce=dx});var qp=ct(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});var vx=xc();function Ec(o){var e=[1/0,1/0,-1/0,-1/0];return vx.coordEach(o,function(r){e[0]>r[0]&&(e[0]=r[0]),e[1]>r[1]&&(e[1]=r[1]),e[2]<r[0]&&(e[2]=r[0]),e[3]<r[1]&&(e[3]=r[1])}),e}Ec.default=Ec;Mc.default=Ec});var lu=ct((eI,wc)=>{var Oi=$l(),Xp=vc(),Yp=xc(),Es=qp().default,_x=Yp.featureEach,jC=Yp.coordEach,tI=Xp.polygon,Wp=Xp.featureCollection;function $p(o){var e=new Oi(o);return e.insert=function(r){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:Es(r),Oi.prototype.insert.call(this,r)},e.load=function(r){var a=[];return Array.isArray(r)?r.forEach(function(u){if(u.type!=="Feature")throw new Error("invalid features");u.bbox=u.bbox?u.bbox:Es(u),a.push(u)}):_x(r,function(u){if(u.type!=="Feature")throw new Error("invalid features");u.bbox=u.bbox?u.bbox:Es(u),a.push(u)}),Oi.prototype.load.call(this,a)},e.remove=function(r,a){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:Es(r),Oi.prototype.remove.call(this,r,a)},e.clear=function(){return Oi.prototype.clear.call(this)},e.search=function(r){var a=Oi.prototype.search.call(this,this.toBBox(r));return Wp(a)},e.collides=function(r){return Oi.prototype.collides.call(this,this.toBBox(r))},e.all=function(){var r=Oi.prototype.all.call(this);return Wp(r)},e.toJSON=function(){return Oi.prototype.toJSON.call(this)},e.fromJSON=function(r){return Oi.prototype.fromJSON.call(this,r)},e.toBBox=function(r){var a;if(r.bbox)a=r.bbox;else if(Array.isArray(r)&&r.length===4)a=r;else if(Array.isArray(r)&&r.length===6)a=[r[0],r[1],r[3],r[4]];else if(r.type==="Feature")a=Es(r);else if(r.type==="FeatureCollection")a=Es(r);else throw new Error("invalid geojson");return{minX:a[0],minY:a[1],maxX:a[2],maxY:a[3]}},e}wc.exports=$p;wc.exports.default=$p});var Ic=ct((cR,id)=>{"use strict";var rd=Object.prototype.toString;id.exports=function(e){var r=rd.call(e),a=r==="[object Arguments]";return a||(a=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&rd.call(e.callee)==="[object Function]"),a}});var pd=ct((hR,fd)=>{"use strict";var hd;Object.keys||(ma=Object.prototype.hasOwnProperty,Pc=Object.prototype.toString,od=Ic(),Rc=Object.prototype.propertyIsEnumerable,sd=!Rc.call({toString:null},"toString"),ad=Rc.call(function(){},"prototype"),ga=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],du=function(o){var e=o.constructor;return e&&e.prototype===o},ud={$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},ld=function(){if(typeof window=="undefined")return!1;for(var o in window)try{if(!ud["$"+o]&&ma.call(window,o)&&window[o]!==null&&typeof window[o]=="object")try{du(window[o])}catch(e){return!0}}catch(e){return!0}return!1}(),cd=function(o){if(typeof window=="undefined"||!ld)return du(o);try{return du(o)}catch(e){return!1}},hd=function(e){var r=e!==null&&typeof e=="object",a=Pc.call(e)==="[object Function]",u=od(e),c=r&&Pc.call(e)==="[object String]",h=[];if(!r&&!a&&!u)throw new TypeError("Object.keys called on a non-object");var p=ad&&a;if(c&&e.length>0&&!ma.call(e,0))for(var d=0;d<e.length;++d)h.push(String(d));if(u&&e.length>0)for(var g=0;g<e.length;++g)h.push(String(g));else for(var v in e)!(p&&v==="prototype")&&ma.call(e,v)&&h.push(String(v));if(sd)for(var x=cd(e),M=0;M<ga.length;++M)!(x&&ga[M]==="constructor")&&ma.call(e,ga[M])&&h.push(ga[M]);return h});var ma,Pc,od,Rc,sd,ad,ga,du,ud,ld,cd;fd.exports=hd});var Nc=ct((fR,gd)=>{"use strict";var Ix=Array.prototype.slice,Px=Ic(),dd=Object.keys,mu=dd?function(e){return dd(e)}:pd(),md=Object.keys;mu.shim=function(){if(Object.keys){var e=function(){var r=Object.keys(arguments);return r&&r.length===arguments.length}(1,2);e||(Object.keys=function(a){return Px(a)?md(Ix.call(a)):md(a)})}else Object.keys=mu;return Object.keys||mu};gd.exports=mu});var Lc=ct((pR,yd)=>{"use strict";yd.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),a=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(a)!=="[object Symbol]")return!1;var u=42;e[r]=u;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var c=Object.getOwnPropertySymbols(e);if(c.length!==1||c[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var h=Object.getOwnPropertyDescriptor(e,r);if(h.value!==u||h.enumerable!==!0)return!1}return!0}});var gu=ct((dR,vd)=>{"use strict";var Rx=Lc();vd.exports=function(){return Rx()&&!!Symbol.toStringTag}});var xd=ct((mR,_d)=>{"use strict";_d.exports=Error});var Md=ct((gR,Ed)=>{"use strict";Ed.exports=EvalError});var Sd=ct((yR,wd)=>{"use strict";wd.exports=RangeError});var Ad=ct((vR,bd)=>{"use strict";bd.exports=ReferenceError});var Dc=ct((_R,Td)=>{"use strict";Td.exports=SyntaxError});var ko=ct((xR,Cd)=>{"use strict";Cd.exports=TypeError});var Pd=ct((ER,Id)=>{"use strict";Id.exports=URIError});var Ld=ct((MR,Nd)=>{"use strict";var Rd=typeof Symbol!="undefined"&&Symbol,Nx=Lc();Nd.exports=function(){return typeof Rd!="function"||typeof Symbol!="function"||typeof Rd("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Nx()}});var Od=ct((wR,Dd)=>{"use strict";var Oc={__proto__:null,foo:{}},Lx=Object;Dd.exports=function(){return{__proto__:Oc}.foo===Oc.foo&&!(Oc instanceof Lx)}});var Bd=ct((SR,Ud)=>{"use strict";var Dx="Function.prototype.bind called on incompatible ",Ox=Object.prototype.toString,Fx=Math.max,Ux="[object Function]",Fd=function(e,r){for(var a=[],u=0;u<e.length;u+=1)a[u]=e[u];for(var c=0;c<r.length;c+=1)a[c+e.length]=r[c];return a},Bx=function(e,r){for(var a=[],u=r||0,c=0;u<e.length;u+=1,c+=1)a[c]=e[u];return a},zx=function(o,e){for(var r="",a=0;a<o.length;a+=1)r+=o[a],a+1<o.length&&(r+=e);return r};Ud.exports=function(e){var r=this;if(typeof r!="function"||Ox.apply(r)!==Ux)throw new TypeError(Dx+r);for(var a=Bx(arguments,1),u,c=function(){if(this instanceof u){var v=r.apply(this,Fd(a,arguments));return Object(v)===v?v:this}return r.apply(e,Fd(a,arguments))},h=Fx(0,r.length-a.length),p=[],d=0;d<h;d++)p[d]="$"+d;if(u=Function("binder","return function ("+zx(p,",")+"){ return binder.apply(this,arguments); }")(c),r.prototype){var g=function(){};g.prototype=r.prototype,u.prototype=new g,g.prototype=null}return u}});var yu=ct((bR,zd)=>{"use strict";var kx=Bd();zd.exports=Function.prototype.bind||kx});var Gd=ct((AR,kd)=>{"use strict";var Gx=Function.prototype.call,Vx=Object.prototype.hasOwnProperty,Hx=yu();kd.exports=Hx.call(Gx,Vx)});var As=ct((TR,Xd)=>{"use strict";var _e,qx=xd(),Wx=Md(),Xx=Sd(),Yx=Ad(),bs=Dc(),Ss=ko(),$x=Pd(),Wd=Function,Fc=function(o){try{return Wd(\'"use strict"; return (\'+o+").constructor;")()}catch(e){}},Go=Object.getOwnPropertyDescriptor;if(Go)try{Go({},"")}catch(o){Go=null}var Uc=function(){throw new Ss},Zx=Go?function(){try{return arguments.callee,Uc}catch(o){try{return Go(arguments,"callee").get}catch(e){return Uc}}}():Uc,Ms=Ld()(),Jx=Od()(),Zn=Object.getPrototypeOf||(Jx?function(o){return o.__proto__}:null),ws={},Kx=typeof Uint8Array=="undefined"||!Zn?_e:Zn(Uint8Array),Vo={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?_e:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?_e:ArrayBuffer,"%ArrayIteratorPrototype%":Ms&&Zn?Zn([][Symbol.iterator]()):_e,"%AsyncFromSyncIteratorPrototype%":_e,"%AsyncFunction%":ws,"%AsyncGenerator%":ws,"%AsyncGeneratorFunction%":ws,"%AsyncIteratorPrototype%":ws,"%Atomics%":typeof Atomics=="undefined"?_e:Atomics,"%BigInt%":typeof BigInt=="undefined"?_e:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?_e:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?_e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?_e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":qx,"%eval%":eval,"%EvalError%":Wx,"%Float32Array%":typeof Float32Array=="undefined"?_e:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?_e:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?_e:FinalizationRegistry,"%Function%":Wd,"%GeneratorFunction%":ws,"%Int8Array%":typeof Int8Array=="undefined"?_e:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?_e:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?_e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ms&&Zn?Zn(Zn([][Symbol.iterator]())):_e,"%JSON%":typeof JSON=="object"?JSON:_e,"%Map%":typeof Map=="undefined"?_e:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Ms||!Zn?_e:Zn(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?_e:Promise,"%Proxy%":typeof Proxy=="undefined"?_e:Proxy,"%RangeError%":Xx,"%ReferenceError%":Yx,"%Reflect%":typeof Reflect=="undefined"?_e:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?_e:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Ms||!Zn?_e:Zn(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?_e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ms&&Zn?Zn(""[Symbol.iterator]()):_e,"%Symbol%":Ms?Symbol:_e,"%SyntaxError%":bs,"%ThrowTypeError%":Zx,"%TypedArray%":Kx,"%TypeError%":Ss,"%Uint8Array%":typeof Uint8Array=="undefined"?_e:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?_e:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?_e:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?_e:Uint32Array,"%URIError%":$x,"%WeakMap%":typeof WeakMap=="undefined"?_e:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?_e:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?_e:WeakSet};if(Zn)try{null.error}catch(o){Vd=Zn(Zn(o)),Vo["%Error.prototype%"]=Vd}var Vd,Qx=function o(e){var r;if(e==="%AsyncFunction%")r=Fc("async function () {}");else if(e==="%GeneratorFunction%")r=Fc("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Fc("async function* () {}");else if(e==="%AsyncGenerator%"){var a=o("%AsyncGeneratorFunction%");a&&(r=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var u=o("%AsyncGenerator%");u&&Zn&&(r=Zn(u.prototype))}return Vo[e]=r,r},Hd={__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"]},ya=yu(),vu=Gd(),jx=ya.call(Function.call,Array.prototype.concat),tE=ya.call(Function.apply,Array.prototype.splice),qd=ya.call(Function.call,String.prototype.replace),_u=ya.call(Function.call,String.prototype.slice),eE=ya.call(Function.call,RegExp.prototype.exec),nE=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,rE=/\\\\(\\\\)?/g,iE=function(e){var r=_u(e,0,1),a=_u(e,-1);if(r==="%"&&a!=="%")throw new bs("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&r!=="%")throw new bs("invalid intrinsic syntax, expected opening `%`");var u=[];return qd(e,nE,function(c,h,p,d){u[u.length]=p?qd(d,rE,"$1"):h||c}),u},oE=function(e,r){var a=e,u;if(vu(Hd,a)&&(u=Hd[a],a="%"+u[0]+"%"),vu(Vo,a)){var c=Vo[a];if(c===ws&&(c=Qx(a)),typeof c=="undefined"&&!r)throw new Ss("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:u,name:a,value:c}}throw new bs("intrinsic "+e+" does not exist!")};Xd.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Ss("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Ss(\'"allowMissing" argument must be a boolean\');if(eE(/^%?[^%]*%?$/,e)===null)throw new bs("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=iE(e),u=a.length>0?a[0]:"",c=oE("%"+u+"%",r),h=c.name,p=c.value,d=!1,g=c.alias;g&&(u=g[0],tE(a,jx([0,1],g)));for(var v=1,x=!0;v<a.length;v+=1){var M=a[v],w=_u(M,0,1),I=_u(M,-1);if((w===\'"\'||w==="\'"||w==="`"||I===\'"\'||I==="\'"||I==="`")&&w!==I)throw new bs("property names with quotes must have matching quotes");if((M==="constructor"||!x)&&(d=!0),u+="."+M,h="%"+u+"%",vu(Vo,h))p=Vo[h];else if(p!=null){if(!(M in p)){if(!r)throw new Ss("base intrinsic for "+e+" exists, but the property is not available.");return}if(Go&&v+1>=a.length){var D=Go(p,M);x=!!D,x&&"get"in D&&!("originalValue"in D.get)?p=D.get:p=p[M]}else x=vu(p,M),p=p[M];x&&!d&&(Vo[h]=p)}}return p}});var Eu=ct((CR,Yd)=>{"use strict";var sE=As(),xu=sE("%Object.defineProperty%",!0)||!1;if(xu)try{xu({},"a",{value:1})}catch(o){xu=!1}Yd.exports=xu});var Bc=ct((IR,$d)=>{"use strict";var aE=As(),Mu=aE("%Object.getOwnPropertyDescriptor%",!0);if(Mu)try{Mu([],"length")}catch(o){Mu=null}$d.exports=Mu});var wu=ct((PR,Kd)=>{"use strict";var Zd=Eu(),uE=Dc(),Ts=ko(),Jd=Bc();Kd.exports=function(e,r,a){if(!e||typeof e!="object"&&typeof e!="function")throw new Ts("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Ts("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ts("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ts("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ts("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ts("`loose`, if provided, must be a boolean");var u=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,d=!!Jd&&Jd(e,r);if(Zd)Zd(e,r,{configurable:h===null&&d?d.configurable:!h,enumerable:u===null&&d?d.enumerable:!u,value:a,writable:c===null&&d?d.writable:!c});else if(p||!u&&!c&&!h)e[r]=a;else throw new uE("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Su=ct((RR,jd)=>{"use strict";var zc=Eu(),Qd=function(){return!!zc};Qd.hasArrayLengthDefineBug=function(){if(!zc)return null;try{return zc([],"length",{value:1}).length!==1}catch(e){return!0}};jd.exports=Qd});var im=ct((NR,rm)=>{"use strict";var lE=As(),tm=wu(),cE=Su()(),em=Bc(),nm=ko(),hE=lE("%Math.floor%");rm.exports=function(e,r){if(typeof e!="function")throw new nm("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||hE(r)!==r)throw new nm("`length` must be a positive 32-bit integer");var a=arguments.length>2&&!!arguments[2],u=!0,c=!0;if("length"in e&&em){var h=em(e,"length");h&&!h.configurable&&(u=!1),h&&!h.writable&&(c=!1)}return(u||c||!a)&&(cE?tm(e,"length",r,!0,!0):tm(e,"length",r)),e}});var Tu=ct((LR,bu)=>{"use strict";var kc=yu(),Au=As(),fE=im(),pE=ko(),am=Au("%Function.prototype.apply%"),um=Au("%Function.prototype.call%"),lm=Au("%Reflect.apply%",!0)||kc.call(um,am),om=Eu(),dE=Au("%Math.max%");bu.exports=function(e){if(typeof e!="function")throw new pE("a function is required");var r=lm(kc,um,arguments);return fE(r,1+dE(0,e.length-(arguments.length-1)),!0)};var sm=function(){return lm(kc,am,arguments)};om?om(bu.exports,"apply",{value:sm}):bu.exports.apply=sm});var Gc=ct((DR,fm)=>{"use strict";var cm=As(),hm=Tu(),mE=hm(cm("String.prototype.indexOf"));fm.exports=function(e,r){var a=cm(e,!!r);return typeof a=="function"&&mE(e,".prototype.")>-1?hm(a):a}});var mm=ct((OR,dm)=>{"use strict";var gE=gu()(),yE=Gc(),Vc=yE("Object.prototype.toString"),Cu=function(e){return gE&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:Vc(e)==="[object Arguments]"},pm=function(e){return Cu(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Vc(e)!=="[object Array]"&&Vc(e.callee)==="[object Function]"},vE=function(){return Cu(arguments)}();Cu.isLegacyArguments=pm;dm.exports=vE?Cu:pm});var Cs=ct((FR,_m)=>{"use strict";var _E=Nc(),xE=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",EE=Object.prototype.toString,ME=Array.prototype.concat,gm=wu(),wE=function(o){return typeof o=="function"&&EE.call(o)==="[object Function]"},ym=Su()(),SE=function(o,e,r,a){if(e in o){if(a===!0){if(o[e]===r)return}else if(!wE(a)||!a())return}ym?gm(o,e,r,!0):gm(o,e,r)},vm=function(o,e){var r=arguments.length>2?arguments[2]:{},a=_E(e);xE&&(a=ME.call(a,Object.getOwnPropertySymbols(e)));for(var u=0;u<a.length;u+=1)SE(o,a[u],e[a[u]],r[a[u]])};vm.supportsDescriptors=!!ym;_m.exports=vm});var Hc=ct((UR,Em)=>{"use strict";var xm=function(o){return o!==o};Em.exports=function(e,r){return e===0&&r===0?1/e===1/r:!!(e===r||xm(e)&&xm(r))}});var qc=ct((BR,Mm)=>{"use strict";var bE=Hc();Mm.exports=function(){return typeof Object.is=="function"?Object.is:bE}});var Sm=ct((zR,wm)=>{"use strict";var AE=qc(),TE=Cs();wm.exports=function(){var e=AE();return TE(Object,{is:e},{is:function(){return Object.is!==e}}),e}});var Cm=ct((kR,Tm)=>{"use strict";var CE=Cs(),IE=Tu(),PE=Hc(),bm=qc(),RE=Sm(),Am=IE(bm(),Object);CE(Am,{getPolyfill:bm,implementation:PE,shim:RE});Tm.exports=Am});var Lm=ct((GR,Nm)=>{"use strict";var Wc=Gc(),Im=gu()(),Pm,Rm,Xc,Yc;Im&&(Pm=Wc("Object.prototype.hasOwnProperty"),Rm=Wc("RegExp.prototype.exec"),Xc={},Iu=function(){throw Xc},Yc={toString:Iu,valueOf:Iu},typeof Symbol.toPrimitive=="symbol"&&(Yc[Symbol.toPrimitive]=Iu));var Iu,NE=Wc("Object.prototype.toString"),LE=Object.getOwnPropertyDescriptor,DE="[object RegExp]";Nm.exports=Im?function(e){if(!e||typeof e!="object")return!1;var r=LE(e,"lastIndex"),a=r&&Pm(r,"value");if(!a)return!1;try{Rm(e,Yc)}catch(u){return u===Xc}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:NE(e)===DE}});var Om=ct((VR,Dm)=>{"use strict";var _a=function(){return typeof function(){}.name=="string"},va=Object.getOwnPropertyDescriptor;if(va)try{va([],"length")}catch(o){va=null}_a.functionsHaveConfigurableNames=function(){if(!_a()||!va)return!1;var e=va(function(){},"name");return!!e&&!!e.configurable};var OE=Function.prototype.bind;_a.boundFunctionsHaveNames=function(){return _a()&&typeof OE=="function"&&function(){}.bind().name!==""};Dm.exports=_a});var Bm=ct((HR,Um)=>{"use strict";var Fm=wu(),FE=Su()(),UE=Om().functionsHaveConfigurableNames(),BE=ko();Um.exports=function(e,r){if(typeof e!="function")throw new BE("`fn` is not a function");var a=arguments.length>2&&!!arguments[2];return(!a||UE)&&(FE?Fm(e,"name",r,!0,!0):Fm(e,"name",r)),e}});var $c=ct((qR,zm)=>{"use strict";var zE=Bm(),kE=ko(),GE=Object;zm.exports=zE(function(){if(this==null||this!==GE(this))throw new kE("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0)});var Zc=ct((WR,km)=>{"use strict";var VE=$c(),HE=Cs().supportsDescriptors,qE=Object.getOwnPropertyDescriptor;km.exports=function(){if(HE&&/a/mig.flags==="gim"){var e=qE(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var r="",a={};if(Object.defineProperty(a,"hasIndices",{get:function(){r+="d"}}),Object.defineProperty(a,"sticky",{get:function(){r+="y"}}),e.get.call(a),r==="dy")return e.get}}return VE}});var Hm=ct((XR,Vm)=>{"use strict";var WE=Cs().supportsDescriptors,XE=Zc(),YE=Object.getOwnPropertyDescriptor,$E=Object.defineProperty,ZE=TypeError,Gm=Object.getPrototypeOf,JE=/a/;Vm.exports=function(){if(!WE||!Gm)throw new ZE("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=XE(),r=Gm(JE),a=YE(r,"flags");return(!a||a.get!==e)&&$E(r,"flags",{configurable:!0,enumerable:!1,get:e}),e}});var Ym=ct((YR,Xm)=>{"use strict";var KE=Cs(),QE=Tu(),jE=$c(),qm=Zc(),tM=Hm(),Wm=QE(qm());KE(Wm,{getPolyfill:qm,implementation:jE,shim:tM});Xm.exports=Wm});var Zm=ct(($R,$m)=>{"use strict";var eM=Date.prototype.getDay,nM=function(e){try{return eM.call(e),!0}catch(r){return!1}},rM=Object.prototype.toString,iM="[object Date]",oM=gu()();$m.exports=function(e){return typeof e!="object"||e===null?!1:oM?nM(e):rM.call(e)===iM}});var Jc=ct((ZR,sg)=>{var Jm=Nc(),Km=mm(),Qm=Cm(),jm=Lm(),tg=Ym(),eg=Zm(),ng=Date.prototype.getTime;function og(o,e,r){var a=r||{};return(a.strict?Qm(o,e):o===e)?!0:!o||!e||typeof o!="object"&&typeof e!="object"?a.strict?Qm(o,e):o==e:sM(o,e,a)}function rg(o){return o==null}function ig(o){return!(!o||typeof o!="object"||typeof o.length!="number"||typeof o.copy!="function"||typeof o.slice!="function"||o.length>0&&typeof o[0]!="number")}function sM(o,e,r){var a,u;if(typeof o!=typeof e||rg(o)||rg(e)||o.prototype!==e.prototype||Km(o)!==Km(e))return!1;var c=jm(o),h=jm(e);if(c!==h)return!1;if(c||h)return o.source===e.source&&tg(o)===tg(e);if(eg(o)&&eg(e))return ng.call(o)===ng.call(e);var p=ig(o),d=ig(e);if(p!==d)return!1;if(p||d){if(o.length!==e.length)return!1;for(a=0;a<o.length;a++)if(o[a]!==e[a])return!1;return!0}if(typeof o!=typeof e)return!1;try{var g=Jm(o),v=Jm(e)}catch(x){return!1}if(g.length!==v.length)return!1;for(g.sort(),v.sort(),a=g.length-1;a>=0;a--)if(g[a]!=v[a])return!1;for(a=g.length-1;a>=0;a--)if(u=g[a],!og(o[u],e[u],r))return!1;return!0}sg.exports=og});var uh=ct((e2,pg)=>{var JM=Jc(),Fi=function(o){this.precision=o&&o.precision?o.precision:17,this.direction=o&&o.direction?o.direction:!1,this.pseudoNode=o&&o.pseudoNode?o.pseudoNode:!1,this.objectComparator=o&&o.objectComparator?o.objectComparator:KM};Fi.prototype.compare=function(o,e){if(o.type!==e.type||!fg(o,e))return!1;switch(o.type){case"Point":return this.compareCoord(o.coordinates,e.coordinates);case"LineString":return this.compareLine(o.coordinates,e.coordinates,0,!1);case"Polygon":return this.comparePolygon(o,e);case"Feature":return this.compareFeature(o,e);default:if(o.type.indexOf("Multi")===0){var r=this,a=hg(o),u=hg(e);return a.every(function(c){return this.some(function(h){return r.compare(c,h)})},u)}}return!1};function hg(o){return o.coordinates.map(function(e){return{type:o.type.replace("Multi",""),coordinates:e}})}function fg(o,e){return o.hasOwnProperty("coordinates")?o.coordinates.length===e.coordinates.length:o.length===e.length}Fi.prototype.compareCoord=function(o,e){if(o.length!==e.length)return!1;for(var r=0;r<o.length;r++)if(o[r].toFixed(this.precision)!==e[r].toFixed(this.precision))return!1;return!0};Fi.prototype.compareLine=function(o,e,r,a){if(!fg(o,e))return!1;var u=this.pseudoNode?o:this.removePseudo(o),c=this.pseudoNode?e:this.removePseudo(e);if(!(a&&!this.compareCoord(u[0],c[0])&&(c=this.fixStartIndex(c,u),!c))){var h=this.compareCoord(u[r],c[r]);return this.direction||h?this.comparePath(u,c):this.compareCoord(u[r],c[c.length-(1+r)])?this.comparePath(u.slice().reverse(),c):!1}};Fi.prototype.fixStartIndex=function(o,e){for(var r,a=-1,u=0;u<o.length;u++)if(this.compareCoord(o[u],e[0])){a=u;break}return a>=0&&(r=[].concat(o.slice(a,o.length),o.slice(1,a+1))),r};Fi.prototype.comparePath=function(o,e){var r=this;return o.every(function(a,u){return r.compareCoord(a,this[u])},e)};Fi.prototype.comparePolygon=function(o,e){if(this.compareLine(o.coordinates[0],e.coordinates[0],1,!0)){var r=o.coordinates.slice(1,o.coordinates.length),a=e.coordinates.slice(1,e.coordinates.length),u=this;return r.every(function(c){return this.some(function(h){return u.compareLine(c,h,1,!0)})},a)}else return!1};Fi.prototype.compareFeature=function(o,e){return o.id!==e.id||!this.objectComparator(o.properties,e.properties)||!this.compareBBox(o,e)?!1:this.compare(o.geometry,e.geometry)};Fi.prototype.compareBBox=function(o,e){return!!(!o.bbox&&!e.bbox||o.bbox&&e.bbox&&this.compareCoord(o.bbox,e.bbox))};Fi.prototype.removePseudo=function(o){return o};function KM(o,e){return JM(o,e,{strict:!0})}pg.exports=Fi});var dg=ct((p2,Nu)=>{function xo(o,e,r,a){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(o,e,r,a)}xo.prototype.run=function(o,e,r,a){this._init(o,e,r,a);for(var u=0;u<this._datasetLength;u++)if(this._visited[u]!==1){this._visited[u]=1;var c=this._regionQuery(u);if(c.length<this.minPts)this.noise.push(u);else{var h=this.clusters.length;this.clusters.push([]),this._addToCluster(u,h),this._expandCluster(h,c)}}return this.clusters};xo.prototype._init=function(o,e,r,a){if(o){if(!(o instanceof Array))throw Error("Dataset must be of type array, "+typeof o+" given");this.dataset=o,this.clusters=[],this.noise=[],this._datasetLength=o.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}e&&(this.epsilon=e),r&&(this.minPts=r),a&&(this.distance=a)};xo.prototype._expandCluster=function(o,e){for(var r=0;r<e.length;r++){var a=e[r];if(this._visited[a]!==1){this._visited[a]=1;var u=this._regionQuery(a);u.length>=this.minPts&&(e=this._mergeArrays(e,u))}this._assigned[a]!==1&&this._addToCluster(a,o)}};xo.prototype._addToCluster=function(o,e){this.clusters[e].push(o),this._assigned[o]=1};xo.prototype._regionQuery=function(o){for(var e=[],r=0;r<this._datasetLength;r++){var a=this.distance(this.dataset[o],this.dataset[r]);a<this.epsilon&&e.push(r)}return e};xo.prototype._mergeArrays=function(o,e){for(var r=e.length,a=0;a<r;a++){var u=e[a];o.indexOf(u)<0&&o.push(u)}return o};xo.prototype._euclideanDistance=function(o,e){for(var r=0,a=Math.min(o.length,e.length);a--;)r+=(o[a]-e[a])*(o[a]-e[a]);return Math.sqrt(r)};typeof Nu!="undefined"&&Nu.exports&&(Nu.exports=xo)});var mg=ct((d2,Lu)=>{function Eo(o,e,r){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(o,e,r)}Eo.prototype.init=function(o,e,r){this.assignments=[],this.centroids=[],typeof o!="undefined"&&(this.dataset=o),typeof e!="undefined"&&(this.k=e),typeof r!="undefined"&&(this.distance=r)};Eo.prototype.run=function(o,e){this.init(o,e);for(var r=this.dataset.length,a=0;a<this.k;a++)this.centroids[a]=this.randomCentroid();for(var u=!0;u;){u=this.assign();for(var c=0;c<this.k;c++){for(var h=new Array(v),p=0,d=0;d<v;d++)h[d]=0;for(var g=0;g<r;g++){var v=this.dataset[g].length;if(c===this.assignments[g]){for(var d=0;d<v;d++)h[d]+=this.dataset[g][d];p++}}if(p>0){for(var d=0;d<v;d++)h[d]/=p;this.centroids[c]=h}else this.centroids[c]=this.randomCentroid(),u=!0}}return this.getClusters()};Eo.prototype.randomCentroid=function(){var o=this.dataset.length-1,e,r;do r=Math.round(Math.random()*o),e=this.dataset[r];while(this.centroids.indexOf(e)>=0);return e};Eo.prototype.assign=function(){for(var o=!1,e=this.dataset.length,r,a=0;a<e;a++)r=this.argmin(this.dataset[a],this.centroids,this.distance),r!=this.assignments[a]&&(this.assignments[a]=r,o=!0);return o};Eo.prototype.getClusters=function(){for(var o=new Array(this.k),e,r=0;r<this.assignments.length;r++)e=this.assignments[r],typeof o[e]=="undefined"&&(o[e]=[]),o[e].push(r);return o};Eo.prototype.argmin=function(o,e,r){for(var a=Number.MAX_VALUE,u=0,c=e.length,h,p=0;p<c;p++)h=r(o,e[p]),h<a&&(a=h,u=p);return u};Eo.prototype.distance=function(o,e){for(var r=0,a=Math.min(o.length,e.length);a--;){var u=o[a]-e[a];r+=u*u}return Math.sqrt(r)};typeof Lu!="undefined"&&Lu.exports&&(Lu.exports=Eo)});var lh=ct((m2,Du)=>{function Ui(o,e,r){this._queue=[],this._priorities=[],this._sorting="desc",this._init(o,e,r)}Ui.prototype.insert=function(o,e){for(var r=this._queue.length,a=r;a--;){var u=this._priorities[a];this._sorting==="desc"?e>u&&(r=a):e<u&&(r=a)}this._insertAt(o,e,r)};Ui.prototype.remove=function(o){for(var e=this._queue.length;e--;){var r=this._queue[e];if(o===r){this._queue.splice(e,1),this._priorities.splice(e,1);break}}};Ui.prototype.forEach=function(o){this._queue.forEach(o)};Ui.prototype.getElements=function(){return this._queue};Ui.prototype.getElementPriority=function(o){return this._priorities[o]};Ui.prototype.getPriorities=function(){return this._priorities};Ui.prototype.getElementsWithPriorities=function(){for(var o=[],e=0,r=this._queue.length;e<r;e++)o.push([this._queue[e],this._priorities[e]]);return o};Ui.prototype._init=function(o,e,r){if(o&&e){if(this._queue=[],this._priorities=[],o.length!==e.length)throw new Error("Arrays must have the same length");for(var a=0;a<o.length;a++)this.insert(o[a],e[a])}r&&(this._sorting=r)};Ui.prototype._insertAt=function(o,e,r){this._queue.length===r?(this._queue.push(o),this._priorities.push(e)):(this._queue.splice(r,0,o),this._priorities.splice(r,0,e))};typeof Du!="undefined"&&Du.exports&&(Du.exports=Ui)});var yg=ct((g2,Ps)=>{typeof Ps!="undefined"&&Ps.exports&&(gg=lh());var gg;function to(o,e,r,a){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(o,e,r,a)}to.prototype.run=function(o,e,r,a){this._init(o,e,r,a);for(var u=0,c=this.dataset.length;u<c;u++)if(this._processed[u]!==1){this._processed[u]=1,this.clusters.push([u]);var h=this.clusters.length-1;this._orderedList.push(u);var p=new gg(null,null,"asc"),d=this._regionQuery(u);this._distanceToCore(u)!==void 0&&(this._updateQueue(u,d,p),this._expandCluster(h,p))}return this.clusters};to.prototype.getReachabilityPlot=function(){for(var o=[],e=0,r=this._orderedList.length;e<r;e++){var a=this._orderedList[e],u=this._reachability[a];o.push([a,u])}return o};to.prototype._init=function(o,e,r,a){if(o){if(!(o instanceof Array))throw Error("Dataset must be of type array, "+typeof o+" given");this.dataset=o,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}e&&(this.epsilon=e),r&&(this.minPts=r),a&&(this.distance=a)};to.prototype._updateQueue=function(o,e,r){var a=this;this._coreDistance=this._distanceToCore(o),e.forEach(function(u){if(a._processed[u]===void 0){var c=a.distance(a.dataset[o],a.dataset[u]),h=Math.max(a._coreDistance,c);a._reachability[u]===void 0?(a._reachability[u]=h,r.insert(u,h)):h<a._reachability[u]&&(a._reachability[u]=h,r.remove(u),r.insert(u,h))}})};to.prototype._expandCluster=function(o,e){for(var r=e.getElements(),a=0,u=r.length;a<u;a++){var c=r[a];if(this._processed[c]===void 0){var h=this._regionQuery(c);this._processed[c]=1,this.clusters[o].push(c),this._orderedList.push(c),this._distanceToCore(c)!==void 0&&(this._updateQueue(c,h,e),this._expandCluster(o,e))}}};to.prototype._distanceToCore=function(o){for(var e=this.epsilon,r=0;r<e;r++){var a=this._regionQuery(o,r);if(a.length>=this.minPts)return r}};to.prototype._regionQuery=function(o,e){e=e||this.epsilon;for(var r=[],a=0,u=this.dataset.length;a<u;a++)this.distance(this.dataset[o],this.dataset[a])<e&&r.push(a);return r};to.prototype._euclideanDistance=function(o,e){for(var r=0,a=Math.min(o.length,e.length);a--;)r+=(o[a]-e[a])*(o[a]-e[a]);return Math.sqrt(r)};typeof Ps!="undefined"&&Ps.exports&&(Ps.exports=to)});var vg=ct((y2,Ou)=>{typeof Ou!="undefined"&&Ou.exports&&(Ou.exports={DBSCAN:dg(),KMEANS:mg(),OPTICS:yg(),PriorityQueue:lh()})});var ch=ct((w2,xg)=>{"use strict";xg.exports={eudist:function(e,r,a){for(var u=e.length,c=0,h=0;h<u;h++){var p=(e[h]||0)-(r[h]||0);c+=p*p}return a?Math.sqrt(c):c},mandist:function(e,r,a){for(var u=e.length,c=0,h=0;h<u;h++)c+=Math.abs((e[h]||0)-(r[h]||0));return a?Math.sqrt(c):c},dist:function(e,r,a){var u=Math.abs(e-r);return a?u:u*u}}});var wg=ct((S2,Mg)=>{"use strict";var Eg=ch(),rw=Eg.eudist,iw=Eg.dist;Mg.exports={kmrand:function(e,r){for(var a={},u=[],c=r<<2,h=e.length,p=e[0].length>0;u.length<r&&c-- >0;){var d=e[Math.floor(Math.random()*h)],g=p?d.join("_"):""+d;a[g]||(a[g]=!0,u.push(d))}if(u.length<r)throw new Error("Error initializating clusters");return u},kmpp:function(e,r){var a=e[0].length?rw:iw,u=[],c=e.length,h=e[0].length>0,p={},d=e[Math.floor(Math.random()*c)],g=h?d.join("_"):""+d;for(u.push(d),p[g]=!0;u.length<r;){for(var v=[],x=u.length,M=0,w=[],I=0;I<c;I++){for(var D=1/0,b=0;b<x;b++){var T=a(e[I],u[b]);T<=D&&(D=T)}v[I]=D}for(var L=0;L<c;L++)M+=v[L];for(var P=0;P<c;P++)w[P]={i:P,v:e[P],pr:v[P]/M,cs:0};w.sort(function(q,C){return q.pr-C.pr}),w[0].cs=w[0].pr;for(var z=1;z<c;z++)w[z].cs=w[z-1].cs+w[z].pr;for(var k=Math.random(),Y=0;Y<c-1&&w[Y++].cs<k;);u.push(w[Y-1].v)}return u}}});var Cg=ct((T2,Tg)=>{"use strict";var hh=ch(),Ag=wg(),ow=hh.eudist,b2=hh.mandist,A2=hh.dist,sw=Ag.kmrand,aw=Ag.kmpp,Sg=1e4;function bg(o,e,r){r=r||[];for(var a=0;a<o;a++)r[a]=e;return r}function uw(o,e,r,a){var u=[],c=[],h=[],p=[],d=!1,g=a||Sg,v=o.length,x=o[0].length,M=x>0,w=[];if(r)r=="kmrand"?u=sw(o,e):r=="kmpp"?u=aw(o,e):u=r;else for(var I={};u.length<e;){var D=Math.floor(Math.random()*v);I[D]||(I[D]=!0,u.push(o[D]))}do{bg(e,0,w);for(var b=0;b<v;b++){for(var T=1/0,L=0,P=0;P<e;P++){var p=M?ow(o[b],u[P]):Math.abs(o[b]-u[P]);p<=T&&(T=p,L=P)}h[b]=L,w[L]++}for(var z=[],c=[],k=0,Y=0;Y<e;Y++)z[Y]=M?bg(x,0,z[Y]):0,c[Y]=u[Y];if(M){for(var q=0;q<e;q++)u[q]=[];for(var C=0;C<v;C++)for(var ot=h[C],pt=z[ot],dt=o[C],F=0;F<x;F++)pt[F]+=dt[F];d=!0;for(var ye=0;ye<e;ye++){for(var et=u[ye],St=z[ye],Pt=c[ye],Rt=w[ye],it=0;it<x;it++)et[it]=St[it]/Rt||0;if(d){for(var mt=0;mt<x;mt++)if(Pt[mt]!=et[mt]){d=!1;break}}}}else{for(var U=0;U<v;U++){var Nt=h[U];z[Nt]+=o[U]}for(var Mt=0;Mt<e;Mt++)u[Mt]=z[Mt]/w[Mt]||0;d=!0;for(var Re=0;Re<e;Re++)if(c[Re]!=u[Re]){d=!1;break}}d=d||--g<=0}while(!d);return{it:Sg-g,k:e,idxs:h,centroids:u}}Tg.exports=uw});var Os=ct((yh,vh)=>{(function(o,e){typeof yh=="object"&&typeof vh!="undefined"?vh.exports=e():typeof define=="function"&&define.amd?define(e):(o=typeof globalThis!="undefined"?globalThis:o||self,o.polygonClipping=e())})(yh,function(){"use strict";function o(B,y){var E={label:0,sent:function(){if(R[0]&1)throw R[1];return R[1]},trys:[],ops:[]},A,N,R,$;return $={next:G(0),throw:G(1),return:G(2)},typeof Symbol=="function"&&($[Symbol.iterator]=function(){return this}),$;function G(Z){return function(V){return K([Z,V])}}function K(Z){if(A)throw new TypeError("Generator is already executing.");for(;E;)try{if(A=1,N&&(R=Z[0]&2?N.return:Z[0]?N.throw||((R=N.return)&&R.call(N),0):N.next)&&!(R=R.call(N,Z[1])).done)return R;switch(N=0,R&&(Z=[Z[0]&2,R.value]),Z[0]){case 0:case 1:R=Z;break;case 4:return E.label++,{value:Z[1],done:!1};case 5:E.label++,N=Z[1],Z=[0];continue;case 7:Z=E.ops.pop(),E.trys.pop();continue;default:if(R=E.trys,!(R=R.length>0&&R[R.length-1])&&(Z[0]===6||Z[0]===2)){E=0;continue}if(Z[0]===3&&(!R||Z[1]>R[0]&&Z[1]<R[3])){E.label=Z[1];break}if(Z[0]===6&&E.label<R[1]){E.label=R[1],R=Z;break}if(R&&E.label<R[2]){E.label=R[2],E.ops.push(Z);break}R[2]&&E.ops.pop(),E.trys.pop();continue}Z=y.call(B,E)}catch(V){Z=[6,V],N=0}finally{A=R=0}if(Z[0]&5)throw Z[1];return{value:Z[0]?Z[1]:void 0,done:!0}}}var e=function(){function B(y,E){this.next=null,this.key=y,this.data=E,this.left=null,this.right=null}return B}();function r(B,y){return B>y?1:B<y?-1:0}function a(B,y,E){for(var A=new e(null,null),N=A,R=A;;){var $=E(B,y.key);if($<0){if(y.left===null)break;if(E(B,y.left.key)<0){var G=y.left;if(y.left=G.right,G.right=y,y=G,y.left===null)break}R.left=y,R=y,y=y.left}else if($>0){if(y.right===null)break;if(E(B,y.right.key)>0){var G=y.right;if(y.right=G.left,G.left=y,y=G,y.right===null)break}N.right=y,N=y,y=y.right}else break}return N.right=y.left,R.left=y.right,y.left=A.right,y.right=A.left,y}function u(B,y,E,A){var N=new e(B,y);if(E===null)return N.left=N.right=null,N;E=a(B,E,A);var R=A(B,E.key);return R<0?(N.left=E.left,N.right=E,E.left=null):R>=0&&(N.right=E.right,N.left=E,E.right=null),N}function c(B,y,E){var A=null,N=null;if(y){y=a(B,y,E);var R=E(y.key,B);R===0?(A=y.left,N=y.right):R<0?(N=y.right,y.right=null,A=y):(A=y.left,y.left=null,N=y)}return{left:A,right:N}}function h(B,y,E){return y===null?B:(B===null||(y=a(B.key,y,E),y.left=B),y)}function p(B,y,E,A,N){if(B){A(""+y+(E?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+N(B)+`\n`);var R=y+(E?" ":"\\u2502 ");B.left&&p(B.left,R,!1,A,N),B.right&&p(B.right,R,!0,A,N)}}var d=function(){function B(y){y===void 0&&(y=r),this._root=null,this._size=0,this._comparator=y}return B.prototype.insert=function(y,E){return this._size++,this._root=u(y,E,this._root,this._comparator)},B.prototype.add=function(y,E){var A=new e(y,E);this._root===null&&(A.left=A.right=null,this._size++,this._root=A);var N=this._comparator,R=a(y,this._root,N),$=N(y,R.key);return $===0?this._root=R:($<0?(A.left=R.left,A.right=R,R.left=null):$>0&&(A.right=R.right,A.left=R,R.right=null),this._size++,this._root=A),this._root},B.prototype.remove=function(y){this._root=this._remove(y,this._root,this._comparator)},B.prototype._remove=function(y,E,A){var N;if(E===null)return null;E=a(y,E,A);var R=A(y,E.key);return R===0?(E.left===null?N=E.right:(N=a(y,E.left,A),N.right=E.right),this._size--,N):E},B.prototype.pop=function(){var y=this._root;if(y){for(;y.left;)y=y.left;return this._root=a(y.key,this._root,this._comparator),this._root=this._remove(y.key,this._root,this._comparator),{key:y.key,data:y.data}}return null},B.prototype.findStatic=function(y){for(var E=this._root,A=this._comparator;E;){var N=A(y,E.key);if(N===0)return E;N<0?E=E.left:E=E.right}return null},B.prototype.find=function(y){return this._root&&(this._root=a(y,this._root,this._comparator),this._comparator(y,this._root.key)!==0)?null:this._root},B.prototype.contains=function(y){for(var E=this._root,A=this._comparator;E;){var N=A(y,E.key);if(N===0)return!0;N<0?E=E.left:E=E.right}return!1},B.prototype.forEach=function(y,E){for(var A=this._root,N=[],R=!1;!R;)A!==null?(N.push(A),A=A.left):N.length!==0?(A=N.pop(),y.call(E,A),A=A.right):R=!0;return this},B.prototype.range=function(y,E,A,N){for(var R=[],$=this._comparator,G=this._root,K;R.length!==0||G;)if(G)R.push(G),G=G.left;else{if(G=R.pop(),K=$(G.key,E),K>0)break;if($(G.key,y)>=0&&A.call(N,G))return this;G=G.right}return this},B.prototype.keys=function(){var y=[];return this.forEach(function(E){var A=E.key;return y.push(A)}),y},B.prototype.values=function(){var y=[];return this.forEach(function(E){var A=E.data;return y.push(A)}),y},B.prototype.min=function(){return this._root?this.minNode(this._root).key:null},B.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},B.prototype.minNode=function(y){if(y===void 0&&(y=this._root),y)for(;y.left;)y=y.left;return y},B.prototype.maxNode=function(y){if(y===void 0&&(y=this._root),y)for(;y.right;)y=y.right;return y},B.prototype.at=function(y){for(var E=this._root,A=!1,N=0,R=[];!A;)if(E)R.push(E),E=E.left;else if(R.length>0){if(E=R.pop(),N===y)return E;N++,E=E.right}else A=!0;return null},B.prototype.next=function(y){var E=this._root,A=null;if(y.right){for(A=y.right;A.left;)A=A.left;return A}for(var N=this._comparator;E;){var R=N(y.key,E.key);if(R===0)break;R<0?(A=E,E=E.left):E=E.right}return A},B.prototype.prev=function(y){var E=this._root,A=null;if(y.left!==null){for(A=y.left;A.right;)A=A.right;return A}for(var N=this._comparator;E;){var R=N(y.key,E.key);if(R===0)break;R<0?E=E.left:(A=E,E=E.right)}return A},B.prototype.clear=function(){return this._root=null,this._size=0,this},B.prototype.toList=function(){return x(this._root)},B.prototype.load=function(y,E,A){E===void 0&&(E=[]),A===void 0&&(A=!1);var N=y.length,R=this._comparator;if(A&&I(y,E,0,N-1,R),this._root===null)this._root=g(y,E,0,N),this._size=N;else{var $=w(this.toList(),v(y,E),R);N=this._size+N,this._root=M({head:$},0,N)}return this},B.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(B.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(B.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),B.prototype.toString=function(y){y===void 0&&(y=function(A){return String(A.key)});var E=[];return p(this._root,"",!0,function(A){return E.push(A)},y),E.join("")},B.prototype.update=function(y,E,A){var N=this._comparator,R=c(y,this._root,N),$=R.left,G=R.right;N(y,E)<0?G=u(E,A,G,N):$=u(E,A,$,N),this._root=h($,G,N)},B.prototype.split=function(y){return c(y,this._root,this._comparator)},B.prototype[Symbol.iterator]=function(){var y,E,A;return o(this,function(N){switch(N.label){case 0:y=this._root,E=[],A=!1,N.label=1;case 1:return A?[3,6]:y===null?[3,2]:(E.push(y),y=y.left,[3,5]);case 2:return E.length===0?[3,4]:(y=E.pop(),[4,y]);case 3:return N.sent(),y=y.right,[3,5];case 4:A=!0,N.label=5;case 5:return[3,1];case 6:return[2]}})},B}();function g(B,y,E,A){var N=A-E;if(N>0){var R=E+Math.floor(N/2),$=B[R],G=y[R],K=new e($,G);return K.left=g(B,y,E,R),K.right=g(B,y,R+1,A),K}return null}function v(B,y){for(var E=new e(null,null),A=E,N=0;N<B.length;N++)A=A.next=new e(B[N],y[N]);return A.next=null,E.next}function x(B){for(var y=B,E=[],A=!1,N=new e(null,null),R=N;!A;)y?(E.push(y),y=y.left):E.length>0?(y=R=R.next=E.pop(),y=y.right):A=!0;return R.next=null,N.next}function M(B,y,E){var A=E-y;if(A>0){var N=y+Math.floor(A/2),R=M(B,y,N),$=B.head;return $.left=R,B.head=B.head.next,$.right=M(B,N+1,E),$}return null}function w(B,y,E){for(var A=new e(null,null),N=A,R=B,$=y;R!==null&&$!==null;)E(R.key,$.key)<0?(N.next=R,R=R.next):(N.next=$,$=$.next),N=N.next;return R!==null?N.next=R:$!==null&&(N.next=$),A.next}function I(B,y,E,A,N){if(!(E>=A)){for(var R=B[E+A>>1],$=E-1,G=A+1;;){do $++;while(N(B[$],R)<0);do G--;while(N(B[G],R)>0);if($>=G)break;var K=B[$];B[$]=B[G],B[G]=K,K=y[$],y[$]=y[G],y[G]=K}I(B,y,E,G,N),I(B,y,G+1,A,N)}}let D=(B,y)=>B.ll.x<=y.x&&y.x<=B.ur.x&&B.ll.y<=y.y&&y.y<=B.ur.y,b=(B,y)=>{if(y.ur.x<B.ll.x||B.ur.x<y.ll.x||y.ur.y<B.ll.y||B.ur.y<y.ll.y)return null;let E=B.ll.x<y.ll.x?y.ll.x:B.ll.x,A=B.ur.x<y.ur.x?B.ur.x:y.ur.x,N=B.ll.y<y.ll.y?y.ll.y:B.ll.y,R=B.ur.y<y.ur.y?B.ur.y:y.ur.y;return{ll:{x:E,y:N},ur:{x:A,y:R}}},T=Number.EPSILON;T===void 0&&(T=Math.pow(2,-52));let L=T*T,P=(B,y)=>{if(-T<B&&B<T&&-T<y&&y<T)return 0;let E=B-y;return E*E<L*B*y?0:B<y?-1:1};class z{constructor(){this.reset()}reset(){this.xRounder=new k,this.yRounder=new k}round(y,E){return{x:this.xRounder.round(y),y:this.yRounder.round(E)}}}class k{constructor(){this.tree=new d,this.round(0)}round(y){let E=this.tree.add(y),A=this.tree.prev(E);if(A!==null&&P(E.key,A.key)===0)return this.tree.remove(y),A.key;let N=this.tree.next(E);return N!==null&&P(E.key,N.key)===0?(this.tree.remove(y),N.key):y}}let Y=new z,q=11102230246251565e-32,C=134217729,ot=(3+8*q)*q;function pt(B,y,E,A,N){let R,$,G,K,Z=y[0],V=A[0],W=0,Q=0;V>Z==V>-Z?(R=Z,Z=y[++W]):(R=V,V=A[++Q]);let J=0;if(W<B&&Q<E)for(V>Z==V>-Z?($=Z+R,G=R-($-Z),Z=y[++W]):($=V+R,G=R-($-V),V=A[++Q]),R=$,G!==0&&(N[J++]=G);W<B&&Q<E;)V>Z==V>-Z?($=R+Z,K=$-R,G=R-($-K)+(Z-K),Z=y[++W]):($=R+V,K=$-R,G=R-($-K)+(V-K),V=A[++Q]),R=$,G!==0&&(N[J++]=G);for(;W<B;)$=R+Z,K=$-R,G=R-($-K)+(Z-K),Z=y[++W],R=$,G!==0&&(N[J++]=G);for(;Q<E;)$=R+V,K=$-R,G=R-($-K)+(V-K),V=A[++Q],R=$,G!==0&&(N[J++]=G);return(R!==0||J===0)&&(N[J++]=R),J}function dt(B,y){let E=y[0];for(let A=1;A<B;A++)E+=y[A];return E}function F(B){return new Float64Array(B)}let ye=(3+16*q)*q,et=(2+12*q)*q,St=(9+64*q)*q*q,Pt=F(4),Rt=F(8),it=F(12),mt=F(16),U=F(4);function Nt(B,y,E,A,N,R,$){let G,K,Z,V,W,Q,J,wt,vt,It,At,ke,En,pn,Be,dn,Qn,We,bt=B-N,Xe=E-N,je=y-R,Ye=A-R;pn=bt*Ye,Q=C*bt,J=Q-(Q-bt),wt=bt-J,Q=C*Ye,vt=Q-(Q-Ye),It=Ye-vt,Be=wt*It-(pn-J*vt-wt*vt-J*It),dn=je*Xe,Q=C*je,J=Q-(Q-je),wt=je-J,Q=C*Xe,vt=Q-(Q-Xe),It=Xe-vt,Qn=wt*It-(dn-J*vt-wt*vt-J*It),At=Be-Qn,W=Be-At,Pt[0]=Be-(At+W)+(W-Qn),ke=pn+At,W=ke-pn,En=pn-(ke-W)+(At-W),At=En-dn,W=En-At,Pt[1]=En-(At+W)+(W-dn),We=ke+At,W=We-ke,Pt[2]=ke-(We-W)+(At-W),Pt[3]=We;let Fe=dt(4,Pt),Rr=et*$;if(Fe>=Rr||-Fe>=Rr||(W=B-bt,G=B-(bt+W)+(W-N),W=E-Xe,Z=E-(Xe+W)+(W-N),W=y-je,K=y-(je+W)+(W-R),W=A-Ye,V=A-(Ye+W)+(W-R),G===0&&K===0&&Z===0&&V===0)||(Rr=St*$+ot*Math.abs(Fe),Fe+=bt*V+Ye*G-(je*Z+Xe*K),Fe>=Rr||-Fe>=Rr))return Fe;pn=G*Ye,Q=C*G,J=Q-(Q-G),wt=G-J,Q=C*Ye,vt=Q-(Q-Ye),It=Ye-vt,Be=wt*It-(pn-J*vt-wt*vt-J*It),dn=K*Xe,Q=C*K,J=Q-(Q-K),wt=K-J,Q=C*Xe,vt=Q-(Q-Xe),It=Xe-vt,Qn=wt*It-(dn-J*vt-wt*vt-J*It),At=Be-Qn,W=Be-At,U[0]=Be-(At+W)+(W-Qn),ke=pn+At,W=ke-pn,En=pn-(ke-W)+(At-W),At=En-dn,W=En-At,U[1]=En-(At+W)+(W-dn),We=ke+At,W=We-ke,U[2]=ke-(We-W)+(At-W),U[3]=We;let ur=pt(4,Pt,4,U,Rt);pn=bt*V,Q=C*bt,J=Q-(Q-bt),wt=bt-J,Q=C*V,vt=Q-(Q-V),It=V-vt,Be=wt*It-(pn-J*vt-wt*vt-J*It),dn=je*Z,Q=C*je,J=Q-(Q-je),wt=je-J,Q=C*Z,vt=Q-(Q-Z),It=Z-vt,Qn=wt*It-(dn-J*vt-wt*vt-J*It),At=Be-Qn,W=Be-At,U[0]=Be-(At+W)+(W-Qn),ke=pn+At,W=ke-pn,En=pn-(ke-W)+(At-W),At=En-dn,W=En-At,U[1]=En-(At+W)+(W-dn),We=ke+At,W=We-ke,U[2]=ke-(We-W)+(At-W),U[3]=We;let $o=pt(ur,Rt,4,U,it);pn=G*V,Q=C*G,J=Q-(Q-G),wt=G-J,Q=C*V,vt=Q-(Q-V),It=V-vt,Be=wt*It-(pn-J*vt-wt*vt-J*It),dn=K*Z,Q=C*K,J=Q-(Q-K),wt=K-J,Q=C*Z,vt=Q-(Q-Z),It=Z-vt,Qn=wt*It-(dn-J*vt-wt*vt-J*It),At=Be-Qn,W=Be-At,U[0]=Be-(At+W)+(W-Qn),ke=pn+At,W=ke-pn,En=pn-(ke-W)+(At-W),At=En-dn,W=En-At,U[1]=En-(At+W)+(W-dn),We=ke+At,W=We-ke,U[2]=ke-(We-W)+(At-W),U[3]=We;let lr=pt($o,it,4,U,mt);return mt[lr-1]}function Mt(B,y,E,A,N,R){let $=(y-R)*(E-N),G=(B-N)*(A-R),K=$-G,Z=Math.abs($+G);return Math.abs(K)>=ye*Z?K:-Nt(B,y,E,A,N,R,Z)}let Re=(B,y)=>B.x*y.y-B.y*y.x,ut=(B,y)=>B.x*y.x+B.y*y.y,Ne=(B,y,E)=>{let A=Mt(B.x,B.y,y.x,y.y,E.x,E.y);return A>0?-1:A<0?1:0},xn=B=>Math.sqrt(ut(B,B)),qe=(B,y,E)=>{let A={x:y.x-B.x,y:y.y-B.y},N={x:E.x-B.x,y:E.y-B.y};return Re(N,A)/xn(N)/xn(A)},Ee=(B,y,E)=>{let A={x:y.x-B.x,y:y.y-B.y},N={x:E.x-B.x,y:E.y-B.y};return ut(N,A)/xn(N)/xn(A)},Le=(B,y,E)=>y.y===0?null:{x:B.x+y.x/y.y*(E-B.y),y:E},at=(B,y,E)=>y.x===0?null:{x:E,y:B.y+y.y/y.x*(E-B.x)},Kn=(B,y,E,A)=>{if(y.x===0)return at(E,A,B.x);if(A.x===0)return at(B,y,E.x);if(y.y===0)return Le(E,A,B.y);if(A.y===0)return Le(B,y,E.y);let N=Re(y,A);if(N==0)return null;let R={x:E.x-B.x,y:E.y-B.y},$=Re(R,y)/N,G=Re(R,A)/N,K=B.x+G*y.x,Z=E.x+$*A.x,V=B.y+G*y.y,W=E.y+$*A.y,Q=(K+Z)/2,J=(V+W)/2;return{x:Q,y:J}};class oe{static compare(y,E){let A=oe.comparePoints(y.point,E.point);return A!==0?A:(y.point!==E.point&&y.link(E),y.isLeft!==E.isLeft?y.isLeft?1:-1:Te.compare(y.segment,E.segment))}static comparePoints(y,E){return y.x<E.x?-1:y.x>E.x?1:y.y<E.y?-1:y.y>E.y?1:0}constructor(y,E){y.events===void 0?y.events=[this]:y.events.push(this),this.point=y,this.isLeft=E}link(y){if(y.point===this.point)throw new Error("Tried to link already linked events");let E=y.point.events;for(let A=0,N=E.length;A<N;A++){let R=E[A];this.point.events.push(R),R.point=this.point}this.checkForConsuming()}checkForConsuming(){let y=this.point.events.length;for(let E=0;E<y;E++){let A=this.point.events[E];if(A.segment.consumedBy===void 0)for(let N=E+1;N<y;N++){let R=this.point.events[N];R.consumedBy===void 0&&A.otherSE.point.events===R.otherSE.point.events&&A.segment.consume(R.segment)}}}getAvailableLinkedEvents(){let y=[];for(let E=0,A=this.point.events.length;E<A;E++){let N=this.point.events[E];N!==this&&!N.segment.ringOut&&N.segment.isInResult()&&y.push(N)}return y}getLeftmostComparator(y){let E=new Map,A=N=>{let R=N.otherSE;E.set(N,{sine:qe(this.point,y.point,R.point),cosine:Ee(this.point,y.point,R.point)})};return(N,R)=>{E.has(N)||A(N),E.has(R)||A(R);let{sine:$,cosine:G}=E.get(N),{sine:K,cosine:Z}=E.get(R);return $>=0&&K>=0?G<Z?1:G>Z?-1:0:$<0&&K<0?G<Z?-1:G>Z?1:0:K<$?-1:K>$?1:0}}}let Fn=0;class Te{static compare(y,E){let A=y.leftSE.point.x,N=E.leftSE.point.x,R=y.rightSE.point.x,$=E.rightSE.point.x;if($<A)return 1;if(R<N)return-1;let G=y.leftSE.point.y,K=E.leftSE.point.y,Z=y.rightSE.point.y,V=E.rightSE.point.y;if(A<N){if(K<G&&K<Z)return 1;if(K>G&&K>Z)return-1;let W=y.comparePoint(E.leftSE.point);if(W<0)return 1;if(W>0)return-1;let Q=E.comparePoint(y.rightSE.point);return Q!==0?Q:-1}if(A>N){if(G<K&&G<V)return-1;if(G>K&&G>V)return 1;let W=E.comparePoint(y.leftSE.point);if(W!==0)return W;let Q=y.comparePoint(E.rightSE.point);return Q<0?1:Q>0?-1:1}if(G<K)return-1;if(G>K)return 1;if(R<$){let W=E.comparePoint(y.rightSE.point);if(W!==0)return W}if(R>$){let W=y.comparePoint(E.rightSE.point);if(W<0)return 1;if(W>0)return-1}if(R!==$){let W=Z-G,Q=R-A,J=V-K,wt=$-N;if(W>Q&&J<wt)return 1;if(W<Q&&J>wt)return-1}return R>$?1:R<$||Z<V?-1:Z>V?1:y.id<E.id?-1:y.id>E.id?1:0}constructor(y,E,A,N){this.id=++Fn,this.leftSE=y,y.segment=this,y.otherSE=E,this.rightSE=E,E.segment=this,E.otherSE=y,this.rings=A,this.windings=N}static fromRing(y,E,A){let N,R,$,G=oe.comparePoints(y,E);if(G<0)N=y,R=E,$=1;else if(G>0)N=E,R=y,$=-1;else throw new Error(`Tried to create degenerate segment at [${y.x}, ${y.y}]`);let K=new oe(N,!0),Z=new oe(R,!1);return new Te(K,Z,[A],[$])}replaceRightSE(y){this.rightSE=y,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let y=this.leftSE.point.y,E=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:y<E?y:E},ur:{x:this.rightSE.point.x,y:y>E?y:E}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(y){return y.x===this.leftSE.point.x&&y.y===this.leftSE.point.y||y.x===this.rightSE.point.x&&y.y===this.rightSE.point.y}comparePoint(y){if(this.isAnEndpoint(y))return 0;let E=this.leftSE.point,A=this.rightSE.point,N=this.vector();if(E.x===A.x)return y.x===E.x?0:y.x<E.x?1:-1;let R=(y.y-E.y)/N.y,$=E.x+R*N.x;if(y.x===$)return 0;let G=(y.x-E.x)/N.x,K=E.y+G*N.y;return y.y===K?0:y.y<K?-1:1}getIntersection(y){let E=this.bbox(),A=y.bbox(),N=b(E,A);if(N===null)return null;let R=this.leftSE.point,$=this.rightSE.point,G=y.leftSE.point,K=y.rightSE.point,Z=D(E,G)&&this.comparePoint(G)===0,V=D(A,R)&&y.comparePoint(R)===0,W=D(E,K)&&this.comparePoint(K)===0,Q=D(A,$)&&y.comparePoint($)===0;if(V&&Z)return Q&&!W?$:!Q&&W?K:null;if(V)return W&&R.x===K.x&&R.y===K.y?null:R;if(Z)return Q&&$.x===G.x&&$.y===G.y?null:G;if(Q&&W)return null;if(Q)return $;if(W)return K;let J=Kn(R,this.vector(),G,y.vector());return J===null||!D(N,J)?null:Y.round(J.x,J.y)}split(y){let E=[],A=y.events!==void 0,N=new oe(y,!0),R=new oe(y,!1),$=this.rightSE;this.replaceRightSE(R),E.push(R),E.push(N);let G=new Te(N,$,this.rings.slice(),this.windings.slice());return oe.comparePoints(G.leftSE.point,G.rightSE.point)>0&&G.swapEvents(),oe.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),A&&(N.checkForConsuming(),R.checkForConsuming()),E}swapEvents(){let y=this.rightSE;this.rightSE=this.leftSE,this.leftSE=y,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let E=0,A=this.windings.length;E<A;E++)this.windings[E]*=-1}consume(y){let E=this,A=y;for(;E.consumedBy;)E=E.consumedBy;for(;A.consumedBy;)A=A.consumedBy;let N=Te.compare(E,A);if(N!==0){if(N>0){let R=E;E=A,A=R}if(E.prev===A){let R=E;E=A,A=R}for(let R=0,$=A.rings.length;R<$;R++){let G=A.rings[R],K=A.windings[R],Z=E.rings.indexOf(G);Z===-1?(E.rings.push(G),E.windings.push(K)):E.windings[Z]+=K}A.rings=null,A.windings=null,A.consumedBy=E,A.leftSE.consumedBy=E.leftSE,A.rightSE.consumedBy=E.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 y=this.prev.consumedBy||this.prev;this._beforeState=y.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let y=this.beforeState();this._afterState={rings:y.rings.slice(0),windings:y.windings.slice(0),multiPolys:[]};let E=this._afterState.rings,A=this._afterState.windings,N=this._afterState.multiPolys;for(let G=0,K=this.rings.length;G<K;G++){let Z=this.rings[G],V=this.windings[G],W=E.indexOf(Z);W===-1?(E.push(Z),A.push(V)):A[W]+=V}let R=[],$=[];for(let G=0,K=E.length;G<K;G++){if(A[G]===0)continue;let Z=E[G],V=Z.poly;if($.indexOf(V)===-1)if(Z.isExterior)R.push(V);else{$.indexOf(V)===-1&&$.push(V);let W=R.indexOf(Z.poly);W!==-1&&R.splice(W,1)}}for(let G=0,K=R.length;G<K;G++){let Z=R[G].multiPoly;N.indexOf(Z)===-1&&N.push(Z)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let y=this.beforeState().multiPolys,E=this.afterState().multiPolys;switch(tt.type){case"union":{let A=y.length===0,N=E.length===0;this._isInResult=A!==N;break}case"intersection":{let A,N;y.length<E.length?(A=y.length,N=E.length):(A=E.length,N=y.length),this._isInResult=N===tt.numMultiPolys&&A<N;break}case"xor":{let A=Math.abs(y.length-E.length);this._isInResult=A%2===1;break}case"difference":{let A=N=>N.length===1&&N[0].isSubject;this._isInResult=A(y)!==A(E);break}default:throw new Error(`Unrecognized operation type found ${tt.type}`)}return this._isInResult}}class gn{constructor(y,E,A){if(!Array.isArray(y)||y.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=E,this.isExterior=A,this.segments=[],typeof y[0][0]!="number"||typeof y[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let N=Y.round(y[0][0],y[0][1]);this.bbox={ll:{x:N.x,y:N.y},ur:{x:N.x,y:N.y}};let R=N;for(let $=1,G=y.length;$<G;$++){if(typeof y[$][0]!="number"||typeof y[$][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let K=Y.round(y[$][0],y[$][1]);K.x===R.x&&K.y===R.y||(this.segments.push(Te.fromRing(R,K,this)),K.x<this.bbox.ll.x&&(this.bbox.ll.x=K.x),K.y<this.bbox.ll.y&&(this.bbox.ll.y=K.y),K.x>this.bbox.ur.x&&(this.bbox.ur.x=K.x),K.y>this.bbox.ur.y&&(this.bbox.ur.y=K.y),R=K)}(N.x!==R.x||N.y!==R.y)&&this.segments.push(Te.fromRing(R,N,this))}getSweepEvents(){let y=[];for(let E=0,A=this.segments.length;E<A;E++){let N=this.segments[E];y.push(N.leftSE),y.push(N.rightSE)}return y}}class Qe{constructor(y,E){if(!Array.isArray(y))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new gn(y[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 A=1,N=y.length;A<N;A++){let R=new gn(y[A],this,!1);R.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=R.bbox.ll.x),R.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=R.bbox.ll.y),R.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=R.bbox.ur.x),R.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=R.bbox.ur.y),this.interiorRings.push(R)}this.multiPoly=E}getSweepEvents(){let y=this.exteriorRing.getSweepEvents();for(let E=0,A=this.interiorRings.length;E<A;E++){let N=this.interiorRings[E].getSweepEvents();for(let R=0,$=N.length;R<$;R++)y.push(N[R])}return y}}class Cn{constructor(y,E){if(!Array.isArray(y))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof y[0][0][0]=="number"&&(y=[y])}catch(A){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let A=0,N=y.length;A<N;A++){let R=new Qe(y[A],this);R.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=R.bbox.ll.x),R.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=R.bbox.ll.y),R.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=R.bbox.ur.x),R.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=R.bbox.ur.y),this.polys.push(R)}this.isSubject=E}getSweepEvents(){let y=[];for(let E=0,A=this.polys.length;E<A;E++){let N=this.polys[E].getSweepEvents();for(let R=0,$=N.length;R<$;R++)y.push(N[R])}return y}}class ai{static factory(y){let E=[];for(let A=0,N=y.length;A<N;A++){let R=y[A];if(!R.isInResult()||R.ringOut)continue;let $=null,G=R.leftSE,K=R.rightSE,Z=[G],V=G.point,W=[];for(;$=G,G=K,Z.push(G),G.point!==V;)for(;;){let Q=G.getAvailableLinkedEvents();if(Q.length===0){let vt=Z[0].point,It=Z[Z.length-1].point;throw new Error(`Unable to complete output ring starting at [${vt.x}, ${vt.y}]. Last matching segment found ends at [${It.x}, ${It.y}].`)}if(Q.length===1){K=Q[0].otherSE;break}let J=null;for(let vt=0,It=W.length;vt<It;vt++)if(W[vt].point===G.point){J=vt;break}if(J!==null){let vt=W.splice(J)[0],It=Z.splice(vt.index);It.unshift(It[0].otherSE),E.push(new ai(It.reverse()));continue}W.push({index:Z.length,point:G.point});let wt=G.getLeftmostComparator($);K=Q.sort(wt)[0].otherSE;break}E.push(new ai(Z))}return E}constructor(y){this.events=y;for(let E=0,A=y.length;E<A;E++)y[E].segment.ringOut=this;this.poly=null}getGeom(){let y=this.events[0].point,E=[y];for(let Z=1,V=this.events.length-1;Z<V;Z++){let W=this.events[Z].point,Q=this.events[Z+1].point;Ne(W,y,Q)!==0&&(E.push(W),y=W)}if(E.length===1)return null;let A=E[0],N=E[1];Ne(A,y,N)===0&&E.shift(),E.push(E[0]);let R=this.isExteriorRing()?1:-1,$=this.isExteriorRing()?0:E.length-1,G=this.isExteriorRing()?E.length:-1,K=[];for(let Z=$;Z!=G;Z+=R)K.push([E[Z].x,E[Z].y]);return K}isExteriorRing(){if(this._isExteriorRing===void 0){let y=this.enclosingRing();this._isExteriorRing=y?!y.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let y=this.events[0];for(let N=1,R=this.events.length;N<R;N++){let $=this.events[N];oe.compare(y,$)>0&&(y=$)}let E=y.segment.prevInResult(),A=E?E.prevInResult():null;for(;;){if(!E)return null;if(!A)return E.ringOut;if(A.ringOut!==E.ringOut)return A.ringOut.enclosingRing()!==E.ringOut?E.ringOut:E.ringOut.enclosingRing();E=A.prevInResult(),A=E?E.prevInResult():null}}}class _t{constructor(y){this.exteriorRing=y,y.poly=this,this.interiorRings=[]}addInterior(y){this.interiorRings.push(y),y.poly=this}getGeom(){let y=[this.exteriorRing.getGeom()];if(y[0]===null)return null;for(let E=0,A=this.interiorRings.length;E<A;E++){let N=this.interiorRings[E].getGeom();N!==null&&y.push(N)}return y}}class Ce{constructor(y){this.rings=y,this.polys=this._composePolys(y)}getGeom(){let y=[];for(let E=0,A=this.polys.length;E<A;E++){let N=this.polys[E].getGeom();N!==null&&y.push(N)}return y}_composePolys(y){let E=[];for(let A=0,N=y.length;A<N;A++){let R=y[A];if(!R.poly)if(R.isExteriorRing())E.push(new _t(R));else{let $=R.enclosingRing();$.poly||E.push(new _t($)),$.poly.addInterior(R)}}return E}}class ui{constructor(y){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Te.compare;this.queue=y,this.tree=new d(E),this.segments=[]}process(y){let E=y.segment,A=[];if(y.consumedBy)return y.isLeft?this.queue.remove(y.otherSE):this.tree.remove(E),A;let N=y.isLeft?this.tree.add(E):this.tree.find(E);if(!N)throw new Error(`Unable to find segment #${E.id} [${E.leftSE.point.x}, ${E.leftSE.point.y}] -> [${E.rightSE.point.x}, ${E.rightSE.point.y}] in SweepLine tree.`);let R=N,$=N,G,K;for(;G===void 0;)R=this.tree.prev(R),R===null?G=null:R.key.consumedBy===void 0&&(G=R.key);for(;K===void 0;)$=this.tree.next($),$===null?K=null:$.key.consumedBy===void 0&&(K=$.key);if(y.isLeft){let Z=null;if(G){let W=G.getIntersection(E);if(W!==null&&(E.isAnEndpoint(W)||(Z=W),!G.isAnEndpoint(W))){let Q=this._splitSafely(G,W);for(let J=0,wt=Q.length;J<wt;J++)A.push(Q[J])}}let V=null;if(K){let W=K.getIntersection(E);if(W!==null&&(E.isAnEndpoint(W)||(V=W),!K.isAnEndpoint(W))){let Q=this._splitSafely(K,W);for(let J=0,wt=Q.length;J<wt;J++)A.push(Q[J])}}if(Z!==null||V!==null){let W=null;Z===null?W=V:V===null?W=Z:W=oe.comparePoints(Z,V)<=0?Z:V,this.queue.remove(E.rightSE),A.push(E.rightSE);let Q=E.split(W);for(let J=0,wt=Q.length;J<wt;J++)A.push(Q[J])}A.length>0?(this.tree.remove(E),A.push(y)):(this.segments.push(E),E.prev=G)}else{if(G&&K){let Z=G.getIntersection(K);if(Z!==null){if(!G.isAnEndpoint(Z)){let V=this._splitSafely(G,Z);for(let W=0,Q=V.length;W<Q;W++)A.push(V[W])}if(!K.isAnEndpoint(Z)){let V=this._splitSafely(K,Z);for(let W=0,Q=V.length;W<Q;W++)A.push(V[W])}}}this.tree.remove(E)}return A}_splitSafely(y,E){this.tree.remove(y);let A=y.rightSE;this.queue.remove(A);let N=y.split(E);return N.push(A),y.consumedBy===void 0&&this.tree.add(y),N}}let Pr=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,$r=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Un{run(y,E,A){tt.type=y,Y.reset();let N=[new Cn(E,!0)];for(let W=0,Q=A.length;W<Q;W++)N.push(new Cn(A[W],!1));if(tt.numMultiPolys=N.length,tt.type==="difference"){let W=N[0],Q=1;for(;Q<N.length;)b(N[Q].bbox,W.bbox)!==null?Q++:N.splice(Q,1)}if(tt.type==="intersection")for(let W=0,Q=N.length;W<Q;W++){let J=N[W];for(let wt=W+1,vt=N.length;wt<vt;wt++)if(b(J.bbox,N[wt].bbox)===null)return[]}let R=new d(oe.compare);for(let W=0,Q=N.length;W<Q;W++){let J=N[W].getSweepEvents();for(let wt=0,vt=J.length;wt<vt;wt++)if(R.insert(J[wt]),R.size>Pr)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let $=new ui(R),G=R.size,K=R.pop();for(;K;){let W=K.key;if(R.size===G){let J=W.segment;throw new Error(`Unable to pop() ${W.isLeft?"left":"right"} SweepEvent [${W.point.x}, ${W.point.y}] from segment #${J.id} [${J.leftSE.point.x}, ${J.leftSE.point.y}] -> [${J.rightSE.point.x}, ${J.rightSE.point.y}] from queue.`)}if(R.size>Pr)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if($.segments.length>$r)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let Q=$.process(W);for(let J=0,wt=Q.length;J<wt;J++){let vt=Q[J];vt.consumedBy===void 0&&R.insert(vt)}G=R.size,K=R.pop()}Y.reset();let Z=ai.factory($.segments);return new Ce(Z).getGeom()}}let tt=new Un;var Us={union:function(B){for(var y=arguments.length,E=new Array(y>1?y-1:0),A=1;A<y;A++)E[A-1]=arguments[A];return tt.run("union",B,E)},intersection:function(B){for(var y=arguments.length,E=new Array(y>1?y-1:0),A=1;A<y;A++)E[A-1]=arguments[A];return tt.run("intersection",B,E)},xor:function(B){for(var y=arguments.length,E=new Array(y>1?y-1:0),A=1;A<y;A++)E[A-1]=arguments[A];return tt.run("xor",B,E)},difference:function(B){for(var y=arguments.length,E=new Array(y>1?y-1:0),A=1;A<y;A++)E[A-1]=arguments[A];return tt.run("difference",B,E)}};return Us})});var Yg=ct((zu,Xg)=>{(function(o,e){typeof zu=="object"&&typeof Xg!="undefined"?e(zu):typeof define=="function"&&define.amd?define(["exports"],e):e(o.jsts={})})(zu,function(o){"use strict";function e(){}function r(t){this.message=t||""}function a(t){this.message=t||""}function u(t){this.message=t||""}function c(){}function h(t){return t===null?Be:t.color}function p(t){return t===null?null:t.parent}function d(t,n){t!==null&&(t.color=n)}function g(t){return t===null?null:t.left}function v(t){return t===null?null:t.right}function x(){this.root_=null,this.size_=0}function M(){}function w(){this.array_=[],arguments[0]instanceof G&&this.addAll(arguments[0])}function I(){}function D(t){this.message=t||""}function b(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var n=Object(this),i=Math.max(Math.min(n.length,9007199254740991),0)||0,s=1 in arguments&&parseInt(Number(arguments[1]),10)||0;s=s<0?Math.max(i+s,0):Math.min(s,i);var l=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:i;for(l=l<0?Math.max(i+arguments[2],0):Math.min(l,i);s<l;)n[s]=t,++s;return n},writable:!0}),Number.isFinite=Number.isFinite||function(t){return typeof t=="number"&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var T=function(){};T.prototype.interfaces_=function(){return[]},T.prototype.getClass=function(){return T},T.prototype.equalsWithTolerance=function(t,n,i){return Math.abs(t-n)<=i};var L=function(t){function n(i){t.call(this,i),this.name="IllegalArgumentException",this.message=i,this.stack=new t().stack}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n}(Error),P=function(){},z={MAX_VALUE:{configurable:!0}};P.isNaN=function(t){return Number.isNaN(t)},P.doubleToLongBits=function(t){return t},P.longBitsToDouble=function(t){return t},P.isInfinite=function(t){return!Number.isFinite(t)},z.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(P,z);var k=function(){},Y=function(){},q=function(){},C=function t(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(arguments.length===1){var n=arguments[0];this.x=n.x,this.y=n.y,this.z=n.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},ot={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};C.prototype.setOrdinate=function(t,n){switch(t){case C.X:this.x=n;break;case C.Y:this.y=n;break;case C.Z:this.z=n;break;default:throw new L("Invalid ordinate index: "+t)}},C.prototype.equals2D=function(){if(arguments.length===1){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(arguments.length===2){var n=arguments[0],i=arguments[1];return!!T.equalsWithTolerance(this.x,n.x,i)&&!!T.equalsWithTolerance(this.y,n.y,i)}},C.prototype.getOrdinate=function(t){switch(t){case C.X:return this.x;case C.Y:return this.y;case C.Z:return this.z}throw new L("Invalid ordinate index: "+t)},C.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||P.isNaN(this.z))&&P.isNaN(t.z)},C.prototype.equals=function(t){return t instanceof C&&this.equals2D(t)},C.prototype.equalInZ=function(t,n){return T.equalsWithTolerance(this.z,t.z,n)},C.prototype.compareTo=function(t){var n=t;return this.x<n.x?-1:this.x>n.x?1:this.y<n.y?-1:this.y>n.y?1:0},C.prototype.clone=function(){},C.prototype.copy=function(){return new C(this)},C.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},C.prototype.distance3D=function(t){var n=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return Math.sqrt(n*n+i*i+s*s)},C.prototype.distance=function(t){var n=this.x-t.x,i=this.y-t.y;return Math.sqrt(n*n+i*i)},C.prototype.hashCode=function(){var t=17;return t=37*t+C.hashCode(this.x),t=37*t+C.hashCode(this.y)},C.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},C.prototype.interfaces_=function(){return[k,Y,e]},C.prototype.getClass=function(){return C},C.hashCode=function(){if(arguments.length===1){var t=arguments[0],n=P.doubleToLongBits(t);return Math.trunc((n^n)>>>32)}},ot.DimensionalComparator.get=function(){return pt},ot.serialVersionUID.get=function(){return 6683108902428367e3},ot.NULL_ORDINATE.get=function(){return P.NaN},ot.X.get=function(){return 0},ot.Y.get=function(){return 1},ot.Z.get=function(){return 2},Object.defineProperties(C,ot);var pt=function(t){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var n=arguments[0];if(n!==2&&n!==3)throw new L("only 2 or 3 dimensions may be specified");this._dimensionsToTest=n}}};pt.prototype.compare=function(t,n){var i=t,s=n,l=pt.compare(i.x,s.x);if(l!==0)return l;var f=pt.compare(i.y,s.y);return f!==0?f:this._dimensionsToTest<=2?0:pt.compare(i.z,s.z)},pt.prototype.interfaces_=function(){return[q]},pt.prototype.getClass=function(){return pt},pt.compare=function(t,n){return t<n?-1:t>n?1:P.isNaN(t)?P.isNaN(n)?0:-1:P.isNaN(n)?1:0};var dt=function(){};dt.prototype.create=function(){},dt.prototype.interfaces_=function(){return[]},dt.prototype.getClass=function(){return dt};var F=function(){},ye={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};F.prototype.interfaces_=function(){return[]},F.prototype.getClass=function(){return F},F.toLocationSymbol=function(t){switch(t){case F.EXTERIOR:return"e";case F.BOUNDARY:return"b";case F.INTERIOR:return"i";case F.NONE:return"-"}throw new L("Unknown location value: "+t)},ye.INTERIOR.get=function(){return 0},ye.BOUNDARY.get=function(){return 1},ye.EXTERIOR.get=function(){return 2},ye.NONE.get=function(){return-1},Object.defineProperties(F,ye);var et=function(t,n){return t.interfaces_&&t.interfaces_().indexOf(n)>-1},St=function(){},Pt={LOG_10:{configurable:!0}};St.prototype.interfaces_=function(){return[]},St.prototype.getClass=function(){return St},St.log10=function(t){var n=Math.log(t);return P.isInfinite(n)||P.isNaN(n)?n:n/St.LOG_10},St.min=function(t,n,i,s){var l=t;return n<l&&(l=n),i<l&&(l=i),s<l&&(l=s),l},St.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1],i=arguments[2];return t<n?n:t>i?i:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var s=arguments[0],l=arguments[1],f=arguments[2];return s<l?l:s>f?f:s}},St.wrap=function(t,n){return t<0?n- -t%n:t%n},St.max=function(){if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2],s=t;return n>s&&(s=n),i>s&&(s=i),s}if(arguments.length===4){var l=arguments[0],f=arguments[1],m=arguments[2],_=arguments[3],S=l;return f>S&&(S=f),m>S&&(S=m),_>S&&(S=_),S}},St.average=function(t,n){return(t+n)/2},Pt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(St,Pt);var Rt=function(t){this.str=t};Rt.prototype.append=function(t){this.str+=t},Rt.prototype.setCharAt=function(t,n){this.str=this.str.substr(0,t)+n+this.str.substr(t+1)},Rt.prototype.toString=function(t){return this.str};var it=function(t){this.value=t};it.prototype.intValue=function(){return this.value},it.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},it.isNaN=function(t){return Number.isNaN(t)};var mt=function(){};mt.isWhitespace=function(t){return t<=32&&t>=0||t===127},mt.toUpperCase=function(t){return t.toUpperCase()};var U=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this.init(n)}else if(arguments[0]instanceof t){var i=arguments[0];this.init(i)}else if(typeof arguments[0]=="string"){var s=arguments[0];t.call(this,t.parse(s))}}else if(arguments.length===2){var l=arguments[0],f=arguments[1];this.init(l,f)}},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}};U.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},U.prototype.extractSignificantDigits=function(t,n){var i=this.abs(),s=U.magnitude(i._hi),l=U.TEN.pow(s);(i=i.divide(l)).gt(U.TEN)?(i=i.divide(U.TEN),s+=1):i.lt(U.ONE)&&(i=i.multiply(U.TEN),s-=1);for(var f=s+1,m=new Rt,_=U.MAX_PRINT_DIGITS-1,S=0;S<=_;S++){t&&S===f&&m.append(".");var O=Math.trunc(i._hi);if(O<0)break;var H=!1,X=0;O>9?(H=!0,X="9"):X="0"+O,m.append(X),i=i.subtract(U.valueOf(O)).multiply(U.TEN),H&&i.selfAdd(U.TEN);var nt=!0,rt=U.magnitude(i._hi);if(rt<0&&Math.abs(rt)>=_-S&&(nt=!1),!nt)break}return n[0]=s,m.toString()},U.prototype.sqr=function(){return this.multiply(this)},U.prototype.doubleValue=function(){return this._hi+this._lo},U.prototype.subtract=function(){if(arguments[0]instanceof U){var t=arguments[0];return this.add(t.negate())}if(typeof arguments[0]=="number"){var n=arguments[0];return this.add(-n)}},U.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},U.prototype.isZero=function(){return this._hi===0&&this._lo===0},U.prototype.selfSubtract=function(){if(arguments[0]instanceof U){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if(typeof arguments[0]=="number"){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n,0)}},U.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},U.prototype.min=function(t){return this.le(t)?this:t},U.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if(typeof arguments[0]=="number"){var n=arguments[0];return this.selfDivide(n,0)}}else if(arguments.length===2){var i=arguments[0],s=arguments[1],l=null,f=null,m=null,_=null,S=null,O=null,H=null,X=null;return S=this._hi/i,O=U.SPLIT*S,l=O-S,X=U.SPLIT*i,l=O-l,f=S-l,m=X-i,H=S*i,m=X-m,_=i-m,X=l*m-H+l*_+f*m+f*_,O=(this._hi-H-X+this._lo-S*s)/i,X=S+O,this._hi=X,this._lo=S-X+O,this}},U.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},U.prototype.divide=function(){if(arguments[0]instanceof U){var t=arguments[0],n=null,i=null,s=null,l=null,f=null,m=null,_=null,S=null;return i=(f=this._hi/t._hi)-(n=(m=U.SPLIT*f)-(n=m-f)),S=n*(s=(S=U.SPLIT*t._hi)-(s=S-t._hi))-(_=f*t._hi)+n*(l=t._hi-s)+i*s+i*l,m=(this._hi-_-S+this._lo-f*t._lo)/t._hi,new U(S=f+m,f-S+m)}if(typeof arguments[0]=="number"){var O=arguments[0];return P.isNaN(O)?U.createNaN():U.copy(this).selfDivide(O,0)}},U.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},U.prototype.pow=function(t){if(t===0)return U.valueOf(1);var n=new U(this),i=U.valueOf(1),s=Math.abs(t);if(s>1)for(;s>0;)s%2==1&&i.selfMultiply(n),(s/=2)>0&&(n=n.sqr());else i=n;return t<0?i.reciprocal():i},U.prototype.ceil=function(){if(this.isNaN())return U.NaN;var t=Math.ceil(this._hi),n=0;return t===this._hi&&(n=Math.ceil(this._lo)),new U(t,n)},U.prototype.compareTo=function(t){var n=t;return this._hi<n._hi?-1:this._hi>n._hi?1:this._lo<n._lo?-1:this._lo>n._lo?1:0},U.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},U.prototype.setValue=function(){if(arguments[0]instanceof U){var t=arguments[0];return this.init(t),this}if(typeof arguments[0]=="number"){var n=arguments[0];return this.init(n),this}},U.prototype.max=function(t){return this.ge(t)?this:t},U.prototype.sqrt=function(){if(this.isZero())return U.valueOf(0);if(this.isNegative())return U.NaN;var t=1/Math.sqrt(this._hi),n=this._hi*t,i=U.valueOf(n),s=this.subtract(i.sqr())._hi*(.5*t);return i.add(s)},U.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if(typeof arguments[0]=="number"){var n=arguments[0],i=null,s=null,l=null,f=null,m=null,_=null;return l=this._hi+n,m=l-this._hi,f=l-m,f=n-m+(this._hi-f),_=f+this._lo,i=l+_,s=_+(l-i),this._hi=i+s,this._lo=s+(i-this._hi),this}}else if(arguments.length===2){var S=arguments[0],O=arguments[1],H=null,X=null,nt=null,rt=null,lt=null,gt=null,we=null;rt=this._hi+S,X=this._lo+O,lt=rt-(gt=rt-this._hi),nt=X-(we=X-this._lo);var rn=(H=rt+(gt=(lt=S-gt+(this._hi-lt))+X))+(gt=(nt=O-we+(this._lo-nt))+(gt+(rt-H))),Wn=gt+(H-rn);return this._hi=rn,this._lo=Wn,this}},U.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if(typeof arguments[0]=="number"){var n=arguments[0];return this.selfMultiply(n,0)}}else if(arguments.length===2){var i=arguments[0],s=arguments[1],l=null,f=null,m=null,_=null,S=null,O=null;l=(S=U.SPLIT*this._hi)-this._hi,O=U.SPLIT*i,l=S-l,f=this._hi-l,m=O-i;var H=(S=this._hi*i)+(O=l*(m=O-m)-S+l*(_=i-m)+f*m+f*_+(this._hi*s+this._lo*i)),X=O+(l=S-H);return this._hi=H,this._lo=X,this}},U.prototype.selfSqr=function(){return this.selfMultiply(this)},U.prototype.floor=function(){if(this.isNaN())return U.NaN;var t=Math.floor(this._hi),n=0;return t===this._hi&&(n=Math.floor(this._lo)),new U(t,n)},U.prototype.negate=function(){return this.isNaN()?this:new U(-this._hi,-this._lo)},U.prototype.clone=function(){},U.prototype.multiply=function(){if(arguments[0]instanceof U){var t=arguments[0];return t.isNaN()?U.createNaN():U.copy(this).selfMultiply(t)}if(typeof arguments[0]=="number"){var n=arguments[0];return P.isNaN(n)?U.createNaN():U.copy(this).selfMultiply(n,0)}},U.prototype.isNaN=function(){return P.isNaN(this._hi)},U.prototype.intValue=function(){return Math.trunc(this._hi)},U.prototype.toString=function(){var t=U.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},U.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var n=new Array(1).fill(null),i=this.extractSignificantDigits(!0,n),s=n[0]+1,l=i;if(i.charAt(0)===".")l="0"+i;else if(s<0)l="0."+U.stringOfChar("0",-s)+i;else if(i.indexOf(".")===-1){var f=s-i.length;l=i+U.stringOfChar("0",f)+".0"}return this.isNegative()?"-"+l:l},U.prototype.reciprocal=function(){var t=null,n=null,i=null,s=null,l=null,f=null,m=null,_=null;n=(l=1/this._hi)-(t=(f=U.SPLIT*l)-(t=f-l)),i=(_=U.SPLIT*this._hi)-this._hi;var S=l+(f=(1-(m=l*this._hi)-(_=t*(i=_-i)-m+t*(s=this._hi-i)+n*i+n*s)-l*this._lo)/this._hi);return new U(S,l-S+f)},U.prototype.toSciNotation=function(){if(this.isZero())return U.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var n=new Array(1).fill(null),i=this.extractSignificantDigits(!1,n),s=U.SCI_NOT_EXPONENT_CHAR+n[0];if(i.charAt(0)==="0")throw new Error("Found leading zero: "+i);var l="";i.length>1&&(l=i.substring(1));var f=i.charAt(0)+"."+l;return this.isNegative()?"-"+f+s:f+s},U.prototype.abs=function(){return this.isNaN()?U.NaN:this.isNegative()?this.negate():new U(this)},U.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},U.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},U.prototype.add=function(){if(arguments[0]instanceof U){var t=arguments[0];return U.copy(this).selfAdd(t)}if(typeof arguments[0]=="number"){var n=arguments[0];return U.copy(this).selfAdd(n)}},U.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof U){var n=arguments[0];this._hi=n._hi,this._lo=n._lo}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._hi=i,this._lo=s}},U.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},U.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},U.prototype.trunc=function(){return this.isNaN()?U.NaN:this.isPositive()?this.floor():this.ceil()},U.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},U.prototype.interfaces_=function(){return[e,k,Y]},U.prototype.getClass=function(){return U},U.sqr=function(t){return U.valueOf(t).selfMultiply(t)},U.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return U.parse(t)}if(typeof arguments[0]=="number"){var n=arguments[0];return new U(n)}},U.sqrt=function(t){return U.valueOf(t).sqrt()},U.parse=function(t){for(var n=0,i=t.length;mt.isWhitespace(t.charAt(n));)n++;var s=!1;if(n<i){var l=t.charAt(n);l!=="-"&&l!=="+"||(n++,l==="-"&&(s=!0))}for(var f=new U,m=0,_=0,S=0;!(n>=i);){var O=t.charAt(n);if(n++,mt.isDigit(O)){var H=O-"0";f.selfMultiply(U.TEN),f.selfAdd(H),m++}else{if(O!=="."){if(O==="e"||O==="E"){var X=t.substring(n);try{S=it.parseInt(X)}catch(we){throw we instanceof Error?new Error("Invalid exponent "+X+" in string "+t):we}break}throw new Error("Unexpected character \'"+O+"\' at position "+n+" in string "+t)}_=m}}var nt=f,rt=m-_-S;if(rt===0)nt=f;else if(rt>0){var lt=U.TEN.pow(rt);nt=f.divide(lt)}else if(rt<0){var gt=U.TEN.pow(-rt);nt=f.multiply(gt)}return s?nt.negate():nt},U.createNaN=function(){return new U(P.NaN,P.NaN)},U.copy=function(t){return new U(t)},U.magnitude=function(t){var n=Math.abs(t),i=Math.log(n)/Math.log(10),s=Math.trunc(Math.floor(i));return 10*Math.pow(10,s)<=n&&(s+=1),s},U.stringOfChar=function(t,n){for(var i=new Rt,s=0;s<n;s++)i.append(t);return i.toString()},Nt.PI.get=function(){return new U(3.141592653589793,12246467991473532e-32)},Nt.TWO_PI.get=function(){return new U(6.283185307179586,24492935982947064e-32)},Nt.PI_2.get=function(){return new U(1.5707963267948966,6123233995736766e-32)},Nt.E.get=function(){return new U(2.718281828459045,14456468917292502e-32)},Nt.NaN.get=function(){return new U(P.NaN,P.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 U.valueOf(10)},Nt.ONE.get=function(){return U.valueOf(1)},Nt.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},Nt.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(U,Nt);var Mt=function(){},Re={DP_SAFE_EPSILON:{configurable:!0}};Mt.prototype.interfaces_=function(){return[]},Mt.prototype.getClass=function(){return Mt},Mt.orientationIndex=function(t,n,i){var s=Mt.orientationIndexFilter(t,n,i);if(s<=1)return s;var l=U.valueOf(n.x).selfAdd(-t.x),f=U.valueOf(n.y).selfAdd(-t.y),m=U.valueOf(i.x).selfAdd(-n.x),_=U.valueOf(i.y).selfAdd(-n.y);return l.selfMultiply(_).selfSubtract(f.selfMultiply(m)).signum()},Mt.signOfDet2x2=function(t,n,i,s){return t.multiply(s).selfSubtract(n.multiply(i)).signum()},Mt.intersection=function(t,n,i,s){var l=U.valueOf(s.y).selfSubtract(i.y).selfMultiply(U.valueOf(n.x).selfSubtract(t.x)),f=U.valueOf(s.x).selfSubtract(i.x).selfMultiply(U.valueOf(n.y).selfSubtract(t.y)),m=l.subtract(f),_=U.valueOf(s.x).selfSubtract(i.x).selfMultiply(U.valueOf(t.y).selfSubtract(i.y)),S=U.valueOf(s.y).selfSubtract(i.y).selfMultiply(U.valueOf(t.x).selfSubtract(i.x)),O=_.subtract(S).selfDivide(m).doubleValue(),H=U.valueOf(t.x).selfAdd(U.valueOf(n.x).selfSubtract(t.x).selfMultiply(O)).doubleValue(),X=U.valueOf(n.x).selfSubtract(t.x).selfMultiply(U.valueOf(t.y).selfSubtract(i.y)),nt=U.valueOf(n.y).selfSubtract(t.y).selfMultiply(U.valueOf(t.x).selfSubtract(i.x)),rt=X.subtract(nt).selfDivide(m).doubleValue(),lt=U.valueOf(i.y).selfAdd(U.valueOf(s.y).selfSubtract(i.y).selfMultiply(rt)).doubleValue();return new C(H,lt)},Mt.orientationIndexFilter=function(t,n,i){var s=null,l=(t.x-i.x)*(n.y-i.y),f=(t.y-i.y)*(n.x-i.x),m=l-f;if(l>0){if(f<=0)return Mt.signum(m);s=l+f}else{if(!(l<0)||f>=0)return Mt.signum(m);s=-l-f}var _=Mt.DP_SAFE_EPSILON*s;return m>=_||-m>=_?Mt.signum(m):2},Mt.signum=function(t){return t>0?1:t<0?-1:0},Re.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Mt,Re);var ut=function(){},Ne={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Ne.X.get=function(){return 0},Ne.Y.get=function(){return 1},Ne.Z.get=function(){return 2},Ne.M.get=function(){return 3},ut.prototype.setOrdinate=function(t,n,i){},ut.prototype.size=function(){},ut.prototype.getOrdinate=function(t,n){},ut.prototype.getCoordinate=function(){},ut.prototype.getCoordinateCopy=function(t){},ut.prototype.getDimension=function(){},ut.prototype.getX=function(t){},ut.prototype.clone=function(){},ut.prototype.expandEnvelope=function(t){},ut.prototype.copy=function(){},ut.prototype.getY=function(t){},ut.prototype.toCoordinateArray=function(){},ut.prototype.interfaces_=function(){return[Y]},ut.prototype.getClass=function(){return ut},Object.defineProperties(ut,Ne);var xn=function(){},qe=function(t){function n(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(xn),Ee=function(){};Ee.arraycopy=function(t,n,i,s,l){for(var f=0,m=n;m<n+l;m++)i[s+f]=t[m],f++},Ee.getProperty=function(t){return{"line.separator":`\n`}[t]};var Le=function t(){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 n=arguments[0];this.x=n.x,this.y=n.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var i=arguments[0],s=arguments[1];this.x=i,this.y=s,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var l=arguments[0],f=arguments[1];this.x=l.y*f.w-f.y*l.w,this.y=f.x*l.w-l.x*f.w,this.w=l.x*f.y-f.x*l.y}else if(arguments[0]instanceof C&&arguments[1]instanceof C){var m=arguments[0],_=arguments[1];this.x=m.y-_.y,this.y=_.x-m.x,this.w=m.x*_.y-_.x*m.y}}else if(arguments.length===3){var S=arguments[0],O=arguments[1],H=arguments[2];this.x=S,this.y=O,this.w=H}else if(arguments.length===4){var X=arguments[0],nt=arguments[1],rt=arguments[2],lt=arguments[3],gt=X.y-nt.y,we=nt.x-X.x,rn=X.x*nt.y-nt.x*X.y,Wn=rt.y-lt.y,Ei=lt.x-rt.x,Qi=rt.x*lt.y-lt.x*rt.y;this.x=we*Qi-Ei*rn,this.y=Wn*rn-gt*Qi,this.w=gt*Ei-Wn*we}};Le.prototype.getY=function(){var t=this.y/this.w;if(P.isNaN(t)||P.isInfinite(t))throw new qe;return t},Le.prototype.getX=function(){var t=this.x/this.w;if(P.isNaN(t)||P.isInfinite(t))throw new qe;return t},Le.prototype.getCoordinate=function(){var t=new C;return t.x=this.getX(),t.y=this.getY(),t},Le.prototype.interfaces_=function(){return[]},Le.prototype.getClass=function(){return Le},Le.intersection=function(t,n,i,s){var l=t.y-n.y,f=n.x-t.x,m=t.x*n.y-n.x*t.y,_=i.y-s.y,S=s.x-i.x,O=i.x*s.y-s.x*i.y,H=l*S-_*f,X=(f*O-S*m)/H,nt=(_*m-l*O)/H;if(P.isNaN(X)||P.isInfinite(X)||P.isNaN(nt)||P.isInfinite(nt))throw new qe;return new C(X,nt)};var at=function t(){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 C){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof t){var i=arguments[0];this.init(i)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.init(s.x,l.x,s.y,l.y)}else if(arguments.length===4){var f=arguments[0],m=arguments[1],_=arguments[2],S=arguments[3];this.init(f,m,_,S)}},Kn={serialVersionUID:{configurable:!0}};at.prototype.getArea=function(){return this.getWidth()*this.getHeight()},at.prototype.equals=function(t){if(!(t instanceof at))return!1;var n=t;return this.isNull()?n.isNull():this._maxx===n.getMaxX()&&this._maxy===n.getMaxY()&&this._minx===n.getMinX()&&this._miny===n.getMinY()},at.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new at;var n=this._minx>t._minx?this._minx:t._minx,i=this._miny>t._miny?this._miny:t._miny,s=this._maxx<t._maxx?this._maxx:t._maxx,l=this._maxy<t._maxy?this._maxy:t._maxy;return new at(n,s,i,l)},at.prototype.isNull=function(){return this._maxx<this._minx},at.prototype.getMaxX=function(){return this._maxx},at.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof C){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof at){var n=arguments[0];return!this.isNull()&&!n.isNull()&&n.getMinX()>=this._minx&&n.getMaxX()<=this._maxx&&n.getMinY()>=this._miny&&n.getMaxY()<=this._maxy}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];return!this.isNull()&&i>=this._minx&&i<=this._maxx&&s>=this._miny&&s<=this._maxy}},at.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof at){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof C){var n=arguments[0];return this.intersects(n.x,n.y)}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];return!this.isNull()&&!(i>this._maxx||i<this._minx||s>this._maxy||s<this._miny)}},at.prototype.getMinY=function(){return this._miny},at.prototype.getMinX=function(){return this._minx},at.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof C){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof at){var n=arguments[0];if(n.isNull())return null;this.isNull()?(this._minx=n.getMinX(),this._maxx=n.getMaxX(),this._miny=n.getMinY(),this._maxy=n.getMaxY()):(n._minx<this._minx&&(this._minx=n._minx),n._maxx>this._maxx&&(this._maxx=n._maxx),n._miny<this._miny&&(this._miny=n._miny),n._maxy>this._maxy&&(this._maxy=n._maxy))}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.isNull()?(this._minx=i,this._maxx=i,this._miny=s,this._maxy=s):(i<this._minx&&(this._minx=i),i>this._maxx&&(this._maxx=i),s<this._miny&&(this._miny=s),s>this._maxy&&(this._maxy=s))}},at.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),n=this.getHeight();return t<n?t:n},at.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},at.prototype.compareTo=function(t){var n=t;return this.isNull()?n.isNull()?0:-1:n.isNull()?1:this._minx<n._minx?-1:this._minx>n._minx?1:this._miny<n._miny?-1:this._miny>n._miny?1:this._maxx<n._maxx?-1:this._maxx>n._maxx?1:this._maxy<n._maxy?-1:this._maxy>n._maxy?1:0},at.prototype.translate=function(t,n){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+n,this.getMaxY()+n)},at.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},at.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},at.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},at.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),n=this.getHeight();return t>n?t:n},at.prototype.expandBy=function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];if(this.isNull())return null;this._minx-=n,this._maxx+=n,this._miny-=i,this._maxy+=i,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},at.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof at){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof C){var n=arguments[0];return this.covers(n)}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.covers(i,s)}},at.prototype.centre=function(){return this.isNull()?null:new C((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},at.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof C){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof at){var n=arguments[0];this._minx=n._minx,this._maxx=n._maxx,this._miny=n._miny,this._maxy=n._maxy}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.init(i.x,s.x,i.y,s.y)}else if(arguments.length===4){var l=arguments[0],f=arguments[1],m=arguments[2],_=arguments[3];l<f?(this._minx=l,this._maxx=f):(this._minx=f,this._maxx=l),m<_?(this._miny=m,this._maxy=_):(this._miny=_,this._maxy=m)}},at.prototype.getMaxY=function(){return this._maxy},at.prototype.distance=function(t){if(this.intersects(t))return 0;var n=0;this._maxx<t._minx?n=t._minx-this._maxx:this._minx>t._maxx&&(n=this._minx-t._maxx);var i=0;return this._maxy<t._miny?i=t._miny-this._maxy:this._miny>t._maxy&&(i=this._miny-t._maxy),n===0?i:i===0?n:Math.sqrt(n*n+i*i)},at.prototype.hashCode=function(){var t=17;return t=37*t+C.hashCode(this._minx),t=37*t+C.hashCode(this._maxx),t=37*t+C.hashCode(this._miny),t=37*t+C.hashCode(this._maxy)},at.prototype.interfaces_=function(){return[k,e]},at.prototype.getClass=function(){return at},at.intersects=function(){if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2];return i.x>=(t.x<n.x?t.x:n.x)&&i.x<=(t.x>n.x?t.x:n.x)&&i.y>=(t.y<n.y?t.y:n.y)&&i.y<=(t.y>n.y?t.y:n.y)}if(arguments.length===4){var s=arguments[0],l=arguments[1],f=arguments[2],m=arguments[3],_=Math.min(f.x,m.x),S=Math.max(f.x,m.x),O=Math.min(s.x,l.x),H=Math.max(s.x,l.x);return!(O>S)&&!(H<_)&&(_=Math.min(f.y,m.y),S=Math.max(f.y,m.y),O=Math.min(s.y,l.y),H=Math.max(s.y,l.y),!(O>S)&&!(H<_))}},Kn.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(at,Kn);var oe={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*$/},Fn=function(t){this.geometryFactory=t||new Tt};Fn.prototype.read=function(t){var n,i,s;t=t.replace(/[\\n\\r]/g," ");var l=oe.typeStr.exec(t);if(t.search("EMPTY")!==-1&&((l=oe.emptyTypeStr.exec(t))[2]=void 0),l&&(i=l[1].toLowerCase(),s=l[2],gn[i]&&(n=gn[i].apply(this,[s]))),n===void 0)throw new Error("Could not parse WKT "+t);return n},Fn.prototype.write=function(t){return this.extractGeometry(t)},Fn.prototype.extractGeometry=function(t){var n=t.getGeometryType().toLowerCase();if(!Te[n])return null;var i=n.toUpperCase();return t.isEmpty()?i+" EMPTY":i+"("+Te[n].apply(this,[t])+")"};var Te={coordinate:function(t){return t.x+" "+t.y},point:function(t){return Te.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var n=[],i=0,s=t._geometries.length;i<s;++i)n.push("("+Te.point.apply(this,[t._geometries[i]])+")");return n.join(",")},linestring:function(t){for(var n=[],i=0,s=t._points._coordinates.length;i<s;++i)n.push(Te.coordinate.apply(this,[t._points._coordinates[i]]));return n.join(",")},linearring:function(t){for(var n=[],i=0,s=t._points._coordinates.length;i<s;++i)n.push(Te.coordinate.apply(this,[t._points._coordinates[i]]));return n.join(",")},multilinestring:function(t){for(var n=[],i=0,s=t._geometries.length;i<s;++i)n.push("("+Te.linestring.apply(this,[t._geometries[i]])+")");return n.join(",")},polygon:function(t){var n=[];n.push("("+Te.linestring.apply(this,[t._shell])+")");for(var i=0,s=t._holes.length;i<s;++i)n.push("("+Te.linestring.apply(this,[t._holes[i]])+")");return n.join(",")},multipolygon:function(t){for(var n=[],i=0,s=t._geometries.length;i<s;++i)n.push("("+Te.polygon.apply(this,[t._geometries[i]])+")");return n.join(",")},geometrycollection:function(t){for(var n=[],i=0,s=t._geometries.length;i<s;++i)n.push(this.extractGeometry(t._geometries[i]));return n.join(",")}},gn={point:function(t){if(t===void 0)return this.geometryFactory.createPoint();var n=t.trim().split(oe.spaces);return this.geometryFactory.createPoint(new C(Number.parseFloat(n[0]),Number.parseFloat(n[1])))},multipoint:function(t){if(t===void 0)return this.geometryFactory.createMultiPoint();for(var n,i=t.trim().split(","),s=[],l=0,f=i.length;l<f;++l)n=i[l].replace(oe.trimParens,"$1"),s.push(gn.point.apply(this,[n]));return this.geometryFactory.createMultiPoint(s)},linestring:function(t){if(t===void 0)return this.geometryFactory.createLineString();for(var n,i=t.trim().split(","),s=[],l=0,f=i.length;l<f;++l)n=i[l].trim().split(oe.spaces),s.push(new C(Number.parseFloat(n[0]),Number.parseFloat(n[1])));return this.geometryFactory.createLineString(s)},linearring:function(t){if(t===void 0)return this.geometryFactory.createLinearRing();for(var n,i=t.trim().split(","),s=[],l=0,f=i.length;l<f;++l)n=i[l].trim().split(oe.spaces),s.push(new C(Number.parseFloat(n[0]),Number.parseFloat(n[1])));return this.geometryFactory.createLinearRing(s)},multilinestring:function(t){if(t===void 0)return this.geometryFactory.createMultiLineString();for(var n,i=t.trim().split(oe.parenComma),s=[],l=0,f=i.length;l<f;++l)n=i[l].replace(oe.trimParens,"$1"),s.push(gn.linestring.apply(this,[n]));return this.geometryFactory.createMultiLineString(s)},polygon:function(t){if(t===void 0)return this.geometryFactory.createPolygon();for(var n,i,s,l,f=t.trim().split(oe.parenComma),m=[],_=0,S=f.length;_<S;++_)n=f[_].replace(oe.trimParens,"$1"),i=gn.linestring.apply(this,[n]),s=this.geometryFactory.createLinearRing(i._points),_===0?l=s:m.push(s);return this.geometryFactory.createPolygon(l,m)},multipolygon:function(t){if(t===void 0)return this.geometryFactory.createMultiPolygon();for(var n,i=t.trim().split(oe.doubleParenComma),s=[],l=0,f=i.length;l<f;++l)n=i[l].replace(oe.trimParens,"$1"),s.push(gn.polygon.apply(this,[n]));return this.geometryFactory.createMultiPolygon(s)},geometrycollection:function(t){if(t===void 0)return this.geometryFactory.createGeometryCollection();for(var n=(t=t.replace(/,\\s*([A-Za-z])/g,"|$1")).trim().split("|"),i=[],s=0,l=n.length;s<l;++s)i.push(this.read(n[s]));return this.geometryFactory.createGeometryCollection(i)}},Qe=function(t){this.parser=new Fn(t)};Qe.prototype.write=function(t){return this.parser.write(t)},Qe.toLineString=function(t,n){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+n.x+" "+n.y+" )"};var Cn=function(t){function n(i){t.call(this,i),this.name="RuntimeException",this.message=i,this.stack=new t().stack}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n}(Error),ai=function(t){function n(){if(t.call(this),arguments.length===0)t.call(this);else if(arguments.length===1){var i=arguments[0];t.call(this,i)}}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Cn),_t=function(){};_t.prototype.interfaces_=function(){return[]},_t.prototype.getClass=function(){return _t},_t.shouldNeverReachHere=function(){if(arguments.length===0)_t.shouldNeverReachHere(null);else if(arguments.length===1){var t=arguments[0];throw new ai("Should never reach here"+(t!==null?": "+t:""))}},_t.isTrue=function(){var t,n;if(arguments.length===1)t=arguments[0],_t.isTrue(t,null);else if(arguments.length===2&&(t=arguments[0],n=arguments[1],!t))throw n===null?new ai:new ai(n)},_t.equals=function(){var t,n,i;if(arguments.length===2)t=arguments[0],n=arguments[1],_t.equals(t,n,null);else if(arguments.length===3&&(t=arguments[0],n=arguments[1],i=arguments[2],!n.equals(t)))throw new ai("Expected "+t+" but encountered "+n+(i!==null?": "+i:""))};var Ce=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 C,this._intPt[1]=new C,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},ui={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};Ce.prototype.getIndexAlongSegment=function(t,n){return this.computeIntLineIndex(),this._intLineIndex[t][n]},Ce.prototype.getTopologySummary=function(){var t=new Rt;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},Ce.prototype.computeIntersection=function(t,n,i,s){this._inputLines[0][0]=t,this._inputLines[0][1]=n,this._inputLines[1][0]=i,this._inputLines[1][1]=s,this._result=this.computeIntersect(t,n,i,s)},Ce.prototype.getIntersectionNum=function(){return this._result},Ce.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 t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},Ce.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},Ce.prototype.setPrecisionModel=function(t){this._precisionModel=t},Ce.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var t=arguments[0],n=0;n<this._result;n++)if(!this._intPt[n].equals2D(this._inputLines[t][0])&&!this._intPt[n].equals2D(this._inputLines[t][1]))return!0;return!1}},Ce.prototype.getIntersection=function(t){return this._intPt[t]},Ce.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},Ce.prototype.hasIntersection=function(){return this._result!==Ce.NO_INTERSECTION},Ce.prototype.getEdgeDistance=function(t,n){return Ce.computeEdgeDistance(this._intPt[n],this._inputLines[t][0],this._inputLines[t][1])},Ce.prototype.isCollinear=function(){return this._result===Ce.COLLINEAR_INTERSECTION},Ce.prototype.toString=function(){return Qe.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Qe.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},Ce.prototype.getEndpoint=function(t,n){return this._inputLines[t][n]},Ce.prototype.isIntersection=function(t){for(var n=0;n<this._result;n++)if(this._intPt[n].equals2D(t))return!0;return!1},Ce.prototype.getIntersectionAlongSegment=function(t,n){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][n]]},Ce.prototype.interfaces_=function(){return[]},Ce.prototype.getClass=function(){return Ce},Ce.computeEdgeDistance=function(t,n,i){var s=Math.abs(i.x-n.x),l=Math.abs(i.y-n.y),f=-1;if(t.equals(n))f=0;else if(t.equals(i))f=s>l?s:l;else{var m=Math.abs(t.x-n.x),_=Math.abs(t.y-n.y);(f=s>l?m:_)!==0||t.equals(n)||(f=Math.max(m,_))}return _t.isTrue(!(f===0&&!t.equals(n)),"Bad distance calculation"),f},Ce.nonRobustComputeEdgeDistance=function(t,n,i){var s=t.x-n.x,l=t.y-n.y,f=Math.sqrt(s*s+l*l);return _t.isTrue(!(f===0&&!t.equals(n)),"Invalid distance calculation"),f},ui.DONT_INTERSECT.get=function(){return 0},ui.DO_INTERSECT.get=function(){return 1},ui.COLLINEAR.get=function(){return 2},ui.NO_INTERSECTION.get=function(){return 0},ui.POINT_INTERSECTION.get=function(){return 1},ui.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(Ce,ui);var Pr=function(t){function n(){t.apply(this,arguments)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.isInSegmentEnvelopes=function(i){var s=new at(this._inputLines[0][0],this._inputLines[0][1]),l=new at(this._inputLines[1][0],this._inputLines[1][1]);return s.contains(i)&&l.contains(i)},n.prototype.computeIntersection=function(){if(arguments.length!==3)return t.prototype.computeIntersection.apply(this,arguments);var i=arguments[0],s=arguments[1],l=arguments[2];if(this._isProper=!1,at.intersects(s,l,i)&&tt.orientationIndex(s,l,i)===0&&tt.orientationIndex(l,s,i)===0)return this._isProper=!0,(i.equals(s)||i.equals(l))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},n.prototype.normalizeToMinimum=function(i,s,l,f,m){m.x=this.smallestInAbsValue(i.x,s.x,l.x,f.x),m.y=this.smallestInAbsValue(i.y,s.y,l.y,f.y),i.x-=m.x,i.y-=m.y,s.x-=m.x,s.y-=m.y,l.x-=m.x,l.y-=m.y,f.x-=m.x,f.y-=m.y},n.prototype.safeHCoordinateIntersection=function(i,s,l,f){var m=null;try{m=Le.intersection(i,s,l,f)}catch(_){if(!(_ instanceof qe))throw _;m=n.nearestEndpoint(i,s,l,f)}return m},n.prototype.intersection=function(i,s,l,f){var m=this.intersectionWithNormalization(i,s,l,f);return this.isInSegmentEnvelopes(m)||(m=new C(n.nearestEndpoint(i,s,l,f))),this._precisionModel!==null&&this._precisionModel.makePrecise(m),m},n.prototype.smallestInAbsValue=function(i,s,l,f){var m=i,_=Math.abs(m);return Math.abs(s)<_&&(m=s,_=Math.abs(s)),Math.abs(l)<_&&(m=l,_=Math.abs(l)),Math.abs(f)<_&&(m=f),m},n.prototype.checkDD=function(i,s,l,f,m){var _=Mt.intersection(i,s,l,f),S=this.isInSegmentEnvelopes(_);Ee.out.println("DD in env = "+S+" --------------------- "+_),m.distance(_)>1e-4&&Ee.out.println("Distance = "+m.distance(_))},n.prototype.intersectionWithNormalization=function(i,s,l,f){var m=new C(i),_=new C(s),S=new C(l),O=new C(f),H=new C;this.normalizeToEnvCentre(m,_,S,O,H);var X=this.safeHCoordinateIntersection(m,_,S,O);return X.x+=H.x,X.y+=H.y,X},n.prototype.computeCollinearIntersection=function(i,s,l,f){var m=at.intersects(i,s,l),_=at.intersects(i,s,f),S=at.intersects(l,f,i),O=at.intersects(l,f,s);return m&&_?(this._intPt[0]=l,this._intPt[1]=f,t.COLLINEAR_INTERSECTION):S&&O?(this._intPt[0]=i,this._intPt[1]=s,t.COLLINEAR_INTERSECTION):m&&S?(this._intPt[0]=l,this._intPt[1]=i,!l.equals(i)||_||O?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):m&&O?(this._intPt[0]=l,this._intPt[1]=s,!l.equals(s)||_||S?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):_&&S?(this._intPt[0]=f,this._intPt[1]=i,!f.equals(i)||m||O?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):_&&O?(this._intPt[0]=f,this._intPt[1]=s,!f.equals(s)||m||S?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},n.prototype.normalizeToEnvCentre=function(i,s,l,f,m){var _=i.x<s.x?i.x:s.x,S=i.y<s.y?i.y:s.y,O=i.x>s.x?i.x:s.x,H=i.y>s.y?i.y:s.y,X=l.x<f.x?l.x:f.x,nt=l.y<f.y?l.y:f.y,rt=l.x>f.x?l.x:f.x,lt=l.y>f.y?l.y:f.y,gt=((_>X?_:X)+(O<rt?O:rt))/2,we=((S>nt?S:nt)+(H<lt?H:lt))/2;m.x=gt,m.y=we,i.x-=m.x,i.y-=m.y,s.x-=m.x,s.y-=m.y,l.x-=m.x,l.y-=m.y,f.x-=m.x,f.y-=m.y},n.prototype.computeIntersect=function(i,s,l,f){if(this._isProper=!1,!at.intersects(i,s,l,f))return t.NO_INTERSECTION;var m=tt.orientationIndex(i,s,l),_=tt.orientationIndex(i,s,f);if(m>0&&_>0||m<0&&_<0)return t.NO_INTERSECTION;var S=tt.orientationIndex(l,f,i),O=tt.orientationIndex(l,f,s);return S>0&&O>0||S<0&&O<0?t.NO_INTERSECTION:m===0&&_===0&&S===0&&O===0?this.computeCollinearIntersection(i,s,l,f):(m===0||_===0||S===0||O===0?(this._isProper=!1,i.equals2D(l)||i.equals2D(f)?this._intPt[0]=i:s.equals2D(l)||s.equals2D(f)?this._intPt[0]=s:m===0?this._intPt[0]=new C(l):_===0?this._intPt[0]=new C(f):S===0?this._intPt[0]=new C(i):O===0&&(this._intPt[0]=new C(s))):(this._isProper=!0,this._intPt[0]=this.intersection(i,s,l,f)),t.POINT_INTERSECTION)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n.nearestEndpoint=function(i,s,l,f){var m=i,_=tt.distancePointLine(i,l,f),S=tt.distancePointLine(s,l,f);return S<_&&(_=S,m=s),(S=tt.distancePointLine(l,i,s))<_&&(_=S,m=l),(S=tt.distancePointLine(f,i,s))<_&&(_=S,m=f),m},n}(Ce),$r=function(){};$r.prototype.interfaces_=function(){return[]},$r.prototype.getClass=function(){return $r},$r.orientationIndex=function(t,n,i){var s=n.x-t.x,l=n.y-t.y,f=i.x-n.x,m=i.y-n.y;return $r.signOfDet2x2(s,l,f,m)},$r.signOfDet2x2=function(t,n,i,s){var l=null,f=null,m=null;if(l=1,t===0||s===0)return n===0||i===0?0:n>0?i>0?-l:l:i>0?l:-l;if(n===0||i===0)return s>0?t>0?l:-l:t>0?-l:l;if(n>0?s>0?n<=s||(l=-l,f=t,t=i,i=f,f=n,n=s,s=f):n<=-s?(l=-l,i=-i,s=-s):(f=t,t=-i,i=f,f=n,n=-s,s=f):s>0?-n<=s?(l=-l,t=-t,n=-n):(f=-t,t=i,i=f,f=-n,n=s,s=f):n>=s?(t=-t,n=-n,i=-i,s=-s):(l=-l,f=-t,t=-i,i=f,f=-n,n=-s,s=f),t>0){if(!(i>0)||!(t<=i))return l}else{if(i>0||!(t>=i))return-l;l=-l,t=-t,i=-i}for(;;){if(m=Math.floor(i/t),i-=m*t,(s-=m*n)<0)return-l;if(s>n)return l;if(t>i+i){if(n<s+s)return l}else{if(n>s+s)return-l;i=t-i,s=n-s,l=-l}if(s===0)return i===0?0:-l;if(i===0||(m=Math.floor(t/i),t-=m*i,(n-=m*s)<0))return l;if(n>s)return-l;if(i>t+t){if(s<n+n)return-l}else{if(s>n+n)return l;t=i-t,n=s-n,l=-l}if(n===0)return t===0?0:l;if(t===0)return-l}};var Un=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};Un.prototype.countSegment=function(t,n){if(t.x<this._p.x&&n.x<this._p.x)return null;if(this._p.x===n.x&&this._p.y===n.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&n.y===this._p.y){var i=t.x,s=n.x;return i>s&&(i=n.x,s=t.x),this._p.x>=i&&this._p.x<=s&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&n.y<=this._p.y||n.y>this._p.y&&t.y<=this._p.y){var l=t.x-this._p.x,f=t.y-this._p.y,m=n.x-this._p.x,_=n.y-this._p.y,S=$r.signOfDet2x2(l,f,m,_);if(S===0)return this._isPointOnSegment=!0,null;_<f&&(S=-S),S>0&&this._crossingCount++}},Un.prototype.isPointInPolygon=function(){return this.getLocation()!==F.EXTERIOR},Un.prototype.getLocation=function(){return this._isPointOnSegment?F.BOUNDARY:this._crossingCount%2==1?F.INTERIOR:F.EXTERIOR},Un.prototype.isOnSegment=function(){return this._isPointOnSegment},Un.prototype.interfaces_=function(){return[]},Un.prototype.getClass=function(){return Un},Un.locatePointInRing=function(){if(arguments[0]instanceof C&&et(arguments[1],ut)){for(var t=arguments[0],n=arguments[1],i=new Un(t),s=new C,l=new C,f=1;f<n.size();f++)if(n.getCoordinate(f,s),n.getCoordinate(f-1,l),i.countSegment(s,l),i.isOnSegment())return i.getLocation();return i.getLocation()}if(arguments[0]instanceof C&&arguments[1]instanceof Array){for(var m=arguments[0],_=arguments[1],S=new Un(m),O=1;O<_.length;O++){var H=_[O],X=_[O-1];if(S.countSegment(H,X),S.isOnSegment())return S.getLocation()}return S.getLocation()}};var tt=function(){},eo={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};tt.prototype.interfaces_=function(){return[]},tt.prototype.getClass=function(){return tt},tt.orientationIndex=function(t,n,i){return Mt.orientationIndex(t,n,i)},tt.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var n=0,i=t[0].x,s=1;s<t.length-1;s++){var l=t[s].x-i,f=t[s+1].y;n+=l*(t[s-1].y-f)}return n/2}if(et(arguments[0],ut)){var m=arguments[0],_=m.size();if(_<3)return 0;var S=new C,O=new C,H=new C;m.getCoordinate(0,O),m.getCoordinate(1,H);var X=O.x;H.x-=X;for(var nt=0,rt=1;rt<_-1;rt++)S.y=O.y,O.x=H.x,O.y=H.y,m.getCoordinate(rt+1,H),H.x-=X,nt+=O.x*(S.y-H.y);return nt/2}},tt.distanceLineLine=function(t,n,i,s){if(t.equals(n))return tt.distancePointLine(t,i,s);if(i.equals(s))return tt.distancePointLine(s,t,n);var l=!1;if(at.intersects(t,n,i,s)){var f=(n.x-t.x)*(s.y-i.y)-(n.y-t.y)*(s.x-i.x);if(f===0)l=!0;else{var m=(t.y-i.y)*(s.x-i.x)-(t.x-i.x)*(s.y-i.y),_=((t.y-i.y)*(n.x-t.x)-(t.x-i.x)*(n.y-t.y))/f,S=m/f;(S<0||S>1||_<0||_>1)&&(l=!0)}}else l=!0;return l?St.min(tt.distancePointLine(t,i,s),tt.distancePointLine(n,i,s),tt.distancePointLine(i,t,n),tt.distancePointLine(s,t,n)):0},tt.isPointInRing=function(t,n){return tt.locatePointInRing(t,n)!==F.EXTERIOR},tt.computeLength=function(t){var n=t.size();if(n<=1)return 0;var i=0,s=new C;t.getCoordinate(0,s);for(var l=s.x,f=s.y,m=1;m<n;m++){t.getCoordinate(m,s);var _=s.x,S=s.y,O=_-l,H=S-f;i+=Math.sqrt(O*O+H*H),l=_,f=S}return i},tt.isCCW=function(t){var n=t.length-1;if(n<3)throw new L("Ring has fewer than 4 points, so orientation cannot be determined");for(var i=t[0],s=0,l=1;l<=n;l++){var f=t[l];f.y>i.y&&(i=f,s=l)}var m=s;do(m-=1)<0&&(m=n);while(t[m].equals2D(i)&&m!==s);var _=s;do _=(_+1)%n;while(t[_].equals2D(i)&&_!==s);var S=t[m],O=t[_];if(S.equals2D(i)||O.equals2D(i)||S.equals2D(O))return!1;var H=tt.computeOrientation(S,i,O),X=!1;return X=H===0?S.x>O.x:H>0,X},tt.locatePointInRing=function(t,n){return Un.locatePointInRing(t,n)},tt.distancePointLinePerpendicular=function(t,n,i){var s=(i.x-n.x)*(i.x-n.x)+(i.y-n.y)*(i.y-n.y),l=((n.y-t.y)*(i.x-n.x)-(n.x-t.x)*(i.y-n.y))/s;return Math.abs(l)*Math.sqrt(s)},tt.computeOrientation=function(t,n,i){return tt.orientationIndex(t,n,i)},tt.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];if(n.length===0)throw new L("Line array must contain at least one vertex");for(var i=t.distance(n[0]),s=0;s<n.length-1;s++){var l=tt.distancePointLine(t,n[s],n[s+1]);l<i&&(i=l)}return i}if(arguments.length===3){var f=arguments[0],m=arguments[1],_=arguments[2];if(m.x===_.x&&m.y===_.y)return f.distance(m);var S=(_.x-m.x)*(_.x-m.x)+(_.y-m.y)*(_.y-m.y),O=((f.x-m.x)*(_.x-m.x)+(f.y-m.y)*(_.y-m.y))/S;if(O<=0)return f.distance(m);if(O>=1)return f.distance(_);var H=((m.y-f.y)*(_.x-m.x)-(m.x-f.x)*(_.y-m.y))/S;return Math.abs(H)*Math.sqrt(S)}},tt.isOnLine=function(t,n){for(var i=new Pr,s=1;s<n.length;s++){var l=n[s-1],f=n[s];if(i.computeIntersection(t,l,f),i.hasIntersection())return!0}return!1},eo.CLOCKWISE.get=function(){return-1},eo.RIGHT.get=function(){return tt.CLOCKWISE},eo.COUNTERCLOCKWISE.get=function(){return 1},eo.LEFT.get=function(){return tt.COUNTERCLOCKWISE},eo.COLLINEAR.get=function(){return 0},eo.STRAIGHT.get=function(){return tt.COLLINEAR},Object.defineProperties(tt,eo);var li=function(){};li.prototype.filter=function(t){},li.prototype.interfaces_=function(){return[]},li.prototype.getClass=function(){return li};var yt=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},Zr={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(t){return this},yt.prototype.getArea=function(){return 0},yt.prototype.isRectangle=function(){return!1},yt.prototype.equals=function(){if(arguments[0]instanceof yt){var t=arguments[0];return t!==null&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var n=arguments[0];if(!(n instanceof yt))return!1;var i=n;return this.equalsExact(i)}},yt.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},yt.prototype.geometryChanged=function(){this.apply(yt.geometryChangedFilter)},yt.prototype.geometryChangedAction=function(){this._envelope=null},yt.prototype.equalsNorm=function(t){return t!==null&&this.norm().equalsExact(t.norm())},yt.prototype.getLength=function(){return 0},yt.prototype.getNumGeometries=function(){return 1},yt.prototype.compareTo=function(){if(arguments.length===1){var t=arguments[0],n=t;return this.getSortIndex()!==n.getSortIndex()?this.getSortIndex()-n.getSortIndex():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(t)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(i,s)}},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(t){if(t.getSortIndex()===yt.SORTINDEX_GEOMETRYCOLLECTION)throw new L("This method does not support GeometryCollection arguments")},yt.prototype.equal=function(t,n,i){return i===0?t.equals(n):t.distance(n)<=i},yt.prototype.norm=function(){var t=this.copy();return t.normalize(),t},yt.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},yt.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new at(this._envelope)},yt.prototype.setSRID=function(t){this._SRID=t},yt.prototype.setUserData=function(t){this._userData=t},yt.prototype.compare=function(t,n){for(var i=t.iterator(),s=n.iterator();i.hasNext()&&s.hasNext();){var l=i.next(),f=s.next(),m=l.compareTo(f);if(m!==0)return m}return i.hasNext()?1:s.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[Y,k,e]},yt.prototype.getClass=function(){return yt},yt.hasNonEmptyElements=function(t){for(var n=0;n<t.length;n++)if(!t[n].isEmpty())return!0;return!1},yt.hasNullElements=function(t){for(var n=0;n<t.length;n++)if(t[n]===null)return!0;return!1},Zr.serialVersionUID.get=function(){return 8763622679187377e3},Zr.SORTINDEX_POINT.get=function(){return 0},Zr.SORTINDEX_MULTIPOINT.get=function(){return 1},Zr.SORTINDEX_LINESTRING.get=function(){return 2},Zr.SORTINDEX_LINEARRING.get=function(){return 3},Zr.SORTINDEX_MULTILINESTRING.get=function(){return 4},Zr.SORTINDEX_POLYGON.get=function(){return 5},Zr.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Zr.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Zr.geometryChangedFilter.get=function(){return Us},Object.defineProperties(yt,Zr);var Us=function(){};Us.interfaces_=function(){return[li]},Us.filter=function(t){t.geometryChangedAction()};var B=function(){};B.prototype.filter=function(t){},B.prototype.interfaces_=function(){return[]},B.prototype.getClass=function(){return B};var y=function(){},E={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}};y.prototype.isInBoundary=function(t){},y.prototype.interfaces_=function(){return[]},y.prototype.getClass=function(){return y},E.Mod2BoundaryNodeRule.get=function(){return A},E.EndPointBoundaryNodeRule.get=function(){return N},E.MultiValentEndPointBoundaryNodeRule.get=function(){return R},E.MonoValentEndPointBoundaryNodeRule.get=function(){return $},E.MOD2_BOUNDARY_RULE.get=function(){return new A},E.ENDPOINT_BOUNDARY_RULE.get=function(){return new N},E.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new R},E.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new $},E.OGC_SFS_BOUNDARY_RULE.get=function(){return y.MOD2_BOUNDARY_RULE},Object.defineProperties(y,E);var A=function(){};A.prototype.isInBoundary=function(t){return t%2==1},A.prototype.interfaces_=function(){return[y]},A.prototype.getClass=function(){return A};var N=function(){};N.prototype.isInBoundary=function(t){return t>0},N.prototype.interfaces_=function(){return[y]},N.prototype.getClass=function(){return N};var R=function(){};R.prototype.isInBoundary=function(t){return t>1},R.prototype.interfaces_=function(){return[y]},R.prototype.getClass=function(){return R};var $=function(){};$.prototype.isInBoundary=function(t){return t===1},$.prototype.interfaces_=function(){return[y]},$.prototype.getClass=function(){return $};var G=function(){};G.prototype.add=function(){},G.prototype.addAll=function(){},G.prototype.isEmpty=function(){},G.prototype.iterator=function(){},G.prototype.size=function(){},G.prototype.toArray=function(){},G.prototype.remove=function(){},(r.prototype=new Error).name="IndexOutOfBoundsException";var K=function(){};K.prototype.hasNext=function(){},K.prototype.next=function(){},K.prototype.remove=function(){};var Z=function(t){function n(){t.apply(this,arguments)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.get=function(){},n.prototype.set=function(){},n.prototype.isEmpty=function(){},n}(G);(a.prototype=new Error).name="NoSuchElementException";var V=function(t){function n(){t.call(this),this.array_=[],arguments[0]instanceof G&&this.addAll(arguments[0])}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.ensureCapacity=function(){},n.prototype.interfaces_=function(){return[t,G]},n.prototype.add=function(i){return arguments.length===1?this.array_.push(i):this.array_.splice(arguments[0],arguments[1]),!0},n.prototype.clear=function(){this.array_=[]},n.prototype.addAll=function(i){for(var s=i.iterator();s.hasNext();)this.add(s.next());return!0},n.prototype.set=function(i,s){var l=this.array_[i];return this.array_[i]=s,l},n.prototype.iterator=function(){return new W(this)},n.prototype.get=function(i){if(i<0||i>=this.size())throw new r;return this.array_[i]},n.prototype.isEmpty=function(){return this.array_.length===0},n.prototype.size=function(){return this.array_.length},n.prototype.toArray=function(){for(var i=[],s=0,l=this.array_.length;s<l;s++)i.push(this.array_[s]);return i},n.prototype.remove=function(i){for(var s=!1,l=0,f=this.array_.length;l<f;l++)if(this.array_[l]===i){this.array_.splice(l,1),s=!0;break}return s},n}(Z),W=function(t){function n(i){t.call(this),this.arrayList_=i,this.position_=0}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new a;return this.arrayList_.get(this.position_++)},n.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},n.prototype.set=function(i){return this.arrayList_.set(this.position_-1,i)},n.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},n}(K),Q=function(t){function n(){if(t.call(this),arguments.length!==0){if(arguments.length===1){var s=arguments[0];this.ensureCapacity(s.length),this.add(s,!0)}else if(arguments.length===2){var l=arguments[0],f=arguments[1];this.ensureCapacity(l.length),this.add(l,f)}}}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={coordArrayType:{configurable:!0}};return i.coordArrayType.get=function(){return new Array(0).fill(null)},n.prototype.getCoordinate=function(s){return this.get(s)},n.prototype.addAll=function(){if(arguments.length===2){for(var s=arguments[0],l=arguments[1],f=!1,m=s.iterator();m.hasNext();)this.add(m.next(),l),f=!0;return f}return t.prototype.addAll.apply(this,arguments)},n.prototype.clone=function(){for(var s=t.prototype.clone.call(this),l=0;l<this.size();l++)s.add(l,this.get(l).copy());return s},n.prototype.toCoordinateArray=function(){return this.toArray(n.coordArrayType)},n.prototype.add=function(){if(arguments.length===1){var s=arguments[0];t.prototype.add.call(this,s)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var l=arguments[0],f=arguments[1];return this.add(l,f,!0),!0}if(arguments[0]instanceof C&&typeof arguments[1]=="boolean"){var m=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(m))return null;t.prototype.add.call(this,m)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var _=arguments[0],S=arguments[1];return this.add(_,S),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var O=arguments[0],H=arguments[1];if(arguments[2])for(var X=0;X<O.length;X++)this.add(O[X],H);else for(var nt=O.length-1;nt>=0;nt--)this.add(O[nt],H);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof C){var rt=arguments[0],lt=arguments[1];if(!arguments[2]){var gt=this.size();if(gt>0&&(rt>0&&this.get(rt-1).equals2D(lt)||rt<gt&&this.get(rt).equals2D(lt)))return null}t.prototype.add.call(this,rt,lt)}}else if(arguments.length===4){var we=arguments[0],rn=arguments[1],Wn=arguments[2],Ei=arguments[3],Qi=1;Wn>Ei&&(Qi=-1);for(var hl=Wn;hl!==Ei;hl+=Qi)this.add(we[hl],rn);return!0}},n.prototype.closeRing=function(){this.size()>0&&this.add(new C(this.get(0)),!1)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},Object.defineProperties(n,i),n}(V),J=function(){},wt={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};wt.ForwardComparator.get=function(){return vt},wt.BidirectionalComparator.get=function(){return It},wt.coordArrayType.get=function(){return new Array(0).fill(null)},J.prototype.interfaces_=function(){return[]},J.prototype.getClass=function(){return J},J.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},J.ptNotInList=function(t,n){for(var i=0;i<t.length;i++){var s=t[i];if(J.indexOf(s,n)<0)return s}return null},J.scroll=function(t,n){var i=J.indexOf(n,t);if(i<0)return null;var s=new Array(t.length).fill(null);Ee.arraycopy(t,i,s,0,t.length-i),Ee.arraycopy(t,0,s,t.length-i,i),Ee.arraycopy(s,0,t,0,t.length)},J.equals=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];if(t===n)return!0;if(t===null||n===null||t.length!==n.length)return!1;for(var i=0;i<t.length;i++)if(!t[i].equals(n[i]))return!1;return!0}if(arguments.length===3){var s=arguments[0],l=arguments[1],f=arguments[2];if(s===l)return!0;if(s===null||l===null||s.length!==l.length)return!1;for(var m=0;m<s.length;m++)if(f.compare(s[m],l[m])!==0)return!1;return!0}},J.intersection=function(t,n){for(var i=new Q,s=0;s<t.length;s++)n.intersects(t[s])&&i.add(t[s],!0);return i.toCoordinateArray()},J.hasRepeatedPoints=function(t){for(var n=1;n<t.length;n++)if(t[n-1].equals(t[n]))return!0;return!1},J.removeRepeatedPoints=function(t){return J.hasRepeatedPoints(t)?new Q(t,!1).toCoordinateArray():t},J.reverse=function(t){for(var n=t.length-1,i=Math.trunc(n/2),s=0;s<=i;s++){var l=t[s];t[s]=t[n-s],t[n-s]=l}},J.removeNull=function(t){for(var n=0,i=0;i<t.length;i++)t[i]!==null&&n++;var s=new Array(n).fill(null);if(n===0)return s;for(var l=0,f=0;f<t.length;f++)t[f]!==null&&(s[l++]=t[f]);return s},J.copyDeep=function(){if(arguments.length===1){for(var t=arguments[0],n=new Array(t.length).fill(null),i=0;i<t.length;i++)n[i]=new C(t[i]);return n}if(arguments.length===5)for(var s=arguments[0],l=arguments[1],f=arguments[2],m=arguments[3],_=arguments[4],S=0;S<_;S++)f[m+S]=new C(s[l+S])},J.isEqualReversed=function(t,n){for(var i=0;i<t.length;i++){var s=t[i],l=n[t.length-i-1];if(s.compareTo(l)!==0)return!1}return!0},J.envelope=function(t){for(var n=new at,i=0;i<t.length;i++)n.expandToInclude(t[i]);return n},J.toCoordinateArray=function(t){return t.toArray(J.coordArrayType)},J.atLeastNCoordinatesOrNothing=function(t,n){return n.length>=t?n:[]},J.indexOf=function(t,n){for(var i=0;i<n.length;i++)if(t.equals(n[i]))return i;return-1},J.increasingDirection=function(t){for(var n=0;n<Math.trunc(t.length/2);n++){var i=t.length-1-n,s=t[n].compareTo(t[i]);if(s!==0)return s}return 1},J.compare=function(t,n){for(var i=0;i<t.length&&i<n.length;){var s=t[i].compareTo(n[i]);if(s!==0)return s;i++}return i<n.length?-1:i<t.length?1:0},J.minCoordinate=function(t){for(var n=null,i=0;i<t.length;i++)(n===null||n.compareTo(t[i])>0)&&(n=t[i]);return n},J.extract=function(t,n,i){n=St.clamp(n,0,t.length);var s=(i=St.clamp(i,-1,t.length))-n+1;i<0&&(s=0),n>=t.length&&(s=0),i<n&&(s=0);var l=new Array(s).fill(null);if(s===0)return l;for(var f=0,m=n;m<=i;m++)l[f++]=t[m];return l},Object.defineProperties(J,wt);var vt=function(){};vt.prototype.compare=function(t,n){return J.compare(t,n)},vt.prototype.interfaces_=function(){return[q]},vt.prototype.getClass=function(){return vt};var It=function(){};It.prototype.compare=function(t,n){var i=t,s=n;if(i.length<s.length)return-1;if(i.length>s.length)return 1;if(i.length===0)return 0;var l=J.compare(i,s);return J.isEqualReversed(i,s)?0:l},It.prototype.OLDcompare=function(t,n){var i=t,s=n;if(i.length<s.length)return-1;if(i.length>s.length)return 1;if(i.length===0)return 0;for(var l=J.increasingDirection(i),f=J.increasingDirection(s),m=l>0?0:i.length-1,_=f>0?0:i.length-1,S=0;S<i.length;S++){var O=i[m].compareTo(s[_]);if(O!==0)return O;m+=l,_+=f}return 0},It.prototype.interfaces_=function(){return[q]},It.prototype.getClass=function(){return It};var At=function(){};At.prototype.get=function(){},At.prototype.put=function(){},At.prototype.size=function(){},At.prototype.values=function(){},At.prototype.entrySet=function(){};var ke=function(t){function n(){t.apply(this,arguments)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n}(At);(u.prototype=new Error).name="OperationNotSupported",(c.prototype=new G).contains=function(){};var En=function(t){function n(){t.call(this),this.array_=[],arguments[0]instanceof G&&this.addAll(arguments[0])}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.contains=function(i){for(var s=0,l=this.array_.length;s<l;s++)if(this.array_[s]===i)return!0;return!1},n.prototype.add=function(i){return!this.contains(i)&&(this.array_.push(i),!0)},n.prototype.addAll=function(i){for(var s=i.iterator();s.hasNext();)this.add(s.next());return!0},n.prototype.remove=function(i){throw new Error},n.prototype.size=function(){return this.array_.length},n.prototype.isEmpty=function(){return this.array_.length===0},n.prototype.toArray=function(){for(var i=[],s=0,l=this.array_.length;s<l;s++)i.push(this.array_[s]);return i},n.prototype.iterator=function(){return new pn(this)},n}(c),pn=function(t){function n(i){t.call(this),this.hashSet_=i,this.position_=0}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new a;return this.hashSet_.array_[this.position_++]},n.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},n.prototype.remove=function(){throw new u},n}(K),Be=0;(x.prototype=new ke).get=function(t){for(var n=this.root_;n!==null;){var i=t.compareTo(n.key);if(i<0)n=n.left;else{if(!(i>0))return n.value;n=n.right}}return null},x.prototype.put=function(t,n){if(this.root_===null)return this.root_={key:t,value:n,left:null,right:null,parent:null,color:Be,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var i,s,l=this.root_;do if(i=l,(s=t.compareTo(l.key))<0)l=l.left;else{if(!(s>0)){var f=l.value;return l.value=n,f}l=l.right}while(l!==null);var m={key:t,left:null,right:null,value:n,parent:i,color:Be,getValue:function(){return this.value},getKey:function(){return this.key}};return s<0?i.left=m:i.right=m,this.fixAfterInsertion(m),this.size_++,null},x.prototype.fixAfterInsertion=function(t){for(t.color=1;t!=null&&t!==this.root_&&t.parent.color===1;)if(p(t)===g(p(p(t)))){var n=v(p(p(t)));h(n)===1?(d(p(t),Be),d(n,Be),d(p(p(t)),1),t=p(p(t))):(t===v(p(t))&&(t=p(t),this.rotateLeft(t)),d(p(t),Be),d(p(p(t)),1),this.rotateRight(p(p(t))))}else{var i=g(p(p(t)));h(i)===1?(d(p(t),Be),d(i,Be),d(p(p(t)),1),t=p(p(t))):(t===g(p(t))&&(t=p(t),this.rotateRight(t)),d(p(t),Be),d(p(p(t)),1),this.rotateLeft(p(p(t))))}this.root_.color=Be},x.prototype.values=function(){var t=new V,n=this.getFirstEntry();if(n!==null)for(t.add(n.value);(n=x.successor(n))!==null;)t.add(n.value);return t},x.prototype.entrySet=function(){var t=new En,n=this.getFirstEntry();if(n!==null)for(t.add(n);(n=x.successor(n))!==null;)t.add(n);return t},x.prototype.rotateLeft=function(t){if(t!=null){var n=t.right;t.right=n.left,n.left!=null&&(n.left.parent=t),n.parent=t.parent,t.parent===null?this.root_=n:t.parent.left===t?t.parent.left=n:t.parent.right=n,n.left=t,t.parent=n}},x.prototype.rotateRight=function(t){if(t!=null){var n=t.left;t.left=n.right,n.right!=null&&(n.right.parent=t),n.parent=t.parent,t.parent===null?this.root_=n:t.parent.right===t?t.parent.right=n:t.parent.left=n,n.right=t,t.parent=n}},x.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t},x.successor=function(t){if(t===null)return null;if(t.right!==null){for(var n=t.right;n.left!==null;)n=n.left;return n}for(var i=t.parent,s=t;i!==null&&s===i.right;)s=i,i=i.parent;return i},x.prototype.size=function(){return this.size_};var dn=function(){};dn.prototype.interfaces_=function(){return[]},dn.prototype.getClass=function(){return dn},M.prototype=new c,(w.prototype=new M).contains=function(t){for(var n=0,i=this.array_.length;n<i;n++)if(this.array_[n].compareTo(t)===0)return!0;return!1},w.prototype.add=function(t){if(this.contains(t))return!1;for(var n=0,i=this.array_.length;n<i;n++)if(this.array_[n].compareTo(t)===1)return this.array_.splice(n,0,t),!0;return this.array_.push(t),!0},w.prototype.addAll=function(t){for(var n=t.iterator();n.hasNext();)this.add(n.next());return!0},w.prototype.remove=function(t){throw new u},w.prototype.size=function(){return this.array_.length},w.prototype.isEmpty=function(){return this.array_.length===0},w.prototype.toArray=function(){for(var t=[],n=0,i=this.array_.length;n<i;n++)t.push(this.array_[n]);return t},w.prototype.iterator=function(){return new Qn(this)};var Qn=function(t){this.treeSet_=t,this.position_=0};Qn.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new a;return this.treeSet_.array_[this.position_++]},Qn.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Qn.prototype.remove=function(){throw new u};var We=function(){};We.sort=function(){var t,n,i,s,l=arguments[0];if(arguments.length===1)s=function(m,_){return m.compareTo(_)},l.sort(s);else if(arguments.length===2)i=arguments[1],s=function(m,_){return i.compare(m,_)},l.sort(s);else if(arguments.length===3){(n=l.slice(arguments[1],arguments[2])).sort();var f=l.slice(0,arguments[1]).concat(n,l.slice(arguments[2],l.length));for(l.splice(0,l.length),t=0;t<f.length;t++)l.push(f[t])}else if(arguments.length===4)for(n=l.slice(arguments[1],arguments[2]),i=arguments[3],s=function(m,_){return i.compare(m,_)},n.sort(s),f=l.slice(0,arguments[1]).concat(n,l.slice(arguments[2],l.length)),l.splice(0,l.length),t=0;t<f.length;t++)l.push(f[t])},We.asList=function(t){for(var n=new V,i=0,s=t.length;i<s;i++)n.add(t[i]);return n};var bt=function(){},Xe={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}};Xe.P.get=function(){return 0},Xe.L.get=function(){return 1},Xe.A.get=function(){return 2},Xe.FALSE.get=function(){return-1},Xe.TRUE.get=function(){return-2},Xe.DONTCARE.get=function(){return-3},Xe.SYM_FALSE.get=function(){return"F"},Xe.SYM_TRUE.get=function(){return"T"},Xe.SYM_DONTCARE.get=function(){return"*"},Xe.SYM_P.get=function(){return"0"},Xe.SYM_L.get=function(){return"1"},Xe.SYM_A.get=function(){return"2"},bt.prototype.interfaces_=function(){return[]},bt.prototype.getClass=function(){return bt},bt.toDimensionSymbol=function(t){switch(t){case bt.FALSE:return bt.SYM_FALSE;case bt.TRUE:return bt.SYM_TRUE;case bt.DONTCARE:return bt.SYM_DONTCARE;case bt.P:return bt.SYM_P;case bt.L:return bt.SYM_L;case bt.A:return bt.SYM_A}throw new L("Unknown dimension value: "+t)},bt.toDimensionValue=function(t){switch(mt.toUpperCase(t)){case bt.SYM_FALSE:return bt.FALSE;case bt.SYM_TRUE:return bt.TRUE;case bt.SYM_DONTCARE:return bt.DONTCARE;case bt.SYM_P:return bt.P;case bt.SYM_L:return bt.L;case bt.SYM_A:return bt.A}throw new L("Unknown dimension symbol: "+t)},Object.defineProperties(bt,Xe);var je=function(){};je.prototype.filter=function(t){},je.prototype.interfaces_=function(){return[]},je.prototype.getClass=function(){return je};var Ye=function(){};Ye.prototype.filter=function(t,n){},Ye.prototype.isDone=function(){},Ye.prototype.isGeometryChanged=function(){},Ye.prototype.interfaces_=function(){return[]},Ye.prototype.getClass=function(){return Ye};var Fe=function(t){function n(s,l){if(t.call(this,l),this._geometries=s||[],t.hasNullElements(this._geometries))throw new L("geometries must not contain null elements")}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={serialVersionUID:{configurable:!0}};return n.prototype.computeEnvelopeInternal=function(){for(var s=new at,l=0;l<this._geometries.length;l++)s.expandToInclude(this._geometries[l].getEnvelopeInternal());return s},n.prototype.getGeometryN=function(s){return this._geometries[s]},n.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},n.prototype.getCoordinates=function(){for(var s=new Array(this.getNumPoints()).fill(null),l=-1,f=0;f<this._geometries.length;f++)for(var m=this._geometries[f].getCoordinates(),_=0;_<m.length;_++)s[++l]=m[_];return s},n.prototype.getArea=function(){for(var s=0,l=0;l<this._geometries.length;l++)s+=this._geometries[l].getArea();return s},n.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];if(!this.isEquivalentClass(s))return!1;var f=s;if(this._geometries.length!==f._geometries.length)return!1;for(var m=0;m<this._geometries.length;m++)if(!this._geometries[m].equalsExact(f._geometries[m],l))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.normalize=function(){for(var s=0;s<this._geometries.length;s++)this._geometries[s].normalize();We.sort(this._geometries)},n.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},n.prototype.getBoundaryDimension=function(){for(var s=bt.FALSE,l=0;l<this._geometries.length;l++)s=Math.max(s,this._geometries[l].getBoundaryDimension());return s},n.prototype.getDimension=function(){for(var s=bt.FALSE,l=0;l<this._geometries.length;l++)s=Math.max(s,this._geometries[l].getDimension());return s},n.prototype.getLength=function(){for(var s=0,l=0;l<this._geometries.length;l++)s+=this._geometries[l].getLength();return s},n.prototype.getNumPoints=function(){for(var s=0,l=0;l<this._geometries.length;l++)s+=this._geometries[l].getNumPoints();return s},n.prototype.getNumGeometries=function(){return this._geometries.length},n.prototype.reverse=function(){for(var s=this._geometries.length,l=new Array(s).fill(null),f=0;f<this._geometries.length;f++)l[f]=this._geometries[f].reverse();return this.getFactory().createGeometryCollection(l)},n.prototype.compareToSameClass=function(){if(arguments.length===1){var s=arguments[0],l=new w(We.asList(this._geometries)),f=new w(We.asList(s._geometries));return this.compare(l,f)}if(arguments.length===2){for(var m=arguments[0],_=arguments[1],S=m,O=this.getNumGeometries(),H=S.getNumGeometries(),X=0;X<O&&X<H;){var nt=this.getGeometryN(X),rt=S.getGeometryN(X),lt=nt.compareToSameClass(rt,_);if(lt!==0)return lt;X++}return X<O?1:X<H?-1:0}},n.prototype.apply=function(){if(et(arguments[0],B))for(var s=arguments[0],l=0;l<this._geometries.length;l++)this._geometries[l].apply(s);else if(et(arguments[0],Ye)){var f=arguments[0];if(this._geometries.length===0)return null;for(var m=0;m<this._geometries.length&&(this._geometries[m].apply(f),!f.isDone());m++);f.isGeometryChanged()&&this.geometryChanged()}else if(et(arguments[0],je)){var _=arguments[0];_.filter(this);for(var S=0;S<this._geometries.length;S++)this._geometries[S].apply(_)}else if(et(arguments[0],li)){var O=arguments[0];O.filter(this);for(var H=0;H<this._geometries.length;H++)this._geometries[H].apply(O)}},n.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),_t.shouldNeverReachHere(),null},n.prototype.clone=function(){var s=t.prototype.clone.call(this);s._geometries=new Array(this._geometries.length).fill(null);for(var l=0;l<this._geometries.length;l++)s._geometries[l]=this._geometries[l].clone();return s},n.prototype.getGeometryType=function(){return"GeometryCollection"},n.prototype.copy=function(){for(var s=new Array(this._geometries.length).fill(null),l=0;l<s.length;l++)s[l]=this._geometries[l].copy();return new n(s,this._factory)},n.prototype.isEmpty=function(){for(var s=0;s<this._geometries.length;s++)if(!this._geometries[s].isEmpty())return!1;return!0},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(n,i),n}(yt),Rr=function(t){function n(){t.apply(this,arguments)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={serialVersionUID:{configurable:!0}};return n.prototype.getSortIndex=function(){return yt.SORTINDEX_MULTILINESTRING},n.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];return!!this.isEquivalentClass(s)&&t.prototype.equalsExact.call(this,s,l)}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.getBoundaryDimension=function(){return this.isClosed()?bt.FALSE:0},n.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var s=0;s<this._geometries.length;s++)if(!this._geometries[s].isClosed())return!1;return!0},n.prototype.getDimension=function(){return 1},n.prototype.reverse=function(){for(var s=this._geometries.length,l=new Array(s).fill(null),f=0;f<this._geometries.length;f++)l[s-1-f]=this._geometries[f].reverse();return this.getFactory().createMultiLineString(l)},n.prototype.getBoundary=function(){return new ur(this).getBoundary()},n.prototype.getGeometryType=function(){return"MultiLineString"},n.prototype.copy=function(){for(var s=new Array(this._geometries.length).fill(null),l=0;l<s.length;l++)s[l]=this._geometries[l].copy();return new n(s,this._factory)},n.prototype.interfaces_=function(){return[dn]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(n,i),n}(Fe),ur=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var t=arguments[0],n=y.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=n}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._geom=i,this._geomFact=i.getFactory(),this._bnRule=s}};ur.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var n=this.computeBoundaryCoordinates(t);return n.length===1?this._geomFact.createPoint(n[0]):this._geomFact.createMultiPointFromCoords(n)},ur.prototype.getBoundary=function(){return this._geom instanceof Ge?this.boundaryLineString(this._geom):this._geom instanceof Rr?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},ur.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},ur.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},ur.prototype.computeBoundaryCoordinates=function(t){var n=new V;this._endpointMap=new x;for(var i=0;i<t.getNumGeometries();i++){var s=t.getGeometryN(i);s.getNumPoints()!==0&&(this.addEndpoint(s.getCoordinateN(0)),this.addEndpoint(s.getCoordinateN(s.getNumPoints()-1)))}for(var l=this._endpointMap.entrySet().iterator();l.hasNext();){var f=l.next(),m=f.getValue().count;this._bnRule.isInBoundary(m)&&n.add(f.getKey())}return J.toCoordinateArray(n)},ur.prototype.addEndpoint=function(t){var n=this._endpointMap.get(t);n===null&&(n=new $o,this._endpointMap.put(t,n)),n.count++},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur},ur.getBoundary=function(){if(arguments.length===1){var t=arguments[0];return new ur(t).getBoundary()}if(arguments.length===2){var n=arguments[0],i=arguments[1];return new ur(n,i).getBoundary()}};var $o=function(){this.count=null};$o.prototype.interfaces_=function(){return[]},$o.prototype.getClass=function(){return $o};var lr=function(){},Ku={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr},lr.chars=function(t,n){for(var i=new Array(n).fill(null),s=0;s<n;s++)i[s]=t;return String(i)},lr.getStackTrace=function(){if(arguments.length===1){var t=arguments[0],n=new function(){},i=new function(){}(n);return t.printStackTrace(i),n.toString()}if(arguments.length===2){for(var s=arguments[0],l=arguments[1],f="",m=new function(){}(new function(){}(lr.getStackTrace(s))),_=0;_<l;_++)try{f+=m.readLine()+lr.NEWLINE}catch(S){if(!(S instanceof I))throw S;_t.shouldNeverReachHere()}return f}},lr.split=function(t,n){for(var i=n.length,s=new V,l=""+t,f=l.indexOf(n);f>=0;){var m=l.substring(0,f);s.add(m),f=(l=l.substring(f+i)).indexOf(n)}l.length>0&&s.add(l);for(var _=new Array(s.size()).fill(null),S=0;S<_.length;S++)_[S]=s.get(S);return _},lr.toString=function(){if(arguments.length===1){var t=arguments[0];return lr.SIMPLE_ORDINATE_FORMAT.format(t)}},lr.spaces=function(t){return lr.chars(" ",t)},Ku.NEWLINE.get=function(){return Ee.getProperty("line.separator")},Ku.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(lr,Ku);var $e=function(){};$e.prototype.interfaces_=function(){return[]},$e.prototype.getClass=function(){return $e},$e.copyCoord=function(t,n,i,s){for(var l=Math.min(t.getDimension(),i.getDimension()),f=0;f<l;f++)i.setOrdinate(s,f,t.getOrdinate(n,f))},$e.isRing=function(t){var n=t.size();return n===0||!(n<=3)&&t.getOrdinate(0,ut.X)===t.getOrdinate(n-1,ut.X)&&t.getOrdinate(0,ut.Y)===t.getOrdinate(n-1,ut.Y)},$e.isEqual=function(t,n){var i=t.size();if(i!==n.size())return!1;for(var s=Math.min(t.getDimension(),n.getDimension()),l=0;l<i;l++)for(var f=0;f<s;f++){var m=t.getOrdinate(l,f),_=n.getOrdinate(l,f);if(t.getOrdinate(l,f)!==n.getOrdinate(l,f)&&(!P.isNaN(m)||!P.isNaN(_)))return!1}return!0},$e.extend=function(t,n,i){var s=t.create(i,n.getDimension()),l=n.size();if($e.copy(n,0,s,0,l),l>0)for(var f=l;f<i;f++)$e.copy(n,l-1,s,f,1);return s},$e.reverse=function(t){for(var n=t.size()-1,i=Math.trunc(n/2),s=0;s<=i;s++)$e.swap(t,s,n-s)},$e.swap=function(t,n,i){if(n===i)return null;for(var s=0;s<t.getDimension();s++){var l=t.getOrdinate(n,s);t.setOrdinate(n,s,t.getOrdinate(i,s)),t.setOrdinate(i,s,l)}},$e.copy=function(t,n,i,s,l){for(var f=0;f<l;f++)$e.copyCoord(t,n+f,i,s+f)},$e.toString=function(){if(arguments.length===1){var t=arguments[0],n=t.size();if(n===0)return"()";var i=t.getDimension(),s=new Rt;s.append("(");for(var l=0;l<n;l++){l>0&&s.append(" ");for(var f=0;f<i;f++)f>0&&s.append(","),s.append(lr.toString(t.getOrdinate(l,f)))}return s.append(")"),s.toString()}},$e.ensureValidRing=function(t,n){var i=n.size();return i===0?n:i<=3?$e.createClosedRing(t,n,4):n.getOrdinate(0,ut.X)===n.getOrdinate(i-1,ut.X)&&n.getOrdinate(0,ut.Y)===n.getOrdinate(i-1,ut.Y)?n:$e.createClosedRing(t,n,i+1)},$e.createClosedRing=function(t,n,i){var s=t.create(i,n.getDimension()),l=n.size();$e.copy(n,0,s,0,l);for(var f=l;f<i;f++)$e.copy(n,0,s,f,1);return s};var Ge=function(t){function n(s,l){t.call(this,l),this._points=null,this.init(s)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={serialVersionUID:{configurable:!0}};return n.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new at:this._points.expandEnvelope(new at)},n.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},n.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},n.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},n.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];if(!this.isEquivalentClass(s))return!1;var f=s;if(this._points.size()!==f._points.size())return!1;for(var m=0;m<this._points.size();m++)if(!this.equal(this._points.getCoordinate(m),f._points.getCoordinate(m),l))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.normalize=function(){for(var s=0;s<Math.trunc(this._points.size()/2);s++){var l=this._points.size()-1-s;if(!this._points.getCoordinate(s).equals(this._points.getCoordinate(l)))return this._points.getCoordinate(s).compareTo(this._points.getCoordinate(l))>0&&$e.reverse(this._points),null}},n.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},n.prototype.getBoundaryDimension=function(){return this.isClosed()?bt.FALSE:0},n.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},n.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},n.prototype.getDimension=function(){return 1},n.prototype.getLength=function(){return tt.computeLength(this._points)},n.prototype.getNumPoints=function(){return this._points.size()},n.prototype.reverse=function(){var s=this._points.copy();return $e.reverse(s),this.getFactory().createLineString(s)},n.prototype.compareToSameClass=function(){if(arguments.length===1){for(var s=arguments[0],l=0,f=0;l<this._points.size()&&f<s._points.size();){var m=this._points.getCoordinate(l).compareTo(s._points.getCoordinate(f));if(m!==0)return m;l++,f++}return l<this._points.size()?1:f<s._points.size()?-1:0}if(arguments.length===2){var _=arguments[0];return arguments[1].compare(this._points,_._points)}},n.prototype.apply=function(){if(et(arguments[0],B))for(var s=arguments[0],l=0;l<this._points.size();l++)s.filter(this._points.getCoordinate(l));else if(et(arguments[0],Ye)){var f=arguments[0];if(this._points.size()===0)return null;for(var m=0;m<this._points.size()&&(f.filter(this._points,m),!f.isDone());m++);f.isGeometryChanged()&&this.geometryChanged()}else et(arguments[0],je)?arguments[0].filter(this):et(arguments[0],li)&&arguments[0].filter(this)},n.prototype.getBoundary=function(){return new ur(this).getBoundary()},n.prototype.isEquivalentClass=function(s){return s instanceof n},n.prototype.clone=function(){var s=t.prototype.clone.call(this);return s._points=this._points.clone(),s},n.prototype.getCoordinateN=function(s){return this._points.getCoordinate(s)},n.prototype.getGeometryType=function(){return"LineString"},n.prototype.copy=function(){return new n(this._points.copy(),this._factory)},n.prototype.getCoordinateSequence=function(){return this._points},n.prototype.isEmpty=function(){return this._points.size()===0},n.prototype.init=function(s){if(s===null&&(s=this.getFactory().getCoordinateSequenceFactory().create([])),s.size()===1)throw new L("Invalid number of points in LineString (found "+s.size()+" - must be 0 or >= 2)");this._points=s},n.prototype.isCoordinate=function(s){for(var l=0;l<this._points.size();l++)if(this._points.getCoordinate(l).equals(s))return!0;return!1},n.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},n.prototype.getPointN=function(s){return this.getFactory().createPoint(this._points.getCoordinate(s))},n.prototype.interfaces_=function(){return[dn]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(n,i),n}(yt),Bs=function(){};Bs.prototype.interfaces_=function(){return[]},Bs.prototype.getClass=function(){return Bs};var cr=function(t){function n(s,l){t.call(this,l),this._coordinates=s||null,this.init(this._coordinates)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={serialVersionUID:{configurable:!0}};return n.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new at;var s=new at;return s.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),s},n.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},n.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},n.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];return!!this.isEquivalentClass(s)&&(!(!this.isEmpty()||!s.isEmpty())||this.isEmpty()===s.isEmpty()&&this.equal(s.getCoordinate(),this.getCoordinate(),l))}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.normalize=function(){},n.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},n.prototype.getBoundaryDimension=function(){return bt.FALSE},n.prototype.getDimension=function(){return 0},n.prototype.getNumPoints=function(){return this.isEmpty()?0:1},n.prototype.reverse=function(){return this.copy()},n.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},n.prototype.compareToSameClass=function(){if(arguments.length===1){var s=arguments[0];return this.getCoordinate().compareTo(s.getCoordinate())}if(arguments.length===2){var l=arguments[0];return arguments[1].compare(this._coordinates,l._coordinates)}},n.prototype.apply=function(){if(et(arguments[0],B)){var s=arguments[0];if(this.isEmpty())return null;s.filter(this.getCoordinate())}else if(et(arguments[0],Ye)){var l=arguments[0];if(this.isEmpty())return null;l.filter(this._coordinates,0),l.isGeometryChanged()&&this.geometryChanged()}else et(arguments[0],je)?arguments[0].filter(this):et(arguments[0],li)&&arguments[0].filter(this)},n.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},n.prototype.clone=function(){var s=t.prototype.clone.call(this);return s._coordinates=this._coordinates.clone(),s},n.prototype.getGeometryType=function(){return"Point"},n.prototype.copy=function(){return new n(this._coordinates.copy(),this._factory)},n.prototype.getCoordinateSequence=function(){return this._coordinates},n.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},n.prototype.isEmpty=function(){return this._coordinates.size()===0},n.prototype.init=function(s){s===null&&(s=this.getFactory().getCoordinateSequenceFactory().create([])),_t.isTrue(s.size()<=1),this._coordinates=s},n.prototype.isSimple=function(){return!0},n.prototype.interfaces_=function(){return[Bs]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(n,i),n}(yt),Gi=function(){};Gi.prototype.interfaces_=function(){return[]},Gi.prototype.getClass=function(){return Gi};var an=function(t){function n(s,l,f){if(t.call(this,f),this._shell=null,this._holes=null,s===null&&(s=this.getFactory().createLinearRing()),l===null&&(l=[]),t.hasNullElements(l))throw new L("holes must not contain null elements");if(s.isEmpty()&&t.hasNonEmptyElements(l))throw new L("shell is empty but holes are not");this._shell=s,this._holes=l}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={serialVersionUID:{configurable:!0}};return n.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},n.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},n.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var s=new Array(this.getNumPoints()).fill(null),l=-1,f=this._shell.getCoordinates(),m=0;m<f.length;m++)s[++l]=f[m];for(var _=0;_<this._holes.length;_++)for(var S=this._holes[_].getCoordinates(),O=0;O<S.length;O++)s[++l]=S[O];return s},n.prototype.getArea=function(){var s=0;s+=Math.abs(tt.signedArea(this._shell.getCoordinateSequence()));for(var l=0;l<this._holes.length;l++)s-=Math.abs(tt.signedArea(this._holes[l].getCoordinateSequence()));return s},n.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var s=this._shell.getCoordinateSequence(),l=this.getEnvelopeInternal(),f=0;f<5;f++){var m=s.getX(f);if(m!==l.getMinX()&&m!==l.getMaxX())return!1;var _=s.getY(f);if(_!==l.getMinY()&&_!==l.getMaxY())return!1}for(var S=s.getX(0),O=s.getY(0),H=1;H<=4;H++){var X=s.getX(H),nt=s.getY(H);if(X!==S==(nt!==O))return!1;S=X,O=nt}return!0},n.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];if(!this.isEquivalentClass(s))return!1;var f=s,m=this._shell,_=f._shell;if(!m.equalsExact(_,l)||this._holes.length!==f._holes.length)return!1;for(var S=0;S<this._holes.length;S++)if(!this._holes[S].equalsExact(f._holes[S],l))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var s=0;s<this._holes.length;s++)this.normalize(this._holes[s],!1);We.sort(this._holes)}else if(arguments.length===2){var l=arguments[0],f=arguments[1];if(l.isEmpty())return null;var m=new Array(l.getCoordinates().length-1).fill(null);Ee.arraycopy(l.getCoordinates(),0,m,0,m.length);var _=J.minCoordinate(l.getCoordinates());J.scroll(m,_),Ee.arraycopy(m,0,l.getCoordinates(),0,m.length),l.getCoordinates()[m.length]=m[0],tt.isCCW(l.getCoordinates())===f&&J.reverse(l.getCoordinates())}},n.prototype.getCoordinate=function(){return this._shell.getCoordinate()},n.prototype.getNumInteriorRing=function(){return this._holes.length},n.prototype.getBoundaryDimension=function(){return 1},n.prototype.getDimension=function(){return 2},n.prototype.getLength=function(){var s=0;s+=this._shell.getLength();for(var l=0;l<this._holes.length;l++)s+=this._holes[l].getLength();return s},n.prototype.getNumPoints=function(){for(var s=this._shell.getNumPoints(),l=0;l<this._holes.length;l++)s+=this._holes[l].getNumPoints();return s},n.prototype.reverse=function(){var s=this.copy();s._shell=this._shell.copy().reverse(),s._holes=new Array(this._holes.length).fill(null);for(var l=0;l<this._holes.length;l++)s._holes[l]=this._holes[l].copy().reverse();return s},n.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},n.prototype.compareToSameClass=function(){if(arguments.length===1){var s=arguments[0],l=this._shell,f=s._shell;return l.compareToSameClass(f)}if(arguments.length===2){var m=arguments[0],_=arguments[1],S=m,O=this._shell,H=S._shell,X=O.compareToSameClass(H,_);if(X!==0)return X;for(var nt=this.getNumInteriorRing(),rt=S.getNumInteriorRing(),lt=0;lt<nt&<<rt;){var gt=this.getInteriorRingN(lt),we=S.getInteriorRingN(lt),rn=gt.compareToSameClass(we,_);if(rn!==0)return rn;lt++}return lt<nt?1:lt<rt?-1:0}},n.prototype.apply=function(s){if(et(s,B)){this._shell.apply(s);for(var l=0;l<this._holes.length;l++)this._holes[l].apply(s)}else if(et(s,Ye)){if(this._shell.apply(s),!s.isDone())for(var f=0;f<this._holes.length&&(this._holes[f].apply(s),!s.isDone());f++);s.isGeometryChanged()&&this.geometryChanged()}else if(et(s,je))s.filter(this);else if(et(s,li)){s.filter(this),this._shell.apply(s);for(var m=0;m<this._holes.length;m++)this._holes[m].apply(s)}},n.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var s=new Array(this._holes.length+1).fill(null);s[0]=this._shell;for(var l=0;l<this._holes.length;l++)s[l+1]=this._holes[l];return s.length<=1?this.getFactory().createLinearRing(s[0].getCoordinateSequence()):this.getFactory().createMultiLineString(s)},n.prototype.clone=function(){var s=t.prototype.clone.call(this);s._shell=this._shell.clone(),s._holes=new Array(this._holes.length).fill(null);for(var l=0;l<this._holes.length;l++)s._holes[l]=this._holes[l].clone();return s},n.prototype.getGeometryType=function(){return"Polygon"},n.prototype.copy=function(){for(var s=this._shell.copy(),l=new Array(this._holes.length).fill(null),f=0;f<l.length;f++)l[f]=this._holes[f].copy();return new n(s,l,this._factory)},n.prototype.getExteriorRing=function(){return this._shell},n.prototype.isEmpty=function(){return this._shell.isEmpty()},n.prototype.getInteriorRingN=function(s){return this._holes[s]},n.prototype.interfaces_=function(){return[Gi]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(n,i),n}(yt),Zo=function(t){function n(){t.apply(this,arguments)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={serialVersionUID:{configurable:!0}};return n.prototype.getSortIndex=function(){return yt.SORTINDEX_MULTIPOINT},n.prototype.isValid=function(){return!0},n.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];return!!this.isEquivalentClass(s)&&t.prototype.equalsExact.call(this,s,l)}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.getCoordinate=function(){if(arguments.length===1){var s=arguments[0];return this._geometries[s].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},n.prototype.getBoundaryDimension=function(){return bt.FALSE},n.prototype.getDimension=function(){return 0},n.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},n.prototype.getGeometryType=function(){return"MultiPoint"},n.prototype.copy=function(){for(var s=new Array(this._geometries.length).fill(null),l=0;l<s.length;l++)s[l]=this._geometries[l].copy();return new n(s,this._factory)},n.prototype.interfaces_=function(){return[Bs]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(n,i),n}(Fe),ci=function(t){function n(s,l){s instanceof C&&l instanceof Tt&&(s=l.getCoordinateSequenceFactory().create(s)),t.call(this,s,l),this.validateConstruction()}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return n.prototype.getSortIndex=function(){return yt.SORTINDEX_LINEARRING},n.prototype.getBoundaryDimension=function(){return bt.FALSE},n.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},n.prototype.reverse=function(){var s=this._points.copy();return $e.reverse(s),this.getFactory().createLinearRing(s)},n.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new L("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<n.MINIMUM_VALID_SIZE)throw new L("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},n.prototype.getGeometryType=function(){return"LinearRing"},n.prototype.copy=function(){return new n(this._points.copy(),this._factory)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},i.MINIMUM_VALID_SIZE.get=function(){return 4},i.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(n,i),n}(Ge),hi=function(t){function n(){t.apply(this,arguments)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={serialVersionUID:{configurable:!0}};return n.prototype.getSortIndex=function(){return yt.SORTINDEX_MULTIPOLYGON},n.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];return!!this.isEquivalentClass(s)&&t.prototype.equalsExact.call(this,s,l)}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.getBoundaryDimension=function(){return 1},n.prototype.getDimension=function(){return 2},n.prototype.reverse=function(){for(var s=this._geometries.length,l=new Array(s).fill(null),f=0;f<this._geometries.length;f++)l[f]=this._geometries[f].reverse();return this.getFactory().createMultiPolygon(l)},n.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var s=new V,l=0;l<this._geometries.length;l++)for(var f=this._geometries[l].getBoundary(),m=0;m<f.getNumGeometries();m++)s.add(f.getGeometryN(m));var _=new Array(s.size()).fill(null);return this.getFactory().createMultiLineString(s.toArray(_))},n.prototype.getGeometryType=function(){return"MultiPolygon"},n.prototype.copy=function(){for(var s=new Array(this._geometries.length).fill(null),l=0;l<s.length;l++)s[l]=this._geometries[l].copy();return new n(s,this._factory)},n.prototype.interfaces_=function(){return[Gi]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(n,i),n}(Fe),Nr=function(t){this._factory=t||null,this._isUserDataCopied=!1},Ca={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Nr.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},Nr.prototype.edit=function(t,n){if(t===null)return null;var i=this.editInternal(t,n);return this._isUserDataCopied&&i.setUserData(t.getUserData()),i},Nr.prototype.editInternal=function(t,n){return this._factory===null&&(this._factory=t.getFactory()),t instanceof Fe?this.editGeometryCollection(t,n):t instanceof an?this.editPolygon(t,n):t instanceof cr?n.edit(t,this._factory):t instanceof Ge?n.edit(t,this._factory):(_t.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},Nr.prototype.editGeometryCollection=function(t,n){for(var i=n.edit(t,this._factory),s=new V,l=0;l<i.getNumGeometries();l++){var f=this.edit(i.getGeometryN(l),n);f===null||f.isEmpty()||s.add(f)}return i.getClass()===Zo?this._factory.createMultiPoint(s.toArray([])):i.getClass()===Rr?this._factory.createMultiLineString(s.toArray([])):i.getClass()===hi?this._factory.createMultiPolygon(s.toArray([])):this._factory.createGeometryCollection(s.toArray([]))},Nr.prototype.editPolygon=function(t,n){var i=n.edit(t,this._factory);if(i===null&&(i=this._factory.createPolygon(null)),i.isEmpty())return i;var s=this.edit(i.getExteriorRing(),n);if(s===null||s.isEmpty())return this._factory.createPolygon();for(var l=new V,f=0;f<i.getNumInteriorRing();f++){var m=this.edit(i.getInteriorRingN(f),n);m===null||m.isEmpty()||l.add(m)}return this._factory.createPolygon(s,l.toArray([]))},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr},Nr.GeometryEditorOperation=function(){},Ca.NoOpGeometryOperation.get=function(){return zs},Ca.CoordinateOperation.get=function(){return ks},Ca.CoordinateSequenceOperation.get=function(){return Gs},Object.defineProperties(Nr,Ca);var zs=function(){};zs.prototype.edit=function(t,n){return t},zs.prototype.interfaces_=function(){return[Nr.GeometryEditorOperation]},zs.prototype.getClass=function(){return zs};var ks=function(){};ks.prototype.edit=function(t,n){var i=this.editCoordinates(t.getCoordinates(),t);return i===null?t:t instanceof ci?n.createLinearRing(i):t instanceof Ge?n.createLineString(i):t instanceof cr?i.length>0?n.createPoint(i[0]):n.createPoint():t},ks.prototype.interfaces_=function(){return[Nr.GeometryEditorOperation]},ks.prototype.getClass=function(){return ks};var Gs=function(){};Gs.prototype.edit=function(t,n){return t instanceof ci?n.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Ge?n.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof cr?n.createPoint(this.edit(t.getCoordinateSequence(),t)):t},Gs.prototype.interfaces_=function(){return[Nr.GeometryEditorOperation]},Gs.prototype.getClass=function(){return Gs};var Ze=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 t=arguments[0];this._coordinates=new Array(t).fill(null);for(var n=0;n<t;n++)this._coordinates[n]=new C}else if(et(arguments[0],ut)){var i=arguments[0];if(i===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=i.getDimension(),this._coordinates=new Array(i.size()).fill(null);for(var s=0;s<this._coordinates.length;s++)this._coordinates[s]=i.getCoordinateCopy(s)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var l=arguments[0],f=arguments[1];this._coordinates=l,this._dimension=f,l===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var m=arguments[0],_=arguments[1];this._coordinates=new Array(m).fill(null),this._dimension=_;for(var S=0;S<m;S++)this._coordinates[S]=new C}}},Dh={serialVersionUID:{configurable:!0}};Ze.prototype.setOrdinate=function(t,n,i){switch(n){case ut.X:this._coordinates[t].x=i;break;case ut.Y:this._coordinates[t].y=i;break;case ut.Z:this._coordinates[t].z=i;break;default:throw new L("invalid ordinateIndex")}},Ze.prototype.size=function(){return this._coordinates.length},Ze.prototype.getOrdinate=function(t,n){switch(n){case ut.X:return this._coordinates[t].x;case ut.Y:return this._coordinates[t].y;case ut.Z:return this._coordinates[t].z}return P.NaN},Ze.prototype.getCoordinate=function(){if(arguments.length===1){var t=arguments[0];return this._coordinates[t]}if(arguments.length===2){var n=arguments[0],i=arguments[1];i.x=this._coordinates[n].x,i.y=this._coordinates[n].y,i.z=this._coordinates[n].z}},Ze.prototype.getCoordinateCopy=function(t){return new C(this._coordinates[t])},Ze.prototype.getDimension=function(){return this._dimension},Ze.prototype.getX=function(t){return this._coordinates[t].x},Ze.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),n=0;n<this._coordinates.length;n++)t[n]=this._coordinates[n].clone();return new Ze(t,this._dimension)},Ze.prototype.expandEnvelope=function(t){for(var n=0;n<this._coordinates.length;n++)t.expandToInclude(this._coordinates[n]);return t},Ze.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),n=0;n<this._coordinates.length;n++)t[n]=this._coordinates[n].copy();return new Ze(t,this._dimension)},Ze.prototype.toString=function(){if(this._coordinates.length>0){var t=new Rt(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var n=1;n<this._coordinates.length;n++)t.append(", "),t.append(this._coordinates[n]);return t.append(")"),t.toString()}return"()"},Ze.prototype.getY=function(t){return this._coordinates[t].y},Ze.prototype.toCoordinateArray=function(){return this._coordinates},Ze.prototype.interfaces_=function(){return[ut,e]},Ze.prototype.getClass=function(){return Ze},Dh.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(Ze,Dh);var fi=function(){},Qu={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};fi.prototype.readResolve=function(){return fi.instance()},fi.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new Ze(t)}if(et(arguments[0],ut)){var n=arguments[0];return new Ze(n)}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];return s>3&&(s=3),s<2?new Ze(i):new Ze(i,s)}},fi.prototype.interfaces_=function(){return[dt,e]},fi.prototype.getClass=function(){return fi},fi.instance=function(){return fi.instanceObject},Qu.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Qu.instanceObject.get=function(){return new fi},Object.defineProperties(fi,Qu);var Oh=function(t){function n(){t.call(this),this.map_=new Map}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.get=function(i){return this.map_.get(i)||null},n.prototype.put=function(i,s){return this.map_.set(i,s),s},n.prototype.values=function(){for(var i=new V,s=this.map_.values(),l=s.next();!l.done;)i.add(l.value),l=s.next();return i},n.prototype.entrySet=function(){var i=new En;return this.map_.entries().forEach(function(s){return i.add(s)}),i},n.prototype.size=function(){return this.map_.size()},n}(At),se=function t(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=t.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Jr){var n=arguments[0];this._modelType=n,n===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var i=arguments[0];this._modelType=t.FIXED,this.setScale(i)}else if(arguments[0]instanceof t){var s=arguments[0];this._modelType=s._modelType,this._scale=s._scale}}},ju={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};se.prototype.equals=function(t){if(!(t instanceof se))return!1;var n=t;return this._modelType===n._modelType&&this._scale===n._scale},se.prototype.compareTo=function(t){var n=t,i=this.getMaximumSignificantDigits(),s=n.getMaximumSignificantDigits();return new it(i).compareTo(new it(s))},se.prototype.getScale=function(){return this._scale},se.prototype.isFloating=function(){return this._modelType===se.FLOATING||this._modelType===se.FLOATING_SINGLE},se.prototype.getType=function(){return this._modelType},se.prototype.toString=function(){var t="UNKNOWN";return this._modelType===se.FLOATING?t="Floating":this._modelType===se.FLOATING_SINGLE?t="Floating-Single":this._modelType===se.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},se.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];return P.isNaN(t)||this._modelType===se.FLOATING_SINGLE?t:this._modelType===se.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof C){var n=arguments[0];if(this._modelType===se.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}},se.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===se.FLOATING?t=16:this._modelType===se.FLOATING_SINGLE?t=6:this._modelType===se.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},se.prototype.setScale=function(t){this._scale=Math.abs(t)},se.prototype.interfaces_=function(){return[e,k]},se.prototype.getClass=function(){return se},se.mostPrecise=function(t,n){return t.compareTo(n)>=0?t:n},ju.serialVersionUID.get=function(){return 7777263578777804e3},ju.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(se,ju);var Jr=function t(n){this._name=n||null,t.nameToTypeMap.put(n,this)},tl={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Jr.prototype.readResolve=function(){return Jr.nameToTypeMap.get(this._name)},Jr.prototype.toString=function(){return this._name},Jr.prototype.interfaces_=function(){return[e]},Jr.prototype.getClass=function(){return Jr},tl.serialVersionUID.get=function(){return-552860263173159e4},tl.nameToTypeMap.get=function(){return new Oh},Object.defineProperties(Jr,tl),se.Type=Jr,se.FIXED=new Jr("FIXED"),se.FLOATING=new Jr("FLOATING"),se.FLOATING_SINGLE=new Jr("FLOATING SINGLE");var Tt=function t(){this._precisionModel=new se,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?et(arguments[0],dt)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof se&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},Fh={serialVersionUID:{configurable:!0}};Tt.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new C(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new C(t.getMinX(),t.getMinY()),new C(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new C(t.getMinX(),t.getMinY()),new C(t.getMinX(),t.getMaxY()),new C(t.getMaxX(),t.getMaxY()),new C(t.getMaxX(),t.getMinY()),new C(t.getMinX(),t.getMinY())]),null)},Tt.prototype.createLineString=function(t){return t?t instanceof Array?new Ge(this.getCoordinateSequenceFactory().create(t),this):et(t,ut)?new Ge(t,this):void 0:new Ge(this.getCoordinateSequenceFactory().create([]),this)},Tt.prototype.createMultiLineString=function(){if(arguments.length===0)return new Rr(null,this);if(arguments.length===1){var t=arguments[0];return new Rr(t,this)}},Tt.prototype.buildGeometry=function(t){for(var n=null,i=!1,s=!1,l=t.iterator();l.hasNext();){var f=l.next(),m=f.getClass();n===null&&(n=m),m!==n&&(i=!0),f.isGeometryCollectionOrDerived()&&(s=!0)}if(n===null)return this.createGeometryCollection();if(i||s)return this.createGeometryCollection(Tt.toGeometryArray(t));var _=t.iterator().next();if(t.size()>1){if(_ instanceof an)return this.createMultiPolygon(Tt.toPolygonArray(t));if(_ instanceof Ge)return this.createMultiLineString(Tt.toLineStringArray(t));if(_ instanceof cr)return this.createMultiPoint(Tt.toPointArray(t));_t.shouldNeverReachHere("Unhandled class: "+_.getClass().getName())}return _},Tt.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)},Tt.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof C){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}if(et(arguments[0],ut)){var n=arguments[0];return new cr(n,this)}}},Tt.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Tt.prototype.createPolygon=function(){if(arguments.length===0)return new an(null,null,this);if(arguments.length===1){if(et(arguments[0],ut)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof ci){var i=arguments[0];return this.createPolygon(i,null)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return new an(s,l,this)}},Tt.prototype.getSRID=function(){return this._SRID},Tt.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Fe(null,this);if(arguments.length===1){var t=arguments[0];return new Fe(t,this)}},Tt.prototype.createGeometry=function(t){return new Nr(this).edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})},Tt.prototype.getPrecisionModel=function(){return this._precisionModel},Tt.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}if(et(arguments[0],ut)){var n=arguments[0];return new ci(n,this)}}},Tt.prototype.createMultiPolygon=function(){if(arguments.length===0)return new hi(null,this);if(arguments.length===1){var t=arguments[0];return new hi(t,this)}},Tt.prototype.createMultiPoint=function(){if(arguments.length===0)return new Zo(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new Zo(t,this)}if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(et(arguments[0],ut)){var i=arguments[0];if(i===null)return this.createMultiPoint(new Array(0).fill(null));for(var s=new Array(i.size()).fill(null),l=0;l<i.size();l++){var f=this.getCoordinateSequenceFactory().create(1,i.getDimension());$e.copy(i,l,f,0,1),s[l]=this.createPoint(f)}return this.createMultiPoint(s)}}},Tt.prototype.interfaces_=function(){return[e]},Tt.prototype.getClass=function(){return Tt},Tt.toMultiPolygonArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.toGeometryArray=function(t){if(t===null)return null;var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.getDefaultCoordinateSequenceFactory=function(){return fi.instance()},Tt.toMultiLineStringArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.toLineStringArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.toMultiPointArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.toLinearRingArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.toPointArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.toPolygonArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.createPointFromInternalCoord=function(t,n){return n.getPrecisionModel().makePrecise(t),n.getFactory().createPoint(t)},Fh.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(Tt,Fh);var A0=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Ia=function(t){this.geometryFactory=t||new Tt};Ia.prototype.read=function(t){var n,i=(n=typeof t=="string"?JSON.parse(t):t).type;if(!Kr[i])throw new Error("Unknown GeoJSON type: "+n.type);return A0.indexOf(i)!==-1?Kr[i].apply(this,[n.coordinates]):i==="GeometryCollection"?Kr[i].apply(this,[n.geometries]):Kr[i].apply(this,[n])},Ia.prototype.write=function(t){var n=t.getGeometryType();if(!Ci[n])throw new Error("Geometry is not supported");return Ci[n].apply(this,[t])};var Kr={Feature:function(t){var n={};for(var i in t)n[i]=t[i];if(t.geometry){var s=t.geometry.type;if(!Kr[s])throw new Error("Unknown GeoJSON type: "+t.type);n.geometry=this.read(t.geometry)}return t.bbox&&(n.bbox=Kr.bbox.apply(this,[t.bbox])),n},FeatureCollection:function(t){var n={};if(t.features){n.features=[];for(var i=0;i<t.features.length;++i)n.features.push(this.read(t.features[i]))}return t.bbox&&(n.bbox=this.parse.bbox.apply(this,[t.bbox])),n},coordinates:function(t){for(var n=[],i=0;i<t.length;++i){var s=t[i];n.push(new C(s[0],s[1]))}return n},bbox:function(t){return this.geometryFactory.createLinearRing([new C(t[0],t[1]),new C(t[2],t[1]),new C(t[2],t[3]),new C(t[0],t[3]),new C(t[0],t[1])])},Point:function(t){var n=new C(t[0],t[1]);return this.geometryFactory.createPoint(n)},MultiPoint:function(t){for(var n=[],i=0;i<t.length;++i)n.push(Kr.Point.apply(this,[t[i]]));return this.geometryFactory.createMultiPoint(n)},LineString:function(t){var n=Kr.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(n)},MultiLineString:function(t){for(var n=[],i=0;i<t.length;++i)n.push(Kr.LineString.apply(this,[t[i]]));return this.geometryFactory.createMultiLineString(n)},Polygon:function(t){for(var n=Kr.coordinates.apply(this,[t[0]]),i=this.geometryFactory.createLinearRing(n),s=[],l=1;l<t.length;++l){var f=t[l],m=Kr.coordinates.apply(this,[f]),_=this.geometryFactory.createLinearRing(m);s.push(_)}return this.geometryFactory.createPolygon(i,s)},MultiPolygon:function(t){for(var n=[],i=0;i<t.length;++i){var s=t[i];n.push(Kr.Polygon.apply(this,[s]))}return this.geometryFactory.createMultiPolygon(n)},GeometryCollection:function(t){for(var n=[],i=0;i<t.length;++i){var s=t[i];n.push(this.read(s))}return this.geometryFactory.createGeometryCollection(n)}},Ci={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:Ci.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var s=t._geometries[i],l=Ci.Point.apply(this,[s]);n.push(l.coordinates)}return{type:"MultiPoint",coordinates:n}},LineString:function(t){for(var n=[],i=t.getCoordinates(),s=0;s<i.length;++s){var l=i[s];n.push(Ci.coordinate.apply(this,[l]))}return{type:"LineString",coordinates:n}},MultiLineString:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var s=t._geometries[i],l=Ci.LineString.apply(this,[s]);n.push(l.coordinates)}return{type:"MultiLineString",coordinates:n}},Polygon:function(t){var n=[],i=Ci.LineString.apply(this,[t._shell]);n.push(i.coordinates);for(var s=0;s<t._holes.length;++s){var l=t._holes[s],f=Ci.LineString.apply(this,[l]);n.push(f.coordinates)}return{type:"Polygon",coordinates:n}},MultiPolygon:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var s=t._geometries[i],l=Ci.Polygon.apply(this,[s]);n.push(l.coordinates)}return{type:"MultiPolygon",coordinates:n}},GeometryCollection:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var s=t._geometries[i],l=s.getGeometryType();n.push(Ci[l].apply(this,[s]))}return{type:"GeometryCollection",geometries:n}}},el=function(t){this.geometryFactory=t||new Tt,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new Ia(this.geometryFactory)};el.prototype.read=function(t){var n=this.parser.read(t);return this.precisionModel.getType()===se.FIXED&&this.reducePrecision(n),n},el.prototype.reducePrecision=function(t){var n,i;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(n=0,i=t.points.length;n<i;n++)this.precisionModel.makePrecise(t.points[n]);else if(t.geometries)for(n=0,i=t.geometries.length;n<i;n++)this.reducePrecision(t.geometries[n])};var Uh=function(){this.parser=new Ia(this.geometryFactory)};Uh.prototype.write=function(t){return this.parser.write(t)};var j=function(){},Pa={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};j.prototype.interfaces_=function(){return[]},j.prototype.getClass=function(){return j},j.opposite=function(t){return t===j.LEFT?j.RIGHT:t===j.RIGHT?j.LEFT:t},Pa.ON.get=function(){return 0},Pa.LEFT.get=function(){return 1},Pa.RIGHT.get=function(){return 2},Object.defineProperties(j,Pa),(D.prototype=new Error).name="EmptyStackException",(b.prototype=new Z).add=function(t){return this.array_.push(t),!0},b.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},b.prototype.push=function(t){return this.array_.push(t),t},b.prototype.pop=function(t){if(this.array_.length===0)throw new D;return this.array_.pop()},b.prototype.peek=function(){if(this.array_.length===0)throw new D;return this.array_[this.array_.length-1]},b.prototype.empty=function(){return this.array_.length===0},b.prototype.isEmpty=function(){return this.empty()},b.prototype.search=function(t){return this.array_.indexOf(t)},b.prototype.size=function(){return this.array_.length},b.prototype.toArray=function(){for(var t=[],n=0,i=this.array_.length;n<i;n++)t.push(this.array_[n]);return t};var Qr=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Qr.prototype.getCoordinate=function(){return this._minCoord},Qr.prototype.getRightmostSide=function(t,n){var i=this.getRightmostSideOfSegment(t,n);return i<0&&(i=this.getRightmostSideOfSegment(t,n-1)),i<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),i},Qr.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();_t.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var n=t[this._minIndex-1],i=t[this._minIndex+1],s=tt.computeOrientation(this._minCoord,i,n),l=!1;(n.y<this._minCoord.y&&i.y<this._minCoord.y&&s===tt.COUNTERCLOCKWISE||n.y>this._minCoord.y&&i.y>this._minCoord.y&&s===tt.CLOCKWISE)&&(l=!0),l&&(this._minIndex=this._minIndex-1)},Qr.prototype.getRightmostSideOfSegment=function(t,n){var i=t.getEdge().getCoordinates();if(n<0||n+1>=i.length||i[n].y===i[n+1].y)return-1;var s=j.LEFT;return i[n].y<i[n+1].y&&(s=j.RIGHT),s},Qr.prototype.getEdge=function(){return this._orientedDe},Qr.prototype.checkForRightmostCoordinate=function(t){for(var n=t.getEdge().getCoordinates(),i=0;i<n.length-1;i++)(this._minCoord===null||n[i].x>this._minCoord.x)&&(this._minDe=t,this._minIndex=i,this._minCoord=n[i])},Qr.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},Qr.prototype.findEdge=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isForward()&&this.checkForRightmostCoordinate(i)}_t.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)===j.LEFT&&(this._orientedDe=this._minDe.getSym())},Qr.prototype.interfaces_=function(){return[]},Qr.prototype.getClass=function(){return Qr};var Ii=function(t){function n(i,s){t.call(this,n.msgWithCoord(i,s)),this.pt=s?new C(s):null,this.name="TopologyException"}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.getCoordinate=function(){return this.pt},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n.msgWithCoord=function(i,s){return s?i:i+" [ "+s+" ]"},n}(Cn),Ra=function(){this.array_=[]};Ra.prototype.addLast=function(t){this.array_.push(t)},Ra.prototype.removeFirst=function(){return this.array_.shift()},Ra.prototype.isEmpty=function(){return this.array_.length===0};var Bn=function(){this._finder=null,this._dirEdgeList=new V,this._nodes=new V,this._rightMostCoord=null,this._env=null,this._finder=new Qr};Bn.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},Bn.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Bn.prototype.computeNodeDepth=function(t){for(var n=null,i=t.getEdges().iterator();i.hasNext();){var s=i.next();if(s.isVisited()||s.getSym().isVisited()){n=s;break}}if(n===null)throw new Ii("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(n);for(var l=t.getEdges().iterator();l.hasNext();){var f=l.next();f.setVisited(!0),this.copySymDepths(f)}},Bn.prototype.computeDepth=function(t){this.clearVisitedEdges();var n=this._finder.getEdge();n.setEdgeDepths(j.RIGHT,t),this.copySymDepths(n),this.computeDepths(n)},Bn.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Bn.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var n=t.next();n.getDepth(j.RIGHT)>=1&&n.getDepth(j.LEFT)<=0&&!n.isInteriorAreaEdge()&&n.setInResult(!0)}},Bn.prototype.computeDepths=function(t){var n=new En,i=new Ra,s=t.getNode();for(i.addLast(s),n.add(s),t.setVisited(!0);!i.isEmpty();){var l=i.removeFirst();n.add(l),this.computeNodeDepth(l);for(var f=l.getEdges().iterator();f.hasNext();){var m=f.next().getSym();if(!m.isVisited()){var _=m.getNode();n.contains(_)||(i.addLast(_),n.add(_))}}}},Bn.prototype.compareTo=function(t){var n=t;return this._rightMostCoord.x<n._rightMostCoord.x?-1:this._rightMostCoord.x>n._rightMostCoord.x?1:0},Bn.prototype.getEnvelope=function(){if(this._env===null){for(var t=new at,n=this._dirEdgeList.iterator();n.hasNext();)for(var i=n.next().getEdge().getCoordinates(),s=0;s<i.length-1;s++)t.expandToInclude(i[s]);this._env=t}return this._env},Bn.prototype.addReachable=function(t){var n=new b;for(n.add(t);!n.empty();){var i=n.pop();this.add(i,n)}},Bn.prototype.copySymDepths=function(t){var n=t.getSym();n.setDepth(j.LEFT,t.getDepth(j.RIGHT)),n.setDepth(j.RIGHT,t.getDepth(j.LEFT))},Bn.prototype.add=function(t,n){t.setVisited(!0),this._nodes.add(t);for(var i=t.getEdges().iterator();i.hasNext();){var s=i.next();this._dirEdgeList.add(s);var l=s.getSym().getNode();l.isVisited()||n.push(l)}},Bn.prototype.getNodes=function(){return this._nodes},Bn.prototype.getDirectedEdges=function(){return this._dirEdgeList},Bn.prototype.interfaces_=function(){return[k]},Bn.prototype.getClass=function(){return Bn};var Ie=function t(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];this.init(n.length)}else if(Number.isInteger(arguments[0])){var i=arguments[0];this.init(1),this.location[j.ON]=i}else if(arguments[0]instanceof t){var s=arguments[0];if(this.init(s.location.length),s!==null)for(var l=0;l<this.location.length;l++)this.location[l]=s.location[l]}}else if(arguments.length===3){var f=arguments[0],m=arguments[1],_=arguments[2];this.init(3),this.location[j.ON]=f,this.location[j.LEFT]=m,this.location[j.RIGHT]=_}};Ie.prototype.setAllLocations=function(t){for(var n=0;n<this.location.length;n++)this.location[n]=t},Ie.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==F.NONE)return!1;return!0},Ie.prototype.setAllLocationsIfNull=function(t){for(var n=0;n<this.location.length;n++)this.location[n]===F.NONE&&(this.location[n]=t)},Ie.prototype.isLine=function(){return this.location.length===1},Ie.prototype.merge=function(t){if(t.location.length>this.location.length){var n=new Array(3).fill(null);n[j.ON]=this.location[j.ON],n[j.LEFT]=F.NONE,n[j.RIGHT]=F.NONE,this.location=n}for(var i=0;i<this.location.length;i++)this.location[i]===F.NONE&&i<t.location.length&&(this.location[i]=t.location[i])},Ie.prototype.getLocations=function(){return this.location},Ie.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[j.LEFT];this.location[j.LEFT]=this.location[j.RIGHT],this.location[j.RIGHT]=t},Ie.prototype.toString=function(){var t=new Rt;return this.location.length>1&&t.append(F.toLocationSymbol(this.location[j.LEFT])),t.append(F.toLocationSymbol(this.location[j.ON])),this.location.length>1&&t.append(F.toLocationSymbol(this.location[j.RIGHT])),t.toString()},Ie.prototype.setLocations=function(t,n,i){this.location[j.ON]=t,this.location[j.LEFT]=n,this.location[j.RIGHT]=i},Ie.prototype.get=function(t){return t<this.location.length?this.location[t]:F.NONE},Ie.prototype.isArea=function(){return this.location.length>1},Ie.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===F.NONE)return!0;return!1},Ie.prototype.setLocation=function(){if(arguments.length===1){var t=arguments[0];this.setLocation(j.ON,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.location[n]=i}},Ie.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(F.NONE)},Ie.prototype.isEqualOnSide=function(t,n){return this.location[n]===t.location[n]},Ie.prototype.allPositionsEqual=function(t){for(var n=0;n<this.location.length;n++)if(this.location[n]!==t)return!1;return!0},Ie.prototype.interfaces_=function(){return[]},Ie.prototype.getClass=function(){return Ie};var Me=function t(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var n=arguments[0];this.elt[0]=new Ie(n),this.elt[1]=new Ie(n)}else if(arguments[0]instanceof t){var i=arguments[0];this.elt[0]=new Ie(i.elt[0]),this.elt[1]=new Ie(i.elt[1])}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.elt[0]=new Ie(F.NONE),this.elt[1]=new Ie(F.NONE),this.elt[s].setLocation(l)}else if(arguments.length===3){var f=arguments[0],m=arguments[1],_=arguments[2];this.elt[0]=new Ie(f,m,_),this.elt[1]=new Ie(f,m,_)}else if(arguments.length===4){var S=arguments[0],O=arguments[1],H=arguments[2],X=arguments[3];this.elt[0]=new Ie(F.NONE,F.NONE,F.NONE),this.elt[1]=new Ie(F.NONE,F.NONE,F.NONE),this.elt[S].setLocations(O,H,X)}};Me.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},Me.prototype.setAllLocations=function(t,n){this.elt[t].setAllLocations(n)},Me.prototype.isNull=function(t){return this.elt[t].isNull()},Me.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setAllLocationsIfNull(i)}},Me.prototype.isLine=function(t){return this.elt[t].isLine()},Me.prototype.merge=function(t){for(var n=0;n<2;n++)this.elt[n]===null&&t.elt[n]!==null?this.elt[n]=new Ie(t.elt[n]):this.elt[n].merge(t.elt[n])},Me.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},Me.prototype.getLocation=function(){if(arguments.length===1){var t=arguments[0];return this.elt[t].get(j.ON)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.elt[n].get(i)}},Me.prototype.toString=function(){var t=new Rt;return this.elt[0]!==null&&(t.append("A:"),t.append(this.elt[0].toString())),this.elt[1]!==null&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},Me.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var t=arguments[0];return this.elt[t].isArea()}},Me.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},Me.prototype.setLocation=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];this.elt[t].setLocation(j.ON,n)}else if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];this.elt[i].setLocation(s,l)}},Me.prototype.isEqualOnSide=function(t,n){return this.elt[0].isEqualOnSide(t.elt[0],n)&&this.elt[1].isEqualOnSide(t.elt[1],n)},Me.prototype.allPositionsEqual=function(t,n){return this.elt[t].allPositionsEqual(n)},Me.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new Ie(this.elt[t].location[0]))},Me.prototype.interfaces_=function(){return[]},Me.prototype.getClass=function(){return Me},Me.toLineLabel=function(t){for(var n=new Me(F.NONE),i=0;i<2;i++)n.setLocation(i,t.getLocation(i));return n};var tn=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new V,this._pts=new V,this._label=new Me(F.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new V,this._geometryFactory=null;var t=arguments[0],n=arguments[1];this._geometryFactory=n,this.computePoints(t),this.computeRing()};tn.prototype.computeRing=function(){if(this._ring!==null)return null;for(var t=new Array(this._pts.size()).fill(null),n=0;n<this._pts.size();n++)t[n]=this._pts.get(n);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=tt.isCCW(this._ring.getCoordinates())},tn.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},tn.prototype.computePoints=function(t){this._startDe=t;var n=t,i=!0;do{if(n===null)throw new Ii("Found null DirectedEdge");if(n.getEdgeRing()===this)throw new Ii("Directed Edge visited twice during ring-building at "+n.getCoordinate());this._edges.add(n);var s=n.getLabel();_t.isTrue(s.isArea()),this.mergeLabel(s),this.addPoints(n.getEdge(),n.isForward(),i),i=!1,this.setEdgeRing(n,this),n=this.getNext(n)}while(n!==this._startDe)},tn.prototype.getLinearRing=function(){return this._ring},tn.prototype.getCoordinate=function(t){return this._pts.get(t)},tn.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var t=this._startDe;do{var n=t.getNode().getEdges().getOutgoingDegree(this);n>this._maxNodeDegree&&(this._maxNodeDegree=n),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2},tn.prototype.addPoints=function(t,n,i){var s=t.getCoordinates();if(n){var l=1;i&&(l=0);for(var f=l;f<s.length;f++)this._pts.add(s[f])}else{var m=s.length-2;i&&(m=s.length-1);for(var _=m;_>=0;_--)this._pts.add(s[_])}},tn.prototype.isHole=function(){return this._isHole},tn.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)},tn.prototype.containsPoint=function(t){var n=this.getLinearRing();if(!n.getEnvelopeInternal().contains(t)||!tt.isPointInRing(t,n.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();)if(i.next().containsPoint(t))return!1;return!0},tn.prototype.addHole=function(t){this._holes.add(t)},tn.prototype.isShell=function(){return this._shell===null},tn.prototype.getLabel=function(){return this._label},tn.prototype.getEdges=function(){return this._edges},tn.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},tn.prototype.getShell=function(){return this._shell},tn.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=n.getLocation(i,j.RIGHT);if(s===F.NONE)return null;if(this._label.getLocation(i)===F.NONE)return this._label.setLocation(i,s),null}},tn.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)},tn.prototype.toPolygon=function(t){for(var n=new Array(this._holes.size()).fill(null),i=0;i<this._holes.size();i++)n[i]=this._holes.get(i).getLinearRing();return t.createPolygon(this.getLinearRing(),n)},tn.prototype.interfaces_=function(){return[]},tn.prototype.getClass=function(){return tn};var T0=function(t){function n(){var i=arguments[0],s=arguments[1];t.call(this,i,s)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.setEdgeRing=function(i,s){i.setMinEdgeRing(s)},n.prototype.getNext=function(i){return i.getNextMin()},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(tn),C0=function(t){function n(){var i=arguments[0],s=arguments[1];t.call(this,i,s)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.buildMinimalRings=function(){var i=new V,s=this._startDe;do{if(s.getMinEdgeRing()===null){var l=new T0(s,this._geometryFactory);i.add(l)}s=s.getNext()}while(s!==this._startDe);return i},n.prototype.setEdgeRing=function(i,s){i.setEdgeRing(s)},n.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var i=this._startDe;do i.getNode().getEdges().linkMinimalDirectedEdges(this),i=i.getNext();while(i!==this._startDe)},n.prototype.getNext=function(i){return i.getNext()},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(tn),_r=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 t=arguments[0];this._label=t}}};_r.prototype.setVisited=function(t){this._isVisited=t},_r.prototype.setInResult=function(t){this._isInResult=t},_r.prototype.isCovered=function(){return this._isCovered},_r.prototype.isCoveredSet=function(){return this._isCoveredSet},_r.prototype.setLabel=function(t){this._label=t},_r.prototype.getLabel=function(){return this._label},_r.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},_r.prototype.updateIM=function(t){_t.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},_r.prototype.isInResult=function(){return this._isInResult},_r.prototype.isVisited=function(){return this._isVisited},_r.prototype.interfaces_=function(){return[]},_r.prototype.getClass=function(){return _r};var Na=function(t){function n(){t.call(this),this._coord=null,this._edges=null;var i=arguments[0],s=arguments[1];this._coord=i,this._edges=s,this._label=new Me(0,F.NONE)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.isIncidentEdgeInResult=function(){for(var i=this.getEdges().getEdges().iterator();i.hasNext();)if(i.next().getEdge().isInResult())return!0;return!1},n.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},n.prototype.getCoordinate=function(){return this._coord},n.prototype.print=function(i){i.println("node "+this._coord+" lbl: "+this._label)},n.prototype.computeIM=function(i){},n.prototype.computeMergedLocation=function(i,s){var l=F.NONE;if(l=this._label.getLocation(s),!i.isNull(s)){var f=i.getLocation(s);l!==F.BOUNDARY&&(l=f)}return l},n.prototype.setLabel=function(){if(arguments.length!==2)return t.prototype.setLabel.apply(this,arguments);var i=arguments[0],s=arguments[1];this._label===null?this._label=new Me(i,s):this._label.setLocation(i,s)},n.prototype.getEdges=function(){return this._edges},n.prototype.mergeLabel=function(){if(arguments[0]instanceof n){var i=arguments[0];this.mergeLabel(i._label)}else if(arguments[0]instanceof Me)for(var s=arguments[0],l=0;l<2;l++){var f=this.computeMergedLocation(s,l);this._label.getLocation(l)===F.NONE&&this._label.setLocation(l,f)}},n.prototype.add=function(i){this._edges.insert(i),i.setNode(this)},n.prototype.setLabelBoundary=function(i){if(this._label===null)return null;var s=F.NONE;this._label!==null&&(s=this._label.getLocation(i));var l=null;switch(s){case F.BOUNDARY:l=F.INTERIOR;break;case F.INTERIOR:default:l=F.BOUNDARY}this._label.setLocation(i,l)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(_r),jr=function(){this.nodeMap=new x,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};jr.prototype.find=function(t){return this.nodeMap.get(t)},jr.prototype.addNode=function(){if(arguments[0]instanceof C){var t=arguments[0],n=this.nodeMap.get(t);return n===null&&(n=this.nodeFact.createNode(t),this.nodeMap.put(t,n)),n}if(arguments[0]instanceof Na){var i=arguments[0],s=this.nodeMap.get(i.getCoordinate());return s===null?(this.nodeMap.put(i.getCoordinate(),i),i):(s.mergeLabel(i),s)}},jr.prototype.print=function(t){for(var n=this.iterator();n.hasNext();)n.next().print(t)},jr.prototype.iterator=function(){return this.nodeMap.values().iterator()},jr.prototype.values=function(){return this.nodeMap.values()},jr.prototype.getBoundaryNodes=function(t){for(var n=new V,i=this.iterator();i.hasNext();){var s=i.next();s.getLabel().getLocation(t)===F.BOUNDARY&&n.add(s)}return n},jr.prototype.add=function(t){var n=t.getCoordinate();this.addNode(n).add(t)},jr.prototype.interfaces_=function(){return[]},jr.prototype.getClass=function(){return jr};var be=function(){},Vs={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};be.prototype.interfaces_=function(){return[]},be.prototype.getClass=function(){return be},be.isNorthern=function(t){return t===be.NE||t===be.NW},be.isOpposite=function(t,n){return t===n?!1:(t-n+4)%4===2},be.commonHalfPlane=function(t,n){if(t===n)return t;if((t-n+4)%4===2)return-1;var i=t<n?t:n;return i===0&&(t>n?t:n)===3?3:i},be.isInHalfPlane=function(t,n){return n===be.SE?t===be.SE||t===be.SW:t===n||t===n+1},be.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];if(t===0&&n===0)throw new L("Cannot compute the quadrant for point ( "+t+", "+n+" )");return t>=0?n>=0?be.NE:be.SE:n>=0?be.NW:be.SW}if(arguments[0]instanceof C&&arguments[1]instanceof C){var i=arguments[0],s=arguments[1];if(s.x===i.x&&s.y===i.y)throw new L("Cannot compute the quadrant for two identical points "+i);return s.x>=i.x?s.y>=i.y?be.NE:be.SE:s.y>=i.y?be.NW:be.SW}},Vs.NE.get=function(){return 0},Vs.NW.get=function(){return 1},Vs.SW.get=function(){return 2},Vs.SE.get=function(){return 3},Object.defineProperties(be,Vs);var In=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 t=arguments[0];this._edge=t}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];this._edge=n,this.init(i,s),this._label=null}else if(arguments.length===4){var l=arguments[0],f=arguments[1],m=arguments[2],_=arguments[3];this._edge=l,this.init(f,m),this._label=_}};In.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:tt.computeOrientation(t._p0,t._p1,this._p1)},In.prototype.getDy=function(){return this._dy},In.prototype.getCoordinate=function(){return this._p0},In.prototype.setNode=function(t){this._node=t},In.prototype.print=function(t){var n=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),s=i.lastIndexOf("."),l=i.substring(s+1);t.print(" "+l+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label)},In.prototype.compareTo=function(t){var n=t;return this.compareDirection(n)},In.prototype.getDirectedCoordinate=function(){return this._p1},In.prototype.getDx=function(){return this._dx},In.prototype.getLabel=function(){return this._label},In.prototype.getEdge=function(){return this._edge},In.prototype.getQuadrant=function(){return this._quadrant},In.prototype.getNode=function(){return this._node},In.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),i=n.lastIndexOf(".");return" "+n.substring(i+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},In.prototype.computeLabel=function(t){},In.prototype.init=function(t,n){this._p0=t,this._p1=n,this._dx=n.x-t.x,this._dy=n.y-t.y,this._quadrant=be.quadrant(this._dx,this._dy),_t.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},In.prototype.interfaces_=function(){return[k]},In.prototype.getClass=function(){return In};var nl=function(t){function n(){var i=arguments[0],s=arguments[1];if(t.call(this,i),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=s,s)this.init(i.getCoordinate(0),i.getCoordinate(1));else{var l=i.getNumPoints()-1;this.init(i.getCoordinate(l),i.getCoordinate(l-1))}this.computeDirectedLabel()}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.getNextMin=function(){return this._nextMin},n.prototype.getDepth=function(i){return this._depth[i]},n.prototype.setVisited=function(i){this._isVisited=i},n.prototype.computeDirectedLabel=function(){this._label=new Me(this._edge.getLabel()),this._isForward||this._label.flip()},n.prototype.getNext=function(){return this._next},n.prototype.setDepth=function(i,s){if(this._depth[i]!==-999&&this._depth[i]!==s)throw new Ii("assigned depths do not match",this.getCoordinate());this._depth[i]=s},n.prototype.isInteriorAreaEdge=function(){for(var i=!0,s=0;s<2;s++)this._label.isArea(s)&&this._label.getLocation(s,j.LEFT)===F.INTERIOR&&this._label.getLocation(s,j.RIGHT)===F.INTERIOR||(i=!1);return i},n.prototype.setNextMin=function(i){this._nextMin=i},n.prototype.print=function(i){t.prototype.print.call(this,i),i.print(" "+this._depth[j.LEFT]+"/"+this._depth[j.RIGHT]),i.print(" ("+this.getDepthDelta()+")"),this._isInResult&&i.print(" inResult")},n.prototype.setMinEdgeRing=function(i){this._minEdgeRing=i},n.prototype.isLineEdge=function(){var i=this._label.isLine(0)||this._label.isLine(1),s=!this._label.isArea(0)||this._label.allPositionsEqual(0,F.EXTERIOR),l=!this._label.isArea(1)||this._label.allPositionsEqual(1,F.EXTERIOR);return i&&s&&l},n.prototype.setEdgeRing=function(i){this._edgeRing=i},n.prototype.getMinEdgeRing=function(){return this._minEdgeRing},n.prototype.getDepthDelta=function(){var i=this._edge.getDepthDelta();return this._isForward||(i=-i),i},n.prototype.setInResult=function(i){this._isInResult=i},n.prototype.getSym=function(){return this._sym},n.prototype.isForward=function(){return this._isForward},n.prototype.getEdge=function(){return this._edge},n.prototype.printEdge=function(i){this.print(i),i.print(" "),this._isForward?this._edge.print(i):this._edge.printReverse(i)},n.prototype.setSym=function(i){this._sym=i},n.prototype.setVisitedEdge=function(i){this.setVisited(i),this._sym.setVisited(i)},n.prototype.setEdgeDepths=function(i,s){var l=this.getEdge().getDepthDelta();this._isForward||(l=-l);var f=1;i===j.LEFT&&(f=-1);var m=j.opposite(i),_=s+l*f;this.setDepth(i,s),this.setDepth(m,_)},n.prototype.getEdgeRing=function(){return this._edgeRing},n.prototype.isInResult=function(){return this._isInResult},n.prototype.setNext=function(i){this._next=i},n.prototype.isVisited=function(){return this._isVisited},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n.depthFactor=function(i,s){return i===F.EXTERIOR&&s===F.INTERIOR?1:i===F.INTERIOR&&s===F.EXTERIOR?-1:0},n}(In),Jo=function(){};Jo.prototype.createNode=function(t){return new Na(t,null)},Jo.prototype.interfaces_=function(){return[]},Jo.prototype.getClass=function(){return Jo};var ze=function(){if(this._edges=new V,this._nodes=null,this._edgeEndList=new V,arguments.length===0)this._nodes=new jr(new Jo);else if(arguments.length===1){var t=arguments[0];this._nodes=new jr(t)}};ze.prototype.printEdges=function(t){t.println("Edges:");for(var n=0;n<this._edges.size();n++){t.println("edge "+n+":");var i=this._edges.get(n);i.print(t),i.eiList.print(t)}},ze.prototype.find=function(t){return this._nodes.find(t)},ze.prototype.addNode=function(){if(arguments[0]instanceof Na){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof C){var n=arguments[0];return this._nodes.addNode(n)}},ze.prototype.getNodeIterator=function(){return this._nodes.iterator()},ze.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},ze.prototype.debugPrintln=function(t){Ee.out.println(t)},ze.prototype.isBoundaryNode=function(t,n){var i=this._nodes.find(n);if(i===null)return!1;var s=i.getLabel();return s!==null&&s.getLocation(t)===F.BOUNDARY},ze.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},ze.prototype.matchInSameDirection=function(t,n,i,s){return!!t.equals(i)&&tt.computeOrientation(t,n,s)===tt.COLLINEAR&&be.quadrant(t,n)===be.quadrant(i,s)},ze.prototype.getEdgeEnds=function(){return this._edgeEndList},ze.prototype.debugPrint=function(t){Ee.out.print(t)},ze.prototype.getEdgeIterator=function(){return this._edges.iterator()},ze.prototype.findEdgeInSameDirection=function(t,n){for(var i=0;i<this._edges.size();i++){var s=this._edges.get(i),l=s.getCoordinates();if(this.matchInSameDirection(t,n,l[0],l[1])||this.matchInSameDirection(t,n,l[l.length-1],l[l.length-2]))return s}return null},ze.prototype.insertEdge=function(t){this._edges.add(t)},ze.prototype.findEdgeEnd=function(t){for(var n=this.getEdgeEnds().iterator();n.hasNext();){var i=n.next();if(i.getEdge()===t)return i}return null},ze.prototype.addEdges=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next();this._edges.add(i);var s=new nl(i,!0),l=new nl(i,!1);s.setSym(l),l.setSym(s),this.add(s),this.add(l)}},ze.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},ze.prototype.getNodes=function(){return this._nodes.values()},ze.prototype.findEdge=function(t,n){for(var i=0;i<this._edges.size();i++){var s=this._edges.get(i),l=s.getCoordinates();if(t.equals(l[0])&&n.equals(l[1]))return s}return null},ze.prototype.interfaces_=function(){return[]},ze.prototype.getClass=function(){return ze},ze.linkResultDirectedEdges=function(t){for(var n=t.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()};var hr=function(){this._geometryFactory=null,this._shellList=new V;var t=arguments[0];this._geometryFactory=t};hr.prototype.sortShellsAndHoles=function(t,n,i){for(var s=t.iterator();s.hasNext();){var l=s.next();l.isHole()?i.add(l):n.add(l)}},hr.prototype.computePolygons=function(t){for(var n=new V,i=t.iterator();i.hasNext();){var s=i.next().toPolygon(this._geometryFactory);n.add(s)}return n},hr.prototype.placeFreeHoles=function(t,n){for(var i=n.iterator();i.hasNext();){var s=i.next();if(s.getShell()===null){var l=this.findEdgeRingContaining(s,t);if(l===null)throw new Ii("unable to assign hole to a shell",s.getCoordinate(0));s.setShell(l)}}},hr.prototype.buildMinimalEdgeRings=function(t,n,i){for(var s=new V,l=t.iterator();l.hasNext();){var f=l.next();if(f.getMaxNodeDegree()>2){f.linkDirectedEdgesForMinimalEdgeRings();var m=f.buildMinimalRings(),_=this.findShell(m);_!==null?(this.placePolygonHoles(_,m),n.add(_)):i.addAll(m)}else s.add(f)}return s},hr.prototype.containsPoint=function(t){for(var n=this._shellList.iterator();n.hasNext();)if(n.next().containsPoint(t))return!0;return!1},hr.prototype.buildMaximalEdgeRings=function(t){for(var n=new V,i=t.iterator();i.hasNext();){var s=i.next();if(s.isInResult()&&s.getLabel().isArea()&&s.getEdgeRing()===null){var l=new C0(s,this._geometryFactory);n.add(l),l.setInResult()}}return n},hr.prototype.placePolygonHoles=function(t,n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isHole()&&s.setShell(t)}},hr.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},hr.prototype.findEdgeRingContaining=function(t,n){for(var i=t.getLinearRing(),s=i.getEnvelopeInternal(),l=i.getCoordinateN(0),f=null,m=null,_=n.iterator();_.hasNext();){var S=_.next(),O=S.getLinearRing(),H=O.getEnvelopeInternal();f!==null&&(m=f.getLinearRing().getEnvelopeInternal());var X=!1;H.contains(s)&&tt.isPointInRing(l,O.getCoordinates())&&(X=!0),X&&(f===null||m.contains(H))&&(f=S)}return f},hr.prototype.findShell=function(t){for(var n=0,i=null,s=t.iterator();s.hasNext();){var l=s.next();l.isHole()||(i=l,n++)}return _t.isTrue(n<=1,"found two shells in MinimalEdgeRing list"),i},hr.prototype.add=function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var n=arguments[0],i=arguments[1];ze.linkResultDirectedEdges(i);var s=this.buildMaximalEdgeRings(n),l=new V,f=this.buildMinimalEdgeRings(s,this._shellList,l);this.sortShellsAndHoles(f,this._shellList,l),this.placeFreeHoles(this._shellList,l)}},hr.prototype.interfaces_=function(){return[]},hr.prototype.getClass=function(){return hr};var Ko=function(){};Ko.prototype.getBounds=function(){},Ko.prototype.interfaces_=function(){return[]},Ko.prototype.getClass=function(){return Ko};var kr=function(){this._bounds=null,this._item=null;var t=arguments[0],n=arguments[1];this._bounds=t,this._item=n};kr.prototype.getItem=function(){return this._item},kr.prototype.getBounds=function(){return this._bounds},kr.prototype.interfaces_=function(){return[Ko,e]},kr.prototype.getClass=function(){return kr};var Pi=function(){this._size=null,this._items=null,this._size=0,this._items=new V,this._items.add(null)};Pi.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t},Pi.prototype.size=function(){return this._size},Pi.prototype.reorder=function(t){for(var n=null,i=this._items.get(t);2*t<=this._size&&((n=2*t)!==this._size&&this._items.get(n+1).compareTo(this._items.get(n))<0&&n++,this._items.get(n).compareTo(i)<0);t=n)this._items.set(t,this._items.get(n));this._items.set(t,i)},Pi.prototype.clear=function(){this._size=0,this._items.clear()},Pi.prototype.isEmpty=function(){return this._size===0},Pi.prototype.add=function(t){this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)this._items.set(n,this._items.get(Math.trunc(n/2)));this._items.set(n,t)},Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi};var Vi=function(){};Vi.prototype.visitItem=function(t){},Vi.prototype.interfaces_=function(){return[]},Vi.prototype.getClass=function(){return Vi};var bo=function(){};bo.prototype.insert=function(t,n){},bo.prototype.remove=function(t,n){},bo.prototype.query=function(){},bo.prototype.interfaces_=function(){return[]},bo.prototype.getClass=function(){return bo};var un=function(){if(this._childBoundables=new V,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this._level=t}}},Bh={serialVersionUID:{configurable:!0}};un.prototype.getLevel=function(){return this._level},un.prototype.size=function(){return this._childBoundables.size()},un.prototype.getChildBoundables=function(){return this._childBoundables},un.prototype.addChildBoundable=function(t){_t.isTrue(this._bounds===null),this._childBoundables.add(t)},un.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},un.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},un.prototype.interfaces_=function(){return[Ko,e]},un.prototype.getClass=function(){return un},Bh.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(un,Bh);var Gr=function(){};Gr.reverseOrder=function(){return{compare:function(t,n){return n.compareTo(t)}}},Gr.min=function(t){return Gr.sort(t),t.get(0)},Gr.sort=function(t,n){var i=t.toArray();n?We.sort(i,n):We.sort(i);for(var s=t.iterator(),l=0,f=i.length;l<f;l++)s.next(),s.set(i[l])},Gr.singletonList=function(t){var n=new V;return n.add(t),n};var en=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],n=arguments[1],i=arguments[2];this._boundable1=t,this._boundable2=n,this._itemDistance=i,this._distance=this.distance()};en.prototype.expandToQueue=function(t,n){var i=en.isComposite(this._boundable1),s=en.isComposite(this._boundable2);if(i&&s)return en.area(this._boundable1)>en.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,n),null):(this.expand(this._boundable2,this._boundable1,t,n),null);if(i)return this.expand(this._boundable1,this._boundable2,t,n),null;if(s)return this.expand(this._boundable2,this._boundable1,t,n),null;throw new L("neither boundable is composite")},en.prototype.isLeaves=function(){return!(en.isComposite(this._boundable1)||en.isComposite(this._boundable2))},en.prototype.compareTo=function(t){var n=t;return this._distance<n._distance?-1:this._distance>n._distance?1:0},en.prototype.expand=function(t,n,i,s){for(var l=t.getChildBoundables().iterator();l.hasNext();){var f=l.next(),m=new en(f,n,this._itemDistance);m.getDistance()<s&&i.add(m)}},en.prototype.getBoundable=function(t){return t===0?this._boundable1:this._boundable2},en.prototype.getDistance=function(){return this._distance},en.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},en.prototype.interfaces_=function(){return[k]},en.prototype.getClass=function(){return en},en.area=function(t){return t.getBounds().getArea()},en.isComposite=function(t){return t instanceof un};var yn=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new V,this._nodeCapacity=null,arguments.length===0){var n=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=n}else if(arguments.length===1){var i=arguments[0];_t.isTrue(i>1,"Node capacity must be greater than 1"),this._nodeCapacity=i}},La={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};yn.prototype.getNodeCapacity=function(){return this._nodeCapacity},yn.prototype.lastNode=function(t){return t.get(t.size()-1)},yn.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var t=0,n=arguments[0].getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof un?t+=this.size(i):i instanceof kr&&(t+=1)}return t}},yn.prototype.removeItem=function(t,n){for(var i=null,s=t.getChildBoundables().iterator();s.hasNext();){var l=s.next();l instanceof kr&&l.getItem()===n&&(i=l)}return i!==null&&(t.getChildBoundables().remove(i),!0)},yn.prototype.itemsTree=function(){if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new V:t}if(arguments.length===1){for(var n=arguments[0],i=new V,s=n.getChildBoundables().iterator();s.hasNext();){var l=s.next();if(l instanceof un){var f=this.itemsTree(l);f!==null&&i.add(f)}else l instanceof kr?i.add(l.getItem()):_t.shouldNeverReachHere()}return i.size()<=0?null:i}},yn.prototype.insert=function(t,n){_t.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new kr(t,n))},yn.prototype.boundablesAtLevel=function(){if(arguments.length===1){var t=arguments[0],n=new V;return this.boundablesAtLevel(t,this._root,n),n}if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];if(_t.isTrue(i>-2),s.getLevel()===i)return l.add(s),null;for(var f=s.getChildBoundables().iterator();f.hasNext();){var m=f.next();m instanceof un?this.boundablesAtLevel(i,m,l):(_t.isTrue(m instanceof kr),i===-1&&l.add(m))}return null}},yn.prototype.query=function(){if(arguments.length===1){var t=arguments[0];this.build();var n=new V;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,n),n}if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),i)&&this.query(i,this._root,s)}else if(arguments.length===3){if(et(arguments[2],Vi)&&arguments[0]instanceof Object&&arguments[1]instanceof un)for(var l=arguments[0],f=arguments[1],m=arguments[2],_=f.getChildBoundables(),S=0;S<_.size();S++){var O=_.get(S);this.getIntersectsOp().intersects(O.getBounds(),l)&&(O instanceof un?this.query(l,O,m):O instanceof kr?m.visitItem(O.getItem()):_t.shouldNeverReachHere())}else if(et(arguments[2],Z)&&arguments[0]instanceof Object&&arguments[1]instanceof un)for(var H=arguments[0],X=arguments[1],nt=arguments[2],rt=X.getChildBoundables(),lt=0;lt<rt.size();lt++){var gt=rt.get(lt);this.getIntersectsOp().intersects(gt.getBounds(),H)&&(gt instanceof un?this.query(H,gt,nt):gt instanceof kr?nt.add(gt.getItem()):_t.shouldNeverReachHere())}}},yn.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},yn.prototype.getRoot=function(){return this.build(),this._root},yn.prototype.remove=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,n)}if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2],f=this.removeItem(s,l);if(f)return!0;for(var m=null,_=s.getChildBoundables().iterator();_.hasNext();){var S=_.next();if(this.getIntersectsOp().intersects(S.getBounds(),i)&&S instanceof un&&(f=this.remove(i,S,l))){m=S;break}}return m!==null&&m.getChildBoundables().isEmpty()&&s.getChildBoundables().remove(m),f}},yn.prototype.createHigherLevels=function(t,n){_t.isTrue(!t.isEmpty());var i=this.createParentBoundables(t,n+1);return i.size()===1?i.get(0):this.createHigherLevels(i,n+1)},yn.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var t=0,n=arguments[0].getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof un){var s=this.depth(i);s>t&&(t=s)}}return t+1}},yn.prototype.createParentBoundables=function(t,n){_t.isTrue(!t.isEmpty());var i=new V;i.add(this.createNode(n));var s=new V(t);Gr.sort(s,this.getComparator());for(var l=s.iterator();l.hasNext();){var f=l.next();this.lastNode(i).getChildBoundables().size()===this.getNodeCapacity()&&i.add(this.createNode(n)),this.lastNode(i).addChildBoundable(f)}return i},yn.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},yn.prototype.interfaces_=function(){return[e]},yn.prototype.getClass=function(){return yn},yn.compareDoubles=function(t,n){return t>n?1:t<n?-1:0},La.IntersectsOp.get=function(){return I0},La.serialVersionUID.get=function(){return-3886435814360241e3},La.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(yn,La);var I0=function(){},Qo=function(){};Qo.prototype.distance=function(t,n){},Qo.prototype.interfaces_=function(){return[]},Qo.prototype.getClass=function(){return Qo};var zh=function(t){function n(s){s=s||n.DEFAULT_NODE_CAPACITY,t.call(this,s)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return n.prototype.createParentBoundablesFromVerticalSlices=function(s,l){_t.isTrue(s.length>0);for(var f=new V,m=0;m<s.length;m++)f.addAll(this.createParentBoundablesFromVerticalSlice(s[m],l));return f},n.prototype.createNode=function(s){return new kh(s)},n.prototype.size=function(){return arguments.length===0?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},n.prototype.insert=function(){if(arguments.length!==2)return t.prototype.insert.apply(this,arguments);var s=arguments[0],l=arguments[1];if(s.isNull())return null;t.prototype.insert.call(this,s,l)},n.prototype.getIntersectsOp=function(){return n.intersectsOp},n.prototype.verticalSlices=function(s,l){for(var f=Math.trunc(Math.ceil(s.size()/l)),m=new Array(l).fill(null),_=s.iterator(),S=0;S<l;S++){m[S]=new V;for(var O=0;_.hasNext()&&O<f;){var H=_.next();m[S].add(H),O++}}return m},n.prototype.query=function(){if(arguments.length===1){var s=arguments[0];return t.prototype.query.call(this,s)}if(arguments.length===2){var l=arguments[0],f=arguments[1];t.prototype.query.call(this,l,f)}else if(arguments.length===3){if(et(arguments[2],Vi)&&arguments[0]instanceof Object&&arguments[1]instanceof un){var m=arguments[0],_=arguments[1],S=arguments[2];t.prototype.query.call(this,m,_,S)}else if(et(arguments[2],Z)&&arguments[0]instanceof Object&&arguments[1]instanceof un){var O=arguments[0],H=arguments[1],X=arguments[2];t.prototype.query.call(this,O,H,X)}}},n.prototype.getComparator=function(){return n.yComparator},n.prototype.createParentBoundablesFromVerticalSlice=function(s,l){return t.prototype.createParentBoundables.call(this,s,l)},n.prototype.remove=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];return t.prototype.remove.call(this,s,l)}return t.prototype.remove.apply(this,arguments)},n.prototype.depth=function(){return arguments.length===0?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},n.prototype.createParentBoundables=function(s,l){_t.isTrue(!s.isEmpty());var f=Math.trunc(Math.ceil(s.size()/this.getNodeCapacity())),m=new V(s);Gr.sort(m,n.xComparator);var _=this.verticalSlices(m,Math.trunc(Math.ceil(Math.sqrt(f))));return this.createParentBoundablesFromVerticalSlices(_,l)},n.prototype.nearestNeighbour=function(){if(arguments.length===1){if(et(arguments[0],Qo)){var s=arguments[0],l=new en(this.getRoot(),this.getRoot(),s);return this.nearestNeighbour(l)}if(arguments[0]instanceof en){var f=arguments[0];return this.nearestNeighbour(f,P.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof n&&et(arguments[1],Qo)){var m=arguments[0],_=arguments[1],S=new en(this.getRoot(),m.getRoot(),_);return this.nearestNeighbour(S)}if(arguments[0]instanceof en&&typeof arguments[1]=="number"){var O=arguments[0],H=arguments[1],X=null,nt=new Pi;for(nt.add(O);!nt.isEmpty()&&H>0;){var rt=nt.poll(),lt=rt.getDistance();if(lt>=H)break;rt.isLeaves()?(H=lt,X=rt):rt.expandToQueue(nt,H)}return[X.getBoundable(0).getItem(),X.getBoundable(1).getItem()]}}else if(arguments.length===3){var gt=arguments[0],we=arguments[1],rn=arguments[2],Wn=new kr(gt,we),Ei=new en(this.getRoot(),Wn,rn);return this.nearestNeighbour(Ei)[0]}},n.prototype.interfaces_=function(){return[bo,e]},n.prototype.getClass=function(){return n},n.centreX=function(s){return n.avg(s.getMinX(),s.getMaxX())},n.avg=function(s,l){return(s+l)/2},n.centreY=function(s){return n.avg(s.getMinY(),s.getMaxY())},i.STRtreeNode.get=function(){return kh},i.serialVersionUID.get=function(){return 0x39920f7d5f261e0},i.xComparator.get=function(){return{interfaces_:function(){return[q]},compare:function(s,l){return t.compareDoubles(n.centreX(s.getBounds()),n.centreX(l.getBounds()))}}},i.yComparator.get=function(){return{interfaces_:function(){return[q]},compare:function(s,l){return t.compareDoubles(n.centreY(s.getBounds()),n.centreY(l.getBounds()))}}},i.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(s,l){return s.intersects(l)}}},i.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(n,i),n}(yn),kh=function(t){function n(){var i=arguments[0];t.call(this,i)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.computeBounds=function(){for(var i=null,s=this.getChildBoundables().iterator();s.hasNext();){var l=s.next();i===null?i=new at(l.getBounds()):i.expandToInclude(l.getBounds())}return i},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(un),jn=function(){};jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn},jn.relativeSign=function(t,n){return t<n?-1:t>n?1:0},jn.compare=function(t,n,i){if(n.equals2D(i))return 0;var s=jn.relativeSign(n.x,i.x),l=jn.relativeSign(n.y,i.y);switch(t){case 0:return jn.compareValue(s,l);case 1:return jn.compareValue(l,s);case 2:return jn.compareValue(l,-s);case 3:return jn.compareValue(-s,l);case 4:return jn.compareValue(-s,-l);case 5:return jn.compareValue(-l,-s);case 6:return jn.compareValue(-l,s);case 7:return jn.compareValue(s,-l)}return _t.shouldNeverReachHere("invalid octant value"),0},jn.compareValue=function(t,n){return t<0?-1:t>0?1:n<0?-1:n>0?1:0};var Hi=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],n=arguments[1],i=arguments[2],s=arguments[3];this._segString=t,this.coord=new C(n),this.segmentIndex=i,this._segmentOctant=s,this._isInterior=!n.equals2D(t.getCoordinate(i))};Hi.prototype.getCoordinate=function(){return this.coord},Hi.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},Hi.prototype.compareTo=function(t){var n=t;return this.segmentIndex<n.segmentIndex?-1:this.segmentIndex>n.segmentIndex?1:this.coord.equals2D(n.coord)?0:jn.compare(this._segmentOctant,this.coord,n.coord)},Hi.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t},Hi.prototype.isInterior=function(){return this._isInterior},Hi.prototype.interfaces_=function(){return[k]},Hi.prototype.getClass=function(){return Hi};var zn=function(){this._nodeMap=new x,this._edge=null;var t=arguments[0];this._edge=t};zn.prototype.getSplitCoordinates=function(){var t=new Q;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var s=n.next();this.addEdgeCoordinates(i,s,t),i=s}return t.toCoordinateArray()},zn.prototype.addCollapsedNodes=function(){var t=new V;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var n=t.iterator();n.hasNext();){var i=n.next().intValue();this.add(this._edge.getCoordinate(i),i)}},zn.prototype.print=function(t){t.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(t)},zn.prototype.findCollapsesFromExistingVertices=function(t){for(var n=0;n<this._edge.size()-2;n++){var i=this._edge.getCoordinate(n),s=this._edge.getCoordinate(n+2);i.equals2D(s)&&t.add(new it(n+1))}},zn.prototype.addEdgeCoordinates=function(t,n,i){var s=this._edge.getCoordinate(n.segmentIndex),l=n.isInterior()||!n.coord.equals2D(s);i.add(new C(t.coord),!1);for(var f=t.segmentIndex+1;f<=n.segmentIndex;f++)i.add(this._edge.getCoordinate(f));l&&i.add(new C(n.coord))},zn.prototype.iterator=function(){return this._nodeMap.values().iterator()},zn.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var n=this.iterator(),i=n.next();n.hasNext();){var s=n.next(),l=this.createSplitEdge(i,s);t.add(l),i=s}},zn.prototype.findCollapseIndex=function(t,n,i){if(!t.coord.equals2D(n.coord))return!1;var s=n.segmentIndex-t.segmentIndex;return n.isInterior()||s--,s===1&&(i[0]=t.segmentIndex+1,!0)},zn.prototype.findCollapsesFromInsertedNodes=function(t){for(var n=new Array(1).fill(null),i=this.iterator(),s=i.next();i.hasNext();){var l=i.next();this.findCollapseIndex(s,l,n)&&t.add(new it(n[0])),s=l}},zn.prototype.getEdge=function(){return this._edge},zn.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},zn.prototype.createSplitEdge=function(t,n){var i=n.segmentIndex-t.segmentIndex+2,s=this._edge.getCoordinate(n.segmentIndex),l=n.isInterior()||!n.coord.equals2D(s);l||i--;var f=new Array(i).fill(null),m=0;f[m++]=new C(t.coord);for(var _=t.segmentIndex+1;_<=n.segmentIndex;_++)f[m++]=this._edge.getCoordinate(_);return l&&(f[m]=new C(n.coord)),new Je(f,this._edge.getData())},zn.prototype.add=function(t,n){var i=new Hi(this._edge,t,n,this._edge.getSegmentOctant(n)),s=this._nodeMap.get(i);return s!==null?(_t.isTrue(s.coord.equals2D(t),"Found equal nodes with different coordinates"),s):(this._nodeMap.put(i,i),i)},zn.prototype.checkSplitEdgesCorrectness=function(t){var n=this._edge.getCoordinates(),i=t.get(0).getCoordinate(0);if(!i.equals2D(n[0]))throw new Cn("bad split edge start point at "+i);var s=t.get(t.size()-1).getCoordinates(),l=s[s.length-1];if(!l.equals2D(n[n.length-1]))throw new Cn("bad split edge end point at "+l)},zn.prototype.interfaces_=function(){return[]},zn.prototype.getClass=function(){return zn};var Ao=function(){};Ao.prototype.interfaces_=function(){return[]},Ao.prototype.getClass=function(){return Ao},Ao.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];if(t===0&&n===0)throw new L("Cannot compute the octant for point ( "+t+", "+n+" )");var i=Math.abs(t),s=Math.abs(n);return t>=0?n>=0?i>=s?0:1:i>=s?7:6:n>=0?i>=s?3:2:i>=s?4:5}if(arguments[0]instanceof C&&arguments[1]instanceof C){var l=arguments[0],f=arguments[1],m=f.x-l.x,_=f.y-l.y;if(m===0&&_===0)throw new L("Cannot compute the octant for two identical points "+l);return Ao.octant(m,_)}};var pi=function(){};pi.prototype.getCoordinates=function(){},pi.prototype.size=function(){},pi.prototype.getCoordinate=function(t){},pi.prototype.isClosed=function(){},pi.prototype.setData=function(t){},pi.prototype.getData=function(){},pi.prototype.interfaces_=function(){return[]},pi.prototype.getClass=function(){return pi};var Hs=function(){};Hs.prototype.addIntersection=function(t,n){},Hs.prototype.interfaces_=function(){return[pi]},Hs.prototype.getClass=function(){return Hs};var Je=function(){this._nodeList=new zn(this),this._pts=null,this._data=null;var t=arguments[0],n=arguments[1];this._pts=t,this._data=n};Je.prototype.getCoordinates=function(){return this._pts},Je.prototype.size=function(){return this._pts.length},Je.prototype.getCoordinate=function(t){return this._pts[t]},Je.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Je.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},Je.prototype.setData=function(t){this._data=t},Je.prototype.safeOctant=function(t,n){return t.equals2D(n)?0:Ao.octant(t,n)},Je.prototype.getData=function(){return this._data},Je.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];this.addIntersectionNode(t,n)}else if(arguments.length===4){var i=arguments[0],s=arguments[1],l=arguments[3],f=new C(i.getIntersection(l));this.addIntersection(f,s)}},Je.prototype.toString=function(){return Qe.toLineString(new Ze(this._pts))},Je.prototype.getNodeList=function(){return this._nodeList},Je.prototype.addIntersectionNode=function(t,n){var i=n,s=i+1;if(s<this._pts.length){var l=this._pts[s];t.equals2D(l)&&(i=s)}return this._nodeList.add(t,i)},Je.prototype.addIntersections=function(t,n,i){for(var s=0;s<t.getIntersectionNum();s++)this.addIntersection(t,n,i,s)},Je.prototype.interfaces_=function(){return[Hs]},Je.prototype.getClass=function(){return Je},Je.getNodedSubstrings=function(){if(arguments.length===1){var t=arguments[0],n=new V;return Je.getNodedSubstrings(t,n),n}if(arguments.length===2)for(var i=arguments[0],s=arguments[1],l=i.iterator();l.hasNext();)l.next().getNodeList().addSplitEdges(s)};var ft=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new C,this.p1=new C;else if(arguments.length===1){var t=arguments[0];this.p0=new C(t.p0),this.p1=new C(t.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];this.p0=new C(n,i),this.p1=new C(s,l)}},Gh={serialVersionUID:{configurable:!0}};ft.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},ft.prototype.orientationIndex=function(){if(arguments[0]instanceof ft){var t=arguments[0],n=tt.orientationIndex(this.p0,this.p1,t.p0),i=tt.orientationIndex(this.p0,this.p1,t.p1);return n>=0&&i>=0||n<=0&&i<=0?Math.max(n,i):0}if(arguments[0]instanceof C){var s=arguments[0];return tt.orientationIndex(this.p0,this.p1,s)}},ft.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},ft.prototype.isVertical=function(){return this.p0.x===this.p1.x},ft.prototype.equals=function(t){if(!(t instanceof ft))return!1;var n=t;return this.p0.equals(n.p0)&&this.p1.equals(n.p1)},ft.prototype.intersection=function(t){var n=new Pr;return n.computeIntersection(this.p0,this.p1,t.p0,t.p1),n.hasIntersection()?n.getIntersection(0):null},ft.prototype.project=function(){if(arguments[0]instanceof C){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new C(t);var n=this.projectionFactor(t),i=new C;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}if(arguments[0]instanceof ft){var s=arguments[0],l=this.projectionFactor(s.p0),f=this.projectionFactor(s.p1);if(l>=1&&f>=1||l<=0&&f<=0)return null;var m=this.project(s.p0);l<0&&(m=this.p0),l>1&&(m=this.p1);var _=this.project(s.p1);return f<0&&(_=this.p0),f>1&&(_=this.p1),new ft(m,_)}},ft.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},ft.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},ft.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1},ft.prototype.distancePerpendicular=function(t){return tt.distancePointLinePerpendicular(t,this.p0,this.p1)},ft.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},ft.prototype.midPoint=function(){return ft.midPoint(this.p0,this.p1)},ft.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var n=this.p1.x-this.p0.x,i=this.p1.y-this.p0.y,s=n*n+i*i;return s<=0?P.NaN:((t.x-this.p0.x)*n+(t.y-this.p0.y)*i)/s},ft.prototype.closestPoints=function(t){var n=this.intersection(t);if(n!==null)return[n,n];var i=new Array(2).fill(null),s=P.MAX_VALUE,l=null,f=this.closestPoint(t.p0);s=f.distance(t.p0),i[0]=f,i[1]=t.p0;var m=this.closestPoint(t.p1);(l=m.distance(t.p1))<s&&(s=l,i[0]=m,i[1]=t.p1);var _=t.closestPoint(this.p0);(l=_.distance(this.p0))<s&&(s=l,i[0]=this.p0,i[1]=_);var S=t.closestPoint(this.p1);return(l=S.distance(this.p1))<s&&(s=l,i[0]=this.p1,i[1]=S),i},ft.prototype.closestPoint=function(t){var n=this.projectionFactor(t);return n>0&&n<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},ft.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},ft.prototype.getLength=function(){return this.p0.distance(this.p1)},ft.prototype.compareTo=function(t){var n=t,i=this.p0.compareTo(n.p0);return i!==0?i:this.p1.compareTo(n.p1)},ft.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},ft.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&(this.p1.equals(t.p1)||this.p0.equals(t.p1))&&this.p1.equals(t.p0)},ft.prototype.lineIntersection=function(t){try{return Le.intersection(this.p0,this.p1,t.p0,t.p1)}catch(n){if(!(n instanceof qe))throw n}return null},ft.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},ft.prototype.pointAlongOffset=function(t,n){var i=this.p0.x+t*(this.p1.x-this.p0.x),s=this.p0.y+t*(this.p1.y-this.p0.y),l=this.p1.x-this.p0.x,f=this.p1.y-this.p0.y,m=Math.sqrt(l*l+f*f),_=0,S=0;if(n!==0){if(m<=0)throw new Error("Cannot compute offset from zero-length line segment");_=n*l/m,S=n*f/m}return new C(i-S,s+_)},ft.prototype.setCoordinates=function(){if(arguments.length===1){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.p0.x=n.x,this.p0.y=n.y,this.p1.x=i.x,this.p1.y=i.y}},ft.prototype.segmentFraction=function(t){var n=this.projectionFactor(t);return n<0?n=0:(n>1||P.isNaN(n))&&(n=1),n},ft.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},ft.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},ft.prototype.distance=function(){if(arguments[0]instanceof ft){var t=arguments[0];return tt.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof C){var n=arguments[0];return tt.distancePointLine(n,this.p0,this.p1)}},ft.prototype.pointAlong=function(t){var n=new C;return n.x=this.p0.x+t*(this.p1.x-this.p0.x),n.y=this.p0.y+t*(this.p1.y-this.p0.y),n},ft.prototype.hashCode=function(){var t=P.doubleToLongBits(this.p0.x);t^=31*P.doubleToLongBits(this.p0.y);var n=Math.trunc(t)^Math.trunc(t>>32),i=P.doubleToLongBits(this.p1.x);return i^=31*P.doubleToLongBits(this.p1.y),n^(Math.trunc(i)^Math.trunc(i>>32))},ft.prototype.interfaces_=function(){return[k,e]},ft.prototype.getClass=function(){return ft},ft.midPoint=function(t,n){return new C((t.x+n.x)/2,(t.y+n.y)/2)},Gh.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(ft,Gh);var qs=function(){this.tempEnv1=new at,this.tempEnv2=new at,this._overlapSeg1=new ft,this._overlapSeg2=new ft};qs.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var t=arguments[0],n=arguments[1],i=arguments[2],s=arguments[3];t.getLineSegment(n,this._overlapSeg1),i.getLineSegment(s,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},qs.prototype.interfaces_=function(){return[]},qs.prototype.getClass=function(){return qs};var fr=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],n=arguments[1],i=arguments[2],s=arguments[3];this._pts=t,this._start=n,this._end=i,this._context=s};fr.prototype.getLineSegment=function(t,n){n.p0=this._pts[t],n.p1=this._pts[t+1]},fr.prototype.computeSelect=function(t,n,i,s){var l=this._pts[n],f=this._pts[i];if(s.tempEnv1.init(l,f),i-n==1)return s.select(this,n),null;if(!t.intersects(s.tempEnv1))return null;var m=Math.trunc((n+i)/2);n<m&&this.computeSelect(t,n,m,s),m<i&&this.computeSelect(t,m,i,s)},fr.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),n=0,i=this._start;i<=this._end;i++)t[n++]=this._pts[i];return t},fr.prototype.computeOverlaps=function(t,n){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,n)},fr.prototype.setId=function(t){this._id=t},fr.prototype.select=function(t,n){this.computeSelect(t,this._start,this._end,n)},fr.prototype.getEnvelope=function(){if(this._env===null){var t=this._pts[this._start],n=this._pts[this._end];this._env=new at(t,n)}return this._env},fr.prototype.getEndIndex=function(){return this._end},fr.prototype.getStartIndex=function(){return this._start},fr.prototype.getContext=function(){return this._context},fr.prototype.getId=function(){return this._id},fr.prototype.computeOverlapsInternal=function(t,n,i,s,l,f){var m=this._pts[t],_=this._pts[n],S=i._pts[s],O=i._pts[l];if(n-t==1&&l-s==1)return f.overlap(this,t,i,s),null;if(f.tempEnv1.init(m,_),f.tempEnv2.init(S,O),!f.tempEnv1.intersects(f.tempEnv2))return null;var H=Math.trunc((t+n)/2),X=Math.trunc((s+l)/2);t<H&&(s<X&&this.computeOverlapsInternal(t,H,i,s,X,f),X<l&&this.computeOverlapsInternal(t,H,i,X,l,f)),H<n&&(s<X&&this.computeOverlapsInternal(H,n,i,s,X,f),X<l&&this.computeOverlapsInternal(H,n,i,X,l,f))},fr.prototype.interfaces_=function(){return[]},fr.prototype.getClass=function(){return fr};var ti=function(){};ti.prototype.interfaces_=function(){return[]},ti.prototype.getClass=function(){return ti},ti.getChainStartIndices=function(t){var n=0,i=new V;i.add(new it(n));do{var s=ti.findChainEnd(t,n);i.add(new it(s)),n=s}while(n<t.length-1);return ti.toIntArray(i)},ti.findChainEnd=function(t,n){for(var i=n;i<t.length-1&&t[i].equals2D(t[i+1]);)i++;if(i>=t.length-1)return t.length-1;for(var s=be.quadrant(t[i],t[i+1]),l=n+1;l<t.length&&!(!t[l-1].equals2D(t[l])&&be.quadrant(t[l-1],t[l])!==s);)l++;return l-1},ti.getChains=function(){if(arguments.length===1){var t=arguments[0];return ti.getChains(t,null)}if(arguments.length===2){for(var n=arguments[0],i=arguments[1],s=new V,l=ti.getChainStartIndices(n),f=0;f<l.length-1;f++){var m=new fr(n,l[f],l[f+1],i);s.add(m)}return s}},ti.toIntArray=function(t){for(var n=new Array(t.size()).fill(null),i=0;i<n.length;i++)n[i]=t.get(i).intValue();return n};var no=function(){};no.prototype.computeNodes=function(t){},no.prototype.getNodedSubstrings=function(){},no.prototype.interfaces_=function(){return[]},no.prototype.getClass=function(){return no};var Ws=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setSegmentIntersector(t)}}};Ws.prototype.setSegmentIntersector=function(t){this._segInt=t},Ws.prototype.interfaces_=function(){return[no]},Ws.prototype.getClass=function(){return Ws};var rl=function(t){function n(s){s?t.call(this,s):t.call(this),this._monoChains=new V,this._index=new zh,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={SegmentOverlapAction:{configurable:!0}};return n.prototype.getMonotoneChains=function(){return this._monoChains},n.prototype.getNodedSubstrings=function(){return Je.getNodedSubstrings(this._nodedSegStrings)},n.prototype.getIndex=function(){return this._index},n.prototype.add=function(s){for(var l=ti.getChains(s.getCoordinates(),s).iterator();l.hasNext();){var f=l.next();f.setId(this._idCounter++),this._index.insert(f.getEnvelope(),f),this._monoChains.add(f)}},n.prototype.computeNodes=function(s){this._nodedSegStrings=s;for(var l=s.iterator();l.hasNext();)this.add(l.next());this.intersectChains()},n.prototype.intersectChains=function(){for(var s=new Vh(this._segInt),l=this._monoChains.iterator();l.hasNext();)for(var f=l.next(),m=this._index.query(f.getEnvelope()).iterator();m.hasNext();){var _=m.next();if(_.getId()>f.getId()&&(f.computeOverlaps(_,s),this._nOverlaps++),this._segInt.isDone())return null}},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},i.SegmentOverlapAction.get=function(){return Vh},Object.defineProperties(n,i),n}(Ws),Vh=function(t){function n(){t.call(this),this._si=null;var i=arguments[0];this._si=i}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.overlap=function(){if(arguments.length!==4)return t.prototype.overlap.apply(this,arguments);var i=arguments[0],s=arguments[1],l=arguments[2],f=arguments[3],m=i.getContext(),_=l.getContext();this._si.processIntersections(m,s,_,f)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(qs),ae=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setQuadrantSegments(n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.setQuadrantSegments(i),this.setEndCapStyle(s)}else if(arguments.length===4){var l=arguments[0],f=arguments[1],m=arguments[2],_=arguments[3];this.setQuadrantSegments(l),this.setEndCapStyle(f),this.setJoinStyle(m),this.setMitreLimit(_)}}},Ri={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}};ae.prototype.getEndCapStyle=function(){return this._endCapStyle},ae.prototype.isSingleSided=function(){return this._isSingleSided},ae.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=ae.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=ae.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==ae.JOIN_ROUND&&(this._quadrantSegments=ae.DEFAULT_QUADRANT_SEGMENTS)},ae.prototype.getJoinStyle=function(){return this._joinStyle},ae.prototype.setJoinStyle=function(t){this._joinStyle=t},ae.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},ae.prototype.getSimplifyFactor=function(){return this._simplifyFactor},ae.prototype.getQuadrantSegments=function(){return this._quadrantSegments},ae.prototype.setEndCapStyle=function(t){this._endCapStyle=t},ae.prototype.getMitreLimit=function(){return this._mitreLimit},ae.prototype.setMitreLimit=function(t){this._mitreLimit=t},ae.prototype.setSingleSided=function(t){this._isSingleSided=t},ae.prototype.interfaces_=function(){return[]},ae.prototype.getClass=function(){return ae},ae.bufferDistanceError=function(t){var n=Math.PI/2/t;return 1-Math.cos(n/2)},Ri.CAP_ROUND.get=function(){return 1},Ri.CAP_FLAT.get=function(){return 2},Ri.CAP_SQUARE.get=function(){return 3},Ri.JOIN_ROUND.get=function(){return 1},Ri.JOIN_MITRE.get=function(){return 2},Ri.JOIN_BEVEL.get=function(){return 3},Ri.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Ri.DEFAULT_MITRE_LIMIT.get=function(){return 5},Ri.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(ae,Ri);var Ve=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=tt.COUNTERCLOCKWISE,this._inputLine=t||null},Xs={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Ve.prototype.isDeletable=function(t,n,i,s){var l=this._inputLine[t],f=this._inputLine[n],m=this._inputLine[i];return!!this.isConcave(l,f,m)&&!!this.isShallow(l,f,m,s)&&this.isShallowSampled(l,f,t,i,s)},Ve.prototype.deleteShallowConcavities=function(){for(var t=1,n=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(n),s=!1;i<this._inputLine.length;){var l=!1;this.isDeletable(t,n,i,this._distanceTol)&&(this._isDeleted[n]=Ve.DELETE,l=!0,s=!0),t=l?i:n,n=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(n)}return s},Ve.prototype.isShallowConcavity=function(t,n,i,s){return tt.computeOrientation(t,n,i)!==this._angleOrientation?!1:tt.distancePointLine(n,t,i)<s},Ve.prototype.isShallowSampled=function(t,n,i,s,l){var f=Math.trunc((s-i)/Ve.NUM_PTS_TO_CHECK);f<=0&&(f=1);for(var m=i;m<s;m+=f)if(!this.isShallow(t,n,this._inputLine[m],l))return!1;return!0},Ve.prototype.isConcave=function(t,n,i){var s=tt.computeOrientation(t,n,i)===this._angleOrientation;return s},Ve.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=tt.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var n=!1;do n=this.deleteShallowConcavities();while(n);return this.collapseLine()},Ve.prototype.findNextNonDeletedIndex=function(t){for(var n=t+1;n<this._inputLine.length&&this._isDeleted[n]===Ve.DELETE;)n++;return n},Ve.prototype.isShallow=function(t,n,i,s){return tt.distancePointLine(n,t,i)<s},Ve.prototype.collapseLine=function(){for(var t=new Q,n=0;n<this._inputLine.length;n++)this._isDeleted[n]!==Ve.DELETE&&t.add(this._inputLine[n]);return t.toCoordinateArray()},Ve.prototype.interfaces_=function(){return[]},Ve.prototype.getClass=function(){return Ve},Ve.simplify=function(t,n){return new Ve(t).simplify(n)},Xs.INIT.get=function(){return 0},Xs.DELETE.get=function(){return 1},Xs.KEEP.get=function(){return 1},Xs.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Ve,Xs);var xr=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new V},Hh={COORDINATE_ARRAY_TYPE:{configurable:!0}};xr.prototype.getCoordinates=function(){return this._ptList.toArray(xr.COORDINATE_ARRAY_TYPE)},xr.prototype.setPrecisionModel=function(t){this._precisionModel=t},xr.prototype.addPt=function(t){var n=new C(t);if(this._precisionModel.makePrecise(n),this.isRedundant(n))return null;this._ptList.add(n)},xr.prototype.revere=function(){},xr.prototype.addPts=function(t,n){if(n)for(var i=0;i<t.length;i++)this.addPt(t[i]);else for(var s=t.length-1;s>=0;s--)this.addPt(t[s])},xr.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var n=this._ptList.get(this._ptList.size()-1);return t.distance(n)<this._minimimVertexDistance},xr.prototype.toString=function(){return new Tt().createLineString(this.getCoordinates()).toString()},xr.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new C(this._ptList.get(0)),n=this._ptList.get(this._ptList.size()-1);if(t.equals(n))return null;this._ptList.add(t)},xr.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},xr.prototype.interfaces_=function(){return[]},xr.prototype.getClass=function(){return xr},Hh.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(xr,Hh);var Ct=function(){},To={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};Ct.prototype.interfaces_=function(){return[]},Ct.prototype.getClass=function(){return Ct},Ct.toDegrees=function(t){return 180*t/Math.PI},Ct.normalize=function(t){for(;t>Math.PI;)t-=Ct.PI_TIMES_2;for(;t<=-Math.PI;)t+=Ct.PI_TIMES_2;return t},Ct.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}if(arguments.length===2){var n=arguments[0],i=arguments[1],s=i.x-n.x,l=i.y-n.y;return Math.atan2(l,s)}},Ct.isAcute=function(t,n,i){var s=t.x-n.x,l=t.y-n.y;return s*(i.x-n.x)+l*(i.y-n.y)>0},Ct.isObtuse=function(t,n,i){var s=t.x-n.x,l=t.y-n.y;return s*(i.x-n.x)+l*(i.y-n.y)<0},Ct.interiorAngle=function(t,n,i){var s=Ct.angle(n,t),l=Ct.angle(n,i);return Math.abs(l-s)},Ct.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Ct.PI_TIMES_2;t>=Ct.PI_TIMES_2&&(t=0)}else{for(;t>=Ct.PI_TIMES_2;)t-=Ct.PI_TIMES_2;t<0&&(t=0)}return t},Ct.angleBetween=function(t,n,i){var s=Ct.angle(n,t),l=Ct.angle(n,i);return Ct.diff(s,l)},Ct.diff=function(t,n){var i=null;return(i=t<n?n-t:t-n)>Math.PI&&(i=2*Math.PI-i),i},Ct.toRadians=function(t){return t*Math.PI/180},Ct.getTurn=function(t,n){var i=Math.sin(n-t);return i>0?Ct.COUNTERCLOCKWISE:i<0?Ct.CLOCKWISE:Ct.NONE},Ct.angleBetweenOriented=function(t,n,i){var s=Ct.angle(n,t),l=Ct.angle(n,i)-s;return l<=-Math.PI?l+Ct.PI_TIMES_2:l>Math.PI?l-Ct.PI_TIMES_2:l},To.PI_TIMES_2.get=function(){return 2*Math.PI},To.PI_OVER_2.get=function(){return Math.PI/2},To.PI_OVER_4.get=function(){return Math.PI/4},To.COUNTERCLOCKWISE.get=function(){return tt.COUNTERCLOCKWISE},To.CLOCKWISE.get=function(){return tt.CLOCKWISE},To.NONE.get=function(){return tt.COLLINEAR},Object.defineProperties(Ct,To);var De=function t(){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 ft,this._seg1=new ft,this._offset0=new ft,this._offset1=new ft,this._side=0,this._hasNarrowConcaveAngle=!1;var n=arguments[0],i=arguments[1],s=arguments[2];this._precisionModel=n,this._bufParams=i,this._li=new Pr,this._filletAngleQuantum=Math.PI/2/i.getQuadrantSegments(),i.getQuadrantSegments()>=8&&i.getJoinStyle()===ae.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(s)},Ys={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}};De.prototype.addNextSegment=function(t,n){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,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 i=tt.computeOrientation(this._s0,this._s1,this._s2),s=i===tt.CLOCKWISE&&this._side===j.LEFT||i===tt.COUNTERCLOCKWISE&&this._side===j.RIGHT;i===0?this.addCollinear(n):s?this.addOutsideTurn(i,n):this.addInsideTurn(i,n)},De.prototype.addLineEndCap=function(t,n){var i=new ft(t,n),s=new ft;this.computeOffsetSegment(i,j.LEFT,this._distance,s);var l=new ft;this.computeOffsetSegment(i,j.RIGHT,this._distance,l);var f=n.x-t.x,m=n.y-t.y,_=Math.atan2(m,f);switch(this._bufParams.getEndCapStyle()){case ae.CAP_ROUND:this._segList.addPt(s.p1),this.addFilletArc(n,_+Math.PI/2,_-Math.PI/2,tt.CLOCKWISE,this._distance),this._segList.addPt(l.p1);break;case ae.CAP_FLAT:this._segList.addPt(s.p1),this._segList.addPt(l.p1);break;case ae.CAP_SQUARE:var S=new C;S.x=Math.abs(this._distance)*Math.cos(_),S.y=Math.abs(this._distance)*Math.sin(_);var O=new C(s.p1.x+S.x,s.p1.y+S.y),H=new C(l.p1.x+S.x,l.p1.y+S.y);this._segList.addPt(O),this._segList.addPt(H)}},De.prototype.getCoordinates=function(){return this._segList.getCoordinates()},De.prototype.addMitreJoin=function(t,n,i,s){var l=!0,f=null;try{f=Le.intersection(n.p0,n.p1,i.p0,i.p1),(s<=0?1:f.distance(t)/Math.abs(s))>this._bufParams.getMitreLimit()&&(l=!1)}catch(m){if(!(m instanceof qe))throw m;f=new C(0,0),l=!1}l?this._segList.addPt(f):this.addLimitedMitreJoin(n,i,s,this._bufParams.getMitreLimit())},De.prototype.addFilletCorner=function(t,n,i,s,l){var f=n.x-t.x,m=n.y-t.y,_=Math.atan2(m,f),S=i.x-t.x,O=i.y-t.y,H=Math.atan2(O,S);s===tt.CLOCKWISE?_<=H&&(_+=2*Math.PI):_>=H&&(_-=2*Math.PI),this._segList.addPt(n),this.addFilletArc(t,_,H,s,l),this._segList.addPt(i)},De.prototype.addOutsideTurn=function(t,n){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*De.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===ae.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===ae.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(n&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))},De.prototype.createSquare=function(t){this._segList.addPt(new C(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new C(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new C(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new C(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},De.prototype.addSegments=function(t,n){this._segList.addPts(t,n)},De.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},De.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},De.prototype.initSideSegments=function(t,n,i){this._s1=t,this._s2=n,this._side=i,this._seg1.setCoordinates(t,n),this.computeOffsetSegment(this._seg1,i,this._distance,this._offset1)},De.prototype.addLimitedMitreJoin=function(t,n,i,s){var l=this._seg0.p1,f=Ct.angle(l,this._seg0.p0),m=Ct.angleBetweenOriented(this._seg0.p0,l,this._seg1.p1)/2,_=Ct.normalize(f+m),S=Ct.normalize(_+Math.PI),O=s*i,H=i-O*Math.abs(Math.sin(m)),X=l.x+O*Math.cos(S),nt=l.y+O*Math.sin(S),rt=new C(X,nt),lt=new ft(l,rt),gt=lt.pointAlongOffset(1,H),we=lt.pointAlongOffset(1,-H);this._side===j.LEFT?(this._segList.addPt(gt),this._segList.addPt(we)):(this._segList.addPt(we),this._segList.addPt(gt))},De.prototype.computeOffsetSegment=function(t,n,i,s){var l=n===j.LEFT?1:-1,f=t.p1.x-t.p0.x,m=t.p1.y-t.p0.y,_=Math.sqrt(f*f+m*m),S=l*i*f/_,O=l*i*m/_;s.p0.x=t.p0.x-O,s.p0.y=t.p0.y+S,s.p1.x=t.p1.x-O,s.p1.y=t.p1.y+S},De.prototype.addFilletArc=function(t,n,i,s,l){var f=s===tt.CLOCKWISE?-1:1,m=Math.abs(n-i),_=Math.trunc(m/this._filletAngleQuantum+.5);if(_<1)return null;for(var S=m/_,O=0,H=new C;O<m;){var X=n+f*O;H.x=t.x+l*Math.cos(X),H.y=t.y+l*Math.sin(X),this._segList.addPt(H),O+=S}},De.prototype.addInsideTurn=function(t,n){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*De.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var i=new C((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(i);var s=new C((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(s)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},De.prototype.createCircle=function(t){var n=new C(t.x+this._distance,t.y);this._segList.addPt(n),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},De.prototype.addBevelJoin=function(t,n){this._segList.addPt(t.p1),this._segList.addPt(n.p0)},De.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new xr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*De.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},De.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===ae.JOIN_BEVEL||this._bufParams.getJoinStyle()===ae.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,tt.CLOCKWISE,this._distance))},De.prototype.closeRing=function(){this._segList.closeRing()},De.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},De.prototype.interfaces_=function(){return[]},De.prototype.getClass=function(){return De},Ys.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},Ys.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},Ys.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Ys.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(De,Ys);var tr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],n=arguments[1];this._precisionModel=t,this._bufParams=n};tr.prototype.getOffsetCurve=function(t,n){if(this._distance=n,n===0)return null;var i=n<0,s=Math.abs(n),l=this.getSegGen(s);t.length<=1?this.computePointCurve(t[0],l):this.computeOffsetCurve(t,i,l);var f=l.getCoordinates();return i&&J.reverse(f),f},tr.prototype.computeSingleSidedBufferCurve=function(t,n,i){var s=this.simplifyTolerance(this._distance);if(n){i.addSegments(t,!0);var l=Ve.simplify(t,-s),f=l.length-1;i.initSideSegments(l[f],l[f-1],j.LEFT),i.addFirstSegment();for(var m=f-2;m>=0;m--)i.addNextSegment(l[m],!0)}else{i.addSegments(t,!1);var _=Ve.simplify(t,s),S=_.length-1;i.initSideSegments(_[0],_[1],j.LEFT),i.addFirstSegment();for(var O=2;O<=S;O++)i.addNextSegment(_[O],!0)}i.addLastSegment(),i.closeRing()},tr.prototype.computeRingBufferCurve=function(t,n,i){var s=this.simplifyTolerance(this._distance);n===j.RIGHT&&(s=-s);var l=Ve.simplify(t,s),f=l.length-1;i.initSideSegments(l[f-1],l[0],n);for(var m=1;m<=f;m++){var _=m!==1;i.addNextSegment(l[m],_)}i.closeRing()},tr.prototype.computeLineBufferCurve=function(t,n){var i=this.simplifyTolerance(this._distance),s=Ve.simplify(t,i),l=s.length-1;n.initSideSegments(s[0],s[1],j.LEFT);for(var f=2;f<=l;f++)n.addNextSegment(s[f],!0);n.addLastSegment(),n.addLineEndCap(s[l-1],s[l]);var m=Ve.simplify(t,-i),_=m.length-1;n.initSideSegments(m[_],m[_-1],j.LEFT);for(var S=_-2;S>=0;S--)n.addNextSegment(m[S],!0);n.addLastSegment(),n.addLineEndCap(m[1],m[0]),n.closeRing()},tr.prototype.computePointCurve=function(t,n){switch(this._bufParams.getEndCapStyle()){case ae.CAP_ROUND:n.createCircle(t);break;case ae.CAP_SQUARE:n.createSquare(t)}},tr.prototype.getLineCurve=function(t,n){if(this._distance=n,n<0&&!this._bufParams.isSingleSided()||n===0)return null;var i=Math.abs(n),s=this.getSegGen(i);if(t.length<=1)this.computePointCurve(t[0],s);else if(this._bufParams.isSingleSided()){var l=n<0;this.computeSingleSidedBufferCurve(t,l,s)}else this.computeLineBufferCurve(t,s);return s.getCoordinates()},tr.prototype.getBufferParameters=function(){return this._bufParams},tr.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},tr.prototype.getRingCurve=function(t,n,i){if(this._distance=i,t.length<=2)return this.getLineCurve(t,i);if(i===0)return tr.copyCoordinates(t);var s=this.getSegGen(i);return this.computeRingBufferCurve(t,n,s),s.getCoordinates()},tr.prototype.computeOffsetCurve=function(t,n,i){var s=this.simplifyTolerance(this._distance);if(n){var l=Ve.simplify(t,-s),f=l.length-1;i.initSideSegments(l[f],l[f-1],j.LEFT),i.addFirstSegment();for(var m=f-2;m>=0;m--)i.addNextSegment(l[m],!0)}else{var _=Ve.simplify(t,s),S=_.length-1;i.initSideSegments(_[0],_[1],j.LEFT),i.addFirstSegment();for(var O=2;O<=S;O++)i.addNextSegment(_[O],!0)}i.addLastSegment()},tr.prototype.getSegGen=function(t){return new De(this._precisionModel,this._bufParams,t)},tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr},tr.copyCoordinates=function(t){for(var n=new Array(t.length).fill(null),i=0;i<n.length;i++)n[i]=new C(t[i]);return n};var Co=function(){this._subgraphs=null,this._seg=new ft,this._cga=new tt;var t=arguments[0];this._subgraphs=t},qh={DepthSegment:{configurable:!0}};Co.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var t=arguments[0],n=new V,i=this._subgraphs.iterator();i.hasNext();){var s=i.next(),l=s.getEnvelope();t.y<l.getMinY()||t.y>l.getMaxY()||this.findStabbedSegments(t,s.getDirectedEdges(),n)}return n}if(arguments.length===3){if(et(arguments[2],Z)&&arguments[0]instanceof C&&arguments[1]instanceof nl){for(var f=arguments[0],m=arguments[1],_=arguments[2],S=m.getEdge().getCoordinates(),O=0;O<S.length-1;O++)if(this._seg.p0=S[O],this._seg.p1=S[O+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<f.x)&&!(this._seg.isHorizontal()||f.y<this._seg.p0.y||f.y>this._seg.p1.y||tt.computeOrientation(this._seg.p0,this._seg.p1,f)===tt.RIGHT)){var H=m.getDepth(j.LEFT);this._seg.p0.equals(S[O])||(H=m.getDepth(j.RIGHT));var X=new ro(this._seg,H);_.add(X)}}else if(et(arguments[2],Z)&&arguments[0]instanceof C&&et(arguments[1],Z))for(var nt=arguments[0],rt=arguments[1],lt=arguments[2],gt=rt.iterator();gt.hasNext();){var we=gt.next();we.isForward()&&this.findStabbedSegments(nt,we,lt)}}},Co.prototype.getDepth=function(t){var n=this.findStabbedSegments(t);return n.size()===0?0:Gr.min(n)._leftDepth},Co.prototype.interfaces_=function(){return[]},Co.prototype.getClass=function(){return Co},qh.DepthSegment.get=function(){return ro},Object.defineProperties(Co,qh);var ro=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],n=arguments[1];this._upwardSeg=new ft(t),this._leftDepth=n};ro.prototype.compareTo=function(t){var n=t;if(this._upwardSeg.minX()>=n._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=n._upwardSeg.minX())return-1;var i=this._upwardSeg.orientationIndex(n._upwardSeg);return i!==0||(i=-1*n._upwardSeg.orientationIndex(this._upwardSeg))!=0?i:this._upwardSeg.compareTo(n._upwardSeg)},ro.prototype.compareX=function(t,n){var i=t.p0.compareTo(n.p0);return i!==0?i:t.p1.compareTo(n.p1)},ro.prototype.toString=function(){return this._upwardSeg.toString()},ro.prototype.interfaces_=function(){return[k]},ro.prototype.getClass=function(){return ro};var ue=function(t,n,i){this.p0=t||null,this.p1=n||null,this.p2=i||null};ue.prototype.area=function(){return ue.area(this.p0,this.p1,this.p2)},ue.prototype.signedArea=function(){return ue.signedArea(this.p0,this.p1,this.p2)},ue.prototype.interpolateZ=function(t){if(t===null)throw new L("Supplied point is null.");return ue.interpolateZ(t,this.p0,this.p1,this.p2)},ue.prototype.longestSideLength=function(){return ue.longestSideLength(this.p0,this.p1,this.p2)},ue.prototype.isAcute=function(){return ue.isAcute(this.p0,this.p1,this.p2)},ue.prototype.circumcentre=function(){return ue.circumcentre(this.p0,this.p1,this.p2)},ue.prototype.area3D=function(){return ue.area3D(this.p0,this.p1,this.p2)},ue.prototype.centroid=function(){return ue.centroid(this.p0,this.p1,this.p2)},ue.prototype.inCentre=function(){return ue.inCentre(this.p0,this.p1,this.p2)},ue.prototype.interfaces_=function(){return[]},ue.prototype.getClass=function(){return ue},ue.area=function(t,n,i){return Math.abs(((i.x-t.x)*(n.y-t.y)-(n.x-t.x)*(i.y-t.y))/2)},ue.signedArea=function(t,n,i){return((i.x-t.x)*(n.y-t.y)-(n.x-t.x)*(i.y-t.y))/2},ue.det=function(t,n,i,s){return t*s-n*i},ue.interpolateZ=function(t,n,i,s){var l=n.x,f=n.y,m=i.x-l,_=s.x-l,S=i.y-f,O=s.y-f,H=m*O-_*S,X=t.x-l,nt=t.y-f,rt=(O*X-_*nt)/H,lt=(-S*X+m*nt)/H;return n.z+rt*(i.z-n.z)+lt*(s.z-n.z)},ue.longestSideLength=function(t,n,i){var s=t.distance(n),l=n.distance(i),f=i.distance(t),m=s;return l>m&&(m=l),f>m&&(m=f),m},ue.isAcute=function(t,n,i){return!!Ct.isAcute(t,n,i)&&!!Ct.isAcute(n,i,t)&&!!Ct.isAcute(i,t,n)},ue.circumcentre=function(t,n,i){var s=i.x,l=i.y,f=t.x-s,m=t.y-l,_=n.x-s,S=n.y-l,O=2*ue.det(f,m,_,S),H=ue.det(m,f*f+m*m,S,_*_+S*S),X=ue.det(f,f*f+m*m,_,_*_+S*S);return new C(s-H/O,l+X/O)},ue.perpendicularBisector=function(t,n){var i=n.x-t.x,s=n.y-t.y,l=new Le(t.x+i/2,t.y+s/2,1),f=new Le(t.x-s+i/2,t.y+i+s/2,1);return new Le(l,f)},ue.angleBisector=function(t,n,i){var s=n.distance(t),l=s/(s+n.distance(i)),f=i.x-t.x,m=i.y-t.y;return new C(t.x+l*f,t.y+l*m)},ue.area3D=function(t,n,i){var s=n.x-t.x,l=n.y-t.y,f=n.z-t.z,m=i.x-t.x,_=i.y-t.y,S=i.z-t.z,O=l*S-f*_,H=f*m-s*S,X=s*_-l*m,nt=O*O+H*H+X*X,rt=Math.sqrt(nt)/2;return rt},ue.centroid=function(t,n,i){var s=(t.x+n.x+i.x)/3,l=(t.y+n.y+i.y)/3;return new C(s,l)},ue.inCentre=function(t,n,i){var s=n.distance(i),l=t.distance(i),f=t.distance(n),m=s+l+f,_=(s*t.x+l*n.x+f*i.x)/m,S=(s*t.y+l*n.y+f*i.y)/m;return new C(_,S)};var Lr=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new V;var t=arguments[0],n=arguments[1],i=arguments[2];this._inputGeom=t,this._distance=n,this._curveBuilder=i};Lr.prototype.addPoint=function(t){if(this._distance<=0)return null;var n=t.getCoordinates(),i=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(i,F.EXTERIOR,F.INTERIOR)},Lr.prototype.addPolygon=function(t){var n=this._distance,i=j.LEFT;this._distance<0&&(n=-this._distance,i=j.RIGHT);var s=t.getExteriorRing(),l=J.removeRepeatedPoints(s.getCoordinates());if(this._distance<0&&this.isErodedCompletely(s,this._distance)||this._distance<=0&&l.length<3)return null;this.addPolygonRing(l,n,i,F.EXTERIOR,F.INTERIOR);for(var f=0;f<t.getNumInteriorRing();f++){var m=t.getInteriorRingN(f),_=J.removeRepeatedPoints(m.getCoordinates());this._distance>0&&this.isErodedCompletely(m,-this._distance)||this.addPolygonRing(_,n,j.opposite(i),F.INTERIOR,F.EXTERIOR)}},Lr.prototype.isTriangleErodedCompletely=function(t,n){var i=new ue(t[0],t[1],t[2]),s=i.inCentre();return tt.distancePointLine(s,i.p0,i.p1)<Math.abs(n)},Lr.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var n=J.removeRepeatedPoints(t.getCoordinates()),i=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(i,F.EXTERIOR,F.INTERIOR)},Lr.prototype.addCurve=function(t,n,i){if(t===null||t.length<2)return null;var s=new Je(t,new Me(0,F.BOUNDARY,n,i));this._curveList.add(s)},Lr.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Lr.prototype.addPolygonRing=function(t,n,i,s,l){if(n===0&&t.length<ci.MINIMUM_VALID_SIZE)return null;var f=s,m=l;t.length>=ci.MINIMUM_VALID_SIZE&&tt.isCCW(t)&&(f=l,m=s,i=j.opposite(i));var _=this._curveBuilder.getRingCurve(t,i,n);this.addCurve(_,f,m)},Lr.prototype.add=function(t){if(t.isEmpty())return null;t instanceof an?this.addPolygon(t):t instanceof Ge?this.addLineString(t):t instanceof cr?this.addPoint(t):t instanceof Zo?this.addCollection(t):t instanceof Rr?this.addCollection(t):t instanceof hi?this.addCollection(t):t instanceof Fe&&this.addCollection(t)},Lr.prototype.isErodedCompletely=function(t,n){var i=t.getCoordinates();if(i.length<4)return n<0;if(i.length===4)return this.isTriangleErodedCompletely(i,n);var s=t.getEnvelopeInternal(),l=Math.min(s.getHeight(),s.getWidth());return n<0&&2*Math.abs(n)>l},Lr.prototype.addCollection=function(t){for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);this.add(i)}},Lr.prototype.interfaces_=function(){return[]},Lr.prototype.getClass=function(){return Lr};var jo=function(){};jo.prototype.locate=function(t){},jo.prototype.interfaces_=function(){return[]},jo.prototype.getClass=function(){return jo};var di=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};di.prototype.next=function(){if(this._atStart)return this._atStart=!1,di.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 a;var t=this._parent.getGeometryN(this._index++);return t instanceof Fe?(this._subcollectionIterator=new di(t),this._subcollectionIterator.next()):t},di.prototype.remove=function(){throw new Error(this.getClass().getName())},di.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)},di.prototype.interfaces_=function(){return[K]},di.prototype.getClass=function(){return di},di.isAtomic=function(t){return!(t instanceof Fe)};var Er=function(){this._geom=null;var t=arguments[0];this._geom=t};Er.prototype.locate=function(t){return Er.locate(t,this._geom)},Er.prototype.interfaces_=function(){return[jo]},Er.prototype.getClass=function(){return Er},Er.isPointInRing=function(t,n){return!!n.getEnvelopeInternal().intersects(t)&&tt.isPointInRing(t,n.getCoordinates())},Er.containsPointInPolygon=function(t,n){if(n.isEmpty())return!1;var i=n.getExteriorRing();if(!Er.isPointInRing(t,i))return!1;for(var s=0;s<n.getNumInteriorRing();s++){var l=n.getInteriorRingN(s);if(Er.isPointInRing(t,l))return!1}return!0},Er.containsPoint=function(t,n){if(n instanceof an)return Er.containsPointInPolygon(t,n);if(n instanceof Fe)for(var i=new di(n);i.hasNext();){var s=i.next();if(s!==n&&Er.containsPoint(t,s))return!0}return!1},Er.locate=function(t,n){return n.isEmpty()?F.EXTERIOR:Er.containsPoint(t,n)?F.INTERIOR:F.EXTERIOR};var Pn=function(){this._edgeMap=new x,this._edgeList=null,this._ptInAreaLocation=[F.NONE,F.NONE]};Pn.prototype.getNextCW=function(t){this.getEdges();var n=this._edgeList.indexOf(t),i=n-1;return n===0&&(i=this._edgeList.size()-1),this._edgeList.get(i)},Pn.prototype.propagateSideLabels=function(t){for(var n=F.NONE,i=this.iterator();i.hasNext();){var s=i.next().getLabel();s.isArea(t)&&s.getLocation(t,j.LEFT)!==F.NONE&&(n=s.getLocation(t,j.LEFT))}if(n===F.NONE)return null;for(var l=n,f=this.iterator();f.hasNext();){var m=f.next(),_=m.getLabel();if(_.getLocation(t,j.ON)===F.NONE&&_.setLocation(t,j.ON,l),_.isArea(t)){var S=_.getLocation(t,j.LEFT),O=_.getLocation(t,j.RIGHT);if(O!==F.NONE){if(O!==l)throw new Ii("side location conflict",m.getCoordinate());S===F.NONE&&_t.shouldNeverReachHere("found single null side (at "+m.getCoordinate()+")"),l=S}else _t.isTrue(_.getLocation(t,j.LEFT)===F.NONE,"found single null side"),_.setLocation(t,j.RIGHT,l),_.setLocation(t,j.LEFT,l)}}},Pn.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},Pn.prototype.print=function(t){Ee.out.println("EdgeEndStar: "+this.getCoordinate());for(var n=this.iterator();n.hasNext();)n.next().print(t)},Pn.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},Pn.prototype.checkAreaLabelsConsistent=function(t){var n=this.getEdges();if(n.size()<=0)return!0;var i=n.size()-1,s=n.get(i).getLabel().getLocation(t,j.LEFT);_t.isTrue(s!==F.NONE,"Found unlabelled area edge");for(var l=s,f=this.iterator();f.hasNext();){var m=f.next().getLabel();_t.isTrue(m.isArea(t),"Found non-area edge");var _=m.getLocation(t,j.LEFT),S=m.getLocation(t,j.RIGHT);if(_===S||S!==l)return!1;l=_}return!0},Pn.prototype.findIndex=function(t){this.iterator();for(var n=0;n<this._edgeList.size();n++)if(this._edgeList.get(n)===t)return n;return-1},Pn.prototype.iterator=function(){return this.getEdges().iterator()},Pn.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new V(this._edgeMap.values())),this._edgeList},Pn.prototype.getLocation=function(t,n,i){return this._ptInAreaLocation[t]===F.NONE&&(this._ptInAreaLocation[t]=Er.locate(n,i[t].getGeometry())),this._ptInAreaLocation[t]},Pn.prototype.toString=function(){var t=new Rt;t.append("EdgeEndStar: "+this.getCoordinate()),t.append(`\n`);for(var n=this.iterator();n.hasNext();){var i=n.next();t.append(i),t.append(`\n`)}return t.toString()},Pn.prototype.computeEdgeEndLabels=function(t){for(var n=this.iterator();n.hasNext();)n.next().computeLabel(t)},Pn.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var n=[!1,!1],i=this.iterator();i.hasNext();)for(var s=i.next().getLabel(),l=0;l<2;l++)s.isLine(l)&&s.getLocation(l)===F.BOUNDARY&&(n[l]=!0);for(var f=this.iterator();f.hasNext();)for(var m=f.next(),_=m.getLabel(),S=0;S<2;S++)if(_.isAnyNull(S)){var O=F.NONE;if(n[S])O=F.EXTERIOR;else{var H=m.getCoordinate();O=this.getLocation(S,H,t)}_.setAllLocationsIfNull(S,O)}},Pn.prototype.getDegree=function(){return this._edgeMap.size()},Pn.prototype.insertEdgeEnd=function(t,n){this._edgeMap.put(t,n),this._edgeList=null},Pn.prototype.interfaces_=function(){return[]},Pn.prototype.getClass=function(){return Pn};var P0=function(t){function n(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var i=null,s=null,l=this._SCANNING_FOR_INCOMING,f=0;f<this._resultAreaEdgeList.size();f++){var m=this._resultAreaEdgeList.get(f),_=m.getSym();if(m.getLabel().isArea())switch(i===null&&m.isInResult()&&(i=m),l){case this._SCANNING_FOR_INCOMING:if(!_.isInResult())continue;s=_,l=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!m.isInResult())continue;s.setNext(m),l=this._SCANNING_FOR_INCOMING}}if(l===this._LINKING_TO_OUTGOING){if(i===null)throw new Ii("no outgoing dirEdge found",this.getCoordinate());_t.isTrue(i.isInResult(),"unable to link last incoming dirEdge"),s.setNext(i)}},n.prototype.insert=function(i){var s=i;this.insertEdgeEnd(s,s)},n.prototype.getRightmostEdge=function(){var i=this.getEdges(),s=i.size();if(s<1)return null;var l=i.get(0);if(s===1)return l;var f=i.get(s-1),m=l.getQuadrant(),_=f.getQuadrant();return be.isNorthern(m)&&be.isNorthern(_)?l:be.isNorthern(m)||be.isNorthern(_)?l.getDy()!==0?l:f.getDy()!==0?f:(_t.shouldNeverReachHere("found two horizontal edges incident on node"),null):f},n.prototype.print=function(i){Ee.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var s=this.iterator();s.hasNext();){var l=s.next();i.print("out "),l.print(i),i.println(),i.print("in "),l.getSym().print(i),i.println()}},n.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new V;for(var i=this.iterator();i.hasNext();){var s=i.next();(s.isInResult()||s.getSym().isInResult())&&this._resultAreaEdgeList.add(s)}return this._resultAreaEdgeList},n.prototype.updateLabelling=function(i){for(var s=this.iterator();s.hasNext();){var l=s.next().getLabel();l.setAllLocationsIfNull(0,i.getLocation(0)),l.setAllLocationsIfNull(1,i.getLocation(1))}},n.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var i=null,s=null,l=this._edgeList.size()-1;l>=0;l--){var f=this._edgeList.get(l),m=f.getSym();s===null&&(s=m),i!==null&&m.setNext(i),i=f}s.setNext(i)},n.prototype.computeDepths=function(){if(arguments.length===1){var i=arguments[0],s=this.findIndex(i),l=i.getDepth(j.LEFT),f=i.getDepth(j.RIGHT),m=this.computeDepths(s+1,this._edgeList.size(),l);if(this.computeDepths(0,s,m)!==f)throw new Ii("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var _=arguments[0],S=arguments[1],O=arguments[2],H=_;H<S;H++){var X=this._edgeList.get(H);X.setEdgeDepths(j.RIGHT,O),O=X.getDepth(j.LEFT)}return O}},n.prototype.mergeSymLabels=function(){for(var i=this.iterator();i.hasNext();){var s=i.next();s.getLabel().merge(s.getSym().getLabel())}},n.prototype.linkMinimalDirectedEdges=function(i){for(var s=null,l=null,f=this._SCANNING_FOR_INCOMING,m=this._resultAreaEdgeList.size()-1;m>=0;m--){var _=this._resultAreaEdgeList.get(m),S=_.getSym();switch(s===null&&_.getEdgeRing()===i&&(s=_),f){case this._SCANNING_FOR_INCOMING:if(S.getEdgeRing()!==i)continue;l=S,f=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(_.getEdgeRing()!==i)continue;l.setNextMin(_),f=this._SCANNING_FOR_INCOMING}}f===this._LINKING_TO_OUTGOING&&(_t.isTrue(s!==null,"found null for first outgoing dirEdge"),_t.isTrue(s.getEdgeRing()===i,"unable to link last incoming dirEdge"),l.setNextMin(s))},n.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var i=0,s=this.iterator();s.hasNext();)s.next().isInResult()&&i++;return i}if(arguments.length===1){for(var l=arguments[0],f=0,m=this.iterator();m.hasNext();)m.next().getEdgeRing()===l&&f++;return f}},n.prototype.getLabel=function(){return this._label},n.prototype.findCoveredLineEdges=function(){for(var i=F.NONE,s=this.iterator();s.hasNext();){var l=s.next(),f=l.getSym();if(!l.isLineEdge()){if(l.isInResult()){i=F.INTERIOR;break}if(f.isInResult()){i=F.EXTERIOR;break}}}if(i===F.NONE)return null;for(var m=i,_=this.iterator();_.hasNext();){var S=_.next(),O=S.getSym();S.isLineEdge()?S.getEdge().setCovered(m===F.INTERIOR):(S.isInResult()&&(m=F.EXTERIOR),O.isInResult()&&(m=F.INTERIOR))}},n.prototype.computeLabelling=function(i){t.prototype.computeLabelling.call(this,i),this._label=new Me(F.NONE);for(var s=this.iterator();s.hasNext();)for(var l=s.next().getEdge().getLabel(),f=0;f<2;f++){var m=l.getLocation(f);m!==F.INTERIOR&&m!==F.BOUNDARY||this._label.setLocation(f,F.INTERIOR)}},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Pn),Wh=function(t){function n(){t.apply(this,arguments)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.createNode=function(i){return new Na(i,new P0)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Jo),qi=function t(){this._pts=null,this._orientation=null;var n=arguments[0];this._pts=n,this._orientation=t.orientation(n)};qi.prototype.compareTo=function(t){var n=t;return qi.compareOriented(this._pts,this._orientation,n._pts,n._orientation)},qi.prototype.interfaces_=function(){return[k]},qi.prototype.getClass=function(){return qi},qi.orientation=function(t){return J.increasingDirection(t)===1},qi.compareOriented=function(t,n,i,s){for(var l=n?1:-1,f=s?1:-1,m=n?t.length:-1,_=s?i.length:-1,S=n?0:t.length-1,O=s?0:i.length-1;;){var H=t[S].compareTo(i[O]);if(H!==0)return H;var X=(S+=l)===m,nt=(O+=f)===_;if(X&&!nt)return-1;if(!X&&nt)return 1;if(X&&nt)return 0}};var Vr=function(){this._edges=new V,this._ocaMap=new x};Vr.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n);n>0&&t.print(","),t.print("(");for(var s=i.getCoordinates(),l=0;l<s.length;l++)l>0&&t.print(","),t.print(s[l].x+" "+s[l].y);t.println(")")}t.print(") ")},Vr.prototype.addAll=function(t){for(var n=t.iterator();n.hasNext();)this.add(n.next())},Vr.prototype.findEdgeIndex=function(t){for(var n=0;n<this._edges.size();n++)if(this._edges.get(n).equals(t))return n;return-1},Vr.prototype.iterator=function(){return this._edges.iterator()},Vr.prototype.getEdges=function(){return this._edges},Vr.prototype.get=function(t){return this._edges.get(t)},Vr.prototype.findEqualEdge=function(t){var n=new qi(t.getCoordinates());return this._ocaMap.get(n)},Vr.prototype.add=function(t){this._edges.add(t);var n=new qi(t.getCoordinates());this._ocaMap.put(n,t)},Vr.prototype.interfaces_=function(){return[]},Vr.prototype.getClass=function(){return Vr};var io=function(){};io.prototype.processIntersections=function(t,n,i,s){},io.prototype.isDone=function(){},io.prototype.interfaces_=function(){return[]},io.prototype.getClass=function(){return io};var Mr=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 t=arguments[0];this._li=t};Mr.prototype.isTrivialIntersection=function(t,n,i,s){if(t===i&&this._li.getIntersectionNum()===1){if(Mr.isAdjacentSegments(n,s))return!0;if(t.isClosed()){var l=t.size()-1;if(n===0&&s===l||s===0&&n===l)return!0}}return!1},Mr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Mr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Mr.prototype.getLineIntersector=function(){return this._li},Mr.prototype.hasProperIntersection=function(){return this._hasProper},Mr.prototype.processIntersections=function(t,n,i,s){if(t===i&&n===s)return null;this.numTests++;var l=t.getCoordinates()[n],f=t.getCoordinates()[n+1],m=i.getCoordinates()[s],_=i.getCoordinates()[s+1];this._li.computeIntersection(l,f,m,_),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,n,i,s)||(this._hasIntersection=!0,t.addIntersections(this._li,n,0),i.addIntersections(this._li,s,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Mr.prototype.hasIntersection=function(){return this._hasIntersection},Mr.prototype.isDone=function(){return!1},Mr.prototype.hasInteriorIntersection=function(){return this._hasInterior},Mr.prototype.interfaces_=function(){return[io]},Mr.prototype.getClass=function(){return Mr},Mr.isAdjacentSegments=function(t,n){return Math.abs(t-n)===1};var ei=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],n=arguments[1],i=arguments[2];this.coord=new C(t),this.segmentIndex=n,this.dist=i};ei.prototype.getSegmentIndex=function(){return this.segmentIndex},ei.prototype.getCoordinate=function(){return this.coord},ei.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},ei.prototype.compareTo=function(t){var n=t;return this.compare(n.segmentIndex,n.dist)},ei.prototype.isEndPoint=function(t){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===t},ei.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},ei.prototype.getDistance=function(){return this.dist},ei.prototype.compare=function(t,n){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<n?-1:this.dist>n?1:0},ei.prototype.interfaces_=function(){return[k]},ei.prototype.getClass=function(){return ei};var mi=function(){this._nodeMap=new x,this.edge=null;var t=arguments[0];this.edge=t};mi.prototype.print=function(t){t.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(t)},mi.prototype.iterator=function(){return this._nodeMap.values().iterator()},mi.prototype.addSplitEdges=function(t){this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var s=n.next(),l=this.createSplitEdge(i,s);t.add(l),i=s}},mi.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},mi.prototype.createSplitEdge=function(t,n){var i=n.segmentIndex-t.segmentIndex+2,s=this.edge.pts[n.segmentIndex],l=n.dist>0||!n.coord.equals2D(s);l||i--;var f=new Array(i).fill(null),m=0;f[m++]=new C(t.coord);for(var _=t.segmentIndex+1;_<=n.segmentIndex;_++)f[m++]=this.edge.pts[_];return l&&(f[m]=n.coord),new Da(f,new Me(this.edge._label))},mi.prototype.add=function(t,n,i){var s=new ei(t,n,i),l=this._nodeMap.get(s);return l!==null?l:(this._nodeMap.put(s,s),s)},mi.prototype.isIntersection=function(t){for(var n=this.iterator();n.hasNext();)if(n.next().coord.equals(t))return!0;return!1},mi.prototype.interfaces_=function(){return[]},mi.prototype.getClass=function(){return mi};var oo=function(){};oo.prototype.getChainStartIndices=function(t){var n=0,i=new V;i.add(new it(n));do{var s=this.findChainEnd(t,n);i.add(new it(s)),n=s}while(n<t.length-1);return oo.toIntArray(i)},oo.prototype.findChainEnd=function(t,n){for(var i=be.quadrant(t[n],t[n+1]),s=n+1;s<t.length&&be.quadrant(t[s-1],t[s])===i;)s++;return s-1},oo.prototype.interfaces_=function(){return[]},oo.prototype.getClass=function(){return oo},oo.toIntArray=function(t){for(var n=new Array(t.size()).fill(null),i=0;i<n.length;i++)n[i]=t.get(i).intValue();return n};var Ni=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new at,this.env2=new at;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var n=new oo;this.startIndex=n.getChainStartIndices(this.pts)};Ni.prototype.getCoordinates=function(){return this.pts},Ni.prototype.getMaxX=function(t){var n=this.pts[this.startIndex[t]].x,i=this.pts[this.startIndex[t+1]].x;return n>i?n:i},Ni.prototype.getMinX=function(t){var n=this.pts[this.startIndex[t]].x,i=this.pts[this.startIndex[t+1]].x;return n<i?n:i},Ni.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var t=arguments[0],n=arguments[1],i=arguments[2],s=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],n,n.startIndex[i],n.startIndex[i+1],s)}else if(arguments.length===6){var l=arguments[0],f=arguments[1],m=arguments[2],_=arguments[3],S=arguments[4],O=arguments[5],H=this.pts[l],X=this.pts[f],nt=m.pts[_],rt=m.pts[S];if(f-l==1&&S-_==1)return O.addIntersections(this.e,l,m.e,_),null;if(this.env1.init(H,X),this.env2.init(nt,rt),!this.env1.intersects(this.env2))return null;var lt=Math.trunc((l+f)/2),gt=Math.trunc((_+S)/2);l<lt&&(_<gt&&this.computeIntersectsForChain(l,lt,m,_,gt,O),gt<S&&this.computeIntersectsForChain(l,lt,m,gt,S,O)),lt<f&&(_<gt&&this.computeIntersectsForChain(lt,f,m,_,gt,O),gt<S&&this.computeIntersectsForChain(lt,f,m,gt,S,O))}},Ni.prototype.getStartIndexes=function(){return this.startIndex},Ni.prototype.computeIntersects=function(t,n){for(var i=0;i<this.startIndex.length-1;i++)for(var s=0;s<t.startIndex.length-1;s++)this.computeIntersectsForChain(i,t,s,n)},Ni.prototype.interfaces_=function(){return[]},Ni.prototype.getClass=function(){return Ni};var Mn=function t(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var n=0;n<2;n++)for(var i=0;i<3;i++)this._depth[n][i]=t.NULL_VALUE},Xh={NULL_VALUE:{configurable:!0}};Mn.prototype.getDepth=function(t,n){return this._depth[t][n]},Mn.prototype.setDepth=function(t,n,i){this._depth[t][n]=i},Mn.prototype.isNull=function(){if(arguments.length===0){for(var t=0;t<2;t++)for(var n=0;n<3;n++)if(this._depth[t][n]!==Mn.NULL_VALUE)return!1;return!0}if(arguments.length===1){var i=arguments[0];return this._depth[i][1]===Mn.NULL_VALUE}if(arguments.length===2){var s=arguments[0],l=arguments[1];return this._depth[s][l]===Mn.NULL_VALUE}},Mn.prototype.normalize=function(){for(var t=0;t<2;t++)if(!this.isNull(t)){var n=this._depth[t][1];this._depth[t][2]<n&&(n=this._depth[t][2]),n<0&&(n=0);for(var i=1;i<3;i++){var s=0;this._depth[t][i]>n&&(s=1),this._depth[t][i]=s}}},Mn.prototype.getDelta=function(t){return this._depth[t][j.RIGHT]-this._depth[t][j.LEFT]},Mn.prototype.getLocation=function(t,n){return this._depth[t][n]<=0?F.EXTERIOR:F.INTERIOR},Mn.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Mn.prototype.add=function(){if(arguments.length===1)for(var t=arguments[0],n=0;n<2;n++)for(var i=1;i<3;i++){var s=t.getLocation(n,i);s!==F.EXTERIOR&&s!==F.INTERIOR||(this.isNull(n,i)?this._depth[n][i]=Mn.depthAtLocation(s):this._depth[n][i]+=Mn.depthAtLocation(s))}else if(arguments.length===3){var l=arguments[0],f=arguments[1];arguments[2]===F.INTERIOR&&this._depth[l][f]++}},Mn.prototype.interfaces_=function(){return[]},Mn.prototype.getClass=function(){return Mn},Mn.depthAtLocation=function(t){return t===F.EXTERIOR?0:t===F.INTERIOR?1:Mn.NULL_VALUE},Xh.NULL_VALUE.get=function(){return-1},Object.defineProperties(Mn,Xh);var Da=function(t){function n(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new mi(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Mn,this._depthDelta=0,arguments.length===1){var i=arguments[0];n.call(this,i,null)}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.pts=s,this._label=l}}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.getDepth=function(){return this._depth},n.prototype.getCollapsedEdge=function(){var i=new Array(2).fill(null);return i[0]=this.pts[0],i[1]=this.pts[1],new n(i,Me.toLineLabel(this._label))},n.prototype.isIsolated=function(){return this._isIsolated},n.prototype.getCoordinates=function(){return this.pts},n.prototype.setIsolated=function(i){this._isIsolated=i},n.prototype.setName=function(i){this._name=i},n.prototype.equals=function(i){if(!(i instanceof n))return!1;var s=i;if(this.pts.length!==s.pts.length)return!1;for(var l=!0,f=!0,m=this.pts.length,_=0;_<this.pts.length;_++)if(this.pts[_].equals2D(s.pts[_])||(l=!1),this.pts[_].equals2D(s.pts[--m])||(f=!1),!l&&!f)return!1;return!0},n.prototype.getCoordinate=function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var i=arguments[0];return this.pts[i]}},n.prototype.print=function(i){i.print("edge "+this._name+": "),i.print("LINESTRING (");for(var s=0;s<this.pts.length;s++)s>0&&i.print(","),i.print(this.pts[s].x+" "+this.pts[s].y);i.print(") "+this._label+" "+this._depthDelta)},n.prototype.computeIM=function(i){n.updateIM(this._label,i)},n.prototype.isCollapsed=function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])},n.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},n.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},n.prototype.getDepthDelta=function(){return this._depthDelta},n.prototype.getNumPoints=function(){return this.pts.length},n.prototype.printReverse=function(i){i.print("edge "+this._name+": ");for(var s=this.pts.length-1;s>=0;s--)i.print(this.pts[s]+" ");i.println("")},n.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Ni(this)),this._mce},n.prototype.getEnvelope=function(){if(this._env===null){this._env=new at;for(var i=0;i<this.pts.length;i++)this._env.expandToInclude(this.pts[i])}return this._env},n.prototype.addIntersection=function(i,s,l,f){var m=new C(i.getIntersection(f)),_=s,S=i.getEdgeDistance(l,f),O=_+1;if(O<this.pts.length){var H=this.pts[O];m.equals2D(H)&&(_=O,S=0)}this.eiList.add(m,_,S)},n.prototype.toString=function(){var i=new Rt;i.append("edge "+this._name+": "),i.append("LINESTRING (");for(var s=0;s<this.pts.length;s++)s>0&&i.append(","),i.append(this.pts[s].x+" "+this.pts[s].y);return i.append(") "+this._label+" "+this._depthDelta),i.toString()},n.prototype.isPointwiseEqual=function(i){if(this.pts.length!==i.pts.length)return!1;for(var s=0;s<this.pts.length;s++)if(!this.pts[s].equals2D(i.pts[s]))return!1;return!0},n.prototype.setDepthDelta=function(i){this._depthDelta=i},n.prototype.getEdgeIntersectionList=function(){return this.eiList},n.prototype.addIntersections=function(i,s,l){for(var f=0;f<i.getIntersectionNum();f++)this.addIntersection(i,s,l,f)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n.updateIM=function(){if(arguments.length!==2)return t.prototype.updateIM.apply(this,arguments);var i=arguments[0],s=arguments[1];s.setAtLeastIfValid(i.getLocation(0,j.ON),i.getLocation(1,j.ON),1),i.isArea()&&(s.setAtLeastIfValid(i.getLocation(0,j.LEFT),i.getLocation(1,j.LEFT),2),s.setAtLeastIfValid(i.getLocation(0,j.RIGHT),i.getLocation(1,j.RIGHT),2))},n}(_r),kn=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Vr,this._bufParams=t||null};kn.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},kn.prototype.insertUniqueEdge=function(t){var n=this._edgeList.findEqualEdge(t);if(n!==null){var i=n.getLabel(),s=t.getLabel();n.isPointwiseEqual(t)||(s=new Me(t.getLabel())).flip(),i.merge(s);var l=kn.depthDelta(s),f=n.getDepthDelta()+l;n.setDepthDelta(f)}else this._edgeList.add(t),t.setDepthDelta(kn.depthDelta(t.getLabel()))},kn.prototype.buildSubgraphs=function(t,n){for(var i=new V,s=t.iterator();s.hasNext();){var l=s.next(),f=l.getRightmostCoordinate(),m=new Co(i).getDepth(f);l.computeDepth(m),l.findResultEdges(),i.add(l),n.add(l.getDirectedEdges(),l.getNodes())}},kn.prototype.createSubgraphs=function(t){for(var n=new V,i=t.getNodes().iterator();i.hasNext();){var s=i.next();if(!s.isVisited()){var l=new Bn;l.create(s),n.add(l)}}return Gr.sort(n,Gr.reverseOrder()),n},kn.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},kn.prototype.getNoder=function(t){if(this._workingNoder!==null)return this._workingNoder;var n=new rl,i=new Pr;return i.setPrecisionModel(t),n.setSegmentIntersector(new Mr(i)),n},kn.prototype.buffer=function(t,n){var i=this._workingPrecisionModel;i===null&&(i=t.getPrecisionModel()),this._geomFact=t.getFactory();var s=new tr(i,this._bufParams),l=new Lr(t,n,s).getCurves();if(l.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(l,i),this._graph=new ze(new Wh),this._graph.addEdges(this._edgeList.getEdges());var f=this.createSubgraphs(this._graph),m=new hr(this._geomFact);this.buildSubgraphs(f,m);var _=m.getPolygons();return _.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(_)},kn.prototype.computeNodedEdges=function(t,n){var i=this.getNoder(n);i.computeNodes(t);for(var s=i.getNodedSubstrings().iterator();s.hasNext();){var l=s.next(),f=l.getCoordinates();if(f.length!==2||!f[0].equals2D(f[1])){var m=l.getData(),_=new Da(l.getCoordinates(),new Me(m));this.insertUniqueEdge(_)}}},kn.prototype.setNoder=function(t){this._workingNoder=t},kn.prototype.interfaces_=function(){return[]},kn.prototype.getClass=function(){return kn},kn.depthDelta=function(t){var n=t.getLocation(0,j.LEFT),i=t.getLocation(0,j.RIGHT);return n===F.INTERIOR&&i===F.EXTERIOR?1:n===F.EXTERIOR&&i===F.INTERIOR?-1:0},kn.convertSegStrings=function(t){for(var n=new Tt,i=new V;t.hasNext();){var s=t.next(),l=n.createLineString(s.getCoordinates());i.add(l)}return n.buildGeometry(i)};var Wi=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var t=arguments[0],n=arguments[1];this._noder=t,this._scaleFactor=n,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var i=arguments[0],s=arguments[1],l=arguments[2],f=arguments[3];this._noder=i,this._scaleFactor=s,this._offsetX=l,this._offsetY=f,this._isScaled=!this.isIntegerPrecision()}};Wi.prototype.rescale=function(){if(et(arguments[0],G))for(var t=arguments[0].iterator();t.hasNext();){var n=t.next();this.rescale(n.getCoordinates())}else if(arguments[0]instanceof Array){for(var i=arguments[0],s=0;s<i.length;s++)i[s].x=i[s].x/this._scaleFactor+this._offsetX,i[s].y=i[s].y/this._scaleFactor+this._offsetY;i.length===2&&i[0].equals2D(i[1])&&Ee.out.println(i)}},Wi.prototype.scale=function(){if(et(arguments[0],G)){for(var t=arguments[0],n=new V,i=t.iterator();i.hasNext();){var s=i.next();n.add(new Je(this.scale(s.getCoordinates()),s.getData()))}return n}if(arguments[0]instanceof Array){for(var l=arguments[0],f=new Array(l.length).fill(null),m=0;m<l.length;m++)f[m]=new C(Math.round((l[m].x-this._offsetX)*this._scaleFactor),Math.round((l[m].y-this._offsetY)*this._scaleFactor),l[m].z);return J.removeRepeatedPoints(f)}},Wi.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},Wi.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},Wi.prototype.computeNodes=function(t){var n=t;this._isScaled&&(n=this.scale(t)),this._noder.computeNodes(n)},Wi.prototype.interfaces_=function(){return[no]},Wi.prototype.getClass=function(){return Wi};var ni=function(){this._li=new Pr,this._segStrings=null;var t=arguments[0];this._segStrings=t},Yh={fact:{configurable:!0}};ni.prototype.checkEndPtVertexIntersections=function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();){var n=t.next().getCoordinates();this.checkEndPtVertexIntersections(n[0],this._segStrings),this.checkEndPtVertexIntersections(n[n.length-1],this._segStrings)}else if(arguments.length===2){for(var i=arguments[0],s=arguments[1].iterator();s.hasNext();)for(var l=s.next().getCoordinates(),f=1;f<l.length-1;f++)if(l[f].equals(i))throw new Cn("found endpt/interior pt intersection at index "+f+" :pt "+i)}},ni.prototype.checkInteriorIntersections=function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();)for(var n=t.next(),i=this._segStrings.iterator();i.hasNext();){var s=i.next();this.checkInteriorIntersections(n,s)}else if(arguments.length===2)for(var l=arguments[0],f=arguments[1],m=l.getCoordinates(),_=f.getCoordinates(),S=0;S<m.length-1;S++)for(var O=0;O<_.length-1;O++)this.checkInteriorIntersections(l,S,f,O);else if(arguments.length===4){var H=arguments[0],X=arguments[1],nt=arguments[2],rt=arguments[3];if(H===nt&&X===rt)return null;var lt=H.getCoordinates()[X],gt=H.getCoordinates()[X+1],we=nt.getCoordinates()[rt],rn=nt.getCoordinates()[rt+1];if(this._li.computeIntersection(lt,gt,we,rn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,lt,gt)||this.hasInteriorIntersection(this._li,we,rn)))throw new Cn("found non-noded intersection at "+lt+"-"+gt+" and "+we+"-"+rn)}},ni.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},ni.prototype.checkCollapses=function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();){var n=t.next();this.checkCollapses(n)}else if(arguments.length===1)for(var i=arguments[0].getCoordinates(),s=0;s<i.length-2;s++)this.checkCollapse(i[s],i[s+1],i[s+2])},ni.prototype.hasInteriorIntersection=function(t,n,i){for(var s=0;s<t.getIntersectionNum();s++){var l=t.getIntersection(s);if(!l.equals(n)&&!l.equals(i))return!0}return!1},ni.prototype.checkCollapse=function(t,n,i){if(t.equals(i))throw new Cn("found non-noded collapse at "+ni.fact.createLineString([t,n,i]))},ni.prototype.interfaces_=function(){return[]},ni.prototype.getClass=function(){return ni},Yh.fact.get=function(){return new Tt},Object.defineProperties(ni,Yh);var er=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 t=arguments[0],n=arguments[1],i=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=n,this._li=i,n<=0)throw new L("Scale factor must be non-zero");n!==1&&(this._pt=new C(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new C,this._p1Scaled=new C),this.initCorners(this._pt)},$h={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};er.prototype.intersectsScaled=function(t,n){var i=Math.min(t.x,n.x),s=Math.max(t.x,n.x),l=Math.min(t.y,n.y),f=Math.max(t.y,n.y),m=this._maxx<i||this._minx>s||this._maxy<l||this._miny>f;if(m)return!1;var _=this.intersectsToleranceSquare(t,n);return _t.isTrue(!(m&&_),"Found bad envelope test"),_},er.prototype.initCorners=function(t){this._minx=t.x-.5,this._maxx=t.x+.5,this._miny=t.y-.5,this._maxy=t.y+.5,this._corner[0]=new C(this._maxx,this._maxy),this._corner[1]=new C(this._minx,this._maxy),this._corner[2]=new C(this._minx,this._miny),this._corner[3]=new C(this._maxx,this._miny)},er.prototype.intersects=function(t,n){return this._scaleFactor===1?this.intersectsScaled(t,n):(this.copyScaled(t,this._p0Scaled),this.copyScaled(n,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},er.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},er.prototype.getCoordinate=function(){return this._originalPt},er.prototype.copyScaled=function(t,n){n.x=this.scale(t.x),n.y=this.scale(t.y)},er.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=er.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new at(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},er.prototype.intersectsPixelClosure=function(t,n){return this._li.computeIntersection(t,n,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,n,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,n,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,n,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},er.prototype.intersectsToleranceSquare=function(t,n){var i=!1,s=!1;return this._li.computeIntersection(t,n,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(t,n,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(t,n,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(s=!0),this._li.computeIntersection(t,n,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!i||!s)||!!t.equals(this._pt)||!!n.equals(this._pt))))},er.prototype.addSnappedNode=function(t,n){var i=t.getCoordinate(n),s=t.getCoordinate(n+1);return!!this.intersects(i,s)&&(t.addIntersection(this.getCoordinate(),n),!0)},er.prototype.interfaces_=function(){return[]},er.prototype.getClass=function(){return er},$h.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(er,$h);var $s=function(){this.tempEnv1=new at,this.selectedSegment=new ft};$s.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var t=arguments[0],n=arguments[1];t.getLineSegment(n,this.selectedSegment),this.select(this.selectedSegment)}}},$s.prototype.interfaces_=function(){return[]},$s.prototype.getClass=function(){return $s};var ts=function(){this._index=null;var t=arguments[0];this._index=t},Zh={HotPixelSnapAction:{configurable:!0}};ts.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2],l=n.getSafeEnvelope(),f=new Jh(n,i,s);return this._index.query(l,{interfaces_:function(){return[Vi]},visitItem:function(m){m.select(l,f)}}),f.isNodeAdded()}},ts.prototype.interfaces_=function(){return[]},ts.prototype.getClass=function(){return ts},Zh.HotPixelSnapAction.get=function(){return Jh},Object.defineProperties(ts,Zh);var Jh=function(t){function n(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var i=arguments[0],s=arguments[1],l=arguments[2];this._hotPixel=i,this._parentEdge=s,this._hotPixelVertexIndex=l}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.isNodeAdded=function(){return this._isNodeAdded},n.prototype.select=function(){if(arguments.length!==2)return t.prototype.select.apply(this,arguments);var i=arguments[0],s=arguments[1],l=i.getContext();if(this._parentEdge!==null&&l===this._parentEdge&&s===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(l,s)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}($s),Io=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new V};Io.prototype.processIntersections=function(t,n,i,s){if(t===i&&n===s)return null;var l=t.getCoordinates()[n],f=t.getCoordinates()[n+1],m=i.getCoordinates()[s],_=i.getCoordinates()[s+1];if(this._li.computeIntersection(l,f,m,_),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var S=0;S<this._li.getIntersectionNum();S++)this._interiorIntersections.add(this._li.getIntersection(S));t.addIntersections(this._li,n,0),i.addIntersections(this._li,s,1)}},Io.prototype.isDone=function(){return!1},Io.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Io.prototype.interfaces_=function(){return[io]},Io.prototype.getClass=function(){return Io};var gi=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new Pr,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};gi.prototype.checkCorrectness=function(t){var n=Je.getNodedSubstrings(t),i=new ni(n);try{i.checkValid()}catch(s){if(!(s instanceof xn))throw s;s.printStackTrace()}},gi.prototype.getNodedSubstrings=function(){return Je.getNodedSubstrings(this._nodedSegStrings)},gi.prototype.snapRound=function(t,n){var i=this.findInteriorIntersections(t,n);this.computeIntersectionSnaps(i),this.computeVertexSnaps(t)},gi.prototype.findInteriorIntersections=function(t,n){var i=new Io(n);return this._noder.setSegmentIntersector(i),this._noder.computeNodes(t),i.getInteriorIntersections()},gi.prototype.computeVertexSnaps=function(){if(et(arguments[0],G))for(var t=arguments[0].iterator();t.hasNext();){var n=t.next();this.computeVertexSnaps(n)}else if(arguments[0]instanceof Je)for(var i=arguments[0],s=i.getCoordinates(),l=0;l<s.length;l++){var f=new er(s[l],this._scaleFactor,this._li);this._pointSnapper.snap(f,i,l)&&i.addIntersection(s[l],l)}},gi.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new rl,this._pointSnapper=new ts(this._noder.getIndex()),this.snapRound(t,this._li)},gi.prototype.computeIntersectionSnaps=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next(),s=new er(i,this._scaleFactor,this._li);this._pointSnapper.snap(s)}},gi.prototype.interfaces_=function(){return[no]},gi.prototype.getClass=function(){return gi};var wn=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new ae,this._resultGeometry=null,this._saveException=null,arguments.length===1){var t=arguments[0];this._argGeom=t}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._argGeom=n,this._bufParams=i}},es={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};wn.prototype.bufferFixedPrecision=function(t){var n=new Wi(new gi(new se(1)),t.getScale()),i=new kn(this._bufParams);i.setWorkingPrecisionModel(t),i.setNoder(n),this._resultGeometry=i.buffer(this._argGeom,this._distance)},wn.prototype.bufferReducedPrecision=function(){var t=this;if(arguments.length===0){for(var n=wn.MAX_PRECISION_DIGITS;n>=0;n--){try{t.bufferReducedPrecision(n)}catch(f){if(!(f instanceof Ii))throw f;t._saveException=f}if(t._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var i=arguments[0],s=wn.precisionScaleFactor(this._argGeom,this._distance,i),l=new se(s);this.bufferFixedPrecision(l)}},wn.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===se.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},wn.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},wn.prototype.bufferOriginalPrecision=function(){try{var t=new kn(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(n){if(!(n instanceof Cn))throw n;this._saveException=n}},wn.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},wn.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},wn.prototype.interfaces_=function(){return[]},wn.prototype.getClass=function(){return wn},wn.bufferOp=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];return new wn(t).getResultGeometry(n)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof yt&&typeof arguments[1]=="number"){var i=arguments[0],s=arguments[1],l=arguments[2],f=new wn(i);return f.setQuadrantSegments(l),f.getResultGeometry(s)}if(arguments[2]instanceof ae&&arguments[0]instanceof yt&&typeof arguments[1]=="number"){var m=arguments[0],_=arguments[1],S=arguments[2];return new wn(m,S).getResultGeometry(_)}}else if(arguments.length===4){var O=arguments[0],H=arguments[1],X=arguments[2],nt=arguments[3],rt=new wn(O);return rt.setQuadrantSegments(X),rt.setEndCapStyle(nt),rt.getResultGeometry(H)}},wn.precisionScaleFactor=function(t,n,i){var s=t.getEnvelopeInternal(),l=St.max(Math.abs(s.getMaxX()),Math.abs(s.getMaxY()),Math.abs(s.getMinX()),Math.abs(s.getMinY()))+2*(n>0?n:0),f=i-Math.trunc(Math.log(l)/Math.log(10)+1);return Math.pow(10,f)},es.CAP_ROUND.get=function(){return ae.CAP_ROUND},es.CAP_BUTT.get=function(){return ae.CAP_FLAT},es.CAP_FLAT.get=function(){return ae.CAP_FLAT},es.CAP_SQUARE.get=function(){return ae.CAP_SQUARE},es.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(wn,es);var Gn=function(){this._pt=[new C,new C],this._distance=P.NaN,this._isNull=!0};Gn.prototype.getCoordinates=function(){return this._pt},Gn.prototype.getCoordinate=function(t){return this._pt[t]},Gn.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var n=arguments[0],i=arguments[1];if(this._isNull)return this.initialize(n,i),null;var s=n.distance(i);s<this._distance&&this.initialize(n,i,s)}},Gn.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var t=arguments[0],n=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(n),this._distance=t.distance(n),this._isNull=!1}else if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];this._pt[0].setCoordinate(i),this._pt[1].setCoordinate(s),this._distance=l,this._isNull=!1}},Gn.prototype.getDistance=function(){return this._distance},Gn.prototype.setMaximum=function(){if(arguments.length===1){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(arguments.length===2){var n=arguments[0],i=arguments[1];if(this._isNull)return this.initialize(n,i),null;var s=n.distance(i);s>this._distance&&this.initialize(n,i,s)}},Gn.prototype.interfaces_=function(){return[]},Gn.prototype.getClass=function(){return Gn};var yi=function(){};yi.prototype.interfaces_=function(){return[]},yi.prototype.getClass=function(){return yi},yi.computeDistance=function(){if(arguments[2]instanceof Gn&&arguments[0]instanceof Ge&&arguments[1]instanceof C)for(var t=arguments[0],n=arguments[1],i=arguments[2],s=t.getCoordinates(),l=new ft,f=0;f<s.length-1;f++){l.setCoordinates(s[f],s[f+1]);var m=l.closestPoint(n);i.setMinimum(m,n)}else if(arguments[2]instanceof Gn&&arguments[0]instanceof an&&arguments[1]instanceof C){var _=arguments[0],S=arguments[1],O=arguments[2];yi.computeDistance(_.getExteriorRing(),S,O);for(var H=0;H<_.getNumInteriorRing();H++)yi.computeDistance(_.getInteriorRingN(H),S,O)}else if(arguments[2]instanceof Gn&&arguments[0]instanceof yt&&arguments[1]instanceof C){var X=arguments[0],nt=arguments[1],rt=arguments[2];if(X instanceof Ge)yi.computeDistance(X,nt,rt);else if(X instanceof an)yi.computeDistance(X,nt,rt);else if(X instanceof Fe)for(var lt=X,gt=0;gt<lt.getNumGeometries();gt++){var we=lt.getGeometryN(gt);yi.computeDistance(we,nt,rt)}else rt.setMinimum(X.getCoordinate(),nt)}else if(arguments[2]instanceof Gn&&arguments[0]instanceof ft&&arguments[1]instanceof C){var rn=arguments[0],Wn=arguments[1],Ei=arguments[2],Qi=rn.closestPoint(Wn);Ei.setMinimum(Qi,Wn)}};var so=function(t){this._maxPtDist=new Gn,this._inputGeom=t||null},il={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};so.prototype.computeMaxMidpointDistance=function(t){var n=new Xi(this._inputGeom);t.apply(n),this._maxPtDist.setMaximum(n.getMaxPointDistance())},so.prototype.computeMaxVertexDistance=function(t){var n=new Po(this._inputGeom);t.apply(n),this._maxPtDist.setMaximum(n.getMaxPointDistance())},so.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},so.prototype.getDistancePoints=function(){return this._maxPtDist},so.prototype.interfaces_=function(){return[]},so.prototype.getClass=function(){return so},il.MaxPointDistanceFilter.get=function(){return Po},il.MaxMidpointDistanceFilter.get=function(){return Xi},Object.defineProperties(so,il);var Po=function(t){this._maxPtDist=new Gn,this._minPtDist=new Gn,this._geom=t||null};Po.prototype.filter=function(t){this._minPtDist.initialize(),yi.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Po.prototype.getMaxPointDistance=function(){return this._maxPtDist},Po.prototype.interfaces_=function(){return[B]},Po.prototype.getClass=function(){return Po};var Xi=function(t){this._maxPtDist=new Gn,this._minPtDist=new Gn,this._geom=t||null};Xi.prototype.filter=function(t,n){if(n===0)return null;var i=t.getCoordinate(n-1),s=t.getCoordinate(n),l=new C((i.x+s.x)/2,(i.y+s.y)/2);this._minPtDist.initialize(),yi.computeDistance(this._geom,l,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Xi.prototype.isDone=function(){return!1},Xi.prototype.isGeometryChanged=function(){return!1},Xi.prototype.getMaxPointDistance=function(){return this._maxPtDist},Xi.prototype.interfaces_=function(){return[Ye]},Xi.prototype.getClass=function(){return Xi};var Li=function(t){this._comps=t||null};Li.prototype.filter=function(t){t instanceof an&&this._comps.add(t)},Li.prototype.interfaces_=function(){return[je]},Li.prototype.getClass=function(){return Li},Li.getPolygons=function(){if(arguments.length===1){var t=arguments[0];return Li.getPolygons(t,new V)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return n instanceof an?i.add(n):n instanceof Fe&&n.apply(new Li(i)),i}};var Sn=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var t=arguments[0];this._lines=t}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._lines=n,this._isForcedToLineString=i}};Sn.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof ci){var n=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(n),null}t instanceof Ge&&this._lines.add(t)},Sn.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},Sn.prototype.interfaces_=function(){return[li]},Sn.prototype.getClass=function(){return Sn},Sn.getGeometry=function(){if(arguments.length===1){var t=arguments[0];return t.getFactory().buildGeometry(Sn.getLines(t))}if(arguments.length===2){var n=arguments[0],i=arguments[1];return n.getFactory().buildGeometry(Sn.getLines(n,i))}},Sn.getLines=function(){if(arguments.length===1){var t=arguments[0];return Sn.getLines(t,!1)}if(arguments.length===2){if(et(arguments[0],G)&&et(arguments[1],G)){for(var n=arguments[0],i=arguments[1],s=n.iterator();s.hasNext();){var l=s.next();Sn.getLines(l,i)}return i}if(arguments[0]instanceof yt&&typeof arguments[1]=="boolean"){var f=arguments[0],m=arguments[1],_=new V;return f.apply(new Sn(_,m)),_}if(arguments[0]instanceof yt&&et(arguments[1],G)){var S=arguments[0],O=arguments[1];return S instanceof Ge?O.add(S):S.apply(new Sn(O)),O}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&et(arguments[0],G)&&et(arguments[1],G)){for(var H=arguments[0],X=arguments[1],nt=arguments[2],rt=H.iterator();rt.hasNext();){var lt=rt.next();Sn.getLines(lt,X,nt)}return X}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof yt&&et(arguments[1],G)){var gt=arguments[0],we=arguments[1],rn=arguments[2];return gt.apply(new Sn(we,rn)),we}}};var Hr=function(){if(this._boundaryRule=y.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];if(t===null)throw new L("Rule must be non-null");this._boundaryRule=t}}};Hr.prototype.locateInternal=function(){if(arguments[0]instanceof C&&arguments[1]instanceof an){var t=arguments[0],n=arguments[1];if(n.isEmpty())return F.EXTERIOR;var i=n.getExteriorRing(),s=this.locateInPolygonRing(t,i);if(s===F.EXTERIOR)return F.EXTERIOR;if(s===F.BOUNDARY)return F.BOUNDARY;for(var l=0;l<n.getNumInteriorRing();l++){var f=n.getInteriorRingN(l),m=this.locateInPolygonRing(t,f);if(m===F.INTERIOR)return F.EXTERIOR;if(m===F.BOUNDARY)return F.BOUNDARY}return F.INTERIOR}if(arguments[0]instanceof C&&arguments[1]instanceof Ge){var _=arguments[0],S=arguments[1];if(!S.getEnvelopeInternal().intersects(_))return F.EXTERIOR;var O=S.getCoordinates();return S.isClosed()||!_.equals(O[0])&&!_.equals(O[O.length-1])?tt.isOnLine(_,O)?F.INTERIOR:F.EXTERIOR:F.BOUNDARY}if(arguments[0]instanceof C&&arguments[1]instanceof cr){var H=arguments[0];return arguments[1].getCoordinate().equals2D(H)?F.INTERIOR:F.EXTERIOR}},Hr.prototype.locateInPolygonRing=function(t,n){return n.getEnvelopeInternal().intersects(t)?tt.locatePointInRing(t,n.getCoordinates()):F.EXTERIOR},Hr.prototype.intersects=function(t,n){return this.locate(t,n)!==F.EXTERIOR},Hr.prototype.updateLocationInfo=function(t){t===F.INTERIOR&&(this._isIn=!0),t===F.BOUNDARY&&this._numBoundaries++},Hr.prototype.computeLocation=function(t,n){if(n instanceof cr&&this.updateLocationInfo(this.locateInternal(t,n)),n instanceof Ge)this.updateLocationInfo(this.locateInternal(t,n));else if(n instanceof an)this.updateLocationInfo(this.locateInternal(t,n));else if(n instanceof Rr)for(var i=n,s=0;s<i.getNumGeometries();s++){var l=i.getGeometryN(s);this.updateLocationInfo(this.locateInternal(t,l))}else if(n instanceof hi)for(var f=n,m=0;m<f.getNumGeometries();m++){var _=f.getGeometryN(m);this.updateLocationInfo(this.locateInternal(t,_))}else if(n instanceof Fe)for(var S=new di(n);S.hasNext();){var O=S.next();O!==n&&this.computeLocation(t,O)}},Hr.prototype.locate=function(t,n){return n.isEmpty()?F.EXTERIOR:n instanceof Ge?this.locateInternal(t,n):n instanceof an?this.locateInternal(t,n):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,n),this._boundaryRule.isInBoundary(this._numBoundaries)?F.BOUNDARY:this._numBoundaries>0||this._isIn?F.INTERIOR:F.EXTERIOR)},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr};var Vn=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var n=arguments[0],i=arguments[1];t.call(this,n,t.INSIDE_AREA,i)}else if(arguments.length===3){var s=arguments[0],l=arguments[1],f=arguments[2];this._component=s,this._segIndex=l,this._pt=f}},Kh={INSIDE_AREA:{configurable:!0}};Vn.prototype.isInsideArea=function(){return this._segIndex===Vn.INSIDE_AREA},Vn.prototype.getCoordinate=function(){return this._pt},Vn.prototype.getGeometryComponent=function(){return this._component},Vn.prototype.getSegmentIndex=function(){return this._segIndex},Vn.prototype.interfaces_=function(){return[]},Vn.prototype.getClass=function(){return Vn},Kh.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Vn,Kh);var Yi=function(t){this._pts=t||null};Yi.prototype.filter=function(t){t instanceof cr&&this._pts.add(t)},Yi.prototype.interfaces_=function(){return[je]},Yi.prototype.getClass=function(){return Yi},Yi.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof cr?Gr.singletonList(t):Yi.getPoints(t,new V)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return n instanceof cr?i.add(n):n instanceof Fe&&n.apply(new Yi(i)),i}};var Ro=function(){this._locations=null;var t=arguments[0];this._locations=t};Ro.prototype.filter=function(t){(t instanceof cr||t instanceof Ge||t instanceof an)&&this._locations.add(new Vn(t,0,t.getCoordinate()))},Ro.prototype.interfaces_=function(){return[je]},Ro.prototype.getClass=function(){return Ro},Ro.getLocations=function(t){var n=new V;return t.apply(new Ro(n)),n};var bn=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Hr,this._minDistanceLocation=null,this._minDistance=P.MAX_VALUE,arguments.length===2){var t=arguments[0],n=arguments[1];this._geom=[t,n],this._terminateDistance=0}else if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=i,this._geom[1]=s,this._terminateDistance=l}};bn.prototype.computeContainmentDistance=function(){if(arguments.length===0){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=1-n,l=Li.getPolygons(this._geom[n]);if(l.size()>0){var f=Ro.getLocations(this._geom[s]);if(this.computeContainmentDistance(f,l,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[s]=i[0],this._minDistanceLocation[n]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&et(arguments[0],Z)&&et(arguments[1],Z)){for(var m=arguments[0],_=arguments[1],S=arguments[2],O=0;O<m.size();O++)for(var H=m.get(O),X=0;X<_.size();X++)if(this.computeContainmentDistance(H,_.get(X),S),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Vn&&arguments[1]instanceof an){var nt=arguments[0],rt=arguments[1],lt=arguments[2],gt=nt.getCoordinate();if(F.EXTERIOR!==this._ptLocator.locate(gt,rt))return this._minDistance=0,lt[0]=nt,lt[1]=new Vn(rt,gt),null}}},bn.prototype.computeMinDistanceLinesPoints=function(t,n,i){for(var s=0;s<t.size();s++)for(var l=t.get(s),f=0;f<n.size();f++){var m=n.get(f);if(this.computeMinDistance(l,m,i),this._minDistance<=this._terminateDistance)return null}},bn.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),n=Sn.getLines(this._geom[0]),i=Sn.getLines(this._geom[1]),s=Yi.getPoints(this._geom[0]),l=Yi.getPoints(this._geom[1]);return this.computeMinDistanceLines(n,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(n,l,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(i,s,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(s,l,t),void this.updateMinDistance(t,!1))))},bn.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},bn.prototype.updateMinDistance=function(t,n){if(t[0]===null)return null;n?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},bn.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},bn.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 Ge&&arguments[1]instanceof cr){var t=arguments[0],n=arguments[1],i=arguments[2];if(t.getEnvelopeInternal().distance(n.getEnvelopeInternal())>this._minDistance)return null;for(var s=t.getCoordinates(),l=n.getCoordinate(),f=0;f<s.length-1;f++){var m=tt.distancePointLine(l,s[f],s[f+1]);if(m<this._minDistance){this._minDistance=m;var _=new ft(s[f],s[f+1]).closestPoint(l);i[0]=new Vn(t,f,_),i[1]=new Vn(n,0,l)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Ge&&arguments[1]instanceof Ge){var S=arguments[0],O=arguments[1],H=arguments[2];if(S.getEnvelopeInternal().distance(O.getEnvelopeInternal())>this._minDistance)return null;for(var X=S.getCoordinates(),nt=O.getCoordinates(),rt=0;rt<X.length-1;rt++)for(var lt=0;lt<nt.length-1;lt++){var gt=tt.distanceLineLine(X[rt],X[rt+1],nt[lt],nt[lt+1]);if(gt<this._minDistance){this._minDistance=gt;var we=new ft(X[rt],X[rt+1]),rn=new ft(nt[lt],nt[lt+1]),Wn=we.closestPoints(rn);H[0]=new Vn(S,rt,Wn[0]),H[1]=new Vn(O,lt,Wn[1])}if(this._minDistance<=this._terminateDistance)return null}}}},bn.prototype.computeMinDistancePoints=function(t,n,i){for(var s=0;s<t.size();s++)for(var l=t.get(s),f=0;f<n.size();f++){var m=n.get(f),_=l.getCoordinate().distance(m.getCoordinate());if(_<this._minDistance&&(this._minDistance=_,i[0]=new Vn(l,0,l.getCoordinate()),i[1]=new Vn(m,0,m.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},bn.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new L("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},bn.prototype.computeMinDistanceLines=function(t,n,i){for(var s=0;s<t.size();s++)for(var l=t.get(s),f=0;f<n.size();f++){var m=n.get(f);if(this.computeMinDistance(l,m,i),this._minDistance<=this._terminateDistance)return null}},bn.prototype.interfaces_=function(){return[]},bn.prototype.getClass=function(){return bn},bn.distance=function(t,n){return new bn(t,n).distance()},bn.isWithinDistance=function(t,n,i){return new bn(t,n,i).distance()<=i},bn.nearestPoints=function(t,n){return new bn(t,n).nearestPoints()};var Rn=function(){this._pt=[new C,new C],this._distance=P.NaN,this._isNull=!0};Rn.prototype.getCoordinates=function(){return this._pt},Rn.prototype.getCoordinate=function(t){return this._pt[t]},Rn.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var n=arguments[0],i=arguments[1];if(this._isNull)return this.initialize(n,i),null;var s=n.distance(i);s<this._distance&&this.initialize(n,i,s)}},Rn.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var t=arguments[0],n=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(n),this._distance=t.distance(n),this._isNull=!1}else if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];this._pt[0].setCoordinate(i),this._pt[1].setCoordinate(s),this._distance=l,this._isNull=!1}},Rn.prototype.toString=function(){return Qe.toLineString(this._pt[0],this._pt[1])},Rn.prototype.getDistance=function(){return this._distance},Rn.prototype.setMaximum=function(){if(arguments.length===1){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(arguments.length===2){var n=arguments[0],i=arguments[1];if(this._isNull)return this.initialize(n,i),null;var s=n.distance(i);s>this._distance&&this.initialize(n,i,s)}},Rn.prototype.interfaces_=function(){return[]},Rn.prototype.getClass=function(){return Rn};var ri=function(){};ri.prototype.interfaces_=function(){return[]},ri.prototype.getClass=function(){return ri},ri.computeDistance=function(){if(arguments[2]instanceof Rn&&arguments[0]instanceof Ge&&arguments[1]instanceof C)for(var t=arguments[0],n=arguments[1],i=arguments[2],s=new ft,l=t.getCoordinates(),f=0;f<l.length-1;f++){s.setCoordinates(l[f],l[f+1]);var m=s.closestPoint(n);i.setMinimum(m,n)}else if(arguments[2]instanceof Rn&&arguments[0]instanceof an&&arguments[1]instanceof C){var _=arguments[0],S=arguments[1],O=arguments[2];ri.computeDistance(_.getExteriorRing(),S,O);for(var H=0;H<_.getNumInteriorRing();H++)ri.computeDistance(_.getInteriorRingN(H),S,O)}else if(arguments[2]instanceof Rn&&arguments[0]instanceof yt&&arguments[1]instanceof C){var X=arguments[0],nt=arguments[1],rt=arguments[2];if(X instanceof Ge)ri.computeDistance(X,nt,rt);else if(X instanceof an)ri.computeDistance(X,nt,rt);else if(X instanceof Fe)for(var lt=X,gt=0;gt<lt.getNumGeometries();gt++){var we=lt.getGeometryN(gt);ri.computeDistance(we,nt,rt)}else rt.setMinimum(X.getCoordinate(),nt)}else if(arguments[2]instanceof Rn&&arguments[0]instanceof ft&&arguments[1]instanceof C){var rn=arguments[0],Wn=arguments[1],Ei=arguments[2],Qi=rn.closestPoint(Wn);Ei.setMinimum(Qi,Wn)}};var Dr=function(){this._g0=null,this._g1=null,this._ptDist=new Rn,this._densifyFrac=0;var t=arguments[0],n=arguments[1];this._g0=t,this._g1=n},ol={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Dr.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Dr.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new L("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},Dr.prototype.compute=function(t,n){this.computeOrientedDistance(t,n,this._ptDist),this.computeOrientedDistance(n,t,this._ptDist)},Dr.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Dr.prototype.computeOrientedDistance=function(t,n,i){var s=new No(n);if(t.apply(s),i.setMaximum(s.getMaxPointDistance()),this._densifyFrac>0){var l=new $i(n,this._densifyFrac);t.apply(l),i.setMaximum(l.getMaxPointDistance())}},Dr.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Dr.prototype.interfaces_=function(){return[]},Dr.prototype.getClass=function(){return Dr},Dr.distance=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];return new Dr(t,n).distance()}if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2],f=new Dr(i,s);return f.setDensifyFraction(l),f.distance()}},ol.MaxPointDistanceFilter.get=function(){return No},ol.MaxDensifiedByFractionDistanceFilter.get=function(){return $i},Object.defineProperties(Dr,ol);var No=function(){this._maxPtDist=new Rn,this._minPtDist=new Rn,this._euclideanDist=new ri,this._geom=null;var t=arguments[0];this._geom=t};No.prototype.filter=function(t){this._minPtDist.initialize(),ri.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},No.prototype.getMaxPointDistance=function(){return this._maxPtDist},No.prototype.interfaces_=function(){return[B]},No.prototype.getClass=function(){return No};var $i=function(){this._maxPtDist=new Rn,this._minPtDist=new Rn,this._geom=null,this._numSubSegs=0;var t=arguments[0],n=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/n))};$i.prototype.filter=function(t,n){if(n===0)return null;for(var i=t.getCoordinate(n-1),s=t.getCoordinate(n),l=(s.x-i.x)/this._numSubSegs,f=(s.y-i.y)/this._numSubSegs,m=0;m<this._numSubSegs;m++){var _=i.x+m*l,S=i.y+m*f,O=new C(_,S);this._minPtDist.initialize(),ri.computeDistance(this._geom,O,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},$i.prototype.isDone=function(){return!1},$i.prototype.isGeometryChanged=function(){return!1},$i.prototype.getMaxPointDistance=function(){return this._maxPtDist},$i.prototype.interfaces_=function(){return[Ye]},$i.prototype.getClass=function(){return $i};var pr=function(t,n,i){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=t||null,this._bufDistance=n||null,this._result=i||null},sl={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};pr.prototype.checkMaximumDistance=function(t,n,i){var s=new Dr(n,t);if(s.setDensifyFraction(.25),this._maxDistanceFound=s.orientedDistance(),this._maxDistanceFound>i){this._isValid=!1;var l=s.getCoordinates();this._errorLocation=l[1],this._errorIndicator=t.getFactory().createLineString(l),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Qe.toLineString(l[0],l[1])+")"}},pr.prototype.isValid=function(){var t=Math.abs(this._bufDistance),n=pr.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-n,this._maxValidDistance=t+n,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),pr.VERBOSE&&Ee.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},pr.prototype.checkNegativeValid=function(){if(!(this._input instanceof an||this._input instanceof hi||this._input instanceof Fe))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},pr.prototype.getErrorIndicator=function(){return this._errorIndicator},pr.prototype.checkMinimumDistance=function(t,n,i){var s=new bn(t,n,i);if(this._minDistanceFound=s.distance(),this._minDistanceFound<i){this._isValid=!1;var l=s.nearestPoints();this._errorLocation=s.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(l),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+Qe.toLineString(l[0],l[1])+" )"}},pr.prototype.checkPositiveValid=function(){var t=this._result.getBoundary();if(this.checkMinimumDistance(this._input,t,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,t,this._maxValidDistance)},pr.prototype.getErrorLocation=function(){return this._errorLocation},pr.prototype.getPolygonLines=function(t){for(var n=new V,i=new Sn(n),s=Li.getPolygons(t).iterator();s.hasNext();)s.next().apply(i);return t.getFactory().buildGeometry(n)},pr.prototype.getErrorMessage=function(){return this._errMsg},pr.prototype.interfaces_=function(){return[]},pr.prototype.getClass=function(){return pr},sl.VERBOSE.get=function(){return!1},sl.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(pr,sl);var An=function(t,n,i){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=n||null,this._result=i||null},al={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};An.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},An.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*An.MAX_ENV_DIFF_FRAC;t===0&&(t=.001);var n=new at(this._input.getEnvelopeInternal());n.expandBy(this._distance);var i=new at(this._result.getEnvelopeInternal());i.expandBy(t),i.contains(n)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(i)),this.report("Envelope")},An.prototype.checkDistance=function(){var t=new pr(this._input,this._distance,this._result);t.isValid()||(this._isValid=!1,this._errorMsg=t.getErrorMessage(),this._errorLocation=t.getErrorLocation(),this._errorIndicator=t.getErrorIndicator()),this.report("Distance")},An.prototype.checkArea=function(){var t=this._input.getArea(),n=this._result.getArea();this._distance>0&&t>n&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t<n&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},An.prototype.checkPolygonal=function(){this._result instanceof an||this._result instanceof hi||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},An.prototype.getErrorIndicator=function(){return this._errorIndicator},An.prototype.getErrorLocation=function(){return this._errorLocation},An.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"))},An.prototype.report=function(t){if(!An.VERBOSE)return null;Ee.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},An.prototype.getErrorMessage=function(){return this._errorMsg},An.prototype.interfaces_=function(){return[]},An.prototype.getClass=function(){return An},An.isValidMsg=function(t,n,i){var s=new An(t,n,i);return s.isValid()?null:s.getErrorMessage()},An.isValid=function(t,n,i){return!!new An(t,n,i).isValid()},al.VERBOSE.get=function(){return!1},al.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(An,al);var ii=function(){this._pts=null,this._data=null;var t=arguments[0],n=arguments[1];this._pts=t,this._data=n};ii.prototype.getCoordinates=function(){return this._pts},ii.prototype.size=function(){return this._pts.length},ii.prototype.getCoordinate=function(t){return this._pts[t]},ii.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},ii.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Ao.octant(this.getCoordinate(t),this.getCoordinate(t+1))},ii.prototype.setData=function(t){this._data=t},ii.prototype.getData=function(){return this._data},ii.prototype.toString=function(){return Qe.toLineString(new Ze(this._pts))},ii.prototype.interfaces_=function(){return[pi]},ii.prototype.getClass=function(){return ii};var vn=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new V,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};vn.prototype.getInteriorIntersection=function(){return this._interiorIntersection},vn.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},vn.prototype.getIntersectionSegments=function(){return this._intSegments},vn.prototype.count=function(){return this._intersectionCount},vn.prototype.getIntersections=function(){return this._intersections},vn.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},vn.prototype.setKeepIntersections=function(t){this._keepIntersections=t},vn.prototype.processIntersections=function(t,n,i,s){if(!this._findAllIntersections&&this.hasIntersection()||t===i&&n===s||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,n)||this.isEndSegment(i,s)))return null;var l=t.getCoordinates()[n],f=t.getCoordinates()[n+1],m=i.getCoordinates()[s],_=i.getCoordinates()[s+1];this._li.computeIntersection(l,f,m,_),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=l,this._intSegments[1]=f,this._intSegments[2]=m,this._intSegments[3]=_,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},vn.prototype.isEndSegment=function(t,n){return n===0||n>=t.size()-2},vn.prototype.hasIntersection=function(){return this._interiorIntersection!==null},vn.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},vn.prototype.interfaces_=function(){return[io]},vn.prototype.getClass=function(){return vn},vn.createAllIntersectionsFinder=function(t){var n=new vn(t);return n.setFindAllIntersections(!0),n},vn.createAnyIntersectionFinder=function(t){return new vn(t)},vn.createIntersectionCounter=function(t){var n=new vn(t);return n.setFindAllIntersections(!0),n.setKeepIntersections(!1),n};var qr=function(){this._li=new Pr,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};qr.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},qr.prototype.getIntersections=function(){return this._segInt.getIntersections()},qr.prototype.isValid=function(){return this.execute(),this._isValid},qr.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},qr.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new vn(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new rl;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},qr.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Ii(this.getErrorMessage(),this._segInt.getInteriorIntersection())},qr.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Qe.toLineString(t[0],t[1])+" and "+Qe.toLineString(t[2],t[3])},qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr},qr.computeIntersections=function(t){var n=new qr(t);return n.setFindAllIntersections(!0),n.isValid(),n.getIntersections()};var ao=function t(){this._nv=null;var n=arguments[0];this._nv=new qr(t.toSegmentStrings(n))};ao.prototype.checkValid=function(){this._nv.checkValid()},ao.prototype.interfaces_=function(){return[]},ao.prototype.getClass=function(){return ao},ao.toSegmentStrings=function(t){for(var n=new V,i=t.iterator();i.hasNext();){var s=i.next();n.add(new ii(s.getCoordinates(),s))}return n},ao.checkValid=function(t){new ao(t).checkValid()};var Lo=function(t){this._mapOp=t};Lo.prototype.map=function(t){for(var n=new V,i=0;i<t.getNumGeometries();i++){var s=this._mapOp.map(t.getGeometryN(i));s.isEmpty()||n.add(s)}return t.getFactory().createGeometryCollection(Tt.toGeometryArray(n))},Lo.prototype.interfaces_=function(){return[]},Lo.prototype.getClass=function(){return Lo},Lo.map=function(t,n){return new Lo(n).map(t)};var oi=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new V,this._resultLineList=new V;var t=arguments[0],n=arguments[1],i=arguments[2];this._op=t,this._geometryFactory=n,this._ptLocator=i};oi.prototype.collectLines=function(t){for(var n=this._op.getGraph().getEdgeEnds().iterator();n.hasNext();){var i=n.next();this.collectLineEdge(i,t,this._lineEdgesList),this.collectBoundaryTouchEdge(i,t,this._lineEdgesList)}},oi.prototype.labelIsolatedLine=function(t,n){var i=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(n));t.getLabel().setLocation(n,i)},oi.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},oi.prototype.collectLineEdge=function(t,n,i){var s=t.getLabel(),l=t.getEdge();t.isLineEdge()&&(t.isVisited()||!xt.isResultOfOp(s,n)||l.isCovered()||(i.add(l),t.setVisitedEdge(!0)))},oi.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();)t.next().getEdges().findCoveredLineEdges();for(var n=this._op.getGraph().getEdgeEnds().iterator();n.hasNext();){var i=n.next(),s=i.getEdge();if(i.isLineEdge()&&!s.isCoveredSet()){var l=this._op.isCoveredByA(i.getCoordinate());s.setCovered(l)}}},oi.prototype.labelIsolatedLines=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next(),s=i.getLabel();i.isIsolated()&&(s.isNull(0)?this.labelIsolatedLine(i,0):this.labelIsolatedLine(i,1))}},oi.prototype.buildLines=function(t){for(var n=this._lineEdgesList.iterator();n.hasNext();){var i=n.next(),s=this._geometryFactory.createLineString(i.getCoordinates());this._resultLineList.add(s),i.setInResult(!0)}},oi.prototype.collectBoundaryTouchEdge=function(t,n,i){var s=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(_t.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(xt.isResultOfOp(s,n)&&n===xt.INTERSECTION&&(i.add(t.getEdge()),t.setVisitedEdge(!0))))},oi.prototype.interfaces_=function(){return[]},oi.prototype.getClass=function(){return oi};var Do=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new V;var t=arguments[0],n=arguments[1];this._op=t,this._geometryFactory=n};Do.prototype.filterCoveredNodeToPoint=function(t){var n=t.getCoordinate();if(!this._op.isCoveredByLA(n)){var i=this._geometryFactory.createPoint(n);this._resultPointList.add(i)}},Do.prototype.extractNonCoveredResultNodes=function(t){for(var n=this._op.getGraph().getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isInResult()&&!i.isIncidentEdgeInResult()&&(i.getEdges().getDegree()===0||t===xt.INTERSECTION)){var s=i.getLabel();xt.isResultOfOp(s,t)&&this.filterCoveredNodeToPoint(i)}}},Do.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},Do.prototype.interfaces_=function(){return[]},Do.prototype.getClass=function(){return Do};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(t,n){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},nr.prototype.transformPolygon=function(t,n){var i=!0,s=this.transformLinearRing(t.getExteriorRing(),t);s!==null&&s instanceof ci&&!s.isEmpty()||(i=!1);for(var l=new V,f=0;f<t.getNumInteriorRing();f++){var m=this.transformLinearRing(t.getInteriorRingN(f),t);m===null||m.isEmpty()||(m instanceof ci||(i=!1),l.add(m))}if(i)return this._factory.createPolygon(s,l.toArray([]));var _=new V;return s!==null&&_.add(s),_.addAll(l),this._factory.buildGeometry(_)},nr.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},nr.prototype.getInputGeometry=function(){return this._inputGeom},nr.prototype.transformMultiLineString=function(t,n){for(var i=new V,s=0;s<t.getNumGeometries();s++){var l=this.transformLineString(t.getGeometryN(s),t);l!==null&&(l.isEmpty()||i.add(l))}return this._factory.buildGeometry(i)},nr.prototype.transformCoordinates=function(t,n){return this.copy(t)},nr.prototype.transformLineString=function(t,n){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},nr.prototype.transformMultiPoint=function(t,n){for(var i=new V,s=0;s<t.getNumGeometries();s++){var l=this.transformPoint(t.getGeometryN(s),t);l!==null&&(l.isEmpty()||i.add(l))}return this._factory.buildGeometry(i)},nr.prototype.transformMultiPolygon=function(t,n){for(var i=new V,s=0;s<t.getNumGeometries();s++){var l=this.transformPolygon(t.getGeometryN(s),t);l!==null&&(l.isEmpty()||i.add(l))}return this._factory.buildGeometry(i)},nr.prototype.copy=function(t){return t.copy()},nr.prototype.transformGeometryCollection=function(t,n){for(var i=new V,s=0;s<t.getNumGeometries();s++){var l=this.transform(t.getGeometryN(s));l!==null&&(this._pruneEmptyGeometry&&l.isEmpty()||i.add(l))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Tt.toGeometryArray(i)):this._factory.buildGeometry(i)},nr.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof cr)return this.transformPoint(t,null);if(t instanceof Zo)return this.transformMultiPoint(t,null);if(t instanceof ci)return this.transformLinearRing(t,null);if(t instanceof Ge)return this.transformLineString(t,null);if(t instanceof Rr)return this.transformMultiLineString(t,null);if(t instanceof an)return this.transformPolygon(t,null);if(t instanceof hi)return this.transformMultiPolygon(t,null);if(t instanceof Fe)return this.transformGeometryCollection(t,null);throw new L("Unknown Geometry subtype: "+t.getClass().getName())},nr.prototype.transformLinearRing=function(t,n){var i=this.transformCoordinates(t.getCoordinateSequence(),t);if(i===null)return this._factory.createLinearRing(null);var s=i.size();return s>0&&s<4&&!this._preserveType?this._factory.createLineString(i):this._factory.createLinearRing(i)},nr.prototype.interfaces_=function(){return[]},nr.prototype.getClass=function(){return nr};var vi=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new ft,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Ge&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];t.call(this,n.getCoordinates(),i)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var s=arguments[0],l=arguments[1];this._srcPts=s,this._isClosed=t.isClosed(s),this._snapTolerance=l}};vi.prototype.snapVertices=function(t,n){for(var i=this._isClosed?t.size()-1:t.size(),s=0;s<i;s++){var l=t.get(s),f=this.findSnapForVertex(l,n);f!==null&&(t.set(s,new C(f)),s===0&&this._isClosed&&t.set(t.size()-1,new C(f)))}},vi.prototype.findSnapForVertex=function(t,n){for(var i=0;i<n.length;i++){if(t.equals2D(n[i]))return null;if(t.distance(n[i])<this._snapTolerance)return n[i]}return null},vi.prototype.snapTo=function(t){var n=new Q(this._srcPts);return this.snapVertices(n,t),this.snapSegments(n,t),n.toCoordinateArray()},vi.prototype.snapSegments=function(t,n){if(n.length===0)return null;var i=n.length;n[0].equals2D(n[n.length-1])&&(i=n.length-1);for(var s=0;s<i;s++){var l=n[s],f=this.findSegmentIndexToSnap(l,t);f>=0&&t.add(f+1,new C(l),!1)}},vi.prototype.findSegmentIndexToSnap=function(t,n){for(var i=P.MAX_VALUE,s=-1,l=0;l<n.size()-1;l++){if(this._seg.p0=n.get(l),this._seg.p1=n.get(l+1),this._seg.p0.equals2D(t)||this._seg.p1.equals2D(t)){if(this._allowSnappingToSourceVertices)continue;return-1}var f=this._seg.distance(t);f<this._snapTolerance&&f<i&&(i=f,s=l)}return s},vi.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},vi.prototype.interfaces_=function(){return[]},vi.prototype.getClass=function(){return vi},vi.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var Ke=function(t){this._srcGeom=t||null},Qh={SNAP_PRECISION_FACTOR:{configurable:!0}};Ke.prototype.snapTo=function(t,n){var i=this.extractTargetCoordinates(t);return new jh(n,i).transform(this._srcGeom)},Ke.prototype.snapToSelf=function(t,n){var i=this.extractTargetCoordinates(this._srcGeom),s=new jh(t,i,!0).transform(this._srcGeom),l=s;return n&&et(l,Gi)&&(l=s.buffer(0)),l},Ke.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},Ke.prototype.extractTargetCoordinates=function(t){for(var n=new w,i=t.getCoordinates(),s=0;s<i.length;s++)n.add(i[s]);return n.toArray(new Array(0).fill(null))},Ke.prototype.computeMinimumSegmentLength=function(t){for(var n=P.MAX_VALUE,i=0;i<t.length-1;i++){var s=t[i].distance(t[i+1]);s<n&&(n=s)}return n},Ke.prototype.interfaces_=function(){return[]},Ke.prototype.getClass=function(){return Ke},Ke.snap=function(t,n,i){var s=new Array(2).fill(null),l=new Ke(t);s[0]=l.snapTo(n,i);var f=new Ke(n);return s[1]=f.snapTo(s[0],i),s},Ke.computeOverlaySnapTolerance=function(){if(arguments.length===1){var t=arguments[0],n=Ke.computeSizeBasedSnapTolerance(t),i=t.getPrecisionModel();if(i.getType()===se.FIXED){var s=1/i.getScale()*2/1.415;s>n&&(n=s)}return n}if(arguments.length===2){var l=arguments[0],f=arguments[1];return Math.min(Ke.computeOverlaySnapTolerance(l),Ke.computeOverlaySnapTolerance(f))}},Ke.computeSizeBasedSnapTolerance=function(t){var n=t.getEnvelopeInternal();return Math.min(n.getHeight(),n.getWidth())*Ke.SNAP_PRECISION_FACTOR},Ke.snapToSelf=function(t,n,i){return new Ke(t).snapToSelf(n,i)},Qh.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Ke,Qh);var jh=function(t){function n(i,s,l){t.call(this),this._snapTolerance=i||null,this._snapPts=s||null,this._isSelfSnap=l!==void 0&&l}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.snapLine=function(i,s){var l=new vi(i,this._snapTolerance);return l.setAllowSnappingToSourceVertices(this._isSelfSnap),l.snapTo(s)},n.prototype.transformCoordinates=function(i,s){var l=i.toCoordinateArray(),f=this.snapLine(l,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(f)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(nr),Hn=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Hn.prototype.getCommon=function(){return P.longBitsToDouble(this._commonBits)},Hn.prototype.add=function(t){var n=P.doubleToLongBits(t);if(this._isFirst)return this._commonBits=n,this._commonSignExp=Hn.signExpBits(this._commonBits),this._isFirst=!1,null;if(Hn.signExpBits(n)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Hn.numCommonMostSigMantissaBits(this._commonBits,n),this._commonBits=Hn.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},Hn.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],n=P.longBitsToDouble(t),i="0000000000000000000000000000000000000000000000000000000000000000"+P.toBinaryString(t),s=i.substring(i.length-64);return s.substring(0,1)+" "+s.substring(1,12)+"(exp) "+s.substring(12)+" [ "+n+" ]"}},Hn.prototype.interfaces_=function(){return[]},Hn.prototype.getClass=function(){return Hn},Hn.getBit=function(t,n){return t&1<<n?1:0},Hn.signExpBits=function(t){return t>>52},Hn.zeroLowerBits=function(t,n){return t&~((1<<n)-1)},Hn.numCommonMostSigMantissaBits=function(t,n){for(var i=0,s=52;s>=0;s--){if(Hn.getBit(t,s)!==Hn.getBit(n,s))return i;i++}return 52};var Zi=function(){this._commonCoord=null,this._ccFilter=new Oo},ul={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Zi.prototype.addCommonBits=function(t){var n=new Ji(this._commonCoord);t.apply(n),t.geometryChanged()},Zi.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var n=new C(this._commonCoord);n.x=-n.x,n.y=-n.y;var i=new Ji(n);return t.apply(i),t.geometryChanged(),t},Zi.prototype.getCommonCoordinate=function(){return this._commonCoord},Zi.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Zi.prototype.interfaces_=function(){return[]},Zi.prototype.getClass=function(){return Zi},ul.CommonCoordinateFilter.get=function(){return Oo},ul.Translater.get=function(){return Ji},Object.defineProperties(Zi,ul);var Oo=function(){this._commonBitsX=new Hn,this._commonBitsY=new Hn};Oo.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},Oo.prototype.getCommonCoordinate=function(){return new C(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Oo.prototype.interfaces_=function(){return[B]},Oo.prototype.getClass=function(){return Oo};var Ji=function(){this.trans=null;var t=arguments[0];this.trans=t};Ji.prototype.filter=function(t,n){var i=t.getOrdinate(n,0)+this.trans.x,s=t.getOrdinate(n,1)+this.trans.y;t.setOrdinate(n,0,i),t.setOrdinate(n,1,s)},Ji.prototype.isDone=function(){return!1},Ji.prototype.isGeometryChanged=function(){return!0},Ji.prototype.interfaces_=function(){return[Ye]},Ji.prototype.getClass=function(){return Ji};var _n=function(t,n){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=n,this.computeSnapTolerance()};_n.prototype.selfSnap=function(t){return new Ke(t).snapTo(t,this._snapTolerance)},_n.prototype.removeCommonBits=function(t){this._cbr=new Zi,this._cbr.add(t[0]),this._cbr.add(t[1]);var n=new Array(2).fill(null);return n[0]=this._cbr.removeCommonBits(t[0].copy()),n[1]=this._cbr.removeCommonBits(t[1].copy()),n},_n.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},_n.prototype.getResultGeometry=function(t){var n=this.snap(this._geom),i=xt.overlayOp(n[0],n[1],t);return this.prepareResult(i)},_n.prototype.checkValid=function(t){t.isValid()||Ee.out.println("Snapped geometry is invalid")},_n.prototype.computeSnapTolerance=function(){this._snapTolerance=Ke.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},_n.prototype.snap=function(t){var n=this.removeCommonBits(t);return Ke.snap(n[0],n[1],this._snapTolerance)},_n.prototype.interfaces_=function(){return[]},_n.prototype.getClass=function(){return _n},_n.overlayOp=function(t,n,i){return new _n(t,n).getResultGeometry(i)},_n.union=function(t,n){return _n.overlayOp(t,n,xt.UNION)},_n.intersection=function(t,n){return _n.overlayOp(t,n,xt.INTERSECTION)},_n.symDifference=function(t,n){return _n.overlayOp(t,n,xt.SYMDIFFERENCE)},_n.difference=function(t,n){return _n.overlayOp(t,n,xt.DIFFERENCE)};var qn=function(t,n){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=n};qn.prototype.getResultGeometry=function(t){var n=null,i=!1,s=null;try{n=xt.overlayOp(this._geom[0],this._geom[1],t),i=!0}catch(l){if(!(l instanceof Cn))throw l;s=l}if(!i)try{n=_n.overlayOp(this._geom[0],this._geom[1],t)}catch(l){throw l instanceof Cn?s:l}return n},qn.prototype.interfaces_=function(){return[]},qn.prototype.getClass=function(){return qn},qn.overlayOp=function(t,n,i){return new qn(t,n).getResultGeometry(i)},qn.union=function(t,n){return qn.overlayOp(t,n,xt.UNION)},qn.intersection=function(t,n){return qn.overlayOp(t,n,xt.INTERSECTION)},qn.symDifference=function(t,n){return qn.overlayOp(t,n,xt.SYMDIFFERENCE)},qn.difference=function(t,n){return qn.overlayOp(t,n,xt.DIFFERENCE)};var Zs=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],n=arguments[1];this.mce=t,this.chainIndex=n};Zs.prototype.computeIntersections=function(t,n){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,n)},Zs.prototype.interfaces_=function(){return[]},Zs.prototype.getClass=function(){return Zs};var dr=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var n=arguments[0],i=arguments[1];this._eventType=t.DELETE,this._xValue=n,this._insertEvent=i}else if(arguments.length===3){var s=arguments[0],l=arguments[1],f=arguments[2];this._eventType=t.INSERT,this._label=s,this._xValue=l,this._obj=f}},ll={INSERT:{configurable:!0},DELETE:{configurable:!0}};dr.prototype.isDelete=function(){return this._eventType===dr.DELETE},dr.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},dr.prototype.getObject=function(){return this._obj},dr.prototype.compareTo=function(t){var n=t;return this._xValue<n._xValue?-1:this._xValue>n._xValue?1:this._eventType<n._eventType?-1:this._eventType>n._eventType?1:0},dr.prototype.getInsertEvent=function(){return this._insertEvent},dr.prototype.isInsert=function(){return this._eventType===dr.INSERT},dr.prototype.isSameLabel=function(t){return this._label!==null&&this._label===t._label},dr.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},dr.prototype.interfaces_=function(){return[k]},dr.prototype.getClass=function(){return dr},ll.INSERT.get=function(){return 1},ll.DELETE.get=function(){return 2},Object.defineProperties(dr,ll);var Oa=function(){};Oa.prototype.interfaces_=function(){return[]},Oa.prototype.getClass=function(){return Oa};var Tn=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 t=arguments[0],n=arguments[1],i=arguments[2];this._li=t,this._includeProper=n,this._recordIsolated=i};Tn.prototype.isTrivialIntersection=function(t,n,i,s){if(t===i&&this._li.getIntersectionNum()===1){if(Tn.isAdjacentSegments(n,s))return!0;if(t.isClosed()){var l=t.getNumPoints()-1;if(n===0&&s===l||s===0&&n===l)return!0}}return!1},Tn.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Tn.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},Tn.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Tn.prototype.isBoundaryPointInternal=function(t,n){for(var i=n.iterator();i.hasNext();){var s=i.next().getCoordinate();if(t.isIntersection(s))return!0}return!1},Tn.prototype.hasProperIntersection=function(){return this._hasProper},Tn.prototype.hasIntersection=function(){return this._hasIntersection},Tn.prototype.isDone=function(){return this._isDone},Tn.prototype.isBoundaryPoint=function(t,n){return n!==null&&(!!this.isBoundaryPointInternal(t,n[0])||!!this.isBoundaryPointInternal(t,n[1]))},Tn.prototype.setBoundaryNodes=function(t,n){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=n},Tn.prototype.addIntersections=function(t,n,i,s){if(t===i&&n===s)return null;this.numTests++;var l=t.getCoordinates()[n],f=t.getCoordinates()[n+1],m=i.getCoordinates()[s],_=i.getCoordinates()[s+1];this._li.computeIntersection(l,f,m,_),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),i.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,n,i,s)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,n,0),i.addIntersections(this._li,s,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))))},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn},Tn.isAdjacentSegments=function(t,n){return Math.abs(t-n)===1};var R0=function(t){function n(){t.call(this),this.events=new V,this.nOverlaps=null}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.prepareEvents=function(){Gr.sort(this.events);for(var i=0;i<this.events.size();i++){var s=this.events.get(i);s.isDelete()&&s.getInsertEvent().setDeleteEventIndex(i)}},n.prototype.computeIntersections=function(){if(arguments.length===1){var i=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var s=0;s<this.events.size();s++){var l=this.events.get(s);if(l.isInsert()&&this.processOverlaps(s,l.getDeleteEventIndex(),l,i),i.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof Tn&&et(arguments[0],Z)&&et(arguments[1],Z)){var f=arguments[0],m=arguments[1],_=arguments[2];this.addEdges(f,f),this.addEdges(m,m),this.computeIntersections(_)}else if(typeof arguments[2]=="boolean"&&et(arguments[0],Z)&&arguments[1]instanceof Tn){var S=arguments[0],O=arguments[1];arguments[2]?this.addEdges(S,null):this.addEdges(S),this.computeIntersections(O)}}},n.prototype.addEdge=function(i,s){for(var l=i.getMonotoneChainEdge(),f=l.getStartIndexes(),m=0;m<f.length-1;m++){var _=new Zs(l,m),S=new dr(s,l.getMinX(m),_);this.events.add(S),this.events.add(new dr(l.getMaxX(m),S))}},n.prototype.processOverlaps=function(i,s,l,f){for(var m=l.getObject(),_=i;_<s;_++){var S=this.events.get(_);if(S.isInsert()){var O=S.getObject();l.isSameLabel(S)||(m.computeIntersections(O,f),this.nOverlaps++)}}},n.prototype.addEdges=function(){if(arguments.length===1)for(var i=arguments[0].iterator();i.hasNext();){var s=i.next();this.addEdge(s,s)}else if(arguments.length===2)for(var l=arguments[0],f=arguments[1],m=l.iterator();m.hasNext();){var _=m.next();this.addEdge(_,f)}},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Oa),_i=function(){this._min=P.POSITIVE_INFINITY,this._max=P.NEGATIVE_INFINITY},tf={NodeComparator:{configurable:!0}};_i.prototype.getMin=function(){return this._min},_i.prototype.intersects=function(t,n){return!(this._min>n||this._max<t)},_i.prototype.getMax=function(){return this._max},_i.prototype.toString=function(){return Qe.toLineString(new C(this._min,0),new C(this._max,0))},_i.prototype.interfaces_=function(){return[]},_i.prototype.getClass=function(){return _i},tf.NodeComparator.get=function(){return Js},Object.defineProperties(_i,tf);var Js=function(){};Js.prototype.compare=function(t,n){var i=t,s=n,l=(i._min+i._max)/2,f=(s._min+s._max)/2;return l<f?-1:l>f?1:0},Js.prototype.interfaces_=function(){return[q]},Js.prototype.getClass=function(){return Js};var N0=function(t){function n(){t.call(this),this._item=null;var i=arguments[0],s=arguments[1],l=arguments[2];this._min=i,this._max=s,this._item=l}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.query=function(i,s,l){if(!this.intersects(i,s))return null;l.visitItem(this._item)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(_i),L0=function(t){function n(){t.call(this),this._node1=null,this._node2=null;var i=arguments[0],s=arguments[1];this._node1=i,this._node2=s,this.buildExtent(this._node1,this._node2)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.buildExtent=function(i,s){this._min=Math.min(i._min,s._min),this._max=Math.max(i._max,s._max)},n.prototype.query=function(i,s,l){if(!this.intersects(i,s))return null;this._node1!==null&&this._node1.query(i,s,l),this._node2!==null&&this._node2.query(i,s,l)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(_i),xi=function(){this._leaves=new V,this._root=null,this._level=0};xi.prototype.buildTree=function(){Gr.sort(this._leaves,new _i.NodeComparator);for(var t=this._leaves,n=null,i=new V;;){if(this.buildLevel(t,i),i.size()===1)return i.get(0);n=t,t=i,i=n}},xi.prototype.insert=function(t,n,i){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new N0(t,n,i))},xi.prototype.query=function(t,n,i){this.init(),this._root.query(t,n,i)},xi.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},xi.prototype.printNode=function(t){Ee.out.println(Qe.toLineString(new C(t._min,this._level),new C(t._max,this._level)))},xi.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},xi.prototype.buildLevel=function(t,n){this._level++,n.clear();for(var i=0;i<t.size();i+=2){var s=t.get(i);if((i+1<t.size()?t.get(i):null)===null)n.add(s);else{var l=new L0(t.get(i),t.get(i+1));n.add(l)}}},xi.prototype.interfaces_=function(){return[]},xi.prototype.getClass=function(){return xi};var ns=function(){this._items=new V};ns.prototype.visitItem=function(t){this._items.add(t)},ns.prototype.getItems=function(){return this._items},ns.prototype.interfaces_=function(){return[Vi]},ns.prototype.getClass=function(){return ns};var rs=function(){this._index=null;var t=arguments[0];if(!et(t,Gi))throw new L("Argument must be Polygonal");this._index=new uo(t)},cl={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};rs.prototype.locate=function(t){var n=new Un(t),i=new is(n);return this._index.query(t.y,t.y,i),n.getLocation()},rs.prototype.interfaces_=function(){return[jo]},rs.prototype.getClass=function(){return rs},cl.SegmentVisitor.get=function(){return is},cl.IntervalIndexedGeometry.get=function(){return uo},Object.defineProperties(rs,cl);var is=function(){this._counter=null;var t=arguments[0];this._counter=t};is.prototype.visitItem=function(t){var n=t;this._counter.countSegment(n.getCoordinate(0),n.getCoordinate(1))},is.prototype.interfaces_=function(){return[Vi]},is.prototype.getClass=function(){return is};var uo=function(){this._index=new xi;var t=arguments[0];this.init(t)};uo.prototype.init=function(t){for(var n=Sn.getLines(t).iterator();n.hasNext();){var i=n.next().getCoordinates();this.addLine(i)}},uo.prototype.addLine=function(t){for(var n=1;n<t.length;n++){var i=new ft(t[n-1],t[n]),s=Math.min(i.p0.y,i.p1.y),l=Math.max(i.p0.y,i.p1.y);this._index.insert(s,l,i)}},uo.prototype.query=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1],i=new ns;return this._index.query(t,n,i),i.getItems()}if(arguments.length===3){var s=arguments[0],l=arguments[1],f=arguments[2];this._index.query(s,l,f)}},uo.prototype.interfaces_=function(){return[]},uo.prototype.getClass=function(){return uo};var Ks=function(t){function n(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new Oh,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Hr,arguments.length===2){var i=arguments[0],s=arguments[1],l=y.OGC_SFS_BOUNDARY_RULE;this._argIndex=i,this._parentGeom=s,this._boundaryNodeRule=l,s!==null&&this.add(s)}else if(arguments.length===3){var f=arguments[0],m=arguments[1],_=arguments[2];this._argIndex=f,this._parentGeom=m,this._boundaryNodeRule=_,m!==null&&this.add(m)}}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.insertBoundaryPoint=function(i,s){var l=this._nodes.addNode(s).getLabel(),f=1;F.NONE,l.getLocation(i,j.ON)===F.BOUNDARY&&f++;var m=n.determineBoundary(this._boundaryNodeRule,f);l.setLocation(i,m)},n.prototype.computeSelfNodes=function(){if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.computeSelfNodes(i,s,!1)}if(arguments.length===3){var l=arguments[0],f=arguments[1],m=arguments[2],_=new Tn(l,!0,!1);_.setIsDoneIfProperInt(m);var S=this.createEdgeSetIntersector(),O=this._parentGeom instanceof ci||this._parentGeom instanceof an||this._parentGeom instanceof hi,H=f||!O;return S.computeIntersections(this._edges,_,H),this.addSelfIntersectionNodes(this._argIndex),_}},n.prototype.computeSplitEdges=function(i){for(var s=this._edges.iterator();s.hasNext();)s.next().eiList.addSplitEdges(i)},n.prototype.computeEdgeIntersections=function(i,s,l){var f=new Tn(s,l,!0);return f.setBoundaryNodes(this.getBoundaryNodes(),i.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,i._edges,f),f},n.prototype.getGeometry=function(){return this._parentGeom},n.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},n.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},n.prototype.addPoint=function(){if(arguments[0]instanceof cr){var i=arguments[0].getCoordinate();this.insertPoint(this._argIndex,i,F.INTERIOR)}else if(arguments[0]instanceof C){var s=arguments[0];this.insertPoint(this._argIndex,s,F.INTERIOR)}},n.prototype.addPolygon=function(i){this.addPolygonRing(i.getExteriorRing(),F.EXTERIOR,F.INTERIOR);for(var s=0;s<i.getNumInteriorRing();s++){var l=i.getInteriorRingN(s);this.addPolygonRing(l,F.INTERIOR,F.EXTERIOR)}},n.prototype.addEdge=function(i){this.insertEdge(i);var s=i.getCoordinates();this.insertPoint(this._argIndex,s[0],F.BOUNDARY),this.insertPoint(this._argIndex,s[s.length-1],F.BOUNDARY)},n.prototype.addLineString=function(i){var s=J.removeRepeatedPoints(i.getCoordinates());if(s.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=s[0],null;var l=new Da(s,new Me(this._argIndex,F.INTERIOR));this._lineEdgeMap.put(i,l),this.insertEdge(l),_t.isTrue(s.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,s[0]),this.insertBoundaryPoint(this._argIndex,s[s.length-1])},n.prototype.getInvalidPoint=function(){return this._invalidPoint},n.prototype.getBoundaryPoints=function(){for(var i=this.getBoundaryNodes(),s=new Array(i.size()).fill(null),l=0,f=i.iterator();f.hasNext();){var m=f.next();s[l++]=m.getCoordinate().copy()}return s},n.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},n.prototype.addSelfIntersectionNode=function(i,s,l){if(this.isBoundaryNode(i,s))return null;l===F.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(i,s):this.insertPoint(i,s,l)},n.prototype.addPolygonRing=function(i,s,l){if(i.isEmpty())return null;var f=J.removeRepeatedPoints(i.getCoordinates());if(f.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=f[0],null;var m=s,_=l;tt.isCCW(f)&&(m=l,_=s);var S=new Da(f,new Me(this._argIndex,F.BOUNDARY,m,_));this._lineEdgeMap.put(i,S),this.insertEdge(S),this.insertPoint(this._argIndex,f[0],F.BOUNDARY)},n.prototype.insertPoint=function(i,s,l){var f=this._nodes.addNode(s),m=f.getLabel();m===null?f._label=new Me(i,l):m.setLocation(i,l)},n.prototype.createEdgeSetIntersector=function(){return new R0},n.prototype.addSelfIntersectionNodes=function(i){for(var s=this._edges.iterator();s.hasNext();)for(var l=s.next(),f=l.getLabel().getLocation(i),m=l.eiList.iterator();m.hasNext();){var _=m.next();this.addSelfIntersectionNode(i,_.coord,f)}},n.prototype.add=function(){if(arguments.length!==1)return t.prototype.add.apply(this,arguments);var i=arguments[0];if(i.isEmpty())return null;if(i instanceof hi&&(this._useBoundaryDeterminationRule=!1),i instanceof an)this.addPolygon(i);else if(i instanceof Ge)this.addLineString(i);else if(i instanceof cr)this.addPoint(i);else if(i instanceof Zo)this.addCollection(i);else if(i instanceof Rr)this.addCollection(i);else if(i instanceof hi)this.addCollection(i);else{if(!(i instanceof Fe))throw new Error(i.getClass().getName());this.addCollection(i)}},n.prototype.addCollection=function(i){for(var s=0;s<i.getNumGeometries();s++){var l=i.getGeometryN(s);this.add(l)}},n.prototype.locate=function(i){return et(this._parentGeom,Gi)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new rs(this._parentGeom)),this._areaPtLocator.locate(i)):this._ptLocator.locate(i,this._parentGeom)},n.prototype.findEdge=function(){if(arguments.length===1){var i=arguments[0];return this._lineEdgeMap.get(i)}return t.prototype.findEdge.apply(this,arguments)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n.determineBoundary=function(i,s){return i.isInBoundary(s)?F.BOUNDARY:F.INTERIOR},n}(ze),os=function(){if(this._li=new Pr,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Ks(0,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=y.OGC_SFS_BOUNDARY_RULE;n.getPrecisionModel().compareTo(i.getPrecisionModel())>=0?this.setComputationPrecision(n.getPrecisionModel()):this.setComputationPrecision(i.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Ks(0,n,s),this._arg[1]=new Ks(1,i,s)}else if(arguments.length===3){var l=arguments[0],f=arguments[1],m=arguments[2];l.getPrecisionModel().compareTo(f.getPrecisionModel())>=0?this.setComputationPrecision(l.getPrecisionModel()):this.setComputationPrecision(f.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Ks(0,l,m),this._arg[1]=new Ks(1,f,m)}};os.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},os.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},os.prototype.interfaces_=function(){return[]},os.prototype.getClass=function(){return os};var lo=function(){};lo.prototype.interfaces_=function(){return[]},lo.prototype.getClass=function(){return lo},lo.map=function(){if(arguments[0]instanceof yt&&et(arguments[1],lo.MapOp)){for(var t=arguments[0],n=arguments[1],i=new V,s=0;s<t.getNumGeometries();s++){var l=n.map(t.getGeometryN(s));l!==null&&i.add(l)}return t.getFactory().buildGeometry(i)}if(et(arguments[0],G)&&et(arguments[1],lo.MapOp)){for(var f=arguments[0],m=arguments[1],_=new V,S=f.iterator();S.hasNext();){var O=S.next(),H=m.map(O);H!==null&&_.add(H)}return _}},lo.MapOp=function(){};var xt=function(t){function n(){var i=arguments[0],s=arguments[1];t.call(this,i,s),this._ptLocator=new Hr,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Vr,this._resultPolyList=new V,this._resultLineList=new V,this._resultPointList=new V,this._graph=new ze(new Wh),this._geomFact=i.getFactory()}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.insertUniqueEdge=function(i){var s=this._edgeList.findEqualEdge(i);if(s!==null){var l=s.getLabel(),f=i.getLabel();s.isPointwiseEqual(i)||(f=new Me(i.getLabel())).flip();var m=s.getDepth();m.isNull()&&m.add(l),m.add(f),l.merge(f)}else this._edgeList.add(i)},n.prototype.getGraph=function(){return this._graph},n.prototype.cancelDuplicateResultEdges=function(){for(var i=this._graph.getEdgeEnds().iterator();i.hasNext();){var s=i.next(),l=s.getSym();s.isInResult()&&l.isInResult()&&(s.setInResult(!1),l.setInResult(!1))}},n.prototype.isCoveredByLA=function(i){return!!this.isCovered(i,this._resultLineList)||!!this.isCovered(i,this._resultPolyList)},n.prototype.computeGeometry=function(i,s,l,f){var m=new V;return m.addAll(i),m.addAll(s),m.addAll(l),m.isEmpty()?n.createEmptyResult(f,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(m)},n.prototype.mergeSymLabels=function(){for(var i=this._graph.getNodes().iterator();i.hasNext();)i.next().getEdges().mergeSymLabels()},n.prototype.isCovered=function(i,s){for(var l=s.iterator();l.hasNext();){var f=l.next();if(this._ptLocator.locate(i,f)!==F.EXTERIOR)return!0}return!1},n.prototype.replaceCollapsedEdges=function(){for(var i=new V,s=this._edgeList.iterator();s.hasNext();){var l=s.next();l.isCollapsed()&&(s.remove(),i.add(l.getCollapsedEdge()))}this._edgeList.addAll(i)},n.prototype.updateNodeLabelling=function(){for(var i=this._graph.getNodes().iterator();i.hasNext();){var s=i.next(),l=s.getEdges().getLabel();s.getLabel().merge(l)}},n.prototype.getResultGeometry=function(i){return this.computeOverlay(i),this._resultGeom},n.prototype.insertUniqueEdges=function(i){for(var s=i.iterator();s.hasNext();){var l=s.next();this.insertUniqueEdge(l)}},n.prototype.computeOverlay=function(i){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 s=new V;this._arg[0].computeSplitEdges(s),this._arg[1].computeSplitEdges(s),this.insertUniqueEdges(s),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),ao.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(i),this.cancelDuplicateResultEdges();var l=new hr(this._geomFact);l.add(this._graph),this._resultPolyList=l.getPolygons();var f=new oi(this,this._geomFact,this._ptLocator);this._resultLineList=f.build(i);var m=new Do(this,this._geomFact,this._ptLocator);this._resultPointList=m.build(i),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,i)},n.prototype.labelIncompleteNode=function(i,s){var l=this._ptLocator.locate(i.getCoordinate(),this._arg[s].getGeometry());i.getLabel().setLocation(s,l)},n.prototype.copyPoints=function(i){for(var s=this._arg[i].getNodeIterator();s.hasNext();){var l=s.next();this._graph.addNode(l.getCoordinate()).setLabel(i,l.getLabel().getLocation(i))}},n.prototype.findResultAreaEdges=function(i){for(var s=this._graph.getEdgeEnds().iterator();s.hasNext();){var l=s.next(),f=l.getLabel();f.isArea()&&!l.isInteriorAreaEdge()&&n.isResultOfOp(f.getLocation(0,j.RIGHT),f.getLocation(1,j.RIGHT),i)&&l.setInResult(!0)}},n.prototype.computeLabelsFromDepths=function(){for(var i=this._edgeList.iterator();i.hasNext();){var s=i.next(),l=s.getLabel(),f=s.getDepth();if(!f.isNull()){f.normalize();for(var m=0;m<2;m++)l.isNull(m)||!l.isArea()||f.isNull(m)||(f.getDelta(m)===0?l.toLine(m):(_t.isTrue(!f.isNull(m,j.LEFT),"depth of LEFT side has not been initialized"),l.setLocation(m,j.LEFT,f.getLocation(m,j.LEFT)),_t.isTrue(!f.isNull(m,j.RIGHT),"depth of RIGHT side has not been initialized"),l.setLocation(m,j.RIGHT,f.getLocation(m,j.RIGHT))))}}},n.prototype.computeLabelling=function(){for(var i=this._graph.getNodes().iterator();i.hasNext();)i.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},n.prototype.labelIncompleteNodes=function(){for(var i=this._graph.getNodes().iterator();i.hasNext();){var s=i.next(),l=s.getLabel();s.isIsolated()&&(l.isNull(0)?this.labelIncompleteNode(s,0):this.labelIncompleteNode(s,1)),s.getEdges().updateLabelling(l)}},n.prototype.isCoveredByA=function(i){return!!this.isCovered(i,this._resultPolyList)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(os);xt.overlayOp=function(t,n,i){return new xt(t,n).getResultGeometry(i)},xt.intersection=function(t,n){if(t.isEmpty()||n.isEmpty())return xt.createEmptyResult(xt.INTERSECTION,t,n,t.getFactory());if(t.isGeometryCollection()){var i=n;return Lo.map(t,{interfaces_:function(){return[lo.MapOp]},map:function(s){return s.intersection(i)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),qn.overlayOp(t,n,xt.INTERSECTION)},xt.symDifference=function(t,n){if(t.isEmpty()||n.isEmpty()){if(t.isEmpty()&&n.isEmpty())return xt.createEmptyResult(xt.SYMDIFFERENCE,t,n,t.getFactory());if(t.isEmpty())return n.copy();if(n.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),qn.overlayOp(t,n,xt.SYMDIFFERENCE)},xt.resultDimension=function(t,n,i){var s=n.getDimension(),l=i.getDimension(),f=-1;switch(t){case xt.INTERSECTION:f=Math.min(s,l);break;case xt.UNION:f=Math.max(s,l);break;case xt.DIFFERENCE:f=s;break;case xt.SYMDIFFERENCE:f=Math.max(s,l)}return f},xt.createEmptyResult=function(t,n,i,s){var l=null;switch(xt.resultDimension(t,n,i)){case-1:l=s.createGeometryCollection(new Array(0).fill(null));break;case 0:l=s.createPoint();break;case 1:l=s.createLineString();break;case 2:l=s.createPolygon()}return l},xt.difference=function(t,n){return t.isEmpty()?xt.createEmptyResult(xt.DIFFERENCE,t,n,t.getFactory()):n.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),qn.overlayOp(t,n,xt.DIFFERENCE))},xt.isResultOfOp=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1],i=t.getLocation(0),s=t.getLocation(1);return xt.isResultOfOp(i,s,n)}if(arguments.length===3){var l=arguments[0],f=arguments[1],m=arguments[2];switch(l===F.BOUNDARY&&(l=F.INTERIOR),f===F.BOUNDARY&&(f=F.INTERIOR),m){case xt.INTERSECTION:return l===F.INTERIOR&&f===F.INTERIOR;case xt.UNION:return l===F.INTERIOR||f===F.INTERIOR;case xt.DIFFERENCE:return l===F.INTERIOR&&f!==F.INTERIOR;case xt.SYMDIFFERENCE:return l===F.INTERIOR&&f!==F.INTERIOR||l!==F.INTERIOR&&f===F.INTERIOR}return!1}},xt.INTERSECTION=1,xt.UNION=2,xt.DIFFERENCE=3,xt.SYMDIFFERENCE=4;var Ki=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Hr,this._seg=new ft;var t=arguments[0],n=arguments[1];this._g=t,this._boundaryDistanceTolerance=n,this._linework=this.extractLinework(t)};Ki.prototype.isWithinToleranceOfBoundary=function(t){for(var n=0;n<this._linework.getNumGeometries();n++)for(var i=this._linework.getGeometryN(n).getCoordinateSequence(),s=0;s<i.size()-1;s++)if(i.getCoordinate(s,this._seg.p0),i.getCoordinate(s+1,this._seg.p1),this._seg.distance(t)<=this._boundaryDistanceTolerance)return!0;return!1},Ki.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?F.BOUNDARY:this._ptLocator.locate(t,this._g)},Ki.prototype.extractLinework=function(t){var n=new ss;t.apply(n);var i=n.getLinework(),s=Tt.toLineStringArray(i);return t.getFactory().createMultiLineString(s)},Ki.prototype.interfaces_=function(){return[]},Ki.prototype.getClass=function(){return Ki};var ss=function(){this._linework=null,this._linework=new V};ss.prototype.getLinework=function(){return this._linework},ss.prototype.filter=function(t){if(t instanceof an){var n=t;this._linework.add(n.getExteriorRing());for(var i=0;i<n.getNumInteriorRing();i++)this._linework.add(n.getInteriorRingN(i))}},ss.prototype.interfaces_=function(){return[je]},ss.prototype.getClass=function(){return ss};var co=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};co.prototype.extractPoints=function(t,n,i){for(var s=t.getCoordinates(),l=0;l<s.length-1;l++)this.computeOffsetPoints(s[l],s[l+1],n,i)},co.prototype.setSidesToGenerate=function(t,n){this._doLeft=t,this._doRight=n},co.prototype.getPoints=function(t){for(var n=new V,i=Sn.getLines(this._g).iterator();i.hasNext();){var s=i.next();this.extractPoints(s,t,n)}return n},co.prototype.computeOffsetPoints=function(t,n,i,s){var l=n.x-t.x,f=n.y-t.y,m=Math.sqrt(l*l+f*f),_=i*l/m,S=i*f/m,O=(n.x+t.x)/2,H=(n.y+t.y)/2;if(this._doLeft){var X=new C(O-S,H+_);s.add(X)}if(this._doRight){var nt=new C(O+S,H-_);s.add(nt)}},co.prototype.interfaces_=function(){return[]},co.prototype.getClass=function(){return co};var wr=function t(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=t.TOLERANCE,this._testCoords=new V;var n=arguments[0],i=arguments[1],s=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(n,i),this._geom=[n,i,s],this._locFinder=[new Ki(this._geom[0],this._boundaryDistanceTolerance),new Ki(this._geom[1],this._boundaryDistanceTolerance),new Ki(this._geom[2],this._boundaryDistanceTolerance)]},ef={TOLERANCE:{configurable:!0}};wr.prototype.reportResult=function(t,n,i){Ee.out.println("Overlay result invalid - A:"+F.toLocationSymbol(n[0])+" B:"+F.toLocationSymbol(n[1])+" expected:"+(i?"i":"e")+" actual:"+F.toLocationSymbol(n[2]))},wr.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var n=this.checkValid(t);return n},wr.prototype.checkValid=function(){if(arguments.length===1){for(var t=arguments[0],n=0;n<this._testCoords.size();n++){var i=this._testCoords.get(n);if(!this.checkValid(t,i))return this._invalidLocation=i,!1}return!0}if(arguments.length===2){var s=arguments[0],l=arguments[1];return this._location[0]=this._locFinder[0].getLocation(l),this._location[1]=this._locFinder[1].getLocation(l),this._location[2]=this._locFinder[2].getLocation(l),!!wr.hasLocation(this._location,F.BOUNDARY)||this.isValidResult(s,this._location)}},wr.prototype.addTestPts=function(t){var n=new co(t);this._testCoords.addAll(n.getPoints(5*this._boundaryDistanceTolerance))},wr.prototype.isValidResult=function(t,n){var i=xt.isResultOfOp(n[0],n[1],t),s=!(i^n[2]===F.INTERIOR);return s||this.reportResult(t,n,i),s},wr.prototype.getInvalidLocation=function(){return this._invalidLocation},wr.prototype.interfaces_=function(){return[]},wr.prototype.getClass=function(){return wr},wr.hasLocation=function(t,n){for(var i=0;i<3;i++)if(t[i]===n)return!0;return!1},wr.computeBoundaryDistanceTolerance=function(t,n){return Math.min(Ke.computeSizeBasedSnapTolerance(t),Ke.computeSizeBasedSnapTolerance(n))},wr.isValid=function(t,n,i,s){return new wr(t,n,s).isValid(i)},ef.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(wr,ef);var Sr=function t(n){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(n),this._inputGeoms=n};Sr.prototype.extractElements=function(t,n){if(t===null)return null;for(var i=0;i<t.getNumGeometries();i++){var s=t.getGeometryN(i);this._skipEmpty&&s.isEmpty()||n.add(s)}},Sr.prototype.combine=function(){for(var t=new V,n=this._inputGeoms.iterator();n.hasNext();){var i=n.next();this.extractElements(i,t)}return t.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr},Sr.combine=function(){if(arguments.length===1){var t=arguments[0];return new Sr(t).combine()}if(arguments.length===2){var n=arguments[0],i=arguments[1];return new Sr(Sr.createList(n,i)).combine()}if(arguments.length===3){var s=arguments[0],l=arguments[1],f=arguments[2];return new Sr(Sr.createList(s,l,f)).combine()}},Sr.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},Sr.createList=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1],i=new V;return i.add(t),i.add(n),i}if(arguments.length===3){var s=arguments[0],l=arguments[1],f=arguments[2],m=new V;return m.add(s),m.add(l),m.add(f),m}};var nn=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,this._inputPolys===null&&(this._inputPolys=new V)},nf={STRTREE_NODE_CAPACITY:{configurable:!0}};nn.prototype.reduceToGeometries=function(t){for(var n=new V,i=t.iterator();i.hasNext();){var s=i.next(),l=null;et(s,Z)?l=this.unionTree(s):s instanceof yt&&(l=s),n.add(l)}return n},nn.prototype.extractByEnvelope=function(t,n,i){for(var s=new V,l=0;l<n.getNumGeometries();l++){var f=n.getGeometryN(l);f.getEnvelopeInternal().intersects(t)?s.add(f):i.add(f)}return this._geomFactory.buildGeometry(s)},nn.prototype.unionOptimized=function(t,n){var i=t.getEnvelopeInternal(),s=n.getEnvelopeInternal();if(!i.intersects(s))return Sr.combine(t,n);if(t.getNumGeometries()<=1&&n.getNumGeometries()<=1)return this.unionActual(t,n);var l=i.intersection(s);return this.unionUsingEnvelopeIntersection(t,n,l)},nn.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 t=new zh(nn.STRTREE_NODE_CAPACITY),n=this._inputPolys.iterator();n.hasNext();){var i=n.next();t.insert(i.getEnvelopeInternal(),i)}this._inputPolys=null;var s=t.itemsTree();return this.unionTree(s)},nn.prototype.binaryUnion=function(){if(arguments.length===1){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];if(s-i<=1){var l=nn.getGeometry(n,i);return this.unionSafe(l,null)}if(s-i==2)return this.unionSafe(nn.getGeometry(n,i),nn.getGeometry(n,i+1));var f=Math.trunc((s+i)/2),m=this.binaryUnion(n,i,f),_=this.binaryUnion(n,f,s);return this.unionSafe(m,_)}},nn.prototype.repeatedUnion=function(t){for(var n=null,i=t.iterator();i.hasNext();){var s=i.next();n=n===null?s.copy():n.union(s)}return n},nn.prototype.unionSafe=function(t,n){return t===null&&n===null?null:t===null?n.copy():n===null?t.copy():this.unionOptimized(t,n)},nn.prototype.unionActual=function(t,n){return nn.restrictToPolygons(t.union(n))},nn.prototype.unionTree=function(t){var n=this.reduceToGeometries(t);return this.binaryUnion(n)},nn.prototype.unionUsingEnvelopeIntersection=function(t,n,i){var s=new V,l=this.extractByEnvelope(i,t,s),f=this.extractByEnvelope(i,n,s),m=this.unionActual(l,f);return s.add(m),Sr.combine(s)},nn.prototype.bufferUnion=function(){if(arguments.length===1){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return n.getFactory().createGeometryCollection([n,i]).buffer(0)}},nn.prototype.interfaces_=function(){return[]},nn.prototype.getClass=function(){return nn},nn.restrictToPolygons=function(t){if(et(t,Gi))return t;var n=Li.getPolygons(t);return n.size()===1?n.get(0):t.getFactory().createMultiPolygon(Tt.toPolygonArray(n))},nn.getGeometry=function(t,n){return n>=t.size()?null:t.get(n)},nn.union=function(t){return new nn(t).union()},nf.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(nn,nf);var Qs=function(){};Qs.prototype.interfaces_=function(){return[]},Qs.prototype.getClass=function(){return Qs},Qs.union=function(t,n){if(t.isEmpty()||n.isEmpty()){if(t.isEmpty()&&n.isEmpty())return xt.createEmptyResult(xt.UNION,t,n,t.getFactory());if(t.isEmpty())return n.copy();if(n.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),qn.overlayOp(t,n,xt.UNION)},o.GeoJSONReader=el,o.GeoJSONWriter=Uh,o.OverlayOp=xt,o.UnionOp=Qs,o.BufferOp=wn,Object.defineProperty(o,"__esModule",{value:!0})})});var _0=ct((c6,v0)=>{v0.exports=function(e,r){return e[0]=r[0],e[1]=r[1],e}});var M0=ct((h6,E0)=>{var x0=_0();E0.exports=function(o,e){Array.isArray(e)||(e=[]),o.length>0&&e.push(x0([0,0],o[0]));for(var r=0;r<o.length-1;r++){var a=o[r],u=o[r+1],c=a[0],h=a[1],p=u[0],d=u[1],g=[.75*c+.25*p,.75*h+.25*d],v=[.25*c+.75*p,.25*h+.75*d];e.push(g),e.push(v)}return o.length>1&&e.push(x0([0,0],o[o.length-1])),e}});var ki=ln(xf(),1);var Jf="169";var Ef=0,Mf=1,wf=2,Sf=3,bf=4,Af=5,Tf=6,Cf=7;var Kf=300;var If=1e3,Fa=1001,Pf=1002;var H0=1006;var q0=1008;var W0=1009;var X0=1023;var Va=2300,Sl=2301,gl=2302,Rf=2400,Nf=2401,Lf=2402;var Qf="",po="srgb",zl="srgb-linear",Y0="display-p3",jf="display-p3-linear",bl="linear",Df="srgb",Of="rec709",Ff="p3";var Ua=2e3,Uf=2001,Ha=class{addEventListener(e,r){this._listeners===void 0&&(this._listeners={});let a=this._listeners;a[e]===void 0&&(a[e]=[]),a[e].indexOf(r)===-1&&a[e].push(r)}hasEventListener(e,r){if(this._listeners===void 0)return!1;let a=this._listeners;return a[e]!==void 0&&a[e].indexOf(r)!==-1}removeEventListener(e,r){if(this._listeners===void 0)return;let u=this._listeners[e];if(u!==void 0){let c=u.indexOf(r);c!==-1&&u.splice(c,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let a=this._listeners[e.type];if(a!==void 0){e.target=this;let u=a.slice(0);for(let c=0,h=u.length;c<h;c++)u[c].call(this,e);e.target=null}}},mr=["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 IS=Math.PI/180,PS=180/Math.PI;function kl(){let o=Math.random()*4294967295|0,e=Math.random()*4294967295|0,r=Math.random()*4294967295|0,a=Math.random()*4294967295|0;return(mr[o&255]+mr[o>>8&255]+mr[o>>16&255]+mr[o>>24&255]+"-"+mr[e&255]+mr[e>>8&255]+"-"+mr[e>>16&15|64]+mr[e>>24&255]+"-"+mr[r&63|128]+mr[r>>8&255]+"-"+mr[r>>16&255]+mr[r>>24&255]+mr[a&255]+mr[a>>8&255]+mr[a>>16&255]+mr[a>>24&255]).toLowerCase()}function Fr(o,e,r){return Math.max(e,Math.min(r,o))}function $0(o,e){return(o%e+e)%e}function yl(o,e,r){return(1-r)*o+r*e}var br=class o{constructor(e=0,r=0){o.prototype.isVector2=!0,this.x=e,this.y=r}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,r){return this.x=e,this.y=r,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,r){switch(e){case 0:this.x=r;break;case 1:this.y=r;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,r){return this.x=e.x+r.x,this.y=e.y+r.y,this}addScaledVector(e,r){return this.x+=e.x*r,this.y+=e.y*r,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,r){return this.x=e.x-r.x,this.y=e.y-r.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let r=this.x,a=this.y,u=e.elements;return this.x=u[0]*r+u[3]*a+u[6],this.y=u[1]*r+u[4]*a+u[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,r){return this.x=Math.max(e.x,Math.min(r.x,this.x)),this.y=Math.max(e.y,Math.min(r.y,this.y)),this}clampScalar(e,r){return this.x=Math.max(e,Math.min(r,this.x)),this.y=Math.max(e,Math.min(r,this.y)),this}clampLength(e,r){let a=this.length();return this.divideScalar(a||1).multiplyScalar(Math.max(e,Math.min(r,a)))}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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){let r=Math.sqrt(this.lengthSq()*e.lengthSq());if(r===0)return Math.PI/2;let a=this.dot(e)/r;return Math.acos(Fr(a,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let r=this.x-e.x,a=this.y-e.y;return r*r+a*a}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,r){return this.x+=(e.x-this.x)*r,this.y+=(e.y-this.y)*r,this}lerpVectors(e,r,a){return this.x=e.x+(r.x-e.x)*a,this.y=e.y+(r.y-e.y)*a,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,r=0){return this.x=e[r],this.y=e[r+1],this}toArray(e=[],r=0){return e[r]=this.x,e[r+1]=this.y,e}fromBufferAttribute(e,r){return this.x=e.getX(r),this.y=e.getY(r),this}rotateAround(e,r){let a=Math.cos(r),u=Math.sin(r),c=this.x-e.x,h=this.y-e.y;return this.x=c*a-h*u+e.x,this.y=c*u+h*a+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Dt=class o{constructor(e,r,a,u,c,h,p,d,g){o.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,r,a,u,c,h,p,d,g)}set(e,r,a,u,c,h,p,d,g){let v=this.elements;return v[0]=e,v[1]=u,v[2]=p,v[3]=r,v[4]=c,v[5]=d,v[6]=a,v[7]=h,v[8]=g,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let r=this.elements,a=e.elements;return r[0]=a[0],r[1]=a[1],r[2]=a[2],r[3]=a[3],r[4]=a[4],r[5]=a[5],r[6]=a[6],r[7]=a[7],r[8]=a[8],this}extractBasis(e,r,a){return e.setFromMatrix3Column(this,0),r.setFromMatrix3Column(this,1),a.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let r=e.elements;return this.set(r[0],r[4],r[8],r[1],r[5],r[9],r[2],r[6],r[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,r){let a=e.elements,u=r.elements,c=this.elements,h=a[0],p=a[3],d=a[6],g=a[1],v=a[4],x=a[7],M=a[2],w=a[5],I=a[8],D=u[0],b=u[3],T=u[6],L=u[1],P=u[4],z=u[7],k=u[2],Y=u[5],q=u[8];return c[0]=h*D+p*L+d*k,c[3]=h*b+p*P+d*Y,c[6]=h*T+p*z+d*q,c[1]=g*D+v*L+x*k,c[4]=g*b+v*P+x*Y,c[7]=g*T+v*z+x*q,c[2]=M*D+w*L+I*k,c[5]=M*b+w*P+I*Y,c[8]=M*T+w*z+I*q,this}multiplyScalar(e){let r=this.elements;return r[0]*=e,r[3]*=e,r[6]*=e,r[1]*=e,r[4]*=e,r[7]*=e,r[2]*=e,r[5]*=e,r[8]*=e,this}determinant(){let e=this.elements,r=e[0],a=e[1],u=e[2],c=e[3],h=e[4],p=e[5],d=e[6],g=e[7],v=e[8];return r*h*v-r*p*g-a*c*v+a*p*d+u*c*g-u*h*d}invert(){let e=this.elements,r=e[0],a=e[1],u=e[2],c=e[3],h=e[4],p=e[5],d=e[6],g=e[7],v=e[8],x=v*h-p*g,M=p*d-v*c,w=g*c-h*d,I=r*x+a*M+u*w;if(I===0)return this.set(0,0,0,0,0,0,0,0,0);let D=1/I;return e[0]=x*D,e[1]=(u*g-v*a)*D,e[2]=(p*a-u*h)*D,e[3]=M*D,e[4]=(v*r-u*d)*D,e[5]=(u*c-p*r)*D,e[6]=w*D,e[7]=(a*d-g*r)*D,e[8]=(h*r-a*c)*D,this}transpose(){let e,r=this.elements;return e=r[1],r[1]=r[3],r[3]=e,e=r[2],r[2]=r[6],r[6]=e,e=r[5],r[5]=r[7],r[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let r=this.elements;return e[0]=r[0],e[1]=r[3],e[2]=r[6],e[3]=r[1],e[4]=r[4],e[5]=r[7],e[6]=r[2],e[7]=r[5],e[8]=r[8],this}setUvTransform(e,r,a,u,c,h,p){let d=Math.cos(c),g=Math.sin(c);return this.set(a*d,a*g,-a*(d*h+g*p)+h+e,-u*g,u*d,-u*(-g*h+d*p)+p+r,0,0,1),this}scale(e,r){return this.premultiply(vl.makeScale(e,r)),this}rotate(e){return this.premultiply(vl.makeRotation(-e)),this}translate(e,r){return this.premultiply(vl.makeTranslation(e,r)),this}makeTranslation(e,r){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,r,0,0,1),this}makeRotation(e){let r=Math.cos(e),a=Math.sin(e);return this.set(r,-a,0,a,r,0,0,0,1),this}makeScale(e,r){return this.set(e,0,0,0,r,0,0,0,1),this}equals(e){let r=this.elements,a=e.elements;for(let u=0;u<9;u++)if(r[u]!==a[u])return!1;return!0}fromArray(e,r=0){for(let a=0;a<9;a++)this.elements[a]=e[a+r];return this}toArray(e=[],r=0){let a=this.elements;return e[r]=a[0],e[r+1]=a[1],e[r+2]=a[2],e[r+3]=a[3],e[r+4]=a[4],e[r+5]=a[5],e[r+6]=a[6],e[r+7]=a[7],e[r+8]=a[8],e}clone(){return new this.constructor().fromArray(this.elements)}},vl=new Dt;function Bf(o){return document.createElementNS("http://www.w3.org/1999/xhtml",o)}var zf=new Dt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),kf=new Dt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),ta={[zl]:{transfer:bl,primaries:Of,luminanceCoefficients:[.2126,.7152,.0722],toReference:o=>o,fromReference:o=>o},[po]:{transfer:Df,primaries:Of,luminanceCoefficients:[.2126,.7152,.0722],toReference:o=>o.convertSRGBToLinear(),fromReference:o=>o.convertLinearToSRGB()},[jf]:{transfer:bl,primaries:Ff,luminanceCoefficients:[.2289,.6917,.0793],toReference:o=>o.applyMatrix3(kf),fromReference:o=>o.applyMatrix3(zf)},[Y0]:{transfer:Df,primaries:Ff,luminanceCoefficients:[.2289,.6917,.0793],toReference:o=>o.convertSRGBToLinear().applyMatrix3(kf),fromReference:o=>o.applyMatrix3(zf).convertLinearToSRGB()}},Z0=new Set([zl,jf]),Mi={enabled:!0,_workingColorSpace:zl,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(o){if(!Z0.has(o))throw new Error(`Unsupported working color space, "${o}".`);this._workingColorSpace=o},convert:function(o,e,r){if(this.enabled===!1||e===r||!e||!r)return o;let a=ta[e].toReference,u=ta[r].fromReference;return u(a(o))},fromWorkingColorSpace:function(o,e){return this.convert(o,this._workingColorSpace,e)},toWorkingColorSpace:function(o,e){return this.convert(o,e,this._workingColorSpace)},getPrimaries:function(o){return ta[o].primaries},getTransfer:function(o){return o===Qf?bl:ta[o].transfer},getLuminanceCoefficients:function(o,e=this._workingColorSpace){return o.fromArray(ta[e].luminanceCoefficients)}};function fs(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function _l(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}var as,Al=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let r;if(e instanceof HTMLCanvasElement)r=e;else{as===void 0&&(as=Bf("canvas")),as.width=e.width,as.height=e.height;let a=as.getContext("2d");e instanceof ImageData?a.putImageData(e,0,0):a.drawImage(e,0,0,e.width,e.height),r=as}return r.width>2048||r.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),r.toDataURL("image/jpeg",.6)):r.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){let r=Bf("canvas");r.width=e.width,r.height=e.height;let a=r.getContext("2d");a.drawImage(e,0,0,e.width,e.height);let u=a.getImageData(0,0,e.width,e.height),c=u.data;for(let h=0;h<c.length;h++)c[h]=fs(c[h]/255)*255;return a.putImageData(u,0,0),r}else if(e.data){let r=e.data.slice(0);for(let a=0;a<r.length;a++)r instanceof Uint8Array||r instanceof Uint8ClampedArray?r[a]=Math.floor(fs(r[a]/255)*255):r[a]=fs(r[a]);return{data:r,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},J0=0,Tl=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:J0++}),this.uuid=kl(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let r=e===void 0||typeof e=="string";if(!r&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let a={uuid:this.uuid,url:""},u=this.data;if(u!==null){let c;if(Array.isArray(u)){c=[];for(let h=0,p=u.length;h<p;h++)u[h].isDataTexture?c.push(xl(u[h].image)):c.push(xl(u[h]))}else c=xl(u);a.url=c}return r||(e.images[this.uuid]=a),a}};function xl(o){return typeof HTMLImageElement!="undefined"&&o instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&o instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&o instanceof ImageBitmap?Al.getDataURL(o):o.data?{data:Array.from(o.data),width:o.width,height:o.height,type:o.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var K0=0,na=class o extends Ha{constructor(e=o.DEFAULT_IMAGE,r=o.DEFAULT_MAPPING,a=Fa,u=Fa,c=H0,h=q0,p=X0,d=W0,g=o.DEFAULT_ANISOTROPY,v=Qf){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:K0++}),this.uuid=kl(),this.name="",this.source=new Tl(e),this.mipmaps=[],this.mapping=r,this.channel=0,this.wrapS=a,this.wrapT=u,this.magFilter=c,this.minFilter=h,this.anisotropy=g,this.format=p,this.internalFormat=null,this.type=d,this.offset=new br(0,0),this.repeat=new br(1,1),this.center=new br(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Dt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=v,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}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(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){let r=e===void 0||typeof e=="string";if(!r&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let a={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).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&&(a.userData=this.userData),r||(e.textures[this.uuid]=a),a}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Kf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case If:e.x=e.x-Math.floor(e.x);break;case Fa:e.x=e.x<0?0:1;break;case Pf:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case If:e.y=e.y-Math.floor(e.y);break;case Fa:e.y=e.y<0?0:1;break;case Pf:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};na.DEFAULT_IMAGE=null;na.DEFAULT_MAPPING=Kf;na.DEFAULT_ANISOTROPY=1;var go=class{constructor(e=0,r=0,a=0,u=1){this.isQuaternion=!0,this._x=e,this._y=r,this._z=a,this._w=u}static slerpFlat(e,r,a,u,c,h,p){let d=a[u+0],g=a[u+1],v=a[u+2],x=a[u+3],M=c[h+0],w=c[h+1],I=c[h+2],D=c[h+3];if(p===0){e[r+0]=d,e[r+1]=g,e[r+2]=v,e[r+3]=x;return}if(p===1){e[r+0]=M,e[r+1]=w,e[r+2]=I,e[r+3]=D;return}if(x!==D||d!==M||g!==w||v!==I){let b=1-p,T=d*M+g*w+v*I+x*D,L=T>=0?1:-1,P=1-T*T;if(P>Number.EPSILON){let k=Math.sqrt(P),Y=Math.atan2(k,T*L);b=Math.sin(b*Y)/k,p=Math.sin(p*Y)/k}let z=p*L;if(d=d*b+M*z,g=g*b+w*z,v=v*b+I*z,x=x*b+D*z,b===1-p){let k=1/Math.sqrt(d*d+g*g+v*v+x*x);d*=k,g*=k,v*=k,x*=k}}e[r]=d,e[r+1]=g,e[r+2]=v,e[r+3]=x}static multiplyQuaternionsFlat(e,r,a,u,c,h){let p=a[u],d=a[u+1],g=a[u+2],v=a[u+3],x=c[h],M=c[h+1],w=c[h+2],I=c[h+3];return e[r]=p*I+v*x+d*w-g*M,e[r+1]=d*I+v*M+g*x-p*w,e[r+2]=g*I+v*w+p*M-d*x,e[r+3]=v*I-p*x-d*M-g*w,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,r,a,u){return this._x=e,this._y=r,this._z=a,this._w=u,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,r=!0){let a=e._x,u=e._y,c=e._z,h=e._order,p=Math.cos,d=Math.sin,g=p(a/2),v=p(u/2),x=p(c/2),M=d(a/2),w=d(u/2),I=d(c/2);switch(h){case"XYZ":this._x=M*v*x+g*w*I,this._y=g*w*x-M*v*I,this._z=g*v*I+M*w*x,this._w=g*v*x-M*w*I;break;case"YXZ":this._x=M*v*x+g*w*I,this._y=g*w*x-M*v*I,this._z=g*v*I-M*w*x,this._w=g*v*x+M*w*I;break;case"ZXY":this._x=M*v*x-g*w*I,this._y=g*w*x+M*v*I,this._z=g*v*I+M*w*x,this._w=g*v*x-M*w*I;break;case"ZYX":this._x=M*v*x-g*w*I,this._y=g*w*x+M*v*I,this._z=g*v*I-M*w*x,this._w=g*v*x+M*w*I;break;case"YZX":this._x=M*v*x+g*w*I,this._y=g*w*x+M*v*I,this._z=g*v*I-M*w*x,this._w=g*v*x-M*w*I;break;case"XZY":this._x=M*v*x-g*w*I,this._y=g*w*x-M*v*I,this._z=g*v*I+M*w*x,this._w=g*v*x+M*w*I;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+h)}return r===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,r){let a=r/2,u=Math.sin(a);return this._x=e.x*u,this._y=e.y*u,this._z=e.z*u,this._w=Math.cos(a),this._onChangeCallback(),this}setFromRotationMatrix(e){let r=e.elements,a=r[0],u=r[4],c=r[8],h=r[1],p=r[5],d=r[9],g=r[2],v=r[6],x=r[10],M=a+p+x;if(M>0){let w=.5/Math.sqrt(M+1);this._w=.25/w,this._x=(v-d)*w,this._y=(c-g)*w,this._z=(h-u)*w}else if(a>p&&a>x){let w=2*Math.sqrt(1+a-p-x);this._w=(v-d)/w,this._x=.25*w,this._y=(u+h)/w,this._z=(c+g)/w}else if(p>x){let w=2*Math.sqrt(1+p-a-x);this._w=(c-g)/w,this._x=(u+h)/w,this._y=.25*w,this._z=(d+v)/w}else{let w=2*Math.sqrt(1+x-a-p);this._w=(h-u)/w,this._x=(c+g)/w,this._y=(d+v)/w,this._z=.25*w}return this._onChangeCallback(),this}setFromUnitVectors(e,r){let a=e.dot(r)+1;return a<Number.EPSILON?(a=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=a):(this._x=0,this._y=-e.z,this._z=e.y,this._w=a)):(this._x=e.y*r.z-e.z*r.y,this._y=e.z*r.x-e.x*r.z,this._z=e.x*r.y-e.y*r.x,this._w=a),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Fr(this.dot(e),-1,1)))}rotateTowards(e,r){let a=this.angleTo(e);if(a===0)return this;let u=Math.min(1,r/a);return this.slerp(e,u),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,r){let a=e._x,u=e._y,c=e._z,h=e._w,p=r._x,d=r._y,g=r._z,v=r._w;return this._x=a*v+h*p+u*g-c*d,this._y=u*v+h*d+c*p-a*g,this._z=c*v+h*g+a*d-u*p,this._w=h*v-a*p-u*d-c*g,this._onChangeCallback(),this}slerp(e,r){if(r===0)return this;if(r===1)return this.copy(e);let a=this._x,u=this._y,c=this._z,h=this._w,p=h*e._w+a*e._x+u*e._y+c*e._z;if(p<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,p=-p):this.copy(e),p>=1)return this._w=h,this._x=a,this._y=u,this._z=c,this;let d=1-p*p;if(d<=Number.EPSILON){let w=1-r;return this._w=w*h+r*this._w,this._x=w*a+r*this._x,this._y=w*u+r*this._y,this._z=w*c+r*this._z,this.normalize(),this}let g=Math.sqrt(d),v=Math.atan2(g,p),x=Math.sin((1-r)*v)/g,M=Math.sin(r*v)/g;return this._w=h*x+this._w*M,this._x=a*x+this._x*M,this._y=u*x+this._y*M,this._z=c*x+this._z*M,this._onChangeCallback(),this}slerpQuaternions(e,r,a){return this.copy(e).slerp(r,a)}random(){let e=2*Math.PI*Math.random(),r=2*Math.PI*Math.random(),a=Math.random(),u=Math.sqrt(1-a),c=Math.sqrt(a);return this.set(u*Math.sin(e),u*Math.cos(e),c*Math.sin(r),c*Math.cos(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,r=0){return this._x=e[r],this._y=e[r+1],this._z=e[r+2],this._w=e[r+3],this._onChangeCallback(),this}toArray(e=[],r=0){return e[r]=this._x,e[r+1]=this._y,e[r+2]=this._z,e[r+3]=this._w,e}fromBufferAttribute(e,r){return this._x=e.getX(r),this._y=e.getY(r),this._z=e.getZ(r),this._w=e.getW(r),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Pe=class o{constructor(e=0,r=0,a=0){o.prototype.isVector3=!0,this.x=e,this.y=r,this.z=a}set(e,r,a){return a===void 0&&(a=this.z),this.x=e,this.y=r,this.z=a,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,r){switch(e){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,r){return this.x=e.x+r.x,this.y=e.y+r.y,this.z=e.z+r.z,this}addScaledVector(e,r){return this.x+=e.x*r,this.y+=e.y*r,this.z+=e.z*r,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,r){return this.x=e.x-r.x,this.y=e.y-r.y,this.z=e.z-r.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,r){return this.x=e.x*r.x,this.y=e.y*r.y,this.z=e.z*r.z,this}applyEuler(e){return this.applyQuaternion(Gf.setFromEuler(e))}applyAxisAngle(e,r){return this.applyQuaternion(Gf.setFromAxisAngle(e,r))}applyMatrix3(e){let r=this.x,a=this.y,u=this.z,c=e.elements;return this.x=c[0]*r+c[3]*a+c[6]*u,this.y=c[1]*r+c[4]*a+c[7]*u,this.z=c[2]*r+c[5]*a+c[8]*u,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let r=this.x,a=this.y,u=this.z,c=e.elements,h=1/(c[3]*r+c[7]*a+c[11]*u+c[15]);return this.x=(c[0]*r+c[4]*a+c[8]*u+c[12])*h,this.y=(c[1]*r+c[5]*a+c[9]*u+c[13])*h,this.z=(c[2]*r+c[6]*a+c[10]*u+c[14])*h,this}applyQuaternion(e){let r=this.x,a=this.y,u=this.z,c=e.x,h=e.y,p=e.z,d=e.w,g=2*(h*u-p*a),v=2*(p*r-c*u),x=2*(c*a-h*r);return this.x=r+d*g+h*x-p*v,this.y=a+d*v+p*g-c*x,this.z=u+d*x+c*v-h*g,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let r=this.x,a=this.y,u=this.z,c=e.elements;return this.x=c[0]*r+c[4]*a+c[8]*u,this.y=c[1]*r+c[5]*a+c[9]*u,this.z=c[2]*r+c[6]*a+c[10]*u,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,r){return this.x=Math.max(e.x,Math.min(r.x,this.x)),this.y=Math.max(e.y,Math.min(r.y,this.y)),this.z=Math.max(e.z,Math.min(r.z,this.z)),this}clampScalar(e,r){return this.x=Math.max(e,Math.min(r,this.x)),this.y=Math.max(e,Math.min(r,this.y)),this.z=Math.max(e,Math.min(r,this.z)),this}clampLength(e,r){let a=this.length();return this.divideScalar(a||1).multiplyScalar(Math.max(e,Math.min(r,a)))}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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,r){return this.x+=(e.x-this.x)*r,this.y+=(e.y-this.y)*r,this.z+=(e.z-this.z)*r,this}lerpVectors(e,r,a){return this.x=e.x+(r.x-e.x)*a,this.y=e.y+(r.y-e.y)*a,this.z=e.z+(r.z-e.z)*a,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,r){let a=e.x,u=e.y,c=e.z,h=r.x,p=r.y,d=r.z;return this.x=u*d-c*p,this.y=c*h-a*d,this.z=a*p-u*h,this}projectOnVector(e){let r=e.lengthSq();if(r===0)return this.set(0,0,0);let a=e.dot(this)/r;return this.copy(e).multiplyScalar(a)}projectOnPlane(e){return El.copy(this).projectOnVector(e),this.sub(El)}reflect(e){return this.sub(El.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let r=Math.sqrt(this.lengthSq()*e.lengthSq());if(r===0)return Math.PI/2;let a=this.dot(e)/r;return Math.acos(Fr(a,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let r=this.x-e.x,a=this.y-e.y,u=this.z-e.z;return r*r+a*a+u*u}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,r,a){let u=Math.sin(r)*e;return this.x=u*Math.sin(a),this.y=Math.cos(r)*e,this.z=u*Math.cos(a),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,r,a){return this.x=e*Math.sin(r),this.y=a,this.z=e*Math.cos(r),this}setFromMatrixPosition(e){let r=e.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this}setFromMatrixScale(e){let r=this.setFromMatrixColumn(e,0).length(),a=this.setFromMatrixColumn(e,1).length(),u=this.setFromMatrixColumn(e,2).length();return this.x=r,this.y=a,this.z=u,this}setFromMatrixColumn(e,r){return this.fromArray(e.elements,r*4)}setFromMatrix3Column(e,r){return this.fromArray(e.elements,r*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,r=0){return this.x=e[r],this.y=e[r+1],this.z=e[r+2],this}toArray(e=[],r=0){return e[r]=this.x,e[r+1]=this.y,e[r+2]=this.z,e}fromBufferAttribute(e,r){return this.x=e.getX(r),this.y=e.getY(r),this.z=e.getZ(r),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,r=Math.random()*2-1,a=Math.sqrt(1-r*r);return this.x=a*Math.cos(e),this.y=r,this.z=a*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},El=new Pe,Gf=new go;var mo=class o{constructor(e,r,a,u,c,h,p,d,g,v,x,M,w,I,D,b){o.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,r,a,u,c,h,p,d,g,v,x,M,w,I,D,b)}set(e,r,a,u,c,h,p,d,g,v,x,M,w,I,D,b){let T=this.elements;return T[0]=e,T[4]=r,T[8]=a,T[12]=u,T[1]=c,T[5]=h,T[9]=p,T[13]=d,T[2]=g,T[6]=v,T[10]=x,T[14]=M,T[3]=w,T[7]=I,T[11]=D,T[15]=b,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 o().fromArray(this.elements)}copy(e){let r=this.elements,a=e.elements;return r[0]=a[0],r[1]=a[1],r[2]=a[2],r[3]=a[3],r[4]=a[4],r[5]=a[5],r[6]=a[6],r[7]=a[7],r[8]=a[8],r[9]=a[9],r[10]=a[10],r[11]=a[11],r[12]=a[12],r[13]=a[13],r[14]=a[14],r[15]=a[15],this}copyPosition(e){let r=this.elements,a=e.elements;return r[12]=a[12],r[13]=a[13],r[14]=a[14],this}setFromMatrix3(e){let r=e.elements;return this.set(r[0],r[3],r[6],0,r[1],r[4],r[7],0,r[2],r[5],r[8],0,0,0,0,1),this}extractBasis(e,r,a){return e.setFromMatrixColumn(this,0),r.setFromMatrixColumn(this,1),a.setFromMatrixColumn(this,2),this}makeBasis(e,r,a){return this.set(e.x,r.x,a.x,0,e.y,r.y,a.y,0,e.z,r.z,a.z,0,0,0,0,1),this}extractRotation(e){let r=this.elements,a=e.elements,u=1/us.setFromMatrixColumn(e,0).length(),c=1/us.setFromMatrixColumn(e,1).length(),h=1/us.setFromMatrixColumn(e,2).length();return r[0]=a[0]*u,r[1]=a[1]*u,r[2]=a[2]*u,r[3]=0,r[4]=a[4]*c,r[5]=a[5]*c,r[6]=a[6]*c,r[7]=0,r[8]=a[8]*h,r[9]=a[9]*h,r[10]=a[10]*h,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromEuler(e){let r=this.elements,a=e.x,u=e.y,c=e.z,h=Math.cos(a),p=Math.sin(a),d=Math.cos(u),g=Math.sin(u),v=Math.cos(c),x=Math.sin(c);if(e.order==="XYZ"){let M=h*v,w=h*x,I=p*v,D=p*x;r[0]=d*v,r[4]=-d*x,r[8]=g,r[1]=w+I*g,r[5]=M-D*g,r[9]=-p*d,r[2]=D-M*g,r[6]=I+w*g,r[10]=h*d}else if(e.order==="YXZ"){let M=d*v,w=d*x,I=g*v,D=g*x;r[0]=M+D*p,r[4]=I*p-w,r[8]=h*g,r[1]=h*x,r[5]=h*v,r[9]=-p,r[2]=w*p-I,r[6]=D+M*p,r[10]=h*d}else if(e.order==="ZXY"){let M=d*v,w=d*x,I=g*v,D=g*x;r[0]=M-D*p,r[4]=-h*x,r[8]=I+w*p,r[1]=w+I*p,r[5]=h*v,r[9]=D-M*p,r[2]=-h*g,r[6]=p,r[10]=h*d}else if(e.order==="ZYX"){let M=h*v,w=h*x,I=p*v,D=p*x;r[0]=d*v,r[4]=I*g-w,r[8]=M*g+D,r[1]=d*x,r[5]=D*g+M,r[9]=w*g-I,r[2]=-g,r[6]=p*d,r[10]=h*d}else if(e.order==="YZX"){let M=h*d,w=h*g,I=p*d,D=p*g;r[0]=d*v,r[4]=D-M*x,r[8]=I*x+w,r[1]=x,r[5]=h*v,r[9]=-p*v,r[2]=-g*v,r[6]=w*x+I,r[10]=M-D*x}else if(e.order==="XZY"){let M=h*d,w=h*g,I=p*d,D=p*g;r[0]=d*v,r[4]=-x,r[8]=g*v,r[1]=M*x+D,r[5]=h*v,r[9]=w*x-I,r[2]=I*x-w,r[6]=p*v,r[10]=D*x+M}return r[3]=0,r[7]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Q0,e,j0)}lookAt(e,r,a){let u=this.elements;return Xr.subVectors(e,r),Xr.lengthSq()===0&&(Xr.z=1),Xr.normalize(),ho.crossVectors(a,Xr),ho.lengthSq()===0&&(Math.abs(a.z)===1?Xr.x+=1e-4:Xr.z+=1e-4,Xr.normalize(),ho.crossVectors(a,Xr)),ho.normalize(),Ba.crossVectors(Xr,ho),u[0]=ho.x,u[4]=Ba.x,u[8]=Xr.x,u[1]=ho.y,u[5]=Ba.y,u[9]=Xr.y,u[2]=ho.z,u[6]=Ba.z,u[10]=Xr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,r){let a=e.elements,u=r.elements,c=this.elements,h=a[0],p=a[4],d=a[8],g=a[12],v=a[1],x=a[5],M=a[9],w=a[13],I=a[2],D=a[6],b=a[10],T=a[14],L=a[3],P=a[7],z=a[11],k=a[15],Y=u[0],q=u[4],C=u[8],ot=u[12],pt=u[1],dt=u[5],F=u[9],ye=u[13],et=u[2],St=u[6],Pt=u[10],Rt=u[14],it=u[3],mt=u[7],U=u[11],Nt=u[15];return c[0]=h*Y+p*pt+d*et+g*it,c[4]=h*q+p*dt+d*St+g*mt,c[8]=h*C+p*F+d*Pt+g*U,c[12]=h*ot+p*ye+d*Rt+g*Nt,c[1]=v*Y+x*pt+M*et+w*it,c[5]=v*q+x*dt+M*St+w*mt,c[9]=v*C+x*F+M*Pt+w*U,c[13]=v*ot+x*ye+M*Rt+w*Nt,c[2]=I*Y+D*pt+b*et+T*it,c[6]=I*q+D*dt+b*St+T*mt,c[10]=I*C+D*F+b*Pt+T*U,c[14]=I*ot+D*ye+b*Rt+T*Nt,c[3]=L*Y+P*pt+z*et+k*it,c[7]=L*q+P*dt+z*St+k*mt,c[11]=L*C+P*F+z*Pt+k*U,c[15]=L*ot+P*ye+z*Rt+k*Nt,this}multiplyScalar(e){let r=this.elements;return r[0]*=e,r[4]*=e,r[8]*=e,r[12]*=e,r[1]*=e,r[5]*=e,r[9]*=e,r[13]*=e,r[2]*=e,r[6]*=e,r[10]*=e,r[14]*=e,r[3]*=e,r[7]*=e,r[11]*=e,r[15]*=e,this}determinant(){let e=this.elements,r=e[0],a=e[4],u=e[8],c=e[12],h=e[1],p=e[5],d=e[9],g=e[13],v=e[2],x=e[6],M=e[10],w=e[14],I=e[3],D=e[7],b=e[11],T=e[15];return I*(+c*d*x-u*g*x-c*p*M+a*g*M+u*p*w-a*d*w)+D*(+r*d*w-r*g*M+c*h*M-u*h*w+u*g*v-c*d*v)+b*(+r*g*x-r*p*w-c*h*x+a*h*w+c*p*v-a*g*v)+T*(-u*p*v-r*d*x+r*p*M+u*h*x-a*h*M+a*d*v)}transpose(){let e=this.elements,r;return r=e[1],e[1]=e[4],e[4]=r,r=e[2],e[2]=e[8],e[8]=r,r=e[6],e[6]=e[9],e[9]=r,r=e[3],e[3]=e[12],e[12]=r,r=e[7],e[7]=e[13],e[13]=r,r=e[11],e[11]=e[14],e[14]=r,this}setPosition(e,r,a){let u=this.elements;return e.isVector3?(u[12]=e.x,u[13]=e.y,u[14]=e.z):(u[12]=e,u[13]=r,u[14]=a),this}invert(){let e=this.elements,r=e[0],a=e[1],u=e[2],c=e[3],h=e[4],p=e[5],d=e[6],g=e[7],v=e[8],x=e[9],M=e[10],w=e[11],I=e[12],D=e[13],b=e[14],T=e[15],L=x*b*g-D*M*g+D*d*w-p*b*w-x*d*T+p*M*T,P=I*M*g-v*b*g-I*d*w+h*b*w+v*d*T-h*M*T,z=v*D*g-I*x*g+I*p*w-h*D*w-v*p*T+h*x*T,k=I*x*d-v*D*d-I*p*M+h*D*M+v*p*b-h*x*b,Y=r*L+a*P+u*z+c*k;if(Y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let q=1/Y;return e[0]=L*q,e[1]=(D*M*c-x*b*c-D*u*w+a*b*w+x*u*T-a*M*T)*q,e[2]=(p*b*c-D*d*c+D*u*g-a*b*g-p*u*T+a*d*T)*q,e[3]=(x*d*c-p*M*c-x*u*g+a*M*g+p*u*w-a*d*w)*q,e[4]=P*q,e[5]=(v*b*c-I*M*c+I*u*w-r*b*w-v*u*T+r*M*T)*q,e[6]=(I*d*c-h*b*c-I*u*g+r*b*g+h*u*T-r*d*T)*q,e[7]=(h*M*c-v*d*c+v*u*g-r*M*g-h*u*w+r*d*w)*q,e[8]=z*q,e[9]=(I*x*c-v*D*c-I*a*w+r*D*w+v*a*T-r*x*T)*q,e[10]=(h*D*c-I*p*c+I*a*g-r*D*g-h*a*T+r*p*T)*q,e[11]=(v*p*c-h*x*c-v*a*g+r*x*g+h*a*w-r*p*w)*q,e[12]=k*q,e[13]=(v*D*u-I*x*u+I*a*M-r*D*M-v*a*b+r*x*b)*q,e[14]=(I*p*u-h*D*u-I*a*d+r*D*d+h*a*b-r*p*b)*q,e[15]=(h*x*u-v*p*u+v*a*d-r*x*d-h*a*M+r*p*M)*q,this}scale(e){let r=this.elements,a=e.x,u=e.y,c=e.z;return r[0]*=a,r[4]*=u,r[8]*=c,r[1]*=a,r[5]*=u,r[9]*=c,r[2]*=a,r[6]*=u,r[10]*=c,r[3]*=a,r[7]*=u,r[11]*=c,this}getMaxScaleOnAxis(){let e=this.elements,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],a=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],u=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(r,a,u))}makeTranslation(e,r,a){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,r,0,0,1,a,0,0,0,1),this}makeRotationX(e){let r=Math.cos(e),a=Math.sin(e);return this.set(1,0,0,0,0,r,-a,0,0,a,r,0,0,0,0,1),this}makeRotationY(e){let r=Math.cos(e),a=Math.sin(e);return this.set(r,0,a,0,0,1,0,0,-a,0,r,0,0,0,0,1),this}makeRotationZ(e){let r=Math.cos(e),a=Math.sin(e);return this.set(r,-a,0,0,a,r,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,r){let a=Math.cos(r),u=Math.sin(r),c=1-a,h=e.x,p=e.y,d=e.z,g=c*h,v=c*p;return this.set(g*h+a,g*p-u*d,g*d+u*p,0,g*p+u*d,v*p+a,v*d-u*h,0,g*d-u*p,v*d+u*h,c*d*d+a,0,0,0,0,1),this}makeScale(e,r,a){return this.set(e,0,0,0,0,r,0,0,0,0,a,0,0,0,0,1),this}makeShear(e,r,a,u,c,h){return this.set(1,a,c,0,e,1,h,0,r,u,1,0,0,0,0,1),this}compose(e,r,a){let u=this.elements,c=r._x,h=r._y,p=r._z,d=r._w,g=c+c,v=h+h,x=p+p,M=c*g,w=c*v,I=c*x,D=h*v,b=h*x,T=p*x,L=d*g,P=d*v,z=d*x,k=a.x,Y=a.y,q=a.z;return u[0]=(1-(D+T))*k,u[1]=(w+z)*k,u[2]=(I-P)*k,u[3]=0,u[4]=(w-z)*Y,u[5]=(1-(M+T))*Y,u[6]=(b+L)*Y,u[7]=0,u[8]=(I+P)*q,u[9]=(b-L)*q,u[10]=(1-(M+D))*q,u[11]=0,u[12]=e.x,u[13]=e.y,u[14]=e.z,u[15]=1,this}decompose(e,r,a){let u=this.elements,c=us.set(u[0],u[1],u[2]).length(),h=us.set(u[4],u[5],u[6]).length(),p=us.set(u[8],u[9],u[10]).length();this.determinant()<0&&(c=-c),e.x=u[12],e.y=u[13],e.z=u[14],wi.copy(this);let g=1/c,v=1/h,x=1/p;return wi.elements[0]*=g,wi.elements[1]*=g,wi.elements[2]*=g,wi.elements[4]*=v,wi.elements[5]*=v,wi.elements[6]*=v,wi.elements[8]*=x,wi.elements[9]*=x,wi.elements[10]*=x,r.setFromRotationMatrix(wi),a.x=c,a.y=h,a.z=p,this}makePerspective(e,r,a,u,c,h,p=Ua){let d=this.elements,g=2*c/(r-e),v=2*c/(a-u),x=(r+e)/(r-e),M=(a+u)/(a-u),w,I;if(p===Ua)w=-(h+c)/(h-c),I=-2*h*c/(h-c);else if(p===Uf)w=-h/(h-c),I=-h*c/(h-c);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+p);return d[0]=g,d[4]=0,d[8]=x,d[12]=0,d[1]=0,d[5]=v,d[9]=M,d[13]=0,d[2]=0,d[6]=0,d[10]=w,d[14]=I,d[3]=0,d[7]=0,d[11]=-1,d[15]=0,this}makeOrthographic(e,r,a,u,c,h,p=Ua){let d=this.elements,g=1/(r-e),v=1/(a-u),x=1/(h-c),M=(r+e)*g,w=(a+u)*v,I,D;if(p===Ua)I=(h+c)*x,D=-2*x;else if(p===Uf)I=c*x,D=-1*x;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+p);return d[0]=2*g,d[4]=0,d[8]=0,d[12]=-M,d[1]=0,d[5]=2*v,d[9]=0,d[13]=-w,d[2]=0,d[6]=0,d[10]=D,d[14]=-I,d[3]=0,d[7]=0,d[11]=0,d[15]=1,this}equals(e){let r=this.elements,a=e.elements;for(let u=0;u<16;u++)if(r[u]!==a[u])return!1;return!0}fromArray(e,r=0){for(let a=0;a<16;a++)this.elements[a]=e[a+r];return this}toArray(e=[],r=0){let a=this.elements;return e[r]=a[0],e[r+1]=a[1],e[r+2]=a[2],e[r+3]=a[3],e[r+4]=a[4],e[r+5]=a[5],e[r+6]=a[6],e[r+7]=a[7],e[r+8]=a[8],e[r+9]=a[9],e[r+10]=a[10],e[r+11]=a[11],e[r+12]=a[12],e[r+13]=a[13],e[r+14]=a[14],e[r+15]=a[15],e}},us=new Pe,wi=new mo,Q0=new Pe(0,0,0),j0=new Pe(1,1,1),ho=new Pe,Ba=new Pe,Xr=new Pe,Vf=new mo,Hf=new go,qa=class o{constructor(e=0,r=0,a=0,u=o.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=r,this._z=a,this._order=u}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,r,a,u=this._order){return this._x=e,this._y=r,this._z=a,this._order=u,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,r=this._order,a=!0){let u=e.elements,c=u[0],h=u[4],p=u[8],d=u[1],g=u[5],v=u[9],x=u[2],M=u[6],w=u[10];switch(r){case"XYZ":this._y=Math.asin(Fr(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(-v,w),this._z=Math.atan2(-h,c)):(this._x=Math.atan2(M,g),this._z=0);break;case"YXZ":this._x=Math.asin(-Fr(v,-1,1)),Math.abs(v)<.9999999?(this._y=Math.atan2(p,w),this._z=Math.atan2(d,g)):(this._y=Math.atan2(-x,c),this._z=0);break;case"ZXY":this._x=Math.asin(Fr(M,-1,1)),Math.abs(M)<.9999999?(this._y=Math.atan2(-x,w),this._z=Math.atan2(-h,g)):(this._y=0,this._z=Math.atan2(d,c));break;case"ZYX":this._y=Math.asin(-Fr(x,-1,1)),Math.abs(x)<.9999999?(this._x=Math.atan2(M,w),this._z=Math.atan2(d,c)):(this._x=0,this._z=Math.atan2(-h,g));break;case"YZX":this._z=Math.asin(Fr(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(-v,g),this._y=Math.atan2(-x,c)):(this._x=0,this._y=Math.atan2(p,w));break;case"XZY":this._z=Math.asin(-Fr(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(M,g),this._y=Math.atan2(p,c)):(this._x=Math.atan2(-v,w),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+r)}return this._order=r,a===!0&&this._onChangeCallback(),this}setFromQuaternion(e,r,a){return Vf.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Vf,r,a)}setFromVector3(e,r=this._order){return this.set(e.x,e.y,e.z,r)}reorder(e){return Hf.setFromEuler(this),this.setFromQuaternion(Hf,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],r=0){return e[r]=this._x,e[r+1]=this._y,e[r+2]=this._z,e[r+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};qa.DEFAULT_ORDER="XYZ";var Cl=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},ty=0,qf=new Pe,ls=new go,ji=new mo,za=new Pe,ea=new Pe,ey=new Pe,ny=new go,Wf=new Pe(1,0,0),Xf=new Pe(0,1,0),Yf=new Pe(0,0,1),$f={type:"added"},ry={type:"removed"},cs={type:"childadded",child:null},Ml={type:"childremoved",child:null},ra=class o extends Ha{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ty++}),this.uuid=kl(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=o.DEFAULT_UP.clone();let e=new Pe,r=new qa,a=new go,u=new Pe(1,1,1);function c(){a.setFromEuler(r,!1)}function h(){r.setFromQuaternion(a,void 0,!1)}r._onChange(c),a._onChange(h),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:r},quaternion:{configurable:!0,enumerable:!0,value:a},scale:{configurable:!0,enumerable:!0,value:u},modelViewMatrix:{value:new mo},normalMatrix:{value:new Dt}}),this.matrix=new mo,this.matrixWorld=new mo,this.matrixAutoUpdate=o.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=o.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Cl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,r){this.quaternion.setFromAxisAngle(e,r)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,r){return ls.setFromAxisAngle(e,r),this.quaternion.multiply(ls),this}rotateOnWorldAxis(e,r){return ls.setFromAxisAngle(e,r),this.quaternion.premultiply(ls),this}rotateX(e){return this.rotateOnAxis(Wf,e)}rotateY(e){return this.rotateOnAxis(Xf,e)}rotateZ(e){return this.rotateOnAxis(Yf,e)}translateOnAxis(e,r){return qf.copy(e).applyQuaternion(this.quaternion),this.position.add(qf.multiplyScalar(r)),this}translateX(e){return this.translateOnAxis(Wf,e)}translateY(e){return this.translateOnAxis(Xf,e)}translateZ(e){return this.translateOnAxis(Yf,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ji.copy(this.matrixWorld).invert())}lookAt(e,r,a){e.isVector3?za.copy(e):za.set(e,r,a);let u=this.parent;this.updateWorldMatrix(!0,!1),ea.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ji.lookAt(ea,za,this.up):ji.lookAt(za,ea,this.up),this.quaternion.setFromRotationMatrix(ji),u&&(ji.extractRotation(u.matrixWorld),ls.setFromRotationMatrix(ji),this.quaternion.premultiply(ls.invert()))}add(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.add(arguments[r]);return this}return e===this?(console.error("THREE.Object3D.add: object can\'t be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent($f),cs.child=e,this.dispatchEvent(cs),cs.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let a=0;a<arguments.length;a++)this.remove(arguments[a]);return this}let r=this.children.indexOf(e);return r!==-1&&(e.parent=null,this.children.splice(r,1),e.dispatchEvent(ry),Ml.child=e,this.dispatchEvent(Ml),Ml.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ji.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ji.multiply(e.parent.matrixWorld)),e.applyMatrix4(ji),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent($f),cs.child=e,this.dispatchEvent(cs),cs.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,r){if(this[e]===r)return this;for(let a=0,u=this.children.length;a<u;a++){let h=this.children[a].getObjectByProperty(e,r);if(h!==void 0)return h}}getObjectsByProperty(e,r,a=[]){this[e]===r&&a.push(this);let u=this.children;for(let c=0,h=u.length;c<h;c++)u[c].getObjectsByProperty(e,r,a);return a}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ea,e,ey),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ea,ny,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let r=this.matrixWorld.elements;return e.set(r[8],r[9],r[10]).normalize()}raycast(){}traverse(e){e(this);let r=this.children;for(let a=0,u=r.length;a<u;a++)r[a].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let r=this.children;for(let a=0,u=r.length;a<u;a++)r[a].traverseVisible(e)}traverseAncestors(e){let r=this.parent;r!==null&&(e(r),r.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let r=this.children;for(let a=0,u=r.length;a<u;a++)r[a].updateMatrixWorld(e)}updateWorldMatrix(e,r){let a=this.parent;if(e===!0&&a!==null&&a.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),r===!0){let u=this.children;for(let c=0,h=u.length;c<h;c++)u[c].updateWorldMatrix(!1,!0)}}toJSON(e){let r=e===void 0||typeof e=="string",a={};r&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},a.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let u={};u.uuid=this.uuid,u.type=this.type,this.name!==""&&(u.name=this.name),this.castShadow===!0&&(u.castShadow=!0),this.receiveShadow===!0&&(u.receiveShadow=!0),this.visible===!1&&(u.visible=!1),this.frustumCulled===!1&&(u.frustumCulled=!1),this.renderOrder!==0&&(u.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(u.userData=this.userData),u.layers=this.layers.mask,u.matrix=this.matrix.toArray(),u.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(u.matrixAutoUpdate=!1),this.isInstancedMesh&&(u.type="InstancedMesh",u.count=this.count,u.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(u.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(u.type="BatchedMesh",u.perObjectFrustumCulled=this.perObjectFrustumCulled,u.sortObjects=this.sortObjects,u.drawRanges=this._drawRanges,u.reservedRanges=this._reservedRanges,u.visibility=this._visibility,u.active=this._active,u.bounds=this._bounds.map(p=>({boxInitialized:p.boxInitialized,boxMin:p.box.min.toArray(),boxMax:p.box.max.toArray(),sphereInitialized:p.sphereInitialized,sphereRadius:p.sphere.radius,sphereCenter:p.sphere.center.toArray()})),u.maxInstanceCount=this._maxInstanceCount,u.maxVertexCount=this._maxVertexCount,u.maxIndexCount=this._maxIndexCount,u.geometryInitialized=this._geometryInitialized,u.geometryCount=this._geometryCount,u.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(u.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(u.boundingSphere={center:u.boundingSphere.center.toArray(),radius:u.boundingSphere.radius}),this.boundingBox!==null&&(u.boundingBox={min:u.boundingBox.min.toArray(),max:u.boundingBox.max.toArray()}));function c(p,d){return p[d.uuid]===void 0&&(p[d.uuid]=d.toJSON(e)),d.uuid}if(this.isScene)this.background&&(this.background.isColor?u.background=this.background.toJSON():this.background.isTexture&&(u.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(u.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){u.geometry=c(e.geometries,this.geometry);let p=this.geometry.parameters;if(p!==void 0&&p.shapes!==void 0){let d=p.shapes;if(Array.isArray(d))for(let g=0,v=d.length;g<v;g++){let x=d[g];c(e.shapes,x)}else c(e.shapes,d)}}if(this.isSkinnedMesh&&(u.bindMode=this.bindMode,u.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(c(e.skeletons,this.skeleton),u.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let p=[];for(let d=0,g=this.material.length;d<g;d++)p.push(c(e.materials,this.material[d]));u.material=p}else u.material=c(e.materials,this.material);if(this.children.length>0){u.children=[];for(let p=0;p<this.children.length;p++)u.children.push(this.children[p].toJSON(e).object)}if(this.animations.length>0){u.animations=[];for(let p=0;p<this.animations.length;p++){let d=this.animations[p];u.animations.push(c(e.animations,d))}}if(r){let p=h(e.geometries),d=h(e.materials),g=h(e.textures),v=h(e.images),x=h(e.shapes),M=h(e.skeletons),w=h(e.animations),I=h(e.nodes);p.length>0&&(a.geometries=p),d.length>0&&(a.materials=d),g.length>0&&(a.textures=g),v.length>0&&(a.images=v),x.length>0&&(a.shapes=x),M.length>0&&(a.skeletons=M),w.length>0&&(a.animations=w),I.length>0&&(a.nodes=I)}return a.object=u,a;function h(p){let d=[];for(let g in p){let v=p[g];delete v.metadata,d.push(v)}return d}}clone(e){return new this.constructor().copy(this,e)}copy(e,r=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),r===!0)for(let a=0;a<e.children.length;a++){let u=e.children[a];this.add(u.clone())}return this}};ra.DEFAULT_UP=new Pe(0,1,0);ra.DEFAULT_MATRIX_AUTO_UPDATE=!0;ra.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var tp={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},fo={h:0,s:0,l:0},ka={h:0,s:0,l:0};function wl(o,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?o+(e-o)*6*r:r<1/2?e:r<2/3?o+(e-o)*6*(2/3-r):o}var rr=class{constructor(e,r,a){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,r,a)}set(e,r,a){if(r===void 0&&a===void 0){let u=e;u&&u.isColor?this.copy(u):typeof u=="number"?this.setHex(u):typeof u=="string"&&this.setStyle(u)}else this.setRGB(e,r,a);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,r=po){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Mi.toWorkingColorSpace(this,r),this}setRGB(e,r,a,u=Mi.workingColorSpace){return this.r=e,this.g=r,this.b=a,Mi.toWorkingColorSpace(this,u),this}setHSL(e,r,a,u=Mi.workingColorSpace){if(e=$0(e,1),r=Fr(r,0,1),a=Fr(a,0,1),r===0)this.r=this.g=this.b=a;else{let c=a<=.5?a*(1+r):a+r-a*r,h=2*a-c;this.r=wl(h,c,e+1/3),this.g=wl(h,c,e),this.b=wl(h,c,e-1/3)}return Mi.toWorkingColorSpace(this,u),this}setStyle(e,r=po){function a(c){c!==void 0&&parseFloat(c)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let u;if(u=/^(\\w+)\\(([^\\)]*)\\)/.exec(e)){let c,h=u[1],p=u[2];switch(h){case"rgb":case"rgba":if(c=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(p))return a(c[4]),this.setRGB(Math.min(255,parseInt(c[1],10))/255,Math.min(255,parseInt(c[2],10))/255,Math.min(255,parseInt(c[3],10))/255,r);if(c=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(p))return a(c[4]),this.setRGB(Math.min(100,parseInt(c[1],10))/100,Math.min(100,parseInt(c[2],10))/100,Math.min(100,parseInt(c[3],10))/100,r);break;case"hsl":case"hsla":if(c=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(p))return a(c[4]),this.setHSL(parseFloat(c[1])/360,parseFloat(c[2])/100,parseFloat(c[3])/100,r);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(u=/^\\#([A-Fa-f\\d]+)$/.exec(e)){let c=u[1],h=c.length;if(h===3)return this.setRGB(parseInt(c.charAt(0),16)/15,parseInt(c.charAt(1),16)/15,parseInt(c.charAt(2),16)/15,r);if(h===6)return this.setHex(parseInt(c,16),r);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,r);return this}setColorName(e,r=po){let a=tp[e.toLowerCase()];return a!==void 0?this.setHex(a,r):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=fs(e.r),this.g=fs(e.g),this.b=fs(e.b),this}copyLinearToSRGB(e){return this.r=_l(e.r),this.g=_l(e.g),this.b=_l(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=po){return Mi.fromWorkingColorSpace(gr.copy(this),e),Math.round(Fr(gr.r*255,0,255))*65536+Math.round(Fr(gr.g*255,0,255))*256+Math.round(Fr(gr.b*255,0,255))}getHexString(e=po){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,r=Mi.workingColorSpace){Mi.fromWorkingColorSpace(gr.copy(this),r);let a=gr.r,u=gr.g,c=gr.b,h=Math.max(a,u,c),p=Math.min(a,u,c),d,g,v=(p+h)/2;if(p===h)d=0,g=0;else{let x=h-p;switch(g=v<=.5?x/(h+p):x/(2-h-p),h){case a:d=(u-c)/x+(u<c?6:0);break;case u:d=(c-a)/x+2;break;case c:d=(a-u)/x+4;break}d/=6}return e.h=d,e.s=g,e.l=v,e}getRGB(e,r=Mi.workingColorSpace){return Mi.fromWorkingColorSpace(gr.copy(this),r),e.r=gr.r,e.g=gr.g,e.b=gr.b,e}getStyle(e=po){Mi.fromWorkingColorSpace(gr.copy(this),e);let r=gr.r,a=gr.g,u=gr.b;return e!==po?`color(${e} ${r.toFixed(3)} ${a.toFixed(3)} ${u.toFixed(3)})`:`rgb(${Math.round(r*255)},${Math.round(a*255)},${Math.round(u*255)})`}offsetHSL(e,r,a){return this.getHSL(fo),this.setHSL(fo.h+e,fo.s+r,fo.l+a)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,r){return this.r=e.r+r.r,this.g=e.g+r.g,this.b=e.b+r.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,r){return this.r+=(e.r-this.r)*r,this.g+=(e.g-this.g)*r,this.b+=(e.b-this.b)*r,this}lerpColors(e,r,a){return this.r=e.r+(r.r-e.r)*a,this.g=e.g+(r.g-e.g)*a,this.b=e.b+(r.b-e.b)*a,this}lerpHSL(e,r){this.getHSL(fo),e.getHSL(ka);let a=yl(fo.h,ka.h,r),u=yl(fo.s,ka.s,r),c=yl(fo.l,ka.l,r);return this.setHSL(a,u,c),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let r=this.r,a=this.g,u=this.b,c=e.elements;return this.r=c[0]*r+c[3]*a+c[6]*u,this.g=c[1]*r+c[4]*a+c[7]*u,this.b=c[2]*r+c[5]*a+c[8]*u,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,r=0){return this.r=e[r],this.g=e[r+1],this.b=e[r+2],this}toArray(e=[],r=0){return e[r]=this.r,e[r+1]=this.g,e[r+2]=this.b,e}fromBufferAttribute(e,r){return this.r=e.getX(r),this.g=e.getY(r),this.b=e.getZ(r),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},gr=new rr;rr.NAMES=tp;function iy(o){let e={};for(let r in o){e[r]={};for(let a in o[r]){let u=o[r][a];u&&(u.isColor||u.isMatrix3||u.isMatrix4||u.isVector2||u.isVector3||u.isVector4||u.isTexture||u.isQuaternion)?u.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[r][a]=null):e[r][a]=u.clone():Array.isArray(u)?e[r][a]=u.slice():e[r][a]=u}}return e}function Or(o){let e={};for(let r=0;r<o.length;r++){let a=iy(o[r]);for(let u in a)e[u]=a[u]}return e}var oy=`#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif`,sy=`#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`,ay=`#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif`,uy=`#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,ly=`#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif`,cy=`#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif`,hy=`#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\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`,fy=`#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif`,py=`#ifdef USE_BATCHING\n #if ! defined( GL_ANGLE_multi_draw )\n #define gl_DrawID _gl_DrawID\n uniform int _gl_DrawID;\n #endif\n uniform highp sampler2D batchingTexture;\n uniform highp usampler2D batchingIdTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n float getIndirectIndex( const in int i ) {\n int size = textureSize( batchingIdTexture, 0 ).x;\n int x = i % size;\n int y = i / size;\n return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n }\n#endif\n#ifdef USE_BATCHING_COLOR\n uniform sampler2D batchingColorTexture;\n vec3 getBatchingColor( const in float i ) {\n int size = textureSize( batchingColorTexture, 0 ).x;\n int j = int( i );\n int x = j % size;\n int y = j / size;\n return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n }\n#endif`,dy=`#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif`,my=`vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif`,gy=`vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif`,yy=`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`,vy=`#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`,_y=`#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 = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( 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`,xy=`#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\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\n#endif`,Ey=`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif`,My=`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif`,wy=`#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif`,Sy=`#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif`,by=`#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif`,Ay=`#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif`,Ty=`#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_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\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n vColor.xyz *= batchingColor.xyz;\n#endif`,Cy=`#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}\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`,Iy=`#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_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\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`,Py=`vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n ');
|
|
11669
|
+
return inlineWorker('var D0=Object.create;var pl=Object.defineProperty;var O0=Object.getOwnPropertyDescriptor;var F0=Object.getOwnPropertyNames,rf=Object.getOwnPropertySymbols,U0=Object.getPrototypeOf,of=Object.prototype.hasOwnProperty,B0=Object.prototype.propertyIsEnumerable;var fl=(o,e,r)=>e in o?pl(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,js=(o,e)=>{for(var r in e||(e={}))of.call(e,r)&&fl(o,r,e[r]);if(rf)for(var r of rf(e))B0.call(e,r)&&fl(o,r,e[r]);return o};var ct=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var z0=(o,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of F0(e))!of.call(o,u)&&u!==r&&pl(o,u,{get:()=>e[u],enumerable:!(a=O0(e,u))||a.enumerable});return o};var ln=(o,e,r)=>(r=o!=null?D0(U0(o)):{},z0(e||!o||!o.__esModule?pl(r,"default",{value:o,enumerable:!0}):r,o));var Wr=(o,e,r)=>fl(o,typeof e!="symbol"?e+"":e,r);var af=ct((wS,sf)=>{var dl=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,r)=>e.priority-r.priority)}set(e,r){let a=Number(r);if(isNaN(a))throw new TypeError(\'"priority" must be a number\');return this.keys.has(e)?this.queue.map(u=>(u.key===e&&Object.assign(u,{priority:a}),u)):(this.keys.add(e),this.queue.push({key:e,priority:a})),this.sort(),this.queue.length}next(){let e=this.queue.shift();return this.keys.delete(e.key),e}isEmpty(){return this.queue.length===0}has(e){return this.keys.has(e)}get(e){return this.queue.find(r=>r.key===e)}};sf.exports=dl});var cf=ct((SS,lf)=>{function uf(o,e){let r=new Map;for(let[a,u]of o)a!==e&&u instanceof Map?r.set(a,uf(u,e)):a!==e&&r.set(a,u);return r}lf.exports=uf});var pf=ct((bS,ff)=>{function k0(o){let e=Number(o);return!(isNaN(e)||e<=0)}function hf(o){let e=new Map;return Object.keys(o).forEach(a=>{let u=o[a];if(u!==null&&typeof u=="object"&&!Array.isArray(u))return e.set(a,hf(u));if(!k0(u))throw new Error(`Could not add node at key "${a}", make sure it\'s a valid node`,u);return e.set(a,Number(u))}),e}ff.exports=hf});var gf=ct((AS,mf)=>{function df(o){if(!(o instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof o}`);o.forEach((e,r)=>{if(typeof e=="object"&&e instanceof Map){df(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${r}`)})}mf.exports=df});var xf=ct((TS,_f)=>{var G0=af(),V0=cf(),yf=pf(),vf=gf(),ml=class{constructor(e){e instanceof Map?(vf(e),this.graph=e):e?this.graph=yf(e):this.graph=new Map}addNode(e,r){let a;return r instanceof Map?(vf(r),a=r):a=yf(r),this.graph.set(e,a),this}addVertex(e,r){return this.addNode(e,r)}removeNode(e){return this.graph=V0(this.graph,e),this}path(e,r,a={}){if(!this.graph.size)return a.cost?{path:null,cost:0}:null;let u=new Set,c=new G0,h=new Map,p=[],d=0,g=[];if(a.avoid&&(g=[].concat(a.avoid)),g.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(g.includes(r))throw new Error(`Ending node (${r}) cannot be avoided`);for(c.set(e,0);!c.isEmpty();){let v=c.next();if(v.key===r){d=v.priority;let M=v.key;for(;h.has(M);)p.push(M),M=h.get(M);break}u.add(v.key),(this.graph.get(v.key)||new Map).forEach((M,w)=>{if(u.has(w)||g.includes(w))return null;if(!c.has(w))return h.set(w,v.key),c.set(w,v.priority+M);let I=c.get(w).priority,D=v.priority+M;return D<I?(h.set(w,v.key),c.set(w,D)):null})}return p.length?(a.trim?p.shift():p=p.concat([e]),a.reverse||(p=p.reverse()),a.cost?{path:p,cost:d}:p):a.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};_f.exports=ml});var Xa=ct((WS,rp)=>{"use strict";var np=Object.getOwnPropertySymbols,K_=Object.prototype.hasOwnProperty,Q_=Object.prototype.propertyIsEnumerable;function j_(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function t1(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;var a=Object.getOwnPropertyNames(e).map(function(c){return e[c]});if(a.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(c){u[c]=c}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch(c){return!1}}rp.exports=t1()?Object.assign:function(o,e){for(var r,a=j_(o),u,c=1;c<arguments.length;c++){r=Object(arguments[c]);for(var h in r)K_.call(r,h)&&(a[h]=r[h]);if(np){u=np(r);for(var p=0;p<u.length;p++)Q_.call(r,u[p])&&(a[u[p]]=r[u[p]])}}return a}});var $l=ct((Xl,Yl)=>{(function(o,e){typeof Xl=="object"&&typeof Yl!="undefined"?Yl.exports=e():typeof define=="function"&&define.amd?define(e):(o=o||self).RBush=e()})(Xl,function(){"use strict";function o(b,T,L,P,z){(function k(Y,q,C,ot,pt){for(;ot>C;){if(ot-C>600){var dt=ot-C+1,F=q-C+1,ye=Math.log(dt),et=.5*Math.exp(2*ye/3),St=.5*Math.sqrt(ye*et*(dt-et)/dt)*(F-dt/2<0?-1:1),Pt=Math.max(C,Math.floor(q-F*et/dt+St)),Rt=Math.min(ot,Math.floor(q+(dt-F)*et/dt+St));k(Y,q,Pt,Rt,pt)}var it=Y[q],mt=C,U=ot;for(e(Y,C,q),pt(Y[ot],it)>0&&e(Y,C,ot);mt<U;){for(e(Y,mt,U),mt++,U--;pt(Y[mt],it)<0;)mt++;for(;pt(Y[U],it)>0;)U--}pt(Y[C],it)===0?e(Y,C,U):e(Y,++U,ot),U<=q&&(C=U+1),q<=U&&(ot=U-1)}})(b,T,L||0,P||b.length-1,z||r)}function e(b,T,L){var P=b[T];b[T]=b[L],b[L]=P}function r(b,T){return b<T?-1:b>T?1:0}var a=function(b){b===void 0&&(b=9),this._maxEntries=Math.max(4,b),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function u(b,T,L){if(!L)return T.indexOf(b);for(var P=0;P<T.length;P++)if(L(b,T[P]))return P;return-1}function c(b,T){h(b,0,b.children.length,T,b)}function h(b,T,L,P,z){z||(z=I(null)),z.minX=1/0,z.minY=1/0,z.maxX=-1/0,z.maxY=-1/0;for(var k=T;k<L;k++){var Y=b.children[k];p(z,b.leaf?P(Y):Y)}return z}function p(b,T){return b.minX=Math.min(b.minX,T.minX),b.minY=Math.min(b.minY,T.minY),b.maxX=Math.max(b.maxX,T.maxX),b.maxY=Math.max(b.maxY,T.maxY),b}function d(b,T){return b.minX-T.minX}function g(b,T){return b.minY-T.minY}function v(b){return(b.maxX-b.minX)*(b.maxY-b.minY)}function x(b){return b.maxX-b.minX+(b.maxY-b.minY)}function M(b,T){return b.minX<=T.minX&&b.minY<=T.minY&&T.maxX<=b.maxX&&T.maxY<=b.maxY}function w(b,T){return T.minX<=b.maxX&&T.minY<=b.maxY&&T.maxX>=b.minX&&T.maxY>=b.minY}function I(b){return{children:b,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function D(b,T,L,P,z){for(var k=[T,L];k.length;)if(!((L=k.pop())-(T=k.pop())<=P)){var Y=T+Math.ceil((L-T)/P/2)*P;o(b,Y,T,L,z),k.push(T,Y,Y,L)}}return a.prototype.all=function(){return this._all(this.data,[])},a.prototype.search=function(b){var T=this.data,L=[];if(!w(b,T))return L;for(var P=this.toBBox,z=[];T;){for(var k=0;k<T.children.length;k++){var Y=T.children[k],q=T.leaf?P(Y):Y;w(b,q)&&(T.leaf?L.push(Y):M(b,q)?this._all(Y,L):z.push(Y))}T=z.pop()}return L},a.prototype.collides=function(b){var T=this.data;if(!w(b,T))return!1;for(var L=[];T;){for(var P=0;P<T.children.length;P++){var z=T.children[P],k=T.leaf?this.toBBox(z):z;if(w(b,k)){if(T.leaf||M(b,k))return!0;L.push(z)}}T=L.pop()}return!1},a.prototype.load=function(b){if(!b||!b.length)return this;if(b.length<this._minEntries){for(var T=0;T<b.length;T++)this.insert(b[T]);return this}var L=this._build(b.slice(),0,b.length-1,0);if(this.data.children.length)if(this.data.height===L.height)this._splitRoot(this.data,L);else{if(this.data.height<L.height){var P=this.data;this.data=L,L=P}this._insert(L,this.data.height-L.height-1,!0)}else this.data=L;return this},a.prototype.insert=function(b){return b&&this._insert(b,this.data.height-1),this},a.prototype.clear=function(){return this.data=I([]),this},a.prototype.remove=function(b,T){if(!b)return this;for(var L,P,z,k=this.data,Y=this.toBBox(b),q=[],C=[];k||q.length;){if(k||(k=q.pop(),P=q[q.length-1],L=C.pop(),z=!0),k.leaf){var ot=u(b,k.children,T);if(ot!==-1)return k.children.splice(ot,1),q.push(k),this._condense(q),this}z||k.leaf||!M(k,Y)?P?(L++,k=P.children[L],z=!1):k=null:(q.push(k),C.push(L),L=0,P=k,k=k.children[0])}return this},a.prototype.toBBox=function(b){return b},a.prototype.compareMinX=function(b,T){return b.minX-T.minX},a.prototype.compareMinY=function(b,T){return b.minY-T.minY},a.prototype.toJSON=function(){return this.data},a.prototype.fromJSON=function(b){return this.data=b,this},a.prototype._all=function(b,T){for(var L=[];b;)b.leaf?T.push.apply(T,b.children):L.push.apply(L,b.children),b=L.pop();return T},a.prototype._build=function(b,T,L,P){var z,k=L-T+1,Y=this._maxEntries;if(k<=Y)return c(z=I(b.slice(T,L+1)),this.toBBox),z;P||(P=Math.ceil(Math.log(k)/Math.log(Y)),Y=Math.ceil(k/Math.pow(Y,P-1))),(z=I([])).leaf=!1,z.height=P;var q=Math.ceil(k/Y),C=q*Math.ceil(Math.sqrt(Y));D(b,T,L,C,this.compareMinX);for(var ot=T;ot<=L;ot+=C){var pt=Math.min(ot+C-1,L);D(b,ot,pt,q,this.compareMinY);for(var dt=ot;dt<=pt;dt+=q){var F=Math.min(dt+q-1,pt);z.children.push(this._build(b,dt,F,P-1))}}return c(z,this.toBBox),z},a.prototype._chooseSubtree=function(b,T,L,P){for(;P.push(T),!T.leaf&&P.length-1!==L;){for(var z=1/0,k=1/0,Y=void 0,q=0;q<T.children.length;q++){var C=T.children[q],ot=v(C),pt=(dt=b,F=C,(Math.max(F.maxX,dt.maxX)-Math.min(F.minX,dt.minX))*(Math.max(F.maxY,dt.maxY)-Math.min(F.minY,dt.minY))-ot);pt<k?(k=pt,z=ot<z?ot:z,Y=C):pt===k&&ot<z&&(z=ot,Y=C)}T=Y||T.children[0]}var dt,F;return T},a.prototype._insert=function(b,T,L){var P=L?b:this.toBBox(b),z=[],k=this._chooseSubtree(P,this.data,T,z);for(k.children.push(b),p(k,P);T>=0&&z[T].children.length>this._maxEntries;)this._split(z,T),T--;this._adjustParentBBoxes(P,z,T)},a.prototype._split=function(b,T){var L=b[T],P=L.children.length,z=this._minEntries;this._chooseSplitAxis(L,z,P);var k=this._chooseSplitIndex(L,z,P),Y=I(L.children.splice(k,L.children.length-k));Y.height=L.height,Y.leaf=L.leaf,c(L,this.toBBox),c(Y,this.toBBox),T?b[T-1].children.push(Y):this._splitRoot(L,Y)},a.prototype._splitRoot=function(b,T){this.data=I([b,T]),this.data.height=b.height+1,this.data.leaf=!1,c(this.data,this.toBBox)},a.prototype._chooseSplitIndex=function(b,T,L){for(var P,z,k,Y,q,C,ot,pt=1/0,dt=1/0,F=T;F<=L-T;F++){var ye=h(b,0,F,this.toBBox),et=h(b,F,L,this.toBBox),St=(z=ye,k=et,Y=void 0,q=void 0,C=void 0,ot=void 0,Y=Math.max(z.minX,k.minX),q=Math.max(z.minY,k.minY),C=Math.min(z.maxX,k.maxX),ot=Math.min(z.maxY,k.maxY),Math.max(0,C-Y)*Math.max(0,ot-q)),Pt=v(ye)+v(et);St<pt?(pt=St,P=F,dt=Pt<dt?Pt:dt):St===pt&&Pt<dt&&(dt=Pt,P=F)}return P||L-T},a.prototype._chooseSplitAxis=function(b,T,L){var P=b.leaf?this.compareMinX:d,z=b.leaf?this.compareMinY:g;this._allDistMargin(b,T,L,P)<this._allDistMargin(b,T,L,z)&&b.children.sort(P)},a.prototype._allDistMargin=function(b,T,L,P){b.children.sort(P);for(var z=this.toBBox,k=h(b,0,T,z),Y=h(b,L-T,L,z),q=x(k)+x(Y),C=T;C<L-T;C++){var ot=b.children[C];p(k,b.leaf?z(ot):ot),q+=x(k)}for(var pt=L-T-1;pt>=T;pt--){var dt=b.children[pt];p(Y,b.leaf?z(dt):dt),q+=x(Y)}return q},a.prototype._adjustParentBBoxes=function(b,T,L){for(var P=L;P>=0;P--)p(T[P],b)},a.prototype._condense=function(b){for(var T=b.length-1,L=void 0;T>=0;T--)b[T].children.length===0?T>0?(L=b[T-1].children).splice(L.indexOf(b[T]),1):this.clear():c(b[T],this.toBBox)},a})});var ip=ct((Zl,Jl)=>{(function(o,e){typeof Zl=="object"&&typeof Jl!="undefined"?Jl.exports=e():typeof define=="function"&&define.amd?define(e):(o=o||self,o.TinyQueue=e())})(Zl,function(){"use strict";var o=function(a,u){if(a===void 0&&(a=[]),u===void 0&&(u=e),this.data=a,this.length=this.data.length,this.compare=u,this.length>0)for(var c=(this.length>>1)-1;c>=0;c--)this._down(c)};o.prototype.push=function(a){this.data.push(a),this.length++,this._up(this.length-1)},o.prototype.pop=function(){if(this.length!==0){var a=this.data[0],u=this.data.pop();return this.length--,this.length>0&&(this.data[0]=u,this._down(0)),a}},o.prototype.peek=function(){return this.data[0]},o.prototype._up=function(a){for(var u=this,c=u.data,h=u.compare,p=c[a];a>0;){var d=a-1>>1,g=c[d];if(h(p,g)>=0)break;c[a]=g,a=d}c[a]=p},o.prototype._down=function(a){for(var u=this,c=u.data,h=u.compare,p=this.length>>1,d=c[a];a<p;){var g=(a<<1)+1,v=c[g],x=g+1;if(x<this.length&&h(c[x],v)<0&&(g=x,v=c[x]),h(v,d)>=0)break;c[a]=v,a=g}c[a]=d};function e(r,a){return r<a?-1:r>a?1:0}return o})});var sp=ct((KS,op)=>{op.exports=function(e,r,a,u){var c=e[0],h=e[1],p=!1;a===void 0&&(a=0),u===void 0&&(u=r.length);for(var d=(u-a)/2,g=0,v=d-1;g<d;v=g++){var x=r[a+g*2+0],M=r[a+g*2+1],w=r[a+v*2+0],I=r[a+v*2+1],D=M>h!=I>h&&c<(w-x)*(h-M)/(I-M)+x;D&&(p=!p)}return p}});var up=ct((QS,ap)=>{ap.exports=function(e,r,a,u){var c=e[0],h=e[1],p=!1;a===void 0&&(a=0),u===void 0&&(u=r.length);for(var d=u-a,g=0,v=d-1;g<d;v=g++){var x=r[g+a][0],M=r[g+a][1],w=r[v+a][0],I=r[v+a][1],D=M>h!=I>h&&c<(w-x)*(h-M)/(I-M)+x;D&&(p=!p)}return p}});var hp=ct((jS,Za)=>{var lp=sp(),cp=up();Za.exports=function(e,r,a,u){return r.length>0&&Array.isArray(r[0])?cp(e,r,a,u):lp(e,r,a,u)};Za.exports.nested=cp;Za.exports.flat=lp});var pp=ct((Ja,fp)=>{(function(o,e){typeof Ja=="object"&&typeof fp!="undefined"?e(Ja):typeof define=="function"&&define.amd?define(["exports"],e):e((o=o||self).predicates={})})(Ja,function(o){"use strict";let r=33306690738754706e-32;function a(w,I,D,b,T){let L,P,z,k,Y=I[0],q=b[0],C=0,ot=0;q>Y==q>-Y?(L=Y,Y=I[++C]):(L=q,q=b[++ot]);let pt=0;if(C<w&&ot<D)for(q>Y==q>-Y?(z=L-((P=Y+L)-Y),Y=I[++C]):(z=L-((P=q+L)-q),q=b[++ot]),L=P,z!==0&&(T[pt++]=z);C<w&&ot<D;)q>Y==q>-Y?(z=L-((P=L+Y)-(k=P-L))+(Y-k),Y=I[++C]):(z=L-((P=L+q)-(k=P-L))+(q-k),q=b[++ot]),L=P,z!==0&&(T[pt++]=z);for(;C<w;)z=L-((P=L+Y)-(k=P-L))+(Y-k),Y=I[++C],L=P,z!==0&&(T[pt++]=z);for(;ot<D;)z=L-((P=L+q)-(k=P-L))+(q-k),q=b[++ot],L=P,z!==0&&(T[pt++]=z);return L===0&&pt!==0||(T[pt++]=L),pt}function u(w){return new Float64Array(w)}let c=33306690738754716e-32,h=22204460492503146e-32,p=11093356479670487e-47,d=u(4),g=u(8),v=u(12),x=u(16),M=u(4);o.orient2d=function(w,I,D,b,T,L){let P=(I-L)*(D-T),z=(w-T)*(b-L),k=P-z;if(P===0||z===0||P>0!=z>0)return k;let Y=Math.abs(P+z);return Math.abs(k)>=c*Y?k:-function(q,C,ot,pt,dt,F,ye){let et,St,Pt,Rt,it,mt,U,Nt,Mt,Re,ut,Ne,xn,qe,Ee,Le,at,Kn,oe=q-dt,Fn=ot-dt,Te=C-F,gn=pt-F;it=(Ee=(Nt=oe-(U=(mt=134217729*oe)-(mt-oe)))*(Re=gn-(Mt=(mt=134217729*gn)-(mt-gn)))-((qe=oe*gn)-U*Mt-Nt*Mt-U*Re))-(ut=Ee-(at=(Nt=Te-(U=(mt=134217729*Te)-(mt-Te)))*(Re=Fn-(Mt=(mt=134217729*Fn)-(mt-Fn)))-((Le=Te*Fn)-U*Mt-Nt*Mt-U*Re))),d[0]=Ee-(ut+it)+(it-at),it=(xn=qe-((Ne=qe+ut)-(it=Ne-qe))+(ut-it))-(ut=xn-Le),d[1]=xn-(ut+it)+(it-Le),it=(Kn=Ne+ut)-Ne,d[2]=Ne-(Kn-it)+(ut-it),d[3]=Kn;let Qe=function(ui,Pr){let $r=Pr[0];for(let Un=1;Un<ui;Un++)$r+=Pr[Un];return $r}(4,d),Cn=h*ye;if(Qe>=Cn||-Qe>=Cn||(et=q-(oe+(it=q-oe))+(it-dt),Pt=ot-(Fn+(it=ot-Fn))+(it-dt),St=C-(Te+(it=C-Te))+(it-F),Rt=pt-(gn+(it=pt-gn))+(it-F),et===0&&St===0&&Pt===0&&Rt===0)||(Cn=p*ye+r*Math.abs(Qe),(Qe+=oe*Rt+gn*et-(Te*Pt+Fn*St))>=Cn||-Qe>=Cn))return Qe;it=(Ee=(Nt=et-(U=(mt=134217729*et)-(mt-et)))*(Re=gn-(Mt=(mt=134217729*gn)-(mt-gn)))-((qe=et*gn)-U*Mt-Nt*Mt-U*Re))-(ut=Ee-(at=(Nt=St-(U=(mt=134217729*St)-(mt-St)))*(Re=Fn-(Mt=(mt=134217729*Fn)-(mt-Fn)))-((Le=St*Fn)-U*Mt-Nt*Mt-U*Re))),M[0]=Ee-(ut+it)+(it-at),it=(xn=qe-((Ne=qe+ut)-(it=Ne-qe))+(ut-it))-(ut=xn-Le),M[1]=xn-(ut+it)+(it-Le),it=(Kn=Ne+ut)-Ne,M[2]=Ne-(Kn-it)+(ut-it),M[3]=Kn;let ai=a(4,d,4,M,g);it=(Ee=(Nt=oe-(U=(mt=134217729*oe)-(mt-oe)))*(Re=Rt-(Mt=(mt=134217729*Rt)-(mt-Rt)))-((qe=oe*Rt)-U*Mt-Nt*Mt-U*Re))-(ut=Ee-(at=(Nt=Te-(U=(mt=134217729*Te)-(mt-Te)))*(Re=Pt-(Mt=(mt=134217729*Pt)-(mt-Pt)))-((Le=Te*Pt)-U*Mt-Nt*Mt-U*Re))),M[0]=Ee-(ut+it)+(it-at),it=(xn=qe-((Ne=qe+ut)-(it=Ne-qe))+(ut-it))-(ut=xn-Le),M[1]=xn-(ut+it)+(it-Le),it=(Kn=Ne+ut)-Ne,M[2]=Ne-(Kn-it)+(ut-it),M[3]=Kn;let _t=a(ai,g,4,M,v);it=(Ee=(Nt=et-(U=(mt=134217729*et)-(mt-et)))*(Re=Rt-(Mt=(mt=134217729*Rt)-(mt-Rt)))-((qe=et*Rt)-U*Mt-Nt*Mt-U*Re))-(ut=Ee-(at=(Nt=St-(U=(mt=134217729*St)-(mt-St)))*(Re=Pt-(Mt=(mt=134217729*Pt)-(mt-Pt)))-((Le=St*Pt)-U*Mt-Nt*Mt-U*Re))),M[0]=Ee-(ut+it)+(it-at),it=(xn=qe-((Ne=qe+ut)-(it=Ne-qe))+(ut-it))-(ut=xn-Le),M[1]=xn-(ut+it)+(it-Le),it=(Kn=Ne+ut)-Ne,M[2]=Ne-(Kn-it)+(ut-it),M[3]=Kn;let Ce=a(_t,v,4,M,x);return x[Ce-1]}(w,I,D,b,T,L,Y)},o.orient2dfast=function(w,I,D,b,T,L){return(I-L)*(D-T)-(w-T)*(b-L)},Object.defineProperty(o,"__esModule",{value:!0})})});var _p=ct((tb,tc)=>{"use strict";var dp=$l(),Qa=ip(),n1=hp(),r1=pp().orient2d;Qa.default&&(Qa=Qa.default);tc.exports=vp;tc.exports.default=vp;function vp(o,e,r){e=Math.max(0,e===void 0?2:e),r=r||0;var a=u1(o),u=new dp(16);u.toBBox=function(L){return{minX:L[0],minY:L[1],maxX:L[0],maxY:L[1]}},u.compareMinX=function(L,P){return L[0]-P[0]},u.compareMinY=function(L,P){return L[1]-P[1]},u.load(o);for(var c=[],h=0,p;h<a.length;h++){var d=a[h];u.remove(d),p=yp(d,p),c.push(p)}var g=new dp(16);for(h=0;h<c.length;h++)g.insert(Kl(c[h]));for(var v=e*e,x=r*r;c.length;){var M=c.shift(),w=M.p,I=M.next.p,D=Ql(w,I);if(!(D<x)){var b=D/v;d=i1(u,M.prev.p,w,I,M.next.next.p,b,g),d&&Math.min(Ql(d,w),Ql(d,I))<=b&&(c.push(M),c.push(yp(d,M)),u.remove(d),g.remove(M),g.insert(Kl(M)),g.insert(Kl(M.next)))}}M=p;var T=[];do T.push(M.p),M=M.next;while(M!==p);return T.push(M.p),T}function i1(o,e,r,a,u,c,h){for(var p=new Qa([],o1),d=o.data;d;){for(var g=0;g<d.children.length;g++){var v=d.children[g],x=d.leaf?jl(v,r,a):s1(r,a,v);x>c||p.push({node:v,dist:x})}for(;p.length&&!p.peek().node.children;){var M=p.pop(),w=M.node,I=jl(w,e,r),D=jl(w,a,u);if(M.dist<I&&M.dist<D&&gp(r,w,h)&&gp(a,w,h))return w}d=p.pop(),d&&(d=d.node)}return null}function o1(o,e){return o.dist-e.dist}function s1(o,e,r){if(mp(o,r)||mp(e,r))return 0;var a=Ka(o[0],o[1],e[0],e[1],r.minX,r.minY,r.maxX,r.minY);if(a===0)return 0;var u=Ka(o[0],o[1],e[0],e[1],r.minX,r.minY,r.minX,r.maxY);if(u===0)return 0;var c=Ka(o[0],o[1],e[0],e[1],r.maxX,r.minY,r.maxX,r.maxY);if(c===0)return 0;var h=Ka(o[0],o[1],e[0],e[1],r.minX,r.maxY,r.maxX,r.maxY);return h===0?0:Math.min(a,u,c,h)}function mp(o,e){return o[0]>=e.minX&&o[0]<=e.maxX&&o[1]>=e.minY&&o[1]<=e.maxY}function gp(o,e,r){for(var a=Math.min(o[0],e[0]),u=Math.min(o[1],e[1]),c=Math.max(o[0],e[0]),h=Math.max(o[1],e[1]),p=r.search({minX:a,minY:u,maxX:c,maxY:h}),d=0;d<p.length;d++)if(a1(p[d].p,p[d].next.p,o,e))return!1;return!0}function ds(o,e,r){return r1(o[0],o[1],e[0],e[1],r[0],r[1])}function a1(o,e,r,a){return o!==a&&e!==r&&ds(o,e,r)>0!=ds(o,e,a)>0&&ds(r,a,o)>0!=ds(r,a,e)>0}function Kl(o){var e=o.p,r=o.next.p;return o.minX=Math.min(e[0],r[0]),o.minY=Math.min(e[1],r[1]),o.maxX=Math.max(e[0],r[0]),o.maxY=Math.max(e[1],r[1]),o}function u1(o){for(var e=o[0],r=o[0],a=o[0],u=o[0],c=0;c<o.length;c++){var h=o[c];h[0]<e[0]&&(e=h),h[0]>a[0]&&(a=h),h[1]<r[1]&&(r=h),h[1]>u[1]&&(u=h)}var p=[e,r,a,u],d=p.slice();for(c=0;c<o.length;c++)n1(o[c],p)||d.push(o[c]);return c1(d)}function yp(o,e){var r={p:o,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function Ql(o,e){var r=o[0]-e[0],a=o[1]-e[1];return r*r+a*a}function jl(o,e,r){var a=e[0],u=e[1],c=r[0]-a,h=r[1]-u;if(c!==0||h!==0){var p=((o[0]-a)*c+(o[1]-u)*h)/(c*c+h*h);p>1?(a=r[0],u=r[1]):p>0&&(a+=c*p,u+=h*p)}return c=o[0]-a,h=o[1]-u,c*c+h*h}function Ka(o,e,r,a,u,c,h,p){var d=r-o,g=a-e,v=h-u,x=p-c,M=o-u,w=e-c,I=d*d+g*g,D=d*v+g*x,b=v*v+x*x,T=d*M+g*w,L=v*M+x*w,P=I*b-D*D,z,k,Y,q,C=P,ot=P;P===0?(k=0,C=1,q=L,ot=b):(k=D*L-b*T,q=I*L-D*T,k<0?(k=0,q=L,ot=b):k>C&&(k=C,q=L+D,ot=b)),q<0?(q=0,-T<0?k=0:-T>I?k=C:(k=-T,C=I)):q>ot&&(q=ot,-T+D<0?k=0:-T+D>I?k=C:(k=-T+D,C=I)),z=k===0?0:k/C,Y=q===0?0:q/ot;var pt=(1-z)*o+z*r,dt=(1-z)*e+z*a,F=(1-Y)*u+Y*h,ye=(1-Y)*c+Y*p,et=F-pt,St=ye-dt;return et*et+St*St}function l1(o,e){return o[0]===e[0]?o[1]-e[1]:o[0]-e[0]}function c1(o){o.sort(l1);for(var e=[],r=0;r<o.length;r++){for(;e.length>=2&&ds(e[e.length-2],e[e.length-1],o[r])<=0;)e.pop();e.push(o[r])}for(var a=[],u=o.length-1;u>=0;u--){for(;a.length>=2&&ds(a[a.length-2],a[a.length-1],o[u])<=0;)a.pop();a.push(o[u])}return a.pop(),e.pop(),e.concat(a)}});var bp=ct((nc,rc)=>{(function(o,e){typeof nc=="object"&&typeof rc!="undefined"?rc.exports=e():typeof define=="function"&&define.amd?define(e):o.quickselect=e()})(nc,function(){"use strict";function o(u,c,h,p,d){e(u,c,h||0,p||u.length-1,d||a)}function e(u,c,h,p,d){for(;p>h;){if(p-h>600){var g=p-h+1,v=c-h+1,x=Math.log(g),M=.5*Math.exp(2*x/3),w=.5*Math.sqrt(x*M*(g-M)/g)*(v-g/2<0?-1:1),I=Math.max(h,Math.floor(c-v*M/g+w)),D=Math.min(p,Math.floor(c+(g-v)*M/g+w));e(u,c,I,D,d)}var b=u[c],T=h,L=p;for(r(u,h,c),d(u[p],b)>0&&r(u,h,p);T<L;){for(r(u,T,L),T++,L--;d(u[T],b)<0;)T++;for(;d(u[L],b)>0;)L--}d(u[h],b)===0?r(u,h,L):(L++,r(u,L,p)),L<=c&&(h=L+1),c<=L&&(p=L-1)}}function r(u,c,h){var p=u[c];u[c]=u[h],u[h]=p}function a(u,c){return u<c?-1:u>c?1:0}return o})});var ac=ct((AT,sc)=>{"use strict";sc.exports=sa;sc.exports.default=sa;var w1=bp();function sa(o,e){if(!(this instanceof sa))return new sa(o,e);this._maxEntries=Math.max(4,o||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),e&&this._initFormat(e),this.clear()}sa.prototype={all:function(){return this._all(this.data,[])},search:function(o){var e=this.data,r=[],a=this.toBBox;if(!tu(o,e))return r;for(var u=[],c,h,p,d;e;){for(c=0,h=e.children.length;c<h;c++)p=e.children[c],d=e.leaf?a(p):p,tu(o,d)&&(e.leaf?r.push(p):oc(o,d)?this._all(p,r):u.push(p));e=u.pop()}return r},collides:function(o){var e=this.data,r=this.toBBox;if(!tu(o,e))return!1;for(var a=[],u,c,h,p;e;){for(u=0,c=e.children.length;u<c;u++)if(h=e.children[u],p=e.leaf?r(h):h,tu(o,p)){if(e.leaf||oc(o,p))return!0;a.push(h)}e=a.pop()}return!1},load:function(o){if(!(o&&o.length))return this;if(o.length<this._minEntries){for(var e=0,r=o.length;e<r;e++)this.insert(o[e]);return this}var a=this._build(o.slice(),0,o.length-1,0);if(!this.data.children.length)this.data=a;else if(this.data.height===a.height)this._splitRoot(this.data,a);else{if(this.data.height<a.height){var u=this.data;this.data=a,a=u}this._insert(a,this.data.height-a.height-1,!0)}return this},insert:function(o){return o&&this._insert(o,this.data.height-1),this},clear:function(){return this.data=ys([]),this},remove:function(o,e){if(!o)return this;for(var r=this.data,a=this.toBBox(o),u=[],c=[],h,p,d,g;r||u.length;){if(r||(r=u.pop(),p=u[u.length-1],h=c.pop(),g=!0),r.leaf&&(d=S1(o,r.children,e),d!==-1))return r.children.splice(d,1),u.push(r),this._condense(u),this;!g&&!r.leaf&&oc(r,a)?(u.push(r),c.push(h),h=0,p=r,r=r.children[0]):p?(h++,r=p.children[h],g=!1):r=null}return this},toBBox:function(o){return o},compareMinX:Ap,compareMinY:Tp,toJSON:function(){return this.data},fromJSON:function(o){return this.data=o,this},_all:function(o,e){for(var r=[];o;)o.leaf?e.push.apply(e,o.children):r.push.apply(r,o.children),o=r.pop();return e},_build:function(o,e,r,a){var u=r-e+1,c=this._maxEntries,h;if(u<=c)return h=ys(o.slice(e,r+1)),gs(h,this.toBBox),h;a||(a=Math.ceil(Math.log(u)/Math.log(c)),c=Math.ceil(u/Math.pow(c,a-1))),h=ys([]),h.leaf=!1,h.height=a;var p=Math.ceil(u/c),d=p*Math.ceil(Math.sqrt(c)),g,v,x,M;for(Cp(o,e,r,d,this.compareMinX),g=e;g<=r;g+=d)for(x=Math.min(g+d-1,r),Cp(o,g,x,p,this.compareMinY),v=g;v<=x;v+=p)M=Math.min(v+p-1,x),h.children.push(this._build(o,v,M,a-1));return gs(h,this.toBBox),h},_chooseSubtree:function(o,e,r,a){for(var u,c,h,p,d,g,v,x;a.push(e),!(e.leaf||a.length-1===r);){for(v=x=1/0,u=0,c=e.children.length;u<c;u++)h=e.children[u],d=ic(h),g=b1(o,h)-d,g<x?(x=g,v=d<v?d:v,p=h):g===x&&d<v&&(v=d,p=h);e=p||e.children[0]}return e},_insert:function(o,e,r){var a=this.toBBox,u=r?o:a(o),c=[],h=this._chooseSubtree(u,this.data,e,c);for(h.children.push(o),oa(h,u);e>=0&&c[e].children.length>this._maxEntries;)this._split(c,e),e--;this._adjustParentBBoxes(u,c,e)},_split:function(o,e){var r=o[e],a=r.children.length,u=this._minEntries;this._chooseSplitAxis(r,u,a);var c=this._chooseSplitIndex(r,u,a),h=ys(r.children.splice(c,r.children.length-c));h.height=r.height,h.leaf=r.leaf,gs(r,this.toBBox),gs(h,this.toBBox),e?o[e-1].children.push(h):this._splitRoot(r,h)},_splitRoot:function(o,e){this.data=ys([o,e]),this.data.height=o.height+1,this.data.leaf=!1,gs(this.data,this.toBBox)},_chooseSplitIndex:function(o,e,r){var a,u,c,h,p,d,g,v;for(d=g=1/0,a=e;a<=r-e;a++)u=ia(o,0,a,this.toBBox),c=ia(o,a,r,this.toBBox),h=A1(u,c),p=ic(u)+ic(c),h<d?(d=h,v=a,g=p<g?p:g):h===d&&p<g&&(g=p,v=a);return v},_chooseSplitAxis:function(o,e,r){var a=o.leaf?this.compareMinX:Ap,u=o.leaf?this.compareMinY:Tp,c=this._allDistMargin(o,e,r,a),h=this._allDistMargin(o,e,r,u);c<h&&o.children.sort(a)},_allDistMargin:function(o,e,r,a){o.children.sort(a);var u=this.toBBox,c=ia(o,0,e,u),h=ia(o,r-e,r,u),p=ja(c)+ja(h),d,g;for(d=e;d<r-e;d++)g=o.children[d],oa(c,o.leaf?u(g):g),p+=ja(c);for(d=r-e-1;d>=e;d--)g=o.children[d],oa(h,o.leaf?u(g):g),p+=ja(h);return p},_adjustParentBBoxes:function(o,e,r){for(var a=r;a>=0;a--)oa(e[a],o)},_condense:function(o){for(var e=o.length-1,r;e>=0;e--)o[e].children.length===0?e>0?(r=o[e-1].children,r.splice(r.indexOf(o[e]),1)):this.clear():gs(o[e],this.toBBox)},_initFormat:function(o){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(o[0])),this.compareMinY=new Function("a","b",e.join(o[1])),this.toBBox=new Function("a","return {minX: a"+o[0]+", minY: a"+o[1]+", maxX: a"+o[2]+", maxY: a"+o[3]+"};")}};function S1(o,e,r){if(!r)return e.indexOf(o);for(var a=0;a<e.length;a++)if(r(o,e[a]))return a;return-1}function gs(o,e){ia(o,0,o.children.length,e,o)}function ia(o,e,r,a,u){u||(u=ys(null)),u.minX=1/0,u.minY=1/0,u.maxX=-1/0,u.maxY=-1/0;for(var c=e,h;c<r;c++)h=o.children[c],oa(u,o.leaf?a(h):h);return u}function oa(o,e){return o.minX=Math.min(o.minX,e.minX),o.minY=Math.min(o.minY,e.minY),o.maxX=Math.max(o.maxX,e.maxX),o.maxY=Math.max(o.maxY,e.maxY),o}function Ap(o,e){return o.minX-e.minX}function Tp(o,e){return o.minY-e.minY}function ic(o){return(o.maxX-o.minX)*(o.maxY-o.minY)}function ja(o){return o.maxX-o.minX+(o.maxY-o.minY)}function b1(o,e){return(Math.max(e.maxX,o.maxX)-Math.min(e.minX,o.minX))*(Math.max(e.maxY,o.maxY)-Math.min(e.minY,o.minY))}function A1(o,e){var r=Math.max(o.minX,e.minX),a=Math.max(o.minY,e.minY),u=Math.min(o.maxX,e.maxX),c=Math.min(o.maxY,e.maxY);return Math.max(0,u-r)*Math.max(0,c-a)}function oc(o,e){return o.minX<=e.minX&&o.minY<=e.minY&&e.maxX<=o.maxX&&e.maxY<=o.maxY}function tu(o,e){return e.minX<=o.maxX&&e.minY<=o.maxY&&e.maxX>=o.minX&&e.maxY>=o.minY}function ys(o){return{children:o,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Cp(o,e,r,a,u){for(var c=[e,r],h;c.length;)r=c.pop(),e=c.pop(),!(r-e<=a)&&(h=e+Math.ceil((r-e)/a/2)*a,w1(o,h,e,r,u),c.push(e,h,h,r))}});var Dp=ct((zC,pc)=>{"use strict";pc.exports=iu;pc.exports.default=iu;function iu(o,e,r){r=r||2;var a=e&&e.length,u=a?e[0]*r:o.length,c=Rp(o,0,u,r,!0),h=[];if(!c||c.next===c.prev)return h;var p,d,g,v,x,M,w;if(a&&(c=F1(o,e,c,r)),o.length>80*r){p=g=o[0],d=v=o[1];for(var I=r;I<u;I+=r)x=o[I],M=o[I+1],x<p&&(p=x),M<d&&(d=M),x>g&&(g=x),M>v&&(v=M);w=Math.max(g-p,v-d),w=w!==0?32767/w:0}return la(c,h,r,p,d,w,0),h}function Rp(o,e,r,a,u){var c,h;if(u===fc(o,e,r,a)>0)for(c=e;c<r;c+=a)h=Pp(c,o[c],o[c+1],h);else for(c=r-a;c>=e;c-=a)h=Pp(c,o[c],o[c+1],h);return h&&ou(h,h.next)&&(ha(h),h=h.next),h}function zo(o,e){if(!o)return o;e||(e=o);var r=o,a;do if(a=!1,!r.steiner&&(ou(r,r.next)||fn(r.prev,r,r.next)===0)){if(ha(r),r=e=r.prev,r===r.next)break;a=!0}else r=r.next;while(a||r!==e);return e}function la(o,e,r,a,u,c,h){if(o){!h&&c&&G1(o,a,u,c);for(var p=o,d,g;o.prev!==o.next;){if(d=o.prev,g=o.next,c?L1(o,a,u,c):N1(o)){e.push(d.i/r|0),e.push(o.i/r|0),e.push(g.i/r|0),ha(o),o=g.next,p=g.next;continue}if(o=g,o===p){h?h===1?(o=D1(zo(o),e,r),la(o,e,r,a,u,c,2)):h===2&&O1(o,e,r,a,u,c):la(zo(o),e,r,a,u,c,1);break}}}}function N1(o){var e=o.prev,r=o,a=o.next;if(fn(e,r,a)>=0)return!1;for(var u=e.x,c=r.x,h=a.x,p=e.y,d=r.y,g=a.y,v=u<c?u<h?u:h:c<h?c:h,x=p<d?p<g?p:g:d<g?d:g,M=u>c?u>h?u:h:c>h?c:h,w=p>d?p>g?p:g:d>g?d:g,I=a.next;I!==e;){if(I.x>=v&&I.x<=M&&I.y>=x&&I.y<=w&&xs(u,p,c,d,h,g,I.x,I.y)&&fn(I.prev,I,I.next)>=0)return!1;I=I.next}return!0}function L1(o,e,r,a){var u=o.prev,c=o,h=o.next;if(fn(u,c,h)>=0)return!1;for(var p=u.x,d=c.x,g=h.x,v=u.y,x=c.y,M=h.y,w=p<d?p<g?p:g:d<g?d:g,I=v<x?v<M?v:M:x<M?x:M,D=p>d?p>g?p:g:d>g?d:g,b=v>x?v>M?v:M:x>M?x:M,T=cc(w,I,e,r,a),L=cc(D,b,e,r,a),P=o.prevZ,z=o.nextZ;P&&P.z>=T&&z&&z.z<=L;){if(P.x>=w&&P.x<=D&&P.y>=I&&P.y<=b&&P!==u&&P!==h&&xs(p,v,d,x,g,M,P.x,P.y)&&fn(P.prev,P,P.next)>=0||(P=P.prevZ,z.x>=w&&z.x<=D&&z.y>=I&&z.y<=b&&z!==u&&z!==h&&xs(p,v,d,x,g,M,z.x,z.y)&&fn(z.prev,z,z.next)>=0))return!1;z=z.nextZ}for(;P&&P.z>=T;){if(P.x>=w&&P.x<=D&&P.y>=I&&P.y<=b&&P!==u&&P!==h&&xs(p,v,d,x,g,M,P.x,P.y)&&fn(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;z&&z.z<=L;){if(z.x>=w&&z.x<=D&&z.y>=I&&z.y<=b&&z!==u&&z!==h&&xs(p,v,d,x,g,M,z.x,z.y)&&fn(z.prev,z,z.next)>=0)return!1;z=z.nextZ}return!0}function D1(o,e,r){var a=o;do{var u=a.prev,c=a.next.next;!ou(u,c)&&Np(u,a,a.next,c)&&ca(u,c)&&ca(c,u)&&(e.push(u.i/r|0),e.push(a.i/r|0),e.push(c.i/r|0),ha(a),ha(a.next),a=o=c),a=a.next}while(a!==o);return zo(a)}function O1(o,e,r,a,u,c){var h=o;do{for(var p=h.next.next;p!==h.prev;){if(h.i!==p.i&&q1(h,p)){var d=Lp(h,p);h=zo(h,h.next),d=zo(d,d.next),la(h,e,r,a,u,c,0),la(d,e,r,a,u,c,0);return}p=p.next}h=h.next}while(h!==o)}function F1(o,e,r,a){var u=[],c,h,p,d,g;for(c=0,h=e.length;c<h;c++)p=e[c]*a,d=c<h-1?e[c+1]*a:o.length,g=Rp(o,p,d,a,!1),g===g.next&&(g.steiner=!0),u.push(H1(g));for(u.sort(U1),c=0;c<u.length;c++)r=B1(u[c],r);return r}function U1(o,e){return o.x-e.x}function B1(o,e){var r=z1(o,e);if(!r)return e;var a=Lp(r,o);return zo(a,a.next),zo(r,r.next)}function z1(o,e){var r=e,a=o.x,u=o.y,c=-1/0,h;do{if(u<=r.y&&u>=r.next.y&&r.next.y!==r.y){var p=r.x+(u-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(p<=a&&p>c&&(c=p,h=r.x<r.next.x?r:r.next,p===a))return h}r=r.next}while(r!==e);if(!h)return null;var d=h,g=h.x,v=h.y,x=1/0,M;r=h;do a>=r.x&&r.x>=g&&a!==r.x&&xs(u<v?a:c,u,g,v,u<v?c:a,u,r.x,r.y)&&(M=Math.abs(u-r.y)/(a-r.x),ca(r,o)&&(M<x||M===x&&(r.x>h.x||r.x===h.x&&k1(h,r)))&&(h=r,x=M)),r=r.next;while(r!==d);return h}function k1(o,e){return fn(o.prev,o,e.prev)<0&&fn(e.next,o,o.next)<0}function G1(o,e,r,a){var u=o;do u.z===0&&(u.z=cc(u.x,u.y,e,r,a)),u.prevZ=u.prev,u.nextZ=u.next,u=u.next;while(u!==o);u.prevZ.nextZ=null,u.prevZ=null,V1(u)}function V1(o){var e,r,a,u,c,h,p,d,g=1;do{for(r=o,o=null,c=null,h=0;r;){for(h++,a=r,p=0,e=0;e<g&&(p++,a=a.nextZ,!!a);e++);for(d=g;p>0||d>0&&a;)p!==0&&(d===0||!a||r.z<=a.z)?(u=r,r=r.nextZ,p--):(u=a,a=a.nextZ,d--),c?c.nextZ=u:o=u,u.prevZ=c,c=u;r=a}c.nextZ=null,g*=2}while(h>1);return o}function cc(o,e,r,a,u){return o=(o-r)*u|0,e=(e-a)*u|0,o=(o|o<<8)&16711935,o=(o|o<<4)&252645135,o=(o|o<<2)&858993459,o=(o|o<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,o|e<<1}function H1(o){var e=o,r=o;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==o);return r}function xs(o,e,r,a,u,c,h,p){return(u-h)*(e-p)>=(o-h)*(c-p)&&(o-h)*(a-p)>=(r-h)*(e-p)&&(r-h)*(c-p)>=(u-h)*(a-p)}function q1(o,e){return o.next.i!==e.i&&o.prev.i!==e.i&&!W1(o,e)&&(ca(o,e)&&ca(e,o)&&X1(o,e)&&(fn(o.prev,o,e.prev)||fn(o,e.prev,e))||ou(o,e)&&fn(o.prev,o,o.next)>0&&fn(e.prev,e,e.next)>0)}function fn(o,e,r){return(e.y-o.y)*(r.x-e.x)-(e.x-o.x)*(r.y-e.y)}function ou(o,e){return o.x===e.x&&o.y===e.y}function Np(o,e,r,a){var u=ru(fn(o,e,r)),c=ru(fn(o,e,a)),h=ru(fn(r,a,o)),p=ru(fn(r,a,e));return!!(u!==c&&h!==p||u===0&&nu(o,r,e)||c===0&&nu(o,a,e)||h===0&&nu(r,o,a)||p===0&&nu(r,e,a))}function nu(o,e,r){return e.x<=Math.max(o.x,r.x)&&e.x>=Math.min(o.x,r.x)&&e.y<=Math.max(o.y,r.y)&&e.y>=Math.min(o.y,r.y)}function ru(o){return o>0?1:o<0?-1:0}function W1(o,e){var r=o;do{if(r.i!==o.i&&r.next.i!==o.i&&r.i!==e.i&&r.next.i!==e.i&&Np(r,r.next,o,e))return!0;r=r.next}while(r!==o);return!1}function ca(o,e){return fn(o.prev,o,o.next)<0?fn(o,e,o.next)>=0&&fn(o,o.prev,e)>=0:fn(o,e,o.prev)<0||fn(o,o.next,e)<0}function X1(o,e){var r=o,a=!1,u=(o.x+e.x)/2,c=(o.y+e.y)/2;do r.y>c!=r.next.y>c&&r.next.y!==r.y&&u<(r.next.x-r.x)*(c-r.y)/(r.next.y-r.y)+r.x&&(a=!a),r=r.next;while(r!==o);return a}function Lp(o,e){var r=new hc(o.i,o.x,o.y),a=new hc(e.i,e.x,e.y),u=o.next,c=e.prev;return o.next=e,e.prev=o,r.next=u,u.prev=r,a.next=r,r.prev=a,c.next=a,a.prev=c,a}function Pp(o,e,r,a){var u=new hc(o,e,r);return a?(u.next=a.next,u.prev=a,a.next.prev=u,a.next=u):(u.prev=u,u.next=u),u}function ha(o){o.next.prev=o.prev,o.prev.next=o.next,o.prevZ&&(o.prevZ.nextZ=o.nextZ),o.nextZ&&(o.nextZ.prevZ=o.prevZ)}function hc(o,e,r){this.i=o,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}iu.deviation=function(o,e,r,a){var u=e&&e.length,c=u?e[0]*r:o.length,h=Math.abs(fc(o,0,c,r));if(u)for(var p=0,d=e.length;p<d;p++){var g=e[p]*r,v=p<d-1?e[p+1]*r:o.length;h-=Math.abs(fc(o,g,v,r))}var x=0;for(p=0;p<a.length;p+=3){var M=a[p]*r,w=a[p+1]*r,I=a[p+2]*r;x+=Math.abs((o[M]-o[I])*(o[w+1]-o[M+1])-(o[M]-o[w])*(o[I+1]-o[M+1]))}return h===0&&x===0?0:Math.abs((x-h)/h)};function fc(o,e,r,a){for(var u=0,c=e,h=r-a;c<r;c+=a)u+=(o[h]-o[c])*(o[c+1]+o[h+1]),h=c;return u}iu.flatten=function(o){for(var e=o[0][0].length,r={vertices:[],holes:[],dimensions:e},a=0,u=0;u<o.length;u++){for(var c=0;c<o[u].length;c++)for(var h=0;h<e;h++)r.vertices.push(o[u][c][h]);u>0&&(a+=o[u-1].length,r.holes.push(a))}return r}});var vc=ct(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.earthRadius=63710088e-1;Et.factors={centimeters:Et.earthRadius*100,centimetres:Et.earthRadius*100,degrees:Et.earthRadius/111325,feet:Et.earthRadius*3.28084,inches:Et.earthRadius*39.37,kilometers:Et.earthRadius/1e3,kilometres:Et.earthRadius/1e3,meters:Et.earthRadius,metres:Et.earthRadius,miles:Et.earthRadius/1609.344,millimeters:Et.earthRadius*1e3,millimetres:Et.earthRadius*1e3,nauticalmiles:Et.earthRadius/1852,radians:1,yards:Et.earthRadius*1.0936};Et.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/Et.earthRadius,yards:1.0936133};Et.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 vo(o,e,r){r===void 0&&(r={});var a={type:"Feature"};return(r.id===0||r.id)&&(a.id=r.id),r.bbox&&(a.bbox=r.bbox),a.properties=e||{},a.geometry=o,a}Et.feature=vo;function $1(o,e,r){switch(r===void 0&&(r={}),o){case"Point":return dc(e).geometry;case"LineString":return gc(e).geometry;case"Polygon":return mc(e).geometry;case"MultiPoint":return Fp(e).geometry;case"MultiLineString":return Op(e).geometry;case"MultiPolygon":return Up(e).geometry;default:throw new Error(o+" is invalid")}}Et.geometry=$1;function dc(o,e,r){if(r===void 0&&(r={}),!o)throw new Error("coordinates is required");if(!Array.isArray(o))throw new Error("coordinates must be an Array");if(o.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!su(o[0])||!su(o[1]))throw new Error("coordinates must contain numbers");var a={type:"Point",coordinates:o};return vo(a,e,r)}Et.point=dc;function Z1(o,e,r){return r===void 0&&(r={}),au(o.map(function(a){return dc(a,e)}),r)}Et.points=Z1;function mc(o,e,r){r===void 0&&(r={});for(var a=0,u=o;a<u.length;a++){var c=u[a];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<c[c.length-1].length;h++)if(c[c.length-1][h]!==c[0][h])throw new Error("First and last Position are not equivalent.")}var p={type:"Polygon",coordinates:o};return vo(p,e,r)}Et.polygon=mc;function J1(o,e,r){return r===void 0&&(r={}),au(o.map(function(a){return mc(a,e)}),r)}Et.polygons=J1;function gc(o,e,r){if(r===void 0&&(r={}),o.length<2)throw new Error("coordinates must be an array of two or more positions");var a={type:"LineString",coordinates:o};return vo(a,e,r)}Et.lineString=gc;function K1(o,e,r){return r===void 0&&(r={}),au(o.map(function(a){return gc(a,e)}),r)}Et.lineStrings=K1;function au(o,e){e===void 0&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=o,r}Et.featureCollection=au;function Op(o,e,r){r===void 0&&(r={});var a={type:"MultiLineString",coordinates:o};return vo(a,e,r)}Et.multiLineString=Op;function Fp(o,e,r){r===void 0&&(r={});var a={type:"MultiPoint",coordinates:o};return vo(a,e,r)}Et.multiPoint=Fp;function Up(o,e,r){r===void 0&&(r={});var a={type:"MultiPolygon",coordinates:o};return vo(a,e,r)}Et.multiPolygon=Up;function Q1(o,e,r){r===void 0&&(r={});var a={type:"GeometryCollection",geometries:o};return vo(a,e,r)}Et.geometryCollection=Q1;function j1(o,e){if(e===void 0&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(o*r)/r}Et.round=j1;function Bp(o,e){e===void 0&&(e="kilometers");var r=Et.factors[e];if(!r)throw new Error(e+" units is invalid");return o*r}Et.radiansToLength=Bp;function yc(o,e){e===void 0&&(e="kilometers");var r=Et.factors[e];if(!r)throw new Error(e+" units is invalid");return o/r}Et.lengthToRadians=yc;function tx(o,e){return zp(yc(o,e))}Et.lengthToDegrees=tx;function ex(o){var e=o%360;return e<0&&(e+=360),e}Et.bearingToAzimuth=ex;function zp(o){var e=o%(2*Math.PI);return e*180/Math.PI}Et.radiansToDegrees=zp;function nx(o){var e=o%360;return e*Math.PI/180}Et.degreesToRadians=nx;function rx(o,e,r){if(e===void 0&&(e="kilometers"),r===void 0&&(r="kilometers"),!(o>=0))throw new Error("length must be a positive number");return Bp(yc(o,e),r)}Et.convertLength=rx;function ix(o,e,r){if(e===void 0&&(e="meters"),r===void 0&&(r="kilometers"),!(o>=0))throw new Error("area must be a positive number");var a=Et.areaFactors[e];if(!a)throw new Error("invalid original units");var u=Et.areaFactors[r];if(!u)throw new Error("invalid final units");return o/a*u}Et.convertArea=ix;function su(o){return!isNaN(o)&&o!==null&&!Array.isArray(o)}Et.isNumber=su;function ox(o){return!!o&&o.constructor===Object}Et.isObject=ox;function sx(o){if(!o)throw new Error("bbox is required");if(!Array.isArray(o))throw new Error("bbox must be an Array");if(o.length!==4&&o.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");o.forEach(function(e){if(!su(e))throw new Error("bbox must only contain numbers")})}Et.validateBBox=sx;function ax(o){if(!o)throw new Error("id is required");if(["string","number"].indexOf(typeof o)===-1)throw new Error("id must be a number or a string")}Et.validateId=ax});var xc=ct(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});var vr=vc();function fa(o,e,r){if(o!==null)for(var a,u,c,h,p,d,g,v=0,x=0,M,w=o.type,I=w==="FeatureCollection",D=w==="Feature",b=I?o.features.length:1,T=0;T<b;T++){g=I?o.features[T].geometry:D?o.geometry:o,M=g?g.type==="GeometryCollection":!1,p=M?g.geometries.length:1;for(var L=0;L<p;L++){var P=0,z=0;if(h=M?g.geometries[L]:g,h!==null){d=h.coordinates;var k=h.type;switch(v=r&&(k==="Polygon"||k==="MultiPolygon")?1:0,k){case null:break;case"Point":if(e(d,x,T,P,z)===!1)return!1;x++,P++;break;case"LineString":case"MultiPoint":for(a=0;a<d.length;a++){if(e(d[a],x,T,P,z)===!1)return!1;x++,k==="MultiPoint"&&P++}k==="LineString"&&P++;break;case"Polygon":case"MultiLineString":for(a=0;a<d.length;a++){for(u=0;u<d[a].length-v;u++){if(e(d[a][u],x,T,P,z)===!1)return!1;x++}k==="MultiLineString"&&P++,k==="Polygon"&&z++}k==="Polygon"&&P++;break;case"MultiPolygon":for(a=0;a<d.length;a++){for(z=0,u=0;u<d[a].length;u++){for(c=0;c<d[a][u].length-v;c++){if(e(d[a][u][c],x,T,P,z)===!1)return!1;x++}z++}P++}break;case"GeometryCollection":for(a=0;a<h.geometries.length;a++)if(fa(h.geometries[a],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ux(o,e,r,a){var u=r;return fa(o,function(c,h,p,d,g){h===0&&r===void 0?u=c:u=e(u,c,h,p,d,g)},a),u}function kp(o,e){var r;switch(o.type){case"FeatureCollection":for(r=0;r<o.features.length&&e(o.features[r].properties,r)!==!1;r++);break;case"Feature":e(o.properties,0);break}}function lx(o,e,r){var a=r;return kp(o,function(u,c){c===0&&r===void 0?a=u:a=e(a,u,c)}),a}function Gp(o,e){if(o.type==="Feature")e(o,0);else if(o.type==="FeatureCollection")for(var r=0;r<o.features.length&&e(o.features[r],r)!==!1;r++);}function cx(o,e,r){var a=r;return Gp(o,function(u,c){c===0&&r===void 0?a=u:a=e(a,u,c)}),a}function hx(o){var e=[];return fa(o,function(r){e.push(r)}),e}function _c(o,e){var r,a,u,c,h,p,d,g,v,x,M=0,w=o.type==="FeatureCollection",I=o.type==="Feature",D=w?o.features.length:1;for(r=0;r<D;r++){for(p=w?o.features[r].geometry:I?o.geometry:o,g=w?o.features[r].properties:I?o.properties:{},v=w?o.features[r].bbox:I?o.bbox:void 0,x=w?o.features[r].id:I?o.id:void 0,d=p?p.type==="GeometryCollection":!1,h=d?p.geometries.length:1,u=0;u<h;u++){if(c=d?p.geometries[u]:p,c===null){if(e(null,M,g,v,x)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(c,M,g,v,x)===!1)return!1;break}case"GeometryCollection":{for(a=0;a<c.geometries.length;a++)if(e(c.geometries[a],M,g,v,x)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}M++}}function fx(o,e,r){var a=r;return _c(o,function(u,c,h,p,d){c===0&&r===void 0?a=u:a=e(a,u,c,h,p,d)}),a}function uu(o,e){_c(o,function(r,a,u,c,h){var p=r===null?null:r.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return e(vr.feature(r,u,{bbox:c,id:h}),a,0)===!1?!1:void 0}var d;switch(p){case"MultiPoint":d="Point";break;case"MultiLineString":d="LineString";break;case"MultiPolygon":d="Polygon";break}for(var g=0;g<r.coordinates.length;g++){var v=r.coordinates[g],x={type:d,coordinates:v};if(e(vr.feature(x,u),a,g)===!1)return!1}})}function px(o,e,r){var a=r;return uu(o,function(u,c,h){c===0&&h===0&&r===void 0?a=u:a=e(a,u,c,h)}),a}function Vp(o,e){uu(o,function(r,a,u){var c=0;if(r.geometry){var h=r.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var p,d=0,g=0,v=0;if(fa(r,function(x,M,w,I,D){if(p===void 0||a>d||I>g||D>v){p=x,d=a,g=I,v=D,c=0;return}var b=vr.lineString([p,x],r.properties);if(e(b,a,u,D,c)===!1)return!1;c++,p=x})===!1)return!1}}})}function dx(o,e,r){var a=r,u=!1;return Vp(o,function(c,h,p,d,g){u===!1&&r===void 0?a=c:a=e(a,c,h,p,d,g),u=!0}),a}function Hp(o,e){if(!o)throw new Error("geojson is required");uu(o,function(r,a,u){if(r.geometry!==null){var c=r.geometry.type,h=r.geometry.coordinates;switch(c){case"LineString":if(e(r,a,u,0,0)===!1)return!1;break;case"Polygon":for(var p=0;p<h.length;p++)if(e(vr.lineString(h[p],r.properties),a,u,p)===!1)return!1;break}}})}function mx(o,e,r){var a=r;return Hp(o,function(u,c,h,p){c===0&&r===void 0?a=u:a=e(a,u,c,h,p)}),a}function gx(o,e){if(e=e||{},!vr.isObject(e))throw new Error("options is invalid");var r=e.featureIndex||0,a=e.multiFeatureIndex||0,u=e.geometryIndex||0,c=e.segmentIndex||0,h=e.properties,p;switch(o.type){case"FeatureCollection":r<0&&(r=o.features.length+r),h=h||o.features[r].properties,p=o.features[r].geometry;break;case"Feature":h=h||o.properties,p=o.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=o;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var d=p.coordinates;switch(p.type){case"Point":case"MultiPoint":return null;case"LineString":return c<0&&(c=d.length+c-1),vr.lineString([d[c],d[c+1]],h,e);case"Polygon":return u<0&&(u=d.length+u),c<0&&(c=d[u].length+c-1),vr.lineString([d[u][c],d[u][c+1]],h,e);case"MultiLineString":return a<0&&(a=d.length+a),c<0&&(c=d[a].length+c-1),vr.lineString([d[a][c],d[a][c+1]],h,e);case"MultiPolygon":return a<0&&(a=d.length+a),u<0&&(u=d[a].length+u),c<0&&(c=d[a][u].length-c-1),vr.lineString([d[a][u][c],d[a][u][c+1]],h,e)}throw new Error("geojson is invalid")}function yx(o,e){if(e=e||{},!vr.isObject(e))throw new Error("options is invalid");var r=e.featureIndex||0,a=e.multiFeatureIndex||0,u=e.geometryIndex||0,c=e.coordIndex||0,h=e.properties,p;switch(o.type){case"FeatureCollection":r<0&&(r=o.features.length+r),h=h||o.features[r].properties,p=o.features[r].geometry;break;case"Feature":h=h||o.properties,p=o.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=o;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var d=p.coordinates;switch(p.type){case"Point":return vr.point(d,h,e);case"MultiPoint":return a<0&&(a=d.length+a),vr.point(d[a],h,e);case"LineString":return c<0&&(c=d.length+c),vr.point(d[c],h,e);case"Polygon":return u<0&&(u=d.length+u),c<0&&(c=d[u].length+c),vr.point(d[u][c],h,e);case"MultiLineString":return a<0&&(a=d.length+a),c<0&&(c=d[a].length+c),vr.point(d[a][c],h,e);case"MultiPolygon":return a<0&&(a=d.length+a),u<0&&(u=d[a].length+u),c<0&&(c=d[a][u].length-c),vr.point(d[a][u][c],h,e)}throw new Error("geojson is invalid")}Dn.coordAll=hx;Dn.coordEach=fa;Dn.coordReduce=ux;Dn.featureEach=Gp;Dn.featureReduce=cx;Dn.findPoint=yx;Dn.findSegment=gx;Dn.flattenEach=uu;Dn.flattenReduce=px;Dn.geomEach=_c;Dn.geomReduce=fx;Dn.lineEach=Hp;Dn.lineReduce=mx;Dn.propEach=kp;Dn.propReduce=lx;Dn.segmentEach=Vp;Dn.segmentReduce=dx});var qp=ct(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});var vx=xc();function Ec(o){var e=[1/0,1/0,-1/0,-1/0];return vx.coordEach(o,function(r){e[0]>r[0]&&(e[0]=r[0]),e[1]>r[1]&&(e[1]=r[1]),e[2]<r[0]&&(e[2]=r[0]),e[3]<r[1]&&(e[3]=r[1])}),e}Ec.default=Ec;Mc.default=Ec});var lu=ct((eI,wc)=>{var Oi=$l(),Xp=vc(),Yp=xc(),Es=qp().default,_x=Yp.featureEach,jC=Yp.coordEach,tI=Xp.polygon,Wp=Xp.featureCollection;function $p(o){var e=new Oi(o);return e.insert=function(r){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:Es(r),Oi.prototype.insert.call(this,r)},e.load=function(r){var a=[];return Array.isArray(r)?r.forEach(function(u){if(u.type!=="Feature")throw new Error("invalid features");u.bbox=u.bbox?u.bbox:Es(u),a.push(u)}):_x(r,function(u){if(u.type!=="Feature")throw new Error("invalid features");u.bbox=u.bbox?u.bbox:Es(u),a.push(u)}),Oi.prototype.load.call(this,a)},e.remove=function(r,a){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:Es(r),Oi.prototype.remove.call(this,r,a)},e.clear=function(){return Oi.prototype.clear.call(this)},e.search=function(r){var a=Oi.prototype.search.call(this,this.toBBox(r));return Wp(a)},e.collides=function(r){return Oi.prototype.collides.call(this,this.toBBox(r))},e.all=function(){var r=Oi.prototype.all.call(this);return Wp(r)},e.toJSON=function(){return Oi.prototype.toJSON.call(this)},e.fromJSON=function(r){return Oi.prototype.fromJSON.call(this,r)},e.toBBox=function(r){var a;if(r.bbox)a=r.bbox;else if(Array.isArray(r)&&r.length===4)a=r;else if(Array.isArray(r)&&r.length===6)a=[r[0],r[1],r[3],r[4]];else if(r.type==="Feature")a=Es(r);else if(r.type==="FeatureCollection")a=Es(r);else throw new Error("invalid geojson");return{minX:a[0],minY:a[1],maxX:a[2],maxY:a[3]}},e}wc.exports=$p;wc.exports.default=$p});var Ic=ct((cR,id)=>{"use strict";var rd=Object.prototype.toString;id.exports=function(e){var r=rd.call(e),a=r==="[object Arguments]";return a||(a=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&rd.call(e.callee)==="[object Function]"),a}});var pd=ct((hR,fd)=>{"use strict";var hd;Object.keys||(ma=Object.prototype.hasOwnProperty,Pc=Object.prototype.toString,od=Ic(),Rc=Object.prototype.propertyIsEnumerable,sd=!Rc.call({toString:null},"toString"),ad=Rc.call(function(){},"prototype"),ga=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],du=function(o){var e=o.constructor;return e&&e.prototype===o},ud={$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},ld=function(){if(typeof window=="undefined")return!1;for(var o in window)try{if(!ud["$"+o]&&ma.call(window,o)&&window[o]!==null&&typeof window[o]=="object")try{du(window[o])}catch(e){return!0}}catch(e){return!0}return!1}(),cd=function(o){if(typeof window=="undefined"||!ld)return du(o);try{return du(o)}catch(e){return!1}},hd=function(e){var r=e!==null&&typeof e=="object",a=Pc.call(e)==="[object Function]",u=od(e),c=r&&Pc.call(e)==="[object String]",h=[];if(!r&&!a&&!u)throw new TypeError("Object.keys called on a non-object");var p=ad&&a;if(c&&e.length>0&&!ma.call(e,0))for(var d=0;d<e.length;++d)h.push(String(d));if(u&&e.length>0)for(var g=0;g<e.length;++g)h.push(String(g));else for(var v in e)!(p&&v==="prototype")&&ma.call(e,v)&&h.push(String(v));if(sd)for(var x=cd(e),M=0;M<ga.length;++M)!(x&&ga[M]==="constructor")&&ma.call(e,ga[M])&&h.push(ga[M]);return h});var ma,Pc,od,Rc,sd,ad,ga,du,ud,ld,cd;fd.exports=hd});var Nc=ct((fR,gd)=>{"use strict";var Ix=Array.prototype.slice,Px=Ic(),dd=Object.keys,mu=dd?function(e){return dd(e)}:pd(),md=Object.keys;mu.shim=function(){if(Object.keys){var e=function(){var r=Object.keys(arguments);return r&&r.length===arguments.length}(1,2);e||(Object.keys=function(a){return Px(a)?md(Ix.call(a)):md(a)})}else Object.keys=mu;return Object.keys||mu};gd.exports=mu});var Lc=ct((pR,yd)=>{"use strict";yd.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),a=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(a)!=="[object Symbol]")return!1;var u=42;e[r]=u;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var c=Object.getOwnPropertySymbols(e);if(c.length!==1||c[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var h=Object.getOwnPropertyDescriptor(e,r);if(h.value!==u||h.enumerable!==!0)return!1}return!0}});var gu=ct((dR,vd)=>{"use strict";var Rx=Lc();vd.exports=function(){return Rx()&&!!Symbol.toStringTag}});var xd=ct((mR,_d)=>{"use strict";_d.exports=Error});var Md=ct((gR,Ed)=>{"use strict";Ed.exports=EvalError});var Sd=ct((yR,wd)=>{"use strict";wd.exports=RangeError});var Ad=ct((vR,bd)=>{"use strict";bd.exports=ReferenceError});var Dc=ct((_R,Td)=>{"use strict";Td.exports=SyntaxError});var ko=ct((xR,Cd)=>{"use strict";Cd.exports=TypeError});var Pd=ct((ER,Id)=>{"use strict";Id.exports=URIError});var Ld=ct((MR,Nd)=>{"use strict";var Rd=typeof Symbol!="undefined"&&Symbol,Nx=Lc();Nd.exports=function(){return typeof Rd!="function"||typeof Symbol!="function"||typeof Rd("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Nx()}});var Od=ct((wR,Dd)=>{"use strict";var Oc={__proto__:null,foo:{}},Lx=Object;Dd.exports=function(){return{__proto__:Oc}.foo===Oc.foo&&!(Oc instanceof Lx)}});var Bd=ct((SR,Ud)=>{"use strict";var Dx="Function.prototype.bind called on incompatible ",Ox=Object.prototype.toString,Fx=Math.max,Ux="[object Function]",Fd=function(e,r){for(var a=[],u=0;u<e.length;u+=1)a[u]=e[u];for(var c=0;c<r.length;c+=1)a[c+e.length]=r[c];return a},Bx=function(e,r){for(var a=[],u=r||0,c=0;u<e.length;u+=1,c+=1)a[c]=e[u];return a},zx=function(o,e){for(var r="",a=0;a<o.length;a+=1)r+=o[a],a+1<o.length&&(r+=e);return r};Ud.exports=function(e){var r=this;if(typeof r!="function"||Ox.apply(r)!==Ux)throw new TypeError(Dx+r);for(var a=Bx(arguments,1),u,c=function(){if(this instanceof u){var v=r.apply(this,Fd(a,arguments));return Object(v)===v?v:this}return r.apply(e,Fd(a,arguments))},h=Fx(0,r.length-a.length),p=[],d=0;d<h;d++)p[d]="$"+d;if(u=Function("binder","return function ("+zx(p,",")+"){ return binder.apply(this,arguments); }")(c),r.prototype){var g=function(){};g.prototype=r.prototype,u.prototype=new g,g.prototype=null}return u}});var yu=ct((bR,zd)=>{"use strict";var kx=Bd();zd.exports=Function.prototype.bind||kx});var Gd=ct((AR,kd)=>{"use strict";var Gx=Function.prototype.call,Vx=Object.prototype.hasOwnProperty,Hx=yu();kd.exports=Hx.call(Gx,Vx)});var As=ct((TR,Xd)=>{"use strict";var _e,qx=xd(),Wx=Md(),Xx=Sd(),Yx=Ad(),bs=Dc(),Ss=ko(),$x=Pd(),Wd=Function,Fc=function(o){try{return Wd(\'"use strict"; return (\'+o+").constructor;")()}catch(e){}},Go=Object.getOwnPropertyDescriptor;if(Go)try{Go({},"")}catch(o){Go=null}var Uc=function(){throw new Ss},Zx=Go?function(){try{return arguments.callee,Uc}catch(o){try{return Go(arguments,"callee").get}catch(e){return Uc}}}():Uc,Ms=Ld()(),Jx=Od()(),Zn=Object.getPrototypeOf||(Jx?function(o){return o.__proto__}:null),ws={},Kx=typeof Uint8Array=="undefined"||!Zn?_e:Zn(Uint8Array),Vo={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?_e:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?_e:ArrayBuffer,"%ArrayIteratorPrototype%":Ms&&Zn?Zn([][Symbol.iterator]()):_e,"%AsyncFromSyncIteratorPrototype%":_e,"%AsyncFunction%":ws,"%AsyncGenerator%":ws,"%AsyncGeneratorFunction%":ws,"%AsyncIteratorPrototype%":ws,"%Atomics%":typeof Atomics=="undefined"?_e:Atomics,"%BigInt%":typeof BigInt=="undefined"?_e:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?_e:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?_e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?_e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":qx,"%eval%":eval,"%EvalError%":Wx,"%Float32Array%":typeof Float32Array=="undefined"?_e:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?_e:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?_e:FinalizationRegistry,"%Function%":Wd,"%GeneratorFunction%":ws,"%Int8Array%":typeof Int8Array=="undefined"?_e:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?_e:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?_e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ms&&Zn?Zn(Zn([][Symbol.iterator]())):_e,"%JSON%":typeof JSON=="object"?JSON:_e,"%Map%":typeof Map=="undefined"?_e:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Ms||!Zn?_e:Zn(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?_e:Promise,"%Proxy%":typeof Proxy=="undefined"?_e:Proxy,"%RangeError%":Xx,"%ReferenceError%":Yx,"%Reflect%":typeof Reflect=="undefined"?_e:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?_e:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Ms||!Zn?_e:Zn(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?_e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ms&&Zn?Zn(""[Symbol.iterator]()):_e,"%Symbol%":Ms?Symbol:_e,"%SyntaxError%":bs,"%ThrowTypeError%":Zx,"%TypedArray%":Kx,"%TypeError%":Ss,"%Uint8Array%":typeof Uint8Array=="undefined"?_e:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?_e:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?_e:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?_e:Uint32Array,"%URIError%":$x,"%WeakMap%":typeof WeakMap=="undefined"?_e:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?_e:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?_e:WeakSet};if(Zn)try{null.error}catch(o){Vd=Zn(Zn(o)),Vo["%Error.prototype%"]=Vd}var Vd,Qx=function o(e){var r;if(e==="%AsyncFunction%")r=Fc("async function () {}");else if(e==="%GeneratorFunction%")r=Fc("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Fc("async function* () {}");else if(e==="%AsyncGenerator%"){var a=o("%AsyncGeneratorFunction%");a&&(r=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var u=o("%AsyncGenerator%");u&&Zn&&(r=Zn(u.prototype))}return Vo[e]=r,r},Hd={__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"]},ya=yu(),vu=Gd(),jx=ya.call(Function.call,Array.prototype.concat),tE=ya.call(Function.apply,Array.prototype.splice),qd=ya.call(Function.call,String.prototype.replace),_u=ya.call(Function.call,String.prototype.slice),eE=ya.call(Function.call,RegExp.prototype.exec),nE=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,rE=/\\\\(\\\\)?/g,iE=function(e){var r=_u(e,0,1),a=_u(e,-1);if(r==="%"&&a!=="%")throw new bs("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&r!=="%")throw new bs("invalid intrinsic syntax, expected opening `%`");var u=[];return qd(e,nE,function(c,h,p,d){u[u.length]=p?qd(d,rE,"$1"):h||c}),u},oE=function(e,r){var a=e,u;if(vu(Hd,a)&&(u=Hd[a],a="%"+u[0]+"%"),vu(Vo,a)){var c=Vo[a];if(c===ws&&(c=Qx(a)),typeof c=="undefined"&&!r)throw new Ss("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:u,name:a,value:c}}throw new bs("intrinsic "+e+" does not exist!")};Xd.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Ss("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Ss(\'"allowMissing" argument must be a boolean\');if(eE(/^%?[^%]*%?$/,e)===null)throw new bs("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=iE(e),u=a.length>0?a[0]:"",c=oE("%"+u+"%",r),h=c.name,p=c.value,d=!1,g=c.alias;g&&(u=g[0],tE(a,jx([0,1],g)));for(var v=1,x=!0;v<a.length;v+=1){var M=a[v],w=_u(M,0,1),I=_u(M,-1);if((w===\'"\'||w==="\'"||w==="`"||I===\'"\'||I==="\'"||I==="`")&&w!==I)throw new bs("property names with quotes must have matching quotes");if((M==="constructor"||!x)&&(d=!0),u+="."+M,h="%"+u+"%",vu(Vo,h))p=Vo[h];else if(p!=null){if(!(M in p)){if(!r)throw new Ss("base intrinsic for "+e+" exists, but the property is not available.");return}if(Go&&v+1>=a.length){var D=Go(p,M);x=!!D,x&&"get"in D&&!("originalValue"in D.get)?p=D.get:p=p[M]}else x=vu(p,M),p=p[M];x&&!d&&(Vo[h]=p)}}return p}});var Eu=ct((CR,Yd)=>{"use strict";var sE=As(),xu=sE("%Object.defineProperty%",!0)||!1;if(xu)try{xu({},"a",{value:1})}catch(o){xu=!1}Yd.exports=xu});var Bc=ct((IR,$d)=>{"use strict";var aE=As(),Mu=aE("%Object.getOwnPropertyDescriptor%",!0);if(Mu)try{Mu([],"length")}catch(o){Mu=null}$d.exports=Mu});var wu=ct((PR,Kd)=>{"use strict";var Zd=Eu(),uE=Dc(),Ts=ko(),Jd=Bc();Kd.exports=function(e,r,a){if(!e||typeof e!="object"&&typeof e!="function")throw new Ts("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Ts("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ts("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ts("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ts("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ts("`loose`, if provided, must be a boolean");var u=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,d=!!Jd&&Jd(e,r);if(Zd)Zd(e,r,{configurable:h===null&&d?d.configurable:!h,enumerable:u===null&&d?d.enumerable:!u,value:a,writable:c===null&&d?d.writable:!c});else if(p||!u&&!c&&!h)e[r]=a;else throw new uE("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Su=ct((RR,jd)=>{"use strict";var zc=Eu(),Qd=function(){return!!zc};Qd.hasArrayLengthDefineBug=function(){if(!zc)return null;try{return zc([],"length",{value:1}).length!==1}catch(e){return!0}};jd.exports=Qd});var im=ct((NR,rm)=>{"use strict";var lE=As(),tm=wu(),cE=Su()(),em=Bc(),nm=ko(),hE=lE("%Math.floor%");rm.exports=function(e,r){if(typeof e!="function")throw new nm("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||hE(r)!==r)throw new nm("`length` must be a positive 32-bit integer");var a=arguments.length>2&&!!arguments[2],u=!0,c=!0;if("length"in e&&em){var h=em(e,"length");h&&!h.configurable&&(u=!1),h&&!h.writable&&(c=!1)}return(u||c||!a)&&(cE?tm(e,"length",r,!0,!0):tm(e,"length",r)),e}});var Tu=ct((LR,bu)=>{"use strict";var kc=yu(),Au=As(),fE=im(),pE=ko(),am=Au("%Function.prototype.apply%"),um=Au("%Function.prototype.call%"),lm=Au("%Reflect.apply%",!0)||kc.call(um,am),om=Eu(),dE=Au("%Math.max%");bu.exports=function(e){if(typeof e!="function")throw new pE("a function is required");var r=lm(kc,um,arguments);return fE(r,1+dE(0,e.length-(arguments.length-1)),!0)};var sm=function(){return lm(kc,am,arguments)};om?om(bu.exports,"apply",{value:sm}):bu.exports.apply=sm});var Gc=ct((DR,fm)=>{"use strict";var cm=As(),hm=Tu(),mE=hm(cm("String.prototype.indexOf"));fm.exports=function(e,r){var a=cm(e,!!r);return typeof a=="function"&&mE(e,".prototype.")>-1?hm(a):a}});var mm=ct((OR,dm)=>{"use strict";var gE=gu()(),yE=Gc(),Vc=yE("Object.prototype.toString"),Cu=function(e){return gE&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:Vc(e)==="[object Arguments]"},pm=function(e){return Cu(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Vc(e)!=="[object Array]"&&Vc(e.callee)==="[object Function]"},vE=function(){return Cu(arguments)}();Cu.isLegacyArguments=pm;dm.exports=vE?Cu:pm});var Cs=ct((FR,_m)=>{"use strict";var _E=Nc(),xE=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",EE=Object.prototype.toString,ME=Array.prototype.concat,gm=wu(),wE=function(o){return typeof o=="function"&&EE.call(o)==="[object Function]"},ym=Su()(),SE=function(o,e,r,a){if(e in o){if(a===!0){if(o[e]===r)return}else if(!wE(a)||!a())return}ym?gm(o,e,r,!0):gm(o,e,r)},vm=function(o,e){var r=arguments.length>2?arguments[2]:{},a=_E(e);xE&&(a=ME.call(a,Object.getOwnPropertySymbols(e)));for(var u=0;u<a.length;u+=1)SE(o,a[u],e[a[u]],r[a[u]])};vm.supportsDescriptors=!!ym;_m.exports=vm});var Hc=ct((UR,Em)=>{"use strict";var xm=function(o){return o!==o};Em.exports=function(e,r){return e===0&&r===0?1/e===1/r:!!(e===r||xm(e)&&xm(r))}});var qc=ct((BR,Mm)=>{"use strict";var bE=Hc();Mm.exports=function(){return typeof Object.is=="function"?Object.is:bE}});var Sm=ct((zR,wm)=>{"use strict";var AE=qc(),TE=Cs();wm.exports=function(){var e=AE();return TE(Object,{is:e},{is:function(){return Object.is!==e}}),e}});var Cm=ct((kR,Tm)=>{"use strict";var CE=Cs(),IE=Tu(),PE=Hc(),bm=qc(),RE=Sm(),Am=IE(bm(),Object);CE(Am,{getPolyfill:bm,implementation:PE,shim:RE});Tm.exports=Am});var Lm=ct((GR,Nm)=>{"use strict";var Wc=Gc(),Im=gu()(),Pm,Rm,Xc,Yc;Im&&(Pm=Wc("Object.prototype.hasOwnProperty"),Rm=Wc("RegExp.prototype.exec"),Xc={},Iu=function(){throw Xc},Yc={toString:Iu,valueOf:Iu},typeof Symbol.toPrimitive=="symbol"&&(Yc[Symbol.toPrimitive]=Iu));var Iu,NE=Wc("Object.prototype.toString"),LE=Object.getOwnPropertyDescriptor,DE="[object RegExp]";Nm.exports=Im?function(e){if(!e||typeof e!="object")return!1;var r=LE(e,"lastIndex"),a=r&&Pm(r,"value");if(!a)return!1;try{Rm(e,Yc)}catch(u){return u===Xc}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:NE(e)===DE}});var Om=ct((VR,Dm)=>{"use strict";var _a=function(){return typeof function(){}.name=="string"},va=Object.getOwnPropertyDescriptor;if(va)try{va([],"length")}catch(o){va=null}_a.functionsHaveConfigurableNames=function(){if(!_a()||!va)return!1;var e=va(function(){},"name");return!!e&&!!e.configurable};var OE=Function.prototype.bind;_a.boundFunctionsHaveNames=function(){return _a()&&typeof OE=="function"&&function(){}.bind().name!==""};Dm.exports=_a});var Bm=ct((HR,Um)=>{"use strict";var Fm=wu(),FE=Su()(),UE=Om().functionsHaveConfigurableNames(),BE=ko();Um.exports=function(e,r){if(typeof e!="function")throw new BE("`fn` is not a function");var a=arguments.length>2&&!!arguments[2];return(!a||UE)&&(FE?Fm(e,"name",r,!0,!0):Fm(e,"name",r)),e}});var $c=ct((qR,zm)=>{"use strict";var zE=Bm(),kE=ko(),GE=Object;zm.exports=zE(function(){if(this==null||this!==GE(this))throw new kE("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0)});var Zc=ct((WR,km)=>{"use strict";var VE=$c(),HE=Cs().supportsDescriptors,qE=Object.getOwnPropertyDescriptor;km.exports=function(){if(HE&&/a/mig.flags==="gim"){var e=qE(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var r="",a={};if(Object.defineProperty(a,"hasIndices",{get:function(){r+="d"}}),Object.defineProperty(a,"sticky",{get:function(){r+="y"}}),e.get.call(a),r==="dy")return e.get}}return VE}});var Hm=ct((XR,Vm)=>{"use strict";var WE=Cs().supportsDescriptors,XE=Zc(),YE=Object.getOwnPropertyDescriptor,$E=Object.defineProperty,ZE=TypeError,Gm=Object.getPrototypeOf,JE=/a/;Vm.exports=function(){if(!WE||!Gm)throw new ZE("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=XE(),r=Gm(JE),a=YE(r,"flags");return(!a||a.get!==e)&&$E(r,"flags",{configurable:!0,enumerable:!1,get:e}),e}});var Ym=ct((YR,Xm)=>{"use strict";var KE=Cs(),QE=Tu(),jE=$c(),qm=Zc(),tM=Hm(),Wm=QE(qm());KE(Wm,{getPolyfill:qm,implementation:jE,shim:tM});Xm.exports=Wm});var Zm=ct(($R,$m)=>{"use strict";var eM=Date.prototype.getDay,nM=function(e){try{return eM.call(e),!0}catch(r){return!1}},rM=Object.prototype.toString,iM="[object Date]",oM=gu()();$m.exports=function(e){return typeof e!="object"||e===null?!1:oM?nM(e):rM.call(e)===iM}});var Jc=ct((ZR,sg)=>{var Jm=Nc(),Km=mm(),Qm=Cm(),jm=Lm(),tg=Ym(),eg=Zm(),ng=Date.prototype.getTime;function og(o,e,r){var a=r||{};return(a.strict?Qm(o,e):o===e)?!0:!o||!e||typeof o!="object"&&typeof e!="object"?a.strict?Qm(o,e):o==e:sM(o,e,a)}function rg(o){return o==null}function ig(o){return!(!o||typeof o!="object"||typeof o.length!="number"||typeof o.copy!="function"||typeof o.slice!="function"||o.length>0&&typeof o[0]!="number")}function sM(o,e,r){var a,u;if(typeof o!=typeof e||rg(o)||rg(e)||o.prototype!==e.prototype||Km(o)!==Km(e))return!1;var c=jm(o),h=jm(e);if(c!==h)return!1;if(c||h)return o.source===e.source&&tg(o)===tg(e);if(eg(o)&&eg(e))return ng.call(o)===ng.call(e);var p=ig(o),d=ig(e);if(p!==d)return!1;if(p||d){if(o.length!==e.length)return!1;for(a=0;a<o.length;a++)if(o[a]!==e[a])return!1;return!0}if(typeof o!=typeof e)return!1;try{var g=Jm(o),v=Jm(e)}catch(x){return!1}if(g.length!==v.length)return!1;for(g.sort(),v.sort(),a=g.length-1;a>=0;a--)if(g[a]!=v[a])return!1;for(a=g.length-1;a>=0;a--)if(u=g[a],!og(o[u],e[u],r))return!1;return!0}sg.exports=og});var uh=ct((e2,pg)=>{var JM=Jc(),Fi=function(o){this.precision=o&&o.precision?o.precision:17,this.direction=o&&o.direction?o.direction:!1,this.pseudoNode=o&&o.pseudoNode?o.pseudoNode:!1,this.objectComparator=o&&o.objectComparator?o.objectComparator:KM};Fi.prototype.compare=function(o,e){if(o.type!==e.type||!fg(o,e))return!1;switch(o.type){case"Point":return this.compareCoord(o.coordinates,e.coordinates);case"LineString":return this.compareLine(o.coordinates,e.coordinates,0,!1);case"Polygon":return this.comparePolygon(o,e);case"Feature":return this.compareFeature(o,e);default:if(o.type.indexOf("Multi")===0){var r=this,a=hg(o),u=hg(e);return a.every(function(c){return this.some(function(h){return r.compare(c,h)})},u)}}return!1};function hg(o){return o.coordinates.map(function(e){return{type:o.type.replace("Multi",""),coordinates:e}})}function fg(o,e){return o.hasOwnProperty("coordinates")?o.coordinates.length===e.coordinates.length:o.length===e.length}Fi.prototype.compareCoord=function(o,e){if(o.length!==e.length)return!1;for(var r=0;r<o.length;r++)if(o[r].toFixed(this.precision)!==e[r].toFixed(this.precision))return!1;return!0};Fi.prototype.compareLine=function(o,e,r,a){if(!fg(o,e))return!1;var u=this.pseudoNode?o:this.removePseudo(o),c=this.pseudoNode?e:this.removePseudo(e);if(!(a&&!this.compareCoord(u[0],c[0])&&(c=this.fixStartIndex(c,u),!c))){var h=this.compareCoord(u[r],c[r]);return this.direction||h?this.comparePath(u,c):this.compareCoord(u[r],c[c.length-(1+r)])?this.comparePath(u.slice().reverse(),c):!1}};Fi.prototype.fixStartIndex=function(o,e){for(var r,a=-1,u=0;u<o.length;u++)if(this.compareCoord(o[u],e[0])){a=u;break}return a>=0&&(r=[].concat(o.slice(a,o.length),o.slice(1,a+1))),r};Fi.prototype.comparePath=function(o,e){var r=this;return o.every(function(a,u){return r.compareCoord(a,this[u])},e)};Fi.prototype.comparePolygon=function(o,e){if(this.compareLine(o.coordinates[0],e.coordinates[0],1,!0)){var r=o.coordinates.slice(1,o.coordinates.length),a=e.coordinates.slice(1,e.coordinates.length),u=this;return r.every(function(c){return this.some(function(h){return u.compareLine(c,h,1,!0)})},a)}else return!1};Fi.prototype.compareFeature=function(o,e){return o.id!==e.id||!this.objectComparator(o.properties,e.properties)||!this.compareBBox(o,e)?!1:this.compare(o.geometry,e.geometry)};Fi.prototype.compareBBox=function(o,e){return!!(!o.bbox&&!e.bbox||o.bbox&&e.bbox&&this.compareCoord(o.bbox,e.bbox))};Fi.prototype.removePseudo=function(o){return o};function KM(o,e){return JM(o,e,{strict:!0})}pg.exports=Fi});var dg=ct((p2,Nu)=>{function xo(o,e,r,a){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(o,e,r,a)}xo.prototype.run=function(o,e,r,a){this._init(o,e,r,a);for(var u=0;u<this._datasetLength;u++)if(this._visited[u]!==1){this._visited[u]=1;var c=this._regionQuery(u);if(c.length<this.minPts)this.noise.push(u);else{var h=this.clusters.length;this.clusters.push([]),this._addToCluster(u,h),this._expandCluster(h,c)}}return this.clusters};xo.prototype._init=function(o,e,r,a){if(o){if(!(o instanceof Array))throw Error("Dataset must be of type array, "+typeof o+" given");this.dataset=o,this.clusters=[],this.noise=[],this._datasetLength=o.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}e&&(this.epsilon=e),r&&(this.minPts=r),a&&(this.distance=a)};xo.prototype._expandCluster=function(o,e){for(var r=0;r<e.length;r++){var a=e[r];if(this._visited[a]!==1){this._visited[a]=1;var u=this._regionQuery(a);u.length>=this.minPts&&(e=this._mergeArrays(e,u))}this._assigned[a]!==1&&this._addToCluster(a,o)}};xo.prototype._addToCluster=function(o,e){this.clusters[e].push(o),this._assigned[o]=1};xo.prototype._regionQuery=function(o){for(var e=[],r=0;r<this._datasetLength;r++){var a=this.distance(this.dataset[o],this.dataset[r]);a<this.epsilon&&e.push(r)}return e};xo.prototype._mergeArrays=function(o,e){for(var r=e.length,a=0;a<r;a++){var u=e[a];o.indexOf(u)<0&&o.push(u)}return o};xo.prototype._euclideanDistance=function(o,e){for(var r=0,a=Math.min(o.length,e.length);a--;)r+=(o[a]-e[a])*(o[a]-e[a]);return Math.sqrt(r)};typeof Nu!="undefined"&&Nu.exports&&(Nu.exports=xo)});var mg=ct((d2,Lu)=>{function Eo(o,e,r){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(o,e,r)}Eo.prototype.init=function(o,e,r){this.assignments=[],this.centroids=[],typeof o!="undefined"&&(this.dataset=o),typeof e!="undefined"&&(this.k=e),typeof r!="undefined"&&(this.distance=r)};Eo.prototype.run=function(o,e){this.init(o,e);for(var r=this.dataset.length,a=0;a<this.k;a++)this.centroids[a]=this.randomCentroid();for(var u=!0;u;){u=this.assign();for(var c=0;c<this.k;c++){for(var h=new Array(v),p=0,d=0;d<v;d++)h[d]=0;for(var g=0;g<r;g++){var v=this.dataset[g].length;if(c===this.assignments[g]){for(var d=0;d<v;d++)h[d]+=this.dataset[g][d];p++}}if(p>0){for(var d=0;d<v;d++)h[d]/=p;this.centroids[c]=h}else this.centroids[c]=this.randomCentroid(),u=!0}}return this.getClusters()};Eo.prototype.randomCentroid=function(){var o=this.dataset.length-1,e,r;do r=Math.round(Math.random()*o),e=this.dataset[r];while(this.centroids.indexOf(e)>=0);return e};Eo.prototype.assign=function(){for(var o=!1,e=this.dataset.length,r,a=0;a<e;a++)r=this.argmin(this.dataset[a],this.centroids,this.distance),r!=this.assignments[a]&&(this.assignments[a]=r,o=!0);return o};Eo.prototype.getClusters=function(){for(var o=new Array(this.k),e,r=0;r<this.assignments.length;r++)e=this.assignments[r],typeof o[e]=="undefined"&&(o[e]=[]),o[e].push(r);return o};Eo.prototype.argmin=function(o,e,r){for(var a=Number.MAX_VALUE,u=0,c=e.length,h,p=0;p<c;p++)h=r(o,e[p]),h<a&&(a=h,u=p);return u};Eo.prototype.distance=function(o,e){for(var r=0,a=Math.min(o.length,e.length);a--;){var u=o[a]-e[a];r+=u*u}return Math.sqrt(r)};typeof Lu!="undefined"&&Lu.exports&&(Lu.exports=Eo)});var lh=ct((m2,Du)=>{function Ui(o,e,r){this._queue=[],this._priorities=[],this._sorting="desc",this._init(o,e,r)}Ui.prototype.insert=function(o,e){for(var r=this._queue.length,a=r;a--;){var u=this._priorities[a];this._sorting==="desc"?e>u&&(r=a):e<u&&(r=a)}this._insertAt(o,e,r)};Ui.prototype.remove=function(o){for(var e=this._queue.length;e--;){var r=this._queue[e];if(o===r){this._queue.splice(e,1),this._priorities.splice(e,1);break}}};Ui.prototype.forEach=function(o){this._queue.forEach(o)};Ui.prototype.getElements=function(){return this._queue};Ui.prototype.getElementPriority=function(o){return this._priorities[o]};Ui.prototype.getPriorities=function(){return this._priorities};Ui.prototype.getElementsWithPriorities=function(){for(var o=[],e=0,r=this._queue.length;e<r;e++)o.push([this._queue[e],this._priorities[e]]);return o};Ui.prototype._init=function(o,e,r){if(o&&e){if(this._queue=[],this._priorities=[],o.length!==e.length)throw new Error("Arrays must have the same length");for(var a=0;a<o.length;a++)this.insert(o[a],e[a])}r&&(this._sorting=r)};Ui.prototype._insertAt=function(o,e,r){this._queue.length===r?(this._queue.push(o),this._priorities.push(e)):(this._queue.splice(r,0,o),this._priorities.splice(r,0,e))};typeof Du!="undefined"&&Du.exports&&(Du.exports=Ui)});var yg=ct((g2,Ps)=>{typeof Ps!="undefined"&&Ps.exports&&(gg=lh());var gg;function to(o,e,r,a){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(o,e,r,a)}to.prototype.run=function(o,e,r,a){this._init(o,e,r,a);for(var u=0,c=this.dataset.length;u<c;u++)if(this._processed[u]!==1){this._processed[u]=1,this.clusters.push([u]);var h=this.clusters.length-1;this._orderedList.push(u);var p=new gg(null,null,"asc"),d=this._regionQuery(u);this._distanceToCore(u)!==void 0&&(this._updateQueue(u,d,p),this._expandCluster(h,p))}return this.clusters};to.prototype.getReachabilityPlot=function(){for(var o=[],e=0,r=this._orderedList.length;e<r;e++){var a=this._orderedList[e],u=this._reachability[a];o.push([a,u])}return o};to.prototype._init=function(o,e,r,a){if(o){if(!(o instanceof Array))throw Error("Dataset must be of type array, "+typeof o+" given");this.dataset=o,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}e&&(this.epsilon=e),r&&(this.minPts=r),a&&(this.distance=a)};to.prototype._updateQueue=function(o,e,r){var a=this;this._coreDistance=this._distanceToCore(o),e.forEach(function(u){if(a._processed[u]===void 0){var c=a.distance(a.dataset[o],a.dataset[u]),h=Math.max(a._coreDistance,c);a._reachability[u]===void 0?(a._reachability[u]=h,r.insert(u,h)):h<a._reachability[u]&&(a._reachability[u]=h,r.remove(u),r.insert(u,h))}})};to.prototype._expandCluster=function(o,e){for(var r=e.getElements(),a=0,u=r.length;a<u;a++){var c=r[a];if(this._processed[c]===void 0){var h=this._regionQuery(c);this._processed[c]=1,this.clusters[o].push(c),this._orderedList.push(c),this._distanceToCore(c)!==void 0&&(this._updateQueue(c,h,e),this._expandCluster(o,e))}}};to.prototype._distanceToCore=function(o){for(var e=this.epsilon,r=0;r<e;r++){var a=this._regionQuery(o,r);if(a.length>=this.minPts)return r}};to.prototype._regionQuery=function(o,e){e=e||this.epsilon;for(var r=[],a=0,u=this.dataset.length;a<u;a++)this.distance(this.dataset[o],this.dataset[a])<e&&r.push(a);return r};to.prototype._euclideanDistance=function(o,e){for(var r=0,a=Math.min(o.length,e.length);a--;)r+=(o[a]-e[a])*(o[a]-e[a]);return Math.sqrt(r)};typeof Ps!="undefined"&&Ps.exports&&(Ps.exports=to)});var vg=ct((y2,Ou)=>{typeof Ou!="undefined"&&Ou.exports&&(Ou.exports={DBSCAN:dg(),KMEANS:mg(),OPTICS:yg(),PriorityQueue:lh()})});var ch=ct((w2,xg)=>{"use strict";xg.exports={eudist:function(e,r,a){for(var u=e.length,c=0,h=0;h<u;h++){var p=(e[h]||0)-(r[h]||0);c+=p*p}return a?Math.sqrt(c):c},mandist:function(e,r,a){for(var u=e.length,c=0,h=0;h<u;h++)c+=Math.abs((e[h]||0)-(r[h]||0));return a?Math.sqrt(c):c},dist:function(e,r,a){var u=Math.abs(e-r);return a?u:u*u}}});var wg=ct((S2,Mg)=>{"use strict";var Eg=ch(),rw=Eg.eudist,iw=Eg.dist;Mg.exports={kmrand:function(e,r){for(var a={},u=[],c=r<<2,h=e.length,p=e[0].length>0;u.length<r&&c-- >0;){var d=e[Math.floor(Math.random()*h)],g=p?d.join("_"):""+d;a[g]||(a[g]=!0,u.push(d))}if(u.length<r)throw new Error("Error initializating clusters");return u},kmpp:function(e,r){var a=e[0].length?rw:iw,u=[],c=e.length,h=e[0].length>0,p={},d=e[Math.floor(Math.random()*c)],g=h?d.join("_"):""+d;for(u.push(d),p[g]=!0;u.length<r;){for(var v=[],x=u.length,M=0,w=[],I=0;I<c;I++){for(var D=1/0,b=0;b<x;b++){var T=a(e[I],u[b]);T<=D&&(D=T)}v[I]=D}for(var L=0;L<c;L++)M+=v[L];for(var P=0;P<c;P++)w[P]={i:P,v:e[P],pr:v[P]/M,cs:0};w.sort(function(q,C){return q.pr-C.pr}),w[0].cs=w[0].pr;for(var z=1;z<c;z++)w[z].cs=w[z-1].cs+w[z].pr;for(var k=Math.random(),Y=0;Y<c-1&&w[Y++].cs<k;);u.push(w[Y-1].v)}return u}}});var Cg=ct((T2,Tg)=>{"use strict";var hh=ch(),Ag=wg(),ow=hh.eudist,b2=hh.mandist,A2=hh.dist,sw=Ag.kmrand,aw=Ag.kmpp,Sg=1e4;function bg(o,e,r){r=r||[];for(var a=0;a<o;a++)r[a]=e;return r}function uw(o,e,r,a){var u=[],c=[],h=[],p=[],d=!1,g=a||Sg,v=o.length,x=o[0].length,M=x>0,w=[];if(r)r=="kmrand"?u=sw(o,e):r=="kmpp"?u=aw(o,e):u=r;else for(var I={};u.length<e;){var D=Math.floor(Math.random()*v);I[D]||(I[D]=!0,u.push(o[D]))}do{bg(e,0,w);for(var b=0;b<v;b++){for(var T=1/0,L=0,P=0;P<e;P++){var p=M?ow(o[b],u[P]):Math.abs(o[b]-u[P]);p<=T&&(T=p,L=P)}h[b]=L,w[L]++}for(var z=[],c=[],k=0,Y=0;Y<e;Y++)z[Y]=M?bg(x,0,z[Y]):0,c[Y]=u[Y];if(M){for(var q=0;q<e;q++)u[q]=[];for(var C=0;C<v;C++)for(var ot=h[C],pt=z[ot],dt=o[C],F=0;F<x;F++)pt[F]+=dt[F];d=!0;for(var ye=0;ye<e;ye++){for(var et=u[ye],St=z[ye],Pt=c[ye],Rt=w[ye],it=0;it<x;it++)et[it]=St[it]/Rt||0;if(d){for(var mt=0;mt<x;mt++)if(Pt[mt]!=et[mt]){d=!1;break}}}}else{for(var U=0;U<v;U++){var Nt=h[U];z[Nt]+=o[U]}for(var Mt=0;Mt<e;Mt++)u[Mt]=z[Mt]/w[Mt]||0;d=!0;for(var Re=0;Re<e;Re++)if(c[Re]!=u[Re]){d=!1;break}}d=d||--g<=0}while(!d);return{it:Sg-g,k:e,idxs:h,centroids:u}}Tg.exports=uw});var Os=ct((yh,vh)=>{(function(o,e){typeof yh=="object"&&typeof vh!="undefined"?vh.exports=e():typeof define=="function"&&define.amd?define(e):(o=typeof globalThis!="undefined"?globalThis:o||self,o.polygonClipping=e())})(yh,function(){"use strict";function o(B,y){var E={label:0,sent:function(){if(R[0]&1)throw R[1];return R[1]},trys:[],ops:[]},A,N,R,$;return $={next:G(0),throw:G(1),return:G(2)},typeof Symbol=="function"&&($[Symbol.iterator]=function(){return this}),$;function G(Z){return function(V){return K([Z,V])}}function K(Z){if(A)throw new TypeError("Generator is already executing.");for(;E;)try{if(A=1,N&&(R=Z[0]&2?N.return:Z[0]?N.throw||((R=N.return)&&R.call(N),0):N.next)&&!(R=R.call(N,Z[1])).done)return R;switch(N=0,R&&(Z=[Z[0]&2,R.value]),Z[0]){case 0:case 1:R=Z;break;case 4:return E.label++,{value:Z[1],done:!1};case 5:E.label++,N=Z[1],Z=[0];continue;case 7:Z=E.ops.pop(),E.trys.pop();continue;default:if(R=E.trys,!(R=R.length>0&&R[R.length-1])&&(Z[0]===6||Z[0]===2)){E=0;continue}if(Z[0]===3&&(!R||Z[1]>R[0]&&Z[1]<R[3])){E.label=Z[1];break}if(Z[0]===6&&E.label<R[1]){E.label=R[1],R=Z;break}if(R&&E.label<R[2]){E.label=R[2],E.ops.push(Z);break}R[2]&&E.ops.pop(),E.trys.pop();continue}Z=y.call(B,E)}catch(V){Z=[6,V],N=0}finally{A=R=0}if(Z[0]&5)throw Z[1];return{value:Z[0]?Z[1]:void 0,done:!0}}}var e=function(){function B(y,E){this.next=null,this.key=y,this.data=E,this.left=null,this.right=null}return B}();function r(B,y){return B>y?1:B<y?-1:0}function a(B,y,E){for(var A=new e(null,null),N=A,R=A;;){var $=E(B,y.key);if($<0){if(y.left===null)break;if(E(B,y.left.key)<0){var G=y.left;if(y.left=G.right,G.right=y,y=G,y.left===null)break}R.left=y,R=y,y=y.left}else if($>0){if(y.right===null)break;if(E(B,y.right.key)>0){var G=y.right;if(y.right=G.left,G.left=y,y=G,y.right===null)break}N.right=y,N=y,y=y.right}else break}return N.right=y.left,R.left=y.right,y.left=A.right,y.right=A.left,y}function u(B,y,E,A){var N=new e(B,y);if(E===null)return N.left=N.right=null,N;E=a(B,E,A);var R=A(B,E.key);return R<0?(N.left=E.left,N.right=E,E.left=null):R>=0&&(N.right=E.right,N.left=E,E.right=null),N}function c(B,y,E){var A=null,N=null;if(y){y=a(B,y,E);var R=E(y.key,B);R===0?(A=y.left,N=y.right):R<0?(N=y.right,y.right=null,A=y):(A=y.left,y.left=null,N=y)}return{left:A,right:N}}function h(B,y,E){return y===null?B:(B===null||(y=a(B.key,y,E),y.left=B),y)}function p(B,y,E,A,N){if(B){A(""+y+(E?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+N(B)+`\n`);var R=y+(E?" ":"\\u2502 ");B.left&&p(B.left,R,!1,A,N),B.right&&p(B.right,R,!0,A,N)}}var d=function(){function B(y){y===void 0&&(y=r),this._root=null,this._size=0,this._comparator=y}return B.prototype.insert=function(y,E){return this._size++,this._root=u(y,E,this._root,this._comparator)},B.prototype.add=function(y,E){var A=new e(y,E);this._root===null&&(A.left=A.right=null,this._size++,this._root=A);var N=this._comparator,R=a(y,this._root,N),$=N(y,R.key);return $===0?this._root=R:($<0?(A.left=R.left,A.right=R,R.left=null):$>0&&(A.right=R.right,A.left=R,R.right=null),this._size++,this._root=A),this._root},B.prototype.remove=function(y){this._root=this._remove(y,this._root,this._comparator)},B.prototype._remove=function(y,E,A){var N;if(E===null)return null;E=a(y,E,A);var R=A(y,E.key);return R===0?(E.left===null?N=E.right:(N=a(y,E.left,A),N.right=E.right),this._size--,N):E},B.prototype.pop=function(){var y=this._root;if(y){for(;y.left;)y=y.left;return this._root=a(y.key,this._root,this._comparator),this._root=this._remove(y.key,this._root,this._comparator),{key:y.key,data:y.data}}return null},B.prototype.findStatic=function(y){for(var E=this._root,A=this._comparator;E;){var N=A(y,E.key);if(N===0)return E;N<0?E=E.left:E=E.right}return null},B.prototype.find=function(y){return this._root&&(this._root=a(y,this._root,this._comparator),this._comparator(y,this._root.key)!==0)?null:this._root},B.prototype.contains=function(y){for(var E=this._root,A=this._comparator;E;){var N=A(y,E.key);if(N===0)return!0;N<0?E=E.left:E=E.right}return!1},B.prototype.forEach=function(y,E){for(var A=this._root,N=[],R=!1;!R;)A!==null?(N.push(A),A=A.left):N.length!==0?(A=N.pop(),y.call(E,A),A=A.right):R=!0;return this},B.prototype.range=function(y,E,A,N){for(var R=[],$=this._comparator,G=this._root,K;R.length!==0||G;)if(G)R.push(G),G=G.left;else{if(G=R.pop(),K=$(G.key,E),K>0)break;if($(G.key,y)>=0&&A.call(N,G))return this;G=G.right}return this},B.prototype.keys=function(){var y=[];return this.forEach(function(E){var A=E.key;return y.push(A)}),y},B.prototype.values=function(){var y=[];return this.forEach(function(E){var A=E.data;return y.push(A)}),y},B.prototype.min=function(){return this._root?this.minNode(this._root).key:null},B.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},B.prototype.minNode=function(y){if(y===void 0&&(y=this._root),y)for(;y.left;)y=y.left;return y},B.prototype.maxNode=function(y){if(y===void 0&&(y=this._root),y)for(;y.right;)y=y.right;return y},B.prototype.at=function(y){for(var E=this._root,A=!1,N=0,R=[];!A;)if(E)R.push(E),E=E.left;else if(R.length>0){if(E=R.pop(),N===y)return E;N++,E=E.right}else A=!0;return null},B.prototype.next=function(y){var E=this._root,A=null;if(y.right){for(A=y.right;A.left;)A=A.left;return A}for(var N=this._comparator;E;){var R=N(y.key,E.key);if(R===0)break;R<0?(A=E,E=E.left):E=E.right}return A},B.prototype.prev=function(y){var E=this._root,A=null;if(y.left!==null){for(A=y.left;A.right;)A=A.right;return A}for(var N=this._comparator;E;){var R=N(y.key,E.key);if(R===0)break;R<0?E=E.left:(A=E,E=E.right)}return A},B.prototype.clear=function(){return this._root=null,this._size=0,this},B.prototype.toList=function(){return x(this._root)},B.prototype.load=function(y,E,A){E===void 0&&(E=[]),A===void 0&&(A=!1);var N=y.length,R=this._comparator;if(A&&I(y,E,0,N-1,R),this._root===null)this._root=g(y,E,0,N),this._size=N;else{var $=w(this.toList(),v(y,E),R);N=this._size+N,this._root=M({head:$},0,N)}return this},B.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(B.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(B.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),B.prototype.toString=function(y){y===void 0&&(y=function(A){return String(A.key)});var E=[];return p(this._root,"",!0,function(A){return E.push(A)},y),E.join("")},B.prototype.update=function(y,E,A){var N=this._comparator,R=c(y,this._root,N),$=R.left,G=R.right;N(y,E)<0?G=u(E,A,G,N):$=u(E,A,$,N),this._root=h($,G,N)},B.prototype.split=function(y){return c(y,this._root,this._comparator)},B.prototype[Symbol.iterator]=function(){var y,E,A;return o(this,function(N){switch(N.label){case 0:y=this._root,E=[],A=!1,N.label=1;case 1:return A?[3,6]:y===null?[3,2]:(E.push(y),y=y.left,[3,5]);case 2:return E.length===0?[3,4]:(y=E.pop(),[4,y]);case 3:return N.sent(),y=y.right,[3,5];case 4:A=!0,N.label=5;case 5:return[3,1];case 6:return[2]}})},B}();function g(B,y,E,A){var N=A-E;if(N>0){var R=E+Math.floor(N/2),$=B[R],G=y[R],K=new e($,G);return K.left=g(B,y,E,R),K.right=g(B,y,R+1,A),K}return null}function v(B,y){for(var E=new e(null,null),A=E,N=0;N<B.length;N++)A=A.next=new e(B[N],y[N]);return A.next=null,E.next}function x(B){for(var y=B,E=[],A=!1,N=new e(null,null),R=N;!A;)y?(E.push(y),y=y.left):E.length>0?(y=R=R.next=E.pop(),y=y.right):A=!0;return R.next=null,N.next}function M(B,y,E){var A=E-y;if(A>0){var N=y+Math.floor(A/2),R=M(B,y,N),$=B.head;return $.left=R,B.head=B.head.next,$.right=M(B,N+1,E),$}return null}function w(B,y,E){for(var A=new e(null,null),N=A,R=B,$=y;R!==null&&$!==null;)E(R.key,$.key)<0?(N.next=R,R=R.next):(N.next=$,$=$.next),N=N.next;return R!==null?N.next=R:$!==null&&(N.next=$),A.next}function I(B,y,E,A,N){if(!(E>=A)){for(var R=B[E+A>>1],$=E-1,G=A+1;;){do $++;while(N(B[$],R)<0);do G--;while(N(B[G],R)>0);if($>=G)break;var K=B[$];B[$]=B[G],B[G]=K,K=y[$],y[$]=y[G],y[G]=K}I(B,y,E,G,N),I(B,y,G+1,A,N)}}let D=(B,y)=>B.ll.x<=y.x&&y.x<=B.ur.x&&B.ll.y<=y.y&&y.y<=B.ur.y,b=(B,y)=>{if(y.ur.x<B.ll.x||B.ur.x<y.ll.x||y.ur.y<B.ll.y||B.ur.y<y.ll.y)return null;let E=B.ll.x<y.ll.x?y.ll.x:B.ll.x,A=B.ur.x<y.ur.x?B.ur.x:y.ur.x,N=B.ll.y<y.ll.y?y.ll.y:B.ll.y,R=B.ur.y<y.ur.y?B.ur.y:y.ur.y;return{ll:{x:E,y:N},ur:{x:A,y:R}}},T=Number.EPSILON;T===void 0&&(T=Math.pow(2,-52));let L=T*T,P=(B,y)=>{if(-T<B&&B<T&&-T<y&&y<T)return 0;let E=B-y;return E*E<L*B*y?0:B<y?-1:1};class z{constructor(){this.reset()}reset(){this.xRounder=new k,this.yRounder=new k}round(y,E){return{x:this.xRounder.round(y),y:this.yRounder.round(E)}}}class k{constructor(){this.tree=new d,this.round(0)}round(y){let E=this.tree.add(y),A=this.tree.prev(E);if(A!==null&&P(E.key,A.key)===0)return this.tree.remove(y),A.key;let N=this.tree.next(E);return N!==null&&P(E.key,N.key)===0?(this.tree.remove(y),N.key):y}}let Y=new z,q=11102230246251565e-32,C=134217729,ot=(3+8*q)*q;function pt(B,y,E,A,N){let R,$,G,K,Z=y[0],V=A[0],W=0,Q=0;V>Z==V>-Z?(R=Z,Z=y[++W]):(R=V,V=A[++Q]);let J=0;if(W<B&&Q<E)for(V>Z==V>-Z?($=Z+R,G=R-($-Z),Z=y[++W]):($=V+R,G=R-($-V),V=A[++Q]),R=$,G!==0&&(N[J++]=G);W<B&&Q<E;)V>Z==V>-Z?($=R+Z,K=$-R,G=R-($-K)+(Z-K),Z=y[++W]):($=R+V,K=$-R,G=R-($-K)+(V-K),V=A[++Q]),R=$,G!==0&&(N[J++]=G);for(;W<B;)$=R+Z,K=$-R,G=R-($-K)+(Z-K),Z=y[++W],R=$,G!==0&&(N[J++]=G);for(;Q<E;)$=R+V,K=$-R,G=R-($-K)+(V-K),V=A[++Q],R=$,G!==0&&(N[J++]=G);return(R!==0||J===0)&&(N[J++]=R),J}function dt(B,y){let E=y[0];for(let A=1;A<B;A++)E+=y[A];return E}function F(B){return new Float64Array(B)}let ye=(3+16*q)*q,et=(2+12*q)*q,St=(9+64*q)*q*q,Pt=F(4),Rt=F(8),it=F(12),mt=F(16),U=F(4);function Nt(B,y,E,A,N,R,$){let G,K,Z,V,W,Q,J,wt,vt,It,At,ke,En,pn,Be,dn,Qn,We,bt=B-N,Xe=E-N,je=y-R,Ye=A-R;pn=bt*Ye,Q=C*bt,J=Q-(Q-bt),wt=bt-J,Q=C*Ye,vt=Q-(Q-Ye),It=Ye-vt,Be=wt*It-(pn-J*vt-wt*vt-J*It),dn=je*Xe,Q=C*je,J=Q-(Q-je),wt=je-J,Q=C*Xe,vt=Q-(Q-Xe),It=Xe-vt,Qn=wt*It-(dn-J*vt-wt*vt-J*It),At=Be-Qn,W=Be-At,Pt[0]=Be-(At+W)+(W-Qn),ke=pn+At,W=ke-pn,En=pn-(ke-W)+(At-W),At=En-dn,W=En-At,Pt[1]=En-(At+W)+(W-dn),We=ke+At,W=We-ke,Pt[2]=ke-(We-W)+(At-W),Pt[3]=We;let Fe=dt(4,Pt),Rr=et*$;if(Fe>=Rr||-Fe>=Rr||(W=B-bt,G=B-(bt+W)+(W-N),W=E-Xe,Z=E-(Xe+W)+(W-N),W=y-je,K=y-(je+W)+(W-R),W=A-Ye,V=A-(Ye+W)+(W-R),G===0&&K===0&&Z===0&&V===0)||(Rr=St*$+ot*Math.abs(Fe),Fe+=bt*V+Ye*G-(je*Z+Xe*K),Fe>=Rr||-Fe>=Rr))return Fe;pn=G*Ye,Q=C*G,J=Q-(Q-G),wt=G-J,Q=C*Ye,vt=Q-(Q-Ye),It=Ye-vt,Be=wt*It-(pn-J*vt-wt*vt-J*It),dn=K*Xe,Q=C*K,J=Q-(Q-K),wt=K-J,Q=C*Xe,vt=Q-(Q-Xe),It=Xe-vt,Qn=wt*It-(dn-J*vt-wt*vt-J*It),At=Be-Qn,W=Be-At,U[0]=Be-(At+W)+(W-Qn),ke=pn+At,W=ke-pn,En=pn-(ke-W)+(At-W),At=En-dn,W=En-At,U[1]=En-(At+W)+(W-dn),We=ke+At,W=We-ke,U[2]=ke-(We-W)+(At-W),U[3]=We;let ur=pt(4,Pt,4,U,Rt);pn=bt*V,Q=C*bt,J=Q-(Q-bt),wt=bt-J,Q=C*V,vt=Q-(Q-V),It=V-vt,Be=wt*It-(pn-J*vt-wt*vt-J*It),dn=je*Z,Q=C*je,J=Q-(Q-je),wt=je-J,Q=C*Z,vt=Q-(Q-Z),It=Z-vt,Qn=wt*It-(dn-J*vt-wt*vt-J*It),At=Be-Qn,W=Be-At,U[0]=Be-(At+W)+(W-Qn),ke=pn+At,W=ke-pn,En=pn-(ke-W)+(At-W),At=En-dn,W=En-At,U[1]=En-(At+W)+(W-dn),We=ke+At,W=We-ke,U[2]=ke-(We-W)+(At-W),U[3]=We;let $o=pt(ur,Rt,4,U,it);pn=G*V,Q=C*G,J=Q-(Q-G),wt=G-J,Q=C*V,vt=Q-(Q-V),It=V-vt,Be=wt*It-(pn-J*vt-wt*vt-J*It),dn=K*Z,Q=C*K,J=Q-(Q-K),wt=K-J,Q=C*Z,vt=Q-(Q-Z),It=Z-vt,Qn=wt*It-(dn-J*vt-wt*vt-J*It),At=Be-Qn,W=Be-At,U[0]=Be-(At+W)+(W-Qn),ke=pn+At,W=ke-pn,En=pn-(ke-W)+(At-W),At=En-dn,W=En-At,U[1]=En-(At+W)+(W-dn),We=ke+At,W=We-ke,U[2]=ke-(We-W)+(At-W),U[3]=We;let lr=pt($o,it,4,U,mt);return mt[lr-1]}function Mt(B,y,E,A,N,R){let $=(y-R)*(E-N),G=(B-N)*(A-R),K=$-G,Z=Math.abs($+G);return Math.abs(K)>=ye*Z?K:-Nt(B,y,E,A,N,R,Z)}let Re=(B,y)=>B.x*y.y-B.y*y.x,ut=(B,y)=>B.x*y.x+B.y*y.y,Ne=(B,y,E)=>{let A=Mt(B.x,B.y,y.x,y.y,E.x,E.y);return A>0?-1:A<0?1:0},xn=B=>Math.sqrt(ut(B,B)),qe=(B,y,E)=>{let A={x:y.x-B.x,y:y.y-B.y},N={x:E.x-B.x,y:E.y-B.y};return Re(N,A)/xn(N)/xn(A)},Ee=(B,y,E)=>{let A={x:y.x-B.x,y:y.y-B.y},N={x:E.x-B.x,y:E.y-B.y};return ut(N,A)/xn(N)/xn(A)},Le=(B,y,E)=>y.y===0?null:{x:B.x+y.x/y.y*(E-B.y),y:E},at=(B,y,E)=>y.x===0?null:{x:E,y:B.y+y.y/y.x*(E-B.x)},Kn=(B,y,E,A)=>{if(y.x===0)return at(E,A,B.x);if(A.x===0)return at(B,y,E.x);if(y.y===0)return Le(E,A,B.y);if(A.y===0)return Le(B,y,E.y);let N=Re(y,A);if(N==0)return null;let R={x:E.x-B.x,y:E.y-B.y},$=Re(R,y)/N,G=Re(R,A)/N,K=B.x+G*y.x,Z=E.x+$*A.x,V=B.y+G*y.y,W=E.y+$*A.y,Q=(K+Z)/2,J=(V+W)/2;return{x:Q,y:J}};class oe{static compare(y,E){let A=oe.comparePoints(y.point,E.point);return A!==0?A:(y.point!==E.point&&y.link(E),y.isLeft!==E.isLeft?y.isLeft?1:-1:Te.compare(y.segment,E.segment))}static comparePoints(y,E){return y.x<E.x?-1:y.x>E.x?1:y.y<E.y?-1:y.y>E.y?1:0}constructor(y,E){y.events===void 0?y.events=[this]:y.events.push(this),this.point=y,this.isLeft=E}link(y){if(y.point===this.point)throw new Error("Tried to link already linked events");let E=y.point.events;for(let A=0,N=E.length;A<N;A++){let R=E[A];this.point.events.push(R),R.point=this.point}this.checkForConsuming()}checkForConsuming(){let y=this.point.events.length;for(let E=0;E<y;E++){let A=this.point.events[E];if(A.segment.consumedBy===void 0)for(let N=E+1;N<y;N++){let R=this.point.events[N];R.consumedBy===void 0&&A.otherSE.point.events===R.otherSE.point.events&&A.segment.consume(R.segment)}}}getAvailableLinkedEvents(){let y=[];for(let E=0,A=this.point.events.length;E<A;E++){let N=this.point.events[E];N!==this&&!N.segment.ringOut&&N.segment.isInResult()&&y.push(N)}return y}getLeftmostComparator(y){let E=new Map,A=N=>{let R=N.otherSE;E.set(N,{sine:qe(this.point,y.point,R.point),cosine:Ee(this.point,y.point,R.point)})};return(N,R)=>{E.has(N)||A(N),E.has(R)||A(R);let{sine:$,cosine:G}=E.get(N),{sine:K,cosine:Z}=E.get(R);return $>=0&&K>=0?G<Z?1:G>Z?-1:0:$<0&&K<0?G<Z?-1:G>Z?1:0:K<$?-1:K>$?1:0}}}let Fn=0;class Te{static compare(y,E){let A=y.leftSE.point.x,N=E.leftSE.point.x,R=y.rightSE.point.x,$=E.rightSE.point.x;if($<A)return 1;if(R<N)return-1;let G=y.leftSE.point.y,K=E.leftSE.point.y,Z=y.rightSE.point.y,V=E.rightSE.point.y;if(A<N){if(K<G&&K<Z)return 1;if(K>G&&K>Z)return-1;let W=y.comparePoint(E.leftSE.point);if(W<0)return 1;if(W>0)return-1;let Q=E.comparePoint(y.rightSE.point);return Q!==0?Q:-1}if(A>N){if(G<K&&G<V)return-1;if(G>K&&G>V)return 1;let W=E.comparePoint(y.leftSE.point);if(W!==0)return W;let Q=y.comparePoint(E.rightSE.point);return Q<0?1:Q>0?-1:1}if(G<K)return-1;if(G>K)return 1;if(R<$){let W=E.comparePoint(y.rightSE.point);if(W!==0)return W}if(R>$){let W=y.comparePoint(E.rightSE.point);if(W<0)return 1;if(W>0)return-1}if(R!==$){let W=Z-G,Q=R-A,J=V-K,wt=$-N;if(W>Q&&J<wt)return 1;if(W<Q&&J>wt)return-1}return R>$?1:R<$||Z<V?-1:Z>V?1:y.id<E.id?-1:y.id>E.id?1:0}constructor(y,E,A,N){this.id=++Fn,this.leftSE=y,y.segment=this,y.otherSE=E,this.rightSE=E,E.segment=this,E.otherSE=y,this.rings=A,this.windings=N}static fromRing(y,E,A){let N,R,$,G=oe.comparePoints(y,E);if(G<0)N=y,R=E,$=1;else if(G>0)N=E,R=y,$=-1;else throw new Error(`Tried to create degenerate segment at [${y.x}, ${y.y}]`);let K=new oe(N,!0),Z=new oe(R,!1);return new Te(K,Z,[A],[$])}replaceRightSE(y){this.rightSE=y,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let y=this.leftSE.point.y,E=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:y<E?y:E},ur:{x:this.rightSE.point.x,y:y>E?y:E}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(y){return y.x===this.leftSE.point.x&&y.y===this.leftSE.point.y||y.x===this.rightSE.point.x&&y.y===this.rightSE.point.y}comparePoint(y){if(this.isAnEndpoint(y))return 0;let E=this.leftSE.point,A=this.rightSE.point,N=this.vector();if(E.x===A.x)return y.x===E.x?0:y.x<E.x?1:-1;let R=(y.y-E.y)/N.y,$=E.x+R*N.x;if(y.x===$)return 0;let G=(y.x-E.x)/N.x,K=E.y+G*N.y;return y.y===K?0:y.y<K?-1:1}getIntersection(y){let E=this.bbox(),A=y.bbox(),N=b(E,A);if(N===null)return null;let R=this.leftSE.point,$=this.rightSE.point,G=y.leftSE.point,K=y.rightSE.point,Z=D(E,G)&&this.comparePoint(G)===0,V=D(A,R)&&y.comparePoint(R)===0,W=D(E,K)&&this.comparePoint(K)===0,Q=D(A,$)&&y.comparePoint($)===0;if(V&&Z)return Q&&!W?$:!Q&&W?K:null;if(V)return W&&R.x===K.x&&R.y===K.y?null:R;if(Z)return Q&&$.x===G.x&&$.y===G.y?null:G;if(Q&&W)return null;if(Q)return $;if(W)return K;let J=Kn(R,this.vector(),G,y.vector());return J===null||!D(N,J)?null:Y.round(J.x,J.y)}split(y){let E=[],A=y.events!==void 0,N=new oe(y,!0),R=new oe(y,!1),$=this.rightSE;this.replaceRightSE(R),E.push(R),E.push(N);let G=new Te(N,$,this.rings.slice(),this.windings.slice());return oe.comparePoints(G.leftSE.point,G.rightSE.point)>0&&G.swapEvents(),oe.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),A&&(N.checkForConsuming(),R.checkForConsuming()),E}swapEvents(){let y=this.rightSE;this.rightSE=this.leftSE,this.leftSE=y,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let E=0,A=this.windings.length;E<A;E++)this.windings[E]*=-1}consume(y){let E=this,A=y;for(;E.consumedBy;)E=E.consumedBy;for(;A.consumedBy;)A=A.consumedBy;let N=Te.compare(E,A);if(N!==0){if(N>0){let R=E;E=A,A=R}if(E.prev===A){let R=E;E=A,A=R}for(let R=0,$=A.rings.length;R<$;R++){let G=A.rings[R],K=A.windings[R],Z=E.rings.indexOf(G);Z===-1?(E.rings.push(G),E.windings.push(K)):E.windings[Z]+=K}A.rings=null,A.windings=null,A.consumedBy=E,A.leftSE.consumedBy=E.leftSE,A.rightSE.consumedBy=E.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 y=this.prev.consumedBy||this.prev;this._beforeState=y.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let y=this.beforeState();this._afterState={rings:y.rings.slice(0),windings:y.windings.slice(0),multiPolys:[]};let E=this._afterState.rings,A=this._afterState.windings,N=this._afterState.multiPolys;for(let G=0,K=this.rings.length;G<K;G++){let Z=this.rings[G],V=this.windings[G],W=E.indexOf(Z);W===-1?(E.push(Z),A.push(V)):A[W]+=V}let R=[],$=[];for(let G=0,K=E.length;G<K;G++){if(A[G]===0)continue;let Z=E[G],V=Z.poly;if($.indexOf(V)===-1)if(Z.isExterior)R.push(V);else{$.indexOf(V)===-1&&$.push(V);let W=R.indexOf(Z.poly);W!==-1&&R.splice(W,1)}}for(let G=0,K=R.length;G<K;G++){let Z=R[G].multiPoly;N.indexOf(Z)===-1&&N.push(Z)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let y=this.beforeState().multiPolys,E=this.afterState().multiPolys;switch(tt.type){case"union":{let A=y.length===0,N=E.length===0;this._isInResult=A!==N;break}case"intersection":{let A,N;y.length<E.length?(A=y.length,N=E.length):(A=E.length,N=y.length),this._isInResult=N===tt.numMultiPolys&&A<N;break}case"xor":{let A=Math.abs(y.length-E.length);this._isInResult=A%2===1;break}case"difference":{let A=N=>N.length===1&&N[0].isSubject;this._isInResult=A(y)!==A(E);break}default:throw new Error(`Unrecognized operation type found ${tt.type}`)}return this._isInResult}}class gn{constructor(y,E,A){if(!Array.isArray(y)||y.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=E,this.isExterior=A,this.segments=[],typeof y[0][0]!="number"||typeof y[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let N=Y.round(y[0][0],y[0][1]);this.bbox={ll:{x:N.x,y:N.y},ur:{x:N.x,y:N.y}};let R=N;for(let $=1,G=y.length;$<G;$++){if(typeof y[$][0]!="number"||typeof y[$][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let K=Y.round(y[$][0],y[$][1]);K.x===R.x&&K.y===R.y||(this.segments.push(Te.fromRing(R,K,this)),K.x<this.bbox.ll.x&&(this.bbox.ll.x=K.x),K.y<this.bbox.ll.y&&(this.bbox.ll.y=K.y),K.x>this.bbox.ur.x&&(this.bbox.ur.x=K.x),K.y>this.bbox.ur.y&&(this.bbox.ur.y=K.y),R=K)}(N.x!==R.x||N.y!==R.y)&&this.segments.push(Te.fromRing(R,N,this))}getSweepEvents(){let y=[];for(let E=0,A=this.segments.length;E<A;E++){let N=this.segments[E];y.push(N.leftSE),y.push(N.rightSE)}return y}}class Qe{constructor(y,E){if(!Array.isArray(y))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new gn(y[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 A=1,N=y.length;A<N;A++){let R=new gn(y[A],this,!1);R.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=R.bbox.ll.x),R.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=R.bbox.ll.y),R.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=R.bbox.ur.x),R.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=R.bbox.ur.y),this.interiorRings.push(R)}this.multiPoly=E}getSweepEvents(){let y=this.exteriorRing.getSweepEvents();for(let E=0,A=this.interiorRings.length;E<A;E++){let N=this.interiorRings[E].getSweepEvents();for(let R=0,$=N.length;R<$;R++)y.push(N[R])}return y}}class Cn{constructor(y,E){if(!Array.isArray(y))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof y[0][0][0]=="number"&&(y=[y])}catch(A){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let A=0,N=y.length;A<N;A++){let R=new Qe(y[A],this);R.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=R.bbox.ll.x),R.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=R.bbox.ll.y),R.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=R.bbox.ur.x),R.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=R.bbox.ur.y),this.polys.push(R)}this.isSubject=E}getSweepEvents(){let y=[];for(let E=0,A=this.polys.length;E<A;E++){let N=this.polys[E].getSweepEvents();for(let R=0,$=N.length;R<$;R++)y.push(N[R])}return y}}class ai{static factory(y){let E=[];for(let A=0,N=y.length;A<N;A++){let R=y[A];if(!R.isInResult()||R.ringOut)continue;let $=null,G=R.leftSE,K=R.rightSE,Z=[G],V=G.point,W=[];for(;$=G,G=K,Z.push(G),G.point!==V;)for(;;){let Q=G.getAvailableLinkedEvents();if(Q.length===0){let vt=Z[0].point,It=Z[Z.length-1].point;throw new Error(`Unable to complete output ring starting at [${vt.x}, ${vt.y}]. Last matching segment found ends at [${It.x}, ${It.y}].`)}if(Q.length===1){K=Q[0].otherSE;break}let J=null;for(let vt=0,It=W.length;vt<It;vt++)if(W[vt].point===G.point){J=vt;break}if(J!==null){let vt=W.splice(J)[0],It=Z.splice(vt.index);It.unshift(It[0].otherSE),E.push(new ai(It.reverse()));continue}W.push({index:Z.length,point:G.point});let wt=G.getLeftmostComparator($);K=Q.sort(wt)[0].otherSE;break}E.push(new ai(Z))}return E}constructor(y){this.events=y;for(let E=0,A=y.length;E<A;E++)y[E].segment.ringOut=this;this.poly=null}getGeom(){let y=this.events[0].point,E=[y];for(let Z=1,V=this.events.length-1;Z<V;Z++){let W=this.events[Z].point,Q=this.events[Z+1].point;Ne(W,y,Q)!==0&&(E.push(W),y=W)}if(E.length===1)return null;let A=E[0],N=E[1];Ne(A,y,N)===0&&E.shift(),E.push(E[0]);let R=this.isExteriorRing()?1:-1,$=this.isExteriorRing()?0:E.length-1,G=this.isExteriorRing()?E.length:-1,K=[];for(let Z=$;Z!=G;Z+=R)K.push([E[Z].x,E[Z].y]);return K}isExteriorRing(){if(this._isExteriorRing===void 0){let y=this.enclosingRing();this._isExteriorRing=y?!y.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let y=this.events[0];for(let N=1,R=this.events.length;N<R;N++){let $=this.events[N];oe.compare(y,$)>0&&(y=$)}let E=y.segment.prevInResult(),A=E?E.prevInResult():null;for(;;){if(!E)return null;if(!A)return E.ringOut;if(A.ringOut!==E.ringOut)return A.ringOut.enclosingRing()!==E.ringOut?E.ringOut:E.ringOut.enclosingRing();E=A.prevInResult(),A=E?E.prevInResult():null}}}class _t{constructor(y){this.exteriorRing=y,y.poly=this,this.interiorRings=[]}addInterior(y){this.interiorRings.push(y),y.poly=this}getGeom(){let y=[this.exteriorRing.getGeom()];if(y[0]===null)return null;for(let E=0,A=this.interiorRings.length;E<A;E++){let N=this.interiorRings[E].getGeom();N!==null&&y.push(N)}return y}}class Ce{constructor(y){this.rings=y,this.polys=this._composePolys(y)}getGeom(){let y=[];for(let E=0,A=this.polys.length;E<A;E++){let N=this.polys[E].getGeom();N!==null&&y.push(N)}return y}_composePolys(y){let E=[];for(let A=0,N=y.length;A<N;A++){let R=y[A];if(!R.poly)if(R.isExteriorRing())E.push(new _t(R));else{let $=R.enclosingRing();$.poly||E.push(new _t($)),$.poly.addInterior(R)}}return E}}class ui{constructor(y){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Te.compare;this.queue=y,this.tree=new d(E),this.segments=[]}process(y){let E=y.segment,A=[];if(y.consumedBy)return y.isLeft?this.queue.remove(y.otherSE):this.tree.remove(E),A;let N=y.isLeft?this.tree.add(E):this.tree.find(E);if(!N)throw new Error(`Unable to find segment #${E.id} [${E.leftSE.point.x}, ${E.leftSE.point.y}] -> [${E.rightSE.point.x}, ${E.rightSE.point.y}] in SweepLine tree.`);let R=N,$=N,G,K;for(;G===void 0;)R=this.tree.prev(R),R===null?G=null:R.key.consumedBy===void 0&&(G=R.key);for(;K===void 0;)$=this.tree.next($),$===null?K=null:$.key.consumedBy===void 0&&(K=$.key);if(y.isLeft){let Z=null;if(G){let W=G.getIntersection(E);if(W!==null&&(E.isAnEndpoint(W)||(Z=W),!G.isAnEndpoint(W))){let Q=this._splitSafely(G,W);for(let J=0,wt=Q.length;J<wt;J++)A.push(Q[J])}}let V=null;if(K){let W=K.getIntersection(E);if(W!==null&&(E.isAnEndpoint(W)||(V=W),!K.isAnEndpoint(W))){let Q=this._splitSafely(K,W);for(let J=0,wt=Q.length;J<wt;J++)A.push(Q[J])}}if(Z!==null||V!==null){let W=null;Z===null?W=V:V===null?W=Z:W=oe.comparePoints(Z,V)<=0?Z:V,this.queue.remove(E.rightSE),A.push(E.rightSE);let Q=E.split(W);for(let J=0,wt=Q.length;J<wt;J++)A.push(Q[J])}A.length>0?(this.tree.remove(E),A.push(y)):(this.segments.push(E),E.prev=G)}else{if(G&&K){let Z=G.getIntersection(K);if(Z!==null){if(!G.isAnEndpoint(Z)){let V=this._splitSafely(G,Z);for(let W=0,Q=V.length;W<Q;W++)A.push(V[W])}if(!K.isAnEndpoint(Z)){let V=this._splitSafely(K,Z);for(let W=0,Q=V.length;W<Q;W++)A.push(V[W])}}}this.tree.remove(E)}return A}_splitSafely(y,E){this.tree.remove(y);let A=y.rightSE;this.queue.remove(A);let N=y.split(E);return N.push(A),y.consumedBy===void 0&&this.tree.add(y),N}}let Pr=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,$r=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Un{run(y,E,A){tt.type=y,Y.reset();let N=[new Cn(E,!0)];for(let W=0,Q=A.length;W<Q;W++)N.push(new Cn(A[W],!1));if(tt.numMultiPolys=N.length,tt.type==="difference"){let W=N[0],Q=1;for(;Q<N.length;)b(N[Q].bbox,W.bbox)!==null?Q++:N.splice(Q,1)}if(tt.type==="intersection")for(let W=0,Q=N.length;W<Q;W++){let J=N[W];for(let wt=W+1,vt=N.length;wt<vt;wt++)if(b(J.bbox,N[wt].bbox)===null)return[]}let R=new d(oe.compare);for(let W=0,Q=N.length;W<Q;W++){let J=N[W].getSweepEvents();for(let wt=0,vt=J.length;wt<vt;wt++)if(R.insert(J[wt]),R.size>Pr)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let $=new ui(R),G=R.size,K=R.pop();for(;K;){let W=K.key;if(R.size===G){let J=W.segment;throw new Error(`Unable to pop() ${W.isLeft?"left":"right"} SweepEvent [${W.point.x}, ${W.point.y}] from segment #${J.id} [${J.leftSE.point.x}, ${J.leftSE.point.y}] -> [${J.rightSE.point.x}, ${J.rightSE.point.y}] from queue.`)}if(R.size>Pr)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if($.segments.length>$r)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let Q=$.process(W);for(let J=0,wt=Q.length;J<wt;J++){let vt=Q[J];vt.consumedBy===void 0&&R.insert(vt)}G=R.size,K=R.pop()}Y.reset();let Z=ai.factory($.segments);return new Ce(Z).getGeom()}}let tt=new Un;var Us={union:function(B){for(var y=arguments.length,E=new Array(y>1?y-1:0),A=1;A<y;A++)E[A-1]=arguments[A];return tt.run("union",B,E)},intersection:function(B){for(var y=arguments.length,E=new Array(y>1?y-1:0),A=1;A<y;A++)E[A-1]=arguments[A];return tt.run("intersection",B,E)},xor:function(B){for(var y=arguments.length,E=new Array(y>1?y-1:0),A=1;A<y;A++)E[A-1]=arguments[A];return tt.run("xor",B,E)},difference:function(B){for(var y=arguments.length,E=new Array(y>1?y-1:0),A=1;A<y;A++)E[A-1]=arguments[A];return tt.run("difference",B,E)}};return Us})});var Yg=ct((zu,Xg)=>{(function(o,e){typeof zu=="object"&&typeof Xg!="undefined"?e(zu):typeof define=="function"&&define.amd?define(["exports"],e):e(o.jsts={})})(zu,function(o){"use strict";function e(){}function r(t){this.message=t||""}function a(t){this.message=t||""}function u(t){this.message=t||""}function c(){}function h(t){return t===null?Be:t.color}function p(t){return t===null?null:t.parent}function d(t,n){t!==null&&(t.color=n)}function g(t){return t===null?null:t.left}function v(t){return t===null?null:t.right}function x(){this.root_=null,this.size_=0}function M(){}function w(){this.array_=[],arguments[0]instanceof G&&this.addAll(arguments[0])}function I(){}function D(t){this.message=t||""}function b(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var n=Object(this),i=Math.max(Math.min(n.length,9007199254740991),0)||0,s=1 in arguments&&parseInt(Number(arguments[1]),10)||0;s=s<0?Math.max(i+s,0):Math.min(s,i);var l=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:i;for(l=l<0?Math.max(i+arguments[2],0):Math.min(l,i);s<l;)n[s]=t,++s;return n},writable:!0}),Number.isFinite=Number.isFinite||function(t){return typeof t=="number"&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var T=function(){};T.prototype.interfaces_=function(){return[]},T.prototype.getClass=function(){return T},T.prototype.equalsWithTolerance=function(t,n,i){return Math.abs(t-n)<=i};var L=function(t){function n(i){t.call(this,i),this.name="IllegalArgumentException",this.message=i,this.stack=new t().stack}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n}(Error),P=function(){},z={MAX_VALUE:{configurable:!0}};P.isNaN=function(t){return Number.isNaN(t)},P.doubleToLongBits=function(t){return t},P.longBitsToDouble=function(t){return t},P.isInfinite=function(t){return!Number.isFinite(t)},z.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(P,z);var k=function(){},Y=function(){},q=function(){},C=function t(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(arguments.length===1){var n=arguments[0];this.x=n.x,this.y=n.y,this.z=n.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},ot={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};C.prototype.setOrdinate=function(t,n){switch(t){case C.X:this.x=n;break;case C.Y:this.y=n;break;case C.Z:this.z=n;break;default:throw new L("Invalid ordinate index: "+t)}},C.prototype.equals2D=function(){if(arguments.length===1){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(arguments.length===2){var n=arguments[0],i=arguments[1];return!!T.equalsWithTolerance(this.x,n.x,i)&&!!T.equalsWithTolerance(this.y,n.y,i)}},C.prototype.getOrdinate=function(t){switch(t){case C.X:return this.x;case C.Y:return this.y;case C.Z:return this.z}throw new L("Invalid ordinate index: "+t)},C.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||P.isNaN(this.z))&&P.isNaN(t.z)},C.prototype.equals=function(t){return t instanceof C&&this.equals2D(t)},C.prototype.equalInZ=function(t,n){return T.equalsWithTolerance(this.z,t.z,n)},C.prototype.compareTo=function(t){var n=t;return this.x<n.x?-1:this.x>n.x?1:this.y<n.y?-1:this.y>n.y?1:0},C.prototype.clone=function(){},C.prototype.copy=function(){return new C(this)},C.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},C.prototype.distance3D=function(t){var n=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return Math.sqrt(n*n+i*i+s*s)},C.prototype.distance=function(t){var n=this.x-t.x,i=this.y-t.y;return Math.sqrt(n*n+i*i)},C.prototype.hashCode=function(){var t=17;return t=37*t+C.hashCode(this.x),t=37*t+C.hashCode(this.y)},C.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},C.prototype.interfaces_=function(){return[k,Y,e]},C.prototype.getClass=function(){return C},C.hashCode=function(){if(arguments.length===1){var t=arguments[0],n=P.doubleToLongBits(t);return Math.trunc((n^n)>>>32)}},ot.DimensionalComparator.get=function(){return pt},ot.serialVersionUID.get=function(){return 6683108902428367e3},ot.NULL_ORDINATE.get=function(){return P.NaN},ot.X.get=function(){return 0},ot.Y.get=function(){return 1},ot.Z.get=function(){return 2},Object.defineProperties(C,ot);var pt=function(t){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var n=arguments[0];if(n!==2&&n!==3)throw new L("only 2 or 3 dimensions may be specified");this._dimensionsToTest=n}}};pt.prototype.compare=function(t,n){var i=t,s=n,l=pt.compare(i.x,s.x);if(l!==0)return l;var f=pt.compare(i.y,s.y);return f!==0?f:this._dimensionsToTest<=2?0:pt.compare(i.z,s.z)},pt.prototype.interfaces_=function(){return[q]},pt.prototype.getClass=function(){return pt},pt.compare=function(t,n){return t<n?-1:t>n?1:P.isNaN(t)?P.isNaN(n)?0:-1:P.isNaN(n)?1:0};var dt=function(){};dt.prototype.create=function(){},dt.prototype.interfaces_=function(){return[]},dt.prototype.getClass=function(){return dt};var F=function(){},ye={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};F.prototype.interfaces_=function(){return[]},F.prototype.getClass=function(){return F},F.toLocationSymbol=function(t){switch(t){case F.EXTERIOR:return"e";case F.BOUNDARY:return"b";case F.INTERIOR:return"i";case F.NONE:return"-"}throw new L("Unknown location value: "+t)},ye.INTERIOR.get=function(){return 0},ye.BOUNDARY.get=function(){return 1},ye.EXTERIOR.get=function(){return 2},ye.NONE.get=function(){return-1},Object.defineProperties(F,ye);var et=function(t,n){return t.interfaces_&&t.interfaces_().indexOf(n)>-1},St=function(){},Pt={LOG_10:{configurable:!0}};St.prototype.interfaces_=function(){return[]},St.prototype.getClass=function(){return St},St.log10=function(t){var n=Math.log(t);return P.isInfinite(n)||P.isNaN(n)?n:n/St.LOG_10},St.min=function(t,n,i,s){var l=t;return n<l&&(l=n),i<l&&(l=i),s<l&&(l=s),l},St.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1],i=arguments[2];return t<n?n:t>i?i:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var s=arguments[0],l=arguments[1],f=arguments[2];return s<l?l:s>f?f:s}},St.wrap=function(t,n){return t<0?n- -t%n:t%n},St.max=function(){if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2],s=t;return n>s&&(s=n),i>s&&(s=i),s}if(arguments.length===4){var l=arguments[0],f=arguments[1],m=arguments[2],_=arguments[3],S=l;return f>S&&(S=f),m>S&&(S=m),_>S&&(S=_),S}},St.average=function(t,n){return(t+n)/2},Pt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(St,Pt);var Rt=function(t){this.str=t};Rt.prototype.append=function(t){this.str+=t},Rt.prototype.setCharAt=function(t,n){this.str=this.str.substr(0,t)+n+this.str.substr(t+1)},Rt.prototype.toString=function(t){return this.str};var it=function(t){this.value=t};it.prototype.intValue=function(){return this.value},it.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},it.isNaN=function(t){return Number.isNaN(t)};var mt=function(){};mt.isWhitespace=function(t){return t<=32&&t>=0||t===127},mt.toUpperCase=function(t){return t.toUpperCase()};var U=function t(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this.init(n)}else if(arguments[0]instanceof t){var i=arguments[0];this.init(i)}else if(typeof arguments[0]=="string"){var s=arguments[0];t.call(this,t.parse(s))}}else if(arguments.length===2){var l=arguments[0],f=arguments[1];this.init(l,f)}},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}};U.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},U.prototype.extractSignificantDigits=function(t,n){var i=this.abs(),s=U.magnitude(i._hi),l=U.TEN.pow(s);(i=i.divide(l)).gt(U.TEN)?(i=i.divide(U.TEN),s+=1):i.lt(U.ONE)&&(i=i.multiply(U.TEN),s-=1);for(var f=s+1,m=new Rt,_=U.MAX_PRINT_DIGITS-1,S=0;S<=_;S++){t&&S===f&&m.append(".");var O=Math.trunc(i._hi);if(O<0)break;var H=!1,X=0;O>9?(H=!0,X="9"):X="0"+O,m.append(X),i=i.subtract(U.valueOf(O)).multiply(U.TEN),H&&i.selfAdd(U.TEN);var nt=!0,rt=U.magnitude(i._hi);if(rt<0&&Math.abs(rt)>=_-S&&(nt=!1),!nt)break}return n[0]=s,m.toString()},U.prototype.sqr=function(){return this.multiply(this)},U.prototype.doubleValue=function(){return this._hi+this._lo},U.prototype.subtract=function(){if(arguments[0]instanceof U){var t=arguments[0];return this.add(t.negate())}if(typeof arguments[0]=="number"){var n=arguments[0];return this.add(-n)}},U.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},U.prototype.isZero=function(){return this._hi===0&&this._lo===0},U.prototype.selfSubtract=function(){if(arguments[0]instanceof U){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if(typeof arguments[0]=="number"){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n,0)}},U.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},U.prototype.min=function(t){return this.le(t)?this:t},U.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if(typeof arguments[0]=="number"){var n=arguments[0];return this.selfDivide(n,0)}}else if(arguments.length===2){var i=arguments[0],s=arguments[1],l=null,f=null,m=null,_=null,S=null,O=null,H=null,X=null;return S=this._hi/i,O=U.SPLIT*S,l=O-S,X=U.SPLIT*i,l=O-l,f=S-l,m=X-i,H=S*i,m=X-m,_=i-m,X=l*m-H+l*_+f*m+f*_,O=(this._hi-H-X+this._lo-S*s)/i,X=S+O,this._hi=X,this._lo=S-X+O,this}},U.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},U.prototype.divide=function(){if(arguments[0]instanceof U){var t=arguments[0],n=null,i=null,s=null,l=null,f=null,m=null,_=null,S=null;return i=(f=this._hi/t._hi)-(n=(m=U.SPLIT*f)-(n=m-f)),S=n*(s=(S=U.SPLIT*t._hi)-(s=S-t._hi))-(_=f*t._hi)+n*(l=t._hi-s)+i*s+i*l,m=(this._hi-_-S+this._lo-f*t._lo)/t._hi,new U(S=f+m,f-S+m)}if(typeof arguments[0]=="number"){var O=arguments[0];return P.isNaN(O)?U.createNaN():U.copy(this).selfDivide(O,0)}},U.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},U.prototype.pow=function(t){if(t===0)return U.valueOf(1);var n=new U(this),i=U.valueOf(1),s=Math.abs(t);if(s>1)for(;s>0;)s%2==1&&i.selfMultiply(n),(s/=2)>0&&(n=n.sqr());else i=n;return t<0?i.reciprocal():i},U.prototype.ceil=function(){if(this.isNaN())return U.NaN;var t=Math.ceil(this._hi),n=0;return t===this._hi&&(n=Math.ceil(this._lo)),new U(t,n)},U.prototype.compareTo=function(t){var n=t;return this._hi<n._hi?-1:this._hi>n._hi?1:this._lo<n._lo?-1:this._lo>n._lo?1:0},U.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},U.prototype.setValue=function(){if(arguments[0]instanceof U){var t=arguments[0];return this.init(t),this}if(typeof arguments[0]=="number"){var n=arguments[0];return this.init(n),this}},U.prototype.max=function(t){return this.ge(t)?this:t},U.prototype.sqrt=function(){if(this.isZero())return U.valueOf(0);if(this.isNegative())return U.NaN;var t=1/Math.sqrt(this._hi),n=this._hi*t,i=U.valueOf(n),s=this.subtract(i.sqr())._hi*(.5*t);return i.add(s)},U.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if(typeof arguments[0]=="number"){var n=arguments[0],i=null,s=null,l=null,f=null,m=null,_=null;return l=this._hi+n,m=l-this._hi,f=l-m,f=n-m+(this._hi-f),_=f+this._lo,i=l+_,s=_+(l-i),this._hi=i+s,this._lo=s+(i-this._hi),this}}else if(arguments.length===2){var S=arguments[0],O=arguments[1],H=null,X=null,nt=null,rt=null,lt=null,gt=null,we=null;rt=this._hi+S,X=this._lo+O,lt=rt-(gt=rt-this._hi),nt=X-(we=X-this._lo);var rn=(H=rt+(gt=(lt=S-gt+(this._hi-lt))+X))+(gt=(nt=O-we+(this._lo-nt))+(gt+(rt-H))),Wn=gt+(H-rn);return this._hi=rn,this._lo=Wn,this}},U.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if(typeof arguments[0]=="number"){var n=arguments[0];return this.selfMultiply(n,0)}}else if(arguments.length===2){var i=arguments[0],s=arguments[1],l=null,f=null,m=null,_=null,S=null,O=null;l=(S=U.SPLIT*this._hi)-this._hi,O=U.SPLIT*i,l=S-l,f=this._hi-l,m=O-i;var H=(S=this._hi*i)+(O=l*(m=O-m)-S+l*(_=i-m)+f*m+f*_+(this._hi*s+this._lo*i)),X=O+(l=S-H);return this._hi=H,this._lo=X,this}},U.prototype.selfSqr=function(){return this.selfMultiply(this)},U.prototype.floor=function(){if(this.isNaN())return U.NaN;var t=Math.floor(this._hi),n=0;return t===this._hi&&(n=Math.floor(this._lo)),new U(t,n)},U.prototype.negate=function(){return this.isNaN()?this:new U(-this._hi,-this._lo)},U.prototype.clone=function(){},U.prototype.multiply=function(){if(arguments[0]instanceof U){var t=arguments[0];return t.isNaN()?U.createNaN():U.copy(this).selfMultiply(t)}if(typeof arguments[0]=="number"){var n=arguments[0];return P.isNaN(n)?U.createNaN():U.copy(this).selfMultiply(n,0)}},U.prototype.isNaN=function(){return P.isNaN(this._hi)},U.prototype.intValue=function(){return Math.trunc(this._hi)},U.prototype.toString=function(){var t=U.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},U.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var n=new Array(1).fill(null),i=this.extractSignificantDigits(!0,n),s=n[0]+1,l=i;if(i.charAt(0)===".")l="0"+i;else if(s<0)l="0."+U.stringOfChar("0",-s)+i;else if(i.indexOf(".")===-1){var f=s-i.length;l=i+U.stringOfChar("0",f)+".0"}return this.isNegative()?"-"+l:l},U.prototype.reciprocal=function(){var t=null,n=null,i=null,s=null,l=null,f=null,m=null,_=null;n=(l=1/this._hi)-(t=(f=U.SPLIT*l)-(t=f-l)),i=(_=U.SPLIT*this._hi)-this._hi;var S=l+(f=(1-(m=l*this._hi)-(_=t*(i=_-i)-m+t*(s=this._hi-i)+n*i+n*s)-l*this._lo)/this._hi);return new U(S,l-S+f)},U.prototype.toSciNotation=function(){if(this.isZero())return U.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var n=new Array(1).fill(null),i=this.extractSignificantDigits(!1,n),s=U.SCI_NOT_EXPONENT_CHAR+n[0];if(i.charAt(0)==="0")throw new Error("Found leading zero: "+i);var l="";i.length>1&&(l=i.substring(1));var f=i.charAt(0)+"."+l;return this.isNegative()?"-"+f+s:f+s},U.prototype.abs=function(){return this.isNaN()?U.NaN:this.isNegative()?this.negate():new U(this)},U.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},U.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},U.prototype.add=function(){if(arguments[0]instanceof U){var t=arguments[0];return U.copy(this).selfAdd(t)}if(typeof arguments[0]=="number"){var n=arguments[0];return U.copy(this).selfAdd(n)}},U.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof U){var n=arguments[0];this._hi=n._hi,this._lo=n._lo}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._hi=i,this._lo=s}},U.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},U.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},U.prototype.trunc=function(){return this.isNaN()?U.NaN:this.isPositive()?this.floor():this.ceil()},U.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},U.prototype.interfaces_=function(){return[e,k,Y]},U.prototype.getClass=function(){return U},U.sqr=function(t){return U.valueOf(t).selfMultiply(t)},U.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return U.parse(t)}if(typeof arguments[0]=="number"){var n=arguments[0];return new U(n)}},U.sqrt=function(t){return U.valueOf(t).sqrt()},U.parse=function(t){for(var n=0,i=t.length;mt.isWhitespace(t.charAt(n));)n++;var s=!1;if(n<i){var l=t.charAt(n);l!=="-"&&l!=="+"||(n++,l==="-"&&(s=!0))}for(var f=new U,m=0,_=0,S=0;!(n>=i);){var O=t.charAt(n);if(n++,mt.isDigit(O)){var H=O-"0";f.selfMultiply(U.TEN),f.selfAdd(H),m++}else{if(O!=="."){if(O==="e"||O==="E"){var X=t.substring(n);try{S=it.parseInt(X)}catch(we){throw we instanceof Error?new Error("Invalid exponent "+X+" in string "+t):we}break}throw new Error("Unexpected character \'"+O+"\' at position "+n+" in string "+t)}_=m}}var nt=f,rt=m-_-S;if(rt===0)nt=f;else if(rt>0){var lt=U.TEN.pow(rt);nt=f.divide(lt)}else if(rt<0){var gt=U.TEN.pow(-rt);nt=f.multiply(gt)}return s?nt.negate():nt},U.createNaN=function(){return new U(P.NaN,P.NaN)},U.copy=function(t){return new U(t)},U.magnitude=function(t){var n=Math.abs(t),i=Math.log(n)/Math.log(10),s=Math.trunc(Math.floor(i));return 10*Math.pow(10,s)<=n&&(s+=1),s},U.stringOfChar=function(t,n){for(var i=new Rt,s=0;s<n;s++)i.append(t);return i.toString()},Nt.PI.get=function(){return new U(3.141592653589793,12246467991473532e-32)},Nt.TWO_PI.get=function(){return new U(6.283185307179586,24492935982947064e-32)},Nt.PI_2.get=function(){return new U(1.5707963267948966,6123233995736766e-32)},Nt.E.get=function(){return new U(2.718281828459045,14456468917292502e-32)},Nt.NaN.get=function(){return new U(P.NaN,P.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 U.valueOf(10)},Nt.ONE.get=function(){return U.valueOf(1)},Nt.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},Nt.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(U,Nt);var Mt=function(){},Re={DP_SAFE_EPSILON:{configurable:!0}};Mt.prototype.interfaces_=function(){return[]},Mt.prototype.getClass=function(){return Mt},Mt.orientationIndex=function(t,n,i){var s=Mt.orientationIndexFilter(t,n,i);if(s<=1)return s;var l=U.valueOf(n.x).selfAdd(-t.x),f=U.valueOf(n.y).selfAdd(-t.y),m=U.valueOf(i.x).selfAdd(-n.x),_=U.valueOf(i.y).selfAdd(-n.y);return l.selfMultiply(_).selfSubtract(f.selfMultiply(m)).signum()},Mt.signOfDet2x2=function(t,n,i,s){return t.multiply(s).selfSubtract(n.multiply(i)).signum()},Mt.intersection=function(t,n,i,s){var l=U.valueOf(s.y).selfSubtract(i.y).selfMultiply(U.valueOf(n.x).selfSubtract(t.x)),f=U.valueOf(s.x).selfSubtract(i.x).selfMultiply(U.valueOf(n.y).selfSubtract(t.y)),m=l.subtract(f),_=U.valueOf(s.x).selfSubtract(i.x).selfMultiply(U.valueOf(t.y).selfSubtract(i.y)),S=U.valueOf(s.y).selfSubtract(i.y).selfMultiply(U.valueOf(t.x).selfSubtract(i.x)),O=_.subtract(S).selfDivide(m).doubleValue(),H=U.valueOf(t.x).selfAdd(U.valueOf(n.x).selfSubtract(t.x).selfMultiply(O)).doubleValue(),X=U.valueOf(n.x).selfSubtract(t.x).selfMultiply(U.valueOf(t.y).selfSubtract(i.y)),nt=U.valueOf(n.y).selfSubtract(t.y).selfMultiply(U.valueOf(t.x).selfSubtract(i.x)),rt=X.subtract(nt).selfDivide(m).doubleValue(),lt=U.valueOf(i.y).selfAdd(U.valueOf(s.y).selfSubtract(i.y).selfMultiply(rt)).doubleValue();return new C(H,lt)},Mt.orientationIndexFilter=function(t,n,i){var s=null,l=(t.x-i.x)*(n.y-i.y),f=(t.y-i.y)*(n.x-i.x),m=l-f;if(l>0){if(f<=0)return Mt.signum(m);s=l+f}else{if(!(l<0)||f>=0)return Mt.signum(m);s=-l-f}var _=Mt.DP_SAFE_EPSILON*s;return m>=_||-m>=_?Mt.signum(m):2},Mt.signum=function(t){return t>0?1:t<0?-1:0},Re.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Mt,Re);var ut=function(){},Ne={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Ne.X.get=function(){return 0},Ne.Y.get=function(){return 1},Ne.Z.get=function(){return 2},Ne.M.get=function(){return 3},ut.prototype.setOrdinate=function(t,n,i){},ut.prototype.size=function(){},ut.prototype.getOrdinate=function(t,n){},ut.prototype.getCoordinate=function(){},ut.prototype.getCoordinateCopy=function(t){},ut.prototype.getDimension=function(){},ut.prototype.getX=function(t){},ut.prototype.clone=function(){},ut.prototype.expandEnvelope=function(t){},ut.prototype.copy=function(){},ut.prototype.getY=function(t){},ut.prototype.toCoordinateArray=function(){},ut.prototype.interfaces_=function(){return[Y]},ut.prototype.getClass=function(){return ut},Object.defineProperties(ut,Ne);var xn=function(){},qe=function(t){function n(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(xn),Ee=function(){};Ee.arraycopy=function(t,n,i,s,l){for(var f=0,m=n;m<n+l;m++)i[s+f]=t[m],f++},Ee.getProperty=function(t){return{"line.separator":`\n`}[t]};var Le=function t(){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 n=arguments[0];this.x=n.x,this.y=n.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var i=arguments[0],s=arguments[1];this.x=i,this.y=s,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var l=arguments[0],f=arguments[1];this.x=l.y*f.w-f.y*l.w,this.y=f.x*l.w-l.x*f.w,this.w=l.x*f.y-f.x*l.y}else if(arguments[0]instanceof C&&arguments[1]instanceof C){var m=arguments[0],_=arguments[1];this.x=m.y-_.y,this.y=_.x-m.x,this.w=m.x*_.y-_.x*m.y}}else if(arguments.length===3){var S=arguments[0],O=arguments[1],H=arguments[2];this.x=S,this.y=O,this.w=H}else if(arguments.length===4){var X=arguments[0],nt=arguments[1],rt=arguments[2],lt=arguments[3],gt=X.y-nt.y,we=nt.x-X.x,rn=X.x*nt.y-nt.x*X.y,Wn=rt.y-lt.y,Ei=lt.x-rt.x,Qi=rt.x*lt.y-lt.x*rt.y;this.x=we*Qi-Ei*rn,this.y=Wn*rn-gt*Qi,this.w=gt*Ei-Wn*we}};Le.prototype.getY=function(){var t=this.y/this.w;if(P.isNaN(t)||P.isInfinite(t))throw new qe;return t},Le.prototype.getX=function(){var t=this.x/this.w;if(P.isNaN(t)||P.isInfinite(t))throw new qe;return t},Le.prototype.getCoordinate=function(){var t=new C;return t.x=this.getX(),t.y=this.getY(),t},Le.prototype.interfaces_=function(){return[]},Le.prototype.getClass=function(){return Le},Le.intersection=function(t,n,i,s){var l=t.y-n.y,f=n.x-t.x,m=t.x*n.y-n.x*t.y,_=i.y-s.y,S=s.x-i.x,O=i.x*s.y-s.x*i.y,H=l*S-_*f,X=(f*O-S*m)/H,nt=(_*m-l*O)/H;if(P.isNaN(X)||P.isInfinite(X)||P.isNaN(nt)||P.isInfinite(nt))throw new qe;return new C(X,nt)};var at=function t(){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 C){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof t){var i=arguments[0];this.init(i)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.init(s.x,l.x,s.y,l.y)}else if(arguments.length===4){var f=arguments[0],m=arguments[1],_=arguments[2],S=arguments[3];this.init(f,m,_,S)}},Kn={serialVersionUID:{configurable:!0}};at.prototype.getArea=function(){return this.getWidth()*this.getHeight()},at.prototype.equals=function(t){if(!(t instanceof at))return!1;var n=t;return this.isNull()?n.isNull():this._maxx===n.getMaxX()&&this._maxy===n.getMaxY()&&this._minx===n.getMinX()&&this._miny===n.getMinY()},at.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new at;var n=this._minx>t._minx?this._minx:t._minx,i=this._miny>t._miny?this._miny:t._miny,s=this._maxx<t._maxx?this._maxx:t._maxx,l=this._maxy<t._maxy?this._maxy:t._maxy;return new at(n,s,i,l)},at.prototype.isNull=function(){return this._maxx<this._minx},at.prototype.getMaxX=function(){return this._maxx},at.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof C){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof at){var n=arguments[0];return!this.isNull()&&!n.isNull()&&n.getMinX()>=this._minx&&n.getMaxX()<=this._maxx&&n.getMinY()>=this._miny&&n.getMaxY()<=this._maxy}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];return!this.isNull()&&i>=this._minx&&i<=this._maxx&&s>=this._miny&&s<=this._maxy}},at.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof at){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof C){var n=arguments[0];return this.intersects(n.x,n.y)}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];return!this.isNull()&&!(i>this._maxx||i<this._minx||s>this._maxy||s<this._miny)}},at.prototype.getMinY=function(){return this._miny},at.prototype.getMinX=function(){return this._minx},at.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof C){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof at){var n=arguments[0];if(n.isNull())return null;this.isNull()?(this._minx=n.getMinX(),this._maxx=n.getMaxX(),this._miny=n.getMinY(),this._maxy=n.getMaxY()):(n._minx<this._minx&&(this._minx=n._minx),n._maxx>this._maxx&&(this._maxx=n._maxx),n._miny<this._miny&&(this._miny=n._miny),n._maxy>this._maxy&&(this._maxy=n._maxy))}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.isNull()?(this._minx=i,this._maxx=i,this._miny=s,this._maxy=s):(i<this._minx&&(this._minx=i),i>this._maxx&&(this._maxx=i),s<this._miny&&(this._miny=s),s>this._maxy&&(this._maxy=s))}},at.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),n=this.getHeight();return t<n?t:n},at.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},at.prototype.compareTo=function(t){var n=t;return this.isNull()?n.isNull()?0:-1:n.isNull()?1:this._minx<n._minx?-1:this._minx>n._minx?1:this._miny<n._miny?-1:this._miny>n._miny?1:this._maxx<n._maxx?-1:this._maxx>n._maxx?1:this._maxy<n._maxy?-1:this._maxy>n._maxy?1:0},at.prototype.translate=function(t,n){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+n,this.getMaxY()+n)},at.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},at.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},at.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},at.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),n=this.getHeight();return t>n?t:n},at.prototype.expandBy=function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];if(this.isNull())return null;this._minx-=n,this._maxx+=n,this._miny-=i,this._maxy+=i,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},at.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof at){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof C){var n=arguments[0];return this.covers(n)}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.covers(i,s)}},at.prototype.centre=function(){return this.isNull()?null:new C((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},at.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof C){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof at){var n=arguments[0];this._minx=n._minx,this._maxx=n._maxx,this._miny=n._miny,this._maxy=n._maxy}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.init(i.x,s.x,i.y,s.y)}else if(arguments.length===4){var l=arguments[0],f=arguments[1],m=arguments[2],_=arguments[3];l<f?(this._minx=l,this._maxx=f):(this._minx=f,this._maxx=l),m<_?(this._miny=m,this._maxy=_):(this._miny=_,this._maxy=m)}},at.prototype.getMaxY=function(){return this._maxy},at.prototype.distance=function(t){if(this.intersects(t))return 0;var n=0;this._maxx<t._minx?n=t._minx-this._maxx:this._minx>t._maxx&&(n=this._minx-t._maxx);var i=0;return this._maxy<t._miny?i=t._miny-this._maxy:this._miny>t._maxy&&(i=this._miny-t._maxy),n===0?i:i===0?n:Math.sqrt(n*n+i*i)},at.prototype.hashCode=function(){var t=17;return t=37*t+C.hashCode(this._minx),t=37*t+C.hashCode(this._maxx),t=37*t+C.hashCode(this._miny),t=37*t+C.hashCode(this._maxy)},at.prototype.interfaces_=function(){return[k,e]},at.prototype.getClass=function(){return at},at.intersects=function(){if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2];return i.x>=(t.x<n.x?t.x:n.x)&&i.x<=(t.x>n.x?t.x:n.x)&&i.y>=(t.y<n.y?t.y:n.y)&&i.y<=(t.y>n.y?t.y:n.y)}if(arguments.length===4){var s=arguments[0],l=arguments[1],f=arguments[2],m=arguments[3],_=Math.min(f.x,m.x),S=Math.max(f.x,m.x),O=Math.min(s.x,l.x),H=Math.max(s.x,l.x);return!(O>S)&&!(H<_)&&(_=Math.min(f.y,m.y),S=Math.max(f.y,m.y),O=Math.min(s.y,l.y),H=Math.max(s.y,l.y),!(O>S)&&!(H<_))}},Kn.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(at,Kn);var oe={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*$/},Fn=function(t){this.geometryFactory=t||new Tt};Fn.prototype.read=function(t){var n,i,s;t=t.replace(/[\\n\\r]/g," ");var l=oe.typeStr.exec(t);if(t.search("EMPTY")!==-1&&((l=oe.emptyTypeStr.exec(t))[2]=void 0),l&&(i=l[1].toLowerCase(),s=l[2],gn[i]&&(n=gn[i].apply(this,[s]))),n===void 0)throw new Error("Could not parse WKT "+t);return n},Fn.prototype.write=function(t){return this.extractGeometry(t)},Fn.prototype.extractGeometry=function(t){var n=t.getGeometryType().toLowerCase();if(!Te[n])return null;var i=n.toUpperCase();return t.isEmpty()?i+" EMPTY":i+"("+Te[n].apply(this,[t])+")"};var Te={coordinate:function(t){return t.x+" "+t.y},point:function(t){return Te.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var n=[],i=0,s=t._geometries.length;i<s;++i)n.push("("+Te.point.apply(this,[t._geometries[i]])+")");return n.join(",")},linestring:function(t){for(var n=[],i=0,s=t._points._coordinates.length;i<s;++i)n.push(Te.coordinate.apply(this,[t._points._coordinates[i]]));return n.join(",")},linearring:function(t){for(var n=[],i=0,s=t._points._coordinates.length;i<s;++i)n.push(Te.coordinate.apply(this,[t._points._coordinates[i]]));return n.join(",")},multilinestring:function(t){for(var n=[],i=0,s=t._geometries.length;i<s;++i)n.push("("+Te.linestring.apply(this,[t._geometries[i]])+")");return n.join(",")},polygon:function(t){var n=[];n.push("("+Te.linestring.apply(this,[t._shell])+")");for(var i=0,s=t._holes.length;i<s;++i)n.push("("+Te.linestring.apply(this,[t._holes[i]])+")");return n.join(",")},multipolygon:function(t){for(var n=[],i=0,s=t._geometries.length;i<s;++i)n.push("("+Te.polygon.apply(this,[t._geometries[i]])+")");return n.join(",")},geometrycollection:function(t){for(var n=[],i=0,s=t._geometries.length;i<s;++i)n.push(this.extractGeometry(t._geometries[i]));return n.join(",")}},gn={point:function(t){if(t===void 0)return this.geometryFactory.createPoint();var n=t.trim().split(oe.spaces);return this.geometryFactory.createPoint(new C(Number.parseFloat(n[0]),Number.parseFloat(n[1])))},multipoint:function(t){if(t===void 0)return this.geometryFactory.createMultiPoint();for(var n,i=t.trim().split(","),s=[],l=0,f=i.length;l<f;++l)n=i[l].replace(oe.trimParens,"$1"),s.push(gn.point.apply(this,[n]));return this.geometryFactory.createMultiPoint(s)},linestring:function(t){if(t===void 0)return this.geometryFactory.createLineString();for(var n,i=t.trim().split(","),s=[],l=0,f=i.length;l<f;++l)n=i[l].trim().split(oe.spaces),s.push(new C(Number.parseFloat(n[0]),Number.parseFloat(n[1])));return this.geometryFactory.createLineString(s)},linearring:function(t){if(t===void 0)return this.geometryFactory.createLinearRing();for(var n,i=t.trim().split(","),s=[],l=0,f=i.length;l<f;++l)n=i[l].trim().split(oe.spaces),s.push(new C(Number.parseFloat(n[0]),Number.parseFloat(n[1])));return this.geometryFactory.createLinearRing(s)},multilinestring:function(t){if(t===void 0)return this.geometryFactory.createMultiLineString();for(var n,i=t.trim().split(oe.parenComma),s=[],l=0,f=i.length;l<f;++l)n=i[l].replace(oe.trimParens,"$1"),s.push(gn.linestring.apply(this,[n]));return this.geometryFactory.createMultiLineString(s)},polygon:function(t){if(t===void 0)return this.geometryFactory.createPolygon();for(var n,i,s,l,f=t.trim().split(oe.parenComma),m=[],_=0,S=f.length;_<S;++_)n=f[_].replace(oe.trimParens,"$1"),i=gn.linestring.apply(this,[n]),s=this.geometryFactory.createLinearRing(i._points),_===0?l=s:m.push(s);return this.geometryFactory.createPolygon(l,m)},multipolygon:function(t){if(t===void 0)return this.geometryFactory.createMultiPolygon();for(var n,i=t.trim().split(oe.doubleParenComma),s=[],l=0,f=i.length;l<f;++l)n=i[l].replace(oe.trimParens,"$1"),s.push(gn.polygon.apply(this,[n]));return this.geometryFactory.createMultiPolygon(s)},geometrycollection:function(t){if(t===void 0)return this.geometryFactory.createGeometryCollection();for(var n=(t=t.replace(/,\\s*([A-Za-z])/g,"|$1")).trim().split("|"),i=[],s=0,l=n.length;s<l;++s)i.push(this.read(n[s]));return this.geometryFactory.createGeometryCollection(i)}},Qe=function(t){this.parser=new Fn(t)};Qe.prototype.write=function(t){return this.parser.write(t)},Qe.toLineString=function(t,n){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+n.x+" "+n.y+" )"};var Cn=function(t){function n(i){t.call(this,i),this.name="RuntimeException",this.message=i,this.stack=new t().stack}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n}(Error),ai=function(t){function n(){if(t.call(this),arguments.length===0)t.call(this);else if(arguments.length===1){var i=arguments[0];t.call(this,i)}}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Cn),_t=function(){};_t.prototype.interfaces_=function(){return[]},_t.prototype.getClass=function(){return _t},_t.shouldNeverReachHere=function(){if(arguments.length===0)_t.shouldNeverReachHere(null);else if(arguments.length===1){var t=arguments[0];throw new ai("Should never reach here"+(t!==null?": "+t:""))}},_t.isTrue=function(){var t,n;if(arguments.length===1)t=arguments[0],_t.isTrue(t,null);else if(arguments.length===2&&(t=arguments[0],n=arguments[1],!t))throw n===null?new ai:new ai(n)},_t.equals=function(){var t,n,i;if(arguments.length===2)t=arguments[0],n=arguments[1],_t.equals(t,n,null);else if(arguments.length===3&&(t=arguments[0],n=arguments[1],i=arguments[2],!n.equals(t)))throw new ai("Expected "+t+" but encountered "+n+(i!==null?": "+i:""))};var Ce=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 C,this._intPt[1]=new C,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},ui={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};Ce.prototype.getIndexAlongSegment=function(t,n){return this.computeIntLineIndex(),this._intLineIndex[t][n]},Ce.prototype.getTopologySummary=function(){var t=new Rt;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},Ce.prototype.computeIntersection=function(t,n,i,s){this._inputLines[0][0]=t,this._inputLines[0][1]=n,this._inputLines[1][0]=i,this._inputLines[1][1]=s,this._result=this.computeIntersect(t,n,i,s)},Ce.prototype.getIntersectionNum=function(){return this._result},Ce.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 t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},Ce.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},Ce.prototype.setPrecisionModel=function(t){this._precisionModel=t},Ce.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var t=arguments[0],n=0;n<this._result;n++)if(!this._intPt[n].equals2D(this._inputLines[t][0])&&!this._intPt[n].equals2D(this._inputLines[t][1]))return!0;return!1}},Ce.prototype.getIntersection=function(t){return this._intPt[t]},Ce.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},Ce.prototype.hasIntersection=function(){return this._result!==Ce.NO_INTERSECTION},Ce.prototype.getEdgeDistance=function(t,n){return Ce.computeEdgeDistance(this._intPt[n],this._inputLines[t][0],this._inputLines[t][1])},Ce.prototype.isCollinear=function(){return this._result===Ce.COLLINEAR_INTERSECTION},Ce.prototype.toString=function(){return Qe.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Qe.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},Ce.prototype.getEndpoint=function(t,n){return this._inputLines[t][n]},Ce.prototype.isIntersection=function(t){for(var n=0;n<this._result;n++)if(this._intPt[n].equals2D(t))return!0;return!1},Ce.prototype.getIntersectionAlongSegment=function(t,n){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][n]]},Ce.prototype.interfaces_=function(){return[]},Ce.prototype.getClass=function(){return Ce},Ce.computeEdgeDistance=function(t,n,i){var s=Math.abs(i.x-n.x),l=Math.abs(i.y-n.y),f=-1;if(t.equals(n))f=0;else if(t.equals(i))f=s>l?s:l;else{var m=Math.abs(t.x-n.x),_=Math.abs(t.y-n.y);(f=s>l?m:_)!==0||t.equals(n)||(f=Math.max(m,_))}return _t.isTrue(!(f===0&&!t.equals(n)),"Bad distance calculation"),f},Ce.nonRobustComputeEdgeDistance=function(t,n,i){var s=t.x-n.x,l=t.y-n.y,f=Math.sqrt(s*s+l*l);return _t.isTrue(!(f===0&&!t.equals(n)),"Invalid distance calculation"),f},ui.DONT_INTERSECT.get=function(){return 0},ui.DO_INTERSECT.get=function(){return 1},ui.COLLINEAR.get=function(){return 2},ui.NO_INTERSECTION.get=function(){return 0},ui.POINT_INTERSECTION.get=function(){return 1},ui.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(Ce,ui);var Pr=function(t){function n(){t.apply(this,arguments)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.isInSegmentEnvelopes=function(i){var s=new at(this._inputLines[0][0],this._inputLines[0][1]),l=new at(this._inputLines[1][0],this._inputLines[1][1]);return s.contains(i)&&l.contains(i)},n.prototype.computeIntersection=function(){if(arguments.length!==3)return t.prototype.computeIntersection.apply(this,arguments);var i=arguments[0],s=arguments[1],l=arguments[2];if(this._isProper=!1,at.intersects(s,l,i)&&tt.orientationIndex(s,l,i)===0&&tt.orientationIndex(l,s,i)===0)return this._isProper=!0,(i.equals(s)||i.equals(l))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},n.prototype.normalizeToMinimum=function(i,s,l,f,m){m.x=this.smallestInAbsValue(i.x,s.x,l.x,f.x),m.y=this.smallestInAbsValue(i.y,s.y,l.y,f.y),i.x-=m.x,i.y-=m.y,s.x-=m.x,s.y-=m.y,l.x-=m.x,l.y-=m.y,f.x-=m.x,f.y-=m.y},n.prototype.safeHCoordinateIntersection=function(i,s,l,f){var m=null;try{m=Le.intersection(i,s,l,f)}catch(_){if(!(_ instanceof qe))throw _;m=n.nearestEndpoint(i,s,l,f)}return m},n.prototype.intersection=function(i,s,l,f){var m=this.intersectionWithNormalization(i,s,l,f);return this.isInSegmentEnvelopes(m)||(m=new C(n.nearestEndpoint(i,s,l,f))),this._precisionModel!==null&&this._precisionModel.makePrecise(m),m},n.prototype.smallestInAbsValue=function(i,s,l,f){var m=i,_=Math.abs(m);return Math.abs(s)<_&&(m=s,_=Math.abs(s)),Math.abs(l)<_&&(m=l,_=Math.abs(l)),Math.abs(f)<_&&(m=f),m},n.prototype.checkDD=function(i,s,l,f,m){var _=Mt.intersection(i,s,l,f),S=this.isInSegmentEnvelopes(_);Ee.out.println("DD in env = "+S+" --------------------- "+_),m.distance(_)>1e-4&&Ee.out.println("Distance = "+m.distance(_))},n.prototype.intersectionWithNormalization=function(i,s,l,f){var m=new C(i),_=new C(s),S=new C(l),O=new C(f),H=new C;this.normalizeToEnvCentre(m,_,S,O,H);var X=this.safeHCoordinateIntersection(m,_,S,O);return X.x+=H.x,X.y+=H.y,X},n.prototype.computeCollinearIntersection=function(i,s,l,f){var m=at.intersects(i,s,l),_=at.intersects(i,s,f),S=at.intersects(l,f,i),O=at.intersects(l,f,s);return m&&_?(this._intPt[0]=l,this._intPt[1]=f,t.COLLINEAR_INTERSECTION):S&&O?(this._intPt[0]=i,this._intPt[1]=s,t.COLLINEAR_INTERSECTION):m&&S?(this._intPt[0]=l,this._intPt[1]=i,!l.equals(i)||_||O?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):m&&O?(this._intPt[0]=l,this._intPt[1]=s,!l.equals(s)||_||S?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):_&&S?(this._intPt[0]=f,this._intPt[1]=i,!f.equals(i)||m||O?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):_&&O?(this._intPt[0]=f,this._intPt[1]=s,!f.equals(s)||m||S?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},n.prototype.normalizeToEnvCentre=function(i,s,l,f,m){var _=i.x<s.x?i.x:s.x,S=i.y<s.y?i.y:s.y,O=i.x>s.x?i.x:s.x,H=i.y>s.y?i.y:s.y,X=l.x<f.x?l.x:f.x,nt=l.y<f.y?l.y:f.y,rt=l.x>f.x?l.x:f.x,lt=l.y>f.y?l.y:f.y,gt=((_>X?_:X)+(O<rt?O:rt))/2,we=((S>nt?S:nt)+(H<lt?H:lt))/2;m.x=gt,m.y=we,i.x-=m.x,i.y-=m.y,s.x-=m.x,s.y-=m.y,l.x-=m.x,l.y-=m.y,f.x-=m.x,f.y-=m.y},n.prototype.computeIntersect=function(i,s,l,f){if(this._isProper=!1,!at.intersects(i,s,l,f))return t.NO_INTERSECTION;var m=tt.orientationIndex(i,s,l),_=tt.orientationIndex(i,s,f);if(m>0&&_>0||m<0&&_<0)return t.NO_INTERSECTION;var S=tt.orientationIndex(l,f,i),O=tt.orientationIndex(l,f,s);return S>0&&O>0||S<0&&O<0?t.NO_INTERSECTION:m===0&&_===0&&S===0&&O===0?this.computeCollinearIntersection(i,s,l,f):(m===0||_===0||S===0||O===0?(this._isProper=!1,i.equals2D(l)||i.equals2D(f)?this._intPt[0]=i:s.equals2D(l)||s.equals2D(f)?this._intPt[0]=s:m===0?this._intPt[0]=new C(l):_===0?this._intPt[0]=new C(f):S===0?this._intPt[0]=new C(i):O===0&&(this._intPt[0]=new C(s))):(this._isProper=!0,this._intPt[0]=this.intersection(i,s,l,f)),t.POINT_INTERSECTION)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n.nearestEndpoint=function(i,s,l,f){var m=i,_=tt.distancePointLine(i,l,f),S=tt.distancePointLine(s,l,f);return S<_&&(_=S,m=s),(S=tt.distancePointLine(l,i,s))<_&&(_=S,m=l),(S=tt.distancePointLine(f,i,s))<_&&(_=S,m=f),m},n}(Ce),$r=function(){};$r.prototype.interfaces_=function(){return[]},$r.prototype.getClass=function(){return $r},$r.orientationIndex=function(t,n,i){var s=n.x-t.x,l=n.y-t.y,f=i.x-n.x,m=i.y-n.y;return $r.signOfDet2x2(s,l,f,m)},$r.signOfDet2x2=function(t,n,i,s){var l=null,f=null,m=null;if(l=1,t===0||s===0)return n===0||i===0?0:n>0?i>0?-l:l:i>0?l:-l;if(n===0||i===0)return s>0?t>0?l:-l:t>0?-l:l;if(n>0?s>0?n<=s||(l=-l,f=t,t=i,i=f,f=n,n=s,s=f):n<=-s?(l=-l,i=-i,s=-s):(f=t,t=-i,i=f,f=n,n=-s,s=f):s>0?-n<=s?(l=-l,t=-t,n=-n):(f=-t,t=i,i=f,f=-n,n=s,s=f):n>=s?(t=-t,n=-n,i=-i,s=-s):(l=-l,f=-t,t=-i,i=f,f=-n,n=-s,s=f),t>0){if(!(i>0)||!(t<=i))return l}else{if(i>0||!(t>=i))return-l;l=-l,t=-t,i=-i}for(;;){if(m=Math.floor(i/t),i-=m*t,(s-=m*n)<0)return-l;if(s>n)return l;if(t>i+i){if(n<s+s)return l}else{if(n>s+s)return-l;i=t-i,s=n-s,l=-l}if(s===0)return i===0?0:-l;if(i===0||(m=Math.floor(t/i),t-=m*i,(n-=m*s)<0))return l;if(n>s)return-l;if(i>t+t){if(s<n+n)return-l}else{if(s>n+n)return l;t=i-t,n=s-n,l=-l}if(n===0)return t===0?0:l;if(t===0)return-l}};var Un=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};Un.prototype.countSegment=function(t,n){if(t.x<this._p.x&&n.x<this._p.x)return null;if(this._p.x===n.x&&this._p.y===n.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&n.y===this._p.y){var i=t.x,s=n.x;return i>s&&(i=n.x,s=t.x),this._p.x>=i&&this._p.x<=s&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&n.y<=this._p.y||n.y>this._p.y&&t.y<=this._p.y){var l=t.x-this._p.x,f=t.y-this._p.y,m=n.x-this._p.x,_=n.y-this._p.y,S=$r.signOfDet2x2(l,f,m,_);if(S===0)return this._isPointOnSegment=!0,null;_<f&&(S=-S),S>0&&this._crossingCount++}},Un.prototype.isPointInPolygon=function(){return this.getLocation()!==F.EXTERIOR},Un.prototype.getLocation=function(){return this._isPointOnSegment?F.BOUNDARY:this._crossingCount%2==1?F.INTERIOR:F.EXTERIOR},Un.prototype.isOnSegment=function(){return this._isPointOnSegment},Un.prototype.interfaces_=function(){return[]},Un.prototype.getClass=function(){return Un},Un.locatePointInRing=function(){if(arguments[0]instanceof C&&et(arguments[1],ut)){for(var t=arguments[0],n=arguments[1],i=new Un(t),s=new C,l=new C,f=1;f<n.size();f++)if(n.getCoordinate(f,s),n.getCoordinate(f-1,l),i.countSegment(s,l),i.isOnSegment())return i.getLocation();return i.getLocation()}if(arguments[0]instanceof C&&arguments[1]instanceof Array){for(var m=arguments[0],_=arguments[1],S=new Un(m),O=1;O<_.length;O++){var H=_[O],X=_[O-1];if(S.countSegment(H,X),S.isOnSegment())return S.getLocation()}return S.getLocation()}};var tt=function(){},eo={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};tt.prototype.interfaces_=function(){return[]},tt.prototype.getClass=function(){return tt},tt.orientationIndex=function(t,n,i){return Mt.orientationIndex(t,n,i)},tt.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var n=0,i=t[0].x,s=1;s<t.length-1;s++){var l=t[s].x-i,f=t[s+1].y;n+=l*(t[s-1].y-f)}return n/2}if(et(arguments[0],ut)){var m=arguments[0],_=m.size();if(_<3)return 0;var S=new C,O=new C,H=new C;m.getCoordinate(0,O),m.getCoordinate(1,H);var X=O.x;H.x-=X;for(var nt=0,rt=1;rt<_-1;rt++)S.y=O.y,O.x=H.x,O.y=H.y,m.getCoordinate(rt+1,H),H.x-=X,nt+=O.x*(S.y-H.y);return nt/2}},tt.distanceLineLine=function(t,n,i,s){if(t.equals(n))return tt.distancePointLine(t,i,s);if(i.equals(s))return tt.distancePointLine(s,t,n);var l=!1;if(at.intersects(t,n,i,s)){var f=(n.x-t.x)*(s.y-i.y)-(n.y-t.y)*(s.x-i.x);if(f===0)l=!0;else{var m=(t.y-i.y)*(s.x-i.x)-(t.x-i.x)*(s.y-i.y),_=((t.y-i.y)*(n.x-t.x)-(t.x-i.x)*(n.y-t.y))/f,S=m/f;(S<0||S>1||_<0||_>1)&&(l=!0)}}else l=!0;return l?St.min(tt.distancePointLine(t,i,s),tt.distancePointLine(n,i,s),tt.distancePointLine(i,t,n),tt.distancePointLine(s,t,n)):0},tt.isPointInRing=function(t,n){return tt.locatePointInRing(t,n)!==F.EXTERIOR},tt.computeLength=function(t){var n=t.size();if(n<=1)return 0;var i=0,s=new C;t.getCoordinate(0,s);for(var l=s.x,f=s.y,m=1;m<n;m++){t.getCoordinate(m,s);var _=s.x,S=s.y,O=_-l,H=S-f;i+=Math.sqrt(O*O+H*H),l=_,f=S}return i},tt.isCCW=function(t){var n=t.length-1;if(n<3)throw new L("Ring has fewer than 4 points, so orientation cannot be determined");for(var i=t[0],s=0,l=1;l<=n;l++){var f=t[l];f.y>i.y&&(i=f,s=l)}var m=s;do(m-=1)<0&&(m=n);while(t[m].equals2D(i)&&m!==s);var _=s;do _=(_+1)%n;while(t[_].equals2D(i)&&_!==s);var S=t[m],O=t[_];if(S.equals2D(i)||O.equals2D(i)||S.equals2D(O))return!1;var H=tt.computeOrientation(S,i,O),X=!1;return X=H===0?S.x>O.x:H>0,X},tt.locatePointInRing=function(t,n){return Un.locatePointInRing(t,n)},tt.distancePointLinePerpendicular=function(t,n,i){var s=(i.x-n.x)*(i.x-n.x)+(i.y-n.y)*(i.y-n.y),l=((n.y-t.y)*(i.x-n.x)-(n.x-t.x)*(i.y-n.y))/s;return Math.abs(l)*Math.sqrt(s)},tt.computeOrientation=function(t,n,i){return tt.orientationIndex(t,n,i)},tt.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];if(n.length===0)throw new L("Line array must contain at least one vertex");for(var i=t.distance(n[0]),s=0;s<n.length-1;s++){var l=tt.distancePointLine(t,n[s],n[s+1]);l<i&&(i=l)}return i}if(arguments.length===3){var f=arguments[0],m=arguments[1],_=arguments[2];if(m.x===_.x&&m.y===_.y)return f.distance(m);var S=(_.x-m.x)*(_.x-m.x)+(_.y-m.y)*(_.y-m.y),O=((f.x-m.x)*(_.x-m.x)+(f.y-m.y)*(_.y-m.y))/S;if(O<=0)return f.distance(m);if(O>=1)return f.distance(_);var H=((m.y-f.y)*(_.x-m.x)-(m.x-f.x)*(_.y-m.y))/S;return Math.abs(H)*Math.sqrt(S)}},tt.isOnLine=function(t,n){for(var i=new Pr,s=1;s<n.length;s++){var l=n[s-1],f=n[s];if(i.computeIntersection(t,l,f),i.hasIntersection())return!0}return!1},eo.CLOCKWISE.get=function(){return-1},eo.RIGHT.get=function(){return tt.CLOCKWISE},eo.COUNTERCLOCKWISE.get=function(){return 1},eo.LEFT.get=function(){return tt.COUNTERCLOCKWISE},eo.COLLINEAR.get=function(){return 0},eo.STRAIGHT.get=function(){return tt.COLLINEAR},Object.defineProperties(tt,eo);var li=function(){};li.prototype.filter=function(t){},li.prototype.interfaces_=function(){return[]},li.prototype.getClass=function(){return li};var yt=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},Zr={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(t){return this},yt.prototype.getArea=function(){return 0},yt.prototype.isRectangle=function(){return!1},yt.prototype.equals=function(){if(arguments[0]instanceof yt){var t=arguments[0];return t!==null&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var n=arguments[0];if(!(n instanceof yt))return!1;var i=n;return this.equalsExact(i)}},yt.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},yt.prototype.geometryChanged=function(){this.apply(yt.geometryChangedFilter)},yt.prototype.geometryChangedAction=function(){this._envelope=null},yt.prototype.equalsNorm=function(t){return t!==null&&this.norm().equalsExact(t.norm())},yt.prototype.getLength=function(){return 0},yt.prototype.getNumGeometries=function(){return 1},yt.prototype.compareTo=function(){if(arguments.length===1){var t=arguments[0],n=t;return this.getSortIndex()!==n.getSortIndex()?this.getSortIndex()-n.getSortIndex():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(t)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(i,s)}},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(t){if(t.getSortIndex()===yt.SORTINDEX_GEOMETRYCOLLECTION)throw new L("This method does not support GeometryCollection arguments")},yt.prototype.equal=function(t,n,i){return i===0?t.equals(n):t.distance(n)<=i},yt.prototype.norm=function(){var t=this.copy();return t.normalize(),t},yt.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},yt.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new at(this._envelope)},yt.prototype.setSRID=function(t){this._SRID=t},yt.prototype.setUserData=function(t){this._userData=t},yt.prototype.compare=function(t,n){for(var i=t.iterator(),s=n.iterator();i.hasNext()&&s.hasNext();){var l=i.next(),f=s.next(),m=l.compareTo(f);if(m!==0)return m}return i.hasNext()?1:s.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[Y,k,e]},yt.prototype.getClass=function(){return yt},yt.hasNonEmptyElements=function(t){for(var n=0;n<t.length;n++)if(!t[n].isEmpty())return!0;return!1},yt.hasNullElements=function(t){for(var n=0;n<t.length;n++)if(t[n]===null)return!0;return!1},Zr.serialVersionUID.get=function(){return 8763622679187377e3},Zr.SORTINDEX_POINT.get=function(){return 0},Zr.SORTINDEX_MULTIPOINT.get=function(){return 1},Zr.SORTINDEX_LINESTRING.get=function(){return 2},Zr.SORTINDEX_LINEARRING.get=function(){return 3},Zr.SORTINDEX_MULTILINESTRING.get=function(){return 4},Zr.SORTINDEX_POLYGON.get=function(){return 5},Zr.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Zr.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Zr.geometryChangedFilter.get=function(){return Us},Object.defineProperties(yt,Zr);var Us=function(){};Us.interfaces_=function(){return[li]},Us.filter=function(t){t.geometryChangedAction()};var B=function(){};B.prototype.filter=function(t){},B.prototype.interfaces_=function(){return[]},B.prototype.getClass=function(){return B};var y=function(){},E={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}};y.prototype.isInBoundary=function(t){},y.prototype.interfaces_=function(){return[]},y.prototype.getClass=function(){return y},E.Mod2BoundaryNodeRule.get=function(){return A},E.EndPointBoundaryNodeRule.get=function(){return N},E.MultiValentEndPointBoundaryNodeRule.get=function(){return R},E.MonoValentEndPointBoundaryNodeRule.get=function(){return $},E.MOD2_BOUNDARY_RULE.get=function(){return new A},E.ENDPOINT_BOUNDARY_RULE.get=function(){return new N},E.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new R},E.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new $},E.OGC_SFS_BOUNDARY_RULE.get=function(){return y.MOD2_BOUNDARY_RULE},Object.defineProperties(y,E);var A=function(){};A.prototype.isInBoundary=function(t){return t%2==1},A.prototype.interfaces_=function(){return[y]},A.prototype.getClass=function(){return A};var N=function(){};N.prototype.isInBoundary=function(t){return t>0},N.prototype.interfaces_=function(){return[y]},N.prototype.getClass=function(){return N};var R=function(){};R.prototype.isInBoundary=function(t){return t>1},R.prototype.interfaces_=function(){return[y]},R.prototype.getClass=function(){return R};var $=function(){};$.prototype.isInBoundary=function(t){return t===1},$.prototype.interfaces_=function(){return[y]},$.prototype.getClass=function(){return $};var G=function(){};G.prototype.add=function(){},G.prototype.addAll=function(){},G.prototype.isEmpty=function(){},G.prototype.iterator=function(){},G.prototype.size=function(){},G.prototype.toArray=function(){},G.prototype.remove=function(){},(r.prototype=new Error).name="IndexOutOfBoundsException";var K=function(){};K.prototype.hasNext=function(){},K.prototype.next=function(){},K.prototype.remove=function(){};var Z=function(t){function n(){t.apply(this,arguments)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.get=function(){},n.prototype.set=function(){},n.prototype.isEmpty=function(){},n}(G);(a.prototype=new Error).name="NoSuchElementException";var V=function(t){function n(){t.call(this),this.array_=[],arguments[0]instanceof G&&this.addAll(arguments[0])}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.ensureCapacity=function(){},n.prototype.interfaces_=function(){return[t,G]},n.prototype.add=function(i){return arguments.length===1?this.array_.push(i):this.array_.splice(arguments[0],arguments[1]),!0},n.prototype.clear=function(){this.array_=[]},n.prototype.addAll=function(i){for(var s=i.iterator();s.hasNext();)this.add(s.next());return!0},n.prototype.set=function(i,s){var l=this.array_[i];return this.array_[i]=s,l},n.prototype.iterator=function(){return new W(this)},n.prototype.get=function(i){if(i<0||i>=this.size())throw new r;return this.array_[i]},n.prototype.isEmpty=function(){return this.array_.length===0},n.prototype.size=function(){return this.array_.length},n.prototype.toArray=function(){for(var i=[],s=0,l=this.array_.length;s<l;s++)i.push(this.array_[s]);return i},n.prototype.remove=function(i){for(var s=!1,l=0,f=this.array_.length;l<f;l++)if(this.array_[l]===i){this.array_.splice(l,1),s=!0;break}return s},n}(Z),W=function(t){function n(i){t.call(this),this.arrayList_=i,this.position_=0}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new a;return this.arrayList_.get(this.position_++)},n.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},n.prototype.set=function(i){return this.arrayList_.set(this.position_-1,i)},n.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},n}(K),Q=function(t){function n(){if(t.call(this),arguments.length!==0){if(arguments.length===1){var s=arguments[0];this.ensureCapacity(s.length),this.add(s,!0)}else if(arguments.length===2){var l=arguments[0],f=arguments[1];this.ensureCapacity(l.length),this.add(l,f)}}}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={coordArrayType:{configurable:!0}};return i.coordArrayType.get=function(){return new Array(0).fill(null)},n.prototype.getCoordinate=function(s){return this.get(s)},n.prototype.addAll=function(){if(arguments.length===2){for(var s=arguments[0],l=arguments[1],f=!1,m=s.iterator();m.hasNext();)this.add(m.next(),l),f=!0;return f}return t.prototype.addAll.apply(this,arguments)},n.prototype.clone=function(){for(var s=t.prototype.clone.call(this),l=0;l<this.size();l++)s.add(l,this.get(l).copy());return s},n.prototype.toCoordinateArray=function(){return this.toArray(n.coordArrayType)},n.prototype.add=function(){if(arguments.length===1){var s=arguments[0];t.prototype.add.call(this,s)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var l=arguments[0],f=arguments[1];return this.add(l,f,!0),!0}if(arguments[0]instanceof C&&typeof arguments[1]=="boolean"){var m=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(m))return null;t.prototype.add.call(this,m)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var _=arguments[0],S=arguments[1];return this.add(_,S),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var O=arguments[0],H=arguments[1];if(arguments[2])for(var X=0;X<O.length;X++)this.add(O[X],H);else for(var nt=O.length-1;nt>=0;nt--)this.add(O[nt],H);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof C){var rt=arguments[0],lt=arguments[1];if(!arguments[2]){var gt=this.size();if(gt>0&&(rt>0&&this.get(rt-1).equals2D(lt)||rt<gt&&this.get(rt).equals2D(lt)))return null}t.prototype.add.call(this,rt,lt)}}else if(arguments.length===4){var we=arguments[0],rn=arguments[1],Wn=arguments[2],Ei=arguments[3],Qi=1;Wn>Ei&&(Qi=-1);for(var hl=Wn;hl!==Ei;hl+=Qi)this.add(we[hl],rn);return!0}},n.prototype.closeRing=function(){this.size()>0&&this.add(new C(this.get(0)),!1)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},Object.defineProperties(n,i),n}(V),J=function(){},wt={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};wt.ForwardComparator.get=function(){return vt},wt.BidirectionalComparator.get=function(){return It},wt.coordArrayType.get=function(){return new Array(0).fill(null)},J.prototype.interfaces_=function(){return[]},J.prototype.getClass=function(){return J},J.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},J.ptNotInList=function(t,n){for(var i=0;i<t.length;i++){var s=t[i];if(J.indexOf(s,n)<0)return s}return null},J.scroll=function(t,n){var i=J.indexOf(n,t);if(i<0)return null;var s=new Array(t.length).fill(null);Ee.arraycopy(t,i,s,0,t.length-i),Ee.arraycopy(t,0,s,t.length-i,i),Ee.arraycopy(s,0,t,0,t.length)},J.equals=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];if(t===n)return!0;if(t===null||n===null||t.length!==n.length)return!1;for(var i=0;i<t.length;i++)if(!t[i].equals(n[i]))return!1;return!0}if(arguments.length===3){var s=arguments[0],l=arguments[1],f=arguments[2];if(s===l)return!0;if(s===null||l===null||s.length!==l.length)return!1;for(var m=0;m<s.length;m++)if(f.compare(s[m],l[m])!==0)return!1;return!0}},J.intersection=function(t,n){for(var i=new Q,s=0;s<t.length;s++)n.intersects(t[s])&&i.add(t[s],!0);return i.toCoordinateArray()},J.hasRepeatedPoints=function(t){for(var n=1;n<t.length;n++)if(t[n-1].equals(t[n]))return!0;return!1},J.removeRepeatedPoints=function(t){return J.hasRepeatedPoints(t)?new Q(t,!1).toCoordinateArray():t},J.reverse=function(t){for(var n=t.length-1,i=Math.trunc(n/2),s=0;s<=i;s++){var l=t[s];t[s]=t[n-s],t[n-s]=l}},J.removeNull=function(t){for(var n=0,i=0;i<t.length;i++)t[i]!==null&&n++;var s=new Array(n).fill(null);if(n===0)return s;for(var l=0,f=0;f<t.length;f++)t[f]!==null&&(s[l++]=t[f]);return s},J.copyDeep=function(){if(arguments.length===1){for(var t=arguments[0],n=new Array(t.length).fill(null),i=0;i<t.length;i++)n[i]=new C(t[i]);return n}if(arguments.length===5)for(var s=arguments[0],l=arguments[1],f=arguments[2],m=arguments[3],_=arguments[4],S=0;S<_;S++)f[m+S]=new C(s[l+S])},J.isEqualReversed=function(t,n){for(var i=0;i<t.length;i++){var s=t[i],l=n[t.length-i-1];if(s.compareTo(l)!==0)return!1}return!0},J.envelope=function(t){for(var n=new at,i=0;i<t.length;i++)n.expandToInclude(t[i]);return n},J.toCoordinateArray=function(t){return t.toArray(J.coordArrayType)},J.atLeastNCoordinatesOrNothing=function(t,n){return n.length>=t?n:[]},J.indexOf=function(t,n){for(var i=0;i<n.length;i++)if(t.equals(n[i]))return i;return-1},J.increasingDirection=function(t){for(var n=0;n<Math.trunc(t.length/2);n++){var i=t.length-1-n,s=t[n].compareTo(t[i]);if(s!==0)return s}return 1},J.compare=function(t,n){for(var i=0;i<t.length&&i<n.length;){var s=t[i].compareTo(n[i]);if(s!==0)return s;i++}return i<n.length?-1:i<t.length?1:0},J.minCoordinate=function(t){for(var n=null,i=0;i<t.length;i++)(n===null||n.compareTo(t[i])>0)&&(n=t[i]);return n},J.extract=function(t,n,i){n=St.clamp(n,0,t.length);var s=(i=St.clamp(i,-1,t.length))-n+1;i<0&&(s=0),n>=t.length&&(s=0),i<n&&(s=0);var l=new Array(s).fill(null);if(s===0)return l;for(var f=0,m=n;m<=i;m++)l[f++]=t[m];return l},Object.defineProperties(J,wt);var vt=function(){};vt.prototype.compare=function(t,n){return J.compare(t,n)},vt.prototype.interfaces_=function(){return[q]},vt.prototype.getClass=function(){return vt};var It=function(){};It.prototype.compare=function(t,n){var i=t,s=n;if(i.length<s.length)return-1;if(i.length>s.length)return 1;if(i.length===0)return 0;var l=J.compare(i,s);return J.isEqualReversed(i,s)?0:l},It.prototype.OLDcompare=function(t,n){var i=t,s=n;if(i.length<s.length)return-1;if(i.length>s.length)return 1;if(i.length===0)return 0;for(var l=J.increasingDirection(i),f=J.increasingDirection(s),m=l>0?0:i.length-1,_=f>0?0:i.length-1,S=0;S<i.length;S++){var O=i[m].compareTo(s[_]);if(O!==0)return O;m+=l,_+=f}return 0},It.prototype.interfaces_=function(){return[q]},It.prototype.getClass=function(){return It};var At=function(){};At.prototype.get=function(){},At.prototype.put=function(){},At.prototype.size=function(){},At.prototype.values=function(){},At.prototype.entrySet=function(){};var ke=function(t){function n(){t.apply(this,arguments)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n}(At);(u.prototype=new Error).name="OperationNotSupported",(c.prototype=new G).contains=function(){};var En=function(t){function n(){t.call(this),this.array_=[],arguments[0]instanceof G&&this.addAll(arguments[0])}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.contains=function(i){for(var s=0,l=this.array_.length;s<l;s++)if(this.array_[s]===i)return!0;return!1},n.prototype.add=function(i){return!this.contains(i)&&(this.array_.push(i),!0)},n.prototype.addAll=function(i){for(var s=i.iterator();s.hasNext();)this.add(s.next());return!0},n.prototype.remove=function(i){throw new Error},n.prototype.size=function(){return this.array_.length},n.prototype.isEmpty=function(){return this.array_.length===0},n.prototype.toArray=function(){for(var i=[],s=0,l=this.array_.length;s<l;s++)i.push(this.array_[s]);return i},n.prototype.iterator=function(){return new pn(this)},n}(c),pn=function(t){function n(i){t.call(this),this.hashSet_=i,this.position_=0}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new a;return this.hashSet_.array_[this.position_++]},n.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},n.prototype.remove=function(){throw new u},n}(K),Be=0;(x.prototype=new ke).get=function(t){for(var n=this.root_;n!==null;){var i=t.compareTo(n.key);if(i<0)n=n.left;else{if(!(i>0))return n.value;n=n.right}}return null},x.prototype.put=function(t,n){if(this.root_===null)return this.root_={key:t,value:n,left:null,right:null,parent:null,color:Be,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var i,s,l=this.root_;do if(i=l,(s=t.compareTo(l.key))<0)l=l.left;else{if(!(s>0)){var f=l.value;return l.value=n,f}l=l.right}while(l!==null);var m={key:t,left:null,right:null,value:n,parent:i,color:Be,getValue:function(){return this.value},getKey:function(){return this.key}};return s<0?i.left=m:i.right=m,this.fixAfterInsertion(m),this.size_++,null},x.prototype.fixAfterInsertion=function(t){for(t.color=1;t!=null&&t!==this.root_&&t.parent.color===1;)if(p(t)===g(p(p(t)))){var n=v(p(p(t)));h(n)===1?(d(p(t),Be),d(n,Be),d(p(p(t)),1),t=p(p(t))):(t===v(p(t))&&(t=p(t),this.rotateLeft(t)),d(p(t),Be),d(p(p(t)),1),this.rotateRight(p(p(t))))}else{var i=g(p(p(t)));h(i)===1?(d(p(t),Be),d(i,Be),d(p(p(t)),1),t=p(p(t))):(t===g(p(t))&&(t=p(t),this.rotateRight(t)),d(p(t),Be),d(p(p(t)),1),this.rotateLeft(p(p(t))))}this.root_.color=Be},x.prototype.values=function(){var t=new V,n=this.getFirstEntry();if(n!==null)for(t.add(n.value);(n=x.successor(n))!==null;)t.add(n.value);return t},x.prototype.entrySet=function(){var t=new En,n=this.getFirstEntry();if(n!==null)for(t.add(n);(n=x.successor(n))!==null;)t.add(n);return t},x.prototype.rotateLeft=function(t){if(t!=null){var n=t.right;t.right=n.left,n.left!=null&&(n.left.parent=t),n.parent=t.parent,t.parent===null?this.root_=n:t.parent.left===t?t.parent.left=n:t.parent.right=n,n.left=t,t.parent=n}},x.prototype.rotateRight=function(t){if(t!=null){var n=t.left;t.left=n.right,n.right!=null&&(n.right.parent=t),n.parent=t.parent,t.parent===null?this.root_=n:t.parent.right===t?t.parent.right=n:t.parent.left=n,n.right=t,t.parent=n}},x.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t},x.successor=function(t){if(t===null)return null;if(t.right!==null){for(var n=t.right;n.left!==null;)n=n.left;return n}for(var i=t.parent,s=t;i!==null&&s===i.right;)s=i,i=i.parent;return i},x.prototype.size=function(){return this.size_};var dn=function(){};dn.prototype.interfaces_=function(){return[]},dn.prototype.getClass=function(){return dn},M.prototype=new c,(w.prototype=new M).contains=function(t){for(var n=0,i=this.array_.length;n<i;n++)if(this.array_[n].compareTo(t)===0)return!0;return!1},w.prototype.add=function(t){if(this.contains(t))return!1;for(var n=0,i=this.array_.length;n<i;n++)if(this.array_[n].compareTo(t)===1)return this.array_.splice(n,0,t),!0;return this.array_.push(t),!0},w.prototype.addAll=function(t){for(var n=t.iterator();n.hasNext();)this.add(n.next());return!0},w.prototype.remove=function(t){throw new u},w.prototype.size=function(){return this.array_.length},w.prototype.isEmpty=function(){return this.array_.length===0},w.prototype.toArray=function(){for(var t=[],n=0,i=this.array_.length;n<i;n++)t.push(this.array_[n]);return t},w.prototype.iterator=function(){return new Qn(this)};var Qn=function(t){this.treeSet_=t,this.position_=0};Qn.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new a;return this.treeSet_.array_[this.position_++]},Qn.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Qn.prototype.remove=function(){throw new u};var We=function(){};We.sort=function(){var t,n,i,s,l=arguments[0];if(arguments.length===1)s=function(m,_){return m.compareTo(_)},l.sort(s);else if(arguments.length===2)i=arguments[1],s=function(m,_){return i.compare(m,_)},l.sort(s);else if(arguments.length===3){(n=l.slice(arguments[1],arguments[2])).sort();var f=l.slice(0,arguments[1]).concat(n,l.slice(arguments[2],l.length));for(l.splice(0,l.length),t=0;t<f.length;t++)l.push(f[t])}else if(arguments.length===4)for(n=l.slice(arguments[1],arguments[2]),i=arguments[3],s=function(m,_){return i.compare(m,_)},n.sort(s),f=l.slice(0,arguments[1]).concat(n,l.slice(arguments[2],l.length)),l.splice(0,l.length),t=0;t<f.length;t++)l.push(f[t])},We.asList=function(t){for(var n=new V,i=0,s=t.length;i<s;i++)n.add(t[i]);return n};var bt=function(){},Xe={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}};Xe.P.get=function(){return 0},Xe.L.get=function(){return 1},Xe.A.get=function(){return 2},Xe.FALSE.get=function(){return-1},Xe.TRUE.get=function(){return-2},Xe.DONTCARE.get=function(){return-3},Xe.SYM_FALSE.get=function(){return"F"},Xe.SYM_TRUE.get=function(){return"T"},Xe.SYM_DONTCARE.get=function(){return"*"},Xe.SYM_P.get=function(){return"0"},Xe.SYM_L.get=function(){return"1"},Xe.SYM_A.get=function(){return"2"},bt.prototype.interfaces_=function(){return[]},bt.prototype.getClass=function(){return bt},bt.toDimensionSymbol=function(t){switch(t){case bt.FALSE:return bt.SYM_FALSE;case bt.TRUE:return bt.SYM_TRUE;case bt.DONTCARE:return bt.SYM_DONTCARE;case bt.P:return bt.SYM_P;case bt.L:return bt.SYM_L;case bt.A:return bt.SYM_A}throw new L("Unknown dimension value: "+t)},bt.toDimensionValue=function(t){switch(mt.toUpperCase(t)){case bt.SYM_FALSE:return bt.FALSE;case bt.SYM_TRUE:return bt.TRUE;case bt.SYM_DONTCARE:return bt.DONTCARE;case bt.SYM_P:return bt.P;case bt.SYM_L:return bt.L;case bt.SYM_A:return bt.A}throw new L("Unknown dimension symbol: "+t)},Object.defineProperties(bt,Xe);var je=function(){};je.prototype.filter=function(t){},je.prototype.interfaces_=function(){return[]},je.prototype.getClass=function(){return je};var Ye=function(){};Ye.prototype.filter=function(t,n){},Ye.prototype.isDone=function(){},Ye.prototype.isGeometryChanged=function(){},Ye.prototype.interfaces_=function(){return[]},Ye.prototype.getClass=function(){return Ye};var Fe=function(t){function n(s,l){if(t.call(this,l),this._geometries=s||[],t.hasNullElements(this._geometries))throw new L("geometries must not contain null elements")}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={serialVersionUID:{configurable:!0}};return n.prototype.computeEnvelopeInternal=function(){for(var s=new at,l=0;l<this._geometries.length;l++)s.expandToInclude(this._geometries[l].getEnvelopeInternal());return s},n.prototype.getGeometryN=function(s){return this._geometries[s]},n.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},n.prototype.getCoordinates=function(){for(var s=new Array(this.getNumPoints()).fill(null),l=-1,f=0;f<this._geometries.length;f++)for(var m=this._geometries[f].getCoordinates(),_=0;_<m.length;_++)s[++l]=m[_];return s},n.prototype.getArea=function(){for(var s=0,l=0;l<this._geometries.length;l++)s+=this._geometries[l].getArea();return s},n.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];if(!this.isEquivalentClass(s))return!1;var f=s;if(this._geometries.length!==f._geometries.length)return!1;for(var m=0;m<this._geometries.length;m++)if(!this._geometries[m].equalsExact(f._geometries[m],l))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.normalize=function(){for(var s=0;s<this._geometries.length;s++)this._geometries[s].normalize();We.sort(this._geometries)},n.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},n.prototype.getBoundaryDimension=function(){for(var s=bt.FALSE,l=0;l<this._geometries.length;l++)s=Math.max(s,this._geometries[l].getBoundaryDimension());return s},n.prototype.getDimension=function(){for(var s=bt.FALSE,l=0;l<this._geometries.length;l++)s=Math.max(s,this._geometries[l].getDimension());return s},n.prototype.getLength=function(){for(var s=0,l=0;l<this._geometries.length;l++)s+=this._geometries[l].getLength();return s},n.prototype.getNumPoints=function(){for(var s=0,l=0;l<this._geometries.length;l++)s+=this._geometries[l].getNumPoints();return s},n.prototype.getNumGeometries=function(){return this._geometries.length},n.prototype.reverse=function(){for(var s=this._geometries.length,l=new Array(s).fill(null),f=0;f<this._geometries.length;f++)l[f]=this._geometries[f].reverse();return this.getFactory().createGeometryCollection(l)},n.prototype.compareToSameClass=function(){if(arguments.length===1){var s=arguments[0],l=new w(We.asList(this._geometries)),f=new w(We.asList(s._geometries));return this.compare(l,f)}if(arguments.length===2){for(var m=arguments[0],_=arguments[1],S=m,O=this.getNumGeometries(),H=S.getNumGeometries(),X=0;X<O&&X<H;){var nt=this.getGeometryN(X),rt=S.getGeometryN(X),lt=nt.compareToSameClass(rt,_);if(lt!==0)return lt;X++}return X<O?1:X<H?-1:0}},n.prototype.apply=function(){if(et(arguments[0],B))for(var s=arguments[0],l=0;l<this._geometries.length;l++)this._geometries[l].apply(s);else if(et(arguments[0],Ye)){var f=arguments[0];if(this._geometries.length===0)return null;for(var m=0;m<this._geometries.length&&(this._geometries[m].apply(f),!f.isDone());m++);f.isGeometryChanged()&&this.geometryChanged()}else if(et(arguments[0],je)){var _=arguments[0];_.filter(this);for(var S=0;S<this._geometries.length;S++)this._geometries[S].apply(_)}else if(et(arguments[0],li)){var O=arguments[0];O.filter(this);for(var H=0;H<this._geometries.length;H++)this._geometries[H].apply(O)}},n.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),_t.shouldNeverReachHere(),null},n.prototype.clone=function(){var s=t.prototype.clone.call(this);s._geometries=new Array(this._geometries.length).fill(null);for(var l=0;l<this._geometries.length;l++)s._geometries[l]=this._geometries[l].clone();return s},n.prototype.getGeometryType=function(){return"GeometryCollection"},n.prototype.copy=function(){for(var s=new Array(this._geometries.length).fill(null),l=0;l<s.length;l++)s[l]=this._geometries[l].copy();return new n(s,this._factory)},n.prototype.isEmpty=function(){for(var s=0;s<this._geometries.length;s++)if(!this._geometries[s].isEmpty())return!1;return!0},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(n,i),n}(yt),Rr=function(t){function n(){t.apply(this,arguments)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={serialVersionUID:{configurable:!0}};return n.prototype.getSortIndex=function(){return yt.SORTINDEX_MULTILINESTRING},n.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];return!!this.isEquivalentClass(s)&&t.prototype.equalsExact.call(this,s,l)}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.getBoundaryDimension=function(){return this.isClosed()?bt.FALSE:0},n.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var s=0;s<this._geometries.length;s++)if(!this._geometries[s].isClosed())return!1;return!0},n.prototype.getDimension=function(){return 1},n.prototype.reverse=function(){for(var s=this._geometries.length,l=new Array(s).fill(null),f=0;f<this._geometries.length;f++)l[s-1-f]=this._geometries[f].reverse();return this.getFactory().createMultiLineString(l)},n.prototype.getBoundary=function(){return new ur(this).getBoundary()},n.prototype.getGeometryType=function(){return"MultiLineString"},n.prototype.copy=function(){for(var s=new Array(this._geometries.length).fill(null),l=0;l<s.length;l++)s[l]=this._geometries[l].copy();return new n(s,this._factory)},n.prototype.interfaces_=function(){return[dn]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(n,i),n}(Fe),ur=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var t=arguments[0],n=y.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=n}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._geom=i,this._geomFact=i.getFactory(),this._bnRule=s}};ur.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var n=this.computeBoundaryCoordinates(t);return n.length===1?this._geomFact.createPoint(n[0]):this._geomFact.createMultiPointFromCoords(n)},ur.prototype.getBoundary=function(){return this._geom instanceof Ge?this.boundaryLineString(this._geom):this._geom instanceof Rr?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},ur.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},ur.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},ur.prototype.computeBoundaryCoordinates=function(t){var n=new V;this._endpointMap=new x;for(var i=0;i<t.getNumGeometries();i++){var s=t.getGeometryN(i);s.getNumPoints()!==0&&(this.addEndpoint(s.getCoordinateN(0)),this.addEndpoint(s.getCoordinateN(s.getNumPoints()-1)))}for(var l=this._endpointMap.entrySet().iterator();l.hasNext();){var f=l.next(),m=f.getValue().count;this._bnRule.isInBoundary(m)&&n.add(f.getKey())}return J.toCoordinateArray(n)},ur.prototype.addEndpoint=function(t){var n=this._endpointMap.get(t);n===null&&(n=new $o,this._endpointMap.put(t,n)),n.count++},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur},ur.getBoundary=function(){if(arguments.length===1){var t=arguments[0];return new ur(t).getBoundary()}if(arguments.length===2){var n=arguments[0],i=arguments[1];return new ur(n,i).getBoundary()}};var $o=function(){this.count=null};$o.prototype.interfaces_=function(){return[]},$o.prototype.getClass=function(){return $o};var lr=function(){},Ku={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr},lr.chars=function(t,n){for(var i=new Array(n).fill(null),s=0;s<n;s++)i[s]=t;return String(i)},lr.getStackTrace=function(){if(arguments.length===1){var t=arguments[0],n=new function(){},i=new function(){}(n);return t.printStackTrace(i),n.toString()}if(arguments.length===2){for(var s=arguments[0],l=arguments[1],f="",m=new function(){}(new function(){}(lr.getStackTrace(s))),_=0;_<l;_++)try{f+=m.readLine()+lr.NEWLINE}catch(S){if(!(S instanceof I))throw S;_t.shouldNeverReachHere()}return f}},lr.split=function(t,n){for(var i=n.length,s=new V,l=""+t,f=l.indexOf(n);f>=0;){var m=l.substring(0,f);s.add(m),f=(l=l.substring(f+i)).indexOf(n)}l.length>0&&s.add(l);for(var _=new Array(s.size()).fill(null),S=0;S<_.length;S++)_[S]=s.get(S);return _},lr.toString=function(){if(arguments.length===1){var t=arguments[0];return lr.SIMPLE_ORDINATE_FORMAT.format(t)}},lr.spaces=function(t){return lr.chars(" ",t)},Ku.NEWLINE.get=function(){return Ee.getProperty("line.separator")},Ku.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(lr,Ku);var $e=function(){};$e.prototype.interfaces_=function(){return[]},$e.prototype.getClass=function(){return $e},$e.copyCoord=function(t,n,i,s){for(var l=Math.min(t.getDimension(),i.getDimension()),f=0;f<l;f++)i.setOrdinate(s,f,t.getOrdinate(n,f))},$e.isRing=function(t){var n=t.size();return n===0||!(n<=3)&&t.getOrdinate(0,ut.X)===t.getOrdinate(n-1,ut.X)&&t.getOrdinate(0,ut.Y)===t.getOrdinate(n-1,ut.Y)},$e.isEqual=function(t,n){var i=t.size();if(i!==n.size())return!1;for(var s=Math.min(t.getDimension(),n.getDimension()),l=0;l<i;l++)for(var f=0;f<s;f++){var m=t.getOrdinate(l,f),_=n.getOrdinate(l,f);if(t.getOrdinate(l,f)!==n.getOrdinate(l,f)&&(!P.isNaN(m)||!P.isNaN(_)))return!1}return!0},$e.extend=function(t,n,i){var s=t.create(i,n.getDimension()),l=n.size();if($e.copy(n,0,s,0,l),l>0)for(var f=l;f<i;f++)$e.copy(n,l-1,s,f,1);return s},$e.reverse=function(t){for(var n=t.size()-1,i=Math.trunc(n/2),s=0;s<=i;s++)$e.swap(t,s,n-s)},$e.swap=function(t,n,i){if(n===i)return null;for(var s=0;s<t.getDimension();s++){var l=t.getOrdinate(n,s);t.setOrdinate(n,s,t.getOrdinate(i,s)),t.setOrdinate(i,s,l)}},$e.copy=function(t,n,i,s,l){for(var f=0;f<l;f++)$e.copyCoord(t,n+f,i,s+f)},$e.toString=function(){if(arguments.length===1){var t=arguments[0],n=t.size();if(n===0)return"()";var i=t.getDimension(),s=new Rt;s.append("(");for(var l=0;l<n;l++){l>0&&s.append(" ");for(var f=0;f<i;f++)f>0&&s.append(","),s.append(lr.toString(t.getOrdinate(l,f)))}return s.append(")"),s.toString()}},$e.ensureValidRing=function(t,n){var i=n.size();return i===0?n:i<=3?$e.createClosedRing(t,n,4):n.getOrdinate(0,ut.X)===n.getOrdinate(i-1,ut.X)&&n.getOrdinate(0,ut.Y)===n.getOrdinate(i-1,ut.Y)?n:$e.createClosedRing(t,n,i+1)},$e.createClosedRing=function(t,n,i){var s=t.create(i,n.getDimension()),l=n.size();$e.copy(n,0,s,0,l);for(var f=l;f<i;f++)$e.copy(n,0,s,f,1);return s};var Ge=function(t){function n(s,l){t.call(this,l),this._points=null,this.init(s)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={serialVersionUID:{configurable:!0}};return n.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new at:this._points.expandEnvelope(new at)},n.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},n.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},n.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},n.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];if(!this.isEquivalentClass(s))return!1;var f=s;if(this._points.size()!==f._points.size())return!1;for(var m=0;m<this._points.size();m++)if(!this.equal(this._points.getCoordinate(m),f._points.getCoordinate(m),l))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.normalize=function(){for(var s=0;s<Math.trunc(this._points.size()/2);s++){var l=this._points.size()-1-s;if(!this._points.getCoordinate(s).equals(this._points.getCoordinate(l)))return this._points.getCoordinate(s).compareTo(this._points.getCoordinate(l))>0&&$e.reverse(this._points),null}},n.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},n.prototype.getBoundaryDimension=function(){return this.isClosed()?bt.FALSE:0},n.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},n.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},n.prototype.getDimension=function(){return 1},n.prototype.getLength=function(){return tt.computeLength(this._points)},n.prototype.getNumPoints=function(){return this._points.size()},n.prototype.reverse=function(){var s=this._points.copy();return $e.reverse(s),this.getFactory().createLineString(s)},n.prototype.compareToSameClass=function(){if(arguments.length===1){for(var s=arguments[0],l=0,f=0;l<this._points.size()&&f<s._points.size();){var m=this._points.getCoordinate(l).compareTo(s._points.getCoordinate(f));if(m!==0)return m;l++,f++}return l<this._points.size()?1:f<s._points.size()?-1:0}if(arguments.length===2){var _=arguments[0];return arguments[1].compare(this._points,_._points)}},n.prototype.apply=function(){if(et(arguments[0],B))for(var s=arguments[0],l=0;l<this._points.size();l++)s.filter(this._points.getCoordinate(l));else if(et(arguments[0],Ye)){var f=arguments[0];if(this._points.size()===0)return null;for(var m=0;m<this._points.size()&&(f.filter(this._points,m),!f.isDone());m++);f.isGeometryChanged()&&this.geometryChanged()}else et(arguments[0],je)?arguments[0].filter(this):et(arguments[0],li)&&arguments[0].filter(this)},n.prototype.getBoundary=function(){return new ur(this).getBoundary()},n.prototype.isEquivalentClass=function(s){return s instanceof n},n.prototype.clone=function(){var s=t.prototype.clone.call(this);return s._points=this._points.clone(),s},n.prototype.getCoordinateN=function(s){return this._points.getCoordinate(s)},n.prototype.getGeometryType=function(){return"LineString"},n.prototype.copy=function(){return new n(this._points.copy(),this._factory)},n.prototype.getCoordinateSequence=function(){return this._points},n.prototype.isEmpty=function(){return this._points.size()===0},n.prototype.init=function(s){if(s===null&&(s=this.getFactory().getCoordinateSequenceFactory().create([])),s.size()===1)throw new L("Invalid number of points in LineString (found "+s.size()+" - must be 0 or >= 2)");this._points=s},n.prototype.isCoordinate=function(s){for(var l=0;l<this._points.size();l++)if(this._points.getCoordinate(l).equals(s))return!0;return!1},n.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},n.prototype.getPointN=function(s){return this.getFactory().createPoint(this._points.getCoordinate(s))},n.prototype.interfaces_=function(){return[dn]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(n,i),n}(yt),Bs=function(){};Bs.prototype.interfaces_=function(){return[]},Bs.prototype.getClass=function(){return Bs};var cr=function(t){function n(s,l){t.call(this,l),this._coordinates=s||null,this.init(this._coordinates)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={serialVersionUID:{configurable:!0}};return n.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new at;var s=new at;return s.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),s},n.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},n.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},n.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];return!!this.isEquivalentClass(s)&&(!(!this.isEmpty()||!s.isEmpty())||this.isEmpty()===s.isEmpty()&&this.equal(s.getCoordinate(),this.getCoordinate(),l))}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.normalize=function(){},n.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},n.prototype.getBoundaryDimension=function(){return bt.FALSE},n.prototype.getDimension=function(){return 0},n.prototype.getNumPoints=function(){return this.isEmpty()?0:1},n.prototype.reverse=function(){return this.copy()},n.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},n.prototype.compareToSameClass=function(){if(arguments.length===1){var s=arguments[0];return this.getCoordinate().compareTo(s.getCoordinate())}if(arguments.length===2){var l=arguments[0];return arguments[1].compare(this._coordinates,l._coordinates)}},n.prototype.apply=function(){if(et(arguments[0],B)){var s=arguments[0];if(this.isEmpty())return null;s.filter(this.getCoordinate())}else if(et(arguments[0],Ye)){var l=arguments[0];if(this.isEmpty())return null;l.filter(this._coordinates,0),l.isGeometryChanged()&&this.geometryChanged()}else et(arguments[0],je)?arguments[0].filter(this):et(arguments[0],li)&&arguments[0].filter(this)},n.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},n.prototype.clone=function(){var s=t.prototype.clone.call(this);return s._coordinates=this._coordinates.clone(),s},n.prototype.getGeometryType=function(){return"Point"},n.prototype.copy=function(){return new n(this._coordinates.copy(),this._factory)},n.prototype.getCoordinateSequence=function(){return this._coordinates},n.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},n.prototype.isEmpty=function(){return this._coordinates.size()===0},n.prototype.init=function(s){s===null&&(s=this.getFactory().getCoordinateSequenceFactory().create([])),_t.isTrue(s.size()<=1),this._coordinates=s},n.prototype.isSimple=function(){return!0},n.prototype.interfaces_=function(){return[Bs]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(n,i),n}(yt),Gi=function(){};Gi.prototype.interfaces_=function(){return[]},Gi.prototype.getClass=function(){return Gi};var an=function(t){function n(s,l,f){if(t.call(this,f),this._shell=null,this._holes=null,s===null&&(s=this.getFactory().createLinearRing()),l===null&&(l=[]),t.hasNullElements(l))throw new L("holes must not contain null elements");if(s.isEmpty()&&t.hasNonEmptyElements(l))throw new L("shell is empty but holes are not");this._shell=s,this._holes=l}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={serialVersionUID:{configurable:!0}};return n.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},n.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},n.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var s=new Array(this.getNumPoints()).fill(null),l=-1,f=this._shell.getCoordinates(),m=0;m<f.length;m++)s[++l]=f[m];for(var _=0;_<this._holes.length;_++)for(var S=this._holes[_].getCoordinates(),O=0;O<S.length;O++)s[++l]=S[O];return s},n.prototype.getArea=function(){var s=0;s+=Math.abs(tt.signedArea(this._shell.getCoordinateSequence()));for(var l=0;l<this._holes.length;l++)s-=Math.abs(tt.signedArea(this._holes[l].getCoordinateSequence()));return s},n.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var s=this._shell.getCoordinateSequence(),l=this.getEnvelopeInternal(),f=0;f<5;f++){var m=s.getX(f);if(m!==l.getMinX()&&m!==l.getMaxX())return!1;var _=s.getY(f);if(_!==l.getMinY()&&_!==l.getMaxY())return!1}for(var S=s.getX(0),O=s.getY(0),H=1;H<=4;H++){var X=s.getX(H),nt=s.getY(H);if(X!==S==(nt!==O))return!1;S=X,O=nt}return!0},n.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];if(!this.isEquivalentClass(s))return!1;var f=s,m=this._shell,_=f._shell;if(!m.equalsExact(_,l)||this._holes.length!==f._holes.length)return!1;for(var S=0;S<this._holes.length;S++)if(!this._holes[S].equalsExact(f._holes[S],l))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var s=0;s<this._holes.length;s++)this.normalize(this._holes[s],!1);We.sort(this._holes)}else if(arguments.length===2){var l=arguments[0],f=arguments[1];if(l.isEmpty())return null;var m=new Array(l.getCoordinates().length-1).fill(null);Ee.arraycopy(l.getCoordinates(),0,m,0,m.length);var _=J.minCoordinate(l.getCoordinates());J.scroll(m,_),Ee.arraycopy(m,0,l.getCoordinates(),0,m.length),l.getCoordinates()[m.length]=m[0],tt.isCCW(l.getCoordinates())===f&&J.reverse(l.getCoordinates())}},n.prototype.getCoordinate=function(){return this._shell.getCoordinate()},n.prototype.getNumInteriorRing=function(){return this._holes.length},n.prototype.getBoundaryDimension=function(){return 1},n.prototype.getDimension=function(){return 2},n.prototype.getLength=function(){var s=0;s+=this._shell.getLength();for(var l=0;l<this._holes.length;l++)s+=this._holes[l].getLength();return s},n.prototype.getNumPoints=function(){for(var s=this._shell.getNumPoints(),l=0;l<this._holes.length;l++)s+=this._holes[l].getNumPoints();return s},n.prototype.reverse=function(){var s=this.copy();s._shell=this._shell.copy().reverse(),s._holes=new Array(this._holes.length).fill(null);for(var l=0;l<this._holes.length;l++)s._holes[l]=this._holes[l].copy().reverse();return s},n.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},n.prototype.compareToSameClass=function(){if(arguments.length===1){var s=arguments[0],l=this._shell,f=s._shell;return l.compareToSameClass(f)}if(arguments.length===2){var m=arguments[0],_=arguments[1],S=m,O=this._shell,H=S._shell,X=O.compareToSameClass(H,_);if(X!==0)return X;for(var nt=this.getNumInteriorRing(),rt=S.getNumInteriorRing(),lt=0;lt<nt&<<rt;){var gt=this.getInteriorRingN(lt),we=S.getInteriorRingN(lt),rn=gt.compareToSameClass(we,_);if(rn!==0)return rn;lt++}return lt<nt?1:lt<rt?-1:0}},n.prototype.apply=function(s){if(et(s,B)){this._shell.apply(s);for(var l=0;l<this._holes.length;l++)this._holes[l].apply(s)}else if(et(s,Ye)){if(this._shell.apply(s),!s.isDone())for(var f=0;f<this._holes.length&&(this._holes[f].apply(s),!s.isDone());f++);s.isGeometryChanged()&&this.geometryChanged()}else if(et(s,je))s.filter(this);else if(et(s,li)){s.filter(this),this._shell.apply(s);for(var m=0;m<this._holes.length;m++)this._holes[m].apply(s)}},n.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var s=new Array(this._holes.length+1).fill(null);s[0]=this._shell;for(var l=0;l<this._holes.length;l++)s[l+1]=this._holes[l];return s.length<=1?this.getFactory().createLinearRing(s[0].getCoordinateSequence()):this.getFactory().createMultiLineString(s)},n.prototype.clone=function(){var s=t.prototype.clone.call(this);s._shell=this._shell.clone(),s._holes=new Array(this._holes.length).fill(null);for(var l=0;l<this._holes.length;l++)s._holes[l]=this._holes[l].clone();return s},n.prototype.getGeometryType=function(){return"Polygon"},n.prototype.copy=function(){for(var s=this._shell.copy(),l=new Array(this._holes.length).fill(null),f=0;f<l.length;f++)l[f]=this._holes[f].copy();return new n(s,l,this._factory)},n.prototype.getExteriorRing=function(){return this._shell},n.prototype.isEmpty=function(){return this._shell.isEmpty()},n.prototype.getInteriorRingN=function(s){return this._holes[s]},n.prototype.interfaces_=function(){return[Gi]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(n,i),n}(yt),Zo=function(t){function n(){t.apply(this,arguments)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={serialVersionUID:{configurable:!0}};return n.prototype.getSortIndex=function(){return yt.SORTINDEX_MULTIPOINT},n.prototype.isValid=function(){return!0},n.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];return!!this.isEquivalentClass(s)&&t.prototype.equalsExact.call(this,s,l)}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.getCoordinate=function(){if(arguments.length===1){var s=arguments[0];return this._geometries[s].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},n.prototype.getBoundaryDimension=function(){return bt.FALSE},n.prototype.getDimension=function(){return 0},n.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},n.prototype.getGeometryType=function(){return"MultiPoint"},n.prototype.copy=function(){for(var s=new Array(this._geometries.length).fill(null),l=0;l<s.length;l++)s[l]=this._geometries[l].copy();return new n(s,this._factory)},n.prototype.interfaces_=function(){return[Bs]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(n,i),n}(Fe),ci=function(t){function n(s,l){s instanceof C&&l instanceof Tt&&(s=l.getCoordinateSequenceFactory().create(s)),t.call(this,s,l),this.validateConstruction()}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return n.prototype.getSortIndex=function(){return yt.SORTINDEX_LINEARRING},n.prototype.getBoundaryDimension=function(){return bt.FALSE},n.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},n.prototype.reverse=function(){var s=this._points.copy();return $e.reverse(s),this.getFactory().createLinearRing(s)},n.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new L("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<n.MINIMUM_VALID_SIZE)throw new L("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},n.prototype.getGeometryType=function(){return"LinearRing"},n.prototype.copy=function(){return new n(this._points.copy(),this._factory)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},i.MINIMUM_VALID_SIZE.get=function(){return 4},i.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(n,i),n}(Ge),hi=function(t){function n(){t.apply(this,arguments)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={serialVersionUID:{configurable:!0}};return n.prototype.getSortIndex=function(){return yt.SORTINDEX_MULTIPOLYGON},n.prototype.equalsExact=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];return!!this.isEquivalentClass(s)&&t.prototype.equalsExact.call(this,s,l)}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.getBoundaryDimension=function(){return 1},n.prototype.getDimension=function(){return 2},n.prototype.reverse=function(){for(var s=this._geometries.length,l=new Array(s).fill(null),f=0;f<this._geometries.length;f++)l[f]=this._geometries[f].reverse();return this.getFactory().createMultiPolygon(l)},n.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var s=new V,l=0;l<this._geometries.length;l++)for(var f=this._geometries[l].getBoundary(),m=0;m<f.getNumGeometries();m++)s.add(f.getGeometryN(m));var _=new Array(s.size()).fill(null);return this.getFactory().createMultiLineString(s.toArray(_))},n.prototype.getGeometryType=function(){return"MultiPolygon"},n.prototype.copy=function(){for(var s=new Array(this._geometries.length).fill(null),l=0;l<s.length;l++)s[l]=this._geometries[l].copy();return new n(s,this._factory)},n.prototype.interfaces_=function(){return[Gi]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(n,i),n}(Fe),Nr=function(t){this._factory=t||null,this._isUserDataCopied=!1},Ca={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Nr.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},Nr.prototype.edit=function(t,n){if(t===null)return null;var i=this.editInternal(t,n);return this._isUserDataCopied&&i.setUserData(t.getUserData()),i},Nr.prototype.editInternal=function(t,n){return this._factory===null&&(this._factory=t.getFactory()),t instanceof Fe?this.editGeometryCollection(t,n):t instanceof an?this.editPolygon(t,n):t instanceof cr?n.edit(t,this._factory):t instanceof Ge?n.edit(t,this._factory):(_t.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},Nr.prototype.editGeometryCollection=function(t,n){for(var i=n.edit(t,this._factory),s=new V,l=0;l<i.getNumGeometries();l++){var f=this.edit(i.getGeometryN(l),n);f===null||f.isEmpty()||s.add(f)}return i.getClass()===Zo?this._factory.createMultiPoint(s.toArray([])):i.getClass()===Rr?this._factory.createMultiLineString(s.toArray([])):i.getClass()===hi?this._factory.createMultiPolygon(s.toArray([])):this._factory.createGeometryCollection(s.toArray([]))},Nr.prototype.editPolygon=function(t,n){var i=n.edit(t,this._factory);if(i===null&&(i=this._factory.createPolygon(null)),i.isEmpty())return i;var s=this.edit(i.getExteriorRing(),n);if(s===null||s.isEmpty())return this._factory.createPolygon();for(var l=new V,f=0;f<i.getNumInteriorRing();f++){var m=this.edit(i.getInteriorRingN(f),n);m===null||m.isEmpty()||l.add(m)}return this._factory.createPolygon(s,l.toArray([]))},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr},Nr.GeometryEditorOperation=function(){},Ca.NoOpGeometryOperation.get=function(){return zs},Ca.CoordinateOperation.get=function(){return ks},Ca.CoordinateSequenceOperation.get=function(){return Gs},Object.defineProperties(Nr,Ca);var zs=function(){};zs.prototype.edit=function(t,n){return t},zs.prototype.interfaces_=function(){return[Nr.GeometryEditorOperation]},zs.prototype.getClass=function(){return zs};var ks=function(){};ks.prototype.edit=function(t,n){var i=this.editCoordinates(t.getCoordinates(),t);return i===null?t:t instanceof ci?n.createLinearRing(i):t instanceof Ge?n.createLineString(i):t instanceof cr?i.length>0?n.createPoint(i[0]):n.createPoint():t},ks.prototype.interfaces_=function(){return[Nr.GeometryEditorOperation]},ks.prototype.getClass=function(){return ks};var Gs=function(){};Gs.prototype.edit=function(t,n){return t instanceof ci?n.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Ge?n.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof cr?n.createPoint(this.edit(t.getCoordinateSequence(),t)):t},Gs.prototype.interfaces_=function(){return[Nr.GeometryEditorOperation]},Gs.prototype.getClass=function(){return Gs};var Ze=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 t=arguments[0];this._coordinates=new Array(t).fill(null);for(var n=0;n<t;n++)this._coordinates[n]=new C}else if(et(arguments[0],ut)){var i=arguments[0];if(i===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=i.getDimension(),this._coordinates=new Array(i.size()).fill(null);for(var s=0;s<this._coordinates.length;s++)this._coordinates[s]=i.getCoordinateCopy(s)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var l=arguments[0],f=arguments[1];this._coordinates=l,this._dimension=f,l===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var m=arguments[0],_=arguments[1];this._coordinates=new Array(m).fill(null),this._dimension=_;for(var S=0;S<m;S++)this._coordinates[S]=new C}}},Dh={serialVersionUID:{configurable:!0}};Ze.prototype.setOrdinate=function(t,n,i){switch(n){case ut.X:this._coordinates[t].x=i;break;case ut.Y:this._coordinates[t].y=i;break;case ut.Z:this._coordinates[t].z=i;break;default:throw new L("invalid ordinateIndex")}},Ze.prototype.size=function(){return this._coordinates.length},Ze.prototype.getOrdinate=function(t,n){switch(n){case ut.X:return this._coordinates[t].x;case ut.Y:return this._coordinates[t].y;case ut.Z:return this._coordinates[t].z}return P.NaN},Ze.prototype.getCoordinate=function(){if(arguments.length===1){var t=arguments[0];return this._coordinates[t]}if(arguments.length===2){var n=arguments[0],i=arguments[1];i.x=this._coordinates[n].x,i.y=this._coordinates[n].y,i.z=this._coordinates[n].z}},Ze.prototype.getCoordinateCopy=function(t){return new C(this._coordinates[t])},Ze.prototype.getDimension=function(){return this._dimension},Ze.prototype.getX=function(t){return this._coordinates[t].x},Ze.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),n=0;n<this._coordinates.length;n++)t[n]=this._coordinates[n].clone();return new Ze(t,this._dimension)},Ze.prototype.expandEnvelope=function(t){for(var n=0;n<this._coordinates.length;n++)t.expandToInclude(this._coordinates[n]);return t},Ze.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),n=0;n<this._coordinates.length;n++)t[n]=this._coordinates[n].copy();return new Ze(t,this._dimension)},Ze.prototype.toString=function(){if(this._coordinates.length>0){var t=new Rt(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var n=1;n<this._coordinates.length;n++)t.append(", "),t.append(this._coordinates[n]);return t.append(")"),t.toString()}return"()"},Ze.prototype.getY=function(t){return this._coordinates[t].y},Ze.prototype.toCoordinateArray=function(){return this._coordinates},Ze.prototype.interfaces_=function(){return[ut,e]},Ze.prototype.getClass=function(){return Ze},Dh.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(Ze,Dh);var fi=function(){},Qu={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};fi.prototype.readResolve=function(){return fi.instance()},fi.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new Ze(t)}if(et(arguments[0],ut)){var n=arguments[0];return new Ze(n)}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];return s>3&&(s=3),s<2?new Ze(i):new Ze(i,s)}},fi.prototype.interfaces_=function(){return[dt,e]},fi.prototype.getClass=function(){return fi},fi.instance=function(){return fi.instanceObject},Qu.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Qu.instanceObject.get=function(){return new fi},Object.defineProperties(fi,Qu);var Oh=function(t){function n(){t.call(this),this.map_=new Map}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.get=function(i){return this.map_.get(i)||null},n.prototype.put=function(i,s){return this.map_.set(i,s),s},n.prototype.values=function(){for(var i=new V,s=this.map_.values(),l=s.next();!l.done;)i.add(l.value),l=s.next();return i},n.prototype.entrySet=function(){var i=new En;return this.map_.entries().forEach(function(s){return i.add(s)}),i},n.prototype.size=function(){return this.map_.size()},n}(At),se=function t(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=t.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Jr){var n=arguments[0];this._modelType=n,n===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var i=arguments[0];this._modelType=t.FIXED,this.setScale(i)}else if(arguments[0]instanceof t){var s=arguments[0];this._modelType=s._modelType,this._scale=s._scale}}},ju={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};se.prototype.equals=function(t){if(!(t instanceof se))return!1;var n=t;return this._modelType===n._modelType&&this._scale===n._scale},se.prototype.compareTo=function(t){var n=t,i=this.getMaximumSignificantDigits(),s=n.getMaximumSignificantDigits();return new it(i).compareTo(new it(s))},se.prototype.getScale=function(){return this._scale},se.prototype.isFloating=function(){return this._modelType===se.FLOATING||this._modelType===se.FLOATING_SINGLE},se.prototype.getType=function(){return this._modelType},se.prototype.toString=function(){var t="UNKNOWN";return this._modelType===se.FLOATING?t="Floating":this._modelType===se.FLOATING_SINGLE?t="Floating-Single":this._modelType===se.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},se.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];return P.isNaN(t)||this._modelType===se.FLOATING_SINGLE?t:this._modelType===se.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof C){var n=arguments[0];if(this._modelType===se.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}},se.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===se.FLOATING?t=16:this._modelType===se.FLOATING_SINGLE?t=6:this._modelType===se.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},se.prototype.setScale=function(t){this._scale=Math.abs(t)},se.prototype.interfaces_=function(){return[e,k]},se.prototype.getClass=function(){return se},se.mostPrecise=function(t,n){return t.compareTo(n)>=0?t:n},ju.serialVersionUID.get=function(){return 7777263578777804e3},ju.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(se,ju);var Jr=function t(n){this._name=n||null,t.nameToTypeMap.put(n,this)},tl={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Jr.prototype.readResolve=function(){return Jr.nameToTypeMap.get(this._name)},Jr.prototype.toString=function(){return this._name},Jr.prototype.interfaces_=function(){return[e]},Jr.prototype.getClass=function(){return Jr},tl.serialVersionUID.get=function(){return-552860263173159e4},tl.nameToTypeMap.get=function(){return new Oh},Object.defineProperties(Jr,tl),se.Type=Jr,se.FIXED=new Jr("FIXED"),se.FLOATING=new Jr("FLOATING"),se.FLOATING_SINGLE=new Jr("FLOATING SINGLE");var Tt=function t(){this._precisionModel=new se,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?et(arguments[0],dt)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof se&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},Fh={serialVersionUID:{configurable:!0}};Tt.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new C(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new C(t.getMinX(),t.getMinY()),new C(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new C(t.getMinX(),t.getMinY()),new C(t.getMinX(),t.getMaxY()),new C(t.getMaxX(),t.getMaxY()),new C(t.getMaxX(),t.getMinY()),new C(t.getMinX(),t.getMinY())]),null)},Tt.prototype.createLineString=function(t){return t?t instanceof Array?new Ge(this.getCoordinateSequenceFactory().create(t),this):et(t,ut)?new Ge(t,this):void 0:new Ge(this.getCoordinateSequenceFactory().create([]),this)},Tt.prototype.createMultiLineString=function(){if(arguments.length===0)return new Rr(null,this);if(arguments.length===1){var t=arguments[0];return new Rr(t,this)}},Tt.prototype.buildGeometry=function(t){for(var n=null,i=!1,s=!1,l=t.iterator();l.hasNext();){var f=l.next(),m=f.getClass();n===null&&(n=m),m!==n&&(i=!0),f.isGeometryCollectionOrDerived()&&(s=!0)}if(n===null)return this.createGeometryCollection();if(i||s)return this.createGeometryCollection(Tt.toGeometryArray(t));var _=t.iterator().next();if(t.size()>1){if(_ instanceof an)return this.createMultiPolygon(Tt.toPolygonArray(t));if(_ instanceof Ge)return this.createMultiLineString(Tt.toLineStringArray(t));if(_ instanceof cr)return this.createMultiPoint(Tt.toPointArray(t));_t.shouldNeverReachHere("Unhandled class: "+_.getClass().getName())}return _},Tt.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)},Tt.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof C){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}if(et(arguments[0],ut)){var n=arguments[0];return new cr(n,this)}}},Tt.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Tt.prototype.createPolygon=function(){if(arguments.length===0)return new an(null,null,this);if(arguments.length===1){if(et(arguments[0],ut)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof ci){var i=arguments[0];return this.createPolygon(i,null)}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];return new an(s,l,this)}},Tt.prototype.getSRID=function(){return this._SRID},Tt.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Fe(null,this);if(arguments.length===1){var t=arguments[0];return new Fe(t,this)}},Tt.prototype.createGeometry=function(t){return new Nr(this).edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})},Tt.prototype.getPrecisionModel=function(){return this._precisionModel},Tt.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}if(et(arguments[0],ut)){var n=arguments[0];return new ci(n,this)}}},Tt.prototype.createMultiPolygon=function(){if(arguments.length===0)return new hi(null,this);if(arguments.length===1){var t=arguments[0];return new hi(t,this)}},Tt.prototype.createMultiPoint=function(){if(arguments.length===0)return new Zo(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new Zo(t,this)}if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(et(arguments[0],ut)){var i=arguments[0];if(i===null)return this.createMultiPoint(new Array(0).fill(null));for(var s=new Array(i.size()).fill(null),l=0;l<i.size();l++){var f=this.getCoordinateSequenceFactory().create(1,i.getDimension());$e.copy(i,l,f,0,1),s[l]=this.createPoint(f)}return this.createMultiPoint(s)}}},Tt.prototype.interfaces_=function(){return[e]},Tt.prototype.getClass=function(){return Tt},Tt.toMultiPolygonArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.toGeometryArray=function(t){if(t===null)return null;var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.getDefaultCoordinateSequenceFactory=function(){return fi.instance()},Tt.toMultiLineStringArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.toLineStringArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.toMultiPointArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.toLinearRingArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.toPointArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.toPolygonArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Tt.createPointFromInternalCoord=function(t,n){return n.getPrecisionModel().makePrecise(t),n.getFactory().createPoint(t)},Fh.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(Tt,Fh);var A0=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Ia=function(t){this.geometryFactory=t||new Tt};Ia.prototype.read=function(t){var n,i=(n=typeof t=="string"?JSON.parse(t):t).type;if(!Kr[i])throw new Error("Unknown GeoJSON type: "+n.type);return A0.indexOf(i)!==-1?Kr[i].apply(this,[n.coordinates]):i==="GeometryCollection"?Kr[i].apply(this,[n.geometries]):Kr[i].apply(this,[n])},Ia.prototype.write=function(t){var n=t.getGeometryType();if(!Ci[n])throw new Error("Geometry is not supported");return Ci[n].apply(this,[t])};var Kr={Feature:function(t){var n={};for(var i in t)n[i]=t[i];if(t.geometry){var s=t.geometry.type;if(!Kr[s])throw new Error("Unknown GeoJSON type: "+t.type);n.geometry=this.read(t.geometry)}return t.bbox&&(n.bbox=Kr.bbox.apply(this,[t.bbox])),n},FeatureCollection:function(t){var n={};if(t.features){n.features=[];for(var i=0;i<t.features.length;++i)n.features.push(this.read(t.features[i]))}return t.bbox&&(n.bbox=this.parse.bbox.apply(this,[t.bbox])),n},coordinates:function(t){for(var n=[],i=0;i<t.length;++i){var s=t[i];n.push(new C(s[0],s[1]))}return n},bbox:function(t){return this.geometryFactory.createLinearRing([new C(t[0],t[1]),new C(t[2],t[1]),new C(t[2],t[3]),new C(t[0],t[3]),new C(t[0],t[1])])},Point:function(t){var n=new C(t[0],t[1]);return this.geometryFactory.createPoint(n)},MultiPoint:function(t){for(var n=[],i=0;i<t.length;++i)n.push(Kr.Point.apply(this,[t[i]]));return this.geometryFactory.createMultiPoint(n)},LineString:function(t){var n=Kr.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(n)},MultiLineString:function(t){for(var n=[],i=0;i<t.length;++i)n.push(Kr.LineString.apply(this,[t[i]]));return this.geometryFactory.createMultiLineString(n)},Polygon:function(t){for(var n=Kr.coordinates.apply(this,[t[0]]),i=this.geometryFactory.createLinearRing(n),s=[],l=1;l<t.length;++l){var f=t[l],m=Kr.coordinates.apply(this,[f]),_=this.geometryFactory.createLinearRing(m);s.push(_)}return this.geometryFactory.createPolygon(i,s)},MultiPolygon:function(t){for(var n=[],i=0;i<t.length;++i){var s=t[i];n.push(Kr.Polygon.apply(this,[s]))}return this.geometryFactory.createMultiPolygon(n)},GeometryCollection:function(t){for(var n=[],i=0;i<t.length;++i){var s=t[i];n.push(this.read(s))}return this.geometryFactory.createGeometryCollection(n)}},Ci={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:Ci.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var s=t._geometries[i],l=Ci.Point.apply(this,[s]);n.push(l.coordinates)}return{type:"MultiPoint",coordinates:n}},LineString:function(t){for(var n=[],i=t.getCoordinates(),s=0;s<i.length;++s){var l=i[s];n.push(Ci.coordinate.apply(this,[l]))}return{type:"LineString",coordinates:n}},MultiLineString:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var s=t._geometries[i],l=Ci.LineString.apply(this,[s]);n.push(l.coordinates)}return{type:"MultiLineString",coordinates:n}},Polygon:function(t){var n=[],i=Ci.LineString.apply(this,[t._shell]);n.push(i.coordinates);for(var s=0;s<t._holes.length;++s){var l=t._holes[s],f=Ci.LineString.apply(this,[l]);n.push(f.coordinates)}return{type:"Polygon",coordinates:n}},MultiPolygon:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var s=t._geometries[i],l=Ci.Polygon.apply(this,[s]);n.push(l.coordinates)}return{type:"MultiPolygon",coordinates:n}},GeometryCollection:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var s=t._geometries[i],l=s.getGeometryType();n.push(Ci[l].apply(this,[s]))}return{type:"GeometryCollection",geometries:n}}},el=function(t){this.geometryFactory=t||new Tt,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new Ia(this.geometryFactory)};el.prototype.read=function(t){var n=this.parser.read(t);return this.precisionModel.getType()===se.FIXED&&this.reducePrecision(n),n},el.prototype.reducePrecision=function(t){var n,i;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(n=0,i=t.points.length;n<i;n++)this.precisionModel.makePrecise(t.points[n]);else if(t.geometries)for(n=0,i=t.geometries.length;n<i;n++)this.reducePrecision(t.geometries[n])};var Uh=function(){this.parser=new Ia(this.geometryFactory)};Uh.prototype.write=function(t){return this.parser.write(t)};var j=function(){},Pa={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};j.prototype.interfaces_=function(){return[]},j.prototype.getClass=function(){return j},j.opposite=function(t){return t===j.LEFT?j.RIGHT:t===j.RIGHT?j.LEFT:t},Pa.ON.get=function(){return 0},Pa.LEFT.get=function(){return 1},Pa.RIGHT.get=function(){return 2},Object.defineProperties(j,Pa),(D.prototype=new Error).name="EmptyStackException",(b.prototype=new Z).add=function(t){return this.array_.push(t),!0},b.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},b.prototype.push=function(t){return this.array_.push(t),t},b.prototype.pop=function(t){if(this.array_.length===0)throw new D;return this.array_.pop()},b.prototype.peek=function(){if(this.array_.length===0)throw new D;return this.array_[this.array_.length-1]},b.prototype.empty=function(){return this.array_.length===0},b.prototype.isEmpty=function(){return this.empty()},b.prototype.search=function(t){return this.array_.indexOf(t)},b.prototype.size=function(){return this.array_.length},b.prototype.toArray=function(){for(var t=[],n=0,i=this.array_.length;n<i;n++)t.push(this.array_[n]);return t};var Qr=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Qr.prototype.getCoordinate=function(){return this._minCoord},Qr.prototype.getRightmostSide=function(t,n){var i=this.getRightmostSideOfSegment(t,n);return i<0&&(i=this.getRightmostSideOfSegment(t,n-1)),i<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),i},Qr.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();_t.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var n=t[this._minIndex-1],i=t[this._minIndex+1],s=tt.computeOrientation(this._minCoord,i,n),l=!1;(n.y<this._minCoord.y&&i.y<this._minCoord.y&&s===tt.COUNTERCLOCKWISE||n.y>this._minCoord.y&&i.y>this._minCoord.y&&s===tt.CLOCKWISE)&&(l=!0),l&&(this._minIndex=this._minIndex-1)},Qr.prototype.getRightmostSideOfSegment=function(t,n){var i=t.getEdge().getCoordinates();if(n<0||n+1>=i.length||i[n].y===i[n+1].y)return-1;var s=j.LEFT;return i[n].y<i[n+1].y&&(s=j.RIGHT),s},Qr.prototype.getEdge=function(){return this._orientedDe},Qr.prototype.checkForRightmostCoordinate=function(t){for(var n=t.getEdge().getCoordinates(),i=0;i<n.length-1;i++)(this._minCoord===null||n[i].x>this._minCoord.x)&&(this._minDe=t,this._minIndex=i,this._minCoord=n[i])},Qr.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},Qr.prototype.findEdge=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isForward()&&this.checkForRightmostCoordinate(i)}_t.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)===j.LEFT&&(this._orientedDe=this._minDe.getSym())},Qr.prototype.interfaces_=function(){return[]},Qr.prototype.getClass=function(){return Qr};var Ii=function(t){function n(i,s){t.call(this,n.msgWithCoord(i,s)),this.pt=s?new C(s):null,this.name="TopologyException"}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.getCoordinate=function(){return this.pt},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n.msgWithCoord=function(i,s){return s?i:i+" [ "+s+" ]"},n}(Cn),Ra=function(){this.array_=[]};Ra.prototype.addLast=function(t){this.array_.push(t)},Ra.prototype.removeFirst=function(){return this.array_.shift()},Ra.prototype.isEmpty=function(){return this.array_.length===0};var Bn=function(){this._finder=null,this._dirEdgeList=new V,this._nodes=new V,this._rightMostCoord=null,this._env=null,this._finder=new Qr};Bn.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},Bn.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Bn.prototype.computeNodeDepth=function(t){for(var n=null,i=t.getEdges().iterator();i.hasNext();){var s=i.next();if(s.isVisited()||s.getSym().isVisited()){n=s;break}}if(n===null)throw new Ii("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(n);for(var l=t.getEdges().iterator();l.hasNext();){var f=l.next();f.setVisited(!0),this.copySymDepths(f)}},Bn.prototype.computeDepth=function(t){this.clearVisitedEdges();var n=this._finder.getEdge();n.setEdgeDepths(j.RIGHT,t),this.copySymDepths(n),this.computeDepths(n)},Bn.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Bn.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var n=t.next();n.getDepth(j.RIGHT)>=1&&n.getDepth(j.LEFT)<=0&&!n.isInteriorAreaEdge()&&n.setInResult(!0)}},Bn.prototype.computeDepths=function(t){var n=new En,i=new Ra,s=t.getNode();for(i.addLast(s),n.add(s),t.setVisited(!0);!i.isEmpty();){var l=i.removeFirst();n.add(l),this.computeNodeDepth(l);for(var f=l.getEdges().iterator();f.hasNext();){var m=f.next().getSym();if(!m.isVisited()){var _=m.getNode();n.contains(_)||(i.addLast(_),n.add(_))}}}},Bn.prototype.compareTo=function(t){var n=t;return this._rightMostCoord.x<n._rightMostCoord.x?-1:this._rightMostCoord.x>n._rightMostCoord.x?1:0},Bn.prototype.getEnvelope=function(){if(this._env===null){for(var t=new at,n=this._dirEdgeList.iterator();n.hasNext();)for(var i=n.next().getEdge().getCoordinates(),s=0;s<i.length-1;s++)t.expandToInclude(i[s]);this._env=t}return this._env},Bn.prototype.addReachable=function(t){var n=new b;for(n.add(t);!n.empty();){var i=n.pop();this.add(i,n)}},Bn.prototype.copySymDepths=function(t){var n=t.getSym();n.setDepth(j.LEFT,t.getDepth(j.RIGHT)),n.setDepth(j.RIGHT,t.getDepth(j.LEFT))},Bn.prototype.add=function(t,n){t.setVisited(!0),this._nodes.add(t);for(var i=t.getEdges().iterator();i.hasNext();){var s=i.next();this._dirEdgeList.add(s);var l=s.getSym().getNode();l.isVisited()||n.push(l)}},Bn.prototype.getNodes=function(){return this._nodes},Bn.prototype.getDirectedEdges=function(){return this._dirEdgeList},Bn.prototype.interfaces_=function(){return[k]},Bn.prototype.getClass=function(){return Bn};var Ie=function t(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];this.init(n.length)}else if(Number.isInteger(arguments[0])){var i=arguments[0];this.init(1),this.location[j.ON]=i}else if(arguments[0]instanceof t){var s=arguments[0];if(this.init(s.location.length),s!==null)for(var l=0;l<this.location.length;l++)this.location[l]=s.location[l]}}else if(arguments.length===3){var f=arguments[0],m=arguments[1],_=arguments[2];this.init(3),this.location[j.ON]=f,this.location[j.LEFT]=m,this.location[j.RIGHT]=_}};Ie.prototype.setAllLocations=function(t){for(var n=0;n<this.location.length;n++)this.location[n]=t},Ie.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==F.NONE)return!1;return!0},Ie.prototype.setAllLocationsIfNull=function(t){for(var n=0;n<this.location.length;n++)this.location[n]===F.NONE&&(this.location[n]=t)},Ie.prototype.isLine=function(){return this.location.length===1},Ie.prototype.merge=function(t){if(t.location.length>this.location.length){var n=new Array(3).fill(null);n[j.ON]=this.location[j.ON],n[j.LEFT]=F.NONE,n[j.RIGHT]=F.NONE,this.location=n}for(var i=0;i<this.location.length;i++)this.location[i]===F.NONE&&i<t.location.length&&(this.location[i]=t.location[i])},Ie.prototype.getLocations=function(){return this.location},Ie.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[j.LEFT];this.location[j.LEFT]=this.location[j.RIGHT],this.location[j.RIGHT]=t},Ie.prototype.toString=function(){var t=new Rt;return this.location.length>1&&t.append(F.toLocationSymbol(this.location[j.LEFT])),t.append(F.toLocationSymbol(this.location[j.ON])),this.location.length>1&&t.append(F.toLocationSymbol(this.location[j.RIGHT])),t.toString()},Ie.prototype.setLocations=function(t,n,i){this.location[j.ON]=t,this.location[j.LEFT]=n,this.location[j.RIGHT]=i},Ie.prototype.get=function(t){return t<this.location.length?this.location[t]:F.NONE},Ie.prototype.isArea=function(){return this.location.length>1},Ie.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===F.NONE)return!0;return!1},Ie.prototype.setLocation=function(){if(arguments.length===1){var t=arguments[0];this.setLocation(j.ON,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.location[n]=i}},Ie.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(F.NONE)},Ie.prototype.isEqualOnSide=function(t,n){return this.location[n]===t.location[n]},Ie.prototype.allPositionsEqual=function(t){for(var n=0;n<this.location.length;n++)if(this.location[n]!==t)return!1;return!0},Ie.prototype.interfaces_=function(){return[]},Ie.prototype.getClass=function(){return Ie};var Me=function t(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var n=arguments[0];this.elt[0]=new Ie(n),this.elt[1]=new Ie(n)}else if(arguments[0]instanceof t){var i=arguments[0];this.elt[0]=new Ie(i.elt[0]),this.elt[1]=new Ie(i.elt[1])}}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.elt[0]=new Ie(F.NONE),this.elt[1]=new Ie(F.NONE),this.elt[s].setLocation(l)}else if(arguments.length===3){var f=arguments[0],m=arguments[1],_=arguments[2];this.elt[0]=new Ie(f,m,_),this.elt[1]=new Ie(f,m,_)}else if(arguments.length===4){var S=arguments[0],O=arguments[1],H=arguments[2],X=arguments[3];this.elt[0]=new Ie(F.NONE,F.NONE,F.NONE),this.elt[1]=new Ie(F.NONE,F.NONE,F.NONE),this.elt[S].setLocations(O,H,X)}};Me.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},Me.prototype.setAllLocations=function(t,n){this.elt[t].setAllLocations(n)},Me.prototype.isNull=function(t){return this.elt[t].isNull()},Me.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setAllLocationsIfNull(i)}},Me.prototype.isLine=function(t){return this.elt[t].isLine()},Me.prototype.merge=function(t){for(var n=0;n<2;n++)this.elt[n]===null&&t.elt[n]!==null?this.elt[n]=new Ie(t.elt[n]):this.elt[n].merge(t.elt[n])},Me.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},Me.prototype.getLocation=function(){if(arguments.length===1){var t=arguments[0];return this.elt[t].get(j.ON)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.elt[n].get(i)}},Me.prototype.toString=function(){var t=new Rt;return this.elt[0]!==null&&(t.append("A:"),t.append(this.elt[0].toString())),this.elt[1]!==null&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},Me.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var t=arguments[0];return this.elt[t].isArea()}},Me.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},Me.prototype.setLocation=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];this.elt[t].setLocation(j.ON,n)}else if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];this.elt[i].setLocation(s,l)}},Me.prototype.isEqualOnSide=function(t,n){return this.elt[0].isEqualOnSide(t.elt[0],n)&&this.elt[1].isEqualOnSide(t.elt[1],n)},Me.prototype.allPositionsEqual=function(t,n){return this.elt[t].allPositionsEqual(n)},Me.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new Ie(this.elt[t].location[0]))},Me.prototype.interfaces_=function(){return[]},Me.prototype.getClass=function(){return Me},Me.toLineLabel=function(t){for(var n=new Me(F.NONE),i=0;i<2;i++)n.setLocation(i,t.getLocation(i));return n};var tn=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new V,this._pts=new V,this._label=new Me(F.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new V,this._geometryFactory=null;var t=arguments[0],n=arguments[1];this._geometryFactory=n,this.computePoints(t),this.computeRing()};tn.prototype.computeRing=function(){if(this._ring!==null)return null;for(var t=new Array(this._pts.size()).fill(null),n=0;n<this._pts.size();n++)t[n]=this._pts.get(n);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=tt.isCCW(this._ring.getCoordinates())},tn.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},tn.prototype.computePoints=function(t){this._startDe=t;var n=t,i=!0;do{if(n===null)throw new Ii("Found null DirectedEdge");if(n.getEdgeRing()===this)throw new Ii("Directed Edge visited twice during ring-building at "+n.getCoordinate());this._edges.add(n);var s=n.getLabel();_t.isTrue(s.isArea()),this.mergeLabel(s),this.addPoints(n.getEdge(),n.isForward(),i),i=!1,this.setEdgeRing(n,this),n=this.getNext(n)}while(n!==this._startDe)},tn.prototype.getLinearRing=function(){return this._ring},tn.prototype.getCoordinate=function(t){return this._pts.get(t)},tn.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var t=this._startDe;do{var n=t.getNode().getEdges().getOutgoingDegree(this);n>this._maxNodeDegree&&(this._maxNodeDegree=n),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2},tn.prototype.addPoints=function(t,n,i){var s=t.getCoordinates();if(n){var l=1;i&&(l=0);for(var f=l;f<s.length;f++)this._pts.add(s[f])}else{var m=s.length-2;i&&(m=s.length-1);for(var _=m;_>=0;_--)this._pts.add(s[_])}},tn.prototype.isHole=function(){return this._isHole},tn.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)},tn.prototype.containsPoint=function(t){var n=this.getLinearRing();if(!n.getEnvelopeInternal().contains(t)||!tt.isPointInRing(t,n.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();)if(i.next().containsPoint(t))return!1;return!0},tn.prototype.addHole=function(t){this._holes.add(t)},tn.prototype.isShell=function(){return this._shell===null},tn.prototype.getLabel=function(){return this._label},tn.prototype.getEdges=function(){return this._edges},tn.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},tn.prototype.getShell=function(){return this._shell},tn.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=n.getLocation(i,j.RIGHT);if(s===F.NONE)return null;if(this._label.getLocation(i)===F.NONE)return this._label.setLocation(i,s),null}},tn.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)},tn.prototype.toPolygon=function(t){for(var n=new Array(this._holes.size()).fill(null),i=0;i<this._holes.size();i++)n[i]=this._holes.get(i).getLinearRing();return t.createPolygon(this.getLinearRing(),n)},tn.prototype.interfaces_=function(){return[]},tn.prototype.getClass=function(){return tn};var T0=function(t){function n(){var i=arguments[0],s=arguments[1];t.call(this,i,s)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.setEdgeRing=function(i,s){i.setMinEdgeRing(s)},n.prototype.getNext=function(i){return i.getNextMin()},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(tn),C0=function(t){function n(){var i=arguments[0],s=arguments[1];t.call(this,i,s)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.buildMinimalRings=function(){var i=new V,s=this._startDe;do{if(s.getMinEdgeRing()===null){var l=new T0(s,this._geometryFactory);i.add(l)}s=s.getNext()}while(s!==this._startDe);return i},n.prototype.setEdgeRing=function(i,s){i.setEdgeRing(s)},n.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var i=this._startDe;do i.getNode().getEdges().linkMinimalDirectedEdges(this),i=i.getNext();while(i!==this._startDe)},n.prototype.getNext=function(i){return i.getNext()},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(tn),_r=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 t=arguments[0];this._label=t}}};_r.prototype.setVisited=function(t){this._isVisited=t},_r.prototype.setInResult=function(t){this._isInResult=t},_r.prototype.isCovered=function(){return this._isCovered},_r.prototype.isCoveredSet=function(){return this._isCoveredSet},_r.prototype.setLabel=function(t){this._label=t},_r.prototype.getLabel=function(){return this._label},_r.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},_r.prototype.updateIM=function(t){_t.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},_r.prototype.isInResult=function(){return this._isInResult},_r.prototype.isVisited=function(){return this._isVisited},_r.prototype.interfaces_=function(){return[]},_r.prototype.getClass=function(){return _r};var Na=function(t){function n(){t.call(this),this._coord=null,this._edges=null;var i=arguments[0],s=arguments[1];this._coord=i,this._edges=s,this._label=new Me(0,F.NONE)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.isIncidentEdgeInResult=function(){for(var i=this.getEdges().getEdges().iterator();i.hasNext();)if(i.next().getEdge().isInResult())return!0;return!1},n.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},n.prototype.getCoordinate=function(){return this._coord},n.prototype.print=function(i){i.println("node "+this._coord+" lbl: "+this._label)},n.prototype.computeIM=function(i){},n.prototype.computeMergedLocation=function(i,s){var l=F.NONE;if(l=this._label.getLocation(s),!i.isNull(s)){var f=i.getLocation(s);l!==F.BOUNDARY&&(l=f)}return l},n.prototype.setLabel=function(){if(arguments.length!==2)return t.prototype.setLabel.apply(this,arguments);var i=arguments[0],s=arguments[1];this._label===null?this._label=new Me(i,s):this._label.setLocation(i,s)},n.prototype.getEdges=function(){return this._edges},n.prototype.mergeLabel=function(){if(arguments[0]instanceof n){var i=arguments[0];this.mergeLabel(i._label)}else if(arguments[0]instanceof Me)for(var s=arguments[0],l=0;l<2;l++){var f=this.computeMergedLocation(s,l);this._label.getLocation(l)===F.NONE&&this._label.setLocation(l,f)}},n.prototype.add=function(i){this._edges.insert(i),i.setNode(this)},n.prototype.setLabelBoundary=function(i){if(this._label===null)return null;var s=F.NONE;this._label!==null&&(s=this._label.getLocation(i));var l=null;switch(s){case F.BOUNDARY:l=F.INTERIOR;break;case F.INTERIOR:default:l=F.BOUNDARY}this._label.setLocation(i,l)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(_r),jr=function(){this.nodeMap=new x,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};jr.prototype.find=function(t){return this.nodeMap.get(t)},jr.prototype.addNode=function(){if(arguments[0]instanceof C){var t=arguments[0],n=this.nodeMap.get(t);return n===null&&(n=this.nodeFact.createNode(t),this.nodeMap.put(t,n)),n}if(arguments[0]instanceof Na){var i=arguments[0],s=this.nodeMap.get(i.getCoordinate());return s===null?(this.nodeMap.put(i.getCoordinate(),i),i):(s.mergeLabel(i),s)}},jr.prototype.print=function(t){for(var n=this.iterator();n.hasNext();)n.next().print(t)},jr.prototype.iterator=function(){return this.nodeMap.values().iterator()},jr.prototype.values=function(){return this.nodeMap.values()},jr.prototype.getBoundaryNodes=function(t){for(var n=new V,i=this.iterator();i.hasNext();){var s=i.next();s.getLabel().getLocation(t)===F.BOUNDARY&&n.add(s)}return n},jr.prototype.add=function(t){var n=t.getCoordinate();this.addNode(n).add(t)},jr.prototype.interfaces_=function(){return[]},jr.prototype.getClass=function(){return jr};var be=function(){},Vs={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};be.prototype.interfaces_=function(){return[]},be.prototype.getClass=function(){return be},be.isNorthern=function(t){return t===be.NE||t===be.NW},be.isOpposite=function(t,n){return t===n?!1:(t-n+4)%4===2},be.commonHalfPlane=function(t,n){if(t===n)return t;if((t-n+4)%4===2)return-1;var i=t<n?t:n;return i===0&&(t>n?t:n)===3?3:i},be.isInHalfPlane=function(t,n){return n===be.SE?t===be.SE||t===be.SW:t===n||t===n+1},be.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];if(t===0&&n===0)throw new L("Cannot compute the quadrant for point ( "+t+", "+n+" )");return t>=0?n>=0?be.NE:be.SE:n>=0?be.NW:be.SW}if(arguments[0]instanceof C&&arguments[1]instanceof C){var i=arguments[0],s=arguments[1];if(s.x===i.x&&s.y===i.y)throw new L("Cannot compute the quadrant for two identical points "+i);return s.x>=i.x?s.y>=i.y?be.NE:be.SE:s.y>=i.y?be.NW:be.SW}},Vs.NE.get=function(){return 0},Vs.NW.get=function(){return 1},Vs.SW.get=function(){return 2},Vs.SE.get=function(){return 3},Object.defineProperties(be,Vs);var In=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 t=arguments[0];this._edge=t}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];this._edge=n,this.init(i,s),this._label=null}else if(arguments.length===4){var l=arguments[0],f=arguments[1],m=arguments[2],_=arguments[3];this._edge=l,this.init(f,m),this._label=_}};In.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:tt.computeOrientation(t._p0,t._p1,this._p1)},In.prototype.getDy=function(){return this._dy},In.prototype.getCoordinate=function(){return this._p0},In.prototype.setNode=function(t){this._node=t},In.prototype.print=function(t){var n=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),s=i.lastIndexOf("."),l=i.substring(s+1);t.print(" "+l+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label)},In.prototype.compareTo=function(t){var n=t;return this.compareDirection(n)},In.prototype.getDirectedCoordinate=function(){return this._p1},In.prototype.getDx=function(){return this._dx},In.prototype.getLabel=function(){return this._label},In.prototype.getEdge=function(){return this._edge},In.prototype.getQuadrant=function(){return this._quadrant},In.prototype.getNode=function(){return this._node},In.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),i=n.lastIndexOf(".");return" "+n.substring(i+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},In.prototype.computeLabel=function(t){},In.prototype.init=function(t,n){this._p0=t,this._p1=n,this._dx=n.x-t.x,this._dy=n.y-t.y,this._quadrant=be.quadrant(this._dx,this._dy),_t.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},In.prototype.interfaces_=function(){return[k]},In.prototype.getClass=function(){return In};var nl=function(t){function n(){var i=arguments[0],s=arguments[1];if(t.call(this,i),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=s,s)this.init(i.getCoordinate(0),i.getCoordinate(1));else{var l=i.getNumPoints()-1;this.init(i.getCoordinate(l),i.getCoordinate(l-1))}this.computeDirectedLabel()}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.getNextMin=function(){return this._nextMin},n.prototype.getDepth=function(i){return this._depth[i]},n.prototype.setVisited=function(i){this._isVisited=i},n.prototype.computeDirectedLabel=function(){this._label=new Me(this._edge.getLabel()),this._isForward||this._label.flip()},n.prototype.getNext=function(){return this._next},n.prototype.setDepth=function(i,s){if(this._depth[i]!==-999&&this._depth[i]!==s)throw new Ii("assigned depths do not match",this.getCoordinate());this._depth[i]=s},n.prototype.isInteriorAreaEdge=function(){for(var i=!0,s=0;s<2;s++)this._label.isArea(s)&&this._label.getLocation(s,j.LEFT)===F.INTERIOR&&this._label.getLocation(s,j.RIGHT)===F.INTERIOR||(i=!1);return i},n.prototype.setNextMin=function(i){this._nextMin=i},n.prototype.print=function(i){t.prototype.print.call(this,i),i.print(" "+this._depth[j.LEFT]+"/"+this._depth[j.RIGHT]),i.print(" ("+this.getDepthDelta()+")"),this._isInResult&&i.print(" inResult")},n.prototype.setMinEdgeRing=function(i){this._minEdgeRing=i},n.prototype.isLineEdge=function(){var i=this._label.isLine(0)||this._label.isLine(1),s=!this._label.isArea(0)||this._label.allPositionsEqual(0,F.EXTERIOR),l=!this._label.isArea(1)||this._label.allPositionsEqual(1,F.EXTERIOR);return i&&s&&l},n.prototype.setEdgeRing=function(i){this._edgeRing=i},n.prototype.getMinEdgeRing=function(){return this._minEdgeRing},n.prototype.getDepthDelta=function(){var i=this._edge.getDepthDelta();return this._isForward||(i=-i),i},n.prototype.setInResult=function(i){this._isInResult=i},n.prototype.getSym=function(){return this._sym},n.prototype.isForward=function(){return this._isForward},n.prototype.getEdge=function(){return this._edge},n.prototype.printEdge=function(i){this.print(i),i.print(" "),this._isForward?this._edge.print(i):this._edge.printReverse(i)},n.prototype.setSym=function(i){this._sym=i},n.prototype.setVisitedEdge=function(i){this.setVisited(i),this._sym.setVisited(i)},n.prototype.setEdgeDepths=function(i,s){var l=this.getEdge().getDepthDelta();this._isForward||(l=-l);var f=1;i===j.LEFT&&(f=-1);var m=j.opposite(i),_=s+l*f;this.setDepth(i,s),this.setDepth(m,_)},n.prototype.getEdgeRing=function(){return this._edgeRing},n.prototype.isInResult=function(){return this._isInResult},n.prototype.setNext=function(i){this._next=i},n.prototype.isVisited=function(){return this._isVisited},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n.depthFactor=function(i,s){return i===F.EXTERIOR&&s===F.INTERIOR?1:i===F.INTERIOR&&s===F.EXTERIOR?-1:0},n}(In),Jo=function(){};Jo.prototype.createNode=function(t){return new Na(t,null)},Jo.prototype.interfaces_=function(){return[]},Jo.prototype.getClass=function(){return Jo};var ze=function(){if(this._edges=new V,this._nodes=null,this._edgeEndList=new V,arguments.length===0)this._nodes=new jr(new Jo);else if(arguments.length===1){var t=arguments[0];this._nodes=new jr(t)}};ze.prototype.printEdges=function(t){t.println("Edges:");for(var n=0;n<this._edges.size();n++){t.println("edge "+n+":");var i=this._edges.get(n);i.print(t),i.eiList.print(t)}},ze.prototype.find=function(t){return this._nodes.find(t)},ze.prototype.addNode=function(){if(arguments[0]instanceof Na){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof C){var n=arguments[0];return this._nodes.addNode(n)}},ze.prototype.getNodeIterator=function(){return this._nodes.iterator()},ze.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},ze.prototype.debugPrintln=function(t){Ee.out.println(t)},ze.prototype.isBoundaryNode=function(t,n){var i=this._nodes.find(n);if(i===null)return!1;var s=i.getLabel();return s!==null&&s.getLocation(t)===F.BOUNDARY},ze.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},ze.prototype.matchInSameDirection=function(t,n,i,s){return!!t.equals(i)&&tt.computeOrientation(t,n,s)===tt.COLLINEAR&&be.quadrant(t,n)===be.quadrant(i,s)},ze.prototype.getEdgeEnds=function(){return this._edgeEndList},ze.prototype.debugPrint=function(t){Ee.out.print(t)},ze.prototype.getEdgeIterator=function(){return this._edges.iterator()},ze.prototype.findEdgeInSameDirection=function(t,n){for(var i=0;i<this._edges.size();i++){var s=this._edges.get(i),l=s.getCoordinates();if(this.matchInSameDirection(t,n,l[0],l[1])||this.matchInSameDirection(t,n,l[l.length-1],l[l.length-2]))return s}return null},ze.prototype.insertEdge=function(t){this._edges.add(t)},ze.prototype.findEdgeEnd=function(t){for(var n=this.getEdgeEnds().iterator();n.hasNext();){var i=n.next();if(i.getEdge()===t)return i}return null},ze.prototype.addEdges=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next();this._edges.add(i);var s=new nl(i,!0),l=new nl(i,!1);s.setSym(l),l.setSym(s),this.add(s),this.add(l)}},ze.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},ze.prototype.getNodes=function(){return this._nodes.values()},ze.prototype.findEdge=function(t,n){for(var i=0;i<this._edges.size();i++){var s=this._edges.get(i),l=s.getCoordinates();if(t.equals(l[0])&&n.equals(l[1]))return s}return null},ze.prototype.interfaces_=function(){return[]},ze.prototype.getClass=function(){return ze},ze.linkResultDirectedEdges=function(t){for(var n=t.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()};var hr=function(){this._geometryFactory=null,this._shellList=new V;var t=arguments[0];this._geometryFactory=t};hr.prototype.sortShellsAndHoles=function(t,n,i){for(var s=t.iterator();s.hasNext();){var l=s.next();l.isHole()?i.add(l):n.add(l)}},hr.prototype.computePolygons=function(t){for(var n=new V,i=t.iterator();i.hasNext();){var s=i.next().toPolygon(this._geometryFactory);n.add(s)}return n},hr.prototype.placeFreeHoles=function(t,n){for(var i=n.iterator();i.hasNext();){var s=i.next();if(s.getShell()===null){var l=this.findEdgeRingContaining(s,t);if(l===null)throw new Ii("unable to assign hole to a shell",s.getCoordinate(0));s.setShell(l)}}},hr.prototype.buildMinimalEdgeRings=function(t,n,i){for(var s=new V,l=t.iterator();l.hasNext();){var f=l.next();if(f.getMaxNodeDegree()>2){f.linkDirectedEdgesForMinimalEdgeRings();var m=f.buildMinimalRings(),_=this.findShell(m);_!==null?(this.placePolygonHoles(_,m),n.add(_)):i.addAll(m)}else s.add(f)}return s},hr.prototype.containsPoint=function(t){for(var n=this._shellList.iterator();n.hasNext();)if(n.next().containsPoint(t))return!0;return!1},hr.prototype.buildMaximalEdgeRings=function(t){for(var n=new V,i=t.iterator();i.hasNext();){var s=i.next();if(s.isInResult()&&s.getLabel().isArea()&&s.getEdgeRing()===null){var l=new C0(s,this._geometryFactory);n.add(l),l.setInResult()}}return n},hr.prototype.placePolygonHoles=function(t,n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isHole()&&s.setShell(t)}},hr.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},hr.prototype.findEdgeRingContaining=function(t,n){for(var i=t.getLinearRing(),s=i.getEnvelopeInternal(),l=i.getCoordinateN(0),f=null,m=null,_=n.iterator();_.hasNext();){var S=_.next(),O=S.getLinearRing(),H=O.getEnvelopeInternal();f!==null&&(m=f.getLinearRing().getEnvelopeInternal());var X=!1;H.contains(s)&&tt.isPointInRing(l,O.getCoordinates())&&(X=!0),X&&(f===null||m.contains(H))&&(f=S)}return f},hr.prototype.findShell=function(t){for(var n=0,i=null,s=t.iterator();s.hasNext();){var l=s.next();l.isHole()||(i=l,n++)}return _t.isTrue(n<=1,"found two shells in MinimalEdgeRing list"),i},hr.prototype.add=function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var n=arguments[0],i=arguments[1];ze.linkResultDirectedEdges(i);var s=this.buildMaximalEdgeRings(n),l=new V,f=this.buildMinimalEdgeRings(s,this._shellList,l);this.sortShellsAndHoles(f,this._shellList,l),this.placeFreeHoles(this._shellList,l)}},hr.prototype.interfaces_=function(){return[]},hr.prototype.getClass=function(){return hr};var Ko=function(){};Ko.prototype.getBounds=function(){},Ko.prototype.interfaces_=function(){return[]},Ko.prototype.getClass=function(){return Ko};var kr=function(){this._bounds=null,this._item=null;var t=arguments[0],n=arguments[1];this._bounds=t,this._item=n};kr.prototype.getItem=function(){return this._item},kr.prototype.getBounds=function(){return this._bounds},kr.prototype.interfaces_=function(){return[Ko,e]},kr.prototype.getClass=function(){return kr};var Pi=function(){this._size=null,this._items=null,this._size=0,this._items=new V,this._items.add(null)};Pi.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t},Pi.prototype.size=function(){return this._size},Pi.prototype.reorder=function(t){for(var n=null,i=this._items.get(t);2*t<=this._size&&((n=2*t)!==this._size&&this._items.get(n+1).compareTo(this._items.get(n))<0&&n++,this._items.get(n).compareTo(i)<0);t=n)this._items.set(t,this._items.get(n));this._items.set(t,i)},Pi.prototype.clear=function(){this._size=0,this._items.clear()},Pi.prototype.isEmpty=function(){return this._size===0},Pi.prototype.add=function(t){this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)this._items.set(n,this._items.get(Math.trunc(n/2)));this._items.set(n,t)},Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi};var Vi=function(){};Vi.prototype.visitItem=function(t){},Vi.prototype.interfaces_=function(){return[]},Vi.prototype.getClass=function(){return Vi};var bo=function(){};bo.prototype.insert=function(t,n){},bo.prototype.remove=function(t,n){},bo.prototype.query=function(){},bo.prototype.interfaces_=function(){return[]},bo.prototype.getClass=function(){return bo};var un=function(){if(this._childBoundables=new V,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this._level=t}}},Bh={serialVersionUID:{configurable:!0}};un.prototype.getLevel=function(){return this._level},un.prototype.size=function(){return this._childBoundables.size()},un.prototype.getChildBoundables=function(){return this._childBoundables},un.prototype.addChildBoundable=function(t){_t.isTrue(this._bounds===null),this._childBoundables.add(t)},un.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},un.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},un.prototype.interfaces_=function(){return[Ko,e]},un.prototype.getClass=function(){return un},Bh.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(un,Bh);var Gr=function(){};Gr.reverseOrder=function(){return{compare:function(t,n){return n.compareTo(t)}}},Gr.min=function(t){return Gr.sort(t),t.get(0)},Gr.sort=function(t,n){var i=t.toArray();n?We.sort(i,n):We.sort(i);for(var s=t.iterator(),l=0,f=i.length;l<f;l++)s.next(),s.set(i[l])},Gr.singletonList=function(t){var n=new V;return n.add(t),n};var en=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],n=arguments[1],i=arguments[2];this._boundable1=t,this._boundable2=n,this._itemDistance=i,this._distance=this.distance()};en.prototype.expandToQueue=function(t,n){var i=en.isComposite(this._boundable1),s=en.isComposite(this._boundable2);if(i&&s)return en.area(this._boundable1)>en.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,n),null):(this.expand(this._boundable2,this._boundable1,t,n),null);if(i)return this.expand(this._boundable1,this._boundable2,t,n),null;if(s)return this.expand(this._boundable2,this._boundable1,t,n),null;throw new L("neither boundable is composite")},en.prototype.isLeaves=function(){return!(en.isComposite(this._boundable1)||en.isComposite(this._boundable2))},en.prototype.compareTo=function(t){var n=t;return this._distance<n._distance?-1:this._distance>n._distance?1:0},en.prototype.expand=function(t,n,i,s){for(var l=t.getChildBoundables().iterator();l.hasNext();){var f=l.next(),m=new en(f,n,this._itemDistance);m.getDistance()<s&&i.add(m)}},en.prototype.getBoundable=function(t){return t===0?this._boundable1:this._boundable2},en.prototype.getDistance=function(){return this._distance},en.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},en.prototype.interfaces_=function(){return[k]},en.prototype.getClass=function(){return en},en.area=function(t){return t.getBounds().getArea()},en.isComposite=function(t){return t instanceof un};var yn=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new V,this._nodeCapacity=null,arguments.length===0){var n=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=n}else if(arguments.length===1){var i=arguments[0];_t.isTrue(i>1,"Node capacity must be greater than 1"),this._nodeCapacity=i}},La={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};yn.prototype.getNodeCapacity=function(){return this._nodeCapacity},yn.prototype.lastNode=function(t){return t.get(t.size()-1)},yn.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var t=0,n=arguments[0].getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof un?t+=this.size(i):i instanceof kr&&(t+=1)}return t}},yn.prototype.removeItem=function(t,n){for(var i=null,s=t.getChildBoundables().iterator();s.hasNext();){var l=s.next();l instanceof kr&&l.getItem()===n&&(i=l)}return i!==null&&(t.getChildBoundables().remove(i),!0)},yn.prototype.itemsTree=function(){if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new V:t}if(arguments.length===1){for(var n=arguments[0],i=new V,s=n.getChildBoundables().iterator();s.hasNext();){var l=s.next();if(l instanceof un){var f=this.itemsTree(l);f!==null&&i.add(f)}else l instanceof kr?i.add(l.getItem()):_t.shouldNeverReachHere()}return i.size()<=0?null:i}},yn.prototype.insert=function(t,n){_t.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new kr(t,n))},yn.prototype.boundablesAtLevel=function(){if(arguments.length===1){var t=arguments[0],n=new V;return this.boundablesAtLevel(t,this._root,n),n}if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];if(_t.isTrue(i>-2),s.getLevel()===i)return l.add(s),null;for(var f=s.getChildBoundables().iterator();f.hasNext();){var m=f.next();m instanceof un?this.boundablesAtLevel(i,m,l):(_t.isTrue(m instanceof kr),i===-1&&l.add(m))}return null}},yn.prototype.query=function(){if(arguments.length===1){var t=arguments[0];this.build();var n=new V;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.query(t,this._root,n),n}if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),i)&&this.query(i,this._root,s)}else if(arguments.length===3){if(et(arguments[2],Vi)&&arguments[0]instanceof Object&&arguments[1]instanceof un)for(var l=arguments[0],f=arguments[1],m=arguments[2],_=f.getChildBoundables(),S=0;S<_.size();S++){var O=_.get(S);this.getIntersectsOp().intersects(O.getBounds(),l)&&(O instanceof un?this.query(l,O,m):O instanceof kr?m.visitItem(O.getItem()):_t.shouldNeverReachHere())}else if(et(arguments[2],Z)&&arguments[0]instanceof Object&&arguments[1]instanceof un)for(var H=arguments[0],X=arguments[1],nt=arguments[2],rt=X.getChildBoundables(),lt=0;lt<rt.size();lt++){var gt=rt.get(lt);this.getIntersectsOp().intersects(gt.getBounds(),H)&&(gt instanceof un?this.query(H,gt,nt):gt instanceof kr?nt.add(gt.getItem()):_t.shouldNeverReachHere())}}},yn.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},yn.prototype.getRoot=function(){return this.build(),this._root},yn.prototype.remove=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,n)}if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2],f=this.removeItem(s,l);if(f)return!0;for(var m=null,_=s.getChildBoundables().iterator();_.hasNext();){var S=_.next();if(this.getIntersectsOp().intersects(S.getBounds(),i)&&S instanceof un&&(f=this.remove(i,S,l))){m=S;break}}return m!==null&&m.getChildBoundables().isEmpty()&&s.getChildBoundables().remove(m),f}},yn.prototype.createHigherLevels=function(t,n){_t.isTrue(!t.isEmpty());var i=this.createParentBoundables(t,n+1);return i.size()===1?i.get(0):this.createHigherLevels(i,n+1)},yn.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var t=0,n=arguments[0].getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof un){var s=this.depth(i);s>t&&(t=s)}}return t+1}},yn.prototype.createParentBoundables=function(t,n){_t.isTrue(!t.isEmpty());var i=new V;i.add(this.createNode(n));var s=new V(t);Gr.sort(s,this.getComparator());for(var l=s.iterator();l.hasNext();){var f=l.next();this.lastNode(i).getChildBoundables().size()===this.getNodeCapacity()&&i.add(this.createNode(n)),this.lastNode(i).addChildBoundable(f)}return i},yn.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},yn.prototype.interfaces_=function(){return[e]},yn.prototype.getClass=function(){return yn},yn.compareDoubles=function(t,n){return t>n?1:t<n?-1:0},La.IntersectsOp.get=function(){return I0},La.serialVersionUID.get=function(){return-3886435814360241e3},La.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(yn,La);var I0=function(){},Qo=function(){};Qo.prototype.distance=function(t,n){},Qo.prototype.interfaces_=function(){return[]},Qo.prototype.getClass=function(){return Qo};var zh=function(t){function n(s){s=s||n.DEFAULT_NODE_CAPACITY,t.call(this,s)}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return n.prototype.createParentBoundablesFromVerticalSlices=function(s,l){_t.isTrue(s.length>0);for(var f=new V,m=0;m<s.length;m++)f.addAll(this.createParentBoundablesFromVerticalSlice(s[m],l));return f},n.prototype.createNode=function(s){return new kh(s)},n.prototype.size=function(){return arguments.length===0?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},n.prototype.insert=function(){if(arguments.length!==2)return t.prototype.insert.apply(this,arguments);var s=arguments[0],l=arguments[1];if(s.isNull())return null;t.prototype.insert.call(this,s,l)},n.prototype.getIntersectsOp=function(){return n.intersectsOp},n.prototype.verticalSlices=function(s,l){for(var f=Math.trunc(Math.ceil(s.size()/l)),m=new Array(l).fill(null),_=s.iterator(),S=0;S<l;S++){m[S]=new V;for(var O=0;_.hasNext()&&O<f;){var H=_.next();m[S].add(H),O++}}return m},n.prototype.query=function(){if(arguments.length===1){var s=arguments[0];return t.prototype.query.call(this,s)}if(arguments.length===2){var l=arguments[0],f=arguments[1];t.prototype.query.call(this,l,f)}else if(arguments.length===3){if(et(arguments[2],Vi)&&arguments[0]instanceof Object&&arguments[1]instanceof un){var m=arguments[0],_=arguments[1],S=arguments[2];t.prototype.query.call(this,m,_,S)}else if(et(arguments[2],Z)&&arguments[0]instanceof Object&&arguments[1]instanceof un){var O=arguments[0],H=arguments[1],X=arguments[2];t.prototype.query.call(this,O,H,X)}}},n.prototype.getComparator=function(){return n.yComparator},n.prototype.createParentBoundablesFromVerticalSlice=function(s,l){return t.prototype.createParentBoundables.call(this,s,l)},n.prototype.remove=function(){if(arguments.length===2){var s=arguments[0],l=arguments[1];return t.prototype.remove.call(this,s,l)}return t.prototype.remove.apply(this,arguments)},n.prototype.depth=function(){return arguments.length===0?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},n.prototype.createParentBoundables=function(s,l){_t.isTrue(!s.isEmpty());var f=Math.trunc(Math.ceil(s.size()/this.getNodeCapacity())),m=new V(s);Gr.sort(m,n.xComparator);var _=this.verticalSlices(m,Math.trunc(Math.ceil(Math.sqrt(f))));return this.createParentBoundablesFromVerticalSlices(_,l)},n.prototype.nearestNeighbour=function(){if(arguments.length===1){if(et(arguments[0],Qo)){var s=arguments[0],l=new en(this.getRoot(),this.getRoot(),s);return this.nearestNeighbour(l)}if(arguments[0]instanceof en){var f=arguments[0];return this.nearestNeighbour(f,P.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof n&&et(arguments[1],Qo)){var m=arguments[0],_=arguments[1],S=new en(this.getRoot(),m.getRoot(),_);return this.nearestNeighbour(S)}if(arguments[0]instanceof en&&typeof arguments[1]=="number"){var O=arguments[0],H=arguments[1],X=null,nt=new Pi;for(nt.add(O);!nt.isEmpty()&&H>0;){var rt=nt.poll(),lt=rt.getDistance();if(lt>=H)break;rt.isLeaves()?(H=lt,X=rt):rt.expandToQueue(nt,H)}return[X.getBoundable(0).getItem(),X.getBoundable(1).getItem()]}}else if(arguments.length===3){var gt=arguments[0],we=arguments[1],rn=arguments[2],Wn=new kr(gt,we),Ei=new en(this.getRoot(),Wn,rn);return this.nearestNeighbour(Ei)[0]}},n.prototype.interfaces_=function(){return[bo,e]},n.prototype.getClass=function(){return n},n.centreX=function(s){return n.avg(s.getMinX(),s.getMaxX())},n.avg=function(s,l){return(s+l)/2},n.centreY=function(s){return n.avg(s.getMinY(),s.getMaxY())},i.STRtreeNode.get=function(){return kh},i.serialVersionUID.get=function(){return 0x39920f7d5f261e0},i.xComparator.get=function(){return{interfaces_:function(){return[q]},compare:function(s,l){return t.compareDoubles(n.centreX(s.getBounds()),n.centreX(l.getBounds()))}}},i.yComparator.get=function(){return{interfaces_:function(){return[q]},compare:function(s,l){return t.compareDoubles(n.centreY(s.getBounds()),n.centreY(l.getBounds()))}}},i.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(s,l){return s.intersects(l)}}},i.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(n,i),n}(yn),kh=function(t){function n(){var i=arguments[0];t.call(this,i)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.computeBounds=function(){for(var i=null,s=this.getChildBoundables().iterator();s.hasNext();){var l=s.next();i===null?i=new at(l.getBounds()):i.expandToInclude(l.getBounds())}return i},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(un),jn=function(){};jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn},jn.relativeSign=function(t,n){return t<n?-1:t>n?1:0},jn.compare=function(t,n,i){if(n.equals2D(i))return 0;var s=jn.relativeSign(n.x,i.x),l=jn.relativeSign(n.y,i.y);switch(t){case 0:return jn.compareValue(s,l);case 1:return jn.compareValue(l,s);case 2:return jn.compareValue(l,-s);case 3:return jn.compareValue(-s,l);case 4:return jn.compareValue(-s,-l);case 5:return jn.compareValue(-l,-s);case 6:return jn.compareValue(-l,s);case 7:return jn.compareValue(s,-l)}return _t.shouldNeverReachHere("invalid octant value"),0},jn.compareValue=function(t,n){return t<0?-1:t>0?1:n<0?-1:n>0?1:0};var Hi=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],n=arguments[1],i=arguments[2],s=arguments[3];this._segString=t,this.coord=new C(n),this.segmentIndex=i,this._segmentOctant=s,this._isInterior=!n.equals2D(t.getCoordinate(i))};Hi.prototype.getCoordinate=function(){return this.coord},Hi.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},Hi.prototype.compareTo=function(t){var n=t;return this.segmentIndex<n.segmentIndex?-1:this.segmentIndex>n.segmentIndex?1:this.coord.equals2D(n.coord)?0:jn.compare(this._segmentOctant,this.coord,n.coord)},Hi.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t},Hi.prototype.isInterior=function(){return this._isInterior},Hi.prototype.interfaces_=function(){return[k]},Hi.prototype.getClass=function(){return Hi};var zn=function(){this._nodeMap=new x,this._edge=null;var t=arguments[0];this._edge=t};zn.prototype.getSplitCoordinates=function(){var t=new Q;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var s=n.next();this.addEdgeCoordinates(i,s,t),i=s}return t.toCoordinateArray()},zn.prototype.addCollapsedNodes=function(){var t=new V;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var n=t.iterator();n.hasNext();){var i=n.next().intValue();this.add(this._edge.getCoordinate(i),i)}},zn.prototype.print=function(t){t.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(t)},zn.prototype.findCollapsesFromExistingVertices=function(t){for(var n=0;n<this._edge.size()-2;n++){var i=this._edge.getCoordinate(n),s=this._edge.getCoordinate(n+2);i.equals2D(s)&&t.add(new it(n+1))}},zn.prototype.addEdgeCoordinates=function(t,n,i){var s=this._edge.getCoordinate(n.segmentIndex),l=n.isInterior()||!n.coord.equals2D(s);i.add(new C(t.coord),!1);for(var f=t.segmentIndex+1;f<=n.segmentIndex;f++)i.add(this._edge.getCoordinate(f));l&&i.add(new C(n.coord))},zn.prototype.iterator=function(){return this._nodeMap.values().iterator()},zn.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var n=this.iterator(),i=n.next();n.hasNext();){var s=n.next(),l=this.createSplitEdge(i,s);t.add(l),i=s}},zn.prototype.findCollapseIndex=function(t,n,i){if(!t.coord.equals2D(n.coord))return!1;var s=n.segmentIndex-t.segmentIndex;return n.isInterior()||s--,s===1&&(i[0]=t.segmentIndex+1,!0)},zn.prototype.findCollapsesFromInsertedNodes=function(t){for(var n=new Array(1).fill(null),i=this.iterator(),s=i.next();i.hasNext();){var l=i.next();this.findCollapseIndex(s,l,n)&&t.add(new it(n[0])),s=l}},zn.prototype.getEdge=function(){return this._edge},zn.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},zn.prototype.createSplitEdge=function(t,n){var i=n.segmentIndex-t.segmentIndex+2,s=this._edge.getCoordinate(n.segmentIndex),l=n.isInterior()||!n.coord.equals2D(s);l||i--;var f=new Array(i).fill(null),m=0;f[m++]=new C(t.coord);for(var _=t.segmentIndex+1;_<=n.segmentIndex;_++)f[m++]=this._edge.getCoordinate(_);return l&&(f[m]=new C(n.coord)),new Je(f,this._edge.getData())},zn.prototype.add=function(t,n){var i=new Hi(this._edge,t,n,this._edge.getSegmentOctant(n)),s=this._nodeMap.get(i);return s!==null?(_t.isTrue(s.coord.equals2D(t),"Found equal nodes with different coordinates"),s):(this._nodeMap.put(i,i),i)},zn.prototype.checkSplitEdgesCorrectness=function(t){var n=this._edge.getCoordinates(),i=t.get(0).getCoordinate(0);if(!i.equals2D(n[0]))throw new Cn("bad split edge start point at "+i);var s=t.get(t.size()-1).getCoordinates(),l=s[s.length-1];if(!l.equals2D(n[n.length-1]))throw new Cn("bad split edge end point at "+l)},zn.prototype.interfaces_=function(){return[]},zn.prototype.getClass=function(){return zn};var Ao=function(){};Ao.prototype.interfaces_=function(){return[]},Ao.prototype.getClass=function(){return Ao},Ao.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];if(t===0&&n===0)throw new L("Cannot compute the octant for point ( "+t+", "+n+" )");var i=Math.abs(t),s=Math.abs(n);return t>=0?n>=0?i>=s?0:1:i>=s?7:6:n>=0?i>=s?3:2:i>=s?4:5}if(arguments[0]instanceof C&&arguments[1]instanceof C){var l=arguments[0],f=arguments[1],m=f.x-l.x,_=f.y-l.y;if(m===0&&_===0)throw new L("Cannot compute the octant for two identical points "+l);return Ao.octant(m,_)}};var pi=function(){};pi.prototype.getCoordinates=function(){},pi.prototype.size=function(){},pi.prototype.getCoordinate=function(t){},pi.prototype.isClosed=function(){},pi.prototype.setData=function(t){},pi.prototype.getData=function(){},pi.prototype.interfaces_=function(){return[]},pi.prototype.getClass=function(){return pi};var Hs=function(){};Hs.prototype.addIntersection=function(t,n){},Hs.prototype.interfaces_=function(){return[pi]},Hs.prototype.getClass=function(){return Hs};var Je=function(){this._nodeList=new zn(this),this._pts=null,this._data=null;var t=arguments[0],n=arguments[1];this._pts=t,this._data=n};Je.prototype.getCoordinates=function(){return this._pts},Je.prototype.size=function(){return this._pts.length},Je.prototype.getCoordinate=function(t){return this._pts[t]},Je.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Je.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},Je.prototype.setData=function(t){this._data=t},Je.prototype.safeOctant=function(t,n){return t.equals2D(n)?0:Ao.octant(t,n)},Je.prototype.getData=function(){return this._data},Je.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];this.addIntersectionNode(t,n)}else if(arguments.length===4){var i=arguments[0],s=arguments[1],l=arguments[3],f=new C(i.getIntersection(l));this.addIntersection(f,s)}},Je.prototype.toString=function(){return Qe.toLineString(new Ze(this._pts))},Je.prototype.getNodeList=function(){return this._nodeList},Je.prototype.addIntersectionNode=function(t,n){var i=n,s=i+1;if(s<this._pts.length){var l=this._pts[s];t.equals2D(l)&&(i=s)}return this._nodeList.add(t,i)},Je.prototype.addIntersections=function(t,n,i){for(var s=0;s<t.getIntersectionNum();s++)this.addIntersection(t,n,i,s)},Je.prototype.interfaces_=function(){return[Hs]},Je.prototype.getClass=function(){return Je},Je.getNodedSubstrings=function(){if(arguments.length===1){var t=arguments[0],n=new V;return Je.getNodedSubstrings(t,n),n}if(arguments.length===2)for(var i=arguments[0],s=arguments[1],l=i.iterator();l.hasNext();)l.next().getNodeList().addSplitEdges(s)};var ft=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new C,this.p1=new C;else if(arguments.length===1){var t=arguments[0];this.p0=new C(t.p0),this.p1=new C(t.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],l=arguments[3];this.p0=new C(n,i),this.p1=new C(s,l)}},Gh={serialVersionUID:{configurable:!0}};ft.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},ft.prototype.orientationIndex=function(){if(arguments[0]instanceof ft){var t=arguments[0],n=tt.orientationIndex(this.p0,this.p1,t.p0),i=tt.orientationIndex(this.p0,this.p1,t.p1);return n>=0&&i>=0||n<=0&&i<=0?Math.max(n,i):0}if(arguments[0]instanceof C){var s=arguments[0];return tt.orientationIndex(this.p0,this.p1,s)}},ft.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},ft.prototype.isVertical=function(){return this.p0.x===this.p1.x},ft.prototype.equals=function(t){if(!(t instanceof ft))return!1;var n=t;return this.p0.equals(n.p0)&&this.p1.equals(n.p1)},ft.prototype.intersection=function(t){var n=new Pr;return n.computeIntersection(this.p0,this.p1,t.p0,t.p1),n.hasIntersection()?n.getIntersection(0):null},ft.prototype.project=function(){if(arguments[0]instanceof C){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new C(t);var n=this.projectionFactor(t),i=new C;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}if(arguments[0]instanceof ft){var s=arguments[0],l=this.projectionFactor(s.p0),f=this.projectionFactor(s.p1);if(l>=1&&f>=1||l<=0&&f<=0)return null;var m=this.project(s.p0);l<0&&(m=this.p0),l>1&&(m=this.p1);var _=this.project(s.p1);return f<0&&(_=this.p0),f>1&&(_=this.p1),new ft(m,_)}},ft.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},ft.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},ft.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1},ft.prototype.distancePerpendicular=function(t){return tt.distancePointLinePerpendicular(t,this.p0,this.p1)},ft.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},ft.prototype.midPoint=function(){return ft.midPoint(this.p0,this.p1)},ft.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var n=this.p1.x-this.p0.x,i=this.p1.y-this.p0.y,s=n*n+i*i;return s<=0?P.NaN:((t.x-this.p0.x)*n+(t.y-this.p0.y)*i)/s},ft.prototype.closestPoints=function(t){var n=this.intersection(t);if(n!==null)return[n,n];var i=new Array(2).fill(null),s=P.MAX_VALUE,l=null,f=this.closestPoint(t.p0);s=f.distance(t.p0),i[0]=f,i[1]=t.p0;var m=this.closestPoint(t.p1);(l=m.distance(t.p1))<s&&(s=l,i[0]=m,i[1]=t.p1);var _=t.closestPoint(this.p0);(l=_.distance(this.p0))<s&&(s=l,i[0]=this.p0,i[1]=_);var S=t.closestPoint(this.p1);return(l=S.distance(this.p1))<s&&(s=l,i[0]=this.p1,i[1]=S),i},ft.prototype.closestPoint=function(t){var n=this.projectionFactor(t);return n>0&&n<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},ft.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},ft.prototype.getLength=function(){return this.p0.distance(this.p1)},ft.prototype.compareTo=function(t){var n=t,i=this.p0.compareTo(n.p0);return i!==0?i:this.p1.compareTo(n.p1)},ft.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},ft.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&(this.p1.equals(t.p1)||this.p0.equals(t.p1))&&this.p1.equals(t.p0)},ft.prototype.lineIntersection=function(t){try{return Le.intersection(this.p0,this.p1,t.p0,t.p1)}catch(n){if(!(n instanceof qe))throw n}return null},ft.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},ft.prototype.pointAlongOffset=function(t,n){var i=this.p0.x+t*(this.p1.x-this.p0.x),s=this.p0.y+t*(this.p1.y-this.p0.y),l=this.p1.x-this.p0.x,f=this.p1.y-this.p0.y,m=Math.sqrt(l*l+f*f),_=0,S=0;if(n!==0){if(m<=0)throw new Error("Cannot compute offset from zero-length line segment");_=n*l/m,S=n*f/m}return new C(i-S,s+_)},ft.prototype.setCoordinates=function(){if(arguments.length===1){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.p0.x=n.x,this.p0.y=n.y,this.p1.x=i.x,this.p1.y=i.y}},ft.prototype.segmentFraction=function(t){var n=this.projectionFactor(t);return n<0?n=0:(n>1||P.isNaN(n))&&(n=1),n},ft.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},ft.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},ft.prototype.distance=function(){if(arguments[0]instanceof ft){var t=arguments[0];return tt.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof C){var n=arguments[0];return tt.distancePointLine(n,this.p0,this.p1)}},ft.prototype.pointAlong=function(t){var n=new C;return n.x=this.p0.x+t*(this.p1.x-this.p0.x),n.y=this.p0.y+t*(this.p1.y-this.p0.y),n},ft.prototype.hashCode=function(){var t=P.doubleToLongBits(this.p0.x);t^=31*P.doubleToLongBits(this.p0.y);var n=Math.trunc(t)^Math.trunc(t>>32),i=P.doubleToLongBits(this.p1.x);return i^=31*P.doubleToLongBits(this.p1.y),n^(Math.trunc(i)^Math.trunc(i>>32))},ft.prototype.interfaces_=function(){return[k,e]},ft.prototype.getClass=function(){return ft},ft.midPoint=function(t,n){return new C((t.x+n.x)/2,(t.y+n.y)/2)},Gh.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(ft,Gh);var qs=function(){this.tempEnv1=new at,this.tempEnv2=new at,this._overlapSeg1=new ft,this._overlapSeg2=new ft};qs.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var t=arguments[0],n=arguments[1],i=arguments[2],s=arguments[3];t.getLineSegment(n,this._overlapSeg1),i.getLineSegment(s,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},qs.prototype.interfaces_=function(){return[]},qs.prototype.getClass=function(){return qs};var fr=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],n=arguments[1],i=arguments[2],s=arguments[3];this._pts=t,this._start=n,this._end=i,this._context=s};fr.prototype.getLineSegment=function(t,n){n.p0=this._pts[t],n.p1=this._pts[t+1]},fr.prototype.computeSelect=function(t,n,i,s){var l=this._pts[n],f=this._pts[i];if(s.tempEnv1.init(l,f),i-n==1)return s.select(this,n),null;if(!t.intersects(s.tempEnv1))return null;var m=Math.trunc((n+i)/2);n<m&&this.computeSelect(t,n,m,s),m<i&&this.computeSelect(t,m,i,s)},fr.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),n=0,i=this._start;i<=this._end;i++)t[n++]=this._pts[i];return t},fr.prototype.computeOverlaps=function(t,n){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,n)},fr.prototype.setId=function(t){this._id=t},fr.prototype.select=function(t,n){this.computeSelect(t,this._start,this._end,n)},fr.prototype.getEnvelope=function(){if(this._env===null){var t=this._pts[this._start],n=this._pts[this._end];this._env=new at(t,n)}return this._env},fr.prototype.getEndIndex=function(){return this._end},fr.prototype.getStartIndex=function(){return this._start},fr.prototype.getContext=function(){return this._context},fr.prototype.getId=function(){return this._id},fr.prototype.computeOverlapsInternal=function(t,n,i,s,l,f){var m=this._pts[t],_=this._pts[n],S=i._pts[s],O=i._pts[l];if(n-t==1&&l-s==1)return f.overlap(this,t,i,s),null;if(f.tempEnv1.init(m,_),f.tempEnv2.init(S,O),!f.tempEnv1.intersects(f.tempEnv2))return null;var H=Math.trunc((t+n)/2),X=Math.trunc((s+l)/2);t<H&&(s<X&&this.computeOverlapsInternal(t,H,i,s,X,f),X<l&&this.computeOverlapsInternal(t,H,i,X,l,f)),H<n&&(s<X&&this.computeOverlapsInternal(H,n,i,s,X,f),X<l&&this.computeOverlapsInternal(H,n,i,X,l,f))},fr.prototype.interfaces_=function(){return[]},fr.prototype.getClass=function(){return fr};var ti=function(){};ti.prototype.interfaces_=function(){return[]},ti.prototype.getClass=function(){return ti},ti.getChainStartIndices=function(t){var n=0,i=new V;i.add(new it(n));do{var s=ti.findChainEnd(t,n);i.add(new it(s)),n=s}while(n<t.length-1);return ti.toIntArray(i)},ti.findChainEnd=function(t,n){for(var i=n;i<t.length-1&&t[i].equals2D(t[i+1]);)i++;if(i>=t.length-1)return t.length-1;for(var s=be.quadrant(t[i],t[i+1]),l=n+1;l<t.length&&!(!t[l-1].equals2D(t[l])&&be.quadrant(t[l-1],t[l])!==s);)l++;return l-1},ti.getChains=function(){if(arguments.length===1){var t=arguments[0];return ti.getChains(t,null)}if(arguments.length===2){for(var n=arguments[0],i=arguments[1],s=new V,l=ti.getChainStartIndices(n),f=0;f<l.length-1;f++){var m=new fr(n,l[f],l[f+1],i);s.add(m)}return s}},ti.toIntArray=function(t){for(var n=new Array(t.size()).fill(null),i=0;i<n.length;i++)n[i]=t.get(i).intValue();return n};var no=function(){};no.prototype.computeNodes=function(t){},no.prototype.getNodedSubstrings=function(){},no.prototype.interfaces_=function(){return[]},no.prototype.getClass=function(){return no};var Ws=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setSegmentIntersector(t)}}};Ws.prototype.setSegmentIntersector=function(t){this._segInt=t},Ws.prototype.interfaces_=function(){return[no]},Ws.prototype.getClass=function(){return Ws};var rl=function(t){function n(s){s?t.call(this,s):t.call(this),this._monoChains=new V,this._index=new zh,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(n.__proto__=t),(n.prototype=Object.create(t&&t.prototype)).constructor=n;var i={SegmentOverlapAction:{configurable:!0}};return n.prototype.getMonotoneChains=function(){return this._monoChains},n.prototype.getNodedSubstrings=function(){return Je.getNodedSubstrings(this._nodedSegStrings)},n.prototype.getIndex=function(){return this._index},n.prototype.add=function(s){for(var l=ti.getChains(s.getCoordinates(),s).iterator();l.hasNext();){var f=l.next();f.setId(this._idCounter++),this._index.insert(f.getEnvelope(),f),this._monoChains.add(f)}},n.prototype.computeNodes=function(s){this._nodedSegStrings=s;for(var l=s.iterator();l.hasNext();)this.add(l.next());this.intersectChains()},n.prototype.intersectChains=function(){for(var s=new Vh(this._segInt),l=this._monoChains.iterator();l.hasNext();)for(var f=l.next(),m=this._index.query(f.getEnvelope()).iterator();m.hasNext();){var _=m.next();if(_.getId()>f.getId()&&(f.computeOverlaps(_,s),this._nOverlaps++),this._segInt.isDone())return null}},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},i.SegmentOverlapAction.get=function(){return Vh},Object.defineProperties(n,i),n}(Ws),Vh=function(t){function n(){t.call(this),this._si=null;var i=arguments[0];this._si=i}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.overlap=function(){if(arguments.length!==4)return t.prototype.overlap.apply(this,arguments);var i=arguments[0],s=arguments[1],l=arguments[2],f=arguments[3],m=i.getContext(),_=l.getContext();this._si.processIntersections(m,s,_,f)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(qs),ae=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setQuadrantSegments(n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.setQuadrantSegments(i),this.setEndCapStyle(s)}else if(arguments.length===4){var l=arguments[0],f=arguments[1],m=arguments[2],_=arguments[3];this.setQuadrantSegments(l),this.setEndCapStyle(f),this.setJoinStyle(m),this.setMitreLimit(_)}}},Ri={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}};ae.prototype.getEndCapStyle=function(){return this._endCapStyle},ae.prototype.isSingleSided=function(){return this._isSingleSided},ae.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=ae.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=ae.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==ae.JOIN_ROUND&&(this._quadrantSegments=ae.DEFAULT_QUADRANT_SEGMENTS)},ae.prototype.getJoinStyle=function(){return this._joinStyle},ae.prototype.setJoinStyle=function(t){this._joinStyle=t},ae.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},ae.prototype.getSimplifyFactor=function(){return this._simplifyFactor},ae.prototype.getQuadrantSegments=function(){return this._quadrantSegments},ae.prototype.setEndCapStyle=function(t){this._endCapStyle=t},ae.prototype.getMitreLimit=function(){return this._mitreLimit},ae.prototype.setMitreLimit=function(t){this._mitreLimit=t},ae.prototype.setSingleSided=function(t){this._isSingleSided=t},ae.prototype.interfaces_=function(){return[]},ae.prototype.getClass=function(){return ae},ae.bufferDistanceError=function(t){var n=Math.PI/2/t;return 1-Math.cos(n/2)},Ri.CAP_ROUND.get=function(){return 1},Ri.CAP_FLAT.get=function(){return 2},Ri.CAP_SQUARE.get=function(){return 3},Ri.JOIN_ROUND.get=function(){return 1},Ri.JOIN_MITRE.get=function(){return 2},Ri.JOIN_BEVEL.get=function(){return 3},Ri.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Ri.DEFAULT_MITRE_LIMIT.get=function(){return 5},Ri.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(ae,Ri);var Ve=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=tt.COUNTERCLOCKWISE,this._inputLine=t||null},Xs={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Ve.prototype.isDeletable=function(t,n,i,s){var l=this._inputLine[t],f=this._inputLine[n],m=this._inputLine[i];return!!this.isConcave(l,f,m)&&!!this.isShallow(l,f,m,s)&&this.isShallowSampled(l,f,t,i,s)},Ve.prototype.deleteShallowConcavities=function(){for(var t=1,n=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(n),s=!1;i<this._inputLine.length;){var l=!1;this.isDeletable(t,n,i,this._distanceTol)&&(this._isDeleted[n]=Ve.DELETE,l=!0,s=!0),t=l?i:n,n=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(n)}return s},Ve.prototype.isShallowConcavity=function(t,n,i,s){return tt.computeOrientation(t,n,i)!==this._angleOrientation?!1:tt.distancePointLine(n,t,i)<s},Ve.prototype.isShallowSampled=function(t,n,i,s,l){var f=Math.trunc((s-i)/Ve.NUM_PTS_TO_CHECK);f<=0&&(f=1);for(var m=i;m<s;m+=f)if(!this.isShallow(t,n,this._inputLine[m],l))return!1;return!0},Ve.prototype.isConcave=function(t,n,i){var s=tt.computeOrientation(t,n,i)===this._angleOrientation;return s},Ve.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=tt.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var n=!1;do n=this.deleteShallowConcavities();while(n);return this.collapseLine()},Ve.prototype.findNextNonDeletedIndex=function(t){for(var n=t+1;n<this._inputLine.length&&this._isDeleted[n]===Ve.DELETE;)n++;return n},Ve.prototype.isShallow=function(t,n,i,s){return tt.distancePointLine(n,t,i)<s},Ve.prototype.collapseLine=function(){for(var t=new Q,n=0;n<this._inputLine.length;n++)this._isDeleted[n]!==Ve.DELETE&&t.add(this._inputLine[n]);return t.toCoordinateArray()},Ve.prototype.interfaces_=function(){return[]},Ve.prototype.getClass=function(){return Ve},Ve.simplify=function(t,n){return new Ve(t).simplify(n)},Xs.INIT.get=function(){return 0},Xs.DELETE.get=function(){return 1},Xs.KEEP.get=function(){return 1},Xs.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Ve,Xs);var xr=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new V},Hh={COORDINATE_ARRAY_TYPE:{configurable:!0}};xr.prototype.getCoordinates=function(){return this._ptList.toArray(xr.COORDINATE_ARRAY_TYPE)},xr.prototype.setPrecisionModel=function(t){this._precisionModel=t},xr.prototype.addPt=function(t){var n=new C(t);if(this._precisionModel.makePrecise(n),this.isRedundant(n))return null;this._ptList.add(n)},xr.prototype.revere=function(){},xr.prototype.addPts=function(t,n){if(n)for(var i=0;i<t.length;i++)this.addPt(t[i]);else for(var s=t.length-1;s>=0;s--)this.addPt(t[s])},xr.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var n=this._ptList.get(this._ptList.size()-1);return t.distance(n)<this._minimimVertexDistance},xr.prototype.toString=function(){return new Tt().createLineString(this.getCoordinates()).toString()},xr.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new C(this._ptList.get(0)),n=this._ptList.get(this._ptList.size()-1);if(t.equals(n))return null;this._ptList.add(t)},xr.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},xr.prototype.interfaces_=function(){return[]},xr.prototype.getClass=function(){return xr},Hh.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(xr,Hh);var Ct=function(){},To={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};Ct.prototype.interfaces_=function(){return[]},Ct.prototype.getClass=function(){return Ct},Ct.toDegrees=function(t){return 180*t/Math.PI},Ct.normalize=function(t){for(;t>Math.PI;)t-=Ct.PI_TIMES_2;for(;t<=-Math.PI;)t+=Ct.PI_TIMES_2;return t},Ct.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}if(arguments.length===2){var n=arguments[0],i=arguments[1],s=i.x-n.x,l=i.y-n.y;return Math.atan2(l,s)}},Ct.isAcute=function(t,n,i){var s=t.x-n.x,l=t.y-n.y;return s*(i.x-n.x)+l*(i.y-n.y)>0},Ct.isObtuse=function(t,n,i){var s=t.x-n.x,l=t.y-n.y;return s*(i.x-n.x)+l*(i.y-n.y)<0},Ct.interiorAngle=function(t,n,i){var s=Ct.angle(n,t),l=Ct.angle(n,i);return Math.abs(l-s)},Ct.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Ct.PI_TIMES_2;t>=Ct.PI_TIMES_2&&(t=0)}else{for(;t>=Ct.PI_TIMES_2;)t-=Ct.PI_TIMES_2;t<0&&(t=0)}return t},Ct.angleBetween=function(t,n,i){var s=Ct.angle(n,t),l=Ct.angle(n,i);return Ct.diff(s,l)},Ct.diff=function(t,n){var i=null;return(i=t<n?n-t:t-n)>Math.PI&&(i=2*Math.PI-i),i},Ct.toRadians=function(t){return t*Math.PI/180},Ct.getTurn=function(t,n){var i=Math.sin(n-t);return i>0?Ct.COUNTERCLOCKWISE:i<0?Ct.CLOCKWISE:Ct.NONE},Ct.angleBetweenOriented=function(t,n,i){var s=Ct.angle(n,t),l=Ct.angle(n,i)-s;return l<=-Math.PI?l+Ct.PI_TIMES_2:l>Math.PI?l-Ct.PI_TIMES_2:l},To.PI_TIMES_2.get=function(){return 2*Math.PI},To.PI_OVER_2.get=function(){return Math.PI/2},To.PI_OVER_4.get=function(){return Math.PI/4},To.COUNTERCLOCKWISE.get=function(){return tt.COUNTERCLOCKWISE},To.CLOCKWISE.get=function(){return tt.CLOCKWISE},To.NONE.get=function(){return tt.COLLINEAR},Object.defineProperties(Ct,To);var De=function t(){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 ft,this._seg1=new ft,this._offset0=new ft,this._offset1=new ft,this._side=0,this._hasNarrowConcaveAngle=!1;var n=arguments[0],i=arguments[1],s=arguments[2];this._precisionModel=n,this._bufParams=i,this._li=new Pr,this._filletAngleQuantum=Math.PI/2/i.getQuadrantSegments(),i.getQuadrantSegments()>=8&&i.getJoinStyle()===ae.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(s)},Ys={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}};De.prototype.addNextSegment=function(t,n){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,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 i=tt.computeOrientation(this._s0,this._s1,this._s2),s=i===tt.CLOCKWISE&&this._side===j.LEFT||i===tt.COUNTERCLOCKWISE&&this._side===j.RIGHT;i===0?this.addCollinear(n):s?this.addOutsideTurn(i,n):this.addInsideTurn(i,n)},De.prototype.addLineEndCap=function(t,n){var i=new ft(t,n),s=new ft;this.computeOffsetSegment(i,j.LEFT,this._distance,s);var l=new ft;this.computeOffsetSegment(i,j.RIGHT,this._distance,l);var f=n.x-t.x,m=n.y-t.y,_=Math.atan2(m,f);switch(this._bufParams.getEndCapStyle()){case ae.CAP_ROUND:this._segList.addPt(s.p1),this.addFilletArc(n,_+Math.PI/2,_-Math.PI/2,tt.CLOCKWISE,this._distance),this._segList.addPt(l.p1);break;case ae.CAP_FLAT:this._segList.addPt(s.p1),this._segList.addPt(l.p1);break;case ae.CAP_SQUARE:var S=new C;S.x=Math.abs(this._distance)*Math.cos(_),S.y=Math.abs(this._distance)*Math.sin(_);var O=new C(s.p1.x+S.x,s.p1.y+S.y),H=new C(l.p1.x+S.x,l.p1.y+S.y);this._segList.addPt(O),this._segList.addPt(H)}},De.prototype.getCoordinates=function(){return this._segList.getCoordinates()},De.prototype.addMitreJoin=function(t,n,i,s){var l=!0,f=null;try{f=Le.intersection(n.p0,n.p1,i.p0,i.p1),(s<=0?1:f.distance(t)/Math.abs(s))>this._bufParams.getMitreLimit()&&(l=!1)}catch(m){if(!(m instanceof qe))throw m;f=new C(0,0),l=!1}l?this._segList.addPt(f):this.addLimitedMitreJoin(n,i,s,this._bufParams.getMitreLimit())},De.prototype.addFilletCorner=function(t,n,i,s,l){var f=n.x-t.x,m=n.y-t.y,_=Math.atan2(m,f),S=i.x-t.x,O=i.y-t.y,H=Math.atan2(O,S);s===tt.CLOCKWISE?_<=H&&(_+=2*Math.PI):_>=H&&(_-=2*Math.PI),this._segList.addPt(n),this.addFilletArc(t,_,H,s,l),this._segList.addPt(i)},De.prototype.addOutsideTurn=function(t,n){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*De.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===ae.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===ae.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(n&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))},De.prototype.createSquare=function(t){this._segList.addPt(new C(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new C(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new C(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new C(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},De.prototype.addSegments=function(t,n){this._segList.addPts(t,n)},De.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},De.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},De.prototype.initSideSegments=function(t,n,i){this._s1=t,this._s2=n,this._side=i,this._seg1.setCoordinates(t,n),this.computeOffsetSegment(this._seg1,i,this._distance,this._offset1)},De.prototype.addLimitedMitreJoin=function(t,n,i,s){var l=this._seg0.p1,f=Ct.angle(l,this._seg0.p0),m=Ct.angleBetweenOriented(this._seg0.p0,l,this._seg1.p1)/2,_=Ct.normalize(f+m),S=Ct.normalize(_+Math.PI),O=s*i,H=i-O*Math.abs(Math.sin(m)),X=l.x+O*Math.cos(S),nt=l.y+O*Math.sin(S),rt=new C(X,nt),lt=new ft(l,rt),gt=lt.pointAlongOffset(1,H),we=lt.pointAlongOffset(1,-H);this._side===j.LEFT?(this._segList.addPt(gt),this._segList.addPt(we)):(this._segList.addPt(we),this._segList.addPt(gt))},De.prototype.computeOffsetSegment=function(t,n,i,s){var l=n===j.LEFT?1:-1,f=t.p1.x-t.p0.x,m=t.p1.y-t.p0.y,_=Math.sqrt(f*f+m*m),S=l*i*f/_,O=l*i*m/_;s.p0.x=t.p0.x-O,s.p0.y=t.p0.y+S,s.p1.x=t.p1.x-O,s.p1.y=t.p1.y+S},De.prototype.addFilletArc=function(t,n,i,s,l){var f=s===tt.CLOCKWISE?-1:1,m=Math.abs(n-i),_=Math.trunc(m/this._filletAngleQuantum+.5);if(_<1)return null;for(var S=m/_,O=0,H=new C;O<m;){var X=n+f*O;H.x=t.x+l*Math.cos(X),H.y=t.y+l*Math.sin(X),this._segList.addPt(H),O+=S}},De.prototype.addInsideTurn=function(t,n){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*De.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var i=new C((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(i);var s=new C((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(s)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},De.prototype.createCircle=function(t){var n=new C(t.x+this._distance,t.y);this._segList.addPt(n),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},De.prototype.addBevelJoin=function(t,n){this._segList.addPt(t.p1),this._segList.addPt(n.p0)},De.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new xr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*De.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},De.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===ae.JOIN_BEVEL||this._bufParams.getJoinStyle()===ae.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,tt.CLOCKWISE,this._distance))},De.prototype.closeRing=function(){this._segList.closeRing()},De.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},De.prototype.interfaces_=function(){return[]},De.prototype.getClass=function(){return De},Ys.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},Ys.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},Ys.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Ys.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(De,Ys);var tr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],n=arguments[1];this._precisionModel=t,this._bufParams=n};tr.prototype.getOffsetCurve=function(t,n){if(this._distance=n,n===0)return null;var i=n<0,s=Math.abs(n),l=this.getSegGen(s);t.length<=1?this.computePointCurve(t[0],l):this.computeOffsetCurve(t,i,l);var f=l.getCoordinates();return i&&J.reverse(f),f},tr.prototype.computeSingleSidedBufferCurve=function(t,n,i){var s=this.simplifyTolerance(this._distance);if(n){i.addSegments(t,!0);var l=Ve.simplify(t,-s),f=l.length-1;i.initSideSegments(l[f],l[f-1],j.LEFT),i.addFirstSegment();for(var m=f-2;m>=0;m--)i.addNextSegment(l[m],!0)}else{i.addSegments(t,!1);var _=Ve.simplify(t,s),S=_.length-1;i.initSideSegments(_[0],_[1],j.LEFT),i.addFirstSegment();for(var O=2;O<=S;O++)i.addNextSegment(_[O],!0)}i.addLastSegment(),i.closeRing()},tr.prototype.computeRingBufferCurve=function(t,n,i){var s=this.simplifyTolerance(this._distance);n===j.RIGHT&&(s=-s);var l=Ve.simplify(t,s),f=l.length-1;i.initSideSegments(l[f-1],l[0],n);for(var m=1;m<=f;m++){var _=m!==1;i.addNextSegment(l[m],_)}i.closeRing()},tr.prototype.computeLineBufferCurve=function(t,n){var i=this.simplifyTolerance(this._distance),s=Ve.simplify(t,i),l=s.length-1;n.initSideSegments(s[0],s[1],j.LEFT);for(var f=2;f<=l;f++)n.addNextSegment(s[f],!0);n.addLastSegment(),n.addLineEndCap(s[l-1],s[l]);var m=Ve.simplify(t,-i),_=m.length-1;n.initSideSegments(m[_],m[_-1],j.LEFT);for(var S=_-2;S>=0;S--)n.addNextSegment(m[S],!0);n.addLastSegment(),n.addLineEndCap(m[1],m[0]),n.closeRing()},tr.prototype.computePointCurve=function(t,n){switch(this._bufParams.getEndCapStyle()){case ae.CAP_ROUND:n.createCircle(t);break;case ae.CAP_SQUARE:n.createSquare(t)}},tr.prototype.getLineCurve=function(t,n){if(this._distance=n,n<0&&!this._bufParams.isSingleSided()||n===0)return null;var i=Math.abs(n),s=this.getSegGen(i);if(t.length<=1)this.computePointCurve(t[0],s);else if(this._bufParams.isSingleSided()){var l=n<0;this.computeSingleSidedBufferCurve(t,l,s)}else this.computeLineBufferCurve(t,s);return s.getCoordinates()},tr.prototype.getBufferParameters=function(){return this._bufParams},tr.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},tr.prototype.getRingCurve=function(t,n,i){if(this._distance=i,t.length<=2)return this.getLineCurve(t,i);if(i===0)return tr.copyCoordinates(t);var s=this.getSegGen(i);return this.computeRingBufferCurve(t,n,s),s.getCoordinates()},tr.prototype.computeOffsetCurve=function(t,n,i){var s=this.simplifyTolerance(this._distance);if(n){var l=Ve.simplify(t,-s),f=l.length-1;i.initSideSegments(l[f],l[f-1],j.LEFT),i.addFirstSegment();for(var m=f-2;m>=0;m--)i.addNextSegment(l[m],!0)}else{var _=Ve.simplify(t,s),S=_.length-1;i.initSideSegments(_[0],_[1],j.LEFT),i.addFirstSegment();for(var O=2;O<=S;O++)i.addNextSegment(_[O],!0)}i.addLastSegment()},tr.prototype.getSegGen=function(t){return new De(this._precisionModel,this._bufParams,t)},tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr},tr.copyCoordinates=function(t){for(var n=new Array(t.length).fill(null),i=0;i<n.length;i++)n[i]=new C(t[i]);return n};var Co=function(){this._subgraphs=null,this._seg=new ft,this._cga=new tt;var t=arguments[0];this._subgraphs=t},qh={DepthSegment:{configurable:!0}};Co.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var t=arguments[0],n=new V,i=this._subgraphs.iterator();i.hasNext();){var s=i.next(),l=s.getEnvelope();t.y<l.getMinY()||t.y>l.getMaxY()||this.findStabbedSegments(t,s.getDirectedEdges(),n)}return n}if(arguments.length===3){if(et(arguments[2],Z)&&arguments[0]instanceof C&&arguments[1]instanceof nl){for(var f=arguments[0],m=arguments[1],_=arguments[2],S=m.getEdge().getCoordinates(),O=0;O<S.length-1;O++)if(this._seg.p0=S[O],this._seg.p1=S[O+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<f.x)&&!(this._seg.isHorizontal()||f.y<this._seg.p0.y||f.y>this._seg.p1.y||tt.computeOrientation(this._seg.p0,this._seg.p1,f)===tt.RIGHT)){var H=m.getDepth(j.LEFT);this._seg.p0.equals(S[O])||(H=m.getDepth(j.RIGHT));var X=new ro(this._seg,H);_.add(X)}}else if(et(arguments[2],Z)&&arguments[0]instanceof C&&et(arguments[1],Z))for(var nt=arguments[0],rt=arguments[1],lt=arguments[2],gt=rt.iterator();gt.hasNext();){var we=gt.next();we.isForward()&&this.findStabbedSegments(nt,we,lt)}}},Co.prototype.getDepth=function(t){var n=this.findStabbedSegments(t);return n.size()===0?0:Gr.min(n)._leftDepth},Co.prototype.interfaces_=function(){return[]},Co.prototype.getClass=function(){return Co},qh.DepthSegment.get=function(){return ro},Object.defineProperties(Co,qh);var ro=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],n=arguments[1];this._upwardSeg=new ft(t),this._leftDepth=n};ro.prototype.compareTo=function(t){var n=t;if(this._upwardSeg.minX()>=n._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=n._upwardSeg.minX())return-1;var i=this._upwardSeg.orientationIndex(n._upwardSeg);return i!==0||(i=-1*n._upwardSeg.orientationIndex(this._upwardSeg))!=0?i:this._upwardSeg.compareTo(n._upwardSeg)},ro.prototype.compareX=function(t,n){var i=t.p0.compareTo(n.p0);return i!==0?i:t.p1.compareTo(n.p1)},ro.prototype.toString=function(){return this._upwardSeg.toString()},ro.prototype.interfaces_=function(){return[k]},ro.prototype.getClass=function(){return ro};var ue=function(t,n,i){this.p0=t||null,this.p1=n||null,this.p2=i||null};ue.prototype.area=function(){return ue.area(this.p0,this.p1,this.p2)},ue.prototype.signedArea=function(){return ue.signedArea(this.p0,this.p1,this.p2)},ue.prototype.interpolateZ=function(t){if(t===null)throw new L("Supplied point is null.");return ue.interpolateZ(t,this.p0,this.p1,this.p2)},ue.prototype.longestSideLength=function(){return ue.longestSideLength(this.p0,this.p1,this.p2)},ue.prototype.isAcute=function(){return ue.isAcute(this.p0,this.p1,this.p2)},ue.prototype.circumcentre=function(){return ue.circumcentre(this.p0,this.p1,this.p2)},ue.prototype.area3D=function(){return ue.area3D(this.p0,this.p1,this.p2)},ue.prototype.centroid=function(){return ue.centroid(this.p0,this.p1,this.p2)},ue.prototype.inCentre=function(){return ue.inCentre(this.p0,this.p1,this.p2)},ue.prototype.interfaces_=function(){return[]},ue.prototype.getClass=function(){return ue},ue.area=function(t,n,i){return Math.abs(((i.x-t.x)*(n.y-t.y)-(n.x-t.x)*(i.y-t.y))/2)},ue.signedArea=function(t,n,i){return((i.x-t.x)*(n.y-t.y)-(n.x-t.x)*(i.y-t.y))/2},ue.det=function(t,n,i,s){return t*s-n*i},ue.interpolateZ=function(t,n,i,s){var l=n.x,f=n.y,m=i.x-l,_=s.x-l,S=i.y-f,O=s.y-f,H=m*O-_*S,X=t.x-l,nt=t.y-f,rt=(O*X-_*nt)/H,lt=(-S*X+m*nt)/H;return n.z+rt*(i.z-n.z)+lt*(s.z-n.z)},ue.longestSideLength=function(t,n,i){var s=t.distance(n),l=n.distance(i),f=i.distance(t),m=s;return l>m&&(m=l),f>m&&(m=f),m},ue.isAcute=function(t,n,i){return!!Ct.isAcute(t,n,i)&&!!Ct.isAcute(n,i,t)&&!!Ct.isAcute(i,t,n)},ue.circumcentre=function(t,n,i){var s=i.x,l=i.y,f=t.x-s,m=t.y-l,_=n.x-s,S=n.y-l,O=2*ue.det(f,m,_,S),H=ue.det(m,f*f+m*m,S,_*_+S*S),X=ue.det(f,f*f+m*m,_,_*_+S*S);return new C(s-H/O,l+X/O)},ue.perpendicularBisector=function(t,n){var i=n.x-t.x,s=n.y-t.y,l=new Le(t.x+i/2,t.y+s/2,1),f=new Le(t.x-s+i/2,t.y+i+s/2,1);return new Le(l,f)},ue.angleBisector=function(t,n,i){var s=n.distance(t),l=s/(s+n.distance(i)),f=i.x-t.x,m=i.y-t.y;return new C(t.x+l*f,t.y+l*m)},ue.area3D=function(t,n,i){var s=n.x-t.x,l=n.y-t.y,f=n.z-t.z,m=i.x-t.x,_=i.y-t.y,S=i.z-t.z,O=l*S-f*_,H=f*m-s*S,X=s*_-l*m,nt=O*O+H*H+X*X,rt=Math.sqrt(nt)/2;return rt},ue.centroid=function(t,n,i){var s=(t.x+n.x+i.x)/3,l=(t.y+n.y+i.y)/3;return new C(s,l)},ue.inCentre=function(t,n,i){var s=n.distance(i),l=t.distance(i),f=t.distance(n),m=s+l+f,_=(s*t.x+l*n.x+f*i.x)/m,S=(s*t.y+l*n.y+f*i.y)/m;return new C(_,S)};var Lr=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new V;var t=arguments[0],n=arguments[1],i=arguments[2];this._inputGeom=t,this._distance=n,this._curveBuilder=i};Lr.prototype.addPoint=function(t){if(this._distance<=0)return null;var n=t.getCoordinates(),i=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(i,F.EXTERIOR,F.INTERIOR)},Lr.prototype.addPolygon=function(t){var n=this._distance,i=j.LEFT;this._distance<0&&(n=-this._distance,i=j.RIGHT);var s=t.getExteriorRing(),l=J.removeRepeatedPoints(s.getCoordinates());if(this._distance<0&&this.isErodedCompletely(s,this._distance)||this._distance<=0&&l.length<3)return null;this.addPolygonRing(l,n,i,F.EXTERIOR,F.INTERIOR);for(var f=0;f<t.getNumInteriorRing();f++){var m=t.getInteriorRingN(f),_=J.removeRepeatedPoints(m.getCoordinates());this._distance>0&&this.isErodedCompletely(m,-this._distance)||this.addPolygonRing(_,n,j.opposite(i),F.INTERIOR,F.EXTERIOR)}},Lr.prototype.isTriangleErodedCompletely=function(t,n){var i=new ue(t[0],t[1],t[2]),s=i.inCentre();return tt.distancePointLine(s,i.p0,i.p1)<Math.abs(n)},Lr.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var n=J.removeRepeatedPoints(t.getCoordinates()),i=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(i,F.EXTERIOR,F.INTERIOR)},Lr.prototype.addCurve=function(t,n,i){if(t===null||t.length<2)return null;var s=new Je(t,new Me(0,F.BOUNDARY,n,i));this._curveList.add(s)},Lr.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Lr.prototype.addPolygonRing=function(t,n,i,s,l){if(n===0&&t.length<ci.MINIMUM_VALID_SIZE)return null;var f=s,m=l;t.length>=ci.MINIMUM_VALID_SIZE&&tt.isCCW(t)&&(f=l,m=s,i=j.opposite(i));var _=this._curveBuilder.getRingCurve(t,i,n);this.addCurve(_,f,m)},Lr.prototype.add=function(t){if(t.isEmpty())return null;t instanceof an?this.addPolygon(t):t instanceof Ge?this.addLineString(t):t instanceof cr?this.addPoint(t):t instanceof Zo?this.addCollection(t):t instanceof Rr?this.addCollection(t):t instanceof hi?this.addCollection(t):t instanceof Fe&&this.addCollection(t)},Lr.prototype.isErodedCompletely=function(t,n){var i=t.getCoordinates();if(i.length<4)return n<0;if(i.length===4)return this.isTriangleErodedCompletely(i,n);var s=t.getEnvelopeInternal(),l=Math.min(s.getHeight(),s.getWidth());return n<0&&2*Math.abs(n)>l},Lr.prototype.addCollection=function(t){for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);this.add(i)}},Lr.prototype.interfaces_=function(){return[]},Lr.prototype.getClass=function(){return Lr};var jo=function(){};jo.prototype.locate=function(t){},jo.prototype.interfaces_=function(){return[]},jo.prototype.getClass=function(){return jo};var di=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};di.prototype.next=function(){if(this._atStart)return this._atStart=!1,di.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 a;var t=this._parent.getGeometryN(this._index++);return t instanceof Fe?(this._subcollectionIterator=new di(t),this._subcollectionIterator.next()):t},di.prototype.remove=function(){throw new Error(this.getClass().getName())},di.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)},di.prototype.interfaces_=function(){return[K]},di.prototype.getClass=function(){return di},di.isAtomic=function(t){return!(t instanceof Fe)};var Er=function(){this._geom=null;var t=arguments[0];this._geom=t};Er.prototype.locate=function(t){return Er.locate(t,this._geom)},Er.prototype.interfaces_=function(){return[jo]},Er.prototype.getClass=function(){return Er},Er.isPointInRing=function(t,n){return!!n.getEnvelopeInternal().intersects(t)&&tt.isPointInRing(t,n.getCoordinates())},Er.containsPointInPolygon=function(t,n){if(n.isEmpty())return!1;var i=n.getExteriorRing();if(!Er.isPointInRing(t,i))return!1;for(var s=0;s<n.getNumInteriorRing();s++){var l=n.getInteriorRingN(s);if(Er.isPointInRing(t,l))return!1}return!0},Er.containsPoint=function(t,n){if(n instanceof an)return Er.containsPointInPolygon(t,n);if(n instanceof Fe)for(var i=new di(n);i.hasNext();){var s=i.next();if(s!==n&&Er.containsPoint(t,s))return!0}return!1},Er.locate=function(t,n){return n.isEmpty()?F.EXTERIOR:Er.containsPoint(t,n)?F.INTERIOR:F.EXTERIOR};var Pn=function(){this._edgeMap=new x,this._edgeList=null,this._ptInAreaLocation=[F.NONE,F.NONE]};Pn.prototype.getNextCW=function(t){this.getEdges();var n=this._edgeList.indexOf(t),i=n-1;return n===0&&(i=this._edgeList.size()-1),this._edgeList.get(i)},Pn.prototype.propagateSideLabels=function(t){for(var n=F.NONE,i=this.iterator();i.hasNext();){var s=i.next().getLabel();s.isArea(t)&&s.getLocation(t,j.LEFT)!==F.NONE&&(n=s.getLocation(t,j.LEFT))}if(n===F.NONE)return null;for(var l=n,f=this.iterator();f.hasNext();){var m=f.next(),_=m.getLabel();if(_.getLocation(t,j.ON)===F.NONE&&_.setLocation(t,j.ON,l),_.isArea(t)){var S=_.getLocation(t,j.LEFT),O=_.getLocation(t,j.RIGHT);if(O!==F.NONE){if(O!==l)throw new Ii("side location conflict",m.getCoordinate());S===F.NONE&&_t.shouldNeverReachHere("found single null side (at "+m.getCoordinate()+")"),l=S}else _t.isTrue(_.getLocation(t,j.LEFT)===F.NONE,"found single null side"),_.setLocation(t,j.RIGHT,l),_.setLocation(t,j.LEFT,l)}}},Pn.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},Pn.prototype.print=function(t){Ee.out.println("EdgeEndStar: "+this.getCoordinate());for(var n=this.iterator();n.hasNext();)n.next().print(t)},Pn.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},Pn.prototype.checkAreaLabelsConsistent=function(t){var n=this.getEdges();if(n.size()<=0)return!0;var i=n.size()-1,s=n.get(i).getLabel().getLocation(t,j.LEFT);_t.isTrue(s!==F.NONE,"Found unlabelled area edge");for(var l=s,f=this.iterator();f.hasNext();){var m=f.next().getLabel();_t.isTrue(m.isArea(t),"Found non-area edge");var _=m.getLocation(t,j.LEFT),S=m.getLocation(t,j.RIGHT);if(_===S||S!==l)return!1;l=_}return!0},Pn.prototype.findIndex=function(t){this.iterator();for(var n=0;n<this._edgeList.size();n++)if(this._edgeList.get(n)===t)return n;return-1},Pn.prototype.iterator=function(){return this.getEdges().iterator()},Pn.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new V(this._edgeMap.values())),this._edgeList},Pn.prototype.getLocation=function(t,n,i){return this._ptInAreaLocation[t]===F.NONE&&(this._ptInAreaLocation[t]=Er.locate(n,i[t].getGeometry())),this._ptInAreaLocation[t]},Pn.prototype.toString=function(){var t=new Rt;t.append("EdgeEndStar: "+this.getCoordinate()),t.append(`\n`);for(var n=this.iterator();n.hasNext();){var i=n.next();t.append(i),t.append(`\n`)}return t.toString()},Pn.prototype.computeEdgeEndLabels=function(t){for(var n=this.iterator();n.hasNext();)n.next().computeLabel(t)},Pn.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var n=[!1,!1],i=this.iterator();i.hasNext();)for(var s=i.next().getLabel(),l=0;l<2;l++)s.isLine(l)&&s.getLocation(l)===F.BOUNDARY&&(n[l]=!0);for(var f=this.iterator();f.hasNext();)for(var m=f.next(),_=m.getLabel(),S=0;S<2;S++)if(_.isAnyNull(S)){var O=F.NONE;if(n[S])O=F.EXTERIOR;else{var H=m.getCoordinate();O=this.getLocation(S,H,t)}_.setAllLocationsIfNull(S,O)}},Pn.prototype.getDegree=function(){return this._edgeMap.size()},Pn.prototype.insertEdgeEnd=function(t,n){this._edgeMap.put(t,n),this._edgeList=null},Pn.prototype.interfaces_=function(){return[]},Pn.prototype.getClass=function(){return Pn};var P0=function(t){function n(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var i=null,s=null,l=this._SCANNING_FOR_INCOMING,f=0;f<this._resultAreaEdgeList.size();f++){var m=this._resultAreaEdgeList.get(f),_=m.getSym();if(m.getLabel().isArea())switch(i===null&&m.isInResult()&&(i=m),l){case this._SCANNING_FOR_INCOMING:if(!_.isInResult())continue;s=_,l=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!m.isInResult())continue;s.setNext(m),l=this._SCANNING_FOR_INCOMING}}if(l===this._LINKING_TO_OUTGOING){if(i===null)throw new Ii("no outgoing dirEdge found",this.getCoordinate());_t.isTrue(i.isInResult(),"unable to link last incoming dirEdge"),s.setNext(i)}},n.prototype.insert=function(i){var s=i;this.insertEdgeEnd(s,s)},n.prototype.getRightmostEdge=function(){var i=this.getEdges(),s=i.size();if(s<1)return null;var l=i.get(0);if(s===1)return l;var f=i.get(s-1),m=l.getQuadrant(),_=f.getQuadrant();return be.isNorthern(m)&&be.isNorthern(_)?l:be.isNorthern(m)||be.isNorthern(_)?l.getDy()!==0?l:f.getDy()!==0?f:(_t.shouldNeverReachHere("found two horizontal edges incident on node"),null):f},n.prototype.print=function(i){Ee.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var s=this.iterator();s.hasNext();){var l=s.next();i.print("out "),l.print(i),i.println(),i.print("in "),l.getSym().print(i),i.println()}},n.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new V;for(var i=this.iterator();i.hasNext();){var s=i.next();(s.isInResult()||s.getSym().isInResult())&&this._resultAreaEdgeList.add(s)}return this._resultAreaEdgeList},n.prototype.updateLabelling=function(i){for(var s=this.iterator();s.hasNext();){var l=s.next().getLabel();l.setAllLocationsIfNull(0,i.getLocation(0)),l.setAllLocationsIfNull(1,i.getLocation(1))}},n.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var i=null,s=null,l=this._edgeList.size()-1;l>=0;l--){var f=this._edgeList.get(l),m=f.getSym();s===null&&(s=m),i!==null&&m.setNext(i),i=f}s.setNext(i)},n.prototype.computeDepths=function(){if(arguments.length===1){var i=arguments[0],s=this.findIndex(i),l=i.getDepth(j.LEFT),f=i.getDepth(j.RIGHT),m=this.computeDepths(s+1,this._edgeList.size(),l);if(this.computeDepths(0,s,m)!==f)throw new Ii("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var _=arguments[0],S=arguments[1],O=arguments[2],H=_;H<S;H++){var X=this._edgeList.get(H);X.setEdgeDepths(j.RIGHT,O),O=X.getDepth(j.LEFT)}return O}},n.prototype.mergeSymLabels=function(){for(var i=this.iterator();i.hasNext();){var s=i.next();s.getLabel().merge(s.getSym().getLabel())}},n.prototype.linkMinimalDirectedEdges=function(i){for(var s=null,l=null,f=this._SCANNING_FOR_INCOMING,m=this._resultAreaEdgeList.size()-1;m>=0;m--){var _=this._resultAreaEdgeList.get(m),S=_.getSym();switch(s===null&&_.getEdgeRing()===i&&(s=_),f){case this._SCANNING_FOR_INCOMING:if(S.getEdgeRing()!==i)continue;l=S,f=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(_.getEdgeRing()!==i)continue;l.setNextMin(_),f=this._SCANNING_FOR_INCOMING}}f===this._LINKING_TO_OUTGOING&&(_t.isTrue(s!==null,"found null for first outgoing dirEdge"),_t.isTrue(s.getEdgeRing()===i,"unable to link last incoming dirEdge"),l.setNextMin(s))},n.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var i=0,s=this.iterator();s.hasNext();)s.next().isInResult()&&i++;return i}if(arguments.length===1){for(var l=arguments[0],f=0,m=this.iterator();m.hasNext();)m.next().getEdgeRing()===l&&f++;return f}},n.prototype.getLabel=function(){return this._label},n.prototype.findCoveredLineEdges=function(){for(var i=F.NONE,s=this.iterator();s.hasNext();){var l=s.next(),f=l.getSym();if(!l.isLineEdge()){if(l.isInResult()){i=F.INTERIOR;break}if(f.isInResult()){i=F.EXTERIOR;break}}}if(i===F.NONE)return null;for(var m=i,_=this.iterator();_.hasNext();){var S=_.next(),O=S.getSym();S.isLineEdge()?S.getEdge().setCovered(m===F.INTERIOR):(S.isInResult()&&(m=F.EXTERIOR),O.isInResult()&&(m=F.INTERIOR))}},n.prototype.computeLabelling=function(i){t.prototype.computeLabelling.call(this,i),this._label=new Me(F.NONE);for(var s=this.iterator();s.hasNext();)for(var l=s.next().getEdge().getLabel(),f=0;f<2;f++){var m=l.getLocation(f);m!==F.INTERIOR&&m!==F.BOUNDARY||this._label.setLocation(f,F.INTERIOR)}},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Pn),Wh=function(t){function n(){t.apply(this,arguments)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.createNode=function(i){return new Na(i,new P0)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Jo),qi=function t(){this._pts=null,this._orientation=null;var n=arguments[0];this._pts=n,this._orientation=t.orientation(n)};qi.prototype.compareTo=function(t){var n=t;return qi.compareOriented(this._pts,this._orientation,n._pts,n._orientation)},qi.prototype.interfaces_=function(){return[k]},qi.prototype.getClass=function(){return qi},qi.orientation=function(t){return J.increasingDirection(t)===1},qi.compareOriented=function(t,n,i,s){for(var l=n?1:-1,f=s?1:-1,m=n?t.length:-1,_=s?i.length:-1,S=n?0:t.length-1,O=s?0:i.length-1;;){var H=t[S].compareTo(i[O]);if(H!==0)return H;var X=(S+=l)===m,nt=(O+=f)===_;if(X&&!nt)return-1;if(!X&&nt)return 1;if(X&&nt)return 0}};var Vr=function(){this._edges=new V,this._ocaMap=new x};Vr.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n);n>0&&t.print(","),t.print("(");for(var s=i.getCoordinates(),l=0;l<s.length;l++)l>0&&t.print(","),t.print(s[l].x+" "+s[l].y);t.println(")")}t.print(") ")},Vr.prototype.addAll=function(t){for(var n=t.iterator();n.hasNext();)this.add(n.next())},Vr.prototype.findEdgeIndex=function(t){for(var n=0;n<this._edges.size();n++)if(this._edges.get(n).equals(t))return n;return-1},Vr.prototype.iterator=function(){return this._edges.iterator()},Vr.prototype.getEdges=function(){return this._edges},Vr.prototype.get=function(t){return this._edges.get(t)},Vr.prototype.findEqualEdge=function(t){var n=new qi(t.getCoordinates());return this._ocaMap.get(n)},Vr.prototype.add=function(t){this._edges.add(t);var n=new qi(t.getCoordinates());this._ocaMap.put(n,t)},Vr.prototype.interfaces_=function(){return[]},Vr.prototype.getClass=function(){return Vr};var io=function(){};io.prototype.processIntersections=function(t,n,i,s){},io.prototype.isDone=function(){},io.prototype.interfaces_=function(){return[]},io.prototype.getClass=function(){return io};var Mr=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 t=arguments[0];this._li=t};Mr.prototype.isTrivialIntersection=function(t,n,i,s){if(t===i&&this._li.getIntersectionNum()===1){if(Mr.isAdjacentSegments(n,s))return!0;if(t.isClosed()){var l=t.size()-1;if(n===0&&s===l||s===0&&n===l)return!0}}return!1},Mr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Mr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Mr.prototype.getLineIntersector=function(){return this._li},Mr.prototype.hasProperIntersection=function(){return this._hasProper},Mr.prototype.processIntersections=function(t,n,i,s){if(t===i&&n===s)return null;this.numTests++;var l=t.getCoordinates()[n],f=t.getCoordinates()[n+1],m=i.getCoordinates()[s],_=i.getCoordinates()[s+1];this._li.computeIntersection(l,f,m,_),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,n,i,s)||(this._hasIntersection=!0,t.addIntersections(this._li,n,0),i.addIntersections(this._li,s,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Mr.prototype.hasIntersection=function(){return this._hasIntersection},Mr.prototype.isDone=function(){return!1},Mr.prototype.hasInteriorIntersection=function(){return this._hasInterior},Mr.prototype.interfaces_=function(){return[io]},Mr.prototype.getClass=function(){return Mr},Mr.isAdjacentSegments=function(t,n){return Math.abs(t-n)===1};var ei=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],n=arguments[1],i=arguments[2];this.coord=new C(t),this.segmentIndex=n,this.dist=i};ei.prototype.getSegmentIndex=function(){return this.segmentIndex},ei.prototype.getCoordinate=function(){return this.coord},ei.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},ei.prototype.compareTo=function(t){var n=t;return this.compare(n.segmentIndex,n.dist)},ei.prototype.isEndPoint=function(t){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===t},ei.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},ei.prototype.getDistance=function(){return this.dist},ei.prototype.compare=function(t,n){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<n?-1:this.dist>n?1:0},ei.prototype.interfaces_=function(){return[k]},ei.prototype.getClass=function(){return ei};var mi=function(){this._nodeMap=new x,this.edge=null;var t=arguments[0];this.edge=t};mi.prototype.print=function(t){t.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(t)},mi.prototype.iterator=function(){return this._nodeMap.values().iterator()},mi.prototype.addSplitEdges=function(t){this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var s=n.next(),l=this.createSplitEdge(i,s);t.add(l),i=s}},mi.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},mi.prototype.createSplitEdge=function(t,n){var i=n.segmentIndex-t.segmentIndex+2,s=this.edge.pts[n.segmentIndex],l=n.dist>0||!n.coord.equals2D(s);l||i--;var f=new Array(i).fill(null),m=0;f[m++]=new C(t.coord);for(var _=t.segmentIndex+1;_<=n.segmentIndex;_++)f[m++]=this.edge.pts[_];return l&&(f[m]=n.coord),new Da(f,new Me(this.edge._label))},mi.prototype.add=function(t,n,i){var s=new ei(t,n,i),l=this._nodeMap.get(s);return l!==null?l:(this._nodeMap.put(s,s),s)},mi.prototype.isIntersection=function(t){for(var n=this.iterator();n.hasNext();)if(n.next().coord.equals(t))return!0;return!1},mi.prototype.interfaces_=function(){return[]},mi.prototype.getClass=function(){return mi};var oo=function(){};oo.prototype.getChainStartIndices=function(t){var n=0,i=new V;i.add(new it(n));do{var s=this.findChainEnd(t,n);i.add(new it(s)),n=s}while(n<t.length-1);return oo.toIntArray(i)},oo.prototype.findChainEnd=function(t,n){for(var i=be.quadrant(t[n],t[n+1]),s=n+1;s<t.length&&be.quadrant(t[s-1],t[s])===i;)s++;return s-1},oo.prototype.interfaces_=function(){return[]},oo.prototype.getClass=function(){return oo},oo.toIntArray=function(t){for(var n=new Array(t.size()).fill(null),i=0;i<n.length;i++)n[i]=t.get(i).intValue();return n};var Ni=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new at,this.env2=new at;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var n=new oo;this.startIndex=n.getChainStartIndices(this.pts)};Ni.prototype.getCoordinates=function(){return this.pts},Ni.prototype.getMaxX=function(t){var n=this.pts[this.startIndex[t]].x,i=this.pts[this.startIndex[t+1]].x;return n>i?n:i},Ni.prototype.getMinX=function(t){var n=this.pts[this.startIndex[t]].x,i=this.pts[this.startIndex[t+1]].x;return n<i?n:i},Ni.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var t=arguments[0],n=arguments[1],i=arguments[2],s=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],n,n.startIndex[i],n.startIndex[i+1],s)}else if(arguments.length===6){var l=arguments[0],f=arguments[1],m=arguments[2],_=arguments[3],S=arguments[4],O=arguments[5],H=this.pts[l],X=this.pts[f],nt=m.pts[_],rt=m.pts[S];if(f-l==1&&S-_==1)return O.addIntersections(this.e,l,m.e,_),null;if(this.env1.init(H,X),this.env2.init(nt,rt),!this.env1.intersects(this.env2))return null;var lt=Math.trunc((l+f)/2),gt=Math.trunc((_+S)/2);l<lt&&(_<gt&&this.computeIntersectsForChain(l,lt,m,_,gt,O),gt<S&&this.computeIntersectsForChain(l,lt,m,gt,S,O)),lt<f&&(_<gt&&this.computeIntersectsForChain(lt,f,m,_,gt,O),gt<S&&this.computeIntersectsForChain(lt,f,m,gt,S,O))}},Ni.prototype.getStartIndexes=function(){return this.startIndex},Ni.prototype.computeIntersects=function(t,n){for(var i=0;i<this.startIndex.length-1;i++)for(var s=0;s<t.startIndex.length-1;s++)this.computeIntersectsForChain(i,t,s,n)},Ni.prototype.interfaces_=function(){return[]},Ni.prototype.getClass=function(){return Ni};var Mn=function t(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var n=0;n<2;n++)for(var i=0;i<3;i++)this._depth[n][i]=t.NULL_VALUE},Xh={NULL_VALUE:{configurable:!0}};Mn.prototype.getDepth=function(t,n){return this._depth[t][n]},Mn.prototype.setDepth=function(t,n,i){this._depth[t][n]=i},Mn.prototype.isNull=function(){if(arguments.length===0){for(var t=0;t<2;t++)for(var n=0;n<3;n++)if(this._depth[t][n]!==Mn.NULL_VALUE)return!1;return!0}if(arguments.length===1){var i=arguments[0];return this._depth[i][1]===Mn.NULL_VALUE}if(arguments.length===2){var s=arguments[0],l=arguments[1];return this._depth[s][l]===Mn.NULL_VALUE}},Mn.prototype.normalize=function(){for(var t=0;t<2;t++)if(!this.isNull(t)){var n=this._depth[t][1];this._depth[t][2]<n&&(n=this._depth[t][2]),n<0&&(n=0);for(var i=1;i<3;i++){var s=0;this._depth[t][i]>n&&(s=1),this._depth[t][i]=s}}},Mn.prototype.getDelta=function(t){return this._depth[t][j.RIGHT]-this._depth[t][j.LEFT]},Mn.prototype.getLocation=function(t,n){return this._depth[t][n]<=0?F.EXTERIOR:F.INTERIOR},Mn.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Mn.prototype.add=function(){if(arguments.length===1)for(var t=arguments[0],n=0;n<2;n++)for(var i=1;i<3;i++){var s=t.getLocation(n,i);s!==F.EXTERIOR&&s!==F.INTERIOR||(this.isNull(n,i)?this._depth[n][i]=Mn.depthAtLocation(s):this._depth[n][i]+=Mn.depthAtLocation(s))}else if(arguments.length===3){var l=arguments[0],f=arguments[1];arguments[2]===F.INTERIOR&&this._depth[l][f]++}},Mn.prototype.interfaces_=function(){return[]},Mn.prototype.getClass=function(){return Mn},Mn.depthAtLocation=function(t){return t===F.EXTERIOR?0:t===F.INTERIOR?1:Mn.NULL_VALUE},Xh.NULL_VALUE.get=function(){return-1},Object.defineProperties(Mn,Xh);var Da=function(t){function n(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new mi(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Mn,this._depthDelta=0,arguments.length===1){var i=arguments[0];n.call(this,i,null)}else if(arguments.length===2){var s=arguments[0],l=arguments[1];this.pts=s,this._label=l}}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.getDepth=function(){return this._depth},n.prototype.getCollapsedEdge=function(){var i=new Array(2).fill(null);return i[0]=this.pts[0],i[1]=this.pts[1],new n(i,Me.toLineLabel(this._label))},n.prototype.isIsolated=function(){return this._isIsolated},n.prototype.getCoordinates=function(){return this.pts},n.prototype.setIsolated=function(i){this._isIsolated=i},n.prototype.setName=function(i){this._name=i},n.prototype.equals=function(i){if(!(i instanceof n))return!1;var s=i;if(this.pts.length!==s.pts.length)return!1;for(var l=!0,f=!0,m=this.pts.length,_=0;_<this.pts.length;_++)if(this.pts[_].equals2D(s.pts[_])||(l=!1),this.pts[_].equals2D(s.pts[--m])||(f=!1),!l&&!f)return!1;return!0},n.prototype.getCoordinate=function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var i=arguments[0];return this.pts[i]}},n.prototype.print=function(i){i.print("edge "+this._name+": "),i.print("LINESTRING (");for(var s=0;s<this.pts.length;s++)s>0&&i.print(","),i.print(this.pts[s].x+" "+this.pts[s].y);i.print(") "+this._label+" "+this._depthDelta)},n.prototype.computeIM=function(i){n.updateIM(this._label,i)},n.prototype.isCollapsed=function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])},n.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},n.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},n.prototype.getDepthDelta=function(){return this._depthDelta},n.prototype.getNumPoints=function(){return this.pts.length},n.prototype.printReverse=function(i){i.print("edge "+this._name+": ");for(var s=this.pts.length-1;s>=0;s--)i.print(this.pts[s]+" ");i.println("")},n.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Ni(this)),this._mce},n.prototype.getEnvelope=function(){if(this._env===null){this._env=new at;for(var i=0;i<this.pts.length;i++)this._env.expandToInclude(this.pts[i])}return this._env},n.prototype.addIntersection=function(i,s,l,f){var m=new C(i.getIntersection(f)),_=s,S=i.getEdgeDistance(l,f),O=_+1;if(O<this.pts.length){var H=this.pts[O];m.equals2D(H)&&(_=O,S=0)}this.eiList.add(m,_,S)},n.prototype.toString=function(){var i=new Rt;i.append("edge "+this._name+": "),i.append("LINESTRING (");for(var s=0;s<this.pts.length;s++)s>0&&i.append(","),i.append(this.pts[s].x+" "+this.pts[s].y);return i.append(") "+this._label+" "+this._depthDelta),i.toString()},n.prototype.isPointwiseEqual=function(i){if(this.pts.length!==i.pts.length)return!1;for(var s=0;s<this.pts.length;s++)if(!this.pts[s].equals2D(i.pts[s]))return!1;return!0},n.prototype.setDepthDelta=function(i){this._depthDelta=i},n.prototype.getEdgeIntersectionList=function(){return this.eiList},n.prototype.addIntersections=function(i,s,l){for(var f=0;f<i.getIntersectionNum();f++)this.addIntersection(i,s,l,f)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n.updateIM=function(){if(arguments.length!==2)return t.prototype.updateIM.apply(this,arguments);var i=arguments[0],s=arguments[1];s.setAtLeastIfValid(i.getLocation(0,j.ON),i.getLocation(1,j.ON),1),i.isArea()&&(s.setAtLeastIfValid(i.getLocation(0,j.LEFT),i.getLocation(1,j.LEFT),2),s.setAtLeastIfValid(i.getLocation(0,j.RIGHT),i.getLocation(1,j.RIGHT),2))},n}(_r),kn=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Vr,this._bufParams=t||null};kn.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},kn.prototype.insertUniqueEdge=function(t){var n=this._edgeList.findEqualEdge(t);if(n!==null){var i=n.getLabel(),s=t.getLabel();n.isPointwiseEqual(t)||(s=new Me(t.getLabel())).flip(),i.merge(s);var l=kn.depthDelta(s),f=n.getDepthDelta()+l;n.setDepthDelta(f)}else this._edgeList.add(t),t.setDepthDelta(kn.depthDelta(t.getLabel()))},kn.prototype.buildSubgraphs=function(t,n){for(var i=new V,s=t.iterator();s.hasNext();){var l=s.next(),f=l.getRightmostCoordinate(),m=new Co(i).getDepth(f);l.computeDepth(m),l.findResultEdges(),i.add(l),n.add(l.getDirectedEdges(),l.getNodes())}},kn.prototype.createSubgraphs=function(t){for(var n=new V,i=t.getNodes().iterator();i.hasNext();){var s=i.next();if(!s.isVisited()){var l=new Bn;l.create(s),n.add(l)}}return Gr.sort(n,Gr.reverseOrder()),n},kn.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},kn.prototype.getNoder=function(t){if(this._workingNoder!==null)return this._workingNoder;var n=new rl,i=new Pr;return i.setPrecisionModel(t),n.setSegmentIntersector(new Mr(i)),n},kn.prototype.buffer=function(t,n){var i=this._workingPrecisionModel;i===null&&(i=t.getPrecisionModel()),this._geomFact=t.getFactory();var s=new tr(i,this._bufParams),l=new Lr(t,n,s).getCurves();if(l.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(l,i),this._graph=new ze(new Wh),this._graph.addEdges(this._edgeList.getEdges());var f=this.createSubgraphs(this._graph),m=new hr(this._geomFact);this.buildSubgraphs(f,m);var _=m.getPolygons();return _.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(_)},kn.prototype.computeNodedEdges=function(t,n){var i=this.getNoder(n);i.computeNodes(t);for(var s=i.getNodedSubstrings().iterator();s.hasNext();){var l=s.next(),f=l.getCoordinates();if(f.length!==2||!f[0].equals2D(f[1])){var m=l.getData(),_=new Da(l.getCoordinates(),new Me(m));this.insertUniqueEdge(_)}}},kn.prototype.setNoder=function(t){this._workingNoder=t},kn.prototype.interfaces_=function(){return[]},kn.prototype.getClass=function(){return kn},kn.depthDelta=function(t){var n=t.getLocation(0,j.LEFT),i=t.getLocation(0,j.RIGHT);return n===F.INTERIOR&&i===F.EXTERIOR?1:n===F.EXTERIOR&&i===F.INTERIOR?-1:0},kn.convertSegStrings=function(t){for(var n=new Tt,i=new V;t.hasNext();){var s=t.next(),l=n.createLineString(s.getCoordinates());i.add(l)}return n.buildGeometry(i)};var Wi=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var t=arguments[0],n=arguments[1];this._noder=t,this._scaleFactor=n,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var i=arguments[0],s=arguments[1],l=arguments[2],f=arguments[3];this._noder=i,this._scaleFactor=s,this._offsetX=l,this._offsetY=f,this._isScaled=!this.isIntegerPrecision()}};Wi.prototype.rescale=function(){if(et(arguments[0],G))for(var t=arguments[0].iterator();t.hasNext();){var n=t.next();this.rescale(n.getCoordinates())}else if(arguments[0]instanceof Array){for(var i=arguments[0],s=0;s<i.length;s++)i[s].x=i[s].x/this._scaleFactor+this._offsetX,i[s].y=i[s].y/this._scaleFactor+this._offsetY;i.length===2&&i[0].equals2D(i[1])&&Ee.out.println(i)}},Wi.prototype.scale=function(){if(et(arguments[0],G)){for(var t=arguments[0],n=new V,i=t.iterator();i.hasNext();){var s=i.next();n.add(new Je(this.scale(s.getCoordinates()),s.getData()))}return n}if(arguments[0]instanceof Array){for(var l=arguments[0],f=new Array(l.length).fill(null),m=0;m<l.length;m++)f[m]=new C(Math.round((l[m].x-this._offsetX)*this._scaleFactor),Math.round((l[m].y-this._offsetY)*this._scaleFactor),l[m].z);return J.removeRepeatedPoints(f)}},Wi.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},Wi.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},Wi.prototype.computeNodes=function(t){var n=t;this._isScaled&&(n=this.scale(t)),this._noder.computeNodes(n)},Wi.prototype.interfaces_=function(){return[no]},Wi.prototype.getClass=function(){return Wi};var ni=function(){this._li=new Pr,this._segStrings=null;var t=arguments[0];this._segStrings=t},Yh={fact:{configurable:!0}};ni.prototype.checkEndPtVertexIntersections=function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();){var n=t.next().getCoordinates();this.checkEndPtVertexIntersections(n[0],this._segStrings),this.checkEndPtVertexIntersections(n[n.length-1],this._segStrings)}else if(arguments.length===2){for(var i=arguments[0],s=arguments[1].iterator();s.hasNext();)for(var l=s.next().getCoordinates(),f=1;f<l.length-1;f++)if(l[f].equals(i))throw new Cn("found endpt/interior pt intersection at index "+f+" :pt "+i)}},ni.prototype.checkInteriorIntersections=function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();)for(var n=t.next(),i=this._segStrings.iterator();i.hasNext();){var s=i.next();this.checkInteriorIntersections(n,s)}else if(arguments.length===2)for(var l=arguments[0],f=arguments[1],m=l.getCoordinates(),_=f.getCoordinates(),S=0;S<m.length-1;S++)for(var O=0;O<_.length-1;O++)this.checkInteriorIntersections(l,S,f,O);else if(arguments.length===4){var H=arguments[0],X=arguments[1],nt=arguments[2],rt=arguments[3];if(H===nt&&X===rt)return null;var lt=H.getCoordinates()[X],gt=H.getCoordinates()[X+1],we=nt.getCoordinates()[rt],rn=nt.getCoordinates()[rt+1];if(this._li.computeIntersection(lt,gt,we,rn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,lt,gt)||this.hasInteriorIntersection(this._li,we,rn)))throw new Cn("found non-noded intersection at "+lt+"-"+gt+" and "+we+"-"+rn)}},ni.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},ni.prototype.checkCollapses=function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();){var n=t.next();this.checkCollapses(n)}else if(arguments.length===1)for(var i=arguments[0].getCoordinates(),s=0;s<i.length-2;s++)this.checkCollapse(i[s],i[s+1],i[s+2])},ni.prototype.hasInteriorIntersection=function(t,n,i){for(var s=0;s<t.getIntersectionNum();s++){var l=t.getIntersection(s);if(!l.equals(n)&&!l.equals(i))return!0}return!1},ni.prototype.checkCollapse=function(t,n,i){if(t.equals(i))throw new Cn("found non-noded collapse at "+ni.fact.createLineString([t,n,i]))},ni.prototype.interfaces_=function(){return[]},ni.prototype.getClass=function(){return ni},Yh.fact.get=function(){return new Tt},Object.defineProperties(ni,Yh);var er=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 t=arguments[0],n=arguments[1],i=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=n,this._li=i,n<=0)throw new L("Scale factor must be non-zero");n!==1&&(this._pt=new C(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new C,this._p1Scaled=new C),this.initCorners(this._pt)},$h={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};er.prototype.intersectsScaled=function(t,n){var i=Math.min(t.x,n.x),s=Math.max(t.x,n.x),l=Math.min(t.y,n.y),f=Math.max(t.y,n.y),m=this._maxx<i||this._minx>s||this._maxy<l||this._miny>f;if(m)return!1;var _=this.intersectsToleranceSquare(t,n);return _t.isTrue(!(m&&_),"Found bad envelope test"),_},er.prototype.initCorners=function(t){this._minx=t.x-.5,this._maxx=t.x+.5,this._miny=t.y-.5,this._maxy=t.y+.5,this._corner[0]=new C(this._maxx,this._maxy),this._corner[1]=new C(this._minx,this._maxy),this._corner[2]=new C(this._minx,this._miny),this._corner[3]=new C(this._maxx,this._miny)},er.prototype.intersects=function(t,n){return this._scaleFactor===1?this.intersectsScaled(t,n):(this.copyScaled(t,this._p0Scaled),this.copyScaled(n,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},er.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},er.prototype.getCoordinate=function(){return this._originalPt},er.prototype.copyScaled=function(t,n){n.x=this.scale(t.x),n.y=this.scale(t.y)},er.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=er.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new at(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},er.prototype.intersectsPixelClosure=function(t,n){return this._li.computeIntersection(t,n,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,n,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,n,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,n,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},er.prototype.intersectsToleranceSquare=function(t,n){var i=!1,s=!1;return this._li.computeIntersection(t,n,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(t,n,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(t,n,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(s=!0),this._li.computeIntersection(t,n,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!i||!s)||!!t.equals(this._pt)||!!n.equals(this._pt))))},er.prototype.addSnappedNode=function(t,n){var i=t.getCoordinate(n),s=t.getCoordinate(n+1);return!!this.intersects(i,s)&&(t.addIntersection(this.getCoordinate(),n),!0)},er.prototype.interfaces_=function(){return[]},er.prototype.getClass=function(){return er},$h.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(er,$h);var $s=function(){this.tempEnv1=new at,this.selectedSegment=new ft};$s.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var t=arguments[0],n=arguments[1];t.getLineSegment(n,this.selectedSegment),this.select(this.selectedSegment)}}},$s.prototype.interfaces_=function(){return[]},$s.prototype.getClass=function(){return $s};var ts=function(){this._index=null;var t=arguments[0];this._index=t},Zh={HotPixelSnapAction:{configurable:!0}};ts.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2],l=n.getSafeEnvelope(),f=new Jh(n,i,s);return this._index.query(l,{interfaces_:function(){return[Vi]},visitItem:function(m){m.select(l,f)}}),f.isNodeAdded()}},ts.prototype.interfaces_=function(){return[]},ts.prototype.getClass=function(){return ts},Zh.HotPixelSnapAction.get=function(){return Jh},Object.defineProperties(ts,Zh);var Jh=function(t){function n(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var i=arguments[0],s=arguments[1],l=arguments[2];this._hotPixel=i,this._parentEdge=s,this._hotPixelVertexIndex=l}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.isNodeAdded=function(){return this._isNodeAdded},n.prototype.select=function(){if(arguments.length!==2)return t.prototype.select.apply(this,arguments);var i=arguments[0],s=arguments[1],l=i.getContext();if(this._parentEdge!==null&&l===this._parentEdge&&s===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(l,s)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}($s),Io=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new V};Io.prototype.processIntersections=function(t,n,i,s){if(t===i&&n===s)return null;var l=t.getCoordinates()[n],f=t.getCoordinates()[n+1],m=i.getCoordinates()[s],_=i.getCoordinates()[s+1];if(this._li.computeIntersection(l,f,m,_),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var S=0;S<this._li.getIntersectionNum();S++)this._interiorIntersections.add(this._li.getIntersection(S));t.addIntersections(this._li,n,0),i.addIntersections(this._li,s,1)}},Io.prototype.isDone=function(){return!1},Io.prototype.getInteriorIntersections=function(){return this._interiorIntersections},Io.prototype.interfaces_=function(){return[io]},Io.prototype.getClass=function(){return Io};var gi=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new Pr,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};gi.prototype.checkCorrectness=function(t){var n=Je.getNodedSubstrings(t),i=new ni(n);try{i.checkValid()}catch(s){if(!(s instanceof xn))throw s;s.printStackTrace()}},gi.prototype.getNodedSubstrings=function(){return Je.getNodedSubstrings(this._nodedSegStrings)},gi.prototype.snapRound=function(t,n){var i=this.findInteriorIntersections(t,n);this.computeIntersectionSnaps(i),this.computeVertexSnaps(t)},gi.prototype.findInteriorIntersections=function(t,n){var i=new Io(n);return this._noder.setSegmentIntersector(i),this._noder.computeNodes(t),i.getInteriorIntersections()},gi.prototype.computeVertexSnaps=function(){if(et(arguments[0],G))for(var t=arguments[0].iterator();t.hasNext();){var n=t.next();this.computeVertexSnaps(n)}else if(arguments[0]instanceof Je)for(var i=arguments[0],s=i.getCoordinates(),l=0;l<s.length;l++){var f=new er(s[l],this._scaleFactor,this._li);this._pointSnapper.snap(f,i,l)&&i.addIntersection(s[l],l)}},gi.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new rl,this._pointSnapper=new ts(this._noder.getIndex()),this.snapRound(t,this._li)},gi.prototype.computeIntersectionSnaps=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next(),s=new er(i,this._scaleFactor,this._li);this._pointSnapper.snap(s)}},gi.prototype.interfaces_=function(){return[no]},gi.prototype.getClass=function(){return gi};var wn=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new ae,this._resultGeometry=null,this._saveException=null,arguments.length===1){var t=arguments[0];this._argGeom=t}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._argGeom=n,this._bufParams=i}},es={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};wn.prototype.bufferFixedPrecision=function(t){var n=new Wi(new gi(new se(1)),t.getScale()),i=new kn(this._bufParams);i.setWorkingPrecisionModel(t),i.setNoder(n),this._resultGeometry=i.buffer(this._argGeom,this._distance)},wn.prototype.bufferReducedPrecision=function(){var t=this;if(arguments.length===0){for(var n=wn.MAX_PRECISION_DIGITS;n>=0;n--){try{t.bufferReducedPrecision(n)}catch(f){if(!(f instanceof Ii))throw f;t._saveException=f}if(t._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var i=arguments[0],s=wn.precisionScaleFactor(this._argGeom,this._distance,i),l=new se(s);this.bufferFixedPrecision(l)}},wn.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===se.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},wn.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},wn.prototype.bufferOriginalPrecision=function(){try{var t=new kn(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(n){if(!(n instanceof Cn))throw n;this._saveException=n}},wn.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},wn.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},wn.prototype.interfaces_=function(){return[]},wn.prototype.getClass=function(){return wn},wn.bufferOp=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];return new wn(t).getResultGeometry(n)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof yt&&typeof arguments[1]=="number"){var i=arguments[0],s=arguments[1],l=arguments[2],f=new wn(i);return f.setQuadrantSegments(l),f.getResultGeometry(s)}if(arguments[2]instanceof ae&&arguments[0]instanceof yt&&typeof arguments[1]=="number"){var m=arguments[0],_=arguments[1],S=arguments[2];return new wn(m,S).getResultGeometry(_)}}else if(arguments.length===4){var O=arguments[0],H=arguments[1],X=arguments[2],nt=arguments[3],rt=new wn(O);return rt.setQuadrantSegments(X),rt.setEndCapStyle(nt),rt.getResultGeometry(H)}},wn.precisionScaleFactor=function(t,n,i){var s=t.getEnvelopeInternal(),l=St.max(Math.abs(s.getMaxX()),Math.abs(s.getMaxY()),Math.abs(s.getMinX()),Math.abs(s.getMinY()))+2*(n>0?n:0),f=i-Math.trunc(Math.log(l)/Math.log(10)+1);return Math.pow(10,f)},es.CAP_ROUND.get=function(){return ae.CAP_ROUND},es.CAP_BUTT.get=function(){return ae.CAP_FLAT},es.CAP_FLAT.get=function(){return ae.CAP_FLAT},es.CAP_SQUARE.get=function(){return ae.CAP_SQUARE},es.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(wn,es);var Gn=function(){this._pt=[new C,new C],this._distance=P.NaN,this._isNull=!0};Gn.prototype.getCoordinates=function(){return this._pt},Gn.prototype.getCoordinate=function(t){return this._pt[t]},Gn.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var n=arguments[0],i=arguments[1];if(this._isNull)return this.initialize(n,i),null;var s=n.distance(i);s<this._distance&&this.initialize(n,i,s)}},Gn.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var t=arguments[0],n=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(n),this._distance=t.distance(n),this._isNull=!1}else if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];this._pt[0].setCoordinate(i),this._pt[1].setCoordinate(s),this._distance=l,this._isNull=!1}},Gn.prototype.getDistance=function(){return this._distance},Gn.prototype.setMaximum=function(){if(arguments.length===1){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(arguments.length===2){var n=arguments[0],i=arguments[1];if(this._isNull)return this.initialize(n,i),null;var s=n.distance(i);s>this._distance&&this.initialize(n,i,s)}},Gn.prototype.interfaces_=function(){return[]},Gn.prototype.getClass=function(){return Gn};var yi=function(){};yi.prototype.interfaces_=function(){return[]},yi.prototype.getClass=function(){return yi},yi.computeDistance=function(){if(arguments[2]instanceof Gn&&arguments[0]instanceof Ge&&arguments[1]instanceof C)for(var t=arguments[0],n=arguments[1],i=arguments[2],s=t.getCoordinates(),l=new ft,f=0;f<s.length-1;f++){l.setCoordinates(s[f],s[f+1]);var m=l.closestPoint(n);i.setMinimum(m,n)}else if(arguments[2]instanceof Gn&&arguments[0]instanceof an&&arguments[1]instanceof C){var _=arguments[0],S=arguments[1],O=arguments[2];yi.computeDistance(_.getExteriorRing(),S,O);for(var H=0;H<_.getNumInteriorRing();H++)yi.computeDistance(_.getInteriorRingN(H),S,O)}else if(arguments[2]instanceof Gn&&arguments[0]instanceof yt&&arguments[1]instanceof C){var X=arguments[0],nt=arguments[1],rt=arguments[2];if(X instanceof Ge)yi.computeDistance(X,nt,rt);else if(X instanceof an)yi.computeDistance(X,nt,rt);else if(X instanceof Fe)for(var lt=X,gt=0;gt<lt.getNumGeometries();gt++){var we=lt.getGeometryN(gt);yi.computeDistance(we,nt,rt)}else rt.setMinimum(X.getCoordinate(),nt)}else if(arguments[2]instanceof Gn&&arguments[0]instanceof ft&&arguments[1]instanceof C){var rn=arguments[0],Wn=arguments[1],Ei=arguments[2],Qi=rn.closestPoint(Wn);Ei.setMinimum(Qi,Wn)}};var so=function(t){this._maxPtDist=new Gn,this._inputGeom=t||null},il={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};so.prototype.computeMaxMidpointDistance=function(t){var n=new Xi(this._inputGeom);t.apply(n),this._maxPtDist.setMaximum(n.getMaxPointDistance())},so.prototype.computeMaxVertexDistance=function(t){var n=new Po(this._inputGeom);t.apply(n),this._maxPtDist.setMaximum(n.getMaxPointDistance())},so.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},so.prototype.getDistancePoints=function(){return this._maxPtDist},so.prototype.interfaces_=function(){return[]},so.prototype.getClass=function(){return so},il.MaxPointDistanceFilter.get=function(){return Po},il.MaxMidpointDistanceFilter.get=function(){return Xi},Object.defineProperties(so,il);var Po=function(t){this._maxPtDist=new Gn,this._minPtDist=new Gn,this._geom=t||null};Po.prototype.filter=function(t){this._minPtDist.initialize(),yi.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Po.prototype.getMaxPointDistance=function(){return this._maxPtDist},Po.prototype.interfaces_=function(){return[B]},Po.prototype.getClass=function(){return Po};var Xi=function(t){this._maxPtDist=new Gn,this._minPtDist=new Gn,this._geom=t||null};Xi.prototype.filter=function(t,n){if(n===0)return null;var i=t.getCoordinate(n-1),s=t.getCoordinate(n),l=new C((i.x+s.x)/2,(i.y+s.y)/2);this._minPtDist.initialize(),yi.computeDistance(this._geom,l,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Xi.prototype.isDone=function(){return!1},Xi.prototype.isGeometryChanged=function(){return!1},Xi.prototype.getMaxPointDistance=function(){return this._maxPtDist},Xi.prototype.interfaces_=function(){return[Ye]},Xi.prototype.getClass=function(){return Xi};var Li=function(t){this._comps=t||null};Li.prototype.filter=function(t){t instanceof an&&this._comps.add(t)},Li.prototype.interfaces_=function(){return[je]},Li.prototype.getClass=function(){return Li},Li.getPolygons=function(){if(arguments.length===1){var t=arguments[0];return Li.getPolygons(t,new V)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return n instanceof an?i.add(n):n instanceof Fe&&n.apply(new Li(i)),i}};var Sn=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var t=arguments[0];this._lines=t}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._lines=n,this._isForcedToLineString=i}};Sn.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof ci){var n=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(n),null}t instanceof Ge&&this._lines.add(t)},Sn.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},Sn.prototype.interfaces_=function(){return[li]},Sn.prototype.getClass=function(){return Sn},Sn.getGeometry=function(){if(arguments.length===1){var t=arguments[0];return t.getFactory().buildGeometry(Sn.getLines(t))}if(arguments.length===2){var n=arguments[0],i=arguments[1];return n.getFactory().buildGeometry(Sn.getLines(n,i))}},Sn.getLines=function(){if(arguments.length===1){var t=arguments[0];return Sn.getLines(t,!1)}if(arguments.length===2){if(et(arguments[0],G)&&et(arguments[1],G)){for(var n=arguments[0],i=arguments[1],s=n.iterator();s.hasNext();){var l=s.next();Sn.getLines(l,i)}return i}if(arguments[0]instanceof yt&&typeof arguments[1]=="boolean"){var f=arguments[0],m=arguments[1],_=new V;return f.apply(new Sn(_,m)),_}if(arguments[0]instanceof yt&&et(arguments[1],G)){var S=arguments[0],O=arguments[1];return S instanceof Ge?O.add(S):S.apply(new Sn(O)),O}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&et(arguments[0],G)&&et(arguments[1],G)){for(var H=arguments[0],X=arguments[1],nt=arguments[2],rt=H.iterator();rt.hasNext();){var lt=rt.next();Sn.getLines(lt,X,nt)}return X}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof yt&&et(arguments[1],G)){var gt=arguments[0],we=arguments[1],rn=arguments[2];return gt.apply(new Sn(we,rn)),we}}};var Hr=function(){if(this._boundaryRule=y.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];if(t===null)throw new L("Rule must be non-null");this._boundaryRule=t}}};Hr.prototype.locateInternal=function(){if(arguments[0]instanceof C&&arguments[1]instanceof an){var t=arguments[0],n=arguments[1];if(n.isEmpty())return F.EXTERIOR;var i=n.getExteriorRing(),s=this.locateInPolygonRing(t,i);if(s===F.EXTERIOR)return F.EXTERIOR;if(s===F.BOUNDARY)return F.BOUNDARY;for(var l=0;l<n.getNumInteriorRing();l++){var f=n.getInteriorRingN(l),m=this.locateInPolygonRing(t,f);if(m===F.INTERIOR)return F.EXTERIOR;if(m===F.BOUNDARY)return F.BOUNDARY}return F.INTERIOR}if(arguments[0]instanceof C&&arguments[1]instanceof Ge){var _=arguments[0],S=arguments[1];if(!S.getEnvelopeInternal().intersects(_))return F.EXTERIOR;var O=S.getCoordinates();return S.isClosed()||!_.equals(O[0])&&!_.equals(O[O.length-1])?tt.isOnLine(_,O)?F.INTERIOR:F.EXTERIOR:F.BOUNDARY}if(arguments[0]instanceof C&&arguments[1]instanceof cr){var H=arguments[0];return arguments[1].getCoordinate().equals2D(H)?F.INTERIOR:F.EXTERIOR}},Hr.prototype.locateInPolygonRing=function(t,n){return n.getEnvelopeInternal().intersects(t)?tt.locatePointInRing(t,n.getCoordinates()):F.EXTERIOR},Hr.prototype.intersects=function(t,n){return this.locate(t,n)!==F.EXTERIOR},Hr.prototype.updateLocationInfo=function(t){t===F.INTERIOR&&(this._isIn=!0),t===F.BOUNDARY&&this._numBoundaries++},Hr.prototype.computeLocation=function(t,n){if(n instanceof cr&&this.updateLocationInfo(this.locateInternal(t,n)),n instanceof Ge)this.updateLocationInfo(this.locateInternal(t,n));else if(n instanceof an)this.updateLocationInfo(this.locateInternal(t,n));else if(n instanceof Rr)for(var i=n,s=0;s<i.getNumGeometries();s++){var l=i.getGeometryN(s);this.updateLocationInfo(this.locateInternal(t,l))}else if(n instanceof hi)for(var f=n,m=0;m<f.getNumGeometries();m++){var _=f.getGeometryN(m);this.updateLocationInfo(this.locateInternal(t,_))}else if(n instanceof Fe)for(var S=new di(n);S.hasNext();){var O=S.next();O!==n&&this.computeLocation(t,O)}},Hr.prototype.locate=function(t,n){return n.isEmpty()?F.EXTERIOR:n instanceof Ge?this.locateInternal(t,n):n instanceof an?this.locateInternal(t,n):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,n),this._boundaryRule.isInBoundary(this._numBoundaries)?F.BOUNDARY:this._numBoundaries>0||this._isIn?F.INTERIOR:F.EXTERIOR)},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr};var Vn=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var n=arguments[0],i=arguments[1];t.call(this,n,t.INSIDE_AREA,i)}else if(arguments.length===3){var s=arguments[0],l=arguments[1],f=arguments[2];this._component=s,this._segIndex=l,this._pt=f}},Kh={INSIDE_AREA:{configurable:!0}};Vn.prototype.isInsideArea=function(){return this._segIndex===Vn.INSIDE_AREA},Vn.prototype.getCoordinate=function(){return this._pt},Vn.prototype.getGeometryComponent=function(){return this._component},Vn.prototype.getSegmentIndex=function(){return this._segIndex},Vn.prototype.interfaces_=function(){return[]},Vn.prototype.getClass=function(){return Vn},Kh.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Vn,Kh);var Yi=function(t){this._pts=t||null};Yi.prototype.filter=function(t){t instanceof cr&&this._pts.add(t)},Yi.prototype.interfaces_=function(){return[je]},Yi.prototype.getClass=function(){return Yi},Yi.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof cr?Gr.singletonList(t):Yi.getPoints(t,new V)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return n instanceof cr?i.add(n):n instanceof Fe&&n.apply(new Yi(i)),i}};var Ro=function(){this._locations=null;var t=arguments[0];this._locations=t};Ro.prototype.filter=function(t){(t instanceof cr||t instanceof Ge||t instanceof an)&&this._locations.add(new Vn(t,0,t.getCoordinate()))},Ro.prototype.interfaces_=function(){return[je]},Ro.prototype.getClass=function(){return Ro},Ro.getLocations=function(t){var n=new V;return t.apply(new Ro(n)),n};var bn=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Hr,this._minDistanceLocation=null,this._minDistance=P.MAX_VALUE,arguments.length===2){var t=arguments[0],n=arguments[1];this._geom=[t,n],this._terminateDistance=0}else if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=i,this._geom[1]=s,this._terminateDistance=l}};bn.prototype.computeContainmentDistance=function(){if(arguments.length===0){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=1-n,l=Li.getPolygons(this._geom[n]);if(l.size()>0){var f=Ro.getLocations(this._geom[s]);if(this.computeContainmentDistance(f,l,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[s]=i[0],this._minDistanceLocation[n]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&et(arguments[0],Z)&&et(arguments[1],Z)){for(var m=arguments[0],_=arguments[1],S=arguments[2],O=0;O<m.size();O++)for(var H=m.get(O),X=0;X<_.size();X++)if(this.computeContainmentDistance(H,_.get(X),S),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Vn&&arguments[1]instanceof an){var nt=arguments[0],rt=arguments[1],lt=arguments[2],gt=nt.getCoordinate();if(F.EXTERIOR!==this._ptLocator.locate(gt,rt))return this._minDistance=0,lt[0]=nt,lt[1]=new Vn(rt,gt),null}}},bn.prototype.computeMinDistanceLinesPoints=function(t,n,i){for(var s=0;s<t.size();s++)for(var l=t.get(s),f=0;f<n.size();f++){var m=n.get(f);if(this.computeMinDistance(l,m,i),this._minDistance<=this._terminateDistance)return null}},bn.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),n=Sn.getLines(this._geom[0]),i=Sn.getLines(this._geom[1]),s=Yi.getPoints(this._geom[0]),l=Yi.getPoints(this._geom[1]);return this.computeMinDistanceLines(n,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(n,l,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(i,s,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(s,l,t),void this.updateMinDistance(t,!1))))},bn.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},bn.prototype.updateMinDistance=function(t,n){if(t[0]===null)return null;n?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},bn.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},bn.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 Ge&&arguments[1]instanceof cr){var t=arguments[0],n=arguments[1],i=arguments[2];if(t.getEnvelopeInternal().distance(n.getEnvelopeInternal())>this._minDistance)return null;for(var s=t.getCoordinates(),l=n.getCoordinate(),f=0;f<s.length-1;f++){var m=tt.distancePointLine(l,s[f],s[f+1]);if(m<this._minDistance){this._minDistance=m;var _=new ft(s[f],s[f+1]).closestPoint(l);i[0]=new Vn(t,f,_),i[1]=new Vn(n,0,l)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof Ge&&arguments[1]instanceof Ge){var S=arguments[0],O=arguments[1],H=arguments[2];if(S.getEnvelopeInternal().distance(O.getEnvelopeInternal())>this._minDistance)return null;for(var X=S.getCoordinates(),nt=O.getCoordinates(),rt=0;rt<X.length-1;rt++)for(var lt=0;lt<nt.length-1;lt++){var gt=tt.distanceLineLine(X[rt],X[rt+1],nt[lt],nt[lt+1]);if(gt<this._minDistance){this._minDistance=gt;var we=new ft(X[rt],X[rt+1]),rn=new ft(nt[lt],nt[lt+1]),Wn=we.closestPoints(rn);H[0]=new Vn(S,rt,Wn[0]),H[1]=new Vn(O,lt,Wn[1])}if(this._minDistance<=this._terminateDistance)return null}}}},bn.prototype.computeMinDistancePoints=function(t,n,i){for(var s=0;s<t.size();s++)for(var l=t.get(s),f=0;f<n.size();f++){var m=n.get(f),_=l.getCoordinate().distance(m.getCoordinate());if(_<this._minDistance&&(this._minDistance=_,i[0]=new Vn(l,0,l.getCoordinate()),i[1]=new Vn(m,0,m.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},bn.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new L("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},bn.prototype.computeMinDistanceLines=function(t,n,i){for(var s=0;s<t.size();s++)for(var l=t.get(s),f=0;f<n.size();f++){var m=n.get(f);if(this.computeMinDistance(l,m,i),this._minDistance<=this._terminateDistance)return null}},bn.prototype.interfaces_=function(){return[]},bn.prototype.getClass=function(){return bn},bn.distance=function(t,n){return new bn(t,n).distance()},bn.isWithinDistance=function(t,n,i){return new bn(t,n,i).distance()<=i},bn.nearestPoints=function(t,n){return new bn(t,n).nearestPoints()};var Rn=function(){this._pt=[new C,new C],this._distance=P.NaN,this._isNull=!0};Rn.prototype.getCoordinates=function(){return this._pt},Rn.prototype.getCoordinate=function(t){return this._pt[t]},Rn.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var n=arguments[0],i=arguments[1];if(this._isNull)return this.initialize(n,i),null;var s=n.distance(i);s<this._distance&&this.initialize(n,i,s)}},Rn.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var t=arguments[0],n=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(n),this._distance=t.distance(n),this._isNull=!1}else if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2];this._pt[0].setCoordinate(i),this._pt[1].setCoordinate(s),this._distance=l,this._isNull=!1}},Rn.prototype.toString=function(){return Qe.toLineString(this._pt[0],this._pt[1])},Rn.prototype.getDistance=function(){return this._distance},Rn.prototype.setMaximum=function(){if(arguments.length===1){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(arguments.length===2){var n=arguments[0],i=arguments[1];if(this._isNull)return this.initialize(n,i),null;var s=n.distance(i);s>this._distance&&this.initialize(n,i,s)}},Rn.prototype.interfaces_=function(){return[]},Rn.prototype.getClass=function(){return Rn};var ri=function(){};ri.prototype.interfaces_=function(){return[]},ri.prototype.getClass=function(){return ri},ri.computeDistance=function(){if(arguments[2]instanceof Rn&&arguments[0]instanceof Ge&&arguments[1]instanceof C)for(var t=arguments[0],n=arguments[1],i=arguments[2],s=new ft,l=t.getCoordinates(),f=0;f<l.length-1;f++){s.setCoordinates(l[f],l[f+1]);var m=s.closestPoint(n);i.setMinimum(m,n)}else if(arguments[2]instanceof Rn&&arguments[0]instanceof an&&arguments[1]instanceof C){var _=arguments[0],S=arguments[1],O=arguments[2];ri.computeDistance(_.getExteriorRing(),S,O);for(var H=0;H<_.getNumInteriorRing();H++)ri.computeDistance(_.getInteriorRingN(H),S,O)}else if(arguments[2]instanceof Rn&&arguments[0]instanceof yt&&arguments[1]instanceof C){var X=arguments[0],nt=arguments[1],rt=arguments[2];if(X instanceof Ge)ri.computeDistance(X,nt,rt);else if(X instanceof an)ri.computeDistance(X,nt,rt);else if(X instanceof Fe)for(var lt=X,gt=0;gt<lt.getNumGeometries();gt++){var we=lt.getGeometryN(gt);ri.computeDistance(we,nt,rt)}else rt.setMinimum(X.getCoordinate(),nt)}else if(arguments[2]instanceof Rn&&arguments[0]instanceof ft&&arguments[1]instanceof C){var rn=arguments[0],Wn=arguments[1],Ei=arguments[2],Qi=rn.closestPoint(Wn);Ei.setMinimum(Qi,Wn)}};var Dr=function(){this._g0=null,this._g1=null,this._ptDist=new Rn,this._densifyFrac=0;var t=arguments[0],n=arguments[1];this._g0=t,this._g1=n},ol={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Dr.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Dr.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new L("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},Dr.prototype.compute=function(t,n){this.computeOrientedDistance(t,n,this._ptDist),this.computeOrientedDistance(n,t,this._ptDist)},Dr.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Dr.prototype.computeOrientedDistance=function(t,n,i){var s=new No(n);if(t.apply(s),i.setMaximum(s.getMaxPointDistance()),this._densifyFrac>0){var l=new $i(n,this._densifyFrac);t.apply(l),i.setMaximum(l.getMaxPointDistance())}},Dr.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Dr.prototype.interfaces_=function(){return[]},Dr.prototype.getClass=function(){return Dr},Dr.distance=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];return new Dr(t,n).distance()}if(arguments.length===3){var i=arguments[0],s=arguments[1],l=arguments[2],f=new Dr(i,s);return f.setDensifyFraction(l),f.distance()}},ol.MaxPointDistanceFilter.get=function(){return No},ol.MaxDensifiedByFractionDistanceFilter.get=function(){return $i},Object.defineProperties(Dr,ol);var No=function(){this._maxPtDist=new Rn,this._minPtDist=new Rn,this._euclideanDist=new ri,this._geom=null;var t=arguments[0];this._geom=t};No.prototype.filter=function(t){this._minPtDist.initialize(),ri.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},No.prototype.getMaxPointDistance=function(){return this._maxPtDist},No.prototype.interfaces_=function(){return[B]},No.prototype.getClass=function(){return No};var $i=function(){this._maxPtDist=new Rn,this._minPtDist=new Rn,this._geom=null,this._numSubSegs=0;var t=arguments[0],n=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/n))};$i.prototype.filter=function(t,n){if(n===0)return null;for(var i=t.getCoordinate(n-1),s=t.getCoordinate(n),l=(s.x-i.x)/this._numSubSegs,f=(s.y-i.y)/this._numSubSegs,m=0;m<this._numSubSegs;m++){var _=i.x+m*l,S=i.y+m*f,O=new C(_,S);this._minPtDist.initialize(),ri.computeDistance(this._geom,O,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},$i.prototype.isDone=function(){return!1},$i.prototype.isGeometryChanged=function(){return!1},$i.prototype.getMaxPointDistance=function(){return this._maxPtDist},$i.prototype.interfaces_=function(){return[Ye]},$i.prototype.getClass=function(){return $i};var pr=function(t,n,i){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=t||null,this._bufDistance=n||null,this._result=i||null},sl={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};pr.prototype.checkMaximumDistance=function(t,n,i){var s=new Dr(n,t);if(s.setDensifyFraction(.25),this._maxDistanceFound=s.orientedDistance(),this._maxDistanceFound>i){this._isValid=!1;var l=s.getCoordinates();this._errorLocation=l[1],this._errorIndicator=t.getFactory().createLineString(l),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Qe.toLineString(l[0],l[1])+")"}},pr.prototype.isValid=function(){var t=Math.abs(this._bufDistance),n=pr.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-n,this._maxValidDistance=t+n,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),pr.VERBOSE&&Ee.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},pr.prototype.checkNegativeValid=function(){if(!(this._input instanceof an||this._input instanceof hi||this._input instanceof Fe))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},pr.prototype.getErrorIndicator=function(){return this._errorIndicator},pr.prototype.checkMinimumDistance=function(t,n,i){var s=new bn(t,n,i);if(this._minDistanceFound=s.distance(),this._minDistanceFound<i){this._isValid=!1;var l=s.nearestPoints();this._errorLocation=s.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(l),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+Qe.toLineString(l[0],l[1])+" )"}},pr.prototype.checkPositiveValid=function(){var t=this._result.getBoundary();if(this.checkMinimumDistance(this._input,t,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,t,this._maxValidDistance)},pr.prototype.getErrorLocation=function(){return this._errorLocation},pr.prototype.getPolygonLines=function(t){for(var n=new V,i=new Sn(n),s=Li.getPolygons(t).iterator();s.hasNext();)s.next().apply(i);return t.getFactory().buildGeometry(n)},pr.prototype.getErrorMessage=function(){return this._errMsg},pr.prototype.interfaces_=function(){return[]},pr.prototype.getClass=function(){return pr},sl.VERBOSE.get=function(){return!1},sl.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(pr,sl);var An=function(t,n,i){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=n||null,this._result=i||null},al={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};An.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},An.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*An.MAX_ENV_DIFF_FRAC;t===0&&(t=.001);var n=new at(this._input.getEnvelopeInternal());n.expandBy(this._distance);var i=new at(this._result.getEnvelopeInternal());i.expandBy(t),i.contains(n)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(i)),this.report("Envelope")},An.prototype.checkDistance=function(){var t=new pr(this._input,this._distance,this._result);t.isValid()||(this._isValid=!1,this._errorMsg=t.getErrorMessage(),this._errorLocation=t.getErrorLocation(),this._errorIndicator=t.getErrorIndicator()),this.report("Distance")},An.prototype.checkArea=function(){var t=this._input.getArea(),n=this._result.getArea();this._distance>0&&t>n&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t<n&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},An.prototype.checkPolygonal=function(){this._result instanceof an||this._result instanceof hi||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},An.prototype.getErrorIndicator=function(){return this._errorIndicator},An.prototype.getErrorLocation=function(){return this._errorLocation},An.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"))},An.prototype.report=function(t){if(!An.VERBOSE)return null;Ee.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},An.prototype.getErrorMessage=function(){return this._errorMsg},An.prototype.interfaces_=function(){return[]},An.prototype.getClass=function(){return An},An.isValidMsg=function(t,n,i){var s=new An(t,n,i);return s.isValid()?null:s.getErrorMessage()},An.isValid=function(t,n,i){return!!new An(t,n,i).isValid()},al.VERBOSE.get=function(){return!1},al.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(An,al);var ii=function(){this._pts=null,this._data=null;var t=arguments[0],n=arguments[1];this._pts=t,this._data=n};ii.prototype.getCoordinates=function(){return this._pts},ii.prototype.size=function(){return this._pts.length},ii.prototype.getCoordinate=function(t){return this._pts[t]},ii.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},ii.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Ao.octant(this.getCoordinate(t),this.getCoordinate(t+1))},ii.prototype.setData=function(t){this._data=t},ii.prototype.getData=function(){return this._data},ii.prototype.toString=function(){return Qe.toLineString(new Ze(this._pts))},ii.prototype.interfaces_=function(){return[pi]},ii.prototype.getClass=function(){return ii};var vn=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new V,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};vn.prototype.getInteriorIntersection=function(){return this._interiorIntersection},vn.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},vn.prototype.getIntersectionSegments=function(){return this._intSegments},vn.prototype.count=function(){return this._intersectionCount},vn.prototype.getIntersections=function(){return this._intersections},vn.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},vn.prototype.setKeepIntersections=function(t){this._keepIntersections=t},vn.prototype.processIntersections=function(t,n,i,s){if(!this._findAllIntersections&&this.hasIntersection()||t===i&&n===s||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,n)||this.isEndSegment(i,s)))return null;var l=t.getCoordinates()[n],f=t.getCoordinates()[n+1],m=i.getCoordinates()[s],_=i.getCoordinates()[s+1];this._li.computeIntersection(l,f,m,_),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=l,this._intSegments[1]=f,this._intSegments[2]=m,this._intSegments[3]=_,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},vn.prototype.isEndSegment=function(t,n){return n===0||n>=t.size()-2},vn.prototype.hasIntersection=function(){return this._interiorIntersection!==null},vn.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},vn.prototype.interfaces_=function(){return[io]},vn.prototype.getClass=function(){return vn},vn.createAllIntersectionsFinder=function(t){var n=new vn(t);return n.setFindAllIntersections(!0),n},vn.createAnyIntersectionFinder=function(t){return new vn(t)},vn.createIntersectionCounter=function(t){var n=new vn(t);return n.setFindAllIntersections(!0),n.setKeepIntersections(!1),n};var qr=function(){this._li=new Pr,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};qr.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},qr.prototype.getIntersections=function(){return this._segInt.getIntersections()},qr.prototype.isValid=function(){return this.execute(),this._isValid},qr.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},qr.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new vn(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new rl;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},qr.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Ii(this.getErrorMessage(),this._segInt.getInteriorIntersection())},qr.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Qe.toLineString(t[0],t[1])+" and "+Qe.toLineString(t[2],t[3])},qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr},qr.computeIntersections=function(t){var n=new qr(t);return n.setFindAllIntersections(!0),n.isValid(),n.getIntersections()};var ao=function t(){this._nv=null;var n=arguments[0];this._nv=new qr(t.toSegmentStrings(n))};ao.prototype.checkValid=function(){this._nv.checkValid()},ao.prototype.interfaces_=function(){return[]},ao.prototype.getClass=function(){return ao},ao.toSegmentStrings=function(t){for(var n=new V,i=t.iterator();i.hasNext();){var s=i.next();n.add(new ii(s.getCoordinates(),s))}return n},ao.checkValid=function(t){new ao(t).checkValid()};var Lo=function(t){this._mapOp=t};Lo.prototype.map=function(t){for(var n=new V,i=0;i<t.getNumGeometries();i++){var s=this._mapOp.map(t.getGeometryN(i));s.isEmpty()||n.add(s)}return t.getFactory().createGeometryCollection(Tt.toGeometryArray(n))},Lo.prototype.interfaces_=function(){return[]},Lo.prototype.getClass=function(){return Lo},Lo.map=function(t,n){return new Lo(n).map(t)};var oi=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new V,this._resultLineList=new V;var t=arguments[0],n=arguments[1],i=arguments[2];this._op=t,this._geometryFactory=n,this._ptLocator=i};oi.prototype.collectLines=function(t){for(var n=this._op.getGraph().getEdgeEnds().iterator();n.hasNext();){var i=n.next();this.collectLineEdge(i,t,this._lineEdgesList),this.collectBoundaryTouchEdge(i,t,this._lineEdgesList)}},oi.prototype.labelIsolatedLine=function(t,n){var i=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(n));t.getLabel().setLocation(n,i)},oi.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},oi.prototype.collectLineEdge=function(t,n,i){var s=t.getLabel(),l=t.getEdge();t.isLineEdge()&&(t.isVisited()||!xt.isResultOfOp(s,n)||l.isCovered()||(i.add(l),t.setVisitedEdge(!0)))},oi.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();)t.next().getEdges().findCoveredLineEdges();for(var n=this._op.getGraph().getEdgeEnds().iterator();n.hasNext();){var i=n.next(),s=i.getEdge();if(i.isLineEdge()&&!s.isCoveredSet()){var l=this._op.isCoveredByA(i.getCoordinate());s.setCovered(l)}}},oi.prototype.labelIsolatedLines=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next(),s=i.getLabel();i.isIsolated()&&(s.isNull(0)?this.labelIsolatedLine(i,0):this.labelIsolatedLine(i,1))}},oi.prototype.buildLines=function(t){for(var n=this._lineEdgesList.iterator();n.hasNext();){var i=n.next(),s=this._geometryFactory.createLineString(i.getCoordinates());this._resultLineList.add(s),i.setInResult(!0)}},oi.prototype.collectBoundaryTouchEdge=function(t,n,i){var s=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(_t.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(xt.isResultOfOp(s,n)&&n===xt.INTERSECTION&&(i.add(t.getEdge()),t.setVisitedEdge(!0))))},oi.prototype.interfaces_=function(){return[]},oi.prototype.getClass=function(){return oi};var Do=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new V;var t=arguments[0],n=arguments[1];this._op=t,this._geometryFactory=n};Do.prototype.filterCoveredNodeToPoint=function(t){var n=t.getCoordinate();if(!this._op.isCoveredByLA(n)){var i=this._geometryFactory.createPoint(n);this._resultPointList.add(i)}},Do.prototype.extractNonCoveredResultNodes=function(t){for(var n=this._op.getGraph().getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isInResult()&&!i.isIncidentEdgeInResult()&&(i.getEdges().getDegree()===0||t===xt.INTERSECTION)){var s=i.getLabel();xt.isResultOfOp(s,t)&&this.filterCoveredNodeToPoint(i)}}},Do.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},Do.prototype.interfaces_=function(){return[]},Do.prototype.getClass=function(){return Do};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(t,n){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},nr.prototype.transformPolygon=function(t,n){var i=!0,s=this.transformLinearRing(t.getExteriorRing(),t);s!==null&&s instanceof ci&&!s.isEmpty()||(i=!1);for(var l=new V,f=0;f<t.getNumInteriorRing();f++){var m=this.transformLinearRing(t.getInteriorRingN(f),t);m===null||m.isEmpty()||(m instanceof ci||(i=!1),l.add(m))}if(i)return this._factory.createPolygon(s,l.toArray([]));var _=new V;return s!==null&&_.add(s),_.addAll(l),this._factory.buildGeometry(_)},nr.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},nr.prototype.getInputGeometry=function(){return this._inputGeom},nr.prototype.transformMultiLineString=function(t,n){for(var i=new V,s=0;s<t.getNumGeometries();s++){var l=this.transformLineString(t.getGeometryN(s),t);l!==null&&(l.isEmpty()||i.add(l))}return this._factory.buildGeometry(i)},nr.prototype.transformCoordinates=function(t,n){return this.copy(t)},nr.prototype.transformLineString=function(t,n){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},nr.prototype.transformMultiPoint=function(t,n){for(var i=new V,s=0;s<t.getNumGeometries();s++){var l=this.transformPoint(t.getGeometryN(s),t);l!==null&&(l.isEmpty()||i.add(l))}return this._factory.buildGeometry(i)},nr.prototype.transformMultiPolygon=function(t,n){for(var i=new V,s=0;s<t.getNumGeometries();s++){var l=this.transformPolygon(t.getGeometryN(s),t);l!==null&&(l.isEmpty()||i.add(l))}return this._factory.buildGeometry(i)},nr.prototype.copy=function(t){return t.copy()},nr.prototype.transformGeometryCollection=function(t,n){for(var i=new V,s=0;s<t.getNumGeometries();s++){var l=this.transform(t.getGeometryN(s));l!==null&&(this._pruneEmptyGeometry&&l.isEmpty()||i.add(l))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Tt.toGeometryArray(i)):this._factory.buildGeometry(i)},nr.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof cr)return this.transformPoint(t,null);if(t instanceof Zo)return this.transformMultiPoint(t,null);if(t instanceof ci)return this.transformLinearRing(t,null);if(t instanceof Ge)return this.transformLineString(t,null);if(t instanceof Rr)return this.transformMultiLineString(t,null);if(t instanceof an)return this.transformPolygon(t,null);if(t instanceof hi)return this.transformMultiPolygon(t,null);if(t instanceof Fe)return this.transformGeometryCollection(t,null);throw new L("Unknown Geometry subtype: "+t.getClass().getName())},nr.prototype.transformLinearRing=function(t,n){var i=this.transformCoordinates(t.getCoordinateSequence(),t);if(i===null)return this._factory.createLinearRing(null);var s=i.size();return s>0&&s<4&&!this._preserveType?this._factory.createLineString(i):this._factory.createLinearRing(i)},nr.prototype.interfaces_=function(){return[]},nr.prototype.getClass=function(){return nr};var vi=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new ft,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Ge&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];t.call(this,n.getCoordinates(),i)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var s=arguments[0],l=arguments[1];this._srcPts=s,this._isClosed=t.isClosed(s),this._snapTolerance=l}};vi.prototype.snapVertices=function(t,n){for(var i=this._isClosed?t.size()-1:t.size(),s=0;s<i;s++){var l=t.get(s),f=this.findSnapForVertex(l,n);f!==null&&(t.set(s,new C(f)),s===0&&this._isClosed&&t.set(t.size()-1,new C(f)))}},vi.prototype.findSnapForVertex=function(t,n){for(var i=0;i<n.length;i++){if(t.equals2D(n[i]))return null;if(t.distance(n[i])<this._snapTolerance)return n[i]}return null},vi.prototype.snapTo=function(t){var n=new Q(this._srcPts);return this.snapVertices(n,t),this.snapSegments(n,t),n.toCoordinateArray()},vi.prototype.snapSegments=function(t,n){if(n.length===0)return null;var i=n.length;n[0].equals2D(n[n.length-1])&&(i=n.length-1);for(var s=0;s<i;s++){var l=n[s],f=this.findSegmentIndexToSnap(l,t);f>=0&&t.add(f+1,new C(l),!1)}},vi.prototype.findSegmentIndexToSnap=function(t,n){for(var i=P.MAX_VALUE,s=-1,l=0;l<n.size()-1;l++){if(this._seg.p0=n.get(l),this._seg.p1=n.get(l+1),this._seg.p0.equals2D(t)||this._seg.p1.equals2D(t)){if(this._allowSnappingToSourceVertices)continue;return-1}var f=this._seg.distance(t);f<this._snapTolerance&&f<i&&(i=f,s=l)}return s},vi.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},vi.prototype.interfaces_=function(){return[]},vi.prototype.getClass=function(){return vi},vi.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var Ke=function(t){this._srcGeom=t||null},Qh={SNAP_PRECISION_FACTOR:{configurable:!0}};Ke.prototype.snapTo=function(t,n){var i=this.extractTargetCoordinates(t);return new jh(n,i).transform(this._srcGeom)},Ke.prototype.snapToSelf=function(t,n){var i=this.extractTargetCoordinates(this._srcGeom),s=new jh(t,i,!0).transform(this._srcGeom),l=s;return n&&et(l,Gi)&&(l=s.buffer(0)),l},Ke.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},Ke.prototype.extractTargetCoordinates=function(t){for(var n=new w,i=t.getCoordinates(),s=0;s<i.length;s++)n.add(i[s]);return n.toArray(new Array(0).fill(null))},Ke.prototype.computeMinimumSegmentLength=function(t){for(var n=P.MAX_VALUE,i=0;i<t.length-1;i++){var s=t[i].distance(t[i+1]);s<n&&(n=s)}return n},Ke.prototype.interfaces_=function(){return[]},Ke.prototype.getClass=function(){return Ke},Ke.snap=function(t,n,i){var s=new Array(2).fill(null),l=new Ke(t);s[0]=l.snapTo(n,i);var f=new Ke(n);return s[1]=f.snapTo(s[0],i),s},Ke.computeOverlaySnapTolerance=function(){if(arguments.length===1){var t=arguments[0],n=Ke.computeSizeBasedSnapTolerance(t),i=t.getPrecisionModel();if(i.getType()===se.FIXED){var s=1/i.getScale()*2/1.415;s>n&&(n=s)}return n}if(arguments.length===2){var l=arguments[0],f=arguments[1];return Math.min(Ke.computeOverlaySnapTolerance(l),Ke.computeOverlaySnapTolerance(f))}},Ke.computeSizeBasedSnapTolerance=function(t){var n=t.getEnvelopeInternal();return Math.min(n.getHeight(),n.getWidth())*Ke.SNAP_PRECISION_FACTOR},Ke.snapToSelf=function(t,n,i){return new Ke(t).snapToSelf(n,i)},Qh.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Ke,Qh);var jh=function(t){function n(i,s,l){t.call(this),this._snapTolerance=i||null,this._snapPts=s||null,this._isSelfSnap=l!==void 0&&l}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.snapLine=function(i,s){var l=new vi(i,this._snapTolerance);return l.setAllowSnappingToSourceVertices(this._isSelfSnap),l.snapTo(s)},n.prototype.transformCoordinates=function(i,s){var l=i.toCoordinateArray(),f=this.snapLine(l,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(f)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(nr),Hn=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Hn.prototype.getCommon=function(){return P.longBitsToDouble(this._commonBits)},Hn.prototype.add=function(t){var n=P.doubleToLongBits(t);if(this._isFirst)return this._commonBits=n,this._commonSignExp=Hn.signExpBits(this._commonBits),this._isFirst=!1,null;if(Hn.signExpBits(n)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Hn.numCommonMostSigMantissaBits(this._commonBits,n),this._commonBits=Hn.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},Hn.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],n=P.longBitsToDouble(t),i="0000000000000000000000000000000000000000000000000000000000000000"+P.toBinaryString(t),s=i.substring(i.length-64);return s.substring(0,1)+" "+s.substring(1,12)+"(exp) "+s.substring(12)+" [ "+n+" ]"}},Hn.prototype.interfaces_=function(){return[]},Hn.prototype.getClass=function(){return Hn},Hn.getBit=function(t,n){return t&1<<n?1:0},Hn.signExpBits=function(t){return t>>52},Hn.zeroLowerBits=function(t,n){return t&~((1<<n)-1)},Hn.numCommonMostSigMantissaBits=function(t,n){for(var i=0,s=52;s>=0;s--){if(Hn.getBit(t,s)!==Hn.getBit(n,s))return i;i++}return 52};var Zi=function(){this._commonCoord=null,this._ccFilter=new Oo},ul={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Zi.prototype.addCommonBits=function(t){var n=new Ji(this._commonCoord);t.apply(n),t.geometryChanged()},Zi.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var n=new C(this._commonCoord);n.x=-n.x,n.y=-n.y;var i=new Ji(n);return t.apply(i),t.geometryChanged(),t},Zi.prototype.getCommonCoordinate=function(){return this._commonCoord},Zi.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Zi.prototype.interfaces_=function(){return[]},Zi.prototype.getClass=function(){return Zi},ul.CommonCoordinateFilter.get=function(){return Oo},ul.Translater.get=function(){return Ji},Object.defineProperties(Zi,ul);var Oo=function(){this._commonBitsX=new Hn,this._commonBitsY=new Hn};Oo.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},Oo.prototype.getCommonCoordinate=function(){return new C(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Oo.prototype.interfaces_=function(){return[B]},Oo.prototype.getClass=function(){return Oo};var Ji=function(){this.trans=null;var t=arguments[0];this.trans=t};Ji.prototype.filter=function(t,n){var i=t.getOrdinate(n,0)+this.trans.x,s=t.getOrdinate(n,1)+this.trans.y;t.setOrdinate(n,0,i),t.setOrdinate(n,1,s)},Ji.prototype.isDone=function(){return!1},Ji.prototype.isGeometryChanged=function(){return!0},Ji.prototype.interfaces_=function(){return[Ye]},Ji.prototype.getClass=function(){return Ji};var _n=function(t,n){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=n,this.computeSnapTolerance()};_n.prototype.selfSnap=function(t){return new Ke(t).snapTo(t,this._snapTolerance)},_n.prototype.removeCommonBits=function(t){this._cbr=new Zi,this._cbr.add(t[0]),this._cbr.add(t[1]);var n=new Array(2).fill(null);return n[0]=this._cbr.removeCommonBits(t[0].copy()),n[1]=this._cbr.removeCommonBits(t[1].copy()),n},_n.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},_n.prototype.getResultGeometry=function(t){var n=this.snap(this._geom),i=xt.overlayOp(n[0],n[1],t);return this.prepareResult(i)},_n.prototype.checkValid=function(t){t.isValid()||Ee.out.println("Snapped geometry is invalid")},_n.prototype.computeSnapTolerance=function(){this._snapTolerance=Ke.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},_n.prototype.snap=function(t){var n=this.removeCommonBits(t);return Ke.snap(n[0],n[1],this._snapTolerance)},_n.prototype.interfaces_=function(){return[]},_n.prototype.getClass=function(){return _n},_n.overlayOp=function(t,n,i){return new _n(t,n).getResultGeometry(i)},_n.union=function(t,n){return _n.overlayOp(t,n,xt.UNION)},_n.intersection=function(t,n){return _n.overlayOp(t,n,xt.INTERSECTION)},_n.symDifference=function(t,n){return _n.overlayOp(t,n,xt.SYMDIFFERENCE)},_n.difference=function(t,n){return _n.overlayOp(t,n,xt.DIFFERENCE)};var qn=function(t,n){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=n};qn.prototype.getResultGeometry=function(t){var n=null,i=!1,s=null;try{n=xt.overlayOp(this._geom[0],this._geom[1],t),i=!0}catch(l){if(!(l instanceof Cn))throw l;s=l}if(!i)try{n=_n.overlayOp(this._geom[0],this._geom[1],t)}catch(l){throw l instanceof Cn?s:l}return n},qn.prototype.interfaces_=function(){return[]},qn.prototype.getClass=function(){return qn},qn.overlayOp=function(t,n,i){return new qn(t,n).getResultGeometry(i)},qn.union=function(t,n){return qn.overlayOp(t,n,xt.UNION)},qn.intersection=function(t,n){return qn.overlayOp(t,n,xt.INTERSECTION)},qn.symDifference=function(t,n){return qn.overlayOp(t,n,xt.SYMDIFFERENCE)},qn.difference=function(t,n){return qn.overlayOp(t,n,xt.DIFFERENCE)};var Zs=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],n=arguments[1];this.mce=t,this.chainIndex=n};Zs.prototype.computeIntersections=function(t,n){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,n)},Zs.prototype.interfaces_=function(){return[]},Zs.prototype.getClass=function(){return Zs};var dr=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var n=arguments[0],i=arguments[1];this._eventType=t.DELETE,this._xValue=n,this._insertEvent=i}else if(arguments.length===3){var s=arguments[0],l=arguments[1],f=arguments[2];this._eventType=t.INSERT,this._label=s,this._xValue=l,this._obj=f}},ll={INSERT:{configurable:!0},DELETE:{configurable:!0}};dr.prototype.isDelete=function(){return this._eventType===dr.DELETE},dr.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},dr.prototype.getObject=function(){return this._obj},dr.prototype.compareTo=function(t){var n=t;return this._xValue<n._xValue?-1:this._xValue>n._xValue?1:this._eventType<n._eventType?-1:this._eventType>n._eventType?1:0},dr.prototype.getInsertEvent=function(){return this._insertEvent},dr.prototype.isInsert=function(){return this._eventType===dr.INSERT},dr.prototype.isSameLabel=function(t){return this._label!==null&&this._label===t._label},dr.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},dr.prototype.interfaces_=function(){return[k]},dr.prototype.getClass=function(){return dr},ll.INSERT.get=function(){return 1},ll.DELETE.get=function(){return 2},Object.defineProperties(dr,ll);var Oa=function(){};Oa.prototype.interfaces_=function(){return[]},Oa.prototype.getClass=function(){return Oa};var Tn=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 t=arguments[0],n=arguments[1],i=arguments[2];this._li=t,this._includeProper=n,this._recordIsolated=i};Tn.prototype.isTrivialIntersection=function(t,n,i,s){if(t===i&&this._li.getIntersectionNum()===1){if(Tn.isAdjacentSegments(n,s))return!0;if(t.isClosed()){var l=t.getNumPoints()-1;if(n===0&&s===l||s===0&&n===l)return!0}}return!1},Tn.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Tn.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},Tn.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Tn.prototype.isBoundaryPointInternal=function(t,n){for(var i=n.iterator();i.hasNext();){var s=i.next().getCoordinate();if(t.isIntersection(s))return!0}return!1},Tn.prototype.hasProperIntersection=function(){return this._hasProper},Tn.prototype.hasIntersection=function(){return this._hasIntersection},Tn.prototype.isDone=function(){return this._isDone},Tn.prototype.isBoundaryPoint=function(t,n){return n!==null&&(!!this.isBoundaryPointInternal(t,n[0])||!!this.isBoundaryPointInternal(t,n[1]))},Tn.prototype.setBoundaryNodes=function(t,n){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=n},Tn.prototype.addIntersections=function(t,n,i,s){if(t===i&&n===s)return null;this.numTests++;var l=t.getCoordinates()[n],f=t.getCoordinates()[n+1],m=i.getCoordinates()[s],_=i.getCoordinates()[s+1];this._li.computeIntersection(l,f,m,_),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),i.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,n,i,s)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,n,0),i.addIntersections(this._li,s,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))))},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn},Tn.isAdjacentSegments=function(t,n){return Math.abs(t-n)===1};var R0=function(t){function n(){t.call(this),this.events=new V,this.nOverlaps=null}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.prepareEvents=function(){Gr.sort(this.events);for(var i=0;i<this.events.size();i++){var s=this.events.get(i);s.isDelete()&&s.getInsertEvent().setDeleteEventIndex(i)}},n.prototype.computeIntersections=function(){if(arguments.length===1){var i=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var s=0;s<this.events.size();s++){var l=this.events.get(s);if(l.isInsert()&&this.processOverlaps(s,l.getDeleteEventIndex(),l,i),i.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof Tn&&et(arguments[0],Z)&&et(arguments[1],Z)){var f=arguments[0],m=arguments[1],_=arguments[2];this.addEdges(f,f),this.addEdges(m,m),this.computeIntersections(_)}else if(typeof arguments[2]=="boolean"&&et(arguments[0],Z)&&arguments[1]instanceof Tn){var S=arguments[0],O=arguments[1];arguments[2]?this.addEdges(S,null):this.addEdges(S),this.computeIntersections(O)}}},n.prototype.addEdge=function(i,s){for(var l=i.getMonotoneChainEdge(),f=l.getStartIndexes(),m=0;m<f.length-1;m++){var _=new Zs(l,m),S=new dr(s,l.getMinX(m),_);this.events.add(S),this.events.add(new dr(l.getMaxX(m),S))}},n.prototype.processOverlaps=function(i,s,l,f){for(var m=l.getObject(),_=i;_<s;_++){var S=this.events.get(_);if(S.isInsert()){var O=S.getObject();l.isSameLabel(S)||(m.computeIntersections(O,f),this.nOverlaps++)}}},n.prototype.addEdges=function(){if(arguments.length===1)for(var i=arguments[0].iterator();i.hasNext();){var s=i.next();this.addEdge(s,s)}else if(arguments.length===2)for(var l=arguments[0],f=arguments[1],m=l.iterator();m.hasNext();){var _=m.next();this.addEdge(_,f)}},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Oa),_i=function(){this._min=P.POSITIVE_INFINITY,this._max=P.NEGATIVE_INFINITY},tf={NodeComparator:{configurable:!0}};_i.prototype.getMin=function(){return this._min},_i.prototype.intersects=function(t,n){return!(this._min>n||this._max<t)},_i.prototype.getMax=function(){return this._max},_i.prototype.toString=function(){return Qe.toLineString(new C(this._min,0),new C(this._max,0))},_i.prototype.interfaces_=function(){return[]},_i.prototype.getClass=function(){return _i},tf.NodeComparator.get=function(){return Js},Object.defineProperties(_i,tf);var Js=function(){};Js.prototype.compare=function(t,n){var i=t,s=n,l=(i._min+i._max)/2,f=(s._min+s._max)/2;return l<f?-1:l>f?1:0},Js.prototype.interfaces_=function(){return[q]},Js.prototype.getClass=function(){return Js};var N0=function(t){function n(){t.call(this),this._item=null;var i=arguments[0],s=arguments[1],l=arguments[2];this._min=i,this._max=s,this._item=l}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.query=function(i,s,l){if(!this.intersects(i,s))return null;l.visitItem(this._item)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(_i),L0=function(t){function n(){t.call(this),this._node1=null,this._node2=null;var i=arguments[0],s=arguments[1];this._node1=i,this._node2=s,this.buildExtent(this._node1,this._node2)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.buildExtent=function(i,s){this._min=Math.min(i._min,s._min),this._max=Math.max(i._max,s._max)},n.prototype.query=function(i,s,l){if(!this.intersects(i,s))return null;this._node1!==null&&this._node1.query(i,s,l),this._node2!==null&&this._node2.query(i,s,l)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(_i),xi=function(){this._leaves=new V,this._root=null,this._level=0};xi.prototype.buildTree=function(){Gr.sort(this._leaves,new _i.NodeComparator);for(var t=this._leaves,n=null,i=new V;;){if(this.buildLevel(t,i),i.size()===1)return i.get(0);n=t,t=i,i=n}},xi.prototype.insert=function(t,n,i){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new N0(t,n,i))},xi.prototype.query=function(t,n,i){this.init(),this._root.query(t,n,i)},xi.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},xi.prototype.printNode=function(t){Ee.out.println(Qe.toLineString(new C(t._min,this._level),new C(t._max,this._level)))},xi.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},xi.prototype.buildLevel=function(t,n){this._level++,n.clear();for(var i=0;i<t.size();i+=2){var s=t.get(i);if((i+1<t.size()?t.get(i):null)===null)n.add(s);else{var l=new L0(t.get(i),t.get(i+1));n.add(l)}}},xi.prototype.interfaces_=function(){return[]},xi.prototype.getClass=function(){return xi};var ns=function(){this._items=new V};ns.prototype.visitItem=function(t){this._items.add(t)},ns.prototype.getItems=function(){return this._items},ns.prototype.interfaces_=function(){return[Vi]},ns.prototype.getClass=function(){return ns};var rs=function(){this._index=null;var t=arguments[0];if(!et(t,Gi))throw new L("Argument must be Polygonal");this._index=new uo(t)},cl={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};rs.prototype.locate=function(t){var n=new Un(t),i=new is(n);return this._index.query(t.y,t.y,i),n.getLocation()},rs.prototype.interfaces_=function(){return[jo]},rs.prototype.getClass=function(){return rs},cl.SegmentVisitor.get=function(){return is},cl.IntervalIndexedGeometry.get=function(){return uo},Object.defineProperties(rs,cl);var is=function(){this._counter=null;var t=arguments[0];this._counter=t};is.prototype.visitItem=function(t){var n=t;this._counter.countSegment(n.getCoordinate(0),n.getCoordinate(1))},is.prototype.interfaces_=function(){return[Vi]},is.prototype.getClass=function(){return is};var uo=function(){this._index=new xi;var t=arguments[0];this.init(t)};uo.prototype.init=function(t){for(var n=Sn.getLines(t).iterator();n.hasNext();){var i=n.next().getCoordinates();this.addLine(i)}},uo.prototype.addLine=function(t){for(var n=1;n<t.length;n++){var i=new ft(t[n-1],t[n]),s=Math.min(i.p0.y,i.p1.y),l=Math.max(i.p0.y,i.p1.y);this._index.insert(s,l,i)}},uo.prototype.query=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1],i=new ns;return this._index.query(t,n,i),i.getItems()}if(arguments.length===3){var s=arguments[0],l=arguments[1],f=arguments[2];this._index.query(s,l,f)}},uo.prototype.interfaces_=function(){return[]},uo.prototype.getClass=function(){return uo};var Ks=function(t){function n(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new Oh,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Hr,arguments.length===2){var i=arguments[0],s=arguments[1],l=y.OGC_SFS_BOUNDARY_RULE;this._argIndex=i,this._parentGeom=s,this._boundaryNodeRule=l,s!==null&&this.add(s)}else if(arguments.length===3){var f=arguments[0],m=arguments[1],_=arguments[2];this._argIndex=f,this._parentGeom=m,this._boundaryNodeRule=_,m!==null&&this.add(m)}}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.insertBoundaryPoint=function(i,s){var l=this._nodes.addNode(s).getLabel(),f=1;F.NONE,l.getLocation(i,j.ON)===F.BOUNDARY&&f++;var m=n.determineBoundary(this._boundaryNodeRule,f);l.setLocation(i,m)},n.prototype.computeSelfNodes=function(){if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.computeSelfNodes(i,s,!1)}if(arguments.length===3){var l=arguments[0],f=arguments[1],m=arguments[2],_=new Tn(l,!0,!1);_.setIsDoneIfProperInt(m);var S=this.createEdgeSetIntersector(),O=this._parentGeom instanceof ci||this._parentGeom instanceof an||this._parentGeom instanceof hi,H=f||!O;return S.computeIntersections(this._edges,_,H),this.addSelfIntersectionNodes(this._argIndex),_}},n.prototype.computeSplitEdges=function(i){for(var s=this._edges.iterator();s.hasNext();)s.next().eiList.addSplitEdges(i)},n.prototype.computeEdgeIntersections=function(i,s,l){var f=new Tn(s,l,!0);return f.setBoundaryNodes(this.getBoundaryNodes(),i.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,i._edges,f),f},n.prototype.getGeometry=function(){return this._parentGeom},n.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},n.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},n.prototype.addPoint=function(){if(arguments[0]instanceof cr){var i=arguments[0].getCoordinate();this.insertPoint(this._argIndex,i,F.INTERIOR)}else if(arguments[0]instanceof C){var s=arguments[0];this.insertPoint(this._argIndex,s,F.INTERIOR)}},n.prototype.addPolygon=function(i){this.addPolygonRing(i.getExteriorRing(),F.EXTERIOR,F.INTERIOR);for(var s=0;s<i.getNumInteriorRing();s++){var l=i.getInteriorRingN(s);this.addPolygonRing(l,F.INTERIOR,F.EXTERIOR)}},n.prototype.addEdge=function(i){this.insertEdge(i);var s=i.getCoordinates();this.insertPoint(this._argIndex,s[0],F.BOUNDARY),this.insertPoint(this._argIndex,s[s.length-1],F.BOUNDARY)},n.prototype.addLineString=function(i){var s=J.removeRepeatedPoints(i.getCoordinates());if(s.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=s[0],null;var l=new Da(s,new Me(this._argIndex,F.INTERIOR));this._lineEdgeMap.put(i,l),this.insertEdge(l),_t.isTrue(s.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,s[0]),this.insertBoundaryPoint(this._argIndex,s[s.length-1])},n.prototype.getInvalidPoint=function(){return this._invalidPoint},n.prototype.getBoundaryPoints=function(){for(var i=this.getBoundaryNodes(),s=new Array(i.size()).fill(null),l=0,f=i.iterator();f.hasNext();){var m=f.next();s[l++]=m.getCoordinate().copy()}return s},n.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},n.prototype.addSelfIntersectionNode=function(i,s,l){if(this.isBoundaryNode(i,s))return null;l===F.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(i,s):this.insertPoint(i,s,l)},n.prototype.addPolygonRing=function(i,s,l){if(i.isEmpty())return null;var f=J.removeRepeatedPoints(i.getCoordinates());if(f.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=f[0],null;var m=s,_=l;tt.isCCW(f)&&(m=l,_=s);var S=new Da(f,new Me(this._argIndex,F.BOUNDARY,m,_));this._lineEdgeMap.put(i,S),this.insertEdge(S),this.insertPoint(this._argIndex,f[0],F.BOUNDARY)},n.prototype.insertPoint=function(i,s,l){var f=this._nodes.addNode(s),m=f.getLabel();m===null?f._label=new Me(i,l):m.setLocation(i,l)},n.prototype.createEdgeSetIntersector=function(){return new R0},n.prototype.addSelfIntersectionNodes=function(i){for(var s=this._edges.iterator();s.hasNext();)for(var l=s.next(),f=l.getLabel().getLocation(i),m=l.eiList.iterator();m.hasNext();){var _=m.next();this.addSelfIntersectionNode(i,_.coord,f)}},n.prototype.add=function(){if(arguments.length!==1)return t.prototype.add.apply(this,arguments);var i=arguments[0];if(i.isEmpty())return null;if(i instanceof hi&&(this._useBoundaryDeterminationRule=!1),i instanceof an)this.addPolygon(i);else if(i instanceof Ge)this.addLineString(i);else if(i instanceof cr)this.addPoint(i);else if(i instanceof Zo)this.addCollection(i);else if(i instanceof Rr)this.addCollection(i);else if(i instanceof hi)this.addCollection(i);else{if(!(i instanceof Fe))throw new Error(i.getClass().getName());this.addCollection(i)}},n.prototype.addCollection=function(i){for(var s=0;s<i.getNumGeometries();s++){var l=i.getGeometryN(s);this.add(l)}},n.prototype.locate=function(i){return et(this._parentGeom,Gi)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new rs(this._parentGeom)),this._areaPtLocator.locate(i)):this._ptLocator.locate(i,this._parentGeom)},n.prototype.findEdge=function(){if(arguments.length===1){var i=arguments[0];return this._lineEdgeMap.get(i)}return t.prototype.findEdge.apply(this,arguments)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n.determineBoundary=function(i,s){return i.isInBoundary(s)?F.BOUNDARY:F.INTERIOR},n}(ze),os=function(){if(this._li=new Pr,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Ks(0,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=y.OGC_SFS_BOUNDARY_RULE;n.getPrecisionModel().compareTo(i.getPrecisionModel())>=0?this.setComputationPrecision(n.getPrecisionModel()):this.setComputationPrecision(i.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Ks(0,n,s),this._arg[1]=new Ks(1,i,s)}else if(arguments.length===3){var l=arguments[0],f=arguments[1],m=arguments[2];l.getPrecisionModel().compareTo(f.getPrecisionModel())>=0?this.setComputationPrecision(l.getPrecisionModel()):this.setComputationPrecision(f.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Ks(0,l,m),this._arg[1]=new Ks(1,f,m)}};os.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},os.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},os.prototype.interfaces_=function(){return[]},os.prototype.getClass=function(){return os};var lo=function(){};lo.prototype.interfaces_=function(){return[]},lo.prototype.getClass=function(){return lo},lo.map=function(){if(arguments[0]instanceof yt&&et(arguments[1],lo.MapOp)){for(var t=arguments[0],n=arguments[1],i=new V,s=0;s<t.getNumGeometries();s++){var l=n.map(t.getGeometryN(s));l!==null&&i.add(l)}return t.getFactory().buildGeometry(i)}if(et(arguments[0],G)&&et(arguments[1],lo.MapOp)){for(var f=arguments[0],m=arguments[1],_=new V,S=f.iterator();S.hasNext();){var O=S.next(),H=m.map(O);H!==null&&_.add(H)}return _}},lo.MapOp=function(){};var xt=function(t){function n(){var i=arguments[0],s=arguments[1];t.call(this,i,s),this._ptLocator=new Hr,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Vr,this._resultPolyList=new V,this._resultLineList=new V,this._resultPointList=new V,this._graph=new ze(new Wh),this._geomFact=i.getFactory()}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.insertUniqueEdge=function(i){var s=this._edgeList.findEqualEdge(i);if(s!==null){var l=s.getLabel(),f=i.getLabel();s.isPointwiseEqual(i)||(f=new Me(i.getLabel())).flip();var m=s.getDepth();m.isNull()&&m.add(l),m.add(f),l.merge(f)}else this._edgeList.add(i)},n.prototype.getGraph=function(){return this._graph},n.prototype.cancelDuplicateResultEdges=function(){for(var i=this._graph.getEdgeEnds().iterator();i.hasNext();){var s=i.next(),l=s.getSym();s.isInResult()&&l.isInResult()&&(s.setInResult(!1),l.setInResult(!1))}},n.prototype.isCoveredByLA=function(i){return!!this.isCovered(i,this._resultLineList)||!!this.isCovered(i,this._resultPolyList)},n.prototype.computeGeometry=function(i,s,l,f){var m=new V;return m.addAll(i),m.addAll(s),m.addAll(l),m.isEmpty()?n.createEmptyResult(f,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(m)},n.prototype.mergeSymLabels=function(){for(var i=this._graph.getNodes().iterator();i.hasNext();)i.next().getEdges().mergeSymLabels()},n.prototype.isCovered=function(i,s){for(var l=s.iterator();l.hasNext();){var f=l.next();if(this._ptLocator.locate(i,f)!==F.EXTERIOR)return!0}return!1},n.prototype.replaceCollapsedEdges=function(){for(var i=new V,s=this._edgeList.iterator();s.hasNext();){var l=s.next();l.isCollapsed()&&(s.remove(),i.add(l.getCollapsedEdge()))}this._edgeList.addAll(i)},n.prototype.updateNodeLabelling=function(){for(var i=this._graph.getNodes().iterator();i.hasNext();){var s=i.next(),l=s.getEdges().getLabel();s.getLabel().merge(l)}},n.prototype.getResultGeometry=function(i){return this.computeOverlay(i),this._resultGeom},n.prototype.insertUniqueEdges=function(i){for(var s=i.iterator();s.hasNext();){var l=s.next();this.insertUniqueEdge(l)}},n.prototype.computeOverlay=function(i){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 s=new V;this._arg[0].computeSplitEdges(s),this._arg[1].computeSplitEdges(s),this.insertUniqueEdges(s),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),ao.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(i),this.cancelDuplicateResultEdges();var l=new hr(this._geomFact);l.add(this._graph),this._resultPolyList=l.getPolygons();var f=new oi(this,this._geomFact,this._ptLocator);this._resultLineList=f.build(i);var m=new Do(this,this._geomFact,this._ptLocator);this._resultPointList=m.build(i),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,i)},n.prototype.labelIncompleteNode=function(i,s){var l=this._ptLocator.locate(i.getCoordinate(),this._arg[s].getGeometry());i.getLabel().setLocation(s,l)},n.prototype.copyPoints=function(i){for(var s=this._arg[i].getNodeIterator();s.hasNext();){var l=s.next();this._graph.addNode(l.getCoordinate()).setLabel(i,l.getLabel().getLocation(i))}},n.prototype.findResultAreaEdges=function(i){for(var s=this._graph.getEdgeEnds().iterator();s.hasNext();){var l=s.next(),f=l.getLabel();f.isArea()&&!l.isInteriorAreaEdge()&&n.isResultOfOp(f.getLocation(0,j.RIGHT),f.getLocation(1,j.RIGHT),i)&&l.setInResult(!0)}},n.prototype.computeLabelsFromDepths=function(){for(var i=this._edgeList.iterator();i.hasNext();){var s=i.next(),l=s.getLabel(),f=s.getDepth();if(!f.isNull()){f.normalize();for(var m=0;m<2;m++)l.isNull(m)||!l.isArea()||f.isNull(m)||(f.getDelta(m)===0?l.toLine(m):(_t.isTrue(!f.isNull(m,j.LEFT),"depth of LEFT side has not been initialized"),l.setLocation(m,j.LEFT,f.getLocation(m,j.LEFT)),_t.isTrue(!f.isNull(m,j.RIGHT),"depth of RIGHT side has not been initialized"),l.setLocation(m,j.RIGHT,f.getLocation(m,j.RIGHT))))}}},n.prototype.computeLabelling=function(){for(var i=this._graph.getNodes().iterator();i.hasNext();)i.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},n.prototype.labelIncompleteNodes=function(){for(var i=this._graph.getNodes().iterator();i.hasNext();){var s=i.next(),l=s.getLabel();s.isIsolated()&&(l.isNull(0)?this.labelIncompleteNode(s,0):this.labelIncompleteNode(s,1)),s.getEdges().updateLabelling(l)}},n.prototype.isCoveredByA=function(i){return!!this.isCovered(i,this._resultPolyList)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(os);xt.overlayOp=function(t,n,i){return new xt(t,n).getResultGeometry(i)},xt.intersection=function(t,n){if(t.isEmpty()||n.isEmpty())return xt.createEmptyResult(xt.INTERSECTION,t,n,t.getFactory());if(t.isGeometryCollection()){var i=n;return Lo.map(t,{interfaces_:function(){return[lo.MapOp]},map:function(s){return s.intersection(i)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),qn.overlayOp(t,n,xt.INTERSECTION)},xt.symDifference=function(t,n){if(t.isEmpty()||n.isEmpty()){if(t.isEmpty()&&n.isEmpty())return xt.createEmptyResult(xt.SYMDIFFERENCE,t,n,t.getFactory());if(t.isEmpty())return n.copy();if(n.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),qn.overlayOp(t,n,xt.SYMDIFFERENCE)},xt.resultDimension=function(t,n,i){var s=n.getDimension(),l=i.getDimension(),f=-1;switch(t){case xt.INTERSECTION:f=Math.min(s,l);break;case xt.UNION:f=Math.max(s,l);break;case xt.DIFFERENCE:f=s;break;case xt.SYMDIFFERENCE:f=Math.max(s,l)}return f},xt.createEmptyResult=function(t,n,i,s){var l=null;switch(xt.resultDimension(t,n,i)){case-1:l=s.createGeometryCollection(new Array(0).fill(null));break;case 0:l=s.createPoint();break;case 1:l=s.createLineString();break;case 2:l=s.createPolygon()}return l},xt.difference=function(t,n){return t.isEmpty()?xt.createEmptyResult(xt.DIFFERENCE,t,n,t.getFactory()):n.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),qn.overlayOp(t,n,xt.DIFFERENCE))},xt.isResultOfOp=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1],i=t.getLocation(0),s=t.getLocation(1);return xt.isResultOfOp(i,s,n)}if(arguments.length===3){var l=arguments[0],f=arguments[1],m=arguments[2];switch(l===F.BOUNDARY&&(l=F.INTERIOR),f===F.BOUNDARY&&(f=F.INTERIOR),m){case xt.INTERSECTION:return l===F.INTERIOR&&f===F.INTERIOR;case xt.UNION:return l===F.INTERIOR||f===F.INTERIOR;case xt.DIFFERENCE:return l===F.INTERIOR&&f!==F.INTERIOR;case xt.SYMDIFFERENCE:return l===F.INTERIOR&&f!==F.INTERIOR||l!==F.INTERIOR&&f===F.INTERIOR}return!1}},xt.INTERSECTION=1,xt.UNION=2,xt.DIFFERENCE=3,xt.SYMDIFFERENCE=4;var Ki=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Hr,this._seg=new ft;var t=arguments[0],n=arguments[1];this._g=t,this._boundaryDistanceTolerance=n,this._linework=this.extractLinework(t)};Ki.prototype.isWithinToleranceOfBoundary=function(t){for(var n=0;n<this._linework.getNumGeometries();n++)for(var i=this._linework.getGeometryN(n).getCoordinateSequence(),s=0;s<i.size()-1;s++)if(i.getCoordinate(s,this._seg.p0),i.getCoordinate(s+1,this._seg.p1),this._seg.distance(t)<=this._boundaryDistanceTolerance)return!0;return!1},Ki.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?F.BOUNDARY:this._ptLocator.locate(t,this._g)},Ki.prototype.extractLinework=function(t){var n=new ss;t.apply(n);var i=n.getLinework(),s=Tt.toLineStringArray(i);return t.getFactory().createMultiLineString(s)},Ki.prototype.interfaces_=function(){return[]},Ki.prototype.getClass=function(){return Ki};var ss=function(){this._linework=null,this._linework=new V};ss.prototype.getLinework=function(){return this._linework},ss.prototype.filter=function(t){if(t instanceof an){var n=t;this._linework.add(n.getExteriorRing());for(var i=0;i<n.getNumInteriorRing();i++)this._linework.add(n.getInteriorRingN(i))}},ss.prototype.interfaces_=function(){return[je]},ss.prototype.getClass=function(){return ss};var co=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};co.prototype.extractPoints=function(t,n,i){for(var s=t.getCoordinates(),l=0;l<s.length-1;l++)this.computeOffsetPoints(s[l],s[l+1],n,i)},co.prototype.setSidesToGenerate=function(t,n){this._doLeft=t,this._doRight=n},co.prototype.getPoints=function(t){for(var n=new V,i=Sn.getLines(this._g).iterator();i.hasNext();){var s=i.next();this.extractPoints(s,t,n)}return n},co.prototype.computeOffsetPoints=function(t,n,i,s){var l=n.x-t.x,f=n.y-t.y,m=Math.sqrt(l*l+f*f),_=i*l/m,S=i*f/m,O=(n.x+t.x)/2,H=(n.y+t.y)/2;if(this._doLeft){var X=new C(O-S,H+_);s.add(X)}if(this._doRight){var nt=new C(O+S,H-_);s.add(nt)}},co.prototype.interfaces_=function(){return[]},co.prototype.getClass=function(){return co};var wr=function t(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=t.TOLERANCE,this._testCoords=new V;var n=arguments[0],i=arguments[1],s=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(n,i),this._geom=[n,i,s],this._locFinder=[new Ki(this._geom[0],this._boundaryDistanceTolerance),new Ki(this._geom[1],this._boundaryDistanceTolerance),new Ki(this._geom[2],this._boundaryDistanceTolerance)]},ef={TOLERANCE:{configurable:!0}};wr.prototype.reportResult=function(t,n,i){Ee.out.println("Overlay result invalid - A:"+F.toLocationSymbol(n[0])+" B:"+F.toLocationSymbol(n[1])+" expected:"+(i?"i":"e")+" actual:"+F.toLocationSymbol(n[2]))},wr.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var n=this.checkValid(t);return n},wr.prototype.checkValid=function(){if(arguments.length===1){for(var t=arguments[0],n=0;n<this._testCoords.size();n++){var i=this._testCoords.get(n);if(!this.checkValid(t,i))return this._invalidLocation=i,!1}return!0}if(arguments.length===2){var s=arguments[0],l=arguments[1];return this._location[0]=this._locFinder[0].getLocation(l),this._location[1]=this._locFinder[1].getLocation(l),this._location[2]=this._locFinder[2].getLocation(l),!!wr.hasLocation(this._location,F.BOUNDARY)||this.isValidResult(s,this._location)}},wr.prototype.addTestPts=function(t){var n=new co(t);this._testCoords.addAll(n.getPoints(5*this._boundaryDistanceTolerance))},wr.prototype.isValidResult=function(t,n){var i=xt.isResultOfOp(n[0],n[1],t),s=!(i^n[2]===F.INTERIOR);return s||this.reportResult(t,n,i),s},wr.prototype.getInvalidLocation=function(){return this._invalidLocation},wr.prototype.interfaces_=function(){return[]},wr.prototype.getClass=function(){return wr},wr.hasLocation=function(t,n){for(var i=0;i<3;i++)if(t[i]===n)return!0;return!1},wr.computeBoundaryDistanceTolerance=function(t,n){return Math.min(Ke.computeSizeBasedSnapTolerance(t),Ke.computeSizeBasedSnapTolerance(n))},wr.isValid=function(t,n,i,s){return new wr(t,n,s).isValid(i)},ef.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(wr,ef);var Sr=function t(n){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(n),this._inputGeoms=n};Sr.prototype.extractElements=function(t,n){if(t===null)return null;for(var i=0;i<t.getNumGeometries();i++){var s=t.getGeometryN(i);this._skipEmpty&&s.isEmpty()||n.add(s)}},Sr.prototype.combine=function(){for(var t=new V,n=this._inputGeoms.iterator();n.hasNext();){var i=n.next();this.extractElements(i,t)}return t.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr},Sr.combine=function(){if(arguments.length===1){var t=arguments[0];return new Sr(t).combine()}if(arguments.length===2){var n=arguments[0],i=arguments[1];return new Sr(Sr.createList(n,i)).combine()}if(arguments.length===3){var s=arguments[0],l=arguments[1],f=arguments[2];return new Sr(Sr.createList(s,l,f)).combine()}},Sr.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},Sr.createList=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1],i=new V;return i.add(t),i.add(n),i}if(arguments.length===3){var s=arguments[0],l=arguments[1],f=arguments[2],m=new V;return m.add(s),m.add(l),m.add(f),m}};var nn=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,this._inputPolys===null&&(this._inputPolys=new V)},nf={STRTREE_NODE_CAPACITY:{configurable:!0}};nn.prototype.reduceToGeometries=function(t){for(var n=new V,i=t.iterator();i.hasNext();){var s=i.next(),l=null;et(s,Z)?l=this.unionTree(s):s instanceof yt&&(l=s),n.add(l)}return n},nn.prototype.extractByEnvelope=function(t,n,i){for(var s=new V,l=0;l<n.getNumGeometries();l++){var f=n.getGeometryN(l);f.getEnvelopeInternal().intersects(t)?s.add(f):i.add(f)}return this._geomFactory.buildGeometry(s)},nn.prototype.unionOptimized=function(t,n){var i=t.getEnvelopeInternal(),s=n.getEnvelopeInternal();if(!i.intersects(s))return Sr.combine(t,n);if(t.getNumGeometries()<=1&&n.getNumGeometries()<=1)return this.unionActual(t,n);var l=i.intersection(s);return this.unionUsingEnvelopeIntersection(t,n,l)},nn.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 t=new zh(nn.STRTREE_NODE_CAPACITY),n=this._inputPolys.iterator();n.hasNext();){var i=n.next();t.insert(i.getEnvelopeInternal(),i)}this._inputPolys=null;var s=t.itemsTree();return this.unionTree(s)},nn.prototype.binaryUnion=function(){if(arguments.length===1){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];if(s-i<=1){var l=nn.getGeometry(n,i);return this.unionSafe(l,null)}if(s-i==2)return this.unionSafe(nn.getGeometry(n,i),nn.getGeometry(n,i+1));var f=Math.trunc((s+i)/2),m=this.binaryUnion(n,i,f),_=this.binaryUnion(n,f,s);return this.unionSafe(m,_)}},nn.prototype.repeatedUnion=function(t){for(var n=null,i=t.iterator();i.hasNext();){var s=i.next();n=n===null?s.copy():n.union(s)}return n},nn.prototype.unionSafe=function(t,n){return t===null&&n===null?null:t===null?n.copy():n===null?t.copy():this.unionOptimized(t,n)},nn.prototype.unionActual=function(t,n){return nn.restrictToPolygons(t.union(n))},nn.prototype.unionTree=function(t){var n=this.reduceToGeometries(t);return this.binaryUnion(n)},nn.prototype.unionUsingEnvelopeIntersection=function(t,n,i){var s=new V,l=this.extractByEnvelope(i,t,s),f=this.extractByEnvelope(i,n,s),m=this.unionActual(l,f);return s.add(m),Sr.combine(s)},nn.prototype.bufferUnion=function(){if(arguments.length===1){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return n.getFactory().createGeometryCollection([n,i]).buffer(0)}},nn.prototype.interfaces_=function(){return[]},nn.prototype.getClass=function(){return nn},nn.restrictToPolygons=function(t){if(et(t,Gi))return t;var n=Li.getPolygons(t);return n.size()===1?n.get(0):t.getFactory().createMultiPolygon(Tt.toPolygonArray(n))},nn.getGeometry=function(t,n){return n>=t.size()?null:t.get(n)},nn.union=function(t){return new nn(t).union()},nf.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(nn,nf);var Qs=function(){};Qs.prototype.interfaces_=function(){return[]},Qs.prototype.getClass=function(){return Qs},Qs.union=function(t,n){if(t.isEmpty()||n.isEmpty()){if(t.isEmpty()&&n.isEmpty())return xt.createEmptyResult(xt.UNION,t,n,t.getFactory());if(t.isEmpty())return n.copy();if(n.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),qn.overlayOp(t,n,xt.UNION)},o.GeoJSONReader=el,o.GeoJSONWriter=Uh,o.OverlayOp=xt,o.UnionOp=Qs,o.BufferOp=wn,Object.defineProperty(o,"__esModule",{value:!0})})});var _0=ct((c6,v0)=>{v0.exports=function(e,r){return e[0]=r[0],e[1]=r[1],e}});var M0=ct((h6,E0)=>{var x0=_0();E0.exports=function(o,e){Array.isArray(e)||(e=[]),o.length>0&&e.push(x0([0,0],o[0]));for(var r=0;r<o.length-1;r++){var a=o[r],u=o[r+1],c=a[0],h=a[1],p=u[0],d=u[1],g=[.75*c+.25*p,.75*h+.25*d],v=[.25*c+.75*p,.25*h+.75*d];e.push(g),e.push(v)}return o.length>1&&e.push(x0([0,0],o[o.length-1])),e}});var ki=ln(xf(),1);var Jf="169";var Ef=0,Mf=1,wf=2,Sf=3,bf=4,Af=5,Tf=6,Cf=7;var Kf=300;var If=1e3,Fa=1001,Pf=1002;var H0=1006;var q0=1008;var W0=1009;var X0=1023;var Va=2300,Sl=2301,gl=2302,Rf=2400,Nf=2401,Lf=2402;var Qf="",po="srgb",zl="srgb-linear",Y0="display-p3",jf="display-p3-linear",bl="linear",Df="srgb",Of="rec709",Ff="p3";var Ua=2e3,Uf=2001,Ha=class{addEventListener(e,r){this._listeners===void 0&&(this._listeners={});let a=this._listeners;a[e]===void 0&&(a[e]=[]),a[e].indexOf(r)===-1&&a[e].push(r)}hasEventListener(e,r){if(this._listeners===void 0)return!1;let a=this._listeners;return a[e]!==void 0&&a[e].indexOf(r)!==-1}removeEventListener(e,r){if(this._listeners===void 0)return;let u=this._listeners[e];if(u!==void 0){let c=u.indexOf(r);c!==-1&&u.splice(c,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let a=this._listeners[e.type];if(a!==void 0){e.target=this;let u=a.slice(0);for(let c=0,h=u.length;c<h;c++)u[c].call(this,e);e.target=null}}},mr=["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 IS=Math.PI/180,PS=180/Math.PI;function kl(){let o=Math.random()*4294967295|0,e=Math.random()*4294967295|0,r=Math.random()*4294967295|0,a=Math.random()*4294967295|0;return(mr[o&255]+mr[o>>8&255]+mr[o>>16&255]+mr[o>>24&255]+"-"+mr[e&255]+mr[e>>8&255]+"-"+mr[e>>16&15|64]+mr[e>>24&255]+"-"+mr[r&63|128]+mr[r>>8&255]+"-"+mr[r>>16&255]+mr[r>>24&255]+mr[a&255]+mr[a>>8&255]+mr[a>>16&255]+mr[a>>24&255]).toLowerCase()}function Fr(o,e,r){return Math.max(e,Math.min(r,o))}function $0(o,e){return(o%e+e)%e}function yl(o,e,r){return(1-r)*o+r*e}var br=class o{constructor(e=0,r=0){o.prototype.isVector2=!0,this.x=e,this.y=r}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,r){return this.x=e,this.y=r,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,r){switch(e){case 0:this.x=r;break;case 1:this.y=r;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,r){return this.x=e.x+r.x,this.y=e.y+r.y,this}addScaledVector(e,r){return this.x+=e.x*r,this.y+=e.y*r,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,r){return this.x=e.x-r.x,this.y=e.y-r.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let r=this.x,a=this.y,u=e.elements;return this.x=u[0]*r+u[3]*a+u[6],this.y=u[1]*r+u[4]*a+u[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,r){return this.x=Math.max(e.x,Math.min(r.x,this.x)),this.y=Math.max(e.y,Math.min(r.y,this.y)),this}clampScalar(e,r){return this.x=Math.max(e,Math.min(r,this.x)),this.y=Math.max(e,Math.min(r,this.y)),this}clampLength(e,r){let a=this.length();return this.divideScalar(a||1).multiplyScalar(Math.max(e,Math.min(r,a)))}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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){let r=Math.sqrt(this.lengthSq()*e.lengthSq());if(r===0)return Math.PI/2;let a=this.dot(e)/r;return Math.acos(Fr(a,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let r=this.x-e.x,a=this.y-e.y;return r*r+a*a}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,r){return this.x+=(e.x-this.x)*r,this.y+=(e.y-this.y)*r,this}lerpVectors(e,r,a){return this.x=e.x+(r.x-e.x)*a,this.y=e.y+(r.y-e.y)*a,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,r=0){return this.x=e[r],this.y=e[r+1],this}toArray(e=[],r=0){return e[r]=this.x,e[r+1]=this.y,e}fromBufferAttribute(e,r){return this.x=e.getX(r),this.y=e.getY(r),this}rotateAround(e,r){let a=Math.cos(r),u=Math.sin(r),c=this.x-e.x,h=this.y-e.y;return this.x=c*a-h*u+e.x,this.y=c*u+h*a+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Dt=class o{constructor(e,r,a,u,c,h,p,d,g){o.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,r,a,u,c,h,p,d,g)}set(e,r,a,u,c,h,p,d,g){let v=this.elements;return v[0]=e,v[1]=u,v[2]=p,v[3]=r,v[4]=c,v[5]=d,v[6]=a,v[7]=h,v[8]=g,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let r=this.elements,a=e.elements;return r[0]=a[0],r[1]=a[1],r[2]=a[2],r[3]=a[3],r[4]=a[4],r[5]=a[5],r[6]=a[6],r[7]=a[7],r[8]=a[8],this}extractBasis(e,r,a){return e.setFromMatrix3Column(this,0),r.setFromMatrix3Column(this,1),a.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let r=e.elements;return this.set(r[0],r[4],r[8],r[1],r[5],r[9],r[2],r[6],r[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,r){let a=e.elements,u=r.elements,c=this.elements,h=a[0],p=a[3],d=a[6],g=a[1],v=a[4],x=a[7],M=a[2],w=a[5],I=a[8],D=u[0],b=u[3],T=u[6],L=u[1],P=u[4],z=u[7],k=u[2],Y=u[5],q=u[8];return c[0]=h*D+p*L+d*k,c[3]=h*b+p*P+d*Y,c[6]=h*T+p*z+d*q,c[1]=g*D+v*L+x*k,c[4]=g*b+v*P+x*Y,c[7]=g*T+v*z+x*q,c[2]=M*D+w*L+I*k,c[5]=M*b+w*P+I*Y,c[8]=M*T+w*z+I*q,this}multiplyScalar(e){let r=this.elements;return r[0]*=e,r[3]*=e,r[6]*=e,r[1]*=e,r[4]*=e,r[7]*=e,r[2]*=e,r[5]*=e,r[8]*=e,this}determinant(){let e=this.elements,r=e[0],a=e[1],u=e[2],c=e[3],h=e[4],p=e[5],d=e[6],g=e[7],v=e[8];return r*h*v-r*p*g-a*c*v+a*p*d+u*c*g-u*h*d}invert(){let e=this.elements,r=e[0],a=e[1],u=e[2],c=e[3],h=e[4],p=e[5],d=e[6],g=e[7],v=e[8],x=v*h-p*g,M=p*d-v*c,w=g*c-h*d,I=r*x+a*M+u*w;if(I===0)return this.set(0,0,0,0,0,0,0,0,0);let D=1/I;return e[0]=x*D,e[1]=(u*g-v*a)*D,e[2]=(p*a-u*h)*D,e[3]=M*D,e[4]=(v*r-u*d)*D,e[5]=(u*c-p*r)*D,e[6]=w*D,e[7]=(a*d-g*r)*D,e[8]=(h*r-a*c)*D,this}transpose(){let e,r=this.elements;return e=r[1],r[1]=r[3],r[3]=e,e=r[2],r[2]=r[6],r[6]=e,e=r[5],r[5]=r[7],r[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let r=this.elements;return e[0]=r[0],e[1]=r[3],e[2]=r[6],e[3]=r[1],e[4]=r[4],e[5]=r[7],e[6]=r[2],e[7]=r[5],e[8]=r[8],this}setUvTransform(e,r,a,u,c,h,p){let d=Math.cos(c),g=Math.sin(c);return this.set(a*d,a*g,-a*(d*h+g*p)+h+e,-u*g,u*d,-u*(-g*h+d*p)+p+r,0,0,1),this}scale(e,r){return this.premultiply(vl.makeScale(e,r)),this}rotate(e){return this.premultiply(vl.makeRotation(-e)),this}translate(e,r){return this.premultiply(vl.makeTranslation(e,r)),this}makeTranslation(e,r){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,r,0,0,1),this}makeRotation(e){let r=Math.cos(e),a=Math.sin(e);return this.set(r,-a,0,a,r,0,0,0,1),this}makeScale(e,r){return this.set(e,0,0,0,r,0,0,0,1),this}equals(e){let r=this.elements,a=e.elements;for(let u=0;u<9;u++)if(r[u]!==a[u])return!1;return!0}fromArray(e,r=0){for(let a=0;a<9;a++)this.elements[a]=e[a+r];return this}toArray(e=[],r=0){let a=this.elements;return e[r]=a[0],e[r+1]=a[1],e[r+2]=a[2],e[r+3]=a[3],e[r+4]=a[4],e[r+5]=a[5],e[r+6]=a[6],e[r+7]=a[7],e[r+8]=a[8],e}clone(){return new this.constructor().fromArray(this.elements)}},vl=new Dt;function Bf(o){return document.createElementNS("http://www.w3.org/1999/xhtml",o)}var zf=new Dt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),kf=new Dt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),ta={[zl]:{transfer:bl,primaries:Of,luminanceCoefficients:[.2126,.7152,.0722],toReference:o=>o,fromReference:o=>o},[po]:{transfer:Df,primaries:Of,luminanceCoefficients:[.2126,.7152,.0722],toReference:o=>o.convertSRGBToLinear(),fromReference:o=>o.convertLinearToSRGB()},[jf]:{transfer:bl,primaries:Ff,luminanceCoefficients:[.2289,.6917,.0793],toReference:o=>o.applyMatrix3(kf),fromReference:o=>o.applyMatrix3(zf)},[Y0]:{transfer:Df,primaries:Ff,luminanceCoefficients:[.2289,.6917,.0793],toReference:o=>o.convertSRGBToLinear().applyMatrix3(kf),fromReference:o=>o.applyMatrix3(zf).convertLinearToSRGB()}},Z0=new Set([zl,jf]),Mi={enabled:!0,_workingColorSpace:zl,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(o){if(!Z0.has(o))throw new Error(`Unsupported working color space, "${o}".`);this._workingColorSpace=o},convert:function(o,e,r){if(this.enabled===!1||e===r||!e||!r)return o;let a=ta[e].toReference,u=ta[r].fromReference;return u(a(o))},fromWorkingColorSpace:function(o,e){return this.convert(o,this._workingColorSpace,e)},toWorkingColorSpace:function(o,e){return this.convert(o,e,this._workingColorSpace)},getPrimaries:function(o){return ta[o].primaries},getTransfer:function(o){return o===Qf?bl:ta[o].transfer},getLuminanceCoefficients:function(o,e=this._workingColorSpace){return o.fromArray(ta[e].luminanceCoefficients)}};function fs(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function _l(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}var as,Al=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let r;if(e instanceof HTMLCanvasElement)r=e;else{as===void 0&&(as=Bf("canvas")),as.width=e.width,as.height=e.height;let a=as.getContext("2d");e instanceof ImageData?a.putImageData(e,0,0):a.drawImage(e,0,0,e.width,e.height),r=as}return r.width>2048||r.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),r.toDataURL("image/jpeg",.6)):r.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){let r=Bf("canvas");r.width=e.width,r.height=e.height;let a=r.getContext("2d");a.drawImage(e,0,0,e.width,e.height);let u=a.getImageData(0,0,e.width,e.height),c=u.data;for(let h=0;h<c.length;h++)c[h]=fs(c[h]/255)*255;return a.putImageData(u,0,0),r}else if(e.data){let r=e.data.slice(0);for(let a=0;a<r.length;a++)r instanceof Uint8Array||r instanceof Uint8ClampedArray?r[a]=Math.floor(fs(r[a]/255)*255):r[a]=fs(r[a]);return{data:r,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},J0=0,Tl=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:J0++}),this.uuid=kl(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let r=e===void 0||typeof e=="string";if(!r&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let a={uuid:this.uuid,url:""},u=this.data;if(u!==null){let c;if(Array.isArray(u)){c=[];for(let h=0,p=u.length;h<p;h++)u[h].isDataTexture?c.push(xl(u[h].image)):c.push(xl(u[h]))}else c=xl(u);a.url=c}return r||(e.images[this.uuid]=a),a}};function xl(o){return typeof HTMLImageElement!="undefined"&&o instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&o instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&o instanceof ImageBitmap?Al.getDataURL(o):o.data?{data:Array.from(o.data),width:o.width,height:o.height,type:o.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var K0=0,na=class o extends Ha{constructor(e=o.DEFAULT_IMAGE,r=o.DEFAULT_MAPPING,a=Fa,u=Fa,c=H0,h=q0,p=X0,d=W0,g=o.DEFAULT_ANISOTROPY,v=Qf){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:K0++}),this.uuid=kl(),this.name="",this.source=new Tl(e),this.mipmaps=[],this.mapping=r,this.channel=0,this.wrapS=a,this.wrapT=u,this.magFilter=c,this.minFilter=h,this.anisotropy=g,this.format=p,this.internalFormat=null,this.type=d,this.offset=new br(0,0),this.repeat=new br(1,1),this.center=new br(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Dt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=v,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}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(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){let r=e===void 0||typeof e=="string";if(!r&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let a={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).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&&(a.userData=this.userData),r||(e.textures[this.uuid]=a),a}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Kf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case If:e.x=e.x-Math.floor(e.x);break;case Fa:e.x=e.x<0?0:1;break;case Pf:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case If:e.y=e.y-Math.floor(e.y);break;case Fa:e.y=e.y<0?0:1;break;case Pf:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};na.DEFAULT_IMAGE=null;na.DEFAULT_MAPPING=Kf;na.DEFAULT_ANISOTROPY=1;var go=class{constructor(e=0,r=0,a=0,u=1){this.isQuaternion=!0,this._x=e,this._y=r,this._z=a,this._w=u}static slerpFlat(e,r,a,u,c,h,p){let d=a[u+0],g=a[u+1],v=a[u+2],x=a[u+3],M=c[h+0],w=c[h+1],I=c[h+2],D=c[h+3];if(p===0){e[r+0]=d,e[r+1]=g,e[r+2]=v,e[r+3]=x;return}if(p===1){e[r+0]=M,e[r+1]=w,e[r+2]=I,e[r+3]=D;return}if(x!==D||d!==M||g!==w||v!==I){let b=1-p,T=d*M+g*w+v*I+x*D,L=T>=0?1:-1,P=1-T*T;if(P>Number.EPSILON){let k=Math.sqrt(P),Y=Math.atan2(k,T*L);b=Math.sin(b*Y)/k,p=Math.sin(p*Y)/k}let z=p*L;if(d=d*b+M*z,g=g*b+w*z,v=v*b+I*z,x=x*b+D*z,b===1-p){let k=1/Math.sqrt(d*d+g*g+v*v+x*x);d*=k,g*=k,v*=k,x*=k}}e[r]=d,e[r+1]=g,e[r+2]=v,e[r+3]=x}static multiplyQuaternionsFlat(e,r,a,u,c,h){let p=a[u],d=a[u+1],g=a[u+2],v=a[u+3],x=c[h],M=c[h+1],w=c[h+2],I=c[h+3];return e[r]=p*I+v*x+d*w-g*M,e[r+1]=d*I+v*M+g*x-p*w,e[r+2]=g*I+v*w+p*M-d*x,e[r+3]=v*I-p*x-d*M-g*w,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,r,a,u){return this._x=e,this._y=r,this._z=a,this._w=u,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,r=!0){let a=e._x,u=e._y,c=e._z,h=e._order,p=Math.cos,d=Math.sin,g=p(a/2),v=p(u/2),x=p(c/2),M=d(a/2),w=d(u/2),I=d(c/2);switch(h){case"XYZ":this._x=M*v*x+g*w*I,this._y=g*w*x-M*v*I,this._z=g*v*I+M*w*x,this._w=g*v*x-M*w*I;break;case"YXZ":this._x=M*v*x+g*w*I,this._y=g*w*x-M*v*I,this._z=g*v*I-M*w*x,this._w=g*v*x+M*w*I;break;case"ZXY":this._x=M*v*x-g*w*I,this._y=g*w*x+M*v*I,this._z=g*v*I+M*w*x,this._w=g*v*x-M*w*I;break;case"ZYX":this._x=M*v*x-g*w*I,this._y=g*w*x+M*v*I,this._z=g*v*I-M*w*x,this._w=g*v*x+M*w*I;break;case"YZX":this._x=M*v*x+g*w*I,this._y=g*w*x+M*v*I,this._z=g*v*I-M*w*x,this._w=g*v*x-M*w*I;break;case"XZY":this._x=M*v*x-g*w*I,this._y=g*w*x-M*v*I,this._z=g*v*I+M*w*x,this._w=g*v*x+M*w*I;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+h)}return r===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,r){let a=r/2,u=Math.sin(a);return this._x=e.x*u,this._y=e.y*u,this._z=e.z*u,this._w=Math.cos(a),this._onChangeCallback(),this}setFromRotationMatrix(e){let r=e.elements,a=r[0],u=r[4],c=r[8],h=r[1],p=r[5],d=r[9],g=r[2],v=r[6],x=r[10],M=a+p+x;if(M>0){let w=.5/Math.sqrt(M+1);this._w=.25/w,this._x=(v-d)*w,this._y=(c-g)*w,this._z=(h-u)*w}else if(a>p&&a>x){let w=2*Math.sqrt(1+a-p-x);this._w=(v-d)/w,this._x=.25*w,this._y=(u+h)/w,this._z=(c+g)/w}else if(p>x){let w=2*Math.sqrt(1+p-a-x);this._w=(c-g)/w,this._x=(u+h)/w,this._y=.25*w,this._z=(d+v)/w}else{let w=2*Math.sqrt(1+x-a-p);this._w=(h-u)/w,this._x=(c+g)/w,this._y=(d+v)/w,this._z=.25*w}return this._onChangeCallback(),this}setFromUnitVectors(e,r){let a=e.dot(r)+1;return a<Number.EPSILON?(a=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=a):(this._x=0,this._y=-e.z,this._z=e.y,this._w=a)):(this._x=e.y*r.z-e.z*r.y,this._y=e.z*r.x-e.x*r.z,this._z=e.x*r.y-e.y*r.x,this._w=a),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Fr(this.dot(e),-1,1)))}rotateTowards(e,r){let a=this.angleTo(e);if(a===0)return this;let u=Math.min(1,r/a);return this.slerp(e,u),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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,r){let a=e._x,u=e._y,c=e._z,h=e._w,p=r._x,d=r._y,g=r._z,v=r._w;return this._x=a*v+h*p+u*g-c*d,this._y=u*v+h*d+c*p-a*g,this._z=c*v+h*g+a*d-u*p,this._w=h*v-a*p-u*d-c*g,this._onChangeCallback(),this}slerp(e,r){if(r===0)return this;if(r===1)return this.copy(e);let a=this._x,u=this._y,c=this._z,h=this._w,p=h*e._w+a*e._x+u*e._y+c*e._z;if(p<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,p=-p):this.copy(e),p>=1)return this._w=h,this._x=a,this._y=u,this._z=c,this;let d=1-p*p;if(d<=Number.EPSILON){let w=1-r;return this._w=w*h+r*this._w,this._x=w*a+r*this._x,this._y=w*u+r*this._y,this._z=w*c+r*this._z,this.normalize(),this}let g=Math.sqrt(d),v=Math.atan2(g,p),x=Math.sin((1-r)*v)/g,M=Math.sin(r*v)/g;return this._w=h*x+this._w*M,this._x=a*x+this._x*M,this._y=u*x+this._y*M,this._z=c*x+this._z*M,this._onChangeCallback(),this}slerpQuaternions(e,r,a){return this.copy(e).slerp(r,a)}random(){let e=2*Math.PI*Math.random(),r=2*Math.PI*Math.random(),a=Math.random(),u=Math.sqrt(1-a),c=Math.sqrt(a);return this.set(u*Math.sin(e),u*Math.cos(e),c*Math.sin(r),c*Math.cos(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,r=0){return this._x=e[r],this._y=e[r+1],this._z=e[r+2],this._w=e[r+3],this._onChangeCallback(),this}toArray(e=[],r=0){return e[r]=this._x,e[r+1]=this._y,e[r+2]=this._z,e[r+3]=this._w,e}fromBufferAttribute(e,r){return this._x=e.getX(r),this._y=e.getY(r),this._z=e.getZ(r),this._w=e.getW(r),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Pe=class o{constructor(e=0,r=0,a=0){o.prototype.isVector3=!0,this.x=e,this.y=r,this.z=a}set(e,r,a){return a===void 0&&(a=this.z),this.x=e,this.y=r,this.z=a,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,r){switch(e){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,r){return this.x=e.x+r.x,this.y=e.y+r.y,this.z=e.z+r.z,this}addScaledVector(e,r){return this.x+=e.x*r,this.y+=e.y*r,this.z+=e.z*r,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,r){return this.x=e.x-r.x,this.y=e.y-r.y,this.z=e.z-r.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,r){return this.x=e.x*r.x,this.y=e.y*r.y,this.z=e.z*r.z,this}applyEuler(e){return this.applyQuaternion(Gf.setFromEuler(e))}applyAxisAngle(e,r){return this.applyQuaternion(Gf.setFromAxisAngle(e,r))}applyMatrix3(e){let r=this.x,a=this.y,u=this.z,c=e.elements;return this.x=c[0]*r+c[3]*a+c[6]*u,this.y=c[1]*r+c[4]*a+c[7]*u,this.z=c[2]*r+c[5]*a+c[8]*u,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let r=this.x,a=this.y,u=this.z,c=e.elements,h=1/(c[3]*r+c[7]*a+c[11]*u+c[15]);return this.x=(c[0]*r+c[4]*a+c[8]*u+c[12])*h,this.y=(c[1]*r+c[5]*a+c[9]*u+c[13])*h,this.z=(c[2]*r+c[6]*a+c[10]*u+c[14])*h,this}applyQuaternion(e){let r=this.x,a=this.y,u=this.z,c=e.x,h=e.y,p=e.z,d=e.w,g=2*(h*u-p*a),v=2*(p*r-c*u),x=2*(c*a-h*r);return this.x=r+d*g+h*x-p*v,this.y=a+d*v+p*g-c*x,this.z=u+d*x+c*v-h*g,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let r=this.x,a=this.y,u=this.z,c=e.elements;return this.x=c[0]*r+c[4]*a+c[8]*u,this.y=c[1]*r+c[5]*a+c[9]*u,this.z=c[2]*r+c[6]*a+c[10]*u,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,r){return this.x=Math.max(e.x,Math.min(r.x,this.x)),this.y=Math.max(e.y,Math.min(r.y,this.y)),this.z=Math.max(e.z,Math.min(r.z,this.z)),this}clampScalar(e,r){return this.x=Math.max(e,Math.min(r,this.x)),this.y=Math.max(e,Math.min(r,this.y)),this.z=Math.max(e,Math.min(r,this.z)),this}clampLength(e,r){let a=this.length();return this.divideScalar(a||1).multiplyScalar(Math.max(e,Math.min(r,a)))}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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,r){return this.x+=(e.x-this.x)*r,this.y+=(e.y-this.y)*r,this.z+=(e.z-this.z)*r,this}lerpVectors(e,r,a){return this.x=e.x+(r.x-e.x)*a,this.y=e.y+(r.y-e.y)*a,this.z=e.z+(r.z-e.z)*a,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,r){let a=e.x,u=e.y,c=e.z,h=r.x,p=r.y,d=r.z;return this.x=u*d-c*p,this.y=c*h-a*d,this.z=a*p-u*h,this}projectOnVector(e){let r=e.lengthSq();if(r===0)return this.set(0,0,0);let a=e.dot(this)/r;return this.copy(e).multiplyScalar(a)}projectOnPlane(e){return El.copy(this).projectOnVector(e),this.sub(El)}reflect(e){return this.sub(El.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let r=Math.sqrt(this.lengthSq()*e.lengthSq());if(r===0)return Math.PI/2;let a=this.dot(e)/r;return Math.acos(Fr(a,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let r=this.x-e.x,a=this.y-e.y,u=this.z-e.z;return r*r+a*a+u*u}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,r,a){let u=Math.sin(r)*e;return this.x=u*Math.sin(a),this.y=Math.cos(r)*e,this.z=u*Math.cos(a),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,r,a){return this.x=e*Math.sin(r),this.y=a,this.z=e*Math.cos(r),this}setFromMatrixPosition(e){let r=e.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this}setFromMatrixScale(e){let r=this.setFromMatrixColumn(e,0).length(),a=this.setFromMatrixColumn(e,1).length(),u=this.setFromMatrixColumn(e,2).length();return this.x=r,this.y=a,this.z=u,this}setFromMatrixColumn(e,r){return this.fromArray(e.elements,r*4)}setFromMatrix3Column(e,r){return this.fromArray(e.elements,r*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,r=0){return this.x=e[r],this.y=e[r+1],this.z=e[r+2],this}toArray(e=[],r=0){return e[r]=this.x,e[r+1]=this.y,e[r+2]=this.z,e}fromBufferAttribute(e,r){return this.x=e.getX(r),this.y=e.getY(r),this.z=e.getZ(r),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,r=Math.random()*2-1,a=Math.sqrt(1-r*r);return this.x=a*Math.cos(e),this.y=r,this.z=a*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},El=new Pe,Gf=new go;var mo=class o{constructor(e,r,a,u,c,h,p,d,g,v,x,M,w,I,D,b){o.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,r,a,u,c,h,p,d,g,v,x,M,w,I,D,b)}set(e,r,a,u,c,h,p,d,g,v,x,M,w,I,D,b){let T=this.elements;return T[0]=e,T[4]=r,T[8]=a,T[12]=u,T[1]=c,T[5]=h,T[9]=p,T[13]=d,T[2]=g,T[6]=v,T[10]=x,T[14]=M,T[3]=w,T[7]=I,T[11]=D,T[15]=b,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 o().fromArray(this.elements)}copy(e){let r=this.elements,a=e.elements;return r[0]=a[0],r[1]=a[1],r[2]=a[2],r[3]=a[3],r[4]=a[4],r[5]=a[5],r[6]=a[6],r[7]=a[7],r[8]=a[8],r[9]=a[9],r[10]=a[10],r[11]=a[11],r[12]=a[12],r[13]=a[13],r[14]=a[14],r[15]=a[15],this}copyPosition(e){let r=this.elements,a=e.elements;return r[12]=a[12],r[13]=a[13],r[14]=a[14],this}setFromMatrix3(e){let r=e.elements;return this.set(r[0],r[3],r[6],0,r[1],r[4],r[7],0,r[2],r[5],r[8],0,0,0,0,1),this}extractBasis(e,r,a){return e.setFromMatrixColumn(this,0),r.setFromMatrixColumn(this,1),a.setFromMatrixColumn(this,2),this}makeBasis(e,r,a){return this.set(e.x,r.x,a.x,0,e.y,r.y,a.y,0,e.z,r.z,a.z,0,0,0,0,1),this}extractRotation(e){let r=this.elements,a=e.elements,u=1/us.setFromMatrixColumn(e,0).length(),c=1/us.setFromMatrixColumn(e,1).length(),h=1/us.setFromMatrixColumn(e,2).length();return r[0]=a[0]*u,r[1]=a[1]*u,r[2]=a[2]*u,r[3]=0,r[4]=a[4]*c,r[5]=a[5]*c,r[6]=a[6]*c,r[7]=0,r[8]=a[8]*h,r[9]=a[9]*h,r[10]=a[10]*h,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromEuler(e){let r=this.elements,a=e.x,u=e.y,c=e.z,h=Math.cos(a),p=Math.sin(a),d=Math.cos(u),g=Math.sin(u),v=Math.cos(c),x=Math.sin(c);if(e.order==="XYZ"){let M=h*v,w=h*x,I=p*v,D=p*x;r[0]=d*v,r[4]=-d*x,r[8]=g,r[1]=w+I*g,r[5]=M-D*g,r[9]=-p*d,r[2]=D-M*g,r[6]=I+w*g,r[10]=h*d}else if(e.order==="YXZ"){let M=d*v,w=d*x,I=g*v,D=g*x;r[0]=M+D*p,r[4]=I*p-w,r[8]=h*g,r[1]=h*x,r[5]=h*v,r[9]=-p,r[2]=w*p-I,r[6]=D+M*p,r[10]=h*d}else if(e.order==="ZXY"){let M=d*v,w=d*x,I=g*v,D=g*x;r[0]=M-D*p,r[4]=-h*x,r[8]=I+w*p,r[1]=w+I*p,r[5]=h*v,r[9]=D-M*p,r[2]=-h*g,r[6]=p,r[10]=h*d}else if(e.order==="ZYX"){let M=h*v,w=h*x,I=p*v,D=p*x;r[0]=d*v,r[4]=I*g-w,r[8]=M*g+D,r[1]=d*x,r[5]=D*g+M,r[9]=w*g-I,r[2]=-g,r[6]=p*d,r[10]=h*d}else if(e.order==="YZX"){let M=h*d,w=h*g,I=p*d,D=p*g;r[0]=d*v,r[4]=D-M*x,r[8]=I*x+w,r[1]=x,r[5]=h*v,r[9]=-p*v,r[2]=-g*v,r[6]=w*x+I,r[10]=M-D*x}else if(e.order==="XZY"){let M=h*d,w=h*g,I=p*d,D=p*g;r[0]=d*v,r[4]=-x,r[8]=g*v,r[1]=M*x+D,r[5]=h*v,r[9]=w*x-I,r[2]=I*x-w,r[6]=p*v,r[10]=D*x+M}return r[3]=0,r[7]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Q0,e,j0)}lookAt(e,r,a){let u=this.elements;return Xr.subVectors(e,r),Xr.lengthSq()===0&&(Xr.z=1),Xr.normalize(),ho.crossVectors(a,Xr),ho.lengthSq()===0&&(Math.abs(a.z)===1?Xr.x+=1e-4:Xr.z+=1e-4,Xr.normalize(),ho.crossVectors(a,Xr)),ho.normalize(),Ba.crossVectors(Xr,ho),u[0]=ho.x,u[4]=Ba.x,u[8]=Xr.x,u[1]=ho.y,u[5]=Ba.y,u[9]=Xr.y,u[2]=ho.z,u[6]=Ba.z,u[10]=Xr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,r){let a=e.elements,u=r.elements,c=this.elements,h=a[0],p=a[4],d=a[8],g=a[12],v=a[1],x=a[5],M=a[9],w=a[13],I=a[2],D=a[6],b=a[10],T=a[14],L=a[3],P=a[7],z=a[11],k=a[15],Y=u[0],q=u[4],C=u[8],ot=u[12],pt=u[1],dt=u[5],F=u[9],ye=u[13],et=u[2],St=u[6],Pt=u[10],Rt=u[14],it=u[3],mt=u[7],U=u[11],Nt=u[15];return c[0]=h*Y+p*pt+d*et+g*it,c[4]=h*q+p*dt+d*St+g*mt,c[8]=h*C+p*F+d*Pt+g*U,c[12]=h*ot+p*ye+d*Rt+g*Nt,c[1]=v*Y+x*pt+M*et+w*it,c[5]=v*q+x*dt+M*St+w*mt,c[9]=v*C+x*F+M*Pt+w*U,c[13]=v*ot+x*ye+M*Rt+w*Nt,c[2]=I*Y+D*pt+b*et+T*it,c[6]=I*q+D*dt+b*St+T*mt,c[10]=I*C+D*F+b*Pt+T*U,c[14]=I*ot+D*ye+b*Rt+T*Nt,c[3]=L*Y+P*pt+z*et+k*it,c[7]=L*q+P*dt+z*St+k*mt,c[11]=L*C+P*F+z*Pt+k*U,c[15]=L*ot+P*ye+z*Rt+k*Nt,this}multiplyScalar(e){let r=this.elements;return r[0]*=e,r[4]*=e,r[8]*=e,r[12]*=e,r[1]*=e,r[5]*=e,r[9]*=e,r[13]*=e,r[2]*=e,r[6]*=e,r[10]*=e,r[14]*=e,r[3]*=e,r[7]*=e,r[11]*=e,r[15]*=e,this}determinant(){let e=this.elements,r=e[0],a=e[4],u=e[8],c=e[12],h=e[1],p=e[5],d=e[9],g=e[13],v=e[2],x=e[6],M=e[10],w=e[14],I=e[3],D=e[7],b=e[11],T=e[15];return I*(+c*d*x-u*g*x-c*p*M+a*g*M+u*p*w-a*d*w)+D*(+r*d*w-r*g*M+c*h*M-u*h*w+u*g*v-c*d*v)+b*(+r*g*x-r*p*w-c*h*x+a*h*w+c*p*v-a*g*v)+T*(-u*p*v-r*d*x+r*p*M+u*h*x-a*h*M+a*d*v)}transpose(){let e=this.elements,r;return r=e[1],e[1]=e[4],e[4]=r,r=e[2],e[2]=e[8],e[8]=r,r=e[6],e[6]=e[9],e[9]=r,r=e[3],e[3]=e[12],e[12]=r,r=e[7],e[7]=e[13],e[13]=r,r=e[11],e[11]=e[14],e[14]=r,this}setPosition(e,r,a){let u=this.elements;return e.isVector3?(u[12]=e.x,u[13]=e.y,u[14]=e.z):(u[12]=e,u[13]=r,u[14]=a),this}invert(){let e=this.elements,r=e[0],a=e[1],u=e[2],c=e[3],h=e[4],p=e[5],d=e[6],g=e[7],v=e[8],x=e[9],M=e[10],w=e[11],I=e[12],D=e[13],b=e[14],T=e[15],L=x*b*g-D*M*g+D*d*w-p*b*w-x*d*T+p*M*T,P=I*M*g-v*b*g-I*d*w+h*b*w+v*d*T-h*M*T,z=v*D*g-I*x*g+I*p*w-h*D*w-v*p*T+h*x*T,k=I*x*d-v*D*d-I*p*M+h*D*M+v*p*b-h*x*b,Y=r*L+a*P+u*z+c*k;if(Y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let q=1/Y;return e[0]=L*q,e[1]=(D*M*c-x*b*c-D*u*w+a*b*w+x*u*T-a*M*T)*q,e[2]=(p*b*c-D*d*c+D*u*g-a*b*g-p*u*T+a*d*T)*q,e[3]=(x*d*c-p*M*c-x*u*g+a*M*g+p*u*w-a*d*w)*q,e[4]=P*q,e[5]=(v*b*c-I*M*c+I*u*w-r*b*w-v*u*T+r*M*T)*q,e[6]=(I*d*c-h*b*c-I*u*g+r*b*g+h*u*T-r*d*T)*q,e[7]=(h*M*c-v*d*c+v*u*g-r*M*g-h*u*w+r*d*w)*q,e[8]=z*q,e[9]=(I*x*c-v*D*c-I*a*w+r*D*w+v*a*T-r*x*T)*q,e[10]=(h*D*c-I*p*c+I*a*g-r*D*g-h*a*T+r*p*T)*q,e[11]=(v*p*c-h*x*c-v*a*g+r*x*g+h*a*w-r*p*w)*q,e[12]=k*q,e[13]=(v*D*u-I*x*u+I*a*M-r*D*M-v*a*b+r*x*b)*q,e[14]=(I*p*u-h*D*u-I*a*d+r*D*d+h*a*b-r*p*b)*q,e[15]=(h*x*u-v*p*u+v*a*d-r*x*d-h*a*M+r*p*M)*q,this}scale(e){let r=this.elements,a=e.x,u=e.y,c=e.z;return r[0]*=a,r[4]*=u,r[8]*=c,r[1]*=a,r[5]*=u,r[9]*=c,r[2]*=a,r[6]*=u,r[10]*=c,r[3]*=a,r[7]*=u,r[11]*=c,this}getMaxScaleOnAxis(){let e=this.elements,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],a=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],u=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(r,a,u))}makeTranslation(e,r,a){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,r,0,0,1,a,0,0,0,1),this}makeRotationX(e){let r=Math.cos(e),a=Math.sin(e);return this.set(1,0,0,0,0,r,-a,0,0,a,r,0,0,0,0,1),this}makeRotationY(e){let r=Math.cos(e),a=Math.sin(e);return this.set(r,0,a,0,0,1,0,0,-a,0,r,0,0,0,0,1),this}makeRotationZ(e){let r=Math.cos(e),a=Math.sin(e);return this.set(r,-a,0,0,a,r,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,r){let a=Math.cos(r),u=Math.sin(r),c=1-a,h=e.x,p=e.y,d=e.z,g=c*h,v=c*p;return this.set(g*h+a,g*p-u*d,g*d+u*p,0,g*p+u*d,v*p+a,v*d-u*h,0,g*d-u*p,v*d+u*h,c*d*d+a,0,0,0,0,1),this}makeScale(e,r,a){return this.set(e,0,0,0,0,r,0,0,0,0,a,0,0,0,0,1),this}makeShear(e,r,a,u,c,h){return this.set(1,a,c,0,e,1,h,0,r,u,1,0,0,0,0,1),this}compose(e,r,a){let u=this.elements,c=r._x,h=r._y,p=r._z,d=r._w,g=c+c,v=h+h,x=p+p,M=c*g,w=c*v,I=c*x,D=h*v,b=h*x,T=p*x,L=d*g,P=d*v,z=d*x,k=a.x,Y=a.y,q=a.z;return u[0]=(1-(D+T))*k,u[1]=(w+z)*k,u[2]=(I-P)*k,u[3]=0,u[4]=(w-z)*Y,u[5]=(1-(M+T))*Y,u[6]=(b+L)*Y,u[7]=0,u[8]=(I+P)*q,u[9]=(b-L)*q,u[10]=(1-(M+D))*q,u[11]=0,u[12]=e.x,u[13]=e.y,u[14]=e.z,u[15]=1,this}decompose(e,r,a){let u=this.elements,c=us.set(u[0],u[1],u[2]).length(),h=us.set(u[4],u[5],u[6]).length(),p=us.set(u[8],u[9],u[10]).length();this.determinant()<0&&(c=-c),e.x=u[12],e.y=u[13],e.z=u[14],wi.copy(this);let g=1/c,v=1/h,x=1/p;return wi.elements[0]*=g,wi.elements[1]*=g,wi.elements[2]*=g,wi.elements[4]*=v,wi.elements[5]*=v,wi.elements[6]*=v,wi.elements[8]*=x,wi.elements[9]*=x,wi.elements[10]*=x,r.setFromRotationMatrix(wi),a.x=c,a.y=h,a.z=p,this}makePerspective(e,r,a,u,c,h,p=Ua){let d=this.elements,g=2*c/(r-e),v=2*c/(a-u),x=(r+e)/(r-e),M=(a+u)/(a-u),w,I;if(p===Ua)w=-(h+c)/(h-c),I=-2*h*c/(h-c);else if(p===Uf)w=-h/(h-c),I=-h*c/(h-c);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+p);return d[0]=g,d[4]=0,d[8]=x,d[12]=0,d[1]=0,d[5]=v,d[9]=M,d[13]=0,d[2]=0,d[6]=0,d[10]=w,d[14]=I,d[3]=0,d[7]=0,d[11]=-1,d[15]=0,this}makeOrthographic(e,r,a,u,c,h,p=Ua){let d=this.elements,g=1/(r-e),v=1/(a-u),x=1/(h-c),M=(r+e)*g,w=(a+u)*v,I,D;if(p===Ua)I=(h+c)*x,D=-2*x;else if(p===Uf)I=c*x,D=-1*x;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+p);return d[0]=2*g,d[4]=0,d[8]=0,d[12]=-M,d[1]=0,d[5]=2*v,d[9]=0,d[13]=-w,d[2]=0,d[6]=0,d[10]=D,d[14]=-I,d[3]=0,d[7]=0,d[11]=0,d[15]=1,this}equals(e){let r=this.elements,a=e.elements;for(let u=0;u<16;u++)if(r[u]!==a[u])return!1;return!0}fromArray(e,r=0){for(let a=0;a<16;a++)this.elements[a]=e[a+r];return this}toArray(e=[],r=0){let a=this.elements;return e[r]=a[0],e[r+1]=a[1],e[r+2]=a[2],e[r+3]=a[3],e[r+4]=a[4],e[r+5]=a[5],e[r+6]=a[6],e[r+7]=a[7],e[r+8]=a[8],e[r+9]=a[9],e[r+10]=a[10],e[r+11]=a[11],e[r+12]=a[12],e[r+13]=a[13],e[r+14]=a[14],e[r+15]=a[15],e}},us=new Pe,wi=new mo,Q0=new Pe(0,0,0),j0=new Pe(1,1,1),ho=new Pe,Ba=new Pe,Xr=new Pe,Vf=new mo,Hf=new go,qa=class o{constructor(e=0,r=0,a=0,u=o.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=r,this._z=a,this._order=u}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,r,a,u=this._order){return this._x=e,this._y=r,this._z=a,this._order=u,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,r=this._order,a=!0){let u=e.elements,c=u[0],h=u[4],p=u[8],d=u[1],g=u[5],v=u[9],x=u[2],M=u[6],w=u[10];switch(r){case"XYZ":this._y=Math.asin(Fr(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(-v,w),this._z=Math.atan2(-h,c)):(this._x=Math.atan2(M,g),this._z=0);break;case"YXZ":this._x=Math.asin(-Fr(v,-1,1)),Math.abs(v)<.9999999?(this._y=Math.atan2(p,w),this._z=Math.atan2(d,g)):(this._y=Math.atan2(-x,c),this._z=0);break;case"ZXY":this._x=Math.asin(Fr(M,-1,1)),Math.abs(M)<.9999999?(this._y=Math.atan2(-x,w),this._z=Math.atan2(-h,g)):(this._y=0,this._z=Math.atan2(d,c));break;case"ZYX":this._y=Math.asin(-Fr(x,-1,1)),Math.abs(x)<.9999999?(this._x=Math.atan2(M,w),this._z=Math.atan2(d,c)):(this._x=0,this._z=Math.atan2(-h,g));break;case"YZX":this._z=Math.asin(Fr(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(-v,g),this._y=Math.atan2(-x,c)):(this._x=0,this._y=Math.atan2(p,w));break;case"XZY":this._z=Math.asin(-Fr(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(M,g),this._y=Math.atan2(p,c)):(this._x=Math.atan2(-v,w),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+r)}return this._order=r,a===!0&&this._onChangeCallback(),this}setFromQuaternion(e,r,a){return Vf.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Vf,r,a)}setFromVector3(e,r=this._order){return this.set(e.x,e.y,e.z,r)}reorder(e){return Hf.setFromEuler(this),this.setFromQuaternion(Hf,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],r=0){return e[r]=this._x,e[r+1]=this._y,e[r+2]=this._z,e[r+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};qa.DEFAULT_ORDER="XYZ";var Cl=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},ty=0,qf=new Pe,ls=new go,ji=new mo,za=new Pe,ea=new Pe,ey=new Pe,ny=new go,Wf=new Pe(1,0,0),Xf=new Pe(0,1,0),Yf=new Pe(0,0,1),$f={type:"added"},ry={type:"removed"},cs={type:"childadded",child:null},Ml={type:"childremoved",child:null},ra=class o extends Ha{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ty++}),this.uuid=kl(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=o.DEFAULT_UP.clone();let e=new Pe,r=new qa,a=new go,u=new Pe(1,1,1);function c(){a.setFromEuler(r,!1)}function h(){r.setFromQuaternion(a,void 0,!1)}r._onChange(c),a._onChange(h),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:r},quaternion:{configurable:!0,enumerable:!0,value:a},scale:{configurable:!0,enumerable:!0,value:u},modelViewMatrix:{value:new mo},normalMatrix:{value:new Dt}}),this.matrix=new mo,this.matrixWorld=new mo,this.matrixAutoUpdate=o.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=o.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Cl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,r){this.quaternion.setFromAxisAngle(e,r)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,r){return ls.setFromAxisAngle(e,r),this.quaternion.multiply(ls),this}rotateOnWorldAxis(e,r){return ls.setFromAxisAngle(e,r),this.quaternion.premultiply(ls),this}rotateX(e){return this.rotateOnAxis(Wf,e)}rotateY(e){return this.rotateOnAxis(Xf,e)}rotateZ(e){return this.rotateOnAxis(Yf,e)}translateOnAxis(e,r){return qf.copy(e).applyQuaternion(this.quaternion),this.position.add(qf.multiplyScalar(r)),this}translateX(e){return this.translateOnAxis(Wf,e)}translateY(e){return this.translateOnAxis(Xf,e)}translateZ(e){return this.translateOnAxis(Yf,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ji.copy(this.matrixWorld).invert())}lookAt(e,r,a){e.isVector3?za.copy(e):za.set(e,r,a);let u=this.parent;this.updateWorldMatrix(!0,!1),ea.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ji.lookAt(ea,za,this.up):ji.lookAt(za,ea,this.up),this.quaternion.setFromRotationMatrix(ji),u&&(ji.extractRotation(u.matrixWorld),ls.setFromRotationMatrix(ji),this.quaternion.premultiply(ls.invert()))}add(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.add(arguments[r]);return this}return e===this?(console.error("THREE.Object3D.add: object can\'t be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent($f),cs.child=e,this.dispatchEvent(cs),cs.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let a=0;a<arguments.length;a++)this.remove(arguments[a]);return this}let r=this.children.indexOf(e);return r!==-1&&(e.parent=null,this.children.splice(r,1),e.dispatchEvent(ry),Ml.child=e,this.dispatchEvent(Ml),Ml.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ji.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ji.multiply(e.parent.matrixWorld)),e.applyMatrix4(ji),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent($f),cs.child=e,this.dispatchEvent(cs),cs.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,r){if(this[e]===r)return this;for(let a=0,u=this.children.length;a<u;a++){let h=this.children[a].getObjectByProperty(e,r);if(h!==void 0)return h}}getObjectsByProperty(e,r,a=[]){this[e]===r&&a.push(this);let u=this.children;for(let c=0,h=u.length;c<h;c++)u[c].getObjectsByProperty(e,r,a);return a}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ea,e,ey),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ea,ny,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let r=this.matrixWorld.elements;return e.set(r[8],r[9],r[10]).normalize()}raycast(){}traverse(e){e(this);let r=this.children;for(let a=0,u=r.length;a<u;a++)r[a].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let r=this.children;for(let a=0,u=r.length;a<u;a++)r[a].traverseVisible(e)}traverseAncestors(e){let r=this.parent;r!==null&&(e(r),r.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let r=this.children;for(let a=0,u=r.length;a<u;a++)r[a].updateMatrixWorld(e)}updateWorldMatrix(e,r){let a=this.parent;if(e===!0&&a!==null&&a.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),r===!0){let u=this.children;for(let c=0,h=u.length;c<h;c++)u[c].updateWorldMatrix(!1,!0)}}toJSON(e){let r=e===void 0||typeof e=="string",a={};r&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},a.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let u={};u.uuid=this.uuid,u.type=this.type,this.name!==""&&(u.name=this.name),this.castShadow===!0&&(u.castShadow=!0),this.receiveShadow===!0&&(u.receiveShadow=!0),this.visible===!1&&(u.visible=!1),this.frustumCulled===!1&&(u.frustumCulled=!1),this.renderOrder!==0&&(u.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(u.userData=this.userData),u.layers=this.layers.mask,u.matrix=this.matrix.toArray(),u.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(u.matrixAutoUpdate=!1),this.isInstancedMesh&&(u.type="InstancedMesh",u.count=this.count,u.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(u.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(u.type="BatchedMesh",u.perObjectFrustumCulled=this.perObjectFrustumCulled,u.sortObjects=this.sortObjects,u.drawRanges=this._drawRanges,u.reservedRanges=this._reservedRanges,u.visibility=this._visibility,u.active=this._active,u.bounds=this._bounds.map(p=>({boxInitialized:p.boxInitialized,boxMin:p.box.min.toArray(),boxMax:p.box.max.toArray(),sphereInitialized:p.sphereInitialized,sphereRadius:p.sphere.radius,sphereCenter:p.sphere.center.toArray()})),u.maxInstanceCount=this._maxInstanceCount,u.maxVertexCount=this._maxVertexCount,u.maxIndexCount=this._maxIndexCount,u.geometryInitialized=this._geometryInitialized,u.geometryCount=this._geometryCount,u.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(u.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(u.boundingSphere={center:u.boundingSphere.center.toArray(),radius:u.boundingSphere.radius}),this.boundingBox!==null&&(u.boundingBox={min:u.boundingBox.min.toArray(),max:u.boundingBox.max.toArray()}));function c(p,d){return p[d.uuid]===void 0&&(p[d.uuid]=d.toJSON(e)),d.uuid}if(this.isScene)this.background&&(this.background.isColor?u.background=this.background.toJSON():this.background.isTexture&&(u.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(u.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){u.geometry=c(e.geometries,this.geometry);let p=this.geometry.parameters;if(p!==void 0&&p.shapes!==void 0){let d=p.shapes;if(Array.isArray(d))for(let g=0,v=d.length;g<v;g++){let x=d[g];c(e.shapes,x)}else c(e.shapes,d)}}if(this.isSkinnedMesh&&(u.bindMode=this.bindMode,u.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(c(e.skeletons,this.skeleton),u.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let p=[];for(let d=0,g=this.material.length;d<g;d++)p.push(c(e.materials,this.material[d]));u.material=p}else u.material=c(e.materials,this.material);if(this.children.length>0){u.children=[];for(let p=0;p<this.children.length;p++)u.children.push(this.children[p].toJSON(e).object)}if(this.animations.length>0){u.animations=[];for(let p=0;p<this.animations.length;p++){let d=this.animations[p];u.animations.push(c(e.animations,d))}}if(r){let p=h(e.geometries),d=h(e.materials),g=h(e.textures),v=h(e.images),x=h(e.shapes),M=h(e.skeletons),w=h(e.animations),I=h(e.nodes);p.length>0&&(a.geometries=p),d.length>0&&(a.materials=d),g.length>0&&(a.textures=g),v.length>0&&(a.images=v),x.length>0&&(a.shapes=x),M.length>0&&(a.skeletons=M),w.length>0&&(a.animations=w),I.length>0&&(a.nodes=I)}return a.object=u,a;function h(p){let d=[];for(let g in p){let v=p[g];delete v.metadata,d.push(v)}return d}}clone(e){return new this.constructor().copy(this,e)}copy(e,r=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),r===!0)for(let a=0;a<e.children.length;a++){let u=e.children[a];this.add(u.clone())}return this}};ra.DEFAULT_UP=new Pe(0,1,0);ra.DEFAULT_MATRIX_AUTO_UPDATE=!0;ra.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var tp={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},fo={h:0,s:0,l:0},ka={h:0,s:0,l:0};function wl(o,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?o+(e-o)*6*r:r<1/2?e:r<2/3?o+(e-o)*6*(2/3-r):o}var rr=class{constructor(e,r,a){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,r,a)}set(e,r,a){if(r===void 0&&a===void 0){let u=e;u&&u.isColor?this.copy(u):typeof u=="number"?this.setHex(u):typeof u=="string"&&this.setStyle(u)}else this.setRGB(e,r,a);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,r=po){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Mi.toWorkingColorSpace(this,r),this}setRGB(e,r,a,u=Mi.workingColorSpace){return this.r=e,this.g=r,this.b=a,Mi.toWorkingColorSpace(this,u),this}setHSL(e,r,a,u=Mi.workingColorSpace){if(e=$0(e,1),r=Fr(r,0,1),a=Fr(a,0,1),r===0)this.r=this.g=this.b=a;else{let c=a<=.5?a*(1+r):a+r-a*r,h=2*a-c;this.r=wl(h,c,e+1/3),this.g=wl(h,c,e),this.b=wl(h,c,e-1/3)}return Mi.toWorkingColorSpace(this,u),this}setStyle(e,r=po){function a(c){c!==void 0&&parseFloat(c)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let u;if(u=/^(\\w+)\\(([^\\)]*)\\)/.exec(e)){let c,h=u[1],p=u[2];switch(h){case"rgb":case"rgba":if(c=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(p))return a(c[4]),this.setRGB(Math.min(255,parseInt(c[1],10))/255,Math.min(255,parseInt(c[2],10))/255,Math.min(255,parseInt(c[3],10))/255,r);if(c=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(p))return a(c[4]),this.setRGB(Math.min(100,parseInt(c[1],10))/100,Math.min(100,parseInt(c[2],10))/100,Math.min(100,parseInt(c[3],10))/100,r);break;case"hsl":case"hsla":if(c=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(p))return a(c[4]),this.setHSL(parseFloat(c[1])/360,parseFloat(c[2])/100,parseFloat(c[3])/100,r);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(u=/^\\#([A-Fa-f\\d]+)$/.exec(e)){let c=u[1],h=c.length;if(h===3)return this.setRGB(parseInt(c.charAt(0),16)/15,parseInt(c.charAt(1),16)/15,parseInt(c.charAt(2),16)/15,r);if(h===6)return this.setHex(parseInt(c,16),r);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,r);return this}setColorName(e,r=po){let a=tp[e.toLowerCase()];return a!==void 0?this.setHex(a,r):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=fs(e.r),this.g=fs(e.g),this.b=fs(e.b),this}copyLinearToSRGB(e){return this.r=_l(e.r),this.g=_l(e.g),this.b=_l(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=po){return Mi.fromWorkingColorSpace(gr.copy(this),e),Math.round(Fr(gr.r*255,0,255))*65536+Math.round(Fr(gr.g*255,0,255))*256+Math.round(Fr(gr.b*255,0,255))}getHexString(e=po){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,r=Mi.workingColorSpace){Mi.fromWorkingColorSpace(gr.copy(this),r);let a=gr.r,u=gr.g,c=gr.b,h=Math.max(a,u,c),p=Math.min(a,u,c),d,g,v=(p+h)/2;if(p===h)d=0,g=0;else{let x=h-p;switch(g=v<=.5?x/(h+p):x/(2-h-p),h){case a:d=(u-c)/x+(u<c?6:0);break;case u:d=(c-a)/x+2;break;case c:d=(a-u)/x+4;break}d/=6}return e.h=d,e.s=g,e.l=v,e}getRGB(e,r=Mi.workingColorSpace){return Mi.fromWorkingColorSpace(gr.copy(this),r),e.r=gr.r,e.g=gr.g,e.b=gr.b,e}getStyle(e=po){Mi.fromWorkingColorSpace(gr.copy(this),e);let r=gr.r,a=gr.g,u=gr.b;return e!==po?`color(${e} ${r.toFixed(3)} ${a.toFixed(3)} ${u.toFixed(3)})`:`rgb(${Math.round(r*255)},${Math.round(a*255)},${Math.round(u*255)})`}offsetHSL(e,r,a){return this.getHSL(fo),this.setHSL(fo.h+e,fo.s+r,fo.l+a)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,r){return this.r=e.r+r.r,this.g=e.g+r.g,this.b=e.b+r.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,r){return this.r+=(e.r-this.r)*r,this.g+=(e.g-this.g)*r,this.b+=(e.b-this.b)*r,this}lerpColors(e,r,a){return this.r=e.r+(r.r-e.r)*a,this.g=e.g+(r.g-e.g)*a,this.b=e.b+(r.b-e.b)*a,this}lerpHSL(e,r){this.getHSL(fo),e.getHSL(ka);let a=yl(fo.h,ka.h,r),u=yl(fo.s,ka.s,r),c=yl(fo.l,ka.l,r);return this.setHSL(a,u,c),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let r=this.r,a=this.g,u=this.b,c=e.elements;return this.r=c[0]*r+c[3]*a+c[6]*u,this.g=c[1]*r+c[4]*a+c[7]*u,this.b=c[2]*r+c[5]*a+c[8]*u,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,r=0){return this.r=e[r],this.g=e[r+1],this.b=e[r+2],this}toArray(e=[],r=0){return e[r]=this.r,e[r+1]=this.g,e[r+2]=this.b,e}fromBufferAttribute(e,r){return this.r=e.getX(r),this.g=e.getY(r),this.b=e.getZ(r),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},gr=new rr;rr.NAMES=tp;function iy(o){let e={};for(let r in o){e[r]={};for(let a in o[r]){let u=o[r][a];u&&(u.isColor||u.isMatrix3||u.isMatrix4||u.isVector2||u.isVector3||u.isVector4||u.isTexture||u.isQuaternion)?u.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[r][a]=null):e[r][a]=u.clone():Array.isArray(u)?e[r][a]=u.slice():e[r][a]=u}}return e}function Or(o){let e={};for(let r=0;r<o.length;r++){let a=iy(o[r]);for(let u in a)e[u]=a[u]}return e}var oy=`#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif`,sy=`#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`,ay=`#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif`,uy=`#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,ly=`#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif`,cy=`#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif`,hy=`#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\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`,fy=`#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif`,py=`#ifdef USE_BATCHING\n #if ! defined( GL_ANGLE_multi_draw )\n #define gl_DrawID _gl_DrawID\n uniform int _gl_DrawID;\n #endif\n uniform highp sampler2D batchingTexture;\n uniform highp usampler2D batchingIdTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n float getIndirectIndex( const in int i ) {\n int size = textureSize( batchingIdTexture, 0 ).x;\n int x = i % size;\n int y = i / size;\n return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n }\n#endif\n#ifdef USE_BATCHING_COLOR\n uniform sampler2D batchingColorTexture;\n vec3 getBatchingColor( const in float i ) {\n int size = textureSize( batchingColorTexture, 0 ).x;\n int j = int( i );\n int x = j % size;\n int y = j / size;\n return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n }\n#endif`,dy=`#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif`,my=`vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif`,gy=`vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif`,yy=`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`,vy=`#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`,_y=`#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 = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( 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`,xy=`#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\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\n#endif`,Ey=`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif`,My=`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif`,wy=`#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif`,Sy=`#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif`,by=`#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif`,Ay=`#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif`,Ty=`#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_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\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n vColor.xyz *= batchingColor.xyz;\n#endif`,Cy=`#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}\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`,Iy=`#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_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\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`,Py=`vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif`,Ry=`#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif`,Ny=`#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif`,Ly=`#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif`,Dy=`#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif`,Oy="gl_FragColor = linearToOutputTexel( gl_FragColor );",Fy=`\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}`,Uy=`#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, envMapRotation * 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`,By=`#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif`,zy=`#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`,ky=`#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`,Gy=`#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`,Vy=`#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif`,Hy=`#ifdef USE_FOG\n varying float vFogDepth;\n#endif`,qy=`#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`,Wy=`#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`,Xy=`#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}`,Yy=`#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif`,$y=`LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;`,Zy=`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`,Jy=`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 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}\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`,Ky=`#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, envMapRotation * 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, envMapRotation * 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`,Qy=`ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;`,jy=`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`,tv=`BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`,ev=`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`,nv=`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_DISPERSION\n material.dispersion = dispersion;\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 if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\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`,rv=`struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n float dispersion;\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 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = 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 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularDirect += 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 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += 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}`,iv=`\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\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.shadowIntensity, 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.shadowIntensity, 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.shadowIntensity, 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`,ov=`#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`,sv=`#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`,av=`#if defined( USE_LOGDEPTHBUF )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif`,uv=`#if defined( USE_LOGDEPTHBUF )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif`,lv=`#ifdef USE_LOGDEPTHBUF\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif`,cv=`#ifdef USE_LOGDEPTHBUF\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif`,hv=`#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`,fv=`#ifdef USE_MAP\n uniform sampler2D map;\n#endif`,pv=`#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`,dv=`#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`,mv=`float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif`,gv=`#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif`,yv=`#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif`,vv=`#if defined( USE_MORPHCOLORS )\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`,_v=`#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\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#endif`,xv=`#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\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#endif`,Ev=`#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\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#endif`,Mv=`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;`,wv=`#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`,Sv=`#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif`,bv=`#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif`,Av=`#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`,Tv=`#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`,Cv=`#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif`,Iv=`#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`,Pv=`#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`,Rv=`#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif`,Nv=`#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Lv=`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.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in 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( const in 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}`,Dv=`#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif`,Ov=`vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;`,Fv=`#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif`,Uv=`#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`,Bv=`float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif`,zv=`#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif`,kv=`#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 shadowIntensity;\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 shadowIntensity;\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 shadowIntensity;\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 shadowIntensity, 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 mix( 1.0, shadow, shadowIntensity );\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n \n float lightToPositionLength = length( lightToPosition );\n if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\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 shadow = (\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 shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n#endif`,Gv=`#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 shadowIntensity;\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 shadowIntensity;\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 shadowIntensity;\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`,Vv=`#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`,Hv=`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.shadowIntensity, 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.shadowIntensity, 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.shadowIntensity, 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}`,qv=`#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`,Wv=`#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif`,Xv=`#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`,Yv=`#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`,$v=`float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif`,Zv=`#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif`,Jv=`#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif`,Kv=`#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 CineonToneMapping( 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}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }`,Qv=`#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.dispersion, 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`,jv=`#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 dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n \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 \n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n \n #else\n \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 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n \n #endif\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`,t_=`#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`,e_=`#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`,n_=`#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`,r_=`#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_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif`,i_=`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}`,o_=`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}`,s_=`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}`,a_=`#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;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * 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}`,u_=`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}`,l_=`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}`,c_=`#include <common>\n#include <batching_pars_vertex>\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 <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_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}`,h_=`#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 vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\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 #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}`,f_=`#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\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 <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_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}`,p_=`#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 vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\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}`,d_=`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}`,m_=`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}`,g_=`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 <morphinstance_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}`,y_=`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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\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}`,v_=`#include <common>\n#include <batching_pars_vertex>\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 <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_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}`,__=`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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\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}`,x_=`#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\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 <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_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}`,E_=`#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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\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}`,M_=`#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\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 <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_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}`,w_=`#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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\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}`,S_=`#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 <batching_pars_vertex>\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 <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_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}`,b_=`#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 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\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 ), diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}`,A_=`#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\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 <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_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}`,T_=`#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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\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}`,C_=`#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\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 <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_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}`,I_=`#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_DISPERSION\n uniform float dispersion;\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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\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 + sheenSpecularDirect + sheenSpecularIndirect;\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 ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * 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}`,P_=`#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\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 <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_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}`,R_=`#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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\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}`,N_=`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 <morphinstance_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}`,L_=`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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\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}`,D_=`#include <common>\n#include <batching_pars_vertex>\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 <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_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}`,O_=`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}`,F_=`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[ 3 ];\n vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\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}`,U_=`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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\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}`,ve={alphahash_fragment:oy,alphahash_pars_fragment:sy,alphamap_fragment:ay,alphamap_pars_fragment:uy,alphatest_fragment:ly,alphatest_pars_fragment:cy,aomap_fragment:hy,aomap_pars_fragment:fy,batching_pars_vertex:py,batching_vertex:dy,begin_vertex:my,beginnormal_vertex:gy,bsdfs:yy,iridescence_fragment:vy,bumpmap_pars_fragment:_y,clipping_planes_fragment:xy,clipping_planes_pars_fragment:Ey,clipping_planes_pars_vertex:My,clipping_planes_vertex:wy,color_fragment:Sy,color_pars_fragment:by,color_pars_vertex:Ay,color_vertex:Ty,common:Cy,cube_uv_reflection_fragment:Iy,defaultnormal_vertex:Py,displacementmap_pars_vertex:Ry,displacementmap_vertex:Ny,emissivemap_fragment:Ly,emissivemap_pars_fragment:Dy,colorspace_fragment:Oy,colorspace_pars_fragment:Fy,envmap_fragment:Uy,envmap_common_pars_fragment:By,envmap_pars_fragment:zy,envmap_pars_vertex:ky,envmap_physical_pars_fragment:Ky,envmap_vertex:Gy,fog_vertex:Vy,fog_pars_vertex:Hy,fog_fragment:qy,fog_pars_fragment:Wy,gradientmap_pars_fragment:Xy,lightmap_pars_fragment:Yy,lights_lambert_fragment:$y,lights_lambert_pars_fragment:Zy,lights_pars_begin:Jy,lights_toon_fragment:Qy,lights_toon_pars_fragment:jy,lights_phong_fragment:tv,lights_phong_pars_fragment:ev,lights_physical_fragment:nv,lights_physical_pars_fragment:rv,lights_fragment_begin:iv,lights_fragment_maps:ov,lights_fragment_end:sv,logdepthbuf_fragment:av,logdepthbuf_pars_fragment:uv,logdepthbuf_pars_vertex:lv,logdepthbuf_vertex:cv,map_fragment:hv,map_pars_fragment:fv,map_particle_fragment:pv,map_particle_pars_fragment:dv,metalnessmap_fragment:mv,metalnessmap_pars_fragment:gv,morphinstance_vertex:yv,morphcolor_vertex:vv,morphnormal_vertex:_v,morphtarget_pars_vertex:xv,morphtarget_vertex:Ev,normal_fragment_begin:Mv,normal_fragment_maps:wv,normal_pars_fragment:Sv,normal_pars_vertex:bv,normal_vertex:Av,normalmap_pars_fragment:Tv,clearcoat_normal_fragment_begin:Cv,clearcoat_normal_fragment_maps:Iv,clearcoat_pars_fragment:Pv,iridescence_pars_fragment:Rv,opaque_fragment:Nv,packing:Lv,premultiplied_alpha_fragment:Dv,project_vertex:Ov,dithering_fragment:Fv,dithering_pars_fragment:Uv,roughnessmap_fragment:Bv,roughnessmap_pars_fragment:zv,shadowmap_pars_fragment:kv,shadowmap_pars_vertex:Gv,shadowmap_vertex:Vv,shadowmask_pars_fragment:Hv,skinbase_vertex:qv,skinning_pars_vertex:Wv,skinning_vertex:Xv,skinnormal_vertex:Yv,specularmap_fragment:$v,specularmap_pars_fragment:Zv,tonemapping_fragment:Jv,tonemapping_pars_fragment:Kv,transmission_fragment:Qv,transmission_pars_fragment:jv,uv_pars_fragment:t_,uv_pars_vertex:e_,uv_vertex:n_,worldpos_vertex:r_,background_vert:i_,background_frag:o_,backgroundCube_vert:s_,backgroundCube_frag:a_,cube_vert:u_,cube_frag:l_,depth_vert:c_,depth_frag:h_,distanceRGBA_vert:f_,distanceRGBA_frag:p_,equirect_vert:d_,equirect_frag:m_,linedashed_vert:g_,linedashed_frag:y_,meshbasic_vert:v_,meshbasic_frag:__,meshlambert_vert:x_,meshlambert_frag:E_,meshmatcap_vert:M_,meshmatcap_frag:w_,meshnormal_vert:S_,meshnormal_frag:b_,meshphong_vert:A_,meshphong_frag:T_,meshphysical_vert:C_,meshphysical_frag:I_,meshtoon_vert:P_,meshtoon_frag:R_,points_vert:N_,points_frag:L_,shadow_vert:D_,shadow_frag:O_,sprite_vert:F_,sprite_frag:U_},ht={common:{diffuse:{value:new rr(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Dt},alphaMap:{value:null},alphaMapTransform:{value:new Dt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Dt}},envmap:{envMap:{value:null},envMapRotation:{value:new Dt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Dt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Dt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Dt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Dt},normalScale:{value:new br(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Dt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Dt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Dt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Dt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new rr(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 rr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Dt},alphaTest:{value:0},uvTransform:{value:new Dt}},sprite:{diffuse:{value:new rr(16777215)},opacity:{value:1},center:{value:new br(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Dt},alphaMap:{value:null},alphaMapTransform:{value:new Dt},alphaTest:{value:0}}},Zf={basic:{uniforms:Or([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.fog]),vertexShader:ve.meshbasic_vert,fragmentShader:ve.meshbasic_frag},lambert:{uniforms:Or([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new rr(0)}}]),vertexShader:ve.meshlambert_vert,fragmentShader:ve.meshlambert_frag},phong:{uniforms:Or([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new rr(0)},specular:{value:new rr(1118481)},shininess:{value:30}}]),vertexShader:ve.meshphong_vert,fragmentShader:ve.meshphong_frag},standard:{uniforms:Or([ht.common,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.roughnessmap,ht.metalnessmap,ht.fog,ht.lights,{emissive:{value:new rr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ve.meshphysical_vert,fragmentShader:ve.meshphysical_frag},toon:{uniforms:Or([ht.common,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.gradientmap,ht.fog,ht.lights,{emissive:{value:new rr(0)}}]),vertexShader:ve.meshtoon_vert,fragmentShader:ve.meshtoon_frag},matcap:{uniforms:Or([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,{matcap:{value:null}}]),vertexShader:ve.meshmatcap_vert,fragmentShader:ve.meshmatcap_frag},points:{uniforms:Or([ht.points,ht.fog]),vertexShader:ve.points_vert,fragmentShader:ve.points_frag},dashed:{uniforms:Or([ht.common,ht.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ve.linedashed_vert,fragmentShader:ve.linedashed_frag},depth:{uniforms:Or([ht.common,ht.displacementmap]),vertexShader:ve.depth_vert,fragmentShader:ve.depth_frag},normal:{uniforms:Or([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,{opacity:{value:1}}]),vertexShader:ve.meshnormal_vert,fragmentShader:ve.meshnormal_frag},sprite:{uniforms:Or([ht.sprite,ht.fog]),vertexShader:ve.sprite_vert,fragmentShader:ve.sprite_frag},background:{uniforms:{uvTransform:{value:new Dt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ve.background_vert,fragmentShader:ve.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Dt}},vertexShader:ve.backgroundCube_vert,fragmentShader:ve.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ve.cube_vert,fragmentShader:ve.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ve.equirect_vert,fragmentShader:ve.equirect_frag},distanceRGBA:{uniforms:Or([ht.common,ht.displacementmap,{referencePosition:{value:new Pe},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ve.distanceRGBA_vert,fragmentShader:ve.distanceRGBA_frag},shadow:{uniforms:Or([ht.lights,ht.fog,{color:{value:new rr(0)},opacity:{value:1}}]),vertexShader:ve.shadow_vert,fragmentShader:ve.shadow_frag}};Zf.physical={uniforms:Or([Zf.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Dt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Dt},clearcoatNormalScale:{value:new br(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Dt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Dt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Dt},sheen:{value:0},sheenColor:{value:new rr(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Dt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Dt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Dt},transmissionSamplerSize:{value:new br},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Dt},attenuationDistance:{value:0},attenuationColor:{value:new rr(0)},specularColor:{value:new rr(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Dt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Dt},anisotropyVector:{value:new br},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Dt}}]),vertexShader:ve.meshphysical_vert,fragmentShader:ve.meshphysical_frag};var Fo=(1+Math.sqrt(5))/2,hs=1/Fo,RS=[new Pe(-Fo,hs,0),new Pe(Fo,hs,0),new Pe(-hs,0,Fo),new Pe(hs,0,Fo),new Pe(0,Fo,-hs),new Pe(0,Fo,hs),new Pe(-1,1,-1),new Pe(1,1,-1),new Pe(-1,1,1),new Pe(1,1,1)];var NS=new Float32Array(16),LS=new Float32Array(9),DS=new Float32Array(4);var OS={[Ef]:Mf,[wf]:Tf,[bf]:Cf,[Sf]:Af,[Mf]:Ef,[Tf]:wf,[Cf]:bf,[Af]:Sf};function Ga(o,e,r){return!o||!r&&o.constructor===e?o:typeof e.BYTES_PER_ELEMENT=="number"?new e(o):Array.prototype.slice.call(o)}function B_(o){return ArrayBuffer.isView(o)&&!(o instanceof DataView)}var ps=class{constructor(e,r,a,u){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=u!==void 0?u:new r.constructor(a),this.sampleValues=r,this.valueSize=a,this.settings=null,this.DefaultSettings_={}}evaluate(e){let r=this.parameterPositions,a=this._cachedIndex,u=r[a],c=r[a-1];n:{t:{let h;e:{r:if(!(e<u)){for(let p=a+2;;){if(u===void 0){if(e<c)break r;return a=r.length,this._cachedIndex=a,this.copySampleValue_(a-1)}if(a===p)break;if(c=u,u=r[++a],e<u)break t}h=r.length;break e}if(!(e>=c)){let p=r[1];e<p&&(a=2,c=p);for(let d=a-2;;){if(c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(a===d)break;if(u=c,c=r[--a-1],e>=c)break t}h=a,a=0;break e}break n}for(;a<h;){let p=a+h>>>1;e<r[p]?h=p:a=p+1}if(u=r[a],c=r[a-1],c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(u===void 0)return a=r.length,this._cachedIndex=a,this.copySampleValue_(a-1)}this._cachedIndex=a,this.intervalChanged_(a,c,u)}return this.interpolate_(a,c,e,u)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let r=this.resultBuffer,a=this.sampleValues,u=this.valueSize,c=e*u;for(let h=0;h!==u;++h)r[h]=a[c+h];return r}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Il=class extends ps{constructor(e,r,a,u){super(e,r,a,u),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Rf,endingEnd:Rf}}intervalChanged_(e,r,a){let u=this.parameterPositions,c=e-2,h=e+1,p=u[c],d=u[h];if(p===void 0)switch(this.getSettings_().endingStart){case Nf:c=e,p=2*r-a;break;case Lf:c=u.length-2,p=r+u[c]-u[c+1];break;default:c=e,p=a}if(d===void 0)switch(this.getSettings_().endingEnd){case Nf:h=e,d=2*a-r;break;case Lf:h=1,d=a+u[1]-u[0];break;default:h=e-1,d=r}let g=(a-r)*.5,v=this.valueSize;this._weightPrev=g/(r-p),this._weightNext=g/(d-a),this._offsetPrev=c*v,this._offsetNext=h*v}interpolate_(e,r,a,u){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,d=e*p,g=d-p,v=this._offsetPrev,x=this._offsetNext,M=this._weightPrev,w=this._weightNext,I=(a-r)/(u-r),D=I*I,b=D*I,T=-M*b+2*M*D-M*I,L=(1+M)*b+(-1.5-2*M)*D+(-.5+M)*I+1,P=(-1-w)*b+(1.5+w)*D+.5*I,z=w*b-w*D;for(let k=0;k!==p;++k)c[k]=T*h[v+k]+L*h[g+k]+P*h[d+k]+z*h[x+k];return c}},Pl=class extends ps{constructor(e,r,a,u){super(e,r,a,u)}interpolate_(e,r,a,u){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,d=e*p,g=d-p,v=(a-r)/(u-r),x=1-v;for(let M=0;M!==p;++M)c[M]=h[g+M]*x+h[d+M]*v;return c}},Rl=class extends ps{constructor(e,r,a,u){super(e,r,a,u)}interpolate_(e){return this.copySampleValue_(e-1)}},Si=class{constructor(e,r,a,u){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(r===void 0||r.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Ga(r,this.TimeBufferType),this.values=Ga(a,this.ValueBufferType),this.setInterpolation(u||this.DefaultInterpolation)}static toJSON(e){let r=e.constructor,a;if(r.toJSON!==this.toJSON)a=r.toJSON(e);else{a={name:e.name,times:Ga(e.times,Array),values:Ga(e.values,Array)};let u=e.getInterpolation();u!==e.DefaultInterpolation&&(a.interpolation=u)}return a.type=e.ValueTypeName,a}InterpolantFactoryMethodDiscrete(e){return new Rl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Pl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Il(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let r;switch(e){case Va:r=this.InterpolantFactoryMethodDiscrete;break;case Sl:r=this.InterpolantFactoryMethodLinear;break;case gl:r=this.InterpolantFactoryMethodSmooth;break}if(r===void 0){let a="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(a);return console.warn("THREE.KeyframeTrack:",a),this}return this.createInterpolant=r,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Va;case this.InterpolantFactoryMethodLinear:return Sl;case this.InterpolantFactoryMethodSmooth:return gl}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let r=this.times;for(let a=0,u=r.length;a!==u;++a)r[a]+=e}return this}scale(e){if(e!==1){let r=this.times;for(let a=0,u=r.length;a!==u;++a)r[a]*=e}return this}trim(e,r){let a=this.times,u=a.length,c=0,h=u-1;for(;c!==u&&a[c]<e;)++c;for(;h!==-1&&a[h]>r;)--h;if(++h,c!==0||h!==u){c>=h&&(h=Math.max(h,1),c=h-1);let p=this.getValueSize();this.times=a.slice(c,h),this.values=this.values.slice(c*p,h*p)}return this}validate(){let e=!0,r=this.getValueSize();r-Math.floor(r)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let a=this.times,u=this.values,c=a.length;c===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let h=null;for(let p=0;p!==c;p++){let d=a[p];if(typeof d=="number"&&isNaN(d)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,p,d),e=!1;break}if(h!==null&&h>d){console.error("THREE.KeyframeTrack: Out of order keys.",this,p,d,h),e=!1;break}h=d}if(u!==void 0&&B_(u))for(let p=0,d=u.length;p!==d;++p){let g=u[p];if(isNaN(g)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,p,g),e=!1;break}}return e}optimize(){let e=this.times.slice(),r=this.values.slice(),a=this.getValueSize(),u=this.getInterpolation()===gl,c=e.length-1,h=1;for(let p=1;p<c;++p){let d=!1,g=e[p],v=e[p+1];if(g!==v&&(p!==1||g!==e[0]))if(u)d=!0;else{let x=p*a,M=x-a,w=x+a;for(let I=0;I!==a;++I){let D=r[x+I];if(D!==r[M+I]||D!==r[w+I]){d=!0;break}}}if(d){if(p!==h){e[h]=e[p];let x=p*a,M=h*a;for(let w=0;w!==a;++w)r[M+w]=r[x+w]}++h}}if(c>0){e[h]=e[c];for(let p=c*a,d=h*a,g=0;g!==a;++g)r[d+g]=r[p+g];++h}return h!==e.length?(this.times=e.slice(0,h),this.values=r.slice(0,h*a)):(this.times=e,this.values=r),this}clone(){let e=this.times.slice(),r=this.values.slice(),a=this.constructor,u=new a(this.name,e,r);return u.createInterpolant=this.createInterpolant,u}};Si.prototype.TimeBufferType=Float32Array;Si.prototype.ValueBufferType=Float32Array;Si.prototype.DefaultInterpolation=Sl;var Uo=class extends Si{constructor(e,r,a){super(e,r,a)}};Uo.prototype.ValueTypeName="bool";Uo.prototype.ValueBufferType=Array;Uo.prototype.DefaultInterpolation=Va;Uo.prototype.InterpolantFactoryMethodLinear=void 0;Uo.prototype.InterpolantFactoryMethodSmooth=void 0;var Nl=class extends Si{};Nl.prototype.ValueTypeName="color";var Ll=class extends Si{};Ll.prototype.ValueTypeName="number";var Dl=class extends ps{constructor(e,r,a,u){super(e,r,a,u)}interpolate_(e,r,a,u){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,d=(a-r)/(u-r),g=e*p;for(let v=g+p;g!==v;g+=4)go.slerpFlat(c,0,h,g-p,h,g,d);return c}},Wa=class extends Si{InterpolantFactoryMethodLinear(e){return new Dl(this.times,this.values,this.getValueSize(),e)}};Wa.prototype.ValueTypeName="quaternion";Wa.prototype.InterpolantFactoryMethodSmooth=void 0;var Bo=class extends Si{constructor(e,r,a){super(e,r,a)}};Bo.prototype.ValueTypeName="string";Bo.prototype.ValueBufferType=Array;Bo.prototype.DefaultInterpolation=Va;Bo.prototype.InterpolantFactoryMethodLinear=void 0;Bo.prototype.InterpolantFactoryMethodSmooth=void 0;var Ol=class extends Si{};Ol.prototype.ValueTypeName="vector";var Fl=class{constructor(e,r,a){let u=this,c=!1,h=0,p=0,d,g=[];this.onStart=void 0,this.onLoad=e,this.onProgress=r,this.onError=a,this.itemStart=function(v){p++,c===!1&&u.onStart!==void 0&&u.onStart(v,h,p),c=!0},this.itemEnd=function(v){h++,u.onProgress!==void 0&&u.onProgress(v,h,p),h===p&&(c=!1,u.onLoad!==void 0&&u.onLoad())},this.itemError=function(v){u.onError!==void 0&&u.onError(v)},this.resolveURL=function(v){return d?d(v):v},this.setURLModifier=function(v){return d=v,this},this.addHandler=function(v,x){return g.push(v,x),this},this.removeHandler=function(v){let x=g.indexOf(v);return x!==-1&&g.splice(x,2),this},this.getHandler=function(v){for(let x=0,M=g.length;x<M;x+=2){let w=g[x],I=g[x+1];if(w.global&&(w.lastIndex=0),w.test(v))return I}return null}}},z_=new Fl,Ul=class{constructor(e){this.manager=e!==void 0?e:z_,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,r){let a=this;return new Promise(function(u,c){a.load(e,u,r,c)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}};Ul.DEFAULT_MATERIAL_NAME="__DEFAULT";var Gl="\\\\[\\\\]\\\\.:\\\\/",k_=new RegExp("["+Gl+"]","g"),Vl="[^"+Gl+"]",G_="[^"+Gl.replace("\\\\.","")+"]",V_=/((?:WC+[\\/:])*)/.source.replace("WC",Vl),H_=/(WCOD+)?/.source.replace("WCOD",G_),q_=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Vl),W_=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Vl),X_=new RegExp("^"+V_+H_+q_+W_+"$"),Y_=["material","materials","bones","map"],Bl=class{constructor(e,r,a){let u=a||on.parseTrackName(r);this._targetGroup=e,this._bindings=e.subscribe_(r,u)}getValue(e,r){this.bind();let a=this._targetGroup.nCachedObjects_,u=this._bindings[a];u!==void 0&&u.getValue(e,r)}setValue(e,r){let a=this._bindings;for(let u=this._targetGroup.nCachedObjects_,c=a.length;u!==c;++u)a[u].setValue(e,r)}bind(){let e=this._bindings;for(let r=this._targetGroup.nCachedObjects_,a=e.length;r!==a;++r)e[r].bind()}unbind(){let e=this._bindings;for(let r=this._targetGroup.nCachedObjects_,a=e.length;r!==a;++r)e[r].unbind()}},on=class o{constructor(e,r,a){this.path=r,this.parsedPath=a||o.parseTrackName(r),this.node=o.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,r,a){return e&&e.isAnimationObjectGroup?new o.Composite(e,r,a):new o(e,r,a)}static sanitizeNodeName(e){return e.replace(/\\s/g,"_").replace(k_,"")}static parseTrackName(e){let r=X_.exec(e);if(r===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let a={nodeName:r[2],objectName:r[3],objectIndex:r[4],propertyName:r[5],propertyIndex:r[6]},u=a.nodeName&&a.nodeName.lastIndexOf(".");if(u!==void 0&&u!==-1){let c=a.nodeName.substring(u+1);Y_.indexOf(c)!==-1&&(a.nodeName=a.nodeName.substring(0,u),a.objectName=c)}if(a.propertyName===null||a.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return a}static findNode(e,r){if(r===void 0||r===""||r==="."||r===-1||r===e.name||r===e.uuid)return e;if(e.skeleton){let a=e.skeleton.getBoneByName(r);if(a!==void 0)return a}if(e.children){let a=function(c){for(let h=0;h<c.length;h++){let p=c[h];if(p.name===r||p.uuid===r)return p;let d=a(p.children);if(d)return d}return null},u=a(e.children);if(u)return u}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,r){e[r]=this.targetObject[this.propertyName]}_getValue_array(e,r){let a=this.resolvedProperty;for(let u=0,c=a.length;u!==c;++u)e[r++]=a[u]}_getValue_arrayElement(e,r){e[r]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,r){this.resolvedProperty.toArray(e,r)}_setValue_direct(e,r){this.targetObject[this.propertyName]=e[r]}_setValue_direct_setNeedsUpdate(e,r){this.targetObject[this.propertyName]=e[r],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,r){this.targetObject[this.propertyName]=e[r],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,r){let a=this.resolvedProperty;for(let u=0,c=a.length;u!==c;++u)a[u]=e[r++]}_setValue_array_setNeedsUpdate(e,r){let a=this.resolvedProperty;for(let u=0,c=a.length;u!==c;++u)a[u]=e[r++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,r){let a=this.resolvedProperty;for(let u=0,c=a.length;u!==c;++u)a[u]=e[r++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,r){this.resolvedProperty[this.propertyIndex]=e[r]}_setValue_arrayElement_setNeedsUpdate(e,r){this.resolvedProperty[this.propertyIndex]=e[r],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,r){this.resolvedProperty[this.propertyIndex]=e[r],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,r){this.resolvedProperty.fromArray(e,r)}_setValue_fromArray_setNeedsUpdate(e,r){this.resolvedProperty.fromArray(e,r),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,r){this.resolvedProperty.fromArray(e,r),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,r){this.bind(),this.getValue(e,r)}_setValue_unbound(e,r){this.bind(),this.setValue(e,r)}bind(){let e=this.node,r=this.parsedPath,a=r.objectName,u=r.propertyName,c=r.propertyIndex;if(e||(e=o.findNode(this.rootNode,r.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(a){let g=r.objectIndex;switch(a){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let v=0;v<e.length;v++)if(e[v].name===g){g=v;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[a]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[a]}if(g!==void 0){if(e[g]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[g]}}let h=e[u];if(h===void 0){let g=r.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+g+"."+u+" but it wasn\'t found.",e);return}let p=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?p=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(p=this.Versioning.MatrixWorldNeedsUpdate);let d=this.BindingType.Direct;if(c!==void 0){if(u==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[c]!==void 0&&(c=e.morphTargetDictionary[c])}d=this.BindingType.ArrayElement,this.resolvedProperty=h,this.propertyIndex=c}else h.fromArray!==void 0&&h.toArray!==void 0?(d=this.BindingType.HasFromToArray,this.resolvedProperty=h):Array.isArray(h)?(d=this.BindingType.EntireArray,this.resolvedProperty=h):this.propertyName=u;this.getValue=this.GetterByBindingType[d],this.setValue=this.SetterByBindingTypeAndVersioning[d][p]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};on.Composite=Bl;on.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};on.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};on.prototype.GetterByBindingType=[on.prototype._getValue_direct,on.prototype._getValue_array,on.prototype._getValue_arrayElement,on.prototype._getValue_toArray];on.prototype.SetterByBindingTypeAndVersioning=[[on.prototype._setValue_direct,on.prototype._setValue_direct_setNeedsUpdate,on.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[on.prototype._setValue_array,on.prototype._setValue_array_setNeedsUpdate,on.prototype._setValue_array_setMatrixWorldNeedsUpdate],[on.prototype._setValue_arrayElement,on.prototype._setValue_arrayElement_setNeedsUpdate,on.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[on.prototype._setValue_fromArray,on.prototype._setValue_fromArray_setNeedsUpdate,on.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var FS=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Jf}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Jf);var Xn=63710088e-1,zS={centimeters:Xn*100,centimetres:Xn*100,degrees:Xn/111325,feet:Xn*3.28084,inches:Xn*39.37,kilometers:Xn/1e3,kilometres:Xn/1e3,meters:Xn,metres:Xn,miles:Xn/1609.344,millimeters:Xn*1e3,millimetres:Xn*1e3,nauticalmiles:Xn/1852,radians:1,yards:Xn*1.0936},kS={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/Xn,yards:1.0936133};function Ar(o,e,r){r===void 0&&(r={});var a={type:"Feature"};return(r.id===0||r.id)&&(a.id=r.id),r.bbox&&(a.bbox=r.bbox),a.properties=e||{},a.geometry=o,a}function He(o,e,r){if(r===void 0&&(r={}),!o)throw new Error("coordinates is required");if(!Array.isArray(o))throw new Error("coordinates must be an Array");if(o.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Di(o[0])||!Di(o[1]))throw new Error("coordinates must contain numbers");var a={type:"Point",coordinates:o};return Ar(a,e,r)}function sn(o,e,r){r===void 0&&(r={});for(var a=0,u=o;a<u.length;a++){var c=u[a];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<c[c.length-1].length;h++)if(c[c.length-1][h]!==c[0][h])throw new Error("First and last Position are not equivalent.")}var p={type:"Polygon",coordinates:o};return Ar(p,e,r)}function Yn(o,e,r){if(r===void 0&&(r={}),o.length<2)throw new Error("coordinates must be an array of two or more positions");var a={type:"LineString",coordinates:o};return Ar(a,e,r)}function Hl(o,e,r){r===void 0&&(r={});var a={type:"MultiPoint",coordinates:o};return Ar(a,e,r)}function Di(o){return!isNaN(o)&&o!==null&&!Array.isArray(o)}function Nn(o,e,r){if(o!==null)for(var a,u,c,h,p,d,g,v=0,x=0,M,w=o.type,I=w==="FeatureCollection",D=w==="Feature",b=I?o.features.length:1,T=0;T<b;T++){g=I?o.features[T].geometry:D?o.geometry:o,M=g?g.type==="GeometryCollection":!1,p=M?g.geometries.length:1;for(var L=0;L<p;L++){var P=0,z=0;if(h=M?g.geometries[L]:g,h!==null){d=h.coordinates;var k=h.type;switch(v=r&&(k==="Polygon"||k==="MultiPolygon")?1:0,k){case null:break;case"Point":if(e(d,x,T,P,z)===!1)return!1;x++,P++;break;case"LineString":case"MultiPoint":for(a=0;a<d.length;a++){if(e(d[a],x,T,P,z)===!1)return!1;x++,k==="MultiPoint"&&P++}k==="LineString"&&P++;break;case"Polygon":case"MultiLineString":for(a=0;a<d.length;a++){for(u=0;u<d[a].length-v;u++){if(e(d[a][u],x,T,P,z)===!1)return!1;x++}k==="MultiLineString"&&P++,k==="Polygon"&&z++}k==="Polygon"&&P++;break;case"MultiPolygon":for(a=0;a<d.length;a++){for(z=0,u=0;u<d[a].length;u++){for(c=0;c<d[a][u].length-v;c++){if(e(d[a][u][c],x,T,P,z)===!1)return!1;x++}z++}P++}break;case"GeometryCollection":for(a=0;a<h.geometries.length;a++)if(Nn(h.geometries[a],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ep(o,e,r,a){var u=r;return Nn(o,function(c,h,p,d,g){h===0&&r===void 0?u=c:u=e(u,c,h,p,d,g)},a),u}function yo(o,e){var r,a,u,c,h,p,d,g,v,x,M=0,w=o.type==="FeatureCollection",I=o.type==="Feature",D=w?o.features.length:1;for(r=0;r<D;r++){for(p=w?o.features[r].geometry:I?o.geometry:o,g=w?o.features[r].properties:I?o.properties:{},v=w?o.features[r].bbox:I?o.bbox:void 0,x=w?o.features[r].id:I?o.id:void 0,d=p?p.type==="GeometryCollection":!1,h=d?p.geometries.length:1,u=0;u<h;u++){if(c=d?p.geometries[u]:p,c===null){if(e(null,M,g,v,x)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(c,M,g,v,x)===!1)return!1;break}case"GeometryCollection":{for(a=0;a<c.geometries.length;a++)if(e(c.geometries[a],M,g,v,x)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}M++}}function Yr(o,e){yo(o,function(r,a,u,c,h){var p=r===null?null:r.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return e(Ar(r,u,{bbox:c,id:h}),a,0)===!1?!1:void 0}var d;switch(p){case"MultiPoint":d="Point";break;case"MultiLineString":d="LineString";break;case"MultiPolygon":d="Polygon";break}for(var g=0;g<r.coordinates.length;g++){var v=r.coordinates[g],x={type:d,coordinates:v};if(e(Ar(x,u),a,g)===!1)return!1}})}function ql(o){var e=[1/0,1/0,-1/0,-1/0];return Nn(o,function(r){e[0]>r[0]&&(e[0]=r[0]),e[1]>r[1]&&(e[1]=r[1]),e[2]<r[0]&&(e[2]=r[0]),e[3]<r[1]&&(e[3]=r[1])}),e}ql.default=ql;var Tr=ql;function ir(o){if(!o)throw new Error("coord is required");if(!Array.isArray(o)){if(o.type==="Feature"&&o.geometry!==null&&o.geometry.type==="Point")return o.geometry.coordinates;if(o.type==="Point")return o.coordinates}if(Array.isArray(o)&&o.length>=2&&!Array.isArray(o[0])&&!Array.isArray(o[1]))return o;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Wl(o,e,r){if(!o)throw new Error("No feature passed");if(!r)throw new Error(".featureOf() requires a name");if(!o||o.type!=="Feature"||!o.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+o.geometry.type)}function or(o){return o.type==="Feature"?o.geometry:o}var e1=ln(Xa(),1);var h1=ln(_p(),1);function $n(o,e,r){if(r===void 0&&(r={}),!o)throw new Error("point is required");if(!e)throw new Error("polygon is required");var a=ir(o),u=or(e),c=u.type,h=e.bbox,p=u.coordinates;if(h&&f1(a,h)===!1)return!1;c==="Polygon"&&(p=[p]);for(var d=!1,g=0;g<p.length&&!d;g++)if(xp(a,p[g][0],r.ignoreBoundary)){for(var v=!1,x=1;x<p[g].length&&!v;)xp(a,p[g][x],!r.ignoreBoundary)&&(v=!0),x++;v||(d=!0)}return d}function xp(o,e,r){var a=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var u=0,c=e.length-1;u<e.length;c=u++){var h=e[u][0],p=e[u][1],d=e[c][0],g=e[c][1],v=o[1]*(h-d)+p*(d-o[0])+g*(o[0]-h)===0&&(h-o[0])*(d-o[0])<=0&&(p-o[1])*(g-o[1])<=0;if(v)return!r;var x=p>o[1]!=g>o[1]&&o[0]<(d-h)*(o[1]-p)/(g-p)+h;x&&(a=!a)}return a}function f1(o,e){return e[0]<=o[0]&&e[1]<=o[1]&&e[2]>=o[0]&&e[3]>=o[1]}var wp=new ArrayBuffer(16),mA=new Float64Array(wp),gA=new Uint32Array(wp);var T1=ln(ac(),1);var VT=function(){function o(e){this.points=e.points||[],this.duration=e.duration||1e4,this.sharpness=e.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=e.stepLength||60,this.length=this.points.length,this.delay=0;for(var r=0;r<this.length;r++)this.points[r].z=this.points[r].z||0;for(var r=0;r<this.length-1;r++){var a=this.points[r],u=this.points[r+1];this.centers.push({x:(a.x+u.x)/2,y:(a.y+u.y)/2,z:(a.z+u.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var r=0;r<this.centers.length-1;r++){var c=this.points[r+1].x-(this.centers[r].x+this.centers[r+1].x)/2,h=this.points[r+1].y-(this.centers[r].y+this.centers[r+1].y)/2,p=this.points[r+1].z-(this.centers[r].y+this.centers[r+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[r+1].x+this.sharpness*(this.centers[r].x+c),y:(1-this.sharpness)*this.points[r+1].y+this.sharpness*(this.centers[r].y+h),z:(1-this.sharpness)*this.points[r+1].z+this.sharpness*(this.centers[r].z+p)},{x:(1-this.sharpness)*this.points[r+1].x+this.sharpness*(this.centers[r+1].x+c),y:(1-this.sharpness)*this.points[r+1].y+this.sharpness*(this.centers[r+1].y+h),z:(1-this.sharpness)*this.points[r+1].z+this.sharpness*(this.centers[r+1].z+p)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return o.prototype.cacheSteps=function(e){var r=[],a=this.pos(0);r.push(0);for(var u=0;u<this.duration;u+=10){var c=this.pos(u),h=Math.sqrt((c.x-a.x)*(c.x-a.x)+(c.y-a.y)*(c.y-a.y)+(c.z-a.z)*(c.z-a.z));h>e&&(r.push(u),a=c)}return r},o.prototype.vector=function(e){var r=this.pos(e+10),a=this.pos(e-10);return{angle:180*Math.atan2(r.y-a.y,r.x-a.x)/3.14,speed:Math.sqrt((a.x-r.x)*(a.x-r.x)+(a.y-r.y)*(a.y-r.y)+(a.z-r.z)*(a.z-r.z))}},o.prototype.pos=function(e){var r=e-this.delay;r<0&&(r=0),r>this.duration&&(r=this.duration-1);var a=r/this.duration;if(a>=1)return this.points[this.length-1];var u=Math.floor((this.points.length-1)*a),c=(this.length-1)*a-u;return C1(c,this.points[u],this.controls[u][1],this.controls[u+1][0],this.points[u+1])},o}();function C1(o,e,r,a,u){var c=I1(o),h={x:u.x*c[0]+a.x*c[1]+r.x*c[2]+e.x*c[3],y:u.y*c[0]+a.y*c[1]+r.y*c[2]+e.y*c[3],z:u.z*c[0]+a.z*c[1]+r.z*c[2]+e.z*c[3]};return h}function I1(o){var e=o*o,r=e*o;return[r,3*e*(1-o),3*o*(1-o)*(1-o),(1-o)*(1-o)*(1-o)]}function aa(o,e){e===void 0&&(e={});var r=Number(o[0]),a=Number(o[1]),u=Number(o[2]),c=Number(o[3]);if(o.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var h=[r,a],p=[r,c],d=[u,c],g=[u,a];return sn([[h,g,d,p,h]],e.properties,{bbox:o,id:e.id})}function P1(o){return aa(Tr(o))}var uc=P1;var Y1=ln(Dp(),1);var xx=ln(lu(),1);var Mx=ln(Xa(),1);var bx=ln(ac(),1);var Qp=Math.PI/180,jp=180/Math.PI,da=function(o,e){this.lon=o,this.lat=e,this.x=Qp*o,this.y=Qp*e};da.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};da.prototype.antipode=function(){var o=-1*this.lat,e=this.lon<0?180+this.lon:(180-this.lon)*-1;return new da(e,o)};var td=function(){this.coords=[],this.length=0};td.prototype.move_to=function(o){this.length++,this.coords.push(o)};var Cc=function(o){this.properties=o||{},this.geometries=[]};Cc.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 o=[],e=0;e<this.geometries.length;e++)o.push(this.geometries[e].coords);return{geometry:{type:"MultiLineString",coordinates:o},type:"Feature",properties:this.properties}};Cc.prototype.wkt=function(){for(var o="",e="LINESTRING(",r=function(c){e+=c[0]+" "+c[1]+","},a=0;a<this.geometries.length;a++){if(this.geometries[a].coords.length===0)return"LINESTRING(empty)";var u=this.geometries[a].coords;u.forEach(r),o+=e.substring(0,e.length-1)+")"}return o};var ed=function(o,e,r){if(!o||o.x===void 0||o.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!e||e.x===void 0||e.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new da(o.x,o.y),this.end=new da(e.x,e.y),this.properties=r||{};var a=this.start.x-this.end.x,u=this.start.y-this.end.y,c=Math.pow(Math.sin(u/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(a/2),2);if(this.g=2*Math.asin(Math.sqrt(c)),this.g===Math.PI)throw new Error("it appears "+o.view()+" and "+e.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 "+o+" and "+e)};ed.prototype.interpolate=function(o){var e=Math.sin((1-o)*this.g)/Math.sin(this.g),r=Math.sin(o*this.g)/Math.sin(this.g),a=e*Math.cos(this.start.y)*Math.cos(this.start.x)+r*Math.cos(this.end.y)*Math.cos(this.end.x),u=e*Math.cos(this.start.y)*Math.sin(this.start.x)+r*Math.cos(this.end.y)*Math.sin(this.end.x),c=e*Math.sin(this.start.y)+r*Math.sin(this.end.y),h=jp*Math.atan2(c,Math.sqrt(Math.pow(a,2)+Math.pow(u,2))),p=jp*Math.atan2(u,a);return[p,h]};ed.prototype.Arc=function(o,e){var r=[];if(!o||o<=2)r.push([this.start.lon,this.start.lat]),r.push([this.end.lon,this.end.lat]);else for(var a=1/(o-1),u=0;u<o;++u){var c=a*u,h=this.interpolate(c);r.push(h)}for(var p=!1,d=0,g=e&&e.offset?e.offset:10,v=180-g,x=-180+g,M=360-g,w=1;w<r.length;++w){var I=r[w-1][0],D=r[w][0],b=Math.abs(D-I);b>M&&(D>v&&I<x||I>v&&D<x)?p=!0:b>d&&(d=b)}var T=[];if(p&&d<g){var L=[];T.push(L);for(var P=0;P<r.length;++P){var z=parseFloat(r[P][0]);if(P>0&&Math.abs(z-r[P-1][0])>M){var k=parseFloat(r[P-1][0]),Y=parseFloat(r[P-1][1]),q=parseFloat(r[P][0]),C=parseFloat(r[P][1]);if(k>-180&&k<x&&q===180&&P+1<r.length&&r[P-1][0]>-180&&r[P-1][0]<x){L.push([-180,r[P][1]]),P++,L.push([r[P][0],r[P][1]]);continue}else if(k>v&&k<180&&q===-180&&P+1<r.length&&r[P-1][0]>v&&r[P-1][0]<180){L.push([180,r[P][1]]),P++,L.push([r[P][0],r[P][1]]);continue}if(k<x&&q>v){var ot=k;k=q,q=ot;var pt=Y;Y=C,C=pt}if(k>v&&q<x&&(q+=360),k<=180&&q>=180&&k<q){var dt=(180-k)/(q-k),F=dt*C+(1-dt)*Y;L.push([r[P-1][0]>v?180:-180,F]),L=[],L.push([r[P-1][0]>v?-180:180,F]),T.push(L)}else L=[],T.push(L);L.push([z,r[P][1]])}else L.push([r[P][0],r[P][1]])}}else{var ye=[];T.push(ye);for(var et=0;et<r.length;++et)ye.push([r[et][0],r[et][1]])}for(var St=new Cc(this.properties),Pt=0;Pt<T.length;++Pt){var Rt=new td;St.geometries.push(Rt);for(var it=T[Pt],mt=0;mt<it.length;++mt)Rt.move_to(it[mt])}return St};var Cx=ln(lu(),1);var aM=ln(lu(),1);var uM=ln(Jc(),1);var hM=ln(Xa(),1);var Ot=[],Ft=[],Ut=[],Bt=[],zt=[],kt=[],Gt=[],Vt=[],Ht=[],qt=[],Wt=[],Xt=[],Yt=[],$t=[],Zt=[],Jt=[],Kt=[],Qt=[],jt=[],te=[],ee=[],ne=[],re=[],ie=[];Gt[85]=qt[85]=-1;Vt[85]=Wt[85]=0;Ht[85]=Xt[85]=1;jt[85]=ne[85]=1;te[85]=re[85]=0;ee[85]=ie[85]=1;Ot[85]=Bt[85]=0;Ft[85]=zt[85]=-1;Ut[85]=Zt[85]=0;Jt[85]=Yt[85]=0;Kt[85]=$t[85]=1;kt[85]=Qt[85]=1;ne[1]=ne[169]=0;re[1]=re[169]=-1;ie[1]=ie[169]=0;Yt[1]=Yt[169]=-1;$t[1]=$t[169]=0;Zt[1]=Zt[169]=0;qt[4]=qt[166]=0;Wt[4]=Wt[166]=-1;Xt[4]=Xt[166]=1;Jt[4]=Jt[166]=1;Kt[4]=Kt[166]=0;Qt[4]=Qt[166]=0;Gt[16]=Gt[154]=0;Vt[16]=Vt[154]=1;Ht[16]=Ht[154]=1;Bt[16]=Bt[154]=1;zt[16]=zt[154]=0;kt[16]=kt[154]=1;jt[64]=jt[106]=0;te[64]=te[106]=1;ee[64]=ee[106]=0;Ot[64]=Ot[106]=-1;Ft[64]=Ft[106]=0;Ut[64]=Ut[106]=1;jt[2]=jt[168]=0;te[2]=te[168]=-1;ee[2]=ee[168]=1;ne[2]=ne[168]=0;re[2]=re[168]=-1;ie[2]=ie[168]=0;Yt[2]=Yt[168]=-1;$t[2]=$t[168]=0;Zt[2]=Zt[168]=0;Jt[2]=Jt[168]=-1;Kt[2]=Kt[168]=0;Qt[2]=Qt[168]=1;Gt[8]=Gt[162]=0;Vt[8]=Vt[162]=-1;Ht[8]=Ht[162]=0;qt[8]=qt[162]=0;Wt[8]=Wt[162]=-1;Xt[8]=Xt[162]=1;Yt[8]=Yt[162]=1;$t[8]=$t[162]=0;Zt[8]=Zt[162]=1;Jt[8]=Jt[162]=1;Kt[8]=Kt[162]=0;Qt[8]=Qt[162]=0;Gt[32]=Gt[138]=0;Vt[32]=Vt[138]=1;Ht[32]=Ht[138]=1;qt[32]=qt[138]=0;Wt[32]=Wt[138]=1;Xt[32]=Xt[138]=0;Ot[32]=Ot[138]=1;Ft[32]=Ft[138]=0;Ut[32]=Ut[138]=0;Bt[32]=Bt[138]=1;zt[32]=zt[138]=0;kt[32]=kt[138]=1;ne[128]=ne[42]=0;re[128]=re[42]=1;ie[128]=ie[42]=1;jt[128]=jt[42]=0;te[128]=te[42]=1;ee[128]=ee[42]=0;Ot[128]=Ot[42]=-1;Ft[128]=Ft[42]=0;Ut[128]=Ut[42]=1;Bt[128]=Bt[42]=-1;zt[128]=zt[42]=0;kt[128]=kt[42]=0;qt[5]=qt[165]=-1;Wt[5]=Wt[165]=0;Xt[5]=Xt[165]=0;ne[5]=ne[165]=1;re[5]=re[165]=0;ie[5]=ie[165]=0;Jt[20]=Jt[150]=0;Kt[20]=Kt[150]=1;Qt[20]=Qt[150]=1;Bt[20]=Bt[150]=0;zt[20]=zt[150]=-1;kt[20]=kt[150]=1;Gt[80]=Gt[90]=-1;Vt[80]=Vt[90]=0;Ht[80]=Ht[90]=1;jt[80]=jt[90]=1;te[80]=te[90]=0;ee[80]=ee[90]=1;Yt[65]=Yt[105]=0;$t[65]=$t[105]=1;Zt[65]=Zt[105]=0;Ot[65]=Ot[105]=0;Ft[65]=Ft[105]=-1;Ut[65]=Ut[105]=0;Gt[160]=Gt[10]=-1;Vt[160]=Vt[10]=0;Ht[160]=Ht[10]=1;qt[160]=qt[10]=-1;Wt[160]=Wt[10]=0;Xt[160]=Xt[10]=0;ne[160]=ne[10]=1;re[160]=re[10]=0;ie[160]=ie[10]=0;jt[160]=jt[10]=1;te[160]=te[10]=0;ee[160]=ee[10]=1;Jt[130]=Jt[40]=0;Kt[130]=Kt[40]=1;Qt[130]=Qt[40]=1;Yt[130]=Yt[40]=0;$t[130]=$t[40]=1;Zt[130]=Zt[40]=0;Ot[130]=Ot[40]=0;Ft[130]=Ft[40]=-1;Ut[130]=Ut[40]=0;Bt[130]=Bt[40]=0;zt[130]=zt[40]=-1;kt[130]=kt[40]=1;qt[37]=qt[133]=0;Wt[37]=Wt[133]=1;Xt[37]=Xt[133]=1;ne[37]=ne[133]=0;re[37]=re[133]=1;ie[37]=ie[133]=0;Ot[37]=Ot[133]=-1;Ft[37]=Ft[133]=0;Ut[37]=Ut[133]=0;Bt[37]=Bt[133]=1;zt[37]=zt[133]=0;kt[37]=kt[133]=0;Jt[148]=Jt[22]=-1;Kt[148]=Kt[22]=0;Qt[148]=Qt[22]=0;ne[148]=ne[22]=0;re[148]=re[22]=-1;ie[148]=ie[22]=1;jt[148]=jt[22]=0;te[148]=te[22]=1;ee[148]=ee[22]=1;Bt[148]=Bt[22]=-1;zt[148]=zt[22]=0;kt[148]=kt[22]=1;Gt[82]=Gt[88]=0;Vt[82]=Vt[88]=-1;Ht[82]=Ht[88]=1;Jt[82]=Jt[88]=1;Kt[82]=Kt[88]=0;Qt[82]=Qt[88]=1;Yt[82]=Yt[88]=-1;$t[82]=$t[88]=0;Zt[82]=Zt[88]=1;jt[82]=jt[88]=0;te[82]=te[88]=-1;ee[82]=ee[88]=0;Gt[73]=Gt[97]=0;Vt[73]=Vt[97]=1;Ht[73]=Ht[97]=0;qt[73]=qt[97]=0;Wt[73]=Wt[97]=-1;Xt[73]=Xt[97]=0;Yt[73]=Yt[97]=1;$t[73]=$t[97]=0;Zt[73]=Zt[97]=0;Ot[73]=Ot[97]=1;Ft[73]=Ft[97]=0;Ut[73]=Ut[97]=1;Gt[145]=Gt[25]=0;Vt[145]=Vt[25]=-1;Ht[145]=Ht[25]=0;Yt[145]=Yt[25]=1;$t[145]=$t[25]=0;Zt[145]=Zt[25]=1;ne[145]=ne[25]=0;re[145]=re[25]=1;ie[145]=ie[25]=1;Bt[145]=Bt[25]=-1;zt[145]=zt[25]=0;kt[145]=kt[25]=0;qt[70]=qt[100]=0;Wt[70]=Wt[100]=1;Xt[70]=Xt[100]=0;Jt[70]=Jt[100]=-1;Kt[70]=Kt[100]=0;Qt[70]=Qt[100]=1;jt[70]=jt[100]=0;te[70]=te[100]=-1;ee[70]=ee[100]=1;Ot[70]=Ot[100]=1;Ft[70]=Ft[100]=0;Ut[70]=Ut[100]=0;qt[101]=qt[69]=0;Wt[101]=Wt[69]=1;Xt[101]=Xt[69]=0;Ot[101]=Ot[69]=1;Ft[101]=Ft[69]=0;Ut[101]=Ut[69]=0;ne[149]=ne[21]=0;re[149]=re[21]=1;ie[149]=ie[21]=1;Bt[149]=Bt[21]=-1;zt[149]=zt[21]=0;kt[149]=kt[21]=0;Jt[86]=Jt[84]=-1;Kt[86]=Kt[84]=0;Qt[86]=Qt[84]=1;jt[86]=jt[84]=0;te[86]=te[84]=-1;ee[86]=ee[84]=1;Gt[89]=Gt[81]=0;Vt[89]=Vt[81]=-1;Ht[89]=Ht[81]=0;Yt[89]=Yt[81]=1;$t[89]=$t[81]=0;Zt[89]=Zt[81]=1;Gt[96]=Gt[74]=0;Vt[96]=Vt[74]=1;Ht[96]=Ht[74]=0;qt[96]=qt[74]=-1;Wt[96]=Wt[74]=0;Xt[96]=Xt[74]=1;jt[96]=jt[74]=1;te[96]=te[74]=0;ee[96]=ee[74]=0;Ot[96]=Ot[74]=1;Ft[96]=Ft[74]=0;Ut[96]=Ut[74]=1;Gt[24]=Gt[146]=0;Vt[24]=Vt[146]=-1;Ht[24]=Ht[146]=1;Jt[24]=Jt[146]=1;Kt[24]=Kt[146]=0;Qt[24]=Qt[146]=1;Yt[24]=Yt[146]=0;$t[24]=$t[146]=1;Zt[24]=Zt[146]=1;Bt[24]=Bt[146]=0;zt[24]=zt[146]=-1;kt[24]=kt[146]=0;qt[6]=qt[164]=-1;Wt[6]=Wt[164]=0;Xt[6]=Xt[164]=1;Jt[6]=Jt[164]=-1;Kt[6]=Kt[164]=0;Qt[6]=Qt[164]=0;ne[6]=ne[164]=0;re[6]=re[164]=-1;ie[6]=ie[164]=1;jt[6]=jt[164]=1;te[6]=te[164]=0;ee[6]=ee[164]=0;Yt[129]=Yt[41]=0;$t[129]=$t[41]=1;Zt[129]=Zt[41]=1;ne[129]=ne[41]=0;re[129]=re[41]=1;ie[129]=ie[41]=0;Ot[129]=Ot[41]=-1;Ft[129]=Ft[41]=0;Ut[129]=Ut[41]=0;Bt[129]=Bt[41]=0;zt[129]=zt[41]=-1;kt[129]=kt[41]=0;Jt[66]=Jt[104]=0;Kt[66]=Kt[104]=1;Qt[66]=Qt[104]=0;Yt[66]=Yt[104]=-1;$t[66]=$t[104]=0;Zt[66]=Zt[104]=1;jt[66]=jt[104]=0;te[66]=te[104]=-1;ee[66]=ee[104]=0;Ot[66]=Ot[104]=0;Ft[66]=Ft[104]=-1;Ut[66]=Ut[104]=1;Gt[144]=Gt[26]=-1;Vt[144]=Vt[26]=0;Ht[144]=Ht[26]=0;ne[144]=ne[26]=1;re[144]=re[26]=0;ie[144]=ie[26]=1;jt[144]=jt[26]=0;te[144]=te[26]=1;ee[144]=ee[26]=1;Bt[144]=Bt[26]=-1;zt[144]=zt[26]=0;kt[144]=kt[26]=1;qt[36]=qt[134]=0;Wt[36]=Wt[134]=1;Xt[36]=Xt[134]=1;Jt[36]=Jt[134]=0;Kt[36]=Kt[134]=1;Qt[36]=Qt[134]=0;Ot[36]=Ot[134]=0;Ft[36]=Ft[134]=-1;Ut[36]=Ut[134]=1;Bt[36]=Bt[134]=1;zt[36]=zt[134]=0;kt[36]=kt[134]=0;Gt[9]=Gt[161]=-1;Vt[9]=Vt[161]=0;Ht[9]=Ht[161]=0;qt[9]=qt[161]=0;Wt[9]=Wt[161]=-1;Xt[9]=Xt[161]=0;Yt[9]=Yt[161]=1;$t[9]=$t[161]=0;Zt[9]=Zt[161]=0;ne[9]=ne[161]=1;re[9]=re[161]=0;ie[9]=ie[161]=1;Gt[136]=0;Vt[136]=1;Ht[136]=1;qt[136]=0;Wt[136]=1;Xt[136]=0;Jt[136]=-1;Kt[136]=0;Qt[136]=1;Yt[136]=-1;$t[136]=0;Zt[136]=0;ne[136]=0;re[136]=-1;ie[136]=0;jt[136]=0;te[136]=-1;ee[136]=1;Ot[136]=1;Ft[136]=0;Ut[136]=0;Bt[136]=1;zt[136]=0;kt[136]=1;Gt[34]=0;Vt[34]=-1;Ht[34]=0;qt[34]=0;Wt[34]=-1;Xt[34]=1;Jt[34]=1;Kt[34]=0;Qt[34]=0;Yt[34]=1;$t[34]=0;Zt[34]=1;ne[34]=0;re[34]=1;ie[34]=1;jt[34]=0;te[34]=1;ee[34]=0;Ot[34]=-1;Ft[34]=0;Ut[34]=1;Bt[34]=-1;zt[34]=0;kt[34]=0;Gt[35]=0;Vt[35]=1;Ht[35]=1;qt[35]=0;Wt[35]=-1;Xt[35]=1;Jt[35]=1;Kt[35]=0;Qt[35]=0;Yt[35]=-1;$t[35]=0;Zt[35]=0;ne[35]=0;re[35]=-1;ie[35]=0;jt[35]=0;te[35]=1;ee[35]=0;Ot[35]=-1;Ft[35]=0;Ut[35]=1;Bt[35]=1;zt[35]=0;kt[35]=1;Gt[153]=0;Vt[153]=1;Ht[153]=1;Yt[153]=-1;$t[153]=0;Zt[153]=0;ne[153]=0;re[153]=-1;ie[153]=0;Bt[153]=1;zt[153]=0;kt[153]=1;qt[102]=0;Wt[102]=-1;Xt[102]=1;Jt[102]=1;Kt[102]=0;Qt[102]=0;jt[102]=0;te[102]=1;ee[102]=0;Ot[102]=-1;Ft[102]=0;Ut[102]=1;Gt[155]=0;Vt[155]=-1;Ht[155]=0;Yt[155]=1;$t[155]=0;Zt[155]=1;ne[155]=0;re[155]=1;ie[155]=1;Bt[155]=-1;zt[155]=0;kt[155]=0;qt[103]=0;Wt[103]=1;Xt[103]=0;Jt[103]=-1;Kt[103]=0;Qt[103]=1;jt[103]=0;te[103]=-1;ee[103]=1;Ot[103]=1;Ft[103]=0;Ut[103]=0;Gt[152]=0;Vt[152]=1;Ht[152]=1;Jt[152]=-1;Kt[152]=0;Qt[152]=1;Yt[152]=-1;$t[152]=0;Zt[152]=0;ne[152]=0;re[152]=-1;ie[152]=0;jt[152]=0;te[152]=-1;ee[152]=1;Bt[152]=1;zt[152]=0;kt[152]=1;Gt[156]=0;Vt[156]=-1;Ht[156]=1;Jt[156]=1;Kt[156]=0;Qt[156]=1;Yt[156]=-1;$t[156]=0;Zt[156]=0;ne[156]=0;re[156]=-1;ie[156]=0;jt[156]=0;te[156]=1;ee[156]=1;Bt[156]=-1;zt[156]=0;kt[156]=1;Gt[137]=0;Vt[137]=1;Ht[137]=1;qt[137]=0;Wt[137]=1;Xt[137]=0;Yt[137]=-1;$t[137]=0;Zt[137]=0;ne[137]=0;re[137]=-1;ie[137]=0;Ot[137]=1;Ft[137]=0;Ut[137]=0;Bt[137]=1;zt[137]=0;kt[137]=1;Gt[139]=0;Vt[139]=1;Ht[139]=1;qt[139]=0;Wt[139]=-1;Xt[139]=0;Yt[139]=1;$t[139]=0;Zt[139]=0;ne[139]=0;re[139]=1;ie[139]=0;Ot[139]=-1;Ft[139]=0;Ut[139]=0;Bt[139]=1;zt[139]=0;kt[139]=1;Gt[98]=0;Vt[98]=-1;Ht[98]=0;qt[98]=0;Wt[98]=-1;Xt[98]=1;Jt[98]=1;Kt[98]=0;Qt[98]=0;Yt[98]=1;$t[98]=0;Zt[98]=1;jt[98]=0;te[98]=1;ee[98]=0;Ot[98]=-1;Ft[98]=0;Ut[98]=1;Gt[99]=0;Vt[99]=1;Ht[99]=0;qt[99]=0;Wt[99]=-1;Xt[99]=1;Jt[99]=1;Kt[99]=0;Qt[99]=0;Yt[99]=-1;$t[99]=0;Zt[99]=1;jt[99]=0;te[99]=-1;ee[99]=0;Ot[99]=1;Ft[99]=0;Ut[99]=1;qt[38]=0;Wt[38]=-1;Xt[38]=1;Jt[38]=1;Kt[38]=0;Qt[38]=0;ne[38]=0;re[38]=1;ie[38]=1;jt[38]=0;te[38]=1;ee[38]=0;Ot[38]=-1;Ft[38]=0;Ut[38]=1;Bt[38]=-1;zt[38]=0;kt[38]=0;qt[39]=0;Wt[39]=1;Xt[39]=1;Jt[39]=-1;Kt[39]=0;Qt[39]=0;ne[39]=0;re[39]=-1;ie[39]=1;jt[39]=0;te[39]=1;ee[39]=0;Ot[39]=-1;Ft[39]=0;Ut[39]=1;Bt[39]=1;zt[39]=0;kt[39]=0;var Kc=function(o){return[[o.bottomleft,0],[0,0],[0,o.leftbottom]]},Qc=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0]]},jc=function(o){return[[o.topright,1],[1,1],[1,o.righttop]]},th=function(o){return[[0,o.lefttop],[0,1],[o.topleft,1]]},eh=function(o){return[[o.bottomright,0],[o.bottomleft,0],[0,o.leftbottom],[0,o.lefttop]]},nh=function(o){return[[o.bottomright,0],[o.bottomleft,0],[1,o.righttop],[1,o.rightbottom]]},rh=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.topleft,1],[o.topright,1]]},ih=function(o){return[[0,o.leftbottom],[0,o.lefttop],[o.topleft,1],[o.topright,1]]},fM=function(o){return[[0,0],[0,o.leftbottom],[1,o.rightbottom],[1,0]]},pM=function(o){return[[1,0],[o.bottomright,0],[o.topright,1],[1,1]]},dM=function(o){return[[1,1],[1,o.righttop],[0,o.lefttop],[0,1]]},mM=function(o){return[[o.bottomleft,0],[0,0],[0,1],[o.topleft,1]]},gM=function(o){return[[1,o.righttop],[1,o.rightbottom],[0,o.leftbottom],[0,o.lefttop]]},yM=function(o){return[[o.topleft,1],[o.topright,1],[o.bottomright,0],[o.bottomleft,0]]},vM=function(){return[[0,0],[0,1],[1,1],[1,0]]},_M=function(o){return[[1,o.rightbottom],[1,0],[0,0],[0,1],[o.topleft,1]]},xM=function(o){return[[o.topright,1],[1,1],[1,0],[0,0],[0,o.leftbottom]]},EM=function(o){return[[1,0],[o.bottomright,0],[0,o.lefttop],[0,1],[1,1]]},MM=function(o){return[[1,1],[1,o.righttop],[o.bottomleft,0],[0,0],[0,1]]},wM=function(o){return[[1,o.righttop],[1,o.rightbottom],[0,o.lefttop],[0,1],[o.topleft,1]]},SM=function(o){return[[1,1],[1,o.righttop],[o.bottomright,0],[o.bottomleft,0],[o.topright,1]]},bM=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.leftbottom],[0,o.lefttop]]},AM=function(o){return[[o.topright,1],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topleft,1]]},TM=function(o){return[[o.bottomright,0],[o.bottomleft,0],[0,o.lefttop],[0,1],[o.topleft,1]]},CM=function(o){return[[1,1],[1,o.righttop],[0,o.leftbottom],[0,o.lefttop],[o.topright,1]]},IM=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[o.topleft,1],[o.topright,1]]},PM=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomleft,0],[0,0],[0,o.leftbottom]]},RM=function(o){return[[1,o.rightbottom],[1,0],[0,0],[0,o.leftbottom],[o.topleft,1],[o.topright,1]]},NM=function(o){return[[1,1],[1,0],[o.bottomright,0],[0,o.leftbottom],[0,o.lefttop],[o.topright,1]]},LM=function(o){return[[1,1],[1,o.righttop],[o.bottomright,0],[o.bottomleft,0],[0,o.lefttop],[0,1]]},DM=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomleft,0],[0,0],[0,1],[o.topleft,1]]},OM=function(o){return[[1,1],[1,o.righttop],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topright,1]]},FM=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.lefttop],[0,1],[o.topleft,1]]},UM=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomright,0],[o.bottomleft,0],[0,o.leftbottom],[0,o.lefttop],[o.topleft,1],[o.topright,1]]},BM=function(o){return[[1,1],[1,o.righttop],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topright,1]]},zM=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.lefttop],[0,1],[o.topleft,1]]},kM=function(o){return[[1,1],[1,o.righttop],[o.bottomright,0],[o.bottomleft,0],[0,o.leftbottom],[0,o.lefttop],[o.topright,1]]},GM=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topleft,1],[o.topright,1]]},VM=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomright,0],[o.bottomleft,0],[0,o.lefttop],[0,1],[o.topleft,1]]},HM=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.leftbottom],[0,o.lefttop],[o.topleft,1],[o.topright,1]]},le=[],ce=[],he=[],fe=[],pe=[],de=[],me=[],ge=[];fe[1]=pe[1]=18;fe[169]=pe[169]=18;he[4]=ce[4]=12;he[166]=ce[166]=12;le[16]=ge[16]=4;le[154]=ge[154]=4;de[64]=me[64]=22;de[106]=me[106]=22;he[2]=de[2]=17;fe[2]=pe[2]=18;he[168]=de[168]=17;fe[168]=pe[168]=18;le[8]=fe[8]=9;ce[8]=he[8]=12;le[162]=fe[162]=9;ce[162]=he[162]=12;le[32]=ge[32]=4;ce[32]=me[32]=1;le[138]=ge[138]=4;ce[138]=me[138]=1;pe[128]=ge[128]=21;de[128]=me[128]=22;pe[42]=ge[42]=21;de[42]=me[42]=22;ce[5]=pe[5]=14;ce[165]=pe[165]=14;he[20]=ge[20]=6;he[150]=ge[150]=6;le[80]=de[80]=11;le[90]=de[90]=11;fe[65]=me[65]=3;fe[105]=me[105]=3;le[160]=de[160]=11;ce[160]=pe[160]=14;le[10]=de[10]=11;ce[10]=pe[10]=14;he[130]=ge[130]=6;fe[130]=me[130]=3;he[40]=ge[40]=6;fe[40]=me[40]=3;ce[101]=me[101]=1;ce[69]=me[69]=1;pe[149]=ge[149]=21;pe[21]=ge[21]=21;he[86]=de[86]=17;he[84]=de[84]=17;le[89]=fe[89]=9;le[81]=fe[81]=9;le[96]=me[96]=0;ce[96]=de[96]=15;le[74]=me[74]=0;ce[74]=de[74]=15;le[24]=he[24]=8;fe[24]=ge[24]=7;le[146]=he[146]=8;fe[146]=ge[146]=7;ce[6]=de[6]=15;he[6]=pe[6]=16;ce[164]=de[164]=15;he[164]=pe[164]=16;fe[129]=ge[129]=7;pe[129]=me[129]=20;fe[41]=ge[41]=7;pe[41]=me[41]=20;he[66]=me[66]=2;fe[66]=de[66]=19;he[104]=me[104]=2;fe[104]=de[104]=19;le[144]=pe[144]=10;de[144]=ge[144]=23;le[26]=pe[26]=10;de[26]=ge[26]=23;ce[36]=ge[36]=5;he[36]=me[36]=2;ce[134]=ge[134]=5;he[134]=me[134]=2;le[9]=pe[9]=10;ce[9]=fe[9]=13;le[161]=pe[161]=10;ce[161]=fe[161]=13;ce[37]=ge[37]=5;pe[37]=me[37]=20;ce[133]=ge[133]=5;pe[133]=me[133]=20;he[148]=pe[148]=16;de[148]=ge[148]=23;he[22]=pe[22]=16;de[22]=ge[22]=23;le[82]=he[82]=8;fe[82]=de[82]=19;le[88]=he[88]=8;fe[88]=de[88]=19;le[73]=me[73]=0;ce[73]=fe[73]=13;le[97]=me[97]=0;ce[97]=fe[97]=13;le[145]=fe[145]=9;pe[145]=ge[145]=21;le[25]=fe[25]=9;pe[25]=ge[25]=21;ce[70]=me[70]=1;he[70]=de[70]=17;ce[100]=me[100]=1;he[100]=de[100]=17;le[34]=fe[34]=9;ce[34]=he[34]=12;pe[34]=ge[34]=21;de[34]=me[34]=22;le[136]=ge[136]=4;ce[136]=me[136]=1;he[136]=de[136]=17;fe[136]=pe[136]=18;le[35]=ge[35]=4;ce[35]=he[35]=12;fe[35]=pe[35]=18;de[35]=me[35]=22;le[153]=ge[153]=4;fe[153]=pe[153]=18;ce[102]=he[102]=12;de[102]=me[102]=22;le[155]=fe[155]=9;pe[155]=ge[155]=23;ce[103]=me[103]=1;he[103]=de[103]=17;le[152]=ge[152]=4;he[152]=de[152]=17;fe[152]=pe[152]=18;le[156]=he[156]=8;fe[156]=pe[156]=18;de[156]=ge[156]=23;le[137]=ge[137]=4;ce[137]=me[137]=1;fe[137]=pe[137]=18;le[139]=ge[139]=4;ce[139]=fe[139]=13;pe[139]=me[139]=20;le[98]=fe[98]=9;ce[98]=he[98]=12;de[98]=me[98]=22;le[99]=me[99]=0;ce[99]=he[99]=12;fe[99]=de[99]=19;ce[38]=he[38]=12;pe[38]=ge[38]=21;de[38]=me[38]=22;ce[39]=ge[39]=5;he[39]=pe[39]=16;de[39]=me[39]=22;var st=[];st[1]=st[169]=Kc;st[4]=st[166]=Qc;st[16]=st[154]=jc;st[64]=st[106]=th;st[168]=st[2]=eh;st[162]=st[8]=nh;st[138]=st[32]=rh;st[42]=st[128]=ih;st[5]=st[165]=fM;st[20]=st[150]=pM;st[80]=st[90]=dM;st[65]=st[105]=mM;st[160]=st[10]=gM;st[130]=st[40]=yM;st[85]=vM;st[101]=st[69]=_M;st[149]=st[21]=xM;st[86]=st[84]=EM;st[89]=st[81]=MM;st[96]=st[74]=wM;st[24]=st[146]=SM;st[6]=st[164]=bM;st[129]=st[41]=AM;st[66]=st[104]=TM;st[144]=st[26]=CM;st[36]=st[134]=IM;st[9]=st[161]=PM;st[37]=st[133]=RM;st[148]=st[22]=NM;st[82]=st[88]=LM;st[73]=st[97]=DM;st[145]=st[25]=OM;st[70]=st[100]=FM;st[34]=function(o){return[ih(o),nh(o)]};st[35]=UM;st[136]=function(o){return[rh(o),eh(o)]};st[153]=function(o){return[jc(o),Kc(o)]};st[102]=function(o){return[Qc(o),th(o)]};st[155]=BM;st[103]=zM;st[152]=function(o){return[jc(o),eh(o)]};st[156]=kM;st[137]=function(o){return[rh(o),Kc(o)]};st[139]=GM;st[98]=function(o){return[nh(o),th(o)]};st[99]=VM;st[38]=function(o){return[Qc(o),ih(o)]};st[39]=HM;function WM(o){return(o>0)-(o<0)||+o}function Is(o,e,r){var a=e[0]-o[0],u=e[1]-o[1],c=r[0]-e[0],h=r[1]-e[1];return WM(a*h-c*u)}function ag(o,e){var r=o.geometry.coordinates[0].map(function(h){return h[0]}),a=o.geometry.coordinates[0].map(function(h){return h[1]}),u=e.geometry.coordinates[0].map(function(h){return h[0]}),c=e.geometry.coordinates[0].map(function(h){return h[1]});return Math.max.apply(null,r)===Math.max.apply(null,u)&&Math.max.apply(null,a)===Math.max.apply(null,c)&&Math.min.apply(null,r)===Math.min.apply(null,u)&&Math.min.apply(null,a)===Math.min.apply(null,c)}function oh(o,e){return e.geometry.coordinates[0].every(function(r){return $n(He(r),o)})}function ug(o,e){return o[0]===e[0]&&o[1]===e[1]}var XM=function(){function o(e){this.id=o.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return o.buildId=function(e){return e.join(",")},o.prototype.removeInnerEdge=function(e){this.innerEdges=this.innerEdges.filter(function(r){return r.from.id!==e.from.id})},o.prototype.removeOuterEdge=function(e){this.outerEdges=this.outerEdges.filter(function(r){return r.to.id!==e.to.id})},o.prototype.addOuterEdge=function(e){this.outerEdges.push(e),this.outerEdgesSorted=!1},o.prototype.sortOuterEdges=function(){var e=this;this.outerEdgesSorted||(this.outerEdges.sort(function(r,a){var u=r.to,c=a.to;if(u.coordinates[0]-e.coordinates[0]>=0&&c.coordinates[0]-e.coordinates[0]<0)return 1;if(u.coordinates[0]-e.coordinates[0]<0&&c.coordinates[0]-e.coordinates[0]>=0)return-1;if(u.coordinates[0]-e.coordinates[0]===0&&c.coordinates[0]-e.coordinates[0]===0)return u.coordinates[1]-e.coordinates[1]>=0||c.coordinates[1]-e.coordinates[1]>=0?u.coordinates[1]-c.coordinates[1]:c.coordinates[1]-u.coordinates[1];var h=Is(e.coordinates,u.coordinates,c.coordinates);if(h<0)return 1;if(h>0)return-1;var p=Math.pow(u.coordinates[0]-e.coordinates[0],2)+Math.pow(u.coordinates[1]-e.coordinates[1],2),d=Math.pow(c.coordinates[0]-e.coordinates[0],2)+Math.pow(c.coordinates[1]-e.coordinates[1],2);return p-d}),this.outerEdgesSorted=!0)},o.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},o.prototype.getOuterEdge=function(e){return this.sortOuterEdges(),this.outerEdges[e]},o.prototype.addInnerEdge=function(e){this.innerEdges.push(e)},o}(),sh=XM;var YM=function(){function o(e,r){this.from=e,this.to=r,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 o.prototype.getSymetric=function(){return this.symetric||(this.symetric=new o(this.to,this.from),this.symetric.symetric=this),this.symetric},o.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},o.prototype.isEqual=function(e){return this.from.id===e.from.id&&this.to.id===e.to.id},o.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},o.prototype.toLineString=function(){return Yn([this.from.coordinates,this.to.coordinates])},o.prototype.compareTo=function(e){return Is(e.from.coordinates,e.to.coordinates,this.to.coordinates)},o}(),lg=YM;var $M=function(){function o(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return o.prototype.push=function(e){this.edges.push(e),this.polygon=this.envelope=void 0},o.prototype.get=function(e){return this.edges[e]},Object.defineProperty(o.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),o.prototype.forEach=function(e){this.edges.forEach(e)},o.prototype.map=function(e){return this.edges.map(e)},o.prototype.some=function(e){return this.edges.some(e)},o.prototype.isValid=function(){return!0},o.prototype.isHole=function(){var e=this,r=this.edges.reduce(function(h,p,d){return p.from.coordinates[1]>e.edges[h].from.coordinates[1]&&(h=d),h},0),a=(r===0?this.length:r)-1,u=(r+1)%this.length,c=Is(this.edges[a].from.coordinates,this.edges[r].from.coordinates,this.edges[u].from.coordinates);return c===0?this.edges[a].from.coordinates[0]>this.edges[u].from.coordinates[0]:c>0},o.prototype.toMultiPoint=function(){return Hl(this.edges.map(function(e){return e.from.coordinates}))},o.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var e=this.edges.map(function(r){return r.from.coordinates});return e.push(this.edges[0].from.coordinates),this.polygon=sn([e])},o.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=uc(this.toPolygon())},o.findEdgeRingContaining=function(e,r){var a=e.getEnvelope(),u,c;return r.forEach(function(h){var p=h.getEnvelope();if(c&&(u=c.getEnvelope()),!ag(p,a)&&oh(p,a)){for(var d=e.map(function(I){return I.from.coordinates}),g=void 0,v=function(I){h.some(function(D){return ug(I,D.from.coordinates)})||(g=I)},x=0,M=d;x<M.length;x++){var w=M[x];v(w)}g&&h.inside(He(g))&&(!c||oh(u,p))&&(c=h)}}),c},o.prototype.inside=function(e){return $n(e,this.toPolygon())},o}(),ah=$M;function ZM(o){if(!o)throw new Error("No geojson passed");if(o.type!=="FeatureCollection"&&o.type!=="GeometryCollection"&&o.type!=="MultiLineString"&&o.type!=="LineString"&&o.type!=="Feature")throw new Error("Invalid input type \'"+o.type+"\'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var RL=function(){function o(){this.edges=[],this.nodes={}}return o.fromGeoJson=function(e){ZM(e);var r=new o;return Yr(e,function(a){Wl(a,"LineString","Graph::fromGeoJson"),ep(a,function(u,c){if(u){var h=r.getNode(u),p=r.getNode(c);r.addEdge(h,p)}return c})}),r},o.prototype.getNode=function(e){var r=sh.buildId(e),a=this.nodes[r];return a||(a=this.nodes[r]=new sh(e)),a},o.prototype.addEdge=function(e,r){var a=new lg(e,r),u=a.getSymetric();this.edges.push(a),this.edges.push(u)},o.prototype.deleteDangles=function(){var e=this;Object.keys(this.nodes).map(function(r){return e.nodes[r]}).forEach(function(r){return e._removeIfDangle(r)})},o.prototype._removeIfDangle=function(e){var r=this;if(e.innerEdges.length<=1){var a=e.getOuterEdges().map(function(u){return u.to});this.removeNode(e),a.forEach(function(u){return r._removeIfDangle(u)})}},o.prototype.deleteCutEdges=function(){var e=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(r){r.label===r.symetric.label&&(e.removeEdge(r.symetric),e.removeEdge(r))})},o.prototype._computeNextCWEdges=function(e){var r=this;typeof e=="undefined"?Object.keys(this.nodes).forEach(function(a){return r._computeNextCWEdges(r.nodes[a])}):e.getOuterEdges().forEach(function(a,u){e.getOuterEdge((u===0?e.getOuterEdges().length:u)-1).symetric.next=a})},o.prototype._computeNextCCWEdges=function(e,r){for(var a=e.getOuterEdges(),u,c,h=a.length-1;h>=0;--h){var p=a[h],d=p.symetric,g=void 0,v=void 0;p.label===r&&(g=p),d.label===r&&(v=d),!(!g||!v)&&(v&&(c=v),g&&(c&&(c.next=g,c=void 0),u||(u=g)))}c&&(c.next=u)},o.prototype._findLabeledEdgeRings=function(){var e=[],r=0;return this.edges.forEach(function(a){if(!(a.label>=0)){e.push(a);var u=a;do u.label=r,u=u.next;while(!a.isEqual(u));r++}}),e},o.prototype.getEdgeRings=function(){var e=this;this._computeNextCWEdges(),this.edges.forEach(function(a){a.label=void 0}),this._findLabeledEdgeRings().forEach(function(a){e._findIntersectionNodes(a).forEach(function(u){e._computeNextCCWEdges(u,a.label)})});var r=[];return this.edges.forEach(function(a){a.ring||r.push(e._findEdgeRing(a))}),r},o.prototype._findIntersectionNodes=function(e){var r=[],a=e,u=function(){var c=0;a.from.getOuterEdges().forEach(function(h){h.label===e.label&&++c}),c>1&&r.push(a.from),a=a.next};do u();while(!e.isEqual(a));return r},o.prototype._findEdgeRing=function(e){var r=e,a=new ah;do a.push(r),r.ring=a,r=r.next;while(!e.isEqual(r));return a},o.prototype.removeNode=function(e){var r=this;e.getOuterEdges().forEach(function(a){return r.removeEdge(a)}),e.innerEdges.forEach(function(a){return r.removeEdge(a)}),delete this.nodes[e.id]},o.prototype.removeEdge=function(e){this.edges=this.edges.filter(function(r){return!r.isEqual(e)}),e.deleteEdge()},o}();var jM=ln(uh(),1);var tw=ln(uh(),1);var nw=ln(vg(),1);var lw=ln(Cg(),1);function Pg(o){for(var e=o,r=[];e.parent;)r.unshift(e),e=e.parent;return r}function hw(){return new Rg(function(o){return o.f})}var fh={search:function(o,e,r,a){o.cleanDirty(),a=a||{};var u=a.heuristic||fh.heuristics.manhattan,c=a.closest||!1,h=hw(),p=e;for(e.h=u(e,r),h.push(e);h.size()>0;){var d=h.pop();if(d===r)return Pg(d);d.closed=!0;for(var g=o.neighbors(d),v=0,x=g.length;v<x;++v){var M=g[v];if(!(M.closed||M.isWall())){var w=d.g+M.getCost(d),I=M.visited;(!I||w<M.g)&&(M.visited=!0,M.parent=d,M.h=M.h||u(M,r),M.g=w,M.f=M.g+M.h,o.markDirty(M),c&&(M.h<p.h||M.h===p.h&&M.g<p.g)&&(p=M),I?h.rescoreElement(M):h.push(M))}}}return c?Pg(p):[]},heuristics:{manhattan:function(o,e){var r=Math.abs(e.x-o.x),a=Math.abs(e.y-o.y);return r+a},diagonal:function(o,e){var r=1,a=Math.sqrt(2),u=Math.abs(e.x-o.x),c=Math.abs(e.y-o.y);return r*(u+c)+(a-2*r)*Math.min(u,c)}},cleanNode:function(o){o.f=0,o.g=0,o.h=0,o.visited=!1,o.closed=!1,o.parent=null}};function xa(o,e){e=e||{},this.nodes=[],this.diagonal=!!e.diagonal,this.grid=[];for(var r=0;r<o.length;r++){this.grid[r]=[];for(var a=0,u=o[r];a<u.length;a++){var c=new Fu(r,a,u[a]);this.grid[r][a]=c,this.nodes.push(c)}}this.init()}xa.prototype.init=function(){this.dirtyNodes=[];for(var o=0;o<this.nodes.length;o++)fh.cleanNode(this.nodes[o])};xa.prototype.cleanDirty=function(){for(var o=0;o<this.dirtyNodes.length;o++)fh.cleanNode(this.dirtyNodes[o]);this.dirtyNodes=[]};xa.prototype.markDirty=function(o){this.dirtyNodes.push(o)};xa.prototype.neighbors=function(o){var e=[],r=o.x,a=o.y,u=this.grid;return u[r-1]&&u[r-1][a]&&e.push(u[r-1][a]),u[r+1]&&u[r+1][a]&&e.push(u[r+1][a]),u[r]&&u[r][a-1]&&e.push(u[r][a-1]),u[r]&&u[r][a+1]&&e.push(u[r][a+1]),this.diagonal&&(u[r-1]&&u[r-1][a-1]&&e.push(u[r-1][a-1]),u[r+1]&&u[r+1][a-1]&&e.push(u[r+1][a-1]),u[r-1]&&u[r-1][a+1]&&e.push(u[r-1][a+1]),u[r+1]&&u[r+1][a+1]&&e.push(u[r+1][a+1])),e};xa.prototype.toString=function(){for(var o=[],e=this.grid,r,a,u,c,h=0,p=e.length;h<p;h++){for(r=[],a=e[h],u=0,c=a.length;u<c;u++)r.push(a[u].weight);o.push(r.join(" "))}return o.join(`\n`)};function Fu(o,e,r){this.x=o,this.y=e,this.weight=r}Fu.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Fu.prototype.getCost=function(o){return o&&o.x!==this.x&&o.y!==this.y?this.weight*1.41421:this.weight};Fu.prototype.isWall=function(){return this.weight===0};function Rg(o){this.content=[],this.scoreFunction=o}Rg.prototype={push:function(o){this.content.push(o),this.sinkDown(this.content.length-1)},pop:function(){var o=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.bubbleUp(0)),o},remove:function(o){var e=this.content.indexOf(o),r=this.content.pop();e!==this.content.length-1&&(this.content[e]=r,this.scoreFunction(r)<this.scoreFunction(o)?this.sinkDown(e):this.bubbleUp(e))},size:function(){return this.content.length},rescoreElement:function(o){this.sinkDown(this.content.indexOf(o))},sinkDown:function(o){for(var e=this.content[o];o>0;){var r=(o+1>>1)-1,a=this.content[r];if(this.scoreFunction(e)<this.scoreFunction(a))this.content[r]=e,this.content[o]=a,o=r;else break}},bubbleUp:function(o){for(var e=this.content.length,r=this.content[o],a=this.scoreFunction(r);;){var u=o+1<<1,c=u-1,h=null,p;if(c<e){var d=this.content[c];p=this.scoreFunction(d),p<a&&(h=c)}if(u<e){var g=this.content[u],v=this.scoreFunction(g);v<(h===null?a:p)&&(h=u)}if(h!==null)this.content[o]=this.content[h],this.content[h]=r,o=h;else break}}};function ph(){this._=null}function Rs(o){o.U=o.C=o.L=o.R=o.P=o.N=null}ph.prototype={constructor:ph,insert:function(o,e){var r,a,u;if(o){if(e.P=o,e.N=o.N,o.N&&(o.N.P=e),o.N=e,o.R){for(o=o.R;o.L;)o=o.L;o.L=e}else o.R=e;r=o}else this._?(o=Ng(this._),e.P=null,e.N=o,o.P=o.L=e,r=o):(e.P=e.N=null,this._=e,r=null);for(e.L=e.R=null,e.U=r,e.C=!0,o=e;r&&r.C;)a=r.U,r===a.L?(u=a.R,u&&u.C?(r.C=u.C=!1,a.C=!0,o=a):(o===r.R&&(Ea(this,r),o=r,r=o.U),r.C=!1,a.C=!0,Ma(this,a))):(u=a.L,u&&u.C?(r.C=u.C=!1,a.C=!0,o=a):(o===r.L&&(Ma(this,r),o=r,r=o.U),r.C=!1,a.C=!0,Ea(this,a))),r=o.U;this._.C=!1},remove:function(o){o.N&&(o.N.P=o.P),o.P&&(o.P.N=o.N),o.N=o.P=null;var e=o.U,r,a=o.L,u=o.R,c,h;if(a?u?c=Ng(u):c=a:c=u,e?e.L===o?e.L=c:e.R=c:this._=c,a&&u?(h=c.C,c.C=o.C,c.L=a,a.U=c,c!==u?(e=c.U,c.U=o.U,o=c.R,e.L=o,c.R=u,u.U=c):(c.U=e,e=c,o=c.R)):(h=o.C,o=c),o&&(o.U=e),!h){if(o&&o.C){o.C=!1;return}do{if(o===this._)break;if(o===e.L){if(r=e.R,r.C&&(r.C=!1,e.C=!0,Ea(this,e),r=e.R),r.L&&r.L.C||r.R&&r.R.C){(!r.R||!r.R.C)&&(r.L.C=!1,r.C=!0,Ma(this,r),r=e.R),r.C=e.C,e.C=r.R.C=!1,Ea(this,e),o=this._;break}}else if(r=e.L,r.C&&(r.C=!1,e.C=!0,Ma(this,e),r=e.L),r.L&&r.L.C||r.R&&r.R.C){(!r.L||!r.L.C)&&(r.R.C=!1,r.C=!0,Ea(this,r),r=e.L),r.C=e.C,e.C=r.L.C=!1,Ma(this,e),o=this._;break}r.C=!0,o=e,e=e.U}while(!o.C);o&&(o.C=!1)}}};function Ea(o,e){var r=e,a=e.R,u=r.U;u?u.L===r?u.L=a:u.R=a:o._=a,a.U=u,r.U=a,r.R=a.L,r.R&&(r.R.U=r),a.L=r}function Ma(o,e){var r=e,a=e.L,u=r.U;u?u.L===r?u.L=a:u.R=a:o._=a,a.U=u,r.U=a,r.L=a.R,r.L&&(r.L.U=r),a.R=r}function Ng(o){for(;o.L;)o=o.L;return o}var dh=ph;function Ns(o,e,r,a){var u=[null,null],c=Jn.push(u)-1;return u.left=o,u.right=e,r&&wa(u,o,e,r),a&&wa(u,e,o,a),Cr[o.index].halfedges.push(c),Cr[e.index].halfedges.push(c),u}function Ls(o,e,r){var a=[e,r];return a.left=o,a}function wa(o,e,r,a){!o[0]&&!o[1]?(o[0]=a,o.left=e,o.right=r):o.left===r?o[1]=a:o[0]=a}function fw(o,e,r,a,u){var c=o[0],h=o[1],p=c[0],d=c[1],g=h[0],v=h[1],x=0,M=1,w=g-p,I=v-d,D;if(D=e-p,!(!w&&D>0)){if(D/=w,w<0){if(D<x)return;D<M&&(M=D)}else if(w>0){if(D>M)return;D>x&&(x=D)}if(D=a-p,!(!w&&D<0)){if(D/=w,w<0){if(D>M)return;D>x&&(x=D)}else if(w>0){if(D<x)return;D<M&&(M=D)}if(D=r-d,!(!I&&D>0)){if(D/=I,I<0){if(D<x)return;D<M&&(M=D)}else if(I>0){if(D>M)return;D>x&&(x=D)}if(D=u-d,!(!I&&D<0)){if(D/=I,I<0){if(D>M)return;D>x&&(x=D)}else if(I>0){if(D<x)return;D<M&&(M=D)}return!(x>0)&&!(M<1)||(x>0&&(o[0]=[p+x*w,d+x*I]),M<1&&(o[1]=[p+M*w,d+M*I])),!0}}}}}function pw(o,e,r,a,u){var c=o[1];if(c)return!0;var h=o[0],p=o.left,d=o.right,g=p[0],v=p[1],x=d[0],M=d[1],w=(g+x)/2,I=(v+M)/2,D,b;if(M===v){if(w<e||w>=a)return;if(g>x){if(!h)h=[w,r];else if(h[1]>=u)return;c=[w,u]}else{if(!h)h=[w,u];else if(h[1]<r)return;c=[w,r]}}else if(D=(g-x)/(M-v),b=I-D*w,D<-1||D>1)if(g>x){if(!h)h=[(r-b)/D,r];else if(h[1]>=u)return;c=[(u-b)/D,u]}else{if(!h)h=[(u-b)/D,u];else if(h[1]<r)return;c=[(r-b)/D,r]}else if(v<M){if(!h)h=[e,D*e+b];else if(h[0]>=a)return;c=[a,D*a+b]}else{if(!h)h=[a,D*a+b];else if(h[0]<e)return;c=[e,D*e+b]}return o[0]=h,o[1]=c,!0}function Lg(o,e,r,a){for(var u=Jn.length,c;u--;)(!pw(c=Jn[u],o,e,r,a)||!fw(c,o,e,r,a)||!(Math.abs(c[0][0]-c[1][0])>Ue||Math.abs(c[0][1]-c[1][1])>Ue))&&delete Jn[u]}function Dg(o){return Cr[o.index]={site:o,halfedges:[]}}function dw(o,e){var r=o.site,a=e.left,u=e.right;return r===u&&(u=a,a=r),u?Math.atan2(u[1]-a[1],u[0]-a[0]):(r===a?(a=e[1],u=e[0]):(a=e[0],u=e[1]),Math.atan2(a[0]-u[0],u[1]-a[1]))}function mh(o,e){return e[+(e.left!==o.site)]}function mw(o,e){return e[+(e.left===o.site)]}function Og(){for(var o=0,e=Cr.length,r,a,u,c;o<e;++o)if((r=Cr[o])&&(c=(a=r.halfedges).length)){var h=new Array(c),p=new Array(c);for(u=0;u<c;++u)h[u]=u,p[u]=dw(r,Jn[a[u]]);for(h.sort(function(d,g){return p[g]-p[d]}),u=0;u<c;++u)p[u]=a[h[u]];for(u=0;u<c;++u)a[u]=p[u]}}function Fg(o,e,r,a){var u=Cr.length,c,h,p,d,g,v,x,M,w,I,D,b,T=!0;for(c=0;c<u;++c)if(h=Cr[c]){for(p=h.site,g=h.halfedges,d=g.length;d--;)Jn[g[d]]||g.splice(d,1);for(d=0,v=g.length;d<v;)I=mw(h,Jn[g[d]]),D=I[0],b=I[1],x=mh(h,Jn[g[++d%v]]),M=x[0],w=x[1],(Math.abs(D-M)>Ue||Math.abs(b-w)>Ue)&&(g.splice(d,0,Jn.push(Ls(p,I,Math.abs(D-o)<Ue&&a-b>Ue?[o,Math.abs(M-o)<Ue?w:a]:Math.abs(b-a)<Ue&&r-D>Ue?[Math.abs(w-a)<Ue?M:r,a]:Math.abs(D-r)<Ue&&b-e>Ue?[r,Math.abs(M-r)<Ue?w:e]:Math.abs(b-e)<Ue&&D-o>Ue?[Math.abs(w-e)<Ue?M:o,e]:null))-1),++v);v&&(T=!1)}if(T){var L,P,z,k=1/0;for(c=0,T=null;c<u;++c)(h=Cr[c])&&(p=h.site,L=p[0]-o,P=p[1]-e,z=L*L+P*P,z<k&&(k=z,T=h));if(T){var Y=[o,e],q=[o,a],C=[r,a],ot=[r,e];T.halfedges.push(Jn.push(Ls(p=T.site,Y,q))-1,Jn.push(Ls(p,q,C))-1,Jn.push(Ls(p,C,ot))-1,Jn.push(Ls(p,ot,Y))-1)}}for(c=0;c<u;++c)(h=Cr[c])&&(h.halfedges.length||delete Cr[c])}var Ug=[],Uu;function gw(){Rs(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ho(o){var e=o.P,r=o.N;if(!(!e||!r)){var a=e.site,u=o.site,c=r.site;if(a!==c){var h=u[0],p=u[1],d=a[0]-h,g=a[1]-p,v=c[0]-h,x=c[1]-p,M=2*(d*x-g*v);if(!(M>=-Bg)){var w=d*d+g*g,I=v*v+x*x,D=(x*w-g*I)/M,b=(d*I-v*w)/M,T=Ug.pop()||new gw;T.arc=o,T.site=u,T.x=D+h,T.y=(T.cy=b+p)+Math.sqrt(D*D+b*b),o.circle=T;for(var L=null,P=Ds._;P;)if(T.y<P.y||T.y===P.y&&T.x<=P.x)if(P.L)P=P.L;else{L=P.P;break}else if(P.R)P=P.R;else{L=P;break}Ds.insert(L,T),L||(Uu=T)}}}}function qo(o){var e=o.circle;e&&(e.P||(Uu=e.N),Ds.remove(e),Ug.push(e),Rs(e),o.circle=null)}var kg=[];function yw(){Rs(this),this.edge=this.site=this.circle=null}function zg(o){var e=kg.pop()||new yw;return e.site=o,e}function gh(o){qo(o),Wo.remove(o),kg.push(o),Rs(o)}function Gg(o){var e=o.circle,r=e.x,a=e.cy,u=[r,a],c=o.P,h=o.N,p=[o];gh(o);for(var d=c;d.circle&&Math.abs(r-d.circle.x)<Ue&&Math.abs(a-d.circle.cy)<Ue;)c=d.P,p.unshift(d),gh(d),d=c;p.unshift(d),qo(d);for(var g=h;g.circle&&Math.abs(r-g.circle.x)<Ue&&Math.abs(a-g.circle.cy)<Ue;)h=g.N,p.push(g),gh(g),g=h;p.push(g),qo(g);var v=p.length,x;for(x=1;x<v;++x)g=p[x],d=p[x-1],wa(g.edge,d.site,g.site,u);d=p[0],g=p[v-1],g.edge=Ns(d.site,g.site,null,u),Ho(d),Ho(g)}function Vg(o){for(var e=o[0],r=o[1],a,u,c,h,p=Wo._;p;)if(c=Hg(p,r)-e,c>Ue)p=p.L;else if(h=e-vw(p,r),h>Ue){if(!p.R){a=p;break}p=p.R}else{c>-Ue?(a=p.P,u=p):h>-Ue?(a=p,u=p.N):a=u=p;break}Dg(o);var d=zg(o);if(Wo.insert(a,d),!(!a&&!u)){if(a===u){qo(a),u=zg(a.site),Wo.insert(d,u),d.edge=u.edge=Ns(a.site,d.site),Ho(a),Ho(u);return}if(!u){d.edge=Ns(a.site,d.site);return}qo(a),qo(u);var g=a.site,v=g[0],x=g[1],M=o[0]-v,w=o[1]-x,I=u.site,D=I[0]-v,b=I[1]-x,T=2*(M*b-w*D),L=M*M+w*w,P=D*D+b*b,z=[(b*L-w*P)/T+v,(M*P-D*L)/T+x];wa(u.edge,g,I,z),d.edge=Ns(g,o,null,z),u.edge=Ns(o,I,null,z),Ho(a),Ho(u)}}function Hg(o,e){var r=o.site,a=r[0],u=r[1],c=u-e;if(!c)return a;var h=o.P;if(!h)return-1/0;r=h.site;var p=r[0],d=r[1],g=d-e;if(!g)return p;var v=p-a,x=1/c-1/g,M=v/g;return x?(-M+Math.sqrt(M*M-2*x*(v*v/(-2*g)-d+g/2+u-c/2)))/x+a:(a+p)/2}function vw(o,e){var r=o.N;if(r)return Hg(r,e);var a=o.site;return a[1]===e?a[0]:1/0}var Ue=1e-6,Bg=1e-12,Wo,Cr,Ds,Jn;function _w(o,e,r){return(o[0]-r[0])*(e[1]-o[1])-(o[0]-e[0])*(r[1]-o[1])}function xw(o,e){return e[1]-o[1]||e[0]-o[0]}function Bu(o,e){var r=o.sort(xw).pop(),a,u,c;for(Jn=[],Cr=new Array(o.length),Wo=new dh,Ds=new dh;;)if(c=Uu,r&&(!c||r[1]<c.y||r[1]===c.y&&r[0]<c.x))(r[0]!==a||r[1]!==u)&&(Vg(r),a=r[0],u=r[1]),r=o.pop();else if(c)Gg(c.arc);else break;if(Og(),e){var h=+e[0][0],p=+e[0][1],d=+e[1][0],g=+e[1][1];Lg(h,p,d,g),Fg(h,p,d,g)}this.edges=Jn,this.cells=Cr,Wo=Ds=Jn=Cr=null}Bu.prototype={constructor:Bu,polygons:function(){var o=this.edges;return this.cells.map(function(e){var r=e.halfedges.map(function(a){return mh(e,o[a])});return r.data=e.site.data,r})},triangles:function(){var o=[],e=this.edges;return this.cells.forEach(function(r,a){if(p=(c=r.halfedges).length)for(var u=r.site,c,h=-1,p,d,g=e[c[p-1]],v=g.left===u?g.right:g.left;++h<p;)d=v,g=e[c[h]],v=g.left===u?g.right:g.left,d&&v&&a<d.index&&a<v.index&&_w(u,d,v)<0&&o.push([u.data,d.data,v.data])}),o},links:function(){return this.edges.filter(function(o){return o.right}).map(function(o){return{source:o.left.data,target:o.right.data}})},find:function(o,e,r){for(var a=this,u,c=a._found||0,h=a.cells.length,p;!(p=a.cells[c]);)if(++c>=h)return null;var d=o-p.site[0],g=e-p.site[1],v=d*d+g*g;do p=a.cells[u=c],c=null,p.halfedges.forEach(function(x){var M=a.edges[x],w=M.left;if(!((w===p.site||!w)&&!(w=M.right))){var I=o-w[0],D=e-w[1],b=I*I+D*D;b<v&&(v=b,c=w.index)}});while(c!==null);return a._found=u,r==null||v<=r*r?p.site:null}};var Cw=ln(Os(),1);var Rh=ln(Yg(),1);function Ur(){return new Gu}function Gu(){this.reset()}Gu.prototype={constructor:Gu,reset:function(){this.s=this.t=0},add:function(o){$g(ku,o,this.t),$g(this,ku.s,this.s),this.s?this.t+=ku.t:this.s=ku.t},valueOf:function(){return this.s}};var ku=new Gu;function $g(o,e,r){var a=o.s=e+r,u=a-e,c=a-u;o.t=e-c+(r-u)}var Ae=1e-6;var Oe=Math.PI,On=Oe/2,Vu=Oe/4,Bi=Oe*2,Xo=180/Oe,Br=Oe/180,mn=Math.abs,Ai=Math.atan,zr=Math.atan2,xe=Math.cos;var Hu=Math.exp;var Sa=Math.log;var Lt=Math.sin;var ar=Math.sqrt,ba=Math.tan;function _h(o){return o>1?0:o<-1?Oe:Math.acos(o)}function Ir(o){return o>1?On:o<-1?-On:Math.asin(o)}function Ti(){}var Iw=Ur(),bO=Ur();function Yo(o){var e=o[0],r=o[1],a=xe(r);return[a*xe(e),a*Lt(e),Lt(r)]}function Aa(o,e){return[o[1]*e[2]-o[2]*e[1],o[2]*e[0]-o[0]*e[2],o[0]*e[1]-o[1]*e[0]]}function Ta(o){var e=ar(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]);o[0]/=e,o[1]/=e,o[2]/=e}var OO=Ur();function Jg(o,e){return[o>Oe?o-Bi:o<-Oe?o+Bi:o,e]}Jg.invert=Jg;function xh(){var o=[],e;return{point:function(r,a){e.push([r,a])},lineStart:function(){o.push(e=[])},lineEnd:Ti,rejoin:function(){o.length>1&&o.push(o.pop().concat(o.shift()))},result:function(){var r=o;return o=[],e=null,r}}}function Eh(o,e){return mn(o[0]-e[0])<Ae&&mn(o[1]-e[1])<Ae}function qu(o,e,r,a){this.x=o,this.z=e,this.o=r,this.e=a,this.v=!1,this.n=this.p=null}function Mh(o,e,r,a,u){var c=[],h=[],p,d;if(o.forEach(function(I){if(!((D=I.length-1)<=0)){var D,b=I[0],T=I[D],L;if(Eh(b,T)){for(u.lineStart(),p=0;p<D;++p)u.point((b=I[p])[0],b[1]);u.lineEnd();return}c.push(L=new qu(b,I,null,!0)),h.push(L.o=new qu(b,null,L,!1)),c.push(L=new qu(T,I,null,!1)),h.push(L.o=new qu(T,null,L,!0))}}),!!c.length){for(h.sort(e),Kg(c),Kg(h),p=0,d=h.length;p<d;++p)h[p].e=r=!r;for(var g=c[0],v,x;;){for(var M=g,w=!0;M.v;)if((M=M.n)===g)return;v=M.z,u.lineStart();do{if(M.v=M.o.v=!0,M.e){if(w)for(p=0,d=v.length;p<d;++p)u.point((x=v[p])[0],x[1]);else a(M.x,M.n.x,1,u);M=M.n}else{if(w)for(v=M.p.z,p=v.length-1;p>=0;--p)u.point((x=v[p])[0],x[1]);else a(M.x,M.p.x,-1,u);M=M.p}M=M.o,v=M.z,w=!w}while(!M.v);u.lineEnd()}}}function Kg(o){if(e=o.length){for(var e,r=0,a=o[0],u;++r<e;)a.n=u=o[r],u.p=a,a=u;a.n=u=o[0],u.p=a}}function Mo(o,e){return o<e?-1:o>e?1:o>=e?0:NaN}function wh(o){return o.length===1&&(o=Nw(o)),{left:function(e,r,a,u){for(a==null&&(a=0),u==null&&(u=e.length);a<u;){var c=a+u>>>1;o(e[c],r)<0?a=c+1:u=c}return a},right:function(e,r,a,u){for(a==null&&(a=0),u==null&&(u=e.length);a<u;){var c=a+u>>>1;o(e[c],r)>0?u=c:a=c+1}return a}}}function Nw(o){return function(e,r){return Mo(o(e),r)}}var Qg=wh(Mo),Lw=Qg.right,Dw=Qg.left;var jg=Array.prototype,Fw=jg.slice,Uw=jg.map;var T3=Math.sqrt(50),C3=Math.sqrt(10),I3=Math.sqrt(2);function Xu(o){for(var e=o.length,r,a=-1,u=0,c,h;++a<e;)u+=o[a].length;for(c=new Array(u);--e>=0;)for(h=o[e],r=h.length;--r>=0;)c[--u]=h[r];return c}var Ww=1e9,fU=-Ww;var Sh=Ur();function bh(o,e){var r=e[0],a=e[1],u=[Lt(r),-xe(r),0],c=0,h=0;Sh.reset();for(var p=0,d=o.length;p<d;++p)if(v=(g=o[p]).length)for(var g,v,x=g[v-1],M=x[0],w=x[1]/2+Vu,I=Lt(w),D=xe(w),b=0;b<v;++b,M=L,I=z,D=k,x=T){var T=g[b],L=T[0],P=T[1]/2+Vu,z=Lt(P),k=xe(P),Y=L-M,q=Y>=0?1:-1,C=q*Y,ot=C>Oe,pt=I*z;if(Sh.add(zr(pt*q*Lt(C),D*k+pt*xe(C))),c+=ot?Y+q*Bi:Y,ot^M>=r^L>=r){var dt=Aa(Yo(x),Yo(T));Ta(dt);var F=Aa(u,dt);Ta(F);var ye=(ot^Y>=0?-1:1)*Ir(F[2]);(a>ye||a===ye&&(dt[0]||dt[1]))&&(h+=ot^Y>=0?1:-1)}}return(c<-Ae||c<Ae&&Sh<-Ae)^h&1}var MU=Ur();var GU=Ur(),VU=Ur();var $w=1/0;var WU=-$w;function Ah(o){this._context=o}Ah.prototype={_radius:4.5,pointRadius:function(o){return this._radius=o,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(o,e){switch(this._point){case 0:{this._context.moveTo(o,e),this._point=1;break}case 1:{this._context.lineTo(o,e);break}default:{this._context.moveTo(o+this._radius,e),this._context.arc(o,e,this._radius,0,Bi);break}}},result:Ti};var eB=Ur();function Th(){this._string=[]}Th.prototype={_radius:4.5,_circle:n0(4.5),pointRadius:function(o){return(o=+o)!==this._radius&&(this._radius=o,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(o,e){switch(this._point){case 0:{this._string.push("M",o,",",e),this._point=1;break}case 1:{this._string.push("L",o,",",e);break}default:{this._circle==null&&(this._circle=n0(this._radius)),this._string.push("M",o,",",e,this._circle);break}}},result:function(){if(this._string.length){var o=this._string.join("");return this._string=[],o}else return null}};function n0(o){return"m0,"+o+"a"+o+","+o+" 0 1,1 0,"+-2*o+"a"+o+","+o+" 0 1,1 0,"+2*o+"z"}function Ch(o,e,r,a){return function(u,c){var h=e(c),p=u.invert(a[0],a[1]),d=xh(),g=e(d),v=!1,x,M,w,I={point:D,lineStart:T,lineEnd:L,polygonStart:function(){I.point=P,I.lineStart=z,I.lineEnd=k,M=[],x=[]},polygonEnd:function(){I.point=D,I.lineStart=T,I.lineEnd=L,M=Xu(M);var Y=bh(x,p);M.length?(v||(c.polygonStart(),v=!0),Mh(M,Kw,Y,r,c)):Y&&(v||(c.polygonStart(),v=!0),c.lineStart(),r(null,null,1,c),c.lineEnd()),v&&(c.polygonEnd(),v=!1),M=x=null},sphere:function(){c.polygonStart(),c.lineStart(),r(null,null,1,c),c.lineEnd(),c.polygonEnd()}};function D(Y,q){var C=u(Y,q);o(Y=C[0],q=C[1])&&c.point(Y,q)}function b(Y,q){var C=u(Y,q);h.point(C[0],C[1])}function T(){I.point=b,h.lineStart()}function L(){I.point=D,h.lineEnd()}function P(Y,q){w.push([Y,q]);var C=u(Y,q);g.point(C[0],C[1])}function z(){g.lineStart(),w=[]}function k(){P(w[0][0],w[0][1]),g.lineEnd();var Y=g.clean(),q=d.result(),C,ot=q.length,pt,dt,F;if(w.pop(),x.push(w),w=null,!!ot){if(Y&1){if(dt=q[0],(pt=dt.length-1)>0){for(v||(c.polygonStart(),v=!0),c.lineStart(),C=0;C<pt;++C)c.point((F=dt[C])[0],F[1]);c.lineEnd()}return}ot>1&&Y&2&&q.push(q.pop().concat(q.shift())),M.push(q.filter(Jw))}}return I}}function Jw(o){return o.length>1}function Kw(o,e){return((o=o.x)[0]<0?o[1]-On-Ae:On-o[1])-((e=e.x)[0]<0?e[1]-On-Ae:On-e[1])}var Qw=Ch(function(){return!0},jw,eS,[-Oe,-On]);function jw(o){var e=NaN,r=NaN,a=NaN,u;return{lineStart:function(){o.lineStart(),u=1},point:function(c,h){var p=c>0?Oe:-Oe,d=mn(c-e);mn(d-Oe)<Ae?(o.point(e,r=(r+h)/2>0?On:-On),o.point(a,r),o.lineEnd(),o.lineStart(),o.point(p,r),o.point(c,r),u=0):a!==p&&d>=Oe&&(mn(e-a)<Ae&&(e-=a*Ae),mn(c-p)<Ae&&(c-=p*Ae),r=tS(e,r,c,h),o.point(a,r),o.lineEnd(),o.lineStart(),o.point(p,r),u=0),o.point(e=c,r=h),a=p},lineEnd:function(){o.lineEnd(),e=r=NaN},clean:function(){return 2-u}}}function tS(o,e,r,a){var u,c,h=Lt(o-r);return mn(h)>Ae?Ai((Lt(e)*(c=xe(a))*Lt(r)-Lt(a)*(u=xe(e))*Lt(o))/(u*c*h)):(e+a)/2}function eS(o,e,r,a){var u;if(o==null)u=r*On,a.point(-Oe,u),a.point(0,u),a.point(Oe,u),a.point(Oe,0),a.point(Oe,-u),a.point(0,-u),a.point(-Oe,-u),a.point(-Oe,0),a.point(-Oe,u);else if(mn(o[0]-e[0])>Ae){var c=o[0]<e[0]?Oe:-Oe;u=r*c/2,a.point(-c,u),a.point(0,u),a.point(c,u)}else a.point(e[0],e[1])}function Yu(o){return function(e){var r=new Ih;for(var a in o)r[a]=o[a];return r.stream=e,r}}function Ih(){}Ih.prototype={constructor:Ih,point:function(o,e){this.stream.point(o,e)},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 VB=xe(30*Br);var nz=Yu({point:function(o,e){this.stream.point(o*Br,e*Br)}});function $u(o){return function(e,r){var a=xe(e),u=xe(r),c=o(a*u);return[c*u*Lt(e),c*Lt(r)]}}function zi(o){return function(e,r){var a=ar(e*e+r*r),u=o(a),c=Lt(u),h=xe(u);return[zr(e*c,a*h),Ir(a&&r*c/a)]}}var l0=$u(function(o){return ar(2/(1+o))});l0.invert=zi(function(o){return 2*Ir(o/2)});var c0=$u(function(o){return(o=_h(o))&&o/Lt(o)});c0.invert=zi(function(o){return o});function Ph(o,e){return[o,Sa(ba((On+e)/2))]}Ph.invert=function(o,e){return[o,2*Ai(Hu(e))-On]};function Zu(o,e){return[o,e]}Zu.invert=Zu;function h0(o,e){var r=xe(e),a=xe(o)*r;return[r*Lt(o)/a,Lt(e)/a]}h0.invert=zi(Ai);function f0(o,e){var r=e*e,a=r*r;return[o*(.8707-.131979*r+a*(-.013791+a*(.003971*r-.001529*a))),e*(1.007226+r*(.015085+a*(-.044475+.028874*r-.005916*a)))]}f0.invert=function(o,e){var r=e,a=25,u;do{var c=r*r,h=c*c;r-=u=(r*(1.007226+c*(.015085+h*(-.044475+.028874*c-.005916*h)))-e)/(1.007226+c*(.015085*3+h*(-.044475*7+.028874*9*c-.005916*11*h)))}while(mn(u)>Ae&&--a>0);return[o/(.8707+(c=r*r)*(-.131979+c*(-.013791+c*c*c*(.003971-.001529*c)))),r]};function p0(o,e){return[xe(e)*Lt(o),Lt(e)]}p0.invert=zi(Ir);function d0(o,e){var r=xe(e),a=1+xe(o)*r;return[r*Lt(o)/a,Lt(e)/a]}d0.invert=zi(function(o){return 2*Ai(o)});function m0(o,e){return[Sa(ba((On+e)/2)),-o]}m0.invert=function(o,e){return[-e,2*Ai(Hu(o))-On]};var aS=ln(Os(),1);var uS=ln(Os(),1);var cS=ln(Os(),1);var hS=ln(Os(),1);function So(o,e){return Math.sqrt((e[0]-o[0])**2+(e[1]-o[1])**2)}function Nh(o){let e=0;for(let r=0;r<o.length-1;r++)e+=So(o[r],o[r+1]);return e}function y0(o,e,r){let a=new br(e[0]-o[0],e[1]-o[1]),u=new br(e[0]-r[0],e[1]-r[1]),h=a.angleTo(u)*180/Math.PI,p=new br(e[0]-o[0],e[1]-o[1]);return new br(r[0]-o[0],r[1]-o[1]).cross(p)>0?h:-h}var si="___",Ju=class{constructor(e=3){this.lift_priority=e;Wr(this,"roadInfo",[]);Wr(this,"pointMap",new Map);Wr(this,"nodeMap",new Map);Wr(this,"facilityMap",new Map);Wr(this,"straightLadderMap",new Map);Wr(this,"escalatorMap",new Map);Wr(this,"staircaseMap",new Map);Wr(this,"lineMap",new Map);Wr(this,"baseRoute",new ki.default);Wr(this,"escalatorRoute",new ki.default);Wr(this,"straightLadderRoute",new ki.default)}initRoute(e){this.clear(),this.roadInfo=e,e.length&&(e.forEach(r=>{r.points.forEach(a=>{let u=`${r.floor}${si}${a.id}`;if(this.pointMap.set(u,a),this.nodeMap.set(`${a.floor}${si}${a.nodeId}`,u),a.type==="straightLadder"){let c=this.straightLadderMap.get(a.name)||[];c.push(js({},a)),this.straightLadderMap.set(a.name,c)}if(a.type==="staircase"){let c=this.staircaseMap.get(a.name)||[];c.push(js({},a)),this.staircaseMap.set(a.name,c)}if(a.type==="escalator"){let c=this.escalatorMap.get(a.name)||{};a.escalatorDirection==="exit"?c.end={floor:a.floor,id:a.id}:c.start={floor:a.floor,id:a.id},this.escalatorMap.set(a.name,c)}if(a.type==="facility"){let c=this.facilityMap.get(a.targetId)||[];c.push(js({},a)),this.facilityMap.set(a.targetId,c)}}),r.lines.filter(a=>a.direction!=="no").forEach(a=>{var d,g;let u=`${r.floor}${si}${a.from}`,c=`${r.floor}${si}${a.to}`,h=(d=this.pointMap.get(u))==null?void 0:d.cds,p=(g=this.pointMap.get(c))==null?void 0:g.cds;if(h!=null&&h.length&&(p!=null&&p.length)){let v=So(h,p);this.addLineItem(u,c,v),a.direction==="double"&&this.addLineItem(c,u,v)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(e,r,a,u=this.lineMap){let c=u.get(e)||new Map;c.set(r,a),u.set(e,c)}addFacilityToLineMap(e,r,a,u){[...this.straightLadderMap,...this.staircaseMap].forEach(([c,h])=>{var p,d;if(!(h.length<2))for(let g=0;g<h.length;g++){let v=`${h[g].floor}${si}${h[g].id}`;for(let x=0;x<h.length;x++)if(g!==x){let M=`${h[x].floor}${si}${h[x].id}`,w=(p=this.pointMap.get(v))==null?void 0:p.cds,I=(d=this.pointMap.get(M))==null?void 0:d.cds;if(w!=null&&w.length&&(I!=null&&I.length))if(h[g].type==="straightLadder"){let D=r;this.addLineItem(v,M,D,u)}else{let D=a;this.addLineItem(v,M,D,u)}}}}),this.escalatorMap.forEach((c,h)=>{var p,d;if(c.start&&c.end){let g=`${c.start.floor}${si}${c.start.id}`,v=`${c.end.floor}${si}${c.end.id}`,x=(p=this.pointMap.get(g))==null?void 0:p.cds,M=(d=this.pointMap.get(v))==null?void 0:d.cds;if(x!=null&&x.length&&(M!=null&&M.length)){let w=e;this.addLineItem(g,v,w,u)}}})}initBaseRoute(){let e=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new ki.default(e)}initEscalatorRoute(){let e=new Map([...this.lineMap]),r=1e4;this.addFacilityToLineMap(1*r,this.lift_priority*r,3e4*r,e),this.escalatorRoute=new ki.default(e)}initStraightLadderRoute(){let e=new Map([...this.lineMap]),r=1e4;this.addFacilityToLineMap(3*r,1*r,3e4*r,e),this.straightLadderRoute=new ki.default(e)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility?!0:this.checkStart(e)}transformStart(e){var r;if(e.nodeId){let a=this.nodeMap.get(`${e.floor}${si}${e.nodeId}`);if(a){let[u,c]=a.split(si);return{floor:u,id:c}}}if((r=e.coord)!=null&&r.length){let a=this.roadInfo.find(c=>c.floor===e.floor);if(!a)return null;let u=a.points.reduce((c,h)=>{let p=So(e.coord,h.cds);return p<c.min&&(c.min=p,c.point=h),c},{min:1/0,point:a.points[0]});return{floor:u.point.floor,id:u.point.id}}return null}transformEnd(e){if(e.floor){let r=this.transformStart(e);if(r)return r}if(e.facility){let r=this.facilityMap.get(e.facility);if(r!=null&&r.length)return{floor:e.floor,facility:e.facility}}return null}getPath(e,r,a=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(r))return"end-error";let u=this.transformStart(e);if(!u)return"no-start";let c=this.transformEnd(r);if(!c)return"no-end";let h=this.getBasePath.bind(this);switch(a){case"escalator":h=this.getEscalatorPath.bind(this);break;case"straightLadder":h=this.getStraightLadderPath.bind(this);break;default:h=this.getBasePath.bind(this);break}if(c.id)return h(u,c);if(c.facility){let p=this.facilityMap.get(c.facility).filter(g=>c.floor?g.floor===c.floor:!0);if(!p.length)return null;let d=p.map(g=>h(u,{floor:g.floor,id:g.id})).filter(g=>!!g);return d.reduce((g,v)=>{let x=v.reduce((M,w)=>M+Nh(w.points),0);return x<g.distance&&(g.distance=x,g.path=v),g},{distance:1/0,path:d[0]}).path}}getRoutePath(e,r,a){let u=`${e.floor}${si}${e.id}`,c=`${r.floor}${si}${r.id}`,h=a.path(u,c);if(!h)return null;let p=[];return h.map(d=>{var v;let g=this.pointMap.get(d);if(g){let{floor:x}=g;if(((v=p[p.length-1])==null?void 0:v.floor)===x){let M=p[p.length-1];M.points.push(g.cds),M.endType=g.type,M.destId=g.nodeId,M.distance=Nh(M.points)}else p.push({floor:x,points:[g.cds],endType:g.type,destId:g.nodeId,distance:0})}}),p}getBasePath(e,r){return this.getRoutePath(e,r,this.baseRoute)}getEscalatorPath(e,r){return this.getRoutePath(e,r,this.escalatorRoute)}getStraightLadderPath(e,r){return this.getRoutePath(e,r,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 ki.default,this.escalatorRoute=new ki.default,this.straightLadderRoute=new ki.default}};var xS=ln(M0(),1);function ES(o,e,r){let a=y0(o,e,r);return 180-Math.abs(a)<15?"front":a>135?"right_front":a<-135?"left_front":a<=135&&a>=60?"right":a>=-135&&a<=-60?"left":a<60&&a>0?"right_back":a>-60&&a<0?"left_back":"front"}function w0(o){if(!o.length)return[];if(o.length===1)return[{direction:"start",distance:0,points:o}];let e=[{direction:"start",distance:So(o[0],o[1]),points:[o[0],o[1]]}];for(let r=2;r<o.length;r++){let a=ES(o[r-2],o[r-1],o[r]);if(a==="front"){let u=e[e.length-1],c=So(o[r-1],o[r]);u.distance+=c,r!==2&&u.points.push(o[r-1])}else e.push({direction:a,distance:So(o[r-1],o[r]),points:[o[r-1],o[r]]})}return e.push({direction:"end",distance:0,points:[o[o.length-1]]}),e}function S0(o){return o.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function b0(o){let e={};for(let a in o)a.startsWith("on")&&(e[S0(a.slice(2))]=o[a]);let r=async({data:a})=>{if(e[a.type])try{let u=await e[a.type](a.data);self.postMessage({type:`${a.type}_result`,key:a.key,data:u})}catch(u){self.postMessage({type:`${a.type}_result`,key:a.key,error:u})}else self.postMessage({type:`${a.type}_result`,key:a.key,error:"no_event"})};return self.addEventListener("message",r),()=>{self.removeEventListener("message",r)}}var Lh=new Ju;b0({onSetRoadInfo({roadData:o}){Lh.initRoute(o)},onGetPath({start:o,end:e,type:r}){return Lh.getPath(o,e,r)},onGetDirectionPath(o){return w0(o)},onClear(){Lh.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-2024 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');
|
|
11667
11670
|
}
|
|
11668
11671
|
|
|
11669
11672
|
// src/plugins/cr-nav-path/cr-nav-path.ts
|
|
@@ -11683,7 +11686,6 @@ var CrNavPath = class extends EventDispatcher15 {
|
|
|
11683
11686
|
async getPath(start, end, type = "") {
|
|
11684
11687
|
return new Promise((resolve, reject) => {
|
|
11685
11688
|
const _getPath = () => {
|
|
11686
|
-
console.log("initRoadStatus", this.initRoadStatus);
|
|
11687
11689
|
triggerWorker(this.worker, "get_path", { start, end, type }).then((data) => {
|
|
11688
11690
|
if (!data) {
|
|
11689
11691
|
reject("no-path");
|
|
@@ -24875,7 +24877,7 @@ function storeLayer(layer, floor2) {
|
|
|
24875
24877
|
icon: options.poi_info.icon,
|
|
24876
24878
|
text: options.poi_info.showName || options.store_name || options.poi_info.text,
|
|
24877
24879
|
position: { x: pos[0], y: pos[1], z: options.airHeight + options.height },
|
|
24878
|
-
icon_size: [
|
|
24880
|
+
icon_size: [24, 24],
|
|
24879
24881
|
level: options.poi_info.level || 0
|
|
24880
24882
|
});
|
|
24881
24883
|
floor2.poiLayer2.pushPoi(poi);
|
|
@@ -24906,7 +24908,7 @@ function facilityLayer(layer, floor2) {
|
|
|
24906
24908
|
icon: options.poi_info.icon,
|
|
24907
24909
|
text: options.poi_info.showName || options.store_name || options.poi_info.text,
|
|
24908
24910
|
position: { x: pos[0], y: pos[1], z: options.airHeight + options.height },
|
|
24909
|
-
icon_size: [
|
|
24911
|
+
icon_size: [24, 24],
|
|
24910
24912
|
level: options.poi_info.level || 0
|
|
24911
24913
|
});
|
|
24912
24914
|
floor2.poiLayer2.pushPoi(poi);
|
|
@@ -25195,10 +25197,13 @@ var AibeeLoader = class extends EventDispatcher19 {
|
|
|
25195
25197
|
const floor2 = new Floor(this.bmap.context);
|
|
25196
25198
|
const floorInfo = this.floors.find((item) => item.floor === floorData.floor);
|
|
25197
25199
|
const angle = floorInfo?.map_angle ?? 0;
|
|
25200
|
+
this.bmap.dispatchEvent({ type: "switch_floor_before" /* SWITCH_FLOOR_BEFORE */, data: { curFloor: floor2, graphics: [] } });
|
|
25198
25201
|
this.dispatchEvent({ type: "switch-floor-before", data: { curFloor: floor2, graphics: [] } });
|
|
25199
25202
|
this.bmap.context.control.setAzimuthalAngle(angle / 180 * Math.PI, true);
|
|
25200
25203
|
this.getFloorBaseLayer(floorData, floor2);
|
|
25201
25204
|
this.changeFloorBox(floorData, floor2);
|
|
25205
|
+
this.bmap.buildingCenter = floor2.userData.center;
|
|
25206
|
+
this.bmap.currentBuildGround = floor2.userData.data.layers.find((item) => item.l_type === "range")?.elements[0];
|
|
25202
25207
|
this.bmap.context.switchFloor(floor2);
|
|
25203
25208
|
this.bmap.initialFloorCamera();
|
|
25204
25209
|
await sleepOneRf();
|
|
@@ -25208,6 +25213,7 @@ var AibeeLoader = class extends EventDispatcher19 {
|
|
|
25208
25213
|
this.bmap.initialFloorCamera();
|
|
25209
25214
|
this.bmap.context.cameraBound.updateBox();
|
|
25210
25215
|
this.dispatchEvent({ type: "switch-floor-after", data: { curFloor: floor2, graphics: floor2.graphicLayer.children } });
|
|
25216
|
+
this.bmap.dispatchEvent({ type: "switch_floor_after" /* SWITCH_FLOOR_AFTER */, data: { curFloor: floor2, graphics: floor2.graphicLayer.children } });
|
|
25211
25217
|
return floor2;
|
|
25212
25218
|
}
|
|
25213
25219
|
getFloorBaseLayer(data, floor2) {
|
|
@@ -25216,7 +25222,6 @@ var AibeeLoader = class extends EventDispatcher19 {
|
|
|
25216
25222
|
}
|
|
25217
25223
|
let center2 = [0, 0];
|
|
25218
25224
|
data.layers.forEach((layer) => {
|
|
25219
|
-
console.log("l_type", layer.l_type);
|
|
25220
25225
|
switch (layer.l_type) {
|
|
25221
25226
|
case "range":
|
|
25222
25227
|
const rangeData = layer.elements[0];
|