@aibee/crc-bmap 0.8.16 → 0.8.18
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 +19 -19
- package/lib/bmap.esm.js +101 -15
- package/lib/bmap.esm.min.js +19 -19
- package/lib/bmap.min.js +19 -19
- package/lib/src/loader/AibeeLoader/index.d.ts +1 -0
- package/lib/src/utils/road2.d.ts +20 -1
- package/package.json +4 -4
package/lib/bmap.esm.js
CHANGED
|
@@ -2791,6 +2791,8 @@ var RoadNetwork2 = class {
|
|
|
2791
2791
|
rampMap = /* @__PURE__ */ new Map();
|
|
2792
2792
|
// 步行梯
|
|
2793
2793
|
staircaseMap = /* @__PURE__ */ new Map();
|
|
2794
|
+
// 地图连接点
|
|
2795
|
+
connectionPointMap = /* @__PURE__ */ new Map();
|
|
2794
2796
|
// 车位号 key是${floor}-${parking-name} */
|
|
2795
2797
|
parkingMap = /* @__PURE__ */ new Map();
|
|
2796
2798
|
// 路网线
|
|
@@ -2810,7 +2812,8 @@ var RoadNetwork2 = class {
|
|
|
2810
2812
|
"escalator",
|
|
2811
2813
|
"straightLadder",
|
|
2812
2814
|
"staircase",
|
|
2813
|
-
"ramp"
|
|
2815
|
+
"ramp",
|
|
2816
|
+
"connectionPoint"
|
|
2814
2817
|
].includes(type);
|
|
2815
2818
|
}
|
|
2816
2819
|
initFacilities(facilities) {
|
|
@@ -2943,6 +2946,17 @@ var RoadNetwork2 = class {
|
|
|
2943
2946
|
}
|
|
2944
2947
|
this.rampMap.set(point3.targetId, rampArr);
|
|
2945
2948
|
break;
|
|
2949
|
+
case "connectionPoint":
|
|
2950
|
+
if (facility.entry_end_floor.find(
|
|
2951
|
+
(item) => item.floor === floorRoadInfo.floor
|
|
2952
|
+
) && facility.entry_start_floor.find(
|
|
2953
|
+
(item) => item.floor === floorRoadInfo.floor
|
|
2954
|
+
)) {
|
|
2955
|
+
const connectionPointArr = this.connectionPointMap.get(point3.targetId) || [];
|
|
2956
|
+
connectionPointArr.push({ ...point3 });
|
|
2957
|
+
this.connectionPointMap.set(point3.targetId, connectionPointArr);
|
|
2958
|
+
}
|
|
2959
|
+
break;
|
|
2946
2960
|
}
|
|
2947
2961
|
const arr = this.facilityMap.get(point3.targetId) || [];
|
|
2948
2962
|
arr.push({ ...point3 });
|
|
@@ -3099,7 +3113,7 @@ var RoadNetwork2 = class {
|
|
|
3099
3113
|
this.setPermissionLine(fromKey, toKey, fromPoint.permission, 1, "staircase");
|
|
3100
3114
|
}
|
|
3101
3115
|
if (toPoint.permission && toPoint.permission !== fromPoint.permission) {
|
|
3102
|
-
this.setPermissionLine(fromKey, toKey, toPoint.permission, 1, "
|
|
3116
|
+
this.setPermissionLine(fromKey, toKey, toPoint.permission, 1, "staircase");
|
|
3103
3117
|
}
|
|
3104
3118
|
}
|
|
3105
3119
|
}
|
|
@@ -3141,6 +3155,34 @@ var RoadNetwork2 = class {
|
|
|
3141
3155
|
}
|
|
3142
3156
|
});
|
|
3143
3157
|
});
|
|
3158
|
+
this.connectionPointMap.forEach((value, key) => {
|
|
3159
|
+
if (value.length < 2) {
|
|
3160
|
+
this.connectionPointMap.delete(key);
|
|
3161
|
+
return;
|
|
3162
|
+
}
|
|
3163
|
+
for (let i2 = 0; i2 < value.length; i2++) {
|
|
3164
|
+
const fromKey = `${value[i2].floor}${SPLIT_FLG2}${value[i2].id}`;
|
|
3165
|
+
const fromPoint = this.pointMap.get(fromKey);
|
|
3166
|
+
if (!fromPoint) {
|
|
3167
|
+
continue;
|
|
3168
|
+
}
|
|
3169
|
+
for (let j = 0; j < value.length; j++) {
|
|
3170
|
+
if (i2 !== j) {
|
|
3171
|
+
const toKey = `${value[j].floor}${SPLIT_FLG2}${value[j].id}`;
|
|
3172
|
+
const toPoint = this.pointMap.get(toKey);
|
|
3173
|
+
if (!toPoint) {
|
|
3174
|
+
continue;
|
|
3175
|
+
}
|
|
3176
|
+
if (fromPoint.permission) {
|
|
3177
|
+
this.setPermissionLine(fromKey, toKey, fromPoint.permission, 1, "connectionPoint");
|
|
3178
|
+
}
|
|
3179
|
+
if (toPoint.permission && toPoint.permission !== fromPoint.permission) {
|
|
3180
|
+
this.setPermissionLine(fromKey, toKey, toPoint.permission, 1, "connectionPoint");
|
|
3181
|
+
}
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
});
|
|
3144
3186
|
}
|
|
3145
3187
|
// 添加有权限的点到路网
|
|
3146
3188
|
addPermissionLineToMap(permission, types, lineMap, weightMap) {
|
|
@@ -3211,6 +3253,28 @@ var RoadNetwork2 = class {
|
|
|
3211
3253
|
}
|
|
3212
3254
|
});
|
|
3213
3255
|
});
|
|
3256
|
+
this.connectionPointMap.forEach((value, _) => {
|
|
3257
|
+
if (value.length < 2) {
|
|
3258
|
+
return;
|
|
3259
|
+
}
|
|
3260
|
+
for (let i2 = 0; i2 < value.length; i2++) {
|
|
3261
|
+
const fromKey = `${value[i2].floor}${SPLIT_FLG2}${value[i2].id}`;
|
|
3262
|
+
const fromPoint = this.pointMap.get(fromKey);
|
|
3263
|
+
if (!fromPoint || fromPoint.permission) {
|
|
3264
|
+
continue;
|
|
3265
|
+
}
|
|
3266
|
+
for (let j = 0; j < value.length; j++) {
|
|
3267
|
+
if (i2 !== j) {
|
|
3268
|
+
const toKey = `${value[j].floor}${SPLIT_FLG2}${value[j].id}`;
|
|
3269
|
+
const toPoint = this.pointMap.get(toKey);
|
|
3270
|
+
if (!toPoint || toPoint.permission) {
|
|
3271
|
+
continue;
|
|
3272
|
+
}
|
|
3273
|
+
this.addLineItem(fromKey, toKey, 100, lineMap);
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
});
|
|
3214
3278
|
}
|
|
3215
3279
|
// 最短路径
|
|
3216
3280
|
initBaseRoute() {
|
|
@@ -3253,6 +3317,28 @@ var RoadNetwork2 = class {
|
|
|
3253
3317
|
}
|
|
3254
3318
|
});
|
|
3255
3319
|
});
|
|
3320
|
+
this.connectionPointMap.forEach((value, _) => {
|
|
3321
|
+
if (value.length < 2) {
|
|
3322
|
+
return;
|
|
3323
|
+
}
|
|
3324
|
+
for (let i2 = 0; i2 < value.length; i2++) {
|
|
3325
|
+
const fromKey = `${value[i2].floor}${SPLIT_FLG2}${value[i2].id}`;
|
|
3326
|
+
const fromPoint = this.pointMap.get(fromKey);
|
|
3327
|
+
if (!fromPoint || fromPoint.permission) {
|
|
3328
|
+
continue;
|
|
3329
|
+
}
|
|
3330
|
+
for (let j = 0; j < value.length; j++) {
|
|
3331
|
+
if (i2 !== j) {
|
|
3332
|
+
const toKey = `${value[j].floor}${SPLIT_FLG2}${value[j].id}`;
|
|
3333
|
+
const toPoint = this.pointMap.get(toKey);
|
|
3334
|
+
if (!toPoint || toPoint.permission) {
|
|
3335
|
+
continue;
|
|
3336
|
+
}
|
|
3337
|
+
this.addLineItem(fromKey, toKey, 100, this.forwardLineMap);
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
});
|
|
3256
3342
|
this.forwardRoute = new import_node_dijkstra2.default(this.forwardLineMap);
|
|
3257
3343
|
}
|
|
3258
3344
|
checkStart(start) {
|
|
@@ -3470,8 +3556,9 @@ var RoadNetwork2 = class {
|
|
|
3470
3556
|
return this.getRoutePath(start, end, this.baseRoute);
|
|
3471
3557
|
}
|
|
3472
3558
|
const tempMap = cloneDeep(this.baseRoute.graph);
|
|
3473
|
-
this.addPermissionLineToMap(permission, ["", "escalator", "staircase", "straightLadder"], tempMap, /* @__PURE__ */ new Map([
|
|
3559
|
+
this.addPermissionLineToMap(permission, ["", "escalator", "staircase", "straightLadder", "connectionPoint"], tempMap, /* @__PURE__ */ new Map([
|
|
3474
3560
|
["escalator", 100],
|
|
3561
|
+
["connectionPoint", 100],
|
|
3475
3562
|
["straightLadder", 100 + this.lift_priority],
|
|
3476
3563
|
["staircase", 3e4]
|
|
3477
3564
|
]));
|
|
@@ -3485,8 +3572,9 @@ var RoadNetwork2 = class {
|
|
|
3485
3572
|
}
|
|
3486
3573
|
const tempMap = cloneDeep(this.escalatorRoute.graph);
|
|
3487
3574
|
const step = 1e4;
|
|
3488
|
-
this.addPermissionLineToMap(permission, ["", "escalator", "staircase", "straightLadder"], tempMap, /* @__PURE__ */ new Map([
|
|
3575
|
+
this.addPermissionLineToMap(permission, ["", "escalator", "staircase", "straightLadder", "connectionPoint"], tempMap, /* @__PURE__ */ new Map([
|
|
3489
3576
|
["escalator", 1 * step],
|
|
3577
|
+
["connectionPoint", 100],
|
|
3490
3578
|
["straightLadder", this.lift_priority * step],
|
|
3491
3579
|
["staircase", 3e4 * step]
|
|
3492
3580
|
]));
|
|
@@ -3500,8 +3588,9 @@ var RoadNetwork2 = class {
|
|
|
3500
3588
|
}
|
|
3501
3589
|
const tempMap = cloneDeep(this.straightLadderRoute.graph);
|
|
3502
3590
|
const step = 1e4;
|
|
3503
|
-
this.addPermissionLineToMap(permission, ["", "escalator", "staircase", "straightLadder"], tempMap, /* @__PURE__ */ new Map([
|
|
3591
|
+
this.addPermissionLineToMap(permission, ["", "escalator", "staircase", "straightLadder", "connectionPoint"], tempMap, /* @__PURE__ */ new Map([
|
|
3504
3592
|
["escalator", 3 * step],
|
|
3593
|
+
["connectionPoint", 100],
|
|
3505
3594
|
["straightLadder", 1 * step],
|
|
3506
3595
|
["staircase", 3e4 * step]
|
|
3507
3596
|
]));
|
|
@@ -6503,7 +6592,6 @@ var Wall = class extends Object3D9 {
|
|
|
6503
6592
|
if (this.options[0].strokeOpacity !== 0) {
|
|
6504
6593
|
this.initLineMaterial();
|
|
6505
6594
|
this.initLineGeometry();
|
|
6506
|
-
this.createBorder();
|
|
6507
6595
|
}
|
|
6508
6596
|
}
|
|
6509
6597
|
dispose() {
|
|
@@ -11628,7 +11716,7 @@ import { EventDispatcher as EventDispatcher14 } from "three";
|
|
|
11628
11716
|
|
|
11629
11717
|
// ../src/plugins/nav-path/path.worker.ts
|
|
11630
11718
|
function InlineWorker() {
|
|
11631
|
-
let blob = new Blob(['var Ab=Object.create;var Nm=Object.defineProperty;var Tb=Object.getOwnPropertyDescriptor;var Cb=Object.getOwnPropertyNames;var Ib=Object.getPrototypeOf,Pb=Object.prototype.hasOwnProperty;var It=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var Rb=(o,e,r,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of Cb(e))!Pb.call(o,l)&&l!==r&&Nm(o,l,{get:()=>e[l],enumerable:!(u=Tb(e,l))||u.enumerable});return o};var nr=(o,e,r)=>(r=o!=null?Ab(Ib(o)):{},Rb(e||!o||!o.__esModule?Nm(r,"default",{value:o,enumerable:!0}):r,o));var Om=It((gN,Dm)=>{var Nh=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,r)=>e.priority-r.priority)}set(e,r){let u=Number(r);if(isNaN(u))throw new TypeError(\'"priority" must be a number\');return this.keys.has(e)?this.queue.map(l=>(l.key===e&&Object.assign(l,{priority:u}),l)):(this.keys.add(e),this.queue.push({key:e,priority:u})),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)}};Dm.exports=Nh});var Bm=It((mN,Um)=>{function Fm(o,e){let r=new Map;for(let[u,l]of o)u!==e&&l instanceof Map?r.set(u,Fm(l,e)):u!==e&&r.set(u,l);return r}Um.exports=Fm});var Gm=It((yN,km)=>{function Lb(o){let e=Number(o);return!(isNaN(e)||e<=0)}function zm(o){let e=new Map;return Object.keys(o).forEach(u=>{let l=o[u];if(l!==null&&typeof l=="object"&&!Array.isArray(l))return e.set(u,zm(l));if(!Lb(l))throw new Error(`Could not add node at key "${u}", make sure it\'s a valid node`,l);return e.set(u,Number(l))}),e}km.exports=zm});var Wm=It((vN,Vm)=>{function Hm(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){Hm(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${r}`)})}Vm.exports=Hm});var $m=It((_N,Ym)=>{var Nb=Om(),Db=Bm(),qm=Gm(),Xm=Wm(),Dh=class{constructor(e){e instanceof Map?(Xm(e),this.graph=e):e?this.graph=qm(e):this.graph=new Map}addNode(e,r){let u;return r instanceof Map?(Xm(r),u=r):u=qm(r),this.graph.set(e,u),this}addVertex(e,r){return this.addNode(e,r)}removeNode(e){return this.graph=Db(this.graph,e),this}path(e,r,u={}){if(!this.graph.size)return u.cost?{path:null,cost:0}:null;let l=new Set,h=new Nb,p=new Map,m=[],y=0,x=[];if(u.avoid&&(x=[].concat(u.avoid)),x.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(x.includes(r))throw new Error(`Ending node (${r}) cannot be avoided`);for(h.set(e,0);!h.isEmpty();){let E=h.next();if(E.key===r){y=E.priority;let S=E.key;for(;p.has(S);)m.push(S),S=p.get(S);break}l.add(E.key),(this.graph.get(E.key)||new Map).forEach((S,C)=>{if(l.has(C)||x.includes(C))return null;if(!h.has(C))return p.set(C,E.key),h.set(C,E.priority+S);let D=h.get(C).priority,G=E.priority+S;return G<D?(p.set(C,E.key),h.set(C,G)):null})}return m.length?(u.trim?m.shift():m=m.concat([e]),u.reverse||(m=m.reverse()),u.cost?{path:m,cost:y}:m):u.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};Ym.exports=Dh});var Oc=It((ON,R0)=>{"use strict";var P0=Object.getOwnPropertySymbols,VC=Object.prototype.hasOwnProperty,WC=Object.prototype.propertyIsEnumerable;function qC(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function XC(){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 u=Object.getOwnPropertyNames(e).map(function(h){return e[h]});if(u.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(h){l[h]=h}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}R0.exports=XC()?Object.assign:function(o,e){for(var r,u=qC(o),l,h=1;h<arguments.length;h++){r=Object(arguments[h]);for(var p in r)VC.call(r,p)&&(u[p]=r[p]);if(P0){l=P0(r);for(var m=0;m<l.length;m++)WC.call(r,l[m])&&(u[l[m]]=r[l[m]])}}return u}});var pp=It((fp,hp)=>{(function(o,e){typeof fp=="object"&&typeof hp<"u"?hp.exports=e():typeof define=="function"&&define.amd?define(e):(o=o||self).RBush=e()})(fp,function(){"use strict";function o(O,L,k,F,$){(function Z(it,et,U,wt,Lt){for(;wt>U;){if(wt-U>600){var Ot=wt-U+1,W=et-U+1,de=Math.log(Ot),yt=.5*Math.exp(2*de/3),zt=.5*Math.sqrt(de*yt*(Ot-yt)/Ot)*(W-Ot/2<0?-1:1),Kt=Math.max(U,Math.floor(et-W*yt/Ot+zt)),ie=Math.min(wt,Math.floor(et+(Ot-W)*yt/Ot+zt));Z(it,et,Kt,ie,Lt)}var _t=it[et],Pt=U,q=wt;for(e(it,U,et),Lt(it[wt],_t)>0&&e(it,U,wt);Pt<q;){for(e(it,Pt,q),Pt++,q--;Lt(it[Pt],_t)<0;)Pt++;for(;Lt(it[q],_t)>0;)q--}Lt(it[U],_t)===0?e(it,U,q):e(it,++q,wt),q<=et&&(U=q+1),et<=q&&(wt=q-1)}})(O,L,k||0,F||O.length-1,$||r)}function e(O,L,k){var F=O[L];O[L]=O[k],O[k]=F}function r(O,L){return O<L?-1:O>L?1:0}var u=function(O){O===void 0&&(O=9),this._maxEntries=Math.max(4,O),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function l(O,L,k){if(!k)return L.indexOf(O);for(var F=0;F<L.length;F++)if(k(O,L[F]))return F;return-1}function h(O,L){p(O,0,O.children.length,L,O)}function p(O,L,k,F,$){$||($=D(null)),$.minX=1/0,$.minY=1/0,$.maxX=-1/0,$.maxY=-1/0;for(var Z=L;Z<k;Z++){var it=O.children[Z];m($,O.leaf?F(it):it)}return $}function m(O,L){return O.minX=Math.min(O.minX,L.minX),O.minY=Math.min(O.minY,L.minY),O.maxX=Math.max(O.maxX,L.maxX),O.maxY=Math.max(O.maxY,L.maxY),O}function y(O,L){return O.minX-L.minX}function x(O,L){return O.minY-L.minY}function E(O){return(O.maxX-O.minX)*(O.maxY-O.minY)}function b(O){return O.maxX-O.minX+(O.maxY-O.minY)}function S(O,L){return O.minX<=L.minX&&O.minY<=L.minY&&L.maxX<=O.maxX&&L.maxY<=O.maxY}function C(O,L){return L.minX<=O.maxX&&L.minY<=O.maxY&&L.maxX>=O.minX&&L.maxY>=O.minY}function D(O){return{children:O,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function G(O,L,k,F,$){for(var Z=[L,k];Z.length;)if(!((k=Z.pop())-(L=Z.pop())<=F)){var it=L+Math.ceil((k-L)/F/2)*F;o(O,it,L,k,$),Z.push(L,it,it,k)}}return u.prototype.all=function(){return this._all(this.data,[])},u.prototype.search=function(O){var L=this.data,k=[];if(!C(O,L))return k;for(var F=this.toBBox,$=[];L;){for(var Z=0;Z<L.children.length;Z++){var it=L.children[Z],et=L.leaf?F(it):it;C(O,et)&&(L.leaf?k.push(it):S(O,et)?this._all(it,k):$.push(it))}L=$.pop()}return k},u.prototype.collides=function(O){var L=this.data;if(!C(O,L))return!1;for(var k=[];L;){for(var F=0;F<L.children.length;F++){var $=L.children[F],Z=L.leaf?this.toBBox($):$;if(C(O,Z)){if(L.leaf||S(O,Z))return!0;k.push($)}}L=k.pop()}return!1},u.prototype.load=function(O){if(!O||!O.length)return this;if(O.length<this._minEntries){for(var L=0;L<O.length;L++)this.insert(O[L]);return this}var k=this._build(O.slice(),0,O.length-1,0);if(this.data.children.length)if(this.data.height===k.height)this._splitRoot(this.data,k);else{if(this.data.height<k.height){var F=this.data;this.data=k,k=F}this._insert(k,this.data.height-k.height-1,!0)}else this.data=k;return this},u.prototype.insert=function(O){return O&&this._insert(O,this.data.height-1),this},u.prototype.clear=function(){return this.data=D([]),this},u.prototype.remove=function(O,L){if(!O)return this;for(var k,F,$,Z=this.data,it=this.toBBox(O),et=[],U=[];Z||et.length;){if(Z||(Z=et.pop(),F=et[et.length-1],k=U.pop(),$=!0),Z.leaf){var wt=l(O,Z.children,L);if(wt!==-1)return Z.children.splice(wt,1),et.push(Z),this._condense(et),this}$||Z.leaf||!S(Z,it)?F?(k++,Z=F.children[k],$=!1):Z=null:(et.push(Z),U.push(k),k=0,F=Z,Z=Z.children[0])}return this},u.prototype.toBBox=function(O){return O},u.prototype.compareMinX=function(O,L){return O.minX-L.minX},u.prototype.compareMinY=function(O,L){return O.minY-L.minY},u.prototype.toJSON=function(){return this.data},u.prototype.fromJSON=function(O){return this.data=O,this},u.prototype._all=function(O,L){for(var k=[];O;)O.leaf?L.push.apply(L,O.children):k.push.apply(k,O.children),O=k.pop();return L},u.prototype._build=function(O,L,k,F){var $,Z=k-L+1,it=this._maxEntries;if(Z<=it)return h($=D(O.slice(L,k+1)),this.toBBox),$;F||(F=Math.ceil(Math.log(Z)/Math.log(it)),it=Math.ceil(Z/Math.pow(it,F-1))),($=D([])).leaf=!1,$.height=F;var et=Math.ceil(Z/it),U=et*Math.ceil(Math.sqrt(it));G(O,L,k,U,this.compareMinX);for(var wt=L;wt<=k;wt+=U){var Lt=Math.min(wt+U-1,k);G(O,wt,Lt,et,this.compareMinY);for(var Ot=wt;Ot<=Lt;Ot+=et){var W=Math.min(Ot+et-1,Lt);$.children.push(this._build(O,Ot,W,F-1))}}return h($,this.toBBox),$},u.prototype._chooseSubtree=function(O,L,k,F){for(;F.push(L),!L.leaf&&F.length-1!==k;){for(var $=1/0,Z=1/0,it=void 0,et=0;et<L.children.length;et++){var U=L.children[et],wt=E(U),Lt=(Ot=O,W=U,(Math.max(W.maxX,Ot.maxX)-Math.min(W.minX,Ot.minX))*(Math.max(W.maxY,Ot.maxY)-Math.min(W.minY,Ot.minY))-wt);Lt<Z?(Z=Lt,$=wt<$?wt:$,it=U):Lt===Z&&wt<$&&($=wt,it=U)}L=it||L.children[0]}var Ot,W;return L},u.prototype._insert=function(O,L,k){var F=k?O:this.toBBox(O),$=[],Z=this._chooseSubtree(F,this.data,L,$);for(Z.children.push(O),m(Z,F);L>=0&&$[L].children.length>this._maxEntries;)this._split($,L),L--;this._adjustParentBBoxes(F,$,L)},u.prototype._split=function(O,L){var k=O[L],F=k.children.length,$=this._minEntries;this._chooseSplitAxis(k,$,F);var Z=this._chooseSplitIndex(k,$,F),it=D(k.children.splice(Z,k.children.length-Z));it.height=k.height,it.leaf=k.leaf,h(k,this.toBBox),h(it,this.toBBox),L?O[L-1].children.push(it):this._splitRoot(k,it)},u.prototype._splitRoot=function(O,L){this.data=D([O,L]),this.data.height=O.height+1,this.data.leaf=!1,h(this.data,this.toBBox)},u.prototype._chooseSplitIndex=function(O,L,k){for(var F,$,Z,it,et,U,wt,Lt=1/0,Ot=1/0,W=L;W<=k-L;W++){var de=p(O,0,W,this.toBBox),yt=p(O,W,k,this.toBBox),zt=($=de,Z=yt,it=void 0,et=void 0,U=void 0,wt=void 0,it=Math.max($.minX,Z.minX),et=Math.max($.minY,Z.minY),U=Math.min($.maxX,Z.maxX),wt=Math.min($.maxY,Z.maxY),Math.max(0,U-it)*Math.max(0,wt-et)),Kt=E(de)+E(yt);zt<Lt?(Lt=zt,F=W,Ot=Kt<Ot?Kt:Ot):zt===Lt&&Kt<Ot&&(Ot=Kt,F=W)}return F||k-L},u.prototype._chooseSplitAxis=function(O,L,k){var F=O.leaf?this.compareMinX:y,$=O.leaf?this.compareMinY:x;this._allDistMargin(O,L,k,F)<this._allDistMargin(O,L,k,$)&&O.children.sort(F)},u.prototype._allDistMargin=function(O,L,k,F){O.children.sort(F);for(var $=this.toBBox,Z=p(O,0,L,$),it=p(O,k-L,k,$),et=b(Z)+b(it),U=L;U<k-L;U++){var wt=O.children[U];m(Z,O.leaf?$(wt):wt),et+=b(Z)}for(var Lt=k-L-1;Lt>=L;Lt--){var Ot=O.children[Lt];m(it,O.leaf?$(Ot):Ot),et+=b(it)}return et},u.prototype._adjustParentBBoxes=function(O,L,k){for(var F=k;F>=0;F--)m(L[F],O)},u.prototype._condense=function(O){for(var L=O.length-1,k=void 0;L>=0;L--)O[L].children.length===0?L>0?(k=O[L-1].children).splice(k.indexOf(O[L]),1):this.clear():h(O[L],this.toBBox)},u})});var L0=It((dp,gp)=>{(function(o,e){typeof dp=="object"&&typeof gp<"u"?gp.exports=e():typeof define=="function"&&define.amd?define(e):(o=o||self,o.TinyQueue=e())})(dp,function(){"use strict";var o=function(u,l){if(u===void 0&&(u=[]),l===void 0&&(l=e),this.data=u,this.length=this.data.length,this.compare=l,this.length>0)for(var h=(this.length>>1)-1;h>=0;h--)this._down(h)};o.prototype.push=function(u){this.data.push(u),this.length++,this._up(this.length-1)},o.prototype.pop=function(){if(this.length!==0){var u=this.data[0],l=this.data.pop();return this.length--,this.length>0&&(this.data[0]=l,this._down(0)),u}},o.prototype.peek=function(){return this.data[0]},o.prototype._up=function(u){for(var l=this,h=l.data,p=l.compare,m=h[u];u>0;){var y=u-1>>1,x=h[y];if(p(m,x)>=0)break;h[u]=x,u=y}h[u]=m},o.prototype._down=function(u){for(var l=this,h=l.data,p=l.compare,m=this.length>>1,y=h[u];u<m;){var x=(u<<1)+1,E=h[x],b=x+1;if(b<this.length&&p(h[b],E)<0&&(x=b,E=h[b]),p(E,y)>=0)break;h[u]=E,u=x}h[u]=y};function e(r,u){return r<u?-1:r>u?1:0}return o})});var D0=It((GN,N0)=>{N0.exports=function(e,r,u,l){var h=e[0],p=e[1],m=!1;u===void 0&&(u=0),l===void 0&&(l=r.length);for(var y=(l-u)/2,x=0,E=y-1;x<y;E=x++){var b=r[u+x*2+0],S=r[u+x*2+1],C=r[u+E*2+0],D=r[u+E*2+1],G=S>p!=D>p&&h<(C-b)*(p-S)/(D-S)+b;G&&(m=!m)}return m}});var F0=It((HN,O0)=>{O0.exports=function(e,r,u,l){var h=e[0],p=e[1],m=!1;u===void 0&&(u=0),l===void 0&&(l=r.length);for(var y=l-u,x=0,E=y-1;x<y;E=x++){var b=r[x+u][0],S=r[x+u][1],C=r[E+u][0],D=r[E+u][1],G=S>p!=D>p&&h<(C-b)*(p-S)/(D-S)+b;G&&(m=!m)}return m}});var z0=It((VN,Bc)=>{var U0=D0(),B0=F0();Bc.exports=function(e,r,u,l){return r.length>0&&Array.isArray(r[0])?B0(e,r,u,l):U0(e,r,u,l)};Bc.exports.nested=B0;Bc.exports.flat=U0});var G0=It((zc,k0)=>{(function(o,e){typeof zc=="object"&&typeof k0<"u"?e(zc):typeof define=="function"&&define.amd?define(["exports"],e):e((o=o||self).predicates={})})(zc,function(o){"use strict";let r=33306690738754706e-32;function u(C,D,G,O,L){let k,F,$,Z,it=D[0],et=O[0],U=0,wt=0;et>it==et>-it?(k=it,it=D[++U]):(k=et,et=O[++wt]);let Lt=0;if(U<C&&wt<G)for(et>it==et>-it?($=k-((F=it+k)-it),it=D[++U]):($=k-((F=et+k)-et),et=O[++wt]),k=F,$!==0&&(L[Lt++]=$);U<C&&wt<G;)et>it==et>-it?($=k-((F=k+it)-(Z=F-k))+(it-Z),it=D[++U]):($=k-((F=k+et)-(Z=F-k))+(et-Z),et=O[++wt]),k=F,$!==0&&(L[Lt++]=$);for(;U<C;)$=k-((F=k+it)-(Z=F-k))+(it-Z),it=D[++U],k=F,$!==0&&(L[Lt++]=$);for(;wt<G;)$=k-((F=k+et)-(Z=F-k))+(et-Z),et=O[++wt],k=F,$!==0&&(L[Lt++]=$);return k===0&&Lt!==0||(L[Lt++]=k),Lt}function l(C){return new Float64Array(C)}let h=33306690738754716e-32,p=22204460492503146e-32,m=11093356479670487e-47,y=l(4),x=l(8),E=l(12),b=l(16),S=l(4);o.orient2d=function(C,D,G,O,L,k){let F=(D-k)*(G-L),$=(C-L)*(O-k),Z=F-$;if(F===0||$===0||F>0!=$>0)return Z;let it=Math.abs(F+$);return Math.abs(Z)>=h*it?Z:-function(et,U,wt,Lt,Ot,W,de){let yt,zt,Kt,ie,_t,Pt,q,oe,Vt,tn,Mt,mn,Hn,yn,Ge,an,Et,Pr,Jt=et-Ot,jn=wt-Ot,hn=U-W,vn=Lt-W;_t=(Ge=(oe=Jt-(q=(Pt=134217729*Jt)-(Pt-Jt)))*(tn=vn-(Vt=(Pt=134217729*vn)-(Pt-vn)))-((yn=Jt*vn)-q*Vt-oe*Vt-q*tn))-(Mt=Ge-(Et=(oe=hn-(q=(Pt=134217729*hn)-(Pt-hn)))*(tn=jn-(Vt=(Pt=134217729*jn)-(Pt-jn)))-((an=hn*jn)-q*Vt-oe*Vt-q*tn))),y[0]=Ge-(Mt+_t)+(_t-Et),_t=(Hn=yn-((mn=yn+Mt)-(_t=mn-yn))+(Mt-_t))-(Mt=Hn-an),y[1]=Hn-(Mt+_t)+(_t-an),_t=(Pr=mn+Mt)-mn,y[2]=mn-(Pr-_t)+(Mt-_t),y[3]=Pr;let On=function(wi,Mi){let qr=Mi[0];for(let Rr=1;Rr<wi;Rr++)qr+=Mi[Rr];return qr}(4,y),xr=p*de;if(On>=xr||-On>=xr||(yt=et-(Jt+(_t=et-Jt))+(_t-Ot),Kt=wt-(jn+(_t=wt-jn))+(_t-Ot),zt=U-(hn+(_t=U-hn))+(_t-W),ie=Lt-(vn+(_t=Lt-vn))+(_t-W),yt===0&&zt===0&&Kt===0&&ie===0)||(xr=m*de+r*Math.abs(On),(On+=Jt*ie+vn*yt-(hn*Kt+jn*zt))>=xr||-On>=xr))return On;_t=(Ge=(oe=yt-(q=(Pt=134217729*yt)-(Pt-yt)))*(tn=vn-(Vt=(Pt=134217729*vn)-(Pt-vn)))-((yn=yt*vn)-q*Vt-oe*Vt-q*tn))-(Mt=Ge-(Et=(oe=zt-(q=(Pt=134217729*zt)-(Pt-zt)))*(tn=jn-(Vt=(Pt=134217729*jn)-(Pt-jn)))-((an=zt*jn)-q*Vt-oe*Vt-q*tn))),S[0]=Ge-(Mt+_t)+(_t-Et),_t=(Hn=yn-((mn=yn+Mt)-(_t=mn-yn))+(Mt-_t))-(Mt=Hn-an),S[1]=Hn-(Mt+_t)+(_t-an),_t=(Pr=mn+Mt)-mn,S[2]=mn-(Pr-_t)+(Mt-_t),S[3]=Pr;let ui=u(4,y,4,S,x);_t=(Ge=(oe=Jt-(q=(Pt=134217729*Jt)-(Pt-Jt)))*(tn=ie-(Vt=(Pt=134217729*ie)-(Pt-ie)))-((yn=Jt*ie)-q*Vt-oe*Vt-q*tn))-(Mt=Ge-(Et=(oe=hn-(q=(Pt=134217729*hn)-(Pt-hn)))*(tn=Kt-(Vt=(Pt=134217729*Kt)-(Pt-Kt)))-((an=hn*Kt)-q*Vt-oe*Vt-q*tn))),S[0]=Ge-(Mt+_t)+(_t-Et),_t=(Hn=yn-((mn=yn+Mt)-(_t=mn-yn))+(Mt-_t))-(Mt=Hn-an),S[1]=Hn-(Mt+_t)+(_t-an),_t=(Pr=mn+Mt)-mn,S[2]=mn-(Pr-_t)+(Mt-_t),S[3]=Pr;let Nt=u(ui,x,4,S,E);_t=(Ge=(oe=yt-(q=(Pt=134217729*yt)-(Pt-yt)))*(tn=ie-(Vt=(Pt=134217729*ie)-(Pt-ie)))-((yn=yt*ie)-q*Vt-oe*Vt-q*tn))-(Mt=Ge-(Et=(oe=zt-(q=(Pt=134217729*zt)-(Pt-zt)))*(tn=Kt-(Vt=(Pt=134217729*Kt)-(Pt-Kt)))-((an=zt*Kt)-q*Vt-oe*Vt-q*tn))),S[0]=Ge-(Mt+_t)+(_t-Et),_t=(Hn=yn-((mn=yn+Mt)-(_t=mn-yn))+(Mt-_t))-(Mt=Hn-an),S[1]=Hn-(Mt+_t)+(_t-an),_t=(Pr=mn+Mt)-mn,S[2]=mn-(Pr-_t)+(Mt-_t),S[3]=Pr;let He=u(Nt,E,4,S,b);return b[He-1]}(C,D,G,O,L,k,it)},o.orient2dfast=function(C,D,G,O,L,k){return(D-k)*(G-L)-(C-L)*(O-k)},Object.defineProperty(o,"__esModule",{value:!0})})});var Y0=It((WN,_p)=>{"use strict";var H0=pp(),Gc=L0(),$C=z0(),ZC=G0().orient2d;Gc.default&&(Gc=Gc.default);_p.exports=X0;_p.exports.default=X0;function X0(o,e,r){e=Math.max(0,e===void 0?2:e),r=r||0;var u=tI(o),l=new H0(16);l.toBBox=function(k){return{minX:k[0],minY:k[1],maxX:k[0],maxY:k[1]}},l.compareMinX=function(k,F){return k[0]-F[0]},l.compareMinY=function(k,F){return k[1]-F[1]},l.load(o);for(var h=[],p=0,m;p<u.length;p++){var y=u[p];l.remove(y),m=q0(y,m),h.push(m)}var x=new H0(16);for(p=0;p<h.length;p++)x.insert(mp(h[p]));for(var E=e*e,b=r*r;h.length;){var S=h.shift(),C=S.p,D=S.next.p,G=yp(C,D);if(!(G<b)){var O=G/E;y=JC(l,S.prev.p,C,D,S.next.next.p,O,x),y&&Math.min(yp(y,C),yp(y,D))<=O&&(h.push(S),h.push(q0(y,S)),l.remove(y),x.remove(S),x.insert(mp(S)),x.insert(mp(S.next)))}}S=m;var L=[];do L.push(S.p),S=S.next;while(S!==m);return L.push(S.p),L}function JC(o,e,r,u,l,h,p){for(var m=new Gc([],KC),y=o.data;y;){for(var x=0;x<y.children.length;x++){var E=y.children[x],b=y.leaf?vp(E,r,u):QC(r,u,E);b>h||m.push({node:E,dist:b})}for(;m.length&&!m.peek().node.children;){var S=m.pop(),C=S.node,D=vp(C,e,r),G=vp(C,u,l);if(S.dist<D&&S.dist<G&&W0(r,C,p)&&W0(u,C,p))return C}y=m.pop(),y&&(y=y.node)}return null}function KC(o,e){return o.dist-e.dist}function QC(o,e,r){if(V0(o,r)||V0(e,r))return 0;var u=kc(o[0],o[1],e[0],e[1],r.minX,r.minY,r.maxX,r.minY);if(u===0)return 0;var l=kc(o[0],o[1],e[0],e[1],r.minX,r.minY,r.minX,r.maxY);if(l===0)return 0;var h=kc(o[0],o[1],e[0],e[1],r.maxX,r.minY,r.maxX,r.maxY);if(h===0)return 0;var p=kc(o[0],o[1],e[0],e[1],r.minX,r.maxY,r.maxX,r.maxY);return p===0?0:Math.min(u,l,h,p)}function V0(o,e){return o[0]>=e.minX&&o[0]<=e.maxX&&o[1]>=e.minY&&o[1]<=e.maxY}function W0(o,e,r){for(var u=Math.min(o[0],e[0]),l=Math.min(o[1],e[1]),h=Math.max(o[0],e[0]),p=Math.max(o[1],e[1]),m=r.search({minX:u,minY:l,maxX:h,maxY:p}),y=0;y<m.length;y++)if(jC(m[y].p,m[y].next.p,o,e))return!1;return!0}function Tu(o,e,r){return ZC(o[0],o[1],e[0],e[1],r[0],r[1])}function jC(o,e,r,u){return o!==u&&e!==r&&Tu(o,e,r)>0!=Tu(o,e,u)>0&&Tu(r,u,o)>0!=Tu(r,u,e)>0}function mp(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 tI(o){for(var e=o[0],r=o[0],u=o[0],l=o[0],h=0;h<o.length;h++){var p=o[h];p[0]<e[0]&&(e=p),p[0]>u[0]&&(u=p),p[1]<r[1]&&(r=p),p[1]>l[1]&&(l=p)}var m=[e,r,u,l],y=m.slice();for(h=0;h<o.length;h++)$C(o[h],m)||y.push(o[h]);return nI(y)}function q0(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 yp(o,e){var r=o[0]-e[0],u=o[1]-e[1];return r*r+u*u}function vp(o,e,r){var u=e[0],l=e[1],h=r[0]-u,p=r[1]-l;if(h!==0||p!==0){var m=((o[0]-u)*h+(o[1]-l)*p)/(h*h+p*p);m>1?(u=r[0],l=r[1]):m>0&&(u+=h*m,l+=p*m)}return h=o[0]-u,p=o[1]-l,h*h+p*p}function kc(o,e,r,u,l,h,p,m){var y=r-o,x=u-e,E=p-l,b=m-h,S=o-l,C=e-h,D=y*y+x*x,G=y*E+x*b,O=E*E+b*b,L=y*S+x*C,k=E*S+b*C,F=D*O-G*G,$,Z,it,et,U=F,wt=F;F===0?(Z=0,U=1,et=k,wt=O):(Z=G*k-O*L,et=D*k-G*L,Z<0?(Z=0,et=k,wt=O):Z>U&&(Z=U,et=k+G,wt=O)),et<0?(et=0,-L<0?Z=0:-L>D?Z=U:(Z=-L,U=D)):et>wt&&(et=wt,-L+G<0?Z=0:-L+G>D?Z=U:(Z=-L+G,U=D)),$=Z===0?0:Z/U,it=et===0?0:et/wt;var Lt=(1-$)*o+$*r,Ot=(1-$)*e+$*u,W=(1-it)*l+it*p,de=(1-it)*h+it*m,yt=W-Lt,zt=de-Ot;return yt*yt+zt*zt}function eI(o,e){return o[0]===e[0]?o[1]-e[1]:o[0]-e[0]}function nI(o){o.sort(eI);for(var e=[],r=0;r<o.length;r++){for(;e.length>=2&&Tu(e[e.length-2],e[e.length-1],o[r])<=0;)e.pop();e.push(o[r])}for(var u=[],l=o.length-1;l>=0;l--){for(;u.length>=2&&Tu(u[u.length-2],u[u.length-1],o[l])<=0;)u.pop();u.push(o[l])}return u.pop(),e.pop(),e.concat(u)}});var j0=It((Ep,wp)=>{(function(o,e){typeof Ep=="object"&&typeof wp<"u"?wp.exports=e():typeof define=="function"&&define.amd?define(e):o.quickselect=e()})(Ep,function(){"use strict";function o(l,h,p,m,y){e(l,h,p||0,m||l.length-1,y||u)}function e(l,h,p,m,y){for(;m>p;){if(m-p>600){var x=m-p+1,E=h-p+1,b=Math.log(x),S=.5*Math.exp(2*b/3),C=.5*Math.sqrt(b*S*(x-S)/x)*(E-x/2<0?-1:1),D=Math.max(p,Math.floor(h-E*S/x+C)),G=Math.min(m,Math.floor(h+(x-E)*S/x+C));e(l,h,D,G,y)}var O=l[h],L=p,k=m;for(r(l,p,h),y(l[m],O)>0&&r(l,p,m);L<k;){for(r(l,L,k),L++,k--;y(l[L],O)<0;)L++;for(;y(l[k],O)>0;)k--}y(l[p],O)===0?r(l,p,k):(k++,r(l,k,m)),k<=h&&(p=k+1),h<=k&&(m=k-1)}}function r(l,h,p){var m=l[h];l[h]=l[p],l[p]=m}function u(l,h){return l<h?-1:l>h?1:0}return o})});var Ap=It((m3,bp)=>{"use strict";bp.exports=bl;bp.exports.default=bl;var gI=j0();function bl(o,e){if(!(this instanceof bl))return new bl(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()}bl.prototype={all:function(){return this._all(this.data,[])},search:function(o){var e=this.data,r=[],u=this.toBBox;if(!Vc(o,e))return r;for(var l=[],h,p,m,y;e;){for(h=0,p=e.children.length;h<p;h++)m=e.children[h],y=e.leaf?u(m):m,Vc(o,y)&&(e.leaf?r.push(m):Sp(o,y)?this._all(m,r):l.push(m));e=l.pop()}return r},collides:function(o){var e=this.data,r=this.toBBox;if(!Vc(o,e))return!1;for(var u=[],l,h,p,m;e;){for(l=0,h=e.children.length;l<h;l++)if(p=e.children[l],m=e.leaf?r(p):p,Vc(o,m)){if(e.leaf||Sp(o,m))return!0;u.push(p)}e=u.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 u=this._build(o.slice(),0,o.length-1,0);if(!this.data.children.length)this.data=u;else if(this.data.height===u.height)this._splitRoot(this.data,u);else{if(this.data.height<u.height){var l=this.data;this.data=u,u=l}this._insert(u,this.data.height-u.height-1,!0)}return this},insert:function(o){return o&&this._insert(o,this.data.height-1),this},clear:function(){return this.data=Pu([]),this},remove:function(o,e){if(!o)return this;for(var r=this.data,u=this.toBBox(o),l=[],h=[],p,m,y,x;r||l.length;){if(r||(r=l.pop(),m=l[l.length-1],p=h.pop(),x=!0),r.leaf&&(y=mI(o,r.children,e),y!==-1))return r.children.splice(y,1),l.push(r),this._condense(l),this;!x&&!r.leaf&&Sp(r,u)?(l.push(r),h.push(p),p=0,m=r,r=r.children[0]):m?(p++,r=m.children[p],x=!1):r=null}return this},toBBox:function(o){return o},compareMinX:ty,compareMinY:ey,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,u){var l=r-e+1,h=this._maxEntries,p;if(l<=h)return p=Pu(o.slice(e,r+1)),Iu(p,this.toBBox),p;u||(u=Math.ceil(Math.log(l)/Math.log(h)),h=Math.ceil(l/Math.pow(h,u-1))),p=Pu([]),p.leaf=!1,p.height=u;var m=Math.ceil(l/h),y=m*Math.ceil(Math.sqrt(h)),x,E,b,S;for(ny(o,e,r,y,this.compareMinX),x=e;x<=r;x+=y)for(b=Math.min(x+y-1,r),ny(o,x,b,m,this.compareMinY),E=x;E<=b;E+=m)S=Math.min(E+m-1,b),p.children.push(this._build(o,E,S,u-1));return Iu(p,this.toBBox),p},_chooseSubtree:function(o,e,r,u){for(var l,h,p,m,y,x,E,b;u.push(e),!(e.leaf||u.length-1===r);){for(E=b=1/0,l=0,h=e.children.length;l<h;l++)p=e.children[l],y=Mp(p),x=yI(o,p)-y,x<b?(b=x,E=y<E?y:E,m=p):x===b&&y<E&&(E=y,m=p);e=m||e.children[0]}return e},_insert:function(o,e,r){var u=this.toBBox,l=r?o:u(o),h=[],p=this._chooseSubtree(l,this.data,e,h);for(p.children.push(o),Sl(p,l);e>=0&&h[e].children.length>this._maxEntries;)this._split(h,e),e--;this._adjustParentBBoxes(l,h,e)},_split:function(o,e){var r=o[e],u=r.children.length,l=this._minEntries;this._chooseSplitAxis(r,l,u);var h=this._chooseSplitIndex(r,l,u),p=Pu(r.children.splice(h,r.children.length-h));p.height=r.height,p.leaf=r.leaf,Iu(r,this.toBBox),Iu(p,this.toBBox),e?o[e-1].children.push(p):this._splitRoot(r,p)},_splitRoot:function(o,e){this.data=Pu([o,e]),this.data.height=o.height+1,this.data.leaf=!1,Iu(this.data,this.toBBox)},_chooseSplitIndex:function(o,e,r){var u,l,h,p,m,y,x,E;for(y=x=1/0,u=e;u<=r-e;u++)l=Ml(o,0,u,this.toBBox),h=Ml(o,u,r,this.toBBox),p=vI(l,h),m=Mp(l)+Mp(h),p<y?(y=p,E=u,x=m<x?m:x):p===y&&m<x&&(x=m,E=u);return E},_chooseSplitAxis:function(o,e,r){var u=o.leaf?this.compareMinX:ty,l=o.leaf?this.compareMinY:ey,h=this._allDistMargin(o,e,r,u),p=this._allDistMargin(o,e,r,l);h<p&&o.children.sort(u)},_allDistMargin:function(o,e,r,u){o.children.sort(u);var l=this.toBBox,h=Ml(o,0,e,l),p=Ml(o,r-e,r,l),m=Hc(h)+Hc(p),y,x;for(y=e;y<r-e;y++)x=o.children[y],Sl(h,o.leaf?l(x):x),m+=Hc(h);for(y=r-e-1;y>=e;y--)x=o.children[y],Sl(p,o.leaf?l(x):x),m+=Hc(p);return m},_adjustParentBBoxes:function(o,e,r){for(var u=r;u>=0;u--)Sl(e[u],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():Iu(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 mI(o,e,r){if(!r)return e.indexOf(o);for(var u=0;u<e.length;u++)if(r(o,e[u]))return u;return-1}function Iu(o,e){Ml(o,0,o.children.length,e,o)}function Ml(o,e,r,u,l){l||(l=Pu(null)),l.minX=1/0,l.minY=1/0,l.maxX=-1/0,l.maxY=-1/0;for(var h=e,p;h<r;h++)p=o.children[h],Sl(l,o.leaf?u(p):p);return l}function Sl(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 ty(o,e){return o.minX-e.minX}function ey(o,e){return o.minY-e.minY}function Mp(o){return(o.maxX-o.minX)*(o.maxY-o.minY)}function Hc(o){return o.maxX-o.minX+(o.maxY-o.minY)}function yI(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 vI(o,e){var r=Math.max(o.minX,e.minX),u=Math.max(o.minY,e.minY),l=Math.min(o.maxX,e.maxX),h=Math.min(o.maxY,e.maxY);return Math.max(0,l-r)*Math.max(0,h-u)}function Sp(o,e){return o.minX<=e.minX&&o.minY<=e.minY&&e.maxX<=o.maxX&&e.maxY<=o.maxY}function Vc(o,e){return e.minX<=o.maxX&&e.minY<=o.maxY&&e.maxX>=o.minX&&e.maxY>=o.minY}function Pu(o){return{children:o,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ny(o,e,r,u,l){for(var h=[e,r],p;h.length;)r=h.pop(),e=h.pop(),!(r-e<=u)&&(p=e+Math.ceil((r-e)/u/2)*u,gI(o,p,e,r,l),h.push(e,p,p,r))}});var uy=It((IF,Lp)=>{"use strict";Lp.exports=Yc;Lp.exports.default=Yc;function Yc(o,e,r){r=r||2;var u=e&&e.length,l=u?e[0]*r:o.length,h=oy(o,0,l,r,!0),p=[];if(!h||h.next===h.prev)return p;var m,y,x,E,b,S,C;if(u&&(h=CI(o,e,h,r)),o.length>80*r){m=x=o[0],y=E=o[1];for(var D=r;D<l;D+=r)b=o[D],S=o[D+1],b<m&&(m=b),S<y&&(y=S),b>x&&(x=b),S>E&&(E=S);C=Math.max(x-m,E-y),C=C!==0?32767/C:0}return Cl(h,p,r,m,y,C,0),p}function oy(o,e,r,u,l){var h,p;if(l===Rp(o,e,r,u)>0)for(h=e;h<r;h+=u)p=iy(h,o[h],o[h+1],p);else for(h=r-u;h>=e;h-=u)p=iy(h,o[h],o[h+1],p);return p&&$c(p,p.next)&&(Pl(p),p=p.next),p}function Qa(o,e){if(!o)return o;e||(e=o);var r=o,u;do if(u=!1,!r.steiner&&($c(r,r.next)||hr(r.prev,r,r.next)===0)){if(Pl(r),r=e=r.prev,r===r.next)break;u=!0}else r=r.next;while(u||r!==e);return e}function Cl(o,e,r,u,l,h,p){if(o){!p&&h&&NI(o,u,l,h);for(var m=o,y,x;o.prev!==o.next;){if(y=o.prev,x=o.next,h?bI(o,u,l,h):SI(o)){e.push(y.i/r|0),e.push(o.i/r|0),e.push(x.i/r|0),Pl(o),o=x.next,m=x.next;continue}if(o=x,o===m){p?p===1?(o=AI(Qa(o),e,r),Cl(o,e,r,u,l,h,2)):p===2&&TI(o,e,r,u,l,h):Cl(Qa(o),e,r,u,l,h,1);break}}}}function SI(o){var e=o.prev,r=o,u=o.next;if(hr(e,r,u)>=0)return!1;for(var l=e.x,h=r.x,p=u.x,m=e.y,y=r.y,x=u.y,E=l<h?l<p?l:p:h<p?h:p,b=m<y?m<x?m:x:y<x?y:x,S=l>h?l>p?l:p:h>p?h:p,C=m>y?m>x?m:x:y>x?y:x,D=u.next;D!==e;){if(D.x>=E&&D.x<=S&&D.y>=b&&D.y<=C&&Nu(l,m,h,y,p,x,D.x,D.y)&&hr(D.prev,D,D.next)>=0)return!1;D=D.next}return!0}function bI(o,e,r,u){var l=o.prev,h=o,p=o.next;if(hr(l,h,p)>=0)return!1;for(var m=l.x,y=h.x,x=p.x,E=l.y,b=h.y,S=p.y,C=m<y?m<x?m:x:y<x?y:x,D=E<b?E<S?E:S:b<S?b:S,G=m>y?m>x?m:x:y>x?y:x,O=E>b?E>S?E:S:b>S?b:S,L=Ip(C,D,e,r,u),k=Ip(G,O,e,r,u),F=o.prevZ,$=o.nextZ;F&&F.z>=L&&$&&$.z<=k;){if(F.x>=C&&F.x<=G&&F.y>=D&&F.y<=O&&F!==l&&F!==p&&Nu(m,E,y,b,x,S,F.x,F.y)&&hr(F.prev,F,F.next)>=0||(F=F.prevZ,$.x>=C&&$.x<=G&&$.y>=D&&$.y<=O&&$!==l&&$!==p&&Nu(m,E,y,b,x,S,$.x,$.y)&&hr($.prev,$,$.next)>=0))return!1;$=$.nextZ}for(;F&&F.z>=L;){if(F.x>=C&&F.x<=G&&F.y>=D&&F.y<=O&&F!==l&&F!==p&&Nu(m,E,y,b,x,S,F.x,F.y)&&hr(F.prev,F,F.next)>=0)return!1;F=F.prevZ}for(;$&&$.z<=k;){if($.x>=C&&$.x<=G&&$.y>=D&&$.y<=O&&$!==l&&$!==p&&Nu(m,E,y,b,x,S,$.x,$.y)&&hr($.prev,$,$.next)>=0)return!1;$=$.nextZ}return!0}function AI(o,e,r){var u=o;do{var l=u.prev,h=u.next.next;!$c(l,h)&&sy(l,u,u.next,h)&&Il(l,h)&&Il(h,l)&&(e.push(l.i/r|0),e.push(u.i/r|0),e.push(h.i/r|0),Pl(u),Pl(u.next),u=o=h),u=u.next}while(u!==o);return Qa(u)}function TI(o,e,r,u,l,h){var p=o;do{for(var m=p.next.next;m!==p.prev;){if(p.i!==m.i&&FI(p,m)){var y=ay(p,m);p=Qa(p,p.next),y=Qa(y,y.next),Cl(p,e,r,u,l,h,0),Cl(y,e,r,u,l,h,0);return}m=m.next}p=p.next}while(p!==o)}function CI(o,e,r,u){var l=[],h,p,m,y,x;for(h=0,p=e.length;h<p;h++)m=e[h]*u,y=h<p-1?e[h+1]*u:o.length,x=oy(o,m,y,u,!1),x===x.next&&(x.steiner=!0),l.push(OI(x));for(l.sort(II),h=0;h<l.length;h++)r=PI(l[h],r);return r}function II(o,e){return o.x-e.x}function PI(o,e){var r=RI(o,e);if(!r)return e;var u=ay(r,o);return Qa(u,u.next),Qa(r,r.next)}function RI(o,e){var r=e,u=o.x,l=o.y,h=-1/0,p;do{if(l<=r.y&&l>=r.next.y&&r.next.y!==r.y){var m=r.x+(l-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(m<=u&&m>h&&(h=m,p=r.x<r.next.x?r:r.next,m===u))return p}r=r.next}while(r!==e);if(!p)return null;var y=p,x=p.x,E=p.y,b=1/0,S;r=p;do u>=r.x&&r.x>=x&&u!==r.x&&Nu(l<E?u:h,l,x,E,l<E?h:u,l,r.x,r.y)&&(S=Math.abs(l-r.y)/(u-r.x),Il(r,o)&&(S<b||S===b&&(r.x>p.x||r.x===p.x&&LI(p,r)))&&(p=r,b=S)),r=r.next;while(r!==y);return p}function LI(o,e){return hr(o.prev,o,e.prev)<0&&hr(e.next,o,o.next)<0}function NI(o,e,r,u){var l=o;do l.z===0&&(l.z=Ip(l.x,l.y,e,r,u)),l.prevZ=l.prev,l.nextZ=l.next,l=l.next;while(l!==o);l.prevZ.nextZ=null,l.prevZ=null,DI(l)}function DI(o){var e,r,u,l,h,p,m,y,x=1;do{for(r=o,o=null,h=null,p=0;r;){for(p++,u=r,m=0,e=0;e<x&&(m++,u=u.nextZ,!!u);e++);for(y=x;m>0||y>0&&u;)m!==0&&(y===0||!u||r.z<=u.z)?(l=r,r=r.nextZ,m--):(l=u,u=u.nextZ,y--),h?h.nextZ=l:o=l,l.prevZ=h,h=l;r=u}h.nextZ=null,x*=2}while(p>1);return o}function Ip(o,e,r,u,l){return o=(o-r)*l|0,e=(e-u)*l|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 OI(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 Nu(o,e,r,u,l,h,p,m){return(l-p)*(e-m)>=(o-p)*(h-m)&&(o-p)*(u-m)>=(r-p)*(e-m)&&(r-p)*(h-m)>=(l-p)*(u-m)}function FI(o,e){return o.next.i!==e.i&&o.prev.i!==e.i&&!UI(o,e)&&(Il(o,e)&&Il(e,o)&&BI(o,e)&&(hr(o.prev,o,e.prev)||hr(o,e.prev,e))||$c(o,e)&&hr(o.prev,o,o.next)>0&&hr(e.prev,e,e.next)>0)}function hr(o,e,r){return(e.y-o.y)*(r.x-e.x)-(e.x-o.x)*(r.y-e.y)}function $c(o,e){return o.x===e.x&&o.y===e.y}function sy(o,e,r,u){var l=Xc(hr(o,e,r)),h=Xc(hr(o,e,u)),p=Xc(hr(r,u,o)),m=Xc(hr(r,u,e));return!!(l!==h&&p!==m||l===0&&qc(o,r,e)||h===0&&qc(o,u,e)||p===0&&qc(r,o,u)||m===0&&qc(r,e,u))}function qc(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 Xc(o){return o>0?1:o<0?-1:0}function UI(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&&sy(r,r.next,o,e))return!0;r=r.next}while(r!==o);return!1}function Il(o,e){return hr(o.prev,o,o.next)<0?hr(o,e,o.next)>=0&&hr(o,o.prev,e)>=0:hr(o,e,o.prev)<0||hr(o,o.next,e)<0}function BI(o,e){var r=o,u=!1,l=(o.x+e.x)/2,h=(o.y+e.y)/2;do r.y>h!=r.next.y>h&&r.next.y!==r.y&&l<(r.next.x-r.x)*(h-r.y)/(r.next.y-r.y)+r.x&&(u=!u),r=r.next;while(r!==o);return u}function ay(o,e){var r=new Pp(o.i,o.x,o.y),u=new Pp(e.i,e.x,e.y),l=o.next,h=e.prev;return o.next=e,e.prev=o,r.next=l,l.prev=r,u.next=r,r.prev=u,h.next=u,u.prev=h,u}function iy(o,e,r,u){var l=new Pp(o,e,r);return u?(l.next=u.next,l.prev=u,u.next.prev=l,u.next=l):(l.prev=l,l.next=l),l}function Pl(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 Pp(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}Yc.deviation=function(o,e,r,u){var l=e&&e.length,h=l?e[0]*r:o.length,p=Math.abs(Rp(o,0,h,r));if(l)for(var m=0,y=e.length;m<y;m++){var x=e[m]*r,E=m<y-1?e[m+1]*r:o.length;p-=Math.abs(Rp(o,x,E,r))}var b=0;for(m=0;m<u.length;m+=3){var S=u[m]*r,C=u[m+1]*r,D=u[m+2]*r;b+=Math.abs((o[S]-o[D])*(o[C+1]-o[S+1])-(o[S]-o[C])*(o[D+1]-o[S+1]))}return p===0&&b===0?0:Math.abs((b-p)/p)};function Rp(o,e,r,u){for(var l=0,h=e,p=r-u;h<r;h+=u)l+=(o[p]-o[h])*(o[h+1]+o[p+1]),p=h;return l}Yc.flatten=function(o){for(var e=o[0][0].length,r={vertices:[],holes:[],dimensions:e},u=0,l=0;l<o.length;l++){for(var h=0;h<o[l].length;h++)for(var p=0;p<e;p++)r.vertices.push(o[l][h][p]);l>0&&(u+=o[l-1].length,r.holes.push(u))}return r}});var Up=It(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.earthRadius=63710088e-1;Xt.factors={centimeters:Xt.earthRadius*100,centimetres:Xt.earthRadius*100,degrees:Xt.earthRadius/111325,feet:Xt.earthRadius*3.28084,inches:Xt.earthRadius*39.37,kilometers:Xt.earthRadius/1e3,kilometres:Xt.earthRadius/1e3,meters:Xt.earthRadius,metres:Xt.earthRadius,miles:Xt.earthRadius/1609.344,millimeters:Xt.earthRadius*1e3,millimetres:Xt.earthRadius*1e3,nauticalmiles:Xt.earthRadius/1852,radians:1,yards:Xt.earthRadius*1.0936};Xt.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/Xt.earthRadius,yards:1.0936133};Xt.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 Sa(o,e,r){r===void 0&&(r={});var u={type:"Feature"};return(r.id===0||r.id)&&(u.id=r.id),r.bbox&&(u.bbox=r.bbox),u.properties=e||{},u.geometry=o,u}Xt.feature=Sa;function kI(o,e,r){switch(r===void 0&&(r={}),o){case"Point":return Np(e).geometry;case"LineString":return Op(e).geometry;case"Polygon":return Dp(e).geometry;case"MultiPoint":return cy(e).geometry;case"MultiLineString":return ly(e).geometry;case"MultiPolygon":return fy(e).geometry;default:throw new Error(o+" is invalid")}}Xt.geometry=kI;function Np(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(!Zc(o[0])||!Zc(o[1]))throw new Error("coordinates must contain numbers");var u={type:"Point",coordinates:o};return Sa(u,e,r)}Xt.point=Np;function GI(o,e,r){return r===void 0&&(r={}),Jc(o.map(function(u){return Np(u,e)}),r)}Xt.points=GI;function Dp(o,e,r){r===void 0&&(r={});for(var u=0,l=o;u<l.length;u++){var h=l[u];if(h.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var p=0;p<h[h.length-1].length;p++)if(h[h.length-1][p]!==h[0][p])throw new Error("First and last Position are not equivalent.")}var m={type:"Polygon",coordinates:o};return Sa(m,e,r)}Xt.polygon=Dp;function HI(o,e,r){return r===void 0&&(r={}),Jc(o.map(function(u){return Dp(u,e)}),r)}Xt.polygons=HI;function Op(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 u={type:"LineString",coordinates:o};return Sa(u,e,r)}Xt.lineString=Op;function VI(o,e,r){return r===void 0&&(r={}),Jc(o.map(function(u){return Op(u,e)}),r)}Xt.lineStrings=VI;function Jc(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}Xt.featureCollection=Jc;function ly(o,e,r){r===void 0&&(r={});var u={type:"MultiLineString",coordinates:o};return Sa(u,e,r)}Xt.multiLineString=ly;function cy(o,e,r){r===void 0&&(r={});var u={type:"MultiPoint",coordinates:o};return Sa(u,e,r)}Xt.multiPoint=cy;function fy(o,e,r){r===void 0&&(r={});var u={type:"MultiPolygon",coordinates:o};return Sa(u,e,r)}Xt.multiPolygon=fy;function WI(o,e,r){r===void 0&&(r={});var u={type:"GeometryCollection",geometries:o};return Sa(u,e,r)}Xt.geometryCollection=WI;function qI(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}Xt.round=qI;function hy(o,e){e===void 0&&(e="kilometers");var r=Xt.factors[e];if(!r)throw new Error(e+" units is invalid");return o*r}Xt.radiansToLength=hy;function Fp(o,e){e===void 0&&(e="kilometers");var r=Xt.factors[e];if(!r)throw new Error(e+" units is invalid");return o/r}Xt.lengthToRadians=Fp;function XI(o,e){return py(Fp(o,e))}Xt.lengthToDegrees=XI;function YI(o){var e=o%360;return e<0&&(e+=360),e}Xt.bearingToAzimuth=YI;function py(o){var e=o%(2*Math.PI);return e*180/Math.PI}Xt.radiansToDegrees=py;function $I(o){var e=o%360;return e*Math.PI/180}Xt.degreesToRadians=$I;function ZI(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 hy(Fp(o,e),r)}Xt.convertLength=ZI;function JI(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 u=Xt.areaFactors[e];if(!u)throw new Error("invalid original units");var l=Xt.areaFactors[r];if(!l)throw new Error("invalid final units");return o/u*l}Xt.convertArea=JI;function Zc(o){return!isNaN(o)&&o!==null&&!Array.isArray(o)}Xt.isNumber=Zc;function KI(o){return!!o&&o.constructor===Object}Xt.isObject=KI;function QI(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(!Zc(e))throw new Error("bbox must only contain numbers")})}Xt.validateBBox=QI;function jI(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")}Xt.validateId=jI});var zp=It(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});var Ri=Up();function Rl(o,e,r){if(o!==null)for(var u,l,h,p,m,y,x,E=0,b=0,S,C=o.type,D=C==="FeatureCollection",G=C==="Feature",O=D?o.features.length:1,L=0;L<O;L++){x=D?o.features[L].geometry:G?o.geometry:o,S=x?x.type==="GeometryCollection":!1,m=S?x.geometries.length:1;for(var k=0;k<m;k++){var F=0,$=0;if(p=S?x.geometries[k]:x,p!==null){y=p.coordinates;var Z=p.type;switch(E=r&&(Z==="Polygon"||Z==="MultiPolygon")?1:0,Z){case null:break;case"Point":if(e(y,b,L,F,$)===!1)return!1;b++,F++;break;case"LineString":case"MultiPoint":for(u=0;u<y.length;u++){if(e(y[u],b,L,F,$)===!1)return!1;b++,Z==="MultiPoint"&&F++}Z==="LineString"&&F++;break;case"Polygon":case"MultiLineString":for(u=0;u<y.length;u++){for(l=0;l<y[u].length-E;l++){if(e(y[u][l],b,L,F,$)===!1)return!1;b++}Z==="MultiLineString"&&F++,Z==="Polygon"&&$++}Z==="Polygon"&&F++;break;case"MultiPolygon":for(u=0;u<y.length;u++){for($=0,l=0;l<y[u].length;l++){for(h=0;h<y[u][l].length-E;h++){if(e(y[u][l][h],b,L,F,$)===!1)return!1;b++}$++}F++}break;case"GeometryCollection":for(u=0;u<p.geometries.length;u++)if(Rl(p.geometries[u],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function tP(o,e,r,u){var l=r;return Rl(o,function(h,p,m,y,x){p===0&&r===void 0?l=h:l=e(l,h,p,m,y,x)},u),l}function dy(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 eP(o,e,r){var u=r;return dy(o,function(l,h){h===0&&r===void 0?u=l:u=e(u,l,h)}),u}function gy(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 nP(o,e,r){var u=r;return gy(o,function(l,h){h===0&&r===void 0?u=l:u=e(u,l,h)}),u}function rP(o){var e=[];return Rl(o,function(r){e.push(r)}),e}function Bp(o,e){var r,u,l,h,p,m,y,x,E,b,S=0,C=o.type==="FeatureCollection",D=o.type==="Feature",G=C?o.features.length:1;for(r=0;r<G;r++){for(m=C?o.features[r].geometry:D?o.geometry:o,x=C?o.features[r].properties:D?o.properties:{},E=C?o.features[r].bbox:D?o.bbox:void 0,b=C?o.features[r].id:D?o.id:void 0,y=m?m.type==="GeometryCollection":!1,p=y?m.geometries.length:1,l=0;l<p;l++){if(h=y?m.geometries[l]:m,h===null){if(e(null,S,x,E,b)===!1)return!1;continue}switch(h.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(h,S,x,E,b)===!1)return!1;break}case"GeometryCollection":{for(u=0;u<h.geometries.length;u++)if(e(h.geometries[u],S,x,E,b)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}S++}}function iP(o,e,r){var u=r;return Bp(o,function(l,h,p,m,y){h===0&&r===void 0?u=l:u=e(u,l,h,p,m,y)}),u}function Kc(o,e){Bp(o,function(r,u,l,h,p){var m=r===null?null:r.type;switch(m){case null:case"Point":case"LineString":case"Polygon":return e(Ri.feature(r,l,{bbox:h,id:p}),u,0)===!1?!1:void 0}var y;switch(m){case"MultiPoint":y="Point";break;case"MultiLineString":y="LineString";break;case"MultiPolygon":y="Polygon";break}for(var x=0;x<r.coordinates.length;x++){var E=r.coordinates[x],b={type:y,coordinates:E};if(e(Ri.feature(b,l),u,x)===!1)return!1}})}function oP(o,e,r){var u=r;return Kc(o,function(l,h,p){h===0&&p===0&&r===void 0?u=l:u=e(u,l,h,p)}),u}function my(o,e){Kc(o,function(r,u,l){var h=0;if(r.geometry){var p=r.geometry.type;if(!(p==="Point"||p==="MultiPoint")){var m,y=0,x=0,E=0;if(Rl(r,function(b,S,C,D,G){if(m===void 0||u>y||D>x||G>E){m=b,y=u,x=D,E=G,h=0;return}var O=Ri.lineString([m,b],r.properties);if(e(O,u,l,G,h)===!1)return!1;h++,m=b})===!1)return!1}}})}function sP(o,e,r){var u=r,l=!1;return my(o,function(h,p,m,y,x){l===!1&&r===void 0?u=h:u=e(u,h,p,m,y,x),l=!0}),u}function yy(o,e){if(!o)throw new Error("geojson is required");Kc(o,function(r,u,l){if(r.geometry!==null){var h=r.geometry.type,p=r.geometry.coordinates;switch(h){case"LineString":if(e(r,u,l,0,0)===!1)return!1;break;case"Polygon":for(var m=0;m<p.length;m++)if(e(Ri.lineString(p[m],r.properties),u,l,m)===!1)return!1;break}}})}function aP(o,e,r){var u=r;return yy(o,function(l,h,p,m){h===0&&r===void 0?u=l:u=e(u,l,h,p,m)}),u}function uP(o,e){if(e=e||{},!Ri.isObject(e))throw new Error("options is invalid");var r=e.featureIndex||0,u=e.multiFeatureIndex||0,l=e.geometryIndex||0,h=e.segmentIndex||0,p=e.properties,m;switch(o.type){case"FeatureCollection":r<0&&(r=o.features.length+r),p=p||o.features[r].properties,m=o.features[r].geometry;break;case"Feature":p=p||o.properties,m=o.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":m=o;break;default:throw new Error("geojson is invalid")}if(m===null)return null;var y=m.coordinates;switch(m.type){case"Point":case"MultiPoint":return null;case"LineString":return h<0&&(h=y.length+h-1),Ri.lineString([y[h],y[h+1]],p,e);case"Polygon":return l<0&&(l=y.length+l),h<0&&(h=y[l].length+h-1),Ri.lineString([y[l][h],y[l][h+1]],p,e);case"MultiLineString":return u<0&&(u=y.length+u),h<0&&(h=y[u].length+h-1),Ri.lineString([y[u][h],y[u][h+1]],p,e);case"MultiPolygon":return u<0&&(u=y.length+u),l<0&&(l=y[u].length+l),h<0&&(h=y[u][l].length-h-1),Ri.lineString([y[u][l][h],y[u][l][h+1]],p,e)}throw new Error("geojson is invalid")}function lP(o,e){if(e=e||{},!Ri.isObject(e))throw new Error("options is invalid");var r=e.featureIndex||0,u=e.multiFeatureIndex||0,l=e.geometryIndex||0,h=e.coordIndex||0,p=e.properties,m;switch(o.type){case"FeatureCollection":r<0&&(r=o.features.length+r),p=p||o.features[r].properties,m=o.features[r].geometry;break;case"Feature":p=p||o.properties,m=o.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":m=o;break;default:throw new Error("geojson is invalid")}if(m===null)return null;var y=m.coordinates;switch(m.type){case"Point":return Ri.point(y,p,e);case"MultiPoint":return u<0&&(u=y.length+u),Ri.point(y[u],p,e);case"LineString":return h<0&&(h=y.length+h),Ri.point(y[h],p,e);case"Polygon":return l<0&&(l=y.length+l),h<0&&(h=y[l].length+h),Ri.point(y[l][h],p,e);case"MultiLineString":return u<0&&(u=y.length+u),h<0&&(h=y[u].length+h),Ri.point(y[u][h],p,e);case"MultiPolygon":return u<0&&(u=y.length+u),l<0&&(l=y[u].length+l),h<0&&(h=y[u][l].length-h),Ri.point(y[u][l][h],p,e)}throw new Error("geojson is invalid")}Vr.coordAll=rP;Vr.coordEach=Rl;Vr.coordReduce=tP;Vr.featureEach=gy;Vr.featureReduce=nP;Vr.findPoint=lP;Vr.findSegment=uP;Vr.flattenEach=Kc;Vr.flattenReduce=oP;Vr.geomEach=Bp;Vr.geomReduce=iP;Vr.lineEach=yy;Vr.lineReduce=aP;Vr.propEach=dy;Vr.propReduce=eP;Vr.segmentEach=my;Vr.segmentReduce=sP});var vy=It(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var cP=zp();function kp(o){var e=[1/0,1/0,-1/0,-1/0];return cP.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}kp.default=kp;Gp.default=kp});var Qc=It((qF,Hp)=>{var Ps=pp(),xy=Up(),Ey=zp(),Du=vy().default,fP=Ey.featureEach,VF=Ey.coordEach,WF=xy.polygon,_y=xy.featureCollection;function wy(o){var e=new Ps(o);return e.insert=function(r){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:Du(r),Ps.prototype.insert.call(this,r)},e.load=function(r){var u=[];return Array.isArray(r)?r.forEach(function(l){if(l.type!=="Feature")throw new Error("invalid features");l.bbox=l.bbox?l.bbox:Du(l),u.push(l)}):fP(r,function(l){if(l.type!=="Feature")throw new Error("invalid features");l.bbox=l.bbox?l.bbox:Du(l),u.push(l)}),Ps.prototype.load.call(this,u)},e.remove=function(r,u){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:Du(r),Ps.prototype.remove.call(this,r,u)},e.clear=function(){return Ps.prototype.clear.call(this)},e.search=function(r){var u=Ps.prototype.search.call(this,this.toBBox(r));return _y(u)},e.collides=function(r){return Ps.prototype.collides.call(this,this.toBBox(r))},e.all=function(){var r=Ps.prototype.all.call(this);return _y(r)},e.toJSON=function(){return Ps.prototype.toJSON.call(this)},e.fromJSON=function(r){return Ps.prototype.fromJSON.call(this,r)},e.toBBox=function(r){var u;if(r.bbox)u=r.bbox;else if(Array.isArray(r)&&r.length===4)u=r;else if(Array.isArray(r)&&r.length===6)u=[r[0],r[1],r[3],r[4]];else if(r.type==="Feature")u=Du(r);else if(r.type==="FeatureCollection")u=Du(r);else throw new Error("invalid geojson");return{minX:u[0],minY:u[1],maxX:u[2],maxY:u[3]}},e}Hp.exports=wy;Hp.exports.default=wy});var $p=It((tz,Ly)=>{"use strict";var Ry=Object.prototype.toString;Ly.exports=function(e){var r=Ry.call(e),u=r==="[object Arguments]";return u||(u=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Ry.call(e.callee)==="[object Function]"),u}});var Gy=It((ez,ky)=>{"use strict";var zy;Object.keys||(Dl=Object.prototype.hasOwnProperty,Zp=Object.prototype.toString,Ny=$p(),Jp=Object.prototype.propertyIsEnumerable,Dy=!Jp.call({toString:null},"toString"),Oy=Jp.call(function(){},"prototype"),Ol=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],rf=function(o){var e=o.constructor;return e&&e.prototype===o},Fy={$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},Uy=function(){if(typeof window>"u")return!1;for(var o in window)try{if(!Fy["$"+o]&&Dl.call(window,o)&&window[o]!==null&&typeof window[o]=="object")try{rf(window[o])}catch{return!0}}catch{return!0}return!1}(),By=function(o){if(typeof window>"u"||!Uy)return rf(o);try{return rf(o)}catch{return!1}},zy=function(e){var r=e!==null&&typeof e=="object",u=Zp.call(e)==="[object Function]",l=Ny(e),h=r&&Zp.call(e)==="[object String]",p=[];if(!r&&!u&&!l)throw new TypeError("Object.keys called on a non-object");var m=Oy&&u;if(h&&e.length>0&&!Dl.call(e,0))for(var y=0;y<e.length;++y)p.push(String(y));if(l&&e.length>0)for(var x=0;x<e.length;++x)p.push(String(x));else for(var E in e)!(m&&E==="prototype")&&Dl.call(e,E)&&p.push(String(E));if(Dy)for(var b=By(e),S=0;S<Ol.length;++S)!(b&&Ol[S]==="constructor")&&Dl.call(e,Ol[S])&&p.push(Ol[S]);return p});var Dl,Zp,Ny,Jp,Dy,Oy,Ol,rf,Fy,Uy,By;ky.exports=zy});var Kp=It((nz,Wy)=>{"use strict";var EP=Array.prototype.slice,wP=$p(),Hy=Object.keys,of=Hy?function(e){return Hy(e)}:Gy(),Vy=Object.keys;of.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(u){return wP(u)?Vy(EP.call(u)):Vy(u)})}else Object.keys=of;return Object.keys||of};Wy.exports=of});var Qp=It((rz,qy)=>{"use strict";qy.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),u=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(u)!=="[object Symbol]")return!1;var l=42;e[r]=l;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 h=Object.getOwnPropertySymbols(e);if(h.length!==1||h[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var p=Object.getOwnPropertyDescriptor(e,r);if(p.value!==l||p.enumerable!==!0)return!1}return!0}});var sf=It((iz,Xy)=>{"use strict";var MP=Qp();Xy.exports=function(){return MP()&&!!Symbol.toStringTag}});var $y=It((oz,Yy)=>{"use strict";Yy.exports=Error});var Jy=It((sz,Zy)=>{"use strict";Zy.exports=EvalError});var Qy=It((az,Ky)=>{"use strict";Ky.exports=RangeError});var tv=It((uz,jy)=>{"use strict";jy.exports=ReferenceError});var jp=It((lz,ev)=>{"use strict";ev.exports=SyntaxError});var ja=It((cz,nv)=>{"use strict";nv.exports=TypeError});var iv=It((fz,rv)=>{"use strict";rv.exports=URIError});var av=It((hz,sv)=>{"use strict";var ov=typeof Symbol<"u"&&Symbol,SP=Qp();sv.exports=function(){return typeof ov!="function"||typeof Symbol!="function"||typeof ov("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:SP()}});var lv=It((pz,uv)=>{"use strict";var td={__proto__:null,foo:{}},bP=Object;uv.exports=function(){return{__proto__:td}.foo===td.foo&&!(td instanceof bP)}});var hv=It((dz,fv)=>{"use strict";var AP="Function.prototype.bind called on incompatible ",TP=Object.prototype.toString,CP=Math.max,IP="[object Function]",cv=function(e,r){for(var u=[],l=0;l<e.length;l+=1)u[l]=e[l];for(var h=0;h<r.length;h+=1)u[h+e.length]=r[h];return u},PP=function(e,r){for(var u=[],l=r||0,h=0;l<e.length;l+=1,h+=1)u[h]=e[l];return u},RP=function(o,e){for(var r="",u=0;u<o.length;u+=1)r+=o[u],u+1<o.length&&(r+=e);return r};fv.exports=function(e){var r=this;if(typeof r!="function"||TP.apply(r)!==IP)throw new TypeError(AP+r);for(var u=PP(arguments,1),l,h=function(){if(this instanceof l){var E=r.apply(this,cv(u,arguments));return Object(E)===E?E:this}return r.apply(e,cv(u,arguments))},p=CP(0,r.length-u.length),m=[],y=0;y<p;y++)m[y]="$"+y;if(l=Function("binder","return function ("+RP(m,",")+"){ return binder.apply(this,arguments); }")(h),r.prototype){var x=function(){};x.prototype=r.prototype,l.prototype=new x,x.prototype=null}return l}});var af=It((gz,pv)=>{"use strict";var LP=hv();pv.exports=Function.prototype.bind||LP});var gv=It((mz,dv)=>{"use strict";var NP=Function.prototype.call,DP=Object.prototype.hasOwnProperty,OP=af();dv.exports=OP.call(NP,DP)});var zu=It((yz,xv)=>{"use strict";var nn,FP=$y(),UP=Jy(),BP=Qy(),zP=tv(),Bu=jp(),Uu=ja(),kP=iv(),_v=Function,ed=function(o){try{return _v(\'"use strict"; return (\'+o+").constructor;")()}catch{}},tu=Object.getOwnPropertyDescriptor;if(tu)try{tu({},"")}catch{tu=null}var nd=function(){throw new Uu},GP=tu?function(){try{return arguments.callee,nd}catch{try{return tu(arguments,"callee").get}catch{return nd}}}():nd,Ou=av()(),HP=lv()(),si=Object.getPrototypeOf||(HP?function(o){return o.__proto__}:null),Fu={},VP=typeof Uint8Array>"u"||!si?nn:si(Uint8Array),eu={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?nn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?nn:ArrayBuffer,"%ArrayIteratorPrototype%":Ou&&si?si([][Symbol.iterator]()):nn,"%AsyncFromSyncIteratorPrototype%":nn,"%AsyncFunction%":Fu,"%AsyncGenerator%":Fu,"%AsyncGeneratorFunction%":Fu,"%AsyncIteratorPrototype%":Fu,"%Atomics%":typeof Atomics>"u"?nn:Atomics,"%BigInt%":typeof BigInt>"u"?nn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?nn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?nn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?nn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":FP,"%eval%":eval,"%EvalError%":UP,"%Float32Array%":typeof Float32Array>"u"?nn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?nn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?nn:FinalizationRegistry,"%Function%":_v,"%GeneratorFunction%":Fu,"%Int8Array%":typeof Int8Array>"u"?nn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?nn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?nn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ou&&si?si(si([][Symbol.iterator]())):nn,"%JSON%":typeof JSON=="object"?JSON:nn,"%Map%":typeof Map>"u"?nn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ou||!si?nn:si(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?nn:Promise,"%Proxy%":typeof Proxy>"u"?nn:Proxy,"%RangeError%":BP,"%ReferenceError%":zP,"%Reflect%":typeof Reflect>"u"?nn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?nn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ou||!si?nn:si(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?nn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ou&&si?si(""[Symbol.iterator]()):nn,"%Symbol%":Ou?Symbol:nn,"%SyntaxError%":Bu,"%ThrowTypeError%":GP,"%TypedArray%":VP,"%TypeError%":Uu,"%Uint8Array%":typeof Uint8Array>"u"?nn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?nn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?nn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?nn:Uint32Array,"%URIError%":kP,"%WeakMap%":typeof WeakMap>"u"?nn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?nn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?nn:WeakSet};if(si)try{null.error}catch(o){mv=si(si(o)),eu["%Error.prototype%"]=mv}var mv,WP=function o(e){var r;if(e==="%AsyncFunction%")r=ed("async function () {}");else if(e==="%GeneratorFunction%")r=ed("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=ed("async function* () {}");else if(e==="%AsyncGenerator%"){var u=o("%AsyncGeneratorFunction%");u&&(r=u.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=o("%AsyncGenerator%");l&&si&&(r=si(l.prototype))}return eu[e]=r,r},yv={__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"]},Fl=af(),uf=gv(),qP=Fl.call(Function.call,Array.prototype.concat),XP=Fl.call(Function.apply,Array.prototype.splice),vv=Fl.call(Function.call,String.prototype.replace),lf=Fl.call(Function.call,String.prototype.slice),YP=Fl.call(Function.call,RegExp.prototype.exec),$P=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,ZP=/\\\\(\\\\)?/g,JP=function(e){var r=lf(e,0,1),u=lf(e,-1);if(r==="%"&&u!=="%")throw new Bu("invalid intrinsic syntax, expected closing `%`");if(u==="%"&&r!=="%")throw new Bu("invalid intrinsic syntax, expected opening `%`");var l=[];return vv(e,$P,function(h,p,m,y){l[l.length]=m?vv(y,ZP,"$1"):p||h}),l},KP=function(e,r){var u=e,l;if(uf(yv,u)&&(l=yv[u],u="%"+l[0]+"%"),uf(eu,u)){var h=eu[u];if(h===Fu&&(h=WP(u)),typeof h>"u"&&!r)throw new Uu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:u,value:h}}throw new Bu("intrinsic "+e+" does not exist!")};xv.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Uu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Uu(\'"allowMissing" argument must be a boolean\');if(YP(/^%?[^%]*%?$/,e)===null)throw new Bu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var u=JP(e),l=u.length>0?u[0]:"",h=KP("%"+l+"%",r),p=h.name,m=h.value,y=!1,x=h.alias;x&&(l=x[0],XP(u,qP([0,1],x)));for(var E=1,b=!0;E<u.length;E+=1){var S=u[E],C=lf(S,0,1),D=lf(S,-1);if((C===\'"\'||C==="\'"||C==="`"||D===\'"\'||D==="\'"||D==="`")&&C!==D)throw new Bu("property names with quotes must have matching quotes");if((S==="constructor"||!b)&&(y=!0),l+="."+S,p="%"+l+"%",uf(eu,p))m=eu[p];else if(m!=null){if(!(S in m)){if(!r)throw new Uu("base intrinsic for "+e+" exists, but the property is not available.");return}if(tu&&E+1>=u.length){var G=tu(m,S);b=!!G,b&&"get"in G&&!("originalValue"in G.get)?m=G.get:m=m[S]}else b=uf(m,S),m=m[S];b&&!y&&(eu[p]=m)}}return m}});var ff=It((vz,Ev)=>{"use strict";var QP=zu(),cf=QP("%Object.defineProperty%",!0)||!1;if(cf)try{cf({},"a",{value:1})}catch{cf=!1}Ev.exports=cf});var rd=It((_z,wv)=>{"use strict";var jP=zu(),hf=jP("%Object.getOwnPropertyDescriptor%",!0);if(hf)try{hf([],"length")}catch{hf=null}wv.exports=hf});var pf=It((xz,bv)=>{"use strict";var Mv=ff(),tR=jp(),ku=ja(),Sv=rd();bv.exports=function(e,r,u){if(!e||typeof e!="object"&&typeof e!="function")throw new ku("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new ku("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ku("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ku("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ku("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ku("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,h=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,m=arguments.length>6?arguments[6]:!1,y=!!Sv&&Sv(e,r);if(Mv)Mv(e,r,{configurable:p===null&&y?y.configurable:!p,enumerable:l===null&&y?y.enumerable:!l,value:u,writable:h===null&&y?y.writable:!h});else if(m||!l&&!h&&!p)e[r]=u;else throw new tR("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var df=It((Ez,Tv)=>{"use strict";var id=ff(),Av=function(){return!!id};Av.hasArrayLengthDefineBug=function(){if(!id)return null;try{return id([],"length",{value:1}).length!==1}catch{return!0}};Tv.exports=Av});var Lv=It((wz,Rv)=>{"use strict";var eR=zu(),Cv=pf(),nR=df()(),Iv=rd(),Pv=ja(),rR=eR("%Math.floor%");Rv.exports=function(e,r){if(typeof e!="function")throw new Pv("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||rR(r)!==r)throw new Pv("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],l=!0,h=!0;if("length"in e&&Iv){var p=Iv(e,"length");p&&!p.configurable&&(l=!1),p&&!p.writable&&(h=!1)}return(l||h||!u)&&(nR?Cv(e,"length",r,!0,!0):Cv(e,"length",r)),e}});var yf=It((Mz,gf)=>{"use strict";var od=af(),mf=zu(),iR=Lv(),oR=ja(),Ov=mf("%Function.prototype.apply%"),Fv=mf("%Function.prototype.call%"),Uv=mf("%Reflect.apply%",!0)||od.call(Fv,Ov),Nv=ff(),sR=mf("%Math.max%");gf.exports=function(e){if(typeof e!="function")throw new oR("a function is required");var r=Uv(od,Fv,arguments);return iR(r,1+sR(0,e.length-(arguments.length-1)),!0)};var Dv=function(){return Uv(od,Ov,arguments)};Nv?Nv(gf.exports,"apply",{value:Dv}):gf.exports.apply=Dv});var sd=It((Sz,kv)=>{"use strict";var Bv=zu(),zv=yf(),aR=zv(Bv("String.prototype.indexOf"));kv.exports=function(e,r){var u=Bv(e,!!r);return typeof u=="function"&&aR(e,".prototype.")>-1?zv(u):u}});var Vv=It((bz,Hv)=>{"use strict";var uR=sf()(),lR=sd(),ad=lR("Object.prototype.toString"),vf=function(e){return uR&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:ad(e)==="[object Arguments]"},Gv=function(e){return vf(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&ad(e)!=="[object Array]"&&ad(e.callee)==="[object Function]"},cR=function(){return vf(arguments)}();vf.isLegacyArguments=Gv;Hv.exports=cR?vf:Gv});var Gu=It((Az,Yv)=>{"use strict";var fR=Kp(),hR=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",pR=Object.prototype.toString,dR=Array.prototype.concat,Wv=pf(),gR=function(o){return typeof o=="function"&&pR.call(o)==="[object Function]"},qv=df()(),mR=function(o,e,r,u){if(e in o){if(u===!0){if(o[e]===r)return}else if(!gR(u)||!u())return}qv?Wv(o,e,r,!0):Wv(o,e,r)},Xv=function(o,e){var r=arguments.length>2?arguments[2]:{},u=fR(e);hR&&(u=dR.call(u,Object.getOwnPropertySymbols(e)));for(var l=0;l<u.length;l+=1)mR(o,u[l],e[u[l]],r[u[l]])};Xv.supportsDescriptors=!!qv;Yv.exports=Xv});var ud=It((Tz,Zv)=>{"use strict";var $v=function(o){return o!==o};Zv.exports=function(e,r){return e===0&&r===0?1/e===1/r:!!(e===r||$v(e)&&$v(r))}});var ld=It((Cz,Jv)=>{"use strict";var yR=ud();Jv.exports=function(){return typeof Object.is=="function"?Object.is:yR}});var Qv=It((Iz,Kv)=>{"use strict";var vR=ld(),_R=Gu();Kv.exports=function(){var e=vR();return _R(Object,{is:e},{is:function(){return Object.is!==e}}),e}});var n_=It((Pz,e_)=>{"use strict";var xR=Gu(),ER=yf(),wR=ud(),jv=ld(),MR=Qv(),t_=ER(jv(),Object);xR(t_,{getPolyfill:jv,implementation:wR,shim:MR});e_.exports=t_});var a_=It((Rz,s_)=>{"use strict";var cd=sd(),r_=sf()(),i_,o_,fd,hd;r_&&(i_=cd("Object.prototype.hasOwnProperty"),o_=cd("RegExp.prototype.exec"),fd={},_f=function(){throw fd},hd={toString:_f,valueOf:_f},typeof Symbol.toPrimitive=="symbol"&&(hd[Symbol.toPrimitive]=_f));var _f,SR=cd("Object.prototype.toString"),bR=Object.getOwnPropertyDescriptor,AR="[object RegExp]";s_.exports=r_?function(e){if(!e||typeof e!="object")return!1;var r=bR(e,"lastIndex"),u=r&&i_(r,"value");if(!u)return!1;try{o_(e,hd)}catch(l){return l===fd}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:SR(e)===AR}});var l_=It((Lz,u_)=>{"use strict";var Bl=function(){return typeof function(){}.name=="string"},Ul=Object.getOwnPropertyDescriptor;if(Ul)try{Ul([],"length")}catch{Ul=null}Bl.functionsHaveConfigurableNames=function(){if(!Bl()||!Ul)return!1;var e=Ul(function(){},"name");return!!e&&!!e.configurable};var TR=Function.prototype.bind;Bl.boundFunctionsHaveNames=function(){return Bl()&&typeof TR=="function"&&function(){}.bind().name!==""};u_.exports=Bl});var h_=It((Nz,f_)=>{"use strict";var c_=pf(),CR=df()(),IR=l_().functionsHaveConfigurableNames(),PR=ja();f_.exports=function(e,r){if(typeof e!="function")throw new PR("`fn` is not a function");var u=arguments.length>2&&!!arguments[2];return(!u||IR)&&(CR?c_(e,"name",r,!0,!0):c_(e,"name",r)),e}});var pd=It((Dz,p_)=>{"use strict";var RR=h_(),LR=ja(),NR=Object;p_.exports=RR(function(){if(this==null||this!==NR(this))throw new LR("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 dd=It((Oz,d_)=>{"use strict";var DR=pd(),OR=Gu().supportsDescriptors,FR=Object.getOwnPropertyDescriptor;d_.exports=function(){if(OR&&/a/mig.flags==="gim"){var e=FR(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var r="",u={};if(Object.defineProperty(u,"hasIndices",{get:function(){r+="d"}}),Object.defineProperty(u,"sticky",{get:function(){r+="y"}}),e.get.call(u),r==="dy")return e.get}}return DR}});var y_=It((Fz,m_)=>{"use strict";var UR=Gu().supportsDescriptors,BR=dd(),zR=Object.getOwnPropertyDescriptor,kR=Object.defineProperty,GR=TypeError,g_=Object.getPrototypeOf,HR=/a/;m_.exports=function(){if(!UR||!g_)throw new GR("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=BR(),r=g_(HR),u=zR(r,"flags");return(!u||u.get!==e)&&kR(r,"flags",{configurable:!0,enumerable:!1,get:e}),e}});var E_=It((Uz,x_)=>{"use strict";var VR=Gu(),WR=yf(),qR=pd(),v_=dd(),XR=y_(),__=WR(v_());VR(__,{getPolyfill:v_,implementation:qR,shim:XR});x_.exports=__});var M_=It((Bz,w_)=>{"use strict";var YR=Date.prototype.getDay,$R=function(e){try{return YR.call(e),!0}catch{return!1}},ZR=Object.prototype.toString,JR="[object Date]",KR=sf()();w_.exports=function(e){return typeof e!="object"||e===null?!1:KR?$R(e):ZR.call(e)===JR}});var gd=It((zz,D_)=>{var S_=Kp(),b_=Vv(),A_=n_(),T_=a_(),C_=E_(),I_=M_(),P_=Date.prototype.getTime;function N_(o,e,r){var u=r||{};return(u.strict?A_(o,e):o===e)?!0:!o||!e||typeof o!="object"&&typeof e!="object"?u.strict?A_(o,e):o==e:QR(o,e,u)}function R_(o){return o==null}function L_(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 QR(o,e,r){var u,l;if(typeof o!=typeof e||R_(o)||R_(e)||o.prototype!==e.prototype||b_(o)!==b_(e))return!1;var h=T_(o),p=T_(e);if(h!==p)return!1;if(h||p)return o.source===e.source&&C_(o)===C_(e);if(I_(o)&&I_(e))return P_.call(o)===P_.call(e);var m=L_(o),y=L_(e);if(m!==y)return!1;if(m||y){if(o.length!==e.length)return!1;for(u=0;u<o.length;u++)if(o[u]!==e[u])return!1;return!0}if(typeof o!=typeof e)return!1;try{var x=S_(o),E=S_(e)}catch{return!1}if(x.length!==E.length)return!1;for(x.sort(),E.sort(),u=x.length-1;u>=0;u--)if(x[u]!=E[u])return!1;for(u=x.length-1;u>=0;u--)if(l=x[u],!N_(o[l],e[l],r))return!1;return!0}D_.exports=N_});var Td=It((qk,G_)=>{var HL=gd(),Rs=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:VL};Rs.prototype.compare=function(o,e){if(o.type!==e.type||!k_(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,u=z_(o),l=z_(e);return u.every(function(h){return this.some(function(p){return r.compare(h,p)})},l)}}return!1};function z_(o){return o.coordinates.map(function(e){return{type:o.type.replace("Multi",""),coordinates:e}})}function k_(o,e){return o.hasOwnProperty("coordinates")?o.coordinates.length===e.coordinates.length:o.length===e.length}Rs.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};Rs.prototype.compareLine=function(o,e,r,u){if(!k_(o,e))return!1;var l=this.pseudoNode?o:this.removePseudo(o),h=this.pseudoNode?e:this.removePseudo(e);if(!(u&&!this.compareCoord(l[0],h[0])&&(h=this.fixStartIndex(h,l),!h))){var p=this.compareCoord(l[r],h[r]);return this.direction||p?this.comparePath(l,h):this.compareCoord(l[r],h[h.length-(1+r)])?this.comparePath(l.slice().reverse(),h):!1}};Rs.prototype.fixStartIndex=function(o,e){for(var r,u=-1,l=0;l<o.length;l++)if(this.compareCoord(o[l],e[0])){u=l;break}return u>=0&&(r=[].concat(o.slice(u,o.length),o.slice(1,u+1))),r};Rs.prototype.comparePath=function(o,e){var r=this;return o.every(function(u,l){return r.compareCoord(u,this[l])},e)};Rs.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),u=e.coordinates.slice(1,e.coordinates.length),l=this;return r.every(function(h){return this.some(function(p){return l.compareLine(h,p,1,!0)})},u)}else return!1};Rs.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)};Rs.prototype.compareBBox=function(o,e){return!!(!o.bbox&&!e.bbox||o.bbox&&e.bbox&&this.compareCoord(o.bbox,e.bbox))};Rs.prototype.removePseudo=function(o){return o};function VL(o,e){return HL(o,e,{strict:!0})}G_.exports=Rs});var H_=It((rG,wf)=>{function Aa(o,e,r,u){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,u)}Aa.prototype.run=function(o,e,r,u){this._init(o,e,r,u);for(var l=0;l<this._datasetLength;l++)if(this._visited[l]!==1){this._visited[l]=1;var h=this._regionQuery(l);if(h.length<this.minPts)this.noise.push(l);else{var p=this.clusters.length;this.clusters.push([]),this._addToCluster(l,p),this._expandCluster(p,h)}}return this.clusters};Aa.prototype._init=function(o,e,r,u){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),u&&(this.distance=u)};Aa.prototype._expandCluster=function(o,e){for(var r=0;r<e.length;r++){var u=e[r];if(this._visited[u]!==1){this._visited[u]=1;var l=this._regionQuery(u);l.length>=this.minPts&&(e=this._mergeArrays(e,l))}this._assigned[u]!==1&&this._addToCluster(u,o)}};Aa.prototype._addToCluster=function(o,e){this.clusters[e].push(o),this._assigned[o]=1};Aa.prototype._regionQuery=function(o){for(var e=[],r=0;r<this._datasetLength;r++){var u=this.distance(this.dataset[o],this.dataset[r]);u<this.epsilon&&e.push(r)}return e};Aa.prototype._mergeArrays=function(o,e){for(var r=e.length,u=0;u<r;u++){var l=e[u];o.indexOf(l)<0&&o.push(l)}return o};Aa.prototype._euclideanDistance=function(o,e){for(var r=0,u=Math.min(o.length,e.length);u--;)r+=(o[u]-e[u])*(o[u]-e[u]);return Math.sqrt(r)};typeof wf<"u"&&wf.exports&&(wf.exports=Aa)});var V_=It((iG,Mf)=>{function Ta(o,e,r){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(o,e,r)}Ta.prototype.init=function(o,e,r){this.assignments=[],this.centroids=[],typeof o<"u"&&(this.dataset=o),typeof e<"u"&&(this.k=e),typeof r<"u"&&(this.distance=r)};Ta.prototype.run=function(o,e){this.init(o,e);for(var r=this.dataset.length,u=0;u<this.k;u++)this.centroids[u]=this.randomCentroid();for(var l=!0;l;){l=this.assign();for(var h=0;h<this.k;h++){for(var p=new Array(E),m=0,y=0;y<E;y++)p[y]=0;for(var x=0;x<r;x++){var E=this.dataset[x].length;if(h===this.assignments[x]){for(var y=0;y<E;y++)p[y]+=this.dataset[x][y];m++}}if(m>0){for(var y=0;y<E;y++)p[y]/=m;this.centroids[h]=p}else this.centroids[h]=this.randomCentroid(),l=!0}}return this.getClusters()};Ta.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};Ta.prototype.assign=function(){for(var o=!1,e=this.dataset.length,r,u=0;u<e;u++)r=this.argmin(this.dataset[u],this.centroids,this.distance),r!=this.assignments[u]&&(this.assignments[u]=r,o=!0);return o};Ta.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]>"u"&&(o[e]=[]),o[e].push(r);return o};Ta.prototype.argmin=function(o,e,r){for(var u=Number.MAX_VALUE,l=0,h=e.length,p,m=0;m<h;m++)p=r(o,e[m]),p<u&&(u=p,l=m);return l};Ta.prototype.distance=function(o,e){for(var r=0,u=Math.min(o.length,e.length);u--;){var l=o[u]-e[u];r+=l*l}return Math.sqrt(r)};typeof Mf<"u"&&Mf.exports&&(Mf.exports=Ta)});var Cd=It((oG,Sf)=>{function Ls(o,e,r){this._queue=[],this._priorities=[],this._sorting="desc",this._init(o,e,r)}Ls.prototype.insert=function(o,e){for(var r=this._queue.length,u=r;u--;){var l=this._priorities[u];this._sorting==="desc"?e>l&&(r=u):e<l&&(r=u)}this._insertAt(o,e,r)};Ls.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}}};Ls.prototype.forEach=function(o){this._queue.forEach(o)};Ls.prototype.getElements=function(){return this._queue};Ls.prototype.getElementPriority=function(o){return this._priorities[o]};Ls.prototype.getPriorities=function(){return this._priorities};Ls.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};Ls.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 u=0;u<o.length;u++)this.insert(o[u],e[u])}r&&(this._sorting=r)};Ls.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 Sf<"u"&&Sf.exports&&(Sf.exports=Ls)});var q_=It((sG,Vu)=>{typeof Vu<"u"&&Vu.exports&&(W_=Cd());var W_;function ta(o,e,r,u){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(o,e,r,u)}ta.prototype.run=function(o,e,r,u){this._init(o,e,r,u);for(var l=0,h=this.dataset.length;l<h;l++)if(this._processed[l]!==1){this._processed[l]=1,this.clusters.push([l]);var p=this.clusters.length-1;this._orderedList.push(l);var m=new W_(null,null,"asc"),y=this._regionQuery(l);this._distanceToCore(l)!==void 0&&(this._updateQueue(l,y,m),this._expandCluster(p,m))}return this.clusters};ta.prototype.getReachabilityPlot=function(){for(var o=[],e=0,r=this._orderedList.length;e<r;e++){var u=this._orderedList[e],l=this._reachability[u];o.push([u,l])}return o};ta.prototype._init=function(o,e,r,u){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),u&&(this.distance=u)};ta.prototype._updateQueue=function(o,e,r){var u=this;this._coreDistance=this._distanceToCore(o),e.forEach(function(l){if(u._processed[l]===void 0){var h=u.distance(u.dataset[o],u.dataset[l]),p=Math.max(u._coreDistance,h);u._reachability[l]===void 0?(u._reachability[l]=p,r.insert(l,p)):p<u._reachability[l]&&(u._reachability[l]=p,r.remove(l),r.insert(l,p))}})};ta.prototype._expandCluster=function(o,e){for(var r=e.getElements(),u=0,l=r.length;u<l;u++){var h=r[u];if(this._processed[h]===void 0){var p=this._regionQuery(h);this._processed[h]=1,this.clusters[o].push(h),this._orderedList.push(h),this._distanceToCore(h)!==void 0&&(this._updateQueue(h,p,e),this._expandCluster(o,e))}}};ta.prototype._distanceToCore=function(o){for(var e=this.epsilon,r=0;r<e;r++){var u=this._regionQuery(o,r);if(u.length>=this.minPts)return r}};ta.prototype._regionQuery=function(o,e){e=e||this.epsilon;for(var r=[],u=0,l=this.dataset.length;u<l;u++)this.distance(this.dataset[o],this.dataset[u])<e&&r.push(u);return r};ta.prototype._euclideanDistance=function(o,e){for(var r=0,u=Math.min(o.length,e.length);u--;)r+=(o[u]-e[u])*(o[u]-e[u]);return Math.sqrt(r)};typeof Vu<"u"&&Vu.exports&&(Vu.exports=ta)});var X_=It((aG,bf)=>{typeof bf<"u"&&bf.exports&&(bf.exports={DBSCAN:H_(),KMEANS:V_(),OPTICS:q_(),PriorityQueue:Cd()})});var Id=It((pG,$_)=>{"use strict";$_.exports={eudist:function(e,r,u){for(var l=e.length,h=0,p=0;p<l;p++){var m=(e[p]||0)-(r[p]||0);h+=m*m}return u?Math.sqrt(h):h},mandist:function(e,r,u){for(var l=e.length,h=0,p=0;p<l;p++)h+=Math.abs((e[p]||0)-(r[p]||0));return u?Math.sqrt(h):h},dist:function(e,r,u){var l=Math.abs(e-r);return u?l:l*l}}});var K_=It((dG,J_)=>{"use strict";var Z_=Id(),ZL=Z_.eudist,JL=Z_.dist;J_.exports={kmrand:function(e,r){for(var u={},l=[],h=r<<2,p=e.length,m=e[0].length>0;l.length<r&&h-- >0;){var y=e[Math.floor(Math.random()*p)],x=m?y.join("_"):""+y;u[x]||(u[x]=!0,l.push(y))}if(l.length<r)throw new Error("Error initializating clusters");return l},kmpp:function(e,r){var u=e[0].length?ZL:JL,l=[],h=e.length,p=e[0].length>0,m={},y=e[Math.floor(Math.random()*h)],x=p?y.join("_"):""+y;for(l.push(y),m[x]=!0;l.length<r;){for(var E=[],b=l.length,S=0,C=[],D=0;D<h;D++){for(var G=1/0,O=0;O<b;O++){var L=u(e[D],l[O]);L<=G&&(G=L)}E[D]=G}for(var k=0;k<h;k++)S+=E[k];for(var F=0;F<h;F++)C[F]={i:F,v:e[F],pr:E[F]/S,cs:0};C.sort(function(et,U){return et.pr-U.pr}),C[0].cs=C[0].pr;for(var $=1;$<h;$++)C[$].cs=C[$-1].cs+C[$].pr;for(var Z=Math.random(),it=0;it<h-1&&C[it++].cs<Z;);l.push(C[it-1].v)}return l}}});var n1=It((yG,e1)=>{"use strict";var Pd=Id(),t1=K_(),KL=Pd.eudist,gG=Pd.mandist,mG=Pd.dist,QL=t1.kmrand,jL=t1.kmpp,Q_=1e4;function j_(o,e,r){r=r||[];for(var u=0;u<o;u++)r[u]=e;return r}function t2(o,e,r,u){var l=[],h=[],p=[],m=[],y=!1,x=u||Q_,E=o.length,b=o[0].length,S=b>0,C=[];if(r)r=="kmrand"?l=QL(o,e):r=="kmpp"?l=jL(o,e):l=r;else for(var D={};l.length<e;){var G=Math.floor(Math.random()*E);D[G]||(D[G]=!0,l.push(o[G]))}do{j_(e,0,C);for(var O=0;O<E;O++){for(var L=1/0,k=0,F=0;F<e;F++){var m=S?KL(o[O],l[F]):Math.abs(o[O]-l[F]);m<=L&&(L=m,k=F)}p[O]=k,C[k]++}for(var $=[],h=[],Z=0,it=0;it<e;it++)$[it]=S?j_(b,0,$[it]):0,h[it]=l[it];if(S){for(var et=0;et<e;et++)l[et]=[];for(var U=0;U<E;U++)for(var wt=p[U],Lt=$[wt],Ot=o[U],W=0;W<b;W++)Lt[W]+=Ot[W];y=!0;for(var de=0;de<e;de++){for(var yt=l[de],zt=$[de],Kt=h[de],ie=C[de],_t=0;_t<b;_t++)yt[_t]=zt[_t]/ie||0;if(y){for(var Pt=0;Pt<b;Pt++)if(Kt[Pt]!=yt[Pt]){y=!1;break}}}}else{for(var q=0;q<E;q++){var oe=p[q];$[oe]+=o[q]}for(var Vt=0;Vt<e;Vt++)l[Vt]=$[Vt]/C[Vt]||0;y=!0;for(var tn=0;tn<e;tn++)if(h[tn]!=l[tn]){y=!1;break}}y=y||--x<=0}while(!y);return{it:Q_-x,k:e,idxs:p,centroids:l}}e1.exports=t2});var $u=It((Fd,Ud)=>{(function(o,e){typeof Fd=="object"&&typeof Ud<"u"?Ud.exports=e():typeof define=="function"&&define.amd?define(e):(o=typeof globalThis<"u"?globalThis:o||self,o.polygonClipping=e())})(Fd,function(){"use strict";function o(Y,w){var T={label:0,sent:function(){if(B[0]&1)throw B[1];return B[1]},trys:[],ops:[]},N,z,B,st;return st={next:K(0),throw:K(1),return:K(2)},typeof Symbol=="function"&&(st[Symbol.iterator]=function(){return this}),st;function K(at){return function(j){return ct([at,j])}}function ct(at){if(N)throw new TypeError("Generator is already executing.");for(;T;)try{if(N=1,z&&(B=at[0]&2?z.return:at[0]?z.throw||((B=z.return)&&B.call(z),0):z.next)&&!(B=B.call(z,at[1])).done)return B;switch(z=0,B&&(at=[at[0]&2,B.value]),at[0]){case 0:case 1:B=at;break;case 4:return T.label++,{value:at[1],done:!1};case 5:T.label++,z=at[1],at=[0];continue;case 7:at=T.ops.pop(),T.trys.pop();continue;default:if(B=T.trys,!(B=B.length>0&&B[B.length-1])&&(at[0]===6||at[0]===2)){T=0;continue}if(at[0]===3&&(!B||at[1]>B[0]&&at[1]<B[3])){T.label=at[1];break}if(at[0]===6&&T.label<B[1]){T.label=B[1],B=at;break}if(B&&T.label<B[2]){T.label=B[2],T.ops.push(at);break}B[2]&&T.ops.pop(),T.trys.pop();continue}at=w.call(Y,T)}catch(j){at=[6,j],z=0}finally{N=B=0}if(at[0]&5)throw at[1];return{value:at[0]?at[1]:void 0,done:!0}}}var e=function(){function Y(w,T){this.next=null,this.key=w,this.data=T,this.left=null,this.right=null}return Y}();function r(Y,w){return Y>w?1:Y<w?-1:0}function u(Y,w,T){for(var N=new e(null,null),z=N,B=N;;){var st=T(Y,w.key);if(st<0){if(w.left===null)break;if(T(Y,w.left.key)<0){var K=w.left;if(w.left=K.right,K.right=w,w=K,w.left===null)break}B.left=w,B=w,w=w.left}else if(st>0){if(w.right===null)break;if(T(Y,w.right.key)>0){var K=w.right;if(w.right=K.left,K.left=w,w=K,w.right===null)break}z.right=w,z=w,w=w.right}else break}return z.right=w.left,B.left=w.right,w.left=N.right,w.right=N.left,w}function l(Y,w,T,N){var z=new e(Y,w);if(T===null)return z.left=z.right=null,z;T=u(Y,T,N);var B=N(Y,T.key);return B<0?(z.left=T.left,z.right=T,T.left=null):B>=0&&(z.right=T.right,z.left=T,T.right=null),z}function h(Y,w,T){var N=null,z=null;if(w){w=u(Y,w,T);var B=T(w.key,Y);B===0?(N=w.left,z=w.right):B<0?(z=w.right,w.right=null,N=w):(N=w.left,w.left=null,z=w)}return{left:N,right:z}}function p(Y,w,T){return w===null?Y:(Y===null||(w=u(Y.key,w,T),w.left=Y),w)}function m(Y,w,T,N,z){if(Y){N(""+w+(T?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+z(Y)+`\n`);var B=w+(T?" ":"\\u2502 ");Y.left&&m(Y.left,B,!1,N,z),Y.right&&m(Y.right,B,!0,N,z)}}var y=function(){function Y(w){w===void 0&&(w=r),this._root=null,this._size=0,this._comparator=w}return Y.prototype.insert=function(w,T){return this._size++,this._root=l(w,T,this._root,this._comparator)},Y.prototype.add=function(w,T){var N=new e(w,T);this._root===null&&(N.left=N.right=null,this._size++,this._root=N);var z=this._comparator,B=u(w,this._root,z),st=z(w,B.key);return st===0?this._root=B:(st<0?(N.left=B.left,N.right=B,B.left=null):st>0&&(N.right=B.right,N.left=B,B.right=null),this._size++,this._root=N),this._root},Y.prototype.remove=function(w){this._root=this._remove(w,this._root,this._comparator)},Y.prototype._remove=function(w,T,N){var z;if(T===null)return null;T=u(w,T,N);var B=N(w,T.key);return B===0?(T.left===null?z=T.right:(z=u(w,T.left,N),z.right=T.right),this._size--,z):T},Y.prototype.pop=function(){var w=this._root;if(w){for(;w.left;)w=w.left;return this._root=u(w.key,this._root,this._comparator),this._root=this._remove(w.key,this._root,this._comparator),{key:w.key,data:w.data}}return null},Y.prototype.findStatic=function(w){for(var T=this._root,N=this._comparator;T;){var z=N(w,T.key);if(z===0)return T;z<0?T=T.left:T=T.right}return null},Y.prototype.find=function(w){return this._root&&(this._root=u(w,this._root,this._comparator),this._comparator(w,this._root.key)!==0)?null:this._root},Y.prototype.contains=function(w){for(var T=this._root,N=this._comparator;T;){var z=N(w,T.key);if(z===0)return!0;z<0?T=T.left:T=T.right}return!1},Y.prototype.forEach=function(w,T){for(var N=this._root,z=[],B=!1;!B;)N!==null?(z.push(N),N=N.left):z.length!==0?(N=z.pop(),w.call(T,N),N=N.right):B=!0;return this},Y.prototype.range=function(w,T,N,z){for(var B=[],st=this._comparator,K=this._root,ct;B.length!==0||K;)if(K)B.push(K),K=K.left;else{if(K=B.pop(),ct=st(K.key,T),ct>0)break;if(st(K.key,w)>=0&&N.call(z,K))return this;K=K.right}return this},Y.prototype.keys=function(){var w=[];return this.forEach(function(T){var N=T.key;return w.push(N)}),w},Y.prototype.values=function(){var w=[];return this.forEach(function(T){var N=T.data;return w.push(N)}),w},Y.prototype.min=function(){return this._root?this.minNode(this._root).key:null},Y.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},Y.prototype.minNode=function(w){if(w===void 0&&(w=this._root),w)for(;w.left;)w=w.left;return w},Y.prototype.maxNode=function(w){if(w===void 0&&(w=this._root),w)for(;w.right;)w=w.right;return w},Y.prototype.at=function(w){for(var T=this._root,N=!1,z=0,B=[];!N;)if(T)B.push(T),T=T.left;else if(B.length>0){if(T=B.pop(),z===w)return T;z++,T=T.right}else N=!0;return null},Y.prototype.next=function(w){var T=this._root,N=null;if(w.right){for(N=w.right;N.left;)N=N.left;return N}for(var z=this._comparator;T;){var B=z(w.key,T.key);if(B===0)break;B<0?(N=T,T=T.left):T=T.right}return N},Y.prototype.prev=function(w){var T=this._root,N=null;if(w.left!==null){for(N=w.left;N.right;)N=N.right;return N}for(var z=this._comparator;T;){var B=z(w.key,T.key);if(B===0)break;B<0?T=T.left:(N=T,T=T.right)}return N},Y.prototype.clear=function(){return this._root=null,this._size=0,this},Y.prototype.toList=function(){return b(this._root)},Y.prototype.load=function(w,T,N){T===void 0&&(T=[]),N===void 0&&(N=!1);var z=w.length,B=this._comparator;if(N&&D(w,T,0,z-1,B),this._root===null)this._root=x(w,T,0,z),this._size=z;else{var st=C(this.toList(),E(w,T),B);z=this._size+z,this._root=S({head:st},0,z)}return this},Y.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(Y.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(Y.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Y.prototype.toString=function(w){w===void 0&&(w=function(N){return String(N.key)});var T=[];return m(this._root,"",!0,function(N){return T.push(N)},w),T.join("")},Y.prototype.update=function(w,T,N){var z=this._comparator,B=h(w,this._root,z),st=B.left,K=B.right;z(w,T)<0?K=l(T,N,K,z):st=l(T,N,st,z),this._root=p(st,K,z)},Y.prototype.split=function(w){return h(w,this._root,this._comparator)},Y.prototype[Symbol.iterator]=function(){var w,T,N;return o(this,function(z){switch(z.label){case 0:w=this._root,T=[],N=!1,z.label=1;case 1:return N?[3,6]:w===null?[3,2]:(T.push(w),w=w.left,[3,5]);case 2:return T.length===0?[3,4]:(w=T.pop(),[4,w]);case 3:return z.sent(),w=w.right,[3,5];case 4:N=!0,z.label=5;case 5:return[3,1];case 6:return[2]}})},Y}();function x(Y,w,T,N){var z=N-T;if(z>0){var B=T+Math.floor(z/2),st=Y[B],K=w[B],ct=new e(st,K);return ct.left=x(Y,w,T,B),ct.right=x(Y,w,B+1,N),ct}return null}function E(Y,w){for(var T=new e(null,null),N=T,z=0;z<Y.length;z++)N=N.next=new e(Y[z],w[z]);return N.next=null,T.next}function b(Y){for(var w=Y,T=[],N=!1,z=new e(null,null),B=z;!N;)w?(T.push(w),w=w.left):T.length>0?(w=B=B.next=T.pop(),w=w.right):N=!0;return B.next=null,z.next}function S(Y,w,T){var N=T-w;if(N>0){var z=w+Math.floor(N/2),B=S(Y,w,z),st=Y.head;return st.left=B,Y.head=Y.head.next,st.right=S(Y,z+1,T),st}return null}function C(Y,w,T){for(var N=new e(null,null),z=N,B=Y,st=w;B!==null&&st!==null;)T(B.key,st.key)<0?(z.next=B,B=B.next):(z.next=st,st=st.next),z=z.next;return B!==null?z.next=B:st!==null&&(z.next=st),N.next}function D(Y,w,T,N,z){if(!(T>=N)){for(var B=Y[T+N>>1],st=T-1,K=N+1;;){do st++;while(z(Y[st],B)<0);do K--;while(z(Y[K],B)>0);if(st>=K)break;var ct=Y[st];Y[st]=Y[K],Y[K]=ct,ct=w[st],w[st]=w[K],w[K]=ct}D(Y,w,T,K,z),D(Y,w,K+1,N,z)}}let G=(Y,w)=>Y.ll.x<=w.x&&w.x<=Y.ur.x&&Y.ll.y<=w.y&&w.y<=Y.ur.y,O=(Y,w)=>{if(w.ur.x<Y.ll.x||Y.ur.x<w.ll.x||w.ur.y<Y.ll.y||Y.ur.y<w.ll.y)return null;let T=Y.ll.x<w.ll.x?w.ll.x:Y.ll.x,N=Y.ur.x<w.ur.x?Y.ur.x:w.ur.x,z=Y.ll.y<w.ll.y?w.ll.y:Y.ll.y,B=Y.ur.y<w.ur.y?Y.ur.y:w.ur.y;return{ll:{x:T,y:z},ur:{x:N,y:B}}},L=Number.EPSILON;L===void 0&&(L=Math.pow(2,-52));let k=L*L,F=(Y,w)=>{if(-L<Y&&Y<L&&-L<w&&w<L)return 0;let T=Y-w;return T*T<k*Y*w?0:Y<w?-1:1};class ${constructor(){this.reset()}reset(){this.xRounder=new Z,this.yRounder=new Z}round(w,T){return{x:this.xRounder.round(w),y:this.yRounder.round(T)}}}class Z{constructor(){this.tree=new y,this.round(0)}round(w){let T=this.tree.add(w),N=this.tree.prev(T);if(N!==null&&F(T.key,N.key)===0)return this.tree.remove(w),N.key;let z=this.tree.next(T);return z!==null&&F(T.key,z.key)===0?(this.tree.remove(w),z.key):w}}let it=new $,et=11102230246251565e-32,U=134217729,wt=(3+8*et)*et;function Lt(Y,w,T,N,z){let B,st,K,ct,at=w[0],j=N[0],rt=0,ft=0;j>at==j>-at?(B=at,at=w[++rt]):(B=j,j=N[++ft]);let lt=0;if(rt<Y&&ft<T)for(j>at==j>-at?(st=at+B,K=B-(st-at),at=w[++rt]):(st=j+B,K=B-(st-j),j=N[++ft]),B=st,K!==0&&(z[lt++]=K);rt<Y&&ft<T;)j>at==j>-at?(st=B+at,ct=st-B,K=B-(st-ct)+(at-ct),at=w[++rt]):(st=B+j,ct=st-B,K=B-(st-ct)+(j-ct),j=N[++ft]),B=st,K!==0&&(z[lt++]=K);for(;rt<Y;)st=B+at,ct=st-B,K=B-(st-ct)+(at-ct),at=w[++rt],B=st,K!==0&&(z[lt++]=K);for(;ft<T;)st=B+j,ct=st-B,K=B-(st-ct)+(j-ct),j=N[++ft],B=st,K!==0&&(z[lt++]=K);return(B!==0||lt===0)&&(z[lt++]=B),lt}function Ot(Y,w){let T=w[0];for(let N=1;N<Y;N++)T+=w[N];return T}function W(Y){return new Float64Array(Y)}let de=(3+16*et)*et,yt=(2+12*et)*et,zt=(9+64*et)*et*et,Kt=W(4),ie=W(8),_t=W(12),Pt=W(16),q=W(4);function oe(Y,w,T,N,z,B,st){let K,ct,at,j,rt,ft,lt,Gt,kt,re,Yt,wn,pr,Vn,Tn,tr,Ur,Fn,Wt=Y-z,Un=T-z,Wn=w-B,Bn=N-B;Vn=Wt*Bn,ft=U*Wt,lt=ft-(ft-Wt),Gt=Wt-lt,ft=U*Bn,kt=ft-(ft-Bn),re=Bn-kt,Tn=Gt*re-(Vn-lt*kt-Gt*kt-lt*re),tr=Wn*Un,ft=U*Wn,lt=ft-(ft-Wn),Gt=Wn-lt,ft=U*Un,kt=ft-(ft-Un),re=Un-kt,Ur=Gt*re-(tr-lt*kt-Gt*kt-lt*re),Yt=Tn-Ur,rt=Tn-Yt,Kt[0]=Tn-(Yt+rt)+(rt-Ur),wn=Vn+Yt,rt=wn-Vn,pr=Vn-(wn-rt)+(Yt-rt),Yt=pr-tr,rt=pr-Yt,Kt[1]=pr-(Yt+rt)+(rt-tr),Fn=wn+Yt,rt=Fn-wn,Kt[2]=wn-(Fn-rt)+(Yt-rt),Kt[3]=Fn;let _n=Ot(4,Kt),bi=yt*st;if(_n>=bi||-_n>=bi||(rt=Y-Wt,K=Y-(Wt+rt)+(rt-z),rt=T-Un,at=T-(Un+rt)+(rt-z),rt=w-Wn,ct=w-(Wn+rt)+(rt-B),rt=N-Bn,j=N-(Bn+rt)+(rt-B),K===0&&ct===0&&at===0&&j===0)||(bi=zt*st+wt*Math.abs(_n),_n+=Wt*j+Bn*K-(Wn*at+Un*ct),_n>=bi||-_n>=bi))return _n;Vn=K*Bn,ft=U*K,lt=ft-(ft-K),Gt=K-lt,ft=U*Bn,kt=ft-(ft-Bn),re=Bn-kt,Tn=Gt*re-(Vn-lt*kt-Gt*kt-lt*re),tr=ct*Un,ft=U*ct,lt=ft-(ft-ct),Gt=ct-lt,ft=U*Un,kt=ft-(ft-Un),re=Un-kt,Ur=Gt*re-(tr-lt*kt-Gt*kt-lt*re),Yt=Tn-Ur,rt=Tn-Yt,q[0]=Tn-(Yt+rt)+(rt-Ur),wn=Vn+Yt,rt=wn-Vn,pr=Vn-(wn-rt)+(Yt-rt),Yt=pr-tr,rt=pr-Yt,q[1]=pr-(Yt+rt)+(rt-tr),Fn=wn+Yt,rt=Fn-wn,q[2]=wn-(Fn-rt)+(Yt-rt),q[3]=Fn;let Xr=Lt(4,Kt,4,q,ie);Vn=Wt*j,ft=U*Wt,lt=ft-(ft-Wt),Gt=Wt-lt,ft=U*j,kt=ft-(ft-j),re=j-kt,Tn=Gt*re-(Vn-lt*kt-Gt*kt-lt*re),tr=Wn*at,ft=U*Wn,lt=ft-(ft-Wn),Gt=Wn-lt,ft=U*at,kt=ft-(ft-at),re=at-kt,Ur=Gt*re-(tr-lt*kt-Gt*kt-lt*re),Yt=Tn-Ur,rt=Tn-Yt,q[0]=Tn-(Yt+rt)+(rt-Ur),wn=Vn+Yt,rt=wn-Vn,pr=Vn-(wn-rt)+(Yt-rt),Yt=pr-tr,rt=pr-Yt,q[1]=pr-(Yt+rt)+(rt-tr),Fn=wn+Yt,rt=Fn-wn,q[2]=wn-(Fn-rt)+(Yt-rt),q[3]=Fn;let ea=Lt(Xr,ie,4,q,_t);Vn=K*j,ft=U*K,lt=ft-(ft-K),Gt=K-lt,ft=U*j,kt=ft-(ft-j),re=j-kt,Tn=Gt*re-(Vn-lt*kt-Gt*kt-lt*re),tr=ct*at,ft=U*ct,lt=ft-(ft-ct),Gt=ct-lt,ft=U*at,kt=ft-(ft-at),re=at-kt,Ur=Gt*re-(tr-lt*kt-Gt*kt-lt*re),Yt=Tn-Ur,rt=Tn-Yt,q[0]=Tn-(Yt+rt)+(rt-Ur),wn=Vn+Yt,rt=wn-Vn,pr=Vn-(wn-rt)+(Yt-rt),Yt=pr-tr,rt=pr-Yt,q[1]=pr-(Yt+rt)+(rt-tr),Fn=wn+Yt,rt=Fn-wn,q[2]=wn-(Fn-rt)+(Yt-rt),q[3]=Fn;let Yr=Lt(ea,_t,4,q,Pt);return Pt[Yr-1]}function Vt(Y,w,T,N,z,B){let st=(w-B)*(T-z),K=(Y-z)*(N-B),ct=st-K,at=Math.abs(st+K);return Math.abs(ct)>=de*at?ct:-oe(Y,w,T,N,z,B,at)}let tn=(Y,w)=>Y.x*w.y-Y.y*w.x,Mt=(Y,w)=>Y.x*w.x+Y.y*w.y,mn=(Y,w,T)=>{let N=Vt(Y.x,Y.y,w.x,w.y,T.x,T.y);return N>0?-1:N<0?1:0},Hn=Y=>Math.sqrt(Mt(Y,Y)),yn=(Y,w,T)=>{let N={x:w.x-Y.x,y:w.y-Y.y},z={x:T.x-Y.x,y:T.y-Y.y};return tn(z,N)/Hn(z)/Hn(N)},Ge=(Y,w,T)=>{let N={x:w.x-Y.x,y:w.y-Y.y},z={x:T.x-Y.x,y:T.y-Y.y};return Mt(z,N)/Hn(z)/Hn(N)},an=(Y,w,T)=>w.y===0?null:{x:Y.x+w.x/w.y*(T-Y.y),y:T},Et=(Y,w,T)=>w.x===0?null:{x:T,y:Y.y+w.y/w.x*(T-Y.x)},Pr=(Y,w,T,N)=>{if(w.x===0)return Et(T,N,Y.x);if(N.x===0)return Et(Y,w,T.x);if(w.y===0)return an(T,N,Y.y);if(N.y===0)return an(Y,w,T.y);let z=tn(w,N);if(z==0)return null;let B={x:T.x-Y.x,y:T.y-Y.y},st=tn(B,w)/z,K=tn(B,N)/z,ct=Y.x+K*w.x,at=T.x+st*N.x,j=Y.y+K*w.y,rt=T.y+st*N.y,ft=(ct+at)/2,lt=(j+rt)/2;return{x:ft,y:lt}};class Jt{static compare(w,T){let N=Jt.comparePoints(w.point,T.point);return N!==0?N:(w.point!==T.point&&w.link(T),w.isLeft!==T.isLeft?w.isLeft?1:-1:hn.compare(w.segment,T.segment))}static comparePoints(w,T){return w.x<T.x?-1:w.x>T.x?1:w.y<T.y?-1:w.y>T.y?1:0}constructor(w,T){w.events===void 0?w.events=[this]:w.events.push(this),this.point=w,this.isLeft=T}link(w){if(w.point===this.point)throw new Error("Tried to link already linked events");let T=w.point.events;for(let N=0,z=T.length;N<z;N++){let B=T[N];this.point.events.push(B),B.point=this.point}this.checkForConsuming()}checkForConsuming(){let w=this.point.events.length;for(let T=0;T<w;T++){let N=this.point.events[T];if(N.segment.consumedBy===void 0)for(let z=T+1;z<w;z++){let B=this.point.events[z];B.consumedBy===void 0&&N.otherSE.point.events===B.otherSE.point.events&&N.segment.consume(B.segment)}}}getAvailableLinkedEvents(){let w=[];for(let T=0,N=this.point.events.length;T<N;T++){let z=this.point.events[T];z!==this&&!z.segment.ringOut&&z.segment.isInResult()&&w.push(z)}return w}getLeftmostComparator(w){let T=new Map,N=z=>{let B=z.otherSE;T.set(z,{sine:yn(this.point,w.point,B.point),cosine:Ge(this.point,w.point,B.point)})};return(z,B)=>{T.has(z)||N(z),T.has(B)||N(B);let{sine:st,cosine:K}=T.get(z),{sine:ct,cosine:at}=T.get(B);return st>=0&&ct>=0?K<at?1:K>at?-1:0:st<0&&ct<0?K<at?-1:K>at?1:0:ct<st?-1:ct>st?1:0}}}let jn=0;class hn{static compare(w,T){let N=w.leftSE.point.x,z=T.leftSE.point.x,B=w.rightSE.point.x,st=T.rightSE.point.x;if(st<N)return 1;if(B<z)return-1;let K=w.leftSE.point.y,ct=T.leftSE.point.y,at=w.rightSE.point.y,j=T.rightSE.point.y;if(N<z){if(ct<K&&ct<at)return 1;if(ct>K&&ct>at)return-1;let rt=w.comparePoint(T.leftSE.point);if(rt<0)return 1;if(rt>0)return-1;let ft=T.comparePoint(w.rightSE.point);return ft!==0?ft:-1}if(N>z){if(K<ct&&K<j)return-1;if(K>ct&&K>j)return 1;let rt=T.comparePoint(w.leftSE.point);if(rt!==0)return rt;let ft=w.comparePoint(T.rightSE.point);return ft<0?1:ft>0?-1:1}if(K<ct)return-1;if(K>ct)return 1;if(B<st){let rt=T.comparePoint(w.rightSE.point);if(rt!==0)return rt}if(B>st){let rt=w.comparePoint(T.rightSE.point);if(rt<0)return 1;if(rt>0)return-1}if(B!==st){let rt=at-K,ft=B-N,lt=j-ct,Gt=st-z;if(rt>ft&<<Gt)return 1;if(rt<ft&<>Gt)return-1}return B>st?1:B<st||at<j?-1:at>j?1:w.id<T.id?-1:w.id>T.id?1:0}constructor(w,T,N,z){this.id=++jn,this.leftSE=w,w.segment=this,w.otherSE=T,this.rightSE=T,T.segment=this,T.otherSE=w,this.rings=N,this.windings=z}static fromRing(w,T,N){let z,B,st,K=Jt.comparePoints(w,T);if(K<0)z=w,B=T,st=1;else if(K>0)z=T,B=w,st=-1;else throw new Error(`Tried to create degenerate segment at [${w.x}, ${w.y}]`);let ct=new Jt(z,!0),at=new Jt(B,!1);return new hn(ct,at,[N],[st])}replaceRightSE(w){this.rightSE=w,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let w=this.leftSE.point.y,T=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:w<T?w:T},ur:{x:this.rightSE.point.x,y:w>T?w:T}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(w){return w.x===this.leftSE.point.x&&w.y===this.leftSE.point.y||w.x===this.rightSE.point.x&&w.y===this.rightSE.point.y}comparePoint(w){if(this.isAnEndpoint(w))return 0;let T=this.leftSE.point,N=this.rightSE.point,z=this.vector();if(T.x===N.x)return w.x===T.x?0:w.x<T.x?1:-1;let B=(w.y-T.y)/z.y,st=T.x+B*z.x;if(w.x===st)return 0;let K=(w.x-T.x)/z.x,ct=T.y+K*z.y;return w.y===ct?0:w.y<ct?-1:1}getIntersection(w){let T=this.bbox(),N=w.bbox(),z=O(T,N);if(z===null)return null;let B=this.leftSE.point,st=this.rightSE.point,K=w.leftSE.point,ct=w.rightSE.point,at=G(T,K)&&this.comparePoint(K)===0,j=G(N,B)&&w.comparePoint(B)===0,rt=G(T,ct)&&this.comparePoint(ct)===0,ft=G(N,st)&&w.comparePoint(st)===0;if(j&&at)return ft&&!rt?st:!ft&&rt?ct:null;if(j)return rt&&B.x===ct.x&&B.y===ct.y?null:B;if(at)return ft&&st.x===K.x&&st.y===K.y?null:K;if(ft&&rt)return null;if(ft)return st;if(rt)return ct;let lt=Pr(B,this.vector(),K,w.vector());return lt===null||!G(z,lt)?null:it.round(lt.x,lt.y)}split(w){let T=[],N=w.events!==void 0,z=new Jt(w,!0),B=new Jt(w,!1),st=this.rightSE;this.replaceRightSE(B),T.push(B),T.push(z);let K=new hn(z,st,this.rings.slice(),this.windings.slice());return Jt.comparePoints(K.leftSE.point,K.rightSE.point)>0&&K.swapEvents(),Jt.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),N&&(z.checkForConsuming(),B.checkForConsuming()),T}swapEvents(){let w=this.rightSE;this.rightSE=this.leftSE,this.leftSE=w,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let T=0,N=this.windings.length;T<N;T++)this.windings[T]*=-1}consume(w){let T=this,N=w;for(;T.consumedBy;)T=T.consumedBy;for(;N.consumedBy;)N=N.consumedBy;let z=hn.compare(T,N);if(z!==0){if(z>0){let B=T;T=N,N=B}if(T.prev===N){let B=T;T=N,N=B}for(let B=0,st=N.rings.length;B<st;B++){let K=N.rings[B],ct=N.windings[B],at=T.rings.indexOf(K);at===-1?(T.rings.push(K),T.windings.push(ct)):T.windings[at]+=ct}N.rings=null,N.windings=null,N.consumedBy=T,N.leftSE.consumedBy=T.leftSE,N.rightSE.consumedBy=T.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let w=this.prev.consumedBy||this.prev;this._beforeState=w.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let w=this.beforeState();this._afterState={rings:w.rings.slice(0),windings:w.windings.slice(0),multiPolys:[]};let T=this._afterState.rings,N=this._afterState.windings,z=this._afterState.multiPolys;for(let K=0,ct=this.rings.length;K<ct;K++){let at=this.rings[K],j=this.windings[K],rt=T.indexOf(at);rt===-1?(T.push(at),N.push(j)):N[rt]+=j}let B=[],st=[];for(let K=0,ct=T.length;K<ct;K++){if(N[K]===0)continue;let at=T[K],j=at.poly;if(st.indexOf(j)===-1)if(at.isExterior)B.push(j);else{st.indexOf(j)===-1&&st.push(j);let rt=B.indexOf(at.poly);rt!==-1&&B.splice(rt,1)}}for(let K=0,ct=B.length;K<ct;K++){let at=B[K].multiPoly;z.indexOf(at)===-1&&z.push(at)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let w=this.beforeState().multiPolys,T=this.afterState().multiPolys;switch(mt.type){case"union":{let N=w.length===0,z=T.length===0;this._isInResult=N!==z;break}case"intersection":{let N,z;w.length<T.length?(N=w.length,z=T.length):(N=T.length,z=w.length),this._isInResult=z===mt.numMultiPolys&&N<z;break}case"xor":{let N=Math.abs(w.length-T.length);this._isInResult=N%2===1;break}case"difference":{let N=z=>z.length===1&&z[0].isSubject;this._isInResult=N(w)!==N(T);break}default:throw new Error(`Unrecognized operation type found ${mt.type}`)}return this._isInResult}}class vn{constructor(w,T,N){if(!Array.isArray(w)||w.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=T,this.isExterior=N,this.segments=[],typeof w[0][0]!="number"||typeof w[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let z=it.round(w[0][0],w[0][1]);this.bbox={ll:{x:z.x,y:z.y},ur:{x:z.x,y:z.y}};let B=z;for(let st=1,K=w.length;st<K;st++){if(typeof w[st][0]!="number"||typeof w[st][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let ct=it.round(w[st][0],w[st][1]);ct.x===B.x&&ct.y===B.y||(this.segments.push(hn.fromRing(B,ct,this)),ct.x<this.bbox.ll.x&&(this.bbox.ll.x=ct.x),ct.y<this.bbox.ll.y&&(this.bbox.ll.y=ct.y),ct.x>this.bbox.ur.x&&(this.bbox.ur.x=ct.x),ct.y>this.bbox.ur.y&&(this.bbox.ur.y=ct.y),B=ct)}(z.x!==B.x||z.y!==B.y)&&this.segments.push(hn.fromRing(B,z,this))}getSweepEvents(){let w=[];for(let T=0,N=this.segments.length;T<N;T++){let z=this.segments[T];w.push(z.leftSE),w.push(z.rightSE)}return w}}class On{constructor(w,T){if(!Array.isArray(w))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new vn(w[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let N=1,z=w.length;N<z;N++){let B=new vn(w[N],this,!1);B.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=B.bbox.ll.x),B.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=B.bbox.ll.y),B.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=B.bbox.ur.x),B.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=B.bbox.ur.y),this.interiorRings.push(B)}this.multiPoly=T}getSweepEvents(){let w=this.exteriorRing.getSweepEvents();for(let T=0,N=this.interiorRings.length;T<N;T++){let z=this.interiorRings[T].getSweepEvents();for(let B=0,st=z.length;B<st;B++)w.push(z[B])}return w}}class xr{constructor(w,T){if(!Array.isArray(w))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof w[0][0][0]=="number"&&(w=[w])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let N=0,z=w.length;N<z;N++){let B=new On(w[N],this);B.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=B.bbox.ll.x),B.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=B.bbox.ll.y),B.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=B.bbox.ur.x),B.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=B.bbox.ur.y),this.polys.push(B)}this.isSubject=T}getSweepEvents(){let w=[];for(let T=0,N=this.polys.length;T<N;T++){let z=this.polys[T].getSweepEvents();for(let B=0,st=z.length;B<st;B++)w.push(z[B])}return w}}class ui{static factory(w){let T=[];for(let N=0,z=w.length;N<z;N++){let B=w[N];if(!B.isInResult()||B.ringOut)continue;let st=null,K=B.leftSE,ct=B.rightSE,at=[K],j=K.point,rt=[];for(;st=K,K=ct,at.push(K),K.point!==j;)for(;;){let ft=K.getAvailableLinkedEvents();if(ft.length===0){let kt=at[0].point,re=at[at.length-1].point;throw new Error(`Unable to complete output ring starting at [${kt.x}, ${kt.y}]. Last matching segment found ends at [${re.x}, ${re.y}].`)}if(ft.length===1){ct=ft[0].otherSE;break}let lt=null;for(let kt=0,re=rt.length;kt<re;kt++)if(rt[kt].point===K.point){lt=kt;break}if(lt!==null){let kt=rt.splice(lt)[0],re=at.splice(kt.index);re.unshift(re[0].otherSE),T.push(new ui(re.reverse()));continue}rt.push({index:at.length,point:K.point});let Gt=K.getLeftmostComparator(st);ct=ft.sort(Gt)[0].otherSE;break}T.push(new ui(at))}return T}constructor(w){this.events=w;for(let T=0,N=w.length;T<N;T++)w[T].segment.ringOut=this;this.poly=null}getGeom(){let w=this.events[0].point,T=[w];for(let at=1,j=this.events.length-1;at<j;at++){let rt=this.events[at].point,ft=this.events[at+1].point;mn(rt,w,ft)!==0&&(T.push(rt),w=rt)}if(T.length===1)return null;let N=T[0],z=T[1];mn(N,w,z)===0&&T.shift(),T.push(T[0]);let B=this.isExteriorRing()?1:-1,st=this.isExteriorRing()?0:T.length-1,K=this.isExteriorRing()?T.length:-1,ct=[];for(let at=st;at!=K;at+=B)ct.push([T[at].x,T[at].y]);return ct}isExteriorRing(){if(this._isExteriorRing===void 0){let w=this.enclosingRing();this._isExteriorRing=w?!w.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let w=this.events[0];for(let z=1,B=this.events.length;z<B;z++){let st=this.events[z];Jt.compare(w,st)>0&&(w=st)}let T=w.segment.prevInResult(),N=T?T.prevInResult():null;for(;;){if(!T)return null;if(!N)return T.ringOut;if(N.ringOut!==T.ringOut)return N.ringOut.enclosingRing()!==T.ringOut?T.ringOut:T.ringOut.enclosingRing();T=N.prevInResult(),N=T?T.prevInResult():null}}}class Nt{constructor(w){this.exteriorRing=w,w.poly=this,this.interiorRings=[]}addInterior(w){this.interiorRings.push(w),w.poly=this}getGeom(){let w=[this.exteriorRing.getGeom()];if(w[0]===null)return null;for(let T=0,N=this.interiorRings.length;T<N;T++){let z=this.interiorRings[T].getGeom();z!==null&&w.push(z)}return w}}class He{constructor(w){this.rings=w,this.polys=this._composePolys(w)}getGeom(){let w=[];for(let T=0,N=this.polys.length;T<N;T++){let z=this.polys[T].getGeom();z!==null&&w.push(z)}return w}_composePolys(w){let T=[];for(let N=0,z=w.length;N<z;N++){let B=w[N];if(!B.poly)if(B.isExteriorRing())T.push(new Nt(B));else{let st=B.enclosingRing();st.poly||T.push(new Nt(st)),st.poly.addInterior(B)}}return T}}class wi{constructor(w){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:hn.compare;this.queue=w,this.tree=new y(T),this.segments=[]}process(w){let T=w.segment,N=[];if(w.consumedBy)return w.isLeft?this.queue.remove(w.otherSE):this.tree.remove(T),N;let z=w.isLeft?this.tree.add(T):this.tree.find(T);if(!z)throw new Error(`Unable to find segment #${T.id} [${T.leftSE.point.x}, ${T.leftSE.point.y}] -> [${T.rightSE.point.x}, ${T.rightSE.point.y}] in SweepLine tree.`);let B=z,st=z,K,ct;for(;K===void 0;)B=this.tree.prev(B),B===null?K=null:B.key.consumedBy===void 0&&(K=B.key);for(;ct===void 0;)st=this.tree.next(st),st===null?ct=null:st.key.consumedBy===void 0&&(ct=st.key);if(w.isLeft){let at=null;if(K){let rt=K.getIntersection(T);if(rt!==null&&(T.isAnEndpoint(rt)||(at=rt),!K.isAnEndpoint(rt))){let ft=this._splitSafely(K,rt);for(let lt=0,Gt=ft.length;lt<Gt;lt++)N.push(ft[lt])}}let j=null;if(ct){let rt=ct.getIntersection(T);if(rt!==null&&(T.isAnEndpoint(rt)||(j=rt),!ct.isAnEndpoint(rt))){let ft=this._splitSafely(ct,rt);for(let lt=0,Gt=ft.length;lt<Gt;lt++)N.push(ft[lt])}}if(at!==null||j!==null){let rt=null;at===null?rt=j:j===null?rt=at:rt=Jt.comparePoints(at,j)<=0?at:j,this.queue.remove(T.rightSE),N.push(T.rightSE);let ft=T.split(rt);for(let lt=0,Gt=ft.length;lt<Gt;lt++)N.push(ft[lt])}N.length>0?(this.tree.remove(T),N.push(w)):(this.segments.push(T),T.prev=K)}else{if(K&&ct){let at=K.getIntersection(ct);if(at!==null){if(!K.isAnEndpoint(at)){let j=this._splitSafely(K,at);for(let rt=0,ft=j.length;rt<ft;rt++)N.push(j[rt])}if(!ct.isAnEndpoint(at)){let j=this._splitSafely(ct,at);for(let rt=0,ft=j.length;rt<ft;rt++)N.push(j[rt])}}}this.tree.remove(T)}return N}_splitSafely(w,T){this.tree.remove(w);let N=w.rightSE;this.queue.remove(N);let z=w.split(T);return z.push(N),w.consumedBy===void 0&&this.tree.add(w),z}}let Mi=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,qr=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Rr{run(w,T,N){mt.type=w,it.reset();let z=[new xr(T,!0)];for(let rt=0,ft=N.length;rt<ft;rt++)z.push(new xr(N[rt],!1));if(mt.numMultiPolys=z.length,mt.type==="difference"){let rt=z[0],ft=1;for(;ft<z.length;)O(z[ft].bbox,rt.bbox)!==null?ft++:z.splice(ft,1)}if(mt.type==="intersection")for(let rt=0,ft=z.length;rt<ft;rt++){let lt=z[rt];for(let Gt=rt+1,kt=z.length;Gt<kt;Gt++)if(O(lt.bbox,z[Gt].bbox)===null)return[]}let B=new y(Jt.compare);for(let rt=0,ft=z.length;rt<ft;rt++){let lt=z[rt].getSweepEvents();for(let Gt=0,kt=lt.length;Gt<kt;Gt++)if(B.insert(lt[Gt]),B.size>Mi)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let st=new wi(B),K=B.size,ct=B.pop();for(;ct;){let rt=ct.key;if(B.size===K){let lt=rt.segment;throw new Error(`Unable to pop() ${rt.isLeft?"left":"right"} SweepEvent [${rt.point.x}, ${rt.point.y}] from segment #${lt.id} [${lt.leftSE.point.x}, ${lt.leftSE.point.y}] -> [${lt.rightSE.point.x}, ${lt.rightSE.point.y}] from queue.`)}if(B.size>Mi)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(st.segments.length>qr)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let ft=st.process(rt);for(let lt=0,Gt=ft.length;lt<Gt;lt++){let kt=ft[lt];kt.consumedBy===void 0&&B.insert(kt)}K=B.size,ct=B.pop()}it.reset();let at=ui.factory(st.segments);return new He(at).getGeom()}}let mt=new Rr;var Os={union:function(Y){for(var w=arguments.length,T=new Array(w>1?w-1:0),N=1;N<w;N++)T[N-1]=arguments[N];return mt.run("union",Y,T)},intersection:function(Y){for(var w=arguments.length,T=new Array(w>1?w-1:0),N=1;N<w;N++)T[N-1]=arguments[N];return mt.run("intersection",Y,T)},xor:function(Y){for(var w=arguments.length,T=new Array(w>1?w-1:0),N=1;N<w;N++)T[N-1]=arguments[N];return mt.run("xor",Y,T)},difference:function(Y){for(var w=arguments.length,T=new Array(w>1?w-1:0),N=1;N<w;N++)T[N-1]=arguments[N];return mt.run("difference",Y,T)}};return Os})});var E1=It((If,x1)=>{(function(o,e){typeof If=="object"&&typeof x1<"u"?e(If):typeof define=="function"&&define.amd?define(["exports"],e):e(o.jsts={})})(If,function(o){"use strict";function e(){}function r(t){this.message=t||""}function u(t){this.message=t||""}function l(t){this.message=t||""}function h(){}function p(t){return t===null?Tn:t.color}function m(t){return t===null?null:t.parent}function y(t,n){t!==null&&(t.color=n)}function x(t){return t===null?null:t.left}function E(t){return t===null?null:t.right}function b(){this.root_=null,this.size_=0}function S(){}function C(){this.array_=[],arguments[0]instanceof K&&this.addAll(arguments[0])}function D(){}function G(t){this.message=t||""}function O(){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,a=1 in arguments&&parseInt(Number(arguments[1]),10)||0;a=a<0?Math.max(i+a,0):Math.min(a,i);var f=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:i;for(f=f<0?Math.max(i+arguments[2],0):Math.min(f,i);a<f;)n[a]=t,++a;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 L=function(){};L.prototype.interfaces_=function(){return[]},L.prototype.getClass=function(){return L},L.prototype.equalsWithTolerance=function(t,n,i){return Math.abs(t-n)<=i};var k=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),F=function(){},$={MAX_VALUE:{configurable:!0}};F.isNaN=function(t){return Number.isNaN(t)},F.doubleToLongBits=function(t){return t},F.longBitsToDouble=function(t){return t},F.isInfinite=function(t){return!Number.isFinite(t)},$.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(F,$);var Z=function(){},it=function(){},et=function(){},U=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])},wt={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};U.prototype.setOrdinate=function(t,n){switch(t){case U.X:this.x=n;break;case U.Y:this.y=n;break;case U.Z:this.z=n;break;default:throw new k("Invalid ordinate index: "+t)}},U.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!!L.equalsWithTolerance(this.x,n.x,i)&&!!L.equalsWithTolerance(this.y,n.y,i)}},U.prototype.getOrdinate=function(t){switch(t){case U.X:return this.x;case U.Y:return this.y;case U.Z:return this.z}throw new k("Invalid ordinate index: "+t)},U.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||F.isNaN(this.z))&&F.isNaN(t.z)},U.prototype.equals=function(t){return t instanceof U&&this.equals2D(t)},U.prototype.equalInZ=function(t,n){return L.equalsWithTolerance(this.z,t.z,n)},U.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},U.prototype.clone=function(){},U.prototype.copy=function(){return new U(this)},U.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},U.prototype.distance3D=function(t){var n=this.x-t.x,i=this.y-t.y,a=this.z-t.z;return Math.sqrt(n*n+i*i+a*a)},U.prototype.distance=function(t){var n=this.x-t.x,i=this.y-t.y;return Math.sqrt(n*n+i*i)},U.prototype.hashCode=function(){var t=17;return t=37*t+U.hashCode(this.x),t=37*t+U.hashCode(this.y)},U.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},U.prototype.interfaces_=function(){return[Z,it,e]},U.prototype.getClass=function(){return U},U.hashCode=function(){if(arguments.length===1){var t=arguments[0],n=F.doubleToLongBits(t);return Math.trunc((n^n)>>>32)}},wt.DimensionalComparator.get=function(){return Lt},wt.serialVersionUID.get=function(){return 6683108902428367e3},wt.NULL_ORDINATE.get=function(){return F.NaN},wt.X.get=function(){return 0},wt.Y.get=function(){return 1},wt.Z.get=function(){return 2},Object.defineProperties(U,wt);var Lt=function(t){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var n=arguments[0];if(n!==2&&n!==3)throw new k("only 2 or 3 dimensions may be specified");this._dimensionsToTest=n}}};Lt.prototype.compare=function(t,n){var i=t,a=n,f=Lt.compare(i.x,a.x);if(f!==0)return f;var g=Lt.compare(i.y,a.y);return g!==0?g:this._dimensionsToTest<=2?0:Lt.compare(i.z,a.z)},Lt.prototype.interfaces_=function(){return[et]},Lt.prototype.getClass=function(){return Lt},Lt.compare=function(t,n){return t<n?-1:t>n?1:F.isNaN(t)?F.isNaN(n)?0:-1:F.isNaN(n)?1:0};var Ot=function(){};Ot.prototype.create=function(){},Ot.prototype.interfaces_=function(){return[]},Ot.prototype.getClass=function(){return Ot};var W=function(){},de={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};W.prototype.interfaces_=function(){return[]},W.prototype.getClass=function(){return W},W.toLocationSymbol=function(t){switch(t){case W.EXTERIOR:return"e";case W.BOUNDARY:return"b";case W.INTERIOR:return"i";case W.NONE:return"-"}throw new k("Unknown location value: "+t)},de.INTERIOR.get=function(){return 0},de.BOUNDARY.get=function(){return 1},de.EXTERIOR.get=function(){return 2},de.NONE.get=function(){return-1},Object.defineProperties(W,de);var yt=function(t,n){return t.interfaces_&&t.interfaces_().indexOf(n)>-1},zt=function(){},Kt={LOG_10:{configurable:!0}};zt.prototype.interfaces_=function(){return[]},zt.prototype.getClass=function(){return zt},zt.log10=function(t){var n=Math.log(t);return F.isInfinite(n)||F.isNaN(n)?n:n/zt.LOG_10},zt.min=function(t,n,i,a){var f=t;return n<f&&(f=n),i<f&&(f=i),a<f&&(f=a),f},zt.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 a=arguments[0],f=arguments[1],g=arguments[2];return a<f?f:a>g?g:a}},zt.wrap=function(t,n){return t<0?n- -t%n:t%n},zt.max=function(){if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2],a=t;return n>a&&(a=n),i>a&&(a=i),a}if(arguments.length===4){var f=arguments[0],g=arguments[1],v=arguments[2],M=arguments[3],P=f;return g>P&&(P=g),v>P&&(P=v),M>P&&(P=M),P}},zt.average=function(t,n){return(t+n)/2},Kt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(zt,Kt);var ie=function(t){this.str=t};ie.prototype.append=function(t){this.str+=t},ie.prototype.setCharAt=function(t,n){this.str=this.str.substr(0,t)+n+this.str.substr(t+1)},ie.prototype.toString=function(t){return this.str};var _t=function(t){this.value=t};_t.prototype.intValue=function(){return this.value},_t.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},_t.isNaN=function(t){return Number.isNaN(t)};var Pt=function(){};Pt.isWhitespace=function(t){return t<=32&&t>=0||t===127},Pt.toUpperCase=function(t){return t.toUpperCase()};var q=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 a=arguments[0];t.call(this,t.parse(a))}}else if(arguments.length===2){var f=arguments[0],g=arguments[1];this.init(f,g)}},oe={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}};q.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},q.prototype.extractSignificantDigits=function(t,n){var i=this.abs(),a=q.magnitude(i._hi),f=q.TEN.pow(a);(i=i.divide(f)).gt(q.TEN)?(i=i.divide(q.TEN),a+=1):i.lt(q.ONE)&&(i=i.multiply(q.TEN),a-=1);for(var g=a+1,v=new ie,M=q.MAX_PRINT_DIGITS-1,P=0;P<=M;P++){t&&P===g&&v.append(".");var V=Math.trunc(i._hi);if(V<0)break;var tt=!1,nt=0;V>9?(tt=!0,nt="9"):nt="0"+V,v.append(nt),i=i.subtract(q.valueOf(V)).multiply(q.TEN),tt&&i.selfAdd(q.TEN);var vt=!0,xt=q.magnitude(i._hi);if(xt<0&&Math.abs(xt)>=M-P&&(vt=!1),!vt)break}return n[0]=a,v.toString()},q.prototype.sqr=function(){return this.multiply(this)},q.prototype.doubleValue=function(){return this._hi+this._lo},q.prototype.subtract=function(){if(arguments[0]instanceof q){var t=arguments[0];return this.add(t.negate())}if(typeof arguments[0]=="number"){var n=arguments[0];return this.add(-n)}},q.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},q.prototype.isZero=function(){return this._hi===0&&this._lo===0},q.prototype.selfSubtract=function(){if(arguments[0]instanceof q){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)}},q.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},q.prototype.min=function(t){return this.le(t)?this:t},q.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof q){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],a=arguments[1],f=null,g=null,v=null,M=null,P=null,V=null,tt=null,nt=null;return P=this._hi/i,V=q.SPLIT*P,f=V-P,nt=q.SPLIT*i,f=V-f,g=P-f,v=nt-i,tt=P*i,v=nt-v,M=i-v,nt=f*v-tt+f*M+g*v+g*M,V=(this._hi-tt-nt+this._lo-P*a)/i,nt=P+V,this._hi=nt,this._lo=P-nt+V,this}},q.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},q.prototype.divide=function(){if(arguments[0]instanceof q){var t=arguments[0],n=null,i=null,a=null,f=null,g=null,v=null,M=null,P=null;return i=(g=this._hi/t._hi)-(n=(v=q.SPLIT*g)-(n=v-g)),P=n*(a=(P=q.SPLIT*t._hi)-(a=P-t._hi))-(M=g*t._hi)+n*(f=t._hi-a)+i*a+i*f,v=(this._hi-M-P+this._lo-g*t._lo)/t._hi,new q(P=g+v,g-P+v)}if(typeof arguments[0]=="number"){var V=arguments[0];return F.isNaN(V)?q.createNaN():q.copy(this).selfDivide(V,0)}},q.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},q.prototype.pow=function(t){if(t===0)return q.valueOf(1);var n=new q(this),i=q.valueOf(1),a=Math.abs(t);if(a>1)for(;a>0;)a%2==1&&i.selfMultiply(n),(a/=2)>0&&(n=n.sqr());else i=n;return t<0?i.reciprocal():i},q.prototype.ceil=function(){if(this.isNaN())return q.NaN;var t=Math.ceil(this._hi),n=0;return t===this._hi&&(n=Math.ceil(this._lo)),new q(t,n)},q.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},q.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},q.prototype.setValue=function(){if(arguments[0]instanceof q){var t=arguments[0];return this.init(t),this}if(typeof arguments[0]=="number"){var n=arguments[0];return this.init(n),this}},q.prototype.max=function(t){return this.ge(t)?this:t},q.prototype.sqrt=function(){if(this.isZero())return q.valueOf(0);if(this.isNegative())return q.NaN;var t=1/Math.sqrt(this._hi),n=this._hi*t,i=q.valueOf(n),a=this.subtract(i.sqr())._hi*(.5*t);return i.add(a)},q.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof q){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if(typeof arguments[0]=="number"){var n=arguments[0],i=null,a=null,f=null,g=null,v=null,M=null;return f=this._hi+n,v=f-this._hi,g=f-v,g=n-v+(this._hi-g),M=g+this._lo,i=f+M,a=M+(f-i),this._hi=i+a,this._lo=a+(i-this._hi),this}}else if(arguments.length===2){var P=arguments[0],V=arguments[1],tt=null,nt=null,vt=null,xt=null,Tt=null,Ut=null,We=null;xt=this._hi+P,nt=this._lo+V,Tt=xt-(Ut=xt-this._hi),vt=nt-(We=nt-this._lo);var cn=(tt=xt+(Ut=(Tt=P-Ut+(this._hi-Tt))+nt))+(Ut=(vt=V-We+(this._lo-vt))+(Ut+(xt-tt))),Fr=Ut+(tt-cn);return this._hi=cn,this._lo=Fr,this}},q.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof q){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],a=arguments[1],f=null,g=null,v=null,M=null,P=null,V=null;f=(P=q.SPLIT*this._hi)-this._hi,V=q.SPLIT*i,f=P-f,g=this._hi-f,v=V-i;var tt=(P=this._hi*i)+(V=f*(v=V-v)-P+f*(M=i-v)+g*v+g*M+(this._hi*a+this._lo*i)),nt=V+(f=P-tt);return this._hi=tt,this._lo=nt,this}},q.prototype.selfSqr=function(){return this.selfMultiply(this)},q.prototype.floor=function(){if(this.isNaN())return q.NaN;var t=Math.floor(this._hi),n=0;return t===this._hi&&(n=Math.floor(this._lo)),new q(t,n)},q.prototype.negate=function(){return this.isNaN()?this:new q(-this._hi,-this._lo)},q.prototype.clone=function(){},q.prototype.multiply=function(){if(arguments[0]instanceof q){var t=arguments[0];return t.isNaN()?q.createNaN():q.copy(this).selfMultiply(t)}if(typeof arguments[0]=="number"){var n=arguments[0];return F.isNaN(n)?q.createNaN():q.copy(this).selfMultiply(n,0)}},q.prototype.isNaN=function(){return F.isNaN(this._hi)},q.prototype.intValue=function(){return Math.trunc(this._hi)},q.prototype.toString=function(){var t=q.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},q.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var n=new Array(1).fill(null),i=this.extractSignificantDigits(!0,n),a=n[0]+1,f=i;if(i.charAt(0)===".")f="0"+i;else if(a<0)f="0."+q.stringOfChar("0",-a)+i;else if(i.indexOf(".")===-1){var g=a-i.length;f=i+q.stringOfChar("0",g)+".0"}return this.isNegative()?"-"+f:f},q.prototype.reciprocal=function(){var t=null,n=null,i=null,a=null,f=null,g=null,v=null,M=null;n=(f=1/this._hi)-(t=(g=q.SPLIT*f)-(t=g-f)),i=(M=q.SPLIT*this._hi)-this._hi;var P=f+(g=(1-(v=f*this._hi)-(M=t*(i=M-i)-v+t*(a=this._hi-i)+n*i+n*a)-f*this._lo)/this._hi);return new q(P,f-P+g)},q.prototype.toSciNotation=function(){if(this.isZero())return q.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var n=new Array(1).fill(null),i=this.extractSignificantDigits(!1,n),a=q.SCI_NOT_EXPONENT_CHAR+n[0];if(i.charAt(0)==="0")throw new Error("Found leading zero: "+i);var f="";i.length>1&&(f=i.substring(1));var g=i.charAt(0)+"."+f;return this.isNegative()?"-"+g+a:g+a},q.prototype.abs=function(){return this.isNaN()?q.NaN:this.isNegative()?this.negate():new q(this)},q.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},q.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},q.prototype.add=function(){if(arguments[0]instanceof q){var t=arguments[0];return q.copy(this).selfAdd(t)}if(typeof arguments[0]=="number"){var n=arguments[0];return q.copy(this).selfAdd(n)}},q.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 q){var n=arguments[0];this._hi=n._hi,this._lo=n._lo}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this._hi=i,this._lo=a}},q.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},q.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},q.prototype.trunc=function(){return this.isNaN()?q.NaN:this.isPositive()?this.floor():this.ceil()},q.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},q.prototype.interfaces_=function(){return[e,Z,it]},q.prototype.getClass=function(){return q},q.sqr=function(t){return q.valueOf(t).selfMultiply(t)},q.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return q.parse(t)}if(typeof arguments[0]=="number"){var n=arguments[0];return new q(n)}},q.sqrt=function(t){return q.valueOf(t).sqrt()},q.parse=function(t){for(var n=0,i=t.length;Pt.isWhitespace(t.charAt(n));)n++;var a=!1;if(n<i){var f=t.charAt(n);f!=="-"&&f!=="+"||(n++,f==="-"&&(a=!0))}for(var g=new q,v=0,M=0,P=0;!(n>=i);){var V=t.charAt(n);if(n++,Pt.isDigit(V)){var tt=V-"0";g.selfMultiply(q.TEN),g.selfAdd(tt),v++}else{if(V!=="."){if(V==="e"||V==="E"){var nt=t.substring(n);try{P=_t.parseInt(nt)}catch(We){throw We instanceof Error?new Error("Invalid exponent "+nt+" in string "+t):We}break}throw new Error("Unexpected character \'"+V+"\' at position "+n+" in string "+t)}M=v}}var vt=g,xt=v-M-P;if(xt===0)vt=g;else if(xt>0){var Tt=q.TEN.pow(xt);vt=g.divide(Tt)}else if(xt<0){var Ut=q.TEN.pow(-xt);vt=g.multiply(Ut)}return a?vt.negate():vt},q.createNaN=function(){return new q(F.NaN,F.NaN)},q.copy=function(t){return new q(t)},q.magnitude=function(t){var n=Math.abs(t),i=Math.log(n)/Math.log(10),a=Math.trunc(Math.floor(i));return 10*Math.pow(10,a)<=n&&(a+=1),a},q.stringOfChar=function(t,n){for(var i=new ie,a=0;a<n;a++)i.append(t);return i.toString()},oe.PI.get=function(){return new q(3.141592653589793,12246467991473532e-32)},oe.TWO_PI.get=function(){return new q(6.283185307179586,24492935982947064e-32)},oe.PI_2.get=function(){return new q(1.5707963267948966,6123233995736766e-32)},oe.E.get=function(){return new q(2.718281828459045,14456468917292502e-32)},oe.NaN.get=function(){return new q(F.NaN,F.NaN)},oe.EPS.get=function(){return 123259516440783e-46},oe.SPLIT.get=function(){return 134217729},oe.MAX_PRINT_DIGITS.get=function(){return 32},oe.TEN.get=function(){return q.valueOf(10)},oe.ONE.get=function(){return q.valueOf(1)},oe.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},oe.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(q,oe);var Vt=function(){},tn={DP_SAFE_EPSILON:{configurable:!0}};Vt.prototype.interfaces_=function(){return[]},Vt.prototype.getClass=function(){return Vt},Vt.orientationIndex=function(t,n,i){var a=Vt.orientationIndexFilter(t,n,i);if(a<=1)return a;var f=q.valueOf(n.x).selfAdd(-t.x),g=q.valueOf(n.y).selfAdd(-t.y),v=q.valueOf(i.x).selfAdd(-n.x),M=q.valueOf(i.y).selfAdd(-n.y);return f.selfMultiply(M).selfSubtract(g.selfMultiply(v)).signum()},Vt.signOfDet2x2=function(t,n,i,a){return t.multiply(a).selfSubtract(n.multiply(i)).signum()},Vt.intersection=function(t,n,i,a){var f=q.valueOf(a.y).selfSubtract(i.y).selfMultiply(q.valueOf(n.x).selfSubtract(t.x)),g=q.valueOf(a.x).selfSubtract(i.x).selfMultiply(q.valueOf(n.y).selfSubtract(t.y)),v=f.subtract(g),M=q.valueOf(a.x).selfSubtract(i.x).selfMultiply(q.valueOf(t.y).selfSubtract(i.y)),P=q.valueOf(a.y).selfSubtract(i.y).selfMultiply(q.valueOf(t.x).selfSubtract(i.x)),V=M.subtract(P).selfDivide(v).doubleValue(),tt=q.valueOf(t.x).selfAdd(q.valueOf(n.x).selfSubtract(t.x).selfMultiply(V)).doubleValue(),nt=q.valueOf(n.x).selfSubtract(t.x).selfMultiply(q.valueOf(t.y).selfSubtract(i.y)),vt=q.valueOf(n.y).selfSubtract(t.y).selfMultiply(q.valueOf(t.x).selfSubtract(i.x)),xt=nt.subtract(vt).selfDivide(v).doubleValue(),Tt=q.valueOf(i.y).selfAdd(q.valueOf(a.y).selfSubtract(i.y).selfMultiply(xt)).doubleValue();return new U(tt,Tt)},Vt.orientationIndexFilter=function(t,n,i){var a=null,f=(t.x-i.x)*(n.y-i.y),g=(t.y-i.y)*(n.x-i.x),v=f-g;if(f>0){if(g<=0)return Vt.signum(v);a=f+g}else{if(!(f<0)||g>=0)return Vt.signum(v);a=-f-g}var M=Vt.DP_SAFE_EPSILON*a;return v>=M||-v>=M?Vt.signum(v):2},Vt.signum=function(t){return t>0?1:t<0?-1:0},tn.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Vt,tn);var Mt=function(){},mn={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};mn.X.get=function(){return 0},mn.Y.get=function(){return 1},mn.Z.get=function(){return 2},mn.M.get=function(){return 3},Mt.prototype.setOrdinate=function(t,n,i){},Mt.prototype.size=function(){},Mt.prototype.getOrdinate=function(t,n){},Mt.prototype.getCoordinate=function(){},Mt.prototype.getCoordinateCopy=function(t){},Mt.prototype.getDimension=function(){},Mt.prototype.getX=function(t){},Mt.prototype.clone=function(){},Mt.prototype.expandEnvelope=function(t){},Mt.prototype.copy=function(){},Mt.prototype.getY=function(t){},Mt.prototype.toCoordinateArray=function(){},Mt.prototype.interfaces_=function(){return[it]},Mt.prototype.getClass=function(){return Mt},Object.defineProperties(Mt,mn);var Hn=function(){},yn=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}(Hn),Ge=function(){};Ge.arraycopy=function(t,n,i,a,f){for(var g=0,v=n;v<n+f;v++)i[a+g]=t[v],g++},Ge.getProperty=function(t){return{"line.separator":`\n`}[t]};var an=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],a=arguments[1];this.x=i,this.y=a,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var f=arguments[0],g=arguments[1];this.x=f.y*g.w-g.y*f.w,this.y=g.x*f.w-f.x*g.w,this.w=f.x*g.y-g.x*f.y}else if(arguments[0]instanceof U&&arguments[1]instanceof U){var v=arguments[0],M=arguments[1];this.x=v.y-M.y,this.y=M.x-v.x,this.w=v.x*M.y-M.x*v.y}}else if(arguments.length===3){var P=arguments[0],V=arguments[1],tt=arguments[2];this.x=P,this.y=V,this.w=tt}else if(arguments.length===4){var nt=arguments[0],vt=arguments[1],xt=arguments[2],Tt=arguments[3],Ut=nt.y-vt.y,We=vt.x-nt.x,cn=nt.x*vt.y-vt.x*nt.y,Fr=xt.y-Tt.y,Ro=Tt.x-xt.x,is=xt.x*Tt.y-Tt.x*xt.y;this.x=We*is-Ro*cn,this.y=Fr*cn-Ut*is,this.w=Ut*Ro-Fr*We}};an.prototype.getY=function(){var t=this.y/this.w;if(F.isNaN(t)||F.isInfinite(t))throw new yn;return t},an.prototype.getX=function(){var t=this.x/this.w;if(F.isNaN(t)||F.isInfinite(t))throw new yn;return t},an.prototype.getCoordinate=function(){var t=new U;return t.x=this.getX(),t.y=this.getY(),t},an.prototype.interfaces_=function(){return[]},an.prototype.getClass=function(){return an},an.intersection=function(t,n,i,a){var f=t.y-n.y,g=n.x-t.x,v=t.x*n.y-n.x*t.y,M=i.y-a.y,P=a.x-i.x,V=i.x*a.y-a.x*i.y,tt=f*P-M*g,nt=(g*V-P*v)/tt,vt=(M*v-f*V)/tt;if(F.isNaN(nt)||F.isInfinite(nt)||F.isNaN(vt)||F.isInfinite(vt))throw new yn;return new U(nt,vt)};var Et=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 U){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 a=arguments[0],f=arguments[1];this.init(a.x,f.x,a.y,f.y)}else if(arguments.length===4){var g=arguments[0],v=arguments[1],M=arguments[2],P=arguments[3];this.init(g,v,M,P)}},Pr={serialVersionUID:{configurable:!0}};Et.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Et.prototype.equals=function(t){if(!(t instanceof Et))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()},Et.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new Et;var n=this._minx>t._minx?this._minx:t._minx,i=this._miny>t._miny?this._miny:t._miny,a=this._maxx<t._maxx?this._maxx:t._maxx,f=this._maxy<t._maxy?this._maxy:t._maxy;return new Et(n,a,i,f)},Et.prototype.isNull=function(){return this._maxx<this._minx},Et.prototype.getMaxX=function(){return this._maxx},Et.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof Et){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],a=arguments[1];return!this.isNull()&&i>=this._minx&&i<=this._maxx&&a>=this._miny&&a<=this._maxy}},Et.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Et){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 U){var n=arguments[0];return this.intersects(n.x,n.y)}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return!this.isNull()&&!(i>this._maxx||i<this._minx||a>this._maxy||a<this._miny)}},Et.prototype.getMinY=function(){return this._miny},Et.prototype.getMinX=function(){return this._minx},Et.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof Et){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],a=arguments[1];this.isNull()?(this._minx=i,this._maxx=i,this._miny=a,this._maxy=a):(i<this._minx&&(this._minx=i),i>this._maxx&&(this._maxx=i),a<this._miny&&(this._miny=a),a>this._maxy&&(this._maxy=a))}},Et.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),n=this.getHeight();return t<n?t:n},Et.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Et.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},Et.prototype.translate=function(t,n){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+n,this.getMaxY()+n)},Et.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Et.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Et.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Et.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),n=this.getHeight();return t>n?t:n},Et.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()}},Et.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Et){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof U){var n=arguments[0];return this.covers(n)}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return this.covers(i,a)}},Et.prototype.centre=function(){return this.isNull()?null:new U((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Et.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Et){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],a=arguments[1];this.init(i.x,a.x,i.y,a.y)}else if(arguments.length===4){var f=arguments[0],g=arguments[1],v=arguments[2],M=arguments[3];f<g?(this._minx=f,this._maxx=g):(this._minx=g,this._maxx=f),v<M?(this._miny=v,this._maxy=M):(this._miny=M,this._maxy=v)}},Et.prototype.getMaxY=function(){return this._maxy},Et.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)},Et.prototype.hashCode=function(){var t=17;return t=37*t+U.hashCode(this._minx),t=37*t+U.hashCode(this._maxx),t=37*t+U.hashCode(this._miny),t=37*t+U.hashCode(this._maxy)},Et.prototype.interfaces_=function(){return[Z,e]},Et.prototype.getClass=function(){return Et},Et.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 a=arguments[0],f=arguments[1],g=arguments[2],v=arguments[3],M=Math.min(g.x,v.x),P=Math.max(g.x,v.x),V=Math.min(a.x,f.x),tt=Math.max(a.x,f.x);return!(V>P)&&!(tt<M)&&(M=Math.min(g.y,v.y),P=Math.max(g.y,v.y),V=Math.min(a.y,f.y),tt=Math.max(a.y,f.y),!(V>P)&&!(tt<M))}},Pr.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Et,Pr);var Jt={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*$/},jn=function(t){this.geometryFactory=t||new Qt};jn.prototype.read=function(t){var n,i,a;t=t.replace(/[\\n\\r]/g," ");var f=Jt.typeStr.exec(t);if(t.search("EMPTY")!==-1&&((f=Jt.emptyTypeStr.exec(t))[2]=void 0),f&&(i=f[1].toLowerCase(),a=f[2],vn[i]&&(n=vn[i].apply(this,[a]))),n===void 0)throw new Error("Could not parse WKT "+t);return n},jn.prototype.write=function(t){return this.extractGeometry(t)},jn.prototype.extractGeometry=function(t){var n=t.getGeometryType().toLowerCase();if(!hn[n])return null;var i=n.toUpperCase();return t.isEmpty()?i+" EMPTY":i+"("+hn[n].apply(this,[t])+")"};var hn={coordinate:function(t){return t.x+" "+t.y},point:function(t){return hn.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var n=[],i=0,a=t._geometries.length;i<a;++i)n.push("("+hn.point.apply(this,[t._geometries[i]])+")");return n.join(",")},linestring:function(t){for(var n=[],i=0,a=t._points._coordinates.length;i<a;++i)n.push(hn.coordinate.apply(this,[t._points._coordinates[i]]));return n.join(",")},linearring:function(t){for(var n=[],i=0,a=t._points._coordinates.length;i<a;++i)n.push(hn.coordinate.apply(this,[t._points._coordinates[i]]));return n.join(",")},multilinestring:function(t){for(var n=[],i=0,a=t._geometries.length;i<a;++i)n.push("("+hn.linestring.apply(this,[t._geometries[i]])+")");return n.join(",")},polygon:function(t){var n=[];n.push("("+hn.linestring.apply(this,[t._shell])+")");for(var i=0,a=t._holes.length;i<a;++i)n.push("("+hn.linestring.apply(this,[t._holes[i]])+")");return n.join(",")},multipolygon:function(t){for(var n=[],i=0,a=t._geometries.length;i<a;++i)n.push("("+hn.polygon.apply(this,[t._geometries[i]])+")");return n.join(",")},geometrycollection:function(t){for(var n=[],i=0,a=t._geometries.length;i<a;++i)n.push(this.extractGeometry(t._geometries[i]));return n.join(",")}},vn={point:function(t){if(t===void 0)return this.geometryFactory.createPoint();var n=t.trim().split(Jt.spaces);return this.geometryFactory.createPoint(new U(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(","),a=[],f=0,g=i.length;f<g;++f)n=i[f].replace(Jt.trimParens,"$1"),a.push(vn.point.apply(this,[n]));return this.geometryFactory.createMultiPoint(a)},linestring:function(t){if(t===void 0)return this.geometryFactory.createLineString();for(var n,i=t.trim().split(","),a=[],f=0,g=i.length;f<g;++f)n=i[f].trim().split(Jt.spaces),a.push(new U(Number.parseFloat(n[0]),Number.parseFloat(n[1])));return this.geometryFactory.createLineString(a)},linearring:function(t){if(t===void 0)return this.geometryFactory.createLinearRing();for(var n,i=t.trim().split(","),a=[],f=0,g=i.length;f<g;++f)n=i[f].trim().split(Jt.spaces),a.push(new U(Number.parseFloat(n[0]),Number.parseFloat(n[1])));return this.geometryFactory.createLinearRing(a)},multilinestring:function(t){if(t===void 0)return this.geometryFactory.createMultiLineString();for(var n,i=t.trim().split(Jt.parenComma),a=[],f=0,g=i.length;f<g;++f)n=i[f].replace(Jt.trimParens,"$1"),a.push(vn.linestring.apply(this,[n]));return this.geometryFactory.createMultiLineString(a)},polygon:function(t){if(t===void 0)return this.geometryFactory.createPolygon();for(var n,i,a,f,g=t.trim().split(Jt.parenComma),v=[],M=0,P=g.length;M<P;++M)n=g[M].replace(Jt.trimParens,"$1"),i=vn.linestring.apply(this,[n]),a=this.geometryFactory.createLinearRing(i._points),M===0?f=a:v.push(a);return this.geometryFactory.createPolygon(f,v)},multipolygon:function(t){if(t===void 0)return this.geometryFactory.createMultiPolygon();for(var n,i=t.trim().split(Jt.doubleParenComma),a=[],f=0,g=i.length;f<g;++f)n=i[f].replace(Jt.trimParens,"$1"),a.push(vn.polygon.apply(this,[n]));return this.geometryFactory.createMultiPolygon(a)},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=[],a=0,f=n.length;a<f;++a)i.push(this.read(n[a]));return this.geometryFactory.createGeometryCollection(i)}},On=function(t){this.parser=new jn(t)};On.prototype.write=function(t){return this.parser.write(t)},On.toLineString=function(t,n){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+n.x+" "+n.y+" )"};var xr=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),ui=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}(xr),Nt=function(){};Nt.prototype.interfaces_=function(){return[]},Nt.prototype.getClass=function(){return Nt},Nt.shouldNeverReachHere=function(){if(arguments.length===0)Nt.shouldNeverReachHere(null);else if(arguments.length===1){var t=arguments[0];throw new ui("Should never reach here"+(t!==null?": "+t:""))}},Nt.isTrue=function(){var t,n;if(arguments.length===1)t=arguments[0],Nt.isTrue(t,null);else if(arguments.length===2&&(t=arguments[0],n=arguments[1],!t))throw n===null?new ui:new ui(n)},Nt.equals=function(){var t,n,i;if(arguments.length===2)t=arguments[0],n=arguments[1],Nt.equals(t,n,null);else if(arguments.length===3&&(t=arguments[0],n=arguments[1],i=arguments[2],!n.equals(t)))throw new ui("Expected "+t+" but encountered "+n+(i!==null?": "+i:""))};var He=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 U,this._intPt[1]=new U,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},wi={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};He.prototype.getIndexAlongSegment=function(t,n){return this.computeIntLineIndex(),this._intLineIndex[t][n]},He.prototype.getTopologySummary=function(){var t=new ie;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},He.prototype.computeIntersection=function(t,n,i,a){this._inputLines[0][0]=t,this._inputLines[0][1]=n,this._inputLines[1][0]=i,this._inputLines[1][1]=a,this._result=this.computeIntersect(t,n,i,a)},He.prototype.getIntersectionNum=function(){return this._result},He.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)}},He.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},He.prototype.setPrecisionModel=function(t){this._precisionModel=t},He.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}},He.prototype.getIntersection=function(t){return this._intPt[t]},He.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},He.prototype.hasIntersection=function(){return this._result!==He.NO_INTERSECTION},He.prototype.getEdgeDistance=function(t,n){return He.computeEdgeDistance(this._intPt[n],this._inputLines[t][0],this._inputLines[t][1])},He.prototype.isCollinear=function(){return this._result===He.COLLINEAR_INTERSECTION},He.prototype.toString=function(){return On.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+On.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},He.prototype.getEndpoint=function(t,n){return this._inputLines[t][n]},He.prototype.isIntersection=function(t){for(var n=0;n<this._result;n++)if(this._intPt[n].equals2D(t))return!0;return!1},He.prototype.getIntersectionAlongSegment=function(t,n){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][n]]},He.prototype.interfaces_=function(){return[]},He.prototype.getClass=function(){return He},He.computeEdgeDistance=function(t,n,i){var a=Math.abs(i.x-n.x),f=Math.abs(i.y-n.y),g=-1;if(t.equals(n))g=0;else if(t.equals(i))g=a>f?a:f;else{var v=Math.abs(t.x-n.x),M=Math.abs(t.y-n.y);(g=a>f?v:M)!==0||t.equals(n)||(g=Math.max(v,M))}return Nt.isTrue(!(g===0&&!t.equals(n)),"Bad distance calculation"),g},He.nonRobustComputeEdgeDistance=function(t,n,i){var a=t.x-n.x,f=t.y-n.y,g=Math.sqrt(a*a+f*f);return Nt.isTrue(!(g===0&&!t.equals(n)),"Invalid distance calculation"),g},wi.DONT_INTERSECT.get=function(){return 0},wi.DO_INTERSECT.get=function(){return 1},wi.COLLINEAR.get=function(){return 2},wi.NO_INTERSECTION.get=function(){return 0},wi.POINT_INTERSECTION.get=function(){return 1},wi.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(He,wi);var Mi=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 a=new Et(this._inputLines[0][0],this._inputLines[0][1]),f=new Et(this._inputLines[1][0],this._inputLines[1][1]);return a.contains(i)&&f.contains(i)},n.prototype.computeIntersection=function(){if(arguments.length!==3)return t.prototype.computeIntersection.apply(this,arguments);var i=arguments[0],a=arguments[1],f=arguments[2];if(this._isProper=!1,Et.intersects(a,f,i)&&mt.orientationIndex(a,f,i)===0&&mt.orientationIndex(f,a,i)===0)return this._isProper=!0,(i.equals(a)||i.equals(f))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},n.prototype.normalizeToMinimum=function(i,a,f,g,v){v.x=this.smallestInAbsValue(i.x,a.x,f.x,g.x),v.y=this.smallestInAbsValue(i.y,a.y,f.y,g.y),i.x-=v.x,i.y-=v.y,a.x-=v.x,a.y-=v.y,f.x-=v.x,f.y-=v.y,g.x-=v.x,g.y-=v.y},n.prototype.safeHCoordinateIntersection=function(i,a,f,g){var v=null;try{v=an.intersection(i,a,f,g)}catch(M){if(!(M instanceof yn))throw M;v=n.nearestEndpoint(i,a,f,g)}return v},n.prototype.intersection=function(i,a,f,g){var v=this.intersectionWithNormalization(i,a,f,g);return this.isInSegmentEnvelopes(v)||(v=new U(n.nearestEndpoint(i,a,f,g))),this._precisionModel!==null&&this._precisionModel.makePrecise(v),v},n.prototype.smallestInAbsValue=function(i,a,f,g){var v=i,M=Math.abs(v);return Math.abs(a)<M&&(v=a,M=Math.abs(a)),Math.abs(f)<M&&(v=f,M=Math.abs(f)),Math.abs(g)<M&&(v=g),v},n.prototype.checkDD=function(i,a,f,g,v){var M=Vt.intersection(i,a,f,g),P=this.isInSegmentEnvelopes(M);Ge.out.println("DD in env = "+P+" --------------------- "+M),v.distance(M)>1e-4&&Ge.out.println("Distance = "+v.distance(M))},n.prototype.intersectionWithNormalization=function(i,a,f,g){var v=new U(i),M=new U(a),P=new U(f),V=new U(g),tt=new U;this.normalizeToEnvCentre(v,M,P,V,tt);var nt=this.safeHCoordinateIntersection(v,M,P,V);return nt.x+=tt.x,nt.y+=tt.y,nt},n.prototype.computeCollinearIntersection=function(i,a,f,g){var v=Et.intersects(i,a,f),M=Et.intersects(i,a,g),P=Et.intersects(f,g,i),V=Et.intersects(f,g,a);return v&&M?(this._intPt[0]=f,this._intPt[1]=g,t.COLLINEAR_INTERSECTION):P&&V?(this._intPt[0]=i,this._intPt[1]=a,t.COLLINEAR_INTERSECTION):v&&P?(this._intPt[0]=f,this._intPt[1]=i,!f.equals(i)||M||V?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):v&&V?(this._intPt[0]=f,this._intPt[1]=a,!f.equals(a)||M||P?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):M&&P?(this._intPt[0]=g,this._intPt[1]=i,!g.equals(i)||v||V?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):M&&V?(this._intPt[0]=g,this._intPt[1]=a,!g.equals(a)||v||P?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},n.prototype.normalizeToEnvCentre=function(i,a,f,g,v){var M=i.x<a.x?i.x:a.x,P=i.y<a.y?i.y:a.y,V=i.x>a.x?i.x:a.x,tt=i.y>a.y?i.y:a.y,nt=f.x<g.x?f.x:g.x,vt=f.y<g.y?f.y:g.y,xt=f.x>g.x?f.x:g.x,Tt=f.y>g.y?f.y:g.y,Ut=((M>nt?M:nt)+(V<xt?V:xt))/2,We=((P>vt?P:vt)+(tt<Tt?tt:Tt))/2;v.x=Ut,v.y=We,i.x-=v.x,i.y-=v.y,a.x-=v.x,a.y-=v.y,f.x-=v.x,f.y-=v.y,g.x-=v.x,g.y-=v.y},n.prototype.computeIntersect=function(i,a,f,g){if(this._isProper=!1,!Et.intersects(i,a,f,g))return t.NO_INTERSECTION;var v=mt.orientationIndex(i,a,f),M=mt.orientationIndex(i,a,g);if(v>0&&M>0||v<0&&M<0)return t.NO_INTERSECTION;var P=mt.orientationIndex(f,g,i),V=mt.orientationIndex(f,g,a);return P>0&&V>0||P<0&&V<0?t.NO_INTERSECTION:v===0&&M===0&&P===0&&V===0?this.computeCollinearIntersection(i,a,f,g):(v===0||M===0||P===0||V===0?(this._isProper=!1,i.equals2D(f)||i.equals2D(g)?this._intPt[0]=i:a.equals2D(f)||a.equals2D(g)?this._intPt[0]=a:v===0?this._intPt[0]=new U(f):M===0?this._intPt[0]=new U(g):P===0?this._intPt[0]=new U(i):V===0&&(this._intPt[0]=new U(a))):(this._isProper=!0,this._intPt[0]=this.intersection(i,a,f,g)),t.POINT_INTERSECTION)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n.nearestEndpoint=function(i,a,f,g){var v=i,M=mt.distancePointLine(i,f,g),P=mt.distancePointLine(a,f,g);return P<M&&(M=P,v=a),(P=mt.distancePointLine(f,i,a))<M&&(M=P,v=f),(P=mt.distancePointLine(g,i,a))<M&&(M=P,v=g),v},n}(He),qr=function(){};qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr},qr.orientationIndex=function(t,n,i){var a=n.x-t.x,f=n.y-t.y,g=i.x-n.x,v=i.y-n.y;return qr.signOfDet2x2(a,f,g,v)},qr.signOfDet2x2=function(t,n,i,a){var f=null,g=null,v=null;if(f=1,t===0||a===0)return n===0||i===0?0:n>0?i>0?-f:f:i>0?f:-f;if(n===0||i===0)return a>0?t>0?f:-f:t>0?-f:f;if(n>0?a>0?n<=a||(f=-f,g=t,t=i,i=g,g=n,n=a,a=g):n<=-a?(f=-f,i=-i,a=-a):(g=t,t=-i,i=g,g=n,n=-a,a=g):a>0?-n<=a?(f=-f,t=-t,n=-n):(g=-t,t=i,i=g,g=-n,n=a,a=g):n>=a?(t=-t,n=-n,i=-i,a=-a):(f=-f,g=-t,t=-i,i=g,g=-n,n=-a,a=g),t>0){if(!(i>0)||!(t<=i))return f}else{if(i>0||!(t>=i))return-f;f=-f,t=-t,i=-i}for(;;){if(v=Math.floor(i/t),i-=v*t,(a-=v*n)<0)return-f;if(a>n)return f;if(t>i+i){if(n<a+a)return f}else{if(n>a+a)return-f;i=t-i,a=n-a,f=-f}if(a===0)return i===0?0:-f;if(i===0||(v=Math.floor(t/i),t-=v*i,(n-=v*a)<0))return f;if(n>a)return-f;if(i>t+t){if(a<n+n)return-f}else{if(a>n+n)return f;t=i-t,n=a-n,f=-f}if(n===0)return t===0?0:f;if(t===0)return-f}};var Rr=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};Rr.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,a=n.x;return i>a&&(i=n.x,a=t.x),this._p.x>=i&&this._p.x<=a&&(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 f=t.x-this._p.x,g=t.y-this._p.y,v=n.x-this._p.x,M=n.y-this._p.y,P=qr.signOfDet2x2(f,g,v,M);if(P===0)return this._isPointOnSegment=!0,null;M<g&&(P=-P),P>0&&this._crossingCount++}},Rr.prototype.isPointInPolygon=function(){return this.getLocation()!==W.EXTERIOR},Rr.prototype.getLocation=function(){return this._isPointOnSegment?W.BOUNDARY:this._crossingCount%2==1?W.INTERIOR:W.EXTERIOR},Rr.prototype.isOnSegment=function(){return this._isPointOnSegment},Rr.prototype.interfaces_=function(){return[]},Rr.prototype.getClass=function(){return Rr},Rr.locatePointInRing=function(){if(arguments[0]instanceof U&&yt(arguments[1],Mt)){for(var t=arguments[0],n=arguments[1],i=new Rr(t),a=new U,f=new U,g=1;g<n.size();g++)if(n.getCoordinate(g,a),n.getCoordinate(g-1,f),i.countSegment(a,f),i.isOnSegment())return i.getLocation();return i.getLocation()}if(arguments[0]instanceof U&&arguments[1]instanceof Array){for(var v=arguments[0],M=arguments[1],P=new Rr(v),V=1;V<M.length;V++){var tt=M[V],nt=M[V-1];if(P.countSegment(tt,nt),P.isOnSegment())return P.getLocation()}return P.getLocation()}};var mt=function(){},Ni={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};mt.prototype.interfaces_=function(){return[]},mt.prototype.getClass=function(){return mt},mt.orientationIndex=function(t,n,i){return Vt.orientationIndex(t,n,i)},mt.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,a=1;a<t.length-1;a++){var f=t[a].x-i,g=t[a+1].y;n+=f*(t[a-1].y-g)}return n/2}if(yt(arguments[0],Mt)){var v=arguments[0],M=v.size();if(M<3)return 0;var P=new U,V=new U,tt=new U;v.getCoordinate(0,V),v.getCoordinate(1,tt);var nt=V.x;tt.x-=nt;for(var vt=0,xt=1;xt<M-1;xt++)P.y=V.y,V.x=tt.x,V.y=tt.y,v.getCoordinate(xt+1,tt),tt.x-=nt,vt+=V.x*(P.y-tt.y);return vt/2}},mt.distanceLineLine=function(t,n,i,a){if(t.equals(n))return mt.distancePointLine(t,i,a);if(i.equals(a))return mt.distancePointLine(a,t,n);var f=!1;if(Et.intersects(t,n,i,a)){var g=(n.x-t.x)*(a.y-i.y)-(n.y-t.y)*(a.x-i.x);if(g===0)f=!0;else{var v=(t.y-i.y)*(a.x-i.x)-(t.x-i.x)*(a.y-i.y),M=((t.y-i.y)*(n.x-t.x)-(t.x-i.x)*(n.y-t.y))/g,P=v/g;(P<0||P>1||M<0||M>1)&&(f=!0)}}else f=!0;return f?zt.min(mt.distancePointLine(t,i,a),mt.distancePointLine(n,i,a),mt.distancePointLine(i,t,n),mt.distancePointLine(a,t,n)):0},mt.isPointInRing=function(t,n){return mt.locatePointInRing(t,n)!==W.EXTERIOR},mt.computeLength=function(t){var n=t.size();if(n<=1)return 0;var i=0,a=new U;t.getCoordinate(0,a);for(var f=a.x,g=a.y,v=1;v<n;v++){t.getCoordinate(v,a);var M=a.x,P=a.y,V=M-f,tt=P-g;i+=Math.sqrt(V*V+tt*tt),f=M,g=P}return i},mt.isCCW=function(t){var n=t.length-1;if(n<3)throw new k("Ring has fewer than 4 points, so orientation cannot be determined");for(var i=t[0],a=0,f=1;f<=n;f++){var g=t[f];g.y>i.y&&(i=g,a=f)}var v=a;do(v-=1)<0&&(v=n);while(t[v].equals2D(i)&&v!==a);var M=a;do M=(M+1)%n;while(t[M].equals2D(i)&&M!==a);var P=t[v],V=t[M];if(P.equals2D(i)||V.equals2D(i)||P.equals2D(V))return!1;var tt=mt.computeOrientation(P,i,V),nt=!1;return nt=tt===0?P.x>V.x:tt>0,nt},mt.locatePointInRing=function(t,n){return Rr.locatePointInRing(t,n)},mt.distancePointLinePerpendicular=function(t,n,i){var a=(i.x-n.x)*(i.x-n.x)+(i.y-n.y)*(i.y-n.y),f=((n.y-t.y)*(i.x-n.x)-(n.x-t.x)*(i.y-n.y))/a;return Math.abs(f)*Math.sqrt(a)},mt.computeOrientation=function(t,n,i){return mt.orientationIndex(t,n,i)},mt.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];if(n.length===0)throw new k("Line array must contain at least one vertex");for(var i=t.distance(n[0]),a=0;a<n.length-1;a++){var f=mt.distancePointLine(t,n[a],n[a+1]);f<i&&(i=f)}return i}if(arguments.length===3){var g=arguments[0],v=arguments[1],M=arguments[2];if(v.x===M.x&&v.y===M.y)return g.distance(v);var P=(M.x-v.x)*(M.x-v.x)+(M.y-v.y)*(M.y-v.y),V=((g.x-v.x)*(M.x-v.x)+(g.y-v.y)*(M.y-v.y))/P;if(V<=0)return g.distance(v);if(V>=1)return g.distance(M);var tt=((v.y-g.y)*(M.x-v.x)-(v.x-g.x)*(M.y-v.y))/P;return Math.abs(tt)*Math.sqrt(P)}},mt.isOnLine=function(t,n){for(var i=new Mi,a=1;a<n.length;a++){var f=n[a-1],g=n[a];if(i.computeIntersection(t,f,g),i.hasIntersection())return!0}return!1},Ni.CLOCKWISE.get=function(){return-1},Ni.RIGHT.get=function(){return mt.CLOCKWISE},Ni.COUNTERCLOCKWISE.get=function(){return 1},Ni.LEFT.get=function(){return mt.COUNTERCLOCKWISE},Ni.COLLINEAR.get=function(){return 0},Ni.STRAIGHT.get=function(){return mt.COLLINEAR},Object.defineProperties(mt,Ni);var Di=function(){};Di.prototype.filter=function(t){},Di.prototype.interfaces_=function(){return[]},Di.prototype.getClass=function(){return Di};var Ft=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},Si={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}};Ft.prototype.isGeometryCollection=function(){return this.getSortIndex()===Ft.SORTINDEX_GEOMETRYCOLLECTION},Ft.prototype.getFactory=function(){return this._factory},Ft.prototype.getGeometryN=function(t){return this},Ft.prototype.getArea=function(){return 0},Ft.prototype.isRectangle=function(){return!1},Ft.prototype.equals=function(){if(arguments[0]instanceof Ft){var t=arguments[0];return t!==null&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var n=arguments[0];if(!(n instanceof Ft))return!1;var i=n;return this.equalsExact(i)}},Ft.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},Ft.prototype.geometryChanged=function(){this.apply(Ft.geometryChangedFilter)},Ft.prototype.geometryChangedAction=function(){this._envelope=null},Ft.prototype.equalsNorm=function(t){return t!==null&&this.norm().equalsExact(t.norm())},Ft.prototype.getLength=function(){return 0},Ft.prototype.getNumGeometries=function(){return 1},Ft.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],a=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,a)}},Ft.prototype.getUserData=function(){return this._userData},Ft.prototype.getSRID=function(){return this._SRID},Ft.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Ft.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===Ft.SORTINDEX_GEOMETRYCOLLECTION)throw new k("This method does not support GeometryCollection arguments")},Ft.prototype.equal=function(t,n,i){return i===0?t.equals(n):t.distance(n)<=i},Ft.prototype.norm=function(){var t=this.copy();return t.normalize(),t},Ft.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Ft.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Et(this._envelope)},Ft.prototype.setSRID=function(t){this._SRID=t},Ft.prototype.setUserData=function(t){this._userData=t},Ft.prototype.compare=function(t,n){for(var i=t.iterator(),a=n.iterator();i.hasNext()&&a.hasNext();){var f=i.next(),g=a.next(),v=f.compareTo(g);if(v!==0)return v}return i.hasNext()?1:a.hasNext()?-1:0},Ft.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Ft.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Ft.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Ft.SORTINDEX_MULTIPOINT||this.getSortIndex()===Ft.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Ft.SORTINDEX_MULTIPOLYGON},Ft.prototype.interfaces_=function(){return[it,Z,e]},Ft.prototype.getClass=function(){return Ft},Ft.hasNonEmptyElements=function(t){for(var n=0;n<t.length;n++)if(!t[n].isEmpty())return!0;return!1},Ft.hasNullElements=function(t){for(var n=0;n<t.length;n++)if(t[n]===null)return!0;return!1},Si.serialVersionUID.get=function(){return 8763622679187377e3},Si.SORTINDEX_POINT.get=function(){return 0},Si.SORTINDEX_MULTIPOINT.get=function(){return 1},Si.SORTINDEX_LINESTRING.get=function(){return 2},Si.SORTINDEX_LINEARRING.get=function(){return 3},Si.SORTINDEX_MULTILINESTRING.get=function(){return 4},Si.SORTINDEX_POLYGON.get=function(){return 5},Si.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Si.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Si.geometryChangedFilter.get=function(){return Os},Object.defineProperties(Ft,Si);var Os=function(){};Os.interfaces_=function(){return[Di]},Os.filter=function(t){t.geometryChangedAction()};var Y=function(){};Y.prototype.filter=function(t){},Y.prototype.interfaces_=function(){return[]},Y.prototype.getClass=function(){return Y};var w=function(){},T={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};w.prototype.isInBoundary=function(t){},w.prototype.interfaces_=function(){return[]},w.prototype.getClass=function(){return w},T.Mod2BoundaryNodeRule.get=function(){return N},T.EndPointBoundaryNodeRule.get=function(){return z},T.MultiValentEndPointBoundaryNodeRule.get=function(){return B},T.MonoValentEndPointBoundaryNodeRule.get=function(){return st},T.MOD2_BOUNDARY_RULE.get=function(){return new N},T.ENDPOINT_BOUNDARY_RULE.get=function(){return new z},T.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new B},T.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new st},T.OGC_SFS_BOUNDARY_RULE.get=function(){return w.MOD2_BOUNDARY_RULE},Object.defineProperties(w,T);var N=function(){};N.prototype.isInBoundary=function(t){return t%2==1},N.prototype.interfaces_=function(){return[w]},N.prototype.getClass=function(){return N};var z=function(){};z.prototype.isInBoundary=function(t){return t>0},z.prototype.interfaces_=function(){return[w]},z.prototype.getClass=function(){return z};var B=function(){};B.prototype.isInBoundary=function(t){return t>1},B.prototype.interfaces_=function(){return[w]},B.prototype.getClass=function(){return B};var st=function(){};st.prototype.isInBoundary=function(t){return t===1},st.prototype.interfaces_=function(){return[w]},st.prototype.getClass=function(){return st};var K=function(){};K.prototype.add=function(){},K.prototype.addAll=function(){},K.prototype.isEmpty=function(){},K.prototype.iterator=function(){},K.prototype.size=function(){},K.prototype.toArray=function(){},K.prototype.remove=function(){},(r.prototype=new Error).name="IndexOutOfBoundsException";var ct=function(){};ct.prototype.hasNext=function(){},ct.prototype.next=function(){},ct.prototype.remove=function(){};var at=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}(K);(u.prototype=new Error).name="NoSuchElementException";var j=function(t){function n(){t.call(this),this.array_=[],arguments[0]instanceof K&&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,K]},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 a=i.iterator();a.hasNext();)this.add(a.next());return!0},n.prototype.set=function(i,a){var f=this.array_[i];return this.array_[i]=a,f},n.prototype.iterator=function(){return new rt(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=[],a=0,f=this.array_.length;a<f;a++)i.push(this.array_[a]);return i},n.prototype.remove=function(i){for(var a=!1,f=0,g=this.array_.length;f<g;f++)if(this.array_[f]===i){this.array_.splice(f,1),a=!0;break}return a},n}(at),rt=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 u;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}(ct),ft=function(t){function n(){if(t.call(this),arguments.length!==0){if(arguments.length===1){var a=arguments[0];this.ensureCapacity(a.length),this.add(a,!0)}else if(arguments.length===2){var f=arguments[0],g=arguments[1];this.ensureCapacity(f.length),this.add(f,g)}}}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(a){return this.get(a)},n.prototype.addAll=function(){if(arguments.length===2){for(var a=arguments[0],f=arguments[1],g=!1,v=a.iterator();v.hasNext();)this.add(v.next(),f),g=!0;return g}return t.prototype.addAll.apply(this,arguments)},n.prototype.clone=function(){for(var a=t.prototype.clone.call(this),f=0;f<this.size();f++)a.add(f,this.get(f).copy());return a},n.prototype.toCoordinateArray=function(){return this.toArray(n.coordArrayType)},n.prototype.add=function(){if(arguments.length===1){var a=arguments[0];t.prototype.add.call(this,a)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var f=arguments[0],g=arguments[1];return this.add(f,g,!0),!0}if(arguments[0]instanceof U&&typeof arguments[1]=="boolean"){var v=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(v))return null;t.prototype.add.call(this,v)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var M=arguments[0],P=arguments[1];return this.add(M,P),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var V=arguments[0],tt=arguments[1];if(arguments[2])for(var nt=0;nt<V.length;nt++)this.add(V[nt],tt);else for(var vt=V.length-1;vt>=0;vt--)this.add(V[vt],tt);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof U){var xt=arguments[0],Tt=arguments[1];if(!arguments[2]){var Ut=this.size();if(Ut>0&&(xt>0&&this.get(xt-1).equals2D(Tt)||xt<Ut&&this.get(xt).equals2D(Tt)))return null}t.prototype.add.call(this,xt,Tt)}}else if(arguments.length===4){var We=arguments[0],cn=arguments[1],Fr=arguments[2],Ro=arguments[3],is=1;Fr>Ro&&(is=-1);for(var ll=Fr;ll!==Ro;ll+=is)this.add(We[ll],cn);return!0}},n.prototype.closeRing=function(){this.size()>0&&this.add(new U(this.get(0)),!1)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},Object.defineProperties(n,i),n}(j),lt=function(){},Gt={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Gt.ForwardComparator.get=function(){return kt},Gt.BidirectionalComparator.get=function(){return re},Gt.coordArrayType.get=function(){return new Array(0).fill(null)},lt.prototype.interfaces_=function(){return[]},lt.prototype.getClass=function(){return lt},lt.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},lt.ptNotInList=function(t,n){for(var i=0;i<t.length;i++){var a=t[i];if(lt.indexOf(a,n)<0)return a}return null},lt.scroll=function(t,n){var i=lt.indexOf(n,t);if(i<0)return null;var a=new Array(t.length).fill(null);Ge.arraycopy(t,i,a,0,t.length-i),Ge.arraycopy(t,0,a,t.length-i,i),Ge.arraycopy(a,0,t,0,t.length)},lt.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 a=arguments[0],f=arguments[1],g=arguments[2];if(a===f)return!0;if(a===null||f===null||a.length!==f.length)return!1;for(var v=0;v<a.length;v++)if(g.compare(a[v],f[v])!==0)return!1;return!0}},lt.intersection=function(t,n){for(var i=new ft,a=0;a<t.length;a++)n.intersects(t[a])&&i.add(t[a],!0);return i.toCoordinateArray()},lt.hasRepeatedPoints=function(t){for(var n=1;n<t.length;n++)if(t[n-1].equals(t[n]))return!0;return!1},lt.removeRepeatedPoints=function(t){return lt.hasRepeatedPoints(t)?new ft(t,!1).toCoordinateArray():t},lt.reverse=function(t){for(var n=t.length-1,i=Math.trunc(n/2),a=0;a<=i;a++){var f=t[a];t[a]=t[n-a],t[n-a]=f}},lt.removeNull=function(t){for(var n=0,i=0;i<t.length;i++)t[i]!==null&&n++;var a=new Array(n).fill(null);if(n===0)return a;for(var f=0,g=0;g<t.length;g++)t[g]!==null&&(a[f++]=t[g]);return a},lt.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 U(t[i]);return n}if(arguments.length===5)for(var a=arguments[0],f=arguments[1],g=arguments[2],v=arguments[3],M=arguments[4],P=0;P<M;P++)g[v+P]=new U(a[f+P])},lt.isEqualReversed=function(t,n){for(var i=0;i<t.length;i++){var a=t[i],f=n[t.length-i-1];if(a.compareTo(f)!==0)return!1}return!0},lt.envelope=function(t){for(var n=new Et,i=0;i<t.length;i++)n.expandToInclude(t[i]);return n},lt.toCoordinateArray=function(t){return t.toArray(lt.coordArrayType)},lt.atLeastNCoordinatesOrNothing=function(t,n){return n.length>=t?n:[]},lt.indexOf=function(t,n){for(var i=0;i<n.length;i++)if(t.equals(n[i]))return i;return-1},lt.increasingDirection=function(t){for(var n=0;n<Math.trunc(t.length/2);n++){var i=t.length-1-n,a=t[n].compareTo(t[i]);if(a!==0)return a}return 1},lt.compare=function(t,n){for(var i=0;i<t.length&&i<n.length;){var a=t[i].compareTo(n[i]);if(a!==0)return a;i++}return i<n.length?-1:i<t.length?1:0},lt.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},lt.extract=function(t,n,i){n=zt.clamp(n,0,t.length);var a=(i=zt.clamp(i,-1,t.length))-n+1;i<0&&(a=0),n>=t.length&&(a=0),i<n&&(a=0);var f=new Array(a).fill(null);if(a===0)return f;for(var g=0,v=n;v<=i;v++)f[g++]=t[v];return f},Object.defineProperties(lt,Gt);var kt=function(){};kt.prototype.compare=function(t,n){return lt.compare(t,n)},kt.prototype.interfaces_=function(){return[et]},kt.prototype.getClass=function(){return kt};var re=function(){};re.prototype.compare=function(t,n){var i=t,a=n;if(i.length<a.length)return-1;if(i.length>a.length)return 1;if(i.length===0)return 0;var f=lt.compare(i,a);return lt.isEqualReversed(i,a)?0:f},re.prototype.OLDcompare=function(t,n){var i=t,a=n;if(i.length<a.length)return-1;if(i.length>a.length)return 1;if(i.length===0)return 0;for(var f=lt.increasingDirection(i),g=lt.increasingDirection(a),v=f>0?0:i.length-1,M=g>0?0:i.length-1,P=0;P<i.length;P++){var V=i[v].compareTo(a[M]);if(V!==0)return V;v+=f,M+=g}return 0},re.prototype.interfaces_=function(){return[et]},re.prototype.getClass=function(){return re};var Yt=function(){};Yt.prototype.get=function(){},Yt.prototype.put=function(){},Yt.prototype.size=function(){},Yt.prototype.values=function(){},Yt.prototype.entrySet=function(){};var wn=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}(Yt);(l.prototype=new Error).name="OperationNotSupported",(h.prototype=new K).contains=function(){};var pr=function(t){function n(){t.call(this),this.array_=[],arguments[0]instanceof K&&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 a=0,f=this.array_.length;a<f;a++)if(this.array_[a]===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 a=i.iterator();a.hasNext();)this.add(a.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=[],a=0,f=this.array_.length;a<f;a++)i.push(this.array_[a]);return i},n.prototype.iterator=function(){return new Vn(this)},n}(h),Vn=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 u;return this.hashSet_.array_[this.position_++]},n.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},n.prototype.remove=function(){throw new l},n}(ct),Tn=0;(b.prototype=new wn).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},b.prototype.put=function(t,n){if(this.root_===null)return this.root_={key:t,value:n,left:null,right:null,parent:null,color:Tn,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var i,a,f=this.root_;do if(i=f,(a=t.compareTo(f.key))<0)f=f.left;else{if(!(a>0)){var g=f.value;return f.value=n,g}f=f.right}while(f!==null);var v={key:t,left:null,right:null,value:n,parent:i,color:Tn,getValue:function(){return this.value},getKey:function(){return this.key}};return a<0?i.left=v:i.right=v,this.fixAfterInsertion(v),this.size_++,null},b.prototype.fixAfterInsertion=function(t){for(t.color=1;t!=null&&t!==this.root_&&t.parent.color===1;)if(m(t)===x(m(m(t)))){var n=E(m(m(t)));p(n)===1?(y(m(t),Tn),y(n,Tn),y(m(m(t)),1),t=m(m(t))):(t===E(m(t))&&(t=m(t),this.rotateLeft(t)),y(m(t),Tn),y(m(m(t)),1),this.rotateRight(m(m(t))))}else{var i=x(m(m(t)));p(i)===1?(y(m(t),Tn),y(i,Tn),y(m(m(t)),1),t=m(m(t))):(t===x(m(t))&&(t=m(t),this.rotateRight(t)),y(m(t),Tn),y(m(m(t)),1),this.rotateLeft(m(m(t))))}this.root_.color=Tn},b.prototype.values=function(){var t=new j,n=this.getFirstEntry();if(n!==null)for(t.add(n.value);(n=b.successor(n))!==null;)t.add(n.value);return t},b.prototype.entrySet=function(){var t=new pr,n=this.getFirstEntry();if(n!==null)for(t.add(n);(n=b.successor(n))!==null;)t.add(n);return t},b.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}},b.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}},b.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t},b.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,a=t;i!==null&&a===i.right;)a=i,i=i.parent;return i},b.prototype.size=function(){return this.size_};var tr=function(){};tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr},S.prototype=new h,(C.prototype=new S).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},C.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},C.prototype.addAll=function(t){for(var n=t.iterator();n.hasNext();)this.add(n.next());return!0},C.prototype.remove=function(t){throw new l},C.prototype.size=function(){return this.array_.length},C.prototype.isEmpty=function(){return this.array_.length===0},C.prototype.toArray=function(){for(var t=[],n=0,i=this.array_.length;n<i;n++)t.push(this.array_[n]);return t},C.prototype.iterator=function(){return new Ur(this)};var Ur=function(t){this.treeSet_=t,this.position_=0};Ur.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new u;return this.treeSet_.array_[this.position_++]},Ur.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Ur.prototype.remove=function(){throw new l};var Fn=function(){};Fn.sort=function(){var t,n,i,a,f=arguments[0];if(arguments.length===1)a=function(v,M){return v.compareTo(M)},f.sort(a);else if(arguments.length===2)i=arguments[1],a=function(v,M){return i.compare(v,M)},f.sort(a);else if(arguments.length===3){(n=f.slice(arguments[1],arguments[2])).sort();var g=f.slice(0,arguments[1]).concat(n,f.slice(arguments[2],f.length));for(f.splice(0,f.length),t=0;t<g.length;t++)f.push(g[t])}else if(arguments.length===4)for(n=f.slice(arguments[1],arguments[2]),i=arguments[3],a=function(v,M){return i.compare(v,M)},n.sort(a),g=f.slice(0,arguments[1]).concat(n,f.slice(arguments[2],f.length)),f.splice(0,f.length),t=0;t<g.length;t++)f.push(g[t])},Fn.asList=function(t){for(var n=new j,i=0,a=t.length;i<a;i++)n.add(t[i]);return n};var Wt=function(){},Un={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}};Un.P.get=function(){return 0},Un.L.get=function(){return 1},Un.A.get=function(){return 2},Un.FALSE.get=function(){return-1},Un.TRUE.get=function(){return-2},Un.DONTCARE.get=function(){return-3},Un.SYM_FALSE.get=function(){return"F"},Un.SYM_TRUE.get=function(){return"T"},Un.SYM_DONTCARE.get=function(){return"*"},Un.SYM_P.get=function(){return"0"},Un.SYM_L.get=function(){return"1"},Un.SYM_A.get=function(){return"2"},Wt.prototype.interfaces_=function(){return[]},Wt.prototype.getClass=function(){return Wt},Wt.toDimensionSymbol=function(t){switch(t){case Wt.FALSE:return Wt.SYM_FALSE;case Wt.TRUE:return Wt.SYM_TRUE;case Wt.DONTCARE:return Wt.SYM_DONTCARE;case Wt.P:return Wt.SYM_P;case Wt.L:return Wt.SYM_L;case Wt.A:return Wt.SYM_A}throw new k("Unknown dimension value: "+t)},Wt.toDimensionValue=function(t){switch(Pt.toUpperCase(t)){case Wt.SYM_FALSE:return Wt.FALSE;case Wt.SYM_TRUE:return Wt.TRUE;case Wt.SYM_DONTCARE:return Wt.DONTCARE;case Wt.SYM_P:return Wt.P;case Wt.SYM_L:return Wt.L;case Wt.SYM_A:return Wt.A}throw new k("Unknown dimension symbol: "+t)},Object.defineProperties(Wt,Un);var Wn=function(){};Wn.prototype.filter=function(t){},Wn.prototype.interfaces_=function(){return[]},Wn.prototype.getClass=function(){return Wn};var Bn=function(){};Bn.prototype.filter=function(t,n){},Bn.prototype.isDone=function(){},Bn.prototype.isGeometryChanged=function(){},Bn.prototype.interfaces_=function(){return[]},Bn.prototype.getClass=function(){return Bn};var _n=function(t){function n(a,f){if(t.call(this,f),this._geometries=a||[],t.hasNullElements(this._geometries))throw new k("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 a=new Et,f=0;f<this._geometries.length;f++)a.expandToInclude(this._geometries[f].getEnvelopeInternal());return a},n.prototype.getGeometryN=function(a){return this._geometries[a]},n.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},n.prototype.getCoordinates=function(){for(var a=new Array(this.getNumPoints()).fill(null),f=-1,g=0;g<this._geometries.length;g++)for(var v=this._geometries[g].getCoordinates(),M=0;M<v.length;M++)a[++f]=v[M];return a},n.prototype.getArea=function(){for(var a=0,f=0;f<this._geometries.length;f++)a+=this._geometries[f].getArea();return a},n.prototype.equalsExact=function(){if(arguments.length===2){var a=arguments[0],f=arguments[1];if(!this.isEquivalentClass(a))return!1;var g=a;if(this._geometries.length!==g._geometries.length)return!1;for(var v=0;v<this._geometries.length;v++)if(!this._geometries[v].equalsExact(g._geometries[v],f))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.normalize=function(){for(var a=0;a<this._geometries.length;a++)this._geometries[a].normalize();Fn.sort(this._geometries)},n.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},n.prototype.getBoundaryDimension=function(){for(var a=Wt.FALSE,f=0;f<this._geometries.length;f++)a=Math.max(a,this._geometries[f].getBoundaryDimension());return a},n.prototype.getDimension=function(){for(var a=Wt.FALSE,f=0;f<this._geometries.length;f++)a=Math.max(a,this._geometries[f].getDimension());return a},n.prototype.getLength=function(){for(var a=0,f=0;f<this._geometries.length;f++)a+=this._geometries[f].getLength();return a},n.prototype.getNumPoints=function(){for(var a=0,f=0;f<this._geometries.length;f++)a+=this._geometries[f].getNumPoints();return a},n.prototype.getNumGeometries=function(){return this._geometries.length},n.prototype.reverse=function(){for(var a=this._geometries.length,f=new Array(a).fill(null),g=0;g<this._geometries.length;g++)f[g]=this._geometries[g].reverse();return this.getFactory().createGeometryCollection(f)},n.prototype.compareToSameClass=function(){if(arguments.length===1){var a=arguments[0],f=new C(Fn.asList(this._geometries)),g=new C(Fn.asList(a._geometries));return this.compare(f,g)}if(arguments.length===2){for(var v=arguments[0],M=arguments[1],P=v,V=this.getNumGeometries(),tt=P.getNumGeometries(),nt=0;nt<V&&nt<tt;){var vt=this.getGeometryN(nt),xt=P.getGeometryN(nt),Tt=vt.compareToSameClass(xt,M);if(Tt!==0)return Tt;nt++}return nt<V?1:nt<tt?-1:0}},n.prototype.apply=function(){if(yt(arguments[0],Y))for(var a=arguments[0],f=0;f<this._geometries.length;f++)this._geometries[f].apply(a);else if(yt(arguments[0],Bn)){var g=arguments[0];if(this._geometries.length===0)return null;for(var v=0;v<this._geometries.length&&(this._geometries[v].apply(g),!g.isDone());v++);g.isGeometryChanged()&&this.geometryChanged()}else if(yt(arguments[0],Wn)){var M=arguments[0];M.filter(this);for(var P=0;P<this._geometries.length;P++)this._geometries[P].apply(M)}else if(yt(arguments[0],Di)){var V=arguments[0];V.filter(this);for(var tt=0;tt<this._geometries.length;tt++)this._geometries[tt].apply(V)}},n.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),Nt.shouldNeverReachHere(),null},n.prototype.clone=function(){var a=t.prototype.clone.call(this);a._geometries=new Array(this._geometries.length).fill(null);for(var f=0;f<this._geometries.length;f++)a._geometries[f]=this._geometries[f].clone();return a},n.prototype.getGeometryType=function(){return"GeometryCollection"},n.prototype.copy=function(){for(var a=new Array(this._geometries.length).fill(null),f=0;f<a.length;f++)a[f]=this._geometries[f].copy();return new n(a,this._factory)},n.prototype.isEmpty=function(){for(var a=0;a<this._geometries.length;a++)if(!this._geometries[a].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}(Ft),bi=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 Ft.SORTINDEX_MULTILINESTRING},n.prototype.equalsExact=function(){if(arguments.length===2){var a=arguments[0],f=arguments[1];return!!this.isEquivalentClass(a)&&t.prototype.equalsExact.call(this,a,f)}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.getBoundaryDimension=function(){return this.isClosed()?Wt.FALSE:0},n.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var a=0;a<this._geometries.length;a++)if(!this._geometries[a].isClosed())return!1;return!0},n.prototype.getDimension=function(){return 1},n.prototype.reverse=function(){for(var a=this._geometries.length,f=new Array(a).fill(null),g=0;g<this._geometries.length;g++)f[a-1-g]=this._geometries[g].reverse();return this.getFactory().createMultiLineString(f)},n.prototype.getBoundary=function(){return new Xr(this).getBoundary()},n.prototype.getGeometryType=function(){return"MultiLineString"},n.prototype.copy=function(){for(var a=new Array(this._geometries.length).fill(null),f=0;f<a.length;f++)a[f]=this._geometries[f].copy();return new n(a,this._factory)},n.prototype.interfaces_=function(){return[tr]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(n,i),n}(_n),Xr=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var t=arguments[0],n=w.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=n}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this._geom=i,this._geomFact=i.getFactory(),this._bnRule=a}};Xr.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)},Xr.prototype.getBoundary=function(){return this._geom instanceof xn?this.boundaryLineString(this._geom):this._geom instanceof bi?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},Xr.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()])},Xr.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},Xr.prototype.computeBoundaryCoordinates=function(t){var n=new j;this._endpointMap=new b;for(var i=0;i<t.getNumGeometries();i++){var a=t.getGeometryN(i);a.getNumPoints()!==0&&(this.addEndpoint(a.getCoordinateN(0)),this.addEndpoint(a.getCoordinateN(a.getNumPoints()-1)))}for(var f=this._endpointMap.entrySet().iterator();f.hasNext();){var g=f.next(),v=g.getValue().count;this._bnRule.isInBoundary(v)&&n.add(g.getKey())}return lt.toCoordinateArray(n)},Xr.prototype.addEndpoint=function(t){var n=this._endpointMap.get(t);n===null&&(n=new ea,this._endpointMap.put(t,n)),n.count++},Xr.prototype.interfaces_=function(){return[]},Xr.prototype.getClass=function(){return Xr},Xr.getBoundary=function(){if(arguments.length===1){var t=arguments[0];return new Xr(t).getBoundary()}if(arguments.length===2){var n=arguments[0],i=arguments[1];return new Xr(n,i).getBoundary()}};var ea=function(){this.count=null};ea.prototype.interfaces_=function(){return[]},ea.prototype.getClass=function(){return ea};var Yr=function(){},Ku={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Yr.prototype.interfaces_=function(){return[]},Yr.prototype.getClass=function(){return Yr},Yr.chars=function(t,n){for(var i=new Array(n).fill(null),a=0;a<n;a++)i[a]=t;return String(i)},Yr.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 a=arguments[0],f=arguments[1],g="",v=new function(){}(new function(){}(Yr.getStackTrace(a))),M=0;M<f;M++)try{g+=v.readLine()+Yr.NEWLINE}catch(P){if(!(P instanceof D))throw P;Nt.shouldNeverReachHere()}return g}},Yr.split=function(t,n){for(var i=n.length,a=new j,f=""+t,g=f.indexOf(n);g>=0;){var v=f.substring(0,g);a.add(v),g=(f=f.substring(g+i)).indexOf(n)}f.length>0&&a.add(f);for(var M=new Array(a.size()).fill(null),P=0;P<M.length;P++)M[P]=a.get(P);return M},Yr.toString=function(){if(arguments.length===1){var t=arguments[0];return Yr.SIMPLE_ORDINATE_FORMAT.format(t)}},Yr.spaces=function(t){return Yr.chars(" ",t)},Ku.NEWLINE.get=function(){return Ge.getProperty("line.separator")},Ku.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(Yr,Ku);var zn=function(){};zn.prototype.interfaces_=function(){return[]},zn.prototype.getClass=function(){return zn},zn.copyCoord=function(t,n,i,a){for(var f=Math.min(t.getDimension(),i.getDimension()),g=0;g<f;g++)i.setOrdinate(a,g,t.getOrdinate(n,g))},zn.isRing=function(t){var n=t.size();return n===0||!(n<=3)&&t.getOrdinate(0,Mt.X)===t.getOrdinate(n-1,Mt.X)&&t.getOrdinate(0,Mt.Y)===t.getOrdinate(n-1,Mt.Y)},zn.isEqual=function(t,n){var i=t.size();if(i!==n.size())return!1;for(var a=Math.min(t.getDimension(),n.getDimension()),f=0;f<i;f++)for(var g=0;g<a;g++){var v=t.getOrdinate(f,g),M=n.getOrdinate(f,g);if(t.getOrdinate(f,g)!==n.getOrdinate(f,g)&&(!F.isNaN(v)||!F.isNaN(M)))return!1}return!0},zn.extend=function(t,n,i){var a=t.create(i,n.getDimension()),f=n.size();if(zn.copy(n,0,a,0,f),f>0)for(var g=f;g<i;g++)zn.copy(n,f-1,a,g,1);return a},zn.reverse=function(t){for(var n=t.size()-1,i=Math.trunc(n/2),a=0;a<=i;a++)zn.swap(t,a,n-a)},zn.swap=function(t,n,i){if(n===i)return null;for(var a=0;a<t.getDimension();a++){var f=t.getOrdinate(n,a);t.setOrdinate(n,a,t.getOrdinate(i,a)),t.setOrdinate(i,a,f)}},zn.copy=function(t,n,i,a,f){for(var g=0;g<f;g++)zn.copyCoord(t,n+g,i,a+g)},zn.toString=function(){if(arguments.length===1){var t=arguments[0],n=t.size();if(n===0)return"()";var i=t.getDimension(),a=new ie;a.append("(");for(var f=0;f<n;f++){f>0&&a.append(" ");for(var g=0;g<i;g++)g>0&&a.append(","),a.append(Yr.toString(t.getOrdinate(f,g)))}return a.append(")"),a.toString()}},zn.ensureValidRing=function(t,n){var i=n.size();return i===0?n:i<=3?zn.createClosedRing(t,n,4):n.getOrdinate(0,Mt.X)===n.getOrdinate(i-1,Mt.X)&&n.getOrdinate(0,Mt.Y)===n.getOrdinate(i-1,Mt.Y)?n:zn.createClosedRing(t,n,i+1)},zn.createClosedRing=function(t,n,i){var a=t.create(i,n.getDimension()),f=n.size();zn.copy(n,0,a,0,f);for(var g=f;g<i;g++)zn.copy(n,0,a,g,1);return a};var xn=function(t){function n(a,f){t.call(this,f),this._points=null,this.init(a)}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 Et:this._points.expandEnvelope(new Et)},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 a=arguments[0],f=arguments[1];if(!this.isEquivalentClass(a))return!1;var g=a;if(this._points.size()!==g._points.size())return!1;for(var v=0;v<this._points.size();v++)if(!this.equal(this._points.getCoordinate(v),g._points.getCoordinate(v),f))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.normalize=function(){for(var a=0;a<Math.trunc(this._points.size()/2);a++){var f=this._points.size()-1-a;if(!this._points.getCoordinate(a).equals(this._points.getCoordinate(f)))return this._points.getCoordinate(a).compareTo(this._points.getCoordinate(f))>0&&zn.reverse(this._points),null}},n.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},n.prototype.getBoundaryDimension=function(){return this.isClosed()?Wt.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 mt.computeLength(this._points)},n.prototype.getNumPoints=function(){return this._points.size()},n.prototype.reverse=function(){var a=this._points.copy();return zn.reverse(a),this.getFactory().createLineString(a)},n.prototype.compareToSameClass=function(){if(arguments.length===1){for(var a=arguments[0],f=0,g=0;f<this._points.size()&&g<a._points.size();){var v=this._points.getCoordinate(f).compareTo(a._points.getCoordinate(g));if(v!==0)return v;f++,g++}return f<this._points.size()?1:g<a._points.size()?-1:0}if(arguments.length===2){var M=arguments[0];return arguments[1].compare(this._points,M._points)}},n.prototype.apply=function(){if(yt(arguments[0],Y))for(var a=arguments[0],f=0;f<this._points.size();f++)a.filter(this._points.getCoordinate(f));else if(yt(arguments[0],Bn)){var g=arguments[0];if(this._points.size()===0)return null;for(var v=0;v<this._points.size()&&(g.filter(this._points,v),!g.isDone());v++);g.isGeometryChanged()&&this.geometryChanged()}else yt(arguments[0],Wn)?arguments[0].filter(this):yt(arguments[0],Di)&&arguments[0].filter(this)},n.prototype.getBoundary=function(){return new Xr(this).getBoundary()},n.prototype.isEquivalentClass=function(a){return a instanceof n},n.prototype.clone=function(){var a=t.prototype.clone.call(this);return a._points=this._points.clone(),a},n.prototype.getCoordinateN=function(a){return this._points.getCoordinate(a)},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(a){if(a===null&&(a=this.getFactory().getCoordinateSequenceFactory().create([])),a.size()===1)throw new k("Invalid number of points in LineString (found "+a.size()+" - must be 0 or >= 2)");this._points=a},n.prototype.isCoordinate=function(a){for(var f=0;f<this._points.size();f++)if(this._points.getCoordinate(f).equals(a))return!0;return!1},n.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},n.prototype.getPointN=function(a){return this.getFactory().createPoint(this._points.getCoordinate(a))},n.prototype.interfaces_=function(){return[tr]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(n,i),n}(Ft),La=function(){};La.prototype.interfaces_=function(){return[]},La.prototype.getClass=function(){return La};var Er=function(t){function n(a,f){t.call(this,f),this._coordinates=a||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 Et;var a=new Et;return a.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),a},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 a=arguments[0],f=arguments[1];return!!this.isEquivalentClass(a)&&(!(!this.isEmpty()||!a.isEmpty())||this.isEmpty()===a.isEmpty()&&this.equal(a.getCoordinate(),this.getCoordinate(),f))}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 Wt.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 a=arguments[0];return this.getCoordinate().compareTo(a.getCoordinate())}if(arguments.length===2){var f=arguments[0];return arguments[1].compare(this._coordinates,f._coordinates)}},n.prototype.apply=function(){if(yt(arguments[0],Y)){var a=arguments[0];if(this.isEmpty())return null;a.filter(this.getCoordinate())}else if(yt(arguments[0],Bn)){var f=arguments[0];if(this.isEmpty())return null;f.filter(this._coordinates,0),f.isGeometryChanged()&&this.geometryChanged()}else yt(arguments[0],Wn)?arguments[0].filter(this):yt(arguments[0],Di)&&arguments[0].filter(this)},n.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},n.prototype.clone=function(){var a=t.prototype.clone.call(this);return a._coordinates=this._coordinates.clone(),a},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(a){a===null&&(a=this.getFactory().getCoordinateSequenceFactory().create([])),Nt.isTrue(a.size()<=1),this._coordinates=a},n.prototype.isSimple=function(){return!0},n.prototype.interfaces_=function(){return[La]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(n,i),n}(Ft),Qo=function(){};Qo.prototype.interfaces_=function(){return[]},Qo.prototype.getClass=function(){return Qo};var Zn=function(t){function n(a,f,g){if(t.call(this,g),this._shell=null,this._holes=null,a===null&&(a=this.getFactory().createLinearRing()),f===null&&(f=[]),t.hasNullElements(f))throw new k("holes must not contain null elements");if(a.isEmpty()&&t.hasNonEmptyElements(f))throw new k("shell is empty but holes are not");this._shell=a,this._holes=f}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 a=new Array(this.getNumPoints()).fill(null),f=-1,g=this._shell.getCoordinates(),v=0;v<g.length;v++)a[++f]=g[v];for(var M=0;M<this._holes.length;M++)for(var P=this._holes[M].getCoordinates(),V=0;V<P.length;V++)a[++f]=P[V];return a},n.prototype.getArea=function(){var a=0;a+=Math.abs(mt.signedArea(this._shell.getCoordinateSequence()));for(var f=0;f<this._holes.length;f++)a-=Math.abs(mt.signedArea(this._holes[f].getCoordinateSequence()));return a},n.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var a=this._shell.getCoordinateSequence(),f=this.getEnvelopeInternal(),g=0;g<5;g++){var v=a.getX(g);if(v!==f.getMinX()&&v!==f.getMaxX())return!1;var M=a.getY(g);if(M!==f.getMinY()&&M!==f.getMaxY())return!1}for(var P=a.getX(0),V=a.getY(0),tt=1;tt<=4;tt++){var nt=a.getX(tt),vt=a.getY(tt);if(nt!==P==(vt!==V))return!1;P=nt,V=vt}return!0},n.prototype.equalsExact=function(){if(arguments.length===2){var a=arguments[0],f=arguments[1];if(!this.isEquivalentClass(a))return!1;var g=a,v=this._shell,M=g._shell;if(!v.equalsExact(M,f)||this._holes.length!==g._holes.length)return!1;for(var P=0;P<this._holes.length;P++)if(!this._holes[P].equalsExact(g._holes[P],f))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 a=0;a<this._holes.length;a++)this.normalize(this._holes[a],!1);Fn.sort(this._holes)}else if(arguments.length===2){var f=arguments[0],g=arguments[1];if(f.isEmpty())return null;var v=new Array(f.getCoordinates().length-1).fill(null);Ge.arraycopy(f.getCoordinates(),0,v,0,v.length);var M=lt.minCoordinate(f.getCoordinates());lt.scroll(v,M),Ge.arraycopy(v,0,f.getCoordinates(),0,v.length),f.getCoordinates()[v.length]=v[0],mt.isCCW(f.getCoordinates())===g&<.reverse(f.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 a=0;a+=this._shell.getLength();for(var f=0;f<this._holes.length;f++)a+=this._holes[f].getLength();return a},n.prototype.getNumPoints=function(){for(var a=this._shell.getNumPoints(),f=0;f<this._holes.length;f++)a+=this._holes[f].getNumPoints();return a},n.prototype.reverse=function(){var a=this.copy();a._shell=this._shell.copy().reverse(),a._holes=new Array(this._holes.length).fill(null);for(var f=0;f<this._holes.length;f++)a._holes[f]=this._holes[f].copy().reverse();return a},n.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},n.prototype.compareToSameClass=function(){if(arguments.length===1){var a=arguments[0],f=this._shell,g=a._shell;return f.compareToSameClass(g)}if(arguments.length===2){var v=arguments[0],M=arguments[1],P=v,V=this._shell,tt=P._shell,nt=V.compareToSameClass(tt,M);if(nt!==0)return nt;for(var vt=this.getNumInteriorRing(),xt=P.getNumInteriorRing(),Tt=0;Tt<vt&&Tt<xt;){var Ut=this.getInteriorRingN(Tt),We=P.getInteriorRingN(Tt),cn=Ut.compareToSameClass(We,M);if(cn!==0)return cn;Tt++}return Tt<vt?1:Tt<xt?-1:0}},n.prototype.apply=function(a){if(yt(a,Y)){this._shell.apply(a);for(var f=0;f<this._holes.length;f++)this._holes[f].apply(a)}else if(yt(a,Bn)){if(this._shell.apply(a),!a.isDone())for(var g=0;g<this._holes.length&&(this._holes[g].apply(a),!a.isDone());g++);a.isGeometryChanged()&&this.geometryChanged()}else if(yt(a,Wn))a.filter(this);else if(yt(a,Di)){a.filter(this),this._shell.apply(a);for(var v=0;v<this._holes.length;v++)this._holes[v].apply(a)}},n.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var a=new Array(this._holes.length+1).fill(null);a[0]=this._shell;for(var f=0;f<this._holes.length;f++)a[f+1]=this._holes[f];return a.length<=1?this.getFactory().createLinearRing(a[0].getCoordinateSequence()):this.getFactory().createMultiLineString(a)},n.prototype.clone=function(){var a=t.prototype.clone.call(this);a._shell=this._shell.clone(),a._holes=new Array(this._holes.length).fill(null);for(var f=0;f<this._holes.length;f++)a._holes[f]=this._holes[f].clone();return a},n.prototype.getGeometryType=function(){return"Polygon"},n.prototype.copy=function(){for(var a=this._shell.copy(),f=new Array(this._holes.length).fill(null),g=0;g<f.length;g++)f[g]=this._holes[g].copy();return new n(a,f,this._factory)},n.prototype.getExteriorRing=function(){return this._shell},n.prototype.isEmpty=function(){return this._shell.isEmpty()},n.prototype.getInteriorRingN=function(a){return this._holes[a]},n.prototype.interfaces_=function(){return[Qo]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(n,i),n}(Ft),na=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 Ft.SORTINDEX_MULTIPOINT},n.prototype.isValid=function(){return!0},n.prototype.equalsExact=function(){if(arguments.length===2){var a=arguments[0],f=arguments[1];return!!this.isEquivalentClass(a)&&t.prototype.equalsExact.call(this,a,f)}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.getCoordinate=function(){if(arguments.length===1){var a=arguments[0];return this._geometries[a].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},n.prototype.getBoundaryDimension=function(){return Wt.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 a=new Array(this._geometries.length).fill(null),f=0;f<a.length;f++)a[f]=this._geometries[f].copy();return new n(a,this._factory)},n.prototype.interfaces_=function(){return[La]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(n,i),n}(_n),Ki=function(t){function n(a,f){a instanceof U&&f instanceof Qt&&(a=f.getCoordinateSequenceFactory().create(a)),t.call(this,a,f),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 Ft.SORTINDEX_LINEARRING},n.prototype.getBoundaryDimension=function(){return Wt.FALSE},n.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},n.prototype.reverse=function(){var a=this._points.copy();return zn.reverse(a),this.getFactory().createLinearRing(a)},n.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new k("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<n.MINIMUM_VALID_SIZE)throw new k("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}(xn),Qi=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 Ft.SORTINDEX_MULTIPOLYGON},n.prototype.equalsExact=function(){if(arguments.length===2){var a=arguments[0],f=arguments[1];return!!this.isEquivalentClass(a)&&t.prototype.equalsExact.call(this,a,f)}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 a=this._geometries.length,f=new Array(a).fill(null),g=0;g<this._geometries.length;g++)f[g]=this._geometries[g].reverse();return this.getFactory().createMultiPolygon(f)},n.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var a=new j,f=0;f<this._geometries.length;f++)for(var g=this._geometries[f].getBoundary(),v=0;v<g.getNumGeometries();v++)a.add(g.getGeometryN(v));var M=new Array(a.size()).fill(null);return this.getFactory().createMultiLineString(a.toArray(M))},n.prototype.getGeometryType=function(){return"MultiPolygon"},n.prototype.copy=function(){for(var a=new Array(this._geometries.length).fill(null),f=0;f<a.length;f++)a[f]=this._geometries[f].copy();return new n(a,this._factory)},n.prototype.interfaces_=function(){return[Qo]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(n,i),n}(_n),li=function(t){this._factory=t||null,this._isUserDataCopied=!1},au={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};li.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},li.prototype.edit=function(t,n){if(t===null)return null;var i=this.editInternal(t,n);return this._isUserDataCopied&&i.setUserData(t.getUserData()),i},li.prototype.editInternal=function(t,n){return this._factory===null&&(this._factory=t.getFactory()),t instanceof _n?this.editGeometryCollection(t,n):t instanceof Zn?this.editPolygon(t,n):t instanceof Er?n.edit(t,this._factory):t instanceof xn?n.edit(t,this._factory):(Nt.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},li.prototype.editGeometryCollection=function(t,n){for(var i=n.edit(t,this._factory),a=new j,f=0;f<i.getNumGeometries();f++){var g=this.edit(i.getGeometryN(f),n);g===null||g.isEmpty()||a.add(g)}return i.getClass()===na?this._factory.createMultiPoint(a.toArray([])):i.getClass()===bi?this._factory.createMultiLineString(a.toArray([])):i.getClass()===Qi?this._factory.createMultiPolygon(a.toArray([])):this._factory.createGeometryCollection(a.toArray([]))},li.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 a=this.edit(i.getExteriorRing(),n);if(a===null||a.isEmpty())return this._factory.createPolygon();for(var f=new j,g=0;g<i.getNumInteriorRing();g++){var v=this.edit(i.getInteriorRingN(g),n);v===null||v.isEmpty()||f.add(v)}return this._factory.createPolygon(a,f.toArray([]))},li.prototype.interfaces_=function(){return[]},li.prototype.getClass=function(){return li},li.GeometryEditorOperation=function(){},au.NoOpGeometryOperation.get=function(){return Na},au.CoordinateOperation.get=function(){return Da},au.CoordinateSequenceOperation.get=function(){return Oa},Object.defineProperties(li,au);var Na=function(){};Na.prototype.edit=function(t,n){return t},Na.prototype.interfaces_=function(){return[li.GeometryEditorOperation]},Na.prototype.getClass=function(){return Na};var Da=function(){};Da.prototype.edit=function(t,n){var i=this.editCoordinates(t.getCoordinates(),t);return i===null?t:t instanceof Ki?n.createLinearRing(i):t instanceof xn?n.createLineString(i):t instanceof Er?i.length>0?n.createPoint(i[0]):n.createPoint():t},Da.prototype.interfaces_=function(){return[li.GeometryEditorOperation]},Da.prototype.getClass=function(){return Da};var Oa=function(){};Oa.prototype.edit=function(t,n){return t instanceof Ki?n.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof xn?n.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Er?n.createPoint(this.edit(t.getCoordinateSequence(),t)):t},Oa.prototype.interfaces_=function(){return[li.GeometryEditorOperation]},Oa.prototype.getClass=function(){return Oa};var Pn=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 U}else if(yt(arguments[0],Mt)){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 a=0;a<this._coordinates.length;a++)this._coordinates[a]=i.getCoordinateCopy(a)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var f=arguments[0],g=arguments[1];this._coordinates=f,this._dimension=g,f===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var v=arguments[0],M=arguments[1];this._coordinates=new Array(v).fill(null),this._dimension=M;for(var P=0;P<v;P++)this._coordinates[P]=new U}}},Qu={serialVersionUID:{configurable:!0}};Pn.prototype.setOrdinate=function(t,n,i){switch(n){case Mt.X:this._coordinates[t].x=i;break;case Mt.Y:this._coordinates[t].y=i;break;case Mt.Z:this._coordinates[t].z=i;break;default:throw new k("invalid ordinateIndex")}},Pn.prototype.size=function(){return this._coordinates.length},Pn.prototype.getOrdinate=function(t,n){switch(n){case Mt.X:return this._coordinates[t].x;case Mt.Y:return this._coordinates[t].y;case Mt.Z:return this._coordinates[t].z}return F.NaN},Pn.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}},Pn.prototype.getCoordinateCopy=function(t){return new U(this._coordinates[t])},Pn.prototype.getDimension=function(){return this._dimension},Pn.prototype.getX=function(t){return this._coordinates[t].x},Pn.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 Pn(t,this._dimension)},Pn.prototype.expandEnvelope=function(t){for(var n=0;n<this._coordinates.length;n++)t.expandToInclude(this._coordinates[n]);return t},Pn.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 Pn(t,this._dimension)},Pn.prototype.toString=function(){if(this._coordinates.length>0){var t=new ie(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"()"},Pn.prototype.getY=function(t){return this._coordinates[t].y},Pn.prototype.toCoordinateArray=function(){return this._coordinates},Pn.prototype.interfaces_=function(){return[Mt,e]},Pn.prototype.getClass=function(){return Pn},Qu.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(Pn,Qu);var ji=function(){},Fa={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};ji.prototype.readResolve=function(){return ji.instance()},ji.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new Pn(t)}if(yt(arguments[0],Mt)){var n=arguments[0];return new Pn(n)}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return a>3&&(a=3),a<2?new Pn(i):new Pn(i,a)}},ji.prototype.interfaces_=function(){return[Ot,e]},ji.prototype.getClass=function(){return ji},ji.instance=function(){return ji.instanceObject},Fa.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Fa.instanceObject.get=function(){return new ji},Object.defineProperties(ji,Fa);var $l=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,a){return this.map_.set(i,a),a},n.prototype.values=function(){for(var i=new j,a=this.map_.values(),f=a.next();!f.done;)i.add(f.value),f=a.next();return i},n.prototype.entrySet=function(){var i=new pr;return this.map_.entries().forEach(function(a){return i.add(a)}),i},n.prototype.size=function(){return this.map_.size()},n}(Yt),ue=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 Oi){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 a=arguments[0];this._modelType=a._modelType,this._scale=a._scale}}},ra={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};ue.prototype.equals=function(t){if(!(t instanceof ue))return!1;var n=t;return this._modelType===n._modelType&&this._scale===n._scale},ue.prototype.compareTo=function(t){var n=t,i=this.getMaximumSignificantDigits(),a=n.getMaximumSignificantDigits();return new _t(i).compareTo(new _t(a))},ue.prototype.getScale=function(){return this._scale},ue.prototype.isFloating=function(){return this._modelType===ue.FLOATING||this._modelType===ue.FLOATING_SINGLE},ue.prototype.getType=function(){return this._modelType},ue.prototype.toString=function(){var t="UNKNOWN";return this._modelType===ue.FLOATING?t="Floating":this._modelType===ue.FLOATING_SINGLE?t="Floating-Single":this._modelType===ue.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},ue.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];return F.isNaN(t)||this._modelType===ue.FLOATING_SINGLE?t:this._modelType===ue.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof U){var n=arguments[0];if(this._modelType===ue.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}},ue.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===ue.FLOATING?t=16:this._modelType===ue.FLOATING_SINGLE?t=6:this._modelType===ue.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},ue.prototype.setScale=function(t){this._scale=Math.abs(t)},ue.prototype.interfaces_=function(){return[e,Z]},ue.prototype.getClass=function(){return ue},ue.mostPrecise=function(t,n){return t.compareTo(n)>=0?t:n},ra.serialVersionUID.get=function(){return 7777263578777804e3},ra.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ue,ra);var Oi=function t(n){this._name=n||null,t.nameToTypeMap.put(n,this)},ju={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Oi.prototype.readResolve=function(){return Oi.nameToTypeMap.get(this._name)},Oi.prototype.toString=function(){return this._name},Oi.prototype.interfaces_=function(){return[e]},Oi.prototype.getClass=function(){return Oi},ju.serialVersionUID.get=function(){return-552860263173159e4},ju.nameToTypeMap.get=function(){return new $l},Object.defineProperties(Oi,ju),ue.Type=Oi,ue.FIXED=new Oi("FIXED"),ue.FLOATING=new Oi("FLOATING"),ue.FLOATING_SINGLE=new Oi("FLOATING SINGLE");var Qt=function t(){this._precisionModel=new ue,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?yt(arguments[0],Ot)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof ue&&(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]))},tl={serialVersionUID:{configurable:!0}};Qt.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new U(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new U(t.getMinX(),t.getMinY()),new U(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new U(t.getMinX(),t.getMinY()),new U(t.getMinX(),t.getMaxY()),new U(t.getMaxX(),t.getMaxY()),new U(t.getMaxX(),t.getMinY()),new U(t.getMinX(),t.getMinY())]),null)},Qt.prototype.createLineString=function(t){return t?t instanceof Array?new xn(this.getCoordinateSequenceFactory().create(t),this):yt(t,Mt)?new xn(t,this):void 0:new xn(this.getCoordinateSequenceFactory().create([]),this)},Qt.prototype.createMultiLineString=function(){if(arguments.length===0)return new bi(null,this);if(arguments.length===1){var t=arguments[0];return new bi(t,this)}},Qt.prototype.buildGeometry=function(t){for(var n=null,i=!1,a=!1,f=t.iterator();f.hasNext();){var g=f.next(),v=g.getClass();n===null&&(n=v),v!==n&&(i=!0),g.isGeometryCollectionOrDerived()&&(a=!0)}if(n===null)return this.createGeometryCollection();if(i||a)return this.createGeometryCollection(Qt.toGeometryArray(t));var M=t.iterator().next();if(t.size()>1){if(M instanceof Zn)return this.createMultiPolygon(Qt.toPolygonArray(t));if(M instanceof xn)return this.createMultiLineString(Qt.toLineStringArray(t));if(M instanceof Er)return this.createMultiPoint(Qt.toPointArray(t));Nt.shouldNeverReachHere("Unhandled class: "+M.getClass().getName())}return M},Qt.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)},Qt.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}if(yt(arguments[0],Mt)){var n=arguments[0];return new Er(n,this)}}},Qt.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Qt.prototype.createPolygon=function(){if(arguments.length===0)return new Zn(null,null,this);if(arguments.length===1){if(yt(arguments[0],Mt)){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 Ki){var i=arguments[0];return this.createPolygon(i,null)}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];return new Zn(a,f,this)}},Qt.prototype.getSRID=function(){return this._SRID},Qt.prototype.createGeometryCollection=function(){if(arguments.length===0)return new _n(null,this);if(arguments.length===1){var t=arguments[0];return new _n(t,this)}},Qt.prototype.createGeometry=function(t){return new li(this).edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})},Qt.prototype.getPrecisionModel=function(){return this._precisionModel},Qt.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(yt(arguments[0],Mt)){var n=arguments[0];return new Ki(n,this)}}},Qt.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Qi(null,this);if(arguments.length===1){var t=arguments[0];return new Qi(t,this)}},Qt.prototype.createMultiPoint=function(){if(arguments.length===0)return new na(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new na(t,this)}if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(yt(arguments[0],Mt)){var i=arguments[0];if(i===null)return this.createMultiPoint(new Array(0).fill(null));for(var a=new Array(i.size()).fill(null),f=0;f<i.size();f++){var g=this.getCoordinateSequenceFactory().create(1,i.getDimension());zn.copy(i,f,g,0,1),a[f]=this.createPoint(g)}return this.createMultiPoint(a)}}},Qt.prototype.interfaces_=function(){return[e]},Qt.prototype.getClass=function(){return Qt},Qt.toMultiPolygonArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.toGeometryArray=function(t){if(t===null)return null;var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.getDefaultCoordinateSequenceFactory=function(){return ji.instance()},Qt.toMultiLineStringArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.toLineStringArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.toMultiPointArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.toLinearRingArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.toPointArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.toPolygonArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.createPointFromInternalCoord=function(t,n){return n.getPrecisionModel().makePrecise(t),n.getFactory().createPoint(t)},tl.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(Qt,tl);var el=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],uu=function(t){this.geometryFactory=t||new Qt};uu.prototype.read=function(t){var n,i=(n=typeof t=="string"?JSON.parse(t):t).type;if(!Fi[i])throw new Error("Unknown GeoJSON type: "+n.type);return el.indexOf(i)!==-1?Fi[i].apply(this,[n.coordinates]):i==="GeometryCollection"?Fi[i].apply(this,[n.geometries]):Fi[i].apply(this,[n])},uu.prototype.write=function(t){var n=t.getGeometryType();if(!to[n])throw new Error("Geometry is not supported");return to[n].apply(this,[t])};var Fi={Feature:function(t){var n={};for(var i in t)n[i]=t[i];if(t.geometry){var a=t.geometry.type;if(!Fi[a])throw new Error("Unknown GeoJSON type: "+t.type);n.geometry=this.read(t.geometry)}return t.bbox&&(n.bbox=Fi.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 a=t[i];n.push(new U(a[0],a[1]))}return n},bbox:function(t){return this.geometryFactory.createLinearRing([new U(t[0],t[1]),new U(t[2],t[1]),new U(t[2],t[3]),new U(t[0],t[3]),new U(t[0],t[1])])},Point:function(t){var n=new U(t[0],t[1]);return this.geometryFactory.createPoint(n)},MultiPoint:function(t){for(var n=[],i=0;i<t.length;++i)n.push(Fi.Point.apply(this,[t[i]]));return this.geometryFactory.createMultiPoint(n)},LineString:function(t){var n=Fi.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(n)},MultiLineString:function(t){for(var n=[],i=0;i<t.length;++i)n.push(Fi.LineString.apply(this,[t[i]]));return this.geometryFactory.createMultiLineString(n)},Polygon:function(t){for(var n=Fi.coordinates.apply(this,[t[0]]),i=this.geometryFactory.createLinearRing(n),a=[],f=1;f<t.length;++f){var g=t[f],v=Fi.coordinates.apply(this,[g]),M=this.geometryFactory.createLinearRing(v);a.push(M)}return this.geometryFactory.createPolygon(i,a)},MultiPolygon:function(t){for(var n=[],i=0;i<t.length;++i){var a=t[i];n.push(Fi.Polygon.apply(this,[a]))}return this.geometryFactory.createMultiPolygon(n)},GeometryCollection:function(t){for(var n=[],i=0;i<t.length;++i){var a=t[i];n.push(this.read(a))}return this.geometryFactory.createGeometryCollection(n)}},to={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:to.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var a=t._geometries[i],f=to.Point.apply(this,[a]);n.push(f.coordinates)}return{type:"MultiPoint",coordinates:n}},LineString:function(t){for(var n=[],i=t.getCoordinates(),a=0;a<i.length;++a){var f=i[a];n.push(to.coordinate.apply(this,[f]))}return{type:"LineString",coordinates:n}},MultiLineString:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var a=t._geometries[i],f=to.LineString.apply(this,[a]);n.push(f.coordinates)}return{type:"MultiLineString",coordinates:n}},Polygon:function(t){var n=[],i=to.LineString.apply(this,[t._shell]);n.push(i.coordinates);for(var a=0;a<t._holes.length;++a){var f=t._holes[a],g=to.LineString.apply(this,[f]);n.push(g.coordinates)}return{type:"Polygon",coordinates:n}},MultiPolygon:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var a=t._geometries[i],f=to.Polygon.apply(this,[a]);n.push(f.coordinates)}return{type:"MultiPolygon",coordinates:n}},GeometryCollection:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var a=t._geometries[i],f=a.getGeometryType();n.push(to[f].apply(this,[a]))}return{type:"GeometryCollection",geometries:n}}},Ua=function(t){this.geometryFactory=t||new Qt,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new uu(this.geometryFactory)};Ua.prototype.read=function(t){var n=this.parser.read(t);return this.precisionModel.getType()===ue.FIXED&&this.reducePrecision(n),n},Ua.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 Fs=function(){this.parser=new uu(this.geometryFactory)};Fs.prototype.write=function(t){return this.parser.write(t)};var dt=function(){},Ba={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};dt.prototype.interfaces_=function(){return[]},dt.prototype.getClass=function(){return dt},dt.opposite=function(t){return t===dt.LEFT?dt.RIGHT:t===dt.RIGHT?dt.LEFT:t},Ba.ON.get=function(){return 0},Ba.LEFT.get=function(){return 1},Ba.RIGHT.get=function(){return 2},Object.defineProperties(dt,Ba),(G.prototype=new Error).name="EmptyStackException",(O.prototype=new at).add=function(t){return this.array_.push(t),!0},O.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},O.prototype.push=function(t){return this.array_.push(t),t},O.prototype.pop=function(t){if(this.array_.length===0)throw new G;return this.array_.pop()},O.prototype.peek=function(){if(this.array_.length===0)throw new G;return this.array_[this.array_.length-1]},O.prototype.empty=function(){return this.array_.length===0},O.prototype.isEmpty=function(){return this.empty()},O.prototype.search=function(t){return this.array_.indexOf(t)},O.prototype.size=function(){return this.array_.length},O.prototype.toArray=function(){for(var t=[],n=0,i=this.array_.length;n<i;n++)t.push(this.array_[n]);return t};var eo=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};eo.prototype.getCoordinate=function(){return this._minCoord},eo.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},eo.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();Nt.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],a=mt.computeOrientation(this._minCoord,i,n),f=!1;(n.y<this._minCoord.y&&i.y<this._minCoord.y&&a===mt.COUNTERCLOCKWISE||n.y>this._minCoord.y&&i.y>this._minCoord.y&&a===mt.CLOCKWISE)&&(f=!0),f&&(this._minIndex=this._minIndex-1)},eo.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 a=dt.LEFT;return i[n].y<i[n+1].y&&(a=dt.RIGHT),a},eo.prototype.getEdge=function(){return this._orientedDe},eo.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])},eo.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)},eo.prototype.findEdge=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isForward()&&this.checkForRightmostCoordinate(i)}Nt.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)===dt.LEFT&&(this._orientedDe=this._minDe.getSym())},eo.prototype.interfaces_=function(){return[]},eo.prototype.getClass=function(){return eo};var Mo=function(t){function n(i,a){t.call(this,n.msgWithCoord(i,a)),this.pt=a?new U(a):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,a){return a?i:i+" [ "+a+" ]"},n}(xr),za=function(){this.array_=[]};za.prototype.addLast=function(t){this.array_.push(t)},za.prototype.removeFirst=function(){return this.array_.shift()},za.prototype.isEmpty=function(){return this.array_.length===0};var wr=function(){this._finder=null,this._dirEdgeList=new j,this._nodes=new j,this._rightMostCoord=null,this._env=null,this._finder=new eo};wr.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},wr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},wr.prototype.computeNodeDepth=function(t){for(var n=null,i=t.getEdges().iterator();i.hasNext();){var a=i.next();if(a.isVisited()||a.getSym().isVisited()){n=a;break}}if(n===null)throw new Mo("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(n);for(var f=t.getEdges().iterator();f.hasNext();){var g=f.next();g.setVisited(!0),this.copySymDepths(g)}},wr.prototype.computeDepth=function(t){this.clearVisitedEdges();var n=this._finder.getEdge();n.setEdgeDepths(dt.RIGHT,t),this.copySymDepths(n),this.computeDepths(n)},wr.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},wr.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var n=t.next();n.getDepth(dt.RIGHT)>=1&&n.getDepth(dt.LEFT)<=0&&!n.isInteriorAreaEdge()&&n.setInResult(!0)}},wr.prototype.computeDepths=function(t){var n=new pr,i=new za,a=t.getNode();for(i.addLast(a),n.add(a),t.setVisited(!0);!i.isEmpty();){var f=i.removeFirst();n.add(f),this.computeNodeDepth(f);for(var g=f.getEdges().iterator();g.hasNext();){var v=g.next().getSym();if(!v.isVisited()){var M=v.getNode();n.contains(M)||(i.addLast(M),n.add(M))}}}},wr.prototype.compareTo=function(t){var n=t;return this._rightMostCoord.x<n._rightMostCoord.x?-1:this._rightMostCoord.x>n._rightMostCoord.x?1:0},wr.prototype.getEnvelope=function(){if(this._env===null){for(var t=new Et,n=this._dirEdgeList.iterator();n.hasNext();)for(var i=n.next().getEdge().getCoordinates(),a=0;a<i.length-1;a++)t.expandToInclude(i[a]);this._env=t}return this._env},wr.prototype.addReachable=function(t){var n=new O;for(n.add(t);!n.empty();){var i=n.pop();this.add(i,n)}},wr.prototype.copySymDepths=function(t){var n=t.getSym();n.setDepth(dt.LEFT,t.getDepth(dt.RIGHT)),n.setDepth(dt.RIGHT,t.getDepth(dt.LEFT))},wr.prototype.add=function(t,n){t.setVisited(!0),this._nodes.add(t);for(var i=t.getEdges().iterator();i.hasNext();){var a=i.next();this._dirEdgeList.add(a);var f=a.getSym().getNode();f.isVisited()||n.push(f)}},wr.prototype.getNodes=function(){return this._nodes},wr.prototype.getDirectedEdges=function(){return this._dirEdgeList},wr.prototype.interfaces_=function(){return[Z]},wr.prototype.getClass=function(){return wr};var un=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[dt.ON]=i}else if(arguments[0]instanceof t){var a=arguments[0];if(this.init(a.location.length),a!==null)for(var f=0;f<this.location.length;f++)this.location[f]=a.location[f]}}else if(arguments.length===3){var g=arguments[0],v=arguments[1],M=arguments[2];this.init(3),this.location[dt.ON]=g,this.location[dt.LEFT]=v,this.location[dt.RIGHT]=M}};un.prototype.setAllLocations=function(t){for(var n=0;n<this.location.length;n++)this.location[n]=t},un.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==W.NONE)return!1;return!0},un.prototype.setAllLocationsIfNull=function(t){for(var n=0;n<this.location.length;n++)this.location[n]===W.NONE&&(this.location[n]=t)},un.prototype.isLine=function(){return this.location.length===1},un.prototype.merge=function(t){if(t.location.length>this.location.length){var n=new Array(3).fill(null);n[dt.ON]=this.location[dt.ON],n[dt.LEFT]=W.NONE,n[dt.RIGHT]=W.NONE,this.location=n}for(var i=0;i<this.location.length;i++)this.location[i]===W.NONE&&i<t.location.length&&(this.location[i]=t.location[i])},un.prototype.getLocations=function(){return this.location},un.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[dt.LEFT];this.location[dt.LEFT]=this.location[dt.RIGHT],this.location[dt.RIGHT]=t},un.prototype.toString=function(){var t=new ie;return this.location.length>1&&t.append(W.toLocationSymbol(this.location[dt.LEFT])),t.append(W.toLocationSymbol(this.location[dt.ON])),this.location.length>1&&t.append(W.toLocationSymbol(this.location[dt.RIGHT])),t.toString()},un.prototype.setLocations=function(t,n,i){this.location[dt.ON]=t,this.location[dt.LEFT]=n,this.location[dt.RIGHT]=i},un.prototype.get=function(t){return t<this.location.length?this.location[t]:W.NONE},un.prototype.isArea=function(){return this.location.length>1},un.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===W.NONE)return!0;return!1},un.prototype.setLocation=function(){if(arguments.length===1){var t=arguments[0];this.setLocation(dt.ON,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.location[n]=i}},un.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(W.NONE)},un.prototype.isEqualOnSide=function(t,n){return this.location[n]===t.location[n]},un.prototype.allPositionsEqual=function(t){for(var n=0;n<this.location.length;n++)if(this.location[n]!==t)return!1;return!0},un.prototype.interfaces_=function(){return[]},un.prototype.getClass=function(){return un};var Ve=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 un(n),this.elt[1]=new un(n)}else if(arguments[0]instanceof t){var i=arguments[0];this.elt[0]=new un(i.elt[0]),this.elt[1]=new un(i.elt[1])}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.elt[0]=new un(W.NONE),this.elt[1]=new un(W.NONE),this.elt[a].setLocation(f)}else if(arguments.length===3){var g=arguments[0],v=arguments[1],M=arguments[2];this.elt[0]=new un(g,v,M),this.elt[1]=new un(g,v,M)}else if(arguments.length===4){var P=arguments[0],V=arguments[1],tt=arguments[2],nt=arguments[3];this.elt[0]=new un(W.NONE,W.NONE,W.NONE),this.elt[1]=new un(W.NONE,W.NONE,W.NONE),this.elt[P].setLocations(V,tt,nt)}};Ve.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},Ve.prototype.setAllLocations=function(t,n){this.elt[t].setAllLocations(n)},Ve.prototype.isNull=function(t){return this.elt[t].isNull()},Ve.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)}},Ve.prototype.isLine=function(t){return this.elt[t].isLine()},Ve.prototype.merge=function(t){for(var n=0;n<2;n++)this.elt[n]===null&&t.elt[n]!==null?this.elt[n]=new un(t.elt[n]):this.elt[n].merge(t.elt[n])},Ve.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},Ve.prototype.getLocation=function(){if(arguments.length===1){var t=arguments[0];return this.elt[t].get(dt.ON)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.elt[n].get(i)}},Ve.prototype.toString=function(){var t=new ie;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()},Ve.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()}},Ve.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},Ve.prototype.setLocation=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];this.elt[t].setLocation(dt.ON,n)}else if(arguments.length===3){var i=arguments[0],a=arguments[1],f=arguments[2];this.elt[i].setLocation(a,f)}},Ve.prototype.isEqualOnSide=function(t,n){return this.elt[0].isEqualOnSide(t.elt[0],n)&&this.elt[1].isEqualOnSide(t.elt[1],n)},Ve.prototype.allPositionsEqual=function(t,n){return this.elt[t].allPositionsEqual(n)},Ve.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new un(this.elt[t].location[0]))},Ve.prototype.interfaces_=function(){return[]},Ve.prototype.getClass=function(){return Ve},Ve.toLineLabel=function(t){for(var n=new Ve(W.NONE),i=0;i<2;i++)n.setLocation(i,t.getLocation(i));return n};var qn=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new j,this._pts=new j,this._label=new Ve(W.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new j,this._geometryFactory=null;var t=arguments[0],n=arguments[1];this._geometryFactory=n,this.computePoints(t),this.computeRing()};qn.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=mt.isCCW(this._ring.getCoordinates())},qn.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},qn.prototype.computePoints=function(t){this._startDe=t;var n=t,i=!0;do{if(n===null)throw new Mo("Found null DirectedEdge");if(n.getEdgeRing()===this)throw new Mo("Directed Edge visited twice during ring-building at "+n.getCoordinate());this._edges.add(n);var a=n.getLabel();Nt.isTrue(a.isArea()),this.mergeLabel(a),this.addPoints(n.getEdge(),n.isForward(),i),i=!1,this.setEdgeRing(n,this),n=this.getNext(n)}while(n!==this._startDe)},qn.prototype.getLinearRing=function(){return this._ring},qn.prototype.getCoordinate=function(t){return this._pts.get(t)},qn.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},qn.prototype.addPoints=function(t,n,i){var a=t.getCoordinates();if(n){var f=1;i&&(f=0);for(var g=f;g<a.length;g++)this._pts.add(a[g])}else{var v=a.length-2;i&&(v=a.length-1);for(var M=v;M>=0;M--)this._pts.add(a[M])}},qn.prototype.isHole=function(){return this._isHole},qn.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)},qn.prototype.containsPoint=function(t){var n=this.getLinearRing();if(!n.getEnvelopeInternal().contains(t)||!mt.isPointInRing(t,n.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();)if(i.next().containsPoint(t))return!1;return!0},qn.prototype.addHole=function(t){this._holes.add(t)},qn.prototype.isShell=function(){return this._shell===null},qn.prototype.getLabel=function(){return this._label},qn.prototype.getEdges=function(){return this._edges},qn.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},qn.prototype.getShell=function(){return this._shell},qn.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],a=n.getLocation(i,dt.RIGHT);if(a===W.NONE)return null;if(this._label.getLocation(i)===W.NONE)return this._label.setLocation(i,a),null}},qn.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)},qn.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)},qn.prototype.interfaces_=function(){return[]},qn.prototype.getClass=function(){return qn};var Gf=function(t){function n(){var i=arguments[0],a=arguments[1];t.call(this,i,a)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.setEdgeRing=function(i,a){i.setMinEdgeRing(a)},n.prototype.getNext=function(i){return i.getNextMin()},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(qn),Zl=function(t){function n(){var i=arguments[0],a=arguments[1];t.call(this,i,a)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.buildMinimalRings=function(){var i=new j,a=this._startDe;do{if(a.getMinEdgeRing()===null){var f=new Gf(a,this._geometryFactory);i.add(f)}a=a.getNext()}while(a!==this._startDe);return i},n.prototype.setEdgeRing=function(i,a){i.setEdgeRing(a)},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}(qn),ci=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}}};ci.prototype.setVisited=function(t){this._isVisited=t},ci.prototype.setInResult=function(t){this._isInResult=t},ci.prototype.isCovered=function(){return this._isCovered},ci.prototype.isCoveredSet=function(){return this._isCoveredSet},ci.prototype.setLabel=function(t){this._label=t},ci.prototype.getLabel=function(){return this._label},ci.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},ci.prototype.updateIM=function(t){Nt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},ci.prototype.isInResult=function(){return this._isInResult},ci.prototype.isVisited=function(){return this._isVisited},ci.prototype.interfaces_=function(){return[]},ci.prototype.getClass=function(){return ci};var lu=function(t){function n(){t.call(this),this._coord=null,this._edges=null;var i=arguments[0],a=arguments[1];this._coord=i,this._edges=a,this._label=new Ve(0,W.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,a){var f=W.NONE;if(f=this._label.getLocation(a),!i.isNull(a)){var g=i.getLocation(a);f!==W.BOUNDARY&&(f=g)}return f},n.prototype.setLabel=function(){if(arguments.length!==2)return t.prototype.setLabel.apply(this,arguments);var i=arguments[0],a=arguments[1];this._label===null?this._label=new Ve(i,a):this._label.setLocation(i,a)},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 Ve)for(var a=arguments[0],f=0;f<2;f++){var g=this.computeMergedLocation(a,f);this._label.getLocation(f)===W.NONE&&this._label.setLocation(f,g)}},n.prototype.add=function(i){this._edges.insert(i),i.setNode(this)},n.prototype.setLabelBoundary=function(i){if(this._label===null)return null;var a=W.NONE;this._label!==null&&(a=this._label.getLocation(i));var f=null;switch(a){case W.BOUNDARY:f=W.INTERIOR;break;case W.INTERIOR:default:f=W.BOUNDARY}this._label.setLocation(i,f)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(ci),no=function(){this.nodeMap=new b,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};no.prototype.find=function(t){return this.nodeMap.get(t)},no.prototype.addNode=function(){if(arguments[0]instanceof U){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 lu){var i=arguments[0],a=this.nodeMap.get(i.getCoordinate());return a===null?(this.nodeMap.put(i.getCoordinate(),i),i):(a.mergeLabel(i),a)}},no.prototype.print=function(t){for(var n=this.iterator();n.hasNext();)n.next().print(t)},no.prototype.iterator=function(){return this.nodeMap.values().iterator()},no.prototype.values=function(){return this.nodeMap.values()},no.prototype.getBoundaryNodes=function(t){for(var n=new j,i=this.iterator();i.hasNext();){var a=i.next();a.getLabel().getLocation(t)===W.BOUNDARY&&n.add(a)}return n},no.prototype.add=function(t){var n=t.getCoordinate();this.addNode(n).add(t)},no.prototype.interfaces_=function(){return[]},no.prototype.getClass=function(){return no};var on=function(){},Us={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};on.prototype.interfaces_=function(){return[]},on.prototype.getClass=function(){return on},on.isNorthern=function(t){return t===on.NE||t===on.NW},on.isOpposite=function(t,n){return t===n?!1:(t-n+4)%4===2},on.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},on.isInHalfPlane=function(t,n){return n===on.SE?t===on.SE||t===on.SW:t===n||t===n+1},on.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 k("Cannot compute the quadrant for point ( "+t+", "+n+" )");return t>=0?n>=0?on.NE:on.SE:n>=0?on.NW:on.SW}if(arguments[0]instanceof U&&arguments[1]instanceof U){var i=arguments[0],a=arguments[1];if(a.x===i.x&&a.y===i.y)throw new k("Cannot compute the quadrant for two identical points "+i);return a.x>=i.x?a.y>=i.y?on.NE:on.SE:a.y>=i.y?on.NW:on.SW}},Us.NE.get=function(){return 0},Us.NW.get=function(){return 1},Us.SW.get=function(){return 2},Us.SE.get=function(){return 3},Object.defineProperties(on,Us);var Mr=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],a=arguments[2];this._edge=n,this.init(i,a),this._label=null}else if(arguments.length===4){var f=arguments[0],g=arguments[1],v=arguments[2],M=arguments[3];this._edge=f,this.init(g,v),this._label=M}};Mr.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:mt.computeOrientation(t._p0,t._p1,this._p1)},Mr.prototype.getDy=function(){return this._dy},Mr.prototype.getCoordinate=function(){return this._p0},Mr.prototype.setNode=function(t){this._node=t},Mr.prototype.print=function(t){var n=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),a=i.lastIndexOf("."),f=i.substring(a+1);t.print(" "+f+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label)},Mr.prototype.compareTo=function(t){var n=t;return this.compareDirection(n)},Mr.prototype.getDirectedCoordinate=function(){return this._p1},Mr.prototype.getDx=function(){return this._dx},Mr.prototype.getLabel=function(){return this._label},Mr.prototype.getEdge=function(){return this._edge},Mr.prototype.getQuadrant=function(){return this._quadrant},Mr.prototype.getNode=function(){return this._node},Mr.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},Mr.prototype.computeLabel=function(t){},Mr.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=on.quadrant(this._dx,this._dy),Nt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},Mr.prototype.interfaces_=function(){return[Z]},Mr.prototype.getClass=function(){return Mr};var nl=function(t){function n(){var i=arguments[0],a=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=a,a)this.init(i.getCoordinate(0),i.getCoordinate(1));else{var f=i.getNumPoints()-1;this.init(i.getCoordinate(f),i.getCoordinate(f-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 Ve(this._edge.getLabel()),this._isForward||this._label.flip()},n.prototype.getNext=function(){return this._next},n.prototype.setDepth=function(i,a){if(this._depth[i]!==-999&&this._depth[i]!==a)throw new Mo("assigned depths do not match",this.getCoordinate());this._depth[i]=a},n.prototype.isInteriorAreaEdge=function(){for(var i=!0,a=0;a<2;a++)this._label.isArea(a)&&this._label.getLocation(a,dt.LEFT)===W.INTERIOR&&this._label.getLocation(a,dt.RIGHT)===W.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[dt.LEFT]+"/"+this._depth[dt.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),a=!this._label.isArea(0)||this._label.allPositionsEqual(0,W.EXTERIOR),f=!this._label.isArea(1)||this._label.allPositionsEqual(1,W.EXTERIOR);return i&&a&&f},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,a){var f=this.getEdge().getDepthDelta();this._isForward||(f=-f);var g=1;i===dt.LEFT&&(g=-1);var v=dt.opposite(i),M=a+f*g;this.setDepth(i,a),this.setDepth(v,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,a){return i===W.EXTERIOR&&a===W.INTERIOR?1:i===W.INTERIOR&&a===W.EXTERIOR?-1:0},n}(Mr),ia=function(){};ia.prototype.createNode=function(t){return new lu(t,null)},ia.prototype.interfaces_=function(){return[]},ia.prototype.getClass=function(){return ia};var Cn=function(){if(this._edges=new j,this._nodes=null,this._edgeEndList=new j,arguments.length===0)this._nodes=new no(new ia);else if(arguments.length===1){var t=arguments[0];this._nodes=new no(t)}};Cn.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)}},Cn.prototype.find=function(t){return this._nodes.find(t)},Cn.prototype.addNode=function(){if(arguments[0]instanceof lu){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof U){var n=arguments[0];return this._nodes.addNode(n)}},Cn.prototype.getNodeIterator=function(){return this._nodes.iterator()},Cn.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},Cn.prototype.debugPrintln=function(t){Ge.out.println(t)},Cn.prototype.isBoundaryNode=function(t,n){var i=this._nodes.find(n);if(i===null)return!1;var a=i.getLabel();return a!==null&&a.getLocation(t)===W.BOUNDARY},Cn.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},Cn.prototype.matchInSameDirection=function(t,n,i,a){return!!t.equals(i)&&mt.computeOrientation(t,n,a)===mt.COLLINEAR&&on.quadrant(t,n)===on.quadrant(i,a)},Cn.prototype.getEdgeEnds=function(){return this._edgeEndList},Cn.prototype.debugPrint=function(t){Ge.out.print(t)},Cn.prototype.getEdgeIterator=function(){return this._edges.iterator()},Cn.prototype.findEdgeInSameDirection=function(t,n){for(var i=0;i<this._edges.size();i++){var a=this._edges.get(i),f=a.getCoordinates();if(this.matchInSameDirection(t,n,f[0],f[1])||this.matchInSameDirection(t,n,f[f.length-1],f[f.length-2]))return a}return null},Cn.prototype.insertEdge=function(t){this._edges.add(t)},Cn.prototype.findEdgeEnd=function(t){for(var n=this.getEdgeEnds().iterator();n.hasNext();){var i=n.next();if(i.getEdge()===t)return i}return null},Cn.prototype.addEdges=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next();this._edges.add(i);var a=new nl(i,!0),f=new nl(i,!1);a.setSym(f),f.setSym(a),this.add(a),this.add(f)}},Cn.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},Cn.prototype.getNodes=function(){return this._nodes.values()},Cn.prototype.findEdge=function(t,n){for(var i=0;i<this._edges.size();i++){var a=this._edges.get(i),f=a.getCoordinates();if(t.equals(f[0])&&n.equals(f[1]))return a}return null},Cn.prototype.interfaces_=function(){return[]},Cn.prototype.getClass=function(){return Cn},Cn.linkResultDirectedEdges=function(t){for(var n=t.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()};var $r=function(){this._geometryFactory=null,this._shellList=new j;var t=arguments[0];this._geometryFactory=t};$r.prototype.sortShellsAndHoles=function(t,n,i){for(var a=t.iterator();a.hasNext();){var f=a.next();f.isHole()?i.add(f):n.add(f)}},$r.prototype.computePolygons=function(t){for(var n=new j,i=t.iterator();i.hasNext();){var a=i.next().toPolygon(this._geometryFactory);n.add(a)}return n},$r.prototype.placeFreeHoles=function(t,n){for(var i=n.iterator();i.hasNext();){var a=i.next();if(a.getShell()===null){var f=this.findEdgeRingContaining(a,t);if(f===null)throw new Mo("unable to assign hole to a shell",a.getCoordinate(0));a.setShell(f)}}},$r.prototype.buildMinimalEdgeRings=function(t,n,i){for(var a=new j,f=t.iterator();f.hasNext();){var g=f.next();if(g.getMaxNodeDegree()>2){g.linkDirectedEdgesForMinimalEdgeRings();var v=g.buildMinimalRings(),M=this.findShell(v);M!==null?(this.placePolygonHoles(M,v),n.add(M)):i.addAll(v)}else a.add(g)}return a},$r.prototype.containsPoint=function(t){for(var n=this._shellList.iterator();n.hasNext();)if(n.next().containsPoint(t))return!0;return!1},$r.prototype.buildMaximalEdgeRings=function(t){for(var n=new j,i=t.iterator();i.hasNext();){var a=i.next();if(a.isInResult()&&a.getLabel().isArea()&&a.getEdgeRing()===null){var f=new Zl(a,this._geometryFactory);n.add(f),f.setInResult()}}return n},$r.prototype.placePolygonHoles=function(t,n){for(var i=n.iterator();i.hasNext();){var a=i.next();a.isHole()&&a.setShell(t)}},$r.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},$r.prototype.findEdgeRingContaining=function(t,n){for(var i=t.getLinearRing(),a=i.getEnvelopeInternal(),f=i.getCoordinateN(0),g=null,v=null,M=n.iterator();M.hasNext();){var P=M.next(),V=P.getLinearRing(),tt=V.getEnvelopeInternal();g!==null&&(v=g.getLinearRing().getEnvelopeInternal());var nt=!1;tt.contains(a)&&mt.isPointInRing(f,V.getCoordinates())&&(nt=!0),nt&&(g===null||v.contains(tt))&&(g=P)}return g},$r.prototype.findShell=function(t){for(var n=0,i=null,a=t.iterator();a.hasNext();){var f=a.next();f.isHole()||(i=f,n++)}return Nt.isTrue(n<=1,"found two shells in MinimalEdgeRing list"),i},$r.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];Cn.linkResultDirectedEdges(i);var a=this.buildMaximalEdgeRings(n),f=new j,g=this.buildMinimalEdgeRings(a,this._shellList,f);this.sortShellsAndHoles(g,this._shellList,f),this.placeFreeHoles(this._shellList,f)}},$r.prototype.interfaces_=function(){return[]},$r.prototype.getClass=function(){return $r};var gn=function(){};gn.prototype.getBounds=function(){},gn.prototype.interfaces_=function(){return[]},gn.prototype.getClass=function(){return gn};var le=function(){this._bounds=null,this._item=null;var t=arguments[0],n=arguments[1];this._bounds=t,this._item=n};le.prototype.getItem=function(){return this._item},le.prototype.getBounds=function(){return this._bounds},le.prototype.interfaces_=function(){return[gn,e]},le.prototype.getClass=function(){return le};var Bo=function(){this._size=null,this._items=null,this._size=0,this._items=new j,this._items.add(null)};Bo.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},Bo.prototype.size=function(){return this._size},Bo.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)},Bo.prototype.clear=function(){this._size=0,this._items.clear()},Bo.prototype.isEmpty=function(){return this._size===0},Bo.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)},Bo.prototype.interfaces_=function(){return[]},Bo.prototype.getClass=function(){return Bo};var jo=function(){};jo.prototype.visitItem=function(t){},jo.prototype.interfaces_=function(){return[]},jo.prototype.getClass=function(){return jo};var Bs=function(){};Bs.prototype.insert=function(t,n){},Bs.prototype.remove=function(t,n){},Bs.prototype.query=function(){},Bs.prototype.interfaces_=function(){return[]},Bs.prototype.getClass=function(){return Bs};var Jn=function(){if(this._childBoundables=new j,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this._level=t}}},Jl={serialVersionUID:{configurable:!0}};Jn.prototype.getLevel=function(){return this._level},Jn.prototype.size=function(){return this._childBoundables.size()},Jn.prototype.getChildBoundables=function(){return this._childBoundables},Jn.prototype.addChildBoundable=function(t){Nt.isTrue(this._bounds===null),this._childBoundables.add(t)},Jn.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Jn.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Jn.prototype.interfaces_=function(){return[gn,e]},Jn.prototype.getClass=function(){return Jn},Jl.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Jn,Jl);var Ui=function(){};Ui.reverseOrder=function(){return{compare:function(t,n){return n.compareTo(t)}}},Ui.min=function(t){return Ui.sort(t),t.get(0)},Ui.sort=function(t,n){var i=t.toArray();n?Fn.sort(i,n):Fn.sort(i);for(var a=t.iterator(),f=0,g=i.length;f<g;f++)a.next(),a.set(i[f])},Ui.singletonList=function(t){var n=new j;return n.add(t),n};var kn=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()};kn.prototype.expandToQueue=function(t,n){var i=kn.isComposite(this._boundable1),a=kn.isComposite(this._boundable2);if(i&&a)return kn.area(this._boundable1)>kn.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(a)return this.expand(this._boundable2,this._boundable1,t,n),null;throw new k("neither boundable is composite")},kn.prototype.isLeaves=function(){return!(kn.isComposite(this._boundable1)||kn.isComposite(this._boundable2))},kn.prototype.compareTo=function(t){var n=t;return this._distance<n._distance?-1:this._distance>n._distance?1:0},kn.prototype.expand=function(t,n,i,a){for(var f=t.getChildBoundables().iterator();f.hasNext();){var g=f.next(),v=new kn(g,n,this._itemDistance);v.getDistance()<a&&i.add(v)}},kn.prototype.getBoundable=function(t){return t===0?this._boundable1:this._boundable2},kn.prototype.getDistance=function(){return this._distance},kn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},kn.prototype.interfaces_=function(){return[Z]},kn.prototype.getClass=function(){return kn},kn.area=function(t){return t.getBounds().getArea()},kn.isComposite=function(t){return t instanceof Jn};var or=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new j,this._nodeCapacity=null,arguments.length===0){var n=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=n}else if(arguments.length===1){var i=arguments[0];Nt.isTrue(i>1,"Node capacity must be greater than 1"),this._nodeCapacity=i}},sr={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};or.prototype.getNodeCapacity=function(){return this._nodeCapacity},or.prototype.lastNode=function(t){return t.get(t.size()-1)},or.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 Jn?t+=this.size(i):i instanceof le&&(t+=1)}return t}},or.prototype.removeItem=function(t,n){for(var i=null,a=t.getChildBoundables().iterator();a.hasNext();){var f=a.next();f instanceof le&&f.getItem()===n&&(i=f)}return i!==null&&(t.getChildBoundables().remove(i),!0)},or.prototype.itemsTree=function(){if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new j:t}if(arguments.length===1){for(var n=arguments[0],i=new j,a=n.getChildBoundables().iterator();a.hasNext();){var f=a.next();if(f instanceof Jn){var g=this.itemsTree(f);g!==null&&i.add(g)}else f instanceof le?i.add(f.getItem()):Nt.shouldNeverReachHere()}return i.size()<=0?null:i}},or.prototype.insert=function(t,n){Nt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new le(t,n))},or.prototype.boundablesAtLevel=function(){if(arguments.length===1){var t=arguments[0],n=new j;return this.boundablesAtLevel(t,this._root,n),n}if(arguments.length===3){var i=arguments[0],a=arguments[1],f=arguments[2];if(Nt.isTrue(i>-2),a.getLevel()===i)return f.add(a),null;for(var g=a.getChildBoundables().iterator();g.hasNext();){var v=g.next();v instanceof Jn?this.boundablesAtLevel(i,v,f):(Nt.isTrue(v instanceof le),i===-1&&f.add(v))}return null}},or.prototype.query=function(){if(arguments.length===1){var t=arguments[0];this.build();var n=new j;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],a=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),i)&&this.query(i,this._root,a)}else if(arguments.length===3){if(yt(arguments[2],jo)&&arguments[0]instanceof Object&&arguments[1]instanceof Jn)for(var f=arguments[0],g=arguments[1],v=arguments[2],M=g.getChildBoundables(),P=0;P<M.size();P++){var V=M.get(P);this.getIntersectsOp().intersects(V.getBounds(),f)&&(V instanceof Jn?this.query(f,V,v):V instanceof le?v.visitItem(V.getItem()):Nt.shouldNeverReachHere())}else if(yt(arguments[2],at)&&arguments[0]instanceof Object&&arguments[1]instanceof Jn)for(var tt=arguments[0],nt=arguments[1],vt=arguments[2],xt=nt.getChildBoundables(),Tt=0;Tt<xt.size();Tt++){var Ut=xt.get(Tt);this.getIntersectsOp().intersects(Ut.getBounds(),tt)&&(Ut instanceof Jn?this.query(tt,Ut,vt):Ut instanceof le?vt.add(Ut.getItem()):Nt.shouldNeverReachHere())}}},or.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},or.prototype.getRoot=function(){return this.build(),this._root},or.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],a=arguments[1],f=arguments[2],g=this.removeItem(a,f);if(g)return!0;for(var v=null,M=a.getChildBoundables().iterator();M.hasNext();){var P=M.next();if(this.getIntersectsOp().intersects(P.getBounds(),i)&&P instanceof Jn&&(g=this.remove(i,P,f))){v=P;break}}return v!==null&&v.getChildBoundables().isEmpty()&&a.getChildBoundables().remove(v),g}},or.prototype.createHigherLevels=function(t,n){Nt.isTrue(!t.isEmpty());var i=this.createParentBoundables(t,n+1);return i.size()===1?i.get(0):this.createHigherLevels(i,n+1)},or.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 Jn){var a=this.depth(i);a>t&&(t=a)}}return t+1}},or.prototype.createParentBoundables=function(t,n){Nt.isTrue(!t.isEmpty());var i=new j;i.add(this.createNode(n));var a=new j(t);Ui.sort(a,this.getComparator());for(var f=a.iterator();f.hasNext();){var g=f.next();this.lastNode(i).getChildBoundables().size()===this.getNodeCapacity()&&i.add(this.createNode(n)),this.lastNode(i).addChildBoundable(g)}return i},or.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},or.prototype.interfaces_=function(){return[e]},or.prototype.getClass=function(){return or},or.compareDoubles=function(t,n){return t>n?1:t<n?-1:0},sr.IntersectsOp.get=function(){return rl},sr.serialVersionUID.get=function(){return-3886435814360241e3},sr.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(or,sr);var rl=function(){},ro=function(){};ro.prototype.distance=function(t,n){},ro.prototype.interfaces_=function(){return[]},ro.prototype.getClass=function(){return ro};var il=function(t){function n(a){a=a||n.DEFAULT_NODE_CAPACITY,t.call(this,a)}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(a,f){Nt.isTrue(a.length>0);for(var g=new j,v=0;v<a.length;v++)g.addAll(this.createParentBoundablesFromVerticalSlice(a[v],f));return g},n.prototype.createNode=function(a){return new cu(a)},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 a=arguments[0],f=arguments[1];if(a.isNull())return null;t.prototype.insert.call(this,a,f)},n.prototype.getIntersectsOp=function(){return n.intersectsOp},n.prototype.verticalSlices=function(a,f){for(var g=Math.trunc(Math.ceil(a.size()/f)),v=new Array(f).fill(null),M=a.iterator(),P=0;P<f;P++){v[P]=new j;for(var V=0;M.hasNext()&&V<g;){var tt=M.next();v[P].add(tt),V++}}return v},n.prototype.query=function(){if(arguments.length===1){var a=arguments[0];return t.prototype.query.call(this,a)}if(arguments.length===2){var f=arguments[0],g=arguments[1];t.prototype.query.call(this,f,g)}else if(arguments.length===3){if(yt(arguments[2],jo)&&arguments[0]instanceof Object&&arguments[1]instanceof Jn){var v=arguments[0],M=arguments[1],P=arguments[2];t.prototype.query.call(this,v,M,P)}else if(yt(arguments[2],at)&&arguments[0]instanceof Object&&arguments[1]instanceof Jn){var V=arguments[0],tt=arguments[1],nt=arguments[2];t.prototype.query.call(this,V,tt,nt)}}},n.prototype.getComparator=function(){return n.yComparator},n.prototype.createParentBoundablesFromVerticalSlice=function(a,f){return t.prototype.createParentBoundables.call(this,a,f)},n.prototype.remove=function(){if(arguments.length===2){var a=arguments[0],f=arguments[1];return t.prototype.remove.call(this,a,f)}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(a,f){Nt.isTrue(!a.isEmpty());var g=Math.trunc(Math.ceil(a.size()/this.getNodeCapacity())),v=new j(a);Ui.sort(v,n.xComparator);var M=this.verticalSlices(v,Math.trunc(Math.ceil(Math.sqrt(g))));return this.createParentBoundablesFromVerticalSlices(M,f)},n.prototype.nearestNeighbour=function(){if(arguments.length===1){if(yt(arguments[0],ro)){var a=arguments[0],f=new kn(this.getRoot(),this.getRoot(),a);return this.nearestNeighbour(f)}if(arguments[0]instanceof kn){var g=arguments[0];return this.nearestNeighbour(g,F.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof n&&yt(arguments[1],ro)){var v=arguments[0],M=arguments[1],P=new kn(this.getRoot(),v.getRoot(),M);return this.nearestNeighbour(P)}if(arguments[0]instanceof kn&&typeof arguments[1]=="number"){var V=arguments[0],tt=arguments[1],nt=null,vt=new Bo;for(vt.add(V);!vt.isEmpty()&&tt>0;){var xt=vt.poll(),Tt=xt.getDistance();if(Tt>=tt)break;xt.isLeaves()?(tt=Tt,nt=xt):xt.expandToQueue(vt,tt)}return[nt.getBoundable(0).getItem(),nt.getBoundable(1).getItem()]}}else if(arguments.length===3){var Ut=arguments[0],We=arguments[1],cn=arguments[2],Fr=new le(Ut,We),Ro=new kn(this.getRoot(),Fr,cn);return this.nearestNeighbour(Ro)[0]}},n.prototype.interfaces_=function(){return[Bs,e]},n.prototype.getClass=function(){return n},n.centreX=function(a){return n.avg(a.getMinX(),a.getMaxX())},n.avg=function(a,f){return(a+f)/2},n.centreY=function(a){return n.avg(a.getMinY(),a.getMaxY())},i.STRtreeNode.get=function(){return cu},i.serialVersionUID.get=function(){return 0x39920f7d5f261e0},i.xComparator.get=function(){return{interfaces_:function(){return[et]},compare:function(a,f){return t.compareDoubles(n.centreX(a.getBounds()),n.centreX(f.getBounds()))}}},i.yComparator.get=function(){return{interfaces_:function(){return[et]},compare:function(a,f){return t.compareDoubles(n.centreY(a.getBounds()),n.centreY(f.getBounds()))}}},i.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(a,f){return a.intersects(f)}}},i.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(n,i),n}(or),cu=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,a=this.getChildBoundables().iterator();a.hasNext();){var f=a.next();i===null?i=new Et(f.getBounds()):i.expandToInclude(f.getBounds())}return i},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Jn),Mn=function(){};Mn.prototype.interfaces_=function(){return[]},Mn.prototype.getClass=function(){return Mn},Mn.relativeSign=function(t,n){return t<n?-1:t>n?1:0},Mn.compare=function(t,n,i){if(n.equals2D(i))return 0;var a=Mn.relativeSign(n.x,i.x),f=Mn.relativeSign(n.y,i.y);switch(t){case 0:return Mn.compareValue(a,f);case 1:return Mn.compareValue(f,a);case 2:return Mn.compareValue(f,-a);case 3:return Mn.compareValue(-a,f);case 4:return Mn.compareValue(-a,-f);case 5:return Mn.compareValue(-f,-a);case 6:return Mn.compareValue(-f,a);case 7:return Mn.compareValue(a,-f)}return Nt.shouldNeverReachHere("invalid octant value"),0},Mn.compareValue=function(t,n){return t<0?-1:t>0?1:n<0?-1:n>0?1:0};var zo=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],a=arguments[3];this._segString=t,this.coord=new U(n),this.segmentIndex=i,this._segmentOctant=a,this._isInterior=!n.equals2D(t.getCoordinate(i))};zo.prototype.getCoordinate=function(){return this.coord},zo.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},zo.prototype.compareTo=function(t){var n=t;return this.segmentIndex<n.segmentIndex?-1:this.segmentIndex>n.segmentIndex?1:this.coord.equals2D(n.coord)?0:Mn.compare(this._segmentOctant,this.coord,n.coord)},zo.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t},zo.prototype.isInterior=function(){return this._isInterior},zo.prototype.interfaces_=function(){return[Z]},zo.prototype.getClass=function(){return zo};var Sr=function(){this._nodeMap=new b,this._edge=null;var t=arguments[0];this._edge=t};Sr.prototype.getSplitCoordinates=function(){var t=new ft;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var a=n.next();this.addEdgeCoordinates(i,a,t),i=a}return t.toCoordinateArray()},Sr.prototype.addCollapsedNodes=function(){var t=new j;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)}},Sr.prototype.print=function(t){t.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(t)},Sr.prototype.findCollapsesFromExistingVertices=function(t){for(var n=0;n<this._edge.size()-2;n++){var i=this._edge.getCoordinate(n),a=this._edge.getCoordinate(n+2);i.equals2D(a)&&t.add(new _t(n+1))}},Sr.prototype.addEdgeCoordinates=function(t,n,i){var a=this._edge.getCoordinate(n.segmentIndex),f=n.isInterior()||!n.coord.equals2D(a);i.add(new U(t.coord),!1);for(var g=t.segmentIndex+1;g<=n.segmentIndex;g++)i.add(this._edge.getCoordinate(g));f&&i.add(new U(n.coord))},Sr.prototype.iterator=function(){return this._nodeMap.values().iterator()},Sr.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var n=this.iterator(),i=n.next();n.hasNext();){var a=n.next(),f=this.createSplitEdge(i,a);t.add(f),i=a}},Sr.prototype.findCollapseIndex=function(t,n,i){if(!t.coord.equals2D(n.coord))return!1;var a=n.segmentIndex-t.segmentIndex;return n.isInterior()||a--,a===1&&(i[0]=t.segmentIndex+1,!0)},Sr.prototype.findCollapsesFromInsertedNodes=function(t){for(var n=new Array(1).fill(null),i=this.iterator(),a=i.next();i.hasNext();){var f=i.next();this.findCollapseIndex(a,f,n)&&t.add(new _t(n[0])),a=f}},Sr.prototype.getEdge=function(){return this._edge},Sr.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},Sr.prototype.createSplitEdge=function(t,n){var i=n.segmentIndex-t.segmentIndex+2,a=this._edge.getCoordinate(n.segmentIndex),f=n.isInterior()||!n.coord.equals2D(a);f||i--;var g=new Array(i).fill(null),v=0;g[v++]=new U(t.coord);for(var M=t.segmentIndex+1;M<=n.segmentIndex;M++)g[v++]=this._edge.getCoordinate(M);return f&&(g[v]=new U(n.coord)),new Rn(g,this._edge.getData())},Sr.prototype.add=function(t,n){var i=new zo(this._edge,t,n,this._edge.getSegmentOctant(n)),a=this._nodeMap.get(i);return a!==null?(Nt.isTrue(a.coord.equals2D(t),"Found equal nodes with different coordinates"),a):(this._nodeMap.put(i,i),i)},Sr.prototype.checkSplitEdgesCorrectness=function(t){var n=this._edge.getCoordinates(),i=t.get(0).getCoordinate(0);if(!i.equals2D(n[0]))throw new xr("bad split edge start point at "+i);var a=t.get(t.size()-1).getCoordinates(),f=a[a.length-1];if(!f.equals2D(n[n.length-1]))throw new xr("bad split edge end point at "+f)},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr};var ds=function(){};ds.prototype.interfaces_=function(){return[]},ds.prototype.getClass=function(){return ds},ds.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 k("Cannot compute the octant for point ( "+t+", "+n+" )");var i=Math.abs(t),a=Math.abs(n);return t>=0?n>=0?i>=a?0:1:i>=a?7:6:n>=0?i>=a?3:2:i>=a?4:5}if(arguments[0]instanceof U&&arguments[1]instanceof U){var f=arguments[0],g=arguments[1],v=g.x-f.x,M=g.y-f.y;if(v===0&&M===0)throw new k("Cannot compute the octant for two identical points "+f);return ds.octant(v,M)}};var io=function(){};io.prototype.getCoordinates=function(){},io.prototype.size=function(){},io.prototype.getCoordinate=function(t){},io.prototype.isClosed=function(){},io.prototype.setData=function(t){},io.prototype.getData=function(){},io.prototype.interfaces_=function(){return[]},io.prototype.getClass=function(){return io};var oa=function(){};oa.prototype.addIntersection=function(t,n){},oa.prototype.interfaces_=function(){return[io]},oa.prototype.getClass=function(){return oa};var Rn=function(){this._nodeList=new Sr(this),this._pts=null,this._data=null;var t=arguments[0],n=arguments[1];this._pts=t,this._data=n};Rn.prototype.getCoordinates=function(){return this._pts},Rn.prototype.size=function(){return this._pts.length},Rn.prototype.getCoordinate=function(t){return this._pts[t]},Rn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Rn.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},Rn.prototype.setData=function(t){this._data=t},Rn.prototype.safeOctant=function(t,n){return t.equals2D(n)?0:ds.octant(t,n)},Rn.prototype.getData=function(){return this._data},Rn.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],a=arguments[1],f=arguments[3],g=new U(i.getIntersection(f));this.addIntersection(g,a)}},Rn.prototype.toString=function(){return On.toLineString(new Pn(this._pts))},Rn.prototype.getNodeList=function(){return this._nodeList},Rn.prototype.addIntersectionNode=function(t,n){var i=n,a=i+1;if(a<this._pts.length){var f=this._pts[a];t.equals2D(f)&&(i=a)}return this._nodeList.add(t,i)},Rn.prototype.addIntersections=function(t,n,i){for(var a=0;a<t.getIntersectionNum();a++)this.addIntersection(t,n,i,a)},Rn.prototype.interfaces_=function(){return[oa]},Rn.prototype.getClass=function(){return Rn},Rn.getNodedSubstrings=function(){if(arguments.length===1){var t=arguments[0],n=new j;return Rn.getNodedSubstrings(t,n),n}if(arguments.length===2)for(var i=arguments[0],a=arguments[1],f=i.iterator();f.hasNext();)f.next().getNodeList().addSplitEdges(a)};var bt=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new U,this.p1=new U;else if(arguments.length===1){var t=arguments[0];this.p0=new U(t.p0),this.p1=new U(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],a=arguments[2],f=arguments[3];this.p0=new U(n,i),this.p1=new U(a,f)}},Kl={serialVersionUID:{configurable:!0}};bt.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},bt.prototype.orientationIndex=function(){if(arguments[0]instanceof bt){var t=arguments[0],n=mt.orientationIndex(this.p0,this.p1,t.p0),i=mt.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 U){var a=arguments[0];return mt.orientationIndex(this.p0,this.p1,a)}},bt.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},bt.prototype.isVertical=function(){return this.p0.x===this.p1.x},bt.prototype.equals=function(t){if(!(t instanceof bt))return!1;var n=t;return this.p0.equals(n.p0)&&this.p1.equals(n.p1)},bt.prototype.intersection=function(t){var n=new Mi;return n.computeIntersection(this.p0,this.p1,t.p0,t.p1),n.hasIntersection()?n.getIntersection(0):null},bt.prototype.project=function(){if(arguments[0]instanceof U){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new U(t);var n=this.projectionFactor(t),i=new U;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 bt){var a=arguments[0],f=this.projectionFactor(a.p0),g=this.projectionFactor(a.p1);if(f>=1&&g>=1||f<=0&&g<=0)return null;var v=this.project(a.p0);f<0&&(v=this.p0),f>1&&(v=this.p1);var M=this.project(a.p1);return g<0&&(M=this.p0),g>1&&(M=this.p1),new bt(v,M)}},bt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},bt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},bt.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1},bt.prototype.distancePerpendicular=function(t){return mt.distancePointLinePerpendicular(t,this.p0,this.p1)},bt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},bt.prototype.midPoint=function(){return bt.midPoint(this.p0,this.p1)},bt.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,a=n*n+i*i;return a<=0?F.NaN:((t.x-this.p0.x)*n+(t.y-this.p0.y)*i)/a},bt.prototype.closestPoints=function(t){var n=this.intersection(t);if(n!==null)return[n,n];var i=new Array(2).fill(null),a=F.MAX_VALUE,f=null,g=this.closestPoint(t.p0);a=g.distance(t.p0),i[0]=g,i[1]=t.p0;var v=this.closestPoint(t.p1);(f=v.distance(t.p1))<a&&(a=f,i[0]=v,i[1]=t.p1);var M=t.closestPoint(this.p0);(f=M.distance(this.p0))<a&&(a=f,i[0]=this.p0,i[1]=M);var P=t.closestPoint(this.p1);return(f=P.distance(this.p1))<a&&(a=f,i[0]=this.p1,i[1]=P),i},bt.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},bt.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},bt.prototype.getLength=function(){return this.p0.distance(this.p1)},bt.prototype.compareTo=function(t){var n=t,i=this.p0.compareTo(n.p0);return i!==0?i:this.p1.compareTo(n.p1)},bt.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},bt.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)},bt.prototype.lineIntersection=function(t){try{return an.intersection(this.p0,this.p1,t.p0,t.p1)}catch(n){if(!(n instanceof yn))throw n}return null},bt.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},bt.prototype.pointAlongOffset=function(t,n){var i=this.p0.x+t*(this.p1.x-this.p0.x),a=this.p0.y+t*(this.p1.y-this.p0.y),f=this.p1.x-this.p0.x,g=this.p1.y-this.p0.y,v=Math.sqrt(f*f+g*g),M=0,P=0;if(n!==0){if(v<=0)throw new Error("Cannot compute offset from zero-length line segment");M=n*f/v,P=n*g/v}return new U(i-P,a+M)},bt.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}},bt.prototype.segmentFraction=function(t){var n=this.projectionFactor(t);return n<0?n=0:(n>1||F.isNaN(n))&&(n=1),n},bt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},bt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},bt.prototype.distance=function(){if(arguments[0]instanceof bt){var t=arguments[0];return mt.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof U){var n=arguments[0];return mt.distancePointLine(n,this.p0,this.p1)}},bt.prototype.pointAlong=function(t){var n=new U;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},bt.prototype.hashCode=function(){var t=F.doubleToLongBits(this.p0.x);t^=31*F.doubleToLongBits(this.p0.y);var n=Math.trunc(t)^Math.trunc(t>>32),i=F.doubleToLongBits(this.p1.x);return i^=31*F.doubleToLongBits(this.p1.y),n^(Math.trunc(i)^Math.trunc(i>>32))},bt.prototype.interfaces_=function(){return[Z,e]},bt.prototype.getClass=function(){return bt},bt.midPoint=function(t,n){return new U((t.x+n.x)/2,(t.y+n.y)/2)},Kl.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(bt,Kl);var Zr=function(){this.tempEnv1=new Et,this.tempEnv2=new Et,this._overlapSeg1=new bt,this._overlapSeg2=new bt};Zr.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var t=arguments[0],n=arguments[1],i=arguments[2],a=arguments[3];t.getLineSegment(n,this._overlapSeg1),i.getLineSegment(a,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},Zr.prototype.interfaces_=function(){return[]},Zr.prototype.getClass=function(){return Zr};var Jr=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],a=arguments[3];this._pts=t,this._start=n,this._end=i,this._context=a};Jr.prototype.getLineSegment=function(t,n){n.p0=this._pts[t],n.p1=this._pts[t+1]},Jr.prototype.computeSelect=function(t,n,i,a){var f=this._pts[n],g=this._pts[i];if(a.tempEnv1.init(f,g),i-n==1)return a.select(this,n),null;if(!t.intersects(a.tempEnv1))return null;var v=Math.trunc((n+i)/2);n<v&&this.computeSelect(t,n,v,a),v<i&&this.computeSelect(t,v,i,a)},Jr.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},Jr.prototype.computeOverlaps=function(t,n){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,n)},Jr.prototype.setId=function(t){this._id=t},Jr.prototype.select=function(t,n){this.computeSelect(t,this._start,this._end,n)},Jr.prototype.getEnvelope=function(){if(this._env===null){var t=this._pts[this._start],n=this._pts[this._end];this._env=new Et(t,n)}return this._env},Jr.prototype.getEndIndex=function(){return this._end},Jr.prototype.getStartIndex=function(){return this._start},Jr.prototype.getContext=function(){return this._context},Jr.prototype.getId=function(){return this._id},Jr.prototype.computeOverlapsInternal=function(t,n,i,a,f,g){var v=this._pts[t],M=this._pts[n],P=i._pts[a],V=i._pts[f];if(n-t==1&&f-a==1)return g.overlap(this,t,i,a),null;if(g.tempEnv1.init(v,M),g.tempEnv2.init(P,V),!g.tempEnv1.intersects(g.tempEnv2))return null;var tt=Math.trunc((t+n)/2),nt=Math.trunc((a+f)/2);t<tt&&(a<nt&&this.computeOverlapsInternal(t,tt,i,a,nt,g),nt<f&&this.computeOverlapsInternal(t,tt,i,nt,f,g)),tt<n&&(a<nt&&this.computeOverlapsInternal(tt,n,i,a,nt,g),nt<f&&this.computeOverlapsInternal(tt,n,i,nt,f,g))},Jr.prototype.interfaces_=function(){return[]},Jr.prototype.getClass=function(){return Jr};var Bi=function(){};Bi.prototype.interfaces_=function(){return[]},Bi.prototype.getClass=function(){return Bi},Bi.getChainStartIndices=function(t){var n=0,i=new j;i.add(new _t(n));do{var a=Bi.findChainEnd(t,n);i.add(new _t(a)),n=a}while(n<t.length-1);return Bi.toIntArray(i)},Bi.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 a=on.quadrant(t[i],t[i+1]),f=n+1;f<t.length&&!(!t[f-1].equals2D(t[f])&&on.quadrant(t[f-1],t[f])!==a);)f++;return f-1},Bi.getChains=function(){if(arguments.length===1){var t=arguments[0];return Bi.getChains(t,null)}if(arguments.length===2){for(var n=arguments[0],i=arguments[1],a=new j,f=Bi.getChainStartIndices(n),g=0;g<f.length-1;g++){var v=new Jr(n,f[g],f[g+1],i);a.add(v)}return a}},Bi.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 fi=function(){};fi.prototype.computeNodes=function(t){},fi.prototype.getNodedSubstrings=function(){},fi.prototype.interfaces_=function(){return[]},fi.prototype.getClass=function(){return fi};var gs=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setSegmentIntersector(t)}}};gs.prototype.setSegmentIntersector=function(t){this._segInt=t},gs.prototype.interfaces_=function(){return[fi]},gs.prototype.getClass=function(){return gs};var ka=function(t){function n(a){a?t.call(this,a):t.call(this),this._monoChains=new j,this._index=new il,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 Rn.getNodedSubstrings(this._nodedSegStrings)},n.prototype.getIndex=function(){return this._index},n.prototype.add=function(a){for(var f=Bi.getChains(a.getCoordinates(),a).iterator();f.hasNext();){var g=f.next();g.setId(this._idCounter++),this._index.insert(g.getEnvelope(),g),this._monoChains.add(g)}},n.prototype.computeNodes=function(a){this._nodedSegStrings=a;for(var f=a.iterator();f.hasNext();)this.add(f.next());this.intersectChains()},n.prototype.intersectChains=function(){for(var a=new Gn(this._segInt),f=this._monoChains.iterator();f.hasNext();)for(var g=f.next(),v=this._index.query(g.getEnvelope()).iterator();v.hasNext();){var M=v.next();if(M.getId()>g.getId()&&(g.computeOverlaps(M,a),this._nOverlaps++),this._segInt.isDone())return null}},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},i.SegmentOverlapAction.get=function(){return Gn},Object.defineProperties(n,i),n}(gs),Gn=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],a=arguments[1],f=arguments[2],g=arguments[3],v=i.getContext(),M=f.getContext();this._si.processIntersections(v,a,M,g)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Zr),jt=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],a=arguments[1];this.setQuadrantSegments(i),this.setEndCapStyle(a)}else if(arguments.length===4){var f=arguments[0],g=arguments[1],v=arguments[2],M=arguments[3];this.setQuadrantSegments(f),this.setEndCapStyle(g),this.setJoinStyle(v),this.setMitreLimit(M)}}},oo={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}};jt.prototype.getEndCapStyle=function(){return this._endCapStyle},jt.prototype.isSingleSided=function(){return this._isSingleSided},jt.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=jt.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=jt.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==jt.JOIN_ROUND&&(this._quadrantSegments=jt.DEFAULT_QUADRANT_SEGMENTS)},jt.prototype.getJoinStyle=function(){return this._joinStyle},jt.prototype.setJoinStyle=function(t){this._joinStyle=t},jt.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},jt.prototype.getSimplifyFactor=function(){return this._simplifyFactor},jt.prototype.getQuadrantSegments=function(){return this._quadrantSegments},jt.prototype.setEndCapStyle=function(t){this._endCapStyle=t},jt.prototype.getMitreLimit=function(){return this._mitreLimit},jt.prototype.setMitreLimit=function(t){this._mitreLimit=t},jt.prototype.setSingleSided=function(t){this._isSingleSided=t},jt.prototype.interfaces_=function(){return[]},jt.prototype.getClass=function(){return jt},jt.bufferDistanceError=function(t){var n=Math.PI/2/t;return 1-Math.cos(n/2)},oo.CAP_ROUND.get=function(){return 1},oo.CAP_FLAT.get=function(){return 2},oo.CAP_SQUARE.get=function(){return 3},oo.JOIN_ROUND.get=function(){return 1},oo.JOIN_MITRE.get=function(){return 2},oo.JOIN_BEVEL.get=function(){return 3},oo.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},oo.DEFAULT_MITRE_LIMIT.get=function(){return 5},oo.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(jt,oo);var Ln=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=mt.COUNTERCLOCKWISE,this._inputLine=t||null},zs={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Ln.prototype.isDeletable=function(t,n,i,a){var f=this._inputLine[t],g=this._inputLine[n],v=this._inputLine[i];return!!this.isConcave(f,g,v)&&!!this.isShallow(f,g,v,a)&&this.isShallowSampled(f,g,t,i,a)},Ln.prototype.deleteShallowConcavities=function(){for(var t=1,n=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(n),a=!1;i<this._inputLine.length;){var f=!1;this.isDeletable(t,n,i,this._distanceTol)&&(this._isDeleted[n]=Ln.DELETE,f=!0,a=!0),t=f?i:n,n=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(n)}return a},Ln.prototype.isShallowConcavity=function(t,n,i,a){return mt.computeOrientation(t,n,i)!==this._angleOrientation?!1:mt.distancePointLine(n,t,i)<a},Ln.prototype.isShallowSampled=function(t,n,i,a,f){var g=Math.trunc((a-i)/Ln.NUM_PTS_TO_CHECK);g<=0&&(g=1);for(var v=i;v<a;v+=g)if(!this.isShallow(t,n,this._inputLine[v],f))return!1;return!0},Ln.prototype.isConcave=function(t,n,i){var a=mt.computeOrientation(t,n,i)===this._angleOrientation;return a},Ln.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=mt.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var n=!1;do n=this.deleteShallowConcavities();while(n);return this.collapseLine()},Ln.prototype.findNextNonDeletedIndex=function(t){for(var n=t+1;n<this._inputLine.length&&this._isDeleted[n]===Ln.DELETE;)n++;return n},Ln.prototype.isShallow=function(t,n,i,a){return mt.distancePointLine(n,t,i)<a},Ln.prototype.collapseLine=function(){for(var t=new ft,n=0;n<this._inputLine.length;n++)this._isDeleted[n]!==Ln.DELETE&&t.add(this._inputLine[n]);return t.toCoordinateArray()},Ln.prototype.interfaces_=function(){return[]},Ln.prototype.getClass=function(){return Ln},Ln.simplify=function(t,n){return new Ln(t).simplify(n)},zs.INIT.get=function(){return 0},zs.DELETE.get=function(){return 1},zs.KEEP.get=function(){return 1},zs.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Ln,zs);var hi=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new j},Ql={COORDINATE_ARRAY_TYPE:{configurable:!0}};hi.prototype.getCoordinates=function(){return this._ptList.toArray(hi.COORDINATE_ARRAY_TYPE)},hi.prototype.setPrecisionModel=function(t){this._precisionModel=t},hi.prototype.addPt=function(t){var n=new U(t);if(this._precisionModel.makePrecise(n),this.isRedundant(n))return null;this._ptList.add(n)},hi.prototype.revere=function(){},hi.prototype.addPts=function(t,n){if(n)for(var i=0;i<t.length;i++)this.addPt(t[i]);else for(var a=t.length-1;a>=0;a--)this.addPt(t[a])},hi.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},hi.prototype.toString=function(){return new Qt().createLineString(this.getCoordinates()).toString()},hi.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new U(this._ptList.get(0)),n=this._ptList.get(this._ptList.size()-1);if(t.equals(n))return null;this._ptList.add(t)},hi.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},hi.prototype.interfaces_=function(){return[]},hi.prototype.getClass=function(){return hi},Ql.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(hi,Ql);var ee=function(){},ms={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};ee.prototype.interfaces_=function(){return[]},ee.prototype.getClass=function(){return ee},ee.toDegrees=function(t){return 180*t/Math.PI},ee.normalize=function(t){for(;t>Math.PI;)t-=ee.PI_TIMES_2;for(;t<=-Math.PI;)t+=ee.PI_TIMES_2;return t},ee.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],a=i.x-n.x,f=i.y-n.y;return Math.atan2(f,a)}},ee.isAcute=function(t,n,i){var a=t.x-n.x,f=t.y-n.y;return a*(i.x-n.x)+f*(i.y-n.y)>0},ee.isObtuse=function(t,n,i){var a=t.x-n.x,f=t.y-n.y;return a*(i.x-n.x)+f*(i.y-n.y)<0},ee.interiorAngle=function(t,n,i){var a=ee.angle(n,t),f=ee.angle(n,i);return Math.abs(f-a)},ee.normalizePositive=function(t){if(t<0){for(;t<0;)t+=ee.PI_TIMES_2;t>=ee.PI_TIMES_2&&(t=0)}else{for(;t>=ee.PI_TIMES_2;)t-=ee.PI_TIMES_2;t<0&&(t=0)}return t},ee.angleBetween=function(t,n,i){var a=ee.angle(n,t),f=ee.angle(n,i);return ee.diff(a,f)},ee.diff=function(t,n){var i=null;return(i=t<n?n-t:t-n)>Math.PI&&(i=2*Math.PI-i),i},ee.toRadians=function(t){return t*Math.PI/180},ee.getTurn=function(t,n){var i=Math.sin(n-t);return i>0?ee.COUNTERCLOCKWISE:i<0?ee.CLOCKWISE:ee.NONE},ee.angleBetweenOriented=function(t,n,i){var a=ee.angle(n,t),f=ee.angle(n,i)-a;return f<=-Math.PI?f+ee.PI_TIMES_2:f>Math.PI?f-ee.PI_TIMES_2:f},ms.PI_TIMES_2.get=function(){return 2*Math.PI},ms.PI_OVER_2.get=function(){return Math.PI/2},ms.PI_OVER_4.get=function(){return Math.PI/4},ms.COUNTERCLOCKWISE.get=function(){return mt.COUNTERCLOCKWISE},ms.CLOCKWISE.get=function(){return mt.CLOCKWISE},ms.NONE.get=function(){return mt.COLLINEAR},Object.defineProperties(ee,ms);var ln=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 bt,this._seg1=new bt,this._offset0=new bt,this._offset1=new bt,this._side=0,this._hasNarrowConcaveAngle=!1;var n=arguments[0],i=arguments[1],a=arguments[2];this._precisionModel=n,this._bufParams=i,this._li=new Mi,this._filletAngleQuantum=Math.PI/2/i.getQuadrantSegments(),i.getQuadrantSegments()>=8&&i.getJoinStyle()===jt.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(a)},ko={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}};ln.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=mt.computeOrientation(this._s0,this._s1,this._s2),a=i===mt.CLOCKWISE&&this._side===dt.LEFT||i===mt.COUNTERCLOCKWISE&&this._side===dt.RIGHT;i===0?this.addCollinear(n):a?this.addOutsideTurn(i,n):this.addInsideTurn(i,n)},ln.prototype.addLineEndCap=function(t,n){var i=new bt(t,n),a=new bt;this.computeOffsetSegment(i,dt.LEFT,this._distance,a);var f=new bt;this.computeOffsetSegment(i,dt.RIGHT,this._distance,f);var g=n.x-t.x,v=n.y-t.y,M=Math.atan2(v,g);switch(this._bufParams.getEndCapStyle()){case jt.CAP_ROUND:this._segList.addPt(a.p1),this.addFilletArc(n,M+Math.PI/2,M-Math.PI/2,mt.CLOCKWISE,this._distance),this._segList.addPt(f.p1);break;case jt.CAP_FLAT:this._segList.addPt(a.p1),this._segList.addPt(f.p1);break;case jt.CAP_SQUARE:var P=new U;P.x=Math.abs(this._distance)*Math.cos(M),P.y=Math.abs(this._distance)*Math.sin(M);var V=new U(a.p1.x+P.x,a.p1.y+P.y),tt=new U(f.p1.x+P.x,f.p1.y+P.y);this._segList.addPt(V),this._segList.addPt(tt)}},ln.prototype.getCoordinates=function(){return this._segList.getCoordinates()},ln.prototype.addMitreJoin=function(t,n,i,a){var f=!0,g=null;try{g=an.intersection(n.p0,n.p1,i.p0,i.p1),(a<=0?1:g.distance(t)/Math.abs(a))>this._bufParams.getMitreLimit()&&(f=!1)}catch(v){if(!(v instanceof yn))throw v;g=new U(0,0),f=!1}f?this._segList.addPt(g):this.addLimitedMitreJoin(n,i,a,this._bufParams.getMitreLimit())},ln.prototype.addFilletCorner=function(t,n,i,a,f){var g=n.x-t.x,v=n.y-t.y,M=Math.atan2(v,g),P=i.x-t.x,V=i.y-t.y,tt=Math.atan2(V,P);a===mt.CLOCKWISE?M<=tt&&(M+=2*Math.PI):M>=tt&&(M-=2*Math.PI),this._segList.addPt(n),this.addFilletArc(t,M,tt,a,f),this._segList.addPt(i)},ln.prototype.addOutsideTurn=function(t,n){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*ln.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===jt.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===jt.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))},ln.prototype.createSquare=function(t){this._segList.addPt(new U(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new U(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new U(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new U(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},ln.prototype.addSegments=function(t,n){this._segList.addPts(t,n)},ln.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},ln.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},ln.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)},ln.prototype.addLimitedMitreJoin=function(t,n,i,a){var f=this._seg0.p1,g=ee.angle(f,this._seg0.p0),v=ee.angleBetweenOriented(this._seg0.p0,f,this._seg1.p1)/2,M=ee.normalize(g+v),P=ee.normalize(M+Math.PI),V=a*i,tt=i-V*Math.abs(Math.sin(v)),nt=f.x+V*Math.cos(P),vt=f.y+V*Math.sin(P),xt=new U(nt,vt),Tt=new bt(f,xt),Ut=Tt.pointAlongOffset(1,tt),We=Tt.pointAlongOffset(1,-tt);this._side===dt.LEFT?(this._segList.addPt(Ut),this._segList.addPt(We)):(this._segList.addPt(We),this._segList.addPt(Ut))},ln.prototype.computeOffsetSegment=function(t,n,i,a){var f=n===dt.LEFT?1:-1,g=t.p1.x-t.p0.x,v=t.p1.y-t.p0.y,M=Math.sqrt(g*g+v*v),P=f*i*g/M,V=f*i*v/M;a.p0.x=t.p0.x-V,a.p0.y=t.p0.y+P,a.p1.x=t.p1.x-V,a.p1.y=t.p1.y+P},ln.prototype.addFilletArc=function(t,n,i,a,f){var g=a===mt.CLOCKWISE?-1:1,v=Math.abs(n-i),M=Math.trunc(v/this._filletAngleQuantum+.5);if(M<1)return null;for(var P=v/M,V=0,tt=new U;V<v;){var nt=n+g*V;tt.x=t.x+f*Math.cos(nt),tt.y=t.y+f*Math.sin(nt),this._segList.addPt(tt),V+=P}},ln.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*ln.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 U((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 a=new U((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(a)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},ln.prototype.createCircle=function(t){var n=new U(t.x+this._distance,t.y);this._segList.addPt(n),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},ln.prototype.addBevelJoin=function(t,n){this._segList.addPt(t.p1),this._segList.addPt(n.p0)},ln.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new hi,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*ln.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},ln.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===jt.JOIN_BEVEL||this._bufParams.getJoinStyle()===jt.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,mt.CLOCKWISE,this._distance))},ln.prototype.closeRing=function(){this._segList.closeRing()},ln.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},ln.prototype.interfaces_=function(){return[]},ln.prototype.getClass=function(){return ln},ko.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},ko.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},ko.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},ko.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(ln,ko);var Br=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],n=arguments[1];this._precisionModel=t,this._bufParams=n};Br.prototype.getOffsetCurve=function(t,n){if(this._distance=n,n===0)return null;var i=n<0,a=Math.abs(n),f=this.getSegGen(a);t.length<=1?this.computePointCurve(t[0],f):this.computeOffsetCurve(t,i,f);var g=f.getCoordinates();return i&<.reverse(g),g},Br.prototype.computeSingleSidedBufferCurve=function(t,n,i){var a=this.simplifyTolerance(this._distance);if(n){i.addSegments(t,!0);var f=Ln.simplify(t,-a),g=f.length-1;i.initSideSegments(f[g],f[g-1],dt.LEFT),i.addFirstSegment();for(var v=g-2;v>=0;v--)i.addNextSegment(f[v],!0)}else{i.addSegments(t,!1);var M=Ln.simplify(t,a),P=M.length-1;i.initSideSegments(M[0],M[1],dt.LEFT),i.addFirstSegment();for(var V=2;V<=P;V++)i.addNextSegment(M[V],!0)}i.addLastSegment(),i.closeRing()},Br.prototype.computeRingBufferCurve=function(t,n,i){var a=this.simplifyTolerance(this._distance);n===dt.RIGHT&&(a=-a);var f=Ln.simplify(t,a),g=f.length-1;i.initSideSegments(f[g-1],f[0],n);for(var v=1;v<=g;v++){var M=v!==1;i.addNextSegment(f[v],M)}i.closeRing()},Br.prototype.computeLineBufferCurve=function(t,n){var i=this.simplifyTolerance(this._distance),a=Ln.simplify(t,i),f=a.length-1;n.initSideSegments(a[0],a[1],dt.LEFT);for(var g=2;g<=f;g++)n.addNextSegment(a[g],!0);n.addLastSegment(),n.addLineEndCap(a[f-1],a[f]);var v=Ln.simplify(t,-i),M=v.length-1;n.initSideSegments(v[M],v[M-1],dt.LEFT);for(var P=M-2;P>=0;P--)n.addNextSegment(v[P],!0);n.addLastSegment(),n.addLineEndCap(v[1],v[0]),n.closeRing()},Br.prototype.computePointCurve=function(t,n){switch(this._bufParams.getEndCapStyle()){case jt.CAP_ROUND:n.createCircle(t);break;case jt.CAP_SQUARE:n.createSquare(t)}},Br.prototype.getLineCurve=function(t,n){if(this._distance=n,n<0&&!this._bufParams.isSingleSided()||n===0)return null;var i=Math.abs(n),a=this.getSegGen(i);if(t.length<=1)this.computePointCurve(t[0],a);else if(this._bufParams.isSingleSided()){var f=n<0;this.computeSingleSidedBufferCurve(t,f,a)}else this.computeLineBufferCurve(t,a);return a.getCoordinates()},Br.prototype.getBufferParameters=function(){return this._bufParams},Br.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},Br.prototype.getRingCurve=function(t,n,i){if(this._distance=i,t.length<=2)return this.getLineCurve(t,i);if(i===0)return Br.copyCoordinates(t);var a=this.getSegGen(i);return this.computeRingBufferCurve(t,n,a),a.getCoordinates()},Br.prototype.computeOffsetCurve=function(t,n,i){var a=this.simplifyTolerance(this._distance);if(n){var f=Ln.simplify(t,-a),g=f.length-1;i.initSideSegments(f[g],f[g-1],dt.LEFT),i.addFirstSegment();for(var v=g-2;v>=0;v--)i.addNextSegment(f[v],!0)}else{var M=Ln.simplify(t,a),P=M.length-1;i.initSideSegments(M[0],M[1],dt.LEFT),i.addFirstSegment();for(var V=2;V<=P;V++)i.addNextSegment(M[V],!0)}i.addLastSegment()},Br.prototype.getSegGen=function(t){return new ln(this._precisionModel,this._bufParams,t)},Br.prototype.interfaces_=function(){return[]},Br.prototype.getClass=function(){return Br},Br.copyCoordinates=function(t){for(var n=new Array(t.length).fill(null),i=0;i<n.length;i++)n[i]=new U(t[i]);return n};var ys=function(){this._subgraphs=null,this._seg=new bt,this._cga=new mt;var t=arguments[0];this._subgraphs=t},ol={DepthSegment:{configurable:!0}};ys.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var t=arguments[0],n=new j,i=this._subgraphs.iterator();i.hasNext();){var a=i.next(),f=a.getEnvelope();t.y<f.getMinY()||t.y>f.getMaxY()||this.findStabbedSegments(t,a.getDirectedEdges(),n)}return n}if(arguments.length===3){if(yt(arguments[2],at)&&arguments[0]instanceof U&&arguments[1]instanceof nl){for(var g=arguments[0],v=arguments[1],M=arguments[2],P=v.getEdge().getCoordinates(),V=0;V<P.length-1;V++)if(this._seg.p0=P[V],this._seg.p1=P[V+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<g.x)&&!(this._seg.isHorizontal()||g.y<this._seg.p0.y||g.y>this._seg.p1.y||mt.computeOrientation(this._seg.p0,this._seg.p1,g)===mt.RIGHT)){var tt=v.getDepth(dt.LEFT);this._seg.p0.equals(P[V])||(tt=v.getDepth(dt.RIGHT));var nt=new Go(this._seg,tt);M.add(nt)}}else if(yt(arguments[2],at)&&arguments[0]instanceof U&&yt(arguments[1],at))for(var vt=arguments[0],xt=arguments[1],Tt=arguments[2],Ut=xt.iterator();Ut.hasNext();){var We=Ut.next();We.isForward()&&this.findStabbedSegments(vt,We,Tt)}}},ys.prototype.getDepth=function(t){var n=this.findStabbedSegments(t);return n.size()===0?0:Ui.min(n)._leftDepth},ys.prototype.interfaces_=function(){return[]},ys.prototype.getClass=function(){return ys},ol.DepthSegment.get=function(){return Go},Object.defineProperties(ys,ol);var Go=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],n=arguments[1];this._upwardSeg=new bt(t),this._leftDepth=n};Go.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)},Go.prototype.compareX=function(t,n){var i=t.p0.compareTo(n.p0);return i!==0?i:t.p1.compareTo(n.p1)},Go.prototype.toString=function(){return this._upwardSeg.toString()},Go.prototype.interfaces_=function(){return[Z]},Go.prototype.getClass=function(){return Go};var se=function(t,n,i){this.p0=t||null,this.p1=n||null,this.p2=i||null};se.prototype.area=function(){return se.area(this.p0,this.p1,this.p2)},se.prototype.signedArea=function(){return se.signedArea(this.p0,this.p1,this.p2)},se.prototype.interpolateZ=function(t){if(t===null)throw new k("Supplied point is null.");return se.interpolateZ(t,this.p0,this.p1,this.p2)},se.prototype.longestSideLength=function(){return se.longestSideLength(this.p0,this.p1,this.p2)},se.prototype.isAcute=function(){return se.isAcute(this.p0,this.p1,this.p2)},se.prototype.circumcentre=function(){return se.circumcentre(this.p0,this.p1,this.p2)},se.prototype.area3D=function(){return se.area3D(this.p0,this.p1,this.p2)},se.prototype.centroid=function(){return se.centroid(this.p0,this.p1,this.p2)},se.prototype.inCentre=function(){return se.inCentre(this.p0,this.p1,this.p2)},se.prototype.interfaces_=function(){return[]},se.prototype.getClass=function(){return se},se.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)},se.signedArea=function(t,n,i){return((i.x-t.x)*(n.y-t.y)-(n.x-t.x)*(i.y-t.y))/2},se.det=function(t,n,i,a){return t*a-n*i},se.interpolateZ=function(t,n,i,a){var f=n.x,g=n.y,v=i.x-f,M=a.x-f,P=i.y-g,V=a.y-g,tt=v*V-M*P,nt=t.x-f,vt=t.y-g,xt=(V*nt-M*vt)/tt,Tt=(-P*nt+v*vt)/tt;return n.z+xt*(i.z-n.z)+Tt*(a.z-n.z)},se.longestSideLength=function(t,n,i){var a=t.distance(n),f=n.distance(i),g=i.distance(t),v=a;return f>v&&(v=f),g>v&&(v=g),v},se.isAcute=function(t,n,i){return!!ee.isAcute(t,n,i)&&!!ee.isAcute(n,i,t)&&!!ee.isAcute(i,t,n)},se.circumcentre=function(t,n,i){var a=i.x,f=i.y,g=t.x-a,v=t.y-f,M=n.x-a,P=n.y-f,V=2*se.det(g,v,M,P),tt=se.det(v,g*g+v*v,P,M*M+P*P),nt=se.det(g,g*g+v*v,M,M*M+P*P);return new U(a-tt/V,f+nt/V)},se.perpendicularBisector=function(t,n){var i=n.x-t.x,a=n.y-t.y,f=new an(t.x+i/2,t.y+a/2,1),g=new an(t.x-a+i/2,t.y+i+a/2,1);return new an(f,g)},se.angleBisector=function(t,n,i){var a=n.distance(t),f=a/(a+n.distance(i)),g=i.x-t.x,v=i.y-t.y;return new U(t.x+f*g,t.y+f*v)},se.area3D=function(t,n,i){var a=n.x-t.x,f=n.y-t.y,g=n.z-t.z,v=i.x-t.x,M=i.y-t.y,P=i.z-t.z,V=f*P-g*M,tt=g*v-a*P,nt=a*M-f*v,vt=V*V+tt*tt+nt*nt,xt=Math.sqrt(vt)/2;return xt},se.centroid=function(t,n,i){var a=(t.x+n.x+i.x)/3,f=(t.y+n.y+i.y)/3;return new U(a,f)},se.inCentre=function(t,n,i){var a=n.distance(i),f=t.distance(i),g=t.distance(n),v=a+f+g,M=(a*t.x+f*n.x+g*i.x)/v,P=(a*t.y+f*n.y+g*i.y)/v;return new U(M,P)};var pi=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new j;var t=arguments[0],n=arguments[1],i=arguments[2];this._inputGeom=t,this._distance=n,this._curveBuilder=i};pi.prototype.addPoint=function(t){if(this._distance<=0)return null;var n=t.getCoordinates(),i=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(i,W.EXTERIOR,W.INTERIOR)},pi.prototype.addPolygon=function(t){var n=this._distance,i=dt.LEFT;this._distance<0&&(n=-this._distance,i=dt.RIGHT);var a=t.getExteriorRing(),f=lt.removeRepeatedPoints(a.getCoordinates());if(this._distance<0&&this.isErodedCompletely(a,this._distance)||this._distance<=0&&f.length<3)return null;this.addPolygonRing(f,n,i,W.EXTERIOR,W.INTERIOR);for(var g=0;g<t.getNumInteriorRing();g++){var v=t.getInteriorRingN(g),M=lt.removeRepeatedPoints(v.getCoordinates());this._distance>0&&this.isErodedCompletely(v,-this._distance)||this.addPolygonRing(M,n,dt.opposite(i),W.INTERIOR,W.EXTERIOR)}},pi.prototype.isTriangleErodedCompletely=function(t,n){var i=new se(t[0],t[1],t[2]),a=i.inCentre();return mt.distancePointLine(a,i.p0,i.p1)<Math.abs(n)},pi.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var n=lt.removeRepeatedPoints(t.getCoordinates()),i=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(i,W.EXTERIOR,W.INTERIOR)},pi.prototype.addCurve=function(t,n,i){if(t===null||t.length<2)return null;var a=new Rn(t,new Ve(0,W.BOUNDARY,n,i));this._curveList.add(a)},pi.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},pi.prototype.addPolygonRing=function(t,n,i,a,f){if(n===0&&t.length<Ki.MINIMUM_VALID_SIZE)return null;var g=a,v=f;t.length>=Ki.MINIMUM_VALID_SIZE&&mt.isCCW(t)&&(g=f,v=a,i=dt.opposite(i));var M=this._curveBuilder.getRingCurve(t,i,n);this.addCurve(M,g,v)},pi.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Zn?this.addPolygon(t):t instanceof xn?this.addLineString(t):t instanceof Er?this.addPoint(t):t instanceof na?this.addCollection(t):t instanceof bi?this.addCollection(t):t instanceof Qi?this.addCollection(t):t instanceof _n&&this.addCollection(t)},pi.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 a=t.getEnvelopeInternal(),f=Math.min(a.getHeight(),a.getWidth());return n<0&&2*Math.abs(n)>f},pi.prototype.addCollection=function(t){for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);this.add(i)}},pi.prototype.interfaces_=function(){return[]},pi.prototype.getClass=function(){return pi};var sa=function(){};sa.prototype.locate=function(t){},sa.prototype.interfaces_=function(){return[]},sa.prototype.getClass=function(){return sa};var zi=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()};zi.prototype.next=function(){if(this._atStart)return this._atStart=!1,zi.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 u;var t=this._parent.getGeometryN(this._index++);return t instanceof _n?(this._subcollectionIterator=new zi(t),this._subcollectionIterator.next()):t},zi.prototype.remove=function(){throw new Error(this.getClass().getName())},zi.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)},zi.prototype.interfaces_=function(){return[ct]},zi.prototype.getClass=function(){return zi},zi.isAtomic=function(t){return!(t instanceof _n)};var zr=function(){this._geom=null;var t=arguments[0];this._geom=t};zr.prototype.locate=function(t){return zr.locate(t,this._geom)},zr.prototype.interfaces_=function(){return[sa]},zr.prototype.getClass=function(){return zr},zr.isPointInRing=function(t,n){return!!n.getEnvelopeInternal().intersects(t)&&mt.isPointInRing(t,n.getCoordinates())},zr.containsPointInPolygon=function(t,n){if(n.isEmpty())return!1;var i=n.getExteriorRing();if(!zr.isPointInRing(t,i))return!1;for(var a=0;a<n.getNumInteriorRing();a++){var f=n.getInteriorRingN(a);if(zr.isPointInRing(t,f))return!1}return!0},zr.containsPoint=function(t,n){if(n instanceof Zn)return zr.containsPointInPolygon(t,n);if(n instanceof _n)for(var i=new zi(n);i.hasNext();){var a=i.next();if(a!==n&&zr.containsPoint(t,a))return!0}return!1},zr.locate=function(t,n){return n.isEmpty()?W.EXTERIOR:zr.containsPoint(t,n)?W.INTERIOR:W.EXTERIOR};var br=function(){this._edgeMap=new b,this._edgeList=null,this._ptInAreaLocation=[W.NONE,W.NONE]};br.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)},br.prototype.propagateSideLabels=function(t){for(var n=W.NONE,i=this.iterator();i.hasNext();){var a=i.next().getLabel();a.isArea(t)&&a.getLocation(t,dt.LEFT)!==W.NONE&&(n=a.getLocation(t,dt.LEFT))}if(n===W.NONE)return null;for(var f=n,g=this.iterator();g.hasNext();){var v=g.next(),M=v.getLabel();if(M.getLocation(t,dt.ON)===W.NONE&&M.setLocation(t,dt.ON,f),M.isArea(t)){var P=M.getLocation(t,dt.LEFT),V=M.getLocation(t,dt.RIGHT);if(V!==W.NONE){if(V!==f)throw new Mo("side location conflict",v.getCoordinate());P===W.NONE&&Nt.shouldNeverReachHere("found single null side (at "+v.getCoordinate()+")"),f=P}else Nt.isTrue(M.getLocation(t,dt.LEFT)===W.NONE,"found single null side"),M.setLocation(t,dt.RIGHT,f),M.setLocation(t,dt.LEFT,f)}}},br.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},br.prototype.print=function(t){Ge.out.println("EdgeEndStar: "+this.getCoordinate());for(var n=this.iterator();n.hasNext();)n.next().print(t)},br.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},br.prototype.checkAreaLabelsConsistent=function(t){var n=this.getEdges();if(n.size()<=0)return!0;var i=n.size()-1,a=n.get(i).getLabel().getLocation(t,dt.LEFT);Nt.isTrue(a!==W.NONE,"Found unlabelled area edge");for(var f=a,g=this.iterator();g.hasNext();){var v=g.next().getLabel();Nt.isTrue(v.isArea(t),"Found non-area edge");var M=v.getLocation(t,dt.LEFT),P=v.getLocation(t,dt.RIGHT);if(M===P||P!==f)return!1;f=M}return!0},br.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},br.prototype.iterator=function(){return this.getEdges().iterator()},br.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new j(this._edgeMap.values())),this._edgeList},br.prototype.getLocation=function(t,n,i){return this._ptInAreaLocation[t]===W.NONE&&(this._ptInAreaLocation[t]=zr.locate(n,i[t].getGeometry())),this._ptInAreaLocation[t]},br.prototype.toString=function(){var t=new ie;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()},br.prototype.computeEdgeEndLabels=function(t){for(var n=this.iterator();n.hasNext();)n.next().computeLabel(t)},br.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 a=i.next().getLabel(),f=0;f<2;f++)a.isLine(f)&&a.getLocation(f)===W.BOUNDARY&&(n[f]=!0);for(var g=this.iterator();g.hasNext();)for(var v=g.next(),M=v.getLabel(),P=0;P<2;P++)if(M.isAnyNull(P)){var V=W.NONE;if(n[P])V=W.EXTERIOR;else{var tt=v.getCoordinate();V=this.getLocation(P,tt,t)}M.setAllLocationsIfNull(P,V)}},br.prototype.getDegree=function(){return this._edgeMap.size()},br.prototype.insertEdgeEnd=function(t,n){this._edgeMap.put(t,n),this._edgeList=null},br.prototype.interfaces_=function(){return[]},br.prototype.getClass=function(){return br};var jl=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,a=null,f=this._SCANNING_FOR_INCOMING,g=0;g<this._resultAreaEdgeList.size();g++){var v=this._resultAreaEdgeList.get(g),M=v.getSym();if(v.getLabel().isArea())switch(i===null&&v.isInResult()&&(i=v),f){case this._SCANNING_FOR_INCOMING:if(!M.isInResult())continue;a=M,f=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!v.isInResult())continue;a.setNext(v),f=this._SCANNING_FOR_INCOMING}}if(f===this._LINKING_TO_OUTGOING){if(i===null)throw new Mo("no outgoing dirEdge found",this.getCoordinate());Nt.isTrue(i.isInResult(),"unable to link last incoming dirEdge"),a.setNext(i)}},n.prototype.insert=function(i){var a=i;this.insertEdgeEnd(a,a)},n.prototype.getRightmostEdge=function(){var i=this.getEdges(),a=i.size();if(a<1)return null;var f=i.get(0);if(a===1)return f;var g=i.get(a-1),v=f.getQuadrant(),M=g.getQuadrant();return on.isNorthern(v)&&on.isNorthern(M)?f:on.isNorthern(v)||on.isNorthern(M)?f.getDy()!==0?f:g.getDy()!==0?g:(Nt.shouldNeverReachHere("found two horizontal edges incident on node"),null):g},n.prototype.print=function(i){Ge.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var a=this.iterator();a.hasNext();){var f=a.next();i.print("out "),f.print(i),i.println(),i.print("in "),f.getSym().print(i),i.println()}},n.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new j;for(var i=this.iterator();i.hasNext();){var a=i.next();(a.isInResult()||a.getSym().isInResult())&&this._resultAreaEdgeList.add(a)}return this._resultAreaEdgeList},n.prototype.updateLabelling=function(i){for(var a=this.iterator();a.hasNext();){var f=a.next().getLabel();f.setAllLocationsIfNull(0,i.getLocation(0)),f.setAllLocationsIfNull(1,i.getLocation(1))}},n.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var i=null,a=null,f=this._edgeList.size()-1;f>=0;f--){var g=this._edgeList.get(f),v=g.getSym();a===null&&(a=v),i!==null&&v.setNext(i),i=g}a.setNext(i)},n.prototype.computeDepths=function(){if(arguments.length===1){var i=arguments[0],a=this.findIndex(i),f=i.getDepth(dt.LEFT),g=i.getDepth(dt.RIGHT),v=this.computeDepths(a+1,this._edgeList.size(),f);if(this.computeDepths(0,a,v)!==g)throw new Mo("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var M=arguments[0],P=arguments[1],V=arguments[2],tt=M;tt<P;tt++){var nt=this._edgeList.get(tt);nt.setEdgeDepths(dt.RIGHT,V),V=nt.getDepth(dt.LEFT)}return V}},n.prototype.mergeSymLabels=function(){for(var i=this.iterator();i.hasNext();){var a=i.next();a.getLabel().merge(a.getSym().getLabel())}},n.prototype.linkMinimalDirectedEdges=function(i){for(var a=null,f=null,g=this._SCANNING_FOR_INCOMING,v=this._resultAreaEdgeList.size()-1;v>=0;v--){var M=this._resultAreaEdgeList.get(v),P=M.getSym();switch(a===null&&M.getEdgeRing()===i&&(a=M),g){case this._SCANNING_FOR_INCOMING:if(P.getEdgeRing()!==i)continue;f=P,g=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(M.getEdgeRing()!==i)continue;f.setNextMin(M),g=this._SCANNING_FOR_INCOMING}}g===this._LINKING_TO_OUTGOING&&(Nt.isTrue(a!==null,"found null for first outgoing dirEdge"),Nt.isTrue(a.getEdgeRing()===i,"unable to link last incoming dirEdge"),f.setNextMin(a))},n.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var i=0,a=this.iterator();a.hasNext();)a.next().isInResult()&&i++;return i}if(arguments.length===1){for(var f=arguments[0],g=0,v=this.iterator();v.hasNext();)v.next().getEdgeRing()===f&&g++;return g}},n.prototype.getLabel=function(){return this._label},n.prototype.findCoveredLineEdges=function(){for(var i=W.NONE,a=this.iterator();a.hasNext();){var f=a.next(),g=f.getSym();if(!f.isLineEdge()){if(f.isInResult()){i=W.INTERIOR;break}if(g.isInResult()){i=W.EXTERIOR;break}}}if(i===W.NONE)return null;for(var v=i,M=this.iterator();M.hasNext();){var P=M.next(),V=P.getSym();P.isLineEdge()?P.getEdge().setCovered(v===W.INTERIOR):(P.isInResult()&&(v=W.EXTERIOR),V.isInResult()&&(v=W.INTERIOR))}},n.prototype.computeLabelling=function(i){t.prototype.computeLabelling.call(this,i),this._label=new Ve(W.NONE);for(var a=this.iterator();a.hasNext();)for(var f=a.next().getEdge().getLabel(),g=0;g<2;g++){var v=f.getLocation(g);v!==W.INTERIOR&&v!==W.BOUNDARY||this._label.setLocation(g,W.INTERIOR)}},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(br),Ai=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 lu(i,new jl)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(ia),So=function t(){this._pts=null,this._orientation=null;var n=arguments[0];this._pts=n,this._orientation=t.orientation(n)};So.prototype.compareTo=function(t){var n=t;return So.compareOriented(this._pts,this._orientation,n._pts,n._orientation)},So.prototype.interfaces_=function(){return[Z]},So.prototype.getClass=function(){return So},So.orientation=function(t){return lt.increasingDirection(t)===1},So.compareOriented=function(t,n,i,a){for(var f=n?1:-1,g=a?1:-1,v=n?t.length:-1,M=a?i.length:-1,P=n?0:t.length-1,V=a?0:i.length-1;;){var tt=t[P].compareTo(i[V]);if(tt!==0)return tt;var nt=(P+=f)===v,vt=(V+=g)===M;if(nt&&!vt)return-1;if(!nt&&vt)return 1;if(nt&&vt)return 0}};var kr=function(){this._edges=new j,this._ocaMap=new b};kr.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 a=i.getCoordinates(),f=0;f<a.length;f++)f>0&&t.print(","),t.print(a[f].x+" "+a[f].y);t.println(")")}t.print(") ")},kr.prototype.addAll=function(t){for(var n=t.iterator();n.hasNext();)this.add(n.next())},kr.prototype.findEdgeIndex=function(t){for(var n=0;n<this._edges.size();n++)if(this._edges.get(n).equals(t))return n;return-1},kr.prototype.iterator=function(){return this._edges.iterator()},kr.prototype.getEdges=function(){return this._edges},kr.prototype.get=function(t){return this._edges.get(t)},kr.prototype.findEqualEdge=function(t){var n=new So(t.getCoordinates());return this._ocaMap.get(n)},kr.prototype.add=function(t){this._edges.add(t);var n=new So(t.getCoordinates());this._ocaMap.put(n,t)},kr.prototype.interfaces_=function(){return[]},kr.prototype.getClass=function(){return kr};var ts=function(){};ts.prototype.processIntersections=function(t,n,i,a){},ts.prototype.isDone=function(){},ts.prototype.interfaces_=function(){return[]},ts.prototype.getClass=function(){return ts};var Kr=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};Kr.prototype.isTrivialIntersection=function(t,n,i,a){if(t===i&&this._li.getIntersectionNum()===1){if(Kr.isAdjacentSegments(n,a))return!0;if(t.isClosed()){var f=t.size()-1;if(n===0&&a===f||a===0&&n===f)return!0}}return!1},Kr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Kr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Kr.prototype.getLineIntersector=function(){return this._li},Kr.prototype.hasProperIntersection=function(){return this._hasProper},Kr.prototype.processIntersections=function(t,n,i,a){if(t===i&&n===a)return null;this.numTests++;var f=t.getCoordinates()[n],g=t.getCoordinates()[n+1],v=i.getCoordinates()[a],M=i.getCoordinates()[a+1];this._li.computeIntersection(f,g,v,M),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,n,i,a)||(this._hasIntersection=!0,t.addIntersections(this._li,n,0),i.addIntersections(this._li,a,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Kr.prototype.hasIntersection=function(){return this._hasIntersection},Kr.prototype.isDone=function(){return!1},Kr.prototype.hasInteriorIntersection=function(){return this._hasInterior},Kr.prototype.interfaces_=function(){return[ts]},Kr.prototype.getClass=function(){return Kr},Kr.isAdjacentSegments=function(t,n){return Math.abs(t-n)===1};var so=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],n=arguments[1],i=arguments[2];this.coord=new U(t),this.segmentIndex=n,this.dist=i};so.prototype.getSegmentIndex=function(){return this.segmentIndex},so.prototype.getCoordinate=function(){return this.coord},so.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},so.prototype.compareTo=function(t){var n=t;return this.compare(n.segmentIndex,n.dist)},so.prototype.isEndPoint=function(t){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===t},so.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},so.prototype.getDistance=function(){return this.dist},so.prototype.compare=function(t,n){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<n?-1:this.dist>n?1:0},so.prototype.interfaces_=function(){return[Z]},so.prototype.getClass=function(){return so};var bo=function(){this._nodeMap=new b,this.edge=null;var t=arguments[0];this.edge=t};bo.prototype.print=function(t){t.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(t)},bo.prototype.iterator=function(){return this._nodeMap.values().iterator()},bo.prototype.addSplitEdges=function(t){this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var a=n.next(),f=this.createSplitEdge(i,a);t.add(f),i=a}},bo.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)},bo.prototype.createSplitEdge=function(t,n){var i=n.segmentIndex-t.segmentIndex+2,a=this.edge.pts[n.segmentIndex],f=n.dist>0||!n.coord.equals2D(a);f||i--;var g=new Array(i).fill(null),v=0;g[v++]=new U(t.coord);for(var M=t.segmentIndex+1;M<=n.segmentIndex;M++)g[v++]=this.edge.pts[M];return f&&(g[v]=n.coord),new fu(g,new Ve(this.edge._label))},bo.prototype.add=function(t,n,i){var a=new so(t,n,i),f=this._nodeMap.get(a);return f!==null?f:(this._nodeMap.put(a,a),a)},bo.prototype.isIntersection=function(t){for(var n=this.iterator();n.hasNext();)if(n.next().coord.equals(t))return!0;return!1},bo.prototype.interfaces_=function(){return[]},bo.prototype.getClass=function(){return bo};var vs=function(){};vs.prototype.getChainStartIndices=function(t){var n=0,i=new j;i.add(new _t(n));do{var a=this.findChainEnd(t,n);i.add(new _t(a)),n=a}while(n<t.length-1);return vs.toIntArray(i)},vs.prototype.findChainEnd=function(t,n){for(var i=on.quadrant(t[n],t[n+1]),a=n+1;a<t.length&&on.quadrant(t[a-1],t[a])===i;)a++;return a-1},vs.prototype.interfaces_=function(){return[]},vs.prototype.getClass=function(){return vs},vs.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 Ho=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new Et,this.env2=new Et;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var n=new vs;this.startIndex=n.getChainStartIndices(this.pts)};Ho.prototype.getCoordinates=function(){return this.pts},Ho.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},Ho.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},Ho.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var t=arguments[0],n=arguments[1],i=arguments[2],a=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],n,n.startIndex[i],n.startIndex[i+1],a)}else if(arguments.length===6){var f=arguments[0],g=arguments[1],v=arguments[2],M=arguments[3],P=arguments[4],V=arguments[5],tt=this.pts[f],nt=this.pts[g],vt=v.pts[M],xt=v.pts[P];if(g-f==1&&P-M==1)return V.addIntersections(this.e,f,v.e,M),null;if(this.env1.init(tt,nt),this.env2.init(vt,xt),!this.env1.intersects(this.env2))return null;var Tt=Math.trunc((f+g)/2),Ut=Math.trunc((M+P)/2);f<Tt&&(M<Ut&&this.computeIntersectsForChain(f,Tt,v,M,Ut,V),Ut<P&&this.computeIntersectsForChain(f,Tt,v,Ut,P,V)),Tt<g&&(M<Ut&&this.computeIntersectsForChain(Tt,g,v,M,Ut,V),Ut<P&&this.computeIntersectsForChain(Tt,g,v,Ut,P,V))}},Ho.prototype.getStartIndexes=function(){return this.startIndex},Ho.prototype.computeIntersects=function(t,n){for(var i=0;i<this.startIndex.length-1;i++)for(var a=0;a<t.startIndex.length-1;a++)this.computeIntersectsForChain(i,t,a,n)},Ho.prototype.interfaces_=function(){return[]},Ho.prototype.getClass=function(){return Ho};var dr=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},ks={NULL_VALUE:{configurable:!0}};dr.prototype.getDepth=function(t,n){return this._depth[t][n]},dr.prototype.setDepth=function(t,n,i){this._depth[t][n]=i},dr.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]!==dr.NULL_VALUE)return!1;return!0}if(arguments.length===1){var i=arguments[0];return this._depth[i][1]===dr.NULL_VALUE}if(arguments.length===2){var a=arguments[0],f=arguments[1];return this._depth[a][f]===dr.NULL_VALUE}},dr.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 a=0;this._depth[t][i]>n&&(a=1),this._depth[t][i]=a}}},dr.prototype.getDelta=function(t){return this._depth[t][dt.RIGHT]-this._depth[t][dt.LEFT]},dr.prototype.getLocation=function(t,n){return this._depth[t][n]<=0?W.EXTERIOR:W.INTERIOR},dr.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},dr.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 a=t.getLocation(n,i);a!==W.EXTERIOR&&a!==W.INTERIOR||(this.isNull(n,i)?this._depth[n][i]=dr.depthAtLocation(a):this._depth[n][i]+=dr.depthAtLocation(a))}else if(arguments.length===3){var f=arguments[0],g=arguments[1];arguments[2]===W.INTERIOR&&this._depth[f][g]++}},dr.prototype.interfaces_=function(){return[]},dr.prototype.getClass=function(){return dr},dr.depthAtLocation=function(t){return t===W.EXTERIOR?0:t===W.INTERIOR?1:dr.NULL_VALUE},ks.NULL_VALUE.get=function(){return-1},Object.defineProperties(dr,ks);var fu=function(t){function n(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new bo(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new dr,this._depthDelta=0,arguments.length===1){var i=arguments[0];n.call(this,i,null)}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.pts=a,this._label=f}}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,Ve.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 a=i;if(this.pts.length!==a.pts.length)return!1;for(var f=!0,g=!0,v=this.pts.length,M=0;M<this.pts.length;M++)if(this.pts[M].equals2D(a.pts[M])||(f=!1),this.pts[M].equals2D(a.pts[--v])||(g=!1),!f&&!g)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 a=0;a<this.pts.length;a++)a>0&&i.print(","),i.print(this.pts[a].x+" "+this.pts[a].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 a=this.pts.length-1;a>=0;a--)i.print(this.pts[a]+" ");i.println("")},n.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Ho(this)),this._mce},n.prototype.getEnvelope=function(){if(this._env===null){this._env=new Et;for(var i=0;i<this.pts.length;i++)this._env.expandToInclude(this.pts[i])}return this._env},n.prototype.addIntersection=function(i,a,f,g){var v=new U(i.getIntersection(g)),M=a,P=i.getEdgeDistance(f,g),V=M+1;if(V<this.pts.length){var tt=this.pts[V];v.equals2D(tt)&&(M=V,P=0)}this.eiList.add(v,M,P)},n.prototype.toString=function(){var i=new ie;i.append("edge "+this._name+": "),i.append("LINESTRING (");for(var a=0;a<this.pts.length;a++)a>0&&i.append(","),i.append(this.pts[a].x+" "+this.pts[a].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 a=0;a<this.pts.length;a++)if(!this.pts[a].equals2D(i.pts[a]))return!1;return!0},n.prototype.setDepthDelta=function(i){this._depthDelta=i},n.prototype.getEdgeIntersectionList=function(){return this.eiList},n.prototype.addIntersections=function(i,a,f){for(var g=0;g<i.getIntersectionNum();g++)this.addIntersection(i,a,f,g)},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],a=arguments[1];a.setAtLeastIfValid(i.getLocation(0,dt.ON),i.getLocation(1,dt.ON),1),i.isArea()&&(a.setAtLeastIfValid(i.getLocation(0,dt.LEFT),i.getLocation(1,dt.LEFT),2),a.setAtLeastIfValid(i.getLocation(0,dt.RIGHT),i.getLocation(1,dt.RIGHT),2))},n}(ci),Lr=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new kr,this._bufParams=t||null};Lr.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},Lr.prototype.insertUniqueEdge=function(t){var n=this._edgeList.findEqualEdge(t);if(n!==null){var i=n.getLabel(),a=t.getLabel();n.isPointwiseEqual(t)||(a=new Ve(t.getLabel())).flip(),i.merge(a);var f=Lr.depthDelta(a),g=n.getDepthDelta()+f;n.setDepthDelta(g)}else this._edgeList.add(t),t.setDepthDelta(Lr.depthDelta(t.getLabel()))},Lr.prototype.buildSubgraphs=function(t,n){for(var i=new j,a=t.iterator();a.hasNext();){var f=a.next(),g=f.getRightmostCoordinate(),v=new ys(i).getDepth(g);f.computeDepth(v),f.findResultEdges(),i.add(f),n.add(f.getDirectedEdges(),f.getNodes())}},Lr.prototype.createSubgraphs=function(t){for(var n=new j,i=t.getNodes().iterator();i.hasNext();){var a=i.next();if(!a.isVisited()){var f=new wr;f.create(a),n.add(f)}}return Ui.sort(n,Ui.reverseOrder()),n},Lr.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Lr.prototype.getNoder=function(t){if(this._workingNoder!==null)return this._workingNoder;var n=new ka,i=new Mi;return i.setPrecisionModel(t),n.setSegmentIntersector(new Kr(i)),n},Lr.prototype.buffer=function(t,n){var i=this._workingPrecisionModel;i===null&&(i=t.getPrecisionModel()),this._geomFact=t.getFactory();var a=new Br(i,this._bufParams),f=new pi(t,n,a).getCurves();if(f.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(f,i),this._graph=new Cn(new Ai),this._graph.addEdges(this._edgeList.getEdges());var g=this.createSubgraphs(this._graph),v=new $r(this._geomFact);this.buildSubgraphs(g,v);var M=v.getPolygons();return M.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(M)},Lr.prototype.computeNodedEdges=function(t,n){var i=this.getNoder(n);i.computeNodes(t);for(var a=i.getNodedSubstrings().iterator();a.hasNext();){var f=a.next(),g=f.getCoordinates();if(g.length!==2||!g[0].equals2D(g[1])){var v=f.getData(),M=new fu(f.getCoordinates(),new Ve(v));this.insertUniqueEdge(M)}}},Lr.prototype.setNoder=function(t){this._workingNoder=t},Lr.prototype.interfaces_=function(){return[]},Lr.prototype.getClass=function(){return Lr},Lr.depthDelta=function(t){var n=t.getLocation(0,dt.LEFT),i=t.getLocation(0,dt.RIGHT);return n===W.INTERIOR&&i===W.EXTERIOR?1:n===W.EXTERIOR&&i===W.INTERIOR?-1:0},Lr.convertSegStrings=function(t){for(var n=new Qt,i=new j;t.hasNext();){var a=t.next(),f=n.createLineString(a.getCoordinates());i.add(f)}return n.buildGeometry(i)};var Ao=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],a=arguments[1],f=arguments[2],g=arguments[3];this._noder=i,this._scaleFactor=a,this._offsetX=f,this._offsetY=g,this._isScaled=!this.isIntegerPrecision()}};Ao.prototype.rescale=function(){if(yt(arguments[0],K))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],a=0;a<i.length;a++)i[a].x=i[a].x/this._scaleFactor+this._offsetX,i[a].y=i[a].y/this._scaleFactor+this._offsetY;i.length===2&&i[0].equals2D(i[1])&&Ge.out.println(i)}},Ao.prototype.scale=function(){if(yt(arguments[0],K)){for(var t=arguments[0],n=new j,i=t.iterator();i.hasNext();){var a=i.next();n.add(new Rn(this.scale(a.getCoordinates()),a.getData()))}return n}if(arguments[0]instanceof Array){for(var f=arguments[0],g=new Array(f.length).fill(null),v=0;v<f.length;v++)g[v]=new U(Math.round((f[v].x-this._offsetX)*this._scaleFactor),Math.round((f[v].y-this._offsetY)*this._scaleFactor),f[v].z);return lt.removeRepeatedPoints(g)}},Ao.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},Ao.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},Ao.prototype.computeNodes=function(t){var n=t;this._isScaled&&(n=this.scale(t)),this._noder.computeNodes(n)},Ao.prototype.interfaces_=function(){return[fi]},Ao.prototype.getClass=function(){return Ao};var ki=function(){this._li=new Mi,this._segStrings=null;var t=arguments[0];this._segStrings=t},es={fact:{configurable:!0}};ki.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],a=arguments[1].iterator();a.hasNext();)for(var f=a.next().getCoordinates(),g=1;g<f.length-1;g++)if(f[g].equals(i))throw new xr("found endpt/interior pt intersection at index "+g+" :pt "+i)}},ki.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 a=i.next();this.checkInteriorIntersections(n,a)}else if(arguments.length===2)for(var f=arguments[0],g=arguments[1],v=f.getCoordinates(),M=g.getCoordinates(),P=0;P<v.length-1;P++)for(var V=0;V<M.length-1;V++)this.checkInteriorIntersections(f,P,g,V);else if(arguments.length===4){var tt=arguments[0],nt=arguments[1],vt=arguments[2],xt=arguments[3];if(tt===vt&&nt===xt)return null;var Tt=tt.getCoordinates()[nt],Ut=tt.getCoordinates()[nt+1],We=vt.getCoordinates()[xt],cn=vt.getCoordinates()[xt+1];if(this._li.computeIntersection(Tt,Ut,We,cn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,Tt,Ut)||this.hasInteriorIntersection(this._li,We,cn)))throw new xr("found non-noded intersection at "+Tt+"-"+Ut+" and "+We+"-"+cn)}},ki.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},ki.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(),a=0;a<i.length-2;a++)this.checkCollapse(i[a],i[a+1],i[a+2])},ki.prototype.hasInteriorIntersection=function(t,n,i){for(var a=0;a<t.getIntersectionNum();a++){var f=t.getIntersection(a);if(!f.equals(n)&&!f.equals(i))return!0}return!1},ki.prototype.checkCollapse=function(t,n,i){if(t.equals(i))throw new xr("found non-noded collapse at "+ki.fact.createLineString([t,n,i]))},ki.prototype.interfaces_=function(){return[]},ki.prototype.getClass=function(){return ki},es.fact.get=function(){return new Qt},Object.defineProperties(ki,es);var gr=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 k("Scale factor must be non-zero");n!==1&&(this._pt=new U(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new U,this._p1Scaled=new U),this.initCorners(this._pt)},tc={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};gr.prototype.intersectsScaled=function(t,n){var i=Math.min(t.x,n.x),a=Math.max(t.x,n.x),f=Math.min(t.y,n.y),g=Math.max(t.y,n.y),v=this._maxx<i||this._minx>a||this._maxy<f||this._miny>g;if(v)return!1;var M=this.intersectsToleranceSquare(t,n);return Nt.isTrue(!(v&&M),"Found bad envelope test"),M},gr.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 U(this._maxx,this._maxy),this._corner[1]=new U(this._minx,this._maxy),this._corner[2]=new U(this._minx,this._miny),this._corner[3]=new U(this._maxx,this._miny)},gr.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))},gr.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},gr.prototype.getCoordinate=function(){return this._originalPt},gr.prototype.copyScaled=function(t,n){n.x=this.scale(t.x),n.y=this.scale(t.y)},gr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=gr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Et(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},gr.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())))},gr.prototype.intersectsToleranceSquare=function(t,n){var i=!1,a=!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()&&(a=!0),this._li.computeIntersection(t,n,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!i||!a)||!!t.equals(this._pt)||!!n.equals(this._pt))))},gr.prototype.addSnappedNode=function(t,n){var i=t.getCoordinate(n),a=t.getCoordinate(n+1);return!!this.intersects(i,a)&&(t.addIntersection(this.getCoordinate(),n),!0)},gr.prototype.interfaces_=function(){return[]},gr.prototype.getClass=function(){return gr},tc.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(gr,tc);var Ga=function(){this.tempEnv1=new Et,this.selectedSegment=new bt};Ga.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)}}},Ga.prototype.interfaces_=function(){return[]},Ga.prototype.getClass=function(){return Ga};var aa=function(){this._index=null;var t=arguments[0];this._index=t},Gs={HotPixelSnapAction:{configurable:!0}};aa.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],a=arguments[2],f=n.getSafeEnvelope(),g=new ao(n,i,a);return this._index.query(f,{interfaces_:function(){return[jo]},visitItem:function(v){v.select(f,g)}}),g.isNodeAdded()}},aa.prototype.interfaces_=function(){return[]},aa.prototype.getClass=function(){return aa},Gs.HotPixelSnapAction.get=function(){return ao},Object.defineProperties(aa,Gs);var ao=function(t){function n(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var i=arguments[0],a=arguments[1],f=arguments[2];this._hotPixel=i,this._parentEdge=a,this._hotPixelVertexIndex=f}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],a=arguments[1],f=i.getContext();if(this._parentEdge!==null&&f===this._parentEdge&&a===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(f,a)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Ga),_s=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new j};_s.prototype.processIntersections=function(t,n,i,a){if(t===i&&n===a)return null;var f=t.getCoordinates()[n],g=t.getCoordinates()[n+1],v=i.getCoordinates()[a],M=i.getCoordinates()[a+1];if(this._li.computeIntersection(f,g,v,M),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var P=0;P<this._li.getIntersectionNum();P++)this._interiorIntersections.add(this._li.getIntersection(P));t.addIntersections(this._li,n,0),i.addIntersections(this._li,a,1)}},_s.prototype.isDone=function(){return!1},_s.prototype.getInteriorIntersections=function(){return this._interiorIntersections},_s.prototype.interfaces_=function(){return[ts]},_s.prototype.getClass=function(){return _s};var To=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 Mi,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};To.prototype.checkCorrectness=function(t){var n=Rn.getNodedSubstrings(t),i=new ki(n);try{i.checkValid()}catch(a){if(!(a instanceof Hn))throw a;a.printStackTrace()}},To.prototype.getNodedSubstrings=function(){return Rn.getNodedSubstrings(this._nodedSegStrings)},To.prototype.snapRound=function(t,n){var i=this.findInteriorIntersections(t,n);this.computeIntersectionSnaps(i),this.computeVertexSnaps(t)},To.prototype.findInteriorIntersections=function(t,n){var i=new _s(n);return this._noder.setSegmentIntersector(i),this._noder.computeNodes(t),i.getInteriorIntersections()},To.prototype.computeVertexSnaps=function(){if(yt(arguments[0],K))for(var t=arguments[0].iterator();t.hasNext();){var n=t.next();this.computeVertexSnaps(n)}else if(arguments[0]instanceof Rn)for(var i=arguments[0],a=i.getCoordinates(),f=0;f<a.length;f++){var g=new gr(a[f],this._scaleFactor,this._li);this._pointSnapper.snap(g,i,f)&&i.addIntersection(a[f],f)}},To.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new ka,this._pointSnapper=new aa(this._noder.getIndex()),this.snapRound(t,this._li)},To.prototype.computeIntersectionSnaps=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next(),a=new gr(i,this._scaleFactor,this._li);this._pointSnapper.snap(a)}},To.prototype.interfaces_=function(){return[fi]},To.prototype.getClass=function(){return To};var mr=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new jt,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}},ua={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};mr.prototype.bufferFixedPrecision=function(t){var n=new Ao(new To(new ue(1)),t.getScale()),i=new Lr(this._bufParams);i.setWorkingPrecisionModel(t),i.setNoder(n),this._resultGeometry=i.buffer(this._argGeom,this._distance)},mr.prototype.bufferReducedPrecision=function(){var t=this;if(arguments.length===0){for(var n=mr.MAX_PRECISION_DIGITS;n>=0;n--){try{t.bufferReducedPrecision(n)}catch(g){if(!(g instanceof Mo))throw g;t._saveException=g}if(t._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var i=arguments[0],a=mr.precisionScaleFactor(this._argGeom,this._distance,i),f=new ue(a);this.bufferFixedPrecision(f)}},mr.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===ue.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},mr.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},mr.prototype.bufferOriginalPrecision=function(){try{var t=new Lr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(n){if(!(n instanceof xr))throw n;this._saveException=n}},mr.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},mr.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},mr.prototype.interfaces_=function(){return[]},mr.prototype.getClass=function(){return mr},mr.bufferOp=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];return new mr(t).getResultGeometry(n)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Ft&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1],f=arguments[2],g=new mr(i);return g.setQuadrantSegments(f),g.getResultGeometry(a)}if(arguments[2]instanceof jt&&arguments[0]instanceof Ft&&typeof arguments[1]=="number"){var v=arguments[0],M=arguments[1],P=arguments[2];return new mr(v,P).getResultGeometry(M)}}else if(arguments.length===4){var V=arguments[0],tt=arguments[1],nt=arguments[2],vt=arguments[3],xt=new mr(V);return xt.setQuadrantSegments(nt),xt.setEndCapStyle(vt),xt.getResultGeometry(tt)}},mr.precisionScaleFactor=function(t,n,i){var a=t.getEnvelopeInternal(),f=zt.max(Math.abs(a.getMaxX()),Math.abs(a.getMaxY()),Math.abs(a.getMinX()),Math.abs(a.getMinY()))+2*(n>0?n:0),g=i-Math.trunc(Math.log(f)/Math.log(10)+1);return Math.pow(10,g)},ua.CAP_ROUND.get=function(){return jt.CAP_ROUND},ua.CAP_BUTT.get=function(){return jt.CAP_FLAT},ua.CAP_FLAT.get=function(){return jt.CAP_FLAT},ua.CAP_SQUARE.get=function(){return jt.CAP_SQUARE},ua.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(mr,ua);var Nr=function(){this._pt=[new U,new U],this._distance=F.NaN,this._isNull=!0};Nr.prototype.getCoordinates=function(){return this._pt},Nr.prototype.getCoordinate=function(t){return this._pt[t]},Nr.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 a=n.distance(i);a<this._distance&&this.initialize(n,i,a)}},Nr.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],a=arguments[1],f=arguments[2];this._pt[0].setCoordinate(i),this._pt[1].setCoordinate(a),this._distance=f,this._isNull=!1}},Nr.prototype.getDistance=function(){return this._distance},Nr.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 a=n.distance(i);a>this._distance&&this.initialize(n,i,a)}},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr};var Co=function(){};Co.prototype.interfaces_=function(){return[]},Co.prototype.getClass=function(){return Co},Co.computeDistance=function(){if(arguments[2]instanceof Nr&&arguments[0]instanceof xn&&arguments[1]instanceof U)for(var t=arguments[0],n=arguments[1],i=arguments[2],a=t.getCoordinates(),f=new bt,g=0;g<a.length-1;g++){f.setCoordinates(a[g],a[g+1]);var v=f.closestPoint(n);i.setMinimum(v,n)}else if(arguments[2]instanceof Nr&&arguments[0]instanceof Zn&&arguments[1]instanceof U){var M=arguments[0],P=arguments[1],V=arguments[2];Co.computeDistance(M.getExteriorRing(),P,V);for(var tt=0;tt<M.getNumInteriorRing();tt++)Co.computeDistance(M.getInteriorRingN(tt),P,V)}else if(arguments[2]instanceof Nr&&arguments[0]instanceof Ft&&arguments[1]instanceof U){var nt=arguments[0],vt=arguments[1],xt=arguments[2];if(nt instanceof xn)Co.computeDistance(nt,vt,xt);else if(nt instanceof Zn)Co.computeDistance(nt,vt,xt);else if(nt instanceof _n)for(var Tt=nt,Ut=0;Ut<Tt.getNumGeometries();Ut++){var We=Tt.getGeometryN(Ut);Co.computeDistance(We,vt,xt)}else xt.setMinimum(nt.getCoordinate(),vt)}else if(arguments[2]instanceof Nr&&arguments[0]instanceof bt&&arguments[1]instanceof U){var cn=arguments[0],Fr=arguments[1],Ro=arguments[2],is=cn.closestPoint(Fr);Ro.setMinimum(is,Fr)}};var di=function(t){this._maxPtDist=new Nr,this._inputGeom=t||null},J={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};di.prototype.computeMaxMidpointDistance=function(t){var n=new ot(this._inputGeom);t.apply(n),this._maxPtDist.setMaximum(n.getMaxPointDistance())},di.prototype.computeMaxVertexDistance=function(t){var n=new ut(this._inputGeom);t.apply(n),this._maxPtDist.setMaximum(n.getMaxPointDistance())},di.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},di.prototype.getDistancePoints=function(){return this._maxPtDist},di.prototype.interfaces_=function(){return[]},di.prototype.getClass=function(){return di},J.MaxPointDistanceFilter.get=function(){return ut},J.MaxMidpointDistanceFilter.get=function(){return ot},Object.defineProperties(di,J);var ut=function(t){this._maxPtDist=new Nr,this._minPtDist=new Nr,this._geom=t||null};ut.prototype.filter=function(t){this._minPtDist.initialize(),Co.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},ut.prototype.getMaxPointDistance=function(){return this._maxPtDist},ut.prototype.interfaces_=function(){return[Y]},ut.prototype.getClass=function(){return ut};var ot=function(t){this._maxPtDist=new Nr,this._minPtDist=new Nr,this._geom=t||null};ot.prototype.filter=function(t,n){if(n===0)return null;var i=t.getCoordinate(n-1),a=t.getCoordinate(n),f=new U((i.x+a.x)/2,(i.y+a.y)/2);this._minPtDist.initialize(),Co.computeDistance(this._geom,f,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},ot.prototype.isDone=function(){return!1},ot.prototype.isGeometryChanged=function(){return!1},ot.prototype.getMaxPointDistance=function(){return this._maxPtDist},ot.prototype.interfaces_=function(){return[Bn]},ot.prototype.getClass=function(){return ot};var At=function(t){this._comps=t||null};At.prototype.filter=function(t){t instanceof Zn&&this._comps.add(t)},At.prototype.interfaces_=function(){return[Wn]},At.prototype.getClass=function(){return At},At.getPolygons=function(){if(arguments.length===1){var t=arguments[0];return At.getPolygons(t,new j)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return n instanceof Zn?i.add(n):n instanceof _n&&n.apply(new At(i)),i}};var Dt=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}};Dt.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof Ki){var n=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(n),null}t instanceof xn&&this._lines.add(t)},Dt.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},Dt.prototype.interfaces_=function(){return[Di]},Dt.prototype.getClass=function(){return Dt},Dt.getGeometry=function(){if(arguments.length===1){var t=arguments[0];return t.getFactory().buildGeometry(Dt.getLines(t))}if(arguments.length===2){var n=arguments[0],i=arguments[1];return n.getFactory().buildGeometry(Dt.getLines(n,i))}},Dt.getLines=function(){if(arguments.length===1){var t=arguments[0];return Dt.getLines(t,!1)}if(arguments.length===2){if(yt(arguments[0],K)&&yt(arguments[1],K)){for(var n=arguments[0],i=arguments[1],a=n.iterator();a.hasNext();){var f=a.next();Dt.getLines(f,i)}return i}if(arguments[0]instanceof Ft&&typeof arguments[1]=="boolean"){var g=arguments[0],v=arguments[1],M=new j;return g.apply(new Dt(M,v)),M}if(arguments[0]instanceof Ft&&yt(arguments[1],K)){var P=arguments[0],V=arguments[1];return P instanceof xn?V.add(P):P.apply(new Dt(V)),V}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&yt(arguments[0],K)&&yt(arguments[1],K)){for(var tt=arguments[0],nt=arguments[1],vt=arguments[2],xt=tt.iterator();xt.hasNext();){var Tt=xt.next();Dt.getLines(Tt,nt,vt)}return nt}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Ft&&yt(arguments[1],K)){var Ut=arguments[0],We=arguments[1],cn=arguments[2];return Ut.apply(new Dt(We,cn)),We}}};var te=function(){if(this._boundaryRule=w.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 k("Rule must be non-null");this._boundaryRule=t}}};te.prototype.locateInternal=function(){if(arguments[0]instanceof U&&arguments[1]instanceof Zn){var t=arguments[0],n=arguments[1];if(n.isEmpty())return W.EXTERIOR;var i=n.getExteriorRing(),a=this.locateInPolygonRing(t,i);if(a===W.EXTERIOR)return W.EXTERIOR;if(a===W.BOUNDARY)return W.BOUNDARY;for(var f=0;f<n.getNumInteriorRing();f++){var g=n.getInteriorRingN(f),v=this.locateInPolygonRing(t,g);if(v===W.INTERIOR)return W.EXTERIOR;if(v===W.BOUNDARY)return W.BOUNDARY}return W.INTERIOR}if(arguments[0]instanceof U&&arguments[1]instanceof xn){var M=arguments[0],P=arguments[1];if(!P.getEnvelopeInternal().intersects(M))return W.EXTERIOR;var V=P.getCoordinates();return P.isClosed()||!M.equals(V[0])&&!M.equals(V[V.length-1])?mt.isOnLine(M,V)?W.INTERIOR:W.EXTERIOR:W.BOUNDARY}if(arguments[0]instanceof U&&arguments[1]instanceof Er){var tt=arguments[0];return arguments[1].getCoordinate().equals2D(tt)?W.INTERIOR:W.EXTERIOR}},te.prototype.locateInPolygonRing=function(t,n){return n.getEnvelopeInternal().intersects(t)?mt.locatePointInRing(t,n.getCoordinates()):W.EXTERIOR},te.prototype.intersects=function(t,n){return this.locate(t,n)!==W.EXTERIOR},te.prototype.updateLocationInfo=function(t){t===W.INTERIOR&&(this._isIn=!0),t===W.BOUNDARY&&this._numBoundaries++},te.prototype.computeLocation=function(t,n){if(n instanceof Er&&this.updateLocationInfo(this.locateInternal(t,n)),n instanceof xn)this.updateLocationInfo(this.locateInternal(t,n));else if(n instanceof Zn)this.updateLocationInfo(this.locateInternal(t,n));else if(n instanceof bi)for(var i=n,a=0;a<i.getNumGeometries();a++){var f=i.getGeometryN(a);this.updateLocationInfo(this.locateInternal(t,f))}else if(n instanceof Qi)for(var g=n,v=0;v<g.getNumGeometries();v++){var M=g.getGeometryN(v);this.updateLocationInfo(this.locateInternal(t,M))}else if(n instanceof _n)for(var P=new zi(n);P.hasNext();){var V=P.next();V!==n&&this.computeLocation(t,V)}},te.prototype.locate=function(t,n){return n.isEmpty()?W.EXTERIOR:n instanceof xn?this.locateInternal(t,n):n instanceof Zn?this.locateInternal(t,n):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,n),this._boundaryRule.isInBoundary(this._numBoundaries)?W.BOUNDARY:this._numBoundaries>0||this._isIn?W.INTERIOR:W.EXTERIOR)},te.prototype.interfaces_=function(){return[]},te.prototype.getClass=function(){return te};var ge=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 a=arguments[0],f=arguments[1],g=arguments[2];this._component=a,this._segIndex=f,this._pt=g}},Sn={INSIDE_AREA:{configurable:!0}};ge.prototype.isInsideArea=function(){return this._segIndex===ge.INSIDE_AREA},ge.prototype.getCoordinate=function(){return this._pt},ge.prototype.getGeometryComponent=function(){return this._component},ge.prototype.getSegmentIndex=function(){return this._segIndex},ge.prototype.interfaces_=function(){return[]},ge.prototype.getClass=function(){return ge},Sn.INSIDE_AREA.get=function(){return-1},Object.defineProperties(ge,Sn);var Io=function(t){this._pts=t||null};Io.prototype.filter=function(t){t instanceof Er&&this._pts.add(t)},Io.prototype.interfaces_=function(){return[Wn]},Io.prototype.getClass=function(){return Io},Io.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Er?Ui.singletonList(t):Io.getPoints(t,new j)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return n instanceof Er?i.add(n):n instanceof _n&&n.apply(new Io(i)),i}};var Hs=function(){this._locations=null;var t=arguments[0];this._locations=t};Hs.prototype.filter=function(t){(t instanceof Er||t instanceof xn||t instanceof Zn)&&this._locations.add(new ge(t,0,t.getCoordinate()))},Hs.prototype.interfaces_=function(){return[Wn]},Hs.prototype.getClass=function(){return Hs},Hs.getLocations=function(t){var n=new j;return t.apply(new Hs(n)),n};var pn=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new te,this._minDistanceLocation=null,this._minDistance=F.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],a=arguments[1],f=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=i,this._geom[1]=a,this._terminateDistance=f}};pn.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],a=1-n,f=At.getPolygons(this._geom[n]);if(f.size()>0){var g=Hs.getLocations(this._geom[a]);if(this.computeContainmentDistance(g,f,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[a]=i[0],this._minDistanceLocation[n]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&yt(arguments[0],at)&&yt(arguments[1],at)){for(var v=arguments[0],M=arguments[1],P=arguments[2],V=0;V<v.size();V++)for(var tt=v.get(V),nt=0;nt<M.size();nt++)if(this.computeContainmentDistance(tt,M.get(nt),P),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof ge&&arguments[1]instanceof Zn){var vt=arguments[0],xt=arguments[1],Tt=arguments[2],Ut=vt.getCoordinate();if(W.EXTERIOR!==this._ptLocator.locate(Ut,xt))return this._minDistance=0,Tt[0]=vt,Tt[1]=new ge(xt,Ut),null}}},pn.prototype.computeMinDistanceLinesPoints=function(t,n,i){for(var a=0;a<t.size();a++)for(var f=t.get(a),g=0;g<n.size();g++){var v=n.get(g);if(this.computeMinDistance(f,v,i),this._minDistance<=this._terminateDistance)return null}},pn.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),n=Dt.getLines(this._geom[0]),i=Dt.getLines(this._geom[1]),a=Io.getPoints(this._geom[0]),f=Io.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,f,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(i,a,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(a,f,t),void this.updateMinDistance(t,!1))))},pn.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},pn.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])},pn.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},pn.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 xn&&arguments[1]instanceof Er){var t=arguments[0],n=arguments[1],i=arguments[2];if(t.getEnvelopeInternal().distance(n.getEnvelopeInternal())>this._minDistance)return null;for(var a=t.getCoordinates(),f=n.getCoordinate(),g=0;g<a.length-1;g++){var v=mt.distancePointLine(f,a[g],a[g+1]);if(v<this._minDistance){this._minDistance=v;var M=new bt(a[g],a[g+1]).closestPoint(f);i[0]=new ge(t,g,M),i[1]=new ge(n,0,f)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof xn&&arguments[1]instanceof xn){var P=arguments[0],V=arguments[1],tt=arguments[2];if(P.getEnvelopeInternal().distance(V.getEnvelopeInternal())>this._minDistance)return null;for(var nt=P.getCoordinates(),vt=V.getCoordinates(),xt=0;xt<nt.length-1;xt++)for(var Tt=0;Tt<vt.length-1;Tt++){var Ut=mt.distanceLineLine(nt[xt],nt[xt+1],vt[Tt],vt[Tt+1]);if(Ut<this._minDistance){this._minDistance=Ut;var We=new bt(nt[xt],nt[xt+1]),cn=new bt(vt[Tt],vt[Tt+1]),Fr=We.closestPoints(cn);tt[0]=new ge(P,xt,Fr[0]),tt[1]=new ge(V,Tt,Fr[1])}if(this._minDistance<=this._terminateDistance)return null}}}},pn.prototype.computeMinDistancePoints=function(t,n,i){for(var a=0;a<t.size();a++)for(var f=t.get(a),g=0;g<n.size();g++){var v=n.get(g),M=f.getCoordinate().distance(v.getCoordinate());if(M<this._minDistance&&(this._minDistance=M,i[0]=new ge(f,0,f.getCoordinate()),i[1]=new ge(v,0,v.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},pn.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new k("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},pn.prototype.computeMinDistanceLines=function(t,n,i){for(var a=0;a<t.size();a++)for(var f=t.get(a),g=0;g<n.size();g++){var v=n.get(g);if(this.computeMinDistance(f,v,i),this._minDistance<=this._terminateDistance)return null}},pn.prototype.interfaces_=function(){return[]},pn.prototype.getClass=function(){return pn},pn.distance=function(t,n){return new pn(t,n).distance()},pn.isWithinDistance=function(t,n,i){return new pn(t,n,i).distance()<=i},pn.nearestPoints=function(t,n){return new pn(t,n).nearestPoints()};var er=function(){this._pt=[new U,new U],this._distance=F.NaN,this._isNull=!0};er.prototype.getCoordinates=function(){return this._pt},er.prototype.getCoordinate=function(t){return this._pt[t]},er.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 a=n.distance(i);a<this._distance&&this.initialize(n,i,a)}},er.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],a=arguments[1],f=arguments[2];this._pt[0].setCoordinate(i),this._pt[1].setCoordinate(a),this._distance=f,this._isNull=!1}},er.prototype.toString=function(){return On.toLineString(this._pt[0],this._pt[1])},er.prototype.getDistance=function(){return this._distance},er.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 a=n.distance(i);a>this._distance&&this.initialize(n,i,a)}},er.prototype.interfaces_=function(){return[]},er.prototype.getClass=function(){return er};var uo=function(){};uo.prototype.interfaces_=function(){return[]},uo.prototype.getClass=function(){return uo},uo.computeDistance=function(){if(arguments[2]instanceof er&&arguments[0]instanceof xn&&arguments[1]instanceof U)for(var t=arguments[0],n=arguments[1],i=arguments[2],a=new bt,f=t.getCoordinates(),g=0;g<f.length-1;g++){a.setCoordinates(f[g],f[g+1]);var v=a.closestPoint(n);i.setMinimum(v,n)}else if(arguments[2]instanceof er&&arguments[0]instanceof Zn&&arguments[1]instanceof U){var M=arguments[0],P=arguments[1],V=arguments[2];uo.computeDistance(M.getExteriorRing(),P,V);for(var tt=0;tt<M.getNumInteriorRing();tt++)uo.computeDistance(M.getInteriorRingN(tt),P,V)}else if(arguments[2]instanceof er&&arguments[0]instanceof Ft&&arguments[1]instanceof U){var nt=arguments[0],vt=arguments[1],xt=arguments[2];if(nt instanceof xn)uo.computeDistance(nt,vt,xt);else if(nt instanceof Zn)uo.computeDistance(nt,vt,xt);else if(nt instanceof _n)for(var Tt=nt,Ut=0;Ut<Tt.getNumGeometries();Ut++){var We=Tt.getGeometryN(Ut);uo.computeDistance(We,vt,xt)}else xt.setMinimum(nt.getCoordinate(),vt)}else if(arguments[2]instanceof er&&arguments[0]instanceof bt&&arguments[1]instanceof U){var cn=arguments[0],Fr=arguments[1],Ro=arguments[2],is=cn.closestPoint(Fr);Ro.setMinimum(is,Fr)}};var Ar=function(){this._g0=null,this._g1=null,this._ptDist=new er,this._densifyFrac=0;var t=arguments[0],n=arguments[1];this._g0=t,this._g1=n},la={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Ar.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Ar.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new k("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},Ar.prototype.compute=function(t,n){this.computeOrientedDistance(t,n,this._ptDist),this.computeOrientedDistance(n,t,this._ptDist)},Ar.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Ar.prototype.computeOrientedDistance=function(t,n,i){var a=new Vo(n);if(t.apply(a),i.setMaximum(a.getMaxPointDistance()),this._densifyFrac>0){var f=new fe(n,this._densifyFrac);t.apply(f),i.setMaximum(f.getMaxPointDistance())}},Ar.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Ar.prototype.interfaces_=function(){return[]},Ar.prototype.getClass=function(){return Ar},Ar.distance=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];return new Ar(t,n).distance()}if(arguments.length===3){var i=arguments[0],a=arguments[1],f=arguments[2],g=new Ar(i,a);return g.setDensifyFraction(f),g.distance()}},la.MaxPointDistanceFilter.get=function(){return Vo},la.MaxDensifiedByFractionDistanceFilter.get=function(){return fe},Object.defineProperties(Ar,la);var Vo=function(){this._maxPtDist=new er,this._minPtDist=new er,this._euclideanDist=new uo,this._geom=null;var t=arguments[0];this._geom=t};Vo.prototype.filter=function(t){this._minPtDist.initialize(),uo.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Vo.prototype.getMaxPointDistance=function(){return this._maxPtDist},Vo.prototype.interfaces_=function(){return[Y]},Vo.prototype.getClass=function(){return Vo};var fe=function(){this._maxPtDist=new er,this._minPtDist=new er,this._geom=null,this._numSubSegs=0;var t=arguments[0],n=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/n))};fe.prototype.filter=function(t,n){if(n===0)return null;for(var i=t.getCoordinate(n-1),a=t.getCoordinate(n),f=(a.x-i.x)/this._numSubSegs,g=(a.y-i.y)/this._numSubSegs,v=0;v<this._numSubSegs;v++){var M=i.x+v*f,P=i.y+v*g,V=new U(M,P);this._minPtDist.initialize(),uo.computeDistance(this._geom,V,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},fe.prototype.isDone=function(){return!1},fe.prototype.isGeometryChanged=function(){return!1},fe.prototype.getMaxPointDistance=function(){return this._maxPtDist},fe.prototype.interfaces_=function(){return[Bn]},fe.prototype.getClass=function(){return fe};var Qr=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},hu={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Qr.prototype.checkMaximumDistance=function(t,n,i){var a=new Ar(n,t);if(a.setDensifyFraction(.25),this._maxDistanceFound=a.orientedDistance(),this._maxDistanceFound>i){this._isValid=!1;var f=a.getCoordinates();this._errorLocation=f[1],this._errorIndicator=t.getFactory().createLineString(f),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+On.toLineString(f[0],f[1])+")"}},Qr.prototype.isValid=function(){var t=Math.abs(this._bufDistance),n=Qr.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(),Qr.VERBOSE&&Ge.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Qr.prototype.checkNegativeValid=function(){if(!(this._input instanceof Zn||this._input instanceof Qi||this._input instanceof _n))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)},Qr.prototype.getErrorIndicator=function(){return this._errorIndicator},Qr.prototype.checkMinimumDistance=function(t,n,i){var a=new pn(t,n,i);if(this._minDistanceFound=a.distance(),this._minDistanceFound<i){this._isValid=!1;var f=a.nearestPoints();this._errorLocation=a.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(f),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+On.toLineString(f[0],f[1])+" )"}},Qr.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)},Qr.prototype.getErrorLocation=function(){return this._errorLocation},Qr.prototype.getPolygonLines=function(t){for(var n=new j,i=new Dt(n),a=At.getPolygons(t).iterator();a.hasNext();)a.next().apply(i);return t.getFactory().buildGeometry(n)},Qr.prototype.getErrorMessage=function(){return this._errMsg},Qr.prototype.interfaces_=function(){return[]},Qr.prototype.getClass=function(){return Qr},hu.VERBOSE.get=function(){return!1},hu.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Qr,hu);var Kn=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},sl={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Kn.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},Kn.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*Kn.MAX_ENV_DIFF_FRAC;t===0&&(t=.001);var n=new Et(this._input.getEnvelopeInternal());n.expandBy(this._distance);var i=new Et(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")},Kn.prototype.checkDistance=function(){var t=new Qr(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")},Kn.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")},Kn.prototype.checkPolygonal=function(){this._result instanceof Zn||this._result instanceof Qi||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Kn.prototype.getErrorIndicator=function(){return this._errorIndicator},Kn.prototype.getErrorLocation=function(){return this._errorLocation},Kn.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"))},Kn.prototype.report=function(t){if(!Kn.VERBOSE)return null;Ge.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},Kn.prototype.getErrorMessage=function(){return this._errorMsg},Kn.prototype.interfaces_=function(){return[]},Kn.prototype.getClass=function(){return Kn},Kn.isValidMsg=function(t,n,i){var a=new Kn(t,n,i);return a.isValid()?null:a.getErrorMessage()},Kn.isValid=function(t,n,i){return!!new Kn(t,n,i).isValid()},sl.VERBOSE.get=function(){return!1},sl.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Kn,sl);var lo=function(){this._pts=null,this._data=null;var t=arguments[0],n=arguments[1];this._pts=t,this._data=n};lo.prototype.getCoordinates=function(){return this._pts},lo.prototype.size=function(){return this._pts.length},lo.prototype.getCoordinate=function(t){return this._pts[t]},lo.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},lo.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:ds.octant(this.getCoordinate(t),this.getCoordinate(t+1))},lo.prototype.setData=function(t){this._data=t},lo.prototype.getData=function(){return this._data},lo.prototype.toString=function(){return On.toLineString(new Pn(this._pts))},lo.prototype.interfaces_=function(){return[io]},lo.prototype.getClass=function(){return lo};var ar=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new j,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};ar.prototype.getInteriorIntersection=function(){return this._interiorIntersection},ar.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},ar.prototype.getIntersectionSegments=function(){return this._intSegments},ar.prototype.count=function(){return this._intersectionCount},ar.prototype.getIntersections=function(){return this._intersections},ar.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},ar.prototype.setKeepIntersections=function(t){this._keepIntersections=t},ar.prototype.processIntersections=function(t,n,i,a){if(!this._findAllIntersections&&this.hasIntersection()||t===i&&n===a||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,n)||this.isEndSegment(i,a)))return null;var f=t.getCoordinates()[n],g=t.getCoordinates()[n+1],v=i.getCoordinates()[a],M=i.getCoordinates()[a+1];this._li.computeIntersection(f,g,v,M),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=f,this._intSegments[1]=g,this._intSegments[2]=v,this._intSegments[3]=M,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},ar.prototype.isEndSegment=function(t,n){return n===0||n>=t.size()-2},ar.prototype.hasIntersection=function(){return this._interiorIntersection!==null},ar.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},ar.prototype.interfaces_=function(){return[ts]},ar.prototype.getClass=function(){return ar},ar.createAllIntersectionsFinder=function(t){var n=new ar(t);return n.setFindAllIntersections(!0),n},ar.createAnyIntersectionFinder=function(t){return new ar(t)},ar.createIntersectionCounter=function(t){var n=new ar(t);return n.setFindAllIntersections(!0),n.setKeepIntersections(!1),n};var jr=function(){this._li=new Mi,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};jr.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},jr.prototype.getIntersections=function(){return this._segInt.getIntersections()},jr.prototype.isValid=function(){return this.execute(),this._isValid},jr.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},jr.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new ar(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new ka;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},jr.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Mo(this.getErrorMessage(),this._segInt.getInteriorIntersection())},jr.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+On.toLineString(t[0],t[1])+" and "+On.toLineString(t[2],t[3])},jr.prototype.interfaces_=function(){return[]},jr.prototype.getClass=function(){return jr},jr.computeIntersections=function(t){var n=new jr(t);return n.setFindAllIntersections(!0),n.isValid(),n.getIntersections()};var gi=function t(){this._nv=null;var n=arguments[0];this._nv=new jr(t.toSegmentStrings(n))};gi.prototype.checkValid=function(){this._nv.checkValid()},gi.prototype.interfaces_=function(){return[]},gi.prototype.getClass=function(){return gi},gi.toSegmentStrings=function(t){for(var n=new j,i=t.iterator();i.hasNext();){var a=i.next();n.add(new lo(a.getCoordinates(),a))}return n},gi.checkValid=function(t){new gi(t).checkValid()};var Wo=function(t){this._mapOp=t};Wo.prototype.map=function(t){for(var n=new j,i=0;i<t.getNumGeometries();i++){var a=this._mapOp.map(t.getGeometryN(i));a.isEmpty()||n.add(a)}return t.getFactory().createGeometryCollection(Qt.toGeometryArray(n))},Wo.prototype.interfaces_=function(){return[]},Wo.prototype.getClass=function(){return Wo},Wo.map=function(t,n){return new Wo(n).map(t)};var Gi=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new j,this._resultLineList=new j;var t=arguments[0],n=arguments[1],i=arguments[2];this._op=t,this._geometryFactory=n,this._ptLocator=i};Gi.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)}},Gi.prototype.labelIsolatedLine=function(t,n){var i=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(n));t.getLabel().setLocation(n,i)},Gi.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},Gi.prototype.collectLineEdge=function(t,n,i){var a=t.getLabel(),f=t.getEdge();t.isLineEdge()&&(t.isVisited()||!Ht.isResultOfOp(a,n)||f.isCovered()||(i.add(f),t.setVisitedEdge(!0)))},Gi.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(),a=i.getEdge();if(i.isLineEdge()&&!a.isCoveredSet()){var f=this._op.isCoveredByA(i.getCoordinate());a.setCovered(f)}}},Gi.prototype.labelIsolatedLines=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next(),a=i.getLabel();i.isIsolated()&&(a.isNull(0)?this.labelIsolatedLine(i,0):this.labelIsolatedLine(i,1))}},Gi.prototype.buildLines=function(t){for(var n=this._lineEdgesList.iterator();n.hasNext();){var i=n.next(),a=this._geometryFactory.createLineString(i.getCoordinates());this._resultLineList.add(a),i.setInResult(!0)}},Gi.prototype.collectBoundaryTouchEdge=function(t,n,i){var a=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(Nt.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(Ht.isResultOfOp(a,n)&&n===Ht.INTERSECTION&&(i.add(t.getEdge()),t.setVisitedEdge(!0))))},Gi.prototype.interfaces_=function(){return[]},Gi.prototype.getClass=function(){return Gi};var qo=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new j;var t=arguments[0],n=arguments[1];this._op=t,this._geometryFactory=n};qo.prototype.filterCoveredNodeToPoint=function(t){var n=t.getCoordinate();if(!this._op.isCoveredByLA(n)){var i=this._geometryFactory.createPoint(n);this._resultPointList.add(i)}},qo.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===Ht.INTERSECTION)){var a=i.getLabel();Ht.isResultOfOp(a,t)&&this.filterCoveredNodeToPoint(i)}}},qo.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},qo.prototype.interfaces_=function(){return[]},qo.prototype.getClass=function(){return qo};var Dr=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Dr.prototype.transformPoint=function(t,n){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},Dr.prototype.transformPolygon=function(t,n){var i=!0,a=this.transformLinearRing(t.getExteriorRing(),t);a!==null&&a instanceof Ki&&!a.isEmpty()||(i=!1);for(var f=new j,g=0;g<t.getNumInteriorRing();g++){var v=this.transformLinearRing(t.getInteriorRingN(g),t);v===null||v.isEmpty()||(v instanceof Ki||(i=!1),f.add(v))}if(i)return this._factory.createPolygon(a,f.toArray([]));var M=new j;return a!==null&&M.add(a),M.addAll(f),this._factory.buildGeometry(M)},Dr.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},Dr.prototype.getInputGeometry=function(){return this._inputGeom},Dr.prototype.transformMultiLineString=function(t,n){for(var i=new j,a=0;a<t.getNumGeometries();a++){var f=this.transformLineString(t.getGeometryN(a),t);f!==null&&(f.isEmpty()||i.add(f))}return this._factory.buildGeometry(i)},Dr.prototype.transformCoordinates=function(t,n){return this.copy(t)},Dr.prototype.transformLineString=function(t,n){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},Dr.prototype.transformMultiPoint=function(t,n){for(var i=new j,a=0;a<t.getNumGeometries();a++){var f=this.transformPoint(t.getGeometryN(a),t);f!==null&&(f.isEmpty()||i.add(f))}return this._factory.buildGeometry(i)},Dr.prototype.transformMultiPolygon=function(t,n){for(var i=new j,a=0;a<t.getNumGeometries();a++){var f=this.transformPolygon(t.getGeometryN(a),t);f!==null&&(f.isEmpty()||i.add(f))}return this._factory.buildGeometry(i)},Dr.prototype.copy=function(t){return t.copy()},Dr.prototype.transformGeometryCollection=function(t,n){for(var i=new j,a=0;a<t.getNumGeometries();a++){var f=this.transform(t.getGeometryN(a));f!==null&&(this._pruneEmptyGeometry&&f.isEmpty()||i.add(f))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Qt.toGeometryArray(i)):this._factory.buildGeometry(i)},Dr.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Er)return this.transformPoint(t,null);if(t instanceof na)return this.transformMultiPoint(t,null);if(t instanceof Ki)return this.transformLinearRing(t,null);if(t instanceof xn)return this.transformLineString(t,null);if(t instanceof bi)return this.transformMultiLineString(t,null);if(t instanceof Zn)return this.transformPolygon(t,null);if(t instanceof Qi)return this.transformMultiPolygon(t,null);if(t instanceof _n)return this.transformGeometryCollection(t,null);throw new k("Unknown Geometry subtype: "+t.getClass().getName())},Dr.prototype.transformLinearRing=function(t,n){var i=this.transformCoordinates(t.getCoordinateSequence(),t);if(i===null)return this._factory.createLinearRing(null);var a=i.size();return a>0&&a<4&&!this._preserveType?this._factory.createLineString(i):this._factory.createLinearRing(i)},Dr.prototype.interfaces_=function(){return[]},Dr.prototype.getClass=function(){return Dr};var co=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new bt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof xn&&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 a=arguments[0],f=arguments[1];this._srcPts=a,this._isClosed=t.isClosed(a),this._snapTolerance=f}};co.prototype.snapVertices=function(t,n){for(var i=this._isClosed?t.size()-1:t.size(),a=0;a<i;a++){var f=t.get(a),g=this.findSnapForVertex(f,n);g!==null&&(t.set(a,new U(g)),a===0&&this._isClosed&&t.set(t.size()-1,new U(g)))}},co.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},co.prototype.snapTo=function(t){var n=new ft(this._srcPts);return this.snapVertices(n,t),this.snapSegments(n,t),n.toCoordinateArray()},co.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 a=0;a<i;a++){var f=n[a],g=this.findSegmentIndexToSnap(f,t);g>=0&&t.add(g+1,new U(f),!1)}},co.prototype.findSegmentIndexToSnap=function(t,n){for(var i=F.MAX_VALUE,a=-1,f=0;f<n.size()-1;f++){if(this._seg.p0=n.get(f),this._seg.p1=n.get(f+1),this._seg.p0.equals2D(t)||this._seg.p1.equals2D(t)){if(this._allowSnappingToSourceVertices)continue;return-1}var g=this._seg.distance(t);g<this._snapTolerance&&g<i&&(i=g,a=f)}return a},co.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},co.prototype.interfaces_=function(){return[]},co.prototype.getClass=function(){return co},co.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var bn=function(t){this._srcGeom=t||null},al={SNAP_PRECISION_FACTOR:{configurable:!0}};bn.prototype.snapTo=function(t,n){var i=this.extractTargetCoordinates(t);return new ca(n,i).transform(this._srcGeom)},bn.prototype.snapToSelf=function(t,n){var i=this.extractTargetCoordinates(this._srcGeom),a=new ca(t,i,!0).transform(this._srcGeom),f=a;return n&&yt(f,Qo)&&(f=a.buffer(0)),f},bn.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},bn.prototype.extractTargetCoordinates=function(t){for(var n=new C,i=t.getCoordinates(),a=0;a<i.length;a++)n.add(i[a]);return n.toArray(new Array(0).fill(null))},bn.prototype.computeMinimumSegmentLength=function(t){for(var n=F.MAX_VALUE,i=0;i<t.length-1;i++){var a=t[i].distance(t[i+1]);a<n&&(n=a)}return n},bn.prototype.interfaces_=function(){return[]},bn.prototype.getClass=function(){return bn},bn.snap=function(t,n,i){var a=new Array(2).fill(null),f=new bn(t);a[0]=f.snapTo(n,i);var g=new bn(n);return a[1]=g.snapTo(a[0],i),a},bn.computeOverlaySnapTolerance=function(){if(arguments.length===1){var t=arguments[0],n=bn.computeSizeBasedSnapTolerance(t),i=t.getPrecisionModel();if(i.getType()===ue.FIXED){var a=1/i.getScale()*2/1.415;a>n&&(n=a)}return n}if(arguments.length===2){var f=arguments[0],g=arguments[1];return Math.min(bn.computeOverlaySnapTolerance(f),bn.computeOverlaySnapTolerance(g))}},bn.computeSizeBasedSnapTolerance=function(t){var n=t.getEnvelopeInternal();return Math.min(n.getHeight(),n.getWidth())*bn.SNAP_PRECISION_FACTOR},bn.snapToSelf=function(t,n,i){return new bn(t).snapToSelf(n,i)},al.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(bn,al);var ca=function(t){function n(i,a,f){t.call(this),this._snapTolerance=i||null,this._snapPts=a||null,this._isSelfSnap=f!==void 0&&f}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.snapLine=function(i,a){var f=new co(i,this._snapTolerance);return f.setAllowSnappingToSourceVertices(this._isSelfSnap),f.snapTo(a)},n.prototype.transformCoordinates=function(i,a){var f=i.toCoordinateArray(),g=this.snapLine(f,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(g)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Dr),Xn=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Xn.prototype.getCommon=function(){return F.longBitsToDouble(this._commonBits)},Xn.prototype.add=function(t){var n=F.doubleToLongBits(t);if(this._isFirst)return this._commonBits=n,this._commonSignExp=Xn.signExpBits(this._commonBits),this._isFirst=!1,null;if(Xn.signExpBits(n)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Xn.numCommonMostSigMantissaBits(this._commonBits,n),this._commonBits=Xn.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},Xn.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],n=F.longBitsToDouble(t),i="0000000000000000000000000000000000000000000000000000000000000000"+F.toBinaryString(t),a=i.substring(i.length-64);return a.substring(0,1)+" "+a.substring(1,12)+"(exp) "+a.substring(12)+" [ "+n+" ]"}},Xn.prototype.interfaces_=function(){return[]},Xn.prototype.getClass=function(){return Xn},Xn.getBit=function(t,n){return t&1<<n?1:0},Xn.signExpBits=function(t){return t>>52},Xn.zeroLowerBits=function(t,n){return t&~((1<<n)-1)},Xn.numCommonMostSigMantissaBits=function(t,n){for(var i=0,a=52;a>=0;a--){if(Xn.getBit(t,a)!==Xn.getBit(n,a))return i;i++}return 52};var fo=function(){this._commonCoord=null,this._ccFilter=new Vs},ul={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};fo.prototype.addCommonBits=function(t){var n=new ns(this._commonCoord);t.apply(n),t.geometryChanged()},fo.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var n=new U(this._commonCoord);n.x=-n.x,n.y=-n.y;var i=new ns(n);return t.apply(i),t.geometryChanged(),t},fo.prototype.getCommonCoordinate=function(){return this._commonCoord},fo.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},fo.prototype.interfaces_=function(){return[]},fo.prototype.getClass=function(){return fo},ul.CommonCoordinateFilter.get=function(){return Vs},ul.Translater.get=function(){return ns},Object.defineProperties(fo,ul);var Vs=function(){this._commonBitsX=new Xn,this._commonBitsY=new Xn};Vs.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},Vs.prototype.getCommonCoordinate=function(){return new U(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Vs.prototype.interfaces_=function(){return[Y]},Vs.prototype.getClass=function(){return Vs};var ns=function(){this.trans=null;var t=arguments[0];this.trans=t};ns.prototype.filter=function(t,n){var i=t.getOrdinate(n,0)+this.trans.x,a=t.getOrdinate(n,1)+this.trans.y;t.setOrdinate(n,0,i),t.setOrdinate(n,1,a)},ns.prototype.isDone=function(){return!1},ns.prototype.isGeometryChanged=function(){return!0},ns.prototype.interfaces_=function(){return[Bn]},ns.prototype.getClass=function(){return ns};var Yn=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()};Yn.prototype.selfSnap=function(t){return new bn(t).snapTo(t,this._snapTolerance)},Yn.prototype.removeCommonBits=function(t){this._cbr=new fo,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},Yn.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},Yn.prototype.getResultGeometry=function(t){var n=this.snap(this._geom),i=Ht.overlayOp(n[0],n[1],t);return this.prepareResult(i)},Yn.prototype.checkValid=function(t){t.isValid()||Ge.out.println("Snapped geometry is invalid")},Yn.prototype.computeSnapTolerance=function(){this._snapTolerance=bn.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Yn.prototype.snap=function(t){var n=this.removeCommonBits(t);return bn.snap(n[0],n[1],this._snapTolerance)},Yn.prototype.interfaces_=function(){return[]},Yn.prototype.getClass=function(){return Yn},Yn.overlayOp=function(t,n,i){return new Yn(t,n).getResultGeometry(i)},Yn.union=function(t,n){return Yn.overlayOp(t,n,Ht.UNION)},Yn.intersection=function(t,n){return Yn.overlayOp(t,n,Ht.INTERSECTION)},Yn.symDifference=function(t,n){return Yn.overlayOp(t,n,Ht.SYMDIFFERENCE)},Yn.difference=function(t,n){return Yn.overlayOp(t,n,Ht.DIFFERENCE)};var ur=function(t,n){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=n};ur.prototype.getResultGeometry=function(t){var n=null,i=!1,a=null;try{n=Ht.overlayOp(this._geom[0],this._geom[1],t),i=!0}catch(f){if(!(f instanceof xr))throw f;a=f}if(!i)try{n=Yn.overlayOp(this._geom[0],this._geom[1],t)}catch(f){throw f instanceof xr?a:f}return n},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur},ur.overlayOp=function(t,n,i){return new ur(t,n).getResultGeometry(i)},ur.union=function(t,n){return ur.overlayOp(t,n,Ht.UNION)},ur.intersection=function(t,n){return ur.overlayOp(t,n,Ht.INTERSECTION)},ur.symDifference=function(t,n){return ur.overlayOp(t,n,Ht.SYMDIFFERENCE)},ur.difference=function(t,n){return ur.overlayOp(t,n,Ht.DIFFERENCE)};var Ws=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],n=arguments[1];this.mce=t,this.chainIndex=n};Ws.prototype.computeIntersections=function(t,n){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,n)},Ws.prototype.interfaces_=function(){return[]},Ws.prototype.getClass=function(){return Ws};var ti=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 a=arguments[0],f=arguments[1],g=arguments[2];this._eventType=t.INSERT,this._label=a,this._xValue=f,this._obj=g}},pu={INSERT:{configurable:!0},DELETE:{configurable:!0}};ti.prototype.isDelete=function(){return this._eventType===ti.DELETE},ti.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},ti.prototype.getObject=function(){return this._obj},ti.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},ti.prototype.getInsertEvent=function(){return this._insertEvent},ti.prototype.isInsert=function(){return this._eventType===ti.INSERT},ti.prototype.isSameLabel=function(t){return this._label!==null&&this._label===t._label},ti.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},ti.prototype.interfaces_=function(){return[Z]},ti.prototype.getClass=function(){return ti},pu.INSERT.get=function(){return 1},pu.DELETE.get=function(){return 2},Object.defineProperties(ti,pu);var du=function(){};du.prototype.interfaces_=function(){return[]},du.prototype.getClass=function(){return du};var yr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],n=arguments[1],i=arguments[2];this._li=t,this._includeProper=n,this._recordIsolated=i};yr.prototype.isTrivialIntersection=function(t,n,i,a){if(t===i&&this._li.getIntersectionNum()===1){if(yr.isAdjacentSegments(n,a))return!0;if(t.isClosed()){var f=t.getNumPoints()-1;if(n===0&&a===f||a===0&&n===f)return!0}}return!1},yr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},yr.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},yr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},yr.prototype.isBoundaryPointInternal=function(t,n){for(var i=n.iterator();i.hasNext();){var a=i.next().getCoordinate();if(t.isIntersection(a))return!0}return!1},yr.prototype.hasProperIntersection=function(){return this._hasProper},yr.prototype.hasIntersection=function(){return this._hasIntersection},yr.prototype.isDone=function(){return this._isDone},yr.prototype.isBoundaryPoint=function(t,n){return n!==null&&(!!this.isBoundaryPointInternal(t,n[0])||!!this.isBoundaryPointInternal(t,n[1]))},yr.prototype.setBoundaryNodes=function(t,n){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=n},yr.prototype.addIntersections=function(t,n,i,a){if(t===i&&n===a)return null;this.numTests++;var f=t.getCoordinates()[n],g=t.getCoordinates()[n+1],v=i.getCoordinates()[a],M=i.getCoordinates()[a+1];this._li.computeIntersection(f,g,v,M),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),i.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,n,i,a)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,n,0),i.addIntersections(this._li,a,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},yr.prototype.interfaces_=function(){return[]},yr.prototype.getClass=function(){return yr},yr.isAdjacentSegments=function(t,n){return Math.abs(t-n)===1};var Tr=function(t){function n(){t.call(this),this.events=new j,this.nOverlaps=null}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.prepareEvents=function(){Ui.sort(this.events);for(var i=0;i<this.events.size();i++){var a=this.events.get(i);a.isDelete()&&a.getInsertEvent().setDeleteEventIndex(i)}},n.prototype.computeIntersections=function(){if(arguments.length===1){var i=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var a=0;a<this.events.size();a++){var f=this.events.get(a);if(f.isInsert()&&this.processOverlaps(a,f.getDeleteEventIndex(),f,i),i.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof yr&&yt(arguments[0],at)&&yt(arguments[1],at)){var g=arguments[0],v=arguments[1],M=arguments[2];this.addEdges(g,g),this.addEdges(v,v),this.computeIntersections(M)}else if(typeof arguments[2]=="boolean"&&yt(arguments[0],at)&&arguments[1]instanceof yr){var P=arguments[0],V=arguments[1];arguments[2]?this.addEdges(P,null):this.addEdges(P),this.computeIntersections(V)}}},n.prototype.addEdge=function(i,a){for(var f=i.getMonotoneChainEdge(),g=f.getStartIndexes(),v=0;v<g.length-1;v++){var M=new Ws(f,v),P=new ti(a,f.getMinX(v),M);this.events.add(P),this.events.add(new ti(f.getMaxX(v),P))}},n.prototype.processOverlaps=function(i,a,f,g){for(var v=f.getObject(),M=i;M<a;M++){var P=this.events.get(M);if(P.isInsert()){var V=P.getObject();f.isSameLabel(P)||(v.computeIntersections(V,g),this.nOverlaps++)}}},n.prototype.addEdges=function(){if(arguments.length===1)for(var i=arguments[0].iterator();i.hasNext();){var a=i.next();this.addEdge(a,a)}else if(arguments.length===2)for(var f=arguments[0],g=arguments[1],v=f.iterator();v.hasNext();){var M=v.next();this.addEdge(M,g)}},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(du),Nn=function(){this._min=F.POSITIVE_INFINITY,this._max=F.NEGATIVE_INFINITY},ec={NodeComparator:{configurable:!0}};Nn.prototype.getMin=function(){return this._min},Nn.prototype.intersects=function(t,n){return!(this._min>n||this._max<t)},Nn.prototype.getMax=function(){return this._max},Nn.prototype.toString=function(){return On.toLineString(new U(this._min,0),new U(this._max,0))},Nn.prototype.interfaces_=function(){return[]},Nn.prototype.getClass=function(){return Nn},ec.NodeComparator.get=function(){return Ha},Object.defineProperties(Nn,ec);var Ha=function(){};Ha.prototype.compare=function(t,n){var i=t,a=n,f=(i._min+i._max)/2,g=(a._min+a._max)/2;return f<g?-1:f>g?1:0},Ha.prototype.interfaces_=function(){return[et]},Ha.prototype.getClass=function(){return Ha};var nc=function(t){function n(){t.call(this),this._item=null;var i=arguments[0],a=arguments[1],f=arguments[2];this._min=i,this._max=a,this._item=f}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.query=function(i,a,f){if(!this.intersects(i,a))return null;f.visitItem(this._item)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Nn),Hf=function(t){function n(){t.call(this),this._node1=null,this._node2=null;var i=arguments[0],a=arguments[1];this._node1=i,this._node2=a,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,a){this._min=Math.min(i._min,a._min),this._max=Math.max(i._max,a._max)},n.prototype.query=function(i,a,f){if(!this.intersects(i,a))return null;this._node1!==null&&this._node1.query(i,a,f),this._node2!==null&&this._node2.query(i,a,f)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Nn),Hi=function(){this._leaves=new j,this._root=null,this._level=0};Hi.prototype.buildTree=function(){Ui.sort(this._leaves,new Nn.NodeComparator);for(var t=this._leaves,n=null,i=new j;;){if(this.buildLevel(t,i),i.size()===1)return i.get(0);n=t,t=i,i=n}},Hi.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 nc(t,n,i))},Hi.prototype.query=function(t,n,i){this.init(),this._root.query(t,n,i)},Hi.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},Hi.prototype.printNode=function(t){Ge.out.println(On.toLineString(new U(t._min,this._level),new U(t._max,this._level)))},Hi.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},Hi.prototype.buildLevel=function(t,n){this._level++,n.clear();for(var i=0;i<t.size();i+=2){var a=t.get(i);if((i+1<t.size()?t.get(i):null)===null)n.add(a);else{var f=new Hf(t.get(i),t.get(i+1));n.add(f)}}},Hi.prototype.interfaces_=function(){return[]},Hi.prototype.getClass=function(){return Hi};var Xo=function(){this._items=new j};Xo.prototype.visitItem=function(t){this._items.add(t)},Xo.prototype.getItems=function(){return this._items},Xo.prototype.interfaces_=function(){return[jo]},Xo.prototype.getClass=function(){return Xo};var xs=function(){this._index=null;var t=arguments[0];if(!yt(t,Qo))throw new k("Argument must be Polygonal");this._index=new ho(t)},Es={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};xs.prototype.locate=function(t){var n=new Rr(t),i=new Yo(n);return this._index.query(t.y,t.y,i),n.getLocation()},xs.prototype.interfaces_=function(){return[sa]},xs.prototype.getClass=function(){return xs},Es.SegmentVisitor.get=function(){return Yo},Es.IntervalIndexedGeometry.get=function(){return ho},Object.defineProperties(xs,Es);var Yo=function(){this._counter=null;var t=arguments[0];this._counter=t};Yo.prototype.visitItem=function(t){var n=t;this._counter.countSegment(n.getCoordinate(0),n.getCoordinate(1))},Yo.prototype.interfaces_=function(){return[jo]},Yo.prototype.getClass=function(){return Yo};var ho=function(){this._index=new Hi;var t=arguments[0];this.init(t)};ho.prototype.init=function(t){for(var n=Dt.getLines(t).iterator();n.hasNext();){var i=n.next().getCoordinates();this.addLine(i)}},ho.prototype.addLine=function(t){for(var n=1;n<t.length;n++){var i=new bt(t[n-1],t[n]),a=Math.min(i.p0.y,i.p1.y),f=Math.max(i.p0.y,i.p1.y);this._index.insert(a,f,i)}},ho.prototype.query=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1],i=new Xo;return this._index.query(t,n,i),i.getItems()}if(arguments.length===3){var a=arguments[0],f=arguments[1],g=arguments[2];this._index.query(a,f,g)}},ho.prototype.interfaces_=function(){return[]},ho.prototype.getClass=function(){return ho};var ws=function(t){function n(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new $l,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new te,arguments.length===2){var i=arguments[0],a=arguments[1],f=w.OGC_SFS_BOUNDARY_RULE;this._argIndex=i,this._parentGeom=a,this._boundaryNodeRule=f,a!==null&&this.add(a)}else if(arguments.length===3){var g=arguments[0],v=arguments[1],M=arguments[2];this._argIndex=g,this._parentGeom=v,this._boundaryNodeRule=M,v!==null&&this.add(v)}}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.insertBoundaryPoint=function(i,a){var f=this._nodes.addNode(a).getLabel(),g=1;W.NONE,f.getLocation(i,dt.ON)===W.BOUNDARY&&g++;var v=n.determineBoundary(this._boundaryNodeRule,g);f.setLocation(i,v)},n.prototype.computeSelfNodes=function(){if(arguments.length===2){var i=arguments[0],a=arguments[1];return this.computeSelfNodes(i,a,!1)}if(arguments.length===3){var f=arguments[0],g=arguments[1],v=arguments[2],M=new yr(f,!0,!1);M.setIsDoneIfProperInt(v);var P=this.createEdgeSetIntersector(),V=this._parentGeom instanceof Ki||this._parentGeom instanceof Zn||this._parentGeom instanceof Qi,tt=g||!V;return P.computeIntersections(this._edges,M,tt),this.addSelfIntersectionNodes(this._argIndex),M}},n.prototype.computeSplitEdges=function(i){for(var a=this._edges.iterator();a.hasNext();)a.next().eiList.addSplitEdges(i)},n.prototype.computeEdgeIntersections=function(i,a,f){var g=new yr(a,f,!0);return g.setBoundaryNodes(this.getBoundaryNodes(),i.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,i._edges,g),g},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 Er){var i=arguments[0].getCoordinate();this.insertPoint(this._argIndex,i,W.INTERIOR)}else if(arguments[0]instanceof U){var a=arguments[0];this.insertPoint(this._argIndex,a,W.INTERIOR)}},n.prototype.addPolygon=function(i){this.addPolygonRing(i.getExteriorRing(),W.EXTERIOR,W.INTERIOR);for(var a=0;a<i.getNumInteriorRing();a++){var f=i.getInteriorRingN(a);this.addPolygonRing(f,W.INTERIOR,W.EXTERIOR)}},n.prototype.addEdge=function(i){this.insertEdge(i);var a=i.getCoordinates();this.insertPoint(this._argIndex,a[0],W.BOUNDARY),this.insertPoint(this._argIndex,a[a.length-1],W.BOUNDARY)},n.prototype.addLineString=function(i){var a=lt.removeRepeatedPoints(i.getCoordinates());if(a.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=a[0],null;var f=new fu(a,new Ve(this._argIndex,W.INTERIOR));this._lineEdgeMap.put(i,f),this.insertEdge(f),Nt.isTrue(a.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,a[0]),this.insertBoundaryPoint(this._argIndex,a[a.length-1])},n.prototype.getInvalidPoint=function(){return this._invalidPoint},n.prototype.getBoundaryPoints=function(){for(var i=this.getBoundaryNodes(),a=new Array(i.size()).fill(null),f=0,g=i.iterator();g.hasNext();){var v=g.next();a[f++]=v.getCoordinate().copy()}return a},n.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},n.prototype.addSelfIntersectionNode=function(i,a,f){if(this.isBoundaryNode(i,a))return null;f===W.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(i,a):this.insertPoint(i,a,f)},n.prototype.addPolygonRing=function(i,a,f){if(i.isEmpty())return null;var g=lt.removeRepeatedPoints(i.getCoordinates());if(g.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=g[0],null;var v=a,M=f;mt.isCCW(g)&&(v=f,M=a);var P=new fu(g,new Ve(this._argIndex,W.BOUNDARY,v,M));this._lineEdgeMap.put(i,P),this.insertEdge(P),this.insertPoint(this._argIndex,g[0],W.BOUNDARY)},n.prototype.insertPoint=function(i,a,f){var g=this._nodes.addNode(a),v=g.getLabel();v===null?g._label=new Ve(i,f):v.setLocation(i,f)},n.prototype.createEdgeSetIntersector=function(){return new Tr},n.prototype.addSelfIntersectionNodes=function(i){for(var a=this._edges.iterator();a.hasNext();)for(var f=a.next(),g=f.getLabel().getLocation(i),v=f.eiList.iterator();v.hasNext();){var M=v.next();this.addSelfIntersectionNode(i,M.coord,g)}},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 Qi&&(this._useBoundaryDeterminationRule=!1),i instanceof Zn)this.addPolygon(i);else if(i instanceof xn)this.addLineString(i);else if(i instanceof Er)this.addPoint(i);else if(i instanceof na)this.addCollection(i);else if(i instanceof bi)this.addCollection(i);else if(i instanceof Qi)this.addCollection(i);else{if(!(i instanceof _n))throw new Error(i.getClass().getName());this.addCollection(i)}},n.prototype.addCollection=function(i){for(var a=0;a<i.getNumGeometries();a++){var f=i.getGeometryN(a);this.add(f)}},n.prototype.locate=function(i){return yt(this._parentGeom,Qo)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new xs(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,a){return i.isInBoundary(a)?W.BOUNDARY:W.INTERIOR},n}(Cn),Po=function(){if(this._li=new Mi,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 ws(0,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],a=w.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 ws(0,n,a),this._arg[1]=new ws(1,i,a)}else if(arguments.length===3){var f=arguments[0],g=arguments[1],v=arguments[2];f.getPrecisionModel().compareTo(g.getPrecisionModel())>=0?this.setComputationPrecision(f.getPrecisionModel()):this.setComputationPrecision(g.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ws(0,f,v),this._arg[1]=new ws(1,g,v)}};Po.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},Po.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},Po.prototype.interfaces_=function(){return[]},Po.prototype.getClass=function(){return Po};var Ms=function(){};Ms.prototype.interfaces_=function(){return[]},Ms.prototype.getClass=function(){return Ms},Ms.map=function(){if(arguments[0]instanceof Ft&&yt(arguments[1],Ms.MapOp)){for(var t=arguments[0],n=arguments[1],i=new j,a=0;a<t.getNumGeometries();a++){var f=n.map(t.getGeometryN(a));f!==null&&i.add(f)}return t.getFactory().buildGeometry(i)}if(yt(arguments[0],K)&&yt(arguments[1],Ms.MapOp)){for(var g=arguments[0],v=arguments[1],M=new j,P=g.iterator();P.hasNext();){var V=P.next(),tt=v.map(V);tt!==null&&M.add(tt)}return M}},Ms.MapOp=function(){};var Ht=function(t){function n(){var i=arguments[0],a=arguments[1];t.call(this,i,a),this._ptLocator=new te,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new kr,this._resultPolyList=new j,this._resultLineList=new j,this._resultPointList=new j,this._graph=new Cn(new Ai),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 a=this._edgeList.findEqualEdge(i);if(a!==null){var f=a.getLabel(),g=i.getLabel();a.isPointwiseEqual(i)||(g=new Ve(i.getLabel())).flip();var v=a.getDepth();v.isNull()&&v.add(f),v.add(g),f.merge(g)}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 a=i.next(),f=a.getSym();a.isInResult()&&f.isInResult()&&(a.setInResult(!1),f.setInResult(!1))}},n.prototype.isCoveredByLA=function(i){return!!this.isCovered(i,this._resultLineList)||!!this.isCovered(i,this._resultPolyList)},n.prototype.computeGeometry=function(i,a,f,g){var v=new j;return v.addAll(i),v.addAll(a),v.addAll(f),v.isEmpty()?n.createEmptyResult(g,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(v)},n.prototype.mergeSymLabels=function(){for(var i=this._graph.getNodes().iterator();i.hasNext();)i.next().getEdges().mergeSymLabels()},n.prototype.isCovered=function(i,a){for(var f=a.iterator();f.hasNext();){var g=f.next();if(this._ptLocator.locate(i,g)!==W.EXTERIOR)return!0}return!1},n.prototype.replaceCollapsedEdges=function(){for(var i=new j,a=this._edgeList.iterator();a.hasNext();){var f=a.next();f.isCollapsed()&&(a.remove(),i.add(f.getCollapsedEdge()))}this._edgeList.addAll(i)},n.prototype.updateNodeLabelling=function(){for(var i=this._graph.getNodes().iterator();i.hasNext();){var a=i.next(),f=a.getEdges().getLabel();a.getLabel().merge(f)}},n.prototype.getResultGeometry=function(i){return this.computeOverlay(i),this._resultGeom},n.prototype.insertUniqueEdges=function(i){for(var a=i.iterator();a.hasNext();){var f=a.next();this.insertUniqueEdge(f)}},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 a=new j;this._arg[0].computeSplitEdges(a),this._arg[1].computeSplitEdges(a),this.insertUniqueEdges(a),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),gi.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(i),this.cancelDuplicateResultEdges();var f=new $r(this._geomFact);f.add(this._graph),this._resultPolyList=f.getPolygons();var g=new Gi(this,this._geomFact,this._ptLocator);this._resultLineList=g.build(i);var v=new qo(this,this._geomFact,this._ptLocator);this._resultPointList=v.build(i),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,i)},n.prototype.labelIncompleteNode=function(i,a){var f=this._ptLocator.locate(i.getCoordinate(),this._arg[a].getGeometry());i.getLabel().setLocation(a,f)},n.prototype.copyPoints=function(i){for(var a=this._arg[i].getNodeIterator();a.hasNext();){var f=a.next();this._graph.addNode(f.getCoordinate()).setLabel(i,f.getLabel().getLocation(i))}},n.prototype.findResultAreaEdges=function(i){for(var a=this._graph.getEdgeEnds().iterator();a.hasNext();){var f=a.next(),g=f.getLabel();g.isArea()&&!f.isInteriorAreaEdge()&&n.isResultOfOp(g.getLocation(0,dt.RIGHT),g.getLocation(1,dt.RIGHT),i)&&f.setInResult(!0)}},n.prototype.computeLabelsFromDepths=function(){for(var i=this._edgeList.iterator();i.hasNext();){var a=i.next(),f=a.getLabel(),g=a.getDepth();if(!g.isNull()){g.normalize();for(var v=0;v<2;v++)f.isNull(v)||!f.isArea()||g.isNull(v)||(g.getDelta(v)===0?f.toLine(v):(Nt.isTrue(!g.isNull(v,dt.LEFT),"depth of LEFT side has not been initialized"),f.setLocation(v,dt.LEFT,g.getLocation(v,dt.LEFT)),Nt.isTrue(!g.isNull(v,dt.RIGHT),"depth of RIGHT side has not been initialized"),f.setLocation(v,dt.RIGHT,g.getLocation(v,dt.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 a=i.next(),f=a.getLabel();a.isIsolated()&&(f.isNull(0)?this.labelIncompleteNode(a,0):this.labelIncompleteNode(a,1)),a.getEdges().updateLabelling(f)}},n.prototype.isCoveredByA=function(i){return!!this.isCovered(i,this._resultPolyList)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Po);Ht.overlayOp=function(t,n,i){return new Ht(t,n).getResultGeometry(i)},Ht.intersection=function(t,n){if(t.isEmpty()||n.isEmpty())return Ht.createEmptyResult(Ht.INTERSECTION,t,n,t.getFactory());if(t.isGeometryCollection()){var i=n;return Wo.map(t,{interfaces_:function(){return[Ms.MapOp]},map:function(a){return a.intersection(i)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),ur.overlayOp(t,n,Ht.INTERSECTION)},Ht.symDifference=function(t,n){if(t.isEmpty()||n.isEmpty()){if(t.isEmpty()&&n.isEmpty())return Ht.createEmptyResult(Ht.SYMDIFFERENCE,t,n,t.getFactory());if(t.isEmpty())return n.copy();if(n.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),ur.overlayOp(t,n,Ht.SYMDIFFERENCE)},Ht.resultDimension=function(t,n,i){var a=n.getDimension(),f=i.getDimension(),g=-1;switch(t){case Ht.INTERSECTION:g=Math.min(a,f);break;case Ht.UNION:g=Math.max(a,f);break;case Ht.DIFFERENCE:g=a;break;case Ht.SYMDIFFERENCE:g=Math.max(a,f)}return g},Ht.createEmptyResult=function(t,n,i,a){var f=null;switch(Ht.resultDimension(t,n,i)){case-1:f=a.createGeometryCollection(new Array(0).fill(null));break;case 0:f=a.createPoint();break;case 1:f=a.createLineString();break;case 2:f=a.createPolygon()}return f},Ht.difference=function(t,n){return t.isEmpty()?Ht.createEmptyResult(Ht.DIFFERENCE,t,n,t.getFactory()):n.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),ur.overlayOp(t,n,Ht.DIFFERENCE))},Ht.isResultOfOp=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1],i=t.getLocation(0),a=t.getLocation(1);return Ht.isResultOfOp(i,a,n)}if(arguments.length===3){var f=arguments[0],g=arguments[1],v=arguments[2];switch(f===W.BOUNDARY&&(f=W.INTERIOR),g===W.BOUNDARY&&(g=W.INTERIOR),v){case Ht.INTERSECTION:return f===W.INTERIOR&&g===W.INTERIOR;case Ht.UNION:return f===W.INTERIOR||g===W.INTERIOR;case Ht.DIFFERENCE:return f===W.INTERIOR&&g!==W.INTERIOR;case Ht.SYMDIFFERENCE:return f===W.INTERIOR&&g!==W.INTERIOR||f!==W.INTERIOR&&g===W.INTERIOR}return!1}},Ht.INTERSECTION=1,Ht.UNION=2,Ht.DIFFERENCE=3,Ht.SYMDIFFERENCE=4;var rs=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new te,this._seg=new bt;var t=arguments[0],n=arguments[1];this._g=t,this._boundaryDistanceTolerance=n,this._linework=this.extractLinework(t)};rs.prototype.isWithinToleranceOfBoundary=function(t){for(var n=0;n<this._linework.getNumGeometries();n++)for(var i=this._linework.getGeometryN(n).getCoordinateSequence(),a=0;a<i.size()-1;a++)if(i.getCoordinate(a,this._seg.p0),i.getCoordinate(a+1,this._seg.p1),this._seg.distance(t)<=this._boundaryDistanceTolerance)return!0;return!1},rs.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?W.BOUNDARY:this._ptLocator.locate(t,this._g)},rs.prototype.extractLinework=function(t){var n=new fa;t.apply(n);var i=n.getLinework(),a=Qt.toLineStringArray(i);return t.getFactory().createMultiLineString(a)},rs.prototype.interfaces_=function(){return[]},rs.prototype.getClass=function(){return rs};var fa=function(){this._linework=null,this._linework=new j};fa.prototype.getLinework=function(){return this._linework},fa.prototype.filter=function(t){if(t instanceof Zn){var n=t;this._linework.add(n.getExteriorRing());for(var i=0;i<n.getNumInteriorRing();i++)this._linework.add(n.getInteriorRingN(i))}},fa.prototype.interfaces_=function(){return[Wn]},fa.prototype.getClass=function(){return fa};var Ss=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};Ss.prototype.extractPoints=function(t,n,i){for(var a=t.getCoordinates(),f=0;f<a.length-1;f++)this.computeOffsetPoints(a[f],a[f+1],n,i)},Ss.prototype.setSidesToGenerate=function(t,n){this._doLeft=t,this._doRight=n},Ss.prototype.getPoints=function(t){for(var n=new j,i=Dt.getLines(this._g).iterator();i.hasNext();){var a=i.next();this.extractPoints(a,t,n)}return n},Ss.prototype.computeOffsetPoints=function(t,n,i,a){var f=n.x-t.x,g=n.y-t.y,v=Math.sqrt(f*f+g*g),M=i*f/v,P=i*g/v,V=(n.x+t.x)/2,tt=(n.y+t.y)/2;if(this._doLeft){var nt=new U(V-P,tt+M);a.add(nt)}if(this._doRight){var vt=new U(V+P,tt-M);a.add(vt)}},Ss.prototype.interfaces_=function(){return[]},Ss.prototype.getClass=function(){return Ss};var Or=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 j;var n=arguments[0],i=arguments[1],a=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(n,i),this._geom=[n,i,a],this._locFinder=[new rs(this._geom[0],this._boundaryDistanceTolerance),new rs(this._geom[1],this._boundaryDistanceTolerance),new rs(this._geom[2],this._boundaryDistanceTolerance)]},ha={TOLERANCE:{configurable:!0}};Or.prototype.reportResult=function(t,n,i){Ge.out.println("Overlay result invalid - A:"+W.toLocationSymbol(n[0])+" B:"+W.toLocationSymbol(n[1])+" expected:"+(i?"i":"e")+" actual:"+W.toLocationSymbol(n[2]))},Or.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var n=this.checkValid(t);return n},Or.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 a=arguments[0],f=arguments[1];return this._location[0]=this._locFinder[0].getLocation(f),this._location[1]=this._locFinder[1].getLocation(f),this._location[2]=this._locFinder[2].getLocation(f),!!Or.hasLocation(this._location,W.BOUNDARY)||this.isValidResult(a,this._location)}},Or.prototype.addTestPts=function(t){var n=new Ss(t);this._testCoords.addAll(n.getPoints(5*this._boundaryDistanceTolerance))},Or.prototype.isValidResult=function(t,n){var i=Ht.isResultOfOp(n[0],n[1],t),a=!(i^n[2]===W.INTERIOR);return a||this.reportResult(t,n,i),a},Or.prototype.getInvalidLocation=function(){return this._invalidLocation},Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or},Or.hasLocation=function(t,n){for(var i=0;i<3;i++)if(t[i]===n)return!0;return!1},Or.computeBoundaryDistanceTolerance=function(t,n){return Math.min(bn.computeSizeBasedSnapTolerance(t),bn.computeSizeBasedSnapTolerance(n))},Or.isValid=function(t,n,i,a){return new Or(t,n,a).isValid(i)},ha.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(Or,ha);var ei=function t(n){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(n),this._inputGeoms=n};ei.prototype.extractElements=function(t,n){if(t===null)return null;for(var i=0;i<t.getNumGeometries();i++){var a=t.getGeometryN(i);this._skipEmpty&&a.isEmpty()||n.add(a)}},ei.prototype.combine=function(){for(var t=new j,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)},ei.prototype.interfaces_=function(){return[]},ei.prototype.getClass=function(){return ei},ei.combine=function(){if(arguments.length===1){var t=arguments[0];return new ei(t).combine()}if(arguments.length===2){var n=arguments[0],i=arguments[1];return new ei(ei.createList(n,i)).combine()}if(arguments.length===3){var a=arguments[0],f=arguments[1],g=arguments[2];return new ei(ei.createList(a,f,g)).combine()}},ei.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},ei.createList=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1],i=new j;return i.add(t),i.add(n),i}if(arguments.length===3){var a=arguments[0],f=arguments[1],g=arguments[2],v=new j;return v.add(a),v.add(f),v.add(g),v}};var I=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,this._inputPolys===null&&(this._inputPolys=new j)},qs={STRTREE_NODE_CAPACITY:{configurable:!0}};I.prototype.reduceToGeometries=function(t){for(var n=new j,i=t.iterator();i.hasNext();){var a=i.next(),f=null;yt(a,at)?f=this.unionTree(a):a instanceof Ft&&(f=a),n.add(f)}return n},I.prototype.extractByEnvelope=function(t,n,i){for(var a=new j,f=0;f<n.getNumGeometries();f++){var g=n.getGeometryN(f);g.getEnvelopeInternal().intersects(t)?a.add(g):i.add(g)}return this._geomFactory.buildGeometry(a)},I.prototype.unionOptimized=function(t,n){var i=t.getEnvelopeInternal(),a=n.getEnvelopeInternal();if(!i.intersects(a))return ei.combine(t,n);if(t.getNumGeometries()<=1&&n.getNumGeometries()<=1)return this.unionActual(t,n);var f=i.intersection(a);return this.unionUsingEnvelopeIntersection(t,n,f)},I.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 il(I.STRTREE_NODE_CAPACITY),n=this._inputPolys.iterator();n.hasNext();){var i=n.next();t.insert(i.getEnvelopeInternal(),i)}this._inputPolys=null;var a=t.itemsTree();return this.unionTree(a)},I.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],a=arguments[2];if(a-i<=1){var f=I.getGeometry(n,i);return this.unionSafe(f,null)}if(a-i==2)return this.unionSafe(I.getGeometry(n,i),I.getGeometry(n,i+1));var g=Math.trunc((a+i)/2),v=this.binaryUnion(n,i,g),M=this.binaryUnion(n,g,a);return this.unionSafe(v,M)}},I.prototype.repeatedUnion=function(t){for(var n=null,i=t.iterator();i.hasNext();){var a=i.next();n=n===null?a.copy():n.union(a)}return n},I.prototype.unionSafe=function(t,n){return t===null&&n===null?null:t===null?n.copy():n===null?t.copy():this.unionOptimized(t,n)},I.prototype.unionActual=function(t,n){return I.restrictToPolygons(t.union(n))},I.prototype.unionTree=function(t){var n=this.reduceToGeometries(t);return this.binaryUnion(n)},I.prototype.unionUsingEnvelopeIntersection=function(t,n,i){var a=new j,f=this.extractByEnvelope(i,t,a),g=this.extractByEnvelope(i,n,a),v=this.unionActual(f,g);return a.add(v),ei.combine(a)},I.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)}},I.prototype.interfaces_=function(){return[]},I.prototype.getClass=function(){return I},I.restrictToPolygons=function(t){if(yt(t,Qo))return t;var n=At.getPolygons(t);return n.size()===1?n.get(0):t.getFactory().createMultiPolygon(Qt.toPolygonArray(n))},I.getGeometry=function(t,n){return n>=t.size()?null:t.get(n)},I.union=function(t){return new I(t).union()},qs.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(I,qs);var bs=function(){};bs.prototype.interfaces_=function(){return[]},bs.prototype.getClass=function(){return bs},bs.union=function(t,n){if(t.isEmpty()||n.isEmpty()){if(t.isEmpty()&&n.isEmpty())return Ht.createEmptyResult(Ht.UNION,t,n,t.getFactory());if(t.isEmpty())return n.copy();if(n.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),ur.overlayOp(t,n,Ht.UNION)},o.GeoJSONReader=Ua,o.GeoJSONWriter=Fs,o.OverlayOp=Ht,o.UnionOp=bs,o.BufferOp=mr,Object.defineProperty(o,"__esModule",{value:!0})})});var Y1=It((Ju,Yl)=>{(function(){var o,e="4.17.21",r=200,u="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",l="Expected a function",h="Invalid `variable` option passed into `_.template`",p="__lodash_hash_undefined__",m=500,y="__lodash_placeholder__",x=1,E=2,b=4,S=1,C=2,D=1,G=2,O=4,L=8,k=16,F=32,$=64,Z=128,it=256,et=512,U=30,wt="...",Lt=800,Ot=16,W=1,de=2,yt=3,zt=1/0,Kt=9007199254740991,ie=17976931348623157e292,_t=NaN,Pt=4294967295,q=Pt-1,oe=Pt>>>1,Vt=[["ary",Z],["bind",D],["bindKey",G],["curry",L],["curryRight",k],["flip",et],["partial",F],["partialRight",$],["rearg",it]],tn="[object Arguments]",Mt="[object Array]",mn="[object AsyncFunction]",Hn="[object Boolean]",yn="[object Date]",Ge="[object DOMException]",an="[object Error]",Et="[object Function]",Pr="[object GeneratorFunction]",Jt="[object Map]",jn="[object Number]",hn="[object Null]",vn="[object Object]",On="[object Promise]",xr="[object Proxy]",ui="[object RegExp]",Nt="[object Set]",He="[object String]",wi="[object Symbol]",Mi="[object Undefined]",qr="[object WeakMap]",Rr="[object WeakSet]",mt="[object ArrayBuffer]",Ni="[object DataView]",Di="[object Float32Array]",Ft="[object Float64Array]",Si="[object Int8Array]",Os="[object Int16Array]",Y="[object Int32Array]",w="[object Uint8Array]",T="[object Uint8ClampedArray]",N="[object Uint16Array]",z="[object Uint32Array]",B=/\\b__p \\+= \'\';/g,st=/\\b(__p \\+=) \'\' \\+/g,K=/(__e\\(.*?\\)|\\b__t\\)) \\+\\n\'\';/g,ct=/&(?:amp|lt|gt|quot|#39);/g,at=/[&<>"\']/g,j=RegExp(ct.source),rt=RegExp(at.source),ft=/<%-([\\s\\S]+?)%>/g,lt=/<%([\\s\\S]+?)%>/g,Gt=/<%=([\\s\\S]+?)%>/g,kt=/\\.|\\[(?:[^[\\]]*|(["\'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,re=/^\\w*$/,Yt=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,wn=/[\\\\^$.*+?()[\\]{}|]/g,pr=RegExp(wn.source),Vn=/^\\s+/,Tn=/\\s/,tr=/\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,Ur=/\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,Fn=/,? & /,Wt=/[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g,Un=/[()=,{}\\[\\]\\/\\s]/,Wn=/\\\\(\\\\)?/g,Bn=/\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g,_n=/\\w*$/,bi=/^[-+]0x[0-9a-f]+$/i,Xr=/^0b[01]+$/i,ea=/^\\[object .+?Constructor\\]$/,Yr=/^0o[0-7]+$/i,Ku=/^(?:0|[1-9]\\d*)$/,zn=/[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g,xn=/($^)/,La=/[\'\\n\\r\\u2028\\u2029\\\\]/g,Er="\\\\ud800-\\\\udfff",Qo="\\\\u0300-\\\\u036f",Zn="\\\\ufe20-\\\\ufe2f",na="\\\\u20d0-\\\\u20ff",Ki=Qo+Zn+na,Qi="\\\\u2700-\\\\u27bf",li="a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff",au="\\\\xac\\\\xb1\\\\xd7\\\\xf7",Na="\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf",Da="\\\\u2000-\\\\u206f",Oa=" \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000",Pn="A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde",Qu="\\\\ufe0e\\\\ufe0f",ji=au+Na+Da+Oa,Fa="[\'\\u2019]",$l="["+Er+"]",ue="["+ji+"]",ra="["+Ki+"]",Oi="\\\\d+",ju="["+Qi+"]",Qt="["+li+"]",tl="[^"+Er+ji+Oi+Qi+li+Pn+"]",el="\\\\ud83c[\\\\udffb-\\\\udfff]",uu="(?:"+ra+"|"+el+")",Fi="[^"+Er+"]",to="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",Ua="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",Fs="["+Pn+"]",dt="\\\\u200d",Ba="(?:"+Qt+"|"+tl+")",eo="(?:"+Fs+"|"+tl+")",Mo="(?:"+Fa+"(?:d|ll|m|re|s|t|ve))?",za="(?:"+Fa+"(?:D|LL|M|RE|S|T|VE))?",wr=uu+"?",un="["+Qu+"]?",Ve="(?:"+dt+"(?:"+[Fi,to,Ua].join("|")+")"+un+wr+")*",qn="\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])",Gf="\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])",Zl=un+wr+Ve,ci="(?:"+[ju,to,Ua].join("|")+")"+Zl,lu="(?:"+[Fi+ra+"?",ra,to,Ua,$l].join("|")+")",no=RegExp(Fa,"g"),on=RegExp(ra,"g"),Us=RegExp(el+"(?="+el+")|"+lu+Zl,"g"),Mr=RegExp([Fs+"?"+Qt+"+"+Mo+"(?="+[ue,Fs,"$"].join("|")+")",eo+"+"+za+"(?="+[ue,Fs+Ba,"$"].join("|")+")",Fs+"?"+Ba+"+"+Mo,Fs+"+"+za,Gf,qn,Oi,ci].join("|"),"g"),nl=RegExp("["+dt+Er+Ki+Qu+"]"),ia=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Cn=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],$r=-1,gn={};gn[Di]=gn[Ft]=gn[Si]=gn[Os]=gn[Y]=gn[w]=gn[T]=gn[N]=gn[z]=!0,gn[tn]=gn[Mt]=gn[mt]=gn[Hn]=gn[Ni]=gn[yn]=gn[an]=gn[Et]=gn[Jt]=gn[jn]=gn[vn]=gn[ui]=gn[Nt]=gn[He]=gn[qr]=!1;var le={};le[tn]=le[Mt]=le[mt]=le[Ni]=le[Hn]=le[yn]=le[Di]=le[Ft]=le[Si]=le[Os]=le[Y]=le[Jt]=le[jn]=le[vn]=le[ui]=le[Nt]=le[He]=le[wi]=le[w]=le[T]=le[N]=le[z]=!0,le[an]=le[Et]=le[qr]=!1;var Bo={\\u00C0:"A",\\u00C1:"A",\\u00C2:"A",\\u00C3:"A",\\u00C4:"A",\\u00C5:"A",\\u00E0:"a",\\u00E1:"a",\\u00E2:"a",\\u00E3:"a",\\u00E4:"a",\\u00E5:"a",\\u00C7:"C",\\u00E7:"c",\\u00D0:"D",\\u00F0:"d",\\u00C8:"E",\\u00C9:"E",\\u00CA:"E",\\u00CB:"E",\\u00E8:"e",\\u00E9:"e",\\u00EA:"e",\\u00EB:"e",\\u00CC:"I",\\u00CD:"I",\\u00CE:"I",\\u00CF:"I",\\u00EC:"i",\\u00ED:"i",\\u00EE:"i",\\u00EF:"i",\\u00D1:"N",\\u00F1:"n",\\u00D2:"O",\\u00D3:"O",\\u00D4:"O",\\u00D5:"O",\\u00D6:"O",\\u00D8:"O",\\u00F2:"o",\\u00F3:"o",\\u00F4:"o",\\u00F5:"o",\\u00F6:"o",\\u00F8:"o",\\u00D9:"U",\\u00DA:"U",\\u00DB:"U",\\u00DC:"U",\\u00F9:"u",\\u00FA:"u",\\u00FB:"u",\\u00FC:"u",\\u00DD:"Y",\\u00FD:"y",\\u00FF:"y",\\u00C6:"Ae",\\u00E6:"ae",\\u00DE:"Th",\\u00FE:"th",\\u00DF:"ss",\\u0100:"A",\\u0102:"A",\\u0104:"A",\\u0101:"a",\\u0103:"a",\\u0105:"a",\\u0106:"C",\\u0108:"C",\\u010A:"C",\\u010C:"C",\\u0107:"c",\\u0109:"c",\\u010B:"c",\\u010D:"c",\\u010E:"D",\\u0110:"D",\\u010F:"d",\\u0111:"d",\\u0112:"E",\\u0114:"E",\\u0116:"E",\\u0118:"E",\\u011A:"E",\\u0113:"e",\\u0115:"e",\\u0117:"e",\\u0119:"e",\\u011B:"e",\\u011C:"G",\\u011E:"G",\\u0120:"G",\\u0122:"G",\\u011D:"g",\\u011F:"g",\\u0121:"g",\\u0123:"g",\\u0124:"H",\\u0126:"H",\\u0125:"h",\\u0127:"h",\\u0128:"I",\\u012A:"I",\\u012C:"I",\\u012E:"I",\\u0130:"I",\\u0129:"i",\\u012B:"i",\\u012D:"i",\\u012F:"i",\\u0131:"i",\\u0134:"J",\\u0135:"j",\\u0136:"K",\\u0137:"k",\\u0138:"k",\\u0139:"L",\\u013B:"L",\\u013D:"L",\\u013F:"L",\\u0141:"L",\\u013A:"l",\\u013C:"l",\\u013E:"l",\\u0140:"l",\\u0142:"l",\\u0143:"N",\\u0145:"N",\\u0147:"N",\\u014A:"N",\\u0144:"n",\\u0146:"n",\\u0148:"n",\\u014B:"n",\\u014C:"O",\\u014E:"O",\\u0150:"O",\\u014D:"o",\\u014F:"o",\\u0151:"o",\\u0154:"R",\\u0156:"R",\\u0158:"R",\\u0155:"r",\\u0157:"r",\\u0159:"r",\\u015A:"S",\\u015C:"S",\\u015E:"S",\\u0160:"S",\\u015B:"s",\\u015D:"s",\\u015F:"s",\\u0161:"s",\\u0162:"T",\\u0164:"T",\\u0166:"T",\\u0163:"t",\\u0165:"t",\\u0167:"t",\\u0168:"U",\\u016A:"U",\\u016C:"U",\\u016E:"U",\\u0170:"U",\\u0172:"U",\\u0169:"u",\\u016B:"u",\\u016D:"u",\\u016F:"u",\\u0171:"u",\\u0173:"u",\\u0174:"W",\\u0175:"w",\\u0176:"Y",\\u0177:"y",\\u0178:"Y",\\u0179:"Z",\\u017B:"Z",\\u017D:"Z",\\u017A:"z",\\u017C:"z",\\u017E:"z",\\u0132:"IJ",\\u0133:"ij",\\u0152:"Oe",\\u0153:"oe",\\u0149:"\'n",\\u017F:"s"},jo={"&":"&","<":"<",">":">",\'"\':""","\'":"'"},Bs={"&":"&","<":"<",">":">",""":\'"\',"'":"\'"},Jn={"\\\\":"\\\\","\'":"\'","\\n":"n","\\r":"r","\\u2028":"u2028","\\u2029":"u2029"},Jl=parseFloat,Ui=parseInt,kn=typeof global=="object"&&global&&global.Object===Object&&global,or=typeof self=="object"&&self&&self.Object===Object&&self,sr=kn||or||Function("return this")(),rl=typeof Ju=="object"&&Ju&&!Ju.nodeType&&Ju,ro=rl&&typeof Yl=="object"&&Yl&&!Yl.nodeType&&Yl,il=ro&&ro.exports===rl,cu=il&&kn.process,Mn=function(){try{var J=ro&&ro.require&&ro.require("util").types;return J||cu&&cu.binding&&cu.binding("util")}catch{}}(),zo=Mn&&Mn.isArrayBuffer,Sr=Mn&&Mn.isDate,ds=Mn&&Mn.isMap,io=Mn&&Mn.isRegExp,oa=Mn&&Mn.isSet,Rn=Mn&&Mn.isTypedArray;function bt(J,ut,ot){switch(ot.length){case 0:return J.call(ut);case 1:return J.call(ut,ot[0]);case 2:return J.call(ut,ot[0],ot[1]);case 3:return J.call(ut,ot[0],ot[1],ot[2])}return J.apply(ut,ot)}function Kl(J,ut,ot,At){for(var Dt=-1,te=J==null?0:J.length;++Dt<te;){var ge=J[Dt];ut(At,ge,ot(ge),J)}return At}function Zr(J,ut){for(var ot=-1,At=J==null?0:J.length;++ot<At&&ut(J[ot],ot,J)!==!1;);return J}function Jr(J,ut){for(var ot=J==null?0:J.length;ot--&&ut(J[ot],ot,J)!==!1;);return J}function Bi(J,ut){for(var ot=-1,At=J==null?0:J.length;++ot<At;)if(!ut(J[ot],ot,J))return!1;return!0}function fi(J,ut){for(var ot=-1,At=J==null?0:J.length,Dt=0,te=[];++ot<At;){var ge=J[ot];ut(ge,ot,J)&&(te[Dt++]=ge)}return te}function gs(J,ut){var ot=J==null?0:J.length;return!!ot&&ko(J,ut,0)>-1}function ka(J,ut,ot){for(var At=-1,Dt=J==null?0:J.length;++At<Dt;)if(ot(ut,J[At]))return!0;return!1}function Gn(J,ut){for(var ot=-1,At=J==null?0:J.length,Dt=Array(At);++ot<At;)Dt[ot]=ut(J[ot],ot,J);return Dt}function jt(J,ut){for(var ot=-1,At=ut.length,Dt=J.length;++ot<At;)J[Dt+ot]=ut[ot];return J}function oo(J,ut,ot,At){var Dt=-1,te=J==null?0:J.length;for(At&&te&&(ot=J[++Dt]);++Dt<te;)ot=ut(ot,J[Dt],Dt,J);return ot}function Ln(J,ut,ot,At){var Dt=J==null?0:J.length;for(At&&Dt&&(ot=J[--Dt]);Dt--;)ot=ut(ot,J[Dt],Dt,J);return ot}function zs(J,ut){for(var ot=-1,At=J==null?0:J.length;++ot<At;)if(ut(J[ot],ot,J))return!0;return!1}var hi=Go("length");function Ql(J){return J.split("")}function ee(J){return J.match(Wt)||[]}function ms(J,ut,ot){var At;return ot(J,function(Dt,te,ge){if(ut(Dt,te,ge))return At=te,!1}),At}function ln(J,ut,ot,At){for(var Dt=J.length,te=ot+(At?1:-1);At?te--:++te<Dt;)if(ut(J[te],te,J))return te;return-1}function ko(J,ut,ot){return ut===ut?Ga(J,ut,ot):ln(J,ys,ot)}function Br(J,ut,ot,At){for(var Dt=ot-1,te=J.length;++Dt<te;)if(At(J[Dt],ut))return Dt;return-1}function ys(J){return J!==J}function ol(J,ut){var ot=J==null?0:J.length;return ot?zi(J,ut)/ot:_t}function Go(J){return function(ut){return ut==null?o:ut[J]}}function se(J){return function(ut){return J==null?o:J[ut]}}function pi(J,ut,ot,At,Dt){return Dt(J,function(te,ge,Sn){ot=At?(At=!1,te):ut(ot,te,ge,Sn)}),ot}function sa(J,ut){var ot=J.length;for(J.sort(ut);ot--;)J[ot]=J[ot].value;return J}function zi(J,ut){for(var ot,At=-1,Dt=J.length;++At<Dt;){var te=ut(J[At]);te!==o&&(ot=ot===o?te:ot+te)}return ot}function zr(J,ut){for(var ot=-1,At=Array(J);++ot<J;)At[ot]=ut(ot);return At}function br(J,ut){return Gn(ut,function(ot){return[ot,J[ot]]})}function jl(J){return J&&J.slice(0,_s(J)+1).replace(Vn,"")}function Ai(J){return function(ut){return J(ut)}}function So(J,ut){return Gn(ut,function(ot){return J[ot]})}function kr(J,ut){return J.has(ut)}function ts(J,ut){for(var ot=-1,At=J.length;++ot<At&&ko(ut,J[ot],0)>-1;);return ot}function Kr(J,ut){for(var ot=J.length;ot--&&ko(ut,J[ot],0)>-1;);return ot}function so(J,ut){for(var ot=J.length,At=0;ot--;)J[ot]===ut&&++At;return At}var bo=se(Bo),vs=se(jo);function Ho(J){return"\\\\"+Jn[J]}function dr(J,ut){return J==null?o:J[ut]}function ks(J){return nl.test(J)}function fu(J){return ia.test(J)}function Lr(J){for(var ut,ot=[];!(ut=J.next()).done;)ot.push(ut.value);return ot}function Ao(J){var ut=-1,ot=Array(J.size);return J.forEach(function(At,Dt){ot[++ut]=[Dt,At]}),ot}function ki(J,ut){return function(ot){return J(ut(ot))}}function es(J,ut){for(var ot=-1,At=J.length,Dt=0,te=[];++ot<At;){var ge=J[ot];(ge===ut||ge===y)&&(J[ot]=y,te[Dt++]=ot)}return te}function gr(J){var ut=-1,ot=Array(J.size);return J.forEach(function(At){ot[++ut]=At}),ot}function tc(J){var ut=-1,ot=Array(J.size);return J.forEach(function(At){ot[++ut]=[At,At]}),ot}function Ga(J,ut,ot){for(var At=ot-1,Dt=J.length;++At<Dt;)if(J[At]===ut)return At;return-1}function aa(J,ut,ot){for(var At=ot+1;At--;)if(J[At]===ut)return At;return At}function Gs(J){return ks(J)?mr(J):hi(J)}function ao(J){return ks(J)?ua(J):Ql(J)}function _s(J){for(var ut=J.length;ut--&&Tn.test(J.charAt(ut)););return ut}var To=se(Bs);function mr(J){for(var ut=Us.lastIndex=0;Us.test(J);)++ut;return ut}function ua(J){return J.match(Us)||[]}function Nr(J){return J.match(Mr)||[]}var Co=function J(ut){ut=ut==null?sr:di.defaults(sr.Object(),ut,di.pick(sr,Cn));var ot=ut.Array,At=ut.Date,Dt=ut.Error,te=ut.Function,ge=ut.Math,Sn=ut.Object,Io=ut.RegExp,Hs=ut.String,pn=ut.TypeError,er=ot.prototype,uo=te.prototype,Ar=Sn.prototype,la=ut["__core-js_shared__"],Vo=uo.toString,fe=Ar.hasOwnProperty,Qr=0,hu=function(){var s=/[^.]+$/.exec(la&&la.keys&&la.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),Kn=Ar.toString,sl=Vo.call(Sn),lo=sr._,ar=Io("^"+Vo.call(fe).replace(wn,"\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,"$1.*?")+"$"),jr=il?ut.Buffer:o,gi=ut.Symbol,Wo=ut.Uint8Array,Gi=jr?jr.allocUnsafe:o,qo=ki(Sn.getPrototypeOf,Sn),Dr=Sn.create,co=Ar.propertyIsEnumerable,bn=er.splice,al=gi?gi.isConcatSpreadable:o,ca=gi?gi.iterator:o,Xn=gi?gi.toStringTag:o,fo=function(){try{var s=Xa(Sn,"defineProperty");return s({},"",{}),s}catch{}}(),ul=ut.clearTimeout!==sr.clearTimeout&&ut.clearTimeout,Vs=At&&At.now!==sr.Date.now&&At.now,ns=ut.setTimeout!==sr.setTimeout&&ut.setTimeout,Yn=ge.ceil,ur=ge.floor,Ws=Sn.getOwnPropertySymbols,ti=jr?jr.isBuffer:o,pu=ut.isFinite,du=er.join,yr=ki(Sn.keys,Sn),Tr=ge.max,Nn=ge.min,ec=At.now,Ha=ut.parseInt,nc=ge.random,Hf=er.reverse,Hi=Xa(ut,"DataView"),Xo=Xa(ut,"Map"),xs=Xa(ut,"Promise"),Es=Xa(ut,"Set"),Yo=Xa(ut,"WeakMap"),ho=Xa(Sn,"create"),ws=Yo&&new Yo,Po={},Ms=Ya(Hi),Ht=Ya(Xo),rs=Ya(xs),fa=Ya(Es),Ss=Ya(Yo),Or=gi?gi.prototype:o,ha=Or?Or.valueOf:o,ei=Or?Or.toString:o;function I(s){if(vr(s)&&!ne(s)&&!(s instanceof n)){if(s instanceof t)return s;if(fe.call(s,"__wrapped__"))return Qg(s)}return new t(s)}var qs=function(){function s(){}return function(c){if(!lr(c))return{};if(Dr)return Dr(c);s.prototype=c;var d=new s;return s.prototype=o,d}}();function bs(){}function t(s,c){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!c,this.__index__=0,this.__values__=o}I.templateSettings={escape:ft,evaluate:lt,interpolate:Gt,variable:"",imports:{_:I}},I.prototype=bs.prototype,I.prototype.constructor=I,t.prototype=qs(bs.prototype),t.prototype.constructor=t;function n(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Pt,this.__views__=[]}function i(){var s=new n(this.__wrapped__);return s.__actions__=po(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=po(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=po(this.__views__),s}function a(){if(this.__filtered__){var s=new n(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function f(){var s=this.__wrapped__.value(),c=this.__dir__,d=ne(s),_=c<0,A=d?s.length:0,R=jx(0,A,this.__views__),H=R.start,X=R.end,Q=X-H,ht=_?X:H-1,pt=this.__iteratees__,gt=pt.length,Ct=0,Bt=Nn(Q,this.__takeCount__);if(!d||!_&&A==Q&&Bt==Q)return Eg(s,this.__actions__);var $t=[];t:for(;Q--&&Ct<Bt;){ht+=c;for(var ce=-1,Zt=s[ht];++ce<gt;){var qe=pt[ce],sn=qe.iteratee,Do=qe.type,qi=sn(Zt);if(Do==de)Zt=qi;else if(!qi){if(Do==W)continue t;break t}}$t[Ct++]=Zt}return $t}n.prototype=qs(bs.prototype),n.prototype.constructor=n;function g(s){var c=-1,d=s==null?0:s.length;for(this.clear();++c<d;){var _=s[c];this.set(_[0],_[1])}}function v(){this.__data__=ho?ho(null):{},this.size=0}function M(s){var c=this.has(s)&&delete this.__data__[s];return this.size-=c?1:0,c}function P(s){var c=this.__data__;if(ho){var d=c[s];return d===p?o:d}return fe.call(c,s)?c[s]:o}function V(s){var c=this.__data__;return ho?c[s]!==o:fe.call(c,s)}function tt(s,c){var d=this.__data__;return this.size+=this.has(s)?0:1,d[s]=ho&&c===o?p:c,this}g.prototype.clear=v,g.prototype.delete=M,g.prototype.get=P,g.prototype.has=V,g.prototype.set=tt;function nt(s){var c=-1,d=s==null?0:s.length;for(this.clear();++c<d;){var _=s[c];this.set(_[0],_[1])}}function vt(){this.__data__=[],this.size=0}function xt(s){var c=this.__data__,d=rc(c,s);if(d<0)return!1;var _=c.length-1;return d==_?c.pop():bn.call(c,d,1),--this.size,!0}function Tt(s){var c=this.__data__,d=rc(c,s);return d<0?o:c[d][1]}function Ut(s){return rc(this.__data__,s)>-1}function We(s,c){var d=this.__data__,_=rc(d,s);return _<0?(++this.size,d.push([s,c])):d[_][1]=c,this}nt.prototype.clear=vt,nt.prototype.delete=xt,nt.prototype.get=Tt,nt.prototype.has=Ut,nt.prototype.set=We;function cn(s){var c=-1,d=s==null?0:s.length;for(this.clear();++c<d;){var _=s[c];this.set(_[0],_[1])}}function Fr(){this.size=0,this.__data__={hash:new g,map:new(Xo||nt),string:new g}}function Ro(s){var c=gc(this,s).delete(s);return this.size-=c?1:0,c}function is(s){return gc(this,s).get(s)}function ll(s){return gc(this,s).has(s)}function nx(s,c){var d=gc(this,s),_=d.size;return d.set(s,c),this.size+=d.size==_?0:1,this}cn.prototype.clear=Fr,cn.prototype.delete=Ro,cn.prototype.get=is,cn.prototype.has=ll,cn.prototype.set=nx;function Va(s){var c=-1,d=s==null?0:s.length;for(this.__data__=new cn;++c<d;)this.add(s[c])}function rx(s){return this.__data__.set(s,p),this}function ix(s){return this.__data__.has(s)}Va.prototype.add=Va.prototype.push=rx,Va.prototype.has=ix;function os(s){var c=this.__data__=new nt(s);this.size=c.size}function ox(){this.__data__=new nt,this.size=0}function sx(s){var c=this.__data__,d=c.delete(s);return this.size=c.size,d}function ax(s){return this.__data__.get(s)}function ux(s){return this.__data__.has(s)}function lx(s,c){var d=this.__data__;if(d instanceof nt){var _=d.__data__;if(!Xo||_.length<r-1)return _.push([s,c]),this.size=++d.size,this;d=this.__data__=new cn(_)}return d.set(s,c),this.size=d.size,this}os.prototype.clear=ox,os.prototype.delete=sx,os.prototype.get=ax,os.prototype.has=ux,os.prototype.set=lx;function Qd(s,c){var d=ne(s),_=!d&&$a(s),A=!d&&!_&&ya(s),R=!d&&!_&&!A&&vu(s),H=d||_||A||R,X=H?zr(s.length,Hs):[],Q=X.length;for(var ht in s)(c||fe.call(s,ht))&&!(H&&(ht=="length"||A&&(ht=="offset"||ht=="parent")||R&&(ht=="buffer"||ht=="byteLength"||ht=="byteOffset")||Zs(ht,Q)))&&X.push(ht);return X}function jd(s){var c=s.length;return c?s[jf(0,c-1)]:o}function cx(s,c){return mc(po(s),Wa(c,0,s.length))}function fx(s){return mc(po(s))}function Vf(s,c,d){(d!==o&&!ss(s[c],d)||d===o&&!(c in s))&&Xs(s,c,d)}function cl(s,c,d){var _=s[c];(!(fe.call(s,c)&&ss(_,d))||d===o&&!(c in s))&&Xs(s,c,d)}function rc(s,c){for(var d=s.length;d--;)if(ss(s[d][0],c))return d;return-1}function hx(s,c,d,_){return pa(s,function(A,R,H){c(_,A,d(A),H)}),_}function tg(s,c){return s&&Ts(c,ni(c),s)}function px(s,c){return s&&Ts(c,mo(c),s)}function Xs(s,c,d){c=="__proto__"&&fo?fo(s,c,{configurable:!0,enumerable:!0,value:d,writable:!0}):s[c]=d}function Wf(s,c){for(var d=-1,_=c.length,A=ot(_),R=s==null;++d<_;)A[d]=R?o:Sh(s,c[d]);return A}function Wa(s,c,d){return s===s&&(d!==o&&(s=s<=d?s:d),c!==o&&(s=s>=c?s:c)),s}function $o(s,c,d,_,A,R){var H,X=c&x,Q=c&E,ht=c&b;if(d&&(H=A?d(s,_,A,R):d(s)),H!==o)return H;if(!lr(s))return s;var pt=ne(s);if(pt){if(H=eE(s),!X)return po(s,H)}else{var gt=Ti(s),Ct=gt==Et||gt==Pr;if(ya(s))return Sg(s,X);if(gt==vn||gt==tn||Ct&&!A){if(H=Q||Ct?{}:Vg(s),!X)return Q?Wx(s,px(H,s)):Vx(s,tg(H,s))}else{if(!le[gt])return A?s:{};H=nE(s,gt,X)}}R||(R=new os);var Bt=R.get(s);if(Bt)return Bt;R.set(s,H),vm(s)?s.forEach(function(Zt){H.add($o(Zt,c,d,Zt,s,R))}):mm(s)&&s.forEach(function(Zt,qe){H.set(qe,$o(Zt,c,d,qe,s,R))});var $t=ht?Q?ch:lh:Q?mo:ni,ce=pt?o:$t(s);return Zr(ce||s,function(Zt,qe){ce&&(qe=Zt,Zt=s[qe]),cl(H,qe,$o(Zt,c,d,qe,s,R))}),H}function dx(s){var c=ni(s);return function(d){return eg(d,s,c)}}function eg(s,c,d){var _=d.length;if(s==null)return!_;for(s=Sn(s);_--;){var A=d[_],R=c[A],H=s[A];if(H===o&&!(A in s)||!R(H))return!1}return!0}function ng(s,c,d){if(typeof s!="function")throw new pn(l);return yl(function(){s.apply(o,d)},c)}function fl(s,c,d,_){var A=-1,R=gs,H=!0,X=s.length,Q=[],ht=c.length;if(!X)return Q;d&&(c=Gn(c,Ai(d))),_?(R=ka,H=!1):c.length>=r&&(R=kr,H=!1,c=new Va(c));t:for(;++A<X;){var pt=s[A],gt=d==null?pt:d(pt);if(pt=_||pt!==0?pt:0,H&>===gt){for(var Ct=ht;Ct--;)if(c[Ct]===gt)continue t;Q.push(pt)}else R(c,gt,_)||Q.push(pt)}return Q}var pa=Ig(As),rg=Ig(Xf,!0);function gx(s,c){var d=!0;return pa(s,function(_,A,R){return d=!!c(_,A,R),d}),d}function ic(s,c,d){for(var _=-1,A=s.length;++_<A;){var R=s[_],H=c(R);if(H!=null&&(X===o?H===H&&!No(H):d(H,X)))var X=H,Q=R}return Q}function mx(s,c,d,_){var A=s.length;for(d=ae(d),d<0&&(d=-d>A?0:A+d),_=_===o||_>A?A:ae(_),_<0&&(_+=A),_=d>_?0:xm(_);d<_;)s[d++]=c;return s}function ig(s,c){var d=[];return pa(s,function(_,A,R){c(_,A,R)&&d.push(_)}),d}function mi(s,c,d,_,A){var R=-1,H=s.length;for(d||(d=iE),A||(A=[]);++R<H;){var X=s[R];c>0&&d(X)?c>1?mi(X,c-1,d,_,A):jt(A,X):_||(A[A.length]=X)}return A}var qf=Pg(),og=Pg(!0);function As(s,c){return s&&qf(s,c,ni)}function Xf(s,c){return s&&og(s,c,ni)}function oc(s,c){return fi(c,function(d){return Js(s[d])})}function qa(s,c){c=ga(c,s);for(var d=0,_=c.length;s!=null&&d<_;)s=s[Cs(c[d++])];return d&&d==_?s:o}function sg(s,c,d){var _=c(s);return ne(s)?_:jt(_,d(s))}function Vi(s){return s==null?s===o?Mi:hn:Xn&&Xn in Sn(s)?Qx(s):fE(s)}function Yf(s,c){return s>c}function yx(s,c){return s!=null&&fe.call(s,c)}function vx(s,c){return s!=null&&c in Sn(s)}function _x(s,c,d){return s>=Nn(c,d)&&s<Tr(c,d)}function $f(s,c,d){for(var _=d?ka:gs,A=s[0].length,R=s.length,H=R,X=ot(R),Q=1/0,ht=[];H--;){var pt=s[H];H&&c&&(pt=Gn(pt,Ai(c))),Q=Nn(pt.length,Q),X[H]=!d&&(c||A>=120&&pt.length>=120)?new Va(H&&pt):o}pt=s[0];var gt=-1,Ct=X[0];t:for(;++gt<A&&ht.length<Q;){var Bt=pt[gt],$t=c?c(Bt):Bt;if(Bt=d||Bt!==0?Bt:0,!(Ct?kr(Ct,$t):_(ht,$t,d))){for(H=R;--H;){var ce=X[H];if(!(ce?kr(ce,$t):_(s[H],$t,d)))continue t}Ct&&Ct.push($t),ht.push(Bt)}}return ht}function xx(s,c,d,_){return As(s,function(A,R,H){c(_,d(A),R,H)}),_}function hl(s,c,d){c=ga(c,s),s=Yg(s,c);var _=s==null?s:s[Cs(Jo(c))];return _==null?o:bt(_,s,d)}function ag(s){return vr(s)&&Vi(s)==tn}function Ex(s){return vr(s)&&Vi(s)==mt}function wx(s){return vr(s)&&Vi(s)==yn}function pl(s,c,d,_,A){return s===c?!0:s==null||c==null||!vr(s)&&!vr(c)?s!==s&&c!==c:Mx(s,c,d,_,pl,A)}function Mx(s,c,d,_,A,R){var H=ne(s),X=ne(c),Q=H?Mt:Ti(s),ht=X?Mt:Ti(c);Q=Q==tn?vn:Q,ht=ht==tn?vn:ht;var pt=Q==vn,gt=ht==vn,Ct=Q==ht;if(Ct&&ya(s)){if(!ya(c))return!1;H=!0,pt=!1}if(Ct&&!pt)return R||(R=new os),H||vu(s)?kg(s,c,d,_,A,R):Jx(s,c,Q,d,_,A,R);if(!(d&S)){var Bt=pt&&fe.call(s,"__wrapped__"),$t=gt&&fe.call(c,"__wrapped__");if(Bt||$t){var ce=Bt?s.value():s,Zt=$t?c.value():c;return R||(R=new os),A(ce,Zt,d,_,R)}}return Ct?(R||(R=new os),Kx(s,c,d,_,A,R)):!1}function Sx(s){return vr(s)&&Ti(s)==Jt}function Zf(s,c,d,_){var A=d.length,R=A,H=!_;if(s==null)return!R;for(s=Sn(s);A--;){var X=d[A];if(H&&X[2]?X[1]!==s[X[0]]:!(X[0]in s))return!1}for(;++A<R;){X=d[A];var Q=X[0],ht=s[Q],pt=X[1];if(H&&X[2]){if(ht===o&&!(Q in s))return!1}else{var gt=new os;if(_)var Ct=_(ht,pt,Q,s,c,gt);if(!(Ct===o?pl(pt,ht,S|C,_,gt):Ct))return!1}}return!0}function ug(s){if(!lr(s)||sE(s))return!1;var c=Js(s)?ar:ea;return c.test(Ya(s))}function bx(s){return vr(s)&&Vi(s)==ui}function Ax(s){return vr(s)&&Ti(s)==Nt}function Tx(s){return vr(s)&&wc(s.length)&&!!gn[Vi(s)]}function lg(s){return typeof s=="function"?s:s==null?yo:typeof s=="object"?ne(s)?hg(s[0],s[1]):fg(s):Rm(s)}function Jf(s){if(!ml(s))return yr(s);var c=[];for(var d in Sn(s))fe.call(s,d)&&d!="constructor"&&c.push(d);return c}function Cx(s){if(!lr(s))return cE(s);var c=ml(s),d=[];for(var _ in s)_=="constructor"&&(c||!fe.call(s,_))||d.push(_);return d}function Kf(s,c){return s<c}function cg(s,c){var d=-1,_=go(s)?ot(s.length):[];return pa(s,function(A,R,H){_[++d]=c(A,R,H)}),_}function fg(s){var c=hh(s);return c.length==1&&c[0][2]?qg(c[0][0],c[0][1]):function(d){return d===s||Zf(d,s,c)}}function hg(s,c){return dh(s)&&Wg(c)?qg(Cs(s),c):function(d){var _=Sh(d,s);return _===o&&_===c?bh(d,s):pl(c,_,S|C)}}function sc(s,c,d,_,A){s!==c&&qf(c,function(R,H){if(A||(A=new os),lr(R))Ix(s,c,H,d,sc,_,A);else{var X=_?_(mh(s,H),R,H+"",s,c,A):o;X===o&&(X=R),Vf(s,H,X)}},mo)}function Ix(s,c,d,_,A,R,H){var X=mh(s,d),Q=mh(c,d),ht=H.get(Q);if(ht){Vf(s,d,ht);return}var pt=R?R(X,Q,d+"",s,c,H):o,gt=pt===o;if(gt){var Ct=ne(Q),Bt=!Ct&&ya(Q),$t=!Ct&&!Bt&&vu(Q);pt=Q,Ct||Bt||$t?ne(X)?pt=X:Cr(X)?pt=po(X):Bt?(gt=!1,pt=Sg(Q,!0)):$t?(gt=!1,pt=bg(Q,!0)):pt=[]:vl(Q)||$a(Q)?(pt=X,$a(X)?pt=Em(X):(!lr(X)||Js(X))&&(pt=Vg(Q))):gt=!1}gt&&(H.set(Q,pt),A(pt,Q,_,R,H),H.delete(Q)),Vf(s,d,pt)}function pg(s,c){var d=s.length;if(d)return c+=c<0?d:0,Zs(c,d)?s[c]:o}function dg(s,c,d){c.length?c=Gn(c,function(R){return ne(R)?function(H){return qa(H,R.length===1?R[0]:R)}:R}):c=[yo];var _=-1;c=Gn(c,Ai(qt()));var A=cg(s,function(R,H,X){var Q=Gn(c,function(ht){return ht(R)});return{criteria:Q,index:++_,value:R}});return sa(A,function(R,H){return Hx(R,H,d)})}function Px(s,c){return gg(s,c,function(d,_){return bh(s,_)})}function gg(s,c,d){for(var _=-1,A=c.length,R={};++_<A;){var H=c[_],X=qa(s,H);d(X,H)&&dl(R,ga(H,s),X)}return R}function Rx(s){return function(c){return qa(c,s)}}function Qf(s,c,d,_){var A=_?Br:ko,R=-1,H=c.length,X=s;for(s===c&&(c=po(c)),d&&(X=Gn(s,Ai(d)));++R<H;)for(var Q=0,ht=c[R],pt=d?d(ht):ht;(Q=A(X,pt,Q,_))>-1;)X!==s&&bn.call(X,Q,1),bn.call(s,Q,1);return s}function mg(s,c){for(var d=s?c.length:0,_=d-1;d--;){var A=c[d];if(d==_||A!==R){var R=A;Zs(A)?bn.call(s,A,1):nh(s,A)}}return s}function jf(s,c){return s+ur(nc()*(c-s+1))}function Lx(s,c,d,_){for(var A=-1,R=Tr(Yn((c-s)/(d||1)),0),H=ot(R);R--;)H[_?R:++A]=s,s+=d;return H}function th(s,c){var d="";if(!s||c<1||c>Kt)return d;do c%2&&(d+=s),c=ur(c/2),c&&(s+=s);while(c);return d}function he(s,c){return yh(Xg(s,c,yo),s+"")}function Nx(s){return jd(_u(s))}function Dx(s,c){var d=_u(s);return mc(d,Wa(c,0,d.length))}function dl(s,c,d,_){if(!lr(s))return s;c=ga(c,s);for(var A=-1,R=c.length,H=R-1,X=s;X!=null&&++A<R;){var Q=Cs(c[A]),ht=d;if(Q==="__proto__"||Q==="constructor"||Q==="prototype")return s;if(A!=H){var pt=X[Q];ht=_?_(pt,Q,X):o,ht===o&&(ht=lr(pt)?pt:Zs(c[A+1])?[]:{})}cl(X,Q,ht),X=X[Q]}return s}var yg=ws?function(s,c){return ws.set(s,c),s}:yo,Ox=fo?function(s,c){return fo(s,"toString",{configurable:!0,enumerable:!1,value:Th(c),writable:!0})}:yo;function Fx(s){return mc(_u(s))}function Zo(s,c,d){var _=-1,A=s.length;c<0&&(c=-c>A?0:A+c),d=d>A?A:d,d<0&&(d+=A),A=c>d?0:d-c>>>0,c>>>=0;for(var R=ot(A);++_<A;)R[_]=s[_+c];return R}function Ux(s,c){var d;return pa(s,function(_,A,R){return d=c(_,A,R),!d}),!!d}function ac(s,c,d){var _=0,A=s==null?_:s.length;if(typeof c=="number"&&c===c&&A<=oe){for(;_<A;){var R=_+A>>>1,H=s[R];H!==null&&!No(H)&&(d?H<=c:H<c)?_=R+1:A=R}return A}return eh(s,c,yo,d)}function eh(s,c,d,_){var A=0,R=s==null?0:s.length;if(R===0)return 0;c=d(c);for(var H=c!==c,X=c===null,Q=No(c),ht=c===o;A<R;){var pt=ur((A+R)/2),gt=d(s[pt]),Ct=gt!==o,Bt=gt===null,$t=gt===gt,ce=No(gt);if(H)var Zt=_||$t;else ht?Zt=$t&&(_||Ct):X?Zt=$t&&Ct&&(_||!Bt):Q?Zt=$t&&Ct&&!Bt&&(_||!ce):Bt||ce?Zt=!1:Zt=_?gt<=c:gt<c;Zt?A=pt+1:R=pt}return Nn(R,q)}function vg(s,c){for(var d=-1,_=s.length,A=0,R=[];++d<_;){var H=s[d],X=c?c(H):H;if(!d||!ss(X,Q)){var Q=X;R[A++]=H===0?0:H}}return R}function _g(s){return typeof s=="number"?s:No(s)?_t:+s}function Lo(s){if(typeof s=="string")return s;if(ne(s))return Gn(s,Lo)+"";if(No(s))return ei?ei.call(s):"";var c=s+"";return c=="0"&&1/s==-zt?"-0":c}function da(s,c,d){var _=-1,A=gs,R=s.length,H=!0,X=[],Q=X;if(d)H=!1,A=ka;else if(R>=r){var ht=c?null:$x(s);if(ht)return gr(ht);H=!1,A=kr,Q=new Va}else Q=c?[]:X;t:for(;++_<R;){var pt=s[_],gt=c?c(pt):pt;if(pt=d||pt!==0?pt:0,H&>===gt){for(var Ct=Q.length;Ct--;)if(Q[Ct]===gt)continue t;c&&Q.push(gt),X.push(pt)}else A(Q,gt,d)||(Q!==X&&Q.push(gt),X.push(pt))}return X}function nh(s,c){return c=ga(c,s),s=Yg(s,c),s==null||delete s[Cs(Jo(c))]}function xg(s,c,d,_){return dl(s,c,d(qa(s,c)),_)}function uc(s,c,d,_){for(var A=s.length,R=_?A:-1;(_?R--:++R<A)&&c(s[R],R,s););return d?Zo(s,_?0:R,_?R+1:A):Zo(s,_?R+1:0,_?A:R)}function Eg(s,c){var d=s;return d instanceof n&&(d=d.value()),oo(c,function(_,A){return A.func.apply(A.thisArg,jt([_],A.args))},d)}function rh(s,c,d){var _=s.length;if(_<2)return _?da(s[0]):[];for(var A=-1,R=ot(_);++A<_;)for(var H=s[A],X=-1;++X<_;)X!=A&&(R[A]=fl(R[A]||H,s[X],c,d));return da(mi(R,1),c,d)}function wg(s,c,d){for(var _=-1,A=s.length,R=c.length,H={};++_<A;){var X=_<R?c[_]:o;d(H,s[_],X)}return H}function ih(s){return Cr(s)?s:[]}function oh(s){return typeof s=="function"?s:yo}function ga(s,c){return ne(s)?s:dh(s,c)?[s]:Kg(An(s))}var Bx=he;function ma(s,c,d){var _=s.length;return d=d===o?_:d,!c&&d>=_?s:Zo(s,c,d)}var Mg=ul||function(s){return sr.clearTimeout(s)};function Sg(s,c){if(c)return s.slice();var d=s.length,_=Gi?Gi(d):new s.constructor(d);return s.copy(_),_}function sh(s){var c=new s.constructor(s.byteLength);return new Wo(c).set(new Wo(s)),c}function zx(s,c){var d=c?sh(s.buffer):s.buffer;return new s.constructor(d,s.byteOffset,s.byteLength)}function kx(s){var c=new s.constructor(s.source,_n.exec(s));return c.lastIndex=s.lastIndex,c}function Gx(s){return ha?Sn(ha.call(s)):{}}function bg(s,c){var d=c?sh(s.buffer):s.buffer;return new s.constructor(d,s.byteOffset,s.length)}function Ag(s,c){if(s!==c){var d=s!==o,_=s===null,A=s===s,R=No(s),H=c!==o,X=c===null,Q=c===c,ht=No(c);if(!X&&!ht&&!R&&s>c||R&&H&&Q&&!X&&!ht||_&&H&&Q||!d&&Q||!A)return 1;if(!_&&!R&&!ht&&s<c||ht&&d&&A&&!_&&!R||X&&d&&A||!H&&A||!Q)return-1}return 0}function Hx(s,c,d){for(var _=-1,A=s.criteria,R=c.criteria,H=A.length,X=d.length;++_<H;){var Q=Ag(A[_],R[_]);if(Q){if(_>=X)return Q;var ht=d[_];return Q*(ht=="desc"?-1:1)}}return s.index-c.index}function Tg(s,c,d,_){for(var A=-1,R=s.length,H=d.length,X=-1,Q=c.length,ht=Tr(R-H,0),pt=ot(Q+ht),gt=!_;++X<Q;)pt[X]=c[X];for(;++A<H;)(gt||A<R)&&(pt[d[A]]=s[A]);for(;ht--;)pt[X++]=s[A++];return pt}function Cg(s,c,d,_){for(var A=-1,R=s.length,H=-1,X=d.length,Q=-1,ht=c.length,pt=Tr(R-X,0),gt=ot(pt+ht),Ct=!_;++A<pt;)gt[A]=s[A];for(var Bt=A;++Q<ht;)gt[Bt+Q]=c[Q];for(;++H<X;)(Ct||A<R)&&(gt[Bt+d[H]]=s[A++]);return gt}function po(s,c){var d=-1,_=s.length;for(c||(c=ot(_));++d<_;)c[d]=s[d];return c}function Ts(s,c,d,_){var A=!d;d||(d={});for(var R=-1,H=c.length;++R<H;){var X=c[R],Q=_?_(d[X],s[X],X,d,s):o;Q===o&&(Q=s[X]),A?Xs(d,X,Q):cl(d,X,Q)}return d}function Vx(s,c){return Ts(s,ph(s),c)}function Wx(s,c){return Ts(s,Gg(s),c)}function lc(s,c){return function(d,_){var A=ne(d)?Kl:hx,R=c?c():{};return A(d,s,qt(_,2),R)}}function gu(s){return he(function(c,d){var _=-1,A=d.length,R=A>1?d[A-1]:o,H=A>2?d[2]:o;for(R=s.length>3&&typeof R=="function"?(A--,R):o,H&&Wi(d[0],d[1],H)&&(R=A<3?o:R,A=1),c=Sn(c);++_<A;){var X=d[_];X&&s(c,X,_,R)}return c})}function Ig(s,c){return function(d,_){if(d==null)return d;if(!go(d))return s(d,_);for(var A=d.length,R=c?A:-1,H=Sn(d);(c?R--:++R<A)&&_(H[R],R,H)!==!1;);return d}}function Pg(s){return function(c,d,_){for(var A=-1,R=Sn(c),H=_(c),X=H.length;X--;){var Q=H[s?X:++A];if(d(R[Q],Q,R)===!1)break}return c}}function qx(s,c,d){var _=c&D,A=gl(s);function R(){var H=this&&this!==sr&&this instanceof R?A:s;return H.apply(_?d:this,arguments)}return R}function Rg(s){return function(c){c=An(c);var d=ks(c)?ao(c):o,_=d?d[0]:c.charAt(0),A=d?ma(d,1).join(""):c.slice(1);return _[s]()+A}}function mu(s){return function(c){return oo(Im(Cm(c).replace(no,"")),s,"")}}function gl(s){return function(){var c=arguments;switch(c.length){case 0:return new s;case 1:return new s(c[0]);case 2:return new s(c[0],c[1]);case 3:return new s(c[0],c[1],c[2]);case 4:return new s(c[0],c[1],c[2],c[3]);case 5:return new s(c[0],c[1],c[2],c[3],c[4]);case 6:return new s(c[0],c[1],c[2],c[3],c[4],c[5]);case 7:return new s(c[0],c[1],c[2],c[3],c[4],c[5],c[6])}var d=qs(s.prototype),_=s.apply(d,c);return lr(_)?_:d}}function Xx(s,c,d){var _=gl(s);function A(){for(var R=arguments.length,H=ot(R),X=R,Q=yu(A);X--;)H[X]=arguments[X];var ht=R<3&&H[0]!==Q&&H[R-1]!==Q?[]:es(H,Q);if(R-=ht.length,R<d)return Fg(s,c,cc,A.placeholder,o,H,ht,o,o,d-R);var pt=this&&this!==sr&&this instanceof A?_:s;return bt(pt,this,H)}return A}function Lg(s){return function(c,d,_){var A=Sn(c);if(!go(c)){var R=qt(d,3);c=ni(c),d=function(X){return R(A[X],X,A)}}var H=s(c,d,_);return H>-1?A[R?c[H]:H]:o}}function Ng(s){return $s(function(c){var d=c.length,_=d,A=t.prototype.thru;for(s&&c.reverse();_--;){var R=c[_];if(typeof R!="function")throw new pn(l);if(A&&!H&&dc(R)=="wrapper")var H=new t([],!0)}for(_=H?_:d;++_<d;){R=c[_];var X=dc(R),Q=X=="wrapper"?fh(R):o;Q&&gh(Q[0])&&Q[1]==(Z|L|F|it)&&!Q[4].length&&Q[9]==1?H=H[dc(Q[0])].apply(H,Q[3]):H=R.length==1&&gh(R)?H[X]():H.thru(R)}return function(){var ht=arguments,pt=ht[0];if(H&&ht.length==1&&ne(pt))return H.plant(pt).value();for(var gt=0,Ct=d?c[gt].apply(this,ht):pt;++gt<d;)Ct=c[gt].call(this,Ct);return Ct}})}function cc(s,c,d,_,A,R,H,X,Q,ht){var pt=c&Z,gt=c&D,Ct=c&G,Bt=c&(L|k),$t=c&et,ce=Ct?o:gl(s);function Zt(){for(var qe=arguments.length,sn=ot(qe),Do=qe;Do--;)sn[Do]=arguments[Do];if(Bt)var qi=yu(Zt),Oo=so(sn,qi);if(_&&(sn=Tg(sn,_,A,Bt)),R&&(sn=Cg(sn,R,H,Bt)),qe-=Oo,Bt&&qe<ht){var Ir=es(sn,qi);return Fg(s,c,cc,Zt.placeholder,d,sn,Ir,X,Q,ht-qe)}var as=gt?d:this,Qs=Ct?as[s]:s;return qe=sn.length,X?sn=hE(sn,X):$t&&qe>1&&sn.reverse(),pt&&Q<qe&&(sn.length=Q),this&&this!==sr&&this instanceof Zt&&(Qs=ce||gl(Qs)),Qs.apply(as,sn)}return Zt}function Dg(s,c){return function(d,_){return xx(d,s,c(_),{})}}function fc(s,c){return function(d,_){var A;if(d===o&&_===o)return c;if(d!==o&&(A=d),_!==o){if(A===o)return _;typeof d=="string"||typeof _=="string"?(d=Lo(d),_=Lo(_)):(d=_g(d),_=_g(_)),A=s(d,_)}return A}}function ah(s){return $s(function(c){return c=Gn(c,Ai(qt())),he(function(d){var _=this;return s(c,function(A){return bt(A,_,d)})})})}function hc(s,c){c=c===o?" ":Lo(c);var d=c.length;if(d<2)return d?th(c,s):c;var _=th(c,Yn(s/Gs(c)));return ks(c)?ma(ao(_),0,s).join(""):_.slice(0,s)}function Yx(s,c,d,_){var A=c&D,R=gl(s);function H(){for(var X=-1,Q=arguments.length,ht=-1,pt=_.length,gt=ot(pt+Q),Ct=this&&this!==sr&&this instanceof H?R:s;++ht<pt;)gt[ht]=_[ht];for(;Q--;)gt[ht++]=arguments[++X];return bt(Ct,A?d:this,gt)}return H}function Og(s){return function(c,d,_){return _&&typeof _!="number"&&Wi(c,d,_)&&(d=_=o),c=Ks(c),d===o?(d=c,c=0):d=Ks(d),_=_===o?c<d?1:-1:Ks(_),Lx(c,d,_,s)}}function pc(s){return function(c,d){return typeof c=="string"&&typeof d=="string"||(c=Ko(c),d=Ko(d)),s(c,d)}}function Fg(s,c,d,_,A,R,H,X,Q,ht){var pt=c&L,gt=pt?H:o,Ct=pt?o:H,Bt=pt?R:o,$t=pt?o:R;c|=pt?F:$,c&=~(pt?$:F),c&O||(c&=~(D|G));var ce=[s,c,A,Bt,gt,$t,Ct,X,Q,ht],Zt=d.apply(o,ce);return gh(s)&&$g(Zt,ce),Zt.placeholder=_,Zg(Zt,s,c)}function uh(s){var c=ge[s];return function(d,_){if(d=Ko(d),_=_==null?0:Nn(ae(_),292),_&&pu(d)){var A=(An(d)+"e").split("e"),R=c(A[0]+"e"+(+A[1]+_));return A=(An(R)+"e").split("e"),+(A[0]+"e"+(+A[1]-_))}return c(d)}}var $x=Es&&1/gr(new Es([,-0]))[1]==zt?function(s){return new Es(s)}:Ph;function Ug(s){return function(c){var d=Ti(c);return d==Jt?Ao(c):d==Nt?tc(c):br(c,s(c))}}function Ys(s,c,d,_,A,R,H,X){var Q=c&G;if(!Q&&typeof s!="function")throw new pn(l);var ht=_?_.length:0;if(ht||(c&=~(F|$),_=A=o),H=H===o?H:Tr(ae(H),0),X=X===o?X:ae(X),ht-=A?A.length:0,c&$){var pt=_,gt=A;_=A=o}var Ct=Q?o:fh(s),Bt=[s,c,d,_,A,pt,gt,R,H,X];if(Ct&&lE(Bt,Ct),s=Bt[0],c=Bt[1],d=Bt[2],_=Bt[3],A=Bt[4],X=Bt[9]=Bt[9]===o?Q?0:s.length:Tr(Bt[9]-ht,0),!X&&c&(L|k)&&(c&=~(L|k)),!c||c==D)var $t=qx(s,c,d);else c==L||c==k?$t=Xx(s,c,X):(c==F||c==(D|F))&&!A.length?$t=Yx(s,c,d,_):$t=cc.apply(o,Bt);var ce=Ct?yg:$g;return Zg(ce($t,Bt),s,c)}function Bg(s,c,d,_){return s===o||ss(s,Ar[d])&&!fe.call(_,d)?c:s}function zg(s,c,d,_,A,R){return lr(s)&&lr(c)&&(R.set(c,s),sc(s,c,o,zg,R),R.delete(c)),s}function Zx(s){return vl(s)?o:s}function kg(s,c,d,_,A,R){var H=d&S,X=s.length,Q=c.length;if(X!=Q&&!(H&&Q>X))return!1;var ht=R.get(s),pt=R.get(c);if(ht&&pt)return ht==c&&pt==s;var gt=-1,Ct=!0,Bt=d&C?new Va:o;for(R.set(s,c),R.set(c,s);++gt<X;){var $t=s[gt],ce=c[gt];if(_)var Zt=H?_(ce,$t,gt,c,s,R):_($t,ce,gt,s,c,R);if(Zt!==o){if(Zt)continue;Ct=!1;break}if(Bt){if(!zs(c,function(qe,sn){if(!kr(Bt,sn)&&($t===qe||A($t,qe,d,_,R)))return Bt.push(sn)})){Ct=!1;break}}else if(!($t===ce||A($t,ce,d,_,R))){Ct=!1;break}}return R.delete(s),R.delete(c),Ct}function Jx(s,c,d,_,A,R,H){switch(d){case Ni:if(s.byteLength!=c.byteLength||s.byteOffset!=c.byteOffset)return!1;s=s.buffer,c=c.buffer;case mt:return!(s.byteLength!=c.byteLength||!R(new Wo(s),new Wo(c)));case Hn:case yn:case jn:return ss(+s,+c);case an:return s.name==c.name&&s.message==c.message;case ui:case He:return s==c+"";case Jt:var X=Ao;case Nt:var Q=_&S;if(X||(X=gr),s.size!=c.size&&!Q)return!1;var ht=H.get(s);if(ht)return ht==c;_|=C,H.set(s,c);var pt=kg(X(s),X(c),_,A,R,H);return H.delete(s),pt;case wi:if(ha)return ha.call(s)==ha.call(c)}return!1}function Kx(s,c,d,_,A,R){var H=d&S,X=lh(s),Q=X.length,ht=lh(c),pt=ht.length;if(Q!=pt&&!H)return!1;for(var gt=Q;gt--;){var Ct=X[gt];if(!(H?Ct in c:fe.call(c,Ct)))return!1}var Bt=R.get(s),$t=R.get(c);if(Bt&&$t)return Bt==c&&$t==s;var ce=!0;R.set(s,c),R.set(c,s);for(var Zt=H;++gt<Q;){Ct=X[gt];var qe=s[Ct],sn=c[Ct];if(_)var Do=H?_(sn,qe,Ct,c,s,R):_(qe,sn,Ct,s,c,R);if(!(Do===o?qe===sn||A(qe,sn,d,_,R):Do)){ce=!1;break}Zt||(Zt=Ct=="constructor")}if(ce&&!Zt){var qi=s.constructor,Oo=c.constructor;qi!=Oo&&"constructor"in s&&"constructor"in c&&!(typeof qi=="function"&&qi instanceof qi&&typeof Oo=="function"&&Oo instanceof Oo)&&(ce=!1)}return R.delete(s),R.delete(c),ce}function $s(s){return yh(Xg(s,o,em),s+"")}function lh(s){return sg(s,ni,ph)}function ch(s){return sg(s,mo,Gg)}var fh=ws?function(s){return ws.get(s)}:Ph;function dc(s){for(var c=s.name+"",d=Po[c],_=fe.call(Po,c)?d.length:0;_--;){var A=d[_],R=A.func;if(R==null||R==s)return A.name}return c}function yu(s){var c=fe.call(I,"placeholder")?I:s;return c.placeholder}function qt(){var s=I.iteratee||Ch;return s=s===Ch?lg:s,arguments.length?s(arguments[0],arguments[1]):s}function gc(s,c){var d=s.__data__;return oE(c)?d[typeof c=="string"?"string":"hash"]:d.map}function hh(s){for(var c=ni(s),d=c.length;d--;){var _=c[d],A=s[_];c[d]=[_,A,Wg(A)]}return c}function Xa(s,c){var d=dr(s,c);return ug(d)?d:o}function Qx(s){var c=fe.call(s,Xn),d=s[Xn];try{s[Xn]=o;var _=!0}catch{}var A=Kn.call(s);return _&&(c?s[Xn]=d:delete s[Xn]),A}var ph=Ws?function(s){return s==null?[]:(s=Sn(s),fi(Ws(s),function(c){return co.call(s,c)}))}:Rh,Gg=Ws?function(s){for(var c=[];s;)jt(c,ph(s)),s=qo(s);return c}:Rh,Ti=Vi;(Hi&&Ti(new Hi(new ArrayBuffer(1)))!=Ni||Xo&&Ti(new Xo)!=Jt||xs&&Ti(xs.resolve())!=On||Es&&Ti(new Es)!=Nt||Yo&&Ti(new Yo)!=qr)&&(Ti=function(s){var c=Vi(s),d=c==vn?s.constructor:o,_=d?Ya(d):"";if(_)switch(_){case Ms:return Ni;case Ht:return Jt;case rs:return On;case fa:return Nt;case Ss:return qr}return c});function jx(s,c,d){for(var _=-1,A=d.length;++_<A;){var R=d[_],H=R.size;switch(R.type){case"drop":s+=H;break;case"dropRight":c-=H;break;case"take":c=Nn(c,s+H);break;case"takeRight":s=Tr(s,c-H);break}}return{start:s,end:c}}function tE(s){var c=s.match(Ur);return c?c[1].split(Fn):[]}function Hg(s,c,d){c=ga(c,s);for(var _=-1,A=c.length,R=!1;++_<A;){var H=Cs(c[_]);if(!(R=s!=null&&d(s,H)))break;s=s[H]}return R||++_!=A?R:(A=s==null?0:s.length,!!A&&wc(A)&&Zs(H,A)&&(ne(s)||$a(s)))}function eE(s){var c=s.length,d=new s.constructor(c);return c&&typeof s[0]=="string"&&fe.call(s,"index")&&(d.index=s.index,d.input=s.input),d}function Vg(s){return typeof s.constructor=="function"&&!ml(s)?qs(qo(s)):{}}function nE(s,c,d){var _=s.constructor;switch(c){case mt:return sh(s);case Hn:case yn:return new _(+s);case Ni:return zx(s,d);case Di:case Ft:case Si:case Os:case Y:case w:case T:case N:case z:return bg(s,d);case Jt:return new _;case jn:case He:return new _(s);case ui:return kx(s);case Nt:return new _;case wi:return Gx(s)}}function rE(s,c){var d=c.length;if(!d)return s;var _=d-1;return c[_]=(d>1?"& ":"")+c[_],c=c.join(d>2?", ":" "),s.replace(tr,`{\n/* [wrapped with `+c+`] */\n`)}function iE(s){return ne(s)||$a(s)||!!(al&&s&&s[al])}function Zs(s,c){var d=typeof s;return c=c??Kt,!!c&&(d=="number"||d!="symbol"&&Ku.test(s))&&s>-1&&s%1==0&&s<c}function Wi(s,c,d){if(!lr(d))return!1;var _=typeof c;return(_=="number"?go(d)&&Zs(c,d.length):_=="string"&&c in d)?ss(d[c],s):!1}function dh(s,c){if(ne(s))return!1;var d=typeof s;return d=="number"||d=="symbol"||d=="boolean"||s==null||No(s)?!0:re.test(s)||!kt.test(s)||c!=null&&s in Sn(c)}function oE(s){var c=typeof s;return c=="string"||c=="number"||c=="symbol"||c=="boolean"?s!=="__proto__":s===null}function gh(s){var c=dc(s),d=I[c];if(typeof d!="function"||!(c in n.prototype))return!1;if(s===d)return!0;var _=fh(d);return!!_&&s===_[0]}function sE(s){return!!hu&&hu in s}var aE=la?Js:Lh;function ml(s){var c=s&&s.constructor,d=typeof c=="function"&&c.prototype||Ar;return s===d}function Wg(s){return s===s&&!lr(s)}function qg(s,c){return function(d){return d==null?!1:d[s]===c&&(c!==o||s in Sn(d))}}function uE(s){var c=xc(s,function(_){return d.size===m&&d.clear(),_}),d=c.cache;return c}function lE(s,c){var d=s[1],_=c[1],A=d|_,R=A<(D|G|Z),H=_==Z&&d==L||_==Z&&d==it&&s[7].length<=c[8]||_==(Z|it)&&c[7].length<=c[8]&&d==L;if(!(R||H))return s;_&D&&(s[2]=c[2],A|=d&D?0:O);var X=c[3];if(X){var Q=s[3];s[3]=Q?Tg(Q,X,c[4]):X,s[4]=Q?es(s[3],y):c[4]}return X=c[5],X&&(Q=s[5],s[5]=Q?Cg(Q,X,c[6]):X,s[6]=Q?es(s[5],y):c[6]),X=c[7],X&&(s[7]=X),_&Z&&(s[8]=s[8]==null?c[8]:Nn(s[8],c[8])),s[9]==null&&(s[9]=c[9]),s[0]=c[0],s[1]=A,s}function cE(s){var c=[];if(s!=null)for(var d in Sn(s))c.push(d);return c}function fE(s){return Kn.call(s)}function Xg(s,c,d){return c=Tr(c===o?s.length-1:c,0),function(){for(var _=arguments,A=-1,R=Tr(_.length-c,0),H=ot(R);++A<R;)H[A]=_[c+A];A=-1;for(var X=ot(c+1);++A<c;)X[A]=_[A];return X[c]=d(H),bt(s,this,X)}}function Yg(s,c){return c.length<2?s:qa(s,Zo(c,0,-1))}function hE(s,c){for(var d=s.length,_=Nn(c.length,d),A=po(s);_--;){var R=c[_];s[_]=Zs(R,d)?A[R]:o}return s}function mh(s,c){if(!(c==="constructor"&&typeof s[c]=="function")&&c!="__proto__")return s[c]}var $g=Jg(yg),yl=ns||function(s,c){return sr.setTimeout(s,c)},yh=Jg(Ox);function Zg(s,c,d){var _=c+"";return yh(s,rE(_,pE(tE(_),d)))}function Jg(s){var c=0,d=0;return function(){var _=ec(),A=Ot-(_-d);if(d=_,A>0){if(++c>=Lt)return arguments[0]}else c=0;return s.apply(o,arguments)}}function mc(s,c){var d=-1,_=s.length,A=_-1;for(c=c===o?_:c;++d<c;){var R=jf(d,A),H=s[R];s[R]=s[d],s[d]=H}return s.length=c,s}var Kg=uE(function(s){var c=[];return s.charCodeAt(0)===46&&c.push(""),s.replace(Yt,function(d,_,A,R){c.push(A?R.replace(Wn,"$1"):_||d)}),c});function Cs(s){if(typeof s=="string"||No(s))return s;var c=s+"";return c=="0"&&1/s==-zt?"-0":c}function Ya(s){if(s!=null){try{return Vo.call(s)}catch{}try{return s+""}catch{}}return""}function pE(s,c){return Zr(Vt,function(d){var _="_."+d[0];c&d[1]&&!gs(s,_)&&s.push(_)}),s.sort()}function Qg(s){if(s instanceof n)return s.clone();var c=new t(s.__wrapped__,s.__chain__);return c.__actions__=po(s.__actions__),c.__index__=s.__index__,c.__values__=s.__values__,c}function dE(s,c,d){(d?Wi(s,c,d):c===o)?c=1:c=Tr(ae(c),0);var _=s==null?0:s.length;if(!_||c<1)return[];for(var A=0,R=0,H=ot(Yn(_/c));A<_;)H[R++]=Zo(s,A,A+=c);return H}function gE(s){for(var c=-1,d=s==null?0:s.length,_=0,A=[];++c<d;){var R=s[c];R&&(A[_++]=R)}return A}function mE(){var s=arguments.length;if(!s)return[];for(var c=ot(s-1),d=arguments[0],_=s;_--;)c[_-1]=arguments[_];return jt(ne(d)?po(d):[d],mi(c,1))}var yE=he(function(s,c){return Cr(s)?fl(s,mi(c,1,Cr,!0)):[]}),vE=he(function(s,c){var d=Jo(c);return Cr(d)&&(d=o),Cr(s)?fl(s,mi(c,1,Cr,!0),qt(d,2)):[]}),_E=he(function(s,c){var d=Jo(c);return Cr(d)&&(d=o),Cr(s)?fl(s,mi(c,1,Cr,!0),o,d):[]});function xE(s,c,d){var _=s==null?0:s.length;return _?(c=d||c===o?1:ae(c),Zo(s,c<0?0:c,_)):[]}function EE(s,c,d){var _=s==null?0:s.length;return _?(c=d||c===o?1:ae(c),c=_-c,Zo(s,0,c<0?0:c)):[]}function wE(s,c){return s&&s.length?uc(s,qt(c,3),!0,!0):[]}function ME(s,c){return s&&s.length?uc(s,qt(c,3),!0):[]}function SE(s,c,d,_){var A=s==null?0:s.length;return A?(d&&typeof d!="number"&&Wi(s,c,d)&&(d=0,_=A),mx(s,c,d,_)):[]}function jg(s,c,d){var _=s==null?0:s.length;if(!_)return-1;var A=d==null?0:ae(d);return A<0&&(A=Tr(_+A,0)),ln(s,qt(c,3),A)}function tm(s,c,d){var _=s==null?0:s.length;if(!_)return-1;var A=_-1;return d!==o&&(A=ae(d),A=d<0?Tr(_+A,0):Nn(A,_-1)),ln(s,qt(c,3),A,!0)}function em(s){var c=s==null?0:s.length;return c?mi(s,1):[]}function bE(s){var c=s==null?0:s.length;return c?mi(s,zt):[]}function AE(s,c){var d=s==null?0:s.length;return d?(c=c===o?1:ae(c),mi(s,c)):[]}function TE(s){for(var c=-1,d=s==null?0:s.length,_={};++c<d;){var A=s[c];_[A[0]]=A[1]}return _}function nm(s){return s&&s.length?s[0]:o}function CE(s,c,d){var _=s==null?0:s.length;if(!_)return-1;var A=d==null?0:ae(d);return A<0&&(A=Tr(_+A,0)),ko(s,c,A)}function IE(s){var c=s==null?0:s.length;return c?Zo(s,0,-1):[]}var PE=he(function(s){var c=Gn(s,ih);return c.length&&c[0]===s[0]?$f(c):[]}),RE=he(function(s){var c=Jo(s),d=Gn(s,ih);return c===Jo(d)?c=o:d.pop(),d.length&&d[0]===s[0]?$f(d,qt(c,2)):[]}),LE=he(function(s){var c=Jo(s),d=Gn(s,ih);return c=typeof c=="function"?c:o,c&&d.pop(),d.length&&d[0]===s[0]?$f(d,o,c):[]});function NE(s,c){return s==null?"":du.call(s,c)}function Jo(s){var c=s==null?0:s.length;return c?s[c-1]:o}function DE(s,c,d){var _=s==null?0:s.length;if(!_)return-1;var A=_;return d!==o&&(A=ae(d),A=A<0?Tr(_+A,0):Nn(A,_-1)),c===c?aa(s,c,A):ln(s,ys,A,!0)}function OE(s,c){return s&&s.length?pg(s,ae(c)):o}var FE=he(rm);function rm(s,c){return s&&s.length&&c&&c.length?Qf(s,c):s}function UE(s,c,d){return s&&s.length&&c&&c.length?Qf(s,c,qt(d,2)):s}function BE(s,c,d){return s&&s.length&&c&&c.length?Qf(s,c,o,d):s}var zE=$s(function(s,c){var d=s==null?0:s.length,_=Wf(s,c);return mg(s,Gn(c,function(A){return Zs(A,d)?+A:A}).sort(Ag)),_});function kE(s,c){var d=[];if(!(s&&s.length))return d;var _=-1,A=[],R=s.length;for(c=qt(c,3);++_<R;){var H=s[_];c(H,_,s)&&(d.push(H),A.push(_))}return mg(s,A),d}function vh(s){return s==null?s:Hf.call(s)}function GE(s,c,d){var _=s==null?0:s.length;return _?(d&&typeof d!="number"&&Wi(s,c,d)?(c=0,d=_):(c=c==null?0:ae(c),d=d===o?_:ae(d)),Zo(s,c,d)):[]}function HE(s,c){return ac(s,c)}function VE(s,c,d){return eh(s,c,qt(d,2))}function WE(s,c){var d=s==null?0:s.length;if(d){var _=ac(s,c);if(_<d&&ss(s[_],c))return _}return-1}function qE(s,c){return ac(s,c,!0)}function XE(s,c,d){return eh(s,c,qt(d,2),!0)}function YE(s,c){var d=s==null?0:s.length;if(d){var _=ac(s,c,!0)-1;if(ss(s[_],c))return _}return-1}function $E(s){return s&&s.length?vg(s):[]}function ZE(s,c){return s&&s.length?vg(s,qt(c,2)):[]}function JE(s){var c=s==null?0:s.length;return c?Zo(s,1,c):[]}function KE(s,c,d){return s&&s.length?(c=d||c===o?1:ae(c),Zo(s,0,c<0?0:c)):[]}function QE(s,c,d){var _=s==null?0:s.length;return _?(c=d||c===o?1:ae(c),c=_-c,Zo(s,c<0?0:c,_)):[]}function jE(s,c){return s&&s.length?uc(s,qt(c,3),!1,!0):[]}function tw(s,c){return s&&s.length?uc(s,qt(c,3)):[]}var ew=he(function(s){return da(mi(s,1,Cr,!0))}),nw=he(function(s){var c=Jo(s);return Cr(c)&&(c=o),da(mi(s,1,Cr,!0),qt(c,2))}),rw=he(function(s){var c=Jo(s);return c=typeof c=="function"?c:o,da(mi(s,1,Cr,!0),o,c)});function iw(s){return s&&s.length?da(s):[]}function ow(s,c){return s&&s.length?da(s,qt(c,2)):[]}function sw(s,c){return c=typeof c=="function"?c:o,s&&s.length?da(s,o,c):[]}function _h(s){if(!(s&&s.length))return[];var c=0;return s=fi(s,function(d){if(Cr(d))return c=Tr(d.length,c),!0}),zr(c,function(d){return Gn(s,Go(d))})}function im(s,c){if(!(s&&s.length))return[];var d=_h(s);return c==null?d:Gn(d,function(_){return bt(c,o,_)})}var aw=he(function(s,c){return Cr(s)?fl(s,c):[]}),uw=he(function(s){return rh(fi(s,Cr))}),lw=he(function(s){var c=Jo(s);return Cr(c)&&(c=o),rh(fi(s,Cr),qt(c,2))}),cw=he(function(s){var c=Jo(s);return c=typeof c=="function"?c:o,rh(fi(s,Cr),o,c)}),fw=he(_h);function hw(s,c){return wg(s||[],c||[],cl)}function pw(s,c){return wg(s||[],c||[],dl)}var dw=he(function(s){var c=s.length,d=c>1?s[c-1]:o;return d=typeof d=="function"?(s.pop(),d):o,im(s,d)});function om(s){var c=I(s);return c.__chain__=!0,c}function gw(s,c){return c(s),s}function yc(s,c){return c(s)}var mw=$s(function(s){var c=s.length,d=c?s[0]:0,_=this.__wrapped__,A=function(R){return Wf(R,s)};return c>1||this.__actions__.length||!(_ instanceof n)||!Zs(d)?this.thru(A):(_=_.slice(d,+d+(c?1:0)),_.__actions__.push({func:yc,args:[A],thisArg:o}),new t(_,this.__chain__).thru(function(R){return c&&!R.length&&R.push(o),R}))});function yw(){return om(this)}function vw(){return new t(this.value(),this.__chain__)}function _w(){this.__values__===o&&(this.__values__=_m(this.value()));var s=this.__index__>=this.__values__.length,c=s?o:this.__values__[this.__index__++];return{done:s,value:c}}function xw(){return this}function Ew(s){for(var c,d=this;d instanceof bs;){var _=Qg(d);_.__index__=0,_.__values__=o,c?A.__wrapped__=_:c=_;var A=_;d=d.__wrapped__}return A.__wrapped__=s,c}function ww(){var s=this.__wrapped__;if(s instanceof n){var c=s;return this.__actions__.length&&(c=new n(this)),c=c.reverse(),c.__actions__.push({func:yc,args:[vh],thisArg:o}),new t(c,this.__chain__)}return this.thru(vh)}function Mw(){return Eg(this.__wrapped__,this.__actions__)}var Sw=lc(function(s,c,d){fe.call(s,d)?++s[d]:Xs(s,d,1)});function bw(s,c,d){var _=ne(s)?Bi:gx;return d&&Wi(s,c,d)&&(c=o),_(s,qt(c,3))}function Aw(s,c){var d=ne(s)?fi:ig;return d(s,qt(c,3))}var Tw=Lg(jg),Cw=Lg(tm);function Iw(s,c){return mi(vc(s,c),1)}function Pw(s,c){return mi(vc(s,c),zt)}function Rw(s,c,d){return d=d===o?1:ae(d),mi(vc(s,c),d)}function sm(s,c){var d=ne(s)?Zr:pa;return d(s,qt(c,3))}function am(s,c){var d=ne(s)?Jr:rg;return d(s,qt(c,3))}var Lw=lc(function(s,c,d){fe.call(s,d)?s[d].push(c):Xs(s,d,[c])});function Nw(s,c,d,_){s=go(s)?s:_u(s),d=d&&!_?ae(d):0;var A=s.length;return d<0&&(d=Tr(A+d,0)),Mc(s)?d<=A&&s.indexOf(c,d)>-1:!!A&&ko(s,c,d)>-1}var Dw=he(function(s,c,d){var _=-1,A=typeof c=="function",R=go(s)?ot(s.length):[];return pa(s,function(H){R[++_]=A?bt(c,H,d):hl(H,c,d)}),R}),Ow=lc(function(s,c,d){Xs(s,d,c)});function vc(s,c){var d=ne(s)?Gn:cg;return d(s,qt(c,3))}function Fw(s,c,d,_){return s==null?[]:(ne(c)||(c=c==null?[]:[c]),d=_?o:d,ne(d)||(d=d==null?[]:[d]),dg(s,c,d))}var Uw=lc(function(s,c,d){s[d?0:1].push(c)},function(){return[[],[]]});function Bw(s,c,d){var _=ne(s)?oo:pi,A=arguments.length<3;return _(s,qt(c,4),d,A,pa)}function zw(s,c,d){var _=ne(s)?Ln:pi,A=arguments.length<3;return _(s,qt(c,4),d,A,rg)}function kw(s,c){var d=ne(s)?fi:ig;return d(s,Ec(qt(c,3)))}function Gw(s){var c=ne(s)?jd:Nx;return c(s)}function Hw(s,c,d){(d?Wi(s,c,d):c===o)?c=1:c=ae(c);var _=ne(s)?cx:Dx;return _(s,c)}function Vw(s){var c=ne(s)?fx:Fx;return c(s)}function Ww(s){if(s==null)return 0;if(go(s))return Mc(s)?Gs(s):s.length;var c=Ti(s);return c==Jt||c==Nt?s.size:Jf(s).length}function qw(s,c,d){var _=ne(s)?zs:Ux;return d&&Wi(s,c,d)&&(c=o),_(s,qt(c,3))}var Xw=he(function(s,c){if(s==null)return[];var d=c.length;return d>1&&Wi(s,c[0],c[1])?c=[]:d>2&&Wi(c[0],c[1],c[2])&&(c=[c[0]]),dg(s,mi(c,1),[])}),_c=Vs||function(){return sr.Date.now()};function Yw(s,c){if(typeof c!="function")throw new pn(l);return s=ae(s),function(){if(--s<1)return c.apply(this,arguments)}}function um(s,c,d){return c=d?o:c,c=s&&c==null?s.length:c,Ys(s,Z,o,o,o,o,c)}function lm(s,c){var d;if(typeof c!="function")throw new pn(l);return s=ae(s),function(){return--s>0&&(d=c.apply(this,arguments)),s<=1&&(c=o),d}}var xh=he(function(s,c,d){var _=D;if(d.length){var A=es(d,yu(xh));_|=F}return Ys(s,_,c,d,A)}),cm=he(function(s,c,d){var _=D|G;if(d.length){var A=es(d,yu(cm));_|=F}return Ys(c,_,s,d,A)});function fm(s,c,d){c=d?o:c;var _=Ys(s,L,o,o,o,o,o,c);return _.placeholder=fm.placeholder,_}function hm(s,c,d){c=d?o:c;var _=Ys(s,k,o,o,o,o,o,c);return _.placeholder=hm.placeholder,_}function pm(s,c,d){var _,A,R,H,X,Q,ht=0,pt=!1,gt=!1,Ct=!0;if(typeof s!="function")throw new pn(l);c=Ko(c)||0,lr(d)&&(pt=!!d.leading,gt="maxWait"in d,R=gt?Tr(Ko(d.maxWait)||0,c):R,Ct="trailing"in d?!!d.trailing:Ct);function Bt(Ir){var as=_,Qs=A;return _=A=o,ht=Ir,H=s.apply(Qs,as),H}function $t(Ir){return ht=Ir,X=yl(qe,c),pt?Bt(Ir):H}function ce(Ir){var as=Ir-Q,Qs=Ir-ht,Lm=c-as;return gt?Nn(Lm,R-Qs):Lm}function Zt(Ir){var as=Ir-Q,Qs=Ir-ht;return Q===o||as>=c||as<0||gt&&Qs>=R}function qe(){var Ir=_c();if(Zt(Ir))return sn(Ir);X=yl(qe,ce(Ir))}function sn(Ir){return X=o,Ct&&_?Bt(Ir):(_=A=o,H)}function Do(){X!==o&&Mg(X),ht=0,_=Q=A=X=o}function qi(){return X===o?H:sn(_c())}function Oo(){var Ir=_c(),as=Zt(Ir);if(_=arguments,A=this,Q=Ir,as){if(X===o)return $t(Q);if(gt)return Mg(X),X=yl(qe,c),Bt(Q)}return X===o&&(X=yl(qe,c)),H}return Oo.cancel=Do,Oo.flush=qi,Oo}var $w=he(function(s,c){return ng(s,1,c)}),Zw=he(function(s,c,d){return ng(s,Ko(c)||0,d)});function Jw(s){return Ys(s,et)}function xc(s,c){if(typeof s!="function"||c!=null&&typeof c!="function")throw new pn(l);var d=function(){var _=arguments,A=c?c.apply(this,_):_[0],R=d.cache;if(R.has(A))return R.get(A);var H=s.apply(this,_);return d.cache=R.set(A,H)||R,H};return d.cache=new(xc.Cache||cn),d}xc.Cache=cn;function Ec(s){if(typeof s!="function")throw new pn(l);return function(){var c=arguments;switch(c.length){case 0:return!s.call(this);case 1:return!s.call(this,c[0]);case 2:return!s.call(this,c[0],c[1]);case 3:return!s.call(this,c[0],c[1],c[2])}return!s.apply(this,c)}}function Kw(s){return lm(2,s)}var Qw=Bx(function(s,c){c=c.length==1&&ne(c[0])?Gn(c[0],Ai(qt())):Gn(mi(c,1),Ai(qt()));var d=c.length;return he(function(_){for(var A=-1,R=Nn(_.length,d);++A<R;)_[A]=c[A].call(this,_[A]);return bt(s,this,_)})}),Eh=he(function(s,c){var d=es(c,yu(Eh));return Ys(s,F,o,c,d)}),dm=he(function(s,c){var d=es(c,yu(dm));return Ys(s,$,o,c,d)}),jw=$s(function(s,c){return Ys(s,it,o,o,o,c)});function tM(s,c){if(typeof s!="function")throw new pn(l);return c=c===o?c:ae(c),he(s,c)}function eM(s,c){if(typeof s!="function")throw new pn(l);return c=c==null?0:Tr(ae(c),0),he(function(d){var _=d[c],A=ma(d,0,c);return _&&jt(A,_),bt(s,this,A)})}function nM(s,c,d){var _=!0,A=!0;if(typeof s!="function")throw new pn(l);return lr(d)&&(_="leading"in d?!!d.leading:_,A="trailing"in d?!!d.trailing:A),pm(s,c,{leading:_,maxWait:c,trailing:A})}function rM(s){return um(s,1)}function iM(s,c){return Eh(oh(c),s)}function oM(){if(!arguments.length)return[];var s=arguments[0];return ne(s)?s:[s]}function sM(s){return $o(s,b)}function aM(s,c){return c=typeof c=="function"?c:o,$o(s,b,c)}function uM(s){return $o(s,x|b)}function lM(s,c){return c=typeof c=="function"?c:o,$o(s,x|b,c)}function cM(s,c){return c==null||eg(s,c,ni(c))}function ss(s,c){return s===c||s!==s&&c!==c}var fM=pc(Yf),hM=pc(function(s,c){return s>=c}),$a=ag(function(){return arguments}())?ag:function(s){return vr(s)&&fe.call(s,"callee")&&!co.call(s,"callee")},ne=ot.isArray,pM=zo?Ai(zo):Ex;function go(s){return s!=null&&wc(s.length)&&!Js(s)}function Cr(s){return vr(s)&&go(s)}function dM(s){return s===!0||s===!1||vr(s)&&Vi(s)==Hn}var ya=ti||Lh,gM=Sr?Ai(Sr):wx;function mM(s){return vr(s)&&s.nodeType===1&&!vl(s)}function yM(s){if(s==null)return!0;if(go(s)&&(ne(s)||typeof s=="string"||typeof s.splice=="function"||ya(s)||vu(s)||$a(s)))return!s.length;var c=Ti(s);if(c==Jt||c==Nt)return!s.size;if(ml(s))return!Jf(s).length;for(var d in s)if(fe.call(s,d))return!1;return!0}function vM(s,c){return pl(s,c)}function _M(s,c,d){d=typeof d=="function"?d:o;var _=d?d(s,c):o;return _===o?pl(s,c,o,d):!!_}function wh(s){if(!vr(s))return!1;var c=Vi(s);return c==an||c==Ge||typeof s.message=="string"&&typeof s.name=="string"&&!vl(s)}function xM(s){return typeof s=="number"&&pu(s)}function Js(s){if(!lr(s))return!1;var c=Vi(s);return c==Et||c==Pr||c==mn||c==xr}function gm(s){return typeof s=="number"&&s==ae(s)}function wc(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=Kt}function lr(s){var c=typeof s;return s!=null&&(c=="object"||c=="function")}function vr(s){return s!=null&&typeof s=="object"}var mm=ds?Ai(ds):Sx;function EM(s,c){return s===c||Zf(s,c,hh(c))}function wM(s,c,d){return d=typeof d=="function"?d:o,Zf(s,c,hh(c),d)}function MM(s){return ym(s)&&s!=+s}function SM(s){if(aE(s))throw new Dt(u);return ug(s)}function bM(s){return s===null}function AM(s){return s==null}function ym(s){return typeof s=="number"||vr(s)&&Vi(s)==jn}function vl(s){if(!vr(s)||Vi(s)!=vn)return!1;var c=qo(s);if(c===null)return!0;var d=fe.call(c,"constructor")&&c.constructor;return typeof d=="function"&&d instanceof d&&Vo.call(d)==sl}var Mh=io?Ai(io):bx;function TM(s){return gm(s)&&s>=-Kt&&s<=Kt}var vm=oa?Ai(oa):Ax;function Mc(s){return typeof s=="string"||!ne(s)&&vr(s)&&Vi(s)==He}function No(s){return typeof s=="symbol"||vr(s)&&Vi(s)==wi}var vu=Rn?Ai(Rn):Tx;function CM(s){return s===o}function IM(s){return vr(s)&&Ti(s)==qr}function PM(s){return vr(s)&&Vi(s)==Rr}var RM=pc(Kf),LM=pc(function(s,c){return s<=c});function _m(s){if(!s)return[];if(go(s))return Mc(s)?ao(s):po(s);if(ca&&s[ca])return Lr(s[ca]());var c=Ti(s),d=c==Jt?Ao:c==Nt?gr:_u;return d(s)}function Ks(s){if(!s)return s===0?s:0;if(s=Ko(s),s===zt||s===-zt){var c=s<0?-1:1;return c*ie}return s===s?s:0}function ae(s){var c=Ks(s),d=c%1;return c===c?d?c-d:c:0}function xm(s){return s?Wa(ae(s),0,Pt):0}function Ko(s){if(typeof s=="number")return s;if(No(s))return _t;if(lr(s)){var c=typeof s.valueOf=="function"?s.valueOf():s;s=lr(c)?c+"":c}if(typeof s!="string")return s===0?s:+s;s=jl(s);var d=Xr.test(s);return d||Yr.test(s)?Ui(s.slice(2),d?2:8):bi.test(s)?_t:+s}function Em(s){return Ts(s,mo(s))}function NM(s){return s?Wa(ae(s),-Kt,Kt):s===0?s:0}function An(s){return s==null?"":Lo(s)}var DM=gu(function(s,c){if(ml(c)||go(c)){Ts(c,ni(c),s);return}for(var d in c)fe.call(c,d)&&cl(s,d,c[d])}),wm=gu(function(s,c){Ts(c,mo(c),s)}),Sc=gu(function(s,c,d,_){Ts(c,mo(c),s,_)}),OM=gu(function(s,c,d,_){Ts(c,ni(c),s,_)}),FM=$s(Wf);function UM(s,c){var d=qs(s);return c==null?d:tg(d,c)}var BM=he(function(s,c){s=Sn(s);var d=-1,_=c.length,A=_>2?c[2]:o;for(A&&Wi(c[0],c[1],A)&&(_=1);++d<_;)for(var R=c[d],H=mo(R),X=-1,Q=H.length;++X<Q;){var ht=H[X],pt=s[ht];(pt===o||ss(pt,Ar[ht])&&!fe.call(s,ht))&&(s[ht]=R[ht])}return s}),zM=he(function(s){return s.push(o,zg),bt(Mm,o,s)});function kM(s,c){return ms(s,qt(c,3),As)}function GM(s,c){return ms(s,qt(c,3),Xf)}function HM(s,c){return s==null?s:qf(s,qt(c,3),mo)}function VM(s,c){return s==null?s:og(s,qt(c,3),mo)}function WM(s,c){return s&&As(s,qt(c,3))}function qM(s,c){return s&&Xf(s,qt(c,3))}function XM(s){return s==null?[]:oc(s,ni(s))}function YM(s){return s==null?[]:oc(s,mo(s))}function Sh(s,c,d){var _=s==null?o:qa(s,c);return _===o?d:_}function $M(s,c){return s!=null&&Hg(s,c,yx)}function bh(s,c){return s!=null&&Hg(s,c,vx)}var ZM=Dg(function(s,c,d){c!=null&&typeof c.toString!="function"&&(c=Kn.call(c)),s[c]=d},Th(yo)),JM=Dg(function(s,c,d){c!=null&&typeof c.toString!="function"&&(c=Kn.call(c)),fe.call(s,c)?s[c].push(d):s[c]=[d]},qt),KM=he(hl);function ni(s){return go(s)?Qd(s):Jf(s)}function mo(s){return go(s)?Qd(s,!0):Cx(s)}function QM(s,c){var d={};return c=qt(c,3),As(s,function(_,A,R){Xs(d,c(_,A,R),_)}),d}function jM(s,c){var d={};return c=qt(c,3),As(s,function(_,A,R){Xs(d,A,c(_,A,R))}),d}var tS=gu(function(s,c,d){sc(s,c,d)}),Mm=gu(function(s,c,d,_){sc(s,c,d,_)}),eS=$s(function(s,c){var d={};if(s==null)return d;var _=!1;c=Gn(c,function(R){return R=ga(R,s),_||(_=R.length>1),R}),Ts(s,ch(s),d),_&&(d=$o(d,x|E|b,Zx));for(var A=c.length;A--;)nh(d,c[A]);return d});function nS(s,c){return Sm(s,Ec(qt(c)))}var rS=$s(function(s,c){return s==null?{}:Px(s,c)});function Sm(s,c){if(s==null)return{};var d=Gn(ch(s),function(_){return[_]});return c=qt(c),gg(s,d,function(_,A){return c(_,A[0])})}function iS(s,c,d){c=ga(c,s);var _=-1,A=c.length;for(A||(A=1,s=o);++_<A;){var R=s==null?o:s[Cs(c[_])];R===o&&(_=A,R=d),s=Js(R)?R.call(s):R}return s}function oS(s,c,d){return s==null?s:dl(s,c,d)}function sS(s,c,d,_){return _=typeof _=="function"?_:o,s==null?s:dl(s,c,d,_)}var bm=Ug(ni),Am=Ug(mo);function aS(s,c,d){var _=ne(s),A=_||ya(s)||vu(s);if(c=qt(c,4),d==null){var R=s&&s.constructor;A?d=_?new R:[]:lr(s)?d=Js(R)?qs(qo(s)):{}:d={}}return(A?Zr:As)(s,function(H,X,Q){return c(d,H,X,Q)}),d}function uS(s,c){return s==null?!0:nh(s,c)}function lS(s,c,d){return s==null?s:xg(s,c,oh(d))}function cS(s,c,d,_){return _=typeof _=="function"?_:o,s==null?s:xg(s,c,oh(d),_)}function _u(s){return s==null?[]:So(s,ni(s))}function fS(s){return s==null?[]:So(s,mo(s))}function hS(s,c,d){return d===o&&(d=c,c=o),d!==o&&(d=Ko(d),d=d===d?d:0),c!==o&&(c=Ko(c),c=c===c?c:0),Wa(Ko(s),c,d)}function pS(s,c,d){return c=Ks(c),d===o?(d=c,c=0):d=Ks(d),s=Ko(s),_x(s,c,d)}function dS(s,c,d){if(d&&typeof d!="boolean"&&Wi(s,c,d)&&(c=d=o),d===o&&(typeof c=="boolean"?(d=c,c=o):typeof s=="boolean"&&(d=s,s=o)),s===o&&c===o?(s=0,c=1):(s=Ks(s),c===o?(c=s,s=0):c=Ks(c)),s>c){var _=s;s=c,c=_}if(d||s%1||c%1){var A=nc();return Nn(s+A*(c-s+Jl("1e-"+((A+"").length-1))),c)}return jf(s,c)}var gS=mu(function(s,c,d){return c=c.toLowerCase(),s+(d?Tm(c):c)});function Tm(s){return Ah(An(s).toLowerCase())}function Cm(s){return s=An(s),s&&s.replace(zn,bo).replace(on,"")}function mS(s,c,d){s=An(s),c=Lo(c);var _=s.length;d=d===o?_:Wa(ae(d),0,_);var A=d;return d-=c.length,d>=0&&s.slice(d,A)==c}function yS(s){return s=An(s),s&&rt.test(s)?s.replace(at,vs):s}function vS(s){return s=An(s),s&&pr.test(s)?s.replace(wn,"\\\\$&"):s}var _S=mu(function(s,c,d){return s+(d?"-":"")+c.toLowerCase()}),xS=mu(function(s,c,d){return s+(d?" ":"")+c.toLowerCase()}),ES=Rg("toLowerCase");function wS(s,c,d){s=An(s),c=ae(c);var _=c?Gs(s):0;if(!c||_>=c)return s;var A=(c-_)/2;return hc(ur(A),d)+s+hc(Yn(A),d)}function MS(s,c,d){s=An(s),c=ae(c);var _=c?Gs(s):0;return c&&_<c?s+hc(c-_,d):s}function SS(s,c,d){s=An(s),c=ae(c);var _=c?Gs(s):0;return c&&_<c?hc(c-_,d)+s:s}function bS(s,c,d){return d||c==null?c=0:c&&(c=+c),Ha(An(s).replace(Vn,""),c||0)}function AS(s,c,d){return(d?Wi(s,c,d):c===o)?c=1:c=ae(c),th(An(s),c)}function TS(){var s=arguments,c=An(s[0]);return s.length<3?c:c.replace(s[1],s[2])}var CS=mu(function(s,c,d){return s+(d?"_":"")+c.toLowerCase()});function IS(s,c,d){return d&&typeof d!="number"&&Wi(s,c,d)&&(c=d=o),d=d===o?Pt:d>>>0,d?(s=An(s),s&&(typeof c=="string"||c!=null&&!Mh(c))&&(c=Lo(c),!c&&ks(s))?ma(ao(s),0,d):s.split(c,d)):[]}var PS=mu(function(s,c,d){return s+(d?" ":"")+Ah(c)});function RS(s,c,d){return s=An(s),d=d==null?0:Wa(ae(d),0,s.length),c=Lo(c),s.slice(d,d+c.length)==c}function LS(s,c,d){var _=I.templateSettings;d&&Wi(s,c,d)&&(c=o),s=An(s),c=Sc({},c,_,Bg);var A=Sc({},c.imports,_.imports,Bg),R=ni(A),H=So(A,R),X,Q,ht=0,pt=c.interpolate||xn,gt="__p += \'",Ct=Io((c.escape||xn).source+"|"+pt.source+"|"+(pt===Gt?Bn:xn).source+"|"+(c.evaluate||xn).source+"|$","g"),Bt="//# sourceURL="+(fe.call(c,"sourceURL")?(c.sourceURL+"").replace(/\\s/g," "):"lodash.templateSources["+ ++$r+"]")+`\n`;s.replace(Ct,function(Zt,qe,sn,Do,qi,Oo){return sn||(sn=Do),gt+=s.slice(ht,Oo).replace(La,Ho),qe&&(X=!0,gt+=`\' +\n__e(`+qe+`) +\n\'`),qi&&(Q=!0,gt+=`\';\n`+qi+`;\n__p += \'`),sn&&(gt+=`\' +\n((__t = (`+sn+`)) == null ? \'\' : __t) +\n\'`),ht=Oo+Zt.length,Zt}),gt+=`\';\n`;var $t=fe.call(c,"variable")&&c.variable;if(!$t)gt=`with (obj) {\n`+gt+`\n}\n`;else if(Un.test($t))throw new Dt(h);gt=(Q?gt.replace(B,""):gt).replace(st,"$1").replace(K,"$1;"),gt="function("+($t||"obj")+`) {\n`+($t?"":`obj || (obj = {});\n`)+"var __t, __p = \'\'"+(X?", __e = _.escape":"")+(Q?`, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, \'\') }\n`:`;\n`)+gt+`return __p\n}`;var ce=Pm(function(){return te(R,Bt+"return "+gt).apply(o,H)});if(ce.source=gt,wh(ce))throw ce;return ce}function NS(s){return An(s).toLowerCase()}function DS(s){return An(s).toUpperCase()}function OS(s,c,d){if(s=An(s),s&&(d||c===o))return jl(s);if(!s||!(c=Lo(c)))return s;var _=ao(s),A=ao(c),R=ts(_,A),H=Kr(_,A)+1;return ma(_,R,H).join("")}function FS(s,c,d){if(s=An(s),s&&(d||c===o))return s.slice(0,_s(s)+1);if(!s||!(c=Lo(c)))return s;var _=ao(s),A=Kr(_,ao(c))+1;return ma(_,0,A).join("")}function US(s,c,d){if(s=An(s),s&&(d||c===o))return s.replace(Vn,"");if(!s||!(c=Lo(c)))return s;var _=ao(s),A=ts(_,ao(c));return ma(_,A).join("")}function BS(s,c){var d=U,_=wt;if(lr(c)){var A="separator"in c?c.separator:A;d="length"in c?ae(c.length):d,_="omission"in c?Lo(c.omission):_}s=An(s);var R=s.length;if(ks(s)){var H=ao(s);R=H.length}if(d>=R)return s;var X=d-Gs(_);if(X<1)return _;var Q=H?ma(H,0,X).join(""):s.slice(0,X);if(A===o)return Q+_;if(H&&(X+=Q.length-X),Mh(A)){if(s.slice(X).search(A)){var ht,pt=Q;for(A.global||(A=Io(A.source,An(_n.exec(A))+"g")),A.lastIndex=0;ht=A.exec(pt);)var gt=ht.index;Q=Q.slice(0,gt===o?X:gt)}}else if(s.indexOf(Lo(A),X)!=X){var Ct=Q.lastIndexOf(A);Ct>-1&&(Q=Q.slice(0,Ct))}return Q+_}function zS(s){return s=An(s),s&&j.test(s)?s.replace(ct,To):s}var kS=mu(function(s,c,d){return s+(d?" ":"")+c.toUpperCase()}),Ah=Rg("toUpperCase");function Im(s,c,d){return s=An(s),c=d?o:c,c===o?fu(s)?Nr(s):ee(s):s.match(c)||[]}var Pm=he(function(s,c){try{return bt(s,o,c)}catch(d){return wh(d)?d:new Dt(d)}}),GS=$s(function(s,c){return Zr(c,function(d){d=Cs(d),Xs(s,d,xh(s[d],s))}),s});function HS(s){var c=s==null?0:s.length,d=qt();return s=c?Gn(s,function(_){if(typeof _[1]!="function")throw new pn(l);return[d(_[0]),_[1]]}):[],he(function(_){for(var A=-1;++A<c;){var R=s[A];if(bt(R[0],this,_))return bt(R[1],this,_)}})}function VS(s){return dx($o(s,x))}function Th(s){return function(){return s}}function WS(s,c){return s==null||s!==s?c:s}var qS=Ng(),XS=Ng(!0);function yo(s){return s}function Ch(s){return lg(typeof s=="function"?s:$o(s,x))}function YS(s){return fg($o(s,x))}function $S(s,c){return hg(s,$o(c,x))}var ZS=he(function(s,c){return function(d){return hl(d,s,c)}}),JS=he(function(s,c){return function(d){return hl(s,d,c)}});function Ih(s,c,d){var _=ni(c),A=oc(c,_);d==null&&!(lr(c)&&(A.length||!_.length))&&(d=c,c=s,s=this,A=oc(c,ni(c)));var R=!(lr(d)&&"chain"in d)||!!d.chain,H=Js(s);return Zr(A,function(X){var Q=c[X];s[X]=Q,H&&(s.prototype[X]=function(){var ht=this.__chain__;if(R||ht){var pt=s(this.__wrapped__),gt=pt.__actions__=po(this.__actions__);return gt.push({func:Q,args:arguments,thisArg:s}),pt.__chain__=ht,pt}return Q.apply(s,jt([this.value()],arguments))})}),s}function KS(){return sr._===this&&(sr._=lo),this}function Ph(){}function QS(s){return s=ae(s),he(function(c){return pg(c,s)})}var jS=ah(Gn),tb=ah(Bi),eb=ah(zs);function Rm(s){return dh(s)?Go(Cs(s)):Rx(s)}function nb(s){return function(c){return s==null?o:qa(s,c)}}var rb=Og(),ib=Og(!0);function Rh(){return[]}function Lh(){return!1}function ob(){return{}}function sb(){return""}function ab(){return!0}function ub(s,c){if(s=ae(s),s<1||s>Kt)return[];var d=Pt,_=Nn(s,Pt);c=qt(c),s-=Pt;for(var A=zr(_,c);++d<s;)c(d);return A}function lb(s){return ne(s)?Gn(s,Cs):No(s)?[s]:po(Kg(An(s)))}function cb(s){var c=++Qr;return An(s)+c}var fb=fc(function(s,c){return s+c},0),hb=uh("ceil"),pb=fc(function(s,c){return s/c},1),db=uh("floor");function gb(s){return s&&s.length?ic(s,yo,Yf):o}function mb(s,c){return s&&s.length?ic(s,qt(c,2),Yf):o}function yb(s){return ol(s,yo)}function vb(s,c){return ol(s,qt(c,2))}function _b(s){return s&&s.length?ic(s,yo,Kf):o}function xb(s,c){return s&&s.length?ic(s,qt(c,2),Kf):o}var Eb=fc(function(s,c){return s*c},1),wb=uh("round"),Mb=fc(function(s,c){return s-c},0);function Sb(s){return s&&s.length?zi(s,yo):0}function bb(s,c){return s&&s.length?zi(s,qt(c,2)):0}return I.after=Yw,I.ary=um,I.assign=DM,I.assignIn=wm,I.assignInWith=Sc,I.assignWith=OM,I.at=FM,I.before=lm,I.bind=xh,I.bindAll=GS,I.bindKey=cm,I.castArray=oM,I.chain=om,I.chunk=dE,I.compact=gE,I.concat=mE,I.cond=HS,I.conforms=VS,I.constant=Th,I.countBy=Sw,I.create=UM,I.curry=fm,I.curryRight=hm,I.debounce=pm,I.defaults=BM,I.defaultsDeep=zM,I.defer=$w,I.delay=Zw,I.difference=yE,I.differenceBy=vE,I.differenceWith=_E,I.drop=xE,I.dropRight=EE,I.dropRightWhile=wE,I.dropWhile=ME,I.fill=SE,I.filter=Aw,I.flatMap=Iw,I.flatMapDeep=Pw,I.flatMapDepth=Rw,I.flatten=em,I.flattenDeep=bE,I.flattenDepth=AE,I.flip=Jw,I.flow=qS,I.flowRight=XS,I.fromPairs=TE,I.functions=XM,I.functionsIn=YM,I.groupBy=Lw,I.initial=IE,I.intersection=PE,I.intersectionBy=RE,I.intersectionWith=LE,I.invert=ZM,I.invertBy=JM,I.invokeMap=Dw,I.iteratee=Ch,I.keyBy=Ow,I.keys=ni,I.keysIn=mo,I.map=vc,I.mapKeys=QM,I.mapValues=jM,I.matches=YS,I.matchesProperty=$S,I.memoize=xc,I.merge=tS,I.mergeWith=Mm,I.method=ZS,I.methodOf=JS,I.mixin=Ih,I.negate=Ec,I.nthArg=QS,I.omit=eS,I.omitBy=nS,I.once=Kw,I.orderBy=Fw,I.over=jS,I.overArgs=Qw,I.overEvery=tb,I.overSome=eb,I.partial=Eh,I.partialRight=dm,I.partition=Uw,I.pick=rS,I.pickBy=Sm,I.property=Rm,I.propertyOf=nb,I.pull=FE,I.pullAll=rm,I.pullAllBy=UE,I.pullAllWith=BE,I.pullAt=zE,I.range=rb,I.rangeRight=ib,I.rearg=jw,I.reject=kw,I.remove=kE,I.rest=tM,I.reverse=vh,I.sampleSize=Hw,I.set=oS,I.setWith=sS,I.shuffle=Vw,I.slice=GE,I.sortBy=Xw,I.sortedUniq=$E,I.sortedUniqBy=ZE,I.split=IS,I.spread=eM,I.tail=JE,I.take=KE,I.takeRight=QE,I.takeRightWhile=jE,I.takeWhile=tw,I.tap=gw,I.throttle=nM,I.thru=yc,I.toArray=_m,I.toPairs=bm,I.toPairsIn=Am,I.toPath=lb,I.toPlainObject=Em,I.transform=aS,I.unary=rM,I.union=ew,I.unionBy=nw,I.unionWith=rw,I.uniq=iw,I.uniqBy=ow,I.uniqWith=sw,I.unset=uS,I.unzip=_h,I.unzipWith=im,I.update=lS,I.updateWith=cS,I.values=_u,I.valuesIn=fS,I.without=aw,I.words=Im,I.wrap=iM,I.xor=uw,I.xorBy=lw,I.xorWith=cw,I.zip=fw,I.zipObject=hw,I.zipObjectDeep=pw,I.zipWith=dw,I.entries=bm,I.entriesIn=Am,I.extend=wm,I.extendWith=Sc,Ih(I,I),I.add=fb,I.attempt=Pm,I.camelCase=gS,I.capitalize=Tm,I.ceil=hb,I.clamp=hS,I.clone=sM,I.cloneDeep=uM,I.cloneDeepWith=lM,I.cloneWith=aM,I.conformsTo=cM,I.deburr=Cm,I.defaultTo=WS,I.divide=pb,I.endsWith=mS,I.eq=ss,I.escape=yS,I.escapeRegExp=vS,I.every=bw,I.find=Tw,I.findIndex=jg,I.findKey=kM,I.findLast=Cw,I.findLastIndex=tm,I.findLastKey=GM,I.floor=db,I.forEach=sm,I.forEachRight=am,I.forIn=HM,I.forInRight=VM,I.forOwn=WM,I.forOwnRight=qM,I.get=Sh,I.gt=fM,I.gte=hM,I.has=$M,I.hasIn=bh,I.head=nm,I.identity=yo,I.includes=Nw,I.indexOf=CE,I.inRange=pS,I.invoke=KM,I.isArguments=$a,I.isArray=ne,I.isArrayBuffer=pM,I.isArrayLike=go,I.isArrayLikeObject=Cr,I.isBoolean=dM,I.isBuffer=ya,I.isDate=gM,I.isElement=mM,I.isEmpty=yM,I.isEqual=vM,I.isEqualWith=_M,I.isError=wh,I.isFinite=xM,I.isFunction=Js,I.isInteger=gm,I.isLength=wc,I.isMap=mm,I.isMatch=EM,I.isMatchWith=wM,I.isNaN=MM,I.isNative=SM,I.isNil=AM,I.isNull=bM,I.isNumber=ym,I.isObject=lr,I.isObjectLike=vr,I.isPlainObject=vl,I.isRegExp=Mh,I.isSafeInteger=TM,I.isSet=vm,I.isString=Mc,I.isSymbol=No,I.isTypedArray=vu,I.isUndefined=CM,I.isWeakMap=IM,I.isWeakSet=PM,I.join=NE,I.kebabCase=_S,I.last=Jo,I.lastIndexOf=DE,I.lowerCase=xS,I.lowerFirst=ES,I.lt=RM,I.lte=LM,I.max=gb,I.maxBy=mb,I.mean=yb,I.meanBy=vb,I.min=_b,I.minBy=xb,I.stubArray=Rh,I.stubFalse=Lh,I.stubObject=ob,I.stubString=sb,I.stubTrue=ab,I.multiply=Eb,I.nth=OE,I.noConflict=KS,I.noop=Ph,I.now=_c,I.pad=wS,I.padEnd=MS,I.padStart=SS,I.parseInt=bS,I.random=dS,I.reduce=Bw,I.reduceRight=zw,I.repeat=AS,I.replace=TS,I.result=iS,I.round=wb,I.runInContext=J,I.sample=Gw,I.size=Ww,I.snakeCase=CS,I.some=qw,I.sortedIndex=HE,I.sortedIndexBy=VE,I.sortedIndexOf=WE,I.sortedLastIndex=qE,I.sortedLastIndexBy=XE,I.sortedLastIndexOf=YE,I.startCase=PS,I.startsWith=RS,I.subtract=Mb,I.sum=Sb,I.sumBy=bb,I.template=LS,I.times=ub,I.toFinite=Ks,I.toInteger=ae,I.toLength=xm,I.toLower=NS,I.toNumber=Ko,I.toSafeInteger=NM,I.toString=An,I.toUpper=DS,I.trim=OS,I.trimEnd=FS,I.trimStart=US,I.truncate=BS,I.unescape=zS,I.uniqueId=cb,I.upperCase=kS,I.upperFirst=Ah,I.each=sm,I.eachRight=am,I.first=nm,Ih(I,function(){var s={};return As(I,function(c,d){fe.call(I.prototype,d)||(s[d]=c)}),s}(),{chain:!1}),I.VERSION=e,Zr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){I[s].placeholder=I}),Zr(["drop","take"],function(s,c){n.prototype[s]=function(d){d=d===o?1:Tr(ae(d),0);var _=this.__filtered__&&!c?new n(this):this.clone();return _.__filtered__?_.__takeCount__=Nn(d,_.__takeCount__):_.__views__.push({size:Nn(d,Pt),type:s+(_.__dir__<0?"Right":"")}),_},n.prototype[s+"Right"]=function(d){return this.reverse()[s](d).reverse()}}),Zr(["filter","map","takeWhile"],function(s,c){var d=c+1,_=d==W||d==yt;n.prototype[s]=function(A){var R=this.clone();return R.__iteratees__.push({iteratee:qt(A,3),type:d}),R.__filtered__=R.__filtered__||_,R}}),Zr(["head","last"],function(s,c){var d="take"+(c?"Right":"");n.prototype[s]=function(){return this[d](1).value()[0]}}),Zr(["initial","tail"],function(s,c){var d="drop"+(c?"":"Right");n.prototype[s]=function(){return this.__filtered__?new n(this):this[d](1)}}),n.prototype.compact=function(){return this.filter(yo)},n.prototype.find=function(s){return this.filter(s).head()},n.prototype.findLast=function(s){return this.reverse().find(s)},n.prototype.invokeMap=he(function(s,c){return typeof s=="function"?new n(this):this.map(function(d){return hl(d,s,c)})}),n.prototype.reject=function(s){return this.filter(Ec(qt(s)))},n.prototype.slice=function(s,c){s=ae(s);var d=this;return d.__filtered__&&(s>0||c<0)?new n(d):(s<0?d=d.takeRight(-s):s&&(d=d.drop(s)),c!==o&&(c=ae(c),d=c<0?d.dropRight(-c):d.take(c-s)),d)},n.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},n.prototype.toArray=function(){return this.take(Pt)},As(n.prototype,function(s,c){var d=/^(?:filter|find|map|reject)|While$/.test(c),_=/^(?:head|last)$/.test(c),A=I[_?"take"+(c=="last"?"Right":""):c],R=_||/^find/.test(c);A&&(I.prototype[c]=function(){var H=this.__wrapped__,X=_?[1]:arguments,Q=H instanceof n,ht=X[0],pt=Q||ne(H),gt=function(qe){var sn=A.apply(I,jt([qe],X));return _&&Ct?sn[0]:sn};pt&&d&&typeof ht=="function"&&ht.length!=1&&(Q=pt=!1);var Ct=this.__chain__,Bt=!!this.__actions__.length,$t=R&&!Ct,ce=Q&&!Bt;if(!R&&pt){H=ce?H:new n(this);var Zt=s.apply(H,X);return Zt.__actions__.push({func:yc,args:[gt],thisArg:o}),new t(Zt,Ct)}return $t&&ce?s.apply(this,X):(Zt=this.thru(gt),$t?_?Zt.value()[0]:Zt.value():Zt)})}),Zr(["pop","push","shift","sort","splice","unshift"],function(s){var c=er[s],d=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",_=/^(?:pop|shift)$/.test(s);I.prototype[s]=function(){var A=arguments;if(_&&!this.__chain__){var R=this.value();return c.apply(ne(R)?R:[],A)}return this[d](function(H){return c.apply(ne(H)?H:[],A)})}}),As(n.prototype,function(s,c){var d=I[c];if(d){var _=d.name+"";fe.call(Po,_)||(Po[_]=[]),Po[_].push({name:c,func:d})}}),Po[cc(o,G).name]=[{name:"wrapper",func:o}],n.prototype.clone=i,n.prototype.reverse=a,n.prototype.value=f,I.prototype.at=mw,I.prototype.chain=yw,I.prototype.commit=vw,I.prototype.next=_w,I.prototype.plant=Ew,I.prototype.reverse=ww,I.prototype.toJSON=I.prototype.valueOf=I.prototype.value=Mw,I.prototype.first=I.prototype.head,ca&&(I.prototype[ca]=xw),I},di=Co();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(sr._=di,define(function(){return di})):ro?((ro.exports=di)._=di,rl._=di):sr._=di}).call(Ju)});var Z1=It((j$,$1)=>{$1.exports=function(e,r){return e[0]=r[0],e[1]=r[1],e}});var Q1=It((tZ,K1)=>{var J1=Z1();K1.exports=function(o,e){Array.isArray(e)||(e=[]),o.length>0&&e.push(J1([0,0],o[0]));for(var r=0;r<o.length-1;r++){var u=o[r],l=o[r+1],h=u[0],p=u[1],m=l[0],y=l[1],x=[.75*h+.25*m,.75*p+.25*y],E=[.25*h+.75*m,.25*p+.75*y];e.push(x),e.push(E)}return o.length>1&&e.push(J1([0,0],o[o.length-1])),e}});var Li=nr($m(),1);var S0="169";var Zm=0,Jm=1,Km=2,Qm=3,jm=4,t0=5,e0=6,n0=7;var b0=300;var r0=1e3,bc=1001,i0=1002;var Ob=1006;var Fb=1008;var Ub=1009;var Bb=1023;var Rc=2300,Vh=2301,Oh=2302,o0=2400,s0=2401,a0=2402;var A0="",xa="srgb",ip="srgb-linear",zb="display-p3",T0="display-p3-linear",Wh="linear",u0="srgb",l0="rec709",c0="p3";var Ac=2e3,f0=2001,Lc=class{addEventListener(e,r){this._listeners===void 0&&(this._listeners={});let u=this._listeners;u[e]===void 0&&(u[e]=[]),u[e].indexOf(r)===-1&&u[e].push(r)}hasEventListener(e,r){if(this._listeners===void 0)return!1;let u=this._listeners;return u[e]!==void 0&&u[e].indexOf(r)!==-1}removeEventListener(e,r){if(this._listeners===void 0)return;let l=this._listeners[e];if(l!==void 0){let h=l.indexOf(r);h!==-1&&l.splice(h,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let u=this._listeners[e.type];if(u!==void 0){e.target=this;let l=u.slice(0);for(let h=0,p=l.length;h<p;h++)l[h].call(this,e);e.target=null}}},Ci=["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 xN=Math.PI/180,EN=180/Math.PI;function op(){let o=Math.random()*4294967295|0,e=Math.random()*4294967295|0,r=Math.random()*4294967295|0,u=Math.random()*4294967295|0;return(Ci[o&255]+Ci[o>>8&255]+Ci[o>>16&255]+Ci[o>>24&255]+"-"+Ci[e&255]+Ci[e>>8&255]+"-"+Ci[e>>16&15|64]+Ci[e>>24&255]+"-"+Ci[r&63|128]+Ci[r>>8&255]+"-"+Ci[r>>16&255]+Ci[r>>24&255]+Ci[u&255]+Ci[u>>8&255]+Ci[u>>16&255]+Ci[u>>24&255]).toLowerCase()}function _o(o,e,r){return Math.max(e,Math.min(r,o))}function kb(o,e){return(o%e+e)%e}function Fh(o,e,r){return(1-r)*o+r*e}var Xi=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,u=this.y,l=e.elements;return this.x=l[0]*r+l[3]*u+l[6],this.y=l[1]*r+l[4]*u+l[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 u=this.length();return this.divideScalar(u||1).multiplyScalar(Math.max(e,Math.min(r,u)))}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 u=this.dot(e)/r;return Math.acos(_o(u,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let r=this.x-e.x,u=this.y-e.y;return r*r+u*u}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,u){return this.x=e.x+(r.x-e.x)*u,this.y=e.y+(r.y-e.y)*u,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 u=Math.cos(r),l=Math.sin(r),h=this.x-e.x,p=this.y-e.y;return this.x=h*u-p*l+e.x,this.y=h*l+p*u+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},me=class o{constructor(e,r,u,l,h,p,m,y,x){o.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,r,u,l,h,p,m,y,x)}set(e,r,u,l,h,p,m,y,x){let E=this.elements;return E[0]=e,E[1]=l,E[2]=m,E[3]=r,E[4]=h,E[5]=y,E[6]=u,E[7]=p,E[8]=x,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let r=this.elements,u=e.elements;return r[0]=u[0],r[1]=u[1],r[2]=u[2],r[3]=u[3],r[4]=u[4],r[5]=u[5],r[6]=u[6],r[7]=u[7],r[8]=u[8],this}extractBasis(e,r,u){return e.setFromMatrix3Column(this,0),r.setFromMatrix3Column(this,1),u.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 u=e.elements,l=r.elements,h=this.elements,p=u[0],m=u[3],y=u[6],x=u[1],E=u[4],b=u[7],S=u[2],C=u[5],D=u[8],G=l[0],O=l[3],L=l[6],k=l[1],F=l[4],$=l[7],Z=l[2],it=l[5],et=l[8];return h[0]=p*G+m*k+y*Z,h[3]=p*O+m*F+y*it,h[6]=p*L+m*$+y*et,h[1]=x*G+E*k+b*Z,h[4]=x*O+E*F+b*it,h[7]=x*L+E*$+b*et,h[2]=S*G+C*k+D*Z,h[5]=S*O+C*F+D*it,h[8]=S*L+C*$+D*et,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],u=e[1],l=e[2],h=e[3],p=e[4],m=e[5],y=e[6],x=e[7],E=e[8];return r*p*E-r*m*x-u*h*E+u*m*y+l*h*x-l*p*y}invert(){let e=this.elements,r=e[0],u=e[1],l=e[2],h=e[3],p=e[4],m=e[5],y=e[6],x=e[7],E=e[8],b=E*p-m*x,S=m*y-E*h,C=x*h-p*y,D=r*b+u*S+l*C;if(D===0)return this.set(0,0,0,0,0,0,0,0,0);let G=1/D;return e[0]=b*G,e[1]=(l*x-E*u)*G,e[2]=(m*u-l*p)*G,e[3]=S*G,e[4]=(E*r-l*y)*G,e[5]=(l*h-m*r)*G,e[6]=C*G,e[7]=(u*y-x*r)*G,e[8]=(p*r-u*h)*G,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,u,l,h,p,m){let y=Math.cos(h),x=Math.sin(h);return this.set(u*y,u*x,-u*(y*p+x*m)+p+e,-l*x,l*y,-l*(-x*p+y*m)+m+r,0,0,1),this}scale(e,r){return this.premultiply(Uh.makeScale(e,r)),this}rotate(e){return this.premultiply(Uh.makeRotation(-e)),this}translate(e,r){return this.premultiply(Uh.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),u=Math.sin(e);return this.set(r,-u,0,u,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,u=e.elements;for(let l=0;l<9;l++)if(r[l]!==u[l])return!1;return!0}fromArray(e,r=0){for(let u=0;u<9;u++)this.elements[u]=e[u+r];return this}toArray(e=[],r=0){let u=this.elements;return e[r]=u[0],e[r+1]=u[1],e[r+2]=u[2],e[r+3]=u[3],e[r+4]=u[4],e[r+5]=u[5],e[r+6]=u[6],e[r+7]=u[7],e[r+8]=u[8],e}clone(){return new this.constructor().fromArray(this.elements)}},Uh=new me;function h0(o){return document.createElementNS("http://www.w3.org/1999/xhtml",o)}var p0=new me().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),d0=new me().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),_l={[ip]:{transfer:Wh,primaries:l0,luminanceCoefficients:[.2126,.7152,.0722],toReference:o=>o,fromReference:o=>o},[xa]:{transfer:u0,primaries:l0,luminanceCoefficients:[.2126,.7152,.0722],toReference:o=>o.convertSRGBToLinear(),fromReference:o=>o.convertLinearToSRGB()},[T0]:{transfer:Wh,primaries:c0,luminanceCoefficients:[.2289,.6917,.0793],toReference:o=>o.applyMatrix3(d0),fromReference:o=>o.applyMatrix3(p0)},[zb]:{transfer:u0,primaries:c0,luminanceCoefficients:[.2289,.6917,.0793],toReference:o=>o.convertSRGBToLinear().applyMatrix3(d0),fromReference:o=>o.applyMatrix3(p0).convertLinearToSRGB()}},Gb=new Set([ip,T0]),us={enabled:!0,_workingColorSpace:ip,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(o){if(!Gb.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 u=_l[e].toReference,l=_l[r].fromReference;return l(u(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 _l[o].primaries},getTransfer:function(o){return o===A0?Wh:_l[o].transfer},getLuminanceCoefficients:function(o,e=this._workingColorSpace){return o.fromArray(_l[e].luminanceCoefficients)}};function bu(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function Bh(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}var xu,qh=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let r;if(e instanceof HTMLCanvasElement)r=e;else{xu===void 0&&(xu=h0("canvas")),xu.width=e.width,xu.height=e.height;let u=xu.getContext("2d");e instanceof ImageData?u.putImageData(e,0,0):u.drawImage(e,0,0,e.width,e.height),r=xu}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<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let r=h0("canvas");r.width=e.width,r.height=e.height;let u=r.getContext("2d");u.drawImage(e,0,0,e.width,e.height);let l=u.getImageData(0,0,e.width,e.height),h=l.data;for(let p=0;p<h.length;p++)h[p]=bu(h[p]/255)*255;return u.putImageData(l,0,0),r}else if(e.data){let r=e.data.slice(0);for(let u=0;u<r.length;u++)r instanceof Uint8Array||r instanceof Uint8ClampedArray?r[u]=Math.floor(bu(r[u]/255)*255):r[u]=bu(r[u]);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}},Hb=0,Xh=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Hb++}),this.uuid=op(),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 u={uuid:this.uuid,url:""},l=this.data;if(l!==null){let h;if(Array.isArray(l)){h=[];for(let p=0,m=l.length;p<m;p++)l[p].isDataTexture?h.push(zh(l[p].image)):h.push(zh(l[p]))}else h=zh(l);u.url=h}return r||(e.images[this.uuid]=u),u}};function zh(o){return typeof HTMLImageElement<"u"&&o instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&o instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&o instanceof ImageBitmap?qh.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 Vb=0,El=class o extends Lc{constructor(e=o.DEFAULT_IMAGE,r=o.DEFAULT_MAPPING,u=bc,l=bc,h=Ob,p=Fb,m=Bb,y=Ub,x=o.DEFAULT_ANISOTROPY,E=A0){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Vb++}),this.uuid=op(),this.name="",this.source=new Xh(e),this.mipmaps=[],this.mapping=r,this.channel=0,this.wrapS=u,this.wrapT=l,this.magFilter=h,this.minFilter=p,this.anisotropy=x,this.format=m,this.internalFormat=null,this.type=y,this.offset=new Xi(0,0),this.repeat=new Xi(1,1),this.center=new Xi(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new me,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=E,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 u={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&&(u.userData=this.userData),r||(e.textures[this.uuid]=u),u}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==b0)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case r0:e.x=e.x-Math.floor(e.x);break;case bc:e.x=e.x<0?0:1;break;case i0: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 r0:e.y=e.y-Math.floor(e.y);break;case bc:e.y=e.y<0?0:1;break;case i0: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++}};El.DEFAULT_IMAGE=null;El.DEFAULT_MAPPING=b0;El.DEFAULT_ANISOTROPY=1;var wa=class{constructor(e=0,r=0,u=0,l=1){this.isQuaternion=!0,this._x=e,this._y=r,this._z=u,this._w=l}static slerpFlat(e,r,u,l,h,p,m){let y=u[l+0],x=u[l+1],E=u[l+2],b=u[l+3],S=h[p+0],C=h[p+1],D=h[p+2],G=h[p+3];if(m===0){e[r+0]=y,e[r+1]=x,e[r+2]=E,e[r+3]=b;return}if(m===1){e[r+0]=S,e[r+1]=C,e[r+2]=D,e[r+3]=G;return}if(b!==G||y!==S||x!==C||E!==D){let O=1-m,L=y*S+x*C+E*D+b*G,k=L>=0?1:-1,F=1-L*L;if(F>Number.EPSILON){let Z=Math.sqrt(F),it=Math.atan2(Z,L*k);O=Math.sin(O*it)/Z,m=Math.sin(m*it)/Z}let $=m*k;if(y=y*O+S*$,x=x*O+C*$,E=E*O+D*$,b=b*O+G*$,O===1-m){let Z=1/Math.sqrt(y*y+x*x+E*E+b*b);y*=Z,x*=Z,E*=Z,b*=Z}}e[r]=y,e[r+1]=x,e[r+2]=E,e[r+3]=b}static multiplyQuaternionsFlat(e,r,u,l,h,p){let m=u[l],y=u[l+1],x=u[l+2],E=u[l+3],b=h[p],S=h[p+1],C=h[p+2],D=h[p+3];return e[r]=m*D+E*b+y*C-x*S,e[r+1]=y*D+E*S+x*b-m*C,e[r+2]=x*D+E*C+m*S-y*b,e[r+3]=E*D-m*b-y*S-x*C,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,u,l){return this._x=e,this._y=r,this._z=u,this._w=l,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 u=e._x,l=e._y,h=e._z,p=e._order,m=Math.cos,y=Math.sin,x=m(u/2),E=m(l/2),b=m(h/2),S=y(u/2),C=y(l/2),D=y(h/2);switch(p){case"XYZ":this._x=S*E*b+x*C*D,this._y=x*C*b-S*E*D,this._z=x*E*D+S*C*b,this._w=x*E*b-S*C*D;break;case"YXZ":this._x=S*E*b+x*C*D,this._y=x*C*b-S*E*D,this._z=x*E*D-S*C*b,this._w=x*E*b+S*C*D;break;case"ZXY":this._x=S*E*b-x*C*D,this._y=x*C*b+S*E*D,this._z=x*E*D+S*C*b,this._w=x*E*b-S*C*D;break;case"ZYX":this._x=S*E*b-x*C*D,this._y=x*C*b+S*E*D,this._z=x*E*D-S*C*b,this._w=x*E*b+S*C*D;break;case"YZX":this._x=S*E*b+x*C*D,this._y=x*C*b+S*E*D,this._z=x*E*D-S*C*b,this._w=x*E*b-S*C*D;break;case"XZY":this._x=S*E*b-x*C*D,this._y=x*C*b-S*E*D,this._z=x*E*D+S*C*b,this._w=x*E*b+S*C*D;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+p)}return r===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,r){let u=r/2,l=Math.sin(u);return this._x=e.x*l,this._y=e.y*l,this._z=e.z*l,this._w=Math.cos(u),this._onChangeCallback(),this}setFromRotationMatrix(e){let r=e.elements,u=r[0],l=r[4],h=r[8],p=r[1],m=r[5],y=r[9],x=r[2],E=r[6],b=r[10],S=u+m+b;if(S>0){let C=.5/Math.sqrt(S+1);this._w=.25/C,this._x=(E-y)*C,this._y=(h-x)*C,this._z=(p-l)*C}else if(u>m&&u>b){let C=2*Math.sqrt(1+u-m-b);this._w=(E-y)/C,this._x=.25*C,this._y=(l+p)/C,this._z=(h+x)/C}else if(m>b){let C=2*Math.sqrt(1+m-u-b);this._w=(h-x)/C,this._x=(l+p)/C,this._y=.25*C,this._z=(y+E)/C}else{let C=2*Math.sqrt(1+b-u-m);this._w=(p-l)/C,this._x=(h+x)/C,this._y=(y+E)/C,this._z=.25*C}return this._onChangeCallback(),this}setFromUnitVectors(e,r){let u=e.dot(r)+1;return u<Number.EPSILON?(u=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=u):(this._x=0,this._y=-e.z,this._z=e.y,this._w=u)):(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=u),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(_o(this.dot(e),-1,1)))}rotateTowards(e,r){let u=this.angleTo(e);if(u===0)return this;let l=Math.min(1,r/u);return this.slerp(e,l),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 u=e._x,l=e._y,h=e._z,p=e._w,m=r._x,y=r._y,x=r._z,E=r._w;return this._x=u*E+p*m+l*x-h*y,this._y=l*E+p*y+h*m-u*x,this._z=h*E+p*x+u*y-l*m,this._w=p*E-u*m-l*y-h*x,this._onChangeCallback(),this}slerp(e,r){if(r===0)return this;if(r===1)return this.copy(e);let u=this._x,l=this._y,h=this._z,p=this._w,m=p*e._w+u*e._x+l*e._y+h*e._z;if(m<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,m=-m):this.copy(e),m>=1)return this._w=p,this._x=u,this._y=l,this._z=h,this;let y=1-m*m;if(y<=Number.EPSILON){let C=1-r;return this._w=C*p+r*this._w,this._x=C*u+r*this._x,this._y=C*l+r*this._y,this._z=C*h+r*this._z,this.normalize(),this}let x=Math.sqrt(y),E=Math.atan2(x,m),b=Math.sin((1-r)*E)/x,S=Math.sin(r*E)/x;return this._w=p*b+this._w*S,this._x=u*b+this._x*S,this._y=l*b+this._y*S,this._z=h*b+this._z*S,this._onChangeCallback(),this}slerpQuaternions(e,r,u){return this.copy(e).slerp(r,u)}random(){let e=2*Math.PI*Math.random(),r=2*Math.PI*Math.random(),u=Math.random(),l=Math.sqrt(1-u),h=Math.sqrt(u);return this.set(l*Math.sin(e),l*Math.cos(e),h*Math.sin(r),h*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}},En=class o{constructor(e=0,r=0,u=0){o.prototype.isVector3=!0,this.x=e,this.y=r,this.z=u}set(e,r,u){return u===void 0&&(u=this.z),this.x=e,this.y=r,this.z=u,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(g0.setFromEuler(e))}applyAxisAngle(e,r){return this.applyQuaternion(g0.setFromAxisAngle(e,r))}applyMatrix3(e){let r=this.x,u=this.y,l=this.z,h=e.elements;return this.x=h[0]*r+h[3]*u+h[6]*l,this.y=h[1]*r+h[4]*u+h[7]*l,this.z=h[2]*r+h[5]*u+h[8]*l,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let r=this.x,u=this.y,l=this.z,h=e.elements,p=1/(h[3]*r+h[7]*u+h[11]*l+h[15]);return this.x=(h[0]*r+h[4]*u+h[8]*l+h[12])*p,this.y=(h[1]*r+h[5]*u+h[9]*l+h[13])*p,this.z=(h[2]*r+h[6]*u+h[10]*l+h[14])*p,this}applyQuaternion(e){let r=this.x,u=this.y,l=this.z,h=e.x,p=e.y,m=e.z,y=e.w,x=2*(p*l-m*u),E=2*(m*r-h*l),b=2*(h*u-p*r);return this.x=r+y*x+p*b-m*E,this.y=u+y*E+m*x-h*b,this.z=l+y*b+h*E-p*x,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,u=this.y,l=this.z,h=e.elements;return this.x=h[0]*r+h[4]*u+h[8]*l,this.y=h[1]*r+h[5]*u+h[9]*l,this.z=h[2]*r+h[6]*u+h[10]*l,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 u=this.length();return this.divideScalar(u||1).multiplyScalar(Math.max(e,Math.min(r,u)))}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,u){return this.x=e.x+(r.x-e.x)*u,this.y=e.y+(r.y-e.y)*u,this.z=e.z+(r.z-e.z)*u,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,r){let u=e.x,l=e.y,h=e.z,p=r.x,m=r.y,y=r.z;return this.x=l*y-h*m,this.y=h*p-u*y,this.z=u*m-l*p,this}projectOnVector(e){let r=e.lengthSq();if(r===0)return this.set(0,0,0);let u=e.dot(this)/r;return this.copy(e).multiplyScalar(u)}projectOnPlane(e){return kh.copy(this).projectOnVector(e),this.sub(kh)}reflect(e){return this.sub(kh.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 u=this.dot(e)/r;return Math.acos(_o(u,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let r=this.x-e.x,u=this.y-e.y,l=this.z-e.z;return r*r+u*u+l*l}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,u){let l=Math.sin(r)*e;return this.x=l*Math.sin(u),this.y=Math.cos(r)*e,this.z=l*Math.cos(u),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,r,u){return this.x=e*Math.sin(r),this.y=u,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(),u=this.setFromMatrixColumn(e,1).length(),l=this.setFromMatrixColumn(e,2).length();return this.x=r,this.y=u,this.z=l,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,u=Math.sqrt(1-r*r);return this.x=u*Math.cos(e),this.y=r,this.z=u*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},kh=new En,g0=new wa;var Ea=class o{constructor(e,r,u,l,h,p,m,y,x,E,b,S,C,D,G,O){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,u,l,h,p,m,y,x,E,b,S,C,D,G,O)}set(e,r,u,l,h,p,m,y,x,E,b,S,C,D,G,O){let L=this.elements;return L[0]=e,L[4]=r,L[8]=u,L[12]=l,L[1]=h,L[5]=p,L[9]=m,L[13]=y,L[2]=x,L[6]=E,L[10]=b,L[14]=S,L[3]=C,L[7]=D,L[11]=G,L[15]=O,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,u=e.elements;return r[0]=u[0],r[1]=u[1],r[2]=u[2],r[3]=u[3],r[4]=u[4],r[5]=u[5],r[6]=u[6],r[7]=u[7],r[8]=u[8],r[9]=u[9],r[10]=u[10],r[11]=u[11],r[12]=u[12],r[13]=u[13],r[14]=u[14],r[15]=u[15],this}copyPosition(e){let r=this.elements,u=e.elements;return r[12]=u[12],r[13]=u[13],r[14]=u[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,u){return e.setFromMatrixColumn(this,0),r.setFromMatrixColumn(this,1),u.setFromMatrixColumn(this,2),this}makeBasis(e,r,u){return this.set(e.x,r.x,u.x,0,e.y,r.y,u.y,0,e.z,r.z,u.z,0,0,0,0,1),this}extractRotation(e){let r=this.elements,u=e.elements,l=1/Eu.setFromMatrixColumn(e,0).length(),h=1/Eu.setFromMatrixColumn(e,1).length(),p=1/Eu.setFromMatrixColumn(e,2).length();return r[0]=u[0]*l,r[1]=u[1]*l,r[2]=u[2]*l,r[3]=0,r[4]=u[4]*h,r[5]=u[5]*h,r[6]=u[6]*h,r[7]=0,r[8]=u[8]*p,r[9]=u[9]*p,r[10]=u[10]*p,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromEuler(e){let r=this.elements,u=e.x,l=e.y,h=e.z,p=Math.cos(u),m=Math.sin(u),y=Math.cos(l),x=Math.sin(l),E=Math.cos(h),b=Math.sin(h);if(e.order==="XYZ"){let S=p*E,C=p*b,D=m*E,G=m*b;r[0]=y*E,r[4]=-y*b,r[8]=x,r[1]=C+D*x,r[5]=S-G*x,r[9]=-m*y,r[2]=G-S*x,r[6]=D+C*x,r[10]=p*y}else if(e.order==="YXZ"){let S=y*E,C=y*b,D=x*E,G=x*b;r[0]=S+G*m,r[4]=D*m-C,r[8]=p*x,r[1]=p*b,r[5]=p*E,r[9]=-m,r[2]=C*m-D,r[6]=G+S*m,r[10]=p*y}else if(e.order==="ZXY"){let S=y*E,C=y*b,D=x*E,G=x*b;r[0]=S-G*m,r[4]=-p*b,r[8]=D+C*m,r[1]=C+D*m,r[5]=p*E,r[9]=G-S*m,r[2]=-p*x,r[6]=m,r[10]=p*y}else if(e.order==="ZYX"){let S=p*E,C=p*b,D=m*E,G=m*b;r[0]=y*E,r[4]=D*x-C,r[8]=S*x+G,r[1]=y*b,r[5]=G*x+S,r[9]=C*x-D,r[2]=-x,r[6]=m*y,r[10]=p*y}else if(e.order==="YZX"){let S=p*y,C=p*x,D=m*y,G=m*x;r[0]=y*E,r[4]=G-S*b,r[8]=D*b+C,r[1]=b,r[5]=p*E,r[9]=-m*E,r[2]=-x*E,r[6]=C*b+D,r[10]=S-G*b}else if(e.order==="XZY"){let S=p*y,C=p*x,D=m*y,G=m*x;r[0]=y*E,r[4]=-b,r[8]=x*E,r[1]=S*b+G,r[5]=p*E,r[9]=C*b-D,r[2]=D*b-C,r[6]=m*E,r[10]=G*b+S}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(Wb,e,qb)}lookAt(e,r,u){let l=this.elements;return Fo.subVectors(e,r),Fo.lengthSq()===0&&(Fo.z=1),Fo.normalize(),va.crossVectors(u,Fo),va.lengthSq()===0&&(Math.abs(u.z)===1?Fo.x+=1e-4:Fo.z+=1e-4,Fo.normalize(),va.crossVectors(u,Fo)),va.normalize(),Tc.crossVectors(Fo,va),l[0]=va.x,l[4]=Tc.x,l[8]=Fo.x,l[1]=va.y,l[5]=Tc.y,l[9]=Fo.y,l[2]=va.z,l[6]=Tc.z,l[10]=Fo.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,r){let u=e.elements,l=r.elements,h=this.elements,p=u[0],m=u[4],y=u[8],x=u[12],E=u[1],b=u[5],S=u[9],C=u[13],D=u[2],G=u[6],O=u[10],L=u[14],k=u[3],F=u[7],$=u[11],Z=u[15],it=l[0],et=l[4],U=l[8],wt=l[12],Lt=l[1],Ot=l[5],W=l[9],de=l[13],yt=l[2],zt=l[6],Kt=l[10],ie=l[14],_t=l[3],Pt=l[7],q=l[11],oe=l[15];return h[0]=p*it+m*Lt+y*yt+x*_t,h[4]=p*et+m*Ot+y*zt+x*Pt,h[8]=p*U+m*W+y*Kt+x*q,h[12]=p*wt+m*de+y*ie+x*oe,h[1]=E*it+b*Lt+S*yt+C*_t,h[5]=E*et+b*Ot+S*zt+C*Pt,h[9]=E*U+b*W+S*Kt+C*q,h[13]=E*wt+b*de+S*ie+C*oe,h[2]=D*it+G*Lt+O*yt+L*_t,h[6]=D*et+G*Ot+O*zt+L*Pt,h[10]=D*U+G*W+O*Kt+L*q,h[14]=D*wt+G*de+O*ie+L*oe,h[3]=k*it+F*Lt+$*yt+Z*_t,h[7]=k*et+F*Ot+$*zt+Z*Pt,h[11]=k*U+F*W+$*Kt+Z*q,h[15]=k*wt+F*de+$*ie+Z*oe,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],u=e[4],l=e[8],h=e[12],p=e[1],m=e[5],y=e[9],x=e[13],E=e[2],b=e[6],S=e[10],C=e[14],D=e[3],G=e[7],O=e[11],L=e[15];return D*(+h*y*b-l*x*b-h*m*S+u*x*S+l*m*C-u*y*C)+G*(+r*y*C-r*x*S+h*p*S-l*p*C+l*x*E-h*y*E)+O*(+r*x*b-r*m*C-h*p*b+u*p*C+h*m*E-u*x*E)+L*(-l*m*E-r*y*b+r*m*S+l*p*b-u*p*S+u*y*E)}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,u){let l=this.elements;return e.isVector3?(l[12]=e.x,l[13]=e.y,l[14]=e.z):(l[12]=e,l[13]=r,l[14]=u),this}invert(){let e=this.elements,r=e[0],u=e[1],l=e[2],h=e[3],p=e[4],m=e[5],y=e[6],x=e[7],E=e[8],b=e[9],S=e[10],C=e[11],D=e[12],G=e[13],O=e[14],L=e[15],k=b*O*x-G*S*x+G*y*C-m*O*C-b*y*L+m*S*L,F=D*S*x-E*O*x-D*y*C+p*O*C+E*y*L-p*S*L,$=E*G*x-D*b*x+D*m*C-p*G*C-E*m*L+p*b*L,Z=D*b*y-E*G*y-D*m*S+p*G*S+E*m*O-p*b*O,it=r*k+u*F+l*$+h*Z;if(it===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let et=1/it;return e[0]=k*et,e[1]=(G*S*h-b*O*h-G*l*C+u*O*C+b*l*L-u*S*L)*et,e[2]=(m*O*h-G*y*h+G*l*x-u*O*x-m*l*L+u*y*L)*et,e[3]=(b*y*h-m*S*h-b*l*x+u*S*x+m*l*C-u*y*C)*et,e[4]=F*et,e[5]=(E*O*h-D*S*h+D*l*C-r*O*C-E*l*L+r*S*L)*et,e[6]=(D*y*h-p*O*h-D*l*x+r*O*x+p*l*L-r*y*L)*et,e[7]=(p*S*h-E*y*h+E*l*x-r*S*x-p*l*C+r*y*C)*et,e[8]=$*et,e[9]=(D*b*h-E*G*h-D*u*C+r*G*C+E*u*L-r*b*L)*et,e[10]=(p*G*h-D*m*h+D*u*x-r*G*x-p*u*L+r*m*L)*et,e[11]=(E*m*h-p*b*h-E*u*x+r*b*x+p*u*C-r*m*C)*et,e[12]=Z*et,e[13]=(E*G*l-D*b*l+D*u*S-r*G*S-E*u*O+r*b*O)*et,e[14]=(D*m*l-p*G*l-D*u*y+r*G*y+p*u*O-r*m*O)*et,e[15]=(p*b*l-E*m*l+E*u*y-r*b*y-p*u*S+r*m*S)*et,this}scale(e){let r=this.elements,u=e.x,l=e.y,h=e.z;return r[0]*=u,r[4]*=l,r[8]*=h,r[1]*=u,r[5]*=l,r[9]*=h,r[2]*=u,r[6]*=l,r[10]*=h,r[3]*=u,r[7]*=l,r[11]*=h,this}getMaxScaleOnAxis(){let e=this.elements,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],u=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],l=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(r,u,l))}makeTranslation(e,r,u){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,u,0,0,0,1),this}makeRotationX(e){let r=Math.cos(e),u=Math.sin(e);return this.set(1,0,0,0,0,r,-u,0,0,u,r,0,0,0,0,1),this}makeRotationY(e){let r=Math.cos(e),u=Math.sin(e);return this.set(r,0,u,0,0,1,0,0,-u,0,r,0,0,0,0,1),this}makeRotationZ(e){let r=Math.cos(e),u=Math.sin(e);return this.set(r,-u,0,0,u,r,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,r){let u=Math.cos(r),l=Math.sin(r),h=1-u,p=e.x,m=e.y,y=e.z,x=h*p,E=h*m;return this.set(x*p+u,x*m-l*y,x*y+l*m,0,x*m+l*y,E*m+u,E*y-l*p,0,x*y-l*m,E*y+l*p,h*y*y+u,0,0,0,0,1),this}makeScale(e,r,u){return this.set(e,0,0,0,0,r,0,0,0,0,u,0,0,0,0,1),this}makeShear(e,r,u,l,h,p){return this.set(1,u,h,0,e,1,p,0,r,l,1,0,0,0,0,1),this}compose(e,r,u){let l=this.elements,h=r._x,p=r._y,m=r._z,y=r._w,x=h+h,E=p+p,b=m+m,S=h*x,C=h*E,D=h*b,G=p*E,O=p*b,L=m*b,k=y*x,F=y*E,$=y*b,Z=u.x,it=u.y,et=u.z;return l[0]=(1-(G+L))*Z,l[1]=(C+$)*Z,l[2]=(D-F)*Z,l[3]=0,l[4]=(C-$)*it,l[5]=(1-(S+L))*it,l[6]=(O+k)*it,l[7]=0,l[8]=(D+F)*et,l[9]=(O-k)*et,l[10]=(1-(S+G))*et,l[11]=0,l[12]=e.x,l[13]=e.y,l[14]=e.z,l[15]=1,this}decompose(e,r,u){let l=this.elements,h=Eu.set(l[0],l[1],l[2]).length(),p=Eu.set(l[4],l[5],l[6]).length(),m=Eu.set(l[8],l[9],l[10]).length();this.determinant()<0&&(h=-h),e.x=l[12],e.y=l[13],e.z=l[14],ls.copy(this);let x=1/h,E=1/p,b=1/m;return ls.elements[0]*=x,ls.elements[1]*=x,ls.elements[2]*=x,ls.elements[4]*=E,ls.elements[5]*=E,ls.elements[6]*=E,ls.elements[8]*=b,ls.elements[9]*=b,ls.elements[10]*=b,r.setFromRotationMatrix(ls),u.x=h,u.y=p,u.z=m,this}makePerspective(e,r,u,l,h,p,m=Ac){let y=this.elements,x=2*h/(r-e),E=2*h/(u-l),b=(r+e)/(r-e),S=(u+l)/(u-l),C,D;if(m===Ac)C=-(p+h)/(p-h),D=-2*p*h/(p-h);else if(m===f0)C=-p/(p-h),D=-p*h/(p-h);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+m);return y[0]=x,y[4]=0,y[8]=b,y[12]=0,y[1]=0,y[5]=E,y[9]=S,y[13]=0,y[2]=0,y[6]=0,y[10]=C,y[14]=D,y[3]=0,y[7]=0,y[11]=-1,y[15]=0,this}makeOrthographic(e,r,u,l,h,p,m=Ac){let y=this.elements,x=1/(r-e),E=1/(u-l),b=1/(p-h),S=(r+e)*x,C=(u+l)*E,D,G;if(m===Ac)D=(p+h)*b,G=-2*b;else if(m===f0)D=h*b,G=-1*b;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+m);return y[0]=2*x,y[4]=0,y[8]=0,y[12]=-S,y[1]=0,y[5]=2*E,y[9]=0,y[13]=-C,y[2]=0,y[6]=0,y[10]=G,y[14]=-D,y[3]=0,y[7]=0,y[11]=0,y[15]=1,this}equals(e){let r=this.elements,u=e.elements;for(let l=0;l<16;l++)if(r[l]!==u[l])return!1;return!0}fromArray(e,r=0){for(let u=0;u<16;u++)this.elements[u]=e[u+r];return this}toArray(e=[],r=0){let u=this.elements;return e[r]=u[0],e[r+1]=u[1],e[r+2]=u[2],e[r+3]=u[3],e[r+4]=u[4],e[r+5]=u[5],e[r+6]=u[6],e[r+7]=u[7],e[r+8]=u[8],e[r+9]=u[9],e[r+10]=u[10],e[r+11]=u[11],e[r+12]=u[12],e[r+13]=u[13],e[r+14]=u[14],e[r+15]=u[15],e}},Eu=new En,ls=new Ea,Wb=new En(0,0,0),qb=new En(1,1,1),va=new En,Tc=new En,Fo=new En,m0=new Ea,y0=new wa,Nc=class o{constructor(e=0,r=0,u=0,l=o.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=r,this._z=u,this._order=l}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,u,l=this._order){return this._x=e,this._y=r,this._z=u,this._order=l,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,u=!0){let l=e.elements,h=l[0],p=l[4],m=l[8],y=l[1],x=l[5],E=l[9],b=l[2],S=l[6],C=l[10];switch(r){case"XYZ":this._y=Math.asin(_o(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(-E,C),this._z=Math.atan2(-p,h)):(this._x=Math.atan2(S,x),this._z=0);break;case"YXZ":this._x=Math.asin(-_o(E,-1,1)),Math.abs(E)<.9999999?(this._y=Math.atan2(m,C),this._z=Math.atan2(y,x)):(this._y=Math.atan2(-b,h),this._z=0);break;case"ZXY":this._x=Math.asin(_o(S,-1,1)),Math.abs(S)<.9999999?(this._y=Math.atan2(-b,C),this._z=Math.atan2(-p,x)):(this._y=0,this._z=Math.atan2(y,h));break;case"ZYX":this._y=Math.asin(-_o(b,-1,1)),Math.abs(b)<.9999999?(this._x=Math.atan2(S,C),this._z=Math.atan2(y,h)):(this._x=0,this._z=Math.atan2(-p,x));break;case"YZX":this._z=Math.asin(_o(y,-1,1)),Math.abs(y)<.9999999?(this._x=Math.atan2(-E,x),this._y=Math.atan2(-b,h)):(this._x=0,this._y=Math.atan2(m,C));break;case"XZY":this._z=Math.asin(-_o(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(S,x),this._y=Math.atan2(m,h)):(this._x=Math.atan2(-E,C),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+r)}return this._order=r,u===!0&&this._onChangeCallback(),this}setFromQuaternion(e,r,u){return m0.makeRotationFromQuaternion(e),this.setFromRotationMatrix(m0,r,u)}setFromVector3(e,r=this._order){return this.set(e.x,e.y,e.z,r)}reorder(e){return y0.setFromEuler(this),this.setFromQuaternion(y0,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}};Nc.DEFAULT_ORDER="XYZ";var Yh=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}},Xb=0,v0=new En,wu=new wa,js=new Ea,Cc=new En,xl=new En,Yb=new En,$b=new wa,_0=new En(1,0,0),x0=new En(0,1,0),E0=new En(0,0,1),w0={type:"added"},Zb={type:"removed"},Mu={type:"childadded",child:null},Gh={type:"childremoved",child:null},wl=class o extends Lc{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Xb++}),this.uuid=op(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=o.DEFAULT_UP.clone();let e=new En,r=new Nc,u=new wa,l=new En(1,1,1);function h(){u.setFromEuler(r,!1)}function p(){r.setFromQuaternion(u,void 0,!1)}r._onChange(h),u._onChange(p),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:r},quaternion:{configurable:!0,enumerable:!0,value:u},scale:{configurable:!0,enumerable:!0,value:l},modelViewMatrix:{value:new Ea},normalMatrix:{value:new me}}),this.matrix=new Ea,this.matrixWorld=new Ea,this.matrixAutoUpdate=o.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=o.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Yh,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 wu.setFromAxisAngle(e,r),this.quaternion.multiply(wu),this}rotateOnWorldAxis(e,r){return wu.setFromAxisAngle(e,r),this.quaternion.premultiply(wu),this}rotateX(e){return this.rotateOnAxis(_0,e)}rotateY(e){return this.rotateOnAxis(x0,e)}rotateZ(e){return this.rotateOnAxis(E0,e)}translateOnAxis(e,r){return v0.copy(e).applyQuaternion(this.quaternion),this.position.add(v0.multiplyScalar(r)),this}translateX(e){return this.translateOnAxis(_0,e)}translateY(e){return this.translateOnAxis(x0,e)}translateZ(e){return this.translateOnAxis(E0,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(js.copy(this.matrixWorld).invert())}lookAt(e,r,u){e.isVector3?Cc.copy(e):Cc.set(e,r,u);let l=this.parent;this.updateWorldMatrix(!0,!1),xl.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?js.lookAt(xl,Cc,this.up):js.lookAt(Cc,xl,this.up),this.quaternion.setFromRotationMatrix(js),l&&(js.extractRotation(l.matrixWorld),wu.setFromRotationMatrix(js),this.quaternion.premultiply(wu.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(w0),Mu.child=e,this.dispatchEvent(Mu),Mu.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let u=0;u<arguments.length;u++)this.remove(arguments[u]);return this}let r=this.children.indexOf(e);return r!==-1&&(e.parent=null,this.children.splice(r,1),e.dispatchEvent(Zb),Gh.child=e,this.dispatchEvent(Gh),Gh.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),js.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),js.multiply(e.parent.matrixWorld)),e.applyMatrix4(js),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(w0),Mu.child=e,this.dispatchEvent(Mu),Mu.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 u=0,l=this.children.length;u<l;u++){let p=this.children[u].getObjectByProperty(e,r);if(p!==void 0)return p}}getObjectsByProperty(e,r,u=[]){this[e]===r&&u.push(this);let l=this.children;for(let h=0,p=l.length;h<p;h++)l[h].getObjectsByProperty(e,r,u);return u}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xl,e,Yb),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xl,$b,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 u=0,l=r.length;u<l;u++)r[u].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let r=this.children;for(let u=0,l=r.length;u<l;u++)r[u].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 u=0,l=r.length;u<l;u++)r[u].updateMatrixWorld(e)}updateWorldMatrix(e,r){let u=this.parent;if(e===!0&&u!==null&&u.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 l=this.children;for(let h=0,p=l.length;h<p;h++)l[h].updateWorldMatrix(!1,!0)}}toJSON(e){let r=e===void 0||typeof e=="string",u={};r&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},u.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let l={};l.uuid=this.uuid,l.type=this.type,this.name!==""&&(l.name=this.name),this.castShadow===!0&&(l.castShadow=!0),this.receiveShadow===!0&&(l.receiveShadow=!0),this.visible===!1&&(l.visible=!1),this.frustumCulled===!1&&(l.frustumCulled=!1),this.renderOrder!==0&&(l.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(l.userData=this.userData),l.layers=this.layers.mask,l.matrix=this.matrix.toArray(),l.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(l.matrixAutoUpdate=!1),this.isInstancedMesh&&(l.type="InstancedMesh",l.count=this.count,l.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(l.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(l.type="BatchedMesh",l.perObjectFrustumCulled=this.perObjectFrustumCulled,l.sortObjects=this.sortObjects,l.drawRanges=this._drawRanges,l.reservedRanges=this._reservedRanges,l.visibility=this._visibility,l.active=this._active,l.bounds=this._bounds.map(m=>({boxInitialized:m.boxInitialized,boxMin:m.box.min.toArray(),boxMax:m.box.max.toArray(),sphereInitialized:m.sphereInitialized,sphereRadius:m.sphere.radius,sphereCenter:m.sphere.center.toArray()})),l.maxInstanceCount=this._maxInstanceCount,l.maxVertexCount=this._maxVertexCount,l.maxIndexCount=this._maxIndexCount,l.geometryInitialized=this._geometryInitialized,l.geometryCount=this._geometryCount,l.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(l.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(l.boundingSphere={center:l.boundingSphere.center.toArray(),radius:l.boundingSphere.radius}),this.boundingBox!==null&&(l.boundingBox={min:l.boundingBox.min.toArray(),max:l.boundingBox.max.toArray()}));function h(m,y){return m[y.uuid]===void 0&&(m[y.uuid]=y.toJSON(e)),y.uuid}if(this.isScene)this.background&&(this.background.isColor?l.background=this.background.toJSON():this.background.isTexture&&(l.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(l.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){l.geometry=h(e.geometries,this.geometry);let m=this.geometry.parameters;if(m!==void 0&&m.shapes!==void 0){let y=m.shapes;if(Array.isArray(y))for(let x=0,E=y.length;x<E;x++){let b=y[x];h(e.shapes,b)}else h(e.shapes,y)}}if(this.isSkinnedMesh&&(l.bindMode=this.bindMode,l.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(h(e.skeletons,this.skeleton),l.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let m=[];for(let y=0,x=this.material.length;y<x;y++)m.push(h(e.materials,this.material[y]));l.material=m}else l.material=h(e.materials,this.material);if(this.children.length>0){l.children=[];for(let m=0;m<this.children.length;m++)l.children.push(this.children[m].toJSON(e).object)}if(this.animations.length>0){l.animations=[];for(let m=0;m<this.animations.length;m++){let y=this.animations[m];l.animations.push(h(e.animations,y))}}if(r){let m=p(e.geometries),y=p(e.materials),x=p(e.textures),E=p(e.images),b=p(e.shapes),S=p(e.skeletons),C=p(e.animations),D=p(e.nodes);m.length>0&&(u.geometries=m),y.length>0&&(u.materials=y),x.length>0&&(u.textures=x),E.length>0&&(u.images=E),b.length>0&&(u.shapes=b),S.length>0&&(u.skeletons=S),C.length>0&&(u.animations=C),D.length>0&&(u.nodes=D)}return u.object=l,u;function p(m){let y=[];for(let x in m){let E=m[x];delete E.metadata,y.push(E)}return y}}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 u=0;u<e.children.length;u++){let l=e.children[u];this.add(l.clone())}return this}};wl.DEFAULT_UP=new En(0,1,0);wl.DEFAULT_MATRIX_AUTO_UPDATE=!0;wl.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var C0={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},_a={h:0,s:0,l:0},Ic={h:0,s:0,l:0};function Hh(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 yi=class{constructor(e,r,u){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,r,u)}set(e,r,u){if(r===void 0&&u===void 0){let l=e;l&&l.isColor?this.copy(l):typeof l=="number"?this.setHex(l):typeof l=="string"&&this.setStyle(l)}else this.setRGB(e,r,u);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,r=xa){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,us.toWorkingColorSpace(this,r),this}setRGB(e,r,u,l=us.workingColorSpace){return this.r=e,this.g=r,this.b=u,us.toWorkingColorSpace(this,l),this}setHSL(e,r,u,l=us.workingColorSpace){if(e=kb(e,1),r=_o(r,0,1),u=_o(u,0,1),r===0)this.r=this.g=this.b=u;else{let h=u<=.5?u*(1+r):u+r-u*r,p=2*u-h;this.r=Hh(p,h,e+1/3),this.g=Hh(p,h,e),this.b=Hh(p,h,e-1/3)}return us.toWorkingColorSpace(this,l),this}setStyle(e,r=xa){function u(h){h!==void 0&&parseFloat(h)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let l;if(l=/^(\\w+)\\(([^\\)]*)\\)/.exec(e)){let h,p=l[1],m=l[2];switch(p){case"rgb":case"rgba":if(h=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(m))return u(h[4]),this.setRGB(Math.min(255,parseInt(h[1],10))/255,Math.min(255,parseInt(h[2],10))/255,Math.min(255,parseInt(h[3],10))/255,r);if(h=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(m))return u(h[4]),this.setRGB(Math.min(100,parseInt(h[1],10))/100,Math.min(100,parseInt(h[2],10))/100,Math.min(100,parseInt(h[3],10))/100,r);break;case"hsl":case"hsla":if(h=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(m))return u(h[4]),this.setHSL(parseFloat(h[1])/360,parseFloat(h[2])/100,parseFloat(h[3])/100,r);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(l=/^\\#([A-Fa-f\\d]+)$/.exec(e)){let h=l[1],p=h.length;if(p===3)return this.setRGB(parseInt(h.charAt(0),16)/15,parseInt(h.charAt(1),16)/15,parseInt(h.charAt(2),16)/15,r);if(p===6)return this.setHex(parseInt(h,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=xa){let u=C0[e.toLowerCase()];return u!==void 0?this.setHex(u,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=bu(e.r),this.g=bu(e.g),this.b=bu(e.b),this}copyLinearToSRGB(e){return this.r=Bh(e.r),this.g=Bh(e.g),this.b=Bh(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=xa){return us.fromWorkingColorSpace(Ii.copy(this),e),Math.round(_o(Ii.r*255,0,255))*65536+Math.round(_o(Ii.g*255,0,255))*256+Math.round(_o(Ii.b*255,0,255))}getHexString(e=xa){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,r=us.workingColorSpace){us.fromWorkingColorSpace(Ii.copy(this),r);let u=Ii.r,l=Ii.g,h=Ii.b,p=Math.max(u,l,h),m=Math.min(u,l,h),y,x,E=(m+p)/2;if(m===p)y=0,x=0;else{let b=p-m;switch(x=E<=.5?b/(p+m):b/(2-p-m),p){case u:y=(l-h)/b+(l<h?6:0);break;case l:y=(h-u)/b+2;break;case h:y=(u-l)/b+4;break}y/=6}return e.h=y,e.s=x,e.l=E,e}getRGB(e,r=us.workingColorSpace){return us.fromWorkingColorSpace(Ii.copy(this),r),e.r=Ii.r,e.g=Ii.g,e.b=Ii.b,e}getStyle(e=xa){us.fromWorkingColorSpace(Ii.copy(this),e);let r=Ii.r,u=Ii.g,l=Ii.b;return e!==xa?`color(${e} ${r.toFixed(3)} ${u.toFixed(3)} ${l.toFixed(3)})`:`rgb(${Math.round(r*255)},${Math.round(u*255)},${Math.round(l*255)})`}offsetHSL(e,r,u){return this.getHSL(_a),this.setHSL(_a.h+e,_a.s+r,_a.l+u)}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,u){return this.r=e.r+(r.r-e.r)*u,this.g=e.g+(r.g-e.g)*u,this.b=e.b+(r.b-e.b)*u,this}lerpHSL(e,r){this.getHSL(_a),e.getHSL(Ic);let u=Fh(_a.h,Ic.h,r),l=Fh(_a.s,Ic.s,r),h=Fh(_a.l,Ic.l,r);return this.setHSL(u,l,h),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let r=this.r,u=this.g,l=this.b,h=e.elements;return this.r=h[0]*r+h[3]*u+h[6]*l,this.g=h[1]*r+h[4]*u+h[7]*l,this.b=h[2]*r+h[5]*u+h[8]*l,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}},Ii=new yi;yi.NAMES=C0;function Jb(o){let e={};for(let r in o){e[r]={};for(let u in o[r]){let l=o[r][u];l&&(l.isColor||l.isMatrix3||l.isMatrix4||l.isVector2||l.isVector3||l.isVector4||l.isTexture||l.isQuaternion)?l.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[r][u]=null):e[r][u]=l.clone():Array.isArray(l)?e[r][u]=l.slice():e[r][u]=l}}return e}function vo(o){let e={};for(let r=0;r<o.length;r++){let u=Jb(o[r]);for(let l in u)e[l]=u[l]}return e}var Kb=`#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif`,Qb=`#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`,jb=`#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif`,tA=`#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,eA=`#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`,nA=`#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif`,rA=`#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`,iA=`#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif`,oA=`#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`,sA=`#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif`,aA=`vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif`,uA=`vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif`,lA=`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`,cA=`#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`,fA=`#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`,hA=`#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`,pA=`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif`,dA=`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif`,gA=`#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif`,mA=`#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif`,yA=`#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif`,vA=`#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`,_A=`#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`,xA=`#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`,EA=`#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`,wA=`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`,MA=`#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif`,SA=`#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif`,bA=`#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif`,AA=`#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif`,TA="gl_FragColor = linearToOutputTexel( gl_FragColor );",CA=`\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}`,IA=`#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`,PA=`#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`,RA=`#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`,LA=`#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`,NA=`#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`,DA=`#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif`,OA=`#ifdef USE_FOG\n varying float vFogDepth;\n#endif`,FA=`#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`,UA=`#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`,BA=`#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}`,zA=`#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif`,kA=`LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;`,GA=`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`,HA=`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`,VA=`#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`,WA=`ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;`,qA=`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`,XA=`BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`,YA=`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`,$A=`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`,ZA=`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}`,JA=`\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`,KA=`#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`,QA=`#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`,jA=`#if defined( USE_LOGDEPTHBUF )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif`,tT=`#if defined( USE_LOGDEPTHBUF )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif`,eT=`#ifdef USE_LOGDEPTHBUF\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif`,nT=`#ifdef USE_LOGDEPTHBUF\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif`,rT=`#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`,iT=`#ifdef USE_MAP\n uniform sampler2D map;\n#endif`,oT=`#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`,sT=`#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`,aT=`float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif`,uT=`#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif`,lT=`#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`,cT=`#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`,fT=`#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`,hT=`#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`,pT=`#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`,dT=`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;`,gT=`#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`,mT=`#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif`,yT=`#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif`,vT=`#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`,_T=`#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`,xT=`#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif`,ET=`#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`,wT=`#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`,MT=`#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif`,ST=`#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );`,bT=`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}`,AT=`#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif`,TT=`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;`,CT=`#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif`,IT=`#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`,PT=`float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif`,RT=`#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif`,LT=`#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`,NT=`#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`,DT=`#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`,OT=`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}`,FT=`#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`,UT=`#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`,BT=`#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`,zT=`#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`,kT=`float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif`,GT=`#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif`,HT=`#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif`,VT=`#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; }`,WT=`#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`,qT=`#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`,XT=`#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`,YT=`#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`,$T=`#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`,ZT=`#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`,JT=`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}`,KT=`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}`,QT=`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}`,jT=`#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}`,tC=`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}`,eC=`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}`,nC=`#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}`,rC=`#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}`,iC=`#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}`,oC=`#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}`,sC=`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}`,aC=`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}`,uC=`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}`,lC=`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}`,cC=`#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}`,fC=`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}`,hC=`#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}`,pC=`#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}`,dC=`#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}`,gC=`#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}`,mC=`#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}`,yC=`#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}`,vC=`#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}`,_C=`#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}`,xC=`#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}`,EC=`#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}`,wC=`#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}`,MC=`#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}`,SC=`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}`,bC=`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}`,AC=`#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}`,TC=`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}`,CC=`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}`,IC=`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}`,en={alphahash_fragment:Kb,alphahash_pars_fragment:Qb,alphamap_fragment:jb,alphamap_pars_fragment:tA,alphatest_fragment:eA,alphatest_pars_fragment:nA,aomap_fragment:rA,aomap_pars_fragment:iA,batching_pars_vertex:oA,batching_vertex:sA,begin_vertex:aA,beginnormal_vertex:uA,bsdfs:lA,iridescence_fragment:cA,bumpmap_pars_fragment:fA,clipping_planes_fragment:hA,clipping_planes_pars_fragment:pA,clipping_planes_pars_vertex:dA,clipping_planes_vertex:gA,color_fragment:mA,color_pars_fragment:yA,color_pars_vertex:vA,color_vertex:_A,common:xA,cube_uv_reflection_fragment:EA,defaultnormal_vertex:wA,displacementmap_pars_vertex:MA,displacementmap_vertex:SA,emissivemap_fragment:bA,emissivemap_pars_fragment:AA,colorspace_fragment:TA,colorspace_pars_fragment:CA,envmap_fragment:IA,envmap_common_pars_fragment:PA,envmap_pars_fragment:RA,envmap_pars_vertex:LA,envmap_physical_pars_fragment:VA,envmap_vertex:NA,fog_vertex:DA,fog_pars_vertex:OA,fog_fragment:FA,fog_pars_fragment:UA,gradientmap_pars_fragment:BA,lightmap_pars_fragment:zA,lights_lambert_fragment:kA,lights_lambert_pars_fragment:GA,lights_pars_begin:HA,lights_toon_fragment:WA,lights_toon_pars_fragment:qA,lights_phong_fragment:XA,lights_phong_pars_fragment:YA,lights_physical_fragment:$A,lights_physical_pars_fragment:ZA,lights_fragment_begin:JA,lights_fragment_maps:KA,lights_fragment_end:QA,logdepthbuf_fragment:jA,logdepthbuf_pars_fragment:tT,logdepthbuf_pars_vertex:eT,logdepthbuf_vertex:nT,map_fragment:rT,map_pars_fragment:iT,map_particle_fragment:oT,map_particle_pars_fragment:sT,metalnessmap_fragment:aT,metalnessmap_pars_fragment:uT,morphinstance_vertex:lT,morphcolor_vertex:cT,morphnormal_vertex:fT,morphtarget_pars_vertex:hT,morphtarget_vertex:pT,normal_fragment_begin:dT,normal_fragment_maps:gT,normal_pars_fragment:mT,normal_pars_vertex:yT,normal_vertex:vT,normalmap_pars_fragment:_T,clearcoat_normal_fragment_begin:xT,clearcoat_normal_fragment_maps:ET,clearcoat_pars_fragment:wT,iridescence_pars_fragment:MT,opaque_fragment:ST,packing:bT,premultiplied_alpha_fragment:AT,project_vertex:TT,dithering_fragment:CT,dithering_pars_fragment:IT,roughnessmap_fragment:PT,roughnessmap_pars_fragment:RT,shadowmap_pars_fragment:LT,shadowmap_pars_vertex:NT,shadowmap_vertex:DT,shadowmask_pars_fragment:OT,skinbase_vertex:FT,skinning_pars_vertex:UT,skinning_vertex:BT,skinnormal_vertex:zT,specularmap_fragment:kT,specularmap_pars_fragment:GT,tonemapping_fragment:HT,tonemapping_pars_fragment:VT,transmission_fragment:WT,transmission_pars_fragment:qT,uv_pars_fragment:XT,uv_pars_vertex:YT,uv_vertex:$T,worldpos_vertex:ZT,background_vert:JT,background_frag:KT,backgroundCube_vert:QT,backgroundCube_frag:jT,cube_vert:tC,cube_frag:eC,depth_vert:nC,depth_frag:rC,distanceRGBA_vert:iC,distanceRGBA_frag:oC,equirect_vert:sC,equirect_frag:aC,linedashed_vert:uC,linedashed_frag:lC,meshbasic_vert:cC,meshbasic_frag:fC,meshlambert_vert:hC,meshlambert_frag:pC,meshmatcap_vert:dC,meshmatcap_frag:gC,meshnormal_vert:mC,meshnormal_frag:yC,meshphong_vert:vC,meshphong_frag:_C,meshphysical_vert:xC,meshphysical_frag:EC,meshtoon_vert:wC,meshtoon_frag:MC,points_vert:SC,points_frag:bC,shadow_vert:AC,shadow_frag:TC,sprite_vert:CC,sprite_frag:IC},Rt={common:{diffuse:{value:new yi(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new me},alphaMap:{value:null},alphaMapTransform:{value:new me},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new me}},envmap:{envMap:{value:null},envMapRotation:{value:new me},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new me}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new me}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new me},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new me},normalScale:{value:new Xi(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new me},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new me}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new me}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new me}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new yi(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 yi(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new me},alphaTest:{value:0},uvTransform:{value:new me}},sprite:{diffuse:{value:new yi(16777215)},opacity:{value:1},center:{value:new Xi(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new me},alphaMap:{value:null},alphaMapTransform:{value:new me},alphaTest:{value:0}}},M0={basic:{uniforms:vo([Rt.common,Rt.specularmap,Rt.envmap,Rt.aomap,Rt.lightmap,Rt.fog]),vertexShader:en.meshbasic_vert,fragmentShader:en.meshbasic_frag},lambert:{uniforms:vo([Rt.common,Rt.specularmap,Rt.envmap,Rt.aomap,Rt.lightmap,Rt.emissivemap,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,Rt.fog,Rt.lights,{emissive:{value:new yi(0)}}]),vertexShader:en.meshlambert_vert,fragmentShader:en.meshlambert_frag},phong:{uniforms:vo([Rt.common,Rt.specularmap,Rt.envmap,Rt.aomap,Rt.lightmap,Rt.emissivemap,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,Rt.fog,Rt.lights,{emissive:{value:new yi(0)},specular:{value:new yi(1118481)},shininess:{value:30}}]),vertexShader:en.meshphong_vert,fragmentShader:en.meshphong_frag},standard:{uniforms:vo([Rt.common,Rt.envmap,Rt.aomap,Rt.lightmap,Rt.emissivemap,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,Rt.roughnessmap,Rt.metalnessmap,Rt.fog,Rt.lights,{emissive:{value:new yi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:en.meshphysical_vert,fragmentShader:en.meshphysical_frag},toon:{uniforms:vo([Rt.common,Rt.aomap,Rt.lightmap,Rt.emissivemap,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,Rt.gradientmap,Rt.fog,Rt.lights,{emissive:{value:new yi(0)}}]),vertexShader:en.meshtoon_vert,fragmentShader:en.meshtoon_frag},matcap:{uniforms:vo([Rt.common,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,Rt.fog,{matcap:{value:null}}]),vertexShader:en.meshmatcap_vert,fragmentShader:en.meshmatcap_frag},points:{uniforms:vo([Rt.points,Rt.fog]),vertexShader:en.points_vert,fragmentShader:en.points_frag},dashed:{uniforms:vo([Rt.common,Rt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:en.linedashed_vert,fragmentShader:en.linedashed_frag},depth:{uniforms:vo([Rt.common,Rt.displacementmap]),vertexShader:en.depth_vert,fragmentShader:en.depth_frag},normal:{uniforms:vo([Rt.common,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,{opacity:{value:1}}]),vertexShader:en.meshnormal_vert,fragmentShader:en.meshnormal_frag},sprite:{uniforms:vo([Rt.sprite,Rt.fog]),vertexShader:en.sprite_vert,fragmentShader:en.sprite_frag},background:{uniforms:{uvTransform:{value:new me},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:en.background_vert,fragmentShader:en.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new me}},vertexShader:en.backgroundCube_vert,fragmentShader:en.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:en.cube_vert,fragmentShader:en.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:en.equirect_vert,fragmentShader:en.equirect_frag},distanceRGBA:{uniforms:vo([Rt.common,Rt.displacementmap,{referencePosition:{value:new En},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:en.distanceRGBA_vert,fragmentShader:en.distanceRGBA_frag},shadow:{uniforms:vo([Rt.lights,Rt.fog,{color:{value:new yi(0)},opacity:{value:1}}]),vertexShader:en.shadow_vert,fragmentShader:en.shadow_frag}};M0.physical={uniforms:vo([M0.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new me},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new me},clearcoatNormalScale:{value:new Xi(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new me},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new me},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new me},sheen:{value:0},sheenColor:{value:new yi(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new me},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new me},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new me},transmissionSamplerSize:{value:new Xi},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new me},attenuationDistance:{value:0},attenuationColor:{value:new yi(0)},specularColor:{value:new yi(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new me},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new me},anisotropyVector:{value:new Xi},anisotropyMap:{value:null},anisotropyMapTransform:{value:new me}}]),vertexShader:en.meshphysical_vert,fragmentShader:en.meshphysical_frag};var Za=(1+Math.sqrt(5))/2,Su=1/Za,wN=[new En(-Za,Su,0),new En(Za,Su,0),new En(-Su,0,Za),new En(Su,0,Za),new En(0,Za,-Su),new En(0,Za,Su),new En(-1,1,-1),new En(1,1,-1),new En(-1,1,1),new En(1,1,1)];var MN=new Float32Array(16),SN=new Float32Array(9),bN=new Float32Array(4);var AN={[Zm]:Jm,[Km]:e0,[jm]:n0,[Qm]:t0,[Jm]:Zm,[e0]:Km,[n0]:jm,[t0]:Qm};function Pc(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 PC(o){return ArrayBuffer.isView(o)&&!(o instanceof DataView)}var Au=class{constructor(e,r,u,l){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=l!==void 0?l:new r.constructor(u),this.sampleValues=r,this.valueSize=u,this.settings=null,this.DefaultSettings_={}}evaluate(e){let r=this.parameterPositions,u=this._cachedIndex,l=r[u],h=r[u-1];t:{e:{let p;n:{r:if(!(e<l)){for(let m=u+2;;){if(l===void 0){if(e<h)break r;return u=r.length,this._cachedIndex=u,this.copySampleValue_(u-1)}if(u===m)break;if(h=l,l=r[++u],e<l)break e}p=r.length;break n}if(!(e>=h)){let m=r[1];e<m&&(u=2,h=m);for(let y=u-2;;){if(h===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(u===y)break;if(l=h,h=r[--u-1],e>=h)break e}p=u,u=0;break n}break t}for(;u<p;){let m=u+p>>>1;e<r[m]?p=m:u=m+1}if(l=r[u],h=r[u-1],h===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(l===void 0)return u=r.length,this._cachedIndex=u,this.copySampleValue_(u-1)}this._cachedIndex=u,this.intervalChanged_(u,h,l)}return this.interpolate_(u,h,e,l)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let r=this.resultBuffer,u=this.sampleValues,l=this.valueSize,h=e*l;for(let p=0;p!==l;++p)r[p]=u[h+p];return r}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},$h=class extends Au{constructor(e,r,u,l){super(e,r,u,l),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:o0,endingEnd:o0}}intervalChanged_(e,r,u){let l=this.parameterPositions,h=e-2,p=e+1,m=l[h],y=l[p];if(m===void 0)switch(this.getSettings_().endingStart){case s0:h=e,m=2*r-u;break;case a0:h=l.length-2,m=r+l[h]-l[h+1];break;default:h=e,m=u}if(y===void 0)switch(this.getSettings_().endingEnd){case s0:p=e,y=2*u-r;break;case a0:p=1,y=u+l[1]-l[0];break;default:p=e-1,y=r}let x=(u-r)*.5,E=this.valueSize;this._weightPrev=x/(r-m),this._weightNext=x/(y-u),this._offsetPrev=h*E,this._offsetNext=p*E}interpolate_(e,r,u,l){let h=this.resultBuffer,p=this.sampleValues,m=this.valueSize,y=e*m,x=y-m,E=this._offsetPrev,b=this._offsetNext,S=this._weightPrev,C=this._weightNext,D=(u-r)/(l-r),G=D*D,O=G*D,L=-S*O+2*S*G-S*D,k=(1+S)*O+(-1.5-2*S)*G+(-.5+S)*D+1,F=(-1-C)*O+(1.5+C)*G+.5*D,$=C*O-C*G;for(let Z=0;Z!==m;++Z)h[Z]=L*p[E+Z]+k*p[x+Z]+F*p[y+Z]+$*p[b+Z];return h}},Zh=class extends Au{constructor(e,r,u,l){super(e,r,u,l)}interpolate_(e,r,u,l){let h=this.resultBuffer,p=this.sampleValues,m=this.valueSize,y=e*m,x=y-m,E=(u-r)/(l-r),b=1-E;for(let S=0;S!==m;++S)h[S]=p[x+S]*b+p[y+S]*E;return h}},Jh=class extends Au{constructor(e,r,u,l){super(e,r,u,l)}interpolate_(e){return this.copySampleValue_(e-1)}},cs=class{constructor(e,r,u,l){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=Pc(r,this.TimeBufferType),this.values=Pc(u,this.ValueBufferType),this.setInterpolation(l||this.DefaultInterpolation)}static toJSON(e){let r=e.constructor,u;if(r.toJSON!==this.toJSON)u=r.toJSON(e);else{u={name:e.name,times:Pc(e.times,Array),values:Pc(e.values,Array)};let l=e.getInterpolation();l!==e.DefaultInterpolation&&(u.interpolation=l)}return u.type=e.ValueTypeName,u}InterpolantFactoryMethodDiscrete(e){return new Jh(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Zh(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new $h(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let r;switch(e){case Rc:r=this.InterpolantFactoryMethodDiscrete;break;case Vh:r=this.InterpolantFactoryMethodLinear;break;case Oh:r=this.InterpolantFactoryMethodSmooth;break}if(r===void 0){let u="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(u);return console.warn("THREE.KeyframeTrack:",u),this}return this.createInterpolant=r,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Rc;case this.InterpolantFactoryMethodLinear:return Vh;case this.InterpolantFactoryMethodSmooth:return Oh}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let r=this.times;for(let u=0,l=r.length;u!==l;++u)r[u]+=e}return this}scale(e){if(e!==1){let r=this.times;for(let u=0,l=r.length;u!==l;++u)r[u]*=e}return this}trim(e,r){let u=this.times,l=u.length,h=0,p=l-1;for(;h!==l&&u[h]<e;)++h;for(;p!==-1&&u[p]>r;)--p;if(++p,h!==0||p!==l){h>=p&&(p=Math.max(p,1),h=p-1);let m=this.getValueSize();this.times=u.slice(h,p),this.values=this.values.slice(h*m,p*m)}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 u=this.times,l=this.values,h=u.length;h===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let p=null;for(let m=0;m!==h;m++){let y=u[m];if(typeof y=="number"&&isNaN(y)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,m,y),e=!1;break}if(p!==null&&p>y){console.error("THREE.KeyframeTrack: Out of order keys.",this,m,y,p),e=!1;break}p=y}if(l!==void 0&&PC(l))for(let m=0,y=l.length;m!==y;++m){let x=l[m];if(isNaN(x)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,m,x),e=!1;break}}return e}optimize(){let e=this.times.slice(),r=this.values.slice(),u=this.getValueSize(),l=this.getInterpolation()===Oh,h=e.length-1,p=1;for(let m=1;m<h;++m){let y=!1,x=e[m],E=e[m+1];if(x!==E&&(m!==1||x!==e[0]))if(l)y=!0;else{let b=m*u,S=b-u,C=b+u;for(let D=0;D!==u;++D){let G=r[b+D];if(G!==r[S+D]||G!==r[C+D]){y=!0;break}}}if(y){if(m!==p){e[p]=e[m];let b=m*u,S=p*u;for(let C=0;C!==u;++C)r[S+C]=r[b+C]}++p}}if(h>0){e[p]=e[h];for(let m=h*u,y=p*u,x=0;x!==u;++x)r[y+x]=r[m+x];++p}return p!==e.length?(this.times=e.slice(0,p),this.values=r.slice(0,p*u)):(this.times=e,this.values=r),this}clone(){let e=this.times.slice(),r=this.values.slice(),u=this.constructor,l=new u(this.name,e,r);return l.createInterpolant=this.createInterpolant,l}};cs.prototype.TimeBufferType=Float32Array;cs.prototype.ValueBufferType=Float32Array;cs.prototype.DefaultInterpolation=Vh;var Ja=class extends cs{constructor(e,r,u){super(e,r,u)}};Ja.prototype.ValueTypeName="bool";Ja.prototype.ValueBufferType=Array;Ja.prototype.DefaultInterpolation=Rc;Ja.prototype.InterpolantFactoryMethodLinear=void 0;Ja.prototype.InterpolantFactoryMethodSmooth=void 0;var Kh=class extends cs{};Kh.prototype.ValueTypeName="color";var Qh=class extends cs{};Qh.prototype.ValueTypeName="number";var jh=class extends Au{constructor(e,r,u,l){super(e,r,u,l)}interpolate_(e,r,u,l){let h=this.resultBuffer,p=this.sampleValues,m=this.valueSize,y=(u-r)/(l-r),x=e*m;for(let E=x+m;x!==E;x+=4)wa.slerpFlat(h,0,p,x-m,p,x,y);return h}},Dc=class extends cs{InterpolantFactoryMethodLinear(e){return new jh(this.times,this.values,this.getValueSize(),e)}};Dc.prototype.ValueTypeName="quaternion";Dc.prototype.InterpolantFactoryMethodSmooth=void 0;var Ka=class extends cs{constructor(e,r,u){super(e,r,u)}};Ka.prototype.ValueTypeName="string";Ka.prototype.ValueBufferType=Array;Ka.prototype.DefaultInterpolation=Rc;Ka.prototype.InterpolantFactoryMethodLinear=void 0;Ka.prototype.InterpolantFactoryMethodSmooth=void 0;var tp=class extends cs{};tp.prototype.ValueTypeName="vector";var ep=class{constructor(e,r,u){let l=this,h=!1,p=0,m=0,y,x=[];this.onStart=void 0,this.onLoad=e,this.onProgress=r,this.onError=u,this.itemStart=function(E){m++,h===!1&&l.onStart!==void 0&&l.onStart(E,p,m),h=!0},this.itemEnd=function(E){p++,l.onProgress!==void 0&&l.onProgress(E,p,m),p===m&&(h=!1,l.onLoad!==void 0&&l.onLoad())},this.itemError=function(E){l.onError!==void 0&&l.onError(E)},this.resolveURL=function(E){return y?y(E):E},this.setURLModifier=function(E){return y=E,this},this.addHandler=function(E,b){return x.push(E,b),this},this.removeHandler=function(E){let b=x.indexOf(E);return b!==-1&&x.splice(b,2),this},this.getHandler=function(E){for(let b=0,S=x.length;b<S;b+=2){let C=x[b],D=x[b+1];if(C.global&&(C.lastIndex=0),C.test(E))return D}return null}}},RC=new ep,np=class{constructor(e){this.manager=e!==void 0?e:RC,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,r){let u=this;return new Promise(function(l,h){u.load(e,l,r,h)})}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}};np.DEFAULT_MATERIAL_NAME="__DEFAULT";var sp="\\\\[\\\\]\\\\.:\\\\/",LC=new RegExp("["+sp+"]","g"),ap="[^"+sp+"]",NC="[^"+sp.replace("\\\\.","")+"]",DC=/((?:WC+[\\/:])*)/.source.replace("WC",ap),OC=/(WCOD+)?/.source.replace("WCOD",NC),FC=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",ap),UC=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",ap),BC=new RegExp("^"+DC+OC+FC+UC+"$"),zC=["material","materials","bones","map"],rp=class{constructor(e,r,u){let l=u||rr.parseTrackName(r);this._targetGroup=e,this._bindings=e.subscribe_(r,l)}getValue(e,r){this.bind();let u=this._targetGroup.nCachedObjects_,l=this._bindings[u];l!==void 0&&l.getValue(e,r)}setValue(e,r){let u=this._bindings;for(let l=this._targetGroup.nCachedObjects_,h=u.length;l!==h;++l)u[l].setValue(e,r)}bind(){let e=this._bindings;for(let r=this._targetGroup.nCachedObjects_,u=e.length;r!==u;++r)e[r].bind()}unbind(){let e=this._bindings;for(let r=this._targetGroup.nCachedObjects_,u=e.length;r!==u;++r)e[r].unbind()}},rr=class o{constructor(e,r,u){this.path=r,this.parsedPath=u||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,u){return e&&e.isAnimationObjectGroup?new o.Composite(e,r,u):new o(e,r,u)}static sanitizeNodeName(e){return e.replace(/\\s/g,"_").replace(LC,"")}static parseTrackName(e){let r=BC.exec(e);if(r===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let u={nodeName:r[2],objectName:r[3],objectIndex:r[4],propertyName:r[5],propertyIndex:r[6]},l=u.nodeName&&u.nodeName.lastIndexOf(".");if(l!==void 0&&l!==-1){let h=u.nodeName.substring(l+1);zC.indexOf(h)!==-1&&(u.nodeName=u.nodeName.substring(0,l),u.objectName=h)}if(u.propertyName===null||u.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return u}static findNode(e,r){if(r===void 0||r===""||r==="."||r===-1||r===e.name||r===e.uuid)return e;if(e.skeleton){let u=e.skeleton.getBoneByName(r);if(u!==void 0)return u}if(e.children){let u=function(h){for(let p=0;p<h.length;p++){let m=h[p];if(m.name===r||m.uuid===r)return m;let y=u(m.children);if(y)return y}return null},l=u(e.children);if(l)return l}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,r){e[r]=this.targetObject[this.propertyName]}_getValue_array(e,r){let u=this.resolvedProperty;for(let l=0,h=u.length;l!==h;++l)e[r++]=u[l]}_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 u=this.resolvedProperty;for(let l=0,h=u.length;l!==h;++l)u[l]=e[r++]}_setValue_array_setNeedsUpdate(e,r){let u=this.resolvedProperty;for(let l=0,h=u.length;l!==h;++l)u[l]=e[r++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,r){let u=this.resolvedProperty;for(let l=0,h=u.length;l!==h;++l)u[l]=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,u=r.objectName,l=r.propertyName,h=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(u){let x=r.objectIndex;switch(u){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 E=0;E<e.length;E++)if(e[E].name===x){x=E;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[u]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[u]}if(x!==void 0){if(e[x]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[x]}}let p=e[l];if(p===void 0){let x=r.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+x+"."+l+" but it wasn\'t found.",e);return}let m=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?m=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(m=this.Versioning.MatrixWorldNeedsUpdate);let y=this.BindingType.Direct;if(h!==void 0){if(l==="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[h]!==void 0&&(h=e.morphTargetDictionary[h])}y=this.BindingType.ArrayElement,this.resolvedProperty=p,this.propertyIndex=h}else p.fromArray!==void 0&&p.toArray!==void 0?(y=this.BindingType.HasFromToArray,this.resolvedProperty=p):Array.isArray(p)?(y=this.BindingType.EntireArray,this.resolvedProperty=p):this.propertyName=l;this.getValue=this.GetterByBindingType[y],this.setValue=this.SetterByBindingTypeAndVersioning[y][m]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};rr.Composite=rp;rr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};rr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};rr.prototype.GetterByBindingType=[rr.prototype._getValue_direct,rr.prototype._getValue_array,rr.prototype._getValue_arrayElement,rr.prototype._getValue_toArray];rr.prototype.SetterByBindingTypeAndVersioning=[[rr.prototype._setValue_direct,rr.prototype._setValue_direct_setNeedsUpdate,rr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[rr.prototype._setValue_array,rr.prototype._setValue_array_setNeedsUpdate,rr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[rr.prototype._setValue_arrayElement,rr.prototype._setValue_arrayElement_setNeedsUpdate,rr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[rr.prototype._setValue_fromArray,rr.prototype._setValue_fromArray_setNeedsUpdate,rr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var TN=new Float32Array(1);typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:S0}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=S0);var ri=63710088e-1,IN={centimeters:ri*100,centimetres:ri*100,degrees:ri/111325,feet:ri*3.28084,inches:ri*39.37,kilometers:ri/1e3,kilometres:ri/1e3,meters:ri,metres:ri,miles:ri/1609.344,millimeters:ri*1e3,millimetres:ri*1e3,nauticalmiles:ri/1852,radians:1,yards:ri*1.0936},PN={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/ri,yards:1.0936133};function Yi(o,e,r){r===void 0&&(r={});var u={type:"Feature"};return(r.id===0||r.id)&&(u.id=r.id),r.bbox&&(u.bbox=r.bbox),u.properties=e||{},u.geometry=o,u}function $n(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(!Is(o[0])||!Is(o[1]))throw new Error("coordinates must contain numbers");var u={type:"Point",coordinates:o};return Yi(u,e,r)}function ir(o,e,r){r===void 0&&(r={});for(var u=0,l=o;u<l.length;u++){var h=l[u];if(h.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var p=0;p<h[h.length-1].length;p++)if(h[h.length-1][p]!==h[0][p])throw new Error("First and last Position are not equivalent.")}var m={type:"Polygon",coordinates:o};return Yi(m,e,r)}function ii(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 u={type:"LineString",coordinates:o};return Yi(u,e,r)}function up(o,e,r){r===void 0&&(r={});var u={type:"MultiPoint",coordinates:o};return Yi(u,e,r)}function Is(o){return!isNaN(o)&&o!==null&&!Array.isArray(o)}function Gr(o,e,r){if(o!==null)for(var u,l,h,p,m,y,x,E=0,b=0,S,C=o.type,D=C==="FeatureCollection",G=C==="Feature",O=D?o.features.length:1,L=0;L<O;L++){x=D?o.features[L].geometry:G?o.geometry:o,S=x?x.type==="GeometryCollection":!1,m=S?x.geometries.length:1;for(var k=0;k<m;k++){var F=0,$=0;if(p=S?x.geometries[k]:x,p!==null){y=p.coordinates;var Z=p.type;switch(E=r&&(Z==="Polygon"||Z==="MultiPolygon")?1:0,Z){case null:break;case"Point":if(e(y,b,L,F,$)===!1)return!1;b++,F++;break;case"LineString":case"MultiPoint":for(u=0;u<y.length;u++){if(e(y[u],b,L,F,$)===!1)return!1;b++,Z==="MultiPoint"&&F++}Z==="LineString"&&F++;break;case"Polygon":case"MultiLineString":for(u=0;u<y.length;u++){for(l=0;l<y[u].length-E;l++){if(e(y[u][l],b,L,F,$)===!1)return!1;b++}Z==="MultiLineString"&&F++,Z==="Polygon"&&$++}Z==="Polygon"&&F++;break;case"MultiPolygon":for(u=0;u<y.length;u++){for($=0,l=0;l<y[u].length;l++){for(h=0;h<y[u][l].length-E;h++){if(e(y[u][l][h],b,L,F,$)===!1)return!1;b++}$++}F++}break;case"GeometryCollection":for(u=0;u<p.geometries.length;u++)if(Gr(p.geometries[u],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function I0(o,e,r,u){var l=r;return Gr(o,function(h,p,m,y,x){p===0&&r===void 0?l=h:l=e(l,h,p,m,y,x)},u),l}function Ma(o,e){var r,u,l,h,p,m,y,x,E,b,S=0,C=o.type==="FeatureCollection",D=o.type==="Feature",G=C?o.features.length:1;for(r=0;r<G;r++){for(m=C?o.features[r].geometry:D?o.geometry:o,x=C?o.features[r].properties:D?o.properties:{},E=C?o.features[r].bbox:D?o.bbox:void 0,b=C?o.features[r].id:D?o.id:void 0,y=m?m.type==="GeometryCollection":!1,p=y?m.geometries.length:1,l=0;l<p;l++){if(h=y?m.geometries[l]:m,h===null){if(e(null,S,x,E,b)===!1)return!1;continue}switch(h.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(h,S,x,E,b)===!1)return!1;break}case"GeometryCollection":{for(u=0;u<h.geometries.length;u++)if(e(h.geometries[u],S,x,E,b)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}S++}}function Uo(o,e){Ma(o,function(r,u,l,h,p){var m=r===null?null:r.type;switch(m){case null:case"Point":case"LineString":case"Polygon":return e(Yi(r,l,{bbox:h,id:p}),u,0)===!1?!1:void 0}var y;switch(m){case"MultiPoint":y="Point";break;case"MultiLineString":y="LineString";break;case"MultiPolygon":y="Polygon";break}for(var x=0;x<r.coordinates.length;x++){var E=r.coordinates[x],b={type:y,coordinates:E};if(e(Yi(b,l),u,x)===!1)return!1}})}function lp(o){var e=[1/0,1/0,-1/0,-1/0];return Gr(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}lp.default=lp;var $i=lp;function vi(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 cp(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 _i(o){return o.type==="Feature"?o.geometry:o}var YC=nr(Oc(),1);var rI=nr(Y0(),1);function oi(o,e,r){if(r===void 0&&(r={}),!o)throw new Error("point is required");if(!e)throw new Error("polygon is required");var u=vi(o),l=_i(e),h=l.type,p=e.bbox,m=l.coordinates;if(p&&iI(u,p)===!1)return!1;h==="Polygon"&&(m=[m]);for(var y=!1,x=0;x<m.length&&!y;x++)if($0(u,m[x][0],r.ignoreBoundary)){for(var E=!1,b=1;b<m[x].length&&!E;)$0(u,m[x][b],!r.ignoreBoundary)&&(E=!0),b++;E||(y=!0)}return y}function $0(o,e,r){var u=!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 l=0,h=e.length-1;l<e.length;h=l++){var p=e[l][0],m=e[l][1],y=e[h][0],x=e[h][1],E=o[1]*(p-y)+m*(y-o[0])+x*(o[0]-p)===0&&(p-o[0])*(y-o[0])<=0&&(m-o[1])*(x-o[1])<=0;if(E)return!r;var b=m>o[1]!=x>o[1]&&o[0]<(y-p)*(o[1]-m)/(x-m)+p;b&&(u=!u)}return u}function iI(o,e){return e[0]<=o[0]&&e[1]<=o[1]&&e[2]>=o[0]&&e[3]>=o[1]}var K0=new ArrayBuffer(16),oO=new Float64Array(K0),sO=new Uint32Array(K0);var _I=nr(Ap(),1);var L3=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 u=this.points[r],l=this.points[r+1];this.centers.push({x:(u.x+l.x)/2,y:(u.y+l.y)/2,z:(u.z+l.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var r=0;r<this.centers.length-1;r++){var h=this.points[r+1].x-(this.centers[r].x+this.centers[r+1].x)/2,p=this.points[r+1].y-(this.centers[r].y+this.centers[r+1].y)/2,m=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+h),y:(1-this.sharpness)*this.points[r+1].y+this.sharpness*(this.centers[r].y+p),z:(1-this.sharpness)*this.points[r+1].z+this.sharpness*(this.centers[r].z+m)},{x:(1-this.sharpness)*this.points[r+1].x+this.sharpness*(this.centers[r+1].x+h),y:(1-this.sharpness)*this.points[r+1].y+this.sharpness*(this.centers[r+1].y+p),z:(1-this.sharpness)*this.points[r+1].z+this.sharpness*(this.centers[r+1].z+m)}])}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=[],u=this.pos(0);r.push(0);for(var l=0;l<this.duration;l+=10){var h=this.pos(l),p=Math.sqrt((h.x-u.x)*(h.x-u.x)+(h.y-u.y)*(h.y-u.y)+(h.z-u.z)*(h.z-u.z));p>e&&(r.push(l),u=h)}return r},o.prototype.vector=function(e){var r=this.pos(e+10),u=this.pos(e-10);return{angle:180*Math.atan2(r.y-u.y,r.x-u.x)/3.14,speed:Math.sqrt((u.x-r.x)*(u.x-r.x)+(u.y-r.y)*(u.y-r.y)+(u.z-r.z)*(u.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 u=r/this.duration;if(u>=1)return this.points[this.length-1];var l=Math.floor((this.points.length-1)*u),h=(this.length-1)*u-l;return xI(h,this.points[l],this.controls[l][1],this.controls[l+1][0],this.points[l+1])},o}();function xI(o,e,r,u,l){var h=EI(o),p={x:l.x*h[0]+u.x*h[1]+r.x*h[2]+e.x*h[3],y:l.y*h[0]+u.y*h[1]+r.y*h[2]+e.y*h[3],z:l.z*h[0]+u.z*h[1]+r.z*h[2]+e.z*h[3]};return p}function EI(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 Al(o,e){e===void 0&&(e={});var r=Number(o[0]),u=Number(o[1]),l=Number(o[2]),h=Number(o[3]);if(o.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var p=[r,u],m=[r,h],y=[l,h],x=[l,u];return ir([[p,x,y,m,p]],e.properties,{bbox:o,id:e.id})}function wI(o){return Al($i(o))}var Tp=wI;var zI=nr(uy(),1);var hP=nr(Qc(),1);var dP=nr(Oc(),1);var yP=nr(Ap(),1);var Ay=Math.PI/180,Ty=180/Math.PI,Nl=function(o,e){this.lon=o,this.lat=e,this.x=Ay*o,this.y=Ay*e};Nl.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};Nl.prototype.antipode=function(){var o=-1*this.lat,e=this.lon<0?180+this.lon:(180-this.lon)*-1;return new Nl(e,o)};var Cy=function(){this.coords=[],this.length=0};Cy.prototype.move_to=function(o){this.length++,this.coords.push(o)};var Yp=function(o){this.properties=o||{},this.geometries=[]};Yp.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}};Yp.prototype.wkt=function(){for(var o="",e="LINESTRING(",r=function(h){e+=h[0]+" "+h[1]+","},u=0;u<this.geometries.length;u++){if(this.geometries[u].coords.length===0)return"LINESTRING(empty)";var l=this.geometries[u].coords;l.forEach(r),o+=e.substring(0,e.length-1)+")"}return o};var Iy=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 Nl(o.x,o.y),this.end=new Nl(e.x,e.y),this.properties=r||{};var u=this.start.x-this.end.x,l=this.start.y-this.end.y,h=Math.pow(Math.sin(l/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(u/2),2);if(this.g=2*Math.asin(Math.sqrt(h)),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)};Iy.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),u=e*Math.cos(this.start.y)*Math.cos(this.start.x)+r*Math.cos(this.end.y)*Math.cos(this.end.x),l=e*Math.cos(this.start.y)*Math.sin(this.start.x)+r*Math.cos(this.end.y)*Math.sin(this.end.x),h=e*Math.sin(this.start.y)+r*Math.sin(this.end.y),p=Ty*Math.atan2(h,Math.sqrt(Math.pow(u,2)+Math.pow(l,2))),m=Ty*Math.atan2(l,u);return[m,p]};Iy.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 u=1/(o-1),l=0;l<o;++l){var h=u*l,p=this.interpolate(h);r.push(p)}for(var m=!1,y=0,x=e&&e.offset?e.offset:10,E=180-x,b=-180+x,S=360-x,C=1;C<r.length;++C){var D=r[C-1][0],G=r[C][0],O=Math.abs(G-D);O>S&&(G>E&&D<b||D>E&&G<b)?m=!0:O>y&&(y=O)}var L=[];if(m&&y<x){var k=[];L.push(k);for(var F=0;F<r.length;++F){var $=parseFloat(r[F][0]);if(F>0&&Math.abs($-r[F-1][0])>S){var Z=parseFloat(r[F-1][0]),it=parseFloat(r[F-1][1]),et=parseFloat(r[F][0]),U=parseFloat(r[F][1]);if(Z>-180&&Z<b&&et===180&&F+1<r.length&&r[F-1][0]>-180&&r[F-1][0]<b){k.push([-180,r[F][1]]),F++,k.push([r[F][0],r[F][1]]);continue}else if(Z>E&&Z<180&&et===-180&&F+1<r.length&&r[F-1][0]>E&&r[F-1][0]<180){k.push([180,r[F][1]]),F++,k.push([r[F][0],r[F][1]]);continue}if(Z<b&&et>E){var wt=Z;Z=et,et=wt;var Lt=it;it=U,U=Lt}if(Z>E&&et<b&&(et+=360),Z<=180&&et>=180&&Z<et){var Ot=(180-Z)/(et-Z),W=Ot*U+(1-Ot)*it;k.push([r[F-1][0]>E?180:-180,W]),k=[],k.push([r[F-1][0]>E?-180:180,W]),L.push(k)}else k=[],L.push(k);k.push([$,r[F][1]])}else k.push([r[F][0],r[F][1]])}}else{var de=[];L.push(de);for(var yt=0;yt<r.length;++yt)de.push([r[yt][0],r[yt][1]])}for(var zt=new Yp(this.properties),Kt=0;Kt<L.length;++Kt){var ie=new Cy;zt.geometries.push(ie);for(var _t=L[Kt],Pt=0;Pt<_t.length;++Pt)ie.move_to(_t[Pt])}return zt};var xP=nr(Qc(),1);var jR=nr(Qc(),1);var tL=nr(gd(),1);var rL=nr(Oc(),1);var ye=[],ve=[],_e=[],xe=[],Ee=[],we=[],Me=[],Se=[],be=[],Ae=[],Te=[],Ce=[],Ie=[],Pe=[],Re=[],Le=[],Ne=[],De=[],Oe=[],Fe=[],Ue=[],Be=[],ze=[],ke=[];Me[85]=Ae[85]=-1;Se[85]=Te[85]=0;be[85]=Ce[85]=1;Oe[85]=Be[85]=1;Fe[85]=ze[85]=0;Ue[85]=ke[85]=1;ye[85]=xe[85]=0;ve[85]=Ee[85]=-1;_e[85]=Re[85]=0;Le[85]=Ie[85]=0;Ne[85]=Pe[85]=1;we[85]=De[85]=1;Be[1]=Be[169]=0;ze[1]=ze[169]=-1;ke[1]=ke[169]=0;Ie[1]=Ie[169]=-1;Pe[1]=Pe[169]=0;Re[1]=Re[169]=0;Ae[4]=Ae[166]=0;Te[4]=Te[166]=-1;Ce[4]=Ce[166]=1;Le[4]=Le[166]=1;Ne[4]=Ne[166]=0;De[4]=De[166]=0;Me[16]=Me[154]=0;Se[16]=Se[154]=1;be[16]=be[154]=1;xe[16]=xe[154]=1;Ee[16]=Ee[154]=0;we[16]=we[154]=1;Oe[64]=Oe[106]=0;Fe[64]=Fe[106]=1;Ue[64]=Ue[106]=0;ye[64]=ye[106]=-1;ve[64]=ve[106]=0;_e[64]=_e[106]=1;Oe[2]=Oe[168]=0;Fe[2]=Fe[168]=-1;Ue[2]=Ue[168]=1;Be[2]=Be[168]=0;ze[2]=ze[168]=-1;ke[2]=ke[168]=0;Ie[2]=Ie[168]=-1;Pe[2]=Pe[168]=0;Re[2]=Re[168]=0;Le[2]=Le[168]=-1;Ne[2]=Ne[168]=0;De[2]=De[168]=1;Me[8]=Me[162]=0;Se[8]=Se[162]=-1;be[8]=be[162]=0;Ae[8]=Ae[162]=0;Te[8]=Te[162]=-1;Ce[8]=Ce[162]=1;Ie[8]=Ie[162]=1;Pe[8]=Pe[162]=0;Re[8]=Re[162]=1;Le[8]=Le[162]=1;Ne[8]=Ne[162]=0;De[8]=De[162]=0;Me[32]=Me[138]=0;Se[32]=Se[138]=1;be[32]=be[138]=1;Ae[32]=Ae[138]=0;Te[32]=Te[138]=1;Ce[32]=Ce[138]=0;ye[32]=ye[138]=1;ve[32]=ve[138]=0;_e[32]=_e[138]=0;xe[32]=xe[138]=1;Ee[32]=Ee[138]=0;we[32]=we[138]=1;Be[128]=Be[42]=0;ze[128]=ze[42]=1;ke[128]=ke[42]=1;Oe[128]=Oe[42]=0;Fe[128]=Fe[42]=1;Ue[128]=Ue[42]=0;ye[128]=ye[42]=-1;ve[128]=ve[42]=0;_e[128]=_e[42]=1;xe[128]=xe[42]=-1;Ee[128]=Ee[42]=0;we[128]=we[42]=0;Ae[5]=Ae[165]=-1;Te[5]=Te[165]=0;Ce[5]=Ce[165]=0;Be[5]=Be[165]=1;ze[5]=ze[165]=0;ke[5]=ke[165]=0;Le[20]=Le[150]=0;Ne[20]=Ne[150]=1;De[20]=De[150]=1;xe[20]=xe[150]=0;Ee[20]=Ee[150]=-1;we[20]=we[150]=1;Me[80]=Me[90]=-1;Se[80]=Se[90]=0;be[80]=be[90]=1;Oe[80]=Oe[90]=1;Fe[80]=Fe[90]=0;Ue[80]=Ue[90]=1;Ie[65]=Ie[105]=0;Pe[65]=Pe[105]=1;Re[65]=Re[105]=0;ye[65]=ye[105]=0;ve[65]=ve[105]=-1;_e[65]=_e[105]=0;Me[160]=Me[10]=-1;Se[160]=Se[10]=0;be[160]=be[10]=1;Ae[160]=Ae[10]=-1;Te[160]=Te[10]=0;Ce[160]=Ce[10]=0;Be[160]=Be[10]=1;ze[160]=ze[10]=0;ke[160]=ke[10]=0;Oe[160]=Oe[10]=1;Fe[160]=Fe[10]=0;Ue[160]=Ue[10]=1;Le[130]=Le[40]=0;Ne[130]=Ne[40]=1;De[130]=De[40]=1;Ie[130]=Ie[40]=0;Pe[130]=Pe[40]=1;Re[130]=Re[40]=0;ye[130]=ye[40]=0;ve[130]=ve[40]=-1;_e[130]=_e[40]=0;xe[130]=xe[40]=0;Ee[130]=Ee[40]=-1;we[130]=we[40]=1;Ae[37]=Ae[133]=0;Te[37]=Te[133]=1;Ce[37]=Ce[133]=1;Be[37]=Be[133]=0;ze[37]=ze[133]=1;ke[37]=ke[133]=0;ye[37]=ye[133]=-1;ve[37]=ve[133]=0;_e[37]=_e[133]=0;xe[37]=xe[133]=1;Ee[37]=Ee[133]=0;we[37]=we[133]=0;Le[148]=Le[22]=-1;Ne[148]=Ne[22]=0;De[148]=De[22]=0;Be[148]=Be[22]=0;ze[148]=ze[22]=-1;ke[148]=ke[22]=1;Oe[148]=Oe[22]=0;Fe[148]=Fe[22]=1;Ue[148]=Ue[22]=1;xe[148]=xe[22]=-1;Ee[148]=Ee[22]=0;we[148]=we[22]=1;Me[82]=Me[88]=0;Se[82]=Se[88]=-1;be[82]=be[88]=1;Le[82]=Le[88]=1;Ne[82]=Ne[88]=0;De[82]=De[88]=1;Ie[82]=Ie[88]=-1;Pe[82]=Pe[88]=0;Re[82]=Re[88]=1;Oe[82]=Oe[88]=0;Fe[82]=Fe[88]=-1;Ue[82]=Ue[88]=0;Me[73]=Me[97]=0;Se[73]=Se[97]=1;be[73]=be[97]=0;Ae[73]=Ae[97]=0;Te[73]=Te[97]=-1;Ce[73]=Ce[97]=0;Ie[73]=Ie[97]=1;Pe[73]=Pe[97]=0;Re[73]=Re[97]=0;ye[73]=ye[97]=1;ve[73]=ve[97]=0;_e[73]=_e[97]=1;Me[145]=Me[25]=0;Se[145]=Se[25]=-1;be[145]=be[25]=0;Ie[145]=Ie[25]=1;Pe[145]=Pe[25]=0;Re[145]=Re[25]=1;Be[145]=Be[25]=0;ze[145]=ze[25]=1;ke[145]=ke[25]=1;xe[145]=xe[25]=-1;Ee[145]=Ee[25]=0;we[145]=we[25]=0;Ae[70]=Ae[100]=0;Te[70]=Te[100]=1;Ce[70]=Ce[100]=0;Le[70]=Le[100]=-1;Ne[70]=Ne[100]=0;De[70]=De[100]=1;Oe[70]=Oe[100]=0;Fe[70]=Fe[100]=-1;Ue[70]=Ue[100]=1;ye[70]=ye[100]=1;ve[70]=ve[100]=0;_e[70]=_e[100]=0;Ae[101]=Ae[69]=0;Te[101]=Te[69]=1;Ce[101]=Ce[69]=0;ye[101]=ye[69]=1;ve[101]=ve[69]=0;_e[101]=_e[69]=0;Be[149]=Be[21]=0;ze[149]=ze[21]=1;ke[149]=ke[21]=1;xe[149]=xe[21]=-1;Ee[149]=Ee[21]=0;we[149]=we[21]=0;Le[86]=Le[84]=-1;Ne[86]=Ne[84]=0;De[86]=De[84]=1;Oe[86]=Oe[84]=0;Fe[86]=Fe[84]=-1;Ue[86]=Ue[84]=1;Me[89]=Me[81]=0;Se[89]=Se[81]=-1;be[89]=be[81]=0;Ie[89]=Ie[81]=1;Pe[89]=Pe[81]=0;Re[89]=Re[81]=1;Me[96]=Me[74]=0;Se[96]=Se[74]=1;be[96]=be[74]=0;Ae[96]=Ae[74]=-1;Te[96]=Te[74]=0;Ce[96]=Ce[74]=1;Oe[96]=Oe[74]=1;Fe[96]=Fe[74]=0;Ue[96]=Ue[74]=0;ye[96]=ye[74]=1;ve[96]=ve[74]=0;_e[96]=_e[74]=1;Me[24]=Me[146]=0;Se[24]=Se[146]=-1;be[24]=be[146]=1;Le[24]=Le[146]=1;Ne[24]=Ne[146]=0;De[24]=De[146]=1;Ie[24]=Ie[146]=0;Pe[24]=Pe[146]=1;Re[24]=Re[146]=1;xe[24]=xe[146]=0;Ee[24]=Ee[146]=-1;we[24]=we[146]=0;Ae[6]=Ae[164]=-1;Te[6]=Te[164]=0;Ce[6]=Ce[164]=1;Le[6]=Le[164]=-1;Ne[6]=Ne[164]=0;De[6]=De[164]=0;Be[6]=Be[164]=0;ze[6]=ze[164]=-1;ke[6]=ke[164]=1;Oe[6]=Oe[164]=1;Fe[6]=Fe[164]=0;Ue[6]=Ue[164]=0;Ie[129]=Ie[41]=0;Pe[129]=Pe[41]=1;Re[129]=Re[41]=1;Be[129]=Be[41]=0;ze[129]=ze[41]=1;ke[129]=ke[41]=0;ye[129]=ye[41]=-1;ve[129]=ve[41]=0;_e[129]=_e[41]=0;xe[129]=xe[41]=0;Ee[129]=Ee[41]=-1;we[129]=we[41]=0;Le[66]=Le[104]=0;Ne[66]=Ne[104]=1;De[66]=De[104]=0;Ie[66]=Ie[104]=-1;Pe[66]=Pe[104]=0;Re[66]=Re[104]=1;Oe[66]=Oe[104]=0;Fe[66]=Fe[104]=-1;Ue[66]=Ue[104]=0;ye[66]=ye[104]=0;ve[66]=ve[104]=-1;_e[66]=_e[104]=1;Me[144]=Me[26]=-1;Se[144]=Se[26]=0;be[144]=be[26]=0;Be[144]=Be[26]=1;ze[144]=ze[26]=0;ke[144]=ke[26]=1;Oe[144]=Oe[26]=0;Fe[144]=Fe[26]=1;Ue[144]=Ue[26]=1;xe[144]=xe[26]=-1;Ee[144]=Ee[26]=0;we[144]=we[26]=1;Ae[36]=Ae[134]=0;Te[36]=Te[134]=1;Ce[36]=Ce[134]=1;Le[36]=Le[134]=0;Ne[36]=Ne[134]=1;De[36]=De[134]=0;ye[36]=ye[134]=0;ve[36]=ve[134]=-1;_e[36]=_e[134]=1;xe[36]=xe[134]=1;Ee[36]=Ee[134]=0;we[36]=we[134]=0;Me[9]=Me[161]=-1;Se[9]=Se[161]=0;be[9]=be[161]=0;Ae[9]=Ae[161]=0;Te[9]=Te[161]=-1;Ce[9]=Ce[161]=0;Ie[9]=Ie[161]=1;Pe[9]=Pe[161]=0;Re[9]=Re[161]=0;Be[9]=Be[161]=1;ze[9]=ze[161]=0;ke[9]=ke[161]=1;Me[136]=0;Se[136]=1;be[136]=1;Ae[136]=0;Te[136]=1;Ce[136]=0;Le[136]=-1;Ne[136]=0;De[136]=1;Ie[136]=-1;Pe[136]=0;Re[136]=0;Be[136]=0;ze[136]=-1;ke[136]=0;Oe[136]=0;Fe[136]=-1;Ue[136]=1;ye[136]=1;ve[136]=0;_e[136]=0;xe[136]=1;Ee[136]=0;we[136]=1;Me[34]=0;Se[34]=-1;be[34]=0;Ae[34]=0;Te[34]=-1;Ce[34]=1;Le[34]=1;Ne[34]=0;De[34]=0;Ie[34]=1;Pe[34]=0;Re[34]=1;Be[34]=0;ze[34]=1;ke[34]=1;Oe[34]=0;Fe[34]=1;Ue[34]=0;ye[34]=-1;ve[34]=0;_e[34]=1;xe[34]=-1;Ee[34]=0;we[34]=0;Me[35]=0;Se[35]=1;be[35]=1;Ae[35]=0;Te[35]=-1;Ce[35]=1;Le[35]=1;Ne[35]=0;De[35]=0;Ie[35]=-1;Pe[35]=0;Re[35]=0;Be[35]=0;ze[35]=-1;ke[35]=0;Oe[35]=0;Fe[35]=1;Ue[35]=0;ye[35]=-1;ve[35]=0;_e[35]=1;xe[35]=1;Ee[35]=0;we[35]=1;Me[153]=0;Se[153]=1;be[153]=1;Ie[153]=-1;Pe[153]=0;Re[153]=0;Be[153]=0;ze[153]=-1;ke[153]=0;xe[153]=1;Ee[153]=0;we[153]=1;Ae[102]=0;Te[102]=-1;Ce[102]=1;Le[102]=1;Ne[102]=0;De[102]=0;Oe[102]=0;Fe[102]=1;Ue[102]=0;ye[102]=-1;ve[102]=0;_e[102]=1;Me[155]=0;Se[155]=-1;be[155]=0;Ie[155]=1;Pe[155]=0;Re[155]=1;Be[155]=0;ze[155]=1;ke[155]=1;xe[155]=-1;Ee[155]=0;we[155]=0;Ae[103]=0;Te[103]=1;Ce[103]=0;Le[103]=-1;Ne[103]=0;De[103]=1;Oe[103]=0;Fe[103]=-1;Ue[103]=1;ye[103]=1;ve[103]=0;_e[103]=0;Me[152]=0;Se[152]=1;be[152]=1;Le[152]=-1;Ne[152]=0;De[152]=1;Ie[152]=-1;Pe[152]=0;Re[152]=0;Be[152]=0;ze[152]=-1;ke[152]=0;Oe[152]=0;Fe[152]=-1;Ue[152]=1;xe[152]=1;Ee[152]=0;we[152]=1;Me[156]=0;Se[156]=-1;be[156]=1;Le[156]=1;Ne[156]=0;De[156]=1;Ie[156]=-1;Pe[156]=0;Re[156]=0;Be[156]=0;ze[156]=-1;ke[156]=0;Oe[156]=0;Fe[156]=1;Ue[156]=1;xe[156]=-1;Ee[156]=0;we[156]=1;Me[137]=0;Se[137]=1;be[137]=1;Ae[137]=0;Te[137]=1;Ce[137]=0;Ie[137]=-1;Pe[137]=0;Re[137]=0;Be[137]=0;ze[137]=-1;ke[137]=0;ye[137]=1;ve[137]=0;_e[137]=0;xe[137]=1;Ee[137]=0;we[137]=1;Me[139]=0;Se[139]=1;be[139]=1;Ae[139]=0;Te[139]=-1;Ce[139]=0;Ie[139]=1;Pe[139]=0;Re[139]=0;Be[139]=0;ze[139]=1;ke[139]=0;ye[139]=-1;ve[139]=0;_e[139]=0;xe[139]=1;Ee[139]=0;we[139]=1;Me[98]=0;Se[98]=-1;be[98]=0;Ae[98]=0;Te[98]=-1;Ce[98]=1;Le[98]=1;Ne[98]=0;De[98]=0;Ie[98]=1;Pe[98]=0;Re[98]=1;Oe[98]=0;Fe[98]=1;Ue[98]=0;ye[98]=-1;ve[98]=0;_e[98]=1;Me[99]=0;Se[99]=1;be[99]=0;Ae[99]=0;Te[99]=-1;Ce[99]=1;Le[99]=1;Ne[99]=0;De[99]=0;Ie[99]=-1;Pe[99]=0;Re[99]=1;Oe[99]=0;Fe[99]=-1;Ue[99]=0;ye[99]=1;ve[99]=0;_e[99]=1;Ae[38]=0;Te[38]=-1;Ce[38]=1;Le[38]=1;Ne[38]=0;De[38]=0;Be[38]=0;ze[38]=1;ke[38]=1;Oe[38]=0;Fe[38]=1;Ue[38]=0;ye[38]=-1;ve[38]=0;_e[38]=1;xe[38]=-1;Ee[38]=0;we[38]=0;Ae[39]=0;Te[39]=1;Ce[39]=1;Le[39]=-1;Ne[39]=0;De[39]=0;Be[39]=0;ze[39]=-1;ke[39]=1;Oe[39]=0;Fe[39]=1;Ue[39]=0;ye[39]=-1;ve[39]=0;_e[39]=1;xe[39]=1;Ee[39]=0;we[39]=0;var md=function(o){return[[o.bottomleft,0],[0,0],[0,o.leftbottom]]},yd=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0]]},vd=function(o){return[[o.topright,1],[1,1],[1,o.righttop]]},_d=function(o){return[[0,o.lefttop],[0,1],[o.topleft,1]]},xd=function(o){return[[o.bottomright,0],[o.bottomleft,0],[0,o.leftbottom],[0,o.lefttop]]},Ed=function(o){return[[o.bottomright,0],[o.bottomleft,0],[1,o.righttop],[1,o.rightbottom]]},wd=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.topleft,1],[o.topright,1]]},Md=function(o){return[[0,o.leftbottom],[0,o.lefttop],[o.topleft,1],[o.topright,1]]},iL=function(o){return[[0,0],[0,o.leftbottom],[1,o.rightbottom],[1,0]]},oL=function(o){return[[1,0],[o.bottomright,0],[o.topright,1],[1,1]]},sL=function(o){return[[1,1],[1,o.righttop],[0,o.lefttop],[0,1]]},aL=function(o){return[[o.bottomleft,0],[0,0],[0,1],[o.topleft,1]]},uL=function(o){return[[1,o.righttop],[1,o.rightbottom],[0,o.leftbottom],[0,o.lefttop]]},lL=function(o){return[[o.topleft,1],[o.topright,1],[o.bottomright,0],[o.bottomleft,0]]},cL=function(){return[[0,0],[0,1],[1,1],[1,0]]},fL=function(o){return[[1,o.rightbottom],[1,0],[0,0],[0,1],[o.topleft,1]]},hL=function(o){return[[o.topright,1],[1,1],[1,0],[0,0],[0,o.leftbottom]]},pL=function(o){return[[1,0],[o.bottomright,0],[0,o.lefttop],[0,1],[1,1]]},dL=function(o){return[[1,1],[1,o.righttop],[o.bottomleft,0],[0,0],[0,1]]},gL=function(o){return[[1,o.righttop],[1,o.rightbottom],[0,o.lefttop],[0,1],[o.topleft,1]]},mL=function(o){return[[1,1],[1,o.righttop],[o.bottomright,0],[o.bottomleft,0],[o.topright,1]]},yL=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.leftbottom],[0,o.lefttop]]},vL=function(o){return[[o.topright,1],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topleft,1]]},_L=function(o){return[[o.bottomright,0],[o.bottomleft,0],[0,o.lefttop],[0,1],[o.topleft,1]]},xL=function(o){return[[1,1],[1,o.righttop],[0,o.leftbottom],[0,o.lefttop],[o.topright,1]]},EL=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[o.topleft,1],[o.topright,1]]},wL=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomleft,0],[0,0],[0,o.leftbottom]]},ML=function(o){return[[1,o.rightbottom],[1,0],[0,0],[0,o.leftbottom],[o.topleft,1],[o.topright,1]]},SL=function(o){return[[1,1],[1,0],[o.bottomright,0],[0,o.leftbottom],[0,o.lefttop],[o.topright,1]]},bL=function(o){return[[1,1],[1,o.righttop],[o.bottomright,0],[o.bottomleft,0],[0,o.lefttop],[0,1]]},AL=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomleft,0],[0,0],[0,1],[o.topleft,1]]},TL=function(o){return[[1,1],[1,o.righttop],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topright,1]]},CL=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.lefttop],[0,1],[o.topleft,1]]},IL=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]]},PL=function(o){return[[1,1],[1,o.righttop],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topright,1]]},RL=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.lefttop],[0,1],[o.topleft,1]]},LL=function(o){return[[1,1],[1,o.righttop],[o.bottomright,0],[o.bottomleft,0],[0,o.leftbottom],[0,o.lefttop],[o.topright,1]]},NL=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topleft,1],[o.topright,1]]},DL=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomright,0],[o.bottomleft,0],[0,o.lefttop],[0,1],[o.topleft,1]]},OL=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.leftbottom],[0,o.lefttop],[o.topleft,1],[o.topright,1]]},Xe=[],Ye=[],$e=[],Ze=[],Je=[],Ke=[],Qe=[],je=[];Ze[1]=Je[1]=18;Ze[169]=Je[169]=18;$e[4]=Ye[4]=12;$e[166]=Ye[166]=12;Xe[16]=je[16]=4;Xe[154]=je[154]=4;Ke[64]=Qe[64]=22;Ke[106]=Qe[106]=22;$e[2]=Ke[2]=17;Ze[2]=Je[2]=18;$e[168]=Ke[168]=17;Ze[168]=Je[168]=18;Xe[8]=Ze[8]=9;Ye[8]=$e[8]=12;Xe[162]=Ze[162]=9;Ye[162]=$e[162]=12;Xe[32]=je[32]=4;Ye[32]=Qe[32]=1;Xe[138]=je[138]=4;Ye[138]=Qe[138]=1;Je[128]=je[128]=21;Ke[128]=Qe[128]=22;Je[42]=je[42]=21;Ke[42]=Qe[42]=22;Ye[5]=Je[5]=14;Ye[165]=Je[165]=14;$e[20]=je[20]=6;$e[150]=je[150]=6;Xe[80]=Ke[80]=11;Xe[90]=Ke[90]=11;Ze[65]=Qe[65]=3;Ze[105]=Qe[105]=3;Xe[160]=Ke[160]=11;Ye[160]=Je[160]=14;Xe[10]=Ke[10]=11;Ye[10]=Je[10]=14;$e[130]=je[130]=6;Ze[130]=Qe[130]=3;$e[40]=je[40]=6;Ze[40]=Qe[40]=3;Ye[101]=Qe[101]=1;Ye[69]=Qe[69]=1;Je[149]=je[149]=21;Je[21]=je[21]=21;$e[86]=Ke[86]=17;$e[84]=Ke[84]=17;Xe[89]=Ze[89]=9;Xe[81]=Ze[81]=9;Xe[96]=Qe[96]=0;Ye[96]=Ke[96]=15;Xe[74]=Qe[74]=0;Ye[74]=Ke[74]=15;Xe[24]=$e[24]=8;Ze[24]=je[24]=7;Xe[146]=$e[146]=8;Ze[146]=je[146]=7;Ye[6]=Ke[6]=15;$e[6]=Je[6]=16;Ye[164]=Ke[164]=15;$e[164]=Je[164]=16;Ze[129]=je[129]=7;Je[129]=Qe[129]=20;Ze[41]=je[41]=7;Je[41]=Qe[41]=20;$e[66]=Qe[66]=2;Ze[66]=Ke[66]=19;$e[104]=Qe[104]=2;Ze[104]=Ke[104]=19;Xe[144]=Je[144]=10;Ke[144]=je[144]=23;Xe[26]=Je[26]=10;Ke[26]=je[26]=23;Ye[36]=je[36]=5;$e[36]=Qe[36]=2;Ye[134]=je[134]=5;$e[134]=Qe[134]=2;Xe[9]=Je[9]=10;Ye[9]=Ze[9]=13;Xe[161]=Je[161]=10;Ye[161]=Ze[161]=13;Ye[37]=je[37]=5;Je[37]=Qe[37]=20;Ye[133]=je[133]=5;Je[133]=Qe[133]=20;$e[148]=Je[148]=16;Ke[148]=je[148]=23;$e[22]=Je[22]=16;Ke[22]=je[22]=23;Xe[82]=$e[82]=8;Ze[82]=Ke[82]=19;Xe[88]=$e[88]=8;Ze[88]=Ke[88]=19;Xe[73]=Qe[73]=0;Ye[73]=Ze[73]=13;Xe[97]=Qe[97]=0;Ye[97]=Ze[97]=13;Xe[145]=Ze[145]=9;Je[145]=je[145]=21;Xe[25]=Ze[25]=9;Je[25]=je[25]=21;Ye[70]=Qe[70]=1;$e[70]=Ke[70]=17;Ye[100]=Qe[100]=1;$e[100]=Ke[100]=17;Xe[34]=Ze[34]=9;Ye[34]=$e[34]=12;Je[34]=je[34]=21;Ke[34]=Qe[34]=22;Xe[136]=je[136]=4;Ye[136]=Qe[136]=1;$e[136]=Ke[136]=17;Ze[136]=Je[136]=18;Xe[35]=je[35]=4;Ye[35]=$e[35]=12;Ze[35]=Je[35]=18;Ke[35]=Qe[35]=22;Xe[153]=je[153]=4;Ze[153]=Je[153]=18;Ye[102]=$e[102]=12;Ke[102]=Qe[102]=22;Xe[155]=Ze[155]=9;Je[155]=je[155]=23;Ye[103]=Qe[103]=1;$e[103]=Ke[103]=17;Xe[152]=je[152]=4;$e[152]=Ke[152]=17;Ze[152]=Je[152]=18;Xe[156]=$e[156]=8;Ze[156]=Je[156]=18;Ke[156]=je[156]=23;Xe[137]=je[137]=4;Ye[137]=Qe[137]=1;Ze[137]=Je[137]=18;Xe[139]=je[139]=4;Ye[139]=Ze[139]=13;Je[139]=Qe[139]=20;Xe[98]=Ze[98]=9;Ye[98]=$e[98]=12;Ke[98]=Qe[98]=22;Xe[99]=Qe[99]=0;Ye[99]=$e[99]=12;Ze[99]=Ke[99]=19;Ye[38]=$e[38]=12;Je[38]=je[38]=21;Ke[38]=Qe[38]=22;Ye[39]=je[39]=5;$e[39]=Je[39]=16;Ke[39]=Qe[39]=22;var St=[];St[1]=St[169]=md;St[4]=St[166]=yd;St[16]=St[154]=vd;St[64]=St[106]=_d;St[168]=St[2]=xd;St[162]=St[8]=Ed;St[138]=St[32]=wd;St[42]=St[128]=Md;St[5]=St[165]=iL;St[20]=St[150]=oL;St[80]=St[90]=sL;St[65]=St[105]=aL;St[160]=St[10]=uL;St[130]=St[40]=lL;St[85]=cL;St[101]=St[69]=fL;St[149]=St[21]=hL;St[86]=St[84]=pL;St[89]=St[81]=dL;St[96]=St[74]=gL;St[24]=St[146]=mL;St[6]=St[164]=yL;St[129]=St[41]=vL;St[66]=St[104]=_L;St[144]=St[26]=xL;St[36]=St[134]=EL;St[9]=St[161]=wL;St[37]=St[133]=ML;St[148]=St[22]=SL;St[82]=St[88]=bL;St[73]=St[97]=AL;St[145]=St[25]=TL;St[70]=St[100]=CL;St[34]=function(o){return[Md(o),Ed(o)]};St[35]=IL;St[136]=function(o){return[wd(o),xd(o)]};St[153]=function(o){return[vd(o),md(o)]};St[102]=function(o){return[yd(o),_d(o)]};St[155]=PL;St[103]=RL;St[152]=function(o){return[vd(o),xd(o)]};St[156]=LL;St[137]=function(o){return[wd(o),md(o)]};St[139]=NL;St[98]=function(o){return[Ed(o),_d(o)]};St[99]=DL;St[38]=function(o){return[yd(o),Md(o)]};St[39]=OL;function UL(o){return(o>0)-(o<0)||+o}function Hu(o,e,r){var u=e[0]-o[0],l=e[1]-o[1],h=r[0]-e[0],p=r[1]-e[1];return UL(u*p-h*l)}function O_(o,e){var r=o.geometry.coordinates[0].map(function(p){return p[0]}),u=o.geometry.coordinates[0].map(function(p){return p[1]}),l=e.geometry.coordinates[0].map(function(p){return p[0]}),h=e.geometry.coordinates[0].map(function(p){return p[1]});return Math.max.apply(null,r)===Math.max.apply(null,l)&&Math.max.apply(null,u)===Math.max.apply(null,h)&&Math.min.apply(null,r)===Math.min.apply(null,l)&&Math.min.apply(null,u)===Math.min.apply(null,h)}function Sd(o,e){return e.geometry.coordinates[0].every(function(r){return oi($n(r),o)})}function F_(o,e){return o[0]===e[0]&&o[1]===e[1]}var BL=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,u){var l=r.to,h=u.to;if(l.coordinates[0]-e.coordinates[0]>=0&&h.coordinates[0]-e.coordinates[0]<0)return 1;if(l.coordinates[0]-e.coordinates[0]<0&&h.coordinates[0]-e.coordinates[0]>=0)return-1;if(l.coordinates[0]-e.coordinates[0]===0&&h.coordinates[0]-e.coordinates[0]===0)return l.coordinates[1]-e.coordinates[1]>=0||h.coordinates[1]-e.coordinates[1]>=0?l.coordinates[1]-h.coordinates[1]:h.coordinates[1]-l.coordinates[1];var p=Hu(e.coordinates,l.coordinates,h.coordinates);if(p<0)return 1;if(p>0)return-1;var m=Math.pow(l.coordinates[0]-e.coordinates[0],2)+Math.pow(l.coordinates[1]-e.coordinates[1],2),y=Math.pow(h.coordinates[0]-e.coordinates[0],2)+Math.pow(h.coordinates[1]-e.coordinates[1],2);return m-y}),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}(),bd=BL;var zL=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 ii([this.from.coordinates,this.to.coordinates])},o.prototype.compareTo=function(e){return Hu(e.from.coordinates,e.to.coordinates,this.to.coordinates)},o}(),U_=zL;var kL=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(p,m,y){return m.from.coordinates[1]>e.edges[p].from.coordinates[1]&&(p=y),p},0),u=(r===0?this.length:r)-1,l=(r+1)%this.length,h=Hu(this.edges[u].from.coordinates,this.edges[r].from.coordinates,this.edges[l].from.coordinates);return h===0?this.edges[u].from.coordinates[0]>this.edges[l].from.coordinates[0]:h>0},o.prototype.toMultiPoint=function(){return up(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=ir([e])},o.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Tp(this.toPolygon())},o.findEdgeRingContaining=function(e,r){var u=e.getEnvelope(),l,h;return r.forEach(function(p){var m=p.getEnvelope();if(h&&(l=h.getEnvelope()),!O_(m,u)&&Sd(m,u)){for(var y=e.map(function(D){return D.from.coordinates}),x=void 0,E=function(D){p.some(function(G){return F_(D,G.from.coordinates)})||(x=D)},b=0,S=y;b<S.length;b++){var C=S[b];E(C)}x&&p.inside($n(x))&&(!h||Sd(l,m))&&(h=p)}}),h},o.prototype.inside=function(e){return oi(e,this.toPolygon())},o}(),Ad=kL;function GL(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 Ek=function(){function o(){this.edges=[],this.nodes={}}return o.fromGeoJson=function(e){GL(e);var r=new o;return Uo(e,function(u){cp(u,"LineString","Graph::fromGeoJson"),I0(u,function(l,h){if(l){var p=r.getNode(l),m=r.getNode(h);r.addEdge(p,m)}return h})}),r},o.prototype.getNode=function(e){var r=bd.buildId(e),u=this.nodes[r];return u||(u=this.nodes[r]=new bd(e)),u},o.prototype.addEdge=function(e,r){var u=new U_(e,r),l=u.getSymetric();this.edges.push(u),this.edges.push(l)},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 u=e.getOuterEdges().map(function(l){return l.to});this.removeNode(e),u.forEach(function(l){return r._removeIfDangle(l)})}},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>"u"?Object.keys(this.nodes).forEach(function(u){return r._computeNextCWEdges(r.nodes[u])}):e.getOuterEdges().forEach(function(u,l){e.getOuterEdge((l===0?e.getOuterEdges().length:l)-1).symetric.next=u})},o.prototype._computeNextCCWEdges=function(e,r){for(var u=e.getOuterEdges(),l,h,p=u.length-1;p>=0;--p){var m=u[p],y=m.symetric,x=void 0,E=void 0;m.label===r&&(x=m),y.label===r&&(E=y),!(!x||!E)&&(E&&(h=E),x&&(h&&(h.next=x,h=void 0),l||(l=x)))}h&&(h.next=l)},o.prototype._findLabeledEdgeRings=function(){var e=[],r=0;return this.edges.forEach(function(u){if(!(u.label>=0)){e.push(u);var l=u;do l.label=r,l=l.next;while(!u.isEqual(l));r++}}),e},o.prototype.getEdgeRings=function(){var e=this;this._computeNextCWEdges(),this.edges.forEach(function(u){u.label=void 0}),this._findLabeledEdgeRings().forEach(function(u){e._findIntersectionNodes(u).forEach(function(l){e._computeNextCCWEdges(l,u.label)})});var r=[];return this.edges.forEach(function(u){u.ring||r.push(e._findEdgeRing(u))}),r},o.prototype._findIntersectionNodes=function(e){var r=[],u=e,l=function(){var h=0;u.from.getOuterEdges().forEach(function(p){p.label===e.label&&++h}),h>1&&r.push(u.from),u=u.next};do l();while(!e.isEqual(u));return r},o.prototype._findEdgeRing=function(e){var r=e,u=new Ad;do u.push(r),r.ring=u,r=r.next;while(!e.isEqual(r));return u},o.prototype.removeNode=function(e){var r=this;e.getOuterEdges().forEach(function(u){return r.removeEdge(u)}),e.innerEdges.forEach(function(u){return r.removeEdge(u)}),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 qL=nr(Td(),1);var XL=nr(Td(),1);var $L=nr(X_(),1);var e2=nr(n1(),1);function i1(o){for(var e=o,r=[];e.parent;)r.unshift(e),e=e.parent;return r}function r2(){return new o1(function(o){return o.f})}var Rd={search:function(o,e,r,u){o.cleanDirty(),u=u||{};var l=u.heuristic||Rd.heuristics.manhattan,h=u.closest||!1,p=r2(),m=e;for(e.h=l(e,r),p.push(e);p.size()>0;){var y=p.pop();if(y===r)return i1(y);y.closed=!0;for(var x=o.neighbors(y),E=0,b=x.length;E<b;++E){var S=x[E];if(!(S.closed||S.isWall())){var C=y.g+S.getCost(y),D=S.visited;(!D||C<S.g)&&(S.visited=!0,S.parent=y,S.h=S.h||l(S,r),S.g=C,S.f=S.g+S.h,o.markDirty(S),h&&(S.h<m.h||S.h===m.h&&S.g<m.g)&&(m=S),D?p.rescoreElement(S):p.push(S))}}}return h?i1(m):[]},heuristics:{manhattan:function(o,e){var r=Math.abs(e.x-o.x),u=Math.abs(e.y-o.y);return r+u},diagonal:function(o,e){var r=1,u=Math.sqrt(2),l=Math.abs(e.x-o.x),h=Math.abs(e.y-o.y);return r*(l+h)+(u-2*r)*Math.min(l,h)}},cleanNode:function(o){o.f=0,o.g=0,o.h=0,o.visited=!1,o.closed=!1,o.parent=null}};function zl(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 u=0,l=o[r];u<l.length;u++){var h=new Af(r,u,l[u]);this.grid[r][u]=h,this.nodes.push(h)}}this.init()}zl.prototype.init=function(){this.dirtyNodes=[];for(var o=0;o<this.nodes.length;o++)Rd.cleanNode(this.nodes[o])};zl.prototype.cleanDirty=function(){for(var o=0;o<this.dirtyNodes.length;o++)Rd.cleanNode(this.dirtyNodes[o]);this.dirtyNodes=[]};zl.prototype.markDirty=function(o){this.dirtyNodes.push(o)};zl.prototype.neighbors=function(o){var e=[],r=o.x,u=o.y,l=this.grid;return l[r-1]&&l[r-1][u]&&e.push(l[r-1][u]),l[r+1]&&l[r+1][u]&&e.push(l[r+1][u]),l[r]&&l[r][u-1]&&e.push(l[r][u-1]),l[r]&&l[r][u+1]&&e.push(l[r][u+1]),this.diagonal&&(l[r-1]&&l[r-1][u-1]&&e.push(l[r-1][u-1]),l[r+1]&&l[r+1][u-1]&&e.push(l[r+1][u-1]),l[r-1]&&l[r-1][u+1]&&e.push(l[r-1][u+1]),l[r+1]&&l[r+1][u+1]&&e.push(l[r+1][u+1])),e};zl.prototype.toString=function(){for(var o=[],e=this.grid,r,u,l,h,p=0,m=e.length;p<m;p++){for(r=[],u=e[p],l=0,h=u.length;l<h;l++)r.push(u[l].weight);o.push(r.join(" "))}return o.join(`\n`)};function Af(o,e,r){this.x=o,this.y=e,this.weight=r}Af.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Af.prototype.getCost=function(o){return o&&o.x!==this.x&&o.y!==this.y?this.weight*1.41421:this.weight};Af.prototype.isWall=function(){return this.weight===0};function o1(o){this.content=[],this.scoreFunction=o}o1.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,u=this.content[r];if(this.scoreFunction(e)<this.scoreFunction(u))this.content[r]=e,this.content[o]=u,o=r;else break}},bubbleUp:function(o){for(var e=this.content.length,r=this.content[o],u=this.scoreFunction(r);;){var l=o+1<<1,h=l-1,p=null,m;if(h<e){var y=this.content[h];m=this.scoreFunction(y),m<u&&(p=h)}if(l<e){var x=this.content[l],E=this.scoreFunction(x);E<(p===null?u:m)&&(p=l)}if(p!==null)this.content[o]=this.content[p],this.content[p]=r,o=p;else break}}};function Ld(){this._=null}function Wu(o){o.U=o.C=o.L=o.R=o.P=o.N=null}Ld.prototype={constructor:Ld,insert:function(o,e){var r,u,l;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=s1(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;)u=r.U,r===u.L?(l=u.R,l&&l.C?(r.C=l.C=!1,u.C=!0,o=u):(o===r.R&&(kl(this,r),o=r,r=o.U),r.C=!1,u.C=!0,Gl(this,u))):(l=u.L,l&&l.C?(r.C=l.C=!1,u.C=!0,o=u):(o===r.L&&(Gl(this,r),o=r,r=o.U),r.C=!1,u.C=!0,kl(this,u))),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,u=o.L,l=o.R,h,p;if(u?l?h=s1(l):h=u:h=l,e?e.L===o?e.L=h:e.R=h:this._=h,u&&l?(p=h.C,h.C=o.C,h.L=u,u.U=h,h!==l?(e=h.U,h.U=o.U,o=h.R,e.L=o,h.R=l,l.U=h):(h.U=e,e=h,o=h.R)):(p=o.C,o=h),o&&(o.U=e),!p){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,kl(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,Gl(this,r),r=e.R),r.C=e.C,e.C=r.R.C=!1,kl(this,e),o=this._;break}}else if(r=e.L,r.C&&(r.C=!1,e.C=!0,Gl(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,kl(this,r),r=e.L),r.C=e.C,e.C=r.L.C=!1,Gl(this,e),o=this._;break}r.C=!0,o=e,e=e.U}while(!o.C);o&&(o.C=!1)}}};function kl(o,e){var r=e,u=e.R,l=r.U;l?l.L===r?l.L=u:l.R=u:o._=u,u.U=l,r.U=u,r.R=u.L,r.R&&(r.R.U=r),u.L=r}function Gl(o,e){var r=e,u=e.L,l=r.U;l?l.L===r?l.L=u:l.R=u:o._=u,u.U=l,r.U=u,r.L=u.R,r.L&&(r.L.U=r),u.R=r}function s1(o){for(;o.L;)o=o.L;return o}var Nd=Ld;function qu(o,e,r,u){var l=[null,null],h=ai.push(l)-1;return l.left=o,l.right=e,r&&Hl(l,o,e,r),u&&Hl(l,e,o,u),Zi[o.index].halfedges.push(h),Zi[e.index].halfedges.push(h),l}function Xu(o,e,r){var u=[e,r];return u.left=o,u}function Hl(o,e,r,u){!o[0]&&!o[1]?(o[0]=u,o.left=e,o.right=r):o.left===r?o[1]=u:o[0]=u}function i2(o,e,r,u,l){var h=o[0],p=o[1],m=h[0],y=h[1],x=p[0],E=p[1],b=0,S=1,C=x-m,D=E-y,G;if(G=e-m,!(!C&&G>0)){if(G/=C,C<0){if(G<b)return;G<S&&(S=G)}else if(C>0){if(G>S)return;G>b&&(b=G)}if(G=u-m,!(!C&&G<0)){if(G/=C,C<0){if(G>S)return;G>b&&(b=G)}else if(C>0){if(G<b)return;G<S&&(S=G)}if(G=r-y,!(!D&&G>0)){if(G/=D,D<0){if(G<b)return;G<S&&(S=G)}else if(D>0){if(G>S)return;G>b&&(b=G)}if(G=l-y,!(!D&&G<0)){if(G/=D,D<0){if(G>S)return;G>b&&(b=G)}else if(D>0){if(G<b)return;G<S&&(S=G)}return!(b>0)&&!(S<1)||(b>0&&(o[0]=[m+b*C,y+b*D]),S<1&&(o[1]=[m+S*C,y+S*D])),!0}}}}}function o2(o,e,r,u,l){var h=o[1];if(h)return!0;var p=o[0],m=o.left,y=o.right,x=m[0],E=m[1],b=y[0],S=y[1],C=(x+b)/2,D=(E+S)/2,G,O;if(S===E){if(C<e||C>=u)return;if(x>b){if(!p)p=[C,r];else if(p[1]>=l)return;h=[C,l]}else{if(!p)p=[C,l];else if(p[1]<r)return;h=[C,r]}}else if(G=(x-b)/(S-E),O=D-G*C,G<-1||G>1)if(x>b){if(!p)p=[(r-O)/G,r];else if(p[1]>=l)return;h=[(l-O)/G,l]}else{if(!p)p=[(l-O)/G,l];else if(p[1]<r)return;h=[(r-O)/G,r]}else if(E<S){if(!p)p=[e,G*e+O];else if(p[0]>=u)return;h=[u,G*u+O]}else{if(!p)p=[u,G*u+O];else if(p[0]<e)return;h=[e,G*e+O]}return o[0]=p,o[1]=h,!0}function a1(o,e,r,u){for(var l=ai.length,h;l--;)(!o2(h=ai[l],o,e,r,u)||!i2(h,o,e,r,u)||!(Math.abs(h[0][0]-h[1][0])>Dn||Math.abs(h[0][1]-h[1][1])>Dn))&&delete ai[l]}function u1(o){return Zi[o.index]={site:o,halfedges:[]}}function s2(o,e){var r=o.site,u=e.left,l=e.right;return r===l&&(l=u,u=r),l?Math.atan2(l[1]-u[1],l[0]-u[0]):(r===u?(u=e[1],l=e[0]):(u=e[0],l=e[1]),Math.atan2(u[0]-l[0],l[1]-u[1]))}function Dd(o,e){return e[+(e.left!==o.site)]}function a2(o,e){return e[+(e.left===o.site)]}function l1(){for(var o=0,e=Zi.length,r,u,l,h;o<e;++o)if((r=Zi[o])&&(h=(u=r.halfedges).length)){var p=new Array(h),m=new Array(h);for(l=0;l<h;++l)p[l]=l,m[l]=s2(r,ai[u[l]]);for(p.sort(function(y,x){return m[x]-m[y]}),l=0;l<h;++l)m[l]=u[p[l]];for(l=0;l<h;++l)u[l]=m[l]}}function c1(o,e,r,u){var l=Zi.length,h,p,m,y,x,E,b,S,C,D,G,O,L=!0;for(h=0;h<l;++h)if(p=Zi[h]){for(m=p.site,x=p.halfedges,y=x.length;y--;)ai[x[y]]||x.splice(y,1);for(y=0,E=x.length;y<E;)D=a2(p,ai[x[y]]),G=D[0],O=D[1],b=Dd(p,ai[x[++y%E]]),S=b[0],C=b[1],(Math.abs(G-S)>Dn||Math.abs(O-C)>Dn)&&(x.splice(y,0,ai.push(Xu(m,D,Math.abs(G-o)<Dn&&u-O>Dn?[o,Math.abs(S-o)<Dn?C:u]:Math.abs(O-u)<Dn&&r-G>Dn?[Math.abs(C-u)<Dn?S:r,u]:Math.abs(G-r)<Dn&&O-e>Dn?[r,Math.abs(S-r)<Dn?C:e]:Math.abs(O-e)<Dn&&G-o>Dn?[Math.abs(C-e)<Dn?S:o,e]:null))-1),++E);E&&(L=!1)}if(L){var k,F,$,Z=1/0;for(h=0,L=null;h<l;++h)(p=Zi[h])&&(m=p.site,k=m[0]-o,F=m[1]-e,$=k*k+F*F,$<Z&&(Z=$,L=p));if(L){var it=[o,e],et=[o,u],U=[r,u],wt=[r,e];L.halfedges.push(ai.push(Xu(m=L.site,it,et))-1,ai.push(Xu(m,et,U))-1,ai.push(Xu(m,U,wt))-1,ai.push(Xu(m,wt,it))-1)}}for(h=0;h<l;++h)(p=Zi[h])&&(p.halfedges.length||delete Zi[h])}var f1=[],Tf;function u2(){Wu(this),this.x=this.y=this.arc=this.site=this.cy=null}function nu(o){var e=o.P,r=o.N;if(!(!e||!r)){var u=e.site,l=o.site,h=r.site;if(u!==h){var p=l[0],m=l[1],y=u[0]-p,x=u[1]-m,E=h[0]-p,b=h[1]-m,S=2*(y*b-x*E);if(!(S>=-h1)){var C=y*y+x*x,D=E*E+b*b,G=(b*C-x*D)/S,O=(y*D-E*C)/S,L=f1.pop()||new u2;L.arc=o,L.site=l,L.x=G+p,L.y=(L.cy=O+m)+Math.sqrt(G*G+O*O),o.circle=L;for(var k=null,F=Yu._;F;)if(L.y<F.y||L.y===F.y&&L.x<=F.x)if(F.L)F=F.L;else{k=F.P;break}else if(F.R)F=F.R;else{k=F;break}Yu.insert(k,L),k||(Tf=L)}}}}function ru(o){var e=o.circle;e&&(e.P||(Tf=e.N),Yu.remove(e),f1.push(e),Wu(e),o.circle=null)}var d1=[];function l2(){Wu(this),this.edge=this.site=this.circle=null}function p1(o){var e=d1.pop()||new l2;return e.site=o,e}function Od(o){ru(o),iu.remove(o),d1.push(o),Wu(o)}function g1(o){var e=o.circle,r=e.x,u=e.cy,l=[r,u],h=o.P,p=o.N,m=[o];Od(o);for(var y=h;y.circle&&Math.abs(r-y.circle.x)<Dn&&Math.abs(u-y.circle.cy)<Dn;)h=y.P,m.unshift(y),Od(y),y=h;m.unshift(y),ru(y);for(var x=p;x.circle&&Math.abs(r-x.circle.x)<Dn&&Math.abs(u-x.circle.cy)<Dn;)p=x.N,m.push(x),Od(x),x=p;m.push(x),ru(x);var E=m.length,b;for(b=1;b<E;++b)x=m[b],y=m[b-1],Hl(x.edge,y.site,x.site,l);y=m[0],x=m[E-1],x.edge=qu(y.site,x.site,null,l),nu(y),nu(x)}function m1(o){for(var e=o[0],r=o[1],u,l,h,p,m=iu._;m;)if(h=y1(m,r)-e,h>Dn)m=m.L;else if(p=e-c2(m,r),p>Dn){if(!m.R){u=m;break}m=m.R}else{h>-Dn?(u=m.P,l=m):p>-Dn?(u=m,l=m.N):u=l=m;break}u1(o);var y=p1(o);if(iu.insert(u,y),!(!u&&!l)){if(u===l){ru(u),l=p1(u.site),iu.insert(y,l),y.edge=l.edge=qu(u.site,y.site),nu(u),nu(l);return}if(!l){y.edge=qu(u.site,y.site);return}ru(u),ru(l);var x=u.site,E=x[0],b=x[1],S=o[0]-E,C=o[1]-b,D=l.site,G=D[0]-E,O=D[1]-b,L=2*(S*O-C*G),k=S*S+C*C,F=G*G+O*O,$=[(O*k-C*F)/L+E,(S*F-G*k)/L+b];Hl(l.edge,x,D,$),y.edge=qu(x,o,null,$),l.edge=qu(o,D,null,$),nu(u),nu(l)}}function y1(o,e){var r=o.site,u=r[0],l=r[1],h=l-e;if(!h)return u;var p=o.P;if(!p)return-1/0;r=p.site;var m=r[0],y=r[1],x=y-e;if(!x)return m;var E=m-u,b=1/h-1/x,S=E/x;return b?(-S+Math.sqrt(S*S-2*b*(E*E/(-2*x)-y+x/2+l-h/2)))/b+u:(u+m)/2}function c2(o,e){var r=o.N;if(r)return y1(r,e);var u=o.site;return u[1]===e?u[0]:1/0}var Dn=1e-6,h1=1e-12,iu,Zi,Yu,ai;function f2(o,e,r){return(o[0]-r[0])*(e[1]-o[1])-(o[0]-e[0])*(r[1]-o[1])}function h2(o,e){return e[1]-o[1]||e[0]-o[0]}function Cf(o,e){var r=o.sort(h2).pop(),u,l,h;for(ai=[],Zi=new Array(o.length),iu=new Nd,Yu=new Nd;;)if(h=Tf,r&&(!h||r[1]<h.y||r[1]===h.y&&r[0]<h.x))(r[0]!==u||r[1]!==l)&&(m1(r),u=r[0],l=r[1]),r=o.pop();else if(h)g1(h.arc);else break;if(l1(),e){var p=+e[0][0],m=+e[0][1],y=+e[1][0],x=+e[1][1];a1(p,m,y,x),c1(p,m,y,x)}this.edges=ai,this.cells=Zi,iu=Yu=ai=Zi=null}Cf.prototype={constructor:Cf,polygons:function(){var o=this.edges;return this.cells.map(function(e){var r=e.halfedges.map(function(u){return Dd(e,o[u])});return r.data=e.site.data,r})},triangles:function(){var o=[],e=this.edges;return this.cells.forEach(function(r,u){if(m=(h=r.halfedges).length)for(var l=r.site,h,p=-1,m,y,x=e[h[m-1]],E=x.left===l?x.right:x.left;++p<m;)y=E,x=e[h[p]],E=x.left===l?x.right:x.left,y&&E&&u<y.index&&u<E.index&&f2(l,y,E)<0&&o.push([l.data,y.data,E.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 u=this,l,h=u._found||0,p=u.cells.length,m;!(m=u.cells[h]);)if(++h>=p)return null;var y=o-m.site[0],x=e-m.site[1],E=y*y+x*x;do m=u.cells[l=h],h=null,m.halfedges.forEach(function(b){var S=u.edges[b],C=S.left;if(!((C===m.site||!C)&&!(C=S.right))){var D=o-C[0],G=e-C[1],O=D*D+G*G;O<E&&(E=O,h=C.index)}});while(h!==null);return u._found=l,r==null||E<=r*r?m.site:null}};var x2=nr($u(),1);var Jd=nr(E1(),1);function xo(){return new Rf}function Rf(){this.reset()}Rf.prototype={constructor:Rf,reset:function(){this.s=this.t=0},add:function(o){w1(Pf,o,this.t),w1(this,Pf.s,this.s),this.s?this.t+=Pf.t:this.s=Pf.t},valueOf:function(){return this.s}};var Pf=new Rf;function w1(o,e,r){var u=o.s=e+r,l=u-e,h=u-l;o.t=e-h+(r-l)}var dn=1e-6;var In=Math.PI,Wr=In/2,Lf=In/4,Ns=In*2,ou=180/In,Eo=In/180,_r=Math.abs,hs=Math.atan,wo=Math.atan2,rn=Math.cos;var Nf=Math.exp;var Vl=Math.log;var pe=Math.sin;var Ei=Math.sqrt,Wl=Math.tan;function Bd(o){return o>1?0:o<-1?In:Math.acos(o)}function Ji(o){return o>1?Wr:o<-1?-Wr:Math.asin(o)}function ps(){}var E2=xo(),g6=xo();function su(o){var e=o[0],r=o[1],u=rn(r);return[u*rn(e),u*pe(e),pe(r)]}function ql(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 Xl(o){var e=Ei(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]);o[0]/=e,o[1]/=e,o[2]/=e}var b6=xo();function S1(o,e){return[o>In?o-Ns:o<-In?o+Ns:o,e]}S1.invert=S1;function zd(){var o=[],e;return{point:function(r,u){e.push([r,u])},lineStart:function(){o.push(e=[])},lineEnd:ps,rejoin:function(){o.length>1&&o.push(o.pop().concat(o.shift()))},result:function(){var r=o;return o=[],e=null,r}}}function kd(o,e){return _r(o[0]-e[0])<dn&&_r(o[1]-e[1])<dn}function Df(o,e,r,u){this.x=o,this.z=e,this.o=r,this.e=u,this.v=!1,this.n=this.p=null}function Gd(o,e,r,u,l){var h=[],p=[],m,y;if(o.forEach(function(D){if(!((G=D.length-1)<=0)){var G,O=D[0],L=D[G],k;if(kd(O,L)){for(l.lineStart(),m=0;m<G;++m)l.point((O=D[m])[0],O[1]);l.lineEnd();return}h.push(k=new Df(O,D,null,!0)),p.push(k.o=new Df(O,null,k,!1)),h.push(k=new Df(L,D,null,!1)),p.push(k.o=new Df(L,null,k,!0))}}),!!h.length){for(p.sort(e),b1(h),b1(p),m=0,y=p.length;m<y;++m)p[m].e=r=!r;for(var x=h[0],E,b;;){for(var S=x,C=!0;S.v;)if((S=S.n)===x)return;E=S.z,l.lineStart();do{if(S.v=S.o.v=!0,S.e){if(C)for(m=0,y=E.length;m<y;++m)l.point((b=E[m])[0],b[1]);else u(S.x,S.n.x,1,l);S=S.n}else{if(C)for(E=S.p.z,m=E.length-1;m>=0;--m)l.point((b=E[m])[0],b[1]);else u(S.x,S.p.x,-1,l);S=S.p}S=S.o,E=S.z,C=!C}while(!S.v);l.lineEnd()}}}function b1(o){if(e=o.length){for(var e,r=0,u=o[0],l;++r<e;)u.n=l=o[r],l.p=u,u=l;u.n=l=o[0],l.p=u}}function Ca(o,e){return o<e?-1:o>e?1:o>=e?0:NaN}function Hd(o){return o.length===1&&(o=S2(o)),{left:function(e,r,u,l){for(u==null&&(u=0),l==null&&(l=e.length);u<l;){var h=u+l>>>1;o(e[h],r)<0?u=h+1:l=h}return u},right:function(e,r,u,l){for(u==null&&(u=0),l==null&&(l=e.length);u<l;){var h=u+l>>>1;o(e[h],r)>0?l=h:u=h+1}return u}}}function S2(o){return function(e,r){return Ca(o(e),r)}}var A1=Hd(Ca),b2=A1.right,A2=A1.left;var T1=Array.prototype,C2=T1.slice,I2=T1.map;var yH=Math.sqrt(50),vH=Math.sqrt(10),_H=Math.sqrt(2);function Ff(o){for(var e=o.length,r,u=-1,l=0,h,p;++u<e;)l+=o[u].length;for(h=new Array(l);--e>=0;)for(p=o[e],r=p.length;--r>=0;)h[--l]=p[r];return h}var U2=1e9,n8=-U2;var Vd=xo();function Wd(o,e){var r=e[0],u=e[1],l=[pe(r),-rn(r),0],h=0,p=0;Vd.reset();for(var m=0,y=o.length;m<y;++m)if(E=(x=o[m]).length)for(var x,E,b=x[E-1],S=b[0],C=b[1]/2+Lf,D=pe(C),G=rn(C),O=0;O<E;++O,S=k,D=$,G=Z,b=L){var L=x[O],k=L[0],F=L[1]/2+Lf,$=pe(F),Z=rn(F),it=k-S,et=it>=0?1:-1,U=et*it,wt=U>In,Lt=D*$;if(Vd.add(wo(Lt*et*pe(U),G*Z+Lt*rn(U))),h+=wt?it+et*Ns:it,wt^S>=r^k>=r){var Ot=ql(su(b),su(L));Xl(Ot);var W=ql(l,Ot);Xl(W);var de=(wt^it>=0?-1:1)*Ji(W[2]);(u>de||u===de&&(Ot[0]||Ot[1]))&&(p+=wt^it>=0?1:-1)}}return(h<-dn||h<dn&&Vd<-dn)^p&1}var h8=xo();var R8=xo(),L8=xo();var k2=1/0;var O8=-k2;function qd(o){this._context=o}qd.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,Ns);break}}},result:ps};var q8=xo();function Xd(){this._string=[]}Xd.prototype={_radius:4.5,_circle:P1(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=P1(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 P1(o){return"m0,"+o+"a"+o+","+o+" 0 1,1 0,"+-2*o+"a"+o+","+o+" 0 1,1 0,"+2*o+"z"}function Yd(o,e,r,u){return function(l,h){var p=e(h),m=l.invert(u[0],u[1]),y=zd(),x=e(y),E=!1,b,S,C,D={point:G,lineStart:L,lineEnd:k,polygonStart:function(){D.point=F,D.lineStart=$,D.lineEnd=Z,S=[],b=[]},polygonEnd:function(){D.point=G,D.lineStart=L,D.lineEnd=k,S=Ff(S);var it=Wd(b,m);S.length?(E||(h.polygonStart(),E=!0),Gd(S,V2,it,r,h)):it&&(E||(h.polygonStart(),E=!0),h.lineStart(),r(null,null,1,h),h.lineEnd()),E&&(h.polygonEnd(),E=!1),S=b=null},sphere:function(){h.polygonStart(),h.lineStart(),r(null,null,1,h),h.lineEnd(),h.polygonEnd()}};function G(it,et){var U=l(it,et);o(it=U[0],et=U[1])&&h.point(it,et)}function O(it,et){var U=l(it,et);p.point(U[0],U[1])}function L(){D.point=O,p.lineStart()}function k(){D.point=G,p.lineEnd()}function F(it,et){C.push([it,et]);var U=l(it,et);x.point(U[0],U[1])}function $(){x.lineStart(),C=[]}function Z(){F(C[0][0],C[0][1]),x.lineEnd();var it=x.clean(),et=y.result(),U,wt=et.length,Lt,Ot,W;if(C.pop(),b.push(C),C=null,!!wt){if(it&1){if(Ot=et[0],(Lt=Ot.length-1)>0){for(E||(h.polygonStart(),E=!0),h.lineStart(),U=0;U<Lt;++U)h.point((W=Ot[U])[0],W[1]);h.lineEnd()}return}wt>1&&it&2&&et.push(et.pop().concat(et.shift())),S.push(et.filter(H2))}}return D}}function H2(o){return o.length>1}function V2(o,e){return((o=o.x)[0]<0?o[1]-Wr-dn:Wr-o[1])-((e=e.x)[0]<0?e[1]-Wr-dn:Wr-e[1])}var W2=Yd(function(){return!0},q2,Y2,[-In,-Wr]);function q2(o){var e=NaN,r=NaN,u=NaN,l;return{lineStart:function(){o.lineStart(),l=1},point:function(h,p){var m=h>0?In:-In,y=_r(h-e);_r(y-In)<dn?(o.point(e,r=(r+p)/2>0?Wr:-Wr),o.point(u,r),o.lineEnd(),o.lineStart(),o.point(m,r),o.point(h,r),l=0):u!==m&&y>=In&&(_r(e-u)<dn&&(e-=u*dn),_r(h-m)<dn&&(h-=m*dn),r=X2(e,r,h,p),o.point(u,r),o.lineEnd(),o.lineStart(),o.point(m,r),l=0),o.point(e=h,r=p),u=m},lineEnd:function(){o.lineEnd(),e=r=NaN},clean:function(){return 2-l}}}function X2(o,e,r,u){var l,h,p=pe(o-r);return _r(p)>dn?hs((pe(e)*(h=rn(u))*pe(r)-pe(u)*(l=rn(e))*pe(o))/(l*h*p)):(e+u)/2}function Y2(o,e,r,u){var l;if(o==null)l=r*Wr,u.point(-In,l),u.point(0,l),u.point(In,l),u.point(In,0),u.point(In,-l),u.point(0,-l),u.point(-In,-l),u.point(-In,0),u.point(-In,l);else if(_r(o[0]-e[0])>dn){var h=o[0]<e[0]?In:-In;l=r*h/2,u.point(-h,l),u.point(0,l),u.point(h,l)}else u.point(e[0],e[1])}function Uf(o){return function(e){var r=new $d;for(var u in o)r[u]=o[u];return r.stream=e,r}}function $d(){}$d.prototype={constructor:$d,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 LW=rn(30*Eo);var XW=Uf({point:function(o,e){this.stream.point(o*Eo,e*Eo)}});function Bf(o){return function(e,r){var u=rn(e),l=rn(r),h=o(u*l);return[h*l*pe(e),h*pe(r)]}}function Ds(o){return function(e,r){var u=Ei(e*e+r*r),l=o(u),h=pe(l),p=rn(l);return[wo(e*h,u*p),Ji(u&&r*h/u)]}}var U1=Bf(function(o){return Ei(2/(1+o))});U1.invert=Ds(function(o){return 2*Ji(o/2)});var B1=Bf(function(o){return(o=Bd(o))&&o/pe(o)});B1.invert=Ds(function(o){return o});function Zd(o,e){return[o,Vl(Wl((Wr+e)/2))]}Zd.invert=function(o,e){return[o,2*hs(Nf(e))-Wr]};function zf(o,e){return[o,e]}zf.invert=zf;function z1(o,e){var r=rn(e),u=rn(o)*r;return[r*pe(o)/u,pe(e)/u]}z1.invert=Ds(hs);function k1(o,e){var r=e*e,u=r*r;return[o*(.8707-.131979*r+u*(-.013791+u*(.003971*r-.001529*u))),e*(1.007226+r*(.015085+u*(-.044475+.028874*r-.005916*u)))]}k1.invert=function(o,e){var r=e,u=25,l;do{var h=r*r,p=h*h;r-=l=(r*(1.007226+h*(.015085+p*(-.044475+.028874*h-.005916*p)))-e)/(1.007226+h*(.015085*3+p*(-.044475*7+.028874*9*h-.005916*11*p)))}while(_r(l)>dn&&--u>0);return[o/(.8707+(h=r*r)*(-.131979+h*(-.013791+h*h*h*(.003971-.001529*h)))),r]};function G1(o,e){return[rn(e)*pe(o),pe(e)]}G1.invert=Ds(Ji);function H1(o,e){var r=rn(e),u=1+rn(o)*r;return[r*pe(o)/u,pe(e)/u]}H1.invert=Ds(function(o){return 2*hs(o)});function V1(o,e){return[Vl(Wl((Wr+e)/2)),-o]}V1.invert=function(o,e){return[-e,2*hs(Nf(o))-Wr]};var j2=nr($u(),1);var tN=nr($u(),1);var nN=nr($u(),1);var rN=nr($u(),1);function Pa(o,e){return Math.sqrt((e[0]-o[0])**2+(e[1]-o[1])**2)}function q1(o){let e=0;for(let r=0;r<o.length-1;r++)e+=Pa(o[r],o[r+1]);return e}function X1(o,e,r){let u=new Xi(e[0]-o[0],e[1]-o[1]),l=new Xi(e[0]-r[0],e[1]-r[1]),p=u.angleTo(l)*180/Math.PI,m=new Xi(e[0]-o[0],e[1]-o[1]);return new Xi(r[0]-o[0],r[1]-o[1]).cross(m)>0?p:-p}var Ra=nr(Y1(),1),Qn="___",kf=class{constructor(e=3){this.lift_priority=e}roadInfo=[];facilities=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;rampMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new Li.default;escalatorRoute=new Li.default;straightLadderRoute=new Li.default;forwardLineMap=new Map;forwardRoute=new Li.default;isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp"].includes(e)}initFacilities(e){this.facilities=e.map(r=>{let u=[];try{u=JSON.parse(r.entry_end_floor)}catch{u=[]}let l=[];try{l=JSON.parse(r.entry_start_floor)}catch{l=[]}return{...r,entry_start_floor:l,entry_end_floor:u}})}initRoute(e,r){this.clear(),this.roadInfo=e,this.initFacilities(r);let u=new Date,l=u.getHours()*60+u.getMinutes();e.length&&(e.forEach(h=>{(h.points||[]).filter(p=>p.openStatus!==!1).filter(p=>{if(!p.startTime||!p.endTime)return!0;let[m,y]=p.startTime.split(":").map(C=>+C),[x,E]=p.endTime.split(":").map(C=>+C),b=m*60+y,S=x*60+E;return l>=b&&l<=S}).forEach(p=>{p.floor=h.floor;let m=`${h.floor}${Qn}${p.id}`;if(this.nodeMap.set(`${h.floor}${Qn}${p.nodeId}`,`${h.floor}${Qn}${p.relatedId||p.id}`),this.pointMap.set(m,p),this.isFacilityByType(p.type)){let y=this.facilities.find(x=>x.id===+p.targetId);if(y){switch(y.entry_infra_type){case"straightLadder":if(y.entry_end_floor.find(S=>S.floor===h.floor)&&y.entry_start_floor.find(S=>S.floor===h.floor)){let S=this.straightLadderMap.get(p.targetId)||[];S.push({...p}),this.straightLadderMap.set(p.targetId,S)}break;case"staircase":if(y.entry_end_floor.find(S=>S.floor===h.floor)&&y.entry_start_floor.find(S=>S.floor===h.floor)){let S=this.staircaseMap.get(p.targetId)||[];S.push({...p}),this.staircaseMap.set(p.targetId,S)}break;case"escalator":let E=this.escalatorMap.get(p.targetId)||[];if(y.entry_start_floor.find(S=>S.floor===h.floor)){let S=E.find(C=>C.end?.floor!==h.floor&&!C.start);S?S.start=p:E.push({start:p})}if(y.entry_end_floor.find(S=>S.floor===h.floor)){let S=E.find(C=>C.start?.floor!==h.floor&&!C.end);S?S.end=p:E.push({end:p})}this.escalatorMap.set(p.targetId,E);break;case"ramp":let b=this.rampMap.get(p.targetId)||[];if(y.entry_start_floor.find(S=>S.floor===h.floor)){let S=b.find(C=>C.end?.floor!==h.floor&&!C.start);S?S.start=p:b.push({start:p})}if(y.entry_end_floor.find(S=>S.floor===h.floor)){let S=b.find(C=>C.start?.floor!==h.floor&&!C.end);S?S.end=p:b.push({end:p})}this.rampMap.set(p.targetId,b);break}let x=this.facilityMap.get(p.targetId)||[];x.push({...p}),this.facilityMap.set(p.targetId,x)}}p.type==="parkingSpace"&&this.parkingMap.set(`${h.floor}${Qn}${p.name}`,p)}),(h.lines||[]).filter(p=>p.direction!=="no").forEach(p=>{let m=`${h.floor}${Qn}${p.from}`,y=`${h.floor}${Qn}${p.to}`,x=this.pointMap.get(m),E=this.pointMap.get(y);if(!x||!E)return;let b=x.cds,S=E.cds,C=Pa(b,S);if(!x.permission&&!E.permission)switch(this.addLineItem(m,y,C),this.addLineItem(y,m,C),p.direction){case"double":this.addLineItem(m,y,C,this.forwardLineMap),this.addLineItem(y,m,C,this.forwardLineMap);break;case"single":this.addLineItem(m,y,C,this.forwardLineMap);break;case"back":this.addLineItem(y,m,C,this.forwardLineMap);break}else x.permission&&(this.setPermissionLine(m,y,x.permission,C,""),this.setPermissionLine(y,m,x.permission,C,"")),E.permission&&E.permission!==x.permission&&(this.setPermissionLine(m,y,E.permission,C,""),this.setPermissionLine(y,m,E.permission,C,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(e){return this[`permission_${e}`]||(this[`permission_${e}`]=new Set),this[`permission_${e}`]}setPermissionLine(e,r,u,l,h){this.getPermissionMap(u).add({fromKey:e,toKey:r,distance:l,type:h})}addPermissionFacility(){this.straightLadderMap.forEach((e,r)=>{if(e.length<2){this.straightLadderMap.delete(r);return}for(let u=0;u<e.length;u++){let l=`${e[u].floor}${Qn}${e[u].id}`,h=this.pointMap.get(l);if(h){for(let p=0;p<e.length;p++)if(u!==p){let m=`${e[p].floor}${Qn}${e[p].id}`,y=this.pointMap.get(m);if(!y)continue;h.permission&&this.setPermissionLine(l,m,h.permission,1,"straightLadder"),y.permission&&y.permission!==h.permission&&this.setPermissionLine(l,m,y.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((e,r)=>{if(e.length<2){this.staircaseMap.delete(r);return}for(let u=0;u<e.length;u++){let l=`${e[u].floor}${Qn}${e[u].id}`,h=this.pointMap.get(l);if(h){for(let p=0;p<e.length;p++)if(u!==p){let m=`${e[p].floor}${Qn}${e[p].id}`,y=this.pointMap.get(m);if(!y)continue;h.permission&&this.setPermissionLine(l,m,h.permission,1,"staircase"),y.permission&&y.permission!==h.permission&&this.setPermissionLine(l,m,y.permission,1,"straightLadder")}}}}),this.escalatorMap.forEach((e,r)=>{e.forEach(u=>{if(u.start&&u.end){let l=`${u.start.floor}${Qn}${u.start.id}`,h=`${u.end.floor}${Qn}${u.end.id}`,p=this.pointMap.get(l),m=this.pointMap.get(h);p&&m&&(p.permission&&this.setPermissionLine(l,h,p.permission,1,"escalator"),m.permission&&m.permission!==p.permission&&this.setPermissionLine(l,h,m.permission,1,"escalator"))}})}),this.rampMap.forEach((e,r)=>{e.forEach(u=>{if(u.start&&u.end){let l=`${u.start.floor}${Qn}${u.start.id}`,h=`${u.end.floor}${Qn}${u.end.id}`,p=this.pointMap.get(l),m=this.pointMap.get(h);p&&m&&(p.permission&&this.setPermissionLine(l,h,p.permission,10,"ramp"),m.permission&&m.permission!==p.permission&&this.setPermissionLine(l,h,m.permission,10,"ramp"))}})})}addPermissionLineToMap(e,r,u,l){let h=this.getPermissionMap(e);console.log(h),h.forEach(p=>{r.includes(p.type)&&(p.type===""?this.addLineItem(p.fromKey,p.toKey,p.distance,u):this.addLineItem(p.fromKey,p.toKey,l.get(p.type),u))})}addLineItem(e,r,u,l=this.lineMap){let h=l.get(e)||new Map;h.set(r,u),l.set(e,h)}addFacilityToLineMap(e,r,u,l){[...this.straightLadderMap,...this.staircaseMap].forEach(([h,p])=>{if(!(p.length<2))for(let m=0;m<p.length;m++){let y=`${p[m].floor}${Qn}${p[m].id}`,x=this.pointMap.get(y);if(!(!x||x.permission)){for(let E=0;E<p.length;E++)if(m!==E){let b=`${p[E].floor}${Qn}${p[E].id}`,S=this.pointMap.get(b);if(!S||S.permission)continue;if(p[m].type==="straightLadder"){let C=r;this.addLineItem(y,b,C,l)}else{let C=u;this.addLineItem(y,b,C,l)}}}}}),this.escalatorMap.forEach((h,p)=>{h.forEach(m=>{if(m.start&&m.end){let y=`${m.start.floor}${Qn}${m.start.id}`,x=`${m.end.floor}${Qn}${m.end.id}`,E=this.pointMap.get(y),b=this.pointMap.get(x);if(E&&b&&!E.permission&&!b.permission){let S=e;this.addLineItem(y,x,S,l)}}})})}initBaseRoute(){let e=new Map((0,Ra.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,e),this.baseRoute=new Li.default(e)}initEscalatorRoute(){let e=new Map((0,Ra.cloneDeep)([...this.lineMap])),r=1e4;this.addFacilityToLineMap(1*r,this.lift_priority*r,3e4*r,e),this.escalatorRoute=new Li.default(e)}initStraightLadderRoute(){let e=new Map((0,Ra.cloneDeep)([...this.lineMap])),r=1e4;this.addFacilityToLineMap(3*r,1*r,3e4*r,e),this.straightLadderRoute=new Li.default(e)}initForwardRoute(){this.rampMap.forEach((e,r)=>{e.forEach(u=>{if(u.start&&u.end){let l=`${u.start.floor}${Qn}${u.start.id}`,h=`${u.end.floor}${Qn}${u.end.id}`,p=this.pointMap.get(l),m=this.pointMap.get(h);p&&m&&!p.permission&&!m.permission&&this.addLineItem(l,h,10,this.forwardLineMap)}})}),this.forwardRoute=new Li.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let r=this.nodeMap.get(`${e.floor}${Qn}${e.nodeId}`);if(r){let[u,l]=r.split(Qn);return{floor:u,id:l}}}if(e.coord?.length){let r=this.roadInfo.find(l=>l.floor===e.floor);if(!r)return null;let u=r.points.reduce((l,h)=>{if(h.relatedId)return l;let p=Pa(e.coord,h.cds);return p<l.min&&(l.min=p,l.point=h),l},{min:1/0,point:r.points[0]});return{floor:r.floor,id:u.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let u=this.parkingMap.get(`${e.floor}${Qn}${e.parkingSpace}`);if(u)return{floor:e.floor,id:u.id}}let r=this.transformStart(e);if(r)return r}return e.facility&&this.facilities.filter(l=>+l.type_id==+e.facility).map(l=>l.id).map(l=>this.facilityMap.get(`${l}`)).flat(2)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,r,u="",l){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(r))return"end-error";let h=this.transformStart(e);if(!h)return"no-start";let p=this.transformEnd(r);if(!p)return"no-end";let m=this.getBasePath.bind(this);switch(u){case"escalator":m=this.getEscalatorPath.bind(this);break;case"straightLadder":m=this.getStraightLadderPath.bind(this);break;case"forward":m=this.getForwardPath.bind(this);break;default:m=this.getBasePath.bind(this);break}if(p.id)return m(h,p,l);if(p.facility){let x=this.facilities.filter(b=>+b.type_id==+r.facility).map(b=>b.id).map(b=>this.facilityMap.get(`${b}`)).flat(2).filter(b=>b).filter(b=>p.floor?b.floor===p.floor:!0);if(!x.length)return null;let E=x.map(b=>m(h,{floor:b.floor,id:b.id},l)).filter(b=>!!b);return E.reduce((b,S)=>{let C=S[0].consume;return C<b.distance&&(b.distance=C,b.path=S),b},{distance:1/0,path:E[0]}).path}}getRoutePath(e,r,u){let l=`${e.floor}${Qn}${e.id}`,h=`${r.floor}${Qn}${r.id}`,p=u.path(l,h);if(!p)return null;let m=[],y=p.reduce((x,E,b,S)=>{if(b===0)return 0;let C=S[b-1],D=u.graph.get(C).get(E);return x+D},0);return p.map(x=>{let E=this.pointMap.get(x);if(E){let{floor:b}=E,S=E.type;if(this.isFacilityByType(E.type)){let C=this.facilities.find(D=>D.id===+E.targetId);C&&(S=C.entry_infra_type)}if(m[m.length-1]?.floor===b){let C=m[m.length-1];C.points.push(E.cds),C.endType=S,C.destId=E.nodeId,C.distance=q1(C.points)}else m.push({floor:b,points:[E.cds],endType:S,destId:E.nodeId,distance:0,consume:y})}}),m}getBasePath(e,r,u){if(!u)return this.getRoutePath(e,r,this.baseRoute);let l=(0,Ra.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(u,["","escalator","staircase","straightLadder"],l,new Map([["escalator",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let h=new Li.default(l);return this.getRoutePath(e,r,h)}getEscalatorPath(e,r,u){if(!u)return this.getRoutePath(e,r,this.escalatorRoute);let l=(0,Ra.cloneDeep)(this.escalatorRoute.graph),h=1e4;this.addPermissionLineToMap(u,["","escalator","staircase","straightLadder"],l,new Map([["escalator",1*h],["straightLadder",this.lift_priority*h],["staircase",3e4*h]]));let p=new Li.default(l);return this.getRoutePath(e,r,p)}getStraightLadderPath(e,r,u){if(!u)return this.getRoutePath(e,r,this.straightLadderRoute);let l=(0,Ra.cloneDeep)(this.straightLadderRoute.graph),h=1e4;this.addPermissionLineToMap(u,["","escalator","staircase","straightLadder"],l,new Map([["escalator",3*h],["straightLadder",1*h],["staircase",3e4*h]]));let p=new Li.default(l);return this.getRoutePath(e,r,p)}getForwardPath(e,r,u){if(!u)return this.getRoutePath(e,r,this.forwardRoute);let l=(0,Ra.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(u,["","ramp"],l,new Map([["ramp",10]]));let h=new Li.default(l);return this.getRoutePath(e,r,h)}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 Li.default,this.escalatorRoute=new Li.default,this.straightLadderRoute=new Li.default}};var hN=nr(Q1(),1);function pN(o,e,r){let u=X1(o,e,r);return 180-Math.abs(u)<15?"front":u>135?"right_front":u<-135?"left_front":u<=135&&u>=60?"right":u>=-135&&u<=-60?"left":u<60&&u>0?"right_back":u>-60&&u<0?"left_back":"front"}function j1(o){if(!o.length)return[];if(o.length===1)return[{direction:"start",distance:0,points:o}];let e=[{direction:"start",distance:Pa(o[0],o[1]),points:[o[0],o[1]]}];for(let r=2;r<o.length;r++){let u=pN(o[r-2],o[r-1],o[r]);if(u==="front"){let l=e[e.length-1],h=Pa(o[r-1],o[r]);l.distance+=h,r!==2&&l.points.push(o[r-1])}else e.push({direction:u,distance:Pa(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 tx(o){return o.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function ex(o){let e={};for(let u in o)u.startsWith("on")&&(e[tx(u.slice(2))]=o[u]);let r=async({data:u})=>{if(e[u.type])try{let l=await e[u.type](u.data);self.postMessage({type:`${u.type}_result`,key:u.key,data:l})}catch(l){self.postMessage({type:`${u.type}_result`,key:u.key,error:l})}else self.postMessage({type:`${u.type}_result`,key:u.key,error:"no_event"})};return self.addEventListener("message",r),()=>{self.removeEventListener("message",r)}}var Kd=new kf;ex({onSetRoadInfo({roadData:o,facilities:e}){Kd.initRoute(o,e)},onGetPath({start:o,end:e,type:r,permission:u}){return Kd.getPath(o,e,r,u)},onGetDirectionPath(o){return j1(o)},onClear(){Kd.clear()}});\n'], { type: "text/javascript" });
|
|
11719
|
+
let blob = new Blob(['var Ab=Object.create;var Nm=Object.defineProperty;var Tb=Object.getOwnPropertyDescriptor;var Cb=Object.getOwnPropertyNames;var Ib=Object.getPrototypeOf,Pb=Object.prototype.hasOwnProperty;var It=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var Rb=(o,e,r,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of Cb(e))!Pb.call(o,l)&&l!==r&&Nm(o,l,{get:()=>e[l],enumerable:!(u=Tb(e,l))||u.enumerable});return o};var nr=(o,e,r)=>(r=o!=null?Ab(Ib(o)):{},Rb(e||!o||!o.__esModule?Nm(r,"default",{value:o,enumerable:!0}):r,o));var Om=It((gN,Dm)=>{var Nh=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,r)=>e.priority-r.priority)}set(e,r){let u=Number(r);if(isNaN(u))throw new TypeError(\'"priority" must be a number\');return this.keys.has(e)?this.queue.map(l=>(l.key===e&&Object.assign(l,{priority:u}),l)):(this.keys.add(e),this.queue.push({key:e,priority:u})),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)}};Dm.exports=Nh});var Bm=It((mN,Um)=>{function Fm(o,e){let r=new Map;for(let[u,l]of o)u!==e&&l instanceof Map?r.set(u,Fm(l,e)):u!==e&&r.set(u,l);return r}Um.exports=Fm});var Gm=It((yN,km)=>{function Lb(o){let e=Number(o);return!(isNaN(e)||e<=0)}function zm(o){let e=new Map;return Object.keys(o).forEach(u=>{let l=o[u];if(l!==null&&typeof l=="object"&&!Array.isArray(l))return e.set(u,zm(l));if(!Lb(l))throw new Error(`Could not add node at key "${u}", make sure it\'s a valid node`,l);return e.set(u,Number(l))}),e}km.exports=zm});var Wm=It((vN,Vm)=>{function Hm(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){Hm(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${r}`)})}Vm.exports=Hm});var $m=It((_N,Ym)=>{var Nb=Om(),Db=Bm(),qm=Gm(),Xm=Wm(),Dh=class{constructor(e){e instanceof Map?(Xm(e),this.graph=e):e?this.graph=qm(e):this.graph=new Map}addNode(e,r){let u;return r instanceof Map?(Xm(r),u=r):u=qm(r),this.graph.set(e,u),this}addVertex(e,r){return this.addNode(e,r)}removeNode(e){return this.graph=Db(this.graph,e),this}path(e,r,u={}){if(!this.graph.size)return u.cost?{path:null,cost:0}:null;let l=new Set,h=new Nb,p=new Map,m=[],y=0,x=[];if(u.avoid&&(x=[].concat(u.avoid)),x.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(x.includes(r))throw new Error(`Ending node (${r}) cannot be avoided`);for(h.set(e,0);!h.isEmpty();){let E=h.next();if(E.key===r){y=E.priority;let M=E.key;for(;p.has(M);)m.push(M),M=p.get(M);break}l.add(E.key),(this.graph.get(E.key)||new Map).forEach((M,C)=>{if(l.has(C)||x.includes(C))return null;if(!h.has(C))return p.set(C,E.key),h.set(C,E.priority+M);let D=h.get(C).priority,G=E.priority+M;return G<D?(p.set(C,E.key),h.set(C,G)):null})}return m.length?(u.trim?m.shift():m=m.concat([e]),u.reverse||(m=m.reverse()),u.cost?{path:m,cost:y}:m):u.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};Ym.exports=Dh});var Oc=It((ON,R0)=>{"use strict";var P0=Object.getOwnPropertySymbols,VC=Object.prototype.hasOwnProperty,WC=Object.prototype.propertyIsEnumerable;function qC(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function XC(){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 u=Object.getOwnPropertyNames(e).map(function(h){return e[h]});if(u.join("")!=="0123456789")return!1;var l={};return"abcdefghijklmnopqrst".split("").forEach(function(h){l[h]=h}),Object.keys(Object.assign({},l)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}R0.exports=XC()?Object.assign:function(o,e){for(var r,u=qC(o),l,h=1;h<arguments.length;h++){r=Object(arguments[h]);for(var p in r)VC.call(r,p)&&(u[p]=r[p]);if(P0){l=P0(r);for(var m=0;m<l.length;m++)WC.call(r,l[m])&&(u[l[m]]=r[l[m]])}}return u}});var pp=It((fp,hp)=>{(function(o,e){typeof fp=="object"&&typeof hp<"u"?hp.exports=e():typeof define=="function"&&define.amd?define(e):(o=o||self).RBush=e()})(fp,function(){"use strict";function o(O,L,k,F,$){(function Z(it,et,U,wt,Lt){for(;wt>U;){if(wt-U>600){var Ot=wt-U+1,W=et-U+1,de=Math.log(Ot),yt=.5*Math.exp(2*de/3),zt=.5*Math.sqrt(de*yt*(Ot-yt)/Ot)*(W-Ot/2<0?-1:1),Kt=Math.max(U,Math.floor(et-W*yt/Ot+zt)),ie=Math.min(wt,Math.floor(et+(Ot-W)*yt/Ot+zt));Z(it,et,Kt,ie,Lt)}var _t=it[et],Pt=U,q=wt;for(e(it,U,et),Lt(it[wt],_t)>0&&e(it,U,wt);Pt<q;){for(e(it,Pt,q),Pt++,q--;Lt(it[Pt],_t)<0;)Pt++;for(;Lt(it[q],_t)>0;)q--}Lt(it[U],_t)===0?e(it,U,q):e(it,++q,wt),q<=et&&(U=q+1),et<=q&&(wt=q-1)}})(O,L,k||0,F||O.length-1,$||r)}function e(O,L,k){var F=O[L];O[L]=O[k],O[k]=F}function r(O,L){return O<L?-1:O>L?1:0}var u=function(O){O===void 0&&(O=9),this._maxEntries=Math.max(4,O),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function l(O,L,k){if(!k)return L.indexOf(O);for(var F=0;F<L.length;F++)if(k(O,L[F]))return F;return-1}function h(O,L){p(O,0,O.children.length,L,O)}function p(O,L,k,F,$){$||($=D(null)),$.minX=1/0,$.minY=1/0,$.maxX=-1/0,$.maxY=-1/0;for(var Z=L;Z<k;Z++){var it=O.children[Z];m($,O.leaf?F(it):it)}return $}function m(O,L){return O.minX=Math.min(O.minX,L.minX),O.minY=Math.min(O.minY,L.minY),O.maxX=Math.max(O.maxX,L.maxX),O.maxY=Math.max(O.maxY,L.maxY),O}function y(O,L){return O.minX-L.minX}function x(O,L){return O.minY-L.minY}function E(O){return(O.maxX-O.minX)*(O.maxY-O.minY)}function b(O){return O.maxX-O.minX+(O.maxY-O.minY)}function M(O,L){return O.minX<=L.minX&&O.minY<=L.minY&&L.maxX<=O.maxX&&L.maxY<=O.maxY}function C(O,L){return L.minX<=O.maxX&&L.minY<=O.maxY&&L.maxX>=O.minX&&L.maxY>=O.minY}function D(O){return{children:O,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function G(O,L,k,F,$){for(var Z=[L,k];Z.length;)if(!((k=Z.pop())-(L=Z.pop())<=F)){var it=L+Math.ceil((k-L)/F/2)*F;o(O,it,L,k,$),Z.push(L,it,it,k)}}return u.prototype.all=function(){return this._all(this.data,[])},u.prototype.search=function(O){var L=this.data,k=[];if(!C(O,L))return k;for(var F=this.toBBox,$=[];L;){for(var Z=0;Z<L.children.length;Z++){var it=L.children[Z],et=L.leaf?F(it):it;C(O,et)&&(L.leaf?k.push(it):M(O,et)?this._all(it,k):$.push(it))}L=$.pop()}return k},u.prototype.collides=function(O){var L=this.data;if(!C(O,L))return!1;for(var k=[];L;){for(var F=0;F<L.children.length;F++){var $=L.children[F],Z=L.leaf?this.toBBox($):$;if(C(O,Z)){if(L.leaf||M(O,Z))return!0;k.push($)}}L=k.pop()}return!1},u.prototype.load=function(O){if(!O||!O.length)return this;if(O.length<this._minEntries){for(var L=0;L<O.length;L++)this.insert(O[L]);return this}var k=this._build(O.slice(),0,O.length-1,0);if(this.data.children.length)if(this.data.height===k.height)this._splitRoot(this.data,k);else{if(this.data.height<k.height){var F=this.data;this.data=k,k=F}this._insert(k,this.data.height-k.height-1,!0)}else this.data=k;return this},u.prototype.insert=function(O){return O&&this._insert(O,this.data.height-1),this},u.prototype.clear=function(){return this.data=D([]),this},u.prototype.remove=function(O,L){if(!O)return this;for(var k,F,$,Z=this.data,it=this.toBBox(O),et=[],U=[];Z||et.length;){if(Z||(Z=et.pop(),F=et[et.length-1],k=U.pop(),$=!0),Z.leaf){var wt=l(O,Z.children,L);if(wt!==-1)return Z.children.splice(wt,1),et.push(Z),this._condense(et),this}$||Z.leaf||!M(Z,it)?F?(k++,Z=F.children[k],$=!1):Z=null:(et.push(Z),U.push(k),k=0,F=Z,Z=Z.children[0])}return this},u.prototype.toBBox=function(O){return O},u.prototype.compareMinX=function(O,L){return O.minX-L.minX},u.prototype.compareMinY=function(O,L){return O.minY-L.minY},u.prototype.toJSON=function(){return this.data},u.prototype.fromJSON=function(O){return this.data=O,this},u.prototype._all=function(O,L){for(var k=[];O;)O.leaf?L.push.apply(L,O.children):k.push.apply(k,O.children),O=k.pop();return L},u.prototype._build=function(O,L,k,F){var $,Z=k-L+1,it=this._maxEntries;if(Z<=it)return h($=D(O.slice(L,k+1)),this.toBBox),$;F||(F=Math.ceil(Math.log(Z)/Math.log(it)),it=Math.ceil(Z/Math.pow(it,F-1))),($=D([])).leaf=!1,$.height=F;var et=Math.ceil(Z/it),U=et*Math.ceil(Math.sqrt(it));G(O,L,k,U,this.compareMinX);for(var wt=L;wt<=k;wt+=U){var Lt=Math.min(wt+U-1,k);G(O,wt,Lt,et,this.compareMinY);for(var Ot=wt;Ot<=Lt;Ot+=et){var W=Math.min(Ot+et-1,Lt);$.children.push(this._build(O,Ot,W,F-1))}}return h($,this.toBBox),$},u.prototype._chooseSubtree=function(O,L,k,F){for(;F.push(L),!L.leaf&&F.length-1!==k;){for(var $=1/0,Z=1/0,it=void 0,et=0;et<L.children.length;et++){var U=L.children[et],wt=E(U),Lt=(Ot=O,W=U,(Math.max(W.maxX,Ot.maxX)-Math.min(W.minX,Ot.minX))*(Math.max(W.maxY,Ot.maxY)-Math.min(W.minY,Ot.minY))-wt);Lt<Z?(Z=Lt,$=wt<$?wt:$,it=U):Lt===Z&&wt<$&&($=wt,it=U)}L=it||L.children[0]}var Ot,W;return L},u.prototype._insert=function(O,L,k){var F=k?O:this.toBBox(O),$=[],Z=this._chooseSubtree(F,this.data,L,$);for(Z.children.push(O),m(Z,F);L>=0&&$[L].children.length>this._maxEntries;)this._split($,L),L--;this._adjustParentBBoxes(F,$,L)},u.prototype._split=function(O,L){var k=O[L],F=k.children.length,$=this._minEntries;this._chooseSplitAxis(k,$,F);var Z=this._chooseSplitIndex(k,$,F),it=D(k.children.splice(Z,k.children.length-Z));it.height=k.height,it.leaf=k.leaf,h(k,this.toBBox),h(it,this.toBBox),L?O[L-1].children.push(it):this._splitRoot(k,it)},u.prototype._splitRoot=function(O,L){this.data=D([O,L]),this.data.height=O.height+1,this.data.leaf=!1,h(this.data,this.toBBox)},u.prototype._chooseSplitIndex=function(O,L,k){for(var F,$,Z,it,et,U,wt,Lt=1/0,Ot=1/0,W=L;W<=k-L;W++){var de=p(O,0,W,this.toBBox),yt=p(O,W,k,this.toBBox),zt=($=de,Z=yt,it=void 0,et=void 0,U=void 0,wt=void 0,it=Math.max($.minX,Z.minX),et=Math.max($.minY,Z.minY),U=Math.min($.maxX,Z.maxX),wt=Math.min($.maxY,Z.maxY),Math.max(0,U-it)*Math.max(0,wt-et)),Kt=E(de)+E(yt);zt<Lt?(Lt=zt,F=W,Ot=Kt<Ot?Kt:Ot):zt===Lt&&Kt<Ot&&(Ot=Kt,F=W)}return F||k-L},u.prototype._chooseSplitAxis=function(O,L,k){var F=O.leaf?this.compareMinX:y,$=O.leaf?this.compareMinY:x;this._allDistMargin(O,L,k,F)<this._allDistMargin(O,L,k,$)&&O.children.sort(F)},u.prototype._allDistMargin=function(O,L,k,F){O.children.sort(F);for(var $=this.toBBox,Z=p(O,0,L,$),it=p(O,k-L,k,$),et=b(Z)+b(it),U=L;U<k-L;U++){var wt=O.children[U];m(Z,O.leaf?$(wt):wt),et+=b(Z)}for(var Lt=k-L-1;Lt>=L;Lt--){var Ot=O.children[Lt];m(it,O.leaf?$(Ot):Ot),et+=b(it)}return et},u.prototype._adjustParentBBoxes=function(O,L,k){for(var F=k;F>=0;F--)m(L[F],O)},u.prototype._condense=function(O){for(var L=O.length-1,k=void 0;L>=0;L--)O[L].children.length===0?L>0?(k=O[L-1].children).splice(k.indexOf(O[L]),1):this.clear():h(O[L],this.toBBox)},u})});var L0=It((dp,gp)=>{(function(o,e){typeof dp=="object"&&typeof gp<"u"?gp.exports=e():typeof define=="function"&&define.amd?define(e):(o=o||self,o.TinyQueue=e())})(dp,function(){"use strict";var o=function(u,l){if(u===void 0&&(u=[]),l===void 0&&(l=e),this.data=u,this.length=this.data.length,this.compare=l,this.length>0)for(var h=(this.length>>1)-1;h>=0;h--)this._down(h)};o.prototype.push=function(u){this.data.push(u),this.length++,this._up(this.length-1)},o.prototype.pop=function(){if(this.length!==0){var u=this.data[0],l=this.data.pop();return this.length--,this.length>0&&(this.data[0]=l,this._down(0)),u}},o.prototype.peek=function(){return this.data[0]},o.prototype._up=function(u){for(var l=this,h=l.data,p=l.compare,m=h[u];u>0;){var y=u-1>>1,x=h[y];if(p(m,x)>=0)break;h[u]=x,u=y}h[u]=m},o.prototype._down=function(u){for(var l=this,h=l.data,p=l.compare,m=this.length>>1,y=h[u];u<m;){var x=(u<<1)+1,E=h[x],b=x+1;if(b<this.length&&p(h[b],E)<0&&(x=b,E=h[b]),p(E,y)>=0)break;h[u]=E,u=x}h[u]=y};function e(r,u){return r<u?-1:r>u?1:0}return o})});var D0=It((GN,N0)=>{N0.exports=function(e,r,u,l){var h=e[0],p=e[1],m=!1;u===void 0&&(u=0),l===void 0&&(l=r.length);for(var y=(l-u)/2,x=0,E=y-1;x<y;E=x++){var b=r[u+x*2+0],M=r[u+x*2+1],C=r[u+E*2+0],D=r[u+E*2+1],G=M>p!=D>p&&h<(C-b)*(p-M)/(D-M)+b;G&&(m=!m)}return m}});var F0=It((HN,O0)=>{O0.exports=function(e,r,u,l){var h=e[0],p=e[1],m=!1;u===void 0&&(u=0),l===void 0&&(l=r.length);for(var y=l-u,x=0,E=y-1;x<y;E=x++){var b=r[x+u][0],M=r[x+u][1],C=r[E+u][0],D=r[E+u][1],G=M>p!=D>p&&h<(C-b)*(p-M)/(D-M)+b;G&&(m=!m)}return m}});var z0=It((VN,Bc)=>{var U0=D0(),B0=F0();Bc.exports=function(e,r,u,l){return r.length>0&&Array.isArray(r[0])?B0(e,r,u,l):U0(e,r,u,l)};Bc.exports.nested=B0;Bc.exports.flat=U0});var G0=It((zc,k0)=>{(function(o,e){typeof zc=="object"&&typeof k0<"u"?e(zc):typeof define=="function"&&define.amd?define(["exports"],e):e((o=o||self).predicates={})})(zc,function(o){"use strict";let r=33306690738754706e-32;function u(C,D,G,O,L){let k,F,$,Z,it=D[0],et=O[0],U=0,wt=0;et>it==et>-it?(k=it,it=D[++U]):(k=et,et=O[++wt]);let Lt=0;if(U<C&&wt<G)for(et>it==et>-it?($=k-((F=it+k)-it),it=D[++U]):($=k-((F=et+k)-et),et=O[++wt]),k=F,$!==0&&(L[Lt++]=$);U<C&&wt<G;)et>it==et>-it?($=k-((F=k+it)-(Z=F-k))+(it-Z),it=D[++U]):($=k-((F=k+et)-(Z=F-k))+(et-Z),et=O[++wt]),k=F,$!==0&&(L[Lt++]=$);for(;U<C;)$=k-((F=k+it)-(Z=F-k))+(it-Z),it=D[++U],k=F,$!==0&&(L[Lt++]=$);for(;wt<G;)$=k-((F=k+et)-(Z=F-k))+(et-Z),et=O[++wt],k=F,$!==0&&(L[Lt++]=$);return k===0&&Lt!==0||(L[Lt++]=k),Lt}function l(C){return new Float64Array(C)}let h=33306690738754716e-32,p=22204460492503146e-32,m=11093356479670487e-47,y=l(4),x=l(8),E=l(12),b=l(16),M=l(4);o.orient2d=function(C,D,G,O,L,k){let F=(D-k)*(G-L),$=(C-L)*(O-k),Z=F-$;if(F===0||$===0||F>0!=$>0)return Z;let it=Math.abs(F+$);return Math.abs(Z)>=h*it?Z:-function(et,U,wt,Lt,Ot,W,de){let yt,zt,Kt,ie,_t,Pt,q,oe,Vt,tn,Mt,mn,Vn,yn,Ge,an,Et,Pr,Jt=et-Ot,jn=wt-Ot,hn=U-W,vn=Lt-W;_t=(Ge=(oe=Jt-(q=(Pt=134217729*Jt)-(Pt-Jt)))*(tn=vn-(Vt=(Pt=134217729*vn)-(Pt-vn)))-((yn=Jt*vn)-q*Vt-oe*Vt-q*tn))-(Mt=Ge-(Et=(oe=hn-(q=(Pt=134217729*hn)-(Pt-hn)))*(tn=jn-(Vt=(Pt=134217729*jn)-(Pt-jn)))-((an=hn*jn)-q*Vt-oe*Vt-q*tn))),y[0]=Ge-(Mt+_t)+(_t-Et),_t=(Vn=yn-((mn=yn+Mt)-(_t=mn-yn))+(Mt-_t))-(Mt=Vn-an),y[1]=Vn-(Mt+_t)+(_t-an),_t=(Pr=mn+Mt)-mn,y[2]=mn-(Pr-_t)+(Mt-_t),y[3]=Pr;let Fn=function(wi,Mi){let qr=Mi[0];for(let Rr=1;Rr<wi;Rr++)qr+=Mi[Rr];return qr}(4,y),xr=p*de;if(Fn>=xr||-Fn>=xr||(yt=et-(Jt+(_t=et-Jt))+(_t-Ot),Kt=wt-(jn+(_t=wt-jn))+(_t-Ot),zt=U-(hn+(_t=U-hn))+(_t-W),ie=Lt-(vn+(_t=Lt-vn))+(_t-W),yt===0&&zt===0&&Kt===0&&ie===0)||(xr=m*de+r*Math.abs(Fn),(Fn+=Jt*ie+vn*yt-(hn*Kt+jn*zt))>=xr||-Fn>=xr))return Fn;_t=(Ge=(oe=yt-(q=(Pt=134217729*yt)-(Pt-yt)))*(tn=vn-(Vt=(Pt=134217729*vn)-(Pt-vn)))-((yn=yt*vn)-q*Vt-oe*Vt-q*tn))-(Mt=Ge-(Et=(oe=zt-(q=(Pt=134217729*zt)-(Pt-zt)))*(tn=jn-(Vt=(Pt=134217729*jn)-(Pt-jn)))-((an=zt*jn)-q*Vt-oe*Vt-q*tn))),M[0]=Ge-(Mt+_t)+(_t-Et),_t=(Vn=yn-((mn=yn+Mt)-(_t=mn-yn))+(Mt-_t))-(Mt=Vn-an),M[1]=Vn-(Mt+_t)+(_t-an),_t=(Pr=mn+Mt)-mn,M[2]=mn-(Pr-_t)+(Mt-_t),M[3]=Pr;let ui=u(4,y,4,M,x);_t=(Ge=(oe=Jt-(q=(Pt=134217729*Jt)-(Pt-Jt)))*(tn=ie-(Vt=(Pt=134217729*ie)-(Pt-ie)))-((yn=Jt*ie)-q*Vt-oe*Vt-q*tn))-(Mt=Ge-(Et=(oe=hn-(q=(Pt=134217729*hn)-(Pt-hn)))*(tn=Kt-(Vt=(Pt=134217729*Kt)-(Pt-Kt)))-((an=hn*Kt)-q*Vt-oe*Vt-q*tn))),M[0]=Ge-(Mt+_t)+(_t-Et),_t=(Vn=yn-((mn=yn+Mt)-(_t=mn-yn))+(Mt-_t))-(Mt=Vn-an),M[1]=Vn-(Mt+_t)+(_t-an),_t=(Pr=mn+Mt)-mn,M[2]=mn-(Pr-_t)+(Mt-_t),M[3]=Pr;let Nt=u(ui,x,4,M,E);_t=(Ge=(oe=yt-(q=(Pt=134217729*yt)-(Pt-yt)))*(tn=ie-(Vt=(Pt=134217729*ie)-(Pt-ie)))-((yn=yt*ie)-q*Vt-oe*Vt-q*tn))-(Mt=Ge-(Et=(oe=zt-(q=(Pt=134217729*zt)-(Pt-zt)))*(tn=Kt-(Vt=(Pt=134217729*Kt)-(Pt-Kt)))-((an=zt*Kt)-q*Vt-oe*Vt-q*tn))),M[0]=Ge-(Mt+_t)+(_t-Et),_t=(Vn=yn-((mn=yn+Mt)-(_t=mn-yn))+(Mt-_t))-(Mt=Vn-an),M[1]=Vn-(Mt+_t)+(_t-an),_t=(Pr=mn+Mt)-mn,M[2]=mn-(Pr-_t)+(Mt-_t),M[3]=Pr;let He=u(Nt,E,4,M,b);return b[He-1]}(C,D,G,O,L,k,it)},o.orient2dfast=function(C,D,G,O,L,k){return(D-k)*(G-L)-(C-L)*(O-k)},Object.defineProperty(o,"__esModule",{value:!0})})});var Y0=It((WN,_p)=>{"use strict";var H0=pp(),Gc=L0(),$C=z0(),ZC=G0().orient2d;Gc.default&&(Gc=Gc.default);_p.exports=X0;_p.exports.default=X0;function X0(o,e,r){e=Math.max(0,e===void 0?2:e),r=r||0;var u=tI(o),l=new H0(16);l.toBBox=function(k){return{minX:k[0],minY:k[1],maxX:k[0],maxY:k[1]}},l.compareMinX=function(k,F){return k[0]-F[0]},l.compareMinY=function(k,F){return k[1]-F[1]},l.load(o);for(var h=[],p=0,m;p<u.length;p++){var y=u[p];l.remove(y),m=q0(y,m),h.push(m)}var x=new H0(16);for(p=0;p<h.length;p++)x.insert(mp(h[p]));for(var E=e*e,b=r*r;h.length;){var M=h.shift(),C=M.p,D=M.next.p,G=yp(C,D);if(!(G<b)){var O=G/E;y=JC(l,M.prev.p,C,D,M.next.next.p,O,x),y&&Math.min(yp(y,C),yp(y,D))<=O&&(h.push(M),h.push(q0(y,M)),l.remove(y),x.remove(M),x.insert(mp(M)),x.insert(mp(M.next)))}}M=m;var L=[];do L.push(M.p),M=M.next;while(M!==m);return L.push(M.p),L}function JC(o,e,r,u,l,h,p){for(var m=new Gc([],KC),y=o.data;y;){for(var x=0;x<y.children.length;x++){var E=y.children[x],b=y.leaf?vp(E,r,u):QC(r,u,E);b>h||m.push({node:E,dist:b})}for(;m.length&&!m.peek().node.children;){var M=m.pop(),C=M.node,D=vp(C,e,r),G=vp(C,u,l);if(M.dist<D&&M.dist<G&&W0(r,C,p)&&W0(u,C,p))return C}y=m.pop(),y&&(y=y.node)}return null}function KC(o,e){return o.dist-e.dist}function QC(o,e,r){if(V0(o,r)||V0(e,r))return 0;var u=kc(o[0],o[1],e[0],e[1],r.minX,r.minY,r.maxX,r.minY);if(u===0)return 0;var l=kc(o[0],o[1],e[0],e[1],r.minX,r.minY,r.minX,r.maxY);if(l===0)return 0;var h=kc(o[0],o[1],e[0],e[1],r.maxX,r.minY,r.maxX,r.maxY);if(h===0)return 0;var p=kc(o[0],o[1],e[0],e[1],r.minX,r.maxY,r.maxX,r.maxY);return p===0?0:Math.min(u,l,h,p)}function V0(o,e){return o[0]>=e.minX&&o[0]<=e.maxX&&o[1]>=e.minY&&o[1]<=e.maxY}function W0(o,e,r){for(var u=Math.min(o[0],e[0]),l=Math.min(o[1],e[1]),h=Math.max(o[0],e[0]),p=Math.max(o[1],e[1]),m=r.search({minX:u,minY:l,maxX:h,maxY:p}),y=0;y<m.length;y++)if(jC(m[y].p,m[y].next.p,o,e))return!1;return!0}function Tu(o,e,r){return ZC(o[0],o[1],e[0],e[1],r[0],r[1])}function jC(o,e,r,u){return o!==u&&e!==r&&Tu(o,e,r)>0!=Tu(o,e,u)>0&&Tu(r,u,o)>0!=Tu(r,u,e)>0}function mp(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 tI(o){for(var e=o[0],r=o[0],u=o[0],l=o[0],h=0;h<o.length;h++){var p=o[h];p[0]<e[0]&&(e=p),p[0]>u[0]&&(u=p),p[1]<r[1]&&(r=p),p[1]>l[1]&&(l=p)}var m=[e,r,u,l],y=m.slice();for(h=0;h<o.length;h++)$C(o[h],m)||y.push(o[h]);return nI(y)}function q0(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 yp(o,e){var r=o[0]-e[0],u=o[1]-e[1];return r*r+u*u}function vp(o,e,r){var u=e[0],l=e[1],h=r[0]-u,p=r[1]-l;if(h!==0||p!==0){var m=((o[0]-u)*h+(o[1]-l)*p)/(h*h+p*p);m>1?(u=r[0],l=r[1]):m>0&&(u+=h*m,l+=p*m)}return h=o[0]-u,p=o[1]-l,h*h+p*p}function kc(o,e,r,u,l,h,p,m){var y=r-o,x=u-e,E=p-l,b=m-h,M=o-l,C=e-h,D=y*y+x*x,G=y*E+x*b,O=E*E+b*b,L=y*M+x*C,k=E*M+b*C,F=D*O-G*G,$,Z,it,et,U=F,wt=F;F===0?(Z=0,U=1,et=k,wt=O):(Z=G*k-O*L,et=D*k-G*L,Z<0?(Z=0,et=k,wt=O):Z>U&&(Z=U,et=k+G,wt=O)),et<0?(et=0,-L<0?Z=0:-L>D?Z=U:(Z=-L,U=D)):et>wt&&(et=wt,-L+G<0?Z=0:-L+G>D?Z=U:(Z=-L+G,U=D)),$=Z===0?0:Z/U,it=et===0?0:et/wt;var Lt=(1-$)*o+$*r,Ot=(1-$)*e+$*u,W=(1-it)*l+it*p,de=(1-it)*h+it*m,yt=W-Lt,zt=de-Ot;return yt*yt+zt*zt}function eI(o,e){return o[0]===e[0]?o[1]-e[1]:o[0]-e[0]}function nI(o){o.sort(eI);for(var e=[],r=0;r<o.length;r++){for(;e.length>=2&&Tu(e[e.length-2],e[e.length-1],o[r])<=0;)e.pop();e.push(o[r])}for(var u=[],l=o.length-1;l>=0;l--){for(;u.length>=2&&Tu(u[u.length-2],u[u.length-1],o[l])<=0;)u.pop();u.push(o[l])}return u.pop(),e.pop(),e.concat(u)}});var j0=It((Ep,wp)=>{(function(o,e){typeof Ep=="object"&&typeof wp<"u"?wp.exports=e():typeof define=="function"&&define.amd?define(e):o.quickselect=e()})(Ep,function(){"use strict";function o(l,h,p,m,y){e(l,h,p||0,m||l.length-1,y||u)}function e(l,h,p,m,y){for(;m>p;){if(m-p>600){var x=m-p+1,E=h-p+1,b=Math.log(x),M=.5*Math.exp(2*b/3),C=.5*Math.sqrt(b*M*(x-M)/x)*(E-x/2<0?-1:1),D=Math.max(p,Math.floor(h-E*M/x+C)),G=Math.min(m,Math.floor(h+(x-E)*M/x+C));e(l,h,D,G,y)}var O=l[h],L=p,k=m;for(r(l,p,h),y(l[m],O)>0&&r(l,p,m);L<k;){for(r(l,L,k),L++,k--;y(l[L],O)<0;)L++;for(;y(l[k],O)>0;)k--}y(l[p],O)===0?r(l,p,k):(k++,r(l,k,m)),k<=h&&(p=k+1),h<=k&&(m=k-1)}}function r(l,h,p){var m=l[h];l[h]=l[p],l[p]=m}function u(l,h){return l<h?-1:l>h?1:0}return o})});var Ap=It((m3,bp)=>{"use strict";bp.exports=bl;bp.exports.default=bl;var gI=j0();function bl(o,e){if(!(this instanceof bl))return new bl(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()}bl.prototype={all:function(){return this._all(this.data,[])},search:function(o){var e=this.data,r=[],u=this.toBBox;if(!Vc(o,e))return r;for(var l=[],h,p,m,y;e;){for(h=0,p=e.children.length;h<p;h++)m=e.children[h],y=e.leaf?u(m):m,Vc(o,y)&&(e.leaf?r.push(m):Sp(o,y)?this._all(m,r):l.push(m));e=l.pop()}return r},collides:function(o){var e=this.data,r=this.toBBox;if(!Vc(o,e))return!1;for(var u=[],l,h,p,m;e;){for(l=0,h=e.children.length;l<h;l++)if(p=e.children[l],m=e.leaf?r(p):p,Vc(o,m)){if(e.leaf||Sp(o,m))return!0;u.push(p)}e=u.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 u=this._build(o.slice(),0,o.length-1,0);if(!this.data.children.length)this.data=u;else if(this.data.height===u.height)this._splitRoot(this.data,u);else{if(this.data.height<u.height){var l=this.data;this.data=u,u=l}this._insert(u,this.data.height-u.height-1,!0)}return this},insert:function(o){return o&&this._insert(o,this.data.height-1),this},clear:function(){return this.data=Pu([]),this},remove:function(o,e){if(!o)return this;for(var r=this.data,u=this.toBBox(o),l=[],h=[],p,m,y,x;r||l.length;){if(r||(r=l.pop(),m=l[l.length-1],p=h.pop(),x=!0),r.leaf&&(y=mI(o,r.children,e),y!==-1))return r.children.splice(y,1),l.push(r),this._condense(l),this;!x&&!r.leaf&&Sp(r,u)?(l.push(r),h.push(p),p=0,m=r,r=r.children[0]):m?(p++,r=m.children[p],x=!1):r=null}return this},toBBox:function(o){return o},compareMinX:ty,compareMinY:ey,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,u){var l=r-e+1,h=this._maxEntries,p;if(l<=h)return p=Pu(o.slice(e,r+1)),Iu(p,this.toBBox),p;u||(u=Math.ceil(Math.log(l)/Math.log(h)),h=Math.ceil(l/Math.pow(h,u-1))),p=Pu([]),p.leaf=!1,p.height=u;var m=Math.ceil(l/h),y=m*Math.ceil(Math.sqrt(h)),x,E,b,M;for(ny(o,e,r,y,this.compareMinX),x=e;x<=r;x+=y)for(b=Math.min(x+y-1,r),ny(o,x,b,m,this.compareMinY),E=x;E<=b;E+=m)M=Math.min(E+m-1,b),p.children.push(this._build(o,E,M,u-1));return Iu(p,this.toBBox),p},_chooseSubtree:function(o,e,r,u){for(var l,h,p,m,y,x,E,b;u.push(e),!(e.leaf||u.length-1===r);){for(E=b=1/0,l=0,h=e.children.length;l<h;l++)p=e.children[l],y=Mp(p),x=yI(o,p)-y,x<b?(b=x,E=y<E?y:E,m=p):x===b&&y<E&&(E=y,m=p);e=m||e.children[0]}return e},_insert:function(o,e,r){var u=this.toBBox,l=r?o:u(o),h=[],p=this._chooseSubtree(l,this.data,e,h);for(p.children.push(o),Sl(p,l);e>=0&&h[e].children.length>this._maxEntries;)this._split(h,e),e--;this._adjustParentBBoxes(l,h,e)},_split:function(o,e){var r=o[e],u=r.children.length,l=this._minEntries;this._chooseSplitAxis(r,l,u);var h=this._chooseSplitIndex(r,l,u),p=Pu(r.children.splice(h,r.children.length-h));p.height=r.height,p.leaf=r.leaf,Iu(r,this.toBBox),Iu(p,this.toBBox),e?o[e-1].children.push(p):this._splitRoot(r,p)},_splitRoot:function(o,e){this.data=Pu([o,e]),this.data.height=o.height+1,this.data.leaf=!1,Iu(this.data,this.toBBox)},_chooseSplitIndex:function(o,e,r){var u,l,h,p,m,y,x,E;for(y=x=1/0,u=e;u<=r-e;u++)l=Ml(o,0,u,this.toBBox),h=Ml(o,u,r,this.toBBox),p=vI(l,h),m=Mp(l)+Mp(h),p<y?(y=p,E=u,x=m<x?m:x):p===y&&m<x&&(x=m,E=u);return E},_chooseSplitAxis:function(o,e,r){var u=o.leaf?this.compareMinX:ty,l=o.leaf?this.compareMinY:ey,h=this._allDistMargin(o,e,r,u),p=this._allDistMargin(o,e,r,l);h<p&&o.children.sort(u)},_allDistMargin:function(o,e,r,u){o.children.sort(u);var l=this.toBBox,h=Ml(o,0,e,l),p=Ml(o,r-e,r,l),m=Hc(h)+Hc(p),y,x;for(y=e;y<r-e;y++)x=o.children[y],Sl(h,o.leaf?l(x):x),m+=Hc(h);for(y=r-e-1;y>=e;y--)x=o.children[y],Sl(p,o.leaf?l(x):x),m+=Hc(p);return m},_adjustParentBBoxes:function(o,e,r){for(var u=r;u>=0;u--)Sl(e[u],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():Iu(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 mI(o,e,r){if(!r)return e.indexOf(o);for(var u=0;u<e.length;u++)if(r(o,e[u]))return u;return-1}function Iu(o,e){Ml(o,0,o.children.length,e,o)}function Ml(o,e,r,u,l){l||(l=Pu(null)),l.minX=1/0,l.minY=1/0,l.maxX=-1/0,l.maxY=-1/0;for(var h=e,p;h<r;h++)p=o.children[h],Sl(l,o.leaf?u(p):p);return l}function Sl(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 ty(o,e){return o.minX-e.minX}function ey(o,e){return o.minY-e.minY}function Mp(o){return(o.maxX-o.minX)*(o.maxY-o.minY)}function Hc(o){return o.maxX-o.minX+(o.maxY-o.minY)}function yI(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 vI(o,e){var r=Math.max(o.minX,e.minX),u=Math.max(o.minY,e.minY),l=Math.min(o.maxX,e.maxX),h=Math.min(o.maxY,e.maxY);return Math.max(0,l-r)*Math.max(0,h-u)}function Sp(o,e){return o.minX<=e.minX&&o.minY<=e.minY&&e.maxX<=o.maxX&&e.maxY<=o.maxY}function Vc(o,e){return e.minX<=o.maxX&&e.minY<=o.maxY&&e.maxX>=o.minX&&e.maxY>=o.minY}function Pu(o){return{children:o,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ny(o,e,r,u,l){for(var h=[e,r],p;h.length;)r=h.pop(),e=h.pop(),!(r-e<=u)&&(p=e+Math.ceil((r-e)/u/2)*u,gI(o,p,e,r,l),h.push(e,p,p,r))}});var uy=It((IF,Lp)=>{"use strict";Lp.exports=Yc;Lp.exports.default=Yc;function Yc(o,e,r){r=r||2;var u=e&&e.length,l=u?e[0]*r:o.length,h=oy(o,0,l,r,!0),p=[];if(!h||h.next===h.prev)return p;var m,y,x,E,b,M,C;if(u&&(h=CI(o,e,h,r)),o.length>80*r){m=x=o[0],y=E=o[1];for(var D=r;D<l;D+=r)b=o[D],M=o[D+1],b<m&&(m=b),M<y&&(y=M),b>x&&(x=b),M>E&&(E=M);C=Math.max(x-m,E-y),C=C!==0?32767/C:0}return Cl(h,p,r,m,y,C,0),p}function oy(o,e,r,u,l){var h,p;if(l===Rp(o,e,r,u)>0)for(h=e;h<r;h+=u)p=iy(h,o[h],o[h+1],p);else for(h=r-u;h>=e;h-=u)p=iy(h,o[h],o[h+1],p);return p&&$c(p,p.next)&&(Pl(p),p=p.next),p}function Qa(o,e){if(!o)return o;e||(e=o);var r=o,u;do if(u=!1,!r.steiner&&($c(r,r.next)||hr(r.prev,r,r.next)===0)){if(Pl(r),r=e=r.prev,r===r.next)break;u=!0}else r=r.next;while(u||r!==e);return e}function Cl(o,e,r,u,l,h,p){if(o){!p&&h&&NI(o,u,l,h);for(var m=o,y,x;o.prev!==o.next;){if(y=o.prev,x=o.next,h?bI(o,u,l,h):SI(o)){e.push(y.i/r|0),e.push(o.i/r|0),e.push(x.i/r|0),Pl(o),o=x.next,m=x.next;continue}if(o=x,o===m){p?p===1?(o=AI(Qa(o),e,r),Cl(o,e,r,u,l,h,2)):p===2&&TI(o,e,r,u,l,h):Cl(Qa(o),e,r,u,l,h,1);break}}}}function SI(o){var e=o.prev,r=o,u=o.next;if(hr(e,r,u)>=0)return!1;for(var l=e.x,h=r.x,p=u.x,m=e.y,y=r.y,x=u.y,E=l<h?l<p?l:p:h<p?h:p,b=m<y?m<x?m:x:y<x?y:x,M=l>h?l>p?l:p:h>p?h:p,C=m>y?m>x?m:x:y>x?y:x,D=u.next;D!==e;){if(D.x>=E&&D.x<=M&&D.y>=b&&D.y<=C&&Nu(l,m,h,y,p,x,D.x,D.y)&&hr(D.prev,D,D.next)>=0)return!1;D=D.next}return!0}function bI(o,e,r,u){var l=o.prev,h=o,p=o.next;if(hr(l,h,p)>=0)return!1;for(var m=l.x,y=h.x,x=p.x,E=l.y,b=h.y,M=p.y,C=m<y?m<x?m:x:y<x?y:x,D=E<b?E<M?E:M:b<M?b:M,G=m>y?m>x?m:x:y>x?y:x,O=E>b?E>M?E:M:b>M?b:M,L=Ip(C,D,e,r,u),k=Ip(G,O,e,r,u),F=o.prevZ,$=o.nextZ;F&&F.z>=L&&$&&$.z<=k;){if(F.x>=C&&F.x<=G&&F.y>=D&&F.y<=O&&F!==l&&F!==p&&Nu(m,E,y,b,x,M,F.x,F.y)&&hr(F.prev,F,F.next)>=0||(F=F.prevZ,$.x>=C&&$.x<=G&&$.y>=D&&$.y<=O&&$!==l&&$!==p&&Nu(m,E,y,b,x,M,$.x,$.y)&&hr($.prev,$,$.next)>=0))return!1;$=$.nextZ}for(;F&&F.z>=L;){if(F.x>=C&&F.x<=G&&F.y>=D&&F.y<=O&&F!==l&&F!==p&&Nu(m,E,y,b,x,M,F.x,F.y)&&hr(F.prev,F,F.next)>=0)return!1;F=F.prevZ}for(;$&&$.z<=k;){if($.x>=C&&$.x<=G&&$.y>=D&&$.y<=O&&$!==l&&$!==p&&Nu(m,E,y,b,x,M,$.x,$.y)&&hr($.prev,$,$.next)>=0)return!1;$=$.nextZ}return!0}function AI(o,e,r){var u=o;do{var l=u.prev,h=u.next.next;!$c(l,h)&&sy(l,u,u.next,h)&&Il(l,h)&&Il(h,l)&&(e.push(l.i/r|0),e.push(u.i/r|0),e.push(h.i/r|0),Pl(u),Pl(u.next),u=o=h),u=u.next}while(u!==o);return Qa(u)}function TI(o,e,r,u,l,h){var p=o;do{for(var m=p.next.next;m!==p.prev;){if(p.i!==m.i&&FI(p,m)){var y=ay(p,m);p=Qa(p,p.next),y=Qa(y,y.next),Cl(p,e,r,u,l,h,0),Cl(y,e,r,u,l,h,0);return}m=m.next}p=p.next}while(p!==o)}function CI(o,e,r,u){var l=[],h,p,m,y,x;for(h=0,p=e.length;h<p;h++)m=e[h]*u,y=h<p-1?e[h+1]*u:o.length,x=oy(o,m,y,u,!1),x===x.next&&(x.steiner=!0),l.push(OI(x));for(l.sort(II),h=0;h<l.length;h++)r=PI(l[h],r);return r}function II(o,e){return o.x-e.x}function PI(o,e){var r=RI(o,e);if(!r)return e;var u=ay(r,o);return Qa(u,u.next),Qa(r,r.next)}function RI(o,e){var r=e,u=o.x,l=o.y,h=-1/0,p;do{if(l<=r.y&&l>=r.next.y&&r.next.y!==r.y){var m=r.x+(l-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(m<=u&&m>h&&(h=m,p=r.x<r.next.x?r:r.next,m===u))return p}r=r.next}while(r!==e);if(!p)return null;var y=p,x=p.x,E=p.y,b=1/0,M;r=p;do u>=r.x&&r.x>=x&&u!==r.x&&Nu(l<E?u:h,l,x,E,l<E?h:u,l,r.x,r.y)&&(M=Math.abs(l-r.y)/(u-r.x),Il(r,o)&&(M<b||M===b&&(r.x>p.x||r.x===p.x&&LI(p,r)))&&(p=r,b=M)),r=r.next;while(r!==y);return p}function LI(o,e){return hr(o.prev,o,e.prev)<0&&hr(e.next,o,o.next)<0}function NI(o,e,r,u){var l=o;do l.z===0&&(l.z=Ip(l.x,l.y,e,r,u)),l.prevZ=l.prev,l.nextZ=l.next,l=l.next;while(l!==o);l.prevZ.nextZ=null,l.prevZ=null,DI(l)}function DI(o){var e,r,u,l,h,p,m,y,x=1;do{for(r=o,o=null,h=null,p=0;r;){for(p++,u=r,m=0,e=0;e<x&&(m++,u=u.nextZ,!!u);e++);for(y=x;m>0||y>0&&u;)m!==0&&(y===0||!u||r.z<=u.z)?(l=r,r=r.nextZ,m--):(l=u,u=u.nextZ,y--),h?h.nextZ=l:o=l,l.prevZ=h,h=l;r=u}h.nextZ=null,x*=2}while(p>1);return o}function Ip(o,e,r,u,l){return o=(o-r)*l|0,e=(e-u)*l|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 OI(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 Nu(o,e,r,u,l,h,p,m){return(l-p)*(e-m)>=(o-p)*(h-m)&&(o-p)*(u-m)>=(r-p)*(e-m)&&(r-p)*(h-m)>=(l-p)*(u-m)}function FI(o,e){return o.next.i!==e.i&&o.prev.i!==e.i&&!UI(o,e)&&(Il(o,e)&&Il(e,o)&&BI(o,e)&&(hr(o.prev,o,e.prev)||hr(o,e.prev,e))||$c(o,e)&&hr(o.prev,o,o.next)>0&&hr(e.prev,e,e.next)>0)}function hr(o,e,r){return(e.y-o.y)*(r.x-e.x)-(e.x-o.x)*(r.y-e.y)}function $c(o,e){return o.x===e.x&&o.y===e.y}function sy(o,e,r,u){var l=Xc(hr(o,e,r)),h=Xc(hr(o,e,u)),p=Xc(hr(r,u,o)),m=Xc(hr(r,u,e));return!!(l!==h&&p!==m||l===0&&qc(o,r,e)||h===0&&qc(o,u,e)||p===0&&qc(r,o,u)||m===0&&qc(r,e,u))}function qc(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 Xc(o){return o>0?1:o<0?-1:0}function UI(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&&sy(r,r.next,o,e))return!0;r=r.next}while(r!==o);return!1}function Il(o,e){return hr(o.prev,o,o.next)<0?hr(o,e,o.next)>=0&&hr(o,o.prev,e)>=0:hr(o,e,o.prev)<0||hr(o,o.next,e)<0}function BI(o,e){var r=o,u=!1,l=(o.x+e.x)/2,h=(o.y+e.y)/2;do r.y>h!=r.next.y>h&&r.next.y!==r.y&&l<(r.next.x-r.x)*(h-r.y)/(r.next.y-r.y)+r.x&&(u=!u),r=r.next;while(r!==o);return u}function ay(o,e){var r=new Pp(o.i,o.x,o.y),u=new Pp(e.i,e.x,e.y),l=o.next,h=e.prev;return o.next=e,e.prev=o,r.next=l,l.prev=r,u.next=r,r.prev=u,h.next=u,u.prev=h,u}function iy(o,e,r,u){var l=new Pp(o,e,r);return u?(l.next=u.next,l.prev=u,u.next.prev=l,u.next=l):(l.prev=l,l.next=l),l}function Pl(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 Pp(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}Yc.deviation=function(o,e,r,u){var l=e&&e.length,h=l?e[0]*r:o.length,p=Math.abs(Rp(o,0,h,r));if(l)for(var m=0,y=e.length;m<y;m++){var x=e[m]*r,E=m<y-1?e[m+1]*r:o.length;p-=Math.abs(Rp(o,x,E,r))}var b=0;for(m=0;m<u.length;m+=3){var M=u[m]*r,C=u[m+1]*r,D=u[m+2]*r;b+=Math.abs((o[M]-o[D])*(o[C+1]-o[M+1])-(o[M]-o[C])*(o[D+1]-o[M+1]))}return p===0&&b===0?0:Math.abs((b-p)/p)};function Rp(o,e,r,u){for(var l=0,h=e,p=r-u;h<r;h+=u)l+=(o[p]-o[h])*(o[h+1]+o[p+1]),p=h;return l}Yc.flatten=function(o){for(var e=o[0][0].length,r={vertices:[],holes:[],dimensions:e},u=0,l=0;l<o.length;l++){for(var h=0;h<o[l].length;h++)for(var p=0;p<e;p++)r.vertices.push(o[l][h][p]);l>0&&(u+=o[l-1].length,r.holes.push(u))}return r}});var Up=It(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.earthRadius=63710088e-1;Xt.factors={centimeters:Xt.earthRadius*100,centimetres:Xt.earthRadius*100,degrees:Xt.earthRadius/111325,feet:Xt.earthRadius*3.28084,inches:Xt.earthRadius*39.37,kilometers:Xt.earthRadius/1e3,kilometres:Xt.earthRadius/1e3,meters:Xt.earthRadius,metres:Xt.earthRadius,miles:Xt.earthRadius/1609.344,millimeters:Xt.earthRadius*1e3,millimetres:Xt.earthRadius*1e3,nauticalmiles:Xt.earthRadius/1852,radians:1,yards:Xt.earthRadius*1.0936};Xt.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/Xt.earthRadius,yards:1.0936133};Xt.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 Sa(o,e,r){r===void 0&&(r={});var u={type:"Feature"};return(r.id===0||r.id)&&(u.id=r.id),r.bbox&&(u.bbox=r.bbox),u.properties=e||{},u.geometry=o,u}Xt.feature=Sa;function kI(o,e,r){switch(r===void 0&&(r={}),o){case"Point":return Np(e).geometry;case"LineString":return Op(e).geometry;case"Polygon":return Dp(e).geometry;case"MultiPoint":return cy(e).geometry;case"MultiLineString":return ly(e).geometry;case"MultiPolygon":return fy(e).geometry;default:throw new Error(o+" is invalid")}}Xt.geometry=kI;function Np(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(!Zc(o[0])||!Zc(o[1]))throw new Error("coordinates must contain numbers");var u={type:"Point",coordinates:o};return Sa(u,e,r)}Xt.point=Np;function GI(o,e,r){return r===void 0&&(r={}),Jc(o.map(function(u){return Np(u,e)}),r)}Xt.points=GI;function Dp(o,e,r){r===void 0&&(r={});for(var u=0,l=o;u<l.length;u++){var h=l[u];if(h.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var p=0;p<h[h.length-1].length;p++)if(h[h.length-1][p]!==h[0][p])throw new Error("First and last Position are not equivalent.")}var m={type:"Polygon",coordinates:o};return Sa(m,e,r)}Xt.polygon=Dp;function HI(o,e,r){return r===void 0&&(r={}),Jc(o.map(function(u){return Dp(u,e)}),r)}Xt.polygons=HI;function Op(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 u={type:"LineString",coordinates:o};return Sa(u,e,r)}Xt.lineString=Op;function VI(o,e,r){return r===void 0&&(r={}),Jc(o.map(function(u){return Op(u,e)}),r)}Xt.lineStrings=VI;function Jc(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}Xt.featureCollection=Jc;function ly(o,e,r){r===void 0&&(r={});var u={type:"MultiLineString",coordinates:o};return Sa(u,e,r)}Xt.multiLineString=ly;function cy(o,e,r){r===void 0&&(r={});var u={type:"MultiPoint",coordinates:o};return Sa(u,e,r)}Xt.multiPoint=cy;function fy(o,e,r){r===void 0&&(r={});var u={type:"MultiPolygon",coordinates:o};return Sa(u,e,r)}Xt.multiPolygon=fy;function WI(o,e,r){r===void 0&&(r={});var u={type:"GeometryCollection",geometries:o};return Sa(u,e,r)}Xt.geometryCollection=WI;function qI(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}Xt.round=qI;function hy(o,e){e===void 0&&(e="kilometers");var r=Xt.factors[e];if(!r)throw new Error(e+" units is invalid");return o*r}Xt.radiansToLength=hy;function Fp(o,e){e===void 0&&(e="kilometers");var r=Xt.factors[e];if(!r)throw new Error(e+" units is invalid");return o/r}Xt.lengthToRadians=Fp;function XI(o,e){return py(Fp(o,e))}Xt.lengthToDegrees=XI;function YI(o){var e=o%360;return e<0&&(e+=360),e}Xt.bearingToAzimuth=YI;function py(o){var e=o%(2*Math.PI);return e*180/Math.PI}Xt.radiansToDegrees=py;function $I(o){var e=o%360;return e*Math.PI/180}Xt.degreesToRadians=$I;function ZI(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 hy(Fp(o,e),r)}Xt.convertLength=ZI;function JI(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 u=Xt.areaFactors[e];if(!u)throw new Error("invalid original units");var l=Xt.areaFactors[r];if(!l)throw new Error("invalid final units");return o/u*l}Xt.convertArea=JI;function Zc(o){return!isNaN(o)&&o!==null&&!Array.isArray(o)}Xt.isNumber=Zc;function KI(o){return!!o&&o.constructor===Object}Xt.isObject=KI;function QI(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(!Zc(e))throw new Error("bbox must only contain numbers")})}Xt.validateBBox=QI;function jI(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")}Xt.validateId=jI});var zp=It(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});var Ri=Up();function Rl(o,e,r){if(o!==null)for(var u,l,h,p,m,y,x,E=0,b=0,M,C=o.type,D=C==="FeatureCollection",G=C==="Feature",O=D?o.features.length:1,L=0;L<O;L++){x=D?o.features[L].geometry:G?o.geometry:o,M=x?x.type==="GeometryCollection":!1,m=M?x.geometries.length:1;for(var k=0;k<m;k++){var F=0,$=0;if(p=M?x.geometries[k]:x,p!==null){y=p.coordinates;var Z=p.type;switch(E=r&&(Z==="Polygon"||Z==="MultiPolygon")?1:0,Z){case null:break;case"Point":if(e(y,b,L,F,$)===!1)return!1;b++,F++;break;case"LineString":case"MultiPoint":for(u=0;u<y.length;u++){if(e(y[u],b,L,F,$)===!1)return!1;b++,Z==="MultiPoint"&&F++}Z==="LineString"&&F++;break;case"Polygon":case"MultiLineString":for(u=0;u<y.length;u++){for(l=0;l<y[u].length-E;l++){if(e(y[u][l],b,L,F,$)===!1)return!1;b++}Z==="MultiLineString"&&F++,Z==="Polygon"&&$++}Z==="Polygon"&&F++;break;case"MultiPolygon":for(u=0;u<y.length;u++){for($=0,l=0;l<y[u].length;l++){for(h=0;h<y[u][l].length-E;h++){if(e(y[u][l][h],b,L,F,$)===!1)return!1;b++}$++}F++}break;case"GeometryCollection":for(u=0;u<p.geometries.length;u++)if(Rl(p.geometries[u],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function tP(o,e,r,u){var l=r;return Rl(o,function(h,p,m,y,x){p===0&&r===void 0?l=h:l=e(l,h,p,m,y,x)},u),l}function dy(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 eP(o,e,r){var u=r;return dy(o,function(l,h){h===0&&r===void 0?u=l:u=e(u,l,h)}),u}function gy(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 nP(o,e,r){var u=r;return gy(o,function(l,h){h===0&&r===void 0?u=l:u=e(u,l,h)}),u}function rP(o){var e=[];return Rl(o,function(r){e.push(r)}),e}function Bp(o,e){var r,u,l,h,p,m,y,x,E,b,M=0,C=o.type==="FeatureCollection",D=o.type==="Feature",G=C?o.features.length:1;for(r=0;r<G;r++){for(m=C?o.features[r].geometry:D?o.geometry:o,x=C?o.features[r].properties:D?o.properties:{},E=C?o.features[r].bbox:D?o.bbox:void 0,b=C?o.features[r].id:D?o.id:void 0,y=m?m.type==="GeometryCollection":!1,p=y?m.geometries.length:1,l=0;l<p;l++){if(h=y?m.geometries[l]:m,h===null){if(e(null,M,x,E,b)===!1)return!1;continue}switch(h.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(h,M,x,E,b)===!1)return!1;break}case"GeometryCollection":{for(u=0;u<h.geometries.length;u++)if(e(h.geometries[u],M,x,E,b)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}M++}}function iP(o,e,r){var u=r;return Bp(o,function(l,h,p,m,y){h===0&&r===void 0?u=l:u=e(u,l,h,p,m,y)}),u}function Kc(o,e){Bp(o,function(r,u,l,h,p){var m=r===null?null:r.type;switch(m){case null:case"Point":case"LineString":case"Polygon":return e(Ri.feature(r,l,{bbox:h,id:p}),u,0)===!1?!1:void 0}var y;switch(m){case"MultiPoint":y="Point";break;case"MultiLineString":y="LineString";break;case"MultiPolygon":y="Polygon";break}for(var x=0;x<r.coordinates.length;x++){var E=r.coordinates[x],b={type:y,coordinates:E};if(e(Ri.feature(b,l),u,x)===!1)return!1}})}function oP(o,e,r){var u=r;return Kc(o,function(l,h,p){h===0&&p===0&&r===void 0?u=l:u=e(u,l,h,p)}),u}function my(o,e){Kc(o,function(r,u,l){var h=0;if(r.geometry){var p=r.geometry.type;if(!(p==="Point"||p==="MultiPoint")){var m,y=0,x=0,E=0;if(Rl(r,function(b,M,C,D,G){if(m===void 0||u>y||D>x||G>E){m=b,y=u,x=D,E=G,h=0;return}var O=Ri.lineString([m,b],r.properties);if(e(O,u,l,G,h)===!1)return!1;h++,m=b})===!1)return!1}}})}function sP(o,e,r){var u=r,l=!1;return my(o,function(h,p,m,y,x){l===!1&&r===void 0?u=h:u=e(u,h,p,m,y,x),l=!0}),u}function yy(o,e){if(!o)throw new Error("geojson is required");Kc(o,function(r,u,l){if(r.geometry!==null){var h=r.geometry.type,p=r.geometry.coordinates;switch(h){case"LineString":if(e(r,u,l,0,0)===!1)return!1;break;case"Polygon":for(var m=0;m<p.length;m++)if(e(Ri.lineString(p[m],r.properties),u,l,m)===!1)return!1;break}}})}function aP(o,e,r){var u=r;return yy(o,function(l,h,p,m){h===0&&r===void 0?u=l:u=e(u,l,h,p,m)}),u}function uP(o,e){if(e=e||{},!Ri.isObject(e))throw new Error("options is invalid");var r=e.featureIndex||0,u=e.multiFeatureIndex||0,l=e.geometryIndex||0,h=e.segmentIndex||0,p=e.properties,m;switch(o.type){case"FeatureCollection":r<0&&(r=o.features.length+r),p=p||o.features[r].properties,m=o.features[r].geometry;break;case"Feature":p=p||o.properties,m=o.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":m=o;break;default:throw new Error("geojson is invalid")}if(m===null)return null;var y=m.coordinates;switch(m.type){case"Point":case"MultiPoint":return null;case"LineString":return h<0&&(h=y.length+h-1),Ri.lineString([y[h],y[h+1]],p,e);case"Polygon":return l<0&&(l=y.length+l),h<0&&(h=y[l].length+h-1),Ri.lineString([y[l][h],y[l][h+1]],p,e);case"MultiLineString":return u<0&&(u=y.length+u),h<0&&(h=y[u].length+h-1),Ri.lineString([y[u][h],y[u][h+1]],p,e);case"MultiPolygon":return u<0&&(u=y.length+u),l<0&&(l=y[u].length+l),h<0&&(h=y[u][l].length-h-1),Ri.lineString([y[u][l][h],y[u][l][h+1]],p,e)}throw new Error("geojson is invalid")}function lP(o,e){if(e=e||{},!Ri.isObject(e))throw new Error("options is invalid");var r=e.featureIndex||0,u=e.multiFeatureIndex||0,l=e.geometryIndex||0,h=e.coordIndex||0,p=e.properties,m;switch(o.type){case"FeatureCollection":r<0&&(r=o.features.length+r),p=p||o.features[r].properties,m=o.features[r].geometry;break;case"Feature":p=p||o.properties,m=o.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":m=o;break;default:throw new Error("geojson is invalid")}if(m===null)return null;var y=m.coordinates;switch(m.type){case"Point":return Ri.point(y,p,e);case"MultiPoint":return u<0&&(u=y.length+u),Ri.point(y[u],p,e);case"LineString":return h<0&&(h=y.length+h),Ri.point(y[h],p,e);case"Polygon":return l<0&&(l=y.length+l),h<0&&(h=y[l].length+h),Ri.point(y[l][h],p,e);case"MultiLineString":return u<0&&(u=y.length+u),h<0&&(h=y[u].length+h),Ri.point(y[u][h],p,e);case"MultiPolygon":return u<0&&(u=y.length+u),l<0&&(l=y[u].length+l),h<0&&(h=y[u][l].length-h),Ri.point(y[u][l][h],p,e)}throw new Error("geojson is invalid")}Vr.coordAll=rP;Vr.coordEach=Rl;Vr.coordReduce=tP;Vr.featureEach=gy;Vr.featureReduce=nP;Vr.findPoint=lP;Vr.findSegment=uP;Vr.flattenEach=Kc;Vr.flattenReduce=oP;Vr.geomEach=Bp;Vr.geomReduce=iP;Vr.lineEach=yy;Vr.lineReduce=aP;Vr.propEach=dy;Vr.propReduce=eP;Vr.segmentEach=my;Vr.segmentReduce=sP});var vy=It(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var cP=zp();function kp(o){var e=[1/0,1/0,-1/0,-1/0];return cP.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}kp.default=kp;Gp.default=kp});var Qc=It((qF,Hp)=>{var Ps=pp(),xy=Up(),Ey=zp(),Du=vy().default,fP=Ey.featureEach,VF=Ey.coordEach,WF=xy.polygon,_y=xy.featureCollection;function wy(o){var e=new Ps(o);return e.insert=function(r){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:Du(r),Ps.prototype.insert.call(this,r)},e.load=function(r){var u=[];return Array.isArray(r)?r.forEach(function(l){if(l.type!=="Feature")throw new Error("invalid features");l.bbox=l.bbox?l.bbox:Du(l),u.push(l)}):fP(r,function(l){if(l.type!=="Feature")throw new Error("invalid features");l.bbox=l.bbox?l.bbox:Du(l),u.push(l)}),Ps.prototype.load.call(this,u)},e.remove=function(r,u){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:Du(r),Ps.prototype.remove.call(this,r,u)},e.clear=function(){return Ps.prototype.clear.call(this)},e.search=function(r){var u=Ps.prototype.search.call(this,this.toBBox(r));return _y(u)},e.collides=function(r){return Ps.prototype.collides.call(this,this.toBBox(r))},e.all=function(){var r=Ps.prototype.all.call(this);return _y(r)},e.toJSON=function(){return Ps.prototype.toJSON.call(this)},e.fromJSON=function(r){return Ps.prototype.fromJSON.call(this,r)},e.toBBox=function(r){var u;if(r.bbox)u=r.bbox;else if(Array.isArray(r)&&r.length===4)u=r;else if(Array.isArray(r)&&r.length===6)u=[r[0],r[1],r[3],r[4]];else if(r.type==="Feature")u=Du(r);else if(r.type==="FeatureCollection")u=Du(r);else throw new Error("invalid geojson");return{minX:u[0],minY:u[1],maxX:u[2],maxY:u[3]}},e}Hp.exports=wy;Hp.exports.default=wy});var $p=It((tz,Ly)=>{"use strict";var Ry=Object.prototype.toString;Ly.exports=function(e){var r=Ry.call(e),u=r==="[object Arguments]";return u||(u=r!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&Ry.call(e.callee)==="[object Function]"),u}});var Gy=It((ez,ky)=>{"use strict";var zy;Object.keys||(Dl=Object.prototype.hasOwnProperty,Zp=Object.prototype.toString,Ny=$p(),Jp=Object.prototype.propertyIsEnumerable,Dy=!Jp.call({toString:null},"toString"),Oy=Jp.call(function(){},"prototype"),Ol=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],rf=function(o){var e=o.constructor;return e&&e.prototype===o},Fy={$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},Uy=function(){if(typeof window>"u")return!1;for(var o in window)try{if(!Fy["$"+o]&&Dl.call(window,o)&&window[o]!==null&&typeof window[o]=="object")try{rf(window[o])}catch{return!0}}catch{return!0}return!1}(),By=function(o){if(typeof window>"u"||!Uy)return rf(o);try{return rf(o)}catch{return!1}},zy=function(e){var r=e!==null&&typeof e=="object",u=Zp.call(e)==="[object Function]",l=Ny(e),h=r&&Zp.call(e)==="[object String]",p=[];if(!r&&!u&&!l)throw new TypeError("Object.keys called on a non-object");var m=Oy&&u;if(h&&e.length>0&&!Dl.call(e,0))for(var y=0;y<e.length;++y)p.push(String(y));if(l&&e.length>0)for(var x=0;x<e.length;++x)p.push(String(x));else for(var E in e)!(m&&E==="prototype")&&Dl.call(e,E)&&p.push(String(E));if(Dy)for(var b=By(e),M=0;M<Ol.length;++M)!(b&&Ol[M]==="constructor")&&Dl.call(e,Ol[M])&&p.push(Ol[M]);return p});var Dl,Zp,Ny,Jp,Dy,Oy,Ol,rf,Fy,Uy,By;ky.exports=zy});var Kp=It((nz,Wy)=>{"use strict";var EP=Array.prototype.slice,wP=$p(),Hy=Object.keys,of=Hy?function(e){return Hy(e)}:Gy(),Vy=Object.keys;of.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(u){return wP(u)?Vy(EP.call(u)):Vy(u)})}else Object.keys=of;return Object.keys||of};Wy.exports=of});var Qp=It((rz,qy)=>{"use strict";qy.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),u=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(u)!=="[object Symbol]")return!1;var l=42;e[r]=l;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 h=Object.getOwnPropertySymbols(e);if(h.length!==1||h[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var p=Object.getOwnPropertyDescriptor(e,r);if(p.value!==l||p.enumerable!==!0)return!1}return!0}});var sf=It((iz,Xy)=>{"use strict";var MP=Qp();Xy.exports=function(){return MP()&&!!Symbol.toStringTag}});var $y=It((oz,Yy)=>{"use strict";Yy.exports=Error});var Jy=It((sz,Zy)=>{"use strict";Zy.exports=EvalError});var Qy=It((az,Ky)=>{"use strict";Ky.exports=RangeError});var tv=It((uz,jy)=>{"use strict";jy.exports=ReferenceError});var jp=It((lz,ev)=>{"use strict";ev.exports=SyntaxError});var ja=It((cz,nv)=>{"use strict";nv.exports=TypeError});var iv=It((fz,rv)=>{"use strict";rv.exports=URIError});var av=It((hz,sv)=>{"use strict";var ov=typeof Symbol<"u"&&Symbol,SP=Qp();sv.exports=function(){return typeof ov!="function"||typeof Symbol!="function"||typeof ov("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:SP()}});var lv=It((pz,uv)=>{"use strict";var td={__proto__:null,foo:{}},bP=Object;uv.exports=function(){return{__proto__:td}.foo===td.foo&&!(td instanceof bP)}});var hv=It((dz,fv)=>{"use strict";var AP="Function.prototype.bind called on incompatible ",TP=Object.prototype.toString,CP=Math.max,IP="[object Function]",cv=function(e,r){for(var u=[],l=0;l<e.length;l+=1)u[l]=e[l];for(var h=0;h<r.length;h+=1)u[h+e.length]=r[h];return u},PP=function(e,r){for(var u=[],l=r||0,h=0;l<e.length;l+=1,h+=1)u[h]=e[l];return u},RP=function(o,e){for(var r="",u=0;u<o.length;u+=1)r+=o[u],u+1<o.length&&(r+=e);return r};fv.exports=function(e){var r=this;if(typeof r!="function"||TP.apply(r)!==IP)throw new TypeError(AP+r);for(var u=PP(arguments,1),l,h=function(){if(this instanceof l){var E=r.apply(this,cv(u,arguments));return Object(E)===E?E:this}return r.apply(e,cv(u,arguments))},p=CP(0,r.length-u.length),m=[],y=0;y<p;y++)m[y]="$"+y;if(l=Function("binder","return function ("+RP(m,",")+"){ return binder.apply(this,arguments); }")(h),r.prototype){var x=function(){};x.prototype=r.prototype,l.prototype=new x,x.prototype=null}return l}});var af=It((gz,pv)=>{"use strict";var LP=hv();pv.exports=Function.prototype.bind||LP});var gv=It((mz,dv)=>{"use strict";var NP=Function.prototype.call,DP=Object.prototype.hasOwnProperty,OP=af();dv.exports=OP.call(NP,DP)});var zu=It((yz,xv)=>{"use strict";var nn,FP=$y(),UP=Jy(),BP=Qy(),zP=tv(),Bu=jp(),Uu=ja(),kP=iv(),_v=Function,ed=function(o){try{return _v(\'"use strict"; return (\'+o+").constructor;")()}catch{}},tu=Object.getOwnPropertyDescriptor;if(tu)try{tu({},"")}catch{tu=null}var nd=function(){throw new Uu},GP=tu?function(){try{return arguments.callee,nd}catch{try{return tu(arguments,"callee").get}catch{return nd}}}():nd,Ou=av()(),HP=lv()(),si=Object.getPrototypeOf||(HP?function(o){return o.__proto__}:null),Fu={},VP=typeof Uint8Array>"u"||!si?nn:si(Uint8Array),eu={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?nn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?nn:ArrayBuffer,"%ArrayIteratorPrototype%":Ou&&si?si([][Symbol.iterator]()):nn,"%AsyncFromSyncIteratorPrototype%":nn,"%AsyncFunction%":Fu,"%AsyncGenerator%":Fu,"%AsyncGeneratorFunction%":Fu,"%AsyncIteratorPrototype%":Fu,"%Atomics%":typeof Atomics>"u"?nn:Atomics,"%BigInt%":typeof BigInt>"u"?nn:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?nn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?nn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?nn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":FP,"%eval%":eval,"%EvalError%":UP,"%Float32Array%":typeof Float32Array>"u"?nn:Float32Array,"%Float64Array%":typeof Float64Array>"u"?nn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?nn:FinalizationRegistry,"%Function%":_v,"%GeneratorFunction%":Fu,"%Int8Array%":typeof Int8Array>"u"?nn:Int8Array,"%Int16Array%":typeof Int16Array>"u"?nn:Int16Array,"%Int32Array%":typeof Int32Array>"u"?nn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ou&&si?si(si([][Symbol.iterator]())):nn,"%JSON%":typeof JSON=="object"?JSON:nn,"%Map%":typeof Map>"u"?nn:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ou||!si?nn:si(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?nn:Promise,"%Proxy%":typeof Proxy>"u"?nn:Proxy,"%RangeError%":BP,"%ReferenceError%":zP,"%Reflect%":typeof Reflect>"u"?nn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?nn:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ou||!si?nn:si(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?nn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ou&&si?si(""[Symbol.iterator]()):nn,"%Symbol%":Ou?Symbol:nn,"%SyntaxError%":Bu,"%ThrowTypeError%":GP,"%TypedArray%":VP,"%TypeError%":Uu,"%Uint8Array%":typeof Uint8Array>"u"?nn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?nn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?nn:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?nn:Uint32Array,"%URIError%":kP,"%WeakMap%":typeof WeakMap>"u"?nn:WeakMap,"%WeakRef%":typeof WeakRef>"u"?nn:WeakRef,"%WeakSet%":typeof WeakSet>"u"?nn:WeakSet};if(si)try{null.error}catch(o){mv=si(si(o)),eu["%Error.prototype%"]=mv}var mv,WP=function o(e){var r;if(e==="%AsyncFunction%")r=ed("async function () {}");else if(e==="%GeneratorFunction%")r=ed("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=ed("async function* () {}");else if(e==="%AsyncGenerator%"){var u=o("%AsyncGeneratorFunction%");u&&(r=u.prototype)}else if(e==="%AsyncIteratorPrototype%"){var l=o("%AsyncGenerator%");l&&si&&(r=si(l.prototype))}return eu[e]=r,r},yv={__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"]},Fl=af(),uf=gv(),qP=Fl.call(Function.call,Array.prototype.concat),XP=Fl.call(Function.apply,Array.prototype.splice),vv=Fl.call(Function.call,String.prototype.replace),lf=Fl.call(Function.call,String.prototype.slice),YP=Fl.call(Function.call,RegExp.prototype.exec),$P=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,ZP=/\\\\(\\\\)?/g,JP=function(e){var r=lf(e,0,1),u=lf(e,-1);if(r==="%"&&u!=="%")throw new Bu("invalid intrinsic syntax, expected closing `%`");if(u==="%"&&r!=="%")throw new Bu("invalid intrinsic syntax, expected opening `%`");var l=[];return vv(e,$P,function(h,p,m,y){l[l.length]=m?vv(y,ZP,"$1"):p||h}),l},KP=function(e,r){var u=e,l;if(uf(yv,u)&&(l=yv[u],u="%"+l[0]+"%"),uf(eu,u)){var h=eu[u];if(h===Fu&&(h=WP(u)),typeof h>"u"&&!r)throw new Uu("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:l,name:u,value:h}}throw new Bu("intrinsic "+e+" does not exist!")};xv.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Uu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Uu(\'"allowMissing" argument must be a boolean\');if(YP(/^%?[^%]*%?$/,e)===null)throw new Bu("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var u=JP(e),l=u.length>0?u[0]:"",h=KP("%"+l+"%",r),p=h.name,m=h.value,y=!1,x=h.alias;x&&(l=x[0],XP(u,qP([0,1],x)));for(var E=1,b=!0;E<u.length;E+=1){var M=u[E],C=lf(M,0,1),D=lf(M,-1);if((C===\'"\'||C==="\'"||C==="`"||D===\'"\'||D==="\'"||D==="`")&&C!==D)throw new Bu("property names with quotes must have matching quotes");if((M==="constructor"||!b)&&(y=!0),l+="."+M,p="%"+l+"%",uf(eu,p))m=eu[p];else if(m!=null){if(!(M in m)){if(!r)throw new Uu("base intrinsic for "+e+" exists, but the property is not available.");return}if(tu&&E+1>=u.length){var G=tu(m,M);b=!!G,b&&"get"in G&&!("originalValue"in G.get)?m=G.get:m=m[M]}else b=uf(m,M),m=m[M];b&&!y&&(eu[p]=m)}}return m}});var ff=It((vz,Ev)=>{"use strict";var QP=zu(),cf=QP("%Object.defineProperty%",!0)||!1;if(cf)try{cf({},"a",{value:1})}catch{cf=!1}Ev.exports=cf});var rd=It((_z,wv)=>{"use strict";var jP=zu(),hf=jP("%Object.getOwnPropertyDescriptor%",!0);if(hf)try{hf([],"length")}catch{hf=null}wv.exports=hf});var pf=It((xz,bv)=>{"use strict";var Mv=ff(),tR=jp(),ku=ja(),Sv=rd();bv.exports=function(e,r,u){if(!e||typeof e!="object"&&typeof e!="function")throw new ku("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new ku("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ku("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ku("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ku("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ku("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,h=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,m=arguments.length>6?arguments[6]:!1,y=!!Sv&&Sv(e,r);if(Mv)Mv(e,r,{configurable:p===null&&y?y.configurable:!p,enumerable:l===null&&y?y.enumerable:!l,value:u,writable:h===null&&y?y.writable:!h});else if(m||!l&&!h&&!p)e[r]=u;else throw new tR("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var df=It((Ez,Tv)=>{"use strict";var id=ff(),Av=function(){return!!id};Av.hasArrayLengthDefineBug=function(){if(!id)return null;try{return id([],"length",{value:1}).length!==1}catch{return!0}};Tv.exports=Av});var Lv=It((wz,Rv)=>{"use strict";var eR=zu(),Cv=pf(),nR=df()(),Iv=rd(),Pv=ja(),rR=eR("%Math.floor%");Rv.exports=function(e,r){if(typeof e!="function")throw new Pv("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||rR(r)!==r)throw new Pv("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],l=!0,h=!0;if("length"in e&&Iv){var p=Iv(e,"length");p&&!p.configurable&&(l=!1),p&&!p.writable&&(h=!1)}return(l||h||!u)&&(nR?Cv(e,"length",r,!0,!0):Cv(e,"length",r)),e}});var yf=It((Mz,gf)=>{"use strict";var od=af(),mf=zu(),iR=Lv(),oR=ja(),Ov=mf("%Function.prototype.apply%"),Fv=mf("%Function.prototype.call%"),Uv=mf("%Reflect.apply%",!0)||od.call(Fv,Ov),Nv=ff(),sR=mf("%Math.max%");gf.exports=function(e){if(typeof e!="function")throw new oR("a function is required");var r=Uv(od,Fv,arguments);return iR(r,1+sR(0,e.length-(arguments.length-1)),!0)};var Dv=function(){return Uv(od,Ov,arguments)};Nv?Nv(gf.exports,"apply",{value:Dv}):gf.exports.apply=Dv});var sd=It((Sz,kv)=>{"use strict";var Bv=zu(),zv=yf(),aR=zv(Bv("String.prototype.indexOf"));kv.exports=function(e,r){var u=Bv(e,!!r);return typeof u=="function"&&aR(e,".prototype.")>-1?zv(u):u}});var Vv=It((bz,Hv)=>{"use strict";var uR=sf()(),lR=sd(),ad=lR("Object.prototype.toString"),vf=function(e){return uR&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:ad(e)==="[object Arguments]"},Gv=function(e){return vf(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&ad(e)!=="[object Array]"&&ad(e.callee)==="[object Function]"},cR=function(){return vf(arguments)}();vf.isLegacyArguments=Gv;Hv.exports=cR?vf:Gv});var Gu=It((Az,Yv)=>{"use strict";var fR=Kp(),hR=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",pR=Object.prototype.toString,dR=Array.prototype.concat,Wv=pf(),gR=function(o){return typeof o=="function"&&pR.call(o)==="[object Function]"},qv=df()(),mR=function(o,e,r,u){if(e in o){if(u===!0){if(o[e]===r)return}else if(!gR(u)||!u())return}qv?Wv(o,e,r,!0):Wv(o,e,r)},Xv=function(o,e){var r=arguments.length>2?arguments[2]:{},u=fR(e);hR&&(u=dR.call(u,Object.getOwnPropertySymbols(e)));for(var l=0;l<u.length;l+=1)mR(o,u[l],e[u[l]],r[u[l]])};Xv.supportsDescriptors=!!qv;Yv.exports=Xv});var ud=It((Tz,Zv)=>{"use strict";var $v=function(o){return o!==o};Zv.exports=function(e,r){return e===0&&r===0?1/e===1/r:!!(e===r||$v(e)&&$v(r))}});var ld=It((Cz,Jv)=>{"use strict";var yR=ud();Jv.exports=function(){return typeof Object.is=="function"?Object.is:yR}});var Qv=It((Iz,Kv)=>{"use strict";var vR=ld(),_R=Gu();Kv.exports=function(){var e=vR();return _R(Object,{is:e},{is:function(){return Object.is!==e}}),e}});var n_=It((Pz,e_)=>{"use strict";var xR=Gu(),ER=yf(),wR=ud(),jv=ld(),MR=Qv(),t_=ER(jv(),Object);xR(t_,{getPolyfill:jv,implementation:wR,shim:MR});e_.exports=t_});var a_=It((Rz,s_)=>{"use strict";var cd=sd(),r_=sf()(),i_,o_,fd,hd;r_&&(i_=cd("Object.prototype.hasOwnProperty"),o_=cd("RegExp.prototype.exec"),fd={},_f=function(){throw fd},hd={toString:_f,valueOf:_f},typeof Symbol.toPrimitive=="symbol"&&(hd[Symbol.toPrimitive]=_f));var _f,SR=cd("Object.prototype.toString"),bR=Object.getOwnPropertyDescriptor,AR="[object RegExp]";s_.exports=r_?function(e){if(!e||typeof e!="object")return!1;var r=bR(e,"lastIndex"),u=r&&i_(r,"value");if(!u)return!1;try{o_(e,hd)}catch(l){return l===fd}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:SR(e)===AR}});var l_=It((Lz,u_)=>{"use strict";var Bl=function(){return typeof function(){}.name=="string"},Ul=Object.getOwnPropertyDescriptor;if(Ul)try{Ul([],"length")}catch{Ul=null}Bl.functionsHaveConfigurableNames=function(){if(!Bl()||!Ul)return!1;var e=Ul(function(){},"name");return!!e&&!!e.configurable};var TR=Function.prototype.bind;Bl.boundFunctionsHaveNames=function(){return Bl()&&typeof TR=="function"&&function(){}.bind().name!==""};u_.exports=Bl});var h_=It((Nz,f_)=>{"use strict";var c_=pf(),CR=df()(),IR=l_().functionsHaveConfigurableNames(),PR=ja();f_.exports=function(e,r){if(typeof e!="function")throw new PR("`fn` is not a function");var u=arguments.length>2&&!!arguments[2];return(!u||IR)&&(CR?c_(e,"name",r,!0,!0):c_(e,"name",r)),e}});var pd=It((Dz,p_)=>{"use strict";var RR=h_(),LR=ja(),NR=Object;p_.exports=RR(function(){if(this==null||this!==NR(this))throw new LR("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 dd=It((Oz,d_)=>{"use strict";var DR=pd(),OR=Gu().supportsDescriptors,FR=Object.getOwnPropertyDescriptor;d_.exports=function(){if(OR&&/a/mig.flags==="gim"){var e=FR(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var r="",u={};if(Object.defineProperty(u,"hasIndices",{get:function(){r+="d"}}),Object.defineProperty(u,"sticky",{get:function(){r+="y"}}),e.get.call(u),r==="dy")return e.get}}return DR}});var y_=It((Fz,m_)=>{"use strict";var UR=Gu().supportsDescriptors,BR=dd(),zR=Object.getOwnPropertyDescriptor,kR=Object.defineProperty,GR=TypeError,g_=Object.getPrototypeOf,HR=/a/;m_.exports=function(){if(!UR||!g_)throw new GR("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=BR(),r=g_(HR),u=zR(r,"flags");return(!u||u.get!==e)&&kR(r,"flags",{configurable:!0,enumerable:!1,get:e}),e}});var E_=It((Uz,x_)=>{"use strict";var VR=Gu(),WR=yf(),qR=pd(),v_=dd(),XR=y_(),__=WR(v_());VR(__,{getPolyfill:v_,implementation:qR,shim:XR});x_.exports=__});var M_=It((Bz,w_)=>{"use strict";var YR=Date.prototype.getDay,$R=function(e){try{return YR.call(e),!0}catch{return!1}},ZR=Object.prototype.toString,JR="[object Date]",KR=sf()();w_.exports=function(e){return typeof e!="object"||e===null?!1:KR?$R(e):ZR.call(e)===JR}});var gd=It((zz,D_)=>{var S_=Kp(),b_=Vv(),A_=n_(),T_=a_(),C_=E_(),I_=M_(),P_=Date.prototype.getTime;function N_(o,e,r){var u=r||{};return(u.strict?A_(o,e):o===e)?!0:!o||!e||typeof o!="object"&&typeof e!="object"?u.strict?A_(o,e):o==e:QR(o,e,u)}function R_(o){return o==null}function L_(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 QR(o,e,r){var u,l;if(typeof o!=typeof e||R_(o)||R_(e)||o.prototype!==e.prototype||b_(o)!==b_(e))return!1;var h=T_(o),p=T_(e);if(h!==p)return!1;if(h||p)return o.source===e.source&&C_(o)===C_(e);if(I_(o)&&I_(e))return P_.call(o)===P_.call(e);var m=L_(o),y=L_(e);if(m!==y)return!1;if(m||y){if(o.length!==e.length)return!1;for(u=0;u<o.length;u++)if(o[u]!==e[u])return!1;return!0}if(typeof o!=typeof e)return!1;try{var x=S_(o),E=S_(e)}catch{return!1}if(x.length!==E.length)return!1;for(x.sort(),E.sort(),u=x.length-1;u>=0;u--)if(x[u]!=E[u])return!1;for(u=x.length-1;u>=0;u--)if(l=x[u],!N_(o[l],e[l],r))return!1;return!0}D_.exports=N_});var Td=It((qk,G_)=>{var HL=gd(),Rs=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:VL};Rs.prototype.compare=function(o,e){if(o.type!==e.type||!k_(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,u=z_(o),l=z_(e);return u.every(function(h){return this.some(function(p){return r.compare(h,p)})},l)}}return!1};function z_(o){return o.coordinates.map(function(e){return{type:o.type.replace("Multi",""),coordinates:e}})}function k_(o,e){return o.hasOwnProperty("coordinates")?o.coordinates.length===e.coordinates.length:o.length===e.length}Rs.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};Rs.prototype.compareLine=function(o,e,r,u){if(!k_(o,e))return!1;var l=this.pseudoNode?o:this.removePseudo(o),h=this.pseudoNode?e:this.removePseudo(e);if(!(u&&!this.compareCoord(l[0],h[0])&&(h=this.fixStartIndex(h,l),!h))){var p=this.compareCoord(l[r],h[r]);return this.direction||p?this.comparePath(l,h):this.compareCoord(l[r],h[h.length-(1+r)])?this.comparePath(l.slice().reverse(),h):!1}};Rs.prototype.fixStartIndex=function(o,e){for(var r,u=-1,l=0;l<o.length;l++)if(this.compareCoord(o[l],e[0])){u=l;break}return u>=0&&(r=[].concat(o.slice(u,o.length),o.slice(1,u+1))),r};Rs.prototype.comparePath=function(o,e){var r=this;return o.every(function(u,l){return r.compareCoord(u,this[l])},e)};Rs.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),u=e.coordinates.slice(1,e.coordinates.length),l=this;return r.every(function(h){return this.some(function(p){return l.compareLine(h,p,1,!0)})},u)}else return!1};Rs.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)};Rs.prototype.compareBBox=function(o,e){return!!(!o.bbox&&!e.bbox||o.bbox&&e.bbox&&this.compareCoord(o.bbox,e.bbox))};Rs.prototype.removePseudo=function(o){return o};function VL(o,e){return HL(o,e,{strict:!0})}G_.exports=Rs});var H_=It((rG,wf)=>{function Aa(o,e,r,u){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,u)}Aa.prototype.run=function(o,e,r,u){this._init(o,e,r,u);for(var l=0;l<this._datasetLength;l++)if(this._visited[l]!==1){this._visited[l]=1;var h=this._regionQuery(l);if(h.length<this.minPts)this.noise.push(l);else{var p=this.clusters.length;this.clusters.push([]),this._addToCluster(l,p),this._expandCluster(p,h)}}return this.clusters};Aa.prototype._init=function(o,e,r,u){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),u&&(this.distance=u)};Aa.prototype._expandCluster=function(o,e){for(var r=0;r<e.length;r++){var u=e[r];if(this._visited[u]!==1){this._visited[u]=1;var l=this._regionQuery(u);l.length>=this.minPts&&(e=this._mergeArrays(e,l))}this._assigned[u]!==1&&this._addToCluster(u,o)}};Aa.prototype._addToCluster=function(o,e){this.clusters[e].push(o),this._assigned[o]=1};Aa.prototype._regionQuery=function(o){for(var e=[],r=0;r<this._datasetLength;r++){var u=this.distance(this.dataset[o],this.dataset[r]);u<this.epsilon&&e.push(r)}return e};Aa.prototype._mergeArrays=function(o,e){for(var r=e.length,u=0;u<r;u++){var l=e[u];o.indexOf(l)<0&&o.push(l)}return o};Aa.prototype._euclideanDistance=function(o,e){for(var r=0,u=Math.min(o.length,e.length);u--;)r+=(o[u]-e[u])*(o[u]-e[u]);return Math.sqrt(r)};typeof wf<"u"&&wf.exports&&(wf.exports=Aa)});var V_=It((iG,Mf)=>{function Ta(o,e,r){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(o,e,r)}Ta.prototype.init=function(o,e,r){this.assignments=[],this.centroids=[],typeof o<"u"&&(this.dataset=o),typeof e<"u"&&(this.k=e),typeof r<"u"&&(this.distance=r)};Ta.prototype.run=function(o,e){this.init(o,e);for(var r=this.dataset.length,u=0;u<this.k;u++)this.centroids[u]=this.randomCentroid();for(var l=!0;l;){l=this.assign();for(var h=0;h<this.k;h++){for(var p=new Array(E),m=0,y=0;y<E;y++)p[y]=0;for(var x=0;x<r;x++){var E=this.dataset[x].length;if(h===this.assignments[x]){for(var y=0;y<E;y++)p[y]+=this.dataset[x][y];m++}}if(m>0){for(var y=0;y<E;y++)p[y]/=m;this.centroids[h]=p}else this.centroids[h]=this.randomCentroid(),l=!0}}return this.getClusters()};Ta.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};Ta.prototype.assign=function(){for(var o=!1,e=this.dataset.length,r,u=0;u<e;u++)r=this.argmin(this.dataset[u],this.centroids,this.distance),r!=this.assignments[u]&&(this.assignments[u]=r,o=!0);return o};Ta.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]>"u"&&(o[e]=[]),o[e].push(r);return o};Ta.prototype.argmin=function(o,e,r){for(var u=Number.MAX_VALUE,l=0,h=e.length,p,m=0;m<h;m++)p=r(o,e[m]),p<u&&(u=p,l=m);return l};Ta.prototype.distance=function(o,e){for(var r=0,u=Math.min(o.length,e.length);u--;){var l=o[u]-e[u];r+=l*l}return Math.sqrt(r)};typeof Mf<"u"&&Mf.exports&&(Mf.exports=Ta)});var Cd=It((oG,Sf)=>{function Ls(o,e,r){this._queue=[],this._priorities=[],this._sorting="desc",this._init(o,e,r)}Ls.prototype.insert=function(o,e){for(var r=this._queue.length,u=r;u--;){var l=this._priorities[u];this._sorting==="desc"?e>l&&(r=u):e<l&&(r=u)}this._insertAt(o,e,r)};Ls.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}}};Ls.prototype.forEach=function(o){this._queue.forEach(o)};Ls.prototype.getElements=function(){return this._queue};Ls.prototype.getElementPriority=function(o){return this._priorities[o]};Ls.prototype.getPriorities=function(){return this._priorities};Ls.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};Ls.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 u=0;u<o.length;u++)this.insert(o[u],e[u])}r&&(this._sorting=r)};Ls.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 Sf<"u"&&Sf.exports&&(Sf.exports=Ls)});var q_=It((sG,Vu)=>{typeof Vu<"u"&&Vu.exports&&(W_=Cd());var W_;function ta(o,e,r,u){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(o,e,r,u)}ta.prototype.run=function(o,e,r,u){this._init(o,e,r,u);for(var l=0,h=this.dataset.length;l<h;l++)if(this._processed[l]!==1){this._processed[l]=1,this.clusters.push([l]);var p=this.clusters.length-1;this._orderedList.push(l);var m=new W_(null,null,"asc"),y=this._regionQuery(l);this._distanceToCore(l)!==void 0&&(this._updateQueue(l,y,m),this._expandCluster(p,m))}return this.clusters};ta.prototype.getReachabilityPlot=function(){for(var o=[],e=0,r=this._orderedList.length;e<r;e++){var u=this._orderedList[e],l=this._reachability[u];o.push([u,l])}return o};ta.prototype._init=function(o,e,r,u){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),u&&(this.distance=u)};ta.prototype._updateQueue=function(o,e,r){var u=this;this._coreDistance=this._distanceToCore(o),e.forEach(function(l){if(u._processed[l]===void 0){var h=u.distance(u.dataset[o],u.dataset[l]),p=Math.max(u._coreDistance,h);u._reachability[l]===void 0?(u._reachability[l]=p,r.insert(l,p)):p<u._reachability[l]&&(u._reachability[l]=p,r.remove(l),r.insert(l,p))}})};ta.prototype._expandCluster=function(o,e){for(var r=e.getElements(),u=0,l=r.length;u<l;u++){var h=r[u];if(this._processed[h]===void 0){var p=this._regionQuery(h);this._processed[h]=1,this.clusters[o].push(h),this._orderedList.push(h),this._distanceToCore(h)!==void 0&&(this._updateQueue(h,p,e),this._expandCluster(o,e))}}};ta.prototype._distanceToCore=function(o){for(var e=this.epsilon,r=0;r<e;r++){var u=this._regionQuery(o,r);if(u.length>=this.minPts)return r}};ta.prototype._regionQuery=function(o,e){e=e||this.epsilon;for(var r=[],u=0,l=this.dataset.length;u<l;u++)this.distance(this.dataset[o],this.dataset[u])<e&&r.push(u);return r};ta.prototype._euclideanDistance=function(o,e){for(var r=0,u=Math.min(o.length,e.length);u--;)r+=(o[u]-e[u])*(o[u]-e[u]);return Math.sqrt(r)};typeof Vu<"u"&&Vu.exports&&(Vu.exports=ta)});var X_=It((aG,bf)=>{typeof bf<"u"&&bf.exports&&(bf.exports={DBSCAN:H_(),KMEANS:V_(),OPTICS:q_(),PriorityQueue:Cd()})});var Id=It((pG,$_)=>{"use strict";$_.exports={eudist:function(e,r,u){for(var l=e.length,h=0,p=0;p<l;p++){var m=(e[p]||0)-(r[p]||0);h+=m*m}return u?Math.sqrt(h):h},mandist:function(e,r,u){for(var l=e.length,h=0,p=0;p<l;p++)h+=Math.abs((e[p]||0)-(r[p]||0));return u?Math.sqrt(h):h},dist:function(e,r,u){var l=Math.abs(e-r);return u?l:l*l}}});var K_=It((dG,J_)=>{"use strict";var Z_=Id(),ZL=Z_.eudist,JL=Z_.dist;J_.exports={kmrand:function(e,r){for(var u={},l=[],h=r<<2,p=e.length,m=e[0].length>0;l.length<r&&h-- >0;){var y=e[Math.floor(Math.random()*p)],x=m?y.join("_"):""+y;u[x]||(u[x]=!0,l.push(y))}if(l.length<r)throw new Error("Error initializating clusters");return l},kmpp:function(e,r){var u=e[0].length?ZL:JL,l=[],h=e.length,p=e[0].length>0,m={},y=e[Math.floor(Math.random()*h)],x=p?y.join("_"):""+y;for(l.push(y),m[x]=!0;l.length<r;){for(var E=[],b=l.length,M=0,C=[],D=0;D<h;D++){for(var G=1/0,O=0;O<b;O++){var L=u(e[D],l[O]);L<=G&&(G=L)}E[D]=G}for(var k=0;k<h;k++)M+=E[k];for(var F=0;F<h;F++)C[F]={i:F,v:e[F],pr:E[F]/M,cs:0};C.sort(function(et,U){return et.pr-U.pr}),C[0].cs=C[0].pr;for(var $=1;$<h;$++)C[$].cs=C[$-1].cs+C[$].pr;for(var Z=Math.random(),it=0;it<h-1&&C[it++].cs<Z;);l.push(C[it-1].v)}return l}}});var n1=It((yG,e1)=>{"use strict";var Pd=Id(),t1=K_(),KL=Pd.eudist,gG=Pd.mandist,mG=Pd.dist,QL=t1.kmrand,jL=t1.kmpp,Q_=1e4;function j_(o,e,r){r=r||[];for(var u=0;u<o;u++)r[u]=e;return r}function t2(o,e,r,u){var l=[],h=[],p=[],m=[],y=!1,x=u||Q_,E=o.length,b=o[0].length,M=b>0,C=[];if(r)r=="kmrand"?l=QL(o,e):r=="kmpp"?l=jL(o,e):l=r;else for(var D={};l.length<e;){var G=Math.floor(Math.random()*E);D[G]||(D[G]=!0,l.push(o[G]))}do{j_(e,0,C);for(var O=0;O<E;O++){for(var L=1/0,k=0,F=0;F<e;F++){var m=M?KL(o[O],l[F]):Math.abs(o[O]-l[F]);m<=L&&(L=m,k=F)}p[O]=k,C[k]++}for(var $=[],h=[],Z=0,it=0;it<e;it++)$[it]=M?j_(b,0,$[it]):0,h[it]=l[it];if(M){for(var et=0;et<e;et++)l[et]=[];for(var U=0;U<E;U++)for(var wt=p[U],Lt=$[wt],Ot=o[U],W=0;W<b;W++)Lt[W]+=Ot[W];y=!0;for(var de=0;de<e;de++){for(var yt=l[de],zt=$[de],Kt=h[de],ie=C[de],_t=0;_t<b;_t++)yt[_t]=zt[_t]/ie||0;if(y){for(var Pt=0;Pt<b;Pt++)if(Kt[Pt]!=yt[Pt]){y=!1;break}}}}else{for(var q=0;q<E;q++){var oe=p[q];$[oe]+=o[q]}for(var Vt=0;Vt<e;Vt++)l[Vt]=$[Vt]/C[Vt]||0;y=!0;for(var tn=0;tn<e;tn++)if(h[tn]!=l[tn]){y=!1;break}}y=y||--x<=0}while(!y);return{it:Q_-x,k:e,idxs:p,centroids:l}}e1.exports=t2});var $u=It((Fd,Ud)=>{(function(o,e){typeof Fd=="object"&&typeof Ud<"u"?Ud.exports=e():typeof define=="function"&&define.amd?define(e):(o=typeof globalThis<"u"?globalThis:o||self,o.polygonClipping=e())})(Fd,function(){"use strict";function o(Y,w){var T={label:0,sent:function(){if(B[0]&1)throw B[1];return B[1]},trys:[],ops:[]},N,z,B,st;return st={next:K(0),throw:K(1),return:K(2)},typeof Symbol=="function"&&(st[Symbol.iterator]=function(){return this}),st;function K(at){return function(j){return ct([at,j])}}function ct(at){if(N)throw new TypeError("Generator is already executing.");for(;T;)try{if(N=1,z&&(B=at[0]&2?z.return:at[0]?z.throw||((B=z.return)&&B.call(z),0):z.next)&&!(B=B.call(z,at[1])).done)return B;switch(z=0,B&&(at=[at[0]&2,B.value]),at[0]){case 0:case 1:B=at;break;case 4:return T.label++,{value:at[1],done:!1};case 5:T.label++,z=at[1],at=[0];continue;case 7:at=T.ops.pop(),T.trys.pop();continue;default:if(B=T.trys,!(B=B.length>0&&B[B.length-1])&&(at[0]===6||at[0]===2)){T=0;continue}if(at[0]===3&&(!B||at[1]>B[0]&&at[1]<B[3])){T.label=at[1];break}if(at[0]===6&&T.label<B[1]){T.label=B[1],B=at;break}if(B&&T.label<B[2]){T.label=B[2],T.ops.push(at);break}B[2]&&T.ops.pop(),T.trys.pop();continue}at=w.call(Y,T)}catch(j){at=[6,j],z=0}finally{N=B=0}if(at[0]&5)throw at[1];return{value:at[0]?at[1]:void 0,done:!0}}}var e=function(){function Y(w,T){this.next=null,this.key=w,this.data=T,this.left=null,this.right=null}return Y}();function r(Y,w){return Y>w?1:Y<w?-1:0}function u(Y,w,T){for(var N=new e(null,null),z=N,B=N;;){var st=T(Y,w.key);if(st<0){if(w.left===null)break;if(T(Y,w.left.key)<0){var K=w.left;if(w.left=K.right,K.right=w,w=K,w.left===null)break}B.left=w,B=w,w=w.left}else if(st>0){if(w.right===null)break;if(T(Y,w.right.key)>0){var K=w.right;if(w.right=K.left,K.left=w,w=K,w.right===null)break}z.right=w,z=w,w=w.right}else break}return z.right=w.left,B.left=w.right,w.left=N.right,w.right=N.left,w}function l(Y,w,T,N){var z=new e(Y,w);if(T===null)return z.left=z.right=null,z;T=u(Y,T,N);var B=N(Y,T.key);return B<0?(z.left=T.left,z.right=T,T.left=null):B>=0&&(z.right=T.right,z.left=T,T.right=null),z}function h(Y,w,T){var N=null,z=null;if(w){w=u(Y,w,T);var B=T(w.key,Y);B===0?(N=w.left,z=w.right):B<0?(z=w.right,w.right=null,N=w):(N=w.left,w.left=null,z=w)}return{left:N,right:z}}function p(Y,w,T){return w===null?Y:(Y===null||(w=u(Y.key,w,T),w.left=Y),w)}function m(Y,w,T,N,z){if(Y){N(""+w+(T?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+z(Y)+`\n`);var B=w+(T?" ":"\\u2502 ");Y.left&&m(Y.left,B,!1,N,z),Y.right&&m(Y.right,B,!0,N,z)}}var y=function(){function Y(w){w===void 0&&(w=r),this._root=null,this._size=0,this._comparator=w}return Y.prototype.insert=function(w,T){return this._size++,this._root=l(w,T,this._root,this._comparator)},Y.prototype.add=function(w,T){var N=new e(w,T);this._root===null&&(N.left=N.right=null,this._size++,this._root=N);var z=this._comparator,B=u(w,this._root,z),st=z(w,B.key);return st===0?this._root=B:(st<0?(N.left=B.left,N.right=B,B.left=null):st>0&&(N.right=B.right,N.left=B,B.right=null),this._size++,this._root=N),this._root},Y.prototype.remove=function(w){this._root=this._remove(w,this._root,this._comparator)},Y.prototype._remove=function(w,T,N){var z;if(T===null)return null;T=u(w,T,N);var B=N(w,T.key);return B===0?(T.left===null?z=T.right:(z=u(w,T.left,N),z.right=T.right),this._size--,z):T},Y.prototype.pop=function(){var w=this._root;if(w){for(;w.left;)w=w.left;return this._root=u(w.key,this._root,this._comparator),this._root=this._remove(w.key,this._root,this._comparator),{key:w.key,data:w.data}}return null},Y.prototype.findStatic=function(w){for(var T=this._root,N=this._comparator;T;){var z=N(w,T.key);if(z===0)return T;z<0?T=T.left:T=T.right}return null},Y.prototype.find=function(w){return this._root&&(this._root=u(w,this._root,this._comparator),this._comparator(w,this._root.key)!==0)?null:this._root},Y.prototype.contains=function(w){for(var T=this._root,N=this._comparator;T;){var z=N(w,T.key);if(z===0)return!0;z<0?T=T.left:T=T.right}return!1},Y.prototype.forEach=function(w,T){for(var N=this._root,z=[],B=!1;!B;)N!==null?(z.push(N),N=N.left):z.length!==0?(N=z.pop(),w.call(T,N),N=N.right):B=!0;return this},Y.prototype.range=function(w,T,N,z){for(var B=[],st=this._comparator,K=this._root,ct;B.length!==0||K;)if(K)B.push(K),K=K.left;else{if(K=B.pop(),ct=st(K.key,T),ct>0)break;if(st(K.key,w)>=0&&N.call(z,K))return this;K=K.right}return this},Y.prototype.keys=function(){var w=[];return this.forEach(function(T){var N=T.key;return w.push(N)}),w},Y.prototype.values=function(){var w=[];return this.forEach(function(T){var N=T.data;return w.push(N)}),w},Y.prototype.min=function(){return this._root?this.minNode(this._root).key:null},Y.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},Y.prototype.minNode=function(w){if(w===void 0&&(w=this._root),w)for(;w.left;)w=w.left;return w},Y.prototype.maxNode=function(w){if(w===void 0&&(w=this._root),w)for(;w.right;)w=w.right;return w},Y.prototype.at=function(w){for(var T=this._root,N=!1,z=0,B=[];!N;)if(T)B.push(T),T=T.left;else if(B.length>0){if(T=B.pop(),z===w)return T;z++,T=T.right}else N=!0;return null},Y.prototype.next=function(w){var T=this._root,N=null;if(w.right){for(N=w.right;N.left;)N=N.left;return N}for(var z=this._comparator;T;){var B=z(w.key,T.key);if(B===0)break;B<0?(N=T,T=T.left):T=T.right}return N},Y.prototype.prev=function(w){var T=this._root,N=null;if(w.left!==null){for(N=w.left;N.right;)N=N.right;return N}for(var z=this._comparator;T;){var B=z(w.key,T.key);if(B===0)break;B<0?T=T.left:(N=T,T=T.right)}return N},Y.prototype.clear=function(){return this._root=null,this._size=0,this},Y.prototype.toList=function(){return b(this._root)},Y.prototype.load=function(w,T,N){T===void 0&&(T=[]),N===void 0&&(N=!1);var z=w.length,B=this._comparator;if(N&&D(w,T,0,z-1,B),this._root===null)this._root=x(w,T,0,z),this._size=z;else{var st=C(this.toList(),E(w,T),B);z=this._size+z,this._root=M({head:st},0,z)}return this},Y.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(Y.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(Y.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Y.prototype.toString=function(w){w===void 0&&(w=function(N){return String(N.key)});var T=[];return m(this._root,"",!0,function(N){return T.push(N)},w),T.join("")},Y.prototype.update=function(w,T,N){var z=this._comparator,B=h(w,this._root,z),st=B.left,K=B.right;z(w,T)<0?K=l(T,N,K,z):st=l(T,N,st,z),this._root=p(st,K,z)},Y.prototype.split=function(w){return h(w,this._root,this._comparator)},Y.prototype[Symbol.iterator]=function(){var w,T,N;return o(this,function(z){switch(z.label){case 0:w=this._root,T=[],N=!1,z.label=1;case 1:return N?[3,6]:w===null?[3,2]:(T.push(w),w=w.left,[3,5]);case 2:return T.length===0?[3,4]:(w=T.pop(),[4,w]);case 3:return z.sent(),w=w.right,[3,5];case 4:N=!0,z.label=5;case 5:return[3,1];case 6:return[2]}})},Y}();function x(Y,w,T,N){var z=N-T;if(z>0){var B=T+Math.floor(z/2),st=Y[B],K=w[B],ct=new e(st,K);return ct.left=x(Y,w,T,B),ct.right=x(Y,w,B+1,N),ct}return null}function E(Y,w){for(var T=new e(null,null),N=T,z=0;z<Y.length;z++)N=N.next=new e(Y[z],w[z]);return N.next=null,T.next}function b(Y){for(var w=Y,T=[],N=!1,z=new e(null,null),B=z;!N;)w?(T.push(w),w=w.left):T.length>0?(w=B=B.next=T.pop(),w=w.right):N=!0;return B.next=null,z.next}function M(Y,w,T){var N=T-w;if(N>0){var z=w+Math.floor(N/2),B=M(Y,w,z),st=Y.head;return st.left=B,Y.head=Y.head.next,st.right=M(Y,z+1,T),st}return null}function C(Y,w,T){for(var N=new e(null,null),z=N,B=Y,st=w;B!==null&&st!==null;)T(B.key,st.key)<0?(z.next=B,B=B.next):(z.next=st,st=st.next),z=z.next;return B!==null?z.next=B:st!==null&&(z.next=st),N.next}function D(Y,w,T,N,z){if(!(T>=N)){for(var B=Y[T+N>>1],st=T-1,K=N+1;;){do st++;while(z(Y[st],B)<0);do K--;while(z(Y[K],B)>0);if(st>=K)break;var ct=Y[st];Y[st]=Y[K],Y[K]=ct,ct=w[st],w[st]=w[K],w[K]=ct}D(Y,w,T,K,z),D(Y,w,K+1,N,z)}}let G=(Y,w)=>Y.ll.x<=w.x&&w.x<=Y.ur.x&&Y.ll.y<=w.y&&w.y<=Y.ur.y,O=(Y,w)=>{if(w.ur.x<Y.ll.x||Y.ur.x<w.ll.x||w.ur.y<Y.ll.y||Y.ur.y<w.ll.y)return null;let T=Y.ll.x<w.ll.x?w.ll.x:Y.ll.x,N=Y.ur.x<w.ur.x?Y.ur.x:w.ur.x,z=Y.ll.y<w.ll.y?w.ll.y:Y.ll.y,B=Y.ur.y<w.ur.y?Y.ur.y:w.ur.y;return{ll:{x:T,y:z},ur:{x:N,y:B}}},L=Number.EPSILON;L===void 0&&(L=Math.pow(2,-52));let k=L*L,F=(Y,w)=>{if(-L<Y&&Y<L&&-L<w&&w<L)return 0;let T=Y-w;return T*T<k*Y*w?0:Y<w?-1:1};class ${constructor(){this.reset()}reset(){this.xRounder=new Z,this.yRounder=new Z}round(w,T){return{x:this.xRounder.round(w),y:this.yRounder.round(T)}}}class Z{constructor(){this.tree=new y,this.round(0)}round(w){let T=this.tree.add(w),N=this.tree.prev(T);if(N!==null&&F(T.key,N.key)===0)return this.tree.remove(w),N.key;let z=this.tree.next(T);return z!==null&&F(T.key,z.key)===0?(this.tree.remove(w),z.key):w}}let it=new $,et=11102230246251565e-32,U=134217729,wt=(3+8*et)*et;function Lt(Y,w,T,N,z){let B,st,K,ct,at=w[0],j=N[0],rt=0,ft=0;j>at==j>-at?(B=at,at=w[++rt]):(B=j,j=N[++ft]);let lt=0;if(rt<Y&&ft<T)for(j>at==j>-at?(st=at+B,K=B-(st-at),at=w[++rt]):(st=j+B,K=B-(st-j),j=N[++ft]),B=st,K!==0&&(z[lt++]=K);rt<Y&&ft<T;)j>at==j>-at?(st=B+at,ct=st-B,K=B-(st-ct)+(at-ct),at=w[++rt]):(st=B+j,ct=st-B,K=B-(st-ct)+(j-ct),j=N[++ft]),B=st,K!==0&&(z[lt++]=K);for(;rt<Y;)st=B+at,ct=st-B,K=B-(st-ct)+(at-ct),at=w[++rt],B=st,K!==0&&(z[lt++]=K);for(;ft<T;)st=B+j,ct=st-B,K=B-(st-ct)+(j-ct),j=N[++ft],B=st,K!==0&&(z[lt++]=K);return(B!==0||lt===0)&&(z[lt++]=B),lt}function Ot(Y,w){let T=w[0];for(let N=1;N<Y;N++)T+=w[N];return T}function W(Y){return new Float64Array(Y)}let de=(3+16*et)*et,yt=(2+12*et)*et,zt=(9+64*et)*et*et,Kt=W(4),ie=W(8),_t=W(12),Pt=W(16),q=W(4);function oe(Y,w,T,N,z,B,st){let K,ct,at,j,rt,ft,lt,Gt,kt,re,Yt,Mn,pr,Wn,Cn,tr,Ur,Un,Wt=Y-z,Bn=T-z,qn=w-B,zn=N-B;Wn=Wt*zn,ft=U*Wt,lt=ft-(ft-Wt),Gt=Wt-lt,ft=U*zn,kt=ft-(ft-zn),re=zn-kt,Cn=Gt*re-(Wn-lt*kt-Gt*kt-lt*re),tr=qn*Bn,ft=U*qn,lt=ft-(ft-qn),Gt=qn-lt,ft=U*Bn,kt=ft-(ft-Bn),re=Bn-kt,Ur=Gt*re-(tr-lt*kt-Gt*kt-lt*re),Yt=Cn-Ur,rt=Cn-Yt,Kt[0]=Cn-(Yt+rt)+(rt-Ur),Mn=Wn+Yt,rt=Mn-Wn,pr=Wn-(Mn-rt)+(Yt-rt),Yt=pr-tr,rt=pr-Yt,Kt[1]=pr-(Yt+rt)+(rt-tr),Un=Mn+Yt,rt=Un-Mn,Kt[2]=Mn-(Un-rt)+(Yt-rt),Kt[3]=Un;let _n=Ot(4,Kt),bi=yt*st;if(_n>=bi||-_n>=bi||(rt=Y-Wt,K=Y-(Wt+rt)+(rt-z),rt=T-Bn,at=T-(Bn+rt)+(rt-z),rt=w-qn,ct=w-(qn+rt)+(rt-B),rt=N-zn,j=N-(zn+rt)+(rt-B),K===0&&ct===0&&at===0&&j===0)||(bi=zt*st+wt*Math.abs(_n),_n+=Wt*j+zn*K-(qn*at+Bn*ct),_n>=bi||-_n>=bi))return _n;Wn=K*zn,ft=U*K,lt=ft-(ft-K),Gt=K-lt,ft=U*zn,kt=ft-(ft-zn),re=zn-kt,Cn=Gt*re-(Wn-lt*kt-Gt*kt-lt*re),tr=ct*Bn,ft=U*ct,lt=ft-(ft-ct),Gt=ct-lt,ft=U*Bn,kt=ft-(ft-Bn),re=Bn-kt,Ur=Gt*re-(tr-lt*kt-Gt*kt-lt*re),Yt=Cn-Ur,rt=Cn-Yt,q[0]=Cn-(Yt+rt)+(rt-Ur),Mn=Wn+Yt,rt=Mn-Wn,pr=Wn-(Mn-rt)+(Yt-rt),Yt=pr-tr,rt=pr-Yt,q[1]=pr-(Yt+rt)+(rt-tr),Un=Mn+Yt,rt=Un-Mn,q[2]=Mn-(Un-rt)+(Yt-rt),q[3]=Un;let Xr=Lt(4,Kt,4,q,ie);Wn=Wt*j,ft=U*Wt,lt=ft-(ft-Wt),Gt=Wt-lt,ft=U*j,kt=ft-(ft-j),re=j-kt,Cn=Gt*re-(Wn-lt*kt-Gt*kt-lt*re),tr=qn*at,ft=U*qn,lt=ft-(ft-qn),Gt=qn-lt,ft=U*at,kt=ft-(ft-at),re=at-kt,Ur=Gt*re-(tr-lt*kt-Gt*kt-lt*re),Yt=Cn-Ur,rt=Cn-Yt,q[0]=Cn-(Yt+rt)+(rt-Ur),Mn=Wn+Yt,rt=Mn-Wn,pr=Wn-(Mn-rt)+(Yt-rt),Yt=pr-tr,rt=pr-Yt,q[1]=pr-(Yt+rt)+(rt-tr),Un=Mn+Yt,rt=Un-Mn,q[2]=Mn-(Un-rt)+(Yt-rt),q[3]=Un;let ea=Lt(Xr,ie,4,q,_t);Wn=K*j,ft=U*K,lt=ft-(ft-K),Gt=K-lt,ft=U*j,kt=ft-(ft-j),re=j-kt,Cn=Gt*re-(Wn-lt*kt-Gt*kt-lt*re),tr=ct*at,ft=U*ct,lt=ft-(ft-ct),Gt=ct-lt,ft=U*at,kt=ft-(ft-at),re=at-kt,Ur=Gt*re-(tr-lt*kt-Gt*kt-lt*re),Yt=Cn-Ur,rt=Cn-Yt,q[0]=Cn-(Yt+rt)+(rt-Ur),Mn=Wn+Yt,rt=Mn-Wn,pr=Wn-(Mn-rt)+(Yt-rt),Yt=pr-tr,rt=pr-Yt,q[1]=pr-(Yt+rt)+(rt-tr),Un=Mn+Yt,rt=Un-Mn,q[2]=Mn-(Un-rt)+(Yt-rt),q[3]=Un;let Yr=Lt(ea,_t,4,q,Pt);return Pt[Yr-1]}function Vt(Y,w,T,N,z,B){let st=(w-B)*(T-z),K=(Y-z)*(N-B),ct=st-K,at=Math.abs(st+K);return Math.abs(ct)>=de*at?ct:-oe(Y,w,T,N,z,B,at)}let tn=(Y,w)=>Y.x*w.y-Y.y*w.x,Mt=(Y,w)=>Y.x*w.x+Y.y*w.y,mn=(Y,w,T)=>{let N=Vt(Y.x,Y.y,w.x,w.y,T.x,T.y);return N>0?-1:N<0?1:0},Vn=Y=>Math.sqrt(Mt(Y,Y)),yn=(Y,w,T)=>{let N={x:w.x-Y.x,y:w.y-Y.y},z={x:T.x-Y.x,y:T.y-Y.y};return tn(z,N)/Vn(z)/Vn(N)},Ge=(Y,w,T)=>{let N={x:w.x-Y.x,y:w.y-Y.y},z={x:T.x-Y.x,y:T.y-Y.y};return Mt(z,N)/Vn(z)/Vn(N)},an=(Y,w,T)=>w.y===0?null:{x:Y.x+w.x/w.y*(T-Y.y),y:T},Et=(Y,w,T)=>w.x===0?null:{x:T,y:Y.y+w.y/w.x*(T-Y.x)},Pr=(Y,w,T,N)=>{if(w.x===0)return Et(T,N,Y.x);if(N.x===0)return Et(Y,w,T.x);if(w.y===0)return an(T,N,Y.y);if(N.y===0)return an(Y,w,T.y);let z=tn(w,N);if(z==0)return null;let B={x:T.x-Y.x,y:T.y-Y.y},st=tn(B,w)/z,K=tn(B,N)/z,ct=Y.x+K*w.x,at=T.x+st*N.x,j=Y.y+K*w.y,rt=T.y+st*N.y,ft=(ct+at)/2,lt=(j+rt)/2;return{x:ft,y:lt}};class Jt{static compare(w,T){let N=Jt.comparePoints(w.point,T.point);return N!==0?N:(w.point!==T.point&&w.link(T),w.isLeft!==T.isLeft?w.isLeft?1:-1:hn.compare(w.segment,T.segment))}static comparePoints(w,T){return w.x<T.x?-1:w.x>T.x?1:w.y<T.y?-1:w.y>T.y?1:0}constructor(w,T){w.events===void 0?w.events=[this]:w.events.push(this),this.point=w,this.isLeft=T}link(w){if(w.point===this.point)throw new Error("Tried to link already linked events");let T=w.point.events;for(let N=0,z=T.length;N<z;N++){let B=T[N];this.point.events.push(B),B.point=this.point}this.checkForConsuming()}checkForConsuming(){let w=this.point.events.length;for(let T=0;T<w;T++){let N=this.point.events[T];if(N.segment.consumedBy===void 0)for(let z=T+1;z<w;z++){let B=this.point.events[z];B.consumedBy===void 0&&N.otherSE.point.events===B.otherSE.point.events&&N.segment.consume(B.segment)}}}getAvailableLinkedEvents(){let w=[];for(let T=0,N=this.point.events.length;T<N;T++){let z=this.point.events[T];z!==this&&!z.segment.ringOut&&z.segment.isInResult()&&w.push(z)}return w}getLeftmostComparator(w){let T=new Map,N=z=>{let B=z.otherSE;T.set(z,{sine:yn(this.point,w.point,B.point),cosine:Ge(this.point,w.point,B.point)})};return(z,B)=>{T.has(z)||N(z),T.has(B)||N(B);let{sine:st,cosine:K}=T.get(z),{sine:ct,cosine:at}=T.get(B);return st>=0&&ct>=0?K<at?1:K>at?-1:0:st<0&&ct<0?K<at?-1:K>at?1:0:ct<st?-1:ct>st?1:0}}}let jn=0;class hn{static compare(w,T){let N=w.leftSE.point.x,z=T.leftSE.point.x,B=w.rightSE.point.x,st=T.rightSE.point.x;if(st<N)return 1;if(B<z)return-1;let K=w.leftSE.point.y,ct=T.leftSE.point.y,at=w.rightSE.point.y,j=T.rightSE.point.y;if(N<z){if(ct<K&&ct<at)return 1;if(ct>K&&ct>at)return-1;let rt=w.comparePoint(T.leftSE.point);if(rt<0)return 1;if(rt>0)return-1;let ft=T.comparePoint(w.rightSE.point);return ft!==0?ft:-1}if(N>z){if(K<ct&&K<j)return-1;if(K>ct&&K>j)return 1;let rt=T.comparePoint(w.leftSE.point);if(rt!==0)return rt;let ft=w.comparePoint(T.rightSE.point);return ft<0?1:ft>0?-1:1}if(K<ct)return-1;if(K>ct)return 1;if(B<st){let rt=T.comparePoint(w.rightSE.point);if(rt!==0)return rt}if(B>st){let rt=w.comparePoint(T.rightSE.point);if(rt<0)return 1;if(rt>0)return-1}if(B!==st){let rt=at-K,ft=B-N,lt=j-ct,Gt=st-z;if(rt>ft&<<Gt)return 1;if(rt<ft&<>Gt)return-1}return B>st?1:B<st||at<j?-1:at>j?1:w.id<T.id?-1:w.id>T.id?1:0}constructor(w,T,N,z){this.id=++jn,this.leftSE=w,w.segment=this,w.otherSE=T,this.rightSE=T,T.segment=this,T.otherSE=w,this.rings=N,this.windings=z}static fromRing(w,T,N){let z,B,st,K=Jt.comparePoints(w,T);if(K<0)z=w,B=T,st=1;else if(K>0)z=T,B=w,st=-1;else throw new Error(`Tried to create degenerate segment at [${w.x}, ${w.y}]`);let ct=new Jt(z,!0),at=new Jt(B,!1);return new hn(ct,at,[N],[st])}replaceRightSE(w){this.rightSE=w,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let w=this.leftSE.point.y,T=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:w<T?w:T},ur:{x:this.rightSE.point.x,y:w>T?w:T}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(w){return w.x===this.leftSE.point.x&&w.y===this.leftSE.point.y||w.x===this.rightSE.point.x&&w.y===this.rightSE.point.y}comparePoint(w){if(this.isAnEndpoint(w))return 0;let T=this.leftSE.point,N=this.rightSE.point,z=this.vector();if(T.x===N.x)return w.x===T.x?0:w.x<T.x?1:-1;let B=(w.y-T.y)/z.y,st=T.x+B*z.x;if(w.x===st)return 0;let K=(w.x-T.x)/z.x,ct=T.y+K*z.y;return w.y===ct?0:w.y<ct?-1:1}getIntersection(w){let T=this.bbox(),N=w.bbox(),z=O(T,N);if(z===null)return null;let B=this.leftSE.point,st=this.rightSE.point,K=w.leftSE.point,ct=w.rightSE.point,at=G(T,K)&&this.comparePoint(K)===0,j=G(N,B)&&w.comparePoint(B)===0,rt=G(T,ct)&&this.comparePoint(ct)===0,ft=G(N,st)&&w.comparePoint(st)===0;if(j&&at)return ft&&!rt?st:!ft&&rt?ct:null;if(j)return rt&&B.x===ct.x&&B.y===ct.y?null:B;if(at)return ft&&st.x===K.x&&st.y===K.y?null:K;if(ft&&rt)return null;if(ft)return st;if(rt)return ct;let lt=Pr(B,this.vector(),K,w.vector());return lt===null||!G(z,lt)?null:it.round(lt.x,lt.y)}split(w){let T=[],N=w.events!==void 0,z=new Jt(w,!0),B=new Jt(w,!1),st=this.rightSE;this.replaceRightSE(B),T.push(B),T.push(z);let K=new hn(z,st,this.rings.slice(),this.windings.slice());return Jt.comparePoints(K.leftSE.point,K.rightSE.point)>0&&K.swapEvents(),Jt.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),N&&(z.checkForConsuming(),B.checkForConsuming()),T}swapEvents(){let w=this.rightSE;this.rightSE=this.leftSE,this.leftSE=w,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let T=0,N=this.windings.length;T<N;T++)this.windings[T]*=-1}consume(w){let T=this,N=w;for(;T.consumedBy;)T=T.consumedBy;for(;N.consumedBy;)N=N.consumedBy;let z=hn.compare(T,N);if(z!==0){if(z>0){let B=T;T=N,N=B}if(T.prev===N){let B=T;T=N,N=B}for(let B=0,st=N.rings.length;B<st;B++){let K=N.rings[B],ct=N.windings[B],at=T.rings.indexOf(K);at===-1?(T.rings.push(K),T.windings.push(ct)):T.windings[at]+=ct}N.rings=null,N.windings=null,N.consumedBy=T,N.leftSE.consumedBy=T.leftSE,N.rightSE.consumedBy=T.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let w=this.prev.consumedBy||this.prev;this._beforeState=w.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let w=this.beforeState();this._afterState={rings:w.rings.slice(0),windings:w.windings.slice(0),multiPolys:[]};let T=this._afterState.rings,N=this._afterState.windings,z=this._afterState.multiPolys;for(let K=0,ct=this.rings.length;K<ct;K++){let at=this.rings[K],j=this.windings[K],rt=T.indexOf(at);rt===-1?(T.push(at),N.push(j)):N[rt]+=j}let B=[],st=[];for(let K=0,ct=T.length;K<ct;K++){if(N[K]===0)continue;let at=T[K],j=at.poly;if(st.indexOf(j)===-1)if(at.isExterior)B.push(j);else{st.indexOf(j)===-1&&st.push(j);let rt=B.indexOf(at.poly);rt!==-1&&B.splice(rt,1)}}for(let K=0,ct=B.length;K<ct;K++){let at=B[K].multiPoly;z.indexOf(at)===-1&&z.push(at)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let w=this.beforeState().multiPolys,T=this.afterState().multiPolys;switch(mt.type){case"union":{let N=w.length===0,z=T.length===0;this._isInResult=N!==z;break}case"intersection":{let N,z;w.length<T.length?(N=w.length,z=T.length):(N=T.length,z=w.length),this._isInResult=z===mt.numMultiPolys&&N<z;break}case"xor":{let N=Math.abs(w.length-T.length);this._isInResult=N%2===1;break}case"difference":{let N=z=>z.length===1&&z[0].isSubject;this._isInResult=N(w)!==N(T);break}default:throw new Error(`Unrecognized operation type found ${mt.type}`)}return this._isInResult}}class vn{constructor(w,T,N){if(!Array.isArray(w)||w.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=T,this.isExterior=N,this.segments=[],typeof w[0][0]!="number"||typeof w[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let z=it.round(w[0][0],w[0][1]);this.bbox={ll:{x:z.x,y:z.y},ur:{x:z.x,y:z.y}};let B=z;for(let st=1,K=w.length;st<K;st++){if(typeof w[st][0]!="number"||typeof w[st][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let ct=it.round(w[st][0],w[st][1]);ct.x===B.x&&ct.y===B.y||(this.segments.push(hn.fromRing(B,ct,this)),ct.x<this.bbox.ll.x&&(this.bbox.ll.x=ct.x),ct.y<this.bbox.ll.y&&(this.bbox.ll.y=ct.y),ct.x>this.bbox.ur.x&&(this.bbox.ur.x=ct.x),ct.y>this.bbox.ur.y&&(this.bbox.ur.y=ct.y),B=ct)}(z.x!==B.x||z.y!==B.y)&&this.segments.push(hn.fromRing(B,z,this))}getSweepEvents(){let w=[];for(let T=0,N=this.segments.length;T<N;T++){let z=this.segments[T];w.push(z.leftSE),w.push(z.rightSE)}return w}}class Fn{constructor(w,T){if(!Array.isArray(w))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new vn(w[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let N=1,z=w.length;N<z;N++){let B=new vn(w[N],this,!1);B.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=B.bbox.ll.x),B.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=B.bbox.ll.y),B.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=B.bbox.ur.x),B.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=B.bbox.ur.y),this.interiorRings.push(B)}this.multiPoly=T}getSweepEvents(){let w=this.exteriorRing.getSweepEvents();for(let T=0,N=this.interiorRings.length;T<N;T++){let z=this.interiorRings[T].getSweepEvents();for(let B=0,st=z.length;B<st;B++)w.push(z[B])}return w}}class xr{constructor(w,T){if(!Array.isArray(w))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof w[0][0][0]=="number"&&(w=[w])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let N=0,z=w.length;N<z;N++){let B=new Fn(w[N],this);B.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=B.bbox.ll.x),B.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=B.bbox.ll.y),B.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=B.bbox.ur.x),B.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=B.bbox.ur.y),this.polys.push(B)}this.isSubject=T}getSweepEvents(){let w=[];for(let T=0,N=this.polys.length;T<N;T++){let z=this.polys[T].getSweepEvents();for(let B=0,st=z.length;B<st;B++)w.push(z[B])}return w}}class ui{static factory(w){let T=[];for(let N=0,z=w.length;N<z;N++){let B=w[N];if(!B.isInResult()||B.ringOut)continue;let st=null,K=B.leftSE,ct=B.rightSE,at=[K],j=K.point,rt=[];for(;st=K,K=ct,at.push(K),K.point!==j;)for(;;){let ft=K.getAvailableLinkedEvents();if(ft.length===0){let kt=at[0].point,re=at[at.length-1].point;throw new Error(`Unable to complete output ring starting at [${kt.x}, ${kt.y}]. Last matching segment found ends at [${re.x}, ${re.y}].`)}if(ft.length===1){ct=ft[0].otherSE;break}let lt=null;for(let kt=0,re=rt.length;kt<re;kt++)if(rt[kt].point===K.point){lt=kt;break}if(lt!==null){let kt=rt.splice(lt)[0],re=at.splice(kt.index);re.unshift(re[0].otherSE),T.push(new ui(re.reverse()));continue}rt.push({index:at.length,point:K.point});let Gt=K.getLeftmostComparator(st);ct=ft.sort(Gt)[0].otherSE;break}T.push(new ui(at))}return T}constructor(w){this.events=w;for(let T=0,N=w.length;T<N;T++)w[T].segment.ringOut=this;this.poly=null}getGeom(){let w=this.events[0].point,T=[w];for(let at=1,j=this.events.length-1;at<j;at++){let rt=this.events[at].point,ft=this.events[at+1].point;mn(rt,w,ft)!==0&&(T.push(rt),w=rt)}if(T.length===1)return null;let N=T[0],z=T[1];mn(N,w,z)===0&&T.shift(),T.push(T[0]);let B=this.isExteriorRing()?1:-1,st=this.isExteriorRing()?0:T.length-1,K=this.isExteriorRing()?T.length:-1,ct=[];for(let at=st;at!=K;at+=B)ct.push([T[at].x,T[at].y]);return ct}isExteriorRing(){if(this._isExteriorRing===void 0){let w=this.enclosingRing();this._isExteriorRing=w?!w.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let w=this.events[0];for(let z=1,B=this.events.length;z<B;z++){let st=this.events[z];Jt.compare(w,st)>0&&(w=st)}let T=w.segment.prevInResult(),N=T?T.prevInResult():null;for(;;){if(!T)return null;if(!N)return T.ringOut;if(N.ringOut!==T.ringOut)return N.ringOut.enclosingRing()!==T.ringOut?T.ringOut:T.ringOut.enclosingRing();T=N.prevInResult(),N=T?T.prevInResult():null}}}class Nt{constructor(w){this.exteriorRing=w,w.poly=this,this.interiorRings=[]}addInterior(w){this.interiorRings.push(w),w.poly=this}getGeom(){let w=[this.exteriorRing.getGeom()];if(w[0]===null)return null;for(let T=0,N=this.interiorRings.length;T<N;T++){let z=this.interiorRings[T].getGeom();z!==null&&w.push(z)}return w}}class He{constructor(w){this.rings=w,this.polys=this._composePolys(w)}getGeom(){let w=[];for(let T=0,N=this.polys.length;T<N;T++){let z=this.polys[T].getGeom();z!==null&&w.push(z)}return w}_composePolys(w){let T=[];for(let N=0,z=w.length;N<z;N++){let B=w[N];if(!B.poly)if(B.isExteriorRing())T.push(new Nt(B));else{let st=B.enclosingRing();st.poly||T.push(new Nt(st)),st.poly.addInterior(B)}}return T}}class wi{constructor(w){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:hn.compare;this.queue=w,this.tree=new y(T),this.segments=[]}process(w){let T=w.segment,N=[];if(w.consumedBy)return w.isLeft?this.queue.remove(w.otherSE):this.tree.remove(T),N;let z=w.isLeft?this.tree.add(T):this.tree.find(T);if(!z)throw new Error(`Unable to find segment #${T.id} [${T.leftSE.point.x}, ${T.leftSE.point.y}] -> [${T.rightSE.point.x}, ${T.rightSE.point.y}] in SweepLine tree.`);let B=z,st=z,K,ct;for(;K===void 0;)B=this.tree.prev(B),B===null?K=null:B.key.consumedBy===void 0&&(K=B.key);for(;ct===void 0;)st=this.tree.next(st),st===null?ct=null:st.key.consumedBy===void 0&&(ct=st.key);if(w.isLeft){let at=null;if(K){let rt=K.getIntersection(T);if(rt!==null&&(T.isAnEndpoint(rt)||(at=rt),!K.isAnEndpoint(rt))){let ft=this._splitSafely(K,rt);for(let lt=0,Gt=ft.length;lt<Gt;lt++)N.push(ft[lt])}}let j=null;if(ct){let rt=ct.getIntersection(T);if(rt!==null&&(T.isAnEndpoint(rt)||(j=rt),!ct.isAnEndpoint(rt))){let ft=this._splitSafely(ct,rt);for(let lt=0,Gt=ft.length;lt<Gt;lt++)N.push(ft[lt])}}if(at!==null||j!==null){let rt=null;at===null?rt=j:j===null?rt=at:rt=Jt.comparePoints(at,j)<=0?at:j,this.queue.remove(T.rightSE),N.push(T.rightSE);let ft=T.split(rt);for(let lt=0,Gt=ft.length;lt<Gt;lt++)N.push(ft[lt])}N.length>0?(this.tree.remove(T),N.push(w)):(this.segments.push(T),T.prev=K)}else{if(K&&ct){let at=K.getIntersection(ct);if(at!==null){if(!K.isAnEndpoint(at)){let j=this._splitSafely(K,at);for(let rt=0,ft=j.length;rt<ft;rt++)N.push(j[rt])}if(!ct.isAnEndpoint(at)){let j=this._splitSafely(ct,at);for(let rt=0,ft=j.length;rt<ft;rt++)N.push(j[rt])}}}this.tree.remove(T)}return N}_splitSafely(w,T){this.tree.remove(w);let N=w.rightSE;this.queue.remove(N);let z=w.split(T);return z.push(N),w.consumedBy===void 0&&this.tree.add(w),z}}let Mi=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,qr=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Rr{run(w,T,N){mt.type=w,it.reset();let z=[new xr(T,!0)];for(let rt=0,ft=N.length;rt<ft;rt++)z.push(new xr(N[rt],!1));if(mt.numMultiPolys=z.length,mt.type==="difference"){let rt=z[0],ft=1;for(;ft<z.length;)O(z[ft].bbox,rt.bbox)!==null?ft++:z.splice(ft,1)}if(mt.type==="intersection")for(let rt=0,ft=z.length;rt<ft;rt++){let lt=z[rt];for(let Gt=rt+1,kt=z.length;Gt<kt;Gt++)if(O(lt.bbox,z[Gt].bbox)===null)return[]}let B=new y(Jt.compare);for(let rt=0,ft=z.length;rt<ft;rt++){let lt=z[rt].getSweepEvents();for(let Gt=0,kt=lt.length;Gt<kt;Gt++)if(B.insert(lt[Gt]),B.size>Mi)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let st=new wi(B),K=B.size,ct=B.pop();for(;ct;){let rt=ct.key;if(B.size===K){let lt=rt.segment;throw new Error(`Unable to pop() ${rt.isLeft?"left":"right"} SweepEvent [${rt.point.x}, ${rt.point.y}] from segment #${lt.id} [${lt.leftSE.point.x}, ${lt.leftSE.point.y}] -> [${lt.rightSE.point.x}, ${lt.rightSE.point.y}] from queue.`)}if(B.size>Mi)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(st.segments.length>qr)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let ft=st.process(rt);for(let lt=0,Gt=ft.length;lt<Gt;lt++){let kt=ft[lt];kt.consumedBy===void 0&&B.insert(kt)}K=B.size,ct=B.pop()}it.reset();let at=ui.factory(st.segments);return new He(at).getGeom()}}let mt=new Rr;var Os={union:function(Y){for(var w=arguments.length,T=new Array(w>1?w-1:0),N=1;N<w;N++)T[N-1]=arguments[N];return mt.run("union",Y,T)},intersection:function(Y){for(var w=arguments.length,T=new Array(w>1?w-1:0),N=1;N<w;N++)T[N-1]=arguments[N];return mt.run("intersection",Y,T)},xor:function(Y){for(var w=arguments.length,T=new Array(w>1?w-1:0),N=1;N<w;N++)T[N-1]=arguments[N];return mt.run("xor",Y,T)},difference:function(Y){for(var w=arguments.length,T=new Array(w>1?w-1:0),N=1;N<w;N++)T[N-1]=arguments[N];return mt.run("difference",Y,T)}};return Os})});var E1=It((If,x1)=>{(function(o,e){typeof If=="object"&&typeof x1<"u"?e(If):typeof define=="function"&&define.amd?define(["exports"],e):e(o.jsts={})})(If,function(o){"use strict";function e(){}function r(t){this.message=t||""}function u(t){this.message=t||""}function l(t){this.message=t||""}function h(){}function p(t){return t===null?Cn:t.color}function m(t){return t===null?null:t.parent}function y(t,n){t!==null&&(t.color=n)}function x(t){return t===null?null:t.left}function E(t){return t===null?null:t.right}function b(){this.root_=null,this.size_=0}function M(){}function C(){this.array_=[],arguments[0]instanceof K&&this.addAll(arguments[0])}function D(){}function G(t){this.message=t||""}function O(){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,a=1 in arguments&&parseInt(Number(arguments[1]),10)||0;a=a<0?Math.max(i+a,0):Math.min(a,i);var f=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:i;for(f=f<0?Math.max(i+arguments[2],0):Math.min(f,i);a<f;)n[a]=t,++a;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 L=function(){};L.prototype.interfaces_=function(){return[]},L.prototype.getClass=function(){return L},L.prototype.equalsWithTolerance=function(t,n,i){return Math.abs(t-n)<=i};var k=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),F=function(){},$={MAX_VALUE:{configurable:!0}};F.isNaN=function(t){return Number.isNaN(t)},F.doubleToLongBits=function(t){return t},F.longBitsToDouble=function(t){return t},F.isInfinite=function(t){return!Number.isFinite(t)},$.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(F,$);var Z=function(){},it=function(){},et=function(){},U=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])},wt={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};U.prototype.setOrdinate=function(t,n){switch(t){case U.X:this.x=n;break;case U.Y:this.y=n;break;case U.Z:this.z=n;break;default:throw new k("Invalid ordinate index: "+t)}},U.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!!L.equalsWithTolerance(this.x,n.x,i)&&!!L.equalsWithTolerance(this.y,n.y,i)}},U.prototype.getOrdinate=function(t){switch(t){case U.X:return this.x;case U.Y:return this.y;case U.Z:return this.z}throw new k("Invalid ordinate index: "+t)},U.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||F.isNaN(this.z))&&F.isNaN(t.z)},U.prototype.equals=function(t){return t instanceof U&&this.equals2D(t)},U.prototype.equalInZ=function(t,n){return L.equalsWithTolerance(this.z,t.z,n)},U.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},U.prototype.clone=function(){},U.prototype.copy=function(){return new U(this)},U.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},U.prototype.distance3D=function(t){var n=this.x-t.x,i=this.y-t.y,a=this.z-t.z;return Math.sqrt(n*n+i*i+a*a)},U.prototype.distance=function(t){var n=this.x-t.x,i=this.y-t.y;return Math.sqrt(n*n+i*i)},U.prototype.hashCode=function(){var t=17;return t=37*t+U.hashCode(this.x),t=37*t+U.hashCode(this.y)},U.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},U.prototype.interfaces_=function(){return[Z,it,e]},U.prototype.getClass=function(){return U},U.hashCode=function(){if(arguments.length===1){var t=arguments[0],n=F.doubleToLongBits(t);return Math.trunc((n^n)>>>32)}},wt.DimensionalComparator.get=function(){return Lt},wt.serialVersionUID.get=function(){return 6683108902428367e3},wt.NULL_ORDINATE.get=function(){return F.NaN},wt.X.get=function(){return 0},wt.Y.get=function(){return 1},wt.Z.get=function(){return 2},Object.defineProperties(U,wt);var Lt=function(t){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var n=arguments[0];if(n!==2&&n!==3)throw new k("only 2 or 3 dimensions may be specified");this._dimensionsToTest=n}}};Lt.prototype.compare=function(t,n){var i=t,a=n,f=Lt.compare(i.x,a.x);if(f!==0)return f;var g=Lt.compare(i.y,a.y);return g!==0?g:this._dimensionsToTest<=2?0:Lt.compare(i.z,a.z)},Lt.prototype.interfaces_=function(){return[et]},Lt.prototype.getClass=function(){return Lt},Lt.compare=function(t,n){return t<n?-1:t>n?1:F.isNaN(t)?F.isNaN(n)?0:-1:F.isNaN(n)?1:0};var Ot=function(){};Ot.prototype.create=function(){},Ot.prototype.interfaces_=function(){return[]},Ot.prototype.getClass=function(){return Ot};var W=function(){},de={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};W.prototype.interfaces_=function(){return[]},W.prototype.getClass=function(){return W},W.toLocationSymbol=function(t){switch(t){case W.EXTERIOR:return"e";case W.BOUNDARY:return"b";case W.INTERIOR:return"i";case W.NONE:return"-"}throw new k("Unknown location value: "+t)},de.INTERIOR.get=function(){return 0},de.BOUNDARY.get=function(){return 1},de.EXTERIOR.get=function(){return 2},de.NONE.get=function(){return-1},Object.defineProperties(W,de);var yt=function(t,n){return t.interfaces_&&t.interfaces_().indexOf(n)>-1},zt=function(){},Kt={LOG_10:{configurable:!0}};zt.prototype.interfaces_=function(){return[]},zt.prototype.getClass=function(){return zt},zt.log10=function(t){var n=Math.log(t);return F.isInfinite(n)||F.isNaN(n)?n:n/zt.LOG_10},zt.min=function(t,n,i,a){var f=t;return n<f&&(f=n),i<f&&(f=i),a<f&&(f=a),f},zt.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 a=arguments[0],f=arguments[1],g=arguments[2];return a<f?f:a>g?g:a}},zt.wrap=function(t,n){return t<0?n- -t%n:t%n},zt.max=function(){if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2],a=t;return n>a&&(a=n),i>a&&(a=i),a}if(arguments.length===4){var f=arguments[0],g=arguments[1],v=arguments[2],S=arguments[3],P=f;return g>P&&(P=g),v>P&&(P=v),S>P&&(P=S),P}},zt.average=function(t,n){return(t+n)/2},Kt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(zt,Kt);var ie=function(t){this.str=t};ie.prototype.append=function(t){this.str+=t},ie.prototype.setCharAt=function(t,n){this.str=this.str.substr(0,t)+n+this.str.substr(t+1)},ie.prototype.toString=function(t){return this.str};var _t=function(t){this.value=t};_t.prototype.intValue=function(){return this.value},_t.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},_t.isNaN=function(t){return Number.isNaN(t)};var Pt=function(){};Pt.isWhitespace=function(t){return t<=32&&t>=0||t===127},Pt.toUpperCase=function(t){return t.toUpperCase()};var q=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 a=arguments[0];t.call(this,t.parse(a))}}else if(arguments.length===2){var f=arguments[0],g=arguments[1];this.init(f,g)}},oe={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}};q.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},q.prototype.extractSignificantDigits=function(t,n){var i=this.abs(),a=q.magnitude(i._hi),f=q.TEN.pow(a);(i=i.divide(f)).gt(q.TEN)?(i=i.divide(q.TEN),a+=1):i.lt(q.ONE)&&(i=i.multiply(q.TEN),a-=1);for(var g=a+1,v=new ie,S=q.MAX_PRINT_DIGITS-1,P=0;P<=S;P++){t&&P===g&&v.append(".");var V=Math.trunc(i._hi);if(V<0)break;var tt=!1,nt=0;V>9?(tt=!0,nt="9"):nt="0"+V,v.append(nt),i=i.subtract(q.valueOf(V)).multiply(q.TEN),tt&&i.selfAdd(q.TEN);var vt=!0,xt=q.magnitude(i._hi);if(xt<0&&Math.abs(xt)>=S-P&&(vt=!1),!vt)break}return n[0]=a,v.toString()},q.prototype.sqr=function(){return this.multiply(this)},q.prototype.doubleValue=function(){return this._hi+this._lo},q.prototype.subtract=function(){if(arguments[0]instanceof q){var t=arguments[0];return this.add(t.negate())}if(typeof arguments[0]=="number"){var n=arguments[0];return this.add(-n)}},q.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},q.prototype.isZero=function(){return this._hi===0&&this._lo===0},q.prototype.selfSubtract=function(){if(arguments[0]instanceof q){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)}},q.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},q.prototype.min=function(t){return this.le(t)?this:t},q.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof q){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],a=arguments[1],f=null,g=null,v=null,S=null,P=null,V=null,tt=null,nt=null;return P=this._hi/i,V=q.SPLIT*P,f=V-P,nt=q.SPLIT*i,f=V-f,g=P-f,v=nt-i,tt=P*i,v=nt-v,S=i-v,nt=f*v-tt+f*S+g*v+g*S,V=(this._hi-tt-nt+this._lo-P*a)/i,nt=P+V,this._hi=nt,this._lo=P-nt+V,this}},q.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},q.prototype.divide=function(){if(arguments[0]instanceof q){var t=arguments[0],n=null,i=null,a=null,f=null,g=null,v=null,S=null,P=null;return i=(g=this._hi/t._hi)-(n=(v=q.SPLIT*g)-(n=v-g)),P=n*(a=(P=q.SPLIT*t._hi)-(a=P-t._hi))-(S=g*t._hi)+n*(f=t._hi-a)+i*a+i*f,v=(this._hi-S-P+this._lo-g*t._lo)/t._hi,new q(P=g+v,g-P+v)}if(typeof arguments[0]=="number"){var V=arguments[0];return F.isNaN(V)?q.createNaN():q.copy(this).selfDivide(V,0)}},q.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},q.prototype.pow=function(t){if(t===0)return q.valueOf(1);var n=new q(this),i=q.valueOf(1),a=Math.abs(t);if(a>1)for(;a>0;)a%2==1&&i.selfMultiply(n),(a/=2)>0&&(n=n.sqr());else i=n;return t<0?i.reciprocal():i},q.prototype.ceil=function(){if(this.isNaN())return q.NaN;var t=Math.ceil(this._hi),n=0;return t===this._hi&&(n=Math.ceil(this._lo)),new q(t,n)},q.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},q.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},q.prototype.setValue=function(){if(arguments[0]instanceof q){var t=arguments[0];return this.init(t),this}if(typeof arguments[0]=="number"){var n=arguments[0];return this.init(n),this}},q.prototype.max=function(t){return this.ge(t)?this:t},q.prototype.sqrt=function(){if(this.isZero())return q.valueOf(0);if(this.isNegative())return q.NaN;var t=1/Math.sqrt(this._hi),n=this._hi*t,i=q.valueOf(n),a=this.subtract(i.sqr())._hi*(.5*t);return i.add(a)},q.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof q){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if(typeof arguments[0]=="number"){var n=arguments[0],i=null,a=null,f=null,g=null,v=null,S=null;return f=this._hi+n,v=f-this._hi,g=f-v,g=n-v+(this._hi-g),S=g+this._lo,i=f+S,a=S+(f-i),this._hi=i+a,this._lo=a+(i-this._hi),this}}else if(arguments.length===2){var P=arguments[0],V=arguments[1],tt=null,nt=null,vt=null,xt=null,Tt=null,Ut=null,We=null;xt=this._hi+P,nt=this._lo+V,Tt=xt-(Ut=xt-this._hi),vt=nt-(We=nt-this._lo);var cn=(tt=xt+(Ut=(Tt=P-Ut+(this._hi-Tt))+nt))+(Ut=(vt=V-We+(this._lo-vt))+(Ut+(xt-tt))),Fr=Ut+(tt-cn);return this._hi=cn,this._lo=Fr,this}},q.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof q){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],a=arguments[1],f=null,g=null,v=null,S=null,P=null,V=null;f=(P=q.SPLIT*this._hi)-this._hi,V=q.SPLIT*i,f=P-f,g=this._hi-f,v=V-i;var tt=(P=this._hi*i)+(V=f*(v=V-v)-P+f*(S=i-v)+g*v+g*S+(this._hi*a+this._lo*i)),nt=V+(f=P-tt);return this._hi=tt,this._lo=nt,this}},q.prototype.selfSqr=function(){return this.selfMultiply(this)},q.prototype.floor=function(){if(this.isNaN())return q.NaN;var t=Math.floor(this._hi),n=0;return t===this._hi&&(n=Math.floor(this._lo)),new q(t,n)},q.prototype.negate=function(){return this.isNaN()?this:new q(-this._hi,-this._lo)},q.prototype.clone=function(){},q.prototype.multiply=function(){if(arguments[0]instanceof q){var t=arguments[0];return t.isNaN()?q.createNaN():q.copy(this).selfMultiply(t)}if(typeof arguments[0]=="number"){var n=arguments[0];return F.isNaN(n)?q.createNaN():q.copy(this).selfMultiply(n,0)}},q.prototype.isNaN=function(){return F.isNaN(this._hi)},q.prototype.intValue=function(){return Math.trunc(this._hi)},q.prototype.toString=function(){var t=q.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},q.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var n=new Array(1).fill(null),i=this.extractSignificantDigits(!0,n),a=n[0]+1,f=i;if(i.charAt(0)===".")f="0"+i;else if(a<0)f="0."+q.stringOfChar("0",-a)+i;else if(i.indexOf(".")===-1){var g=a-i.length;f=i+q.stringOfChar("0",g)+".0"}return this.isNegative()?"-"+f:f},q.prototype.reciprocal=function(){var t=null,n=null,i=null,a=null,f=null,g=null,v=null,S=null;n=(f=1/this._hi)-(t=(g=q.SPLIT*f)-(t=g-f)),i=(S=q.SPLIT*this._hi)-this._hi;var P=f+(g=(1-(v=f*this._hi)-(S=t*(i=S-i)-v+t*(a=this._hi-i)+n*i+n*a)-f*this._lo)/this._hi);return new q(P,f-P+g)},q.prototype.toSciNotation=function(){if(this.isZero())return q.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var n=new Array(1).fill(null),i=this.extractSignificantDigits(!1,n),a=q.SCI_NOT_EXPONENT_CHAR+n[0];if(i.charAt(0)==="0")throw new Error("Found leading zero: "+i);var f="";i.length>1&&(f=i.substring(1));var g=i.charAt(0)+"."+f;return this.isNegative()?"-"+g+a:g+a},q.prototype.abs=function(){return this.isNaN()?q.NaN:this.isNegative()?this.negate():new q(this)},q.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},q.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},q.prototype.add=function(){if(arguments[0]instanceof q){var t=arguments[0];return q.copy(this).selfAdd(t)}if(typeof arguments[0]=="number"){var n=arguments[0];return q.copy(this).selfAdd(n)}},q.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 q){var n=arguments[0];this._hi=n._hi,this._lo=n._lo}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this._hi=i,this._lo=a}},q.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},q.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},q.prototype.trunc=function(){return this.isNaN()?q.NaN:this.isPositive()?this.floor():this.ceil()},q.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},q.prototype.interfaces_=function(){return[e,Z,it]},q.prototype.getClass=function(){return q},q.sqr=function(t){return q.valueOf(t).selfMultiply(t)},q.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return q.parse(t)}if(typeof arguments[0]=="number"){var n=arguments[0];return new q(n)}},q.sqrt=function(t){return q.valueOf(t).sqrt()},q.parse=function(t){for(var n=0,i=t.length;Pt.isWhitespace(t.charAt(n));)n++;var a=!1;if(n<i){var f=t.charAt(n);f!=="-"&&f!=="+"||(n++,f==="-"&&(a=!0))}for(var g=new q,v=0,S=0,P=0;!(n>=i);){var V=t.charAt(n);if(n++,Pt.isDigit(V)){var tt=V-"0";g.selfMultiply(q.TEN),g.selfAdd(tt),v++}else{if(V!=="."){if(V==="e"||V==="E"){var nt=t.substring(n);try{P=_t.parseInt(nt)}catch(We){throw We instanceof Error?new Error("Invalid exponent "+nt+" in string "+t):We}break}throw new Error("Unexpected character \'"+V+"\' at position "+n+" in string "+t)}S=v}}var vt=g,xt=v-S-P;if(xt===0)vt=g;else if(xt>0){var Tt=q.TEN.pow(xt);vt=g.divide(Tt)}else if(xt<0){var Ut=q.TEN.pow(-xt);vt=g.multiply(Ut)}return a?vt.negate():vt},q.createNaN=function(){return new q(F.NaN,F.NaN)},q.copy=function(t){return new q(t)},q.magnitude=function(t){var n=Math.abs(t),i=Math.log(n)/Math.log(10),a=Math.trunc(Math.floor(i));return 10*Math.pow(10,a)<=n&&(a+=1),a},q.stringOfChar=function(t,n){for(var i=new ie,a=0;a<n;a++)i.append(t);return i.toString()},oe.PI.get=function(){return new q(3.141592653589793,12246467991473532e-32)},oe.TWO_PI.get=function(){return new q(6.283185307179586,24492935982947064e-32)},oe.PI_2.get=function(){return new q(1.5707963267948966,6123233995736766e-32)},oe.E.get=function(){return new q(2.718281828459045,14456468917292502e-32)},oe.NaN.get=function(){return new q(F.NaN,F.NaN)},oe.EPS.get=function(){return 123259516440783e-46},oe.SPLIT.get=function(){return 134217729},oe.MAX_PRINT_DIGITS.get=function(){return 32},oe.TEN.get=function(){return q.valueOf(10)},oe.ONE.get=function(){return q.valueOf(1)},oe.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},oe.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(q,oe);var Vt=function(){},tn={DP_SAFE_EPSILON:{configurable:!0}};Vt.prototype.interfaces_=function(){return[]},Vt.prototype.getClass=function(){return Vt},Vt.orientationIndex=function(t,n,i){var a=Vt.orientationIndexFilter(t,n,i);if(a<=1)return a;var f=q.valueOf(n.x).selfAdd(-t.x),g=q.valueOf(n.y).selfAdd(-t.y),v=q.valueOf(i.x).selfAdd(-n.x),S=q.valueOf(i.y).selfAdd(-n.y);return f.selfMultiply(S).selfSubtract(g.selfMultiply(v)).signum()},Vt.signOfDet2x2=function(t,n,i,a){return t.multiply(a).selfSubtract(n.multiply(i)).signum()},Vt.intersection=function(t,n,i,a){var f=q.valueOf(a.y).selfSubtract(i.y).selfMultiply(q.valueOf(n.x).selfSubtract(t.x)),g=q.valueOf(a.x).selfSubtract(i.x).selfMultiply(q.valueOf(n.y).selfSubtract(t.y)),v=f.subtract(g),S=q.valueOf(a.x).selfSubtract(i.x).selfMultiply(q.valueOf(t.y).selfSubtract(i.y)),P=q.valueOf(a.y).selfSubtract(i.y).selfMultiply(q.valueOf(t.x).selfSubtract(i.x)),V=S.subtract(P).selfDivide(v).doubleValue(),tt=q.valueOf(t.x).selfAdd(q.valueOf(n.x).selfSubtract(t.x).selfMultiply(V)).doubleValue(),nt=q.valueOf(n.x).selfSubtract(t.x).selfMultiply(q.valueOf(t.y).selfSubtract(i.y)),vt=q.valueOf(n.y).selfSubtract(t.y).selfMultiply(q.valueOf(t.x).selfSubtract(i.x)),xt=nt.subtract(vt).selfDivide(v).doubleValue(),Tt=q.valueOf(i.y).selfAdd(q.valueOf(a.y).selfSubtract(i.y).selfMultiply(xt)).doubleValue();return new U(tt,Tt)},Vt.orientationIndexFilter=function(t,n,i){var a=null,f=(t.x-i.x)*(n.y-i.y),g=(t.y-i.y)*(n.x-i.x),v=f-g;if(f>0){if(g<=0)return Vt.signum(v);a=f+g}else{if(!(f<0)||g>=0)return Vt.signum(v);a=-f-g}var S=Vt.DP_SAFE_EPSILON*a;return v>=S||-v>=S?Vt.signum(v):2},Vt.signum=function(t){return t>0?1:t<0?-1:0},tn.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Vt,tn);var Mt=function(){},mn={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};mn.X.get=function(){return 0},mn.Y.get=function(){return 1},mn.Z.get=function(){return 2},mn.M.get=function(){return 3},Mt.prototype.setOrdinate=function(t,n,i){},Mt.prototype.size=function(){},Mt.prototype.getOrdinate=function(t,n){},Mt.prototype.getCoordinate=function(){},Mt.prototype.getCoordinateCopy=function(t){},Mt.prototype.getDimension=function(){},Mt.prototype.getX=function(t){},Mt.prototype.clone=function(){},Mt.prototype.expandEnvelope=function(t){},Mt.prototype.copy=function(){},Mt.prototype.getY=function(t){},Mt.prototype.toCoordinateArray=function(){},Mt.prototype.interfaces_=function(){return[it]},Mt.prototype.getClass=function(){return Mt},Object.defineProperties(Mt,mn);var Vn=function(){},yn=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}(Vn),Ge=function(){};Ge.arraycopy=function(t,n,i,a,f){for(var g=0,v=n;v<n+f;v++)i[a+g]=t[v],g++},Ge.getProperty=function(t){return{"line.separator":`\n`}[t]};var an=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],a=arguments[1];this.x=i,this.y=a,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var f=arguments[0],g=arguments[1];this.x=f.y*g.w-g.y*f.w,this.y=g.x*f.w-f.x*g.w,this.w=f.x*g.y-g.x*f.y}else if(arguments[0]instanceof U&&arguments[1]instanceof U){var v=arguments[0],S=arguments[1];this.x=v.y-S.y,this.y=S.x-v.x,this.w=v.x*S.y-S.x*v.y}}else if(arguments.length===3){var P=arguments[0],V=arguments[1],tt=arguments[2];this.x=P,this.y=V,this.w=tt}else if(arguments.length===4){var nt=arguments[0],vt=arguments[1],xt=arguments[2],Tt=arguments[3],Ut=nt.y-vt.y,We=vt.x-nt.x,cn=nt.x*vt.y-vt.x*nt.y,Fr=xt.y-Tt.y,Ro=Tt.x-xt.x,is=xt.x*Tt.y-Tt.x*xt.y;this.x=We*is-Ro*cn,this.y=Fr*cn-Ut*is,this.w=Ut*Ro-Fr*We}};an.prototype.getY=function(){var t=this.y/this.w;if(F.isNaN(t)||F.isInfinite(t))throw new yn;return t},an.prototype.getX=function(){var t=this.x/this.w;if(F.isNaN(t)||F.isInfinite(t))throw new yn;return t},an.prototype.getCoordinate=function(){var t=new U;return t.x=this.getX(),t.y=this.getY(),t},an.prototype.interfaces_=function(){return[]},an.prototype.getClass=function(){return an},an.intersection=function(t,n,i,a){var f=t.y-n.y,g=n.x-t.x,v=t.x*n.y-n.x*t.y,S=i.y-a.y,P=a.x-i.x,V=i.x*a.y-a.x*i.y,tt=f*P-S*g,nt=(g*V-P*v)/tt,vt=(S*v-f*V)/tt;if(F.isNaN(nt)||F.isInfinite(nt)||F.isNaN(vt)||F.isInfinite(vt))throw new yn;return new U(nt,vt)};var Et=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 U){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 a=arguments[0],f=arguments[1];this.init(a.x,f.x,a.y,f.y)}else if(arguments.length===4){var g=arguments[0],v=arguments[1],S=arguments[2],P=arguments[3];this.init(g,v,S,P)}},Pr={serialVersionUID:{configurable:!0}};Et.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Et.prototype.equals=function(t){if(!(t instanceof Et))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()},Et.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new Et;var n=this._minx>t._minx?this._minx:t._minx,i=this._miny>t._miny?this._miny:t._miny,a=this._maxx<t._maxx?this._maxx:t._maxx,f=this._maxy<t._maxy?this._maxy:t._maxy;return new Et(n,a,i,f)},Et.prototype.isNull=function(){return this._maxx<this._minx},Et.prototype.getMaxX=function(){return this._maxx},Et.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof Et){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],a=arguments[1];return!this.isNull()&&i>=this._minx&&i<=this._maxx&&a>=this._miny&&a<=this._maxy}},Et.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Et){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 U){var n=arguments[0];return this.intersects(n.x,n.y)}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return!this.isNull()&&!(i>this._maxx||i<this._minx||a>this._maxy||a<this._miny)}},Et.prototype.getMinY=function(){return this._miny},Et.prototype.getMinX=function(){return this._minx},Et.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof Et){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],a=arguments[1];this.isNull()?(this._minx=i,this._maxx=i,this._miny=a,this._maxy=a):(i<this._minx&&(this._minx=i),i>this._maxx&&(this._maxx=i),a<this._miny&&(this._miny=a),a>this._maxy&&(this._maxy=a))}},Et.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),n=this.getHeight();return t<n?t:n},Et.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Et.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},Et.prototype.translate=function(t,n){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+n,this.getMaxY()+n)},Et.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Et.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Et.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Et.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),n=this.getHeight();return t>n?t:n},Et.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()}},Et.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Et){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof U){var n=arguments[0];return this.covers(n)}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return this.covers(i,a)}},Et.prototype.centre=function(){return this.isNull()?null:new U((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Et.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Et){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],a=arguments[1];this.init(i.x,a.x,i.y,a.y)}else if(arguments.length===4){var f=arguments[0],g=arguments[1],v=arguments[2],S=arguments[3];f<g?(this._minx=f,this._maxx=g):(this._minx=g,this._maxx=f),v<S?(this._miny=v,this._maxy=S):(this._miny=S,this._maxy=v)}},Et.prototype.getMaxY=function(){return this._maxy},Et.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)},Et.prototype.hashCode=function(){var t=17;return t=37*t+U.hashCode(this._minx),t=37*t+U.hashCode(this._maxx),t=37*t+U.hashCode(this._miny),t=37*t+U.hashCode(this._maxy)},Et.prototype.interfaces_=function(){return[Z,e]},Et.prototype.getClass=function(){return Et},Et.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 a=arguments[0],f=arguments[1],g=arguments[2],v=arguments[3],S=Math.min(g.x,v.x),P=Math.max(g.x,v.x),V=Math.min(a.x,f.x),tt=Math.max(a.x,f.x);return!(V>P)&&!(tt<S)&&(S=Math.min(g.y,v.y),P=Math.max(g.y,v.y),V=Math.min(a.y,f.y),tt=Math.max(a.y,f.y),!(V>P)&&!(tt<S))}},Pr.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Et,Pr);var Jt={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*$/},jn=function(t){this.geometryFactory=t||new Qt};jn.prototype.read=function(t){var n,i,a;t=t.replace(/[\\n\\r]/g," ");var f=Jt.typeStr.exec(t);if(t.search("EMPTY")!==-1&&((f=Jt.emptyTypeStr.exec(t))[2]=void 0),f&&(i=f[1].toLowerCase(),a=f[2],vn[i]&&(n=vn[i].apply(this,[a]))),n===void 0)throw new Error("Could not parse WKT "+t);return n},jn.prototype.write=function(t){return this.extractGeometry(t)},jn.prototype.extractGeometry=function(t){var n=t.getGeometryType().toLowerCase();if(!hn[n])return null;var i=n.toUpperCase();return t.isEmpty()?i+" EMPTY":i+"("+hn[n].apply(this,[t])+")"};var hn={coordinate:function(t){return t.x+" "+t.y},point:function(t){return hn.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var n=[],i=0,a=t._geometries.length;i<a;++i)n.push("("+hn.point.apply(this,[t._geometries[i]])+")");return n.join(",")},linestring:function(t){for(var n=[],i=0,a=t._points._coordinates.length;i<a;++i)n.push(hn.coordinate.apply(this,[t._points._coordinates[i]]));return n.join(",")},linearring:function(t){for(var n=[],i=0,a=t._points._coordinates.length;i<a;++i)n.push(hn.coordinate.apply(this,[t._points._coordinates[i]]));return n.join(",")},multilinestring:function(t){for(var n=[],i=0,a=t._geometries.length;i<a;++i)n.push("("+hn.linestring.apply(this,[t._geometries[i]])+")");return n.join(",")},polygon:function(t){var n=[];n.push("("+hn.linestring.apply(this,[t._shell])+")");for(var i=0,a=t._holes.length;i<a;++i)n.push("("+hn.linestring.apply(this,[t._holes[i]])+")");return n.join(",")},multipolygon:function(t){for(var n=[],i=0,a=t._geometries.length;i<a;++i)n.push("("+hn.polygon.apply(this,[t._geometries[i]])+")");return n.join(",")},geometrycollection:function(t){for(var n=[],i=0,a=t._geometries.length;i<a;++i)n.push(this.extractGeometry(t._geometries[i]));return n.join(",")}},vn={point:function(t){if(t===void 0)return this.geometryFactory.createPoint();var n=t.trim().split(Jt.spaces);return this.geometryFactory.createPoint(new U(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(","),a=[],f=0,g=i.length;f<g;++f)n=i[f].replace(Jt.trimParens,"$1"),a.push(vn.point.apply(this,[n]));return this.geometryFactory.createMultiPoint(a)},linestring:function(t){if(t===void 0)return this.geometryFactory.createLineString();for(var n,i=t.trim().split(","),a=[],f=0,g=i.length;f<g;++f)n=i[f].trim().split(Jt.spaces),a.push(new U(Number.parseFloat(n[0]),Number.parseFloat(n[1])));return this.geometryFactory.createLineString(a)},linearring:function(t){if(t===void 0)return this.geometryFactory.createLinearRing();for(var n,i=t.trim().split(","),a=[],f=0,g=i.length;f<g;++f)n=i[f].trim().split(Jt.spaces),a.push(new U(Number.parseFloat(n[0]),Number.parseFloat(n[1])));return this.geometryFactory.createLinearRing(a)},multilinestring:function(t){if(t===void 0)return this.geometryFactory.createMultiLineString();for(var n,i=t.trim().split(Jt.parenComma),a=[],f=0,g=i.length;f<g;++f)n=i[f].replace(Jt.trimParens,"$1"),a.push(vn.linestring.apply(this,[n]));return this.geometryFactory.createMultiLineString(a)},polygon:function(t){if(t===void 0)return this.geometryFactory.createPolygon();for(var n,i,a,f,g=t.trim().split(Jt.parenComma),v=[],S=0,P=g.length;S<P;++S)n=g[S].replace(Jt.trimParens,"$1"),i=vn.linestring.apply(this,[n]),a=this.geometryFactory.createLinearRing(i._points),S===0?f=a:v.push(a);return this.geometryFactory.createPolygon(f,v)},multipolygon:function(t){if(t===void 0)return this.geometryFactory.createMultiPolygon();for(var n,i=t.trim().split(Jt.doubleParenComma),a=[],f=0,g=i.length;f<g;++f)n=i[f].replace(Jt.trimParens,"$1"),a.push(vn.polygon.apply(this,[n]));return this.geometryFactory.createMultiPolygon(a)},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=[],a=0,f=n.length;a<f;++a)i.push(this.read(n[a]));return this.geometryFactory.createGeometryCollection(i)}},Fn=function(t){this.parser=new jn(t)};Fn.prototype.write=function(t){return this.parser.write(t)},Fn.toLineString=function(t,n){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+n.x+" "+n.y+" )"};var xr=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),ui=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}(xr),Nt=function(){};Nt.prototype.interfaces_=function(){return[]},Nt.prototype.getClass=function(){return Nt},Nt.shouldNeverReachHere=function(){if(arguments.length===0)Nt.shouldNeverReachHere(null);else if(arguments.length===1){var t=arguments[0];throw new ui("Should never reach here"+(t!==null?": "+t:""))}},Nt.isTrue=function(){var t,n;if(arguments.length===1)t=arguments[0],Nt.isTrue(t,null);else if(arguments.length===2&&(t=arguments[0],n=arguments[1],!t))throw n===null?new ui:new ui(n)},Nt.equals=function(){var t,n,i;if(arguments.length===2)t=arguments[0],n=arguments[1],Nt.equals(t,n,null);else if(arguments.length===3&&(t=arguments[0],n=arguments[1],i=arguments[2],!n.equals(t)))throw new ui("Expected "+t+" but encountered "+n+(i!==null?": "+i:""))};var He=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 U,this._intPt[1]=new U,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},wi={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};He.prototype.getIndexAlongSegment=function(t,n){return this.computeIntLineIndex(),this._intLineIndex[t][n]},He.prototype.getTopologySummary=function(){var t=new ie;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},He.prototype.computeIntersection=function(t,n,i,a){this._inputLines[0][0]=t,this._inputLines[0][1]=n,this._inputLines[1][0]=i,this._inputLines[1][1]=a,this._result=this.computeIntersect(t,n,i,a)},He.prototype.getIntersectionNum=function(){return this._result},He.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)}},He.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},He.prototype.setPrecisionModel=function(t){this._precisionModel=t},He.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}},He.prototype.getIntersection=function(t){return this._intPt[t]},He.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},He.prototype.hasIntersection=function(){return this._result!==He.NO_INTERSECTION},He.prototype.getEdgeDistance=function(t,n){return He.computeEdgeDistance(this._intPt[n],this._inputLines[t][0],this._inputLines[t][1])},He.prototype.isCollinear=function(){return this._result===He.COLLINEAR_INTERSECTION},He.prototype.toString=function(){return Fn.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Fn.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},He.prototype.getEndpoint=function(t,n){return this._inputLines[t][n]},He.prototype.isIntersection=function(t){for(var n=0;n<this._result;n++)if(this._intPt[n].equals2D(t))return!0;return!1},He.prototype.getIntersectionAlongSegment=function(t,n){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][n]]},He.prototype.interfaces_=function(){return[]},He.prototype.getClass=function(){return He},He.computeEdgeDistance=function(t,n,i){var a=Math.abs(i.x-n.x),f=Math.abs(i.y-n.y),g=-1;if(t.equals(n))g=0;else if(t.equals(i))g=a>f?a:f;else{var v=Math.abs(t.x-n.x),S=Math.abs(t.y-n.y);(g=a>f?v:S)!==0||t.equals(n)||(g=Math.max(v,S))}return Nt.isTrue(!(g===0&&!t.equals(n)),"Bad distance calculation"),g},He.nonRobustComputeEdgeDistance=function(t,n,i){var a=t.x-n.x,f=t.y-n.y,g=Math.sqrt(a*a+f*f);return Nt.isTrue(!(g===0&&!t.equals(n)),"Invalid distance calculation"),g},wi.DONT_INTERSECT.get=function(){return 0},wi.DO_INTERSECT.get=function(){return 1},wi.COLLINEAR.get=function(){return 2},wi.NO_INTERSECTION.get=function(){return 0},wi.POINT_INTERSECTION.get=function(){return 1},wi.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(He,wi);var Mi=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 a=new Et(this._inputLines[0][0],this._inputLines[0][1]),f=new Et(this._inputLines[1][0],this._inputLines[1][1]);return a.contains(i)&&f.contains(i)},n.prototype.computeIntersection=function(){if(arguments.length!==3)return t.prototype.computeIntersection.apply(this,arguments);var i=arguments[0],a=arguments[1],f=arguments[2];if(this._isProper=!1,Et.intersects(a,f,i)&&mt.orientationIndex(a,f,i)===0&&mt.orientationIndex(f,a,i)===0)return this._isProper=!0,(i.equals(a)||i.equals(f))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},n.prototype.normalizeToMinimum=function(i,a,f,g,v){v.x=this.smallestInAbsValue(i.x,a.x,f.x,g.x),v.y=this.smallestInAbsValue(i.y,a.y,f.y,g.y),i.x-=v.x,i.y-=v.y,a.x-=v.x,a.y-=v.y,f.x-=v.x,f.y-=v.y,g.x-=v.x,g.y-=v.y},n.prototype.safeHCoordinateIntersection=function(i,a,f,g){var v=null;try{v=an.intersection(i,a,f,g)}catch(S){if(!(S instanceof yn))throw S;v=n.nearestEndpoint(i,a,f,g)}return v},n.prototype.intersection=function(i,a,f,g){var v=this.intersectionWithNormalization(i,a,f,g);return this.isInSegmentEnvelopes(v)||(v=new U(n.nearestEndpoint(i,a,f,g))),this._precisionModel!==null&&this._precisionModel.makePrecise(v),v},n.prototype.smallestInAbsValue=function(i,a,f,g){var v=i,S=Math.abs(v);return Math.abs(a)<S&&(v=a,S=Math.abs(a)),Math.abs(f)<S&&(v=f,S=Math.abs(f)),Math.abs(g)<S&&(v=g),v},n.prototype.checkDD=function(i,a,f,g,v){var S=Vt.intersection(i,a,f,g),P=this.isInSegmentEnvelopes(S);Ge.out.println("DD in env = "+P+" --------------------- "+S),v.distance(S)>1e-4&&Ge.out.println("Distance = "+v.distance(S))},n.prototype.intersectionWithNormalization=function(i,a,f,g){var v=new U(i),S=new U(a),P=new U(f),V=new U(g),tt=new U;this.normalizeToEnvCentre(v,S,P,V,tt);var nt=this.safeHCoordinateIntersection(v,S,P,V);return nt.x+=tt.x,nt.y+=tt.y,nt},n.prototype.computeCollinearIntersection=function(i,a,f,g){var v=Et.intersects(i,a,f),S=Et.intersects(i,a,g),P=Et.intersects(f,g,i),V=Et.intersects(f,g,a);return v&&S?(this._intPt[0]=f,this._intPt[1]=g,t.COLLINEAR_INTERSECTION):P&&V?(this._intPt[0]=i,this._intPt[1]=a,t.COLLINEAR_INTERSECTION):v&&P?(this._intPt[0]=f,this._intPt[1]=i,!f.equals(i)||S||V?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):v&&V?(this._intPt[0]=f,this._intPt[1]=a,!f.equals(a)||S||P?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):S&&P?(this._intPt[0]=g,this._intPt[1]=i,!g.equals(i)||v||V?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):S&&V?(this._intPt[0]=g,this._intPt[1]=a,!g.equals(a)||v||P?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},n.prototype.normalizeToEnvCentre=function(i,a,f,g,v){var S=i.x<a.x?i.x:a.x,P=i.y<a.y?i.y:a.y,V=i.x>a.x?i.x:a.x,tt=i.y>a.y?i.y:a.y,nt=f.x<g.x?f.x:g.x,vt=f.y<g.y?f.y:g.y,xt=f.x>g.x?f.x:g.x,Tt=f.y>g.y?f.y:g.y,Ut=((S>nt?S:nt)+(V<xt?V:xt))/2,We=((P>vt?P:vt)+(tt<Tt?tt:Tt))/2;v.x=Ut,v.y=We,i.x-=v.x,i.y-=v.y,a.x-=v.x,a.y-=v.y,f.x-=v.x,f.y-=v.y,g.x-=v.x,g.y-=v.y},n.prototype.computeIntersect=function(i,a,f,g){if(this._isProper=!1,!Et.intersects(i,a,f,g))return t.NO_INTERSECTION;var v=mt.orientationIndex(i,a,f),S=mt.orientationIndex(i,a,g);if(v>0&&S>0||v<0&&S<0)return t.NO_INTERSECTION;var P=mt.orientationIndex(f,g,i),V=mt.orientationIndex(f,g,a);return P>0&&V>0||P<0&&V<0?t.NO_INTERSECTION:v===0&&S===0&&P===0&&V===0?this.computeCollinearIntersection(i,a,f,g):(v===0||S===0||P===0||V===0?(this._isProper=!1,i.equals2D(f)||i.equals2D(g)?this._intPt[0]=i:a.equals2D(f)||a.equals2D(g)?this._intPt[0]=a:v===0?this._intPt[0]=new U(f):S===0?this._intPt[0]=new U(g):P===0?this._intPt[0]=new U(i):V===0&&(this._intPt[0]=new U(a))):(this._isProper=!0,this._intPt[0]=this.intersection(i,a,f,g)),t.POINT_INTERSECTION)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n.nearestEndpoint=function(i,a,f,g){var v=i,S=mt.distancePointLine(i,f,g),P=mt.distancePointLine(a,f,g);return P<S&&(S=P,v=a),(P=mt.distancePointLine(f,i,a))<S&&(S=P,v=f),(P=mt.distancePointLine(g,i,a))<S&&(S=P,v=g),v},n}(He),qr=function(){};qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr},qr.orientationIndex=function(t,n,i){var a=n.x-t.x,f=n.y-t.y,g=i.x-n.x,v=i.y-n.y;return qr.signOfDet2x2(a,f,g,v)},qr.signOfDet2x2=function(t,n,i,a){var f=null,g=null,v=null;if(f=1,t===0||a===0)return n===0||i===0?0:n>0?i>0?-f:f:i>0?f:-f;if(n===0||i===0)return a>0?t>0?f:-f:t>0?-f:f;if(n>0?a>0?n<=a||(f=-f,g=t,t=i,i=g,g=n,n=a,a=g):n<=-a?(f=-f,i=-i,a=-a):(g=t,t=-i,i=g,g=n,n=-a,a=g):a>0?-n<=a?(f=-f,t=-t,n=-n):(g=-t,t=i,i=g,g=-n,n=a,a=g):n>=a?(t=-t,n=-n,i=-i,a=-a):(f=-f,g=-t,t=-i,i=g,g=-n,n=-a,a=g),t>0){if(!(i>0)||!(t<=i))return f}else{if(i>0||!(t>=i))return-f;f=-f,t=-t,i=-i}for(;;){if(v=Math.floor(i/t),i-=v*t,(a-=v*n)<0)return-f;if(a>n)return f;if(t>i+i){if(n<a+a)return f}else{if(n>a+a)return-f;i=t-i,a=n-a,f=-f}if(a===0)return i===0?0:-f;if(i===0||(v=Math.floor(t/i),t-=v*i,(n-=v*a)<0))return f;if(n>a)return-f;if(i>t+t){if(a<n+n)return-f}else{if(a>n+n)return f;t=i-t,n=a-n,f=-f}if(n===0)return t===0?0:f;if(t===0)return-f}};var Rr=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};Rr.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,a=n.x;return i>a&&(i=n.x,a=t.x),this._p.x>=i&&this._p.x<=a&&(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 f=t.x-this._p.x,g=t.y-this._p.y,v=n.x-this._p.x,S=n.y-this._p.y,P=qr.signOfDet2x2(f,g,v,S);if(P===0)return this._isPointOnSegment=!0,null;S<g&&(P=-P),P>0&&this._crossingCount++}},Rr.prototype.isPointInPolygon=function(){return this.getLocation()!==W.EXTERIOR},Rr.prototype.getLocation=function(){return this._isPointOnSegment?W.BOUNDARY:this._crossingCount%2==1?W.INTERIOR:W.EXTERIOR},Rr.prototype.isOnSegment=function(){return this._isPointOnSegment},Rr.prototype.interfaces_=function(){return[]},Rr.prototype.getClass=function(){return Rr},Rr.locatePointInRing=function(){if(arguments[0]instanceof U&&yt(arguments[1],Mt)){for(var t=arguments[0],n=arguments[1],i=new Rr(t),a=new U,f=new U,g=1;g<n.size();g++)if(n.getCoordinate(g,a),n.getCoordinate(g-1,f),i.countSegment(a,f),i.isOnSegment())return i.getLocation();return i.getLocation()}if(arguments[0]instanceof U&&arguments[1]instanceof Array){for(var v=arguments[0],S=arguments[1],P=new Rr(v),V=1;V<S.length;V++){var tt=S[V],nt=S[V-1];if(P.countSegment(tt,nt),P.isOnSegment())return P.getLocation()}return P.getLocation()}};var mt=function(){},Ni={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};mt.prototype.interfaces_=function(){return[]},mt.prototype.getClass=function(){return mt},mt.orientationIndex=function(t,n,i){return Vt.orientationIndex(t,n,i)},mt.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,a=1;a<t.length-1;a++){var f=t[a].x-i,g=t[a+1].y;n+=f*(t[a-1].y-g)}return n/2}if(yt(arguments[0],Mt)){var v=arguments[0],S=v.size();if(S<3)return 0;var P=new U,V=new U,tt=new U;v.getCoordinate(0,V),v.getCoordinate(1,tt);var nt=V.x;tt.x-=nt;for(var vt=0,xt=1;xt<S-1;xt++)P.y=V.y,V.x=tt.x,V.y=tt.y,v.getCoordinate(xt+1,tt),tt.x-=nt,vt+=V.x*(P.y-tt.y);return vt/2}},mt.distanceLineLine=function(t,n,i,a){if(t.equals(n))return mt.distancePointLine(t,i,a);if(i.equals(a))return mt.distancePointLine(a,t,n);var f=!1;if(Et.intersects(t,n,i,a)){var g=(n.x-t.x)*(a.y-i.y)-(n.y-t.y)*(a.x-i.x);if(g===0)f=!0;else{var v=(t.y-i.y)*(a.x-i.x)-(t.x-i.x)*(a.y-i.y),S=((t.y-i.y)*(n.x-t.x)-(t.x-i.x)*(n.y-t.y))/g,P=v/g;(P<0||P>1||S<0||S>1)&&(f=!0)}}else f=!0;return f?zt.min(mt.distancePointLine(t,i,a),mt.distancePointLine(n,i,a),mt.distancePointLine(i,t,n),mt.distancePointLine(a,t,n)):0},mt.isPointInRing=function(t,n){return mt.locatePointInRing(t,n)!==W.EXTERIOR},mt.computeLength=function(t){var n=t.size();if(n<=1)return 0;var i=0,a=new U;t.getCoordinate(0,a);for(var f=a.x,g=a.y,v=1;v<n;v++){t.getCoordinate(v,a);var S=a.x,P=a.y,V=S-f,tt=P-g;i+=Math.sqrt(V*V+tt*tt),f=S,g=P}return i},mt.isCCW=function(t){var n=t.length-1;if(n<3)throw new k("Ring has fewer than 4 points, so orientation cannot be determined");for(var i=t[0],a=0,f=1;f<=n;f++){var g=t[f];g.y>i.y&&(i=g,a=f)}var v=a;do(v-=1)<0&&(v=n);while(t[v].equals2D(i)&&v!==a);var S=a;do S=(S+1)%n;while(t[S].equals2D(i)&&S!==a);var P=t[v],V=t[S];if(P.equals2D(i)||V.equals2D(i)||P.equals2D(V))return!1;var tt=mt.computeOrientation(P,i,V),nt=!1;return nt=tt===0?P.x>V.x:tt>0,nt},mt.locatePointInRing=function(t,n){return Rr.locatePointInRing(t,n)},mt.distancePointLinePerpendicular=function(t,n,i){var a=(i.x-n.x)*(i.x-n.x)+(i.y-n.y)*(i.y-n.y),f=((n.y-t.y)*(i.x-n.x)-(n.x-t.x)*(i.y-n.y))/a;return Math.abs(f)*Math.sqrt(a)},mt.computeOrientation=function(t,n,i){return mt.orientationIndex(t,n,i)},mt.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];if(n.length===0)throw new k("Line array must contain at least one vertex");for(var i=t.distance(n[0]),a=0;a<n.length-1;a++){var f=mt.distancePointLine(t,n[a],n[a+1]);f<i&&(i=f)}return i}if(arguments.length===3){var g=arguments[0],v=arguments[1],S=arguments[2];if(v.x===S.x&&v.y===S.y)return g.distance(v);var P=(S.x-v.x)*(S.x-v.x)+(S.y-v.y)*(S.y-v.y),V=((g.x-v.x)*(S.x-v.x)+(g.y-v.y)*(S.y-v.y))/P;if(V<=0)return g.distance(v);if(V>=1)return g.distance(S);var tt=((v.y-g.y)*(S.x-v.x)-(v.x-g.x)*(S.y-v.y))/P;return Math.abs(tt)*Math.sqrt(P)}},mt.isOnLine=function(t,n){for(var i=new Mi,a=1;a<n.length;a++){var f=n[a-1],g=n[a];if(i.computeIntersection(t,f,g),i.hasIntersection())return!0}return!1},Ni.CLOCKWISE.get=function(){return-1},Ni.RIGHT.get=function(){return mt.CLOCKWISE},Ni.COUNTERCLOCKWISE.get=function(){return 1},Ni.LEFT.get=function(){return mt.COUNTERCLOCKWISE},Ni.COLLINEAR.get=function(){return 0},Ni.STRAIGHT.get=function(){return mt.COLLINEAR},Object.defineProperties(mt,Ni);var Di=function(){};Di.prototype.filter=function(t){},Di.prototype.interfaces_=function(){return[]},Di.prototype.getClass=function(){return Di};var Ft=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},Si={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}};Ft.prototype.isGeometryCollection=function(){return this.getSortIndex()===Ft.SORTINDEX_GEOMETRYCOLLECTION},Ft.prototype.getFactory=function(){return this._factory},Ft.prototype.getGeometryN=function(t){return this},Ft.prototype.getArea=function(){return 0},Ft.prototype.isRectangle=function(){return!1},Ft.prototype.equals=function(){if(arguments[0]instanceof Ft){var t=arguments[0];return t!==null&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var n=arguments[0];if(!(n instanceof Ft))return!1;var i=n;return this.equalsExact(i)}},Ft.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},Ft.prototype.geometryChanged=function(){this.apply(Ft.geometryChangedFilter)},Ft.prototype.geometryChangedAction=function(){this._envelope=null},Ft.prototype.equalsNorm=function(t){return t!==null&&this.norm().equalsExact(t.norm())},Ft.prototype.getLength=function(){return 0},Ft.prototype.getNumGeometries=function(){return 1},Ft.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],a=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,a)}},Ft.prototype.getUserData=function(){return this._userData},Ft.prototype.getSRID=function(){return this._SRID},Ft.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Ft.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===Ft.SORTINDEX_GEOMETRYCOLLECTION)throw new k("This method does not support GeometryCollection arguments")},Ft.prototype.equal=function(t,n,i){return i===0?t.equals(n):t.distance(n)<=i},Ft.prototype.norm=function(){var t=this.copy();return t.normalize(),t},Ft.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Ft.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Et(this._envelope)},Ft.prototype.setSRID=function(t){this._SRID=t},Ft.prototype.setUserData=function(t){this._userData=t},Ft.prototype.compare=function(t,n){for(var i=t.iterator(),a=n.iterator();i.hasNext()&&a.hasNext();){var f=i.next(),g=a.next(),v=f.compareTo(g);if(v!==0)return v}return i.hasNext()?1:a.hasNext()?-1:0},Ft.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Ft.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Ft.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Ft.SORTINDEX_MULTIPOINT||this.getSortIndex()===Ft.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Ft.SORTINDEX_MULTIPOLYGON},Ft.prototype.interfaces_=function(){return[it,Z,e]},Ft.prototype.getClass=function(){return Ft},Ft.hasNonEmptyElements=function(t){for(var n=0;n<t.length;n++)if(!t[n].isEmpty())return!0;return!1},Ft.hasNullElements=function(t){for(var n=0;n<t.length;n++)if(t[n]===null)return!0;return!1},Si.serialVersionUID.get=function(){return 8763622679187377e3},Si.SORTINDEX_POINT.get=function(){return 0},Si.SORTINDEX_MULTIPOINT.get=function(){return 1},Si.SORTINDEX_LINESTRING.get=function(){return 2},Si.SORTINDEX_LINEARRING.get=function(){return 3},Si.SORTINDEX_MULTILINESTRING.get=function(){return 4},Si.SORTINDEX_POLYGON.get=function(){return 5},Si.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Si.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Si.geometryChangedFilter.get=function(){return Os},Object.defineProperties(Ft,Si);var Os=function(){};Os.interfaces_=function(){return[Di]},Os.filter=function(t){t.geometryChangedAction()};var Y=function(){};Y.prototype.filter=function(t){},Y.prototype.interfaces_=function(){return[]},Y.prototype.getClass=function(){return Y};var w=function(){},T={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};w.prototype.isInBoundary=function(t){},w.prototype.interfaces_=function(){return[]},w.prototype.getClass=function(){return w},T.Mod2BoundaryNodeRule.get=function(){return N},T.EndPointBoundaryNodeRule.get=function(){return z},T.MultiValentEndPointBoundaryNodeRule.get=function(){return B},T.MonoValentEndPointBoundaryNodeRule.get=function(){return st},T.MOD2_BOUNDARY_RULE.get=function(){return new N},T.ENDPOINT_BOUNDARY_RULE.get=function(){return new z},T.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new B},T.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new st},T.OGC_SFS_BOUNDARY_RULE.get=function(){return w.MOD2_BOUNDARY_RULE},Object.defineProperties(w,T);var N=function(){};N.prototype.isInBoundary=function(t){return t%2==1},N.prototype.interfaces_=function(){return[w]},N.prototype.getClass=function(){return N};var z=function(){};z.prototype.isInBoundary=function(t){return t>0},z.prototype.interfaces_=function(){return[w]},z.prototype.getClass=function(){return z};var B=function(){};B.prototype.isInBoundary=function(t){return t>1},B.prototype.interfaces_=function(){return[w]},B.prototype.getClass=function(){return B};var st=function(){};st.prototype.isInBoundary=function(t){return t===1},st.prototype.interfaces_=function(){return[w]},st.prototype.getClass=function(){return st};var K=function(){};K.prototype.add=function(){},K.prototype.addAll=function(){},K.prototype.isEmpty=function(){},K.prototype.iterator=function(){},K.prototype.size=function(){},K.prototype.toArray=function(){},K.prototype.remove=function(){},(r.prototype=new Error).name="IndexOutOfBoundsException";var ct=function(){};ct.prototype.hasNext=function(){},ct.prototype.next=function(){},ct.prototype.remove=function(){};var at=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}(K);(u.prototype=new Error).name="NoSuchElementException";var j=function(t){function n(){t.call(this),this.array_=[],arguments[0]instanceof K&&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,K]},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 a=i.iterator();a.hasNext();)this.add(a.next());return!0},n.prototype.set=function(i,a){var f=this.array_[i];return this.array_[i]=a,f},n.prototype.iterator=function(){return new rt(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=[],a=0,f=this.array_.length;a<f;a++)i.push(this.array_[a]);return i},n.prototype.remove=function(i){for(var a=!1,f=0,g=this.array_.length;f<g;f++)if(this.array_[f]===i){this.array_.splice(f,1),a=!0;break}return a},n}(at),rt=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 u;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}(ct),ft=function(t){function n(){if(t.call(this),arguments.length!==0){if(arguments.length===1){var a=arguments[0];this.ensureCapacity(a.length),this.add(a,!0)}else if(arguments.length===2){var f=arguments[0],g=arguments[1];this.ensureCapacity(f.length),this.add(f,g)}}}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(a){return this.get(a)},n.prototype.addAll=function(){if(arguments.length===2){for(var a=arguments[0],f=arguments[1],g=!1,v=a.iterator();v.hasNext();)this.add(v.next(),f),g=!0;return g}return t.prototype.addAll.apply(this,arguments)},n.prototype.clone=function(){for(var a=t.prototype.clone.call(this),f=0;f<this.size();f++)a.add(f,this.get(f).copy());return a},n.prototype.toCoordinateArray=function(){return this.toArray(n.coordArrayType)},n.prototype.add=function(){if(arguments.length===1){var a=arguments[0];t.prototype.add.call(this,a)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var f=arguments[0],g=arguments[1];return this.add(f,g,!0),!0}if(arguments[0]instanceof U&&typeof arguments[1]=="boolean"){var v=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(v))return null;t.prototype.add.call(this,v)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var S=arguments[0],P=arguments[1];return this.add(S,P),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var V=arguments[0],tt=arguments[1];if(arguments[2])for(var nt=0;nt<V.length;nt++)this.add(V[nt],tt);else for(var vt=V.length-1;vt>=0;vt--)this.add(V[vt],tt);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof U){var xt=arguments[0],Tt=arguments[1];if(!arguments[2]){var Ut=this.size();if(Ut>0&&(xt>0&&this.get(xt-1).equals2D(Tt)||xt<Ut&&this.get(xt).equals2D(Tt)))return null}t.prototype.add.call(this,xt,Tt)}}else if(arguments.length===4){var We=arguments[0],cn=arguments[1],Fr=arguments[2],Ro=arguments[3],is=1;Fr>Ro&&(is=-1);for(var ll=Fr;ll!==Ro;ll+=is)this.add(We[ll],cn);return!0}},n.prototype.closeRing=function(){this.size()>0&&this.add(new U(this.get(0)),!1)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},Object.defineProperties(n,i),n}(j),lt=function(){},Gt={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Gt.ForwardComparator.get=function(){return kt},Gt.BidirectionalComparator.get=function(){return re},Gt.coordArrayType.get=function(){return new Array(0).fill(null)},lt.prototype.interfaces_=function(){return[]},lt.prototype.getClass=function(){return lt},lt.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},lt.ptNotInList=function(t,n){for(var i=0;i<t.length;i++){var a=t[i];if(lt.indexOf(a,n)<0)return a}return null},lt.scroll=function(t,n){var i=lt.indexOf(n,t);if(i<0)return null;var a=new Array(t.length).fill(null);Ge.arraycopy(t,i,a,0,t.length-i),Ge.arraycopy(t,0,a,t.length-i,i),Ge.arraycopy(a,0,t,0,t.length)},lt.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 a=arguments[0],f=arguments[1],g=arguments[2];if(a===f)return!0;if(a===null||f===null||a.length!==f.length)return!1;for(var v=0;v<a.length;v++)if(g.compare(a[v],f[v])!==0)return!1;return!0}},lt.intersection=function(t,n){for(var i=new ft,a=0;a<t.length;a++)n.intersects(t[a])&&i.add(t[a],!0);return i.toCoordinateArray()},lt.hasRepeatedPoints=function(t){for(var n=1;n<t.length;n++)if(t[n-1].equals(t[n]))return!0;return!1},lt.removeRepeatedPoints=function(t){return lt.hasRepeatedPoints(t)?new ft(t,!1).toCoordinateArray():t},lt.reverse=function(t){for(var n=t.length-1,i=Math.trunc(n/2),a=0;a<=i;a++){var f=t[a];t[a]=t[n-a],t[n-a]=f}},lt.removeNull=function(t){for(var n=0,i=0;i<t.length;i++)t[i]!==null&&n++;var a=new Array(n).fill(null);if(n===0)return a;for(var f=0,g=0;g<t.length;g++)t[g]!==null&&(a[f++]=t[g]);return a},lt.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 U(t[i]);return n}if(arguments.length===5)for(var a=arguments[0],f=arguments[1],g=arguments[2],v=arguments[3],S=arguments[4],P=0;P<S;P++)g[v+P]=new U(a[f+P])},lt.isEqualReversed=function(t,n){for(var i=0;i<t.length;i++){var a=t[i],f=n[t.length-i-1];if(a.compareTo(f)!==0)return!1}return!0},lt.envelope=function(t){for(var n=new Et,i=0;i<t.length;i++)n.expandToInclude(t[i]);return n},lt.toCoordinateArray=function(t){return t.toArray(lt.coordArrayType)},lt.atLeastNCoordinatesOrNothing=function(t,n){return n.length>=t?n:[]},lt.indexOf=function(t,n){for(var i=0;i<n.length;i++)if(t.equals(n[i]))return i;return-1},lt.increasingDirection=function(t){for(var n=0;n<Math.trunc(t.length/2);n++){var i=t.length-1-n,a=t[n].compareTo(t[i]);if(a!==0)return a}return 1},lt.compare=function(t,n){for(var i=0;i<t.length&&i<n.length;){var a=t[i].compareTo(n[i]);if(a!==0)return a;i++}return i<n.length?-1:i<t.length?1:0},lt.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},lt.extract=function(t,n,i){n=zt.clamp(n,0,t.length);var a=(i=zt.clamp(i,-1,t.length))-n+1;i<0&&(a=0),n>=t.length&&(a=0),i<n&&(a=0);var f=new Array(a).fill(null);if(a===0)return f;for(var g=0,v=n;v<=i;v++)f[g++]=t[v];return f},Object.defineProperties(lt,Gt);var kt=function(){};kt.prototype.compare=function(t,n){return lt.compare(t,n)},kt.prototype.interfaces_=function(){return[et]},kt.prototype.getClass=function(){return kt};var re=function(){};re.prototype.compare=function(t,n){var i=t,a=n;if(i.length<a.length)return-1;if(i.length>a.length)return 1;if(i.length===0)return 0;var f=lt.compare(i,a);return lt.isEqualReversed(i,a)?0:f},re.prototype.OLDcompare=function(t,n){var i=t,a=n;if(i.length<a.length)return-1;if(i.length>a.length)return 1;if(i.length===0)return 0;for(var f=lt.increasingDirection(i),g=lt.increasingDirection(a),v=f>0?0:i.length-1,S=g>0?0:i.length-1,P=0;P<i.length;P++){var V=i[v].compareTo(a[S]);if(V!==0)return V;v+=f,S+=g}return 0},re.prototype.interfaces_=function(){return[et]},re.prototype.getClass=function(){return re};var Yt=function(){};Yt.prototype.get=function(){},Yt.prototype.put=function(){},Yt.prototype.size=function(){},Yt.prototype.values=function(){},Yt.prototype.entrySet=function(){};var Mn=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}(Yt);(l.prototype=new Error).name="OperationNotSupported",(h.prototype=new K).contains=function(){};var pr=function(t){function n(){t.call(this),this.array_=[],arguments[0]instanceof K&&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 a=0,f=this.array_.length;a<f;a++)if(this.array_[a]===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 a=i.iterator();a.hasNext();)this.add(a.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=[],a=0,f=this.array_.length;a<f;a++)i.push(this.array_[a]);return i},n.prototype.iterator=function(){return new Wn(this)},n}(h),Wn=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 u;return this.hashSet_.array_[this.position_++]},n.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},n.prototype.remove=function(){throw new l},n}(ct),Cn=0;(b.prototype=new Mn).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},b.prototype.put=function(t,n){if(this.root_===null)return this.root_={key:t,value:n,left:null,right:null,parent:null,color:Cn,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var i,a,f=this.root_;do if(i=f,(a=t.compareTo(f.key))<0)f=f.left;else{if(!(a>0)){var g=f.value;return f.value=n,g}f=f.right}while(f!==null);var v={key:t,left:null,right:null,value:n,parent:i,color:Cn,getValue:function(){return this.value},getKey:function(){return this.key}};return a<0?i.left=v:i.right=v,this.fixAfterInsertion(v),this.size_++,null},b.prototype.fixAfterInsertion=function(t){for(t.color=1;t!=null&&t!==this.root_&&t.parent.color===1;)if(m(t)===x(m(m(t)))){var n=E(m(m(t)));p(n)===1?(y(m(t),Cn),y(n,Cn),y(m(m(t)),1),t=m(m(t))):(t===E(m(t))&&(t=m(t),this.rotateLeft(t)),y(m(t),Cn),y(m(m(t)),1),this.rotateRight(m(m(t))))}else{var i=x(m(m(t)));p(i)===1?(y(m(t),Cn),y(i,Cn),y(m(m(t)),1),t=m(m(t))):(t===x(m(t))&&(t=m(t),this.rotateRight(t)),y(m(t),Cn),y(m(m(t)),1),this.rotateLeft(m(m(t))))}this.root_.color=Cn},b.prototype.values=function(){var t=new j,n=this.getFirstEntry();if(n!==null)for(t.add(n.value);(n=b.successor(n))!==null;)t.add(n.value);return t},b.prototype.entrySet=function(){var t=new pr,n=this.getFirstEntry();if(n!==null)for(t.add(n);(n=b.successor(n))!==null;)t.add(n);return t},b.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}},b.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}},b.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t},b.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,a=t;i!==null&&a===i.right;)a=i,i=i.parent;return i},b.prototype.size=function(){return this.size_};var tr=function(){};tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr},M.prototype=new h,(C.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},C.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},C.prototype.addAll=function(t){for(var n=t.iterator();n.hasNext();)this.add(n.next());return!0},C.prototype.remove=function(t){throw new l},C.prototype.size=function(){return this.array_.length},C.prototype.isEmpty=function(){return this.array_.length===0},C.prototype.toArray=function(){for(var t=[],n=0,i=this.array_.length;n<i;n++)t.push(this.array_[n]);return t},C.prototype.iterator=function(){return new Ur(this)};var Ur=function(t){this.treeSet_=t,this.position_=0};Ur.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new u;return this.treeSet_.array_[this.position_++]},Ur.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Ur.prototype.remove=function(){throw new l};var Un=function(){};Un.sort=function(){var t,n,i,a,f=arguments[0];if(arguments.length===1)a=function(v,S){return v.compareTo(S)},f.sort(a);else if(arguments.length===2)i=arguments[1],a=function(v,S){return i.compare(v,S)},f.sort(a);else if(arguments.length===3){(n=f.slice(arguments[1],arguments[2])).sort();var g=f.slice(0,arguments[1]).concat(n,f.slice(arguments[2],f.length));for(f.splice(0,f.length),t=0;t<g.length;t++)f.push(g[t])}else if(arguments.length===4)for(n=f.slice(arguments[1],arguments[2]),i=arguments[3],a=function(v,S){return i.compare(v,S)},n.sort(a),g=f.slice(0,arguments[1]).concat(n,f.slice(arguments[2],f.length)),f.splice(0,f.length),t=0;t<g.length;t++)f.push(g[t])},Un.asList=function(t){for(var n=new j,i=0,a=t.length;i<a;i++)n.add(t[i]);return n};var Wt=function(){},Bn={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}};Bn.P.get=function(){return 0},Bn.L.get=function(){return 1},Bn.A.get=function(){return 2},Bn.FALSE.get=function(){return-1},Bn.TRUE.get=function(){return-2},Bn.DONTCARE.get=function(){return-3},Bn.SYM_FALSE.get=function(){return"F"},Bn.SYM_TRUE.get=function(){return"T"},Bn.SYM_DONTCARE.get=function(){return"*"},Bn.SYM_P.get=function(){return"0"},Bn.SYM_L.get=function(){return"1"},Bn.SYM_A.get=function(){return"2"},Wt.prototype.interfaces_=function(){return[]},Wt.prototype.getClass=function(){return Wt},Wt.toDimensionSymbol=function(t){switch(t){case Wt.FALSE:return Wt.SYM_FALSE;case Wt.TRUE:return Wt.SYM_TRUE;case Wt.DONTCARE:return Wt.SYM_DONTCARE;case Wt.P:return Wt.SYM_P;case Wt.L:return Wt.SYM_L;case Wt.A:return Wt.SYM_A}throw new k("Unknown dimension value: "+t)},Wt.toDimensionValue=function(t){switch(Pt.toUpperCase(t)){case Wt.SYM_FALSE:return Wt.FALSE;case Wt.SYM_TRUE:return Wt.TRUE;case Wt.SYM_DONTCARE:return Wt.DONTCARE;case Wt.SYM_P:return Wt.P;case Wt.SYM_L:return Wt.L;case Wt.SYM_A:return Wt.A}throw new k("Unknown dimension symbol: "+t)},Object.defineProperties(Wt,Bn);var qn=function(){};qn.prototype.filter=function(t){},qn.prototype.interfaces_=function(){return[]},qn.prototype.getClass=function(){return qn};var zn=function(){};zn.prototype.filter=function(t,n){},zn.prototype.isDone=function(){},zn.prototype.isGeometryChanged=function(){},zn.prototype.interfaces_=function(){return[]},zn.prototype.getClass=function(){return zn};var _n=function(t){function n(a,f){if(t.call(this,f),this._geometries=a||[],t.hasNullElements(this._geometries))throw new k("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 a=new Et,f=0;f<this._geometries.length;f++)a.expandToInclude(this._geometries[f].getEnvelopeInternal());return a},n.prototype.getGeometryN=function(a){return this._geometries[a]},n.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},n.prototype.getCoordinates=function(){for(var a=new Array(this.getNumPoints()).fill(null),f=-1,g=0;g<this._geometries.length;g++)for(var v=this._geometries[g].getCoordinates(),S=0;S<v.length;S++)a[++f]=v[S];return a},n.prototype.getArea=function(){for(var a=0,f=0;f<this._geometries.length;f++)a+=this._geometries[f].getArea();return a},n.prototype.equalsExact=function(){if(arguments.length===2){var a=arguments[0],f=arguments[1];if(!this.isEquivalentClass(a))return!1;var g=a;if(this._geometries.length!==g._geometries.length)return!1;for(var v=0;v<this._geometries.length;v++)if(!this._geometries[v].equalsExact(g._geometries[v],f))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.normalize=function(){for(var a=0;a<this._geometries.length;a++)this._geometries[a].normalize();Un.sort(this._geometries)},n.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},n.prototype.getBoundaryDimension=function(){for(var a=Wt.FALSE,f=0;f<this._geometries.length;f++)a=Math.max(a,this._geometries[f].getBoundaryDimension());return a},n.prototype.getDimension=function(){for(var a=Wt.FALSE,f=0;f<this._geometries.length;f++)a=Math.max(a,this._geometries[f].getDimension());return a},n.prototype.getLength=function(){for(var a=0,f=0;f<this._geometries.length;f++)a+=this._geometries[f].getLength();return a},n.prototype.getNumPoints=function(){for(var a=0,f=0;f<this._geometries.length;f++)a+=this._geometries[f].getNumPoints();return a},n.prototype.getNumGeometries=function(){return this._geometries.length},n.prototype.reverse=function(){for(var a=this._geometries.length,f=new Array(a).fill(null),g=0;g<this._geometries.length;g++)f[g]=this._geometries[g].reverse();return this.getFactory().createGeometryCollection(f)},n.prototype.compareToSameClass=function(){if(arguments.length===1){var a=arguments[0],f=new C(Un.asList(this._geometries)),g=new C(Un.asList(a._geometries));return this.compare(f,g)}if(arguments.length===2){for(var v=arguments[0],S=arguments[1],P=v,V=this.getNumGeometries(),tt=P.getNumGeometries(),nt=0;nt<V&&nt<tt;){var vt=this.getGeometryN(nt),xt=P.getGeometryN(nt),Tt=vt.compareToSameClass(xt,S);if(Tt!==0)return Tt;nt++}return nt<V?1:nt<tt?-1:0}},n.prototype.apply=function(){if(yt(arguments[0],Y))for(var a=arguments[0],f=0;f<this._geometries.length;f++)this._geometries[f].apply(a);else if(yt(arguments[0],zn)){var g=arguments[0];if(this._geometries.length===0)return null;for(var v=0;v<this._geometries.length&&(this._geometries[v].apply(g),!g.isDone());v++);g.isGeometryChanged()&&this.geometryChanged()}else if(yt(arguments[0],qn)){var S=arguments[0];S.filter(this);for(var P=0;P<this._geometries.length;P++)this._geometries[P].apply(S)}else if(yt(arguments[0],Di)){var V=arguments[0];V.filter(this);for(var tt=0;tt<this._geometries.length;tt++)this._geometries[tt].apply(V)}},n.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),Nt.shouldNeverReachHere(),null},n.prototype.clone=function(){var a=t.prototype.clone.call(this);a._geometries=new Array(this._geometries.length).fill(null);for(var f=0;f<this._geometries.length;f++)a._geometries[f]=this._geometries[f].clone();return a},n.prototype.getGeometryType=function(){return"GeometryCollection"},n.prototype.copy=function(){for(var a=new Array(this._geometries.length).fill(null),f=0;f<a.length;f++)a[f]=this._geometries[f].copy();return new n(a,this._factory)},n.prototype.isEmpty=function(){for(var a=0;a<this._geometries.length;a++)if(!this._geometries[a].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}(Ft),bi=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 Ft.SORTINDEX_MULTILINESTRING},n.prototype.equalsExact=function(){if(arguments.length===2){var a=arguments[0],f=arguments[1];return!!this.isEquivalentClass(a)&&t.prototype.equalsExact.call(this,a,f)}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.getBoundaryDimension=function(){return this.isClosed()?Wt.FALSE:0},n.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var a=0;a<this._geometries.length;a++)if(!this._geometries[a].isClosed())return!1;return!0},n.prototype.getDimension=function(){return 1},n.prototype.reverse=function(){for(var a=this._geometries.length,f=new Array(a).fill(null),g=0;g<this._geometries.length;g++)f[a-1-g]=this._geometries[g].reverse();return this.getFactory().createMultiLineString(f)},n.prototype.getBoundary=function(){return new Xr(this).getBoundary()},n.prototype.getGeometryType=function(){return"MultiLineString"},n.prototype.copy=function(){for(var a=new Array(this._geometries.length).fill(null),f=0;f<a.length;f++)a[f]=this._geometries[f].copy();return new n(a,this._factory)},n.prototype.interfaces_=function(){return[tr]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(n,i),n}(_n),Xr=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var t=arguments[0],n=w.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=n}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this._geom=i,this._geomFact=i.getFactory(),this._bnRule=a}};Xr.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)},Xr.prototype.getBoundary=function(){return this._geom instanceof xn?this.boundaryLineString(this._geom):this._geom instanceof bi?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},Xr.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()])},Xr.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},Xr.prototype.computeBoundaryCoordinates=function(t){var n=new j;this._endpointMap=new b;for(var i=0;i<t.getNumGeometries();i++){var a=t.getGeometryN(i);a.getNumPoints()!==0&&(this.addEndpoint(a.getCoordinateN(0)),this.addEndpoint(a.getCoordinateN(a.getNumPoints()-1)))}for(var f=this._endpointMap.entrySet().iterator();f.hasNext();){var g=f.next(),v=g.getValue().count;this._bnRule.isInBoundary(v)&&n.add(g.getKey())}return lt.toCoordinateArray(n)},Xr.prototype.addEndpoint=function(t){var n=this._endpointMap.get(t);n===null&&(n=new ea,this._endpointMap.put(t,n)),n.count++},Xr.prototype.interfaces_=function(){return[]},Xr.prototype.getClass=function(){return Xr},Xr.getBoundary=function(){if(arguments.length===1){var t=arguments[0];return new Xr(t).getBoundary()}if(arguments.length===2){var n=arguments[0],i=arguments[1];return new Xr(n,i).getBoundary()}};var ea=function(){this.count=null};ea.prototype.interfaces_=function(){return[]},ea.prototype.getClass=function(){return ea};var Yr=function(){},Ku={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Yr.prototype.interfaces_=function(){return[]},Yr.prototype.getClass=function(){return Yr},Yr.chars=function(t,n){for(var i=new Array(n).fill(null),a=0;a<n;a++)i[a]=t;return String(i)},Yr.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 a=arguments[0],f=arguments[1],g="",v=new function(){}(new function(){}(Yr.getStackTrace(a))),S=0;S<f;S++)try{g+=v.readLine()+Yr.NEWLINE}catch(P){if(!(P instanceof D))throw P;Nt.shouldNeverReachHere()}return g}},Yr.split=function(t,n){for(var i=n.length,a=new j,f=""+t,g=f.indexOf(n);g>=0;){var v=f.substring(0,g);a.add(v),g=(f=f.substring(g+i)).indexOf(n)}f.length>0&&a.add(f);for(var S=new Array(a.size()).fill(null),P=0;P<S.length;P++)S[P]=a.get(P);return S},Yr.toString=function(){if(arguments.length===1){var t=arguments[0];return Yr.SIMPLE_ORDINATE_FORMAT.format(t)}},Yr.spaces=function(t){return Yr.chars(" ",t)},Ku.NEWLINE.get=function(){return Ge.getProperty("line.separator")},Ku.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(Yr,Ku);var kn=function(){};kn.prototype.interfaces_=function(){return[]},kn.prototype.getClass=function(){return kn},kn.copyCoord=function(t,n,i,a){for(var f=Math.min(t.getDimension(),i.getDimension()),g=0;g<f;g++)i.setOrdinate(a,g,t.getOrdinate(n,g))},kn.isRing=function(t){var n=t.size();return n===0||!(n<=3)&&t.getOrdinate(0,Mt.X)===t.getOrdinate(n-1,Mt.X)&&t.getOrdinate(0,Mt.Y)===t.getOrdinate(n-1,Mt.Y)},kn.isEqual=function(t,n){var i=t.size();if(i!==n.size())return!1;for(var a=Math.min(t.getDimension(),n.getDimension()),f=0;f<i;f++)for(var g=0;g<a;g++){var v=t.getOrdinate(f,g),S=n.getOrdinate(f,g);if(t.getOrdinate(f,g)!==n.getOrdinate(f,g)&&(!F.isNaN(v)||!F.isNaN(S)))return!1}return!0},kn.extend=function(t,n,i){var a=t.create(i,n.getDimension()),f=n.size();if(kn.copy(n,0,a,0,f),f>0)for(var g=f;g<i;g++)kn.copy(n,f-1,a,g,1);return a},kn.reverse=function(t){for(var n=t.size()-1,i=Math.trunc(n/2),a=0;a<=i;a++)kn.swap(t,a,n-a)},kn.swap=function(t,n,i){if(n===i)return null;for(var a=0;a<t.getDimension();a++){var f=t.getOrdinate(n,a);t.setOrdinate(n,a,t.getOrdinate(i,a)),t.setOrdinate(i,a,f)}},kn.copy=function(t,n,i,a,f){for(var g=0;g<f;g++)kn.copyCoord(t,n+g,i,a+g)},kn.toString=function(){if(arguments.length===1){var t=arguments[0],n=t.size();if(n===0)return"()";var i=t.getDimension(),a=new ie;a.append("(");for(var f=0;f<n;f++){f>0&&a.append(" ");for(var g=0;g<i;g++)g>0&&a.append(","),a.append(Yr.toString(t.getOrdinate(f,g)))}return a.append(")"),a.toString()}},kn.ensureValidRing=function(t,n){var i=n.size();return i===0?n:i<=3?kn.createClosedRing(t,n,4):n.getOrdinate(0,Mt.X)===n.getOrdinate(i-1,Mt.X)&&n.getOrdinate(0,Mt.Y)===n.getOrdinate(i-1,Mt.Y)?n:kn.createClosedRing(t,n,i+1)},kn.createClosedRing=function(t,n,i){var a=t.create(i,n.getDimension()),f=n.size();kn.copy(n,0,a,0,f);for(var g=f;g<i;g++)kn.copy(n,0,a,g,1);return a};var xn=function(t){function n(a,f){t.call(this,f),this._points=null,this.init(a)}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 Et:this._points.expandEnvelope(new Et)},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 a=arguments[0],f=arguments[1];if(!this.isEquivalentClass(a))return!1;var g=a;if(this._points.size()!==g._points.size())return!1;for(var v=0;v<this._points.size();v++)if(!this.equal(this._points.getCoordinate(v),g._points.getCoordinate(v),f))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.normalize=function(){for(var a=0;a<Math.trunc(this._points.size()/2);a++){var f=this._points.size()-1-a;if(!this._points.getCoordinate(a).equals(this._points.getCoordinate(f)))return this._points.getCoordinate(a).compareTo(this._points.getCoordinate(f))>0&&kn.reverse(this._points),null}},n.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},n.prototype.getBoundaryDimension=function(){return this.isClosed()?Wt.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 mt.computeLength(this._points)},n.prototype.getNumPoints=function(){return this._points.size()},n.prototype.reverse=function(){var a=this._points.copy();return kn.reverse(a),this.getFactory().createLineString(a)},n.prototype.compareToSameClass=function(){if(arguments.length===1){for(var a=arguments[0],f=0,g=0;f<this._points.size()&&g<a._points.size();){var v=this._points.getCoordinate(f).compareTo(a._points.getCoordinate(g));if(v!==0)return v;f++,g++}return f<this._points.size()?1:g<a._points.size()?-1:0}if(arguments.length===2){var S=arguments[0];return arguments[1].compare(this._points,S._points)}},n.prototype.apply=function(){if(yt(arguments[0],Y))for(var a=arguments[0],f=0;f<this._points.size();f++)a.filter(this._points.getCoordinate(f));else if(yt(arguments[0],zn)){var g=arguments[0];if(this._points.size()===0)return null;for(var v=0;v<this._points.size()&&(g.filter(this._points,v),!g.isDone());v++);g.isGeometryChanged()&&this.geometryChanged()}else yt(arguments[0],qn)?arguments[0].filter(this):yt(arguments[0],Di)&&arguments[0].filter(this)},n.prototype.getBoundary=function(){return new Xr(this).getBoundary()},n.prototype.isEquivalentClass=function(a){return a instanceof n},n.prototype.clone=function(){var a=t.prototype.clone.call(this);return a._points=this._points.clone(),a},n.prototype.getCoordinateN=function(a){return this._points.getCoordinate(a)},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(a){if(a===null&&(a=this.getFactory().getCoordinateSequenceFactory().create([])),a.size()===1)throw new k("Invalid number of points in LineString (found "+a.size()+" - must be 0 or >= 2)");this._points=a},n.prototype.isCoordinate=function(a){for(var f=0;f<this._points.size();f++)if(this._points.getCoordinate(f).equals(a))return!0;return!1},n.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},n.prototype.getPointN=function(a){return this.getFactory().createPoint(this._points.getCoordinate(a))},n.prototype.interfaces_=function(){return[tr]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(n,i),n}(Ft),La=function(){};La.prototype.interfaces_=function(){return[]},La.prototype.getClass=function(){return La};var Er=function(t){function n(a,f){t.call(this,f),this._coordinates=a||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 Et;var a=new Et;return a.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),a},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 a=arguments[0],f=arguments[1];return!!this.isEquivalentClass(a)&&(!(!this.isEmpty()||!a.isEmpty())||this.isEmpty()===a.isEmpty()&&this.equal(a.getCoordinate(),this.getCoordinate(),f))}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 Wt.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 a=arguments[0];return this.getCoordinate().compareTo(a.getCoordinate())}if(arguments.length===2){var f=arguments[0];return arguments[1].compare(this._coordinates,f._coordinates)}},n.prototype.apply=function(){if(yt(arguments[0],Y)){var a=arguments[0];if(this.isEmpty())return null;a.filter(this.getCoordinate())}else if(yt(arguments[0],zn)){var f=arguments[0];if(this.isEmpty())return null;f.filter(this._coordinates,0),f.isGeometryChanged()&&this.geometryChanged()}else yt(arguments[0],qn)?arguments[0].filter(this):yt(arguments[0],Di)&&arguments[0].filter(this)},n.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},n.prototype.clone=function(){var a=t.prototype.clone.call(this);return a._coordinates=this._coordinates.clone(),a},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(a){a===null&&(a=this.getFactory().getCoordinateSequenceFactory().create([])),Nt.isTrue(a.size()<=1),this._coordinates=a},n.prototype.isSimple=function(){return!0},n.prototype.interfaces_=function(){return[La]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(n,i),n}(Ft),Qo=function(){};Qo.prototype.interfaces_=function(){return[]},Qo.prototype.getClass=function(){return Qo};var Jn=function(t){function n(a,f,g){if(t.call(this,g),this._shell=null,this._holes=null,a===null&&(a=this.getFactory().createLinearRing()),f===null&&(f=[]),t.hasNullElements(f))throw new k("holes must not contain null elements");if(a.isEmpty()&&t.hasNonEmptyElements(f))throw new k("shell is empty but holes are not");this._shell=a,this._holes=f}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 a=new Array(this.getNumPoints()).fill(null),f=-1,g=this._shell.getCoordinates(),v=0;v<g.length;v++)a[++f]=g[v];for(var S=0;S<this._holes.length;S++)for(var P=this._holes[S].getCoordinates(),V=0;V<P.length;V++)a[++f]=P[V];return a},n.prototype.getArea=function(){var a=0;a+=Math.abs(mt.signedArea(this._shell.getCoordinateSequence()));for(var f=0;f<this._holes.length;f++)a-=Math.abs(mt.signedArea(this._holes[f].getCoordinateSequence()));return a},n.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var a=this._shell.getCoordinateSequence(),f=this.getEnvelopeInternal(),g=0;g<5;g++){var v=a.getX(g);if(v!==f.getMinX()&&v!==f.getMaxX())return!1;var S=a.getY(g);if(S!==f.getMinY()&&S!==f.getMaxY())return!1}for(var P=a.getX(0),V=a.getY(0),tt=1;tt<=4;tt++){var nt=a.getX(tt),vt=a.getY(tt);if(nt!==P==(vt!==V))return!1;P=nt,V=vt}return!0},n.prototype.equalsExact=function(){if(arguments.length===2){var a=arguments[0],f=arguments[1];if(!this.isEquivalentClass(a))return!1;var g=a,v=this._shell,S=g._shell;if(!v.equalsExact(S,f)||this._holes.length!==g._holes.length)return!1;for(var P=0;P<this._holes.length;P++)if(!this._holes[P].equalsExact(g._holes[P],f))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 a=0;a<this._holes.length;a++)this.normalize(this._holes[a],!1);Un.sort(this._holes)}else if(arguments.length===2){var f=arguments[0],g=arguments[1];if(f.isEmpty())return null;var v=new Array(f.getCoordinates().length-1).fill(null);Ge.arraycopy(f.getCoordinates(),0,v,0,v.length);var S=lt.minCoordinate(f.getCoordinates());lt.scroll(v,S),Ge.arraycopy(v,0,f.getCoordinates(),0,v.length),f.getCoordinates()[v.length]=v[0],mt.isCCW(f.getCoordinates())===g&<.reverse(f.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 a=0;a+=this._shell.getLength();for(var f=0;f<this._holes.length;f++)a+=this._holes[f].getLength();return a},n.prototype.getNumPoints=function(){for(var a=this._shell.getNumPoints(),f=0;f<this._holes.length;f++)a+=this._holes[f].getNumPoints();return a},n.prototype.reverse=function(){var a=this.copy();a._shell=this._shell.copy().reverse(),a._holes=new Array(this._holes.length).fill(null);for(var f=0;f<this._holes.length;f++)a._holes[f]=this._holes[f].copy().reverse();return a},n.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},n.prototype.compareToSameClass=function(){if(arguments.length===1){var a=arguments[0],f=this._shell,g=a._shell;return f.compareToSameClass(g)}if(arguments.length===2){var v=arguments[0],S=arguments[1],P=v,V=this._shell,tt=P._shell,nt=V.compareToSameClass(tt,S);if(nt!==0)return nt;for(var vt=this.getNumInteriorRing(),xt=P.getNumInteriorRing(),Tt=0;Tt<vt&&Tt<xt;){var Ut=this.getInteriorRingN(Tt),We=P.getInteriorRingN(Tt),cn=Ut.compareToSameClass(We,S);if(cn!==0)return cn;Tt++}return Tt<vt?1:Tt<xt?-1:0}},n.prototype.apply=function(a){if(yt(a,Y)){this._shell.apply(a);for(var f=0;f<this._holes.length;f++)this._holes[f].apply(a)}else if(yt(a,zn)){if(this._shell.apply(a),!a.isDone())for(var g=0;g<this._holes.length&&(this._holes[g].apply(a),!a.isDone());g++);a.isGeometryChanged()&&this.geometryChanged()}else if(yt(a,qn))a.filter(this);else if(yt(a,Di)){a.filter(this),this._shell.apply(a);for(var v=0;v<this._holes.length;v++)this._holes[v].apply(a)}},n.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var a=new Array(this._holes.length+1).fill(null);a[0]=this._shell;for(var f=0;f<this._holes.length;f++)a[f+1]=this._holes[f];return a.length<=1?this.getFactory().createLinearRing(a[0].getCoordinateSequence()):this.getFactory().createMultiLineString(a)},n.prototype.clone=function(){var a=t.prototype.clone.call(this);a._shell=this._shell.clone(),a._holes=new Array(this._holes.length).fill(null);for(var f=0;f<this._holes.length;f++)a._holes[f]=this._holes[f].clone();return a},n.prototype.getGeometryType=function(){return"Polygon"},n.prototype.copy=function(){for(var a=this._shell.copy(),f=new Array(this._holes.length).fill(null),g=0;g<f.length;g++)f[g]=this._holes[g].copy();return new n(a,f,this._factory)},n.prototype.getExteriorRing=function(){return this._shell},n.prototype.isEmpty=function(){return this._shell.isEmpty()},n.prototype.getInteriorRingN=function(a){return this._holes[a]},n.prototype.interfaces_=function(){return[Qo]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(n,i),n}(Ft),na=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 Ft.SORTINDEX_MULTIPOINT},n.prototype.isValid=function(){return!0},n.prototype.equalsExact=function(){if(arguments.length===2){var a=arguments[0],f=arguments[1];return!!this.isEquivalentClass(a)&&t.prototype.equalsExact.call(this,a,f)}return t.prototype.equalsExact.apply(this,arguments)},n.prototype.getCoordinate=function(){if(arguments.length===1){var a=arguments[0];return this._geometries[a].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},n.prototype.getBoundaryDimension=function(){return Wt.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 a=new Array(this._geometries.length).fill(null),f=0;f<a.length;f++)a[f]=this._geometries[f].copy();return new n(a,this._factory)},n.prototype.interfaces_=function(){return[La]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(n,i),n}(_n),Ki=function(t){function n(a,f){a instanceof U&&f instanceof Qt&&(a=f.getCoordinateSequenceFactory().create(a)),t.call(this,a,f),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 Ft.SORTINDEX_LINEARRING},n.prototype.getBoundaryDimension=function(){return Wt.FALSE},n.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},n.prototype.reverse=function(){var a=this._points.copy();return kn.reverse(a),this.getFactory().createLinearRing(a)},n.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new k("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<n.MINIMUM_VALID_SIZE)throw new k("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}(xn),Qi=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 Ft.SORTINDEX_MULTIPOLYGON},n.prototype.equalsExact=function(){if(arguments.length===2){var a=arguments[0],f=arguments[1];return!!this.isEquivalentClass(a)&&t.prototype.equalsExact.call(this,a,f)}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 a=this._geometries.length,f=new Array(a).fill(null),g=0;g<this._geometries.length;g++)f[g]=this._geometries[g].reverse();return this.getFactory().createMultiPolygon(f)},n.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var a=new j,f=0;f<this._geometries.length;f++)for(var g=this._geometries[f].getBoundary(),v=0;v<g.getNumGeometries();v++)a.add(g.getGeometryN(v));var S=new Array(a.size()).fill(null);return this.getFactory().createMultiLineString(a.toArray(S))},n.prototype.getGeometryType=function(){return"MultiPolygon"},n.prototype.copy=function(){for(var a=new Array(this._geometries.length).fill(null),f=0;f<a.length;f++)a[f]=this._geometries[f].copy();return new n(a,this._factory)},n.prototype.interfaces_=function(){return[Qo]},n.prototype.getClass=function(){return n},i.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(n,i),n}(_n),li=function(t){this._factory=t||null,this._isUserDataCopied=!1},au={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};li.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},li.prototype.edit=function(t,n){if(t===null)return null;var i=this.editInternal(t,n);return this._isUserDataCopied&&i.setUserData(t.getUserData()),i},li.prototype.editInternal=function(t,n){return this._factory===null&&(this._factory=t.getFactory()),t instanceof _n?this.editGeometryCollection(t,n):t instanceof Jn?this.editPolygon(t,n):t instanceof Er?n.edit(t,this._factory):t instanceof xn?n.edit(t,this._factory):(Nt.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},li.prototype.editGeometryCollection=function(t,n){for(var i=n.edit(t,this._factory),a=new j,f=0;f<i.getNumGeometries();f++){var g=this.edit(i.getGeometryN(f),n);g===null||g.isEmpty()||a.add(g)}return i.getClass()===na?this._factory.createMultiPoint(a.toArray([])):i.getClass()===bi?this._factory.createMultiLineString(a.toArray([])):i.getClass()===Qi?this._factory.createMultiPolygon(a.toArray([])):this._factory.createGeometryCollection(a.toArray([]))},li.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 a=this.edit(i.getExteriorRing(),n);if(a===null||a.isEmpty())return this._factory.createPolygon();for(var f=new j,g=0;g<i.getNumInteriorRing();g++){var v=this.edit(i.getInteriorRingN(g),n);v===null||v.isEmpty()||f.add(v)}return this._factory.createPolygon(a,f.toArray([]))},li.prototype.interfaces_=function(){return[]},li.prototype.getClass=function(){return li},li.GeometryEditorOperation=function(){},au.NoOpGeometryOperation.get=function(){return Na},au.CoordinateOperation.get=function(){return Da},au.CoordinateSequenceOperation.get=function(){return Oa},Object.defineProperties(li,au);var Na=function(){};Na.prototype.edit=function(t,n){return t},Na.prototype.interfaces_=function(){return[li.GeometryEditorOperation]},Na.prototype.getClass=function(){return Na};var Da=function(){};Da.prototype.edit=function(t,n){var i=this.editCoordinates(t.getCoordinates(),t);return i===null?t:t instanceof Ki?n.createLinearRing(i):t instanceof xn?n.createLineString(i):t instanceof Er?i.length>0?n.createPoint(i[0]):n.createPoint():t},Da.prototype.interfaces_=function(){return[li.GeometryEditorOperation]},Da.prototype.getClass=function(){return Da};var Oa=function(){};Oa.prototype.edit=function(t,n){return t instanceof Ki?n.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof xn?n.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Er?n.createPoint(this.edit(t.getCoordinateSequence(),t)):t},Oa.prototype.interfaces_=function(){return[li.GeometryEditorOperation]},Oa.prototype.getClass=function(){return Oa};var Rn=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 U}else if(yt(arguments[0],Mt)){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 a=0;a<this._coordinates.length;a++)this._coordinates[a]=i.getCoordinateCopy(a)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var f=arguments[0],g=arguments[1];this._coordinates=f,this._dimension=g,f===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var v=arguments[0],S=arguments[1];this._coordinates=new Array(v).fill(null),this._dimension=S;for(var P=0;P<v;P++)this._coordinates[P]=new U}}},Qu={serialVersionUID:{configurable:!0}};Rn.prototype.setOrdinate=function(t,n,i){switch(n){case Mt.X:this._coordinates[t].x=i;break;case Mt.Y:this._coordinates[t].y=i;break;case Mt.Z:this._coordinates[t].z=i;break;default:throw new k("invalid ordinateIndex")}},Rn.prototype.size=function(){return this._coordinates.length},Rn.prototype.getOrdinate=function(t,n){switch(n){case Mt.X:return this._coordinates[t].x;case Mt.Y:return this._coordinates[t].y;case Mt.Z:return this._coordinates[t].z}return F.NaN},Rn.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}},Rn.prototype.getCoordinateCopy=function(t){return new U(this._coordinates[t])},Rn.prototype.getDimension=function(){return this._dimension},Rn.prototype.getX=function(t){return this._coordinates[t].x},Rn.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 Rn(t,this._dimension)},Rn.prototype.expandEnvelope=function(t){for(var n=0;n<this._coordinates.length;n++)t.expandToInclude(this._coordinates[n]);return t},Rn.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 Rn(t,this._dimension)},Rn.prototype.toString=function(){if(this._coordinates.length>0){var t=new ie(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"()"},Rn.prototype.getY=function(t){return this._coordinates[t].y},Rn.prototype.toCoordinateArray=function(){return this._coordinates},Rn.prototype.interfaces_=function(){return[Mt,e]},Rn.prototype.getClass=function(){return Rn},Qu.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(Rn,Qu);var ji=function(){},Fa={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};ji.prototype.readResolve=function(){return ji.instance()},ji.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new Rn(t)}if(yt(arguments[0],Mt)){var n=arguments[0];return new Rn(n)}}else if(arguments.length===2){var i=arguments[0],a=arguments[1];return a>3&&(a=3),a<2?new Rn(i):new Rn(i,a)}},ji.prototype.interfaces_=function(){return[Ot,e]},ji.prototype.getClass=function(){return ji},ji.instance=function(){return ji.instanceObject},Fa.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Fa.instanceObject.get=function(){return new ji},Object.defineProperties(ji,Fa);var $l=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,a){return this.map_.set(i,a),a},n.prototype.values=function(){for(var i=new j,a=this.map_.values(),f=a.next();!f.done;)i.add(f.value),f=a.next();return i},n.prototype.entrySet=function(){var i=new pr;return this.map_.entries().forEach(function(a){return i.add(a)}),i},n.prototype.size=function(){return this.map_.size()},n}(Yt),ue=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 Oi){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 a=arguments[0];this._modelType=a._modelType,this._scale=a._scale}}},ra={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};ue.prototype.equals=function(t){if(!(t instanceof ue))return!1;var n=t;return this._modelType===n._modelType&&this._scale===n._scale},ue.prototype.compareTo=function(t){var n=t,i=this.getMaximumSignificantDigits(),a=n.getMaximumSignificantDigits();return new _t(i).compareTo(new _t(a))},ue.prototype.getScale=function(){return this._scale},ue.prototype.isFloating=function(){return this._modelType===ue.FLOATING||this._modelType===ue.FLOATING_SINGLE},ue.prototype.getType=function(){return this._modelType},ue.prototype.toString=function(){var t="UNKNOWN";return this._modelType===ue.FLOATING?t="Floating":this._modelType===ue.FLOATING_SINGLE?t="Floating-Single":this._modelType===ue.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},ue.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];return F.isNaN(t)||this._modelType===ue.FLOATING_SINGLE?t:this._modelType===ue.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof U){var n=arguments[0];if(this._modelType===ue.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}},ue.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===ue.FLOATING?t=16:this._modelType===ue.FLOATING_SINGLE?t=6:this._modelType===ue.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},ue.prototype.setScale=function(t){this._scale=Math.abs(t)},ue.prototype.interfaces_=function(){return[e,Z]},ue.prototype.getClass=function(){return ue},ue.mostPrecise=function(t,n){return t.compareTo(n)>=0?t:n},ra.serialVersionUID.get=function(){return 7777263578777804e3},ra.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ue,ra);var Oi=function t(n){this._name=n||null,t.nameToTypeMap.put(n,this)},ju={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Oi.prototype.readResolve=function(){return Oi.nameToTypeMap.get(this._name)},Oi.prototype.toString=function(){return this._name},Oi.prototype.interfaces_=function(){return[e]},Oi.prototype.getClass=function(){return Oi},ju.serialVersionUID.get=function(){return-552860263173159e4},ju.nameToTypeMap.get=function(){return new $l},Object.defineProperties(Oi,ju),ue.Type=Oi,ue.FIXED=new Oi("FIXED"),ue.FLOATING=new Oi("FLOATING"),ue.FLOATING_SINGLE=new Oi("FLOATING SINGLE");var Qt=function t(){this._precisionModel=new ue,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?yt(arguments[0],Ot)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof ue&&(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]))},tl={serialVersionUID:{configurable:!0}};Qt.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new U(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new U(t.getMinX(),t.getMinY()),new U(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new U(t.getMinX(),t.getMinY()),new U(t.getMinX(),t.getMaxY()),new U(t.getMaxX(),t.getMaxY()),new U(t.getMaxX(),t.getMinY()),new U(t.getMinX(),t.getMinY())]),null)},Qt.prototype.createLineString=function(t){return t?t instanceof Array?new xn(this.getCoordinateSequenceFactory().create(t),this):yt(t,Mt)?new xn(t,this):void 0:new xn(this.getCoordinateSequenceFactory().create([]),this)},Qt.prototype.createMultiLineString=function(){if(arguments.length===0)return new bi(null,this);if(arguments.length===1){var t=arguments[0];return new bi(t,this)}},Qt.prototype.buildGeometry=function(t){for(var n=null,i=!1,a=!1,f=t.iterator();f.hasNext();){var g=f.next(),v=g.getClass();n===null&&(n=v),v!==n&&(i=!0),g.isGeometryCollectionOrDerived()&&(a=!0)}if(n===null)return this.createGeometryCollection();if(i||a)return this.createGeometryCollection(Qt.toGeometryArray(t));var S=t.iterator().next();if(t.size()>1){if(S instanceof Jn)return this.createMultiPolygon(Qt.toPolygonArray(t));if(S instanceof xn)return this.createMultiLineString(Qt.toLineStringArray(t));if(S instanceof Er)return this.createMultiPoint(Qt.toPointArray(t));Nt.shouldNeverReachHere("Unhandled class: "+S.getClass().getName())}return S},Qt.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)},Qt.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof U){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}if(yt(arguments[0],Mt)){var n=arguments[0];return new Er(n,this)}}},Qt.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Qt.prototype.createPolygon=function(){if(arguments.length===0)return new Jn(null,null,this);if(arguments.length===1){if(yt(arguments[0],Mt)){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 Ki){var i=arguments[0];return this.createPolygon(i,null)}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];return new Jn(a,f,this)}},Qt.prototype.getSRID=function(){return this._SRID},Qt.prototype.createGeometryCollection=function(){if(arguments.length===0)return new _n(null,this);if(arguments.length===1){var t=arguments[0];return new _n(t,this)}},Qt.prototype.createGeometry=function(t){return new li(this).edit(t,{edit:function(){if(arguments.length===2){var n=arguments[0];return this._coordinateSequenceFactory.create(n)}}})},Qt.prototype.getPrecisionModel=function(){return this._precisionModel},Qt.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(yt(arguments[0],Mt)){var n=arguments[0];return new Ki(n,this)}}},Qt.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Qi(null,this);if(arguments.length===1){var t=arguments[0];return new Qi(t,this)}},Qt.prototype.createMultiPoint=function(){if(arguments.length===0)return new na(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new na(t,this)}if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(yt(arguments[0],Mt)){var i=arguments[0];if(i===null)return this.createMultiPoint(new Array(0).fill(null));for(var a=new Array(i.size()).fill(null),f=0;f<i.size();f++){var g=this.getCoordinateSequenceFactory().create(1,i.getDimension());kn.copy(i,f,g,0,1),a[f]=this.createPoint(g)}return this.createMultiPoint(a)}}},Qt.prototype.interfaces_=function(){return[e]},Qt.prototype.getClass=function(){return Qt},Qt.toMultiPolygonArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.toGeometryArray=function(t){if(t===null)return null;var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.getDefaultCoordinateSequenceFactory=function(){return ji.instance()},Qt.toMultiLineStringArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.toLineStringArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.toMultiPointArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.toLinearRingArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.toPointArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.toPolygonArray=function(t){var n=new Array(t.size()).fill(null);return t.toArray(n)},Qt.createPointFromInternalCoord=function(t,n){return n.getPrecisionModel().makePrecise(t),n.getFactory().createPoint(t)},tl.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(Qt,tl);var el=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],uu=function(t){this.geometryFactory=t||new Qt};uu.prototype.read=function(t){var n,i=(n=typeof t=="string"?JSON.parse(t):t).type;if(!Fi[i])throw new Error("Unknown GeoJSON type: "+n.type);return el.indexOf(i)!==-1?Fi[i].apply(this,[n.coordinates]):i==="GeometryCollection"?Fi[i].apply(this,[n.geometries]):Fi[i].apply(this,[n])},uu.prototype.write=function(t){var n=t.getGeometryType();if(!to[n])throw new Error("Geometry is not supported");return to[n].apply(this,[t])};var Fi={Feature:function(t){var n={};for(var i in t)n[i]=t[i];if(t.geometry){var a=t.geometry.type;if(!Fi[a])throw new Error("Unknown GeoJSON type: "+t.type);n.geometry=this.read(t.geometry)}return t.bbox&&(n.bbox=Fi.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 a=t[i];n.push(new U(a[0],a[1]))}return n},bbox:function(t){return this.geometryFactory.createLinearRing([new U(t[0],t[1]),new U(t[2],t[1]),new U(t[2],t[3]),new U(t[0],t[3]),new U(t[0],t[1])])},Point:function(t){var n=new U(t[0],t[1]);return this.geometryFactory.createPoint(n)},MultiPoint:function(t){for(var n=[],i=0;i<t.length;++i)n.push(Fi.Point.apply(this,[t[i]]));return this.geometryFactory.createMultiPoint(n)},LineString:function(t){var n=Fi.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(n)},MultiLineString:function(t){for(var n=[],i=0;i<t.length;++i)n.push(Fi.LineString.apply(this,[t[i]]));return this.geometryFactory.createMultiLineString(n)},Polygon:function(t){for(var n=Fi.coordinates.apply(this,[t[0]]),i=this.geometryFactory.createLinearRing(n),a=[],f=1;f<t.length;++f){var g=t[f],v=Fi.coordinates.apply(this,[g]),S=this.geometryFactory.createLinearRing(v);a.push(S)}return this.geometryFactory.createPolygon(i,a)},MultiPolygon:function(t){for(var n=[],i=0;i<t.length;++i){var a=t[i];n.push(Fi.Polygon.apply(this,[a]))}return this.geometryFactory.createMultiPolygon(n)},GeometryCollection:function(t){for(var n=[],i=0;i<t.length;++i){var a=t[i];n.push(this.read(a))}return this.geometryFactory.createGeometryCollection(n)}},to={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:to.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var a=t._geometries[i],f=to.Point.apply(this,[a]);n.push(f.coordinates)}return{type:"MultiPoint",coordinates:n}},LineString:function(t){for(var n=[],i=t.getCoordinates(),a=0;a<i.length;++a){var f=i[a];n.push(to.coordinate.apply(this,[f]))}return{type:"LineString",coordinates:n}},MultiLineString:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var a=t._geometries[i],f=to.LineString.apply(this,[a]);n.push(f.coordinates)}return{type:"MultiLineString",coordinates:n}},Polygon:function(t){var n=[],i=to.LineString.apply(this,[t._shell]);n.push(i.coordinates);for(var a=0;a<t._holes.length;++a){var f=t._holes[a],g=to.LineString.apply(this,[f]);n.push(g.coordinates)}return{type:"Polygon",coordinates:n}},MultiPolygon:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var a=t._geometries[i],f=to.Polygon.apply(this,[a]);n.push(f.coordinates)}return{type:"MultiPolygon",coordinates:n}},GeometryCollection:function(t){for(var n=[],i=0;i<t._geometries.length;++i){var a=t._geometries[i],f=a.getGeometryType();n.push(to[f].apply(this,[a]))}return{type:"GeometryCollection",geometries:n}}},Ua=function(t){this.geometryFactory=t||new Qt,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new uu(this.geometryFactory)};Ua.prototype.read=function(t){var n=this.parser.read(t);return this.precisionModel.getType()===ue.FIXED&&this.reducePrecision(n),n},Ua.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 Fs=function(){this.parser=new uu(this.geometryFactory)};Fs.prototype.write=function(t){return this.parser.write(t)};var dt=function(){},Ba={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};dt.prototype.interfaces_=function(){return[]},dt.prototype.getClass=function(){return dt},dt.opposite=function(t){return t===dt.LEFT?dt.RIGHT:t===dt.RIGHT?dt.LEFT:t},Ba.ON.get=function(){return 0},Ba.LEFT.get=function(){return 1},Ba.RIGHT.get=function(){return 2},Object.defineProperties(dt,Ba),(G.prototype=new Error).name="EmptyStackException",(O.prototype=new at).add=function(t){return this.array_.push(t),!0},O.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},O.prototype.push=function(t){return this.array_.push(t),t},O.prototype.pop=function(t){if(this.array_.length===0)throw new G;return this.array_.pop()},O.prototype.peek=function(){if(this.array_.length===0)throw new G;return this.array_[this.array_.length-1]},O.prototype.empty=function(){return this.array_.length===0},O.prototype.isEmpty=function(){return this.empty()},O.prototype.search=function(t){return this.array_.indexOf(t)},O.prototype.size=function(){return this.array_.length},O.prototype.toArray=function(){for(var t=[],n=0,i=this.array_.length;n<i;n++)t.push(this.array_[n]);return t};var eo=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};eo.prototype.getCoordinate=function(){return this._minCoord},eo.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},eo.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();Nt.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],a=mt.computeOrientation(this._minCoord,i,n),f=!1;(n.y<this._minCoord.y&&i.y<this._minCoord.y&&a===mt.COUNTERCLOCKWISE||n.y>this._minCoord.y&&i.y>this._minCoord.y&&a===mt.CLOCKWISE)&&(f=!0),f&&(this._minIndex=this._minIndex-1)},eo.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 a=dt.LEFT;return i[n].y<i[n+1].y&&(a=dt.RIGHT),a},eo.prototype.getEdge=function(){return this._orientedDe},eo.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])},eo.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)},eo.prototype.findEdge=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isForward()&&this.checkForRightmostCoordinate(i)}Nt.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)===dt.LEFT&&(this._orientedDe=this._minDe.getSym())},eo.prototype.interfaces_=function(){return[]},eo.prototype.getClass=function(){return eo};var Mo=function(t){function n(i,a){t.call(this,n.msgWithCoord(i,a)),this.pt=a?new U(a):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,a){return a?i:i+" [ "+a+" ]"},n}(xr),za=function(){this.array_=[]};za.prototype.addLast=function(t){this.array_.push(t)},za.prototype.removeFirst=function(){return this.array_.shift()},za.prototype.isEmpty=function(){return this.array_.length===0};var wr=function(){this._finder=null,this._dirEdgeList=new j,this._nodes=new j,this._rightMostCoord=null,this._env=null,this._finder=new eo};wr.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},wr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},wr.prototype.computeNodeDepth=function(t){for(var n=null,i=t.getEdges().iterator();i.hasNext();){var a=i.next();if(a.isVisited()||a.getSym().isVisited()){n=a;break}}if(n===null)throw new Mo("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(n);for(var f=t.getEdges().iterator();f.hasNext();){var g=f.next();g.setVisited(!0),this.copySymDepths(g)}},wr.prototype.computeDepth=function(t){this.clearVisitedEdges();var n=this._finder.getEdge();n.setEdgeDepths(dt.RIGHT,t),this.copySymDepths(n),this.computeDepths(n)},wr.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},wr.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var n=t.next();n.getDepth(dt.RIGHT)>=1&&n.getDepth(dt.LEFT)<=0&&!n.isInteriorAreaEdge()&&n.setInResult(!0)}},wr.prototype.computeDepths=function(t){var n=new pr,i=new za,a=t.getNode();for(i.addLast(a),n.add(a),t.setVisited(!0);!i.isEmpty();){var f=i.removeFirst();n.add(f),this.computeNodeDepth(f);for(var g=f.getEdges().iterator();g.hasNext();){var v=g.next().getSym();if(!v.isVisited()){var S=v.getNode();n.contains(S)||(i.addLast(S),n.add(S))}}}},wr.prototype.compareTo=function(t){var n=t;return this._rightMostCoord.x<n._rightMostCoord.x?-1:this._rightMostCoord.x>n._rightMostCoord.x?1:0},wr.prototype.getEnvelope=function(){if(this._env===null){for(var t=new Et,n=this._dirEdgeList.iterator();n.hasNext();)for(var i=n.next().getEdge().getCoordinates(),a=0;a<i.length-1;a++)t.expandToInclude(i[a]);this._env=t}return this._env},wr.prototype.addReachable=function(t){var n=new O;for(n.add(t);!n.empty();){var i=n.pop();this.add(i,n)}},wr.prototype.copySymDepths=function(t){var n=t.getSym();n.setDepth(dt.LEFT,t.getDepth(dt.RIGHT)),n.setDepth(dt.RIGHT,t.getDepth(dt.LEFT))},wr.prototype.add=function(t,n){t.setVisited(!0),this._nodes.add(t);for(var i=t.getEdges().iterator();i.hasNext();){var a=i.next();this._dirEdgeList.add(a);var f=a.getSym().getNode();f.isVisited()||n.push(f)}},wr.prototype.getNodes=function(){return this._nodes},wr.prototype.getDirectedEdges=function(){return this._dirEdgeList},wr.prototype.interfaces_=function(){return[Z]},wr.prototype.getClass=function(){return wr};var un=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[dt.ON]=i}else if(arguments[0]instanceof t){var a=arguments[0];if(this.init(a.location.length),a!==null)for(var f=0;f<this.location.length;f++)this.location[f]=a.location[f]}}else if(arguments.length===3){var g=arguments[0],v=arguments[1],S=arguments[2];this.init(3),this.location[dt.ON]=g,this.location[dt.LEFT]=v,this.location[dt.RIGHT]=S}};un.prototype.setAllLocations=function(t){for(var n=0;n<this.location.length;n++)this.location[n]=t},un.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==W.NONE)return!1;return!0},un.prototype.setAllLocationsIfNull=function(t){for(var n=0;n<this.location.length;n++)this.location[n]===W.NONE&&(this.location[n]=t)},un.prototype.isLine=function(){return this.location.length===1},un.prototype.merge=function(t){if(t.location.length>this.location.length){var n=new Array(3).fill(null);n[dt.ON]=this.location[dt.ON],n[dt.LEFT]=W.NONE,n[dt.RIGHT]=W.NONE,this.location=n}for(var i=0;i<this.location.length;i++)this.location[i]===W.NONE&&i<t.location.length&&(this.location[i]=t.location[i])},un.prototype.getLocations=function(){return this.location},un.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[dt.LEFT];this.location[dt.LEFT]=this.location[dt.RIGHT],this.location[dt.RIGHT]=t},un.prototype.toString=function(){var t=new ie;return this.location.length>1&&t.append(W.toLocationSymbol(this.location[dt.LEFT])),t.append(W.toLocationSymbol(this.location[dt.ON])),this.location.length>1&&t.append(W.toLocationSymbol(this.location[dt.RIGHT])),t.toString()},un.prototype.setLocations=function(t,n,i){this.location[dt.ON]=t,this.location[dt.LEFT]=n,this.location[dt.RIGHT]=i},un.prototype.get=function(t){return t<this.location.length?this.location[t]:W.NONE},un.prototype.isArea=function(){return this.location.length>1},un.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===W.NONE)return!0;return!1},un.prototype.setLocation=function(){if(arguments.length===1){var t=arguments[0];this.setLocation(dt.ON,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.location[n]=i}},un.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(W.NONE)},un.prototype.isEqualOnSide=function(t,n){return this.location[n]===t.location[n]},un.prototype.allPositionsEqual=function(t){for(var n=0;n<this.location.length;n++)if(this.location[n]!==t)return!1;return!0},un.prototype.interfaces_=function(){return[]},un.prototype.getClass=function(){return un};var Ve=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 un(n),this.elt[1]=new un(n)}else if(arguments[0]instanceof t){var i=arguments[0];this.elt[0]=new un(i.elt[0]),this.elt[1]=new un(i.elt[1])}}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.elt[0]=new un(W.NONE),this.elt[1]=new un(W.NONE),this.elt[a].setLocation(f)}else if(arguments.length===3){var g=arguments[0],v=arguments[1],S=arguments[2];this.elt[0]=new un(g,v,S),this.elt[1]=new un(g,v,S)}else if(arguments.length===4){var P=arguments[0],V=arguments[1],tt=arguments[2],nt=arguments[3];this.elt[0]=new un(W.NONE,W.NONE,W.NONE),this.elt[1]=new un(W.NONE,W.NONE,W.NONE),this.elt[P].setLocations(V,tt,nt)}};Ve.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},Ve.prototype.setAllLocations=function(t,n){this.elt[t].setAllLocations(n)},Ve.prototype.isNull=function(t){return this.elt[t].isNull()},Ve.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)}},Ve.prototype.isLine=function(t){return this.elt[t].isLine()},Ve.prototype.merge=function(t){for(var n=0;n<2;n++)this.elt[n]===null&&t.elt[n]!==null?this.elt[n]=new un(t.elt[n]):this.elt[n].merge(t.elt[n])},Ve.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},Ve.prototype.getLocation=function(){if(arguments.length===1){var t=arguments[0];return this.elt[t].get(dt.ON)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.elt[n].get(i)}},Ve.prototype.toString=function(){var t=new ie;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()},Ve.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()}},Ve.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},Ve.prototype.setLocation=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];this.elt[t].setLocation(dt.ON,n)}else if(arguments.length===3){var i=arguments[0],a=arguments[1],f=arguments[2];this.elt[i].setLocation(a,f)}},Ve.prototype.isEqualOnSide=function(t,n){return this.elt[0].isEqualOnSide(t.elt[0],n)&&this.elt[1].isEqualOnSide(t.elt[1],n)},Ve.prototype.allPositionsEqual=function(t,n){return this.elt[t].allPositionsEqual(n)},Ve.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new un(this.elt[t].location[0]))},Ve.prototype.interfaces_=function(){return[]},Ve.prototype.getClass=function(){return Ve},Ve.toLineLabel=function(t){for(var n=new Ve(W.NONE),i=0;i<2;i++)n.setLocation(i,t.getLocation(i));return n};var Xn=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new j,this._pts=new j,this._label=new Ve(W.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new j,this._geometryFactory=null;var t=arguments[0],n=arguments[1];this._geometryFactory=n,this.computePoints(t),this.computeRing()};Xn.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=mt.isCCW(this._ring.getCoordinates())},Xn.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},Xn.prototype.computePoints=function(t){this._startDe=t;var n=t,i=!0;do{if(n===null)throw new Mo("Found null DirectedEdge");if(n.getEdgeRing()===this)throw new Mo("Directed Edge visited twice during ring-building at "+n.getCoordinate());this._edges.add(n);var a=n.getLabel();Nt.isTrue(a.isArea()),this.mergeLabel(a),this.addPoints(n.getEdge(),n.isForward(),i),i=!1,this.setEdgeRing(n,this),n=this.getNext(n)}while(n!==this._startDe)},Xn.prototype.getLinearRing=function(){return this._ring},Xn.prototype.getCoordinate=function(t){return this._pts.get(t)},Xn.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},Xn.prototype.addPoints=function(t,n,i){var a=t.getCoordinates();if(n){var f=1;i&&(f=0);for(var g=f;g<a.length;g++)this._pts.add(a[g])}else{var v=a.length-2;i&&(v=a.length-1);for(var S=v;S>=0;S--)this._pts.add(a[S])}},Xn.prototype.isHole=function(){return this._isHole},Xn.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)},Xn.prototype.containsPoint=function(t){var n=this.getLinearRing();if(!n.getEnvelopeInternal().contains(t)||!mt.isPointInRing(t,n.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();)if(i.next().containsPoint(t))return!1;return!0},Xn.prototype.addHole=function(t){this._holes.add(t)},Xn.prototype.isShell=function(){return this._shell===null},Xn.prototype.getLabel=function(){return this._label},Xn.prototype.getEdges=function(){return this._edges},Xn.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Xn.prototype.getShell=function(){return this._shell},Xn.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],a=n.getLocation(i,dt.RIGHT);if(a===W.NONE)return null;if(this._label.getLocation(i)===W.NONE)return this._label.setLocation(i,a),null}},Xn.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)},Xn.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)},Xn.prototype.interfaces_=function(){return[]},Xn.prototype.getClass=function(){return Xn};var Gf=function(t){function n(){var i=arguments[0],a=arguments[1];t.call(this,i,a)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.setEdgeRing=function(i,a){i.setMinEdgeRing(a)},n.prototype.getNext=function(i){return i.getNextMin()},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Xn),Zl=function(t){function n(){var i=arguments[0],a=arguments[1];t.call(this,i,a)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.buildMinimalRings=function(){var i=new j,a=this._startDe;do{if(a.getMinEdgeRing()===null){var f=new Gf(a,this._geometryFactory);i.add(f)}a=a.getNext()}while(a!==this._startDe);return i},n.prototype.setEdgeRing=function(i,a){i.setEdgeRing(a)},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}(Xn),ci=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}}};ci.prototype.setVisited=function(t){this._isVisited=t},ci.prototype.setInResult=function(t){this._isInResult=t},ci.prototype.isCovered=function(){return this._isCovered},ci.prototype.isCoveredSet=function(){return this._isCoveredSet},ci.prototype.setLabel=function(t){this._label=t},ci.prototype.getLabel=function(){return this._label},ci.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},ci.prototype.updateIM=function(t){Nt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},ci.prototype.isInResult=function(){return this._isInResult},ci.prototype.isVisited=function(){return this._isVisited},ci.prototype.interfaces_=function(){return[]},ci.prototype.getClass=function(){return ci};var lu=function(t){function n(){t.call(this),this._coord=null,this._edges=null;var i=arguments[0],a=arguments[1];this._coord=i,this._edges=a,this._label=new Ve(0,W.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,a){var f=W.NONE;if(f=this._label.getLocation(a),!i.isNull(a)){var g=i.getLocation(a);f!==W.BOUNDARY&&(f=g)}return f},n.prototype.setLabel=function(){if(arguments.length!==2)return t.prototype.setLabel.apply(this,arguments);var i=arguments[0],a=arguments[1];this._label===null?this._label=new Ve(i,a):this._label.setLocation(i,a)},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 Ve)for(var a=arguments[0],f=0;f<2;f++){var g=this.computeMergedLocation(a,f);this._label.getLocation(f)===W.NONE&&this._label.setLocation(f,g)}},n.prototype.add=function(i){this._edges.insert(i),i.setNode(this)},n.prototype.setLabelBoundary=function(i){if(this._label===null)return null;var a=W.NONE;this._label!==null&&(a=this._label.getLocation(i));var f=null;switch(a){case W.BOUNDARY:f=W.INTERIOR;break;case W.INTERIOR:default:f=W.BOUNDARY}this._label.setLocation(i,f)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(ci),no=function(){this.nodeMap=new b,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};no.prototype.find=function(t){return this.nodeMap.get(t)},no.prototype.addNode=function(){if(arguments[0]instanceof U){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 lu){var i=arguments[0],a=this.nodeMap.get(i.getCoordinate());return a===null?(this.nodeMap.put(i.getCoordinate(),i),i):(a.mergeLabel(i),a)}},no.prototype.print=function(t){for(var n=this.iterator();n.hasNext();)n.next().print(t)},no.prototype.iterator=function(){return this.nodeMap.values().iterator()},no.prototype.values=function(){return this.nodeMap.values()},no.prototype.getBoundaryNodes=function(t){for(var n=new j,i=this.iterator();i.hasNext();){var a=i.next();a.getLabel().getLocation(t)===W.BOUNDARY&&n.add(a)}return n},no.prototype.add=function(t){var n=t.getCoordinate();this.addNode(n).add(t)},no.prototype.interfaces_=function(){return[]},no.prototype.getClass=function(){return no};var on=function(){},Us={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};on.prototype.interfaces_=function(){return[]},on.prototype.getClass=function(){return on},on.isNorthern=function(t){return t===on.NE||t===on.NW},on.isOpposite=function(t,n){return t===n?!1:(t-n+4)%4===2},on.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},on.isInHalfPlane=function(t,n){return n===on.SE?t===on.SE||t===on.SW:t===n||t===n+1},on.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 k("Cannot compute the quadrant for point ( "+t+", "+n+" )");return t>=0?n>=0?on.NE:on.SE:n>=0?on.NW:on.SW}if(arguments[0]instanceof U&&arguments[1]instanceof U){var i=arguments[0],a=arguments[1];if(a.x===i.x&&a.y===i.y)throw new k("Cannot compute the quadrant for two identical points "+i);return a.x>=i.x?a.y>=i.y?on.NE:on.SE:a.y>=i.y?on.NW:on.SW}},Us.NE.get=function(){return 0},Us.NW.get=function(){return 1},Us.SW.get=function(){return 2},Us.SE.get=function(){return 3},Object.defineProperties(on,Us);var Mr=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],a=arguments[2];this._edge=n,this.init(i,a),this._label=null}else if(arguments.length===4){var f=arguments[0],g=arguments[1],v=arguments[2],S=arguments[3];this._edge=f,this.init(g,v),this._label=S}};Mr.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:mt.computeOrientation(t._p0,t._p1,this._p1)},Mr.prototype.getDy=function(){return this._dy},Mr.prototype.getCoordinate=function(){return this._p0},Mr.prototype.setNode=function(t){this._node=t},Mr.prototype.print=function(t){var n=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),a=i.lastIndexOf("."),f=i.substring(a+1);t.print(" "+f+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label)},Mr.prototype.compareTo=function(t){var n=t;return this.compareDirection(n)},Mr.prototype.getDirectedCoordinate=function(){return this._p1},Mr.prototype.getDx=function(){return this._dx},Mr.prototype.getLabel=function(){return this._label},Mr.prototype.getEdge=function(){return this._edge},Mr.prototype.getQuadrant=function(){return this._quadrant},Mr.prototype.getNode=function(){return this._node},Mr.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},Mr.prototype.computeLabel=function(t){},Mr.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=on.quadrant(this._dx,this._dy),Nt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},Mr.prototype.interfaces_=function(){return[Z]},Mr.prototype.getClass=function(){return Mr};var nl=function(t){function n(){var i=arguments[0],a=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=a,a)this.init(i.getCoordinate(0),i.getCoordinate(1));else{var f=i.getNumPoints()-1;this.init(i.getCoordinate(f),i.getCoordinate(f-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 Ve(this._edge.getLabel()),this._isForward||this._label.flip()},n.prototype.getNext=function(){return this._next},n.prototype.setDepth=function(i,a){if(this._depth[i]!==-999&&this._depth[i]!==a)throw new Mo("assigned depths do not match",this.getCoordinate());this._depth[i]=a},n.prototype.isInteriorAreaEdge=function(){for(var i=!0,a=0;a<2;a++)this._label.isArea(a)&&this._label.getLocation(a,dt.LEFT)===W.INTERIOR&&this._label.getLocation(a,dt.RIGHT)===W.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[dt.LEFT]+"/"+this._depth[dt.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),a=!this._label.isArea(0)||this._label.allPositionsEqual(0,W.EXTERIOR),f=!this._label.isArea(1)||this._label.allPositionsEqual(1,W.EXTERIOR);return i&&a&&f},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,a){var f=this.getEdge().getDepthDelta();this._isForward||(f=-f);var g=1;i===dt.LEFT&&(g=-1);var v=dt.opposite(i),S=a+f*g;this.setDepth(i,a),this.setDepth(v,S)},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,a){return i===W.EXTERIOR&&a===W.INTERIOR?1:i===W.INTERIOR&&a===W.EXTERIOR?-1:0},n}(Mr),ia=function(){};ia.prototype.createNode=function(t){return new lu(t,null)},ia.prototype.interfaces_=function(){return[]},ia.prototype.getClass=function(){return ia};var In=function(){if(this._edges=new j,this._nodes=null,this._edgeEndList=new j,arguments.length===0)this._nodes=new no(new ia);else if(arguments.length===1){var t=arguments[0];this._nodes=new no(t)}};In.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)}},In.prototype.find=function(t){return this._nodes.find(t)},In.prototype.addNode=function(){if(arguments[0]instanceof lu){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof U){var n=arguments[0];return this._nodes.addNode(n)}},In.prototype.getNodeIterator=function(){return this._nodes.iterator()},In.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},In.prototype.debugPrintln=function(t){Ge.out.println(t)},In.prototype.isBoundaryNode=function(t,n){var i=this._nodes.find(n);if(i===null)return!1;var a=i.getLabel();return a!==null&&a.getLocation(t)===W.BOUNDARY},In.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},In.prototype.matchInSameDirection=function(t,n,i,a){return!!t.equals(i)&&mt.computeOrientation(t,n,a)===mt.COLLINEAR&&on.quadrant(t,n)===on.quadrant(i,a)},In.prototype.getEdgeEnds=function(){return this._edgeEndList},In.prototype.debugPrint=function(t){Ge.out.print(t)},In.prototype.getEdgeIterator=function(){return this._edges.iterator()},In.prototype.findEdgeInSameDirection=function(t,n){for(var i=0;i<this._edges.size();i++){var a=this._edges.get(i),f=a.getCoordinates();if(this.matchInSameDirection(t,n,f[0],f[1])||this.matchInSameDirection(t,n,f[f.length-1],f[f.length-2]))return a}return null},In.prototype.insertEdge=function(t){this._edges.add(t)},In.prototype.findEdgeEnd=function(t){for(var n=this.getEdgeEnds().iterator();n.hasNext();){var i=n.next();if(i.getEdge()===t)return i}return null},In.prototype.addEdges=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next();this._edges.add(i);var a=new nl(i,!0),f=new nl(i,!1);a.setSym(f),f.setSym(a),this.add(a),this.add(f)}},In.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},In.prototype.getNodes=function(){return this._nodes.values()},In.prototype.findEdge=function(t,n){for(var i=0;i<this._edges.size();i++){var a=this._edges.get(i),f=a.getCoordinates();if(t.equals(f[0])&&n.equals(f[1]))return a}return null},In.prototype.interfaces_=function(){return[]},In.prototype.getClass=function(){return In},In.linkResultDirectedEdges=function(t){for(var n=t.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()};var $r=function(){this._geometryFactory=null,this._shellList=new j;var t=arguments[0];this._geometryFactory=t};$r.prototype.sortShellsAndHoles=function(t,n,i){for(var a=t.iterator();a.hasNext();){var f=a.next();f.isHole()?i.add(f):n.add(f)}},$r.prototype.computePolygons=function(t){for(var n=new j,i=t.iterator();i.hasNext();){var a=i.next().toPolygon(this._geometryFactory);n.add(a)}return n},$r.prototype.placeFreeHoles=function(t,n){for(var i=n.iterator();i.hasNext();){var a=i.next();if(a.getShell()===null){var f=this.findEdgeRingContaining(a,t);if(f===null)throw new Mo("unable to assign hole to a shell",a.getCoordinate(0));a.setShell(f)}}},$r.prototype.buildMinimalEdgeRings=function(t,n,i){for(var a=new j,f=t.iterator();f.hasNext();){var g=f.next();if(g.getMaxNodeDegree()>2){g.linkDirectedEdgesForMinimalEdgeRings();var v=g.buildMinimalRings(),S=this.findShell(v);S!==null?(this.placePolygonHoles(S,v),n.add(S)):i.addAll(v)}else a.add(g)}return a},$r.prototype.containsPoint=function(t){for(var n=this._shellList.iterator();n.hasNext();)if(n.next().containsPoint(t))return!0;return!1},$r.prototype.buildMaximalEdgeRings=function(t){for(var n=new j,i=t.iterator();i.hasNext();){var a=i.next();if(a.isInResult()&&a.getLabel().isArea()&&a.getEdgeRing()===null){var f=new Zl(a,this._geometryFactory);n.add(f),f.setInResult()}}return n},$r.prototype.placePolygonHoles=function(t,n){for(var i=n.iterator();i.hasNext();){var a=i.next();a.isHole()&&a.setShell(t)}},$r.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},$r.prototype.findEdgeRingContaining=function(t,n){for(var i=t.getLinearRing(),a=i.getEnvelopeInternal(),f=i.getCoordinateN(0),g=null,v=null,S=n.iterator();S.hasNext();){var P=S.next(),V=P.getLinearRing(),tt=V.getEnvelopeInternal();g!==null&&(v=g.getLinearRing().getEnvelopeInternal());var nt=!1;tt.contains(a)&&mt.isPointInRing(f,V.getCoordinates())&&(nt=!0),nt&&(g===null||v.contains(tt))&&(g=P)}return g},$r.prototype.findShell=function(t){for(var n=0,i=null,a=t.iterator();a.hasNext();){var f=a.next();f.isHole()||(i=f,n++)}return Nt.isTrue(n<=1,"found two shells in MinimalEdgeRing list"),i},$r.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];In.linkResultDirectedEdges(i);var a=this.buildMaximalEdgeRings(n),f=new j,g=this.buildMinimalEdgeRings(a,this._shellList,f);this.sortShellsAndHoles(g,this._shellList,f),this.placeFreeHoles(this._shellList,f)}},$r.prototype.interfaces_=function(){return[]},$r.prototype.getClass=function(){return $r};var gn=function(){};gn.prototype.getBounds=function(){},gn.prototype.interfaces_=function(){return[]},gn.prototype.getClass=function(){return gn};var le=function(){this._bounds=null,this._item=null;var t=arguments[0],n=arguments[1];this._bounds=t,this._item=n};le.prototype.getItem=function(){return this._item},le.prototype.getBounds=function(){return this._bounds},le.prototype.interfaces_=function(){return[gn,e]},le.prototype.getClass=function(){return le};var Bo=function(){this._size=null,this._items=null,this._size=0,this._items=new j,this._items.add(null)};Bo.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},Bo.prototype.size=function(){return this._size},Bo.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)},Bo.prototype.clear=function(){this._size=0,this._items.clear()},Bo.prototype.isEmpty=function(){return this._size===0},Bo.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)},Bo.prototype.interfaces_=function(){return[]},Bo.prototype.getClass=function(){return Bo};var jo=function(){};jo.prototype.visitItem=function(t){},jo.prototype.interfaces_=function(){return[]},jo.prototype.getClass=function(){return jo};var Bs=function(){};Bs.prototype.insert=function(t,n){},Bs.prototype.remove=function(t,n){},Bs.prototype.query=function(){},Bs.prototype.interfaces_=function(){return[]},Bs.prototype.getClass=function(){return Bs};var Kn=function(){if(this._childBoundables=new j,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this._level=t}}},Jl={serialVersionUID:{configurable:!0}};Kn.prototype.getLevel=function(){return this._level},Kn.prototype.size=function(){return this._childBoundables.size()},Kn.prototype.getChildBoundables=function(){return this._childBoundables},Kn.prototype.addChildBoundable=function(t){Nt.isTrue(this._bounds===null),this._childBoundables.add(t)},Kn.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Kn.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Kn.prototype.interfaces_=function(){return[gn,e]},Kn.prototype.getClass=function(){return Kn},Jl.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Kn,Jl);var Ui=function(){};Ui.reverseOrder=function(){return{compare:function(t,n){return n.compareTo(t)}}},Ui.min=function(t){return Ui.sort(t),t.get(0)},Ui.sort=function(t,n){var i=t.toArray();n?Un.sort(i,n):Un.sort(i);for(var a=t.iterator(),f=0,g=i.length;f<g;f++)a.next(),a.set(i[f])},Ui.singletonList=function(t){var n=new j;return n.add(t),n};var Gn=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()};Gn.prototype.expandToQueue=function(t,n){var i=Gn.isComposite(this._boundable1),a=Gn.isComposite(this._boundable2);if(i&&a)return Gn.area(this._boundable1)>Gn.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(a)return this.expand(this._boundable2,this._boundable1,t,n),null;throw new k("neither boundable is composite")},Gn.prototype.isLeaves=function(){return!(Gn.isComposite(this._boundable1)||Gn.isComposite(this._boundable2))},Gn.prototype.compareTo=function(t){var n=t;return this._distance<n._distance?-1:this._distance>n._distance?1:0},Gn.prototype.expand=function(t,n,i,a){for(var f=t.getChildBoundables().iterator();f.hasNext();){var g=f.next(),v=new Gn(g,n,this._itemDistance);v.getDistance()<a&&i.add(v)}},Gn.prototype.getBoundable=function(t){return t===0?this._boundable1:this._boundable2},Gn.prototype.getDistance=function(){return this._distance},Gn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Gn.prototype.interfaces_=function(){return[Z]},Gn.prototype.getClass=function(){return Gn},Gn.area=function(t){return t.getBounds().getArea()},Gn.isComposite=function(t){return t instanceof Kn};var or=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new j,this._nodeCapacity=null,arguments.length===0){var n=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=n}else if(arguments.length===1){var i=arguments[0];Nt.isTrue(i>1,"Node capacity must be greater than 1"),this._nodeCapacity=i}},sr={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};or.prototype.getNodeCapacity=function(){return this._nodeCapacity},or.prototype.lastNode=function(t){return t.get(t.size()-1)},or.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 Kn?t+=this.size(i):i instanceof le&&(t+=1)}return t}},or.prototype.removeItem=function(t,n){for(var i=null,a=t.getChildBoundables().iterator();a.hasNext();){var f=a.next();f instanceof le&&f.getItem()===n&&(i=f)}return i!==null&&(t.getChildBoundables().remove(i),!0)},or.prototype.itemsTree=function(){if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new j:t}if(arguments.length===1){for(var n=arguments[0],i=new j,a=n.getChildBoundables().iterator();a.hasNext();){var f=a.next();if(f instanceof Kn){var g=this.itemsTree(f);g!==null&&i.add(g)}else f instanceof le?i.add(f.getItem()):Nt.shouldNeverReachHere()}return i.size()<=0?null:i}},or.prototype.insert=function(t,n){Nt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new le(t,n))},or.prototype.boundablesAtLevel=function(){if(arguments.length===1){var t=arguments[0],n=new j;return this.boundablesAtLevel(t,this._root,n),n}if(arguments.length===3){var i=arguments[0],a=arguments[1],f=arguments[2];if(Nt.isTrue(i>-2),a.getLevel()===i)return f.add(a),null;for(var g=a.getChildBoundables().iterator();g.hasNext();){var v=g.next();v instanceof Kn?this.boundablesAtLevel(i,v,f):(Nt.isTrue(v instanceof le),i===-1&&f.add(v))}return null}},or.prototype.query=function(){if(arguments.length===1){var t=arguments[0];this.build();var n=new j;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],a=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),i)&&this.query(i,this._root,a)}else if(arguments.length===3){if(yt(arguments[2],jo)&&arguments[0]instanceof Object&&arguments[1]instanceof Kn)for(var f=arguments[0],g=arguments[1],v=arguments[2],S=g.getChildBoundables(),P=0;P<S.size();P++){var V=S.get(P);this.getIntersectsOp().intersects(V.getBounds(),f)&&(V instanceof Kn?this.query(f,V,v):V instanceof le?v.visitItem(V.getItem()):Nt.shouldNeverReachHere())}else if(yt(arguments[2],at)&&arguments[0]instanceof Object&&arguments[1]instanceof Kn)for(var tt=arguments[0],nt=arguments[1],vt=arguments[2],xt=nt.getChildBoundables(),Tt=0;Tt<xt.size();Tt++){var Ut=xt.get(Tt);this.getIntersectsOp().intersects(Ut.getBounds(),tt)&&(Ut instanceof Kn?this.query(tt,Ut,vt):Ut instanceof le?vt.add(Ut.getItem()):Nt.shouldNeverReachHere())}}},or.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},or.prototype.getRoot=function(){return this.build(),this._root},or.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],a=arguments[1],f=arguments[2],g=this.removeItem(a,f);if(g)return!0;for(var v=null,S=a.getChildBoundables().iterator();S.hasNext();){var P=S.next();if(this.getIntersectsOp().intersects(P.getBounds(),i)&&P instanceof Kn&&(g=this.remove(i,P,f))){v=P;break}}return v!==null&&v.getChildBoundables().isEmpty()&&a.getChildBoundables().remove(v),g}},or.prototype.createHigherLevels=function(t,n){Nt.isTrue(!t.isEmpty());var i=this.createParentBoundables(t,n+1);return i.size()===1?i.get(0):this.createHigherLevels(i,n+1)},or.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 Kn){var a=this.depth(i);a>t&&(t=a)}}return t+1}},or.prototype.createParentBoundables=function(t,n){Nt.isTrue(!t.isEmpty());var i=new j;i.add(this.createNode(n));var a=new j(t);Ui.sort(a,this.getComparator());for(var f=a.iterator();f.hasNext();){var g=f.next();this.lastNode(i).getChildBoundables().size()===this.getNodeCapacity()&&i.add(this.createNode(n)),this.lastNode(i).addChildBoundable(g)}return i},or.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},or.prototype.interfaces_=function(){return[e]},or.prototype.getClass=function(){return or},or.compareDoubles=function(t,n){return t>n?1:t<n?-1:0},sr.IntersectsOp.get=function(){return rl},sr.serialVersionUID.get=function(){return-3886435814360241e3},sr.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(or,sr);var rl=function(){},ro=function(){};ro.prototype.distance=function(t,n){},ro.prototype.interfaces_=function(){return[]},ro.prototype.getClass=function(){return ro};var il=function(t){function n(a){a=a||n.DEFAULT_NODE_CAPACITY,t.call(this,a)}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(a,f){Nt.isTrue(a.length>0);for(var g=new j,v=0;v<a.length;v++)g.addAll(this.createParentBoundablesFromVerticalSlice(a[v],f));return g},n.prototype.createNode=function(a){return new cu(a)},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 a=arguments[0],f=arguments[1];if(a.isNull())return null;t.prototype.insert.call(this,a,f)},n.prototype.getIntersectsOp=function(){return n.intersectsOp},n.prototype.verticalSlices=function(a,f){for(var g=Math.trunc(Math.ceil(a.size()/f)),v=new Array(f).fill(null),S=a.iterator(),P=0;P<f;P++){v[P]=new j;for(var V=0;S.hasNext()&&V<g;){var tt=S.next();v[P].add(tt),V++}}return v},n.prototype.query=function(){if(arguments.length===1){var a=arguments[0];return t.prototype.query.call(this,a)}if(arguments.length===2){var f=arguments[0],g=arguments[1];t.prototype.query.call(this,f,g)}else if(arguments.length===3){if(yt(arguments[2],jo)&&arguments[0]instanceof Object&&arguments[1]instanceof Kn){var v=arguments[0],S=arguments[1],P=arguments[2];t.prototype.query.call(this,v,S,P)}else if(yt(arguments[2],at)&&arguments[0]instanceof Object&&arguments[1]instanceof Kn){var V=arguments[0],tt=arguments[1],nt=arguments[2];t.prototype.query.call(this,V,tt,nt)}}},n.prototype.getComparator=function(){return n.yComparator},n.prototype.createParentBoundablesFromVerticalSlice=function(a,f){return t.prototype.createParentBoundables.call(this,a,f)},n.prototype.remove=function(){if(arguments.length===2){var a=arguments[0],f=arguments[1];return t.prototype.remove.call(this,a,f)}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(a,f){Nt.isTrue(!a.isEmpty());var g=Math.trunc(Math.ceil(a.size()/this.getNodeCapacity())),v=new j(a);Ui.sort(v,n.xComparator);var S=this.verticalSlices(v,Math.trunc(Math.ceil(Math.sqrt(g))));return this.createParentBoundablesFromVerticalSlices(S,f)},n.prototype.nearestNeighbour=function(){if(arguments.length===1){if(yt(arguments[0],ro)){var a=arguments[0],f=new Gn(this.getRoot(),this.getRoot(),a);return this.nearestNeighbour(f)}if(arguments[0]instanceof Gn){var g=arguments[0];return this.nearestNeighbour(g,F.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof n&&yt(arguments[1],ro)){var v=arguments[0],S=arguments[1],P=new Gn(this.getRoot(),v.getRoot(),S);return this.nearestNeighbour(P)}if(arguments[0]instanceof Gn&&typeof arguments[1]=="number"){var V=arguments[0],tt=arguments[1],nt=null,vt=new Bo;for(vt.add(V);!vt.isEmpty()&&tt>0;){var xt=vt.poll(),Tt=xt.getDistance();if(Tt>=tt)break;xt.isLeaves()?(tt=Tt,nt=xt):xt.expandToQueue(vt,tt)}return[nt.getBoundable(0).getItem(),nt.getBoundable(1).getItem()]}}else if(arguments.length===3){var Ut=arguments[0],We=arguments[1],cn=arguments[2],Fr=new le(Ut,We),Ro=new Gn(this.getRoot(),Fr,cn);return this.nearestNeighbour(Ro)[0]}},n.prototype.interfaces_=function(){return[Bs,e]},n.prototype.getClass=function(){return n},n.centreX=function(a){return n.avg(a.getMinX(),a.getMaxX())},n.avg=function(a,f){return(a+f)/2},n.centreY=function(a){return n.avg(a.getMinY(),a.getMaxY())},i.STRtreeNode.get=function(){return cu},i.serialVersionUID.get=function(){return 0x39920f7d5f261e0},i.xComparator.get=function(){return{interfaces_:function(){return[et]},compare:function(a,f){return t.compareDoubles(n.centreX(a.getBounds()),n.centreX(f.getBounds()))}}},i.yComparator.get=function(){return{interfaces_:function(){return[et]},compare:function(a,f){return t.compareDoubles(n.centreY(a.getBounds()),n.centreY(f.getBounds()))}}},i.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(a,f){return a.intersects(f)}}},i.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(n,i),n}(or),cu=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,a=this.getChildBoundables().iterator();a.hasNext();){var f=a.next();i===null?i=new Et(f.getBounds()):i.expandToInclude(f.getBounds())}return i},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Kn),Sn=function(){};Sn.prototype.interfaces_=function(){return[]},Sn.prototype.getClass=function(){return Sn},Sn.relativeSign=function(t,n){return t<n?-1:t>n?1:0},Sn.compare=function(t,n,i){if(n.equals2D(i))return 0;var a=Sn.relativeSign(n.x,i.x),f=Sn.relativeSign(n.y,i.y);switch(t){case 0:return Sn.compareValue(a,f);case 1:return Sn.compareValue(f,a);case 2:return Sn.compareValue(f,-a);case 3:return Sn.compareValue(-a,f);case 4:return Sn.compareValue(-a,-f);case 5:return Sn.compareValue(-f,-a);case 6:return Sn.compareValue(-f,a);case 7:return Sn.compareValue(a,-f)}return Nt.shouldNeverReachHere("invalid octant value"),0},Sn.compareValue=function(t,n){return t<0?-1:t>0?1:n<0?-1:n>0?1:0};var zo=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],a=arguments[3];this._segString=t,this.coord=new U(n),this.segmentIndex=i,this._segmentOctant=a,this._isInterior=!n.equals2D(t.getCoordinate(i))};zo.prototype.getCoordinate=function(){return this.coord},zo.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},zo.prototype.compareTo=function(t){var n=t;return this.segmentIndex<n.segmentIndex?-1:this.segmentIndex>n.segmentIndex?1:this.coord.equals2D(n.coord)?0:Sn.compare(this._segmentOctant,this.coord,n.coord)},zo.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t},zo.prototype.isInterior=function(){return this._isInterior},zo.prototype.interfaces_=function(){return[Z]},zo.prototype.getClass=function(){return zo};var Sr=function(){this._nodeMap=new b,this._edge=null;var t=arguments[0];this._edge=t};Sr.prototype.getSplitCoordinates=function(){var t=new ft;this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var a=n.next();this.addEdgeCoordinates(i,a,t),i=a}return t.toCoordinateArray()},Sr.prototype.addCollapsedNodes=function(){var t=new j;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)}},Sr.prototype.print=function(t){t.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(t)},Sr.prototype.findCollapsesFromExistingVertices=function(t){for(var n=0;n<this._edge.size()-2;n++){var i=this._edge.getCoordinate(n),a=this._edge.getCoordinate(n+2);i.equals2D(a)&&t.add(new _t(n+1))}},Sr.prototype.addEdgeCoordinates=function(t,n,i){var a=this._edge.getCoordinate(n.segmentIndex),f=n.isInterior()||!n.coord.equals2D(a);i.add(new U(t.coord),!1);for(var g=t.segmentIndex+1;g<=n.segmentIndex;g++)i.add(this._edge.getCoordinate(g));f&&i.add(new U(n.coord))},Sr.prototype.iterator=function(){return this._nodeMap.values().iterator()},Sr.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var n=this.iterator(),i=n.next();n.hasNext();){var a=n.next(),f=this.createSplitEdge(i,a);t.add(f),i=a}},Sr.prototype.findCollapseIndex=function(t,n,i){if(!t.coord.equals2D(n.coord))return!1;var a=n.segmentIndex-t.segmentIndex;return n.isInterior()||a--,a===1&&(i[0]=t.segmentIndex+1,!0)},Sr.prototype.findCollapsesFromInsertedNodes=function(t){for(var n=new Array(1).fill(null),i=this.iterator(),a=i.next();i.hasNext();){var f=i.next();this.findCollapseIndex(a,f,n)&&t.add(new _t(n[0])),a=f}},Sr.prototype.getEdge=function(){return this._edge},Sr.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},Sr.prototype.createSplitEdge=function(t,n){var i=n.segmentIndex-t.segmentIndex+2,a=this._edge.getCoordinate(n.segmentIndex),f=n.isInterior()||!n.coord.equals2D(a);f||i--;var g=new Array(i).fill(null),v=0;g[v++]=new U(t.coord);for(var S=t.segmentIndex+1;S<=n.segmentIndex;S++)g[v++]=this._edge.getCoordinate(S);return f&&(g[v]=new U(n.coord)),new Ln(g,this._edge.getData())},Sr.prototype.add=function(t,n){var i=new zo(this._edge,t,n,this._edge.getSegmentOctant(n)),a=this._nodeMap.get(i);return a!==null?(Nt.isTrue(a.coord.equals2D(t),"Found equal nodes with different coordinates"),a):(this._nodeMap.put(i,i),i)},Sr.prototype.checkSplitEdgesCorrectness=function(t){var n=this._edge.getCoordinates(),i=t.get(0).getCoordinate(0);if(!i.equals2D(n[0]))throw new xr("bad split edge start point at "+i);var a=t.get(t.size()-1).getCoordinates(),f=a[a.length-1];if(!f.equals2D(n[n.length-1]))throw new xr("bad split edge end point at "+f)},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr};var ds=function(){};ds.prototype.interfaces_=function(){return[]},ds.prototype.getClass=function(){return ds},ds.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 k("Cannot compute the octant for point ( "+t+", "+n+" )");var i=Math.abs(t),a=Math.abs(n);return t>=0?n>=0?i>=a?0:1:i>=a?7:6:n>=0?i>=a?3:2:i>=a?4:5}if(arguments[0]instanceof U&&arguments[1]instanceof U){var f=arguments[0],g=arguments[1],v=g.x-f.x,S=g.y-f.y;if(v===0&&S===0)throw new k("Cannot compute the octant for two identical points "+f);return ds.octant(v,S)}};var io=function(){};io.prototype.getCoordinates=function(){},io.prototype.size=function(){},io.prototype.getCoordinate=function(t){},io.prototype.isClosed=function(){},io.prototype.setData=function(t){},io.prototype.getData=function(){},io.prototype.interfaces_=function(){return[]},io.prototype.getClass=function(){return io};var oa=function(){};oa.prototype.addIntersection=function(t,n){},oa.prototype.interfaces_=function(){return[io]},oa.prototype.getClass=function(){return oa};var Ln=function(){this._nodeList=new Sr(this),this._pts=null,this._data=null;var t=arguments[0],n=arguments[1];this._pts=t,this._data=n};Ln.prototype.getCoordinates=function(){return this._pts},Ln.prototype.size=function(){return this._pts.length},Ln.prototype.getCoordinate=function(t){return this._pts[t]},Ln.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Ln.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},Ln.prototype.setData=function(t){this._data=t},Ln.prototype.safeOctant=function(t,n){return t.equals2D(n)?0:ds.octant(t,n)},Ln.prototype.getData=function(){return this._data},Ln.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],a=arguments[1],f=arguments[3],g=new U(i.getIntersection(f));this.addIntersection(g,a)}},Ln.prototype.toString=function(){return Fn.toLineString(new Rn(this._pts))},Ln.prototype.getNodeList=function(){return this._nodeList},Ln.prototype.addIntersectionNode=function(t,n){var i=n,a=i+1;if(a<this._pts.length){var f=this._pts[a];t.equals2D(f)&&(i=a)}return this._nodeList.add(t,i)},Ln.prototype.addIntersections=function(t,n,i){for(var a=0;a<t.getIntersectionNum();a++)this.addIntersection(t,n,i,a)},Ln.prototype.interfaces_=function(){return[oa]},Ln.prototype.getClass=function(){return Ln},Ln.getNodedSubstrings=function(){if(arguments.length===1){var t=arguments[0],n=new j;return Ln.getNodedSubstrings(t,n),n}if(arguments.length===2)for(var i=arguments[0],a=arguments[1],f=i.iterator();f.hasNext();)f.next().getNodeList().addSplitEdges(a)};var bt=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new U,this.p1=new U;else if(arguments.length===1){var t=arguments[0];this.p0=new U(t.p0),this.p1=new U(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],a=arguments[2],f=arguments[3];this.p0=new U(n,i),this.p1=new U(a,f)}},Kl={serialVersionUID:{configurable:!0}};bt.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},bt.prototype.orientationIndex=function(){if(arguments[0]instanceof bt){var t=arguments[0],n=mt.orientationIndex(this.p0,this.p1,t.p0),i=mt.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 U){var a=arguments[0];return mt.orientationIndex(this.p0,this.p1,a)}},bt.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},bt.prototype.isVertical=function(){return this.p0.x===this.p1.x},bt.prototype.equals=function(t){if(!(t instanceof bt))return!1;var n=t;return this.p0.equals(n.p0)&&this.p1.equals(n.p1)},bt.prototype.intersection=function(t){var n=new Mi;return n.computeIntersection(this.p0,this.p1,t.p0,t.p1),n.hasIntersection()?n.getIntersection(0):null},bt.prototype.project=function(){if(arguments[0]instanceof U){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new U(t);var n=this.projectionFactor(t),i=new U;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 bt){var a=arguments[0],f=this.projectionFactor(a.p0),g=this.projectionFactor(a.p1);if(f>=1&&g>=1||f<=0&&g<=0)return null;var v=this.project(a.p0);f<0&&(v=this.p0),f>1&&(v=this.p1);var S=this.project(a.p1);return g<0&&(S=this.p0),g>1&&(S=this.p1),new bt(v,S)}},bt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},bt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},bt.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1},bt.prototype.distancePerpendicular=function(t){return mt.distancePointLinePerpendicular(t,this.p0,this.p1)},bt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},bt.prototype.midPoint=function(){return bt.midPoint(this.p0,this.p1)},bt.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,a=n*n+i*i;return a<=0?F.NaN:((t.x-this.p0.x)*n+(t.y-this.p0.y)*i)/a},bt.prototype.closestPoints=function(t){var n=this.intersection(t);if(n!==null)return[n,n];var i=new Array(2).fill(null),a=F.MAX_VALUE,f=null,g=this.closestPoint(t.p0);a=g.distance(t.p0),i[0]=g,i[1]=t.p0;var v=this.closestPoint(t.p1);(f=v.distance(t.p1))<a&&(a=f,i[0]=v,i[1]=t.p1);var S=t.closestPoint(this.p0);(f=S.distance(this.p0))<a&&(a=f,i[0]=this.p0,i[1]=S);var P=t.closestPoint(this.p1);return(f=P.distance(this.p1))<a&&(a=f,i[0]=this.p1,i[1]=P),i},bt.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},bt.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},bt.prototype.getLength=function(){return this.p0.distance(this.p1)},bt.prototype.compareTo=function(t){var n=t,i=this.p0.compareTo(n.p0);return i!==0?i:this.p1.compareTo(n.p1)},bt.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},bt.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)},bt.prototype.lineIntersection=function(t){try{return an.intersection(this.p0,this.p1,t.p0,t.p1)}catch(n){if(!(n instanceof yn))throw n}return null},bt.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},bt.prototype.pointAlongOffset=function(t,n){var i=this.p0.x+t*(this.p1.x-this.p0.x),a=this.p0.y+t*(this.p1.y-this.p0.y),f=this.p1.x-this.p0.x,g=this.p1.y-this.p0.y,v=Math.sqrt(f*f+g*g),S=0,P=0;if(n!==0){if(v<=0)throw new Error("Cannot compute offset from zero-length line segment");S=n*f/v,P=n*g/v}return new U(i-P,a+S)},bt.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}},bt.prototype.segmentFraction=function(t){var n=this.projectionFactor(t);return n<0?n=0:(n>1||F.isNaN(n))&&(n=1),n},bt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},bt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},bt.prototype.distance=function(){if(arguments[0]instanceof bt){var t=arguments[0];return mt.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof U){var n=arguments[0];return mt.distancePointLine(n,this.p0,this.p1)}},bt.prototype.pointAlong=function(t){var n=new U;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},bt.prototype.hashCode=function(){var t=F.doubleToLongBits(this.p0.x);t^=31*F.doubleToLongBits(this.p0.y);var n=Math.trunc(t)^Math.trunc(t>>32),i=F.doubleToLongBits(this.p1.x);return i^=31*F.doubleToLongBits(this.p1.y),n^(Math.trunc(i)^Math.trunc(i>>32))},bt.prototype.interfaces_=function(){return[Z,e]},bt.prototype.getClass=function(){return bt},bt.midPoint=function(t,n){return new U((t.x+n.x)/2,(t.y+n.y)/2)},Kl.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(bt,Kl);var Zr=function(){this.tempEnv1=new Et,this.tempEnv2=new Et,this._overlapSeg1=new bt,this._overlapSeg2=new bt};Zr.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var t=arguments[0],n=arguments[1],i=arguments[2],a=arguments[3];t.getLineSegment(n,this._overlapSeg1),i.getLineSegment(a,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},Zr.prototype.interfaces_=function(){return[]},Zr.prototype.getClass=function(){return Zr};var Jr=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],a=arguments[3];this._pts=t,this._start=n,this._end=i,this._context=a};Jr.prototype.getLineSegment=function(t,n){n.p0=this._pts[t],n.p1=this._pts[t+1]},Jr.prototype.computeSelect=function(t,n,i,a){var f=this._pts[n],g=this._pts[i];if(a.tempEnv1.init(f,g),i-n==1)return a.select(this,n),null;if(!t.intersects(a.tempEnv1))return null;var v=Math.trunc((n+i)/2);n<v&&this.computeSelect(t,n,v,a),v<i&&this.computeSelect(t,v,i,a)},Jr.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},Jr.prototype.computeOverlaps=function(t,n){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,n)},Jr.prototype.setId=function(t){this._id=t},Jr.prototype.select=function(t,n){this.computeSelect(t,this._start,this._end,n)},Jr.prototype.getEnvelope=function(){if(this._env===null){var t=this._pts[this._start],n=this._pts[this._end];this._env=new Et(t,n)}return this._env},Jr.prototype.getEndIndex=function(){return this._end},Jr.prototype.getStartIndex=function(){return this._start},Jr.prototype.getContext=function(){return this._context},Jr.prototype.getId=function(){return this._id},Jr.prototype.computeOverlapsInternal=function(t,n,i,a,f,g){var v=this._pts[t],S=this._pts[n],P=i._pts[a],V=i._pts[f];if(n-t==1&&f-a==1)return g.overlap(this,t,i,a),null;if(g.tempEnv1.init(v,S),g.tempEnv2.init(P,V),!g.tempEnv1.intersects(g.tempEnv2))return null;var tt=Math.trunc((t+n)/2),nt=Math.trunc((a+f)/2);t<tt&&(a<nt&&this.computeOverlapsInternal(t,tt,i,a,nt,g),nt<f&&this.computeOverlapsInternal(t,tt,i,nt,f,g)),tt<n&&(a<nt&&this.computeOverlapsInternal(tt,n,i,a,nt,g),nt<f&&this.computeOverlapsInternal(tt,n,i,nt,f,g))},Jr.prototype.interfaces_=function(){return[]},Jr.prototype.getClass=function(){return Jr};var Bi=function(){};Bi.prototype.interfaces_=function(){return[]},Bi.prototype.getClass=function(){return Bi},Bi.getChainStartIndices=function(t){var n=0,i=new j;i.add(new _t(n));do{var a=Bi.findChainEnd(t,n);i.add(new _t(a)),n=a}while(n<t.length-1);return Bi.toIntArray(i)},Bi.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 a=on.quadrant(t[i],t[i+1]),f=n+1;f<t.length&&!(!t[f-1].equals2D(t[f])&&on.quadrant(t[f-1],t[f])!==a);)f++;return f-1},Bi.getChains=function(){if(arguments.length===1){var t=arguments[0];return Bi.getChains(t,null)}if(arguments.length===2){for(var n=arguments[0],i=arguments[1],a=new j,f=Bi.getChainStartIndices(n),g=0;g<f.length-1;g++){var v=new Jr(n,f[g],f[g+1],i);a.add(v)}return a}},Bi.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 fi=function(){};fi.prototype.computeNodes=function(t){},fi.prototype.getNodedSubstrings=function(){},fi.prototype.interfaces_=function(){return[]},fi.prototype.getClass=function(){return fi};var gs=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setSegmentIntersector(t)}}};gs.prototype.setSegmentIntersector=function(t){this._segInt=t},gs.prototype.interfaces_=function(){return[fi]},gs.prototype.getClass=function(){return gs};var ka=function(t){function n(a){a?t.call(this,a):t.call(this),this._monoChains=new j,this._index=new il,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 Ln.getNodedSubstrings(this._nodedSegStrings)},n.prototype.getIndex=function(){return this._index},n.prototype.add=function(a){for(var f=Bi.getChains(a.getCoordinates(),a).iterator();f.hasNext();){var g=f.next();g.setId(this._idCounter++),this._index.insert(g.getEnvelope(),g),this._monoChains.add(g)}},n.prototype.computeNodes=function(a){this._nodedSegStrings=a;for(var f=a.iterator();f.hasNext();)this.add(f.next());this.intersectChains()},n.prototype.intersectChains=function(){for(var a=new Hn(this._segInt),f=this._monoChains.iterator();f.hasNext();)for(var g=f.next(),v=this._index.query(g.getEnvelope()).iterator();v.hasNext();){var S=v.next();if(S.getId()>g.getId()&&(g.computeOverlaps(S,a),this._nOverlaps++),this._segInt.isDone())return null}},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},i.SegmentOverlapAction.get=function(){return Hn},Object.defineProperties(n,i),n}(gs),Hn=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],a=arguments[1],f=arguments[2],g=arguments[3],v=i.getContext(),S=f.getContext();this._si.processIntersections(v,a,S,g)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Zr),jt=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],a=arguments[1];this.setQuadrantSegments(i),this.setEndCapStyle(a)}else if(arguments.length===4){var f=arguments[0],g=arguments[1],v=arguments[2],S=arguments[3];this.setQuadrantSegments(f),this.setEndCapStyle(g),this.setJoinStyle(v),this.setMitreLimit(S)}}},oo={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}};jt.prototype.getEndCapStyle=function(){return this._endCapStyle},jt.prototype.isSingleSided=function(){return this._isSingleSided},jt.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=jt.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=jt.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==jt.JOIN_ROUND&&(this._quadrantSegments=jt.DEFAULT_QUADRANT_SEGMENTS)},jt.prototype.getJoinStyle=function(){return this._joinStyle},jt.prototype.setJoinStyle=function(t){this._joinStyle=t},jt.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},jt.prototype.getSimplifyFactor=function(){return this._simplifyFactor},jt.prototype.getQuadrantSegments=function(){return this._quadrantSegments},jt.prototype.setEndCapStyle=function(t){this._endCapStyle=t},jt.prototype.getMitreLimit=function(){return this._mitreLimit},jt.prototype.setMitreLimit=function(t){this._mitreLimit=t},jt.prototype.setSingleSided=function(t){this._isSingleSided=t},jt.prototype.interfaces_=function(){return[]},jt.prototype.getClass=function(){return jt},jt.bufferDistanceError=function(t){var n=Math.PI/2/t;return 1-Math.cos(n/2)},oo.CAP_ROUND.get=function(){return 1},oo.CAP_FLAT.get=function(){return 2},oo.CAP_SQUARE.get=function(){return 3},oo.JOIN_ROUND.get=function(){return 1},oo.JOIN_MITRE.get=function(){return 2},oo.JOIN_BEVEL.get=function(){return 3},oo.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},oo.DEFAULT_MITRE_LIMIT.get=function(){return 5},oo.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(jt,oo);var Nn=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=mt.COUNTERCLOCKWISE,this._inputLine=t||null},zs={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Nn.prototype.isDeletable=function(t,n,i,a){var f=this._inputLine[t],g=this._inputLine[n],v=this._inputLine[i];return!!this.isConcave(f,g,v)&&!!this.isShallow(f,g,v,a)&&this.isShallowSampled(f,g,t,i,a)},Nn.prototype.deleteShallowConcavities=function(){for(var t=1,n=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(n),a=!1;i<this._inputLine.length;){var f=!1;this.isDeletable(t,n,i,this._distanceTol)&&(this._isDeleted[n]=Nn.DELETE,f=!0,a=!0),t=f?i:n,n=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(n)}return a},Nn.prototype.isShallowConcavity=function(t,n,i,a){return mt.computeOrientation(t,n,i)!==this._angleOrientation?!1:mt.distancePointLine(n,t,i)<a},Nn.prototype.isShallowSampled=function(t,n,i,a,f){var g=Math.trunc((a-i)/Nn.NUM_PTS_TO_CHECK);g<=0&&(g=1);for(var v=i;v<a;v+=g)if(!this.isShallow(t,n,this._inputLine[v],f))return!1;return!0},Nn.prototype.isConcave=function(t,n,i){var a=mt.computeOrientation(t,n,i)===this._angleOrientation;return a},Nn.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=mt.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var n=!1;do n=this.deleteShallowConcavities();while(n);return this.collapseLine()},Nn.prototype.findNextNonDeletedIndex=function(t){for(var n=t+1;n<this._inputLine.length&&this._isDeleted[n]===Nn.DELETE;)n++;return n},Nn.prototype.isShallow=function(t,n,i,a){return mt.distancePointLine(n,t,i)<a},Nn.prototype.collapseLine=function(){for(var t=new ft,n=0;n<this._inputLine.length;n++)this._isDeleted[n]!==Nn.DELETE&&t.add(this._inputLine[n]);return t.toCoordinateArray()},Nn.prototype.interfaces_=function(){return[]},Nn.prototype.getClass=function(){return Nn},Nn.simplify=function(t,n){return new Nn(t).simplify(n)},zs.INIT.get=function(){return 0},zs.DELETE.get=function(){return 1},zs.KEEP.get=function(){return 1},zs.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Nn,zs);var hi=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new j},Ql={COORDINATE_ARRAY_TYPE:{configurable:!0}};hi.prototype.getCoordinates=function(){return this._ptList.toArray(hi.COORDINATE_ARRAY_TYPE)},hi.prototype.setPrecisionModel=function(t){this._precisionModel=t},hi.prototype.addPt=function(t){var n=new U(t);if(this._precisionModel.makePrecise(n),this.isRedundant(n))return null;this._ptList.add(n)},hi.prototype.revere=function(){},hi.prototype.addPts=function(t,n){if(n)for(var i=0;i<t.length;i++)this.addPt(t[i]);else for(var a=t.length-1;a>=0;a--)this.addPt(t[a])},hi.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},hi.prototype.toString=function(){return new Qt().createLineString(this.getCoordinates()).toString()},hi.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new U(this._ptList.get(0)),n=this._ptList.get(this._ptList.size()-1);if(t.equals(n))return null;this._ptList.add(t)},hi.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},hi.prototype.interfaces_=function(){return[]},hi.prototype.getClass=function(){return hi},Ql.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(hi,Ql);var ee=function(){},ms={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};ee.prototype.interfaces_=function(){return[]},ee.prototype.getClass=function(){return ee},ee.toDegrees=function(t){return 180*t/Math.PI},ee.normalize=function(t){for(;t>Math.PI;)t-=ee.PI_TIMES_2;for(;t<=-Math.PI;)t+=ee.PI_TIMES_2;return t},ee.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],a=i.x-n.x,f=i.y-n.y;return Math.atan2(f,a)}},ee.isAcute=function(t,n,i){var a=t.x-n.x,f=t.y-n.y;return a*(i.x-n.x)+f*(i.y-n.y)>0},ee.isObtuse=function(t,n,i){var a=t.x-n.x,f=t.y-n.y;return a*(i.x-n.x)+f*(i.y-n.y)<0},ee.interiorAngle=function(t,n,i){var a=ee.angle(n,t),f=ee.angle(n,i);return Math.abs(f-a)},ee.normalizePositive=function(t){if(t<0){for(;t<0;)t+=ee.PI_TIMES_2;t>=ee.PI_TIMES_2&&(t=0)}else{for(;t>=ee.PI_TIMES_2;)t-=ee.PI_TIMES_2;t<0&&(t=0)}return t},ee.angleBetween=function(t,n,i){var a=ee.angle(n,t),f=ee.angle(n,i);return ee.diff(a,f)},ee.diff=function(t,n){var i=null;return(i=t<n?n-t:t-n)>Math.PI&&(i=2*Math.PI-i),i},ee.toRadians=function(t){return t*Math.PI/180},ee.getTurn=function(t,n){var i=Math.sin(n-t);return i>0?ee.COUNTERCLOCKWISE:i<0?ee.CLOCKWISE:ee.NONE},ee.angleBetweenOriented=function(t,n,i){var a=ee.angle(n,t),f=ee.angle(n,i)-a;return f<=-Math.PI?f+ee.PI_TIMES_2:f>Math.PI?f-ee.PI_TIMES_2:f},ms.PI_TIMES_2.get=function(){return 2*Math.PI},ms.PI_OVER_2.get=function(){return Math.PI/2},ms.PI_OVER_4.get=function(){return Math.PI/4},ms.COUNTERCLOCKWISE.get=function(){return mt.COUNTERCLOCKWISE},ms.CLOCKWISE.get=function(){return mt.CLOCKWISE},ms.NONE.get=function(){return mt.COLLINEAR},Object.defineProperties(ee,ms);var ln=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 bt,this._seg1=new bt,this._offset0=new bt,this._offset1=new bt,this._side=0,this._hasNarrowConcaveAngle=!1;var n=arguments[0],i=arguments[1],a=arguments[2];this._precisionModel=n,this._bufParams=i,this._li=new Mi,this._filletAngleQuantum=Math.PI/2/i.getQuadrantSegments(),i.getQuadrantSegments()>=8&&i.getJoinStyle()===jt.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(a)},ko={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}};ln.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=mt.computeOrientation(this._s0,this._s1,this._s2),a=i===mt.CLOCKWISE&&this._side===dt.LEFT||i===mt.COUNTERCLOCKWISE&&this._side===dt.RIGHT;i===0?this.addCollinear(n):a?this.addOutsideTurn(i,n):this.addInsideTurn(i,n)},ln.prototype.addLineEndCap=function(t,n){var i=new bt(t,n),a=new bt;this.computeOffsetSegment(i,dt.LEFT,this._distance,a);var f=new bt;this.computeOffsetSegment(i,dt.RIGHT,this._distance,f);var g=n.x-t.x,v=n.y-t.y,S=Math.atan2(v,g);switch(this._bufParams.getEndCapStyle()){case jt.CAP_ROUND:this._segList.addPt(a.p1),this.addFilletArc(n,S+Math.PI/2,S-Math.PI/2,mt.CLOCKWISE,this._distance),this._segList.addPt(f.p1);break;case jt.CAP_FLAT:this._segList.addPt(a.p1),this._segList.addPt(f.p1);break;case jt.CAP_SQUARE:var P=new U;P.x=Math.abs(this._distance)*Math.cos(S),P.y=Math.abs(this._distance)*Math.sin(S);var V=new U(a.p1.x+P.x,a.p1.y+P.y),tt=new U(f.p1.x+P.x,f.p1.y+P.y);this._segList.addPt(V),this._segList.addPt(tt)}},ln.prototype.getCoordinates=function(){return this._segList.getCoordinates()},ln.prototype.addMitreJoin=function(t,n,i,a){var f=!0,g=null;try{g=an.intersection(n.p0,n.p1,i.p0,i.p1),(a<=0?1:g.distance(t)/Math.abs(a))>this._bufParams.getMitreLimit()&&(f=!1)}catch(v){if(!(v instanceof yn))throw v;g=new U(0,0),f=!1}f?this._segList.addPt(g):this.addLimitedMitreJoin(n,i,a,this._bufParams.getMitreLimit())},ln.prototype.addFilletCorner=function(t,n,i,a,f){var g=n.x-t.x,v=n.y-t.y,S=Math.atan2(v,g),P=i.x-t.x,V=i.y-t.y,tt=Math.atan2(V,P);a===mt.CLOCKWISE?S<=tt&&(S+=2*Math.PI):S>=tt&&(S-=2*Math.PI),this._segList.addPt(n),this.addFilletArc(t,S,tt,a,f),this._segList.addPt(i)},ln.prototype.addOutsideTurn=function(t,n){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*ln.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===jt.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===jt.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))},ln.prototype.createSquare=function(t){this._segList.addPt(new U(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new U(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new U(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new U(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},ln.prototype.addSegments=function(t,n){this._segList.addPts(t,n)},ln.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},ln.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},ln.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)},ln.prototype.addLimitedMitreJoin=function(t,n,i,a){var f=this._seg0.p1,g=ee.angle(f,this._seg0.p0),v=ee.angleBetweenOriented(this._seg0.p0,f,this._seg1.p1)/2,S=ee.normalize(g+v),P=ee.normalize(S+Math.PI),V=a*i,tt=i-V*Math.abs(Math.sin(v)),nt=f.x+V*Math.cos(P),vt=f.y+V*Math.sin(P),xt=new U(nt,vt),Tt=new bt(f,xt),Ut=Tt.pointAlongOffset(1,tt),We=Tt.pointAlongOffset(1,-tt);this._side===dt.LEFT?(this._segList.addPt(Ut),this._segList.addPt(We)):(this._segList.addPt(We),this._segList.addPt(Ut))},ln.prototype.computeOffsetSegment=function(t,n,i,a){var f=n===dt.LEFT?1:-1,g=t.p1.x-t.p0.x,v=t.p1.y-t.p0.y,S=Math.sqrt(g*g+v*v),P=f*i*g/S,V=f*i*v/S;a.p0.x=t.p0.x-V,a.p0.y=t.p0.y+P,a.p1.x=t.p1.x-V,a.p1.y=t.p1.y+P},ln.prototype.addFilletArc=function(t,n,i,a,f){var g=a===mt.CLOCKWISE?-1:1,v=Math.abs(n-i),S=Math.trunc(v/this._filletAngleQuantum+.5);if(S<1)return null;for(var P=v/S,V=0,tt=new U;V<v;){var nt=n+g*V;tt.x=t.x+f*Math.cos(nt),tt.y=t.y+f*Math.sin(nt),this._segList.addPt(tt),V+=P}},ln.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*ln.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 U((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 a=new U((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(a)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},ln.prototype.createCircle=function(t){var n=new U(t.x+this._distance,t.y);this._segList.addPt(n),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},ln.prototype.addBevelJoin=function(t,n){this._segList.addPt(t.p1),this._segList.addPt(n.p0)},ln.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new hi,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*ln.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},ln.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===jt.JOIN_BEVEL||this._bufParams.getJoinStyle()===jt.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,mt.CLOCKWISE,this._distance))},ln.prototype.closeRing=function(){this._segList.closeRing()},ln.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},ln.prototype.interfaces_=function(){return[]},ln.prototype.getClass=function(){return ln},ko.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},ko.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},ko.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},ko.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(ln,ko);var Br=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],n=arguments[1];this._precisionModel=t,this._bufParams=n};Br.prototype.getOffsetCurve=function(t,n){if(this._distance=n,n===0)return null;var i=n<0,a=Math.abs(n),f=this.getSegGen(a);t.length<=1?this.computePointCurve(t[0],f):this.computeOffsetCurve(t,i,f);var g=f.getCoordinates();return i&<.reverse(g),g},Br.prototype.computeSingleSidedBufferCurve=function(t,n,i){var a=this.simplifyTolerance(this._distance);if(n){i.addSegments(t,!0);var f=Nn.simplify(t,-a),g=f.length-1;i.initSideSegments(f[g],f[g-1],dt.LEFT),i.addFirstSegment();for(var v=g-2;v>=0;v--)i.addNextSegment(f[v],!0)}else{i.addSegments(t,!1);var S=Nn.simplify(t,a),P=S.length-1;i.initSideSegments(S[0],S[1],dt.LEFT),i.addFirstSegment();for(var V=2;V<=P;V++)i.addNextSegment(S[V],!0)}i.addLastSegment(),i.closeRing()},Br.prototype.computeRingBufferCurve=function(t,n,i){var a=this.simplifyTolerance(this._distance);n===dt.RIGHT&&(a=-a);var f=Nn.simplify(t,a),g=f.length-1;i.initSideSegments(f[g-1],f[0],n);for(var v=1;v<=g;v++){var S=v!==1;i.addNextSegment(f[v],S)}i.closeRing()},Br.prototype.computeLineBufferCurve=function(t,n){var i=this.simplifyTolerance(this._distance),a=Nn.simplify(t,i),f=a.length-1;n.initSideSegments(a[0],a[1],dt.LEFT);for(var g=2;g<=f;g++)n.addNextSegment(a[g],!0);n.addLastSegment(),n.addLineEndCap(a[f-1],a[f]);var v=Nn.simplify(t,-i),S=v.length-1;n.initSideSegments(v[S],v[S-1],dt.LEFT);for(var P=S-2;P>=0;P--)n.addNextSegment(v[P],!0);n.addLastSegment(),n.addLineEndCap(v[1],v[0]),n.closeRing()},Br.prototype.computePointCurve=function(t,n){switch(this._bufParams.getEndCapStyle()){case jt.CAP_ROUND:n.createCircle(t);break;case jt.CAP_SQUARE:n.createSquare(t)}},Br.prototype.getLineCurve=function(t,n){if(this._distance=n,n<0&&!this._bufParams.isSingleSided()||n===0)return null;var i=Math.abs(n),a=this.getSegGen(i);if(t.length<=1)this.computePointCurve(t[0],a);else if(this._bufParams.isSingleSided()){var f=n<0;this.computeSingleSidedBufferCurve(t,f,a)}else this.computeLineBufferCurve(t,a);return a.getCoordinates()},Br.prototype.getBufferParameters=function(){return this._bufParams},Br.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},Br.prototype.getRingCurve=function(t,n,i){if(this._distance=i,t.length<=2)return this.getLineCurve(t,i);if(i===0)return Br.copyCoordinates(t);var a=this.getSegGen(i);return this.computeRingBufferCurve(t,n,a),a.getCoordinates()},Br.prototype.computeOffsetCurve=function(t,n,i){var a=this.simplifyTolerance(this._distance);if(n){var f=Nn.simplify(t,-a),g=f.length-1;i.initSideSegments(f[g],f[g-1],dt.LEFT),i.addFirstSegment();for(var v=g-2;v>=0;v--)i.addNextSegment(f[v],!0)}else{var S=Nn.simplify(t,a),P=S.length-1;i.initSideSegments(S[0],S[1],dt.LEFT),i.addFirstSegment();for(var V=2;V<=P;V++)i.addNextSegment(S[V],!0)}i.addLastSegment()},Br.prototype.getSegGen=function(t){return new ln(this._precisionModel,this._bufParams,t)},Br.prototype.interfaces_=function(){return[]},Br.prototype.getClass=function(){return Br},Br.copyCoordinates=function(t){for(var n=new Array(t.length).fill(null),i=0;i<n.length;i++)n[i]=new U(t[i]);return n};var ys=function(){this._subgraphs=null,this._seg=new bt,this._cga=new mt;var t=arguments[0];this._subgraphs=t},ol={DepthSegment:{configurable:!0}};ys.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var t=arguments[0],n=new j,i=this._subgraphs.iterator();i.hasNext();){var a=i.next(),f=a.getEnvelope();t.y<f.getMinY()||t.y>f.getMaxY()||this.findStabbedSegments(t,a.getDirectedEdges(),n)}return n}if(arguments.length===3){if(yt(arguments[2],at)&&arguments[0]instanceof U&&arguments[1]instanceof nl){for(var g=arguments[0],v=arguments[1],S=arguments[2],P=v.getEdge().getCoordinates(),V=0;V<P.length-1;V++)if(this._seg.p0=P[V],this._seg.p1=P[V+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<g.x)&&!(this._seg.isHorizontal()||g.y<this._seg.p0.y||g.y>this._seg.p1.y||mt.computeOrientation(this._seg.p0,this._seg.p1,g)===mt.RIGHT)){var tt=v.getDepth(dt.LEFT);this._seg.p0.equals(P[V])||(tt=v.getDepth(dt.RIGHT));var nt=new Go(this._seg,tt);S.add(nt)}}else if(yt(arguments[2],at)&&arguments[0]instanceof U&&yt(arguments[1],at))for(var vt=arguments[0],xt=arguments[1],Tt=arguments[2],Ut=xt.iterator();Ut.hasNext();){var We=Ut.next();We.isForward()&&this.findStabbedSegments(vt,We,Tt)}}},ys.prototype.getDepth=function(t){var n=this.findStabbedSegments(t);return n.size()===0?0:Ui.min(n)._leftDepth},ys.prototype.interfaces_=function(){return[]},ys.prototype.getClass=function(){return ys},ol.DepthSegment.get=function(){return Go},Object.defineProperties(ys,ol);var Go=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],n=arguments[1];this._upwardSeg=new bt(t),this._leftDepth=n};Go.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)},Go.prototype.compareX=function(t,n){var i=t.p0.compareTo(n.p0);return i!==0?i:t.p1.compareTo(n.p1)},Go.prototype.toString=function(){return this._upwardSeg.toString()},Go.prototype.interfaces_=function(){return[Z]},Go.prototype.getClass=function(){return Go};var se=function(t,n,i){this.p0=t||null,this.p1=n||null,this.p2=i||null};se.prototype.area=function(){return se.area(this.p0,this.p1,this.p2)},se.prototype.signedArea=function(){return se.signedArea(this.p0,this.p1,this.p2)},se.prototype.interpolateZ=function(t){if(t===null)throw new k("Supplied point is null.");return se.interpolateZ(t,this.p0,this.p1,this.p2)},se.prototype.longestSideLength=function(){return se.longestSideLength(this.p0,this.p1,this.p2)},se.prototype.isAcute=function(){return se.isAcute(this.p0,this.p1,this.p2)},se.prototype.circumcentre=function(){return se.circumcentre(this.p0,this.p1,this.p2)},se.prototype.area3D=function(){return se.area3D(this.p0,this.p1,this.p2)},se.prototype.centroid=function(){return se.centroid(this.p0,this.p1,this.p2)},se.prototype.inCentre=function(){return se.inCentre(this.p0,this.p1,this.p2)},se.prototype.interfaces_=function(){return[]},se.prototype.getClass=function(){return se},se.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)},se.signedArea=function(t,n,i){return((i.x-t.x)*(n.y-t.y)-(n.x-t.x)*(i.y-t.y))/2},se.det=function(t,n,i,a){return t*a-n*i},se.interpolateZ=function(t,n,i,a){var f=n.x,g=n.y,v=i.x-f,S=a.x-f,P=i.y-g,V=a.y-g,tt=v*V-S*P,nt=t.x-f,vt=t.y-g,xt=(V*nt-S*vt)/tt,Tt=(-P*nt+v*vt)/tt;return n.z+xt*(i.z-n.z)+Tt*(a.z-n.z)},se.longestSideLength=function(t,n,i){var a=t.distance(n),f=n.distance(i),g=i.distance(t),v=a;return f>v&&(v=f),g>v&&(v=g),v},se.isAcute=function(t,n,i){return!!ee.isAcute(t,n,i)&&!!ee.isAcute(n,i,t)&&!!ee.isAcute(i,t,n)},se.circumcentre=function(t,n,i){var a=i.x,f=i.y,g=t.x-a,v=t.y-f,S=n.x-a,P=n.y-f,V=2*se.det(g,v,S,P),tt=se.det(v,g*g+v*v,P,S*S+P*P),nt=se.det(g,g*g+v*v,S,S*S+P*P);return new U(a-tt/V,f+nt/V)},se.perpendicularBisector=function(t,n){var i=n.x-t.x,a=n.y-t.y,f=new an(t.x+i/2,t.y+a/2,1),g=new an(t.x-a+i/2,t.y+i+a/2,1);return new an(f,g)},se.angleBisector=function(t,n,i){var a=n.distance(t),f=a/(a+n.distance(i)),g=i.x-t.x,v=i.y-t.y;return new U(t.x+f*g,t.y+f*v)},se.area3D=function(t,n,i){var a=n.x-t.x,f=n.y-t.y,g=n.z-t.z,v=i.x-t.x,S=i.y-t.y,P=i.z-t.z,V=f*P-g*S,tt=g*v-a*P,nt=a*S-f*v,vt=V*V+tt*tt+nt*nt,xt=Math.sqrt(vt)/2;return xt},se.centroid=function(t,n,i){var a=(t.x+n.x+i.x)/3,f=(t.y+n.y+i.y)/3;return new U(a,f)},se.inCentre=function(t,n,i){var a=n.distance(i),f=t.distance(i),g=t.distance(n),v=a+f+g,S=(a*t.x+f*n.x+g*i.x)/v,P=(a*t.y+f*n.y+g*i.y)/v;return new U(S,P)};var pi=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new j;var t=arguments[0],n=arguments[1],i=arguments[2];this._inputGeom=t,this._distance=n,this._curveBuilder=i};pi.prototype.addPoint=function(t){if(this._distance<=0)return null;var n=t.getCoordinates(),i=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(i,W.EXTERIOR,W.INTERIOR)},pi.prototype.addPolygon=function(t){var n=this._distance,i=dt.LEFT;this._distance<0&&(n=-this._distance,i=dt.RIGHT);var a=t.getExteriorRing(),f=lt.removeRepeatedPoints(a.getCoordinates());if(this._distance<0&&this.isErodedCompletely(a,this._distance)||this._distance<=0&&f.length<3)return null;this.addPolygonRing(f,n,i,W.EXTERIOR,W.INTERIOR);for(var g=0;g<t.getNumInteriorRing();g++){var v=t.getInteriorRingN(g),S=lt.removeRepeatedPoints(v.getCoordinates());this._distance>0&&this.isErodedCompletely(v,-this._distance)||this.addPolygonRing(S,n,dt.opposite(i),W.INTERIOR,W.EXTERIOR)}},pi.prototype.isTriangleErodedCompletely=function(t,n){var i=new se(t[0],t[1],t[2]),a=i.inCentre();return mt.distancePointLine(a,i.p0,i.p1)<Math.abs(n)},pi.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var n=lt.removeRepeatedPoints(t.getCoordinates()),i=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(i,W.EXTERIOR,W.INTERIOR)},pi.prototype.addCurve=function(t,n,i){if(t===null||t.length<2)return null;var a=new Ln(t,new Ve(0,W.BOUNDARY,n,i));this._curveList.add(a)},pi.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},pi.prototype.addPolygonRing=function(t,n,i,a,f){if(n===0&&t.length<Ki.MINIMUM_VALID_SIZE)return null;var g=a,v=f;t.length>=Ki.MINIMUM_VALID_SIZE&&mt.isCCW(t)&&(g=f,v=a,i=dt.opposite(i));var S=this._curveBuilder.getRingCurve(t,i,n);this.addCurve(S,g,v)},pi.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Jn?this.addPolygon(t):t instanceof xn?this.addLineString(t):t instanceof Er?this.addPoint(t):t instanceof na?this.addCollection(t):t instanceof bi?this.addCollection(t):t instanceof Qi?this.addCollection(t):t instanceof _n&&this.addCollection(t)},pi.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 a=t.getEnvelopeInternal(),f=Math.min(a.getHeight(),a.getWidth());return n<0&&2*Math.abs(n)>f},pi.prototype.addCollection=function(t){for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);this.add(i)}},pi.prototype.interfaces_=function(){return[]},pi.prototype.getClass=function(){return pi};var sa=function(){};sa.prototype.locate=function(t){},sa.prototype.interfaces_=function(){return[]},sa.prototype.getClass=function(){return sa};var zi=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()};zi.prototype.next=function(){if(this._atStart)return this._atStart=!1,zi.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 u;var t=this._parent.getGeometryN(this._index++);return t instanceof _n?(this._subcollectionIterator=new zi(t),this._subcollectionIterator.next()):t},zi.prototype.remove=function(){throw new Error(this.getClass().getName())},zi.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)},zi.prototype.interfaces_=function(){return[ct]},zi.prototype.getClass=function(){return zi},zi.isAtomic=function(t){return!(t instanceof _n)};var zr=function(){this._geom=null;var t=arguments[0];this._geom=t};zr.prototype.locate=function(t){return zr.locate(t,this._geom)},zr.prototype.interfaces_=function(){return[sa]},zr.prototype.getClass=function(){return zr},zr.isPointInRing=function(t,n){return!!n.getEnvelopeInternal().intersects(t)&&mt.isPointInRing(t,n.getCoordinates())},zr.containsPointInPolygon=function(t,n){if(n.isEmpty())return!1;var i=n.getExteriorRing();if(!zr.isPointInRing(t,i))return!1;for(var a=0;a<n.getNumInteriorRing();a++){var f=n.getInteriorRingN(a);if(zr.isPointInRing(t,f))return!1}return!0},zr.containsPoint=function(t,n){if(n instanceof Jn)return zr.containsPointInPolygon(t,n);if(n instanceof _n)for(var i=new zi(n);i.hasNext();){var a=i.next();if(a!==n&&zr.containsPoint(t,a))return!0}return!1},zr.locate=function(t,n){return n.isEmpty()?W.EXTERIOR:zr.containsPoint(t,n)?W.INTERIOR:W.EXTERIOR};var br=function(){this._edgeMap=new b,this._edgeList=null,this._ptInAreaLocation=[W.NONE,W.NONE]};br.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)},br.prototype.propagateSideLabels=function(t){for(var n=W.NONE,i=this.iterator();i.hasNext();){var a=i.next().getLabel();a.isArea(t)&&a.getLocation(t,dt.LEFT)!==W.NONE&&(n=a.getLocation(t,dt.LEFT))}if(n===W.NONE)return null;for(var f=n,g=this.iterator();g.hasNext();){var v=g.next(),S=v.getLabel();if(S.getLocation(t,dt.ON)===W.NONE&&S.setLocation(t,dt.ON,f),S.isArea(t)){var P=S.getLocation(t,dt.LEFT),V=S.getLocation(t,dt.RIGHT);if(V!==W.NONE){if(V!==f)throw new Mo("side location conflict",v.getCoordinate());P===W.NONE&&Nt.shouldNeverReachHere("found single null side (at "+v.getCoordinate()+")"),f=P}else Nt.isTrue(S.getLocation(t,dt.LEFT)===W.NONE,"found single null side"),S.setLocation(t,dt.RIGHT,f),S.setLocation(t,dt.LEFT,f)}}},br.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},br.prototype.print=function(t){Ge.out.println("EdgeEndStar: "+this.getCoordinate());for(var n=this.iterator();n.hasNext();)n.next().print(t)},br.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},br.prototype.checkAreaLabelsConsistent=function(t){var n=this.getEdges();if(n.size()<=0)return!0;var i=n.size()-1,a=n.get(i).getLabel().getLocation(t,dt.LEFT);Nt.isTrue(a!==W.NONE,"Found unlabelled area edge");for(var f=a,g=this.iterator();g.hasNext();){var v=g.next().getLabel();Nt.isTrue(v.isArea(t),"Found non-area edge");var S=v.getLocation(t,dt.LEFT),P=v.getLocation(t,dt.RIGHT);if(S===P||P!==f)return!1;f=S}return!0},br.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},br.prototype.iterator=function(){return this.getEdges().iterator()},br.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new j(this._edgeMap.values())),this._edgeList},br.prototype.getLocation=function(t,n,i){return this._ptInAreaLocation[t]===W.NONE&&(this._ptInAreaLocation[t]=zr.locate(n,i[t].getGeometry())),this._ptInAreaLocation[t]},br.prototype.toString=function(){var t=new ie;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()},br.prototype.computeEdgeEndLabels=function(t){for(var n=this.iterator();n.hasNext();)n.next().computeLabel(t)},br.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 a=i.next().getLabel(),f=0;f<2;f++)a.isLine(f)&&a.getLocation(f)===W.BOUNDARY&&(n[f]=!0);for(var g=this.iterator();g.hasNext();)for(var v=g.next(),S=v.getLabel(),P=0;P<2;P++)if(S.isAnyNull(P)){var V=W.NONE;if(n[P])V=W.EXTERIOR;else{var tt=v.getCoordinate();V=this.getLocation(P,tt,t)}S.setAllLocationsIfNull(P,V)}},br.prototype.getDegree=function(){return this._edgeMap.size()},br.prototype.insertEdgeEnd=function(t,n){this._edgeMap.put(t,n),this._edgeList=null},br.prototype.interfaces_=function(){return[]},br.prototype.getClass=function(){return br};var jl=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,a=null,f=this._SCANNING_FOR_INCOMING,g=0;g<this._resultAreaEdgeList.size();g++){var v=this._resultAreaEdgeList.get(g),S=v.getSym();if(v.getLabel().isArea())switch(i===null&&v.isInResult()&&(i=v),f){case this._SCANNING_FOR_INCOMING:if(!S.isInResult())continue;a=S,f=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!v.isInResult())continue;a.setNext(v),f=this._SCANNING_FOR_INCOMING}}if(f===this._LINKING_TO_OUTGOING){if(i===null)throw new Mo("no outgoing dirEdge found",this.getCoordinate());Nt.isTrue(i.isInResult(),"unable to link last incoming dirEdge"),a.setNext(i)}},n.prototype.insert=function(i){var a=i;this.insertEdgeEnd(a,a)},n.prototype.getRightmostEdge=function(){var i=this.getEdges(),a=i.size();if(a<1)return null;var f=i.get(0);if(a===1)return f;var g=i.get(a-1),v=f.getQuadrant(),S=g.getQuadrant();return on.isNorthern(v)&&on.isNorthern(S)?f:on.isNorthern(v)||on.isNorthern(S)?f.getDy()!==0?f:g.getDy()!==0?g:(Nt.shouldNeverReachHere("found two horizontal edges incident on node"),null):g},n.prototype.print=function(i){Ge.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var a=this.iterator();a.hasNext();){var f=a.next();i.print("out "),f.print(i),i.println(),i.print("in "),f.getSym().print(i),i.println()}},n.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new j;for(var i=this.iterator();i.hasNext();){var a=i.next();(a.isInResult()||a.getSym().isInResult())&&this._resultAreaEdgeList.add(a)}return this._resultAreaEdgeList},n.prototype.updateLabelling=function(i){for(var a=this.iterator();a.hasNext();){var f=a.next().getLabel();f.setAllLocationsIfNull(0,i.getLocation(0)),f.setAllLocationsIfNull(1,i.getLocation(1))}},n.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var i=null,a=null,f=this._edgeList.size()-1;f>=0;f--){var g=this._edgeList.get(f),v=g.getSym();a===null&&(a=v),i!==null&&v.setNext(i),i=g}a.setNext(i)},n.prototype.computeDepths=function(){if(arguments.length===1){var i=arguments[0],a=this.findIndex(i),f=i.getDepth(dt.LEFT),g=i.getDepth(dt.RIGHT),v=this.computeDepths(a+1,this._edgeList.size(),f);if(this.computeDepths(0,a,v)!==g)throw new Mo("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var S=arguments[0],P=arguments[1],V=arguments[2],tt=S;tt<P;tt++){var nt=this._edgeList.get(tt);nt.setEdgeDepths(dt.RIGHT,V),V=nt.getDepth(dt.LEFT)}return V}},n.prototype.mergeSymLabels=function(){for(var i=this.iterator();i.hasNext();){var a=i.next();a.getLabel().merge(a.getSym().getLabel())}},n.prototype.linkMinimalDirectedEdges=function(i){for(var a=null,f=null,g=this._SCANNING_FOR_INCOMING,v=this._resultAreaEdgeList.size()-1;v>=0;v--){var S=this._resultAreaEdgeList.get(v),P=S.getSym();switch(a===null&&S.getEdgeRing()===i&&(a=S),g){case this._SCANNING_FOR_INCOMING:if(P.getEdgeRing()!==i)continue;f=P,g=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(S.getEdgeRing()!==i)continue;f.setNextMin(S),g=this._SCANNING_FOR_INCOMING}}g===this._LINKING_TO_OUTGOING&&(Nt.isTrue(a!==null,"found null for first outgoing dirEdge"),Nt.isTrue(a.getEdgeRing()===i,"unable to link last incoming dirEdge"),f.setNextMin(a))},n.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var i=0,a=this.iterator();a.hasNext();)a.next().isInResult()&&i++;return i}if(arguments.length===1){for(var f=arguments[0],g=0,v=this.iterator();v.hasNext();)v.next().getEdgeRing()===f&&g++;return g}},n.prototype.getLabel=function(){return this._label},n.prototype.findCoveredLineEdges=function(){for(var i=W.NONE,a=this.iterator();a.hasNext();){var f=a.next(),g=f.getSym();if(!f.isLineEdge()){if(f.isInResult()){i=W.INTERIOR;break}if(g.isInResult()){i=W.EXTERIOR;break}}}if(i===W.NONE)return null;for(var v=i,S=this.iterator();S.hasNext();){var P=S.next(),V=P.getSym();P.isLineEdge()?P.getEdge().setCovered(v===W.INTERIOR):(P.isInResult()&&(v=W.EXTERIOR),V.isInResult()&&(v=W.INTERIOR))}},n.prototype.computeLabelling=function(i){t.prototype.computeLabelling.call(this,i),this._label=new Ve(W.NONE);for(var a=this.iterator();a.hasNext();)for(var f=a.next().getEdge().getLabel(),g=0;g<2;g++){var v=f.getLocation(g);v!==W.INTERIOR&&v!==W.BOUNDARY||this._label.setLocation(g,W.INTERIOR)}},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(br),Ai=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 lu(i,new jl)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(ia),So=function t(){this._pts=null,this._orientation=null;var n=arguments[0];this._pts=n,this._orientation=t.orientation(n)};So.prototype.compareTo=function(t){var n=t;return So.compareOriented(this._pts,this._orientation,n._pts,n._orientation)},So.prototype.interfaces_=function(){return[Z]},So.prototype.getClass=function(){return So},So.orientation=function(t){return lt.increasingDirection(t)===1},So.compareOriented=function(t,n,i,a){for(var f=n?1:-1,g=a?1:-1,v=n?t.length:-1,S=a?i.length:-1,P=n?0:t.length-1,V=a?0:i.length-1;;){var tt=t[P].compareTo(i[V]);if(tt!==0)return tt;var nt=(P+=f)===v,vt=(V+=g)===S;if(nt&&!vt)return-1;if(!nt&&vt)return 1;if(nt&&vt)return 0}};var kr=function(){this._edges=new j,this._ocaMap=new b};kr.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 a=i.getCoordinates(),f=0;f<a.length;f++)f>0&&t.print(","),t.print(a[f].x+" "+a[f].y);t.println(")")}t.print(") ")},kr.prototype.addAll=function(t){for(var n=t.iterator();n.hasNext();)this.add(n.next())},kr.prototype.findEdgeIndex=function(t){for(var n=0;n<this._edges.size();n++)if(this._edges.get(n).equals(t))return n;return-1},kr.prototype.iterator=function(){return this._edges.iterator()},kr.prototype.getEdges=function(){return this._edges},kr.prototype.get=function(t){return this._edges.get(t)},kr.prototype.findEqualEdge=function(t){var n=new So(t.getCoordinates());return this._ocaMap.get(n)},kr.prototype.add=function(t){this._edges.add(t);var n=new So(t.getCoordinates());this._ocaMap.put(n,t)},kr.prototype.interfaces_=function(){return[]},kr.prototype.getClass=function(){return kr};var ts=function(){};ts.prototype.processIntersections=function(t,n,i,a){},ts.prototype.isDone=function(){},ts.prototype.interfaces_=function(){return[]},ts.prototype.getClass=function(){return ts};var Kr=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};Kr.prototype.isTrivialIntersection=function(t,n,i,a){if(t===i&&this._li.getIntersectionNum()===1){if(Kr.isAdjacentSegments(n,a))return!0;if(t.isClosed()){var f=t.size()-1;if(n===0&&a===f||a===0&&n===f)return!0}}return!1},Kr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Kr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Kr.prototype.getLineIntersector=function(){return this._li},Kr.prototype.hasProperIntersection=function(){return this._hasProper},Kr.prototype.processIntersections=function(t,n,i,a){if(t===i&&n===a)return null;this.numTests++;var f=t.getCoordinates()[n],g=t.getCoordinates()[n+1],v=i.getCoordinates()[a],S=i.getCoordinates()[a+1];this._li.computeIntersection(f,g,v,S),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,n,i,a)||(this._hasIntersection=!0,t.addIntersections(this._li,n,0),i.addIntersections(this._li,a,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Kr.prototype.hasIntersection=function(){return this._hasIntersection},Kr.prototype.isDone=function(){return!1},Kr.prototype.hasInteriorIntersection=function(){return this._hasInterior},Kr.prototype.interfaces_=function(){return[ts]},Kr.prototype.getClass=function(){return Kr},Kr.isAdjacentSegments=function(t,n){return Math.abs(t-n)===1};var so=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],n=arguments[1],i=arguments[2];this.coord=new U(t),this.segmentIndex=n,this.dist=i};so.prototype.getSegmentIndex=function(){return this.segmentIndex},so.prototype.getCoordinate=function(){return this.coord},so.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},so.prototype.compareTo=function(t){var n=t;return this.compare(n.segmentIndex,n.dist)},so.prototype.isEndPoint=function(t){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===t},so.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},so.prototype.getDistance=function(){return this.dist},so.prototype.compare=function(t,n){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<n?-1:this.dist>n?1:0},so.prototype.interfaces_=function(){return[Z]},so.prototype.getClass=function(){return so};var bo=function(){this._nodeMap=new b,this.edge=null;var t=arguments[0];this.edge=t};bo.prototype.print=function(t){t.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(t)},bo.prototype.iterator=function(){return this._nodeMap.values().iterator()},bo.prototype.addSplitEdges=function(t){this.addEndpoints();for(var n=this.iterator(),i=n.next();n.hasNext();){var a=n.next(),f=this.createSplitEdge(i,a);t.add(f),i=a}},bo.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)},bo.prototype.createSplitEdge=function(t,n){var i=n.segmentIndex-t.segmentIndex+2,a=this.edge.pts[n.segmentIndex],f=n.dist>0||!n.coord.equals2D(a);f||i--;var g=new Array(i).fill(null),v=0;g[v++]=new U(t.coord);for(var S=t.segmentIndex+1;S<=n.segmentIndex;S++)g[v++]=this.edge.pts[S];return f&&(g[v]=n.coord),new fu(g,new Ve(this.edge._label))},bo.prototype.add=function(t,n,i){var a=new so(t,n,i),f=this._nodeMap.get(a);return f!==null?f:(this._nodeMap.put(a,a),a)},bo.prototype.isIntersection=function(t){for(var n=this.iterator();n.hasNext();)if(n.next().coord.equals(t))return!0;return!1},bo.prototype.interfaces_=function(){return[]},bo.prototype.getClass=function(){return bo};var vs=function(){};vs.prototype.getChainStartIndices=function(t){var n=0,i=new j;i.add(new _t(n));do{var a=this.findChainEnd(t,n);i.add(new _t(a)),n=a}while(n<t.length-1);return vs.toIntArray(i)},vs.prototype.findChainEnd=function(t,n){for(var i=on.quadrant(t[n],t[n+1]),a=n+1;a<t.length&&on.quadrant(t[a-1],t[a])===i;)a++;return a-1},vs.prototype.interfaces_=function(){return[]},vs.prototype.getClass=function(){return vs},vs.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 Ho=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new Et,this.env2=new Et;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var n=new vs;this.startIndex=n.getChainStartIndices(this.pts)};Ho.prototype.getCoordinates=function(){return this.pts},Ho.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},Ho.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},Ho.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var t=arguments[0],n=arguments[1],i=arguments[2],a=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],n,n.startIndex[i],n.startIndex[i+1],a)}else if(arguments.length===6){var f=arguments[0],g=arguments[1],v=arguments[2],S=arguments[3],P=arguments[4],V=arguments[5],tt=this.pts[f],nt=this.pts[g],vt=v.pts[S],xt=v.pts[P];if(g-f==1&&P-S==1)return V.addIntersections(this.e,f,v.e,S),null;if(this.env1.init(tt,nt),this.env2.init(vt,xt),!this.env1.intersects(this.env2))return null;var Tt=Math.trunc((f+g)/2),Ut=Math.trunc((S+P)/2);f<Tt&&(S<Ut&&this.computeIntersectsForChain(f,Tt,v,S,Ut,V),Ut<P&&this.computeIntersectsForChain(f,Tt,v,Ut,P,V)),Tt<g&&(S<Ut&&this.computeIntersectsForChain(Tt,g,v,S,Ut,V),Ut<P&&this.computeIntersectsForChain(Tt,g,v,Ut,P,V))}},Ho.prototype.getStartIndexes=function(){return this.startIndex},Ho.prototype.computeIntersects=function(t,n){for(var i=0;i<this.startIndex.length-1;i++)for(var a=0;a<t.startIndex.length-1;a++)this.computeIntersectsForChain(i,t,a,n)},Ho.prototype.interfaces_=function(){return[]},Ho.prototype.getClass=function(){return Ho};var dr=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},ks={NULL_VALUE:{configurable:!0}};dr.prototype.getDepth=function(t,n){return this._depth[t][n]},dr.prototype.setDepth=function(t,n,i){this._depth[t][n]=i},dr.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]!==dr.NULL_VALUE)return!1;return!0}if(arguments.length===1){var i=arguments[0];return this._depth[i][1]===dr.NULL_VALUE}if(arguments.length===2){var a=arguments[0],f=arguments[1];return this._depth[a][f]===dr.NULL_VALUE}},dr.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 a=0;this._depth[t][i]>n&&(a=1),this._depth[t][i]=a}}},dr.prototype.getDelta=function(t){return this._depth[t][dt.RIGHT]-this._depth[t][dt.LEFT]},dr.prototype.getLocation=function(t,n){return this._depth[t][n]<=0?W.EXTERIOR:W.INTERIOR},dr.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},dr.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 a=t.getLocation(n,i);a!==W.EXTERIOR&&a!==W.INTERIOR||(this.isNull(n,i)?this._depth[n][i]=dr.depthAtLocation(a):this._depth[n][i]+=dr.depthAtLocation(a))}else if(arguments.length===3){var f=arguments[0],g=arguments[1];arguments[2]===W.INTERIOR&&this._depth[f][g]++}},dr.prototype.interfaces_=function(){return[]},dr.prototype.getClass=function(){return dr},dr.depthAtLocation=function(t){return t===W.EXTERIOR?0:t===W.INTERIOR?1:dr.NULL_VALUE},ks.NULL_VALUE.get=function(){return-1},Object.defineProperties(dr,ks);var fu=function(t){function n(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new bo(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new dr,this._depthDelta=0,arguments.length===1){var i=arguments[0];n.call(this,i,null)}else if(arguments.length===2){var a=arguments[0],f=arguments[1];this.pts=a,this._label=f}}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,Ve.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 a=i;if(this.pts.length!==a.pts.length)return!1;for(var f=!0,g=!0,v=this.pts.length,S=0;S<this.pts.length;S++)if(this.pts[S].equals2D(a.pts[S])||(f=!1),this.pts[S].equals2D(a.pts[--v])||(g=!1),!f&&!g)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 a=0;a<this.pts.length;a++)a>0&&i.print(","),i.print(this.pts[a].x+" "+this.pts[a].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 a=this.pts.length-1;a>=0;a--)i.print(this.pts[a]+" ");i.println("")},n.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Ho(this)),this._mce},n.prototype.getEnvelope=function(){if(this._env===null){this._env=new Et;for(var i=0;i<this.pts.length;i++)this._env.expandToInclude(this.pts[i])}return this._env},n.prototype.addIntersection=function(i,a,f,g){var v=new U(i.getIntersection(g)),S=a,P=i.getEdgeDistance(f,g),V=S+1;if(V<this.pts.length){var tt=this.pts[V];v.equals2D(tt)&&(S=V,P=0)}this.eiList.add(v,S,P)},n.prototype.toString=function(){var i=new ie;i.append("edge "+this._name+": "),i.append("LINESTRING (");for(var a=0;a<this.pts.length;a++)a>0&&i.append(","),i.append(this.pts[a].x+" "+this.pts[a].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 a=0;a<this.pts.length;a++)if(!this.pts[a].equals2D(i.pts[a]))return!1;return!0},n.prototype.setDepthDelta=function(i){this._depthDelta=i},n.prototype.getEdgeIntersectionList=function(){return this.eiList},n.prototype.addIntersections=function(i,a,f){for(var g=0;g<i.getIntersectionNum();g++)this.addIntersection(i,a,f,g)},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],a=arguments[1];a.setAtLeastIfValid(i.getLocation(0,dt.ON),i.getLocation(1,dt.ON),1),i.isArea()&&(a.setAtLeastIfValid(i.getLocation(0,dt.LEFT),i.getLocation(1,dt.LEFT),2),a.setAtLeastIfValid(i.getLocation(0,dt.RIGHT),i.getLocation(1,dt.RIGHT),2))},n}(ci),Lr=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new kr,this._bufParams=t||null};Lr.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},Lr.prototype.insertUniqueEdge=function(t){var n=this._edgeList.findEqualEdge(t);if(n!==null){var i=n.getLabel(),a=t.getLabel();n.isPointwiseEqual(t)||(a=new Ve(t.getLabel())).flip(),i.merge(a);var f=Lr.depthDelta(a),g=n.getDepthDelta()+f;n.setDepthDelta(g)}else this._edgeList.add(t),t.setDepthDelta(Lr.depthDelta(t.getLabel()))},Lr.prototype.buildSubgraphs=function(t,n){for(var i=new j,a=t.iterator();a.hasNext();){var f=a.next(),g=f.getRightmostCoordinate(),v=new ys(i).getDepth(g);f.computeDepth(v),f.findResultEdges(),i.add(f),n.add(f.getDirectedEdges(),f.getNodes())}},Lr.prototype.createSubgraphs=function(t){for(var n=new j,i=t.getNodes().iterator();i.hasNext();){var a=i.next();if(!a.isVisited()){var f=new wr;f.create(a),n.add(f)}}return Ui.sort(n,Ui.reverseOrder()),n},Lr.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Lr.prototype.getNoder=function(t){if(this._workingNoder!==null)return this._workingNoder;var n=new ka,i=new Mi;return i.setPrecisionModel(t),n.setSegmentIntersector(new Kr(i)),n},Lr.prototype.buffer=function(t,n){var i=this._workingPrecisionModel;i===null&&(i=t.getPrecisionModel()),this._geomFact=t.getFactory();var a=new Br(i,this._bufParams),f=new pi(t,n,a).getCurves();if(f.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(f,i),this._graph=new In(new Ai),this._graph.addEdges(this._edgeList.getEdges());var g=this.createSubgraphs(this._graph),v=new $r(this._geomFact);this.buildSubgraphs(g,v);var S=v.getPolygons();return S.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(S)},Lr.prototype.computeNodedEdges=function(t,n){var i=this.getNoder(n);i.computeNodes(t);for(var a=i.getNodedSubstrings().iterator();a.hasNext();){var f=a.next(),g=f.getCoordinates();if(g.length!==2||!g[0].equals2D(g[1])){var v=f.getData(),S=new fu(f.getCoordinates(),new Ve(v));this.insertUniqueEdge(S)}}},Lr.prototype.setNoder=function(t){this._workingNoder=t},Lr.prototype.interfaces_=function(){return[]},Lr.prototype.getClass=function(){return Lr},Lr.depthDelta=function(t){var n=t.getLocation(0,dt.LEFT),i=t.getLocation(0,dt.RIGHT);return n===W.INTERIOR&&i===W.EXTERIOR?1:n===W.EXTERIOR&&i===W.INTERIOR?-1:0},Lr.convertSegStrings=function(t){for(var n=new Qt,i=new j;t.hasNext();){var a=t.next(),f=n.createLineString(a.getCoordinates());i.add(f)}return n.buildGeometry(i)};var Ao=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],a=arguments[1],f=arguments[2],g=arguments[3];this._noder=i,this._scaleFactor=a,this._offsetX=f,this._offsetY=g,this._isScaled=!this.isIntegerPrecision()}};Ao.prototype.rescale=function(){if(yt(arguments[0],K))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],a=0;a<i.length;a++)i[a].x=i[a].x/this._scaleFactor+this._offsetX,i[a].y=i[a].y/this._scaleFactor+this._offsetY;i.length===2&&i[0].equals2D(i[1])&&Ge.out.println(i)}},Ao.prototype.scale=function(){if(yt(arguments[0],K)){for(var t=arguments[0],n=new j,i=t.iterator();i.hasNext();){var a=i.next();n.add(new Ln(this.scale(a.getCoordinates()),a.getData()))}return n}if(arguments[0]instanceof Array){for(var f=arguments[0],g=new Array(f.length).fill(null),v=0;v<f.length;v++)g[v]=new U(Math.round((f[v].x-this._offsetX)*this._scaleFactor),Math.round((f[v].y-this._offsetY)*this._scaleFactor),f[v].z);return lt.removeRepeatedPoints(g)}},Ao.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},Ao.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},Ao.prototype.computeNodes=function(t){var n=t;this._isScaled&&(n=this.scale(t)),this._noder.computeNodes(n)},Ao.prototype.interfaces_=function(){return[fi]},Ao.prototype.getClass=function(){return Ao};var ki=function(){this._li=new Mi,this._segStrings=null;var t=arguments[0];this._segStrings=t},es={fact:{configurable:!0}};ki.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],a=arguments[1].iterator();a.hasNext();)for(var f=a.next().getCoordinates(),g=1;g<f.length-1;g++)if(f[g].equals(i))throw new xr("found endpt/interior pt intersection at index "+g+" :pt "+i)}},ki.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 a=i.next();this.checkInteriorIntersections(n,a)}else if(arguments.length===2)for(var f=arguments[0],g=arguments[1],v=f.getCoordinates(),S=g.getCoordinates(),P=0;P<v.length-1;P++)for(var V=0;V<S.length-1;V++)this.checkInteriorIntersections(f,P,g,V);else if(arguments.length===4){var tt=arguments[0],nt=arguments[1],vt=arguments[2],xt=arguments[3];if(tt===vt&&nt===xt)return null;var Tt=tt.getCoordinates()[nt],Ut=tt.getCoordinates()[nt+1],We=vt.getCoordinates()[xt],cn=vt.getCoordinates()[xt+1];if(this._li.computeIntersection(Tt,Ut,We,cn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,Tt,Ut)||this.hasInteriorIntersection(this._li,We,cn)))throw new xr("found non-noded intersection at "+Tt+"-"+Ut+" and "+We+"-"+cn)}},ki.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},ki.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(),a=0;a<i.length-2;a++)this.checkCollapse(i[a],i[a+1],i[a+2])},ki.prototype.hasInteriorIntersection=function(t,n,i){for(var a=0;a<t.getIntersectionNum();a++){var f=t.getIntersection(a);if(!f.equals(n)&&!f.equals(i))return!0}return!1},ki.prototype.checkCollapse=function(t,n,i){if(t.equals(i))throw new xr("found non-noded collapse at "+ki.fact.createLineString([t,n,i]))},ki.prototype.interfaces_=function(){return[]},ki.prototype.getClass=function(){return ki},es.fact.get=function(){return new Qt},Object.defineProperties(ki,es);var gr=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 k("Scale factor must be non-zero");n!==1&&(this._pt=new U(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new U,this._p1Scaled=new U),this.initCorners(this._pt)},tc={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};gr.prototype.intersectsScaled=function(t,n){var i=Math.min(t.x,n.x),a=Math.max(t.x,n.x),f=Math.min(t.y,n.y),g=Math.max(t.y,n.y),v=this._maxx<i||this._minx>a||this._maxy<f||this._miny>g;if(v)return!1;var S=this.intersectsToleranceSquare(t,n);return Nt.isTrue(!(v&&S),"Found bad envelope test"),S},gr.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 U(this._maxx,this._maxy),this._corner[1]=new U(this._minx,this._maxy),this._corner[2]=new U(this._minx,this._miny),this._corner[3]=new U(this._maxx,this._miny)},gr.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))},gr.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},gr.prototype.getCoordinate=function(){return this._originalPt},gr.prototype.copyScaled=function(t,n){n.x=this.scale(t.x),n.y=this.scale(t.y)},gr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=gr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Et(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},gr.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())))},gr.prototype.intersectsToleranceSquare=function(t,n){var i=!1,a=!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()&&(a=!0),this._li.computeIntersection(t,n,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!i||!a)||!!t.equals(this._pt)||!!n.equals(this._pt))))},gr.prototype.addSnappedNode=function(t,n){var i=t.getCoordinate(n),a=t.getCoordinate(n+1);return!!this.intersects(i,a)&&(t.addIntersection(this.getCoordinate(),n),!0)},gr.prototype.interfaces_=function(){return[]},gr.prototype.getClass=function(){return gr},tc.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(gr,tc);var Ga=function(){this.tempEnv1=new Et,this.selectedSegment=new bt};Ga.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)}}},Ga.prototype.interfaces_=function(){return[]},Ga.prototype.getClass=function(){return Ga};var aa=function(){this._index=null;var t=arguments[0];this._index=t},Gs={HotPixelSnapAction:{configurable:!0}};aa.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],a=arguments[2],f=n.getSafeEnvelope(),g=new ao(n,i,a);return this._index.query(f,{interfaces_:function(){return[jo]},visitItem:function(v){v.select(f,g)}}),g.isNodeAdded()}},aa.prototype.interfaces_=function(){return[]},aa.prototype.getClass=function(){return aa},Gs.HotPixelSnapAction.get=function(){return ao},Object.defineProperties(aa,Gs);var ao=function(t){function n(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var i=arguments[0],a=arguments[1],f=arguments[2];this._hotPixel=i,this._parentEdge=a,this._hotPixelVertexIndex=f}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],a=arguments[1],f=i.getContext();if(this._parentEdge!==null&&f===this._parentEdge&&a===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(f,a)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Ga),_s=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new j};_s.prototype.processIntersections=function(t,n,i,a){if(t===i&&n===a)return null;var f=t.getCoordinates()[n],g=t.getCoordinates()[n+1],v=i.getCoordinates()[a],S=i.getCoordinates()[a+1];if(this._li.computeIntersection(f,g,v,S),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var P=0;P<this._li.getIntersectionNum();P++)this._interiorIntersections.add(this._li.getIntersection(P));t.addIntersections(this._li,n,0),i.addIntersections(this._li,a,1)}},_s.prototype.isDone=function(){return!1},_s.prototype.getInteriorIntersections=function(){return this._interiorIntersections},_s.prototype.interfaces_=function(){return[ts]},_s.prototype.getClass=function(){return _s};var To=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 Mi,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};To.prototype.checkCorrectness=function(t){var n=Ln.getNodedSubstrings(t),i=new ki(n);try{i.checkValid()}catch(a){if(!(a instanceof Vn))throw a;a.printStackTrace()}},To.prototype.getNodedSubstrings=function(){return Ln.getNodedSubstrings(this._nodedSegStrings)},To.prototype.snapRound=function(t,n){var i=this.findInteriorIntersections(t,n);this.computeIntersectionSnaps(i),this.computeVertexSnaps(t)},To.prototype.findInteriorIntersections=function(t,n){var i=new _s(n);return this._noder.setSegmentIntersector(i),this._noder.computeNodes(t),i.getInteriorIntersections()},To.prototype.computeVertexSnaps=function(){if(yt(arguments[0],K))for(var t=arguments[0].iterator();t.hasNext();){var n=t.next();this.computeVertexSnaps(n)}else if(arguments[0]instanceof Ln)for(var i=arguments[0],a=i.getCoordinates(),f=0;f<a.length;f++){var g=new gr(a[f],this._scaleFactor,this._li);this._pointSnapper.snap(g,i,f)&&i.addIntersection(a[f],f)}},To.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new ka,this._pointSnapper=new aa(this._noder.getIndex()),this.snapRound(t,this._li)},To.prototype.computeIntersectionSnaps=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next(),a=new gr(i,this._scaleFactor,this._li);this._pointSnapper.snap(a)}},To.prototype.interfaces_=function(){return[fi]},To.prototype.getClass=function(){return To};var mr=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new jt,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}},ua={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};mr.prototype.bufferFixedPrecision=function(t){var n=new Ao(new To(new ue(1)),t.getScale()),i=new Lr(this._bufParams);i.setWorkingPrecisionModel(t),i.setNoder(n),this._resultGeometry=i.buffer(this._argGeom,this._distance)},mr.prototype.bufferReducedPrecision=function(){var t=this;if(arguments.length===0){for(var n=mr.MAX_PRECISION_DIGITS;n>=0;n--){try{t.bufferReducedPrecision(n)}catch(g){if(!(g instanceof Mo))throw g;t._saveException=g}if(t._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var i=arguments[0],a=mr.precisionScaleFactor(this._argGeom,this._distance,i),f=new ue(a);this.bufferFixedPrecision(f)}},mr.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===ue.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},mr.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},mr.prototype.bufferOriginalPrecision=function(){try{var t=new Lr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(n){if(!(n instanceof xr))throw n;this._saveException=n}},mr.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},mr.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},mr.prototype.interfaces_=function(){return[]},mr.prototype.getClass=function(){return mr},mr.bufferOp=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];return new mr(t).getResultGeometry(n)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Ft&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1],f=arguments[2],g=new mr(i);return g.setQuadrantSegments(f),g.getResultGeometry(a)}if(arguments[2]instanceof jt&&arguments[0]instanceof Ft&&typeof arguments[1]=="number"){var v=arguments[0],S=arguments[1],P=arguments[2];return new mr(v,P).getResultGeometry(S)}}else if(arguments.length===4){var V=arguments[0],tt=arguments[1],nt=arguments[2],vt=arguments[3],xt=new mr(V);return xt.setQuadrantSegments(nt),xt.setEndCapStyle(vt),xt.getResultGeometry(tt)}},mr.precisionScaleFactor=function(t,n,i){var a=t.getEnvelopeInternal(),f=zt.max(Math.abs(a.getMaxX()),Math.abs(a.getMaxY()),Math.abs(a.getMinX()),Math.abs(a.getMinY()))+2*(n>0?n:0),g=i-Math.trunc(Math.log(f)/Math.log(10)+1);return Math.pow(10,g)},ua.CAP_ROUND.get=function(){return jt.CAP_ROUND},ua.CAP_BUTT.get=function(){return jt.CAP_FLAT},ua.CAP_FLAT.get=function(){return jt.CAP_FLAT},ua.CAP_SQUARE.get=function(){return jt.CAP_SQUARE},ua.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(mr,ua);var Nr=function(){this._pt=[new U,new U],this._distance=F.NaN,this._isNull=!0};Nr.prototype.getCoordinates=function(){return this._pt},Nr.prototype.getCoordinate=function(t){return this._pt[t]},Nr.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 a=n.distance(i);a<this._distance&&this.initialize(n,i,a)}},Nr.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],a=arguments[1],f=arguments[2];this._pt[0].setCoordinate(i),this._pt[1].setCoordinate(a),this._distance=f,this._isNull=!1}},Nr.prototype.getDistance=function(){return this._distance},Nr.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 a=n.distance(i);a>this._distance&&this.initialize(n,i,a)}},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr};var Co=function(){};Co.prototype.interfaces_=function(){return[]},Co.prototype.getClass=function(){return Co},Co.computeDistance=function(){if(arguments[2]instanceof Nr&&arguments[0]instanceof xn&&arguments[1]instanceof U)for(var t=arguments[0],n=arguments[1],i=arguments[2],a=t.getCoordinates(),f=new bt,g=0;g<a.length-1;g++){f.setCoordinates(a[g],a[g+1]);var v=f.closestPoint(n);i.setMinimum(v,n)}else if(arguments[2]instanceof Nr&&arguments[0]instanceof Jn&&arguments[1]instanceof U){var S=arguments[0],P=arguments[1],V=arguments[2];Co.computeDistance(S.getExteriorRing(),P,V);for(var tt=0;tt<S.getNumInteriorRing();tt++)Co.computeDistance(S.getInteriorRingN(tt),P,V)}else if(arguments[2]instanceof Nr&&arguments[0]instanceof Ft&&arguments[1]instanceof U){var nt=arguments[0],vt=arguments[1],xt=arguments[2];if(nt instanceof xn)Co.computeDistance(nt,vt,xt);else if(nt instanceof Jn)Co.computeDistance(nt,vt,xt);else if(nt instanceof _n)for(var Tt=nt,Ut=0;Ut<Tt.getNumGeometries();Ut++){var We=Tt.getGeometryN(Ut);Co.computeDistance(We,vt,xt)}else xt.setMinimum(nt.getCoordinate(),vt)}else if(arguments[2]instanceof Nr&&arguments[0]instanceof bt&&arguments[1]instanceof U){var cn=arguments[0],Fr=arguments[1],Ro=arguments[2],is=cn.closestPoint(Fr);Ro.setMinimum(is,Fr)}};var di=function(t){this._maxPtDist=new Nr,this._inputGeom=t||null},J={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};di.prototype.computeMaxMidpointDistance=function(t){var n=new ot(this._inputGeom);t.apply(n),this._maxPtDist.setMaximum(n.getMaxPointDistance())},di.prototype.computeMaxVertexDistance=function(t){var n=new ut(this._inputGeom);t.apply(n),this._maxPtDist.setMaximum(n.getMaxPointDistance())},di.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},di.prototype.getDistancePoints=function(){return this._maxPtDist},di.prototype.interfaces_=function(){return[]},di.prototype.getClass=function(){return di},J.MaxPointDistanceFilter.get=function(){return ut},J.MaxMidpointDistanceFilter.get=function(){return ot},Object.defineProperties(di,J);var ut=function(t){this._maxPtDist=new Nr,this._minPtDist=new Nr,this._geom=t||null};ut.prototype.filter=function(t){this._minPtDist.initialize(),Co.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},ut.prototype.getMaxPointDistance=function(){return this._maxPtDist},ut.prototype.interfaces_=function(){return[Y]},ut.prototype.getClass=function(){return ut};var ot=function(t){this._maxPtDist=new Nr,this._minPtDist=new Nr,this._geom=t||null};ot.prototype.filter=function(t,n){if(n===0)return null;var i=t.getCoordinate(n-1),a=t.getCoordinate(n),f=new U((i.x+a.x)/2,(i.y+a.y)/2);this._minPtDist.initialize(),Co.computeDistance(this._geom,f,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},ot.prototype.isDone=function(){return!1},ot.prototype.isGeometryChanged=function(){return!1},ot.prototype.getMaxPointDistance=function(){return this._maxPtDist},ot.prototype.interfaces_=function(){return[zn]},ot.prototype.getClass=function(){return ot};var At=function(t){this._comps=t||null};At.prototype.filter=function(t){t instanceof Jn&&this._comps.add(t)},At.prototype.interfaces_=function(){return[qn]},At.prototype.getClass=function(){return At},At.getPolygons=function(){if(arguments.length===1){var t=arguments[0];return At.getPolygons(t,new j)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return n instanceof Jn?i.add(n):n instanceof _n&&n.apply(new At(i)),i}};var Dt=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}};Dt.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof Ki){var n=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(n),null}t instanceof xn&&this._lines.add(t)},Dt.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},Dt.prototype.interfaces_=function(){return[Di]},Dt.prototype.getClass=function(){return Dt},Dt.getGeometry=function(){if(arguments.length===1){var t=arguments[0];return t.getFactory().buildGeometry(Dt.getLines(t))}if(arguments.length===2){var n=arguments[0],i=arguments[1];return n.getFactory().buildGeometry(Dt.getLines(n,i))}},Dt.getLines=function(){if(arguments.length===1){var t=arguments[0];return Dt.getLines(t,!1)}if(arguments.length===2){if(yt(arguments[0],K)&&yt(arguments[1],K)){for(var n=arguments[0],i=arguments[1],a=n.iterator();a.hasNext();){var f=a.next();Dt.getLines(f,i)}return i}if(arguments[0]instanceof Ft&&typeof arguments[1]=="boolean"){var g=arguments[0],v=arguments[1],S=new j;return g.apply(new Dt(S,v)),S}if(arguments[0]instanceof Ft&&yt(arguments[1],K)){var P=arguments[0],V=arguments[1];return P instanceof xn?V.add(P):P.apply(new Dt(V)),V}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&yt(arguments[0],K)&&yt(arguments[1],K)){for(var tt=arguments[0],nt=arguments[1],vt=arguments[2],xt=tt.iterator();xt.hasNext();){var Tt=xt.next();Dt.getLines(Tt,nt,vt)}return nt}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Ft&&yt(arguments[1],K)){var Ut=arguments[0],We=arguments[1],cn=arguments[2];return Ut.apply(new Dt(We,cn)),We}}};var te=function(){if(this._boundaryRule=w.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 k("Rule must be non-null");this._boundaryRule=t}}};te.prototype.locateInternal=function(){if(arguments[0]instanceof U&&arguments[1]instanceof Jn){var t=arguments[0],n=arguments[1];if(n.isEmpty())return W.EXTERIOR;var i=n.getExteriorRing(),a=this.locateInPolygonRing(t,i);if(a===W.EXTERIOR)return W.EXTERIOR;if(a===W.BOUNDARY)return W.BOUNDARY;for(var f=0;f<n.getNumInteriorRing();f++){var g=n.getInteriorRingN(f),v=this.locateInPolygonRing(t,g);if(v===W.INTERIOR)return W.EXTERIOR;if(v===W.BOUNDARY)return W.BOUNDARY}return W.INTERIOR}if(arguments[0]instanceof U&&arguments[1]instanceof xn){var S=arguments[0],P=arguments[1];if(!P.getEnvelopeInternal().intersects(S))return W.EXTERIOR;var V=P.getCoordinates();return P.isClosed()||!S.equals(V[0])&&!S.equals(V[V.length-1])?mt.isOnLine(S,V)?W.INTERIOR:W.EXTERIOR:W.BOUNDARY}if(arguments[0]instanceof U&&arguments[1]instanceof Er){var tt=arguments[0];return arguments[1].getCoordinate().equals2D(tt)?W.INTERIOR:W.EXTERIOR}},te.prototype.locateInPolygonRing=function(t,n){return n.getEnvelopeInternal().intersects(t)?mt.locatePointInRing(t,n.getCoordinates()):W.EXTERIOR},te.prototype.intersects=function(t,n){return this.locate(t,n)!==W.EXTERIOR},te.prototype.updateLocationInfo=function(t){t===W.INTERIOR&&(this._isIn=!0),t===W.BOUNDARY&&this._numBoundaries++},te.prototype.computeLocation=function(t,n){if(n instanceof Er&&this.updateLocationInfo(this.locateInternal(t,n)),n instanceof xn)this.updateLocationInfo(this.locateInternal(t,n));else if(n instanceof Jn)this.updateLocationInfo(this.locateInternal(t,n));else if(n instanceof bi)for(var i=n,a=0;a<i.getNumGeometries();a++){var f=i.getGeometryN(a);this.updateLocationInfo(this.locateInternal(t,f))}else if(n instanceof Qi)for(var g=n,v=0;v<g.getNumGeometries();v++){var S=g.getGeometryN(v);this.updateLocationInfo(this.locateInternal(t,S))}else if(n instanceof _n)for(var P=new zi(n);P.hasNext();){var V=P.next();V!==n&&this.computeLocation(t,V)}},te.prototype.locate=function(t,n){return n.isEmpty()?W.EXTERIOR:n instanceof xn?this.locateInternal(t,n):n instanceof Jn?this.locateInternal(t,n):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,n),this._boundaryRule.isInBoundary(this._numBoundaries)?W.BOUNDARY:this._numBoundaries>0||this._isIn?W.INTERIOR:W.EXTERIOR)},te.prototype.interfaces_=function(){return[]},te.prototype.getClass=function(){return te};var ge=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 a=arguments[0],f=arguments[1],g=arguments[2];this._component=a,this._segIndex=f,this._pt=g}},bn={INSIDE_AREA:{configurable:!0}};ge.prototype.isInsideArea=function(){return this._segIndex===ge.INSIDE_AREA},ge.prototype.getCoordinate=function(){return this._pt},ge.prototype.getGeometryComponent=function(){return this._component},ge.prototype.getSegmentIndex=function(){return this._segIndex},ge.prototype.interfaces_=function(){return[]},ge.prototype.getClass=function(){return ge},bn.INSIDE_AREA.get=function(){return-1},Object.defineProperties(ge,bn);var Io=function(t){this._pts=t||null};Io.prototype.filter=function(t){t instanceof Er&&this._pts.add(t)},Io.prototype.interfaces_=function(){return[qn]},Io.prototype.getClass=function(){return Io},Io.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof Er?Ui.singletonList(t):Io.getPoints(t,new j)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return n instanceof Er?i.add(n):n instanceof _n&&n.apply(new Io(i)),i}};var Hs=function(){this._locations=null;var t=arguments[0];this._locations=t};Hs.prototype.filter=function(t){(t instanceof Er||t instanceof xn||t instanceof Jn)&&this._locations.add(new ge(t,0,t.getCoordinate()))},Hs.prototype.interfaces_=function(){return[qn]},Hs.prototype.getClass=function(){return Hs},Hs.getLocations=function(t){var n=new j;return t.apply(new Hs(n)),n};var pn=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new te,this._minDistanceLocation=null,this._minDistance=F.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],a=arguments[1],f=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=i,this._geom[1]=a,this._terminateDistance=f}};pn.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],a=1-n,f=At.getPolygons(this._geom[n]);if(f.size()>0){var g=Hs.getLocations(this._geom[a]);if(this.computeContainmentDistance(g,f,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[a]=i[0],this._minDistanceLocation[n]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&yt(arguments[0],at)&&yt(arguments[1],at)){for(var v=arguments[0],S=arguments[1],P=arguments[2],V=0;V<v.size();V++)for(var tt=v.get(V),nt=0;nt<S.size();nt++)if(this.computeContainmentDistance(tt,S.get(nt),P),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof ge&&arguments[1]instanceof Jn){var vt=arguments[0],xt=arguments[1],Tt=arguments[2],Ut=vt.getCoordinate();if(W.EXTERIOR!==this._ptLocator.locate(Ut,xt))return this._minDistance=0,Tt[0]=vt,Tt[1]=new ge(xt,Ut),null}}},pn.prototype.computeMinDistanceLinesPoints=function(t,n,i){for(var a=0;a<t.size();a++)for(var f=t.get(a),g=0;g<n.size();g++){var v=n.get(g);if(this.computeMinDistance(f,v,i),this._minDistance<=this._terminateDistance)return null}},pn.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),n=Dt.getLines(this._geom[0]),i=Dt.getLines(this._geom[1]),a=Io.getPoints(this._geom[0]),f=Io.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,f,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(i,a,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(a,f,t),void this.updateMinDistance(t,!1))))},pn.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},pn.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])},pn.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},pn.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 xn&&arguments[1]instanceof Er){var t=arguments[0],n=arguments[1],i=arguments[2];if(t.getEnvelopeInternal().distance(n.getEnvelopeInternal())>this._minDistance)return null;for(var a=t.getCoordinates(),f=n.getCoordinate(),g=0;g<a.length-1;g++){var v=mt.distancePointLine(f,a[g],a[g+1]);if(v<this._minDistance){this._minDistance=v;var S=new bt(a[g],a[g+1]).closestPoint(f);i[0]=new ge(t,g,S),i[1]=new ge(n,0,f)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof xn&&arguments[1]instanceof xn){var P=arguments[0],V=arguments[1],tt=arguments[2];if(P.getEnvelopeInternal().distance(V.getEnvelopeInternal())>this._minDistance)return null;for(var nt=P.getCoordinates(),vt=V.getCoordinates(),xt=0;xt<nt.length-1;xt++)for(var Tt=0;Tt<vt.length-1;Tt++){var Ut=mt.distanceLineLine(nt[xt],nt[xt+1],vt[Tt],vt[Tt+1]);if(Ut<this._minDistance){this._minDistance=Ut;var We=new bt(nt[xt],nt[xt+1]),cn=new bt(vt[Tt],vt[Tt+1]),Fr=We.closestPoints(cn);tt[0]=new ge(P,xt,Fr[0]),tt[1]=new ge(V,Tt,Fr[1])}if(this._minDistance<=this._terminateDistance)return null}}}},pn.prototype.computeMinDistancePoints=function(t,n,i){for(var a=0;a<t.size();a++)for(var f=t.get(a),g=0;g<n.size();g++){var v=n.get(g),S=f.getCoordinate().distance(v.getCoordinate());if(S<this._minDistance&&(this._minDistance=S,i[0]=new ge(f,0,f.getCoordinate()),i[1]=new ge(v,0,v.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},pn.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new k("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},pn.prototype.computeMinDistanceLines=function(t,n,i){for(var a=0;a<t.size();a++)for(var f=t.get(a),g=0;g<n.size();g++){var v=n.get(g);if(this.computeMinDistance(f,v,i),this._minDistance<=this._terminateDistance)return null}},pn.prototype.interfaces_=function(){return[]},pn.prototype.getClass=function(){return pn},pn.distance=function(t,n){return new pn(t,n).distance()},pn.isWithinDistance=function(t,n,i){return new pn(t,n,i).distance()<=i},pn.nearestPoints=function(t,n){return new pn(t,n).nearestPoints()};var er=function(){this._pt=[new U,new U],this._distance=F.NaN,this._isNull=!0};er.prototype.getCoordinates=function(){return this._pt},er.prototype.getCoordinate=function(t){return this._pt[t]},er.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 a=n.distance(i);a<this._distance&&this.initialize(n,i,a)}},er.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],a=arguments[1],f=arguments[2];this._pt[0].setCoordinate(i),this._pt[1].setCoordinate(a),this._distance=f,this._isNull=!1}},er.prototype.toString=function(){return Fn.toLineString(this._pt[0],this._pt[1])},er.prototype.getDistance=function(){return this._distance},er.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 a=n.distance(i);a>this._distance&&this.initialize(n,i,a)}},er.prototype.interfaces_=function(){return[]},er.prototype.getClass=function(){return er};var uo=function(){};uo.prototype.interfaces_=function(){return[]},uo.prototype.getClass=function(){return uo},uo.computeDistance=function(){if(arguments[2]instanceof er&&arguments[0]instanceof xn&&arguments[1]instanceof U)for(var t=arguments[0],n=arguments[1],i=arguments[2],a=new bt,f=t.getCoordinates(),g=0;g<f.length-1;g++){a.setCoordinates(f[g],f[g+1]);var v=a.closestPoint(n);i.setMinimum(v,n)}else if(arguments[2]instanceof er&&arguments[0]instanceof Jn&&arguments[1]instanceof U){var S=arguments[0],P=arguments[1],V=arguments[2];uo.computeDistance(S.getExteriorRing(),P,V);for(var tt=0;tt<S.getNumInteriorRing();tt++)uo.computeDistance(S.getInteriorRingN(tt),P,V)}else if(arguments[2]instanceof er&&arguments[0]instanceof Ft&&arguments[1]instanceof U){var nt=arguments[0],vt=arguments[1],xt=arguments[2];if(nt instanceof xn)uo.computeDistance(nt,vt,xt);else if(nt instanceof Jn)uo.computeDistance(nt,vt,xt);else if(nt instanceof _n)for(var Tt=nt,Ut=0;Ut<Tt.getNumGeometries();Ut++){var We=Tt.getGeometryN(Ut);uo.computeDistance(We,vt,xt)}else xt.setMinimum(nt.getCoordinate(),vt)}else if(arguments[2]instanceof er&&arguments[0]instanceof bt&&arguments[1]instanceof U){var cn=arguments[0],Fr=arguments[1],Ro=arguments[2],is=cn.closestPoint(Fr);Ro.setMinimum(is,Fr)}};var Ar=function(){this._g0=null,this._g1=null,this._ptDist=new er,this._densifyFrac=0;var t=arguments[0],n=arguments[1];this._g0=t,this._g1=n},la={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Ar.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Ar.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new k("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},Ar.prototype.compute=function(t,n){this.computeOrientedDistance(t,n,this._ptDist),this.computeOrientedDistance(n,t,this._ptDist)},Ar.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Ar.prototype.computeOrientedDistance=function(t,n,i){var a=new Vo(n);if(t.apply(a),i.setMaximum(a.getMaxPointDistance()),this._densifyFrac>0){var f=new fe(n,this._densifyFrac);t.apply(f),i.setMaximum(f.getMaxPointDistance())}},Ar.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Ar.prototype.interfaces_=function(){return[]},Ar.prototype.getClass=function(){return Ar},Ar.distance=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];return new Ar(t,n).distance()}if(arguments.length===3){var i=arguments[0],a=arguments[1],f=arguments[2],g=new Ar(i,a);return g.setDensifyFraction(f),g.distance()}},la.MaxPointDistanceFilter.get=function(){return Vo},la.MaxDensifiedByFractionDistanceFilter.get=function(){return fe},Object.defineProperties(Ar,la);var Vo=function(){this._maxPtDist=new er,this._minPtDist=new er,this._euclideanDist=new uo,this._geom=null;var t=arguments[0];this._geom=t};Vo.prototype.filter=function(t){this._minPtDist.initialize(),uo.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Vo.prototype.getMaxPointDistance=function(){return this._maxPtDist},Vo.prototype.interfaces_=function(){return[Y]},Vo.prototype.getClass=function(){return Vo};var fe=function(){this._maxPtDist=new er,this._minPtDist=new er,this._geom=null,this._numSubSegs=0;var t=arguments[0],n=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/n))};fe.prototype.filter=function(t,n){if(n===0)return null;for(var i=t.getCoordinate(n-1),a=t.getCoordinate(n),f=(a.x-i.x)/this._numSubSegs,g=(a.y-i.y)/this._numSubSegs,v=0;v<this._numSubSegs;v++){var S=i.x+v*f,P=i.y+v*g,V=new U(S,P);this._minPtDist.initialize(),uo.computeDistance(this._geom,V,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},fe.prototype.isDone=function(){return!1},fe.prototype.isGeometryChanged=function(){return!1},fe.prototype.getMaxPointDistance=function(){return this._maxPtDist},fe.prototype.interfaces_=function(){return[zn]},fe.prototype.getClass=function(){return fe};var Qr=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},hu={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Qr.prototype.checkMaximumDistance=function(t,n,i){var a=new Ar(n,t);if(a.setDensifyFraction(.25),this._maxDistanceFound=a.orientedDistance(),this._maxDistanceFound>i){this._isValid=!1;var f=a.getCoordinates();this._errorLocation=f[1],this._errorIndicator=t.getFactory().createLineString(f),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Fn.toLineString(f[0],f[1])+")"}},Qr.prototype.isValid=function(){var t=Math.abs(this._bufDistance),n=Qr.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(),Qr.VERBOSE&&Ge.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Qr.prototype.checkNegativeValid=function(){if(!(this._input instanceof Jn||this._input instanceof Qi||this._input instanceof _n))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)},Qr.prototype.getErrorIndicator=function(){return this._errorIndicator},Qr.prototype.checkMinimumDistance=function(t,n,i){var a=new pn(t,n,i);if(this._minDistanceFound=a.distance(),this._minDistanceFound<i){this._isValid=!1;var f=a.nearestPoints();this._errorLocation=a.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(f),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+Fn.toLineString(f[0],f[1])+" )"}},Qr.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)},Qr.prototype.getErrorLocation=function(){return this._errorLocation},Qr.prototype.getPolygonLines=function(t){for(var n=new j,i=new Dt(n),a=At.getPolygons(t).iterator();a.hasNext();)a.next().apply(i);return t.getFactory().buildGeometry(n)},Qr.prototype.getErrorMessage=function(){return this._errMsg},Qr.prototype.interfaces_=function(){return[]},Qr.prototype.getClass=function(){return Qr},hu.VERBOSE.get=function(){return!1},hu.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Qr,hu);var Qn=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},sl={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Qn.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},Qn.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*Qn.MAX_ENV_DIFF_FRAC;t===0&&(t=.001);var n=new Et(this._input.getEnvelopeInternal());n.expandBy(this._distance);var i=new Et(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")},Qn.prototype.checkDistance=function(){var t=new Qr(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")},Qn.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")},Qn.prototype.checkPolygonal=function(){this._result instanceof Jn||this._result instanceof Qi||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Qn.prototype.getErrorIndicator=function(){return this._errorIndicator},Qn.prototype.getErrorLocation=function(){return this._errorLocation},Qn.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"))},Qn.prototype.report=function(t){if(!Qn.VERBOSE)return null;Ge.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},Qn.prototype.getErrorMessage=function(){return this._errorMsg},Qn.prototype.interfaces_=function(){return[]},Qn.prototype.getClass=function(){return Qn},Qn.isValidMsg=function(t,n,i){var a=new Qn(t,n,i);return a.isValid()?null:a.getErrorMessage()},Qn.isValid=function(t,n,i){return!!new Qn(t,n,i).isValid()},sl.VERBOSE.get=function(){return!1},sl.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Qn,sl);var lo=function(){this._pts=null,this._data=null;var t=arguments[0],n=arguments[1];this._pts=t,this._data=n};lo.prototype.getCoordinates=function(){return this._pts},lo.prototype.size=function(){return this._pts.length},lo.prototype.getCoordinate=function(t){return this._pts[t]},lo.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},lo.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:ds.octant(this.getCoordinate(t),this.getCoordinate(t+1))},lo.prototype.setData=function(t){this._data=t},lo.prototype.getData=function(){return this._data},lo.prototype.toString=function(){return Fn.toLineString(new Rn(this._pts))},lo.prototype.interfaces_=function(){return[io]},lo.prototype.getClass=function(){return lo};var ar=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new j,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};ar.prototype.getInteriorIntersection=function(){return this._interiorIntersection},ar.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},ar.prototype.getIntersectionSegments=function(){return this._intSegments},ar.prototype.count=function(){return this._intersectionCount},ar.prototype.getIntersections=function(){return this._intersections},ar.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},ar.prototype.setKeepIntersections=function(t){this._keepIntersections=t},ar.prototype.processIntersections=function(t,n,i,a){if(!this._findAllIntersections&&this.hasIntersection()||t===i&&n===a||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,n)||this.isEndSegment(i,a)))return null;var f=t.getCoordinates()[n],g=t.getCoordinates()[n+1],v=i.getCoordinates()[a],S=i.getCoordinates()[a+1];this._li.computeIntersection(f,g,v,S),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=f,this._intSegments[1]=g,this._intSegments[2]=v,this._intSegments[3]=S,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},ar.prototype.isEndSegment=function(t,n){return n===0||n>=t.size()-2},ar.prototype.hasIntersection=function(){return this._interiorIntersection!==null},ar.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},ar.prototype.interfaces_=function(){return[ts]},ar.prototype.getClass=function(){return ar},ar.createAllIntersectionsFinder=function(t){var n=new ar(t);return n.setFindAllIntersections(!0),n},ar.createAnyIntersectionFinder=function(t){return new ar(t)},ar.createIntersectionCounter=function(t){var n=new ar(t);return n.setFindAllIntersections(!0),n.setKeepIntersections(!1),n};var jr=function(){this._li=new Mi,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};jr.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},jr.prototype.getIntersections=function(){return this._segInt.getIntersections()},jr.prototype.isValid=function(){return this.execute(),this._isValid},jr.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},jr.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new ar(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new ka;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},jr.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Mo(this.getErrorMessage(),this._segInt.getInteriorIntersection())},jr.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Fn.toLineString(t[0],t[1])+" and "+Fn.toLineString(t[2],t[3])},jr.prototype.interfaces_=function(){return[]},jr.prototype.getClass=function(){return jr},jr.computeIntersections=function(t){var n=new jr(t);return n.setFindAllIntersections(!0),n.isValid(),n.getIntersections()};var gi=function t(){this._nv=null;var n=arguments[0];this._nv=new jr(t.toSegmentStrings(n))};gi.prototype.checkValid=function(){this._nv.checkValid()},gi.prototype.interfaces_=function(){return[]},gi.prototype.getClass=function(){return gi},gi.toSegmentStrings=function(t){for(var n=new j,i=t.iterator();i.hasNext();){var a=i.next();n.add(new lo(a.getCoordinates(),a))}return n},gi.checkValid=function(t){new gi(t).checkValid()};var Wo=function(t){this._mapOp=t};Wo.prototype.map=function(t){for(var n=new j,i=0;i<t.getNumGeometries();i++){var a=this._mapOp.map(t.getGeometryN(i));a.isEmpty()||n.add(a)}return t.getFactory().createGeometryCollection(Qt.toGeometryArray(n))},Wo.prototype.interfaces_=function(){return[]},Wo.prototype.getClass=function(){return Wo},Wo.map=function(t,n){return new Wo(n).map(t)};var Gi=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new j,this._resultLineList=new j;var t=arguments[0],n=arguments[1],i=arguments[2];this._op=t,this._geometryFactory=n,this._ptLocator=i};Gi.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)}},Gi.prototype.labelIsolatedLine=function(t,n){var i=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(n));t.getLabel().setLocation(n,i)},Gi.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},Gi.prototype.collectLineEdge=function(t,n,i){var a=t.getLabel(),f=t.getEdge();t.isLineEdge()&&(t.isVisited()||!Ht.isResultOfOp(a,n)||f.isCovered()||(i.add(f),t.setVisitedEdge(!0)))},Gi.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(),a=i.getEdge();if(i.isLineEdge()&&!a.isCoveredSet()){var f=this._op.isCoveredByA(i.getCoordinate());a.setCovered(f)}}},Gi.prototype.labelIsolatedLines=function(t){for(var n=t.iterator();n.hasNext();){var i=n.next(),a=i.getLabel();i.isIsolated()&&(a.isNull(0)?this.labelIsolatedLine(i,0):this.labelIsolatedLine(i,1))}},Gi.prototype.buildLines=function(t){for(var n=this._lineEdgesList.iterator();n.hasNext();){var i=n.next(),a=this._geometryFactory.createLineString(i.getCoordinates());this._resultLineList.add(a),i.setInResult(!0)}},Gi.prototype.collectBoundaryTouchEdge=function(t,n,i){var a=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(Nt.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(Ht.isResultOfOp(a,n)&&n===Ht.INTERSECTION&&(i.add(t.getEdge()),t.setVisitedEdge(!0))))},Gi.prototype.interfaces_=function(){return[]},Gi.prototype.getClass=function(){return Gi};var qo=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new j;var t=arguments[0],n=arguments[1];this._op=t,this._geometryFactory=n};qo.prototype.filterCoveredNodeToPoint=function(t){var n=t.getCoordinate();if(!this._op.isCoveredByLA(n)){var i=this._geometryFactory.createPoint(n);this._resultPointList.add(i)}},qo.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===Ht.INTERSECTION)){var a=i.getLabel();Ht.isResultOfOp(a,t)&&this.filterCoveredNodeToPoint(i)}}},qo.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},qo.prototype.interfaces_=function(){return[]},qo.prototype.getClass=function(){return qo};var Dr=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Dr.prototype.transformPoint=function(t,n){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},Dr.prototype.transformPolygon=function(t,n){var i=!0,a=this.transformLinearRing(t.getExteriorRing(),t);a!==null&&a instanceof Ki&&!a.isEmpty()||(i=!1);for(var f=new j,g=0;g<t.getNumInteriorRing();g++){var v=this.transformLinearRing(t.getInteriorRingN(g),t);v===null||v.isEmpty()||(v instanceof Ki||(i=!1),f.add(v))}if(i)return this._factory.createPolygon(a,f.toArray([]));var S=new j;return a!==null&&S.add(a),S.addAll(f),this._factory.buildGeometry(S)},Dr.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},Dr.prototype.getInputGeometry=function(){return this._inputGeom},Dr.prototype.transformMultiLineString=function(t,n){for(var i=new j,a=0;a<t.getNumGeometries();a++){var f=this.transformLineString(t.getGeometryN(a),t);f!==null&&(f.isEmpty()||i.add(f))}return this._factory.buildGeometry(i)},Dr.prototype.transformCoordinates=function(t,n){return this.copy(t)},Dr.prototype.transformLineString=function(t,n){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},Dr.prototype.transformMultiPoint=function(t,n){for(var i=new j,a=0;a<t.getNumGeometries();a++){var f=this.transformPoint(t.getGeometryN(a),t);f!==null&&(f.isEmpty()||i.add(f))}return this._factory.buildGeometry(i)},Dr.prototype.transformMultiPolygon=function(t,n){for(var i=new j,a=0;a<t.getNumGeometries();a++){var f=this.transformPolygon(t.getGeometryN(a),t);f!==null&&(f.isEmpty()||i.add(f))}return this._factory.buildGeometry(i)},Dr.prototype.copy=function(t){return t.copy()},Dr.prototype.transformGeometryCollection=function(t,n){for(var i=new j,a=0;a<t.getNumGeometries();a++){var f=this.transform(t.getGeometryN(a));f!==null&&(this._pruneEmptyGeometry&&f.isEmpty()||i.add(f))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Qt.toGeometryArray(i)):this._factory.buildGeometry(i)},Dr.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Er)return this.transformPoint(t,null);if(t instanceof na)return this.transformMultiPoint(t,null);if(t instanceof Ki)return this.transformLinearRing(t,null);if(t instanceof xn)return this.transformLineString(t,null);if(t instanceof bi)return this.transformMultiLineString(t,null);if(t instanceof Jn)return this.transformPolygon(t,null);if(t instanceof Qi)return this.transformMultiPolygon(t,null);if(t instanceof _n)return this.transformGeometryCollection(t,null);throw new k("Unknown Geometry subtype: "+t.getClass().getName())},Dr.prototype.transformLinearRing=function(t,n){var i=this.transformCoordinates(t.getCoordinateSequence(),t);if(i===null)return this._factory.createLinearRing(null);var a=i.size();return a>0&&a<4&&!this._preserveType?this._factory.createLineString(i):this._factory.createLinearRing(i)},Dr.prototype.interfaces_=function(){return[]},Dr.prototype.getClass=function(){return Dr};var co=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new bt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof xn&&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 a=arguments[0],f=arguments[1];this._srcPts=a,this._isClosed=t.isClosed(a),this._snapTolerance=f}};co.prototype.snapVertices=function(t,n){for(var i=this._isClosed?t.size()-1:t.size(),a=0;a<i;a++){var f=t.get(a),g=this.findSnapForVertex(f,n);g!==null&&(t.set(a,new U(g)),a===0&&this._isClosed&&t.set(t.size()-1,new U(g)))}},co.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},co.prototype.snapTo=function(t){var n=new ft(this._srcPts);return this.snapVertices(n,t),this.snapSegments(n,t),n.toCoordinateArray()},co.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 a=0;a<i;a++){var f=n[a],g=this.findSegmentIndexToSnap(f,t);g>=0&&t.add(g+1,new U(f),!1)}},co.prototype.findSegmentIndexToSnap=function(t,n){for(var i=F.MAX_VALUE,a=-1,f=0;f<n.size()-1;f++){if(this._seg.p0=n.get(f),this._seg.p1=n.get(f+1),this._seg.p0.equals2D(t)||this._seg.p1.equals2D(t)){if(this._allowSnappingToSourceVertices)continue;return-1}var g=this._seg.distance(t);g<this._snapTolerance&&g<i&&(i=g,a=f)}return a},co.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},co.prototype.interfaces_=function(){return[]},co.prototype.getClass=function(){return co},co.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var An=function(t){this._srcGeom=t||null},al={SNAP_PRECISION_FACTOR:{configurable:!0}};An.prototype.snapTo=function(t,n){var i=this.extractTargetCoordinates(t);return new ca(n,i).transform(this._srcGeom)},An.prototype.snapToSelf=function(t,n){var i=this.extractTargetCoordinates(this._srcGeom),a=new ca(t,i,!0).transform(this._srcGeom),f=a;return n&&yt(f,Qo)&&(f=a.buffer(0)),f},An.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},An.prototype.extractTargetCoordinates=function(t){for(var n=new C,i=t.getCoordinates(),a=0;a<i.length;a++)n.add(i[a]);return n.toArray(new Array(0).fill(null))},An.prototype.computeMinimumSegmentLength=function(t){for(var n=F.MAX_VALUE,i=0;i<t.length-1;i++){var a=t[i].distance(t[i+1]);a<n&&(n=a)}return n},An.prototype.interfaces_=function(){return[]},An.prototype.getClass=function(){return An},An.snap=function(t,n,i){var a=new Array(2).fill(null),f=new An(t);a[0]=f.snapTo(n,i);var g=new An(n);return a[1]=g.snapTo(a[0],i),a},An.computeOverlaySnapTolerance=function(){if(arguments.length===1){var t=arguments[0],n=An.computeSizeBasedSnapTolerance(t),i=t.getPrecisionModel();if(i.getType()===ue.FIXED){var a=1/i.getScale()*2/1.415;a>n&&(n=a)}return n}if(arguments.length===2){var f=arguments[0],g=arguments[1];return Math.min(An.computeOverlaySnapTolerance(f),An.computeOverlaySnapTolerance(g))}},An.computeSizeBasedSnapTolerance=function(t){var n=t.getEnvelopeInternal();return Math.min(n.getHeight(),n.getWidth())*An.SNAP_PRECISION_FACTOR},An.snapToSelf=function(t,n,i){return new An(t).snapToSelf(n,i)},al.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(An,al);var ca=function(t){function n(i,a,f){t.call(this),this._snapTolerance=i||null,this._snapPts=a||null,this._isSelfSnap=f!==void 0&&f}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.snapLine=function(i,a){var f=new co(i,this._snapTolerance);return f.setAllowSnappingToSourceVertices(this._isSelfSnap),f.snapTo(a)},n.prototype.transformCoordinates=function(i,a){var f=i.toCoordinateArray(),g=this.snapLine(f,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(g)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Dr),Yn=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Yn.prototype.getCommon=function(){return F.longBitsToDouble(this._commonBits)},Yn.prototype.add=function(t){var n=F.doubleToLongBits(t);if(this._isFirst)return this._commonBits=n,this._commonSignExp=Yn.signExpBits(this._commonBits),this._isFirst=!1,null;if(Yn.signExpBits(n)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Yn.numCommonMostSigMantissaBits(this._commonBits,n),this._commonBits=Yn.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},Yn.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],n=F.longBitsToDouble(t),i="0000000000000000000000000000000000000000000000000000000000000000"+F.toBinaryString(t),a=i.substring(i.length-64);return a.substring(0,1)+" "+a.substring(1,12)+"(exp) "+a.substring(12)+" [ "+n+" ]"}},Yn.prototype.interfaces_=function(){return[]},Yn.prototype.getClass=function(){return Yn},Yn.getBit=function(t,n){return t&1<<n?1:0},Yn.signExpBits=function(t){return t>>52},Yn.zeroLowerBits=function(t,n){return t&~((1<<n)-1)},Yn.numCommonMostSigMantissaBits=function(t,n){for(var i=0,a=52;a>=0;a--){if(Yn.getBit(t,a)!==Yn.getBit(n,a))return i;i++}return 52};var fo=function(){this._commonCoord=null,this._ccFilter=new Vs},ul={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};fo.prototype.addCommonBits=function(t){var n=new ns(this._commonCoord);t.apply(n),t.geometryChanged()},fo.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var n=new U(this._commonCoord);n.x=-n.x,n.y=-n.y;var i=new ns(n);return t.apply(i),t.geometryChanged(),t},fo.prototype.getCommonCoordinate=function(){return this._commonCoord},fo.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},fo.prototype.interfaces_=function(){return[]},fo.prototype.getClass=function(){return fo},ul.CommonCoordinateFilter.get=function(){return Vs},ul.Translater.get=function(){return ns},Object.defineProperties(fo,ul);var Vs=function(){this._commonBitsX=new Yn,this._commonBitsY=new Yn};Vs.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},Vs.prototype.getCommonCoordinate=function(){return new U(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Vs.prototype.interfaces_=function(){return[Y]},Vs.prototype.getClass=function(){return Vs};var ns=function(){this.trans=null;var t=arguments[0];this.trans=t};ns.prototype.filter=function(t,n){var i=t.getOrdinate(n,0)+this.trans.x,a=t.getOrdinate(n,1)+this.trans.y;t.setOrdinate(n,0,i),t.setOrdinate(n,1,a)},ns.prototype.isDone=function(){return!1},ns.prototype.isGeometryChanged=function(){return!0},ns.prototype.interfaces_=function(){return[zn]},ns.prototype.getClass=function(){return ns};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 An(t).snapTo(t,this._snapTolerance)},$n.prototype.removeCommonBits=function(t){this._cbr=new fo,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=Ht.overlayOp(n[0],n[1],t);return this.prepareResult(i)},$n.prototype.checkValid=function(t){t.isValid()||Ge.out.println("Snapped geometry is invalid")},$n.prototype.computeSnapTolerance=function(){this._snapTolerance=An.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},$n.prototype.snap=function(t){var n=this.removeCommonBits(t);return An.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,Ht.UNION)},$n.intersection=function(t,n){return $n.overlayOp(t,n,Ht.INTERSECTION)},$n.symDifference=function(t,n){return $n.overlayOp(t,n,Ht.SYMDIFFERENCE)},$n.difference=function(t,n){return $n.overlayOp(t,n,Ht.DIFFERENCE)};var ur=function(t,n){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=n};ur.prototype.getResultGeometry=function(t){var n=null,i=!1,a=null;try{n=Ht.overlayOp(this._geom[0],this._geom[1],t),i=!0}catch(f){if(!(f instanceof xr))throw f;a=f}if(!i)try{n=$n.overlayOp(this._geom[0],this._geom[1],t)}catch(f){throw f instanceof xr?a:f}return n},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur},ur.overlayOp=function(t,n,i){return new ur(t,n).getResultGeometry(i)},ur.union=function(t,n){return ur.overlayOp(t,n,Ht.UNION)},ur.intersection=function(t,n){return ur.overlayOp(t,n,Ht.INTERSECTION)},ur.symDifference=function(t,n){return ur.overlayOp(t,n,Ht.SYMDIFFERENCE)},ur.difference=function(t,n){return ur.overlayOp(t,n,Ht.DIFFERENCE)};var Ws=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],n=arguments[1];this.mce=t,this.chainIndex=n};Ws.prototype.computeIntersections=function(t,n){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,n)},Ws.prototype.interfaces_=function(){return[]},Ws.prototype.getClass=function(){return Ws};var ti=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 a=arguments[0],f=arguments[1],g=arguments[2];this._eventType=t.INSERT,this._label=a,this._xValue=f,this._obj=g}},pu={INSERT:{configurable:!0},DELETE:{configurable:!0}};ti.prototype.isDelete=function(){return this._eventType===ti.DELETE},ti.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},ti.prototype.getObject=function(){return this._obj},ti.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},ti.prototype.getInsertEvent=function(){return this._insertEvent},ti.prototype.isInsert=function(){return this._eventType===ti.INSERT},ti.prototype.isSameLabel=function(t){return this._label!==null&&this._label===t._label},ti.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},ti.prototype.interfaces_=function(){return[Z]},ti.prototype.getClass=function(){return ti},pu.INSERT.get=function(){return 1},pu.DELETE.get=function(){return 2},Object.defineProperties(ti,pu);var du=function(){};du.prototype.interfaces_=function(){return[]},du.prototype.getClass=function(){return du};var yr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],n=arguments[1],i=arguments[2];this._li=t,this._includeProper=n,this._recordIsolated=i};yr.prototype.isTrivialIntersection=function(t,n,i,a){if(t===i&&this._li.getIntersectionNum()===1){if(yr.isAdjacentSegments(n,a))return!0;if(t.isClosed()){var f=t.getNumPoints()-1;if(n===0&&a===f||a===0&&n===f)return!0}}return!1},yr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},yr.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},yr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},yr.prototype.isBoundaryPointInternal=function(t,n){for(var i=n.iterator();i.hasNext();){var a=i.next().getCoordinate();if(t.isIntersection(a))return!0}return!1},yr.prototype.hasProperIntersection=function(){return this._hasProper},yr.prototype.hasIntersection=function(){return this._hasIntersection},yr.prototype.isDone=function(){return this._isDone},yr.prototype.isBoundaryPoint=function(t,n){return n!==null&&(!!this.isBoundaryPointInternal(t,n[0])||!!this.isBoundaryPointInternal(t,n[1]))},yr.prototype.setBoundaryNodes=function(t,n){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=n},yr.prototype.addIntersections=function(t,n,i,a){if(t===i&&n===a)return null;this.numTests++;var f=t.getCoordinates()[n],g=t.getCoordinates()[n+1],v=i.getCoordinates()[a],S=i.getCoordinates()[a+1];this._li.computeIntersection(f,g,v,S),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),i.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,n,i,a)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,n,0),i.addIntersections(this._li,a,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},yr.prototype.interfaces_=function(){return[]},yr.prototype.getClass=function(){return yr},yr.isAdjacentSegments=function(t,n){return Math.abs(t-n)===1};var Tr=function(t){function n(){t.call(this),this.events=new j,this.nOverlaps=null}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.prepareEvents=function(){Ui.sort(this.events);for(var i=0;i<this.events.size();i++){var a=this.events.get(i);a.isDelete()&&a.getInsertEvent().setDeleteEventIndex(i)}},n.prototype.computeIntersections=function(){if(arguments.length===1){var i=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var a=0;a<this.events.size();a++){var f=this.events.get(a);if(f.isInsert()&&this.processOverlaps(a,f.getDeleteEventIndex(),f,i),i.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof yr&&yt(arguments[0],at)&&yt(arguments[1],at)){var g=arguments[0],v=arguments[1],S=arguments[2];this.addEdges(g,g),this.addEdges(v,v),this.computeIntersections(S)}else if(typeof arguments[2]=="boolean"&&yt(arguments[0],at)&&arguments[1]instanceof yr){var P=arguments[0],V=arguments[1];arguments[2]?this.addEdges(P,null):this.addEdges(P),this.computeIntersections(V)}}},n.prototype.addEdge=function(i,a){for(var f=i.getMonotoneChainEdge(),g=f.getStartIndexes(),v=0;v<g.length-1;v++){var S=new Ws(f,v),P=new ti(a,f.getMinX(v),S);this.events.add(P),this.events.add(new ti(f.getMaxX(v),P))}},n.prototype.processOverlaps=function(i,a,f,g){for(var v=f.getObject(),S=i;S<a;S++){var P=this.events.get(S);if(P.isInsert()){var V=P.getObject();f.isSameLabel(P)||(v.computeIntersections(V,g),this.nOverlaps++)}}},n.prototype.addEdges=function(){if(arguments.length===1)for(var i=arguments[0].iterator();i.hasNext();){var a=i.next();this.addEdge(a,a)}else if(arguments.length===2)for(var f=arguments[0],g=arguments[1],v=f.iterator();v.hasNext();){var S=v.next();this.addEdge(S,g)}},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(du),Dn=function(){this._min=F.POSITIVE_INFINITY,this._max=F.NEGATIVE_INFINITY},ec={NodeComparator:{configurable:!0}};Dn.prototype.getMin=function(){return this._min},Dn.prototype.intersects=function(t,n){return!(this._min>n||this._max<t)},Dn.prototype.getMax=function(){return this._max},Dn.prototype.toString=function(){return Fn.toLineString(new U(this._min,0),new U(this._max,0))},Dn.prototype.interfaces_=function(){return[]},Dn.prototype.getClass=function(){return Dn},ec.NodeComparator.get=function(){return Ha},Object.defineProperties(Dn,ec);var Ha=function(){};Ha.prototype.compare=function(t,n){var i=t,a=n,f=(i._min+i._max)/2,g=(a._min+a._max)/2;return f<g?-1:f>g?1:0},Ha.prototype.interfaces_=function(){return[et]},Ha.prototype.getClass=function(){return Ha};var nc=function(t){function n(){t.call(this),this._item=null;var i=arguments[0],a=arguments[1],f=arguments[2];this._min=i,this._max=a,this._item=f}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.query=function(i,a,f){if(!this.intersects(i,a))return null;f.visitItem(this._item)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Dn),Hf=function(t){function n(){t.call(this),this._node1=null,this._node2=null;var i=arguments[0],a=arguments[1];this._node1=i,this._node2=a,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,a){this._min=Math.min(i._min,a._min),this._max=Math.max(i._max,a._max)},n.prototype.query=function(i,a,f){if(!this.intersects(i,a))return null;this._node1!==null&&this._node1.query(i,a,f),this._node2!==null&&this._node2.query(i,a,f)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Dn),Hi=function(){this._leaves=new j,this._root=null,this._level=0};Hi.prototype.buildTree=function(){Ui.sort(this._leaves,new Dn.NodeComparator);for(var t=this._leaves,n=null,i=new j;;){if(this.buildLevel(t,i),i.size()===1)return i.get(0);n=t,t=i,i=n}},Hi.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 nc(t,n,i))},Hi.prototype.query=function(t,n,i){this.init(),this._root.query(t,n,i)},Hi.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},Hi.prototype.printNode=function(t){Ge.out.println(Fn.toLineString(new U(t._min,this._level),new U(t._max,this._level)))},Hi.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},Hi.prototype.buildLevel=function(t,n){this._level++,n.clear();for(var i=0;i<t.size();i+=2){var a=t.get(i);if((i+1<t.size()?t.get(i):null)===null)n.add(a);else{var f=new Hf(t.get(i),t.get(i+1));n.add(f)}}},Hi.prototype.interfaces_=function(){return[]},Hi.prototype.getClass=function(){return Hi};var Xo=function(){this._items=new j};Xo.prototype.visitItem=function(t){this._items.add(t)},Xo.prototype.getItems=function(){return this._items},Xo.prototype.interfaces_=function(){return[jo]},Xo.prototype.getClass=function(){return Xo};var xs=function(){this._index=null;var t=arguments[0];if(!yt(t,Qo))throw new k("Argument must be Polygonal");this._index=new ho(t)},Es={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};xs.prototype.locate=function(t){var n=new Rr(t),i=new Yo(n);return this._index.query(t.y,t.y,i),n.getLocation()},xs.prototype.interfaces_=function(){return[sa]},xs.prototype.getClass=function(){return xs},Es.SegmentVisitor.get=function(){return Yo},Es.IntervalIndexedGeometry.get=function(){return ho},Object.defineProperties(xs,Es);var Yo=function(){this._counter=null;var t=arguments[0];this._counter=t};Yo.prototype.visitItem=function(t){var n=t;this._counter.countSegment(n.getCoordinate(0),n.getCoordinate(1))},Yo.prototype.interfaces_=function(){return[jo]},Yo.prototype.getClass=function(){return Yo};var ho=function(){this._index=new Hi;var t=arguments[0];this.init(t)};ho.prototype.init=function(t){for(var n=Dt.getLines(t).iterator();n.hasNext();){var i=n.next().getCoordinates();this.addLine(i)}},ho.prototype.addLine=function(t){for(var n=1;n<t.length;n++){var i=new bt(t[n-1],t[n]),a=Math.min(i.p0.y,i.p1.y),f=Math.max(i.p0.y,i.p1.y);this._index.insert(a,f,i)}},ho.prototype.query=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1],i=new Xo;return this._index.query(t,n,i),i.getItems()}if(arguments.length===3){var a=arguments[0],f=arguments[1],g=arguments[2];this._index.query(a,f,g)}},ho.prototype.interfaces_=function(){return[]},ho.prototype.getClass=function(){return ho};var ws=function(t){function n(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new $l,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new te,arguments.length===2){var i=arguments[0],a=arguments[1],f=w.OGC_SFS_BOUNDARY_RULE;this._argIndex=i,this._parentGeom=a,this._boundaryNodeRule=f,a!==null&&this.add(a)}else if(arguments.length===3){var g=arguments[0],v=arguments[1],S=arguments[2];this._argIndex=g,this._parentGeom=v,this._boundaryNodeRule=S,v!==null&&this.add(v)}}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.insertBoundaryPoint=function(i,a){var f=this._nodes.addNode(a).getLabel(),g=1;W.NONE,f.getLocation(i,dt.ON)===W.BOUNDARY&&g++;var v=n.determineBoundary(this._boundaryNodeRule,g);f.setLocation(i,v)},n.prototype.computeSelfNodes=function(){if(arguments.length===2){var i=arguments[0],a=arguments[1];return this.computeSelfNodes(i,a,!1)}if(arguments.length===3){var f=arguments[0],g=arguments[1],v=arguments[2],S=new yr(f,!0,!1);S.setIsDoneIfProperInt(v);var P=this.createEdgeSetIntersector(),V=this._parentGeom instanceof Ki||this._parentGeom instanceof Jn||this._parentGeom instanceof Qi,tt=g||!V;return P.computeIntersections(this._edges,S,tt),this.addSelfIntersectionNodes(this._argIndex),S}},n.prototype.computeSplitEdges=function(i){for(var a=this._edges.iterator();a.hasNext();)a.next().eiList.addSplitEdges(i)},n.prototype.computeEdgeIntersections=function(i,a,f){var g=new yr(a,f,!0);return g.setBoundaryNodes(this.getBoundaryNodes(),i.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,i._edges,g),g},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 Er){var i=arguments[0].getCoordinate();this.insertPoint(this._argIndex,i,W.INTERIOR)}else if(arguments[0]instanceof U){var a=arguments[0];this.insertPoint(this._argIndex,a,W.INTERIOR)}},n.prototype.addPolygon=function(i){this.addPolygonRing(i.getExteriorRing(),W.EXTERIOR,W.INTERIOR);for(var a=0;a<i.getNumInteriorRing();a++){var f=i.getInteriorRingN(a);this.addPolygonRing(f,W.INTERIOR,W.EXTERIOR)}},n.prototype.addEdge=function(i){this.insertEdge(i);var a=i.getCoordinates();this.insertPoint(this._argIndex,a[0],W.BOUNDARY),this.insertPoint(this._argIndex,a[a.length-1],W.BOUNDARY)},n.prototype.addLineString=function(i){var a=lt.removeRepeatedPoints(i.getCoordinates());if(a.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=a[0],null;var f=new fu(a,new Ve(this._argIndex,W.INTERIOR));this._lineEdgeMap.put(i,f),this.insertEdge(f),Nt.isTrue(a.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,a[0]),this.insertBoundaryPoint(this._argIndex,a[a.length-1])},n.prototype.getInvalidPoint=function(){return this._invalidPoint},n.prototype.getBoundaryPoints=function(){for(var i=this.getBoundaryNodes(),a=new Array(i.size()).fill(null),f=0,g=i.iterator();g.hasNext();){var v=g.next();a[f++]=v.getCoordinate().copy()}return a},n.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},n.prototype.addSelfIntersectionNode=function(i,a,f){if(this.isBoundaryNode(i,a))return null;f===W.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(i,a):this.insertPoint(i,a,f)},n.prototype.addPolygonRing=function(i,a,f){if(i.isEmpty())return null;var g=lt.removeRepeatedPoints(i.getCoordinates());if(g.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=g[0],null;var v=a,S=f;mt.isCCW(g)&&(v=f,S=a);var P=new fu(g,new Ve(this._argIndex,W.BOUNDARY,v,S));this._lineEdgeMap.put(i,P),this.insertEdge(P),this.insertPoint(this._argIndex,g[0],W.BOUNDARY)},n.prototype.insertPoint=function(i,a,f){var g=this._nodes.addNode(a),v=g.getLabel();v===null?g._label=new Ve(i,f):v.setLocation(i,f)},n.prototype.createEdgeSetIntersector=function(){return new Tr},n.prototype.addSelfIntersectionNodes=function(i){for(var a=this._edges.iterator();a.hasNext();)for(var f=a.next(),g=f.getLabel().getLocation(i),v=f.eiList.iterator();v.hasNext();){var S=v.next();this.addSelfIntersectionNode(i,S.coord,g)}},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 Qi&&(this._useBoundaryDeterminationRule=!1),i instanceof Jn)this.addPolygon(i);else if(i instanceof xn)this.addLineString(i);else if(i instanceof Er)this.addPoint(i);else if(i instanceof na)this.addCollection(i);else if(i instanceof bi)this.addCollection(i);else if(i instanceof Qi)this.addCollection(i);else{if(!(i instanceof _n))throw new Error(i.getClass().getName());this.addCollection(i)}},n.prototype.addCollection=function(i){for(var a=0;a<i.getNumGeometries();a++){var f=i.getGeometryN(a);this.add(f)}},n.prototype.locate=function(i){return yt(this._parentGeom,Qo)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new xs(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,a){return i.isInBoundary(a)?W.BOUNDARY:W.INTERIOR},n}(In),Po=function(){if(this._li=new Mi,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 ws(0,t)}else if(arguments.length===2){var n=arguments[0],i=arguments[1],a=w.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 ws(0,n,a),this._arg[1]=new ws(1,i,a)}else if(arguments.length===3){var f=arguments[0],g=arguments[1],v=arguments[2];f.getPrecisionModel().compareTo(g.getPrecisionModel())>=0?this.setComputationPrecision(f.getPrecisionModel()):this.setComputationPrecision(g.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ws(0,f,v),this._arg[1]=new ws(1,g,v)}};Po.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},Po.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},Po.prototype.interfaces_=function(){return[]},Po.prototype.getClass=function(){return Po};var Ms=function(){};Ms.prototype.interfaces_=function(){return[]},Ms.prototype.getClass=function(){return Ms},Ms.map=function(){if(arguments[0]instanceof Ft&&yt(arguments[1],Ms.MapOp)){for(var t=arguments[0],n=arguments[1],i=new j,a=0;a<t.getNumGeometries();a++){var f=n.map(t.getGeometryN(a));f!==null&&i.add(f)}return t.getFactory().buildGeometry(i)}if(yt(arguments[0],K)&&yt(arguments[1],Ms.MapOp)){for(var g=arguments[0],v=arguments[1],S=new j,P=g.iterator();P.hasNext();){var V=P.next(),tt=v.map(V);tt!==null&&S.add(tt)}return S}},Ms.MapOp=function(){};var Ht=function(t){function n(){var i=arguments[0],a=arguments[1];t.call(this,i,a),this._ptLocator=new te,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new kr,this._resultPolyList=new j,this._resultLineList=new j,this._resultPointList=new j,this._graph=new In(new Ai),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 a=this._edgeList.findEqualEdge(i);if(a!==null){var f=a.getLabel(),g=i.getLabel();a.isPointwiseEqual(i)||(g=new Ve(i.getLabel())).flip();var v=a.getDepth();v.isNull()&&v.add(f),v.add(g),f.merge(g)}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 a=i.next(),f=a.getSym();a.isInResult()&&f.isInResult()&&(a.setInResult(!1),f.setInResult(!1))}},n.prototype.isCoveredByLA=function(i){return!!this.isCovered(i,this._resultLineList)||!!this.isCovered(i,this._resultPolyList)},n.prototype.computeGeometry=function(i,a,f,g){var v=new j;return v.addAll(i),v.addAll(a),v.addAll(f),v.isEmpty()?n.createEmptyResult(g,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(v)},n.prototype.mergeSymLabels=function(){for(var i=this._graph.getNodes().iterator();i.hasNext();)i.next().getEdges().mergeSymLabels()},n.prototype.isCovered=function(i,a){for(var f=a.iterator();f.hasNext();){var g=f.next();if(this._ptLocator.locate(i,g)!==W.EXTERIOR)return!0}return!1},n.prototype.replaceCollapsedEdges=function(){for(var i=new j,a=this._edgeList.iterator();a.hasNext();){var f=a.next();f.isCollapsed()&&(a.remove(),i.add(f.getCollapsedEdge()))}this._edgeList.addAll(i)},n.prototype.updateNodeLabelling=function(){for(var i=this._graph.getNodes().iterator();i.hasNext();){var a=i.next(),f=a.getEdges().getLabel();a.getLabel().merge(f)}},n.prototype.getResultGeometry=function(i){return this.computeOverlay(i),this._resultGeom},n.prototype.insertUniqueEdges=function(i){for(var a=i.iterator();a.hasNext();){var f=a.next();this.insertUniqueEdge(f)}},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 a=new j;this._arg[0].computeSplitEdges(a),this._arg[1].computeSplitEdges(a),this.insertUniqueEdges(a),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),gi.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(i),this.cancelDuplicateResultEdges();var f=new $r(this._geomFact);f.add(this._graph),this._resultPolyList=f.getPolygons();var g=new Gi(this,this._geomFact,this._ptLocator);this._resultLineList=g.build(i);var v=new qo(this,this._geomFact,this._ptLocator);this._resultPointList=v.build(i),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,i)},n.prototype.labelIncompleteNode=function(i,a){var f=this._ptLocator.locate(i.getCoordinate(),this._arg[a].getGeometry());i.getLabel().setLocation(a,f)},n.prototype.copyPoints=function(i){for(var a=this._arg[i].getNodeIterator();a.hasNext();){var f=a.next();this._graph.addNode(f.getCoordinate()).setLabel(i,f.getLabel().getLocation(i))}},n.prototype.findResultAreaEdges=function(i){for(var a=this._graph.getEdgeEnds().iterator();a.hasNext();){var f=a.next(),g=f.getLabel();g.isArea()&&!f.isInteriorAreaEdge()&&n.isResultOfOp(g.getLocation(0,dt.RIGHT),g.getLocation(1,dt.RIGHT),i)&&f.setInResult(!0)}},n.prototype.computeLabelsFromDepths=function(){for(var i=this._edgeList.iterator();i.hasNext();){var a=i.next(),f=a.getLabel(),g=a.getDepth();if(!g.isNull()){g.normalize();for(var v=0;v<2;v++)f.isNull(v)||!f.isArea()||g.isNull(v)||(g.getDelta(v)===0?f.toLine(v):(Nt.isTrue(!g.isNull(v,dt.LEFT),"depth of LEFT side has not been initialized"),f.setLocation(v,dt.LEFT,g.getLocation(v,dt.LEFT)),Nt.isTrue(!g.isNull(v,dt.RIGHT),"depth of RIGHT side has not been initialized"),f.setLocation(v,dt.RIGHT,g.getLocation(v,dt.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 a=i.next(),f=a.getLabel();a.isIsolated()&&(f.isNull(0)?this.labelIncompleteNode(a,0):this.labelIncompleteNode(a,1)),a.getEdges().updateLabelling(f)}},n.prototype.isCoveredByA=function(i){return!!this.isCovered(i,this._resultPolyList)},n.prototype.interfaces_=function(){return[]},n.prototype.getClass=function(){return n},n}(Po);Ht.overlayOp=function(t,n,i){return new Ht(t,n).getResultGeometry(i)},Ht.intersection=function(t,n){if(t.isEmpty()||n.isEmpty())return Ht.createEmptyResult(Ht.INTERSECTION,t,n,t.getFactory());if(t.isGeometryCollection()){var i=n;return Wo.map(t,{interfaces_:function(){return[Ms.MapOp]},map:function(a){return a.intersection(i)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),ur.overlayOp(t,n,Ht.INTERSECTION)},Ht.symDifference=function(t,n){if(t.isEmpty()||n.isEmpty()){if(t.isEmpty()&&n.isEmpty())return Ht.createEmptyResult(Ht.SYMDIFFERENCE,t,n,t.getFactory());if(t.isEmpty())return n.copy();if(n.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),ur.overlayOp(t,n,Ht.SYMDIFFERENCE)},Ht.resultDimension=function(t,n,i){var a=n.getDimension(),f=i.getDimension(),g=-1;switch(t){case Ht.INTERSECTION:g=Math.min(a,f);break;case Ht.UNION:g=Math.max(a,f);break;case Ht.DIFFERENCE:g=a;break;case Ht.SYMDIFFERENCE:g=Math.max(a,f)}return g},Ht.createEmptyResult=function(t,n,i,a){var f=null;switch(Ht.resultDimension(t,n,i)){case-1:f=a.createGeometryCollection(new Array(0).fill(null));break;case 0:f=a.createPoint();break;case 1:f=a.createLineString();break;case 2:f=a.createPolygon()}return f},Ht.difference=function(t,n){return t.isEmpty()?Ht.createEmptyResult(Ht.DIFFERENCE,t,n,t.getFactory()):n.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),ur.overlayOp(t,n,Ht.DIFFERENCE))},Ht.isResultOfOp=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1],i=t.getLocation(0),a=t.getLocation(1);return Ht.isResultOfOp(i,a,n)}if(arguments.length===3){var f=arguments[0],g=arguments[1],v=arguments[2];switch(f===W.BOUNDARY&&(f=W.INTERIOR),g===W.BOUNDARY&&(g=W.INTERIOR),v){case Ht.INTERSECTION:return f===W.INTERIOR&&g===W.INTERIOR;case Ht.UNION:return f===W.INTERIOR||g===W.INTERIOR;case Ht.DIFFERENCE:return f===W.INTERIOR&&g!==W.INTERIOR;case Ht.SYMDIFFERENCE:return f===W.INTERIOR&&g!==W.INTERIOR||f!==W.INTERIOR&&g===W.INTERIOR}return!1}},Ht.INTERSECTION=1,Ht.UNION=2,Ht.DIFFERENCE=3,Ht.SYMDIFFERENCE=4;var rs=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new te,this._seg=new bt;var t=arguments[0],n=arguments[1];this._g=t,this._boundaryDistanceTolerance=n,this._linework=this.extractLinework(t)};rs.prototype.isWithinToleranceOfBoundary=function(t){for(var n=0;n<this._linework.getNumGeometries();n++)for(var i=this._linework.getGeometryN(n).getCoordinateSequence(),a=0;a<i.size()-1;a++)if(i.getCoordinate(a,this._seg.p0),i.getCoordinate(a+1,this._seg.p1),this._seg.distance(t)<=this._boundaryDistanceTolerance)return!0;return!1},rs.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?W.BOUNDARY:this._ptLocator.locate(t,this._g)},rs.prototype.extractLinework=function(t){var n=new fa;t.apply(n);var i=n.getLinework(),a=Qt.toLineStringArray(i);return t.getFactory().createMultiLineString(a)},rs.prototype.interfaces_=function(){return[]},rs.prototype.getClass=function(){return rs};var fa=function(){this._linework=null,this._linework=new j};fa.prototype.getLinework=function(){return this._linework},fa.prototype.filter=function(t){if(t instanceof Jn){var n=t;this._linework.add(n.getExteriorRing());for(var i=0;i<n.getNumInteriorRing();i++)this._linework.add(n.getInteriorRingN(i))}},fa.prototype.interfaces_=function(){return[qn]},fa.prototype.getClass=function(){return fa};var Ss=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};Ss.prototype.extractPoints=function(t,n,i){for(var a=t.getCoordinates(),f=0;f<a.length-1;f++)this.computeOffsetPoints(a[f],a[f+1],n,i)},Ss.prototype.setSidesToGenerate=function(t,n){this._doLeft=t,this._doRight=n},Ss.prototype.getPoints=function(t){for(var n=new j,i=Dt.getLines(this._g).iterator();i.hasNext();){var a=i.next();this.extractPoints(a,t,n)}return n},Ss.prototype.computeOffsetPoints=function(t,n,i,a){var f=n.x-t.x,g=n.y-t.y,v=Math.sqrt(f*f+g*g),S=i*f/v,P=i*g/v,V=(n.x+t.x)/2,tt=(n.y+t.y)/2;if(this._doLeft){var nt=new U(V-P,tt+S);a.add(nt)}if(this._doRight){var vt=new U(V+P,tt-S);a.add(vt)}},Ss.prototype.interfaces_=function(){return[]},Ss.prototype.getClass=function(){return Ss};var Or=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 j;var n=arguments[0],i=arguments[1],a=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(n,i),this._geom=[n,i,a],this._locFinder=[new rs(this._geom[0],this._boundaryDistanceTolerance),new rs(this._geom[1],this._boundaryDistanceTolerance),new rs(this._geom[2],this._boundaryDistanceTolerance)]},ha={TOLERANCE:{configurable:!0}};Or.prototype.reportResult=function(t,n,i){Ge.out.println("Overlay result invalid - A:"+W.toLocationSymbol(n[0])+" B:"+W.toLocationSymbol(n[1])+" expected:"+(i?"i":"e")+" actual:"+W.toLocationSymbol(n[2]))},Or.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var n=this.checkValid(t);return n},Or.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 a=arguments[0],f=arguments[1];return this._location[0]=this._locFinder[0].getLocation(f),this._location[1]=this._locFinder[1].getLocation(f),this._location[2]=this._locFinder[2].getLocation(f),!!Or.hasLocation(this._location,W.BOUNDARY)||this.isValidResult(a,this._location)}},Or.prototype.addTestPts=function(t){var n=new Ss(t);this._testCoords.addAll(n.getPoints(5*this._boundaryDistanceTolerance))},Or.prototype.isValidResult=function(t,n){var i=Ht.isResultOfOp(n[0],n[1],t),a=!(i^n[2]===W.INTERIOR);return a||this.reportResult(t,n,i),a},Or.prototype.getInvalidLocation=function(){return this._invalidLocation},Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or},Or.hasLocation=function(t,n){for(var i=0;i<3;i++)if(t[i]===n)return!0;return!1},Or.computeBoundaryDistanceTolerance=function(t,n){return Math.min(An.computeSizeBasedSnapTolerance(t),An.computeSizeBasedSnapTolerance(n))},Or.isValid=function(t,n,i,a){return new Or(t,n,a).isValid(i)},ha.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(Or,ha);var ei=function t(n){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(n),this._inputGeoms=n};ei.prototype.extractElements=function(t,n){if(t===null)return null;for(var i=0;i<t.getNumGeometries();i++){var a=t.getGeometryN(i);this._skipEmpty&&a.isEmpty()||n.add(a)}},ei.prototype.combine=function(){for(var t=new j,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)},ei.prototype.interfaces_=function(){return[]},ei.prototype.getClass=function(){return ei},ei.combine=function(){if(arguments.length===1){var t=arguments[0];return new ei(t).combine()}if(arguments.length===2){var n=arguments[0],i=arguments[1];return new ei(ei.createList(n,i)).combine()}if(arguments.length===3){var a=arguments[0],f=arguments[1],g=arguments[2];return new ei(ei.createList(a,f,g)).combine()}},ei.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},ei.createList=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1],i=new j;return i.add(t),i.add(n),i}if(arguments.length===3){var a=arguments[0],f=arguments[1],g=arguments[2],v=new j;return v.add(a),v.add(f),v.add(g),v}};var I=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,this._inputPolys===null&&(this._inputPolys=new j)},qs={STRTREE_NODE_CAPACITY:{configurable:!0}};I.prototype.reduceToGeometries=function(t){for(var n=new j,i=t.iterator();i.hasNext();){var a=i.next(),f=null;yt(a,at)?f=this.unionTree(a):a instanceof Ft&&(f=a),n.add(f)}return n},I.prototype.extractByEnvelope=function(t,n,i){for(var a=new j,f=0;f<n.getNumGeometries();f++){var g=n.getGeometryN(f);g.getEnvelopeInternal().intersects(t)?a.add(g):i.add(g)}return this._geomFactory.buildGeometry(a)},I.prototype.unionOptimized=function(t,n){var i=t.getEnvelopeInternal(),a=n.getEnvelopeInternal();if(!i.intersects(a))return ei.combine(t,n);if(t.getNumGeometries()<=1&&n.getNumGeometries()<=1)return this.unionActual(t,n);var f=i.intersection(a);return this.unionUsingEnvelopeIntersection(t,n,f)},I.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 il(I.STRTREE_NODE_CAPACITY),n=this._inputPolys.iterator();n.hasNext();){var i=n.next();t.insert(i.getEnvelopeInternal(),i)}this._inputPolys=null;var a=t.itemsTree();return this.unionTree(a)},I.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],a=arguments[2];if(a-i<=1){var f=I.getGeometry(n,i);return this.unionSafe(f,null)}if(a-i==2)return this.unionSafe(I.getGeometry(n,i),I.getGeometry(n,i+1));var g=Math.trunc((a+i)/2),v=this.binaryUnion(n,i,g),S=this.binaryUnion(n,g,a);return this.unionSafe(v,S)}},I.prototype.repeatedUnion=function(t){for(var n=null,i=t.iterator();i.hasNext();){var a=i.next();n=n===null?a.copy():n.union(a)}return n},I.prototype.unionSafe=function(t,n){return t===null&&n===null?null:t===null?n.copy():n===null?t.copy():this.unionOptimized(t,n)},I.prototype.unionActual=function(t,n){return I.restrictToPolygons(t.union(n))},I.prototype.unionTree=function(t){var n=this.reduceToGeometries(t);return this.binaryUnion(n)},I.prototype.unionUsingEnvelopeIntersection=function(t,n,i){var a=new j,f=this.extractByEnvelope(i,t,a),g=this.extractByEnvelope(i,n,a),v=this.unionActual(f,g);return a.add(v),ei.combine(a)},I.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)}},I.prototype.interfaces_=function(){return[]},I.prototype.getClass=function(){return I},I.restrictToPolygons=function(t){if(yt(t,Qo))return t;var n=At.getPolygons(t);return n.size()===1?n.get(0):t.getFactory().createMultiPolygon(Qt.toPolygonArray(n))},I.getGeometry=function(t,n){return n>=t.size()?null:t.get(n)},I.union=function(t){return new I(t).union()},qs.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(I,qs);var bs=function(){};bs.prototype.interfaces_=function(){return[]},bs.prototype.getClass=function(){return bs},bs.union=function(t,n){if(t.isEmpty()||n.isEmpty()){if(t.isEmpty()&&n.isEmpty())return Ht.createEmptyResult(Ht.UNION,t,n,t.getFactory());if(t.isEmpty())return n.copy();if(n.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),ur.overlayOp(t,n,Ht.UNION)},o.GeoJSONReader=Ua,o.GeoJSONWriter=Fs,o.OverlayOp=Ht,o.UnionOp=bs,o.BufferOp=mr,Object.defineProperty(o,"__esModule",{value:!0})})});var Y1=It((Ju,Yl)=>{(function(){var o,e="4.17.21",r=200,u="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",l="Expected a function",h="Invalid `variable` option passed into `_.template`",p="__lodash_hash_undefined__",m=500,y="__lodash_placeholder__",x=1,E=2,b=4,M=1,C=2,D=1,G=2,O=4,L=8,k=16,F=32,$=64,Z=128,it=256,et=512,U=30,wt="...",Lt=800,Ot=16,W=1,de=2,yt=3,zt=1/0,Kt=9007199254740991,ie=17976931348623157e292,_t=NaN,Pt=4294967295,q=Pt-1,oe=Pt>>>1,Vt=[["ary",Z],["bind",D],["bindKey",G],["curry",L],["curryRight",k],["flip",et],["partial",F],["partialRight",$],["rearg",it]],tn="[object Arguments]",Mt="[object Array]",mn="[object AsyncFunction]",Vn="[object Boolean]",yn="[object Date]",Ge="[object DOMException]",an="[object Error]",Et="[object Function]",Pr="[object GeneratorFunction]",Jt="[object Map]",jn="[object Number]",hn="[object Null]",vn="[object Object]",Fn="[object Promise]",xr="[object Proxy]",ui="[object RegExp]",Nt="[object Set]",He="[object String]",wi="[object Symbol]",Mi="[object Undefined]",qr="[object WeakMap]",Rr="[object WeakSet]",mt="[object ArrayBuffer]",Ni="[object DataView]",Di="[object Float32Array]",Ft="[object Float64Array]",Si="[object Int8Array]",Os="[object Int16Array]",Y="[object Int32Array]",w="[object Uint8Array]",T="[object Uint8ClampedArray]",N="[object Uint16Array]",z="[object Uint32Array]",B=/\\b__p \\+= \'\';/g,st=/\\b(__p \\+=) \'\' \\+/g,K=/(__e\\(.*?\\)|\\b__t\\)) \\+\\n\'\';/g,ct=/&(?:amp|lt|gt|quot|#39);/g,at=/[&<>"\']/g,j=RegExp(ct.source),rt=RegExp(at.source),ft=/<%-([\\s\\S]+?)%>/g,lt=/<%([\\s\\S]+?)%>/g,Gt=/<%=([\\s\\S]+?)%>/g,kt=/\\.|\\[(?:[^[\\]]*|(["\'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,re=/^\\w*$/,Yt=/[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g,Mn=/[\\\\^$.*+?()[\\]{}|]/g,pr=RegExp(Mn.source),Wn=/^\\s+/,Cn=/\\s/,tr=/\\{(?:\\n\\/\\* \\[wrapped with .+\\] \\*\\/)?\\n?/,Ur=/\\{\\n\\/\\* \\[wrapped with (.+)\\] \\*/,Un=/,? & /,Wt=/[^\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f]+/g,Bn=/[()=,{}\\[\\]\\/\\s]/,qn=/\\\\(\\\\)?/g,zn=/\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g,_n=/\\w*$/,bi=/^[-+]0x[0-9a-f]+$/i,Xr=/^0b[01]+$/i,ea=/^\\[object .+?Constructor\\]$/,Yr=/^0o[0-7]+$/i,Ku=/^(?:0|[1-9]\\d*)$/,kn=/[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g,xn=/($^)/,La=/[\'\\n\\r\\u2028\\u2029\\\\]/g,Er="\\\\ud800-\\\\udfff",Qo="\\\\u0300-\\\\u036f",Jn="\\\\ufe20-\\\\ufe2f",na="\\\\u20d0-\\\\u20ff",Ki=Qo+Jn+na,Qi="\\\\u2700-\\\\u27bf",li="a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff",au="\\\\xac\\\\xb1\\\\xd7\\\\xf7",Na="\\\\x00-\\\\x2f\\\\x3a-\\\\x40\\\\x5b-\\\\x60\\\\x7b-\\\\xbf",Da="\\\\u2000-\\\\u206f",Oa=" \\\\t\\\\x0b\\\\f\\\\xa0\\\\ufeff\\\\n\\\\r\\\\u2028\\\\u2029\\\\u1680\\\\u180e\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200a\\\\u202f\\\\u205f\\\\u3000",Rn="A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde",Qu="\\\\ufe0e\\\\ufe0f",ji=au+Na+Da+Oa,Fa="[\'\\u2019]",$l="["+Er+"]",ue="["+ji+"]",ra="["+Ki+"]",Oi="\\\\d+",ju="["+Qi+"]",Qt="["+li+"]",tl="[^"+Er+ji+Oi+Qi+li+Rn+"]",el="\\\\ud83c[\\\\udffb-\\\\udfff]",uu="(?:"+ra+"|"+el+")",Fi="[^"+Er+"]",to="(?:\\\\ud83c[\\\\udde6-\\\\uddff]){2}",Ua="[\\\\ud800-\\\\udbff][\\\\udc00-\\\\udfff]",Fs="["+Rn+"]",dt="\\\\u200d",Ba="(?:"+Qt+"|"+tl+")",eo="(?:"+Fs+"|"+tl+")",Mo="(?:"+Fa+"(?:d|ll|m|re|s|t|ve))?",za="(?:"+Fa+"(?:D|LL|M|RE|S|T|VE))?",wr=uu+"?",un="["+Qu+"]?",Ve="(?:"+dt+"(?:"+[Fi,to,Ua].join("|")+")"+un+wr+")*",Xn="\\\\d*(?:1st|2nd|3rd|(?![123])\\\\dth)(?=\\\\b|[A-Z_])",Gf="\\\\d*(?:1ST|2ND|3RD|(?![123])\\\\dTH)(?=\\\\b|[a-z_])",Zl=un+wr+Ve,ci="(?:"+[ju,to,Ua].join("|")+")"+Zl,lu="(?:"+[Fi+ra+"?",ra,to,Ua,$l].join("|")+")",no=RegExp(Fa,"g"),on=RegExp(ra,"g"),Us=RegExp(el+"(?="+el+")|"+lu+Zl,"g"),Mr=RegExp([Fs+"?"+Qt+"+"+Mo+"(?="+[ue,Fs,"$"].join("|")+")",eo+"+"+za+"(?="+[ue,Fs+Ba,"$"].join("|")+")",Fs+"?"+Ba+"+"+Mo,Fs+"+"+za,Gf,Xn,Oi,ci].join("|"),"g"),nl=RegExp("["+dt+Er+Ki+Qu+"]"),ia=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,In=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],$r=-1,gn={};gn[Di]=gn[Ft]=gn[Si]=gn[Os]=gn[Y]=gn[w]=gn[T]=gn[N]=gn[z]=!0,gn[tn]=gn[Mt]=gn[mt]=gn[Vn]=gn[Ni]=gn[yn]=gn[an]=gn[Et]=gn[Jt]=gn[jn]=gn[vn]=gn[ui]=gn[Nt]=gn[He]=gn[qr]=!1;var le={};le[tn]=le[Mt]=le[mt]=le[Ni]=le[Vn]=le[yn]=le[Di]=le[Ft]=le[Si]=le[Os]=le[Y]=le[Jt]=le[jn]=le[vn]=le[ui]=le[Nt]=le[He]=le[wi]=le[w]=le[T]=le[N]=le[z]=!0,le[an]=le[Et]=le[qr]=!1;var Bo={\\u00C0:"A",\\u00C1:"A",\\u00C2:"A",\\u00C3:"A",\\u00C4:"A",\\u00C5:"A",\\u00E0:"a",\\u00E1:"a",\\u00E2:"a",\\u00E3:"a",\\u00E4:"a",\\u00E5:"a",\\u00C7:"C",\\u00E7:"c",\\u00D0:"D",\\u00F0:"d",\\u00C8:"E",\\u00C9:"E",\\u00CA:"E",\\u00CB:"E",\\u00E8:"e",\\u00E9:"e",\\u00EA:"e",\\u00EB:"e",\\u00CC:"I",\\u00CD:"I",\\u00CE:"I",\\u00CF:"I",\\u00EC:"i",\\u00ED:"i",\\u00EE:"i",\\u00EF:"i",\\u00D1:"N",\\u00F1:"n",\\u00D2:"O",\\u00D3:"O",\\u00D4:"O",\\u00D5:"O",\\u00D6:"O",\\u00D8:"O",\\u00F2:"o",\\u00F3:"o",\\u00F4:"o",\\u00F5:"o",\\u00F6:"o",\\u00F8:"o",\\u00D9:"U",\\u00DA:"U",\\u00DB:"U",\\u00DC:"U",\\u00F9:"u",\\u00FA:"u",\\u00FB:"u",\\u00FC:"u",\\u00DD:"Y",\\u00FD:"y",\\u00FF:"y",\\u00C6:"Ae",\\u00E6:"ae",\\u00DE:"Th",\\u00FE:"th",\\u00DF:"ss",\\u0100:"A",\\u0102:"A",\\u0104:"A",\\u0101:"a",\\u0103:"a",\\u0105:"a",\\u0106:"C",\\u0108:"C",\\u010A:"C",\\u010C:"C",\\u0107:"c",\\u0109:"c",\\u010B:"c",\\u010D:"c",\\u010E:"D",\\u0110:"D",\\u010F:"d",\\u0111:"d",\\u0112:"E",\\u0114:"E",\\u0116:"E",\\u0118:"E",\\u011A:"E",\\u0113:"e",\\u0115:"e",\\u0117:"e",\\u0119:"e",\\u011B:"e",\\u011C:"G",\\u011E:"G",\\u0120:"G",\\u0122:"G",\\u011D:"g",\\u011F:"g",\\u0121:"g",\\u0123:"g",\\u0124:"H",\\u0126:"H",\\u0125:"h",\\u0127:"h",\\u0128:"I",\\u012A:"I",\\u012C:"I",\\u012E:"I",\\u0130:"I",\\u0129:"i",\\u012B:"i",\\u012D:"i",\\u012F:"i",\\u0131:"i",\\u0134:"J",\\u0135:"j",\\u0136:"K",\\u0137:"k",\\u0138:"k",\\u0139:"L",\\u013B:"L",\\u013D:"L",\\u013F:"L",\\u0141:"L",\\u013A:"l",\\u013C:"l",\\u013E:"l",\\u0140:"l",\\u0142:"l",\\u0143:"N",\\u0145:"N",\\u0147:"N",\\u014A:"N",\\u0144:"n",\\u0146:"n",\\u0148:"n",\\u014B:"n",\\u014C:"O",\\u014E:"O",\\u0150:"O",\\u014D:"o",\\u014F:"o",\\u0151:"o",\\u0154:"R",\\u0156:"R",\\u0158:"R",\\u0155:"r",\\u0157:"r",\\u0159:"r",\\u015A:"S",\\u015C:"S",\\u015E:"S",\\u0160:"S",\\u015B:"s",\\u015D:"s",\\u015F:"s",\\u0161:"s",\\u0162:"T",\\u0164:"T",\\u0166:"T",\\u0163:"t",\\u0165:"t",\\u0167:"t",\\u0168:"U",\\u016A:"U",\\u016C:"U",\\u016E:"U",\\u0170:"U",\\u0172:"U",\\u0169:"u",\\u016B:"u",\\u016D:"u",\\u016F:"u",\\u0171:"u",\\u0173:"u",\\u0174:"W",\\u0175:"w",\\u0176:"Y",\\u0177:"y",\\u0178:"Y",\\u0179:"Z",\\u017B:"Z",\\u017D:"Z",\\u017A:"z",\\u017C:"z",\\u017E:"z",\\u0132:"IJ",\\u0133:"ij",\\u0152:"Oe",\\u0153:"oe",\\u0149:"\'n",\\u017F:"s"},jo={"&":"&","<":"<",">":">",\'"\':""","\'":"'"},Bs={"&":"&","<":"<",">":">",""":\'"\',"'":"\'"},Kn={"\\\\":"\\\\","\'":"\'","\\n":"n","\\r":"r","\\u2028":"u2028","\\u2029":"u2029"},Jl=parseFloat,Ui=parseInt,Gn=typeof global=="object"&&global&&global.Object===Object&&global,or=typeof self=="object"&&self&&self.Object===Object&&self,sr=Gn||or||Function("return this")(),rl=typeof Ju=="object"&&Ju&&!Ju.nodeType&&Ju,ro=rl&&typeof Yl=="object"&&Yl&&!Yl.nodeType&&Yl,il=ro&&ro.exports===rl,cu=il&&Gn.process,Sn=function(){try{var J=ro&&ro.require&&ro.require("util").types;return J||cu&&cu.binding&&cu.binding("util")}catch{}}(),zo=Sn&&Sn.isArrayBuffer,Sr=Sn&&Sn.isDate,ds=Sn&&Sn.isMap,io=Sn&&Sn.isRegExp,oa=Sn&&Sn.isSet,Ln=Sn&&Sn.isTypedArray;function bt(J,ut,ot){switch(ot.length){case 0:return J.call(ut);case 1:return J.call(ut,ot[0]);case 2:return J.call(ut,ot[0],ot[1]);case 3:return J.call(ut,ot[0],ot[1],ot[2])}return J.apply(ut,ot)}function Kl(J,ut,ot,At){for(var Dt=-1,te=J==null?0:J.length;++Dt<te;){var ge=J[Dt];ut(At,ge,ot(ge),J)}return At}function Zr(J,ut){for(var ot=-1,At=J==null?0:J.length;++ot<At&&ut(J[ot],ot,J)!==!1;);return J}function Jr(J,ut){for(var ot=J==null?0:J.length;ot--&&ut(J[ot],ot,J)!==!1;);return J}function Bi(J,ut){for(var ot=-1,At=J==null?0:J.length;++ot<At;)if(!ut(J[ot],ot,J))return!1;return!0}function fi(J,ut){for(var ot=-1,At=J==null?0:J.length,Dt=0,te=[];++ot<At;){var ge=J[ot];ut(ge,ot,J)&&(te[Dt++]=ge)}return te}function gs(J,ut){var ot=J==null?0:J.length;return!!ot&&ko(J,ut,0)>-1}function ka(J,ut,ot){for(var At=-1,Dt=J==null?0:J.length;++At<Dt;)if(ot(ut,J[At]))return!0;return!1}function Hn(J,ut){for(var ot=-1,At=J==null?0:J.length,Dt=Array(At);++ot<At;)Dt[ot]=ut(J[ot],ot,J);return Dt}function jt(J,ut){for(var ot=-1,At=ut.length,Dt=J.length;++ot<At;)J[Dt+ot]=ut[ot];return J}function oo(J,ut,ot,At){var Dt=-1,te=J==null?0:J.length;for(At&&te&&(ot=J[++Dt]);++Dt<te;)ot=ut(ot,J[Dt],Dt,J);return ot}function Nn(J,ut,ot,At){var Dt=J==null?0:J.length;for(At&&Dt&&(ot=J[--Dt]);Dt--;)ot=ut(ot,J[Dt],Dt,J);return ot}function zs(J,ut){for(var ot=-1,At=J==null?0:J.length;++ot<At;)if(ut(J[ot],ot,J))return!0;return!1}var hi=Go("length");function Ql(J){return J.split("")}function ee(J){return J.match(Wt)||[]}function ms(J,ut,ot){var At;return ot(J,function(Dt,te,ge){if(ut(Dt,te,ge))return At=te,!1}),At}function ln(J,ut,ot,At){for(var Dt=J.length,te=ot+(At?1:-1);At?te--:++te<Dt;)if(ut(J[te],te,J))return te;return-1}function ko(J,ut,ot){return ut===ut?Ga(J,ut,ot):ln(J,ys,ot)}function Br(J,ut,ot,At){for(var Dt=ot-1,te=J.length;++Dt<te;)if(At(J[Dt],ut))return Dt;return-1}function ys(J){return J!==J}function ol(J,ut){var ot=J==null?0:J.length;return ot?zi(J,ut)/ot:_t}function Go(J){return function(ut){return ut==null?o:ut[J]}}function se(J){return function(ut){return J==null?o:J[ut]}}function pi(J,ut,ot,At,Dt){return Dt(J,function(te,ge,bn){ot=At?(At=!1,te):ut(ot,te,ge,bn)}),ot}function sa(J,ut){var ot=J.length;for(J.sort(ut);ot--;)J[ot]=J[ot].value;return J}function zi(J,ut){for(var ot,At=-1,Dt=J.length;++At<Dt;){var te=ut(J[At]);te!==o&&(ot=ot===o?te:ot+te)}return ot}function zr(J,ut){for(var ot=-1,At=Array(J);++ot<J;)At[ot]=ut(ot);return At}function br(J,ut){return Hn(ut,function(ot){return[ot,J[ot]]})}function jl(J){return J&&J.slice(0,_s(J)+1).replace(Wn,"")}function Ai(J){return function(ut){return J(ut)}}function So(J,ut){return Hn(ut,function(ot){return J[ot]})}function kr(J,ut){return J.has(ut)}function ts(J,ut){for(var ot=-1,At=J.length;++ot<At&&ko(ut,J[ot],0)>-1;);return ot}function Kr(J,ut){for(var ot=J.length;ot--&&ko(ut,J[ot],0)>-1;);return ot}function so(J,ut){for(var ot=J.length,At=0;ot--;)J[ot]===ut&&++At;return At}var bo=se(Bo),vs=se(jo);function Ho(J){return"\\\\"+Kn[J]}function dr(J,ut){return J==null?o:J[ut]}function ks(J){return nl.test(J)}function fu(J){return ia.test(J)}function Lr(J){for(var ut,ot=[];!(ut=J.next()).done;)ot.push(ut.value);return ot}function Ao(J){var ut=-1,ot=Array(J.size);return J.forEach(function(At,Dt){ot[++ut]=[Dt,At]}),ot}function ki(J,ut){return function(ot){return J(ut(ot))}}function es(J,ut){for(var ot=-1,At=J.length,Dt=0,te=[];++ot<At;){var ge=J[ot];(ge===ut||ge===y)&&(J[ot]=y,te[Dt++]=ot)}return te}function gr(J){var ut=-1,ot=Array(J.size);return J.forEach(function(At){ot[++ut]=At}),ot}function tc(J){var ut=-1,ot=Array(J.size);return J.forEach(function(At){ot[++ut]=[At,At]}),ot}function Ga(J,ut,ot){for(var At=ot-1,Dt=J.length;++At<Dt;)if(J[At]===ut)return At;return-1}function aa(J,ut,ot){for(var At=ot+1;At--;)if(J[At]===ut)return At;return At}function Gs(J){return ks(J)?mr(J):hi(J)}function ao(J){return ks(J)?ua(J):Ql(J)}function _s(J){for(var ut=J.length;ut--&&Cn.test(J.charAt(ut)););return ut}var To=se(Bs);function mr(J){for(var ut=Us.lastIndex=0;Us.test(J);)++ut;return ut}function ua(J){return J.match(Us)||[]}function Nr(J){return J.match(Mr)||[]}var Co=function J(ut){ut=ut==null?sr:di.defaults(sr.Object(),ut,di.pick(sr,In));var ot=ut.Array,At=ut.Date,Dt=ut.Error,te=ut.Function,ge=ut.Math,bn=ut.Object,Io=ut.RegExp,Hs=ut.String,pn=ut.TypeError,er=ot.prototype,uo=te.prototype,Ar=bn.prototype,la=ut["__core-js_shared__"],Vo=uo.toString,fe=Ar.hasOwnProperty,Qr=0,hu=function(){var s=/[^.]+$/.exec(la&&la.keys&&la.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}(),Qn=Ar.toString,sl=Vo.call(bn),lo=sr._,ar=Io("^"+Vo.call(fe).replace(Mn,"\\\\$&").replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g,"$1.*?")+"$"),jr=il?ut.Buffer:o,gi=ut.Symbol,Wo=ut.Uint8Array,Gi=jr?jr.allocUnsafe:o,qo=ki(bn.getPrototypeOf,bn),Dr=bn.create,co=Ar.propertyIsEnumerable,An=er.splice,al=gi?gi.isConcatSpreadable:o,ca=gi?gi.iterator:o,Yn=gi?gi.toStringTag:o,fo=function(){try{var s=Xa(bn,"defineProperty");return s({},"",{}),s}catch{}}(),ul=ut.clearTimeout!==sr.clearTimeout&&ut.clearTimeout,Vs=At&&At.now!==sr.Date.now&&At.now,ns=ut.setTimeout!==sr.setTimeout&&ut.setTimeout,$n=ge.ceil,ur=ge.floor,Ws=bn.getOwnPropertySymbols,ti=jr?jr.isBuffer:o,pu=ut.isFinite,du=er.join,yr=ki(bn.keys,bn),Tr=ge.max,Dn=ge.min,ec=At.now,Ha=ut.parseInt,nc=ge.random,Hf=er.reverse,Hi=Xa(ut,"DataView"),Xo=Xa(ut,"Map"),xs=Xa(ut,"Promise"),Es=Xa(ut,"Set"),Yo=Xa(ut,"WeakMap"),ho=Xa(bn,"create"),ws=Yo&&new Yo,Po={},Ms=Ya(Hi),Ht=Ya(Xo),rs=Ya(xs),fa=Ya(Es),Ss=Ya(Yo),Or=gi?gi.prototype:o,ha=Or?Or.valueOf:o,ei=Or?Or.toString:o;function I(s){if(vr(s)&&!ne(s)&&!(s instanceof n)){if(s instanceof t)return s;if(fe.call(s,"__wrapped__"))return Qg(s)}return new t(s)}var qs=function(){function s(){}return function(c){if(!lr(c))return{};if(Dr)return Dr(c);s.prototype=c;var d=new s;return s.prototype=o,d}}();function bs(){}function t(s,c){this.__wrapped__=s,this.__actions__=[],this.__chain__=!!c,this.__index__=0,this.__values__=o}I.templateSettings={escape:ft,evaluate:lt,interpolate:Gt,variable:"",imports:{_:I}},I.prototype=bs.prototype,I.prototype.constructor=I,t.prototype=qs(bs.prototype),t.prototype.constructor=t;function n(s){this.__wrapped__=s,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Pt,this.__views__=[]}function i(){var s=new n(this.__wrapped__);return s.__actions__=po(this.__actions__),s.__dir__=this.__dir__,s.__filtered__=this.__filtered__,s.__iteratees__=po(this.__iteratees__),s.__takeCount__=this.__takeCount__,s.__views__=po(this.__views__),s}function a(){if(this.__filtered__){var s=new n(this);s.__dir__=-1,s.__filtered__=!0}else s=this.clone(),s.__dir__*=-1;return s}function f(){var s=this.__wrapped__.value(),c=this.__dir__,d=ne(s),_=c<0,A=d?s.length:0,R=jx(0,A,this.__views__),H=R.start,X=R.end,Q=X-H,ht=_?X:H-1,pt=this.__iteratees__,gt=pt.length,Ct=0,Bt=Dn(Q,this.__takeCount__);if(!d||!_&&A==Q&&Bt==Q)return Eg(s,this.__actions__);var $t=[];t:for(;Q--&&Ct<Bt;){ht+=c;for(var ce=-1,Zt=s[ht];++ce<gt;){var qe=pt[ce],sn=qe.iteratee,Do=qe.type,qi=sn(Zt);if(Do==de)Zt=qi;else if(!qi){if(Do==W)continue t;break t}}$t[Ct++]=Zt}return $t}n.prototype=qs(bs.prototype),n.prototype.constructor=n;function g(s){var c=-1,d=s==null?0:s.length;for(this.clear();++c<d;){var _=s[c];this.set(_[0],_[1])}}function v(){this.__data__=ho?ho(null):{},this.size=0}function S(s){var c=this.has(s)&&delete this.__data__[s];return this.size-=c?1:0,c}function P(s){var c=this.__data__;if(ho){var d=c[s];return d===p?o:d}return fe.call(c,s)?c[s]:o}function V(s){var c=this.__data__;return ho?c[s]!==o:fe.call(c,s)}function tt(s,c){var d=this.__data__;return this.size+=this.has(s)?0:1,d[s]=ho&&c===o?p:c,this}g.prototype.clear=v,g.prototype.delete=S,g.prototype.get=P,g.prototype.has=V,g.prototype.set=tt;function nt(s){var c=-1,d=s==null?0:s.length;for(this.clear();++c<d;){var _=s[c];this.set(_[0],_[1])}}function vt(){this.__data__=[],this.size=0}function xt(s){var c=this.__data__,d=rc(c,s);if(d<0)return!1;var _=c.length-1;return d==_?c.pop():An.call(c,d,1),--this.size,!0}function Tt(s){var c=this.__data__,d=rc(c,s);return d<0?o:c[d][1]}function Ut(s){return rc(this.__data__,s)>-1}function We(s,c){var d=this.__data__,_=rc(d,s);return _<0?(++this.size,d.push([s,c])):d[_][1]=c,this}nt.prototype.clear=vt,nt.prototype.delete=xt,nt.prototype.get=Tt,nt.prototype.has=Ut,nt.prototype.set=We;function cn(s){var c=-1,d=s==null?0:s.length;for(this.clear();++c<d;){var _=s[c];this.set(_[0],_[1])}}function Fr(){this.size=0,this.__data__={hash:new g,map:new(Xo||nt),string:new g}}function Ro(s){var c=gc(this,s).delete(s);return this.size-=c?1:0,c}function is(s){return gc(this,s).get(s)}function ll(s){return gc(this,s).has(s)}function nx(s,c){var d=gc(this,s),_=d.size;return d.set(s,c),this.size+=d.size==_?0:1,this}cn.prototype.clear=Fr,cn.prototype.delete=Ro,cn.prototype.get=is,cn.prototype.has=ll,cn.prototype.set=nx;function Va(s){var c=-1,d=s==null?0:s.length;for(this.__data__=new cn;++c<d;)this.add(s[c])}function rx(s){return this.__data__.set(s,p),this}function ix(s){return this.__data__.has(s)}Va.prototype.add=Va.prototype.push=rx,Va.prototype.has=ix;function os(s){var c=this.__data__=new nt(s);this.size=c.size}function ox(){this.__data__=new nt,this.size=0}function sx(s){var c=this.__data__,d=c.delete(s);return this.size=c.size,d}function ax(s){return this.__data__.get(s)}function ux(s){return this.__data__.has(s)}function lx(s,c){var d=this.__data__;if(d instanceof nt){var _=d.__data__;if(!Xo||_.length<r-1)return _.push([s,c]),this.size=++d.size,this;d=this.__data__=new cn(_)}return d.set(s,c),this.size=d.size,this}os.prototype.clear=ox,os.prototype.delete=sx,os.prototype.get=ax,os.prototype.has=ux,os.prototype.set=lx;function Qd(s,c){var d=ne(s),_=!d&&$a(s),A=!d&&!_&&ya(s),R=!d&&!_&&!A&&vu(s),H=d||_||A||R,X=H?zr(s.length,Hs):[],Q=X.length;for(var ht in s)(c||fe.call(s,ht))&&!(H&&(ht=="length"||A&&(ht=="offset"||ht=="parent")||R&&(ht=="buffer"||ht=="byteLength"||ht=="byteOffset")||Zs(ht,Q)))&&X.push(ht);return X}function jd(s){var c=s.length;return c?s[jf(0,c-1)]:o}function cx(s,c){return mc(po(s),Wa(c,0,s.length))}function fx(s){return mc(po(s))}function Vf(s,c,d){(d!==o&&!ss(s[c],d)||d===o&&!(c in s))&&Xs(s,c,d)}function cl(s,c,d){var _=s[c];(!(fe.call(s,c)&&ss(_,d))||d===o&&!(c in s))&&Xs(s,c,d)}function rc(s,c){for(var d=s.length;d--;)if(ss(s[d][0],c))return d;return-1}function hx(s,c,d,_){return pa(s,function(A,R,H){c(_,A,d(A),H)}),_}function tg(s,c){return s&&Ts(c,ni(c),s)}function px(s,c){return s&&Ts(c,mo(c),s)}function Xs(s,c,d){c=="__proto__"&&fo?fo(s,c,{configurable:!0,enumerable:!0,value:d,writable:!0}):s[c]=d}function Wf(s,c){for(var d=-1,_=c.length,A=ot(_),R=s==null;++d<_;)A[d]=R?o:Sh(s,c[d]);return A}function Wa(s,c,d){return s===s&&(d!==o&&(s=s<=d?s:d),c!==o&&(s=s>=c?s:c)),s}function $o(s,c,d,_,A,R){var H,X=c&x,Q=c&E,ht=c&b;if(d&&(H=A?d(s,_,A,R):d(s)),H!==o)return H;if(!lr(s))return s;var pt=ne(s);if(pt){if(H=eE(s),!X)return po(s,H)}else{var gt=Ti(s),Ct=gt==Et||gt==Pr;if(ya(s))return Sg(s,X);if(gt==vn||gt==tn||Ct&&!A){if(H=Q||Ct?{}:Vg(s),!X)return Q?Wx(s,px(H,s)):Vx(s,tg(H,s))}else{if(!le[gt])return A?s:{};H=nE(s,gt,X)}}R||(R=new os);var Bt=R.get(s);if(Bt)return Bt;R.set(s,H),vm(s)?s.forEach(function(Zt){H.add($o(Zt,c,d,Zt,s,R))}):mm(s)&&s.forEach(function(Zt,qe){H.set(qe,$o(Zt,c,d,qe,s,R))});var $t=ht?Q?ch:lh:Q?mo:ni,ce=pt?o:$t(s);return Zr(ce||s,function(Zt,qe){ce&&(qe=Zt,Zt=s[qe]),cl(H,qe,$o(Zt,c,d,qe,s,R))}),H}function dx(s){var c=ni(s);return function(d){return eg(d,s,c)}}function eg(s,c,d){var _=d.length;if(s==null)return!_;for(s=bn(s);_--;){var A=d[_],R=c[A],H=s[A];if(H===o&&!(A in s)||!R(H))return!1}return!0}function ng(s,c,d){if(typeof s!="function")throw new pn(l);return yl(function(){s.apply(o,d)},c)}function fl(s,c,d,_){var A=-1,R=gs,H=!0,X=s.length,Q=[],ht=c.length;if(!X)return Q;d&&(c=Hn(c,Ai(d))),_?(R=ka,H=!1):c.length>=r&&(R=kr,H=!1,c=new Va(c));t:for(;++A<X;){var pt=s[A],gt=d==null?pt:d(pt);if(pt=_||pt!==0?pt:0,H&>===gt){for(var Ct=ht;Ct--;)if(c[Ct]===gt)continue t;Q.push(pt)}else R(c,gt,_)||Q.push(pt)}return Q}var pa=Ig(As),rg=Ig(Xf,!0);function gx(s,c){var d=!0;return pa(s,function(_,A,R){return d=!!c(_,A,R),d}),d}function ic(s,c,d){for(var _=-1,A=s.length;++_<A;){var R=s[_],H=c(R);if(H!=null&&(X===o?H===H&&!No(H):d(H,X)))var X=H,Q=R}return Q}function mx(s,c,d,_){var A=s.length;for(d=ae(d),d<0&&(d=-d>A?0:A+d),_=_===o||_>A?A:ae(_),_<0&&(_+=A),_=d>_?0:xm(_);d<_;)s[d++]=c;return s}function ig(s,c){var d=[];return pa(s,function(_,A,R){c(_,A,R)&&d.push(_)}),d}function mi(s,c,d,_,A){var R=-1,H=s.length;for(d||(d=iE),A||(A=[]);++R<H;){var X=s[R];c>0&&d(X)?c>1?mi(X,c-1,d,_,A):jt(A,X):_||(A[A.length]=X)}return A}var qf=Pg(),og=Pg(!0);function As(s,c){return s&&qf(s,c,ni)}function Xf(s,c){return s&&og(s,c,ni)}function oc(s,c){return fi(c,function(d){return Js(s[d])})}function qa(s,c){c=ga(c,s);for(var d=0,_=c.length;s!=null&&d<_;)s=s[Cs(c[d++])];return d&&d==_?s:o}function sg(s,c,d){var _=c(s);return ne(s)?_:jt(_,d(s))}function Vi(s){return s==null?s===o?Mi:hn:Yn&&Yn in bn(s)?Qx(s):fE(s)}function Yf(s,c){return s>c}function yx(s,c){return s!=null&&fe.call(s,c)}function vx(s,c){return s!=null&&c in bn(s)}function _x(s,c,d){return s>=Dn(c,d)&&s<Tr(c,d)}function $f(s,c,d){for(var _=d?ka:gs,A=s[0].length,R=s.length,H=R,X=ot(R),Q=1/0,ht=[];H--;){var pt=s[H];H&&c&&(pt=Hn(pt,Ai(c))),Q=Dn(pt.length,Q),X[H]=!d&&(c||A>=120&&pt.length>=120)?new Va(H&&pt):o}pt=s[0];var gt=-1,Ct=X[0];t:for(;++gt<A&&ht.length<Q;){var Bt=pt[gt],$t=c?c(Bt):Bt;if(Bt=d||Bt!==0?Bt:0,!(Ct?kr(Ct,$t):_(ht,$t,d))){for(H=R;--H;){var ce=X[H];if(!(ce?kr(ce,$t):_(s[H],$t,d)))continue t}Ct&&Ct.push($t),ht.push(Bt)}}return ht}function xx(s,c,d,_){return As(s,function(A,R,H){c(_,d(A),R,H)}),_}function hl(s,c,d){c=ga(c,s),s=Yg(s,c);var _=s==null?s:s[Cs(Jo(c))];return _==null?o:bt(_,s,d)}function ag(s){return vr(s)&&Vi(s)==tn}function Ex(s){return vr(s)&&Vi(s)==mt}function wx(s){return vr(s)&&Vi(s)==yn}function pl(s,c,d,_,A){return s===c?!0:s==null||c==null||!vr(s)&&!vr(c)?s!==s&&c!==c:Mx(s,c,d,_,pl,A)}function Mx(s,c,d,_,A,R){var H=ne(s),X=ne(c),Q=H?Mt:Ti(s),ht=X?Mt:Ti(c);Q=Q==tn?vn:Q,ht=ht==tn?vn:ht;var pt=Q==vn,gt=ht==vn,Ct=Q==ht;if(Ct&&ya(s)){if(!ya(c))return!1;H=!0,pt=!1}if(Ct&&!pt)return R||(R=new os),H||vu(s)?kg(s,c,d,_,A,R):Jx(s,c,Q,d,_,A,R);if(!(d&M)){var Bt=pt&&fe.call(s,"__wrapped__"),$t=gt&&fe.call(c,"__wrapped__");if(Bt||$t){var ce=Bt?s.value():s,Zt=$t?c.value():c;return R||(R=new os),A(ce,Zt,d,_,R)}}return Ct?(R||(R=new os),Kx(s,c,d,_,A,R)):!1}function Sx(s){return vr(s)&&Ti(s)==Jt}function Zf(s,c,d,_){var A=d.length,R=A,H=!_;if(s==null)return!R;for(s=bn(s);A--;){var X=d[A];if(H&&X[2]?X[1]!==s[X[0]]:!(X[0]in s))return!1}for(;++A<R;){X=d[A];var Q=X[0],ht=s[Q],pt=X[1];if(H&&X[2]){if(ht===o&&!(Q in s))return!1}else{var gt=new os;if(_)var Ct=_(ht,pt,Q,s,c,gt);if(!(Ct===o?pl(pt,ht,M|C,_,gt):Ct))return!1}}return!0}function ug(s){if(!lr(s)||sE(s))return!1;var c=Js(s)?ar:ea;return c.test(Ya(s))}function bx(s){return vr(s)&&Vi(s)==ui}function Ax(s){return vr(s)&&Ti(s)==Nt}function Tx(s){return vr(s)&&wc(s.length)&&!!gn[Vi(s)]}function lg(s){return typeof s=="function"?s:s==null?yo:typeof s=="object"?ne(s)?hg(s[0],s[1]):fg(s):Rm(s)}function Jf(s){if(!ml(s))return yr(s);var c=[];for(var d in bn(s))fe.call(s,d)&&d!="constructor"&&c.push(d);return c}function Cx(s){if(!lr(s))return cE(s);var c=ml(s),d=[];for(var _ in s)_=="constructor"&&(c||!fe.call(s,_))||d.push(_);return d}function Kf(s,c){return s<c}function cg(s,c){var d=-1,_=go(s)?ot(s.length):[];return pa(s,function(A,R,H){_[++d]=c(A,R,H)}),_}function fg(s){var c=hh(s);return c.length==1&&c[0][2]?qg(c[0][0],c[0][1]):function(d){return d===s||Zf(d,s,c)}}function hg(s,c){return dh(s)&&Wg(c)?qg(Cs(s),c):function(d){var _=Sh(d,s);return _===o&&_===c?bh(d,s):pl(c,_,M|C)}}function sc(s,c,d,_,A){s!==c&&qf(c,function(R,H){if(A||(A=new os),lr(R))Ix(s,c,H,d,sc,_,A);else{var X=_?_(mh(s,H),R,H+"",s,c,A):o;X===o&&(X=R),Vf(s,H,X)}},mo)}function Ix(s,c,d,_,A,R,H){var X=mh(s,d),Q=mh(c,d),ht=H.get(Q);if(ht){Vf(s,d,ht);return}var pt=R?R(X,Q,d+"",s,c,H):o,gt=pt===o;if(gt){var Ct=ne(Q),Bt=!Ct&&ya(Q),$t=!Ct&&!Bt&&vu(Q);pt=Q,Ct||Bt||$t?ne(X)?pt=X:Cr(X)?pt=po(X):Bt?(gt=!1,pt=Sg(Q,!0)):$t?(gt=!1,pt=bg(Q,!0)):pt=[]:vl(Q)||$a(Q)?(pt=X,$a(X)?pt=Em(X):(!lr(X)||Js(X))&&(pt=Vg(Q))):gt=!1}gt&&(H.set(Q,pt),A(pt,Q,_,R,H),H.delete(Q)),Vf(s,d,pt)}function pg(s,c){var d=s.length;if(d)return c+=c<0?d:0,Zs(c,d)?s[c]:o}function dg(s,c,d){c.length?c=Hn(c,function(R){return ne(R)?function(H){return qa(H,R.length===1?R[0]:R)}:R}):c=[yo];var _=-1;c=Hn(c,Ai(qt()));var A=cg(s,function(R,H,X){var Q=Hn(c,function(ht){return ht(R)});return{criteria:Q,index:++_,value:R}});return sa(A,function(R,H){return Hx(R,H,d)})}function Px(s,c){return gg(s,c,function(d,_){return bh(s,_)})}function gg(s,c,d){for(var _=-1,A=c.length,R={};++_<A;){var H=c[_],X=qa(s,H);d(X,H)&&dl(R,ga(H,s),X)}return R}function Rx(s){return function(c){return qa(c,s)}}function Qf(s,c,d,_){var A=_?Br:ko,R=-1,H=c.length,X=s;for(s===c&&(c=po(c)),d&&(X=Hn(s,Ai(d)));++R<H;)for(var Q=0,ht=c[R],pt=d?d(ht):ht;(Q=A(X,pt,Q,_))>-1;)X!==s&&An.call(X,Q,1),An.call(s,Q,1);return s}function mg(s,c){for(var d=s?c.length:0,_=d-1;d--;){var A=c[d];if(d==_||A!==R){var R=A;Zs(A)?An.call(s,A,1):nh(s,A)}}return s}function jf(s,c){return s+ur(nc()*(c-s+1))}function Lx(s,c,d,_){for(var A=-1,R=Tr($n((c-s)/(d||1)),0),H=ot(R);R--;)H[_?R:++A]=s,s+=d;return H}function th(s,c){var d="";if(!s||c<1||c>Kt)return d;do c%2&&(d+=s),c=ur(c/2),c&&(s+=s);while(c);return d}function he(s,c){return yh(Xg(s,c,yo),s+"")}function Nx(s){return jd(_u(s))}function Dx(s,c){var d=_u(s);return mc(d,Wa(c,0,d.length))}function dl(s,c,d,_){if(!lr(s))return s;c=ga(c,s);for(var A=-1,R=c.length,H=R-1,X=s;X!=null&&++A<R;){var Q=Cs(c[A]),ht=d;if(Q==="__proto__"||Q==="constructor"||Q==="prototype")return s;if(A!=H){var pt=X[Q];ht=_?_(pt,Q,X):o,ht===o&&(ht=lr(pt)?pt:Zs(c[A+1])?[]:{})}cl(X,Q,ht),X=X[Q]}return s}var yg=ws?function(s,c){return ws.set(s,c),s}:yo,Ox=fo?function(s,c){return fo(s,"toString",{configurable:!0,enumerable:!1,value:Th(c),writable:!0})}:yo;function Fx(s){return mc(_u(s))}function Zo(s,c,d){var _=-1,A=s.length;c<0&&(c=-c>A?0:A+c),d=d>A?A:d,d<0&&(d+=A),A=c>d?0:d-c>>>0,c>>>=0;for(var R=ot(A);++_<A;)R[_]=s[_+c];return R}function Ux(s,c){var d;return pa(s,function(_,A,R){return d=c(_,A,R),!d}),!!d}function ac(s,c,d){var _=0,A=s==null?_:s.length;if(typeof c=="number"&&c===c&&A<=oe){for(;_<A;){var R=_+A>>>1,H=s[R];H!==null&&!No(H)&&(d?H<=c:H<c)?_=R+1:A=R}return A}return eh(s,c,yo,d)}function eh(s,c,d,_){var A=0,R=s==null?0:s.length;if(R===0)return 0;c=d(c);for(var H=c!==c,X=c===null,Q=No(c),ht=c===o;A<R;){var pt=ur((A+R)/2),gt=d(s[pt]),Ct=gt!==o,Bt=gt===null,$t=gt===gt,ce=No(gt);if(H)var Zt=_||$t;else ht?Zt=$t&&(_||Ct):X?Zt=$t&&Ct&&(_||!Bt):Q?Zt=$t&&Ct&&!Bt&&(_||!ce):Bt||ce?Zt=!1:Zt=_?gt<=c:gt<c;Zt?A=pt+1:R=pt}return Dn(R,q)}function vg(s,c){for(var d=-1,_=s.length,A=0,R=[];++d<_;){var H=s[d],X=c?c(H):H;if(!d||!ss(X,Q)){var Q=X;R[A++]=H===0?0:H}}return R}function _g(s){return typeof s=="number"?s:No(s)?_t:+s}function Lo(s){if(typeof s=="string")return s;if(ne(s))return Hn(s,Lo)+"";if(No(s))return ei?ei.call(s):"";var c=s+"";return c=="0"&&1/s==-zt?"-0":c}function da(s,c,d){var _=-1,A=gs,R=s.length,H=!0,X=[],Q=X;if(d)H=!1,A=ka;else if(R>=r){var ht=c?null:$x(s);if(ht)return gr(ht);H=!1,A=kr,Q=new Va}else Q=c?[]:X;t:for(;++_<R;){var pt=s[_],gt=c?c(pt):pt;if(pt=d||pt!==0?pt:0,H&>===gt){for(var Ct=Q.length;Ct--;)if(Q[Ct]===gt)continue t;c&&Q.push(gt),X.push(pt)}else A(Q,gt,d)||(Q!==X&&Q.push(gt),X.push(pt))}return X}function nh(s,c){return c=ga(c,s),s=Yg(s,c),s==null||delete s[Cs(Jo(c))]}function xg(s,c,d,_){return dl(s,c,d(qa(s,c)),_)}function uc(s,c,d,_){for(var A=s.length,R=_?A:-1;(_?R--:++R<A)&&c(s[R],R,s););return d?Zo(s,_?0:R,_?R+1:A):Zo(s,_?R+1:0,_?A:R)}function Eg(s,c){var d=s;return d instanceof n&&(d=d.value()),oo(c,function(_,A){return A.func.apply(A.thisArg,jt([_],A.args))},d)}function rh(s,c,d){var _=s.length;if(_<2)return _?da(s[0]):[];for(var A=-1,R=ot(_);++A<_;)for(var H=s[A],X=-1;++X<_;)X!=A&&(R[A]=fl(R[A]||H,s[X],c,d));return da(mi(R,1),c,d)}function wg(s,c,d){for(var _=-1,A=s.length,R=c.length,H={};++_<A;){var X=_<R?c[_]:o;d(H,s[_],X)}return H}function ih(s){return Cr(s)?s:[]}function oh(s){return typeof s=="function"?s:yo}function ga(s,c){return ne(s)?s:dh(s,c)?[s]:Kg(Tn(s))}var Bx=he;function ma(s,c,d){var _=s.length;return d=d===o?_:d,!c&&d>=_?s:Zo(s,c,d)}var Mg=ul||function(s){return sr.clearTimeout(s)};function Sg(s,c){if(c)return s.slice();var d=s.length,_=Gi?Gi(d):new s.constructor(d);return s.copy(_),_}function sh(s){var c=new s.constructor(s.byteLength);return new Wo(c).set(new Wo(s)),c}function zx(s,c){var d=c?sh(s.buffer):s.buffer;return new s.constructor(d,s.byteOffset,s.byteLength)}function kx(s){var c=new s.constructor(s.source,_n.exec(s));return c.lastIndex=s.lastIndex,c}function Gx(s){return ha?bn(ha.call(s)):{}}function bg(s,c){var d=c?sh(s.buffer):s.buffer;return new s.constructor(d,s.byteOffset,s.length)}function Ag(s,c){if(s!==c){var d=s!==o,_=s===null,A=s===s,R=No(s),H=c!==o,X=c===null,Q=c===c,ht=No(c);if(!X&&!ht&&!R&&s>c||R&&H&&Q&&!X&&!ht||_&&H&&Q||!d&&Q||!A)return 1;if(!_&&!R&&!ht&&s<c||ht&&d&&A&&!_&&!R||X&&d&&A||!H&&A||!Q)return-1}return 0}function Hx(s,c,d){for(var _=-1,A=s.criteria,R=c.criteria,H=A.length,X=d.length;++_<H;){var Q=Ag(A[_],R[_]);if(Q){if(_>=X)return Q;var ht=d[_];return Q*(ht=="desc"?-1:1)}}return s.index-c.index}function Tg(s,c,d,_){for(var A=-1,R=s.length,H=d.length,X=-1,Q=c.length,ht=Tr(R-H,0),pt=ot(Q+ht),gt=!_;++X<Q;)pt[X]=c[X];for(;++A<H;)(gt||A<R)&&(pt[d[A]]=s[A]);for(;ht--;)pt[X++]=s[A++];return pt}function Cg(s,c,d,_){for(var A=-1,R=s.length,H=-1,X=d.length,Q=-1,ht=c.length,pt=Tr(R-X,0),gt=ot(pt+ht),Ct=!_;++A<pt;)gt[A]=s[A];for(var Bt=A;++Q<ht;)gt[Bt+Q]=c[Q];for(;++H<X;)(Ct||A<R)&&(gt[Bt+d[H]]=s[A++]);return gt}function po(s,c){var d=-1,_=s.length;for(c||(c=ot(_));++d<_;)c[d]=s[d];return c}function Ts(s,c,d,_){var A=!d;d||(d={});for(var R=-1,H=c.length;++R<H;){var X=c[R],Q=_?_(d[X],s[X],X,d,s):o;Q===o&&(Q=s[X]),A?Xs(d,X,Q):cl(d,X,Q)}return d}function Vx(s,c){return Ts(s,ph(s),c)}function Wx(s,c){return Ts(s,Gg(s),c)}function lc(s,c){return function(d,_){var A=ne(d)?Kl:hx,R=c?c():{};return A(d,s,qt(_,2),R)}}function gu(s){return he(function(c,d){var _=-1,A=d.length,R=A>1?d[A-1]:o,H=A>2?d[2]:o;for(R=s.length>3&&typeof R=="function"?(A--,R):o,H&&Wi(d[0],d[1],H)&&(R=A<3?o:R,A=1),c=bn(c);++_<A;){var X=d[_];X&&s(c,X,_,R)}return c})}function Ig(s,c){return function(d,_){if(d==null)return d;if(!go(d))return s(d,_);for(var A=d.length,R=c?A:-1,H=bn(d);(c?R--:++R<A)&&_(H[R],R,H)!==!1;);return d}}function Pg(s){return function(c,d,_){for(var A=-1,R=bn(c),H=_(c),X=H.length;X--;){var Q=H[s?X:++A];if(d(R[Q],Q,R)===!1)break}return c}}function qx(s,c,d){var _=c&D,A=gl(s);function R(){var H=this&&this!==sr&&this instanceof R?A:s;return H.apply(_?d:this,arguments)}return R}function Rg(s){return function(c){c=Tn(c);var d=ks(c)?ao(c):o,_=d?d[0]:c.charAt(0),A=d?ma(d,1).join(""):c.slice(1);return _[s]()+A}}function mu(s){return function(c){return oo(Im(Cm(c).replace(no,"")),s,"")}}function gl(s){return function(){var c=arguments;switch(c.length){case 0:return new s;case 1:return new s(c[0]);case 2:return new s(c[0],c[1]);case 3:return new s(c[0],c[1],c[2]);case 4:return new s(c[0],c[1],c[2],c[3]);case 5:return new s(c[0],c[1],c[2],c[3],c[4]);case 6:return new s(c[0],c[1],c[2],c[3],c[4],c[5]);case 7:return new s(c[0],c[1],c[2],c[3],c[4],c[5],c[6])}var d=qs(s.prototype),_=s.apply(d,c);return lr(_)?_:d}}function Xx(s,c,d){var _=gl(s);function A(){for(var R=arguments.length,H=ot(R),X=R,Q=yu(A);X--;)H[X]=arguments[X];var ht=R<3&&H[0]!==Q&&H[R-1]!==Q?[]:es(H,Q);if(R-=ht.length,R<d)return Fg(s,c,cc,A.placeholder,o,H,ht,o,o,d-R);var pt=this&&this!==sr&&this instanceof A?_:s;return bt(pt,this,H)}return A}function Lg(s){return function(c,d,_){var A=bn(c);if(!go(c)){var R=qt(d,3);c=ni(c),d=function(X){return R(A[X],X,A)}}var H=s(c,d,_);return H>-1?A[R?c[H]:H]:o}}function Ng(s){return $s(function(c){var d=c.length,_=d,A=t.prototype.thru;for(s&&c.reverse();_--;){var R=c[_];if(typeof R!="function")throw new pn(l);if(A&&!H&&dc(R)=="wrapper")var H=new t([],!0)}for(_=H?_:d;++_<d;){R=c[_];var X=dc(R),Q=X=="wrapper"?fh(R):o;Q&&gh(Q[0])&&Q[1]==(Z|L|F|it)&&!Q[4].length&&Q[9]==1?H=H[dc(Q[0])].apply(H,Q[3]):H=R.length==1&&gh(R)?H[X]():H.thru(R)}return function(){var ht=arguments,pt=ht[0];if(H&&ht.length==1&&ne(pt))return H.plant(pt).value();for(var gt=0,Ct=d?c[gt].apply(this,ht):pt;++gt<d;)Ct=c[gt].call(this,Ct);return Ct}})}function cc(s,c,d,_,A,R,H,X,Q,ht){var pt=c&Z,gt=c&D,Ct=c&G,Bt=c&(L|k),$t=c&et,ce=Ct?o:gl(s);function Zt(){for(var qe=arguments.length,sn=ot(qe),Do=qe;Do--;)sn[Do]=arguments[Do];if(Bt)var qi=yu(Zt),Oo=so(sn,qi);if(_&&(sn=Tg(sn,_,A,Bt)),R&&(sn=Cg(sn,R,H,Bt)),qe-=Oo,Bt&&qe<ht){var Ir=es(sn,qi);return Fg(s,c,cc,Zt.placeholder,d,sn,Ir,X,Q,ht-qe)}var as=gt?d:this,Qs=Ct?as[s]:s;return qe=sn.length,X?sn=hE(sn,X):$t&&qe>1&&sn.reverse(),pt&&Q<qe&&(sn.length=Q),this&&this!==sr&&this instanceof Zt&&(Qs=ce||gl(Qs)),Qs.apply(as,sn)}return Zt}function Dg(s,c){return function(d,_){return xx(d,s,c(_),{})}}function fc(s,c){return function(d,_){var A;if(d===o&&_===o)return c;if(d!==o&&(A=d),_!==o){if(A===o)return _;typeof d=="string"||typeof _=="string"?(d=Lo(d),_=Lo(_)):(d=_g(d),_=_g(_)),A=s(d,_)}return A}}function ah(s){return $s(function(c){return c=Hn(c,Ai(qt())),he(function(d){var _=this;return s(c,function(A){return bt(A,_,d)})})})}function hc(s,c){c=c===o?" ":Lo(c);var d=c.length;if(d<2)return d?th(c,s):c;var _=th(c,$n(s/Gs(c)));return ks(c)?ma(ao(_),0,s).join(""):_.slice(0,s)}function Yx(s,c,d,_){var A=c&D,R=gl(s);function H(){for(var X=-1,Q=arguments.length,ht=-1,pt=_.length,gt=ot(pt+Q),Ct=this&&this!==sr&&this instanceof H?R:s;++ht<pt;)gt[ht]=_[ht];for(;Q--;)gt[ht++]=arguments[++X];return bt(Ct,A?d:this,gt)}return H}function Og(s){return function(c,d,_){return _&&typeof _!="number"&&Wi(c,d,_)&&(d=_=o),c=Ks(c),d===o?(d=c,c=0):d=Ks(d),_=_===o?c<d?1:-1:Ks(_),Lx(c,d,_,s)}}function pc(s){return function(c,d){return typeof c=="string"&&typeof d=="string"||(c=Ko(c),d=Ko(d)),s(c,d)}}function Fg(s,c,d,_,A,R,H,X,Q,ht){var pt=c&L,gt=pt?H:o,Ct=pt?o:H,Bt=pt?R:o,$t=pt?o:R;c|=pt?F:$,c&=~(pt?$:F),c&O||(c&=~(D|G));var ce=[s,c,A,Bt,gt,$t,Ct,X,Q,ht],Zt=d.apply(o,ce);return gh(s)&&$g(Zt,ce),Zt.placeholder=_,Zg(Zt,s,c)}function uh(s){var c=ge[s];return function(d,_){if(d=Ko(d),_=_==null?0:Dn(ae(_),292),_&&pu(d)){var A=(Tn(d)+"e").split("e"),R=c(A[0]+"e"+(+A[1]+_));return A=(Tn(R)+"e").split("e"),+(A[0]+"e"+(+A[1]-_))}return c(d)}}var $x=Es&&1/gr(new Es([,-0]))[1]==zt?function(s){return new Es(s)}:Ph;function Ug(s){return function(c){var d=Ti(c);return d==Jt?Ao(c):d==Nt?tc(c):br(c,s(c))}}function Ys(s,c,d,_,A,R,H,X){var Q=c&G;if(!Q&&typeof s!="function")throw new pn(l);var ht=_?_.length:0;if(ht||(c&=~(F|$),_=A=o),H=H===o?H:Tr(ae(H),0),X=X===o?X:ae(X),ht-=A?A.length:0,c&$){var pt=_,gt=A;_=A=o}var Ct=Q?o:fh(s),Bt=[s,c,d,_,A,pt,gt,R,H,X];if(Ct&&lE(Bt,Ct),s=Bt[0],c=Bt[1],d=Bt[2],_=Bt[3],A=Bt[4],X=Bt[9]=Bt[9]===o?Q?0:s.length:Tr(Bt[9]-ht,0),!X&&c&(L|k)&&(c&=~(L|k)),!c||c==D)var $t=qx(s,c,d);else c==L||c==k?$t=Xx(s,c,X):(c==F||c==(D|F))&&!A.length?$t=Yx(s,c,d,_):$t=cc.apply(o,Bt);var ce=Ct?yg:$g;return Zg(ce($t,Bt),s,c)}function Bg(s,c,d,_){return s===o||ss(s,Ar[d])&&!fe.call(_,d)?c:s}function zg(s,c,d,_,A,R){return lr(s)&&lr(c)&&(R.set(c,s),sc(s,c,o,zg,R),R.delete(c)),s}function Zx(s){return vl(s)?o:s}function kg(s,c,d,_,A,R){var H=d&M,X=s.length,Q=c.length;if(X!=Q&&!(H&&Q>X))return!1;var ht=R.get(s),pt=R.get(c);if(ht&&pt)return ht==c&&pt==s;var gt=-1,Ct=!0,Bt=d&C?new Va:o;for(R.set(s,c),R.set(c,s);++gt<X;){var $t=s[gt],ce=c[gt];if(_)var Zt=H?_(ce,$t,gt,c,s,R):_($t,ce,gt,s,c,R);if(Zt!==o){if(Zt)continue;Ct=!1;break}if(Bt){if(!zs(c,function(qe,sn){if(!kr(Bt,sn)&&($t===qe||A($t,qe,d,_,R)))return Bt.push(sn)})){Ct=!1;break}}else if(!($t===ce||A($t,ce,d,_,R))){Ct=!1;break}}return R.delete(s),R.delete(c),Ct}function Jx(s,c,d,_,A,R,H){switch(d){case Ni:if(s.byteLength!=c.byteLength||s.byteOffset!=c.byteOffset)return!1;s=s.buffer,c=c.buffer;case mt:return!(s.byteLength!=c.byteLength||!R(new Wo(s),new Wo(c)));case Vn:case yn:case jn:return ss(+s,+c);case an:return s.name==c.name&&s.message==c.message;case ui:case He:return s==c+"";case Jt:var X=Ao;case Nt:var Q=_&M;if(X||(X=gr),s.size!=c.size&&!Q)return!1;var ht=H.get(s);if(ht)return ht==c;_|=C,H.set(s,c);var pt=kg(X(s),X(c),_,A,R,H);return H.delete(s),pt;case wi:if(ha)return ha.call(s)==ha.call(c)}return!1}function Kx(s,c,d,_,A,R){var H=d&M,X=lh(s),Q=X.length,ht=lh(c),pt=ht.length;if(Q!=pt&&!H)return!1;for(var gt=Q;gt--;){var Ct=X[gt];if(!(H?Ct in c:fe.call(c,Ct)))return!1}var Bt=R.get(s),$t=R.get(c);if(Bt&&$t)return Bt==c&&$t==s;var ce=!0;R.set(s,c),R.set(c,s);for(var Zt=H;++gt<Q;){Ct=X[gt];var qe=s[Ct],sn=c[Ct];if(_)var Do=H?_(sn,qe,Ct,c,s,R):_(qe,sn,Ct,s,c,R);if(!(Do===o?qe===sn||A(qe,sn,d,_,R):Do)){ce=!1;break}Zt||(Zt=Ct=="constructor")}if(ce&&!Zt){var qi=s.constructor,Oo=c.constructor;qi!=Oo&&"constructor"in s&&"constructor"in c&&!(typeof qi=="function"&&qi instanceof qi&&typeof Oo=="function"&&Oo instanceof Oo)&&(ce=!1)}return R.delete(s),R.delete(c),ce}function $s(s){return yh(Xg(s,o,em),s+"")}function lh(s){return sg(s,ni,ph)}function ch(s){return sg(s,mo,Gg)}var fh=ws?function(s){return ws.get(s)}:Ph;function dc(s){for(var c=s.name+"",d=Po[c],_=fe.call(Po,c)?d.length:0;_--;){var A=d[_],R=A.func;if(R==null||R==s)return A.name}return c}function yu(s){var c=fe.call(I,"placeholder")?I:s;return c.placeholder}function qt(){var s=I.iteratee||Ch;return s=s===Ch?lg:s,arguments.length?s(arguments[0],arguments[1]):s}function gc(s,c){var d=s.__data__;return oE(c)?d[typeof c=="string"?"string":"hash"]:d.map}function hh(s){for(var c=ni(s),d=c.length;d--;){var _=c[d],A=s[_];c[d]=[_,A,Wg(A)]}return c}function Xa(s,c){var d=dr(s,c);return ug(d)?d:o}function Qx(s){var c=fe.call(s,Yn),d=s[Yn];try{s[Yn]=o;var _=!0}catch{}var A=Qn.call(s);return _&&(c?s[Yn]=d:delete s[Yn]),A}var ph=Ws?function(s){return s==null?[]:(s=bn(s),fi(Ws(s),function(c){return co.call(s,c)}))}:Rh,Gg=Ws?function(s){for(var c=[];s;)jt(c,ph(s)),s=qo(s);return c}:Rh,Ti=Vi;(Hi&&Ti(new Hi(new ArrayBuffer(1)))!=Ni||Xo&&Ti(new Xo)!=Jt||xs&&Ti(xs.resolve())!=Fn||Es&&Ti(new Es)!=Nt||Yo&&Ti(new Yo)!=qr)&&(Ti=function(s){var c=Vi(s),d=c==vn?s.constructor:o,_=d?Ya(d):"";if(_)switch(_){case Ms:return Ni;case Ht:return Jt;case rs:return Fn;case fa:return Nt;case Ss:return qr}return c});function jx(s,c,d){for(var _=-1,A=d.length;++_<A;){var R=d[_],H=R.size;switch(R.type){case"drop":s+=H;break;case"dropRight":c-=H;break;case"take":c=Dn(c,s+H);break;case"takeRight":s=Tr(s,c-H);break}}return{start:s,end:c}}function tE(s){var c=s.match(Ur);return c?c[1].split(Un):[]}function Hg(s,c,d){c=ga(c,s);for(var _=-1,A=c.length,R=!1;++_<A;){var H=Cs(c[_]);if(!(R=s!=null&&d(s,H)))break;s=s[H]}return R||++_!=A?R:(A=s==null?0:s.length,!!A&&wc(A)&&Zs(H,A)&&(ne(s)||$a(s)))}function eE(s){var c=s.length,d=new s.constructor(c);return c&&typeof s[0]=="string"&&fe.call(s,"index")&&(d.index=s.index,d.input=s.input),d}function Vg(s){return typeof s.constructor=="function"&&!ml(s)?qs(qo(s)):{}}function nE(s,c,d){var _=s.constructor;switch(c){case mt:return sh(s);case Vn:case yn:return new _(+s);case Ni:return zx(s,d);case Di:case Ft:case Si:case Os:case Y:case w:case T:case N:case z:return bg(s,d);case Jt:return new _;case jn:case He:return new _(s);case ui:return kx(s);case Nt:return new _;case wi:return Gx(s)}}function rE(s,c){var d=c.length;if(!d)return s;var _=d-1;return c[_]=(d>1?"& ":"")+c[_],c=c.join(d>2?", ":" "),s.replace(tr,`{\n/* [wrapped with `+c+`] */\n`)}function iE(s){return ne(s)||$a(s)||!!(al&&s&&s[al])}function Zs(s,c){var d=typeof s;return c=c??Kt,!!c&&(d=="number"||d!="symbol"&&Ku.test(s))&&s>-1&&s%1==0&&s<c}function Wi(s,c,d){if(!lr(d))return!1;var _=typeof c;return(_=="number"?go(d)&&Zs(c,d.length):_=="string"&&c in d)?ss(d[c],s):!1}function dh(s,c){if(ne(s))return!1;var d=typeof s;return d=="number"||d=="symbol"||d=="boolean"||s==null||No(s)?!0:re.test(s)||!kt.test(s)||c!=null&&s in bn(c)}function oE(s){var c=typeof s;return c=="string"||c=="number"||c=="symbol"||c=="boolean"?s!=="__proto__":s===null}function gh(s){var c=dc(s),d=I[c];if(typeof d!="function"||!(c in n.prototype))return!1;if(s===d)return!0;var _=fh(d);return!!_&&s===_[0]}function sE(s){return!!hu&&hu in s}var aE=la?Js:Lh;function ml(s){var c=s&&s.constructor,d=typeof c=="function"&&c.prototype||Ar;return s===d}function Wg(s){return s===s&&!lr(s)}function qg(s,c){return function(d){return d==null?!1:d[s]===c&&(c!==o||s in bn(d))}}function uE(s){var c=xc(s,function(_){return d.size===m&&d.clear(),_}),d=c.cache;return c}function lE(s,c){var d=s[1],_=c[1],A=d|_,R=A<(D|G|Z),H=_==Z&&d==L||_==Z&&d==it&&s[7].length<=c[8]||_==(Z|it)&&c[7].length<=c[8]&&d==L;if(!(R||H))return s;_&D&&(s[2]=c[2],A|=d&D?0:O);var X=c[3];if(X){var Q=s[3];s[3]=Q?Tg(Q,X,c[4]):X,s[4]=Q?es(s[3],y):c[4]}return X=c[5],X&&(Q=s[5],s[5]=Q?Cg(Q,X,c[6]):X,s[6]=Q?es(s[5],y):c[6]),X=c[7],X&&(s[7]=X),_&Z&&(s[8]=s[8]==null?c[8]:Dn(s[8],c[8])),s[9]==null&&(s[9]=c[9]),s[0]=c[0],s[1]=A,s}function cE(s){var c=[];if(s!=null)for(var d in bn(s))c.push(d);return c}function fE(s){return Qn.call(s)}function Xg(s,c,d){return c=Tr(c===o?s.length-1:c,0),function(){for(var _=arguments,A=-1,R=Tr(_.length-c,0),H=ot(R);++A<R;)H[A]=_[c+A];A=-1;for(var X=ot(c+1);++A<c;)X[A]=_[A];return X[c]=d(H),bt(s,this,X)}}function Yg(s,c){return c.length<2?s:qa(s,Zo(c,0,-1))}function hE(s,c){for(var d=s.length,_=Dn(c.length,d),A=po(s);_--;){var R=c[_];s[_]=Zs(R,d)?A[R]:o}return s}function mh(s,c){if(!(c==="constructor"&&typeof s[c]=="function")&&c!="__proto__")return s[c]}var $g=Jg(yg),yl=ns||function(s,c){return sr.setTimeout(s,c)},yh=Jg(Ox);function Zg(s,c,d){var _=c+"";return yh(s,rE(_,pE(tE(_),d)))}function Jg(s){var c=0,d=0;return function(){var _=ec(),A=Ot-(_-d);if(d=_,A>0){if(++c>=Lt)return arguments[0]}else c=0;return s.apply(o,arguments)}}function mc(s,c){var d=-1,_=s.length,A=_-1;for(c=c===o?_:c;++d<c;){var R=jf(d,A),H=s[R];s[R]=s[d],s[d]=H}return s.length=c,s}var Kg=uE(function(s){var c=[];return s.charCodeAt(0)===46&&c.push(""),s.replace(Yt,function(d,_,A,R){c.push(A?R.replace(qn,"$1"):_||d)}),c});function Cs(s){if(typeof s=="string"||No(s))return s;var c=s+"";return c=="0"&&1/s==-zt?"-0":c}function Ya(s){if(s!=null){try{return Vo.call(s)}catch{}try{return s+""}catch{}}return""}function pE(s,c){return Zr(Vt,function(d){var _="_."+d[0];c&d[1]&&!gs(s,_)&&s.push(_)}),s.sort()}function Qg(s){if(s instanceof n)return s.clone();var c=new t(s.__wrapped__,s.__chain__);return c.__actions__=po(s.__actions__),c.__index__=s.__index__,c.__values__=s.__values__,c}function dE(s,c,d){(d?Wi(s,c,d):c===o)?c=1:c=Tr(ae(c),0);var _=s==null?0:s.length;if(!_||c<1)return[];for(var A=0,R=0,H=ot($n(_/c));A<_;)H[R++]=Zo(s,A,A+=c);return H}function gE(s){for(var c=-1,d=s==null?0:s.length,_=0,A=[];++c<d;){var R=s[c];R&&(A[_++]=R)}return A}function mE(){var s=arguments.length;if(!s)return[];for(var c=ot(s-1),d=arguments[0],_=s;_--;)c[_-1]=arguments[_];return jt(ne(d)?po(d):[d],mi(c,1))}var yE=he(function(s,c){return Cr(s)?fl(s,mi(c,1,Cr,!0)):[]}),vE=he(function(s,c){var d=Jo(c);return Cr(d)&&(d=o),Cr(s)?fl(s,mi(c,1,Cr,!0),qt(d,2)):[]}),_E=he(function(s,c){var d=Jo(c);return Cr(d)&&(d=o),Cr(s)?fl(s,mi(c,1,Cr,!0),o,d):[]});function xE(s,c,d){var _=s==null?0:s.length;return _?(c=d||c===o?1:ae(c),Zo(s,c<0?0:c,_)):[]}function EE(s,c,d){var _=s==null?0:s.length;return _?(c=d||c===o?1:ae(c),c=_-c,Zo(s,0,c<0?0:c)):[]}function wE(s,c){return s&&s.length?uc(s,qt(c,3),!0,!0):[]}function ME(s,c){return s&&s.length?uc(s,qt(c,3),!0):[]}function SE(s,c,d,_){var A=s==null?0:s.length;return A?(d&&typeof d!="number"&&Wi(s,c,d)&&(d=0,_=A),mx(s,c,d,_)):[]}function jg(s,c,d){var _=s==null?0:s.length;if(!_)return-1;var A=d==null?0:ae(d);return A<0&&(A=Tr(_+A,0)),ln(s,qt(c,3),A)}function tm(s,c,d){var _=s==null?0:s.length;if(!_)return-1;var A=_-1;return d!==o&&(A=ae(d),A=d<0?Tr(_+A,0):Dn(A,_-1)),ln(s,qt(c,3),A,!0)}function em(s){var c=s==null?0:s.length;return c?mi(s,1):[]}function bE(s){var c=s==null?0:s.length;return c?mi(s,zt):[]}function AE(s,c){var d=s==null?0:s.length;return d?(c=c===o?1:ae(c),mi(s,c)):[]}function TE(s){for(var c=-1,d=s==null?0:s.length,_={};++c<d;){var A=s[c];_[A[0]]=A[1]}return _}function nm(s){return s&&s.length?s[0]:o}function CE(s,c,d){var _=s==null?0:s.length;if(!_)return-1;var A=d==null?0:ae(d);return A<0&&(A=Tr(_+A,0)),ko(s,c,A)}function IE(s){var c=s==null?0:s.length;return c?Zo(s,0,-1):[]}var PE=he(function(s){var c=Hn(s,ih);return c.length&&c[0]===s[0]?$f(c):[]}),RE=he(function(s){var c=Jo(s),d=Hn(s,ih);return c===Jo(d)?c=o:d.pop(),d.length&&d[0]===s[0]?$f(d,qt(c,2)):[]}),LE=he(function(s){var c=Jo(s),d=Hn(s,ih);return c=typeof c=="function"?c:o,c&&d.pop(),d.length&&d[0]===s[0]?$f(d,o,c):[]});function NE(s,c){return s==null?"":du.call(s,c)}function Jo(s){var c=s==null?0:s.length;return c?s[c-1]:o}function DE(s,c,d){var _=s==null?0:s.length;if(!_)return-1;var A=_;return d!==o&&(A=ae(d),A=A<0?Tr(_+A,0):Dn(A,_-1)),c===c?aa(s,c,A):ln(s,ys,A,!0)}function OE(s,c){return s&&s.length?pg(s,ae(c)):o}var FE=he(rm);function rm(s,c){return s&&s.length&&c&&c.length?Qf(s,c):s}function UE(s,c,d){return s&&s.length&&c&&c.length?Qf(s,c,qt(d,2)):s}function BE(s,c,d){return s&&s.length&&c&&c.length?Qf(s,c,o,d):s}var zE=$s(function(s,c){var d=s==null?0:s.length,_=Wf(s,c);return mg(s,Hn(c,function(A){return Zs(A,d)?+A:A}).sort(Ag)),_});function kE(s,c){var d=[];if(!(s&&s.length))return d;var _=-1,A=[],R=s.length;for(c=qt(c,3);++_<R;){var H=s[_];c(H,_,s)&&(d.push(H),A.push(_))}return mg(s,A),d}function vh(s){return s==null?s:Hf.call(s)}function GE(s,c,d){var _=s==null?0:s.length;return _?(d&&typeof d!="number"&&Wi(s,c,d)?(c=0,d=_):(c=c==null?0:ae(c),d=d===o?_:ae(d)),Zo(s,c,d)):[]}function HE(s,c){return ac(s,c)}function VE(s,c,d){return eh(s,c,qt(d,2))}function WE(s,c){var d=s==null?0:s.length;if(d){var _=ac(s,c);if(_<d&&ss(s[_],c))return _}return-1}function qE(s,c){return ac(s,c,!0)}function XE(s,c,d){return eh(s,c,qt(d,2),!0)}function YE(s,c){var d=s==null?0:s.length;if(d){var _=ac(s,c,!0)-1;if(ss(s[_],c))return _}return-1}function $E(s){return s&&s.length?vg(s):[]}function ZE(s,c){return s&&s.length?vg(s,qt(c,2)):[]}function JE(s){var c=s==null?0:s.length;return c?Zo(s,1,c):[]}function KE(s,c,d){return s&&s.length?(c=d||c===o?1:ae(c),Zo(s,0,c<0?0:c)):[]}function QE(s,c,d){var _=s==null?0:s.length;return _?(c=d||c===o?1:ae(c),c=_-c,Zo(s,c<0?0:c,_)):[]}function jE(s,c){return s&&s.length?uc(s,qt(c,3),!1,!0):[]}function tw(s,c){return s&&s.length?uc(s,qt(c,3)):[]}var ew=he(function(s){return da(mi(s,1,Cr,!0))}),nw=he(function(s){var c=Jo(s);return Cr(c)&&(c=o),da(mi(s,1,Cr,!0),qt(c,2))}),rw=he(function(s){var c=Jo(s);return c=typeof c=="function"?c:o,da(mi(s,1,Cr,!0),o,c)});function iw(s){return s&&s.length?da(s):[]}function ow(s,c){return s&&s.length?da(s,qt(c,2)):[]}function sw(s,c){return c=typeof c=="function"?c:o,s&&s.length?da(s,o,c):[]}function _h(s){if(!(s&&s.length))return[];var c=0;return s=fi(s,function(d){if(Cr(d))return c=Tr(d.length,c),!0}),zr(c,function(d){return Hn(s,Go(d))})}function im(s,c){if(!(s&&s.length))return[];var d=_h(s);return c==null?d:Hn(d,function(_){return bt(c,o,_)})}var aw=he(function(s,c){return Cr(s)?fl(s,c):[]}),uw=he(function(s){return rh(fi(s,Cr))}),lw=he(function(s){var c=Jo(s);return Cr(c)&&(c=o),rh(fi(s,Cr),qt(c,2))}),cw=he(function(s){var c=Jo(s);return c=typeof c=="function"?c:o,rh(fi(s,Cr),o,c)}),fw=he(_h);function hw(s,c){return wg(s||[],c||[],cl)}function pw(s,c){return wg(s||[],c||[],dl)}var dw=he(function(s){var c=s.length,d=c>1?s[c-1]:o;return d=typeof d=="function"?(s.pop(),d):o,im(s,d)});function om(s){var c=I(s);return c.__chain__=!0,c}function gw(s,c){return c(s),s}function yc(s,c){return c(s)}var mw=$s(function(s){var c=s.length,d=c?s[0]:0,_=this.__wrapped__,A=function(R){return Wf(R,s)};return c>1||this.__actions__.length||!(_ instanceof n)||!Zs(d)?this.thru(A):(_=_.slice(d,+d+(c?1:0)),_.__actions__.push({func:yc,args:[A],thisArg:o}),new t(_,this.__chain__).thru(function(R){return c&&!R.length&&R.push(o),R}))});function yw(){return om(this)}function vw(){return new t(this.value(),this.__chain__)}function _w(){this.__values__===o&&(this.__values__=_m(this.value()));var s=this.__index__>=this.__values__.length,c=s?o:this.__values__[this.__index__++];return{done:s,value:c}}function xw(){return this}function Ew(s){for(var c,d=this;d instanceof bs;){var _=Qg(d);_.__index__=0,_.__values__=o,c?A.__wrapped__=_:c=_;var A=_;d=d.__wrapped__}return A.__wrapped__=s,c}function ww(){var s=this.__wrapped__;if(s instanceof n){var c=s;return this.__actions__.length&&(c=new n(this)),c=c.reverse(),c.__actions__.push({func:yc,args:[vh],thisArg:o}),new t(c,this.__chain__)}return this.thru(vh)}function Mw(){return Eg(this.__wrapped__,this.__actions__)}var Sw=lc(function(s,c,d){fe.call(s,d)?++s[d]:Xs(s,d,1)});function bw(s,c,d){var _=ne(s)?Bi:gx;return d&&Wi(s,c,d)&&(c=o),_(s,qt(c,3))}function Aw(s,c){var d=ne(s)?fi:ig;return d(s,qt(c,3))}var Tw=Lg(jg),Cw=Lg(tm);function Iw(s,c){return mi(vc(s,c),1)}function Pw(s,c){return mi(vc(s,c),zt)}function Rw(s,c,d){return d=d===o?1:ae(d),mi(vc(s,c),d)}function sm(s,c){var d=ne(s)?Zr:pa;return d(s,qt(c,3))}function am(s,c){var d=ne(s)?Jr:rg;return d(s,qt(c,3))}var Lw=lc(function(s,c,d){fe.call(s,d)?s[d].push(c):Xs(s,d,[c])});function Nw(s,c,d,_){s=go(s)?s:_u(s),d=d&&!_?ae(d):0;var A=s.length;return d<0&&(d=Tr(A+d,0)),Mc(s)?d<=A&&s.indexOf(c,d)>-1:!!A&&ko(s,c,d)>-1}var Dw=he(function(s,c,d){var _=-1,A=typeof c=="function",R=go(s)?ot(s.length):[];return pa(s,function(H){R[++_]=A?bt(c,H,d):hl(H,c,d)}),R}),Ow=lc(function(s,c,d){Xs(s,d,c)});function vc(s,c){var d=ne(s)?Hn:cg;return d(s,qt(c,3))}function Fw(s,c,d,_){return s==null?[]:(ne(c)||(c=c==null?[]:[c]),d=_?o:d,ne(d)||(d=d==null?[]:[d]),dg(s,c,d))}var Uw=lc(function(s,c,d){s[d?0:1].push(c)},function(){return[[],[]]});function Bw(s,c,d){var _=ne(s)?oo:pi,A=arguments.length<3;return _(s,qt(c,4),d,A,pa)}function zw(s,c,d){var _=ne(s)?Nn:pi,A=arguments.length<3;return _(s,qt(c,4),d,A,rg)}function kw(s,c){var d=ne(s)?fi:ig;return d(s,Ec(qt(c,3)))}function Gw(s){var c=ne(s)?jd:Nx;return c(s)}function Hw(s,c,d){(d?Wi(s,c,d):c===o)?c=1:c=ae(c);var _=ne(s)?cx:Dx;return _(s,c)}function Vw(s){var c=ne(s)?fx:Fx;return c(s)}function Ww(s){if(s==null)return 0;if(go(s))return Mc(s)?Gs(s):s.length;var c=Ti(s);return c==Jt||c==Nt?s.size:Jf(s).length}function qw(s,c,d){var _=ne(s)?zs:Ux;return d&&Wi(s,c,d)&&(c=o),_(s,qt(c,3))}var Xw=he(function(s,c){if(s==null)return[];var d=c.length;return d>1&&Wi(s,c[0],c[1])?c=[]:d>2&&Wi(c[0],c[1],c[2])&&(c=[c[0]]),dg(s,mi(c,1),[])}),_c=Vs||function(){return sr.Date.now()};function Yw(s,c){if(typeof c!="function")throw new pn(l);return s=ae(s),function(){if(--s<1)return c.apply(this,arguments)}}function um(s,c,d){return c=d?o:c,c=s&&c==null?s.length:c,Ys(s,Z,o,o,o,o,c)}function lm(s,c){var d;if(typeof c!="function")throw new pn(l);return s=ae(s),function(){return--s>0&&(d=c.apply(this,arguments)),s<=1&&(c=o),d}}var xh=he(function(s,c,d){var _=D;if(d.length){var A=es(d,yu(xh));_|=F}return Ys(s,_,c,d,A)}),cm=he(function(s,c,d){var _=D|G;if(d.length){var A=es(d,yu(cm));_|=F}return Ys(c,_,s,d,A)});function fm(s,c,d){c=d?o:c;var _=Ys(s,L,o,o,o,o,o,c);return _.placeholder=fm.placeholder,_}function hm(s,c,d){c=d?o:c;var _=Ys(s,k,o,o,o,o,o,c);return _.placeholder=hm.placeholder,_}function pm(s,c,d){var _,A,R,H,X,Q,ht=0,pt=!1,gt=!1,Ct=!0;if(typeof s!="function")throw new pn(l);c=Ko(c)||0,lr(d)&&(pt=!!d.leading,gt="maxWait"in d,R=gt?Tr(Ko(d.maxWait)||0,c):R,Ct="trailing"in d?!!d.trailing:Ct);function Bt(Ir){var as=_,Qs=A;return _=A=o,ht=Ir,H=s.apply(Qs,as),H}function $t(Ir){return ht=Ir,X=yl(qe,c),pt?Bt(Ir):H}function ce(Ir){var as=Ir-Q,Qs=Ir-ht,Lm=c-as;return gt?Dn(Lm,R-Qs):Lm}function Zt(Ir){var as=Ir-Q,Qs=Ir-ht;return Q===o||as>=c||as<0||gt&&Qs>=R}function qe(){var Ir=_c();if(Zt(Ir))return sn(Ir);X=yl(qe,ce(Ir))}function sn(Ir){return X=o,Ct&&_?Bt(Ir):(_=A=o,H)}function Do(){X!==o&&Mg(X),ht=0,_=Q=A=X=o}function qi(){return X===o?H:sn(_c())}function Oo(){var Ir=_c(),as=Zt(Ir);if(_=arguments,A=this,Q=Ir,as){if(X===o)return $t(Q);if(gt)return Mg(X),X=yl(qe,c),Bt(Q)}return X===o&&(X=yl(qe,c)),H}return Oo.cancel=Do,Oo.flush=qi,Oo}var $w=he(function(s,c){return ng(s,1,c)}),Zw=he(function(s,c,d){return ng(s,Ko(c)||0,d)});function Jw(s){return Ys(s,et)}function xc(s,c){if(typeof s!="function"||c!=null&&typeof c!="function")throw new pn(l);var d=function(){var _=arguments,A=c?c.apply(this,_):_[0],R=d.cache;if(R.has(A))return R.get(A);var H=s.apply(this,_);return d.cache=R.set(A,H)||R,H};return d.cache=new(xc.Cache||cn),d}xc.Cache=cn;function Ec(s){if(typeof s!="function")throw new pn(l);return function(){var c=arguments;switch(c.length){case 0:return!s.call(this);case 1:return!s.call(this,c[0]);case 2:return!s.call(this,c[0],c[1]);case 3:return!s.call(this,c[0],c[1],c[2])}return!s.apply(this,c)}}function Kw(s){return lm(2,s)}var Qw=Bx(function(s,c){c=c.length==1&&ne(c[0])?Hn(c[0],Ai(qt())):Hn(mi(c,1),Ai(qt()));var d=c.length;return he(function(_){for(var A=-1,R=Dn(_.length,d);++A<R;)_[A]=c[A].call(this,_[A]);return bt(s,this,_)})}),Eh=he(function(s,c){var d=es(c,yu(Eh));return Ys(s,F,o,c,d)}),dm=he(function(s,c){var d=es(c,yu(dm));return Ys(s,$,o,c,d)}),jw=$s(function(s,c){return Ys(s,it,o,o,o,c)});function tM(s,c){if(typeof s!="function")throw new pn(l);return c=c===o?c:ae(c),he(s,c)}function eM(s,c){if(typeof s!="function")throw new pn(l);return c=c==null?0:Tr(ae(c),0),he(function(d){var _=d[c],A=ma(d,0,c);return _&&jt(A,_),bt(s,this,A)})}function nM(s,c,d){var _=!0,A=!0;if(typeof s!="function")throw new pn(l);return lr(d)&&(_="leading"in d?!!d.leading:_,A="trailing"in d?!!d.trailing:A),pm(s,c,{leading:_,maxWait:c,trailing:A})}function rM(s){return um(s,1)}function iM(s,c){return Eh(oh(c),s)}function oM(){if(!arguments.length)return[];var s=arguments[0];return ne(s)?s:[s]}function sM(s){return $o(s,b)}function aM(s,c){return c=typeof c=="function"?c:o,$o(s,b,c)}function uM(s){return $o(s,x|b)}function lM(s,c){return c=typeof c=="function"?c:o,$o(s,x|b,c)}function cM(s,c){return c==null||eg(s,c,ni(c))}function ss(s,c){return s===c||s!==s&&c!==c}var fM=pc(Yf),hM=pc(function(s,c){return s>=c}),$a=ag(function(){return arguments}())?ag:function(s){return vr(s)&&fe.call(s,"callee")&&!co.call(s,"callee")},ne=ot.isArray,pM=zo?Ai(zo):Ex;function go(s){return s!=null&&wc(s.length)&&!Js(s)}function Cr(s){return vr(s)&&go(s)}function dM(s){return s===!0||s===!1||vr(s)&&Vi(s)==Vn}var ya=ti||Lh,gM=Sr?Ai(Sr):wx;function mM(s){return vr(s)&&s.nodeType===1&&!vl(s)}function yM(s){if(s==null)return!0;if(go(s)&&(ne(s)||typeof s=="string"||typeof s.splice=="function"||ya(s)||vu(s)||$a(s)))return!s.length;var c=Ti(s);if(c==Jt||c==Nt)return!s.size;if(ml(s))return!Jf(s).length;for(var d in s)if(fe.call(s,d))return!1;return!0}function vM(s,c){return pl(s,c)}function _M(s,c,d){d=typeof d=="function"?d:o;var _=d?d(s,c):o;return _===o?pl(s,c,o,d):!!_}function wh(s){if(!vr(s))return!1;var c=Vi(s);return c==an||c==Ge||typeof s.message=="string"&&typeof s.name=="string"&&!vl(s)}function xM(s){return typeof s=="number"&&pu(s)}function Js(s){if(!lr(s))return!1;var c=Vi(s);return c==Et||c==Pr||c==mn||c==xr}function gm(s){return typeof s=="number"&&s==ae(s)}function wc(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=Kt}function lr(s){var c=typeof s;return s!=null&&(c=="object"||c=="function")}function vr(s){return s!=null&&typeof s=="object"}var mm=ds?Ai(ds):Sx;function EM(s,c){return s===c||Zf(s,c,hh(c))}function wM(s,c,d){return d=typeof d=="function"?d:o,Zf(s,c,hh(c),d)}function MM(s){return ym(s)&&s!=+s}function SM(s){if(aE(s))throw new Dt(u);return ug(s)}function bM(s){return s===null}function AM(s){return s==null}function ym(s){return typeof s=="number"||vr(s)&&Vi(s)==jn}function vl(s){if(!vr(s)||Vi(s)!=vn)return!1;var c=qo(s);if(c===null)return!0;var d=fe.call(c,"constructor")&&c.constructor;return typeof d=="function"&&d instanceof d&&Vo.call(d)==sl}var Mh=io?Ai(io):bx;function TM(s){return gm(s)&&s>=-Kt&&s<=Kt}var vm=oa?Ai(oa):Ax;function Mc(s){return typeof s=="string"||!ne(s)&&vr(s)&&Vi(s)==He}function No(s){return typeof s=="symbol"||vr(s)&&Vi(s)==wi}var vu=Ln?Ai(Ln):Tx;function CM(s){return s===o}function IM(s){return vr(s)&&Ti(s)==qr}function PM(s){return vr(s)&&Vi(s)==Rr}var RM=pc(Kf),LM=pc(function(s,c){return s<=c});function _m(s){if(!s)return[];if(go(s))return Mc(s)?ao(s):po(s);if(ca&&s[ca])return Lr(s[ca]());var c=Ti(s),d=c==Jt?Ao:c==Nt?gr:_u;return d(s)}function Ks(s){if(!s)return s===0?s:0;if(s=Ko(s),s===zt||s===-zt){var c=s<0?-1:1;return c*ie}return s===s?s:0}function ae(s){var c=Ks(s),d=c%1;return c===c?d?c-d:c:0}function xm(s){return s?Wa(ae(s),0,Pt):0}function Ko(s){if(typeof s=="number")return s;if(No(s))return _t;if(lr(s)){var c=typeof s.valueOf=="function"?s.valueOf():s;s=lr(c)?c+"":c}if(typeof s!="string")return s===0?s:+s;s=jl(s);var d=Xr.test(s);return d||Yr.test(s)?Ui(s.slice(2),d?2:8):bi.test(s)?_t:+s}function Em(s){return Ts(s,mo(s))}function NM(s){return s?Wa(ae(s),-Kt,Kt):s===0?s:0}function Tn(s){return s==null?"":Lo(s)}var DM=gu(function(s,c){if(ml(c)||go(c)){Ts(c,ni(c),s);return}for(var d in c)fe.call(c,d)&&cl(s,d,c[d])}),wm=gu(function(s,c){Ts(c,mo(c),s)}),Sc=gu(function(s,c,d,_){Ts(c,mo(c),s,_)}),OM=gu(function(s,c,d,_){Ts(c,ni(c),s,_)}),FM=$s(Wf);function UM(s,c){var d=qs(s);return c==null?d:tg(d,c)}var BM=he(function(s,c){s=bn(s);var d=-1,_=c.length,A=_>2?c[2]:o;for(A&&Wi(c[0],c[1],A)&&(_=1);++d<_;)for(var R=c[d],H=mo(R),X=-1,Q=H.length;++X<Q;){var ht=H[X],pt=s[ht];(pt===o||ss(pt,Ar[ht])&&!fe.call(s,ht))&&(s[ht]=R[ht])}return s}),zM=he(function(s){return s.push(o,zg),bt(Mm,o,s)});function kM(s,c){return ms(s,qt(c,3),As)}function GM(s,c){return ms(s,qt(c,3),Xf)}function HM(s,c){return s==null?s:qf(s,qt(c,3),mo)}function VM(s,c){return s==null?s:og(s,qt(c,3),mo)}function WM(s,c){return s&&As(s,qt(c,3))}function qM(s,c){return s&&Xf(s,qt(c,3))}function XM(s){return s==null?[]:oc(s,ni(s))}function YM(s){return s==null?[]:oc(s,mo(s))}function Sh(s,c,d){var _=s==null?o:qa(s,c);return _===o?d:_}function $M(s,c){return s!=null&&Hg(s,c,yx)}function bh(s,c){return s!=null&&Hg(s,c,vx)}var ZM=Dg(function(s,c,d){c!=null&&typeof c.toString!="function"&&(c=Qn.call(c)),s[c]=d},Th(yo)),JM=Dg(function(s,c,d){c!=null&&typeof c.toString!="function"&&(c=Qn.call(c)),fe.call(s,c)?s[c].push(d):s[c]=[d]},qt),KM=he(hl);function ni(s){return go(s)?Qd(s):Jf(s)}function mo(s){return go(s)?Qd(s,!0):Cx(s)}function QM(s,c){var d={};return c=qt(c,3),As(s,function(_,A,R){Xs(d,c(_,A,R),_)}),d}function jM(s,c){var d={};return c=qt(c,3),As(s,function(_,A,R){Xs(d,A,c(_,A,R))}),d}var tS=gu(function(s,c,d){sc(s,c,d)}),Mm=gu(function(s,c,d,_){sc(s,c,d,_)}),eS=$s(function(s,c){var d={};if(s==null)return d;var _=!1;c=Hn(c,function(R){return R=ga(R,s),_||(_=R.length>1),R}),Ts(s,ch(s),d),_&&(d=$o(d,x|E|b,Zx));for(var A=c.length;A--;)nh(d,c[A]);return d});function nS(s,c){return Sm(s,Ec(qt(c)))}var rS=$s(function(s,c){return s==null?{}:Px(s,c)});function Sm(s,c){if(s==null)return{};var d=Hn(ch(s),function(_){return[_]});return c=qt(c),gg(s,d,function(_,A){return c(_,A[0])})}function iS(s,c,d){c=ga(c,s);var _=-1,A=c.length;for(A||(A=1,s=o);++_<A;){var R=s==null?o:s[Cs(c[_])];R===o&&(_=A,R=d),s=Js(R)?R.call(s):R}return s}function oS(s,c,d){return s==null?s:dl(s,c,d)}function sS(s,c,d,_){return _=typeof _=="function"?_:o,s==null?s:dl(s,c,d,_)}var bm=Ug(ni),Am=Ug(mo);function aS(s,c,d){var _=ne(s),A=_||ya(s)||vu(s);if(c=qt(c,4),d==null){var R=s&&s.constructor;A?d=_?new R:[]:lr(s)?d=Js(R)?qs(qo(s)):{}:d={}}return(A?Zr:As)(s,function(H,X,Q){return c(d,H,X,Q)}),d}function uS(s,c){return s==null?!0:nh(s,c)}function lS(s,c,d){return s==null?s:xg(s,c,oh(d))}function cS(s,c,d,_){return _=typeof _=="function"?_:o,s==null?s:xg(s,c,oh(d),_)}function _u(s){return s==null?[]:So(s,ni(s))}function fS(s){return s==null?[]:So(s,mo(s))}function hS(s,c,d){return d===o&&(d=c,c=o),d!==o&&(d=Ko(d),d=d===d?d:0),c!==o&&(c=Ko(c),c=c===c?c:0),Wa(Ko(s),c,d)}function pS(s,c,d){return c=Ks(c),d===o?(d=c,c=0):d=Ks(d),s=Ko(s),_x(s,c,d)}function dS(s,c,d){if(d&&typeof d!="boolean"&&Wi(s,c,d)&&(c=d=o),d===o&&(typeof c=="boolean"?(d=c,c=o):typeof s=="boolean"&&(d=s,s=o)),s===o&&c===o?(s=0,c=1):(s=Ks(s),c===o?(c=s,s=0):c=Ks(c)),s>c){var _=s;s=c,c=_}if(d||s%1||c%1){var A=nc();return Dn(s+A*(c-s+Jl("1e-"+((A+"").length-1))),c)}return jf(s,c)}var gS=mu(function(s,c,d){return c=c.toLowerCase(),s+(d?Tm(c):c)});function Tm(s){return Ah(Tn(s).toLowerCase())}function Cm(s){return s=Tn(s),s&&s.replace(kn,bo).replace(on,"")}function mS(s,c,d){s=Tn(s),c=Lo(c);var _=s.length;d=d===o?_:Wa(ae(d),0,_);var A=d;return d-=c.length,d>=0&&s.slice(d,A)==c}function yS(s){return s=Tn(s),s&&rt.test(s)?s.replace(at,vs):s}function vS(s){return s=Tn(s),s&&pr.test(s)?s.replace(Mn,"\\\\$&"):s}var _S=mu(function(s,c,d){return s+(d?"-":"")+c.toLowerCase()}),xS=mu(function(s,c,d){return s+(d?" ":"")+c.toLowerCase()}),ES=Rg("toLowerCase");function wS(s,c,d){s=Tn(s),c=ae(c);var _=c?Gs(s):0;if(!c||_>=c)return s;var A=(c-_)/2;return hc(ur(A),d)+s+hc($n(A),d)}function MS(s,c,d){s=Tn(s),c=ae(c);var _=c?Gs(s):0;return c&&_<c?s+hc(c-_,d):s}function SS(s,c,d){s=Tn(s),c=ae(c);var _=c?Gs(s):0;return c&&_<c?hc(c-_,d)+s:s}function bS(s,c,d){return d||c==null?c=0:c&&(c=+c),Ha(Tn(s).replace(Wn,""),c||0)}function AS(s,c,d){return(d?Wi(s,c,d):c===o)?c=1:c=ae(c),th(Tn(s),c)}function TS(){var s=arguments,c=Tn(s[0]);return s.length<3?c:c.replace(s[1],s[2])}var CS=mu(function(s,c,d){return s+(d?"_":"")+c.toLowerCase()});function IS(s,c,d){return d&&typeof d!="number"&&Wi(s,c,d)&&(c=d=o),d=d===o?Pt:d>>>0,d?(s=Tn(s),s&&(typeof c=="string"||c!=null&&!Mh(c))&&(c=Lo(c),!c&&ks(s))?ma(ao(s),0,d):s.split(c,d)):[]}var PS=mu(function(s,c,d){return s+(d?" ":"")+Ah(c)});function RS(s,c,d){return s=Tn(s),d=d==null?0:Wa(ae(d),0,s.length),c=Lo(c),s.slice(d,d+c.length)==c}function LS(s,c,d){var _=I.templateSettings;d&&Wi(s,c,d)&&(c=o),s=Tn(s),c=Sc({},c,_,Bg);var A=Sc({},c.imports,_.imports,Bg),R=ni(A),H=So(A,R),X,Q,ht=0,pt=c.interpolate||xn,gt="__p += \'",Ct=Io((c.escape||xn).source+"|"+pt.source+"|"+(pt===Gt?zn:xn).source+"|"+(c.evaluate||xn).source+"|$","g"),Bt="//# sourceURL="+(fe.call(c,"sourceURL")?(c.sourceURL+"").replace(/\\s/g," "):"lodash.templateSources["+ ++$r+"]")+`\n`;s.replace(Ct,function(Zt,qe,sn,Do,qi,Oo){return sn||(sn=Do),gt+=s.slice(ht,Oo).replace(La,Ho),qe&&(X=!0,gt+=`\' +\n__e(`+qe+`) +\n\'`),qi&&(Q=!0,gt+=`\';\n`+qi+`;\n__p += \'`),sn&&(gt+=`\' +\n((__t = (`+sn+`)) == null ? \'\' : __t) +\n\'`),ht=Oo+Zt.length,Zt}),gt+=`\';\n`;var $t=fe.call(c,"variable")&&c.variable;if(!$t)gt=`with (obj) {\n`+gt+`\n}\n`;else if(Bn.test($t))throw new Dt(h);gt=(Q?gt.replace(B,""):gt).replace(st,"$1").replace(K,"$1;"),gt="function("+($t||"obj")+`) {\n`+($t?"":`obj || (obj = {});\n`)+"var __t, __p = \'\'"+(X?", __e = _.escape":"")+(Q?`, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, \'\') }\n`:`;\n`)+gt+`return __p\n}`;var ce=Pm(function(){return te(R,Bt+"return "+gt).apply(o,H)});if(ce.source=gt,wh(ce))throw ce;return ce}function NS(s){return Tn(s).toLowerCase()}function DS(s){return Tn(s).toUpperCase()}function OS(s,c,d){if(s=Tn(s),s&&(d||c===o))return jl(s);if(!s||!(c=Lo(c)))return s;var _=ao(s),A=ao(c),R=ts(_,A),H=Kr(_,A)+1;return ma(_,R,H).join("")}function FS(s,c,d){if(s=Tn(s),s&&(d||c===o))return s.slice(0,_s(s)+1);if(!s||!(c=Lo(c)))return s;var _=ao(s),A=Kr(_,ao(c))+1;return ma(_,0,A).join("")}function US(s,c,d){if(s=Tn(s),s&&(d||c===o))return s.replace(Wn,"");if(!s||!(c=Lo(c)))return s;var _=ao(s),A=ts(_,ao(c));return ma(_,A).join("")}function BS(s,c){var d=U,_=wt;if(lr(c)){var A="separator"in c?c.separator:A;d="length"in c?ae(c.length):d,_="omission"in c?Lo(c.omission):_}s=Tn(s);var R=s.length;if(ks(s)){var H=ao(s);R=H.length}if(d>=R)return s;var X=d-Gs(_);if(X<1)return _;var Q=H?ma(H,0,X).join(""):s.slice(0,X);if(A===o)return Q+_;if(H&&(X+=Q.length-X),Mh(A)){if(s.slice(X).search(A)){var ht,pt=Q;for(A.global||(A=Io(A.source,Tn(_n.exec(A))+"g")),A.lastIndex=0;ht=A.exec(pt);)var gt=ht.index;Q=Q.slice(0,gt===o?X:gt)}}else if(s.indexOf(Lo(A),X)!=X){var Ct=Q.lastIndexOf(A);Ct>-1&&(Q=Q.slice(0,Ct))}return Q+_}function zS(s){return s=Tn(s),s&&j.test(s)?s.replace(ct,To):s}var kS=mu(function(s,c,d){return s+(d?" ":"")+c.toUpperCase()}),Ah=Rg("toUpperCase");function Im(s,c,d){return s=Tn(s),c=d?o:c,c===o?fu(s)?Nr(s):ee(s):s.match(c)||[]}var Pm=he(function(s,c){try{return bt(s,o,c)}catch(d){return wh(d)?d:new Dt(d)}}),GS=$s(function(s,c){return Zr(c,function(d){d=Cs(d),Xs(s,d,xh(s[d],s))}),s});function HS(s){var c=s==null?0:s.length,d=qt();return s=c?Hn(s,function(_){if(typeof _[1]!="function")throw new pn(l);return[d(_[0]),_[1]]}):[],he(function(_){for(var A=-1;++A<c;){var R=s[A];if(bt(R[0],this,_))return bt(R[1],this,_)}})}function VS(s){return dx($o(s,x))}function Th(s){return function(){return s}}function WS(s,c){return s==null||s!==s?c:s}var qS=Ng(),XS=Ng(!0);function yo(s){return s}function Ch(s){return lg(typeof s=="function"?s:$o(s,x))}function YS(s){return fg($o(s,x))}function $S(s,c){return hg(s,$o(c,x))}var ZS=he(function(s,c){return function(d){return hl(d,s,c)}}),JS=he(function(s,c){return function(d){return hl(s,d,c)}});function Ih(s,c,d){var _=ni(c),A=oc(c,_);d==null&&!(lr(c)&&(A.length||!_.length))&&(d=c,c=s,s=this,A=oc(c,ni(c)));var R=!(lr(d)&&"chain"in d)||!!d.chain,H=Js(s);return Zr(A,function(X){var Q=c[X];s[X]=Q,H&&(s.prototype[X]=function(){var ht=this.__chain__;if(R||ht){var pt=s(this.__wrapped__),gt=pt.__actions__=po(this.__actions__);return gt.push({func:Q,args:arguments,thisArg:s}),pt.__chain__=ht,pt}return Q.apply(s,jt([this.value()],arguments))})}),s}function KS(){return sr._===this&&(sr._=lo),this}function Ph(){}function QS(s){return s=ae(s),he(function(c){return pg(c,s)})}var jS=ah(Hn),tb=ah(Bi),eb=ah(zs);function Rm(s){return dh(s)?Go(Cs(s)):Rx(s)}function nb(s){return function(c){return s==null?o:qa(s,c)}}var rb=Og(),ib=Og(!0);function Rh(){return[]}function Lh(){return!1}function ob(){return{}}function sb(){return""}function ab(){return!0}function ub(s,c){if(s=ae(s),s<1||s>Kt)return[];var d=Pt,_=Dn(s,Pt);c=qt(c),s-=Pt;for(var A=zr(_,c);++d<s;)c(d);return A}function lb(s){return ne(s)?Hn(s,Cs):No(s)?[s]:po(Kg(Tn(s)))}function cb(s){var c=++Qr;return Tn(s)+c}var fb=fc(function(s,c){return s+c},0),hb=uh("ceil"),pb=fc(function(s,c){return s/c},1),db=uh("floor");function gb(s){return s&&s.length?ic(s,yo,Yf):o}function mb(s,c){return s&&s.length?ic(s,qt(c,2),Yf):o}function yb(s){return ol(s,yo)}function vb(s,c){return ol(s,qt(c,2))}function _b(s){return s&&s.length?ic(s,yo,Kf):o}function xb(s,c){return s&&s.length?ic(s,qt(c,2),Kf):o}var Eb=fc(function(s,c){return s*c},1),wb=uh("round"),Mb=fc(function(s,c){return s-c},0);function Sb(s){return s&&s.length?zi(s,yo):0}function bb(s,c){return s&&s.length?zi(s,qt(c,2)):0}return I.after=Yw,I.ary=um,I.assign=DM,I.assignIn=wm,I.assignInWith=Sc,I.assignWith=OM,I.at=FM,I.before=lm,I.bind=xh,I.bindAll=GS,I.bindKey=cm,I.castArray=oM,I.chain=om,I.chunk=dE,I.compact=gE,I.concat=mE,I.cond=HS,I.conforms=VS,I.constant=Th,I.countBy=Sw,I.create=UM,I.curry=fm,I.curryRight=hm,I.debounce=pm,I.defaults=BM,I.defaultsDeep=zM,I.defer=$w,I.delay=Zw,I.difference=yE,I.differenceBy=vE,I.differenceWith=_E,I.drop=xE,I.dropRight=EE,I.dropRightWhile=wE,I.dropWhile=ME,I.fill=SE,I.filter=Aw,I.flatMap=Iw,I.flatMapDeep=Pw,I.flatMapDepth=Rw,I.flatten=em,I.flattenDeep=bE,I.flattenDepth=AE,I.flip=Jw,I.flow=qS,I.flowRight=XS,I.fromPairs=TE,I.functions=XM,I.functionsIn=YM,I.groupBy=Lw,I.initial=IE,I.intersection=PE,I.intersectionBy=RE,I.intersectionWith=LE,I.invert=ZM,I.invertBy=JM,I.invokeMap=Dw,I.iteratee=Ch,I.keyBy=Ow,I.keys=ni,I.keysIn=mo,I.map=vc,I.mapKeys=QM,I.mapValues=jM,I.matches=YS,I.matchesProperty=$S,I.memoize=xc,I.merge=tS,I.mergeWith=Mm,I.method=ZS,I.methodOf=JS,I.mixin=Ih,I.negate=Ec,I.nthArg=QS,I.omit=eS,I.omitBy=nS,I.once=Kw,I.orderBy=Fw,I.over=jS,I.overArgs=Qw,I.overEvery=tb,I.overSome=eb,I.partial=Eh,I.partialRight=dm,I.partition=Uw,I.pick=rS,I.pickBy=Sm,I.property=Rm,I.propertyOf=nb,I.pull=FE,I.pullAll=rm,I.pullAllBy=UE,I.pullAllWith=BE,I.pullAt=zE,I.range=rb,I.rangeRight=ib,I.rearg=jw,I.reject=kw,I.remove=kE,I.rest=tM,I.reverse=vh,I.sampleSize=Hw,I.set=oS,I.setWith=sS,I.shuffle=Vw,I.slice=GE,I.sortBy=Xw,I.sortedUniq=$E,I.sortedUniqBy=ZE,I.split=IS,I.spread=eM,I.tail=JE,I.take=KE,I.takeRight=QE,I.takeRightWhile=jE,I.takeWhile=tw,I.tap=gw,I.throttle=nM,I.thru=yc,I.toArray=_m,I.toPairs=bm,I.toPairsIn=Am,I.toPath=lb,I.toPlainObject=Em,I.transform=aS,I.unary=rM,I.union=ew,I.unionBy=nw,I.unionWith=rw,I.uniq=iw,I.uniqBy=ow,I.uniqWith=sw,I.unset=uS,I.unzip=_h,I.unzipWith=im,I.update=lS,I.updateWith=cS,I.values=_u,I.valuesIn=fS,I.without=aw,I.words=Im,I.wrap=iM,I.xor=uw,I.xorBy=lw,I.xorWith=cw,I.zip=fw,I.zipObject=hw,I.zipObjectDeep=pw,I.zipWith=dw,I.entries=bm,I.entriesIn=Am,I.extend=wm,I.extendWith=Sc,Ih(I,I),I.add=fb,I.attempt=Pm,I.camelCase=gS,I.capitalize=Tm,I.ceil=hb,I.clamp=hS,I.clone=sM,I.cloneDeep=uM,I.cloneDeepWith=lM,I.cloneWith=aM,I.conformsTo=cM,I.deburr=Cm,I.defaultTo=WS,I.divide=pb,I.endsWith=mS,I.eq=ss,I.escape=yS,I.escapeRegExp=vS,I.every=bw,I.find=Tw,I.findIndex=jg,I.findKey=kM,I.findLast=Cw,I.findLastIndex=tm,I.findLastKey=GM,I.floor=db,I.forEach=sm,I.forEachRight=am,I.forIn=HM,I.forInRight=VM,I.forOwn=WM,I.forOwnRight=qM,I.get=Sh,I.gt=fM,I.gte=hM,I.has=$M,I.hasIn=bh,I.head=nm,I.identity=yo,I.includes=Nw,I.indexOf=CE,I.inRange=pS,I.invoke=KM,I.isArguments=$a,I.isArray=ne,I.isArrayBuffer=pM,I.isArrayLike=go,I.isArrayLikeObject=Cr,I.isBoolean=dM,I.isBuffer=ya,I.isDate=gM,I.isElement=mM,I.isEmpty=yM,I.isEqual=vM,I.isEqualWith=_M,I.isError=wh,I.isFinite=xM,I.isFunction=Js,I.isInteger=gm,I.isLength=wc,I.isMap=mm,I.isMatch=EM,I.isMatchWith=wM,I.isNaN=MM,I.isNative=SM,I.isNil=AM,I.isNull=bM,I.isNumber=ym,I.isObject=lr,I.isObjectLike=vr,I.isPlainObject=vl,I.isRegExp=Mh,I.isSafeInteger=TM,I.isSet=vm,I.isString=Mc,I.isSymbol=No,I.isTypedArray=vu,I.isUndefined=CM,I.isWeakMap=IM,I.isWeakSet=PM,I.join=NE,I.kebabCase=_S,I.last=Jo,I.lastIndexOf=DE,I.lowerCase=xS,I.lowerFirst=ES,I.lt=RM,I.lte=LM,I.max=gb,I.maxBy=mb,I.mean=yb,I.meanBy=vb,I.min=_b,I.minBy=xb,I.stubArray=Rh,I.stubFalse=Lh,I.stubObject=ob,I.stubString=sb,I.stubTrue=ab,I.multiply=Eb,I.nth=OE,I.noConflict=KS,I.noop=Ph,I.now=_c,I.pad=wS,I.padEnd=MS,I.padStart=SS,I.parseInt=bS,I.random=dS,I.reduce=Bw,I.reduceRight=zw,I.repeat=AS,I.replace=TS,I.result=iS,I.round=wb,I.runInContext=J,I.sample=Gw,I.size=Ww,I.snakeCase=CS,I.some=qw,I.sortedIndex=HE,I.sortedIndexBy=VE,I.sortedIndexOf=WE,I.sortedLastIndex=qE,I.sortedLastIndexBy=XE,I.sortedLastIndexOf=YE,I.startCase=PS,I.startsWith=RS,I.subtract=Mb,I.sum=Sb,I.sumBy=bb,I.template=LS,I.times=ub,I.toFinite=Ks,I.toInteger=ae,I.toLength=xm,I.toLower=NS,I.toNumber=Ko,I.toSafeInteger=NM,I.toString=Tn,I.toUpper=DS,I.trim=OS,I.trimEnd=FS,I.trimStart=US,I.truncate=BS,I.unescape=zS,I.uniqueId=cb,I.upperCase=kS,I.upperFirst=Ah,I.each=sm,I.eachRight=am,I.first=nm,Ih(I,function(){var s={};return As(I,function(c,d){fe.call(I.prototype,d)||(s[d]=c)}),s}(),{chain:!1}),I.VERSION=e,Zr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){I[s].placeholder=I}),Zr(["drop","take"],function(s,c){n.prototype[s]=function(d){d=d===o?1:Tr(ae(d),0);var _=this.__filtered__&&!c?new n(this):this.clone();return _.__filtered__?_.__takeCount__=Dn(d,_.__takeCount__):_.__views__.push({size:Dn(d,Pt),type:s+(_.__dir__<0?"Right":"")}),_},n.prototype[s+"Right"]=function(d){return this.reverse()[s](d).reverse()}}),Zr(["filter","map","takeWhile"],function(s,c){var d=c+1,_=d==W||d==yt;n.prototype[s]=function(A){var R=this.clone();return R.__iteratees__.push({iteratee:qt(A,3),type:d}),R.__filtered__=R.__filtered__||_,R}}),Zr(["head","last"],function(s,c){var d="take"+(c?"Right":"");n.prototype[s]=function(){return this[d](1).value()[0]}}),Zr(["initial","tail"],function(s,c){var d="drop"+(c?"":"Right");n.prototype[s]=function(){return this.__filtered__?new n(this):this[d](1)}}),n.prototype.compact=function(){return this.filter(yo)},n.prototype.find=function(s){return this.filter(s).head()},n.prototype.findLast=function(s){return this.reverse().find(s)},n.prototype.invokeMap=he(function(s,c){return typeof s=="function"?new n(this):this.map(function(d){return hl(d,s,c)})}),n.prototype.reject=function(s){return this.filter(Ec(qt(s)))},n.prototype.slice=function(s,c){s=ae(s);var d=this;return d.__filtered__&&(s>0||c<0)?new n(d):(s<0?d=d.takeRight(-s):s&&(d=d.drop(s)),c!==o&&(c=ae(c),d=c<0?d.dropRight(-c):d.take(c-s)),d)},n.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},n.prototype.toArray=function(){return this.take(Pt)},As(n.prototype,function(s,c){var d=/^(?:filter|find|map|reject)|While$/.test(c),_=/^(?:head|last)$/.test(c),A=I[_?"take"+(c=="last"?"Right":""):c],R=_||/^find/.test(c);A&&(I.prototype[c]=function(){var H=this.__wrapped__,X=_?[1]:arguments,Q=H instanceof n,ht=X[0],pt=Q||ne(H),gt=function(qe){var sn=A.apply(I,jt([qe],X));return _&&Ct?sn[0]:sn};pt&&d&&typeof ht=="function"&&ht.length!=1&&(Q=pt=!1);var Ct=this.__chain__,Bt=!!this.__actions__.length,$t=R&&!Ct,ce=Q&&!Bt;if(!R&&pt){H=ce?H:new n(this);var Zt=s.apply(H,X);return Zt.__actions__.push({func:yc,args:[gt],thisArg:o}),new t(Zt,Ct)}return $t&&ce?s.apply(this,X):(Zt=this.thru(gt),$t?_?Zt.value()[0]:Zt.value():Zt)})}),Zr(["pop","push","shift","sort","splice","unshift"],function(s){var c=er[s],d=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",_=/^(?:pop|shift)$/.test(s);I.prototype[s]=function(){var A=arguments;if(_&&!this.__chain__){var R=this.value();return c.apply(ne(R)?R:[],A)}return this[d](function(H){return c.apply(ne(H)?H:[],A)})}}),As(n.prototype,function(s,c){var d=I[c];if(d){var _=d.name+"";fe.call(Po,_)||(Po[_]=[]),Po[_].push({name:c,func:d})}}),Po[cc(o,G).name]=[{name:"wrapper",func:o}],n.prototype.clone=i,n.prototype.reverse=a,n.prototype.value=f,I.prototype.at=mw,I.prototype.chain=yw,I.prototype.commit=vw,I.prototype.next=_w,I.prototype.plant=Ew,I.prototype.reverse=ww,I.prototype.toJSON=I.prototype.valueOf=I.prototype.value=Mw,I.prototype.first=I.prototype.head,ca&&(I.prototype[ca]=xw),I},di=Co();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(sr._=di,define(function(){return di})):ro?((ro.exports=di)._=di,rl._=di):sr._=di}).call(Ju)});var Z1=It((j$,$1)=>{$1.exports=function(e,r){return e[0]=r[0],e[1]=r[1],e}});var Q1=It((tZ,K1)=>{var J1=Z1();K1.exports=function(o,e){Array.isArray(e)||(e=[]),o.length>0&&e.push(J1([0,0],o[0]));for(var r=0;r<o.length-1;r++){var u=o[r],l=o[r+1],h=u[0],p=u[1],m=l[0],y=l[1],x=[.75*h+.25*m,.75*p+.25*y],E=[.25*h+.75*m,.25*p+.75*y];e.push(x),e.push(E)}return o.length>1&&e.push(J1([0,0],o[o.length-1])),e}});var Li=nr($m(),1);var S0="169";var Zm=0,Jm=1,Km=2,Qm=3,jm=4,t0=5,e0=6,n0=7;var b0=300;var r0=1e3,bc=1001,i0=1002;var Ob=1006;var Fb=1008;var Ub=1009;var Bb=1023;var Rc=2300,Vh=2301,Oh=2302,o0=2400,s0=2401,a0=2402;var A0="",xa="srgb",ip="srgb-linear",zb="display-p3",T0="display-p3-linear",Wh="linear",u0="srgb",l0="rec709",c0="p3";var Ac=2e3,f0=2001,Lc=class{addEventListener(e,r){this._listeners===void 0&&(this._listeners={});let u=this._listeners;u[e]===void 0&&(u[e]=[]),u[e].indexOf(r)===-1&&u[e].push(r)}hasEventListener(e,r){if(this._listeners===void 0)return!1;let u=this._listeners;return u[e]!==void 0&&u[e].indexOf(r)!==-1}removeEventListener(e,r){if(this._listeners===void 0)return;let l=this._listeners[e];if(l!==void 0){let h=l.indexOf(r);h!==-1&&l.splice(h,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let u=this._listeners[e.type];if(u!==void 0){e.target=this;let l=u.slice(0);for(let h=0,p=l.length;h<p;h++)l[h].call(this,e);e.target=null}}},Ci=["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 xN=Math.PI/180,EN=180/Math.PI;function op(){let o=Math.random()*4294967295|0,e=Math.random()*4294967295|0,r=Math.random()*4294967295|0,u=Math.random()*4294967295|0;return(Ci[o&255]+Ci[o>>8&255]+Ci[o>>16&255]+Ci[o>>24&255]+"-"+Ci[e&255]+Ci[e>>8&255]+"-"+Ci[e>>16&15|64]+Ci[e>>24&255]+"-"+Ci[r&63|128]+Ci[r>>8&255]+"-"+Ci[r>>16&255]+Ci[r>>24&255]+Ci[u&255]+Ci[u>>8&255]+Ci[u>>16&255]+Ci[u>>24&255]).toLowerCase()}function _o(o,e,r){return Math.max(e,Math.min(r,o))}function kb(o,e){return(o%e+e)%e}function Fh(o,e,r){return(1-r)*o+r*e}var Xi=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,u=this.y,l=e.elements;return this.x=l[0]*r+l[3]*u+l[6],this.y=l[1]*r+l[4]*u+l[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 u=this.length();return this.divideScalar(u||1).multiplyScalar(Math.max(e,Math.min(r,u)))}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 u=this.dot(e)/r;return Math.acos(_o(u,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let r=this.x-e.x,u=this.y-e.y;return r*r+u*u}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,u){return this.x=e.x+(r.x-e.x)*u,this.y=e.y+(r.y-e.y)*u,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 u=Math.cos(r),l=Math.sin(r),h=this.x-e.x,p=this.y-e.y;return this.x=h*u-p*l+e.x,this.y=h*l+p*u+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},me=class o{constructor(e,r,u,l,h,p,m,y,x){o.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,r,u,l,h,p,m,y,x)}set(e,r,u,l,h,p,m,y,x){let E=this.elements;return E[0]=e,E[1]=l,E[2]=m,E[3]=r,E[4]=h,E[5]=y,E[6]=u,E[7]=p,E[8]=x,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let r=this.elements,u=e.elements;return r[0]=u[0],r[1]=u[1],r[2]=u[2],r[3]=u[3],r[4]=u[4],r[5]=u[5],r[6]=u[6],r[7]=u[7],r[8]=u[8],this}extractBasis(e,r,u){return e.setFromMatrix3Column(this,0),r.setFromMatrix3Column(this,1),u.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 u=e.elements,l=r.elements,h=this.elements,p=u[0],m=u[3],y=u[6],x=u[1],E=u[4],b=u[7],M=u[2],C=u[5],D=u[8],G=l[0],O=l[3],L=l[6],k=l[1],F=l[4],$=l[7],Z=l[2],it=l[5],et=l[8];return h[0]=p*G+m*k+y*Z,h[3]=p*O+m*F+y*it,h[6]=p*L+m*$+y*et,h[1]=x*G+E*k+b*Z,h[4]=x*O+E*F+b*it,h[7]=x*L+E*$+b*et,h[2]=M*G+C*k+D*Z,h[5]=M*O+C*F+D*it,h[8]=M*L+C*$+D*et,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],u=e[1],l=e[2],h=e[3],p=e[4],m=e[5],y=e[6],x=e[7],E=e[8];return r*p*E-r*m*x-u*h*E+u*m*y+l*h*x-l*p*y}invert(){let e=this.elements,r=e[0],u=e[1],l=e[2],h=e[3],p=e[4],m=e[5],y=e[6],x=e[7],E=e[8],b=E*p-m*x,M=m*y-E*h,C=x*h-p*y,D=r*b+u*M+l*C;if(D===0)return this.set(0,0,0,0,0,0,0,0,0);let G=1/D;return e[0]=b*G,e[1]=(l*x-E*u)*G,e[2]=(m*u-l*p)*G,e[3]=M*G,e[4]=(E*r-l*y)*G,e[5]=(l*h-m*r)*G,e[6]=C*G,e[7]=(u*y-x*r)*G,e[8]=(p*r-u*h)*G,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,u,l,h,p,m){let y=Math.cos(h),x=Math.sin(h);return this.set(u*y,u*x,-u*(y*p+x*m)+p+e,-l*x,l*y,-l*(-x*p+y*m)+m+r,0,0,1),this}scale(e,r){return this.premultiply(Uh.makeScale(e,r)),this}rotate(e){return this.premultiply(Uh.makeRotation(-e)),this}translate(e,r){return this.premultiply(Uh.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),u=Math.sin(e);return this.set(r,-u,0,u,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,u=e.elements;for(let l=0;l<9;l++)if(r[l]!==u[l])return!1;return!0}fromArray(e,r=0){for(let u=0;u<9;u++)this.elements[u]=e[u+r];return this}toArray(e=[],r=0){let u=this.elements;return e[r]=u[0],e[r+1]=u[1],e[r+2]=u[2],e[r+3]=u[3],e[r+4]=u[4],e[r+5]=u[5],e[r+6]=u[6],e[r+7]=u[7],e[r+8]=u[8],e}clone(){return new this.constructor().fromArray(this.elements)}},Uh=new me;function h0(o){return document.createElementNS("http://www.w3.org/1999/xhtml",o)}var p0=new me().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),d0=new me().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),_l={[ip]:{transfer:Wh,primaries:l0,luminanceCoefficients:[.2126,.7152,.0722],toReference:o=>o,fromReference:o=>o},[xa]:{transfer:u0,primaries:l0,luminanceCoefficients:[.2126,.7152,.0722],toReference:o=>o.convertSRGBToLinear(),fromReference:o=>o.convertLinearToSRGB()},[T0]:{transfer:Wh,primaries:c0,luminanceCoefficients:[.2289,.6917,.0793],toReference:o=>o.applyMatrix3(d0),fromReference:o=>o.applyMatrix3(p0)},[zb]:{transfer:u0,primaries:c0,luminanceCoefficients:[.2289,.6917,.0793],toReference:o=>o.convertSRGBToLinear().applyMatrix3(d0),fromReference:o=>o.applyMatrix3(p0).convertLinearToSRGB()}},Gb=new Set([ip,T0]),us={enabled:!0,_workingColorSpace:ip,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(o){if(!Gb.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 u=_l[e].toReference,l=_l[r].fromReference;return l(u(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 _l[o].primaries},getTransfer:function(o){return o===A0?Wh:_l[o].transfer},getLuminanceCoefficients:function(o,e=this._workingColorSpace){return o.fromArray(_l[e].luminanceCoefficients)}};function bu(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function Bh(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}var xu,qh=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let r;if(e instanceof HTMLCanvasElement)r=e;else{xu===void 0&&(xu=h0("canvas")),xu.width=e.width,xu.height=e.height;let u=xu.getContext("2d");e instanceof ImageData?u.putImageData(e,0,0):u.drawImage(e,0,0,e.width,e.height),r=xu}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<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let r=h0("canvas");r.width=e.width,r.height=e.height;let u=r.getContext("2d");u.drawImage(e,0,0,e.width,e.height);let l=u.getImageData(0,0,e.width,e.height),h=l.data;for(let p=0;p<h.length;p++)h[p]=bu(h[p]/255)*255;return u.putImageData(l,0,0),r}else if(e.data){let r=e.data.slice(0);for(let u=0;u<r.length;u++)r instanceof Uint8Array||r instanceof Uint8ClampedArray?r[u]=Math.floor(bu(r[u]/255)*255):r[u]=bu(r[u]);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}},Hb=0,Xh=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Hb++}),this.uuid=op(),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 u={uuid:this.uuid,url:""},l=this.data;if(l!==null){let h;if(Array.isArray(l)){h=[];for(let p=0,m=l.length;p<m;p++)l[p].isDataTexture?h.push(zh(l[p].image)):h.push(zh(l[p]))}else h=zh(l);u.url=h}return r||(e.images[this.uuid]=u),u}};function zh(o){return typeof HTMLImageElement<"u"&&o instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&o instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&o instanceof ImageBitmap?qh.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 Vb=0,El=class o extends Lc{constructor(e=o.DEFAULT_IMAGE,r=o.DEFAULT_MAPPING,u=bc,l=bc,h=Ob,p=Fb,m=Bb,y=Ub,x=o.DEFAULT_ANISOTROPY,E=A0){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Vb++}),this.uuid=op(),this.name="",this.source=new Xh(e),this.mipmaps=[],this.mapping=r,this.channel=0,this.wrapS=u,this.wrapT=l,this.magFilter=h,this.minFilter=p,this.anisotropy=x,this.format=m,this.internalFormat=null,this.type=y,this.offset=new Xi(0,0),this.repeat=new Xi(1,1),this.center=new Xi(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new me,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=E,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 u={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&&(u.userData=this.userData),r||(e.textures[this.uuid]=u),u}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==b0)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case r0:e.x=e.x-Math.floor(e.x);break;case bc:e.x=e.x<0?0:1;break;case i0: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 r0:e.y=e.y-Math.floor(e.y);break;case bc:e.y=e.y<0?0:1;break;case i0: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++}};El.DEFAULT_IMAGE=null;El.DEFAULT_MAPPING=b0;El.DEFAULT_ANISOTROPY=1;var wa=class{constructor(e=0,r=0,u=0,l=1){this.isQuaternion=!0,this._x=e,this._y=r,this._z=u,this._w=l}static slerpFlat(e,r,u,l,h,p,m){let y=u[l+0],x=u[l+1],E=u[l+2],b=u[l+3],M=h[p+0],C=h[p+1],D=h[p+2],G=h[p+3];if(m===0){e[r+0]=y,e[r+1]=x,e[r+2]=E,e[r+3]=b;return}if(m===1){e[r+0]=M,e[r+1]=C,e[r+2]=D,e[r+3]=G;return}if(b!==G||y!==M||x!==C||E!==D){let O=1-m,L=y*M+x*C+E*D+b*G,k=L>=0?1:-1,F=1-L*L;if(F>Number.EPSILON){let Z=Math.sqrt(F),it=Math.atan2(Z,L*k);O=Math.sin(O*it)/Z,m=Math.sin(m*it)/Z}let $=m*k;if(y=y*O+M*$,x=x*O+C*$,E=E*O+D*$,b=b*O+G*$,O===1-m){let Z=1/Math.sqrt(y*y+x*x+E*E+b*b);y*=Z,x*=Z,E*=Z,b*=Z}}e[r]=y,e[r+1]=x,e[r+2]=E,e[r+3]=b}static multiplyQuaternionsFlat(e,r,u,l,h,p){let m=u[l],y=u[l+1],x=u[l+2],E=u[l+3],b=h[p],M=h[p+1],C=h[p+2],D=h[p+3];return e[r]=m*D+E*b+y*C-x*M,e[r+1]=y*D+E*M+x*b-m*C,e[r+2]=x*D+E*C+m*M-y*b,e[r+3]=E*D-m*b-y*M-x*C,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,u,l){return this._x=e,this._y=r,this._z=u,this._w=l,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 u=e._x,l=e._y,h=e._z,p=e._order,m=Math.cos,y=Math.sin,x=m(u/2),E=m(l/2),b=m(h/2),M=y(u/2),C=y(l/2),D=y(h/2);switch(p){case"XYZ":this._x=M*E*b+x*C*D,this._y=x*C*b-M*E*D,this._z=x*E*D+M*C*b,this._w=x*E*b-M*C*D;break;case"YXZ":this._x=M*E*b+x*C*D,this._y=x*C*b-M*E*D,this._z=x*E*D-M*C*b,this._w=x*E*b+M*C*D;break;case"ZXY":this._x=M*E*b-x*C*D,this._y=x*C*b+M*E*D,this._z=x*E*D+M*C*b,this._w=x*E*b-M*C*D;break;case"ZYX":this._x=M*E*b-x*C*D,this._y=x*C*b+M*E*D,this._z=x*E*D-M*C*b,this._w=x*E*b+M*C*D;break;case"YZX":this._x=M*E*b+x*C*D,this._y=x*C*b+M*E*D,this._z=x*E*D-M*C*b,this._w=x*E*b-M*C*D;break;case"XZY":this._x=M*E*b-x*C*D,this._y=x*C*b-M*E*D,this._z=x*E*D+M*C*b,this._w=x*E*b+M*C*D;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+p)}return r===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,r){let u=r/2,l=Math.sin(u);return this._x=e.x*l,this._y=e.y*l,this._z=e.z*l,this._w=Math.cos(u),this._onChangeCallback(),this}setFromRotationMatrix(e){let r=e.elements,u=r[0],l=r[4],h=r[8],p=r[1],m=r[5],y=r[9],x=r[2],E=r[6],b=r[10],M=u+m+b;if(M>0){let C=.5/Math.sqrt(M+1);this._w=.25/C,this._x=(E-y)*C,this._y=(h-x)*C,this._z=(p-l)*C}else if(u>m&&u>b){let C=2*Math.sqrt(1+u-m-b);this._w=(E-y)/C,this._x=.25*C,this._y=(l+p)/C,this._z=(h+x)/C}else if(m>b){let C=2*Math.sqrt(1+m-u-b);this._w=(h-x)/C,this._x=(l+p)/C,this._y=.25*C,this._z=(y+E)/C}else{let C=2*Math.sqrt(1+b-u-m);this._w=(p-l)/C,this._x=(h+x)/C,this._y=(y+E)/C,this._z=.25*C}return this._onChangeCallback(),this}setFromUnitVectors(e,r){let u=e.dot(r)+1;return u<Number.EPSILON?(u=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=u):(this._x=0,this._y=-e.z,this._z=e.y,this._w=u)):(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=u),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(_o(this.dot(e),-1,1)))}rotateTowards(e,r){let u=this.angleTo(e);if(u===0)return this;let l=Math.min(1,r/u);return this.slerp(e,l),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 u=e._x,l=e._y,h=e._z,p=e._w,m=r._x,y=r._y,x=r._z,E=r._w;return this._x=u*E+p*m+l*x-h*y,this._y=l*E+p*y+h*m-u*x,this._z=h*E+p*x+u*y-l*m,this._w=p*E-u*m-l*y-h*x,this._onChangeCallback(),this}slerp(e,r){if(r===0)return this;if(r===1)return this.copy(e);let u=this._x,l=this._y,h=this._z,p=this._w,m=p*e._w+u*e._x+l*e._y+h*e._z;if(m<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,m=-m):this.copy(e),m>=1)return this._w=p,this._x=u,this._y=l,this._z=h,this;let y=1-m*m;if(y<=Number.EPSILON){let C=1-r;return this._w=C*p+r*this._w,this._x=C*u+r*this._x,this._y=C*l+r*this._y,this._z=C*h+r*this._z,this.normalize(),this}let x=Math.sqrt(y),E=Math.atan2(x,m),b=Math.sin((1-r)*E)/x,M=Math.sin(r*E)/x;return this._w=p*b+this._w*M,this._x=u*b+this._x*M,this._y=l*b+this._y*M,this._z=h*b+this._z*M,this._onChangeCallback(),this}slerpQuaternions(e,r,u){return this.copy(e).slerp(r,u)}random(){let e=2*Math.PI*Math.random(),r=2*Math.PI*Math.random(),u=Math.random(),l=Math.sqrt(1-u),h=Math.sqrt(u);return this.set(l*Math.sin(e),l*Math.cos(e),h*Math.sin(r),h*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}},En=class o{constructor(e=0,r=0,u=0){o.prototype.isVector3=!0,this.x=e,this.y=r,this.z=u}set(e,r,u){return u===void 0&&(u=this.z),this.x=e,this.y=r,this.z=u,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(g0.setFromEuler(e))}applyAxisAngle(e,r){return this.applyQuaternion(g0.setFromAxisAngle(e,r))}applyMatrix3(e){let r=this.x,u=this.y,l=this.z,h=e.elements;return this.x=h[0]*r+h[3]*u+h[6]*l,this.y=h[1]*r+h[4]*u+h[7]*l,this.z=h[2]*r+h[5]*u+h[8]*l,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let r=this.x,u=this.y,l=this.z,h=e.elements,p=1/(h[3]*r+h[7]*u+h[11]*l+h[15]);return this.x=(h[0]*r+h[4]*u+h[8]*l+h[12])*p,this.y=(h[1]*r+h[5]*u+h[9]*l+h[13])*p,this.z=(h[2]*r+h[6]*u+h[10]*l+h[14])*p,this}applyQuaternion(e){let r=this.x,u=this.y,l=this.z,h=e.x,p=e.y,m=e.z,y=e.w,x=2*(p*l-m*u),E=2*(m*r-h*l),b=2*(h*u-p*r);return this.x=r+y*x+p*b-m*E,this.y=u+y*E+m*x-h*b,this.z=l+y*b+h*E-p*x,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,u=this.y,l=this.z,h=e.elements;return this.x=h[0]*r+h[4]*u+h[8]*l,this.y=h[1]*r+h[5]*u+h[9]*l,this.z=h[2]*r+h[6]*u+h[10]*l,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 u=this.length();return this.divideScalar(u||1).multiplyScalar(Math.max(e,Math.min(r,u)))}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,u){return this.x=e.x+(r.x-e.x)*u,this.y=e.y+(r.y-e.y)*u,this.z=e.z+(r.z-e.z)*u,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,r){let u=e.x,l=e.y,h=e.z,p=r.x,m=r.y,y=r.z;return this.x=l*y-h*m,this.y=h*p-u*y,this.z=u*m-l*p,this}projectOnVector(e){let r=e.lengthSq();if(r===0)return this.set(0,0,0);let u=e.dot(this)/r;return this.copy(e).multiplyScalar(u)}projectOnPlane(e){return kh.copy(this).projectOnVector(e),this.sub(kh)}reflect(e){return this.sub(kh.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 u=this.dot(e)/r;return Math.acos(_o(u,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let r=this.x-e.x,u=this.y-e.y,l=this.z-e.z;return r*r+u*u+l*l}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,u){let l=Math.sin(r)*e;return this.x=l*Math.sin(u),this.y=Math.cos(r)*e,this.z=l*Math.cos(u),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,r,u){return this.x=e*Math.sin(r),this.y=u,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(),u=this.setFromMatrixColumn(e,1).length(),l=this.setFromMatrixColumn(e,2).length();return this.x=r,this.y=u,this.z=l,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,u=Math.sqrt(1-r*r);return this.x=u*Math.cos(e),this.y=r,this.z=u*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},kh=new En,g0=new wa;var Ea=class o{constructor(e,r,u,l,h,p,m,y,x,E,b,M,C,D,G,O){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,u,l,h,p,m,y,x,E,b,M,C,D,G,O)}set(e,r,u,l,h,p,m,y,x,E,b,M,C,D,G,O){let L=this.elements;return L[0]=e,L[4]=r,L[8]=u,L[12]=l,L[1]=h,L[5]=p,L[9]=m,L[13]=y,L[2]=x,L[6]=E,L[10]=b,L[14]=M,L[3]=C,L[7]=D,L[11]=G,L[15]=O,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,u=e.elements;return r[0]=u[0],r[1]=u[1],r[2]=u[2],r[3]=u[3],r[4]=u[4],r[5]=u[5],r[6]=u[6],r[7]=u[7],r[8]=u[8],r[9]=u[9],r[10]=u[10],r[11]=u[11],r[12]=u[12],r[13]=u[13],r[14]=u[14],r[15]=u[15],this}copyPosition(e){let r=this.elements,u=e.elements;return r[12]=u[12],r[13]=u[13],r[14]=u[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,u){return e.setFromMatrixColumn(this,0),r.setFromMatrixColumn(this,1),u.setFromMatrixColumn(this,2),this}makeBasis(e,r,u){return this.set(e.x,r.x,u.x,0,e.y,r.y,u.y,0,e.z,r.z,u.z,0,0,0,0,1),this}extractRotation(e){let r=this.elements,u=e.elements,l=1/Eu.setFromMatrixColumn(e,0).length(),h=1/Eu.setFromMatrixColumn(e,1).length(),p=1/Eu.setFromMatrixColumn(e,2).length();return r[0]=u[0]*l,r[1]=u[1]*l,r[2]=u[2]*l,r[3]=0,r[4]=u[4]*h,r[5]=u[5]*h,r[6]=u[6]*h,r[7]=0,r[8]=u[8]*p,r[9]=u[9]*p,r[10]=u[10]*p,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromEuler(e){let r=this.elements,u=e.x,l=e.y,h=e.z,p=Math.cos(u),m=Math.sin(u),y=Math.cos(l),x=Math.sin(l),E=Math.cos(h),b=Math.sin(h);if(e.order==="XYZ"){let M=p*E,C=p*b,D=m*E,G=m*b;r[0]=y*E,r[4]=-y*b,r[8]=x,r[1]=C+D*x,r[5]=M-G*x,r[9]=-m*y,r[2]=G-M*x,r[6]=D+C*x,r[10]=p*y}else if(e.order==="YXZ"){let M=y*E,C=y*b,D=x*E,G=x*b;r[0]=M+G*m,r[4]=D*m-C,r[8]=p*x,r[1]=p*b,r[5]=p*E,r[9]=-m,r[2]=C*m-D,r[6]=G+M*m,r[10]=p*y}else if(e.order==="ZXY"){let M=y*E,C=y*b,D=x*E,G=x*b;r[0]=M-G*m,r[4]=-p*b,r[8]=D+C*m,r[1]=C+D*m,r[5]=p*E,r[9]=G-M*m,r[2]=-p*x,r[6]=m,r[10]=p*y}else if(e.order==="ZYX"){let M=p*E,C=p*b,D=m*E,G=m*b;r[0]=y*E,r[4]=D*x-C,r[8]=M*x+G,r[1]=y*b,r[5]=G*x+M,r[9]=C*x-D,r[2]=-x,r[6]=m*y,r[10]=p*y}else if(e.order==="YZX"){let M=p*y,C=p*x,D=m*y,G=m*x;r[0]=y*E,r[4]=G-M*b,r[8]=D*b+C,r[1]=b,r[5]=p*E,r[9]=-m*E,r[2]=-x*E,r[6]=C*b+D,r[10]=M-G*b}else if(e.order==="XZY"){let M=p*y,C=p*x,D=m*y,G=m*x;r[0]=y*E,r[4]=-b,r[8]=x*E,r[1]=M*b+G,r[5]=p*E,r[9]=C*b-D,r[2]=D*b-C,r[6]=m*E,r[10]=G*b+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(Wb,e,qb)}lookAt(e,r,u){let l=this.elements;return Fo.subVectors(e,r),Fo.lengthSq()===0&&(Fo.z=1),Fo.normalize(),va.crossVectors(u,Fo),va.lengthSq()===0&&(Math.abs(u.z)===1?Fo.x+=1e-4:Fo.z+=1e-4,Fo.normalize(),va.crossVectors(u,Fo)),va.normalize(),Tc.crossVectors(Fo,va),l[0]=va.x,l[4]=Tc.x,l[8]=Fo.x,l[1]=va.y,l[5]=Tc.y,l[9]=Fo.y,l[2]=va.z,l[6]=Tc.z,l[10]=Fo.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,r){let u=e.elements,l=r.elements,h=this.elements,p=u[0],m=u[4],y=u[8],x=u[12],E=u[1],b=u[5],M=u[9],C=u[13],D=u[2],G=u[6],O=u[10],L=u[14],k=u[3],F=u[7],$=u[11],Z=u[15],it=l[0],et=l[4],U=l[8],wt=l[12],Lt=l[1],Ot=l[5],W=l[9],de=l[13],yt=l[2],zt=l[6],Kt=l[10],ie=l[14],_t=l[3],Pt=l[7],q=l[11],oe=l[15];return h[0]=p*it+m*Lt+y*yt+x*_t,h[4]=p*et+m*Ot+y*zt+x*Pt,h[8]=p*U+m*W+y*Kt+x*q,h[12]=p*wt+m*de+y*ie+x*oe,h[1]=E*it+b*Lt+M*yt+C*_t,h[5]=E*et+b*Ot+M*zt+C*Pt,h[9]=E*U+b*W+M*Kt+C*q,h[13]=E*wt+b*de+M*ie+C*oe,h[2]=D*it+G*Lt+O*yt+L*_t,h[6]=D*et+G*Ot+O*zt+L*Pt,h[10]=D*U+G*W+O*Kt+L*q,h[14]=D*wt+G*de+O*ie+L*oe,h[3]=k*it+F*Lt+$*yt+Z*_t,h[7]=k*et+F*Ot+$*zt+Z*Pt,h[11]=k*U+F*W+$*Kt+Z*q,h[15]=k*wt+F*de+$*ie+Z*oe,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],u=e[4],l=e[8],h=e[12],p=e[1],m=e[5],y=e[9],x=e[13],E=e[2],b=e[6],M=e[10],C=e[14],D=e[3],G=e[7],O=e[11],L=e[15];return D*(+h*y*b-l*x*b-h*m*M+u*x*M+l*m*C-u*y*C)+G*(+r*y*C-r*x*M+h*p*M-l*p*C+l*x*E-h*y*E)+O*(+r*x*b-r*m*C-h*p*b+u*p*C+h*m*E-u*x*E)+L*(-l*m*E-r*y*b+r*m*M+l*p*b-u*p*M+u*y*E)}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,u){let l=this.elements;return e.isVector3?(l[12]=e.x,l[13]=e.y,l[14]=e.z):(l[12]=e,l[13]=r,l[14]=u),this}invert(){let e=this.elements,r=e[0],u=e[1],l=e[2],h=e[3],p=e[4],m=e[5],y=e[6],x=e[7],E=e[8],b=e[9],M=e[10],C=e[11],D=e[12],G=e[13],O=e[14],L=e[15],k=b*O*x-G*M*x+G*y*C-m*O*C-b*y*L+m*M*L,F=D*M*x-E*O*x-D*y*C+p*O*C+E*y*L-p*M*L,$=E*G*x-D*b*x+D*m*C-p*G*C-E*m*L+p*b*L,Z=D*b*y-E*G*y-D*m*M+p*G*M+E*m*O-p*b*O,it=r*k+u*F+l*$+h*Z;if(it===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let et=1/it;return e[0]=k*et,e[1]=(G*M*h-b*O*h-G*l*C+u*O*C+b*l*L-u*M*L)*et,e[2]=(m*O*h-G*y*h+G*l*x-u*O*x-m*l*L+u*y*L)*et,e[3]=(b*y*h-m*M*h-b*l*x+u*M*x+m*l*C-u*y*C)*et,e[4]=F*et,e[5]=(E*O*h-D*M*h+D*l*C-r*O*C-E*l*L+r*M*L)*et,e[6]=(D*y*h-p*O*h-D*l*x+r*O*x+p*l*L-r*y*L)*et,e[7]=(p*M*h-E*y*h+E*l*x-r*M*x-p*l*C+r*y*C)*et,e[8]=$*et,e[9]=(D*b*h-E*G*h-D*u*C+r*G*C+E*u*L-r*b*L)*et,e[10]=(p*G*h-D*m*h+D*u*x-r*G*x-p*u*L+r*m*L)*et,e[11]=(E*m*h-p*b*h-E*u*x+r*b*x+p*u*C-r*m*C)*et,e[12]=Z*et,e[13]=(E*G*l-D*b*l+D*u*M-r*G*M-E*u*O+r*b*O)*et,e[14]=(D*m*l-p*G*l-D*u*y+r*G*y+p*u*O-r*m*O)*et,e[15]=(p*b*l-E*m*l+E*u*y-r*b*y-p*u*M+r*m*M)*et,this}scale(e){let r=this.elements,u=e.x,l=e.y,h=e.z;return r[0]*=u,r[4]*=l,r[8]*=h,r[1]*=u,r[5]*=l,r[9]*=h,r[2]*=u,r[6]*=l,r[10]*=h,r[3]*=u,r[7]*=l,r[11]*=h,this}getMaxScaleOnAxis(){let e=this.elements,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],u=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],l=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(r,u,l))}makeTranslation(e,r,u){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,u,0,0,0,1),this}makeRotationX(e){let r=Math.cos(e),u=Math.sin(e);return this.set(1,0,0,0,0,r,-u,0,0,u,r,0,0,0,0,1),this}makeRotationY(e){let r=Math.cos(e),u=Math.sin(e);return this.set(r,0,u,0,0,1,0,0,-u,0,r,0,0,0,0,1),this}makeRotationZ(e){let r=Math.cos(e),u=Math.sin(e);return this.set(r,-u,0,0,u,r,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,r){let u=Math.cos(r),l=Math.sin(r),h=1-u,p=e.x,m=e.y,y=e.z,x=h*p,E=h*m;return this.set(x*p+u,x*m-l*y,x*y+l*m,0,x*m+l*y,E*m+u,E*y-l*p,0,x*y-l*m,E*y+l*p,h*y*y+u,0,0,0,0,1),this}makeScale(e,r,u){return this.set(e,0,0,0,0,r,0,0,0,0,u,0,0,0,0,1),this}makeShear(e,r,u,l,h,p){return this.set(1,u,h,0,e,1,p,0,r,l,1,0,0,0,0,1),this}compose(e,r,u){let l=this.elements,h=r._x,p=r._y,m=r._z,y=r._w,x=h+h,E=p+p,b=m+m,M=h*x,C=h*E,D=h*b,G=p*E,O=p*b,L=m*b,k=y*x,F=y*E,$=y*b,Z=u.x,it=u.y,et=u.z;return l[0]=(1-(G+L))*Z,l[1]=(C+$)*Z,l[2]=(D-F)*Z,l[3]=0,l[4]=(C-$)*it,l[5]=(1-(M+L))*it,l[6]=(O+k)*it,l[7]=0,l[8]=(D+F)*et,l[9]=(O-k)*et,l[10]=(1-(M+G))*et,l[11]=0,l[12]=e.x,l[13]=e.y,l[14]=e.z,l[15]=1,this}decompose(e,r,u){let l=this.elements,h=Eu.set(l[0],l[1],l[2]).length(),p=Eu.set(l[4],l[5],l[6]).length(),m=Eu.set(l[8],l[9],l[10]).length();this.determinant()<0&&(h=-h),e.x=l[12],e.y=l[13],e.z=l[14],ls.copy(this);let x=1/h,E=1/p,b=1/m;return ls.elements[0]*=x,ls.elements[1]*=x,ls.elements[2]*=x,ls.elements[4]*=E,ls.elements[5]*=E,ls.elements[6]*=E,ls.elements[8]*=b,ls.elements[9]*=b,ls.elements[10]*=b,r.setFromRotationMatrix(ls),u.x=h,u.y=p,u.z=m,this}makePerspective(e,r,u,l,h,p,m=Ac){let y=this.elements,x=2*h/(r-e),E=2*h/(u-l),b=(r+e)/(r-e),M=(u+l)/(u-l),C,D;if(m===Ac)C=-(p+h)/(p-h),D=-2*p*h/(p-h);else if(m===f0)C=-p/(p-h),D=-p*h/(p-h);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+m);return y[0]=x,y[4]=0,y[8]=b,y[12]=0,y[1]=0,y[5]=E,y[9]=M,y[13]=0,y[2]=0,y[6]=0,y[10]=C,y[14]=D,y[3]=0,y[7]=0,y[11]=-1,y[15]=0,this}makeOrthographic(e,r,u,l,h,p,m=Ac){let y=this.elements,x=1/(r-e),E=1/(u-l),b=1/(p-h),M=(r+e)*x,C=(u+l)*E,D,G;if(m===Ac)D=(p+h)*b,G=-2*b;else if(m===f0)D=h*b,G=-1*b;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+m);return y[0]=2*x,y[4]=0,y[8]=0,y[12]=-M,y[1]=0,y[5]=2*E,y[9]=0,y[13]=-C,y[2]=0,y[6]=0,y[10]=G,y[14]=-D,y[3]=0,y[7]=0,y[11]=0,y[15]=1,this}equals(e){let r=this.elements,u=e.elements;for(let l=0;l<16;l++)if(r[l]!==u[l])return!1;return!0}fromArray(e,r=0){for(let u=0;u<16;u++)this.elements[u]=e[u+r];return this}toArray(e=[],r=0){let u=this.elements;return e[r]=u[0],e[r+1]=u[1],e[r+2]=u[2],e[r+3]=u[3],e[r+4]=u[4],e[r+5]=u[5],e[r+6]=u[6],e[r+7]=u[7],e[r+8]=u[8],e[r+9]=u[9],e[r+10]=u[10],e[r+11]=u[11],e[r+12]=u[12],e[r+13]=u[13],e[r+14]=u[14],e[r+15]=u[15],e}},Eu=new En,ls=new Ea,Wb=new En(0,0,0),qb=new En(1,1,1),va=new En,Tc=new En,Fo=new En,m0=new Ea,y0=new wa,Nc=class o{constructor(e=0,r=0,u=0,l=o.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=r,this._z=u,this._order=l}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,u,l=this._order){return this._x=e,this._y=r,this._z=u,this._order=l,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,u=!0){let l=e.elements,h=l[0],p=l[4],m=l[8],y=l[1],x=l[5],E=l[9],b=l[2],M=l[6],C=l[10];switch(r){case"XYZ":this._y=Math.asin(_o(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(-E,C),this._z=Math.atan2(-p,h)):(this._x=Math.atan2(M,x),this._z=0);break;case"YXZ":this._x=Math.asin(-_o(E,-1,1)),Math.abs(E)<.9999999?(this._y=Math.atan2(m,C),this._z=Math.atan2(y,x)):(this._y=Math.atan2(-b,h),this._z=0);break;case"ZXY":this._x=Math.asin(_o(M,-1,1)),Math.abs(M)<.9999999?(this._y=Math.atan2(-b,C),this._z=Math.atan2(-p,x)):(this._y=0,this._z=Math.atan2(y,h));break;case"ZYX":this._y=Math.asin(-_o(b,-1,1)),Math.abs(b)<.9999999?(this._x=Math.atan2(M,C),this._z=Math.atan2(y,h)):(this._x=0,this._z=Math.atan2(-p,x));break;case"YZX":this._z=Math.asin(_o(y,-1,1)),Math.abs(y)<.9999999?(this._x=Math.atan2(-E,x),this._y=Math.atan2(-b,h)):(this._x=0,this._y=Math.atan2(m,C));break;case"XZY":this._z=Math.asin(-_o(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(M,x),this._y=Math.atan2(m,h)):(this._x=Math.atan2(-E,C),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+r)}return this._order=r,u===!0&&this._onChangeCallback(),this}setFromQuaternion(e,r,u){return m0.makeRotationFromQuaternion(e),this.setFromRotationMatrix(m0,r,u)}setFromVector3(e,r=this._order){return this.set(e.x,e.y,e.z,r)}reorder(e){return y0.setFromEuler(this),this.setFromQuaternion(y0,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}};Nc.DEFAULT_ORDER="XYZ";var Yh=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}},Xb=0,v0=new En,wu=new wa,js=new Ea,Cc=new En,xl=new En,Yb=new En,$b=new wa,_0=new En(1,0,0),x0=new En(0,1,0),E0=new En(0,0,1),w0={type:"added"},Zb={type:"removed"},Mu={type:"childadded",child:null},Gh={type:"childremoved",child:null},wl=class o extends Lc{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Xb++}),this.uuid=op(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=o.DEFAULT_UP.clone();let e=new En,r=new Nc,u=new wa,l=new En(1,1,1);function h(){u.setFromEuler(r,!1)}function p(){r.setFromQuaternion(u,void 0,!1)}r._onChange(h),u._onChange(p),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:r},quaternion:{configurable:!0,enumerable:!0,value:u},scale:{configurable:!0,enumerable:!0,value:l},modelViewMatrix:{value:new Ea},normalMatrix:{value:new me}}),this.matrix=new Ea,this.matrixWorld=new Ea,this.matrixAutoUpdate=o.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=o.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Yh,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 wu.setFromAxisAngle(e,r),this.quaternion.multiply(wu),this}rotateOnWorldAxis(e,r){return wu.setFromAxisAngle(e,r),this.quaternion.premultiply(wu),this}rotateX(e){return this.rotateOnAxis(_0,e)}rotateY(e){return this.rotateOnAxis(x0,e)}rotateZ(e){return this.rotateOnAxis(E0,e)}translateOnAxis(e,r){return v0.copy(e).applyQuaternion(this.quaternion),this.position.add(v0.multiplyScalar(r)),this}translateX(e){return this.translateOnAxis(_0,e)}translateY(e){return this.translateOnAxis(x0,e)}translateZ(e){return this.translateOnAxis(E0,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(js.copy(this.matrixWorld).invert())}lookAt(e,r,u){e.isVector3?Cc.copy(e):Cc.set(e,r,u);let l=this.parent;this.updateWorldMatrix(!0,!1),xl.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?js.lookAt(xl,Cc,this.up):js.lookAt(Cc,xl,this.up),this.quaternion.setFromRotationMatrix(js),l&&(js.extractRotation(l.matrixWorld),wu.setFromRotationMatrix(js),this.quaternion.premultiply(wu.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(w0),Mu.child=e,this.dispatchEvent(Mu),Mu.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let u=0;u<arguments.length;u++)this.remove(arguments[u]);return this}let r=this.children.indexOf(e);return r!==-1&&(e.parent=null,this.children.splice(r,1),e.dispatchEvent(Zb),Gh.child=e,this.dispatchEvent(Gh),Gh.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),js.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),js.multiply(e.parent.matrixWorld)),e.applyMatrix4(js),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(w0),Mu.child=e,this.dispatchEvent(Mu),Mu.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 u=0,l=this.children.length;u<l;u++){let p=this.children[u].getObjectByProperty(e,r);if(p!==void 0)return p}}getObjectsByProperty(e,r,u=[]){this[e]===r&&u.push(this);let l=this.children;for(let h=0,p=l.length;h<p;h++)l[h].getObjectsByProperty(e,r,u);return u}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xl,e,Yb),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xl,$b,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 u=0,l=r.length;u<l;u++)r[u].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let r=this.children;for(let u=0,l=r.length;u<l;u++)r[u].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 u=0,l=r.length;u<l;u++)r[u].updateMatrixWorld(e)}updateWorldMatrix(e,r){let u=this.parent;if(e===!0&&u!==null&&u.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 l=this.children;for(let h=0,p=l.length;h<p;h++)l[h].updateWorldMatrix(!1,!0)}}toJSON(e){let r=e===void 0||typeof e=="string",u={};r&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},u.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let l={};l.uuid=this.uuid,l.type=this.type,this.name!==""&&(l.name=this.name),this.castShadow===!0&&(l.castShadow=!0),this.receiveShadow===!0&&(l.receiveShadow=!0),this.visible===!1&&(l.visible=!1),this.frustumCulled===!1&&(l.frustumCulled=!1),this.renderOrder!==0&&(l.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(l.userData=this.userData),l.layers=this.layers.mask,l.matrix=this.matrix.toArray(),l.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(l.matrixAutoUpdate=!1),this.isInstancedMesh&&(l.type="InstancedMesh",l.count=this.count,l.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(l.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(l.type="BatchedMesh",l.perObjectFrustumCulled=this.perObjectFrustumCulled,l.sortObjects=this.sortObjects,l.drawRanges=this._drawRanges,l.reservedRanges=this._reservedRanges,l.visibility=this._visibility,l.active=this._active,l.bounds=this._bounds.map(m=>({boxInitialized:m.boxInitialized,boxMin:m.box.min.toArray(),boxMax:m.box.max.toArray(),sphereInitialized:m.sphereInitialized,sphereRadius:m.sphere.radius,sphereCenter:m.sphere.center.toArray()})),l.maxInstanceCount=this._maxInstanceCount,l.maxVertexCount=this._maxVertexCount,l.maxIndexCount=this._maxIndexCount,l.geometryInitialized=this._geometryInitialized,l.geometryCount=this._geometryCount,l.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(l.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(l.boundingSphere={center:l.boundingSphere.center.toArray(),radius:l.boundingSphere.radius}),this.boundingBox!==null&&(l.boundingBox={min:l.boundingBox.min.toArray(),max:l.boundingBox.max.toArray()}));function h(m,y){return m[y.uuid]===void 0&&(m[y.uuid]=y.toJSON(e)),y.uuid}if(this.isScene)this.background&&(this.background.isColor?l.background=this.background.toJSON():this.background.isTexture&&(l.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(l.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){l.geometry=h(e.geometries,this.geometry);let m=this.geometry.parameters;if(m!==void 0&&m.shapes!==void 0){let y=m.shapes;if(Array.isArray(y))for(let x=0,E=y.length;x<E;x++){let b=y[x];h(e.shapes,b)}else h(e.shapes,y)}}if(this.isSkinnedMesh&&(l.bindMode=this.bindMode,l.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(h(e.skeletons,this.skeleton),l.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let m=[];for(let y=0,x=this.material.length;y<x;y++)m.push(h(e.materials,this.material[y]));l.material=m}else l.material=h(e.materials,this.material);if(this.children.length>0){l.children=[];for(let m=0;m<this.children.length;m++)l.children.push(this.children[m].toJSON(e).object)}if(this.animations.length>0){l.animations=[];for(let m=0;m<this.animations.length;m++){let y=this.animations[m];l.animations.push(h(e.animations,y))}}if(r){let m=p(e.geometries),y=p(e.materials),x=p(e.textures),E=p(e.images),b=p(e.shapes),M=p(e.skeletons),C=p(e.animations),D=p(e.nodes);m.length>0&&(u.geometries=m),y.length>0&&(u.materials=y),x.length>0&&(u.textures=x),E.length>0&&(u.images=E),b.length>0&&(u.shapes=b),M.length>0&&(u.skeletons=M),C.length>0&&(u.animations=C),D.length>0&&(u.nodes=D)}return u.object=l,u;function p(m){let y=[];for(let x in m){let E=m[x];delete E.metadata,y.push(E)}return y}}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 u=0;u<e.children.length;u++){let l=e.children[u];this.add(l.clone())}return this}};wl.DEFAULT_UP=new En(0,1,0);wl.DEFAULT_MATRIX_AUTO_UPDATE=!0;wl.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var C0={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},_a={h:0,s:0,l:0},Ic={h:0,s:0,l:0};function Hh(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 yi=class{constructor(e,r,u){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,r,u)}set(e,r,u){if(r===void 0&&u===void 0){let l=e;l&&l.isColor?this.copy(l):typeof l=="number"?this.setHex(l):typeof l=="string"&&this.setStyle(l)}else this.setRGB(e,r,u);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,r=xa){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,us.toWorkingColorSpace(this,r),this}setRGB(e,r,u,l=us.workingColorSpace){return this.r=e,this.g=r,this.b=u,us.toWorkingColorSpace(this,l),this}setHSL(e,r,u,l=us.workingColorSpace){if(e=kb(e,1),r=_o(r,0,1),u=_o(u,0,1),r===0)this.r=this.g=this.b=u;else{let h=u<=.5?u*(1+r):u+r-u*r,p=2*u-h;this.r=Hh(p,h,e+1/3),this.g=Hh(p,h,e),this.b=Hh(p,h,e-1/3)}return us.toWorkingColorSpace(this,l),this}setStyle(e,r=xa){function u(h){h!==void 0&&parseFloat(h)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let l;if(l=/^(\\w+)\\(([^\\)]*)\\)/.exec(e)){let h,p=l[1],m=l[2];switch(p){case"rgb":case"rgba":if(h=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(m))return u(h[4]),this.setRGB(Math.min(255,parseInt(h[1],10))/255,Math.min(255,parseInt(h[2],10))/255,Math.min(255,parseInt(h[3],10))/255,r);if(h=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(m))return u(h[4]),this.setRGB(Math.min(100,parseInt(h[1],10))/100,Math.min(100,parseInt(h[2],10))/100,Math.min(100,parseInt(h[3],10))/100,r);break;case"hsl":case"hsla":if(h=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(m))return u(h[4]),this.setHSL(parseFloat(h[1])/360,parseFloat(h[2])/100,parseFloat(h[3])/100,r);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(l=/^\\#([A-Fa-f\\d]+)$/.exec(e)){let h=l[1],p=h.length;if(p===3)return this.setRGB(parseInt(h.charAt(0),16)/15,parseInt(h.charAt(1),16)/15,parseInt(h.charAt(2),16)/15,r);if(p===6)return this.setHex(parseInt(h,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=xa){let u=C0[e.toLowerCase()];return u!==void 0?this.setHex(u,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=bu(e.r),this.g=bu(e.g),this.b=bu(e.b),this}copyLinearToSRGB(e){return this.r=Bh(e.r),this.g=Bh(e.g),this.b=Bh(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=xa){return us.fromWorkingColorSpace(Ii.copy(this),e),Math.round(_o(Ii.r*255,0,255))*65536+Math.round(_o(Ii.g*255,0,255))*256+Math.round(_o(Ii.b*255,0,255))}getHexString(e=xa){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,r=us.workingColorSpace){us.fromWorkingColorSpace(Ii.copy(this),r);let u=Ii.r,l=Ii.g,h=Ii.b,p=Math.max(u,l,h),m=Math.min(u,l,h),y,x,E=(m+p)/2;if(m===p)y=0,x=0;else{let b=p-m;switch(x=E<=.5?b/(p+m):b/(2-p-m),p){case u:y=(l-h)/b+(l<h?6:0);break;case l:y=(h-u)/b+2;break;case h:y=(u-l)/b+4;break}y/=6}return e.h=y,e.s=x,e.l=E,e}getRGB(e,r=us.workingColorSpace){return us.fromWorkingColorSpace(Ii.copy(this),r),e.r=Ii.r,e.g=Ii.g,e.b=Ii.b,e}getStyle(e=xa){us.fromWorkingColorSpace(Ii.copy(this),e);let r=Ii.r,u=Ii.g,l=Ii.b;return e!==xa?`color(${e} ${r.toFixed(3)} ${u.toFixed(3)} ${l.toFixed(3)})`:`rgb(${Math.round(r*255)},${Math.round(u*255)},${Math.round(l*255)})`}offsetHSL(e,r,u){return this.getHSL(_a),this.setHSL(_a.h+e,_a.s+r,_a.l+u)}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,u){return this.r=e.r+(r.r-e.r)*u,this.g=e.g+(r.g-e.g)*u,this.b=e.b+(r.b-e.b)*u,this}lerpHSL(e,r){this.getHSL(_a),e.getHSL(Ic);let u=Fh(_a.h,Ic.h,r),l=Fh(_a.s,Ic.s,r),h=Fh(_a.l,Ic.l,r);return this.setHSL(u,l,h),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let r=this.r,u=this.g,l=this.b,h=e.elements;return this.r=h[0]*r+h[3]*u+h[6]*l,this.g=h[1]*r+h[4]*u+h[7]*l,this.b=h[2]*r+h[5]*u+h[8]*l,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}},Ii=new yi;yi.NAMES=C0;function Jb(o){let e={};for(let r in o){e[r]={};for(let u in o[r]){let l=o[r][u];l&&(l.isColor||l.isMatrix3||l.isMatrix4||l.isVector2||l.isVector3||l.isVector4||l.isTexture||l.isQuaternion)?l.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[r][u]=null):e[r][u]=l.clone():Array.isArray(l)?e[r][u]=l.slice():e[r][u]=l}}return e}function vo(o){let e={};for(let r=0;r<o.length;r++){let u=Jb(o[r]);for(let l in u)e[l]=u[l]}return e}var Kb=`#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif`,Qb=`#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`,jb=`#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif`,tA=`#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif`,eA=`#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`,nA=`#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif`,rA=`#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`,iA=`#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif`,oA=`#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`,sA=`#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif`,aA=`vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif`,uA=`vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif`,lA=`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`,cA=`#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`,fA=`#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`,hA=`#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`,pA=`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif`,dA=`#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif`,gA=`#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif`,mA=`#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif`,yA=`#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif`,vA=`#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`,_A=`#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`,xA=`#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`,EA=`#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`,wA=`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`,MA=`#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif`,SA=`#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif`,bA=`#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif`,AA=`#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif`,TA="gl_FragColor = linearToOutputTexel( gl_FragColor );",CA=`\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}`,IA=`#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`,PA=`#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`,RA=`#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`,LA=`#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`,NA=`#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`,DA=`#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif`,OA=`#ifdef USE_FOG\n varying float vFogDepth;\n#endif`,FA=`#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`,UA=`#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`,BA=`#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}`,zA=`#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif`,kA=`LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;`,GA=`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`,HA=`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`,VA=`#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`,WA=`ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;`,qA=`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`,XA=`BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;`,YA=`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`,$A=`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`,ZA=`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}`,JA=`\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`,KA=`#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`,QA=`#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`,jA=`#if defined( USE_LOGDEPTHBUF )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif`,tT=`#if defined( USE_LOGDEPTHBUF )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif`,eT=`#ifdef USE_LOGDEPTHBUF\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif`,nT=`#ifdef USE_LOGDEPTHBUF\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif`,rT=`#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`,iT=`#ifdef USE_MAP\n uniform sampler2D map;\n#endif`,oT=`#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`,sT=`#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`,aT=`float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif`,uT=`#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif`,lT=`#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`,cT=`#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`,fT=`#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`,hT=`#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`,pT=`#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`,dT=`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;`,gT=`#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`,mT=`#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif`,yT=`#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif`,vT=`#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`,_T=`#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`,xT=`#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif`,ET=`#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`,wT=`#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`,MT=`#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif`,ST=`#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );`,bT=`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}`,AT=`#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif`,TT=`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;`,CT=`#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif`,IT=`#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`,PT=`float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif`,RT=`#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif`,LT=`#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`,NT=`#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`,DT=`#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`,OT=`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}`,FT=`#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`,UT=`#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`,BT=`#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`,zT=`#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`,kT=`float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif`,GT=`#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif`,HT=`#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif`,VT=`#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; }`,WT=`#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`,qT=`#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`,XT=`#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`,YT=`#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`,$T=`#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`,ZT=`#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`,JT=`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}`,KT=`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}`,QT=`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}`,jT=`#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}`,tC=`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}`,eC=`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}`,nC=`#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}`,rC=`#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}`,iC=`#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}`,oC=`#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}`,sC=`varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}`,aC=`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}`,uC=`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}`,lC=`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}`,cC=`#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}`,fC=`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}`,hC=`#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}`,pC=`#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}`,dC=`#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}`,gC=`#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}`,mC=`#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}`,yC=`#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}`,vC=`#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}`,_C=`#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}`,xC=`#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}`,EC=`#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}`,wC=`#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}`,MC=`#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}`,SC=`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}`,bC=`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}`,AC=`#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}`,TC=`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}`,CC=`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}`,IC=`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}`,en={alphahash_fragment:Kb,alphahash_pars_fragment:Qb,alphamap_fragment:jb,alphamap_pars_fragment:tA,alphatest_fragment:eA,alphatest_pars_fragment:nA,aomap_fragment:rA,aomap_pars_fragment:iA,batching_pars_vertex:oA,batching_vertex:sA,begin_vertex:aA,beginnormal_vertex:uA,bsdfs:lA,iridescence_fragment:cA,bumpmap_pars_fragment:fA,clipping_planes_fragment:hA,clipping_planes_pars_fragment:pA,clipping_planes_pars_vertex:dA,clipping_planes_vertex:gA,color_fragment:mA,color_pars_fragment:yA,color_pars_vertex:vA,color_vertex:_A,common:xA,cube_uv_reflection_fragment:EA,defaultnormal_vertex:wA,displacementmap_pars_vertex:MA,displacementmap_vertex:SA,emissivemap_fragment:bA,emissivemap_pars_fragment:AA,colorspace_fragment:TA,colorspace_pars_fragment:CA,envmap_fragment:IA,envmap_common_pars_fragment:PA,envmap_pars_fragment:RA,envmap_pars_vertex:LA,envmap_physical_pars_fragment:VA,envmap_vertex:NA,fog_vertex:DA,fog_pars_vertex:OA,fog_fragment:FA,fog_pars_fragment:UA,gradientmap_pars_fragment:BA,lightmap_pars_fragment:zA,lights_lambert_fragment:kA,lights_lambert_pars_fragment:GA,lights_pars_begin:HA,lights_toon_fragment:WA,lights_toon_pars_fragment:qA,lights_phong_fragment:XA,lights_phong_pars_fragment:YA,lights_physical_fragment:$A,lights_physical_pars_fragment:ZA,lights_fragment_begin:JA,lights_fragment_maps:KA,lights_fragment_end:QA,logdepthbuf_fragment:jA,logdepthbuf_pars_fragment:tT,logdepthbuf_pars_vertex:eT,logdepthbuf_vertex:nT,map_fragment:rT,map_pars_fragment:iT,map_particle_fragment:oT,map_particle_pars_fragment:sT,metalnessmap_fragment:aT,metalnessmap_pars_fragment:uT,morphinstance_vertex:lT,morphcolor_vertex:cT,morphnormal_vertex:fT,morphtarget_pars_vertex:hT,morphtarget_vertex:pT,normal_fragment_begin:dT,normal_fragment_maps:gT,normal_pars_fragment:mT,normal_pars_vertex:yT,normal_vertex:vT,normalmap_pars_fragment:_T,clearcoat_normal_fragment_begin:xT,clearcoat_normal_fragment_maps:ET,clearcoat_pars_fragment:wT,iridescence_pars_fragment:MT,opaque_fragment:ST,packing:bT,premultiplied_alpha_fragment:AT,project_vertex:TT,dithering_fragment:CT,dithering_pars_fragment:IT,roughnessmap_fragment:PT,roughnessmap_pars_fragment:RT,shadowmap_pars_fragment:LT,shadowmap_pars_vertex:NT,shadowmap_vertex:DT,shadowmask_pars_fragment:OT,skinbase_vertex:FT,skinning_pars_vertex:UT,skinning_vertex:BT,skinnormal_vertex:zT,specularmap_fragment:kT,specularmap_pars_fragment:GT,tonemapping_fragment:HT,tonemapping_pars_fragment:VT,transmission_fragment:WT,transmission_pars_fragment:qT,uv_pars_fragment:XT,uv_pars_vertex:YT,uv_vertex:$T,worldpos_vertex:ZT,background_vert:JT,background_frag:KT,backgroundCube_vert:QT,backgroundCube_frag:jT,cube_vert:tC,cube_frag:eC,depth_vert:nC,depth_frag:rC,distanceRGBA_vert:iC,distanceRGBA_frag:oC,equirect_vert:sC,equirect_frag:aC,linedashed_vert:uC,linedashed_frag:lC,meshbasic_vert:cC,meshbasic_frag:fC,meshlambert_vert:hC,meshlambert_frag:pC,meshmatcap_vert:dC,meshmatcap_frag:gC,meshnormal_vert:mC,meshnormal_frag:yC,meshphong_vert:vC,meshphong_frag:_C,meshphysical_vert:xC,meshphysical_frag:EC,meshtoon_vert:wC,meshtoon_frag:MC,points_vert:SC,points_frag:bC,shadow_vert:AC,shadow_frag:TC,sprite_vert:CC,sprite_frag:IC},Rt={common:{diffuse:{value:new yi(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new me},alphaMap:{value:null},alphaMapTransform:{value:new me},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new me}},envmap:{envMap:{value:null},envMapRotation:{value:new me},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new me}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new me}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new me},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new me},normalScale:{value:new Xi(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new me},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new me}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new me}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new me}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new yi(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 yi(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new me},alphaTest:{value:0},uvTransform:{value:new me}},sprite:{diffuse:{value:new yi(16777215)},opacity:{value:1},center:{value:new Xi(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new me},alphaMap:{value:null},alphaMapTransform:{value:new me},alphaTest:{value:0}}},M0={basic:{uniforms:vo([Rt.common,Rt.specularmap,Rt.envmap,Rt.aomap,Rt.lightmap,Rt.fog]),vertexShader:en.meshbasic_vert,fragmentShader:en.meshbasic_frag},lambert:{uniforms:vo([Rt.common,Rt.specularmap,Rt.envmap,Rt.aomap,Rt.lightmap,Rt.emissivemap,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,Rt.fog,Rt.lights,{emissive:{value:new yi(0)}}]),vertexShader:en.meshlambert_vert,fragmentShader:en.meshlambert_frag},phong:{uniforms:vo([Rt.common,Rt.specularmap,Rt.envmap,Rt.aomap,Rt.lightmap,Rt.emissivemap,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,Rt.fog,Rt.lights,{emissive:{value:new yi(0)},specular:{value:new yi(1118481)},shininess:{value:30}}]),vertexShader:en.meshphong_vert,fragmentShader:en.meshphong_frag},standard:{uniforms:vo([Rt.common,Rt.envmap,Rt.aomap,Rt.lightmap,Rt.emissivemap,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,Rt.roughnessmap,Rt.metalnessmap,Rt.fog,Rt.lights,{emissive:{value:new yi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:en.meshphysical_vert,fragmentShader:en.meshphysical_frag},toon:{uniforms:vo([Rt.common,Rt.aomap,Rt.lightmap,Rt.emissivemap,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,Rt.gradientmap,Rt.fog,Rt.lights,{emissive:{value:new yi(0)}}]),vertexShader:en.meshtoon_vert,fragmentShader:en.meshtoon_frag},matcap:{uniforms:vo([Rt.common,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,Rt.fog,{matcap:{value:null}}]),vertexShader:en.meshmatcap_vert,fragmentShader:en.meshmatcap_frag},points:{uniforms:vo([Rt.points,Rt.fog]),vertexShader:en.points_vert,fragmentShader:en.points_frag},dashed:{uniforms:vo([Rt.common,Rt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:en.linedashed_vert,fragmentShader:en.linedashed_frag},depth:{uniforms:vo([Rt.common,Rt.displacementmap]),vertexShader:en.depth_vert,fragmentShader:en.depth_frag},normal:{uniforms:vo([Rt.common,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,{opacity:{value:1}}]),vertexShader:en.meshnormal_vert,fragmentShader:en.meshnormal_frag},sprite:{uniforms:vo([Rt.sprite,Rt.fog]),vertexShader:en.sprite_vert,fragmentShader:en.sprite_frag},background:{uniforms:{uvTransform:{value:new me},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:en.background_vert,fragmentShader:en.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new me}},vertexShader:en.backgroundCube_vert,fragmentShader:en.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:en.cube_vert,fragmentShader:en.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:en.equirect_vert,fragmentShader:en.equirect_frag},distanceRGBA:{uniforms:vo([Rt.common,Rt.displacementmap,{referencePosition:{value:new En},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:en.distanceRGBA_vert,fragmentShader:en.distanceRGBA_frag},shadow:{uniforms:vo([Rt.lights,Rt.fog,{color:{value:new yi(0)},opacity:{value:1}}]),vertexShader:en.shadow_vert,fragmentShader:en.shadow_frag}};M0.physical={uniforms:vo([M0.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new me},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new me},clearcoatNormalScale:{value:new Xi(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new me},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new me},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new me},sheen:{value:0},sheenColor:{value:new yi(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new me},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new me},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new me},transmissionSamplerSize:{value:new Xi},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new me},attenuationDistance:{value:0},attenuationColor:{value:new yi(0)},specularColor:{value:new yi(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new me},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new me},anisotropyVector:{value:new Xi},anisotropyMap:{value:null},anisotropyMapTransform:{value:new me}}]),vertexShader:en.meshphysical_vert,fragmentShader:en.meshphysical_frag};var Za=(1+Math.sqrt(5))/2,Su=1/Za,wN=[new En(-Za,Su,0),new En(Za,Su,0),new En(-Su,0,Za),new En(Su,0,Za),new En(0,Za,-Su),new En(0,Za,Su),new En(-1,1,-1),new En(1,1,-1),new En(-1,1,1),new En(1,1,1)];var MN=new Float32Array(16),SN=new Float32Array(9),bN=new Float32Array(4);var AN={[Zm]:Jm,[Km]:e0,[jm]:n0,[Qm]:t0,[Jm]:Zm,[e0]:Km,[n0]:jm,[t0]:Qm};function Pc(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 PC(o){return ArrayBuffer.isView(o)&&!(o instanceof DataView)}var Au=class{constructor(e,r,u,l){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=l!==void 0?l:new r.constructor(u),this.sampleValues=r,this.valueSize=u,this.settings=null,this.DefaultSettings_={}}evaluate(e){let r=this.parameterPositions,u=this._cachedIndex,l=r[u],h=r[u-1];t:{e:{let p;n:{r:if(!(e<l)){for(let m=u+2;;){if(l===void 0){if(e<h)break r;return u=r.length,this._cachedIndex=u,this.copySampleValue_(u-1)}if(u===m)break;if(h=l,l=r[++u],e<l)break e}p=r.length;break n}if(!(e>=h)){let m=r[1];e<m&&(u=2,h=m);for(let y=u-2;;){if(h===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(u===y)break;if(l=h,h=r[--u-1],e>=h)break e}p=u,u=0;break n}break t}for(;u<p;){let m=u+p>>>1;e<r[m]?p=m:u=m+1}if(l=r[u],h=r[u-1],h===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(l===void 0)return u=r.length,this._cachedIndex=u,this.copySampleValue_(u-1)}this._cachedIndex=u,this.intervalChanged_(u,h,l)}return this.interpolate_(u,h,e,l)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let r=this.resultBuffer,u=this.sampleValues,l=this.valueSize,h=e*l;for(let p=0;p!==l;++p)r[p]=u[h+p];return r}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},$h=class extends Au{constructor(e,r,u,l){super(e,r,u,l),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:o0,endingEnd:o0}}intervalChanged_(e,r,u){let l=this.parameterPositions,h=e-2,p=e+1,m=l[h],y=l[p];if(m===void 0)switch(this.getSettings_().endingStart){case s0:h=e,m=2*r-u;break;case a0:h=l.length-2,m=r+l[h]-l[h+1];break;default:h=e,m=u}if(y===void 0)switch(this.getSettings_().endingEnd){case s0:p=e,y=2*u-r;break;case a0:p=1,y=u+l[1]-l[0];break;default:p=e-1,y=r}let x=(u-r)*.5,E=this.valueSize;this._weightPrev=x/(r-m),this._weightNext=x/(y-u),this._offsetPrev=h*E,this._offsetNext=p*E}interpolate_(e,r,u,l){let h=this.resultBuffer,p=this.sampleValues,m=this.valueSize,y=e*m,x=y-m,E=this._offsetPrev,b=this._offsetNext,M=this._weightPrev,C=this._weightNext,D=(u-r)/(l-r),G=D*D,O=G*D,L=-M*O+2*M*G-M*D,k=(1+M)*O+(-1.5-2*M)*G+(-.5+M)*D+1,F=(-1-C)*O+(1.5+C)*G+.5*D,$=C*O-C*G;for(let Z=0;Z!==m;++Z)h[Z]=L*p[E+Z]+k*p[x+Z]+F*p[y+Z]+$*p[b+Z];return h}},Zh=class extends Au{constructor(e,r,u,l){super(e,r,u,l)}interpolate_(e,r,u,l){let h=this.resultBuffer,p=this.sampleValues,m=this.valueSize,y=e*m,x=y-m,E=(u-r)/(l-r),b=1-E;for(let M=0;M!==m;++M)h[M]=p[x+M]*b+p[y+M]*E;return h}},Jh=class extends Au{constructor(e,r,u,l){super(e,r,u,l)}interpolate_(e){return this.copySampleValue_(e-1)}},cs=class{constructor(e,r,u,l){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=Pc(r,this.TimeBufferType),this.values=Pc(u,this.ValueBufferType),this.setInterpolation(l||this.DefaultInterpolation)}static toJSON(e){let r=e.constructor,u;if(r.toJSON!==this.toJSON)u=r.toJSON(e);else{u={name:e.name,times:Pc(e.times,Array),values:Pc(e.values,Array)};let l=e.getInterpolation();l!==e.DefaultInterpolation&&(u.interpolation=l)}return u.type=e.ValueTypeName,u}InterpolantFactoryMethodDiscrete(e){return new Jh(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Zh(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new $h(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let r;switch(e){case Rc:r=this.InterpolantFactoryMethodDiscrete;break;case Vh:r=this.InterpolantFactoryMethodLinear;break;case Oh:r=this.InterpolantFactoryMethodSmooth;break}if(r===void 0){let u="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(u);return console.warn("THREE.KeyframeTrack:",u),this}return this.createInterpolant=r,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Rc;case this.InterpolantFactoryMethodLinear:return Vh;case this.InterpolantFactoryMethodSmooth:return Oh}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let r=this.times;for(let u=0,l=r.length;u!==l;++u)r[u]+=e}return this}scale(e){if(e!==1){let r=this.times;for(let u=0,l=r.length;u!==l;++u)r[u]*=e}return this}trim(e,r){let u=this.times,l=u.length,h=0,p=l-1;for(;h!==l&&u[h]<e;)++h;for(;p!==-1&&u[p]>r;)--p;if(++p,h!==0||p!==l){h>=p&&(p=Math.max(p,1),h=p-1);let m=this.getValueSize();this.times=u.slice(h,p),this.values=this.values.slice(h*m,p*m)}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 u=this.times,l=this.values,h=u.length;h===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let p=null;for(let m=0;m!==h;m++){let y=u[m];if(typeof y=="number"&&isNaN(y)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,m,y),e=!1;break}if(p!==null&&p>y){console.error("THREE.KeyframeTrack: Out of order keys.",this,m,y,p),e=!1;break}p=y}if(l!==void 0&&PC(l))for(let m=0,y=l.length;m!==y;++m){let x=l[m];if(isNaN(x)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,m,x),e=!1;break}}return e}optimize(){let e=this.times.slice(),r=this.values.slice(),u=this.getValueSize(),l=this.getInterpolation()===Oh,h=e.length-1,p=1;for(let m=1;m<h;++m){let y=!1,x=e[m],E=e[m+1];if(x!==E&&(m!==1||x!==e[0]))if(l)y=!0;else{let b=m*u,M=b-u,C=b+u;for(let D=0;D!==u;++D){let G=r[b+D];if(G!==r[M+D]||G!==r[C+D]){y=!0;break}}}if(y){if(m!==p){e[p]=e[m];let b=m*u,M=p*u;for(let C=0;C!==u;++C)r[M+C]=r[b+C]}++p}}if(h>0){e[p]=e[h];for(let m=h*u,y=p*u,x=0;x!==u;++x)r[y+x]=r[m+x];++p}return p!==e.length?(this.times=e.slice(0,p),this.values=r.slice(0,p*u)):(this.times=e,this.values=r),this}clone(){let e=this.times.slice(),r=this.values.slice(),u=this.constructor,l=new u(this.name,e,r);return l.createInterpolant=this.createInterpolant,l}};cs.prototype.TimeBufferType=Float32Array;cs.prototype.ValueBufferType=Float32Array;cs.prototype.DefaultInterpolation=Vh;var Ja=class extends cs{constructor(e,r,u){super(e,r,u)}};Ja.prototype.ValueTypeName="bool";Ja.prototype.ValueBufferType=Array;Ja.prototype.DefaultInterpolation=Rc;Ja.prototype.InterpolantFactoryMethodLinear=void 0;Ja.prototype.InterpolantFactoryMethodSmooth=void 0;var Kh=class extends cs{};Kh.prototype.ValueTypeName="color";var Qh=class extends cs{};Qh.prototype.ValueTypeName="number";var jh=class extends Au{constructor(e,r,u,l){super(e,r,u,l)}interpolate_(e,r,u,l){let h=this.resultBuffer,p=this.sampleValues,m=this.valueSize,y=(u-r)/(l-r),x=e*m;for(let E=x+m;x!==E;x+=4)wa.slerpFlat(h,0,p,x-m,p,x,y);return h}},Dc=class extends cs{InterpolantFactoryMethodLinear(e){return new jh(this.times,this.values,this.getValueSize(),e)}};Dc.prototype.ValueTypeName="quaternion";Dc.prototype.InterpolantFactoryMethodSmooth=void 0;var Ka=class extends cs{constructor(e,r,u){super(e,r,u)}};Ka.prototype.ValueTypeName="string";Ka.prototype.ValueBufferType=Array;Ka.prototype.DefaultInterpolation=Rc;Ka.prototype.InterpolantFactoryMethodLinear=void 0;Ka.prototype.InterpolantFactoryMethodSmooth=void 0;var tp=class extends cs{};tp.prototype.ValueTypeName="vector";var ep=class{constructor(e,r,u){let l=this,h=!1,p=0,m=0,y,x=[];this.onStart=void 0,this.onLoad=e,this.onProgress=r,this.onError=u,this.itemStart=function(E){m++,h===!1&&l.onStart!==void 0&&l.onStart(E,p,m),h=!0},this.itemEnd=function(E){p++,l.onProgress!==void 0&&l.onProgress(E,p,m),p===m&&(h=!1,l.onLoad!==void 0&&l.onLoad())},this.itemError=function(E){l.onError!==void 0&&l.onError(E)},this.resolveURL=function(E){return y?y(E):E},this.setURLModifier=function(E){return y=E,this},this.addHandler=function(E,b){return x.push(E,b),this},this.removeHandler=function(E){let b=x.indexOf(E);return b!==-1&&x.splice(b,2),this},this.getHandler=function(E){for(let b=0,M=x.length;b<M;b+=2){let C=x[b],D=x[b+1];if(C.global&&(C.lastIndex=0),C.test(E))return D}return null}}},RC=new ep,np=class{constructor(e){this.manager=e!==void 0?e:RC,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,r){let u=this;return new Promise(function(l,h){u.load(e,l,r,h)})}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}};np.DEFAULT_MATERIAL_NAME="__DEFAULT";var sp="\\\\[\\\\]\\\\.:\\\\/",LC=new RegExp("["+sp+"]","g"),ap="[^"+sp+"]",NC="[^"+sp.replace("\\\\.","")+"]",DC=/((?:WC+[\\/:])*)/.source.replace("WC",ap),OC=/(WCOD+)?/.source.replace("WCOD",NC),FC=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",ap),UC=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",ap),BC=new RegExp("^"+DC+OC+FC+UC+"$"),zC=["material","materials","bones","map"],rp=class{constructor(e,r,u){let l=u||rr.parseTrackName(r);this._targetGroup=e,this._bindings=e.subscribe_(r,l)}getValue(e,r){this.bind();let u=this._targetGroup.nCachedObjects_,l=this._bindings[u];l!==void 0&&l.getValue(e,r)}setValue(e,r){let u=this._bindings;for(let l=this._targetGroup.nCachedObjects_,h=u.length;l!==h;++l)u[l].setValue(e,r)}bind(){let e=this._bindings;for(let r=this._targetGroup.nCachedObjects_,u=e.length;r!==u;++r)e[r].bind()}unbind(){let e=this._bindings;for(let r=this._targetGroup.nCachedObjects_,u=e.length;r!==u;++r)e[r].unbind()}},rr=class o{constructor(e,r,u){this.path=r,this.parsedPath=u||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,u){return e&&e.isAnimationObjectGroup?new o.Composite(e,r,u):new o(e,r,u)}static sanitizeNodeName(e){return e.replace(/\\s/g,"_").replace(LC,"")}static parseTrackName(e){let r=BC.exec(e);if(r===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let u={nodeName:r[2],objectName:r[3],objectIndex:r[4],propertyName:r[5],propertyIndex:r[6]},l=u.nodeName&&u.nodeName.lastIndexOf(".");if(l!==void 0&&l!==-1){let h=u.nodeName.substring(l+1);zC.indexOf(h)!==-1&&(u.nodeName=u.nodeName.substring(0,l),u.objectName=h)}if(u.propertyName===null||u.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return u}static findNode(e,r){if(r===void 0||r===""||r==="."||r===-1||r===e.name||r===e.uuid)return e;if(e.skeleton){let u=e.skeleton.getBoneByName(r);if(u!==void 0)return u}if(e.children){let u=function(h){for(let p=0;p<h.length;p++){let m=h[p];if(m.name===r||m.uuid===r)return m;let y=u(m.children);if(y)return y}return null},l=u(e.children);if(l)return l}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,r){e[r]=this.targetObject[this.propertyName]}_getValue_array(e,r){let u=this.resolvedProperty;for(let l=0,h=u.length;l!==h;++l)e[r++]=u[l]}_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 u=this.resolvedProperty;for(let l=0,h=u.length;l!==h;++l)u[l]=e[r++]}_setValue_array_setNeedsUpdate(e,r){let u=this.resolvedProperty;for(let l=0,h=u.length;l!==h;++l)u[l]=e[r++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,r){let u=this.resolvedProperty;for(let l=0,h=u.length;l!==h;++l)u[l]=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,u=r.objectName,l=r.propertyName,h=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(u){let x=r.objectIndex;switch(u){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 E=0;E<e.length;E++)if(e[E].name===x){x=E;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[u]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[u]}if(x!==void 0){if(e[x]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[x]}}let p=e[l];if(p===void 0){let x=r.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+x+"."+l+" but it wasn\'t found.",e);return}let m=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?m=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(m=this.Versioning.MatrixWorldNeedsUpdate);let y=this.BindingType.Direct;if(h!==void 0){if(l==="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[h]!==void 0&&(h=e.morphTargetDictionary[h])}y=this.BindingType.ArrayElement,this.resolvedProperty=p,this.propertyIndex=h}else p.fromArray!==void 0&&p.toArray!==void 0?(y=this.BindingType.HasFromToArray,this.resolvedProperty=p):Array.isArray(p)?(y=this.BindingType.EntireArray,this.resolvedProperty=p):this.propertyName=l;this.getValue=this.GetterByBindingType[y],this.setValue=this.SetterByBindingTypeAndVersioning[y][m]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};rr.Composite=rp;rr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};rr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};rr.prototype.GetterByBindingType=[rr.prototype._getValue_direct,rr.prototype._getValue_array,rr.prototype._getValue_arrayElement,rr.prototype._getValue_toArray];rr.prototype.SetterByBindingTypeAndVersioning=[[rr.prototype._setValue_direct,rr.prototype._setValue_direct_setNeedsUpdate,rr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[rr.prototype._setValue_array,rr.prototype._setValue_array_setNeedsUpdate,rr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[rr.prototype._setValue_arrayElement,rr.prototype._setValue_arrayElement_setNeedsUpdate,rr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[rr.prototype._setValue_fromArray,rr.prototype._setValue_fromArray_setNeedsUpdate,rr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var TN=new Float32Array(1);typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:S0}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=S0);var ri=63710088e-1,IN={centimeters:ri*100,centimetres:ri*100,degrees:ri/111325,feet:ri*3.28084,inches:ri*39.37,kilometers:ri/1e3,kilometres:ri/1e3,meters:ri,metres:ri,miles:ri/1609.344,millimeters:ri*1e3,millimetres:ri*1e3,nauticalmiles:ri/1852,radians:1,yards:ri*1.0936},PN={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/ri,yards:1.0936133};function Yi(o,e,r){r===void 0&&(r={});var u={type:"Feature"};return(r.id===0||r.id)&&(u.id=r.id),r.bbox&&(u.bbox=r.bbox),u.properties=e||{},u.geometry=o,u}function Zn(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(!Is(o[0])||!Is(o[1]))throw new Error("coordinates must contain numbers");var u={type:"Point",coordinates:o};return Yi(u,e,r)}function ir(o,e,r){r===void 0&&(r={});for(var u=0,l=o;u<l.length;u++){var h=l[u];if(h.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var p=0;p<h[h.length-1].length;p++)if(h[h.length-1][p]!==h[0][p])throw new Error("First and last Position are not equivalent.")}var m={type:"Polygon",coordinates:o};return Yi(m,e,r)}function ii(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 u={type:"LineString",coordinates:o};return Yi(u,e,r)}function up(o,e,r){r===void 0&&(r={});var u={type:"MultiPoint",coordinates:o};return Yi(u,e,r)}function Is(o){return!isNaN(o)&&o!==null&&!Array.isArray(o)}function Gr(o,e,r){if(o!==null)for(var u,l,h,p,m,y,x,E=0,b=0,M,C=o.type,D=C==="FeatureCollection",G=C==="Feature",O=D?o.features.length:1,L=0;L<O;L++){x=D?o.features[L].geometry:G?o.geometry:o,M=x?x.type==="GeometryCollection":!1,m=M?x.geometries.length:1;for(var k=0;k<m;k++){var F=0,$=0;if(p=M?x.geometries[k]:x,p!==null){y=p.coordinates;var Z=p.type;switch(E=r&&(Z==="Polygon"||Z==="MultiPolygon")?1:0,Z){case null:break;case"Point":if(e(y,b,L,F,$)===!1)return!1;b++,F++;break;case"LineString":case"MultiPoint":for(u=0;u<y.length;u++){if(e(y[u],b,L,F,$)===!1)return!1;b++,Z==="MultiPoint"&&F++}Z==="LineString"&&F++;break;case"Polygon":case"MultiLineString":for(u=0;u<y.length;u++){for(l=0;l<y[u].length-E;l++){if(e(y[u][l],b,L,F,$)===!1)return!1;b++}Z==="MultiLineString"&&F++,Z==="Polygon"&&$++}Z==="Polygon"&&F++;break;case"MultiPolygon":for(u=0;u<y.length;u++){for($=0,l=0;l<y[u].length;l++){for(h=0;h<y[u][l].length-E;h++){if(e(y[u][l][h],b,L,F,$)===!1)return!1;b++}$++}F++}break;case"GeometryCollection":for(u=0;u<p.geometries.length;u++)if(Gr(p.geometries[u],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function I0(o,e,r,u){var l=r;return Gr(o,function(h,p,m,y,x){p===0&&r===void 0?l=h:l=e(l,h,p,m,y,x)},u),l}function Ma(o,e){var r,u,l,h,p,m,y,x,E,b,M=0,C=o.type==="FeatureCollection",D=o.type==="Feature",G=C?o.features.length:1;for(r=0;r<G;r++){for(m=C?o.features[r].geometry:D?o.geometry:o,x=C?o.features[r].properties:D?o.properties:{},E=C?o.features[r].bbox:D?o.bbox:void 0,b=C?o.features[r].id:D?o.id:void 0,y=m?m.type==="GeometryCollection":!1,p=y?m.geometries.length:1,l=0;l<p;l++){if(h=y?m.geometries[l]:m,h===null){if(e(null,M,x,E,b)===!1)return!1;continue}switch(h.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(h,M,x,E,b)===!1)return!1;break}case"GeometryCollection":{for(u=0;u<h.geometries.length;u++)if(e(h.geometries[u],M,x,E,b)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}M++}}function Uo(o,e){Ma(o,function(r,u,l,h,p){var m=r===null?null:r.type;switch(m){case null:case"Point":case"LineString":case"Polygon":return e(Yi(r,l,{bbox:h,id:p}),u,0)===!1?!1:void 0}var y;switch(m){case"MultiPoint":y="Point";break;case"MultiLineString":y="LineString";break;case"MultiPolygon":y="Polygon";break}for(var x=0;x<r.coordinates.length;x++){var E=r.coordinates[x],b={type:y,coordinates:E};if(e(Yi(b,l),u,x)===!1)return!1}})}function lp(o){var e=[1/0,1/0,-1/0,-1/0];return Gr(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}lp.default=lp;var $i=lp;function vi(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 cp(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 _i(o){return o.type==="Feature"?o.geometry:o}var YC=nr(Oc(),1);var rI=nr(Y0(),1);function oi(o,e,r){if(r===void 0&&(r={}),!o)throw new Error("point is required");if(!e)throw new Error("polygon is required");var u=vi(o),l=_i(e),h=l.type,p=e.bbox,m=l.coordinates;if(p&&iI(u,p)===!1)return!1;h==="Polygon"&&(m=[m]);for(var y=!1,x=0;x<m.length&&!y;x++)if($0(u,m[x][0],r.ignoreBoundary)){for(var E=!1,b=1;b<m[x].length&&!E;)$0(u,m[x][b],!r.ignoreBoundary)&&(E=!0),b++;E||(y=!0)}return y}function $0(o,e,r){var u=!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 l=0,h=e.length-1;l<e.length;h=l++){var p=e[l][0],m=e[l][1],y=e[h][0],x=e[h][1],E=o[1]*(p-y)+m*(y-o[0])+x*(o[0]-p)===0&&(p-o[0])*(y-o[0])<=0&&(m-o[1])*(x-o[1])<=0;if(E)return!r;var b=m>o[1]!=x>o[1]&&o[0]<(y-p)*(o[1]-m)/(x-m)+p;b&&(u=!u)}return u}function iI(o,e){return e[0]<=o[0]&&e[1]<=o[1]&&e[2]>=o[0]&&e[3]>=o[1]}var K0=new ArrayBuffer(16),oO=new Float64Array(K0),sO=new Uint32Array(K0);var _I=nr(Ap(),1);var L3=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 u=this.points[r],l=this.points[r+1];this.centers.push({x:(u.x+l.x)/2,y:(u.y+l.y)/2,z:(u.z+l.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var r=0;r<this.centers.length-1;r++){var h=this.points[r+1].x-(this.centers[r].x+this.centers[r+1].x)/2,p=this.points[r+1].y-(this.centers[r].y+this.centers[r+1].y)/2,m=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+h),y:(1-this.sharpness)*this.points[r+1].y+this.sharpness*(this.centers[r].y+p),z:(1-this.sharpness)*this.points[r+1].z+this.sharpness*(this.centers[r].z+m)},{x:(1-this.sharpness)*this.points[r+1].x+this.sharpness*(this.centers[r+1].x+h),y:(1-this.sharpness)*this.points[r+1].y+this.sharpness*(this.centers[r+1].y+p),z:(1-this.sharpness)*this.points[r+1].z+this.sharpness*(this.centers[r+1].z+m)}])}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=[],u=this.pos(0);r.push(0);for(var l=0;l<this.duration;l+=10){var h=this.pos(l),p=Math.sqrt((h.x-u.x)*(h.x-u.x)+(h.y-u.y)*(h.y-u.y)+(h.z-u.z)*(h.z-u.z));p>e&&(r.push(l),u=h)}return r},o.prototype.vector=function(e){var r=this.pos(e+10),u=this.pos(e-10);return{angle:180*Math.atan2(r.y-u.y,r.x-u.x)/3.14,speed:Math.sqrt((u.x-r.x)*(u.x-r.x)+(u.y-r.y)*(u.y-r.y)+(u.z-r.z)*(u.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 u=r/this.duration;if(u>=1)return this.points[this.length-1];var l=Math.floor((this.points.length-1)*u),h=(this.length-1)*u-l;return xI(h,this.points[l],this.controls[l][1],this.controls[l+1][0],this.points[l+1])},o}();function xI(o,e,r,u,l){var h=EI(o),p={x:l.x*h[0]+u.x*h[1]+r.x*h[2]+e.x*h[3],y:l.y*h[0]+u.y*h[1]+r.y*h[2]+e.y*h[3],z:l.z*h[0]+u.z*h[1]+r.z*h[2]+e.z*h[3]};return p}function EI(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 Al(o,e){e===void 0&&(e={});var r=Number(o[0]),u=Number(o[1]),l=Number(o[2]),h=Number(o[3]);if(o.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var p=[r,u],m=[r,h],y=[l,h],x=[l,u];return ir([[p,x,y,m,p]],e.properties,{bbox:o,id:e.id})}function wI(o){return Al($i(o))}var Tp=wI;var zI=nr(uy(),1);var hP=nr(Qc(),1);var dP=nr(Oc(),1);var yP=nr(Ap(),1);var Ay=Math.PI/180,Ty=180/Math.PI,Nl=function(o,e){this.lon=o,this.lat=e,this.x=Ay*o,this.y=Ay*e};Nl.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};Nl.prototype.antipode=function(){var o=-1*this.lat,e=this.lon<0?180+this.lon:(180-this.lon)*-1;return new Nl(e,o)};var Cy=function(){this.coords=[],this.length=0};Cy.prototype.move_to=function(o){this.length++,this.coords.push(o)};var Yp=function(o){this.properties=o||{},this.geometries=[]};Yp.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}};Yp.prototype.wkt=function(){for(var o="",e="LINESTRING(",r=function(h){e+=h[0]+" "+h[1]+","},u=0;u<this.geometries.length;u++){if(this.geometries[u].coords.length===0)return"LINESTRING(empty)";var l=this.geometries[u].coords;l.forEach(r),o+=e.substring(0,e.length-1)+")"}return o};var Iy=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 Nl(o.x,o.y),this.end=new Nl(e.x,e.y),this.properties=r||{};var u=this.start.x-this.end.x,l=this.start.y-this.end.y,h=Math.pow(Math.sin(l/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(u/2),2);if(this.g=2*Math.asin(Math.sqrt(h)),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)};Iy.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),u=e*Math.cos(this.start.y)*Math.cos(this.start.x)+r*Math.cos(this.end.y)*Math.cos(this.end.x),l=e*Math.cos(this.start.y)*Math.sin(this.start.x)+r*Math.cos(this.end.y)*Math.sin(this.end.x),h=e*Math.sin(this.start.y)+r*Math.sin(this.end.y),p=Ty*Math.atan2(h,Math.sqrt(Math.pow(u,2)+Math.pow(l,2))),m=Ty*Math.atan2(l,u);return[m,p]};Iy.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 u=1/(o-1),l=0;l<o;++l){var h=u*l,p=this.interpolate(h);r.push(p)}for(var m=!1,y=0,x=e&&e.offset?e.offset:10,E=180-x,b=-180+x,M=360-x,C=1;C<r.length;++C){var D=r[C-1][0],G=r[C][0],O=Math.abs(G-D);O>M&&(G>E&&D<b||D>E&&G<b)?m=!0:O>y&&(y=O)}var L=[];if(m&&y<x){var k=[];L.push(k);for(var F=0;F<r.length;++F){var $=parseFloat(r[F][0]);if(F>0&&Math.abs($-r[F-1][0])>M){var Z=parseFloat(r[F-1][0]),it=parseFloat(r[F-1][1]),et=parseFloat(r[F][0]),U=parseFloat(r[F][1]);if(Z>-180&&Z<b&&et===180&&F+1<r.length&&r[F-1][0]>-180&&r[F-1][0]<b){k.push([-180,r[F][1]]),F++,k.push([r[F][0],r[F][1]]);continue}else if(Z>E&&Z<180&&et===-180&&F+1<r.length&&r[F-1][0]>E&&r[F-1][0]<180){k.push([180,r[F][1]]),F++,k.push([r[F][0],r[F][1]]);continue}if(Z<b&&et>E){var wt=Z;Z=et,et=wt;var Lt=it;it=U,U=Lt}if(Z>E&&et<b&&(et+=360),Z<=180&&et>=180&&Z<et){var Ot=(180-Z)/(et-Z),W=Ot*U+(1-Ot)*it;k.push([r[F-1][0]>E?180:-180,W]),k=[],k.push([r[F-1][0]>E?-180:180,W]),L.push(k)}else k=[],L.push(k);k.push([$,r[F][1]])}else k.push([r[F][0],r[F][1]])}}else{var de=[];L.push(de);for(var yt=0;yt<r.length;++yt)de.push([r[yt][0],r[yt][1]])}for(var zt=new Yp(this.properties),Kt=0;Kt<L.length;++Kt){var ie=new Cy;zt.geometries.push(ie);for(var _t=L[Kt],Pt=0;Pt<_t.length;++Pt)ie.move_to(_t[Pt])}return zt};var xP=nr(Qc(),1);var jR=nr(Qc(),1);var tL=nr(gd(),1);var rL=nr(Oc(),1);var ye=[],ve=[],_e=[],xe=[],Ee=[],we=[],Me=[],Se=[],be=[],Ae=[],Te=[],Ce=[],Ie=[],Pe=[],Re=[],Le=[],Ne=[],De=[],Oe=[],Fe=[],Ue=[],Be=[],ze=[],ke=[];Me[85]=Ae[85]=-1;Se[85]=Te[85]=0;be[85]=Ce[85]=1;Oe[85]=Be[85]=1;Fe[85]=ze[85]=0;Ue[85]=ke[85]=1;ye[85]=xe[85]=0;ve[85]=Ee[85]=-1;_e[85]=Re[85]=0;Le[85]=Ie[85]=0;Ne[85]=Pe[85]=1;we[85]=De[85]=1;Be[1]=Be[169]=0;ze[1]=ze[169]=-1;ke[1]=ke[169]=0;Ie[1]=Ie[169]=-1;Pe[1]=Pe[169]=0;Re[1]=Re[169]=0;Ae[4]=Ae[166]=0;Te[4]=Te[166]=-1;Ce[4]=Ce[166]=1;Le[4]=Le[166]=1;Ne[4]=Ne[166]=0;De[4]=De[166]=0;Me[16]=Me[154]=0;Se[16]=Se[154]=1;be[16]=be[154]=1;xe[16]=xe[154]=1;Ee[16]=Ee[154]=0;we[16]=we[154]=1;Oe[64]=Oe[106]=0;Fe[64]=Fe[106]=1;Ue[64]=Ue[106]=0;ye[64]=ye[106]=-1;ve[64]=ve[106]=0;_e[64]=_e[106]=1;Oe[2]=Oe[168]=0;Fe[2]=Fe[168]=-1;Ue[2]=Ue[168]=1;Be[2]=Be[168]=0;ze[2]=ze[168]=-1;ke[2]=ke[168]=0;Ie[2]=Ie[168]=-1;Pe[2]=Pe[168]=0;Re[2]=Re[168]=0;Le[2]=Le[168]=-1;Ne[2]=Ne[168]=0;De[2]=De[168]=1;Me[8]=Me[162]=0;Se[8]=Se[162]=-1;be[8]=be[162]=0;Ae[8]=Ae[162]=0;Te[8]=Te[162]=-1;Ce[8]=Ce[162]=1;Ie[8]=Ie[162]=1;Pe[8]=Pe[162]=0;Re[8]=Re[162]=1;Le[8]=Le[162]=1;Ne[8]=Ne[162]=0;De[8]=De[162]=0;Me[32]=Me[138]=0;Se[32]=Se[138]=1;be[32]=be[138]=1;Ae[32]=Ae[138]=0;Te[32]=Te[138]=1;Ce[32]=Ce[138]=0;ye[32]=ye[138]=1;ve[32]=ve[138]=0;_e[32]=_e[138]=0;xe[32]=xe[138]=1;Ee[32]=Ee[138]=0;we[32]=we[138]=1;Be[128]=Be[42]=0;ze[128]=ze[42]=1;ke[128]=ke[42]=1;Oe[128]=Oe[42]=0;Fe[128]=Fe[42]=1;Ue[128]=Ue[42]=0;ye[128]=ye[42]=-1;ve[128]=ve[42]=0;_e[128]=_e[42]=1;xe[128]=xe[42]=-1;Ee[128]=Ee[42]=0;we[128]=we[42]=0;Ae[5]=Ae[165]=-1;Te[5]=Te[165]=0;Ce[5]=Ce[165]=0;Be[5]=Be[165]=1;ze[5]=ze[165]=0;ke[5]=ke[165]=0;Le[20]=Le[150]=0;Ne[20]=Ne[150]=1;De[20]=De[150]=1;xe[20]=xe[150]=0;Ee[20]=Ee[150]=-1;we[20]=we[150]=1;Me[80]=Me[90]=-1;Se[80]=Se[90]=0;be[80]=be[90]=1;Oe[80]=Oe[90]=1;Fe[80]=Fe[90]=0;Ue[80]=Ue[90]=1;Ie[65]=Ie[105]=0;Pe[65]=Pe[105]=1;Re[65]=Re[105]=0;ye[65]=ye[105]=0;ve[65]=ve[105]=-1;_e[65]=_e[105]=0;Me[160]=Me[10]=-1;Se[160]=Se[10]=0;be[160]=be[10]=1;Ae[160]=Ae[10]=-1;Te[160]=Te[10]=0;Ce[160]=Ce[10]=0;Be[160]=Be[10]=1;ze[160]=ze[10]=0;ke[160]=ke[10]=0;Oe[160]=Oe[10]=1;Fe[160]=Fe[10]=0;Ue[160]=Ue[10]=1;Le[130]=Le[40]=0;Ne[130]=Ne[40]=1;De[130]=De[40]=1;Ie[130]=Ie[40]=0;Pe[130]=Pe[40]=1;Re[130]=Re[40]=0;ye[130]=ye[40]=0;ve[130]=ve[40]=-1;_e[130]=_e[40]=0;xe[130]=xe[40]=0;Ee[130]=Ee[40]=-1;we[130]=we[40]=1;Ae[37]=Ae[133]=0;Te[37]=Te[133]=1;Ce[37]=Ce[133]=1;Be[37]=Be[133]=0;ze[37]=ze[133]=1;ke[37]=ke[133]=0;ye[37]=ye[133]=-1;ve[37]=ve[133]=0;_e[37]=_e[133]=0;xe[37]=xe[133]=1;Ee[37]=Ee[133]=0;we[37]=we[133]=0;Le[148]=Le[22]=-1;Ne[148]=Ne[22]=0;De[148]=De[22]=0;Be[148]=Be[22]=0;ze[148]=ze[22]=-1;ke[148]=ke[22]=1;Oe[148]=Oe[22]=0;Fe[148]=Fe[22]=1;Ue[148]=Ue[22]=1;xe[148]=xe[22]=-1;Ee[148]=Ee[22]=0;we[148]=we[22]=1;Me[82]=Me[88]=0;Se[82]=Se[88]=-1;be[82]=be[88]=1;Le[82]=Le[88]=1;Ne[82]=Ne[88]=0;De[82]=De[88]=1;Ie[82]=Ie[88]=-1;Pe[82]=Pe[88]=0;Re[82]=Re[88]=1;Oe[82]=Oe[88]=0;Fe[82]=Fe[88]=-1;Ue[82]=Ue[88]=0;Me[73]=Me[97]=0;Se[73]=Se[97]=1;be[73]=be[97]=0;Ae[73]=Ae[97]=0;Te[73]=Te[97]=-1;Ce[73]=Ce[97]=0;Ie[73]=Ie[97]=1;Pe[73]=Pe[97]=0;Re[73]=Re[97]=0;ye[73]=ye[97]=1;ve[73]=ve[97]=0;_e[73]=_e[97]=1;Me[145]=Me[25]=0;Se[145]=Se[25]=-1;be[145]=be[25]=0;Ie[145]=Ie[25]=1;Pe[145]=Pe[25]=0;Re[145]=Re[25]=1;Be[145]=Be[25]=0;ze[145]=ze[25]=1;ke[145]=ke[25]=1;xe[145]=xe[25]=-1;Ee[145]=Ee[25]=0;we[145]=we[25]=0;Ae[70]=Ae[100]=0;Te[70]=Te[100]=1;Ce[70]=Ce[100]=0;Le[70]=Le[100]=-1;Ne[70]=Ne[100]=0;De[70]=De[100]=1;Oe[70]=Oe[100]=0;Fe[70]=Fe[100]=-1;Ue[70]=Ue[100]=1;ye[70]=ye[100]=1;ve[70]=ve[100]=0;_e[70]=_e[100]=0;Ae[101]=Ae[69]=0;Te[101]=Te[69]=1;Ce[101]=Ce[69]=0;ye[101]=ye[69]=1;ve[101]=ve[69]=0;_e[101]=_e[69]=0;Be[149]=Be[21]=0;ze[149]=ze[21]=1;ke[149]=ke[21]=1;xe[149]=xe[21]=-1;Ee[149]=Ee[21]=0;we[149]=we[21]=0;Le[86]=Le[84]=-1;Ne[86]=Ne[84]=0;De[86]=De[84]=1;Oe[86]=Oe[84]=0;Fe[86]=Fe[84]=-1;Ue[86]=Ue[84]=1;Me[89]=Me[81]=0;Se[89]=Se[81]=-1;be[89]=be[81]=0;Ie[89]=Ie[81]=1;Pe[89]=Pe[81]=0;Re[89]=Re[81]=1;Me[96]=Me[74]=0;Se[96]=Se[74]=1;be[96]=be[74]=0;Ae[96]=Ae[74]=-1;Te[96]=Te[74]=0;Ce[96]=Ce[74]=1;Oe[96]=Oe[74]=1;Fe[96]=Fe[74]=0;Ue[96]=Ue[74]=0;ye[96]=ye[74]=1;ve[96]=ve[74]=0;_e[96]=_e[74]=1;Me[24]=Me[146]=0;Se[24]=Se[146]=-1;be[24]=be[146]=1;Le[24]=Le[146]=1;Ne[24]=Ne[146]=0;De[24]=De[146]=1;Ie[24]=Ie[146]=0;Pe[24]=Pe[146]=1;Re[24]=Re[146]=1;xe[24]=xe[146]=0;Ee[24]=Ee[146]=-1;we[24]=we[146]=0;Ae[6]=Ae[164]=-1;Te[6]=Te[164]=0;Ce[6]=Ce[164]=1;Le[6]=Le[164]=-1;Ne[6]=Ne[164]=0;De[6]=De[164]=0;Be[6]=Be[164]=0;ze[6]=ze[164]=-1;ke[6]=ke[164]=1;Oe[6]=Oe[164]=1;Fe[6]=Fe[164]=0;Ue[6]=Ue[164]=0;Ie[129]=Ie[41]=0;Pe[129]=Pe[41]=1;Re[129]=Re[41]=1;Be[129]=Be[41]=0;ze[129]=ze[41]=1;ke[129]=ke[41]=0;ye[129]=ye[41]=-1;ve[129]=ve[41]=0;_e[129]=_e[41]=0;xe[129]=xe[41]=0;Ee[129]=Ee[41]=-1;we[129]=we[41]=0;Le[66]=Le[104]=0;Ne[66]=Ne[104]=1;De[66]=De[104]=0;Ie[66]=Ie[104]=-1;Pe[66]=Pe[104]=0;Re[66]=Re[104]=1;Oe[66]=Oe[104]=0;Fe[66]=Fe[104]=-1;Ue[66]=Ue[104]=0;ye[66]=ye[104]=0;ve[66]=ve[104]=-1;_e[66]=_e[104]=1;Me[144]=Me[26]=-1;Se[144]=Se[26]=0;be[144]=be[26]=0;Be[144]=Be[26]=1;ze[144]=ze[26]=0;ke[144]=ke[26]=1;Oe[144]=Oe[26]=0;Fe[144]=Fe[26]=1;Ue[144]=Ue[26]=1;xe[144]=xe[26]=-1;Ee[144]=Ee[26]=0;we[144]=we[26]=1;Ae[36]=Ae[134]=0;Te[36]=Te[134]=1;Ce[36]=Ce[134]=1;Le[36]=Le[134]=0;Ne[36]=Ne[134]=1;De[36]=De[134]=0;ye[36]=ye[134]=0;ve[36]=ve[134]=-1;_e[36]=_e[134]=1;xe[36]=xe[134]=1;Ee[36]=Ee[134]=0;we[36]=we[134]=0;Me[9]=Me[161]=-1;Se[9]=Se[161]=0;be[9]=be[161]=0;Ae[9]=Ae[161]=0;Te[9]=Te[161]=-1;Ce[9]=Ce[161]=0;Ie[9]=Ie[161]=1;Pe[9]=Pe[161]=0;Re[9]=Re[161]=0;Be[9]=Be[161]=1;ze[9]=ze[161]=0;ke[9]=ke[161]=1;Me[136]=0;Se[136]=1;be[136]=1;Ae[136]=0;Te[136]=1;Ce[136]=0;Le[136]=-1;Ne[136]=0;De[136]=1;Ie[136]=-1;Pe[136]=0;Re[136]=0;Be[136]=0;ze[136]=-1;ke[136]=0;Oe[136]=0;Fe[136]=-1;Ue[136]=1;ye[136]=1;ve[136]=0;_e[136]=0;xe[136]=1;Ee[136]=0;we[136]=1;Me[34]=0;Se[34]=-1;be[34]=0;Ae[34]=0;Te[34]=-1;Ce[34]=1;Le[34]=1;Ne[34]=0;De[34]=0;Ie[34]=1;Pe[34]=0;Re[34]=1;Be[34]=0;ze[34]=1;ke[34]=1;Oe[34]=0;Fe[34]=1;Ue[34]=0;ye[34]=-1;ve[34]=0;_e[34]=1;xe[34]=-1;Ee[34]=0;we[34]=0;Me[35]=0;Se[35]=1;be[35]=1;Ae[35]=0;Te[35]=-1;Ce[35]=1;Le[35]=1;Ne[35]=0;De[35]=0;Ie[35]=-1;Pe[35]=0;Re[35]=0;Be[35]=0;ze[35]=-1;ke[35]=0;Oe[35]=0;Fe[35]=1;Ue[35]=0;ye[35]=-1;ve[35]=0;_e[35]=1;xe[35]=1;Ee[35]=0;we[35]=1;Me[153]=0;Se[153]=1;be[153]=1;Ie[153]=-1;Pe[153]=0;Re[153]=0;Be[153]=0;ze[153]=-1;ke[153]=0;xe[153]=1;Ee[153]=0;we[153]=1;Ae[102]=0;Te[102]=-1;Ce[102]=1;Le[102]=1;Ne[102]=0;De[102]=0;Oe[102]=0;Fe[102]=1;Ue[102]=0;ye[102]=-1;ve[102]=0;_e[102]=1;Me[155]=0;Se[155]=-1;be[155]=0;Ie[155]=1;Pe[155]=0;Re[155]=1;Be[155]=0;ze[155]=1;ke[155]=1;xe[155]=-1;Ee[155]=0;we[155]=0;Ae[103]=0;Te[103]=1;Ce[103]=0;Le[103]=-1;Ne[103]=0;De[103]=1;Oe[103]=0;Fe[103]=-1;Ue[103]=1;ye[103]=1;ve[103]=0;_e[103]=0;Me[152]=0;Se[152]=1;be[152]=1;Le[152]=-1;Ne[152]=0;De[152]=1;Ie[152]=-1;Pe[152]=0;Re[152]=0;Be[152]=0;ze[152]=-1;ke[152]=0;Oe[152]=0;Fe[152]=-1;Ue[152]=1;xe[152]=1;Ee[152]=0;we[152]=1;Me[156]=0;Se[156]=-1;be[156]=1;Le[156]=1;Ne[156]=0;De[156]=1;Ie[156]=-1;Pe[156]=0;Re[156]=0;Be[156]=0;ze[156]=-1;ke[156]=0;Oe[156]=0;Fe[156]=1;Ue[156]=1;xe[156]=-1;Ee[156]=0;we[156]=1;Me[137]=0;Se[137]=1;be[137]=1;Ae[137]=0;Te[137]=1;Ce[137]=0;Ie[137]=-1;Pe[137]=0;Re[137]=0;Be[137]=0;ze[137]=-1;ke[137]=0;ye[137]=1;ve[137]=0;_e[137]=0;xe[137]=1;Ee[137]=0;we[137]=1;Me[139]=0;Se[139]=1;be[139]=1;Ae[139]=0;Te[139]=-1;Ce[139]=0;Ie[139]=1;Pe[139]=0;Re[139]=0;Be[139]=0;ze[139]=1;ke[139]=0;ye[139]=-1;ve[139]=0;_e[139]=0;xe[139]=1;Ee[139]=0;we[139]=1;Me[98]=0;Se[98]=-1;be[98]=0;Ae[98]=0;Te[98]=-1;Ce[98]=1;Le[98]=1;Ne[98]=0;De[98]=0;Ie[98]=1;Pe[98]=0;Re[98]=1;Oe[98]=0;Fe[98]=1;Ue[98]=0;ye[98]=-1;ve[98]=0;_e[98]=1;Me[99]=0;Se[99]=1;be[99]=0;Ae[99]=0;Te[99]=-1;Ce[99]=1;Le[99]=1;Ne[99]=0;De[99]=0;Ie[99]=-1;Pe[99]=0;Re[99]=1;Oe[99]=0;Fe[99]=-1;Ue[99]=0;ye[99]=1;ve[99]=0;_e[99]=1;Ae[38]=0;Te[38]=-1;Ce[38]=1;Le[38]=1;Ne[38]=0;De[38]=0;Be[38]=0;ze[38]=1;ke[38]=1;Oe[38]=0;Fe[38]=1;Ue[38]=0;ye[38]=-1;ve[38]=0;_e[38]=1;xe[38]=-1;Ee[38]=0;we[38]=0;Ae[39]=0;Te[39]=1;Ce[39]=1;Le[39]=-1;Ne[39]=0;De[39]=0;Be[39]=0;ze[39]=-1;ke[39]=1;Oe[39]=0;Fe[39]=1;Ue[39]=0;ye[39]=-1;ve[39]=0;_e[39]=1;xe[39]=1;Ee[39]=0;we[39]=0;var md=function(o){return[[o.bottomleft,0],[0,0],[0,o.leftbottom]]},yd=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0]]},vd=function(o){return[[o.topright,1],[1,1],[1,o.righttop]]},_d=function(o){return[[0,o.lefttop],[0,1],[o.topleft,1]]},xd=function(o){return[[o.bottomright,0],[o.bottomleft,0],[0,o.leftbottom],[0,o.lefttop]]},Ed=function(o){return[[o.bottomright,0],[o.bottomleft,0],[1,o.righttop],[1,o.rightbottom]]},wd=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.topleft,1],[o.topright,1]]},Md=function(o){return[[0,o.leftbottom],[0,o.lefttop],[o.topleft,1],[o.topright,1]]},iL=function(o){return[[0,0],[0,o.leftbottom],[1,o.rightbottom],[1,0]]},oL=function(o){return[[1,0],[o.bottomright,0],[o.topright,1],[1,1]]},sL=function(o){return[[1,1],[1,o.righttop],[0,o.lefttop],[0,1]]},aL=function(o){return[[o.bottomleft,0],[0,0],[0,1],[o.topleft,1]]},uL=function(o){return[[1,o.righttop],[1,o.rightbottom],[0,o.leftbottom],[0,o.lefttop]]},lL=function(o){return[[o.topleft,1],[o.topright,1],[o.bottomright,0],[o.bottomleft,0]]},cL=function(){return[[0,0],[0,1],[1,1],[1,0]]},fL=function(o){return[[1,o.rightbottom],[1,0],[0,0],[0,1],[o.topleft,1]]},hL=function(o){return[[o.topright,1],[1,1],[1,0],[0,0],[0,o.leftbottom]]},pL=function(o){return[[1,0],[o.bottomright,0],[0,o.lefttop],[0,1],[1,1]]},dL=function(o){return[[1,1],[1,o.righttop],[o.bottomleft,0],[0,0],[0,1]]},gL=function(o){return[[1,o.righttop],[1,o.rightbottom],[0,o.lefttop],[0,1],[o.topleft,1]]},mL=function(o){return[[1,1],[1,o.righttop],[o.bottomright,0],[o.bottomleft,0],[o.topright,1]]},yL=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.leftbottom],[0,o.lefttop]]},vL=function(o){return[[o.topright,1],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topleft,1]]},_L=function(o){return[[o.bottomright,0],[o.bottomleft,0],[0,o.lefttop],[0,1],[o.topleft,1]]},xL=function(o){return[[1,1],[1,o.righttop],[0,o.leftbottom],[0,o.lefttop],[o.topright,1]]},EL=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[o.topleft,1],[o.topright,1]]},wL=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomleft,0],[0,0],[0,o.leftbottom]]},ML=function(o){return[[1,o.rightbottom],[1,0],[0,0],[0,o.leftbottom],[o.topleft,1],[o.topright,1]]},SL=function(o){return[[1,1],[1,0],[o.bottomright,0],[0,o.leftbottom],[0,o.lefttop],[o.topright,1]]},bL=function(o){return[[1,1],[1,o.righttop],[o.bottomright,0],[o.bottomleft,0],[0,o.lefttop],[0,1]]},AL=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomleft,0],[0,0],[0,1],[o.topleft,1]]},TL=function(o){return[[1,1],[1,o.righttop],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topright,1]]},CL=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.lefttop],[0,1],[o.topleft,1]]},IL=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]]},PL=function(o){return[[1,1],[1,o.righttop],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topright,1]]},RL=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.lefttop],[0,1],[o.topleft,1]]},LL=function(o){return[[1,1],[1,o.righttop],[o.bottomright,0],[o.bottomleft,0],[0,o.leftbottom],[0,o.lefttop],[o.topright,1]]},NL=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topleft,1],[o.topright,1]]},DL=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomright,0],[o.bottomleft,0],[0,o.lefttop],[0,1],[o.topleft,1]]},OL=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.leftbottom],[0,o.lefttop],[o.topleft,1],[o.topright,1]]},Xe=[],Ye=[],$e=[],Ze=[],Je=[],Ke=[],Qe=[],je=[];Ze[1]=Je[1]=18;Ze[169]=Je[169]=18;$e[4]=Ye[4]=12;$e[166]=Ye[166]=12;Xe[16]=je[16]=4;Xe[154]=je[154]=4;Ke[64]=Qe[64]=22;Ke[106]=Qe[106]=22;$e[2]=Ke[2]=17;Ze[2]=Je[2]=18;$e[168]=Ke[168]=17;Ze[168]=Je[168]=18;Xe[8]=Ze[8]=9;Ye[8]=$e[8]=12;Xe[162]=Ze[162]=9;Ye[162]=$e[162]=12;Xe[32]=je[32]=4;Ye[32]=Qe[32]=1;Xe[138]=je[138]=4;Ye[138]=Qe[138]=1;Je[128]=je[128]=21;Ke[128]=Qe[128]=22;Je[42]=je[42]=21;Ke[42]=Qe[42]=22;Ye[5]=Je[5]=14;Ye[165]=Je[165]=14;$e[20]=je[20]=6;$e[150]=je[150]=6;Xe[80]=Ke[80]=11;Xe[90]=Ke[90]=11;Ze[65]=Qe[65]=3;Ze[105]=Qe[105]=3;Xe[160]=Ke[160]=11;Ye[160]=Je[160]=14;Xe[10]=Ke[10]=11;Ye[10]=Je[10]=14;$e[130]=je[130]=6;Ze[130]=Qe[130]=3;$e[40]=je[40]=6;Ze[40]=Qe[40]=3;Ye[101]=Qe[101]=1;Ye[69]=Qe[69]=1;Je[149]=je[149]=21;Je[21]=je[21]=21;$e[86]=Ke[86]=17;$e[84]=Ke[84]=17;Xe[89]=Ze[89]=9;Xe[81]=Ze[81]=9;Xe[96]=Qe[96]=0;Ye[96]=Ke[96]=15;Xe[74]=Qe[74]=0;Ye[74]=Ke[74]=15;Xe[24]=$e[24]=8;Ze[24]=je[24]=7;Xe[146]=$e[146]=8;Ze[146]=je[146]=7;Ye[6]=Ke[6]=15;$e[6]=Je[6]=16;Ye[164]=Ke[164]=15;$e[164]=Je[164]=16;Ze[129]=je[129]=7;Je[129]=Qe[129]=20;Ze[41]=je[41]=7;Je[41]=Qe[41]=20;$e[66]=Qe[66]=2;Ze[66]=Ke[66]=19;$e[104]=Qe[104]=2;Ze[104]=Ke[104]=19;Xe[144]=Je[144]=10;Ke[144]=je[144]=23;Xe[26]=Je[26]=10;Ke[26]=je[26]=23;Ye[36]=je[36]=5;$e[36]=Qe[36]=2;Ye[134]=je[134]=5;$e[134]=Qe[134]=2;Xe[9]=Je[9]=10;Ye[9]=Ze[9]=13;Xe[161]=Je[161]=10;Ye[161]=Ze[161]=13;Ye[37]=je[37]=5;Je[37]=Qe[37]=20;Ye[133]=je[133]=5;Je[133]=Qe[133]=20;$e[148]=Je[148]=16;Ke[148]=je[148]=23;$e[22]=Je[22]=16;Ke[22]=je[22]=23;Xe[82]=$e[82]=8;Ze[82]=Ke[82]=19;Xe[88]=$e[88]=8;Ze[88]=Ke[88]=19;Xe[73]=Qe[73]=0;Ye[73]=Ze[73]=13;Xe[97]=Qe[97]=0;Ye[97]=Ze[97]=13;Xe[145]=Ze[145]=9;Je[145]=je[145]=21;Xe[25]=Ze[25]=9;Je[25]=je[25]=21;Ye[70]=Qe[70]=1;$e[70]=Ke[70]=17;Ye[100]=Qe[100]=1;$e[100]=Ke[100]=17;Xe[34]=Ze[34]=9;Ye[34]=$e[34]=12;Je[34]=je[34]=21;Ke[34]=Qe[34]=22;Xe[136]=je[136]=4;Ye[136]=Qe[136]=1;$e[136]=Ke[136]=17;Ze[136]=Je[136]=18;Xe[35]=je[35]=4;Ye[35]=$e[35]=12;Ze[35]=Je[35]=18;Ke[35]=Qe[35]=22;Xe[153]=je[153]=4;Ze[153]=Je[153]=18;Ye[102]=$e[102]=12;Ke[102]=Qe[102]=22;Xe[155]=Ze[155]=9;Je[155]=je[155]=23;Ye[103]=Qe[103]=1;$e[103]=Ke[103]=17;Xe[152]=je[152]=4;$e[152]=Ke[152]=17;Ze[152]=Je[152]=18;Xe[156]=$e[156]=8;Ze[156]=Je[156]=18;Ke[156]=je[156]=23;Xe[137]=je[137]=4;Ye[137]=Qe[137]=1;Ze[137]=Je[137]=18;Xe[139]=je[139]=4;Ye[139]=Ze[139]=13;Je[139]=Qe[139]=20;Xe[98]=Ze[98]=9;Ye[98]=$e[98]=12;Ke[98]=Qe[98]=22;Xe[99]=Qe[99]=0;Ye[99]=$e[99]=12;Ze[99]=Ke[99]=19;Ye[38]=$e[38]=12;Je[38]=je[38]=21;Ke[38]=Qe[38]=22;Ye[39]=je[39]=5;$e[39]=Je[39]=16;Ke[39]=Qe[39]=22;var St=[];St[1]=St[169]=md;St[4]=St[166]=yd;St[16]=St[154]=vd;St[64]=St[106]=_d;St[168]=St[2]=xd;St[162]=St[8]=Ed;St[138]=St[32]=wd;St[42]=St[128]=Md;St[5]=St[165]=iL;St[20]=St[150]=oL;St[80]=St[90]=sL;St[65]=St[105]=aL;St[160]=St[10]=uL;St[130]=St[40]=lL;St[85]=cL;St[101]=St[69]=fL;St[149]=St[21]=hL;St[86]=St[84]=pL;St[89]=St[81]=dL;St[96]=St[74]=gL;St[24]=St[146]=mL;St[6]=St[164]=yL;St[129]=St[41]=vL;St[66]=St[104]=_L;St[144]=St[26]=xL;St[36]=St[134]=EL;St[9]=St[161]=wL;St[37]=St[133]=ML;St[148]=St[22]=SL;St[82]=St[88]=bL;St[73]=St[97]=AL;St[145]=St[25]=TL;St[70]=St[100]=CL;St[34]=function(o){return[Md(o),Ed(o)]};St[35]=IL;St[136]=function(o){return[wd(o),xd(o)]};St[153]=function(o){return[vd(o),md(o)]};St[102]=function(o){return[yd(o),_d(o)]};St[155]=PL;St[103]=RL;St[152]=function(o){return[vd(o),xd(o)]};St[156]=LL;St[137]=function(o){return[wd(o),md(o)]};St[139]=NL;St[98]=function(o){return[Ed(o),_d(o)]};St[99]=DL;St[38]=function(o){return[yd(o),Md(o)]};St[39]=OL;function UL(o){return(o>0)-(o<0)||+o}function Hu(o,e,r){var u=e[0]-o[0],l=e[1]-o[1],h=r[0]-e[0],p=r[1]-e[1];return UL(u*p-h*l)}function O_(o,e){var r=o.geometry.coordinates[0].map(function(p){return p[0]}),u=o.geometry.coordinates[0].map(function(p){return p[1]}),l=e.geometry.coordinates[0].map(function(p){return p[0]}),h=e.geometry.coordinates[0].map(function(p){return p[1]});return Math.max.apply(null,r)===Math.max.apply(null,l)&&Math.max.apply(null,u)===Math.max.apply(null,h)&&Math.min.apply(null,r)===Math.min.apply(null,l)&&Math.min.apply(null,u)===Math.min.apply(null,h)}function Sd(o,e){return e.geometry.coordinates[0].every(function(r){return oi(Zn(r),o)})}function F_(o,e){return o[0]===e[0]&&o[1]===e[1]}var BL=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,u){var l=r.to,h=u.to;if(l.coordinates[0]-e.coordinates[0]>=0&&h.coordinates[0]-e.coordinates[0]<0)return 1;if(l.coordinates[0]-e.coordinates[0]<0&&h.coordinates[0]-e.coordinates[0]>=0)return-1;if(l.coordinates[0]-e.coordinates[0]===0&&h.coordinates[0]-e.coordinates[0]===0)return l.coordinates[1]-e.coordinates[1]>=0||h.coordinates[1]-e.coordinates[1]>=0?l.coordinates[1]-h.coordinates[1]:h.coordinates[1]-l.coordinates[1];var p=Hu(e.coordinates,l.coordinates,h.coordinates);if(p<0)return 1;if(p>0)return-1;var m=Math.pow(l.coordinates[0]-e.coordinates[0],2)+Math.pow(l.coordinates[1]-e.coordinates[1],2),y=Math.pow(h.coordinates[0]-e.coordinates[0],2)+Math.pow(h.coordinates[1]-e.coordinates[1],2);return m-y}),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}(),bd=BL;var zL=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 ii([this.from.coordinates,this.to.coordinates])},o.prototype.compareTo=function(e){return Hu(e.from.coordinates,e.to.coordinates,this.to.coordinates)},o}(),U_=zL;var kL=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(p,m,y){return m.from.coordinates[1]>e.edges[p].from.coordinates[1]&&(p=y),p},0),u=(r===0?this.length:r)-1,l=(r+1)%this.length,h=Hu(this.edges[u].from.coordinates,this.edges[r].from.coordinates,this.edges[l].from.coordinates);return h===0?this.edges[u].from.coordinates[0]>this.edges[l].from.coordinates[0]:h>0},o.prototype.toMultiPoint=function(){return up(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=ir([e])},o.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Tp(this.toPolygon())},o.findEdgeRingContaining=function(e,r){var u=e.getEnvelope(),l,h;return r.forEach(function(p){var m=p.getEnvelope();if(h&&(l=h.getEnvelope()),!O_(m,u)&&Sd(m,u)){for(var y=e.map(function(D){return D.from.coordinates}),x=void 0,E=function(D){p.some(function(G){return F_(D,G.from.coordinates)})||(x=D)},b=0,M=y;b<M.length;b++){var C=M[b];E(C)}x&&p.inside(Zn(x))&&(!h||Sd(l,m))&&(h=p)}}),h},o.prototype.inside=function(e){return oi(e,this.toPolygon())},o}(),Ad=kL;function GL(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 Ek=function(){function o(){this.edges=[],this.nodes={}}return o.fromGeoJson=function(e){GL(e);var r=new o;return Uo(e,function(u){cp(u,"LineString","Graph::fromGeoJson"),I0(u,function(l,h){if(l){var p=r.getNode(l),m=r.getNode(h);r.addEdge(p,m)}return h})}),r},o.prototype.getNode=function(e){var r=bd.buildId(e),u=this.nodes[r];return u||(u=this.nodes[r]=new bd(e)),u},o.prototype.addEdge=function(e,r){var u=new U_(e,r),l=u.getSymetric();this.edges.push(u),this.edges.push(l)},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 u=e.getOuterEdges().map(function(l){return l.to});this.removeNode(e),u.forEach(function(l){return r._removeIfDangle(l)})}},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>"u"?Object.keys(this.nodes).forEach(function(u){return r._computeNextCWEdges(r.nodes[u])}):e.getOuterEdges().forEach(function(u,l){e.getOuterEdge((l===0?e.getOuterEdges().length:l)-1).symetric.next=u})},o.prototype._computeNextCCWEdges=function(e,r){for(var u=e.getOuterEdges(),l,h,p=u.length-1;p>=0;--p){var m=u[p],y=m.symetric,x=void 0,E=void 0;m.label===r&&(x=m),y.label===r&&(E=y),!(!x||!E)&&(E&&(h=E),x&&(h&&(h.next=x,h=void 0),l||(l=x)))}h&&(h.next=l)},o.prototype._findLabeledEdgeRings=function(){var e=[],r=0;return this.edges.forEach(function(u){if(!(u.label>=0)){e.push(u);var l=u;do l.label=r,l=l.next;while(!u.isEqual(l));r++}}),e},o.prototype.getEdgeRings=function(){var e=this;this._computeNextCWEdges(),this.edges.forEach(function(u){u.label=void 0}),this._findLabeledEdgeRings().forEach(function(u){e._findIntersectionNodes(u).forEach(function(l){e._computeNextCCWEdges(l,u.label)})});var r=[];return this.edges.forEach(function(u){u.ring||r.push(e._findEdgeRing(u))}),r},o.prototype._findIntersectionNodes=function(e){var r=[],u=e,l=function(){var h=0;u.from.getOuterEdges().forEach(function(p){p.label===e.label&&++h}),h>1&&r.push(u.from),u=u.next};do l();while(!e.isEqual(u));return r},o.prototype._findEdgeRing=function(e){var r=e,u=new Ad;do u.push(r),r.ring=u,r=r.next;while(!e.isEqual(r));return u},o.prototype.removeNode=function(e){var r=this;e.getOuterEdges().forEach(function(u){return r.removeEdge(u)}),e.innerEdges.forEach(function(u){return r.removeEdge(u)}),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 qL=nr(Td(),1);var XL=nr(Td(),1);var $L=nr(X_(),1);var e2=nr(n1(),1);function i1(o){for(var e=o,r=[];e.parent;)r.unshift(e),e=e.parent;return r}function r2(){return new o1(function(o){return o.f})}var Rd={search:function(o,e,r,u){o.cleanDirty(),u=u||{};var l=u.heuristic||Rd.heuristics.manhattan,h=u.closest||!1,p=r2(),m=e;for(e.h=l(e,r),p.push(e);p.size()>0;){var y=p.pop();if(y===r)return i1(y);y.closed=!0;for(var x=o.neighbors(y),E=0,b=x.length;E<b;++E){var M=x[E];if(!(M.closed||M.isWall())){var C=y.g+M.getCost(y),D=M.visited;(!D||C<M.g)&&(M.visited=!0,M.parent=y,M.h=M.h||l(M,r),M.g=C,M.f=M.g+M.h,o.markDirty(M),h&&(M.h<m.h||M.h===m.h&&M.g<m.g)&&(m=M),D?p.rescoreElement(M):p.push(M))}}}return h?i1(m):[]},heuristics:{manhattan:function(o,e){var r=Math.abs(e.x-o.x),u=Math.abs(e.y-o.y);return r+u},diagonal:function(o,e){var r=1,u=Math.sqrt(2),l=Math.abs(e.x-o.x),h=Math.abs(e.y-o.y);return r*(l+h)+(u-2*r)*Math.min(l,h)}},cleanNode:function(o){o.f=0,o.g=0,o.h=0,o.visited=!1,o.closed=!1,o.parent=null}};function zl(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 u=0,l=o[r];u<l.length;u++){var h=new Af(r,u,l[u]);this.grid[r][u]=h,this.nodes.push(h)}}this.init()}zl.prototype.init=function(){this.dirtyNodes=[];for(var o=0;o<this.nodes.length;o++)Rd.cleanNode(this.nodes[o])};zl.prototype.cleanDirty=function(){for(var o=0;o<this.dirtyNodes.length;o++)Rd.cleanNode(this.dirtyNodes[o]);this.dirtyNodes=[]};zl.prototype.markDirty=function(o){this.dirtyNodes.push(o)};zl.prototype.neighbors=function(o){var e=[],r=o.x,u=o.y,l=this.grid;return l[r-1]&&l[r-1][u]&&e.push(l[r-1][u]),l[r+1]&&l[r+1][u]&&e.push(l[r+1][u]),l[r]&&l[r][u-1]&&e.push(l[r][u-1]),l[r]&&l[r][u+1]&&e.push(l[r][u+1]),this.diagonal&&(l[r-1]&&l[r-1][u-1]&&e.push(l[r-1][u-1]),l[r+1]&&l[r+1][u-1]&&e.push(l[r+1][u-1]),l[r-1]&&l[r-1][u+1]&&e.push(l[r-1][u+1]),l[r+1]&&l[r+1][u+1]&&e.push(l[r+1][u+1])),e};zl.prototype.toString=function(){for(var o=[],e=this.grid,r,u,l,h,p=0,m=e.length;p<m;p++){for(r=[],u=e[p],l=0,h=u.length;l<h;l++)r.push(u[l].weight);o.push(r.join(" "))}return o.join(`\n`)};function Af(o,e,r){this.x=o,this.y=e,this.weight=r}Af.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Af.prototype.getCost=function(o){return o&&o.x!==this.x&&o.y!==this.y?this.weight*1.41421:this.weight};Af.prototype.isWall=function(){return this.weight===0};function o1(o){this.content=[],this.scoreFunction=o}o1.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,u=this.content[r];if(this.scoreFunction(e)<this.scoreFunction(u))this.content[r]=e,this.content[o]=u,o=r;else break}},bubbleUp:function(o){for(var e=this.content.length,r=this.content[o],u=this.scoreFunction(r);;){var l=o+1<<1,h=l-1,p=null,m;if(h<e){var y=this.content[h];m=this.scoreFunction(y),m<u&&(p=h)}if(l<e){var x=this.content[l],E=this.scoreFunction(x);E<(p===null?u:m)&&(p=l)}if(p!==null)this.content[o]=this.content[p],this.content[p]=r,o=p;else break}}};function Ld(){this._=null}function Wu(o){o.U=o.C=o.L=o.R=o.P=o.N=null}Ld.prototype={constructor:Ld,insert:function(o,e){var r,u,l;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=s1(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;)u=r.U,r===u.L?(l=u.R,l&&l.C?(r.C=l.C=!1,u.C=!0,o=u):(o===r.R&&(kl(this,r),o=r,r=o.U),r.C=!1,u.C=!0,Gl(this,u))):(l=u.L,l&&l.C?(r.C=l.C=!1,u.C=!0,o=u):(o===r.L&&(Gl(this,r),o=r,r=o.U),r.C=!1,u.C=!0,kl(this,u))),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,u=o.L,l=o.R,h,p;if(u?l?h=s1(l):h=u:h=l,e?e.L===o?e.L=h:e.R=h:this._=h,u&&l?(p=h.C,h.C=o.C,h.L=u,u.U=h,h!==l?(e=h.U,h.U=o.U,o=h.R,e.L=o,h.R=l,l.U=h):(h.U=e,e=h,o=h.R)):(p=o.C,o=h),o&&(o.U=e),!p){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,kl(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,Gl(this,r),r=e.R),r.C=e.C,e.C=r.R.C=!1,kl(this,e),o=this._;break}}else if(r=e.L,r.C&&(r.C=!1,e.C=!0,Gl(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,kl(this,r),r=e.L),r.C=e.C,e.C=r.L.C=!1,Gl(this,e),o=this._;break}r.C=!0,o=e,e=e.U}while(!o.C);o&&(o.C=!1)}}};function kl(o,e){var r=e,u=e.R,l=r.U;l?l.L===r?l.L=u:l.R=u:o._=u,u.U=l,r.U=u,r.R=u.L,r.R&&(r.R.U=r),u.L=r}function Gl(o,e){var r=e,u=e.L,l=r.U;l?l.L===r?l.L=u:l.R=u:o._=u,u.U=l,r.U=u,r.L=u.R,r.L&&(r.L.U=r),u.R=r}function s1(o){for(;o.L;)o=o.L;return o}var Nd=Ld;function qu(o,e,r,u){var l=[null,null],h=ai.push(l)-1;return l.left=o,l.right=e,r&&Hl(l,o,e,r),u&&Hl(l,e,o,u),Zi[o.index].halfedges.push(h),Zi[e.index].halfedges.push(h),l}function Xu(o,e,r){var u=[e,r];return u.left=o,u}function Hl(o,e,r,u){!o[0]&&!o[1]?(o[0]=u,o.left=e,o.right=r):o.left===r?o[1]=u:o[0]=u}function i2(o,e,r,u,l){var h=o[0],p=o[1],m=h[0],y=h[1],x=p[0],E=p[1],b=0,M=1,C=x-m,D=E-y,G;if(G=e-m,!(!C&&G>0)){if(G/=C,C<0){if(G<b)return;G<M&&(M=G)}else if(C>0){if(G>M)return;G>b&&(b=G)}if(G=u-m,!(!C&&G<0)){if(G/=C,C<0){if(G>M)return;G>b&&(b=G)}else if(C>0){if(G<b)return;G<M&&(M=G)}if(G=r-y,!(!D&&G>0)){if(G/=D,D<0){if(G<b)return;G<M&&(M=G)}else if(D>0){if(G>M)return;G>b&&(b=G)}if(G=l-y,!(!D&&G<0)){if(G/=D,D<0){if(G>M)return;G>b&&(b=G)}else if(D>0){if(G<b)return;G<M&&(M=G)}return!(b>0)&&!(M<1)||(b>0&&(o[0]=[m+b*C,y+b*D]),M<1&&(o[1]=[m+M*C,y+M*D])),!0}}}}}function o2(o,e,r,u,l){var h=o[1];if(h)return!0;var p=o[0],m=o.left,y=o.right,x=m[0],E=m[1],b=y[0],M=y[1],C=(x+b)/2,D=(E+M)/2,G,O;if(M===E){if(C<e||C>=u)return;if(x>b){if(!p)p=[C,r];else if(p[1]>=l)return;h=[C,l]}else{if(!p)p=[C,l];else if(p[1]<r)return;h=[C,r]}}else if(G=(x-b)/(M-E),O=D-G*C,G<-1||G>1)if(x>b){if(!p)p=[(r-O)/G,r];else if(p[1]>=l)return;h=[(l-O)/G,l]}else{if(!p)p=[(l-O)/G,l];else if(p[1]<r)return;h=[(r-O)/G,r]}else if(E<M){if(!p)p=[e,G*e+O];else if(p[0]>=u)return;h=[u,G*u+O]}else{if(!p)p=[u,G*u+O];else if(p[0]<e)return;h=[e,G*e+O]}return o[0]=p,o[1]=h,!0}function a1(o,e,r,u){for(var l=ai.length,h;l--;)(!o2(h=ai[l],o,e,r,u)||!i2(h,o,e,r,u)||!(Math.abs(h[0][0]-h[1][0])>On||Math.abs(h[0][1]-h[1][1])>On))&&delete ai[l]}function u1(o){return Zi[o.index]={site:o,halfedges:[]}}function s2(o,e){var r=o.site,u=e.left,l=e.right;return r===l&&(l=u,u=r),l?Math.atan2(l[1]-u[1],l[0]-u[0]):(r===u?(u=e[1],l=e[0]):(u=e[0],l=e[1]),Math.atan2(u[0]-l[0],l[1]-u[1]))}function Dd(o,e){return e[+(e.left!==o.site)]}function a2(o,e){return e[+(e.left===o.site)]}function l1(){for(var o=0,e=Zi.length,r,u,l,h;o<e;++o)if((r=Zi[o])&&(h=(u=r.halfedges).length)){var p=new Array(h),m=new Array(h);for(l=0;l<h;++l)p[l]=l,m[l]=s2(r,ai[u[l]]);for(p.sort(function(y,x){return m[x]-m[y]}),l=0;l<h;++l)m[l]=u[p[l]];for(l=0;l<h;++l)u[l]=m[l]}}function c1(o,e,r,u){var l=Zi.length,h,p,m,y,x,E,b,M,C,D,G,O,L=!0;for(h=0;h<l;++h)if(p=Zi[h]){for(m=p.site,x=p.halfedges,y=x.length;y--;)ai[x[y]]||x.splice(y,1);for(y=0,E=x.length;y<E;)D=a2(p,ai[x[y]]),G=D[0],O=D[1],b=Dd(p,ai[x[++y%E]]),M=b[0],C=b[1],(Math.abs(G-M)>On||Math.abs(O-C)>On)&&(x.splice(y,0,ai.push(Xu(m,D,Math.abs(G-o)<On&&u-O>On?[o,Math.abs(M-o)<On?C:u]:Math.abs(O-u)<On&&r-G>On?[Math.abs(C-u)<On?M:r,u]:Math.abs(G-r)<On&&O-e>On?[r,Math.abs(M-r)<On?C:e]:Math.abs(O-e)<On&&G-o>On?[Math.abs(C-e)<On?M:o,e]:null))-1),++E);E&&(L=!1)}if(L){var k,F,$,Z=1/0;for(h=0,L=null;h<l;++h)(p=Zi[h])&&(m=p.site,k=m[0]-o,F=m[1]-e,$=k*k+F*F,$<Z&&(Z=$,L=p));if(L){var it=[o,e],et=[o,u],U=[r,u],wt=[r,e];L.halfedges.push(ai.push(Xu(m=L.site,it,et))-1,ai.push(Xu(m,et,U))-1,ai.push(Xu(m,U,wt))-1,ai.push(Xu(m,wt,it))-1)}}for(h=0;h<l;++h)(p=Zi[h])&&(p.halfedges.length||delete Zi[h])}var f1=[],Tf;function u2(){Wu(this),this.x=this.y=this.arc=this.site=this.cy=null}function nu(o){var e=o.P,r=o.N;if(!(!e||!r)){var u=e.site,l=o.site,h=r.site;if(u!==h){var p=l[0],m=l[1],y=u[0]-p,x=u[1]-m,E=h[0]-p,b=h[1]-m,M=2*(y*b-x*E);if(!(M>=-h1)){var C=y*y+x*x,D=E*E+b*b,G=(b*C-x*D)/M,O=(y*D-E*C)/M,L=f1.pop()||new u2;L.arc=o,L.site=l,L.x=G+p,L.y=(L.cy=O+m)+Math.sqrt(G*G+O*O),o.circle=L;for(var k=null,F=Yu._;F;)if(L.y<F.y||L.y===F.y&&L.x<=F.x)if(F.L)F=F.L;else{k=F.P;break}else if(F.R)F=F.R;else{k=F;break}Yu.insert(k,L),k||(Tf=L)}}}}function ru(o){var e=o.circle;e&&(e.P||(Tf=e.N),Yu.remove(e),f1.push(e),Wu(e),o.circle=null)}var d1=[];function l2(){Wu(this),this.edge=this.site=this.circle=null}function p1(o){var e=d1.pop()||new l2;return e.site=o,e}function Od(o){ru(o),iu.remove(o),d1.push(o),Wu(o)}function g1(o){var e=o.circle,r=e.x,u=e.cy,l=[r,u],h=o.P,p=o.N,m=[o];Od(o);for(var y=h;y.circle&&Math.abs(r-y.circle.x)<On&&Math.abs(u-y.circle.cy)<On;)h=y.P,m.unshift(y),Od(y),y=h;m.unshift(y),ru(y);for(var x=p;x.circle&&Math.abs(r-x.circle.x)<On&&Math.abs(u-x.circle.cy)<On;)p=x.N,m.push(x),Od(x),x=p;m.push(x),ru(x);var E=m.length,b;for(b=1;b<E;++b)x=m[b],y=m[b-1],Hl(x.edge,y.site,x.site,l);y=m[0],x=m[E-1],x.edge=qu(y.site,x.site,null,l),nu(y),nu(x)}function m1(o){for(var e=o[0],r=o[1],u,l,h,p,m=iu._;m;)if(h=y1(m,r)-e,h>On)m=m.L;else if(p=e-c2(m,r),p>On){if(!m.R){u=m;break}m=m.R}else{h>-On?(u=m.P,l=m):p>-On?(u=m,l=m.N):u=l=m;break}u1(o);var y=p1(o);if(iu.insert(u,y),!(!u&&!l)){if(u===l){ru(u),l=p1(u.site),iu.insert(y,l),y.edge=l.edge=qu(u.site,y.site),nu(u),nu(l);return}if(!l){y.edge=qu(u.site,y.site);return}ru(u),ru(l);var x=u.site,E=x[0],b=x[1],M=o[0]-E,C=o[1]-b,D=l.site,G=D[0]-E,O=D[1]-b,L=2*(M*O-C*G),k=M*M+C*C,F=G*G+O*O,$=[(O*k-C*F)/L+E,(M*F-G*k)/L+b];Hl(l.edge,x,D,$),y.edge=qu(x,o,null,$),l.edge=qu(o,D,null,$),nu(u),nu(l)}}function y1(o,e){var r=o.site,u=r[0],l=r[1],h=l-e;if(!h)return u;var p=o.P;if(!p)return-1/0;r=p.site;var m=r[0],y=r[1],x=y-e;if(!x)return m;var E=m-u,b=1/h-1/x,M=E/x;return b?(-M+Math.sqrt(M*M-2*b*(E*E/(-2*x)-y+x/2+l-h/2)))/b+u:(u+m)/2}function c2(o,e){var r=o.N;if(r)return y1(r,e);var u=o.site;return u[1]===e?u[0]:1/0}var On=1e-6,h1=1e-12,iu,Zi,Yu,ai;function f2(o,e,r){return(o[0]-r[0])*(e[1]-o[1])-(o[0]-e[0])*(r[1]-o[1])}function h2(o,e){return e[1]-o[1]||e[0]-o[0]}function Cf(o,e){var r=o.sort(h2).pop(),u,l,h;for(ai=[],Zi=new Array(o.length),iu=new Nd,Yu=new Nd;;)if(h=Tf,r&&(!h||r[1]<h.y||r[1]===h.y&&r[0]<h.x))(r[0]!==u||r[1]!==l)&&(m1(r),u=r[0],l=r[1]),r=o.pop();else if(h)g1(h.arc);else break;if(l1(),e){var p=+e[0][0],m=+e[0][1],y=+e[1][0],x=+e[1][1];a1(p,m,y,x),c1(p,m,y,x)}this.edges=ai,this.cells=Zi,iu=Yu=ai=Zi=null}Cf.prototype={constructor:Cf,polygons:function(){var o=this.edges;return this.cells.map(function(e){var r=e.halfedges.map(function(u){return Dd(e,o[u])});return r.data=e.site.data,r})},triangles:function(){var o=[],e=this.edges;return this.cells.forEach(function(r,u){if(m=(h=r.halfedges).length)for(var l=r.site,h,p=-1,m,y,x=e[h[m-1]],E=x.left===l?x.right:x.left;++p<m;)y=E,x=e[h[p]],E=x.left===l?x.right:x.left,y&&E&&u<y.index&&u<E.index&&f2(l,y,E)<0&&o.push([l.data,y.data,E.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 u=this,l,h=u._found||0,p=u.cells.length,m;!(m=u.cells[h]);)if(++h>=p)return null;var y=o-m.site[0],x=e-m.site[1],E=y*y+x*x;do m=u.cells[l=h],h=null,m.halfedges.forEach(function(b){var M=u.edges[b],C=M.left;if(!((C===m.site||!C)&&!(C=M.right))){var D=o-C[0],G=e-C[1],O=D*D+G*G;O<E&&(E=O,h=C.index)}});while(h!==null);return u._found=l,r==null||E<=r*r?m.site:null}};var x2=nr($u(),1);var Jd=nr(E1(),1);function xo(){return new Rf}function Rf(){this.reset()}Rf.prototype={constructor:Rf,reset:function(){this.s=this.t=0},add:function(o){w1(Pf,o,this.t),w1(this,Pf.s,this.s),this.s?this.t+=Pf.t:this.s=Pf.t},valueOf:function(){return this.s}};var Pf=new Rf;function w1(o,e,r){var u=o.s=e+r,l=u-e,h=u-l;o.t=e-h+(r-l)}var dn=1e-6;var Pn=Math.PI,Wr=Pn/2,Lf=Pn/4,Ns=Pn*2,ou=180/Pn,Eo=Pn/180,_r=Math.abs,hs=Math.atan,wo=Math.atan2,rn=Math.cos;var Nf=Math.exp;var Vl=Math.log;var pe=Math.sin;var Ei=Math.sqrt,Wl=Math.tan;function Bd(o){return o>1?0:o<-1?Pn:Math.acos(o)}function Ji(o){return o>1?Wr:o<-1?-Wr:Math.asin(o)}function ps(){}var E2=xo(),g6=xo();function su(o){var e=o[0],r=o[1],u=rn(r);return[u*rn(e),u*pe(e),pe(r)]}function ql(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 Xl(o){var e=Ei(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]);o[0]/=e,o[1]/=e,o[2]/=e}var b6=xo();function S1(o,e){return[o>Pn?o-Ns:o<-Pn?o+Ns:o,e]}S1.invert=S1;function zd(){var o=[],e;return{point:function(r,u){e.push([r,u])},lineStart:function(){o.push(e=[])},lineEnd:ps,rejoin:function(){o.length>1&&o.push(o.pop().concat(o.shift()))},result:function(){var r=o;return o=[],e=null,r}}}function kd(o,e){return _r(o[0]-e[0])<dn&&_r(o[1]-e[1])<dn}function Df(o,e,r,u){this.x=o,this.z=e,this.o=r,this.e=u,this.v=!1,this.n=this.p=null}function Gd(o,e,r,u,l){var h=[],p=[],m,y;if(o.forEach(function(D){if(!((G=D.length-1)<=0)){var G,O=D[0],L=D[G],k;if(kd(O,L)){for(l.lineStart(),m=0;m<G;++m)l.point((O=D[m])[0],O[1]);l.lineEnd();return}h.push(k=new Df(O,D,null,!0)),p.push(k.o=new Df(O,null,k,!1)),h.push(k=new Df(L,D,null,!1)),p.push(k.o=new Df(L,null,k,!0))}}),!!h.length){for(p.sort(e),b1(h),b1(p),m=0,y=p.length;m<y;++m)p[m].e=r=!r;for(var x=h[0],E,b;;){for(var M=x,C=!0;M.v;)if((M=M.n)===x)return;E=M.z,l.lineStart();do{if(M.v=M.o.v=!0,M.e){if(C)for(m=0,y=E.length;m<y;++m)l.point((b=E[m])[0],b[1]);else u(M.x,M.n.x,1,l);M=M.n}else{if(C)for(E=M.p.z,m=E.length-1;m>=0;--m)l.point((b=E[m])[0],b[1]);else u(M.x,M.p.x,-1,l);M=M.p}M=M.o,E=M.z,C=!C}while(!M.v);l.lineEnd()}}}function b1(o){if(e=o.length){for(var e,r=0,u=o[0],l;++r<e;)u.n=l=o[r],l.p=u,u=l;u.n=l=o[0],l.p=u}}function Ca(o,e){return o<e?-1:o>e?1:o>=e?0:NaN}function Hd(o){return o.length===1&&(o=S2(o)),{left:function(e,r,u,l){for(u==null&&(u=0),l==null&&(l=e.length);u<l;){var h=u+l>>>1;o(e[h],r)<0?u=h+1:l=h}return u},right:function(e,r,u,l){for(u==null&&(u=0),l==null&&(l=e.length);u<l;){var h=u+l>>>1;o(e[h],r)>0?l=h:u=h+1}return u}}}function S2(o){return function(e,r){return Ca(o(e),r)}}var A1=Hd(Ca),b2=A1.right,A2=A1.left;var T1=Array.prototype,C2=T1.slice,I2=T1.map;var yH=Math.sqrt(50),vH=Math.sqrt(10),_H=Math.sqrt(2);function Ff(o){for(var e=o.length,r,u=-1,l=0,h,p;++u<e;)l+=o[u].length;for(h=new Array(l);--e>=0;)for(p=o[e],r=p.length;--r>=0;)h[--l]=p[r];return h}var U2=1e9,n8=-U2;var Vd=xo();function Wd(o,e){var r=e[0],u=e[1],l=[pe(r),-rn(r),0],h=0,p=0;Vd.reset();for(var m=0,y=o.length;m<y;++m)if(E=(x=o[m]).length)for(var x,E,b=x[E-1],M=b[0],C=b[1]/2+Lf,D=pe(C),G=rn(C),O=0;O<E;++O,M=k,D=$,G=Z,b=L){var L=x[O],k=L[0],F=L[1]/2+Lf,$=pe(F),Z=rn(F),it=k-M,et=it>=0?1:-1,U=et*it,wt=U>Pn,Lt=D*$;if(Vd.add(wo(Lt*et*pe(U),G*Z+Lt*rn(U))),h+=wt?it+et*Ns:it,wt^M>=r^k>=r){var Ot=ql(su(b),su(L));Xl(Ot);var W=ql(l,Ot);Xl(W);var de=(wt^it>=0?-1:1)*Ji(W[2]);(u>de||u===de&&(Ot[0]||Ot[1]))&&(p+=wt^it>=0?1:-1)}}return(h<-dn||h<dn&&Vd<-dn)^p&1}var h8=xo();var R8=xo(),L8=xo();var k2=1/0;var O8=-k2;function qd(o){this._context=o}qd.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,Ns);break}}},result:ps};var q8=xo();function Xd(){this._string=[]}Xd.prototype={_radius:4.5,_circle:P1(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=P1(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 P1(o){return"m0,"+o+"a"+o+","+o+" 0 1,1 0,"+-2*o+"a"+o+","+o+" 0 1,1 0,"+2*o+"z"}function Yd(o,e,r,u){return function(l,h){var p=e(h),m=l.invert(u[0],u[1]),y=zd(),x=e(y),E=!1,b,M,C,D={point:G,lineStart:L,lineEnd:k,polygonStart:function(){D.point=F,D.lineStart=$,D.lineEnd=Z,M=[],b=[]},polygonEnd:function(){D.point=G,D.lineStart=L,D.lineEnd=k,M=Ff(M);var it=Wd(b,m);M.length?(E||(h.polygonStart(),E=!0),Gd(M,V2,it,r,h)):it&&(E||(h.polygonStart(),E=!0),h.lineStart(),r(null,null,1,h),h.lineEnd()),E&&(h.polygonEnd(),E=!1),M=b=null},sphere:function(){h.polygonStart(),h.lineStart(),r(null,null,1,h),h.lineEnd(),h.polygonEnd()}};function G(it,et){var U=l(it,et);o(it=U[0],et=U[1])&&h.point(it,et)}function O(it,et){var U=l(it,et);p.point(U[0],U[1])}function L(){D.point=O,p.lineStart()}function k(){D.point=G,p.lineEnd()}function F(it,et){C.push([it,et]);var U=l(it,et);x.point(U[0],U[1])}function $(){x.lineStart(),C=[]}function Z(){F(C[0][0],C[0][1]),x.lineEnd();var it=x.clean(),et=y.result(),U,wt=et.length,Lt,Ot,W;if(C.pop(),b.push(C),C=null,!!wt){if(it&1){if(Ot=et[0],(Lt=Ot.length-1)>0){for(E||(h.polygonStart(),E=!0),h.lineStart(),U=0;U<Lt;++U)h.point((W=Ot[U])[0],W[1]);h.lineEnd()}return}wt>1&&it&2&&et.push(et.pop().concat(et.shift())),M.push(et.filter(H2))}}return D}}function H2(o){return o.length>1}function V2(o,e){return((o=o.x)[0]<0?o[1]-Wr-dn:Wr-o[1])-((e=e.x)[0]<0?e[1]-Wr-dn:Wr-e[1])}var W2=Yd(function(){return!0},q2,Y2,[-Pn,-Wr]);function q2(o){var e=NaN,r=NaN,u=NaN,l;return{lineStart:function(){o.lineStart(),l=1},point:function(h,p){var m=h>0?Pn:-Pn,y=_r(h-e);_r(y-Pn)<dn?(o.point(e,r=(r+p)/2>0?Wr:-Wr),o.point(u,r),o.lineEnd(),o.lineStart(),o.point(m,r),o.point(h,r),l=0):u!==m&&y>=Pn&&(_r(e-u)<dn&&(e-=u*dn),_r(h-m)<dn&&(h-=m*dn),r=X2(e,r,h,p),o.point(u,r),o.lineEnd(),o.lineStart(),o.point(m,r),l=0),o.point(e=h,r=p),u=m},lineEnd:function(){o.lineEnd(),e=r=NaN},clean:function(){return 2-l}}}function X2(o,e,r,u){var l,h,p=pe(o-r);return _r(p)>dn?hs((pe(e)*(h=rn(u))*pe(r)-pe(u)*(l=rn(e))*pe(o))/(l*h*p)):(e+u)/2}function Y2(o,e,r,u){var l;if(o==null)l=r*Wr,u.point(-Pn,l),u.point(0,l),u.point(Pn,l),u.point(Pn,0),u.point(Pn,-l),u.point(0,-l),u.point(-Pn,-l),u.point(-Pn,0),u.point(-Pn,l);else if(_r(o[0]-e[0])>dn){var h=o[0]<e[0]?Pn:-Pn;l=r*h/2,u.point(-h,l),u.point(0,l),u.point(h,l)}else u.point(e[0],e[1])}function Uf(o){return function(e){var r=new $d;for(var u in o)r[u]=o[u];return r.stream=e,r}}function $d(){}$d.prototype={constructor:$d,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 LW=rn(30*Eo);var XW=Uf({point:function(o,e){this.stream.point(o*Eo,e*Eo)}});function Bf(o){return function(e,r){var u=rn(e),l=rn(r),h=o(u*l);return[h*l*pe(e),h*pe(r)]}}function Ds(o){return function(e,r){var u=Ei(e*e+r*r),l=o(u),h=pe(l),p=rn(l);return[wo(e*h,u*p),Ji(u&&r*h/u)]}}var U1=Bf(function(o){return Ei(2/(1+o))});U1.invert=Ds(function(o){return 2*Ji(o/2)});var B1=Bf(function(o){return(o=Bd(o))&&o/pe(o)});B1.invert=Ds(function(o){return o});function Zd(o,e){return[o,Vl(Wl((Wr+e)/2))]}Zd.invert=function(o,e){return[o,2*hs(Nf(e))-Wr]};function zf(o,e){return[o,e]}zf.invert=zf;function z1(o,e){var r=rn(e),u=rn(o)*r;return[r*pe(o)/u,pe(e)/u]}z1.invert=Ds(hs);function k1(o,e){var r=e*e,u=r*r;return[o*(.8707-.131979*r+u*(-.013791+u*(.003971*r-.001529*u))),e*(1.007226+r*(.015085+u*(-.044475+.028874*r-.005916*u)))]}k1.invert=function(o,e){var r=e,u=25,l;do{var h=r*r,p=h*h;r-=l=(r*(1.007226+h*(.015085+p*(-.044475+.028874*h-.005916*p)))-e)/(1.007226+h*(.015085*3+p*(-.044475*7+.028874*9*h-.005916*11*p)))}while(_r(l)>dn&&--u>0);return[o/(.8707+(h=r*r)*(-.131979+h*(-.013791+h*h*h*(.003971-.001529*h)))),r]};function G1(o,e){return[rn(e)*pe(o),pe(e)]}G1.invert=Ds(Ji);function H1(o,e){var r=rn(e),u=1+rn(o)*r;return[r*pe(o)/u,pe(e)/u]}H1.invert=Ds(function(o){return 2*hs(o)});function V1(o,e){return[Vl(Wl((Wr+e)/2)),-o]}V1.invert=function(o,e){return[-e,2*hs(Nf(o))-Wr]};var j2=nr($u(),1);var tN=nr($u(),1);var nN=nr($u(),1);var rN=nr($u(),1);function Pa(o,e){return Math.sqrt((e[0]-o[0])**2+(e[1]-o[1])**2)}function q1(o){let e=0;for(let r=0;r<o.length-1;r++)e+=Pa(o[r],o[r+1]);return e}function X1(o,e,r){let u=new Xi(e[0]-o[0],e[1]-o[1]),l=new Xi(e[0]-r[0],e[1]-r[1]),p=u.angleTo(l)*180/Math.PI,m=new Xi(e[0]-o[0],e[1]-o[1]);return new Xi(r[0]-o[0],r[1]-o[1]).cross(m)>0?p:-p}var Ra=nr(Y1(),1),wn="___",kf=class{constructor(e=3){this.lift_priority=e}roadInfo=[];facilities=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;rampMap=new Map;staircaseMap=new Map;connectionPointMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new Li.default;escalatorRoute=new Li.default;straightLadderRoute=new Li.default;forwardLineMap=new Map;forwardRoute=new Li.default;isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(e)}initFacilities(e){this.facilities=e.map(r=>{let u=[];try{u=JSON.parse(r.entry_end_floor)}catch{u=[]}let l=[];try{l=JSON.parse(r.entry_start_floor)}catch{l=[]}return{...r,entry_start_floor:l,entry_end_floor:u}})}initRoute(e,r){this.clear(),this.roadInfo=e,this.initFacilities(r);let u=new Date,l=u.getHours()*60+u.getMinutes();e.length&&(e.forEach(h=>{(h.points||[]).filter(p=>p.openStatus!==!1).filter(p=>{if(!p.startTime||!p.endTime)return!0;let[m,y]=p.startTime.split(":").map(C=>+C),[x,E]=p.endTime.split(":").map(C=>+C),b=m*60+y,M=x*60+E;return l>=b&&l<=M}).forEach(p=>{p.floor=h.floor;let m=`${h.floor}${wn}${p.id}`;if(this.nodeMap.set(`${h.floor}${wn}${p.nodeId}`,`${h.floor}${wn}${p.relatedId||p.id}`),this.pointMap.set(m,p),this.isFacilityByType(p.type)){let y=this.facilities.find(x=>x.id===+p.targetId);if(y){switch(y.entry_infra_type){case"straightLadder":if(y.entry_end_floor.find(M=>M.floor===h.floor)&&y.entry_start_floor.find(M=>M.floor===h.floor)){let M=this.straightLadderMap.get(p.targetId)||[];M.push({...p}),this.straightLadderMap.set(p.targetId,M)}break;case"staircase":if(y.entry_end_floor.find(M=>M.floor===h.floor)&&y.entry_start_floor.find(M=>M.floor===h.floor)){let M=this.staircaseMap.get(p.targetId)||[];M.push({...p}),this.staircaseMap.set(p.targetId,M)}break;case"escalator":let E=this.escalatorMap.get(p.targetId)||[];if(y.entry_start_floor.find(M=>M.floor===h.floor)){let M=E.find(C=>C.end?.floor!==h.floor&&!C.start);M?M.start=p:E.push({start:p})}if(y.entry_end_floor.find(M=>M.floor===h.floor)){let M=E.find(C=>C.start?.floor!==h.floor&&!C.end);M?M.end=p:E.push({end:p})}this.escalatorMap.set(p.targetId,E);break;case"ramp":let b=this.rampMap.get(p.targetId)||[];if(y.entry_start_floor.find(M=>M.floor===h.floor)){let M=b.find(C=>C.end?.floor!==h.floor&&!C.start);M?M.start=p:b.push({start:p})}if(y.entry_end_floor.find(M=>M.floor===h.floor)){let M=b.find(C=>C.start?.floor!==h.floor&&!C.end);M?M.end=p:b.push({end:p})}this.rampMap.set(p.targetId,b);break;case"connectionPoint":if(y.entry_end_floor.find(M=>M.floor===h.floor)&&y.entry_start_floor.find(M=>M.floor===h.floor)){let M=this.connectionPointMap.get(p.targetId)||[];M.push({...p}),this.connectionPointMap.set(p.targetId,M)}break}let x=this.facilityMap.get(p.targetId)||[];x.push({...p}),this.facilityMap.set(p.targetId,x)}}p.type==="parkingSpace"&&this.parkingMap.set(`${h.floor}${wn}${p.name}`,p)}),(h.lines||[]).filter(p=>p.direction!=="no").forEach(p=>{let m=`${h.floor}${wn}${p.from}`,y=`${h.floor}${wn}${p.to}`,x=this.pointMap.get(m),E=this.pointMap.get(y);if(!x||!E)return;let b=x.cds,M=E.cds,C=Pa(b,M);if(!x.permission&&!E.permission)switch(this.addLineItem(m,y,C),this.addLineItem(y,m,C),p.direction){case"double":this.addLineItem(m,y,C,this.forwardLineMap),this.addLineItem(y,m,C,this.forwardLineMap);break;case"single":this.addLineItem(m,y,C,this.forwardLineMap);break;case"back":this.addLineItem(y,m,C,this.forwardLineMap);break}else x.permission&&(this.setPermissionLine(m,y,x.permission,C,""),this.setPermissionLine(y,m,x.permission,C,"")),E.permission&&E.permission!==x.permission&&(this.setPermissionLine(m,y,E.permission,C,""),this.setPermissionLine(y,m,E.permission,C,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(e){return this[`permission_${e}`]||(this[`permission_${e}`]=new Set),this[`permission_${e}`]}setPermissionLine(e,r,u,l,h){this.getPermissionMap(u).add({fromKey:e,toKey:r,distance:l,type:h})}addPermissionFacility(){this.straightLadderMap.forEach((e,r)=>{if(e.length<2){this.straightLadderMap.delete(r);return}for(let u=0;u<e.length;u++){let l=`${e[u].floor}${wn}${e[u].id}`,h=this.pointMap.get(l);if(h){for(let p=0;p<e.length;p++)if(u!==p){let m=`${e[p].floor}${wn}${e[p].id}`,y=this.pointMap.get(m);if(!y)continue;h.permission&&this.setPermissionLine(l,m,h.permission,1,"straightLadder"),y.permission&&y.permission!==h.permission&&this.setPermissionLine(l,m,y.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((e,r)=>{if(e.length<2){this.staircaseMap.delete(r);return}for(let u=0;u<e.length;u++){let l=`${e[u].floor}${wn}${e[u].id}`,h=this.pointMap.get(l);if(h){for(let p=0;p<e.length;p++)if(u!==p){let m=`${e[p].floor}${wn}${e[p].id}`,y=this.pointMap.get(m);if(!y)continue;h.permission&&this.setPermissionLine(l,m,h.permission,1,"staircase"),y.permission&&y.permission!==h.permission&&this.setPermissionLine(l,m,y.permission,1,"staircase")}}}}),this.escalatorMap.forEach((e,r)=>{e.forEach(u=>{if(u.start&&u.end){let l=`${u.start.floor}${wn}${u.start.id}`,h=`${u.end.floor}${wn}${u.end.id}`,p=this.pointMap.get(l),m=this.pointMap.get(h);p&&m&&(p.permission&&this.setPermissionLine(l,h,p.permission,1,"escalator"),m.permission&&m.permission!==p.permission&&this.setPermissionLine(l,h,m.permission,1,"escalator"))}})}),this.rampMap.forEach((e,r)=>{e.forEach(u=>{if(u.start&&u.end){let l=`${u.start.floor}${wn}${u.start.id}`,h=`${u.end.floor}${wn}${u.end.id}`,p=this.pointMap.get(l),m=this.pointMap.get(h);p&&m&&(p.permission&&this.setPermissionLine(l,h,p.permission,10,"ramp"),m.permission&&m.permission!==p.permission&&this.setPermissionLine(l,h,m.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((e,r)=>{if(e.length<2){this.connectionPointMap.delete(r);return}for(let u=0;u<e.length;u++){let l=`${e[u].floor}${wn}${e[u].id}`,h=this.pointMap.get(l);if(h){for(let p=0;p<e.length;p++)if(u!==p){let m=`${e[p].floor}${wn}${e[p].id}`,y=this.pointMap.get(m);if(!y)continue;h.permission&&this.setPermissionLine(l,m,h.permission,1,"connectionPoint"),y.permission&&y.permission!==h.permission&&this.setPermissionLine(l,m,y.permission,1,"connectionPoint")}}}})}addPermissionLineToMap(e,r,u,l){let h=this.getPermissionMap(e);console.log(h),h.forEach(p=>{r.includes(p.type)&&(p.type===""?this.addLineItem(p.fromKey,p.toKey,p.distance,u):this.addLineItem(p.fromKey,p.toKey,l.get(p.type),u))})}addLineItem(e,r,u,l=this.lineMap){let h=l.get(e)||new Map;h.set(r,u),l.set(e,h)}addFacilityToLineMap(e,r,u,l){[...this.straightLadderMap,...this.staircaseMap].forEach(([h,p])=>{if(!(p.length<2))for(let m=0;m<p.length;m++){let y=`${p[m].floor}${wn}${p[m].id}`,x=this.pointMap.get(y);if(!(!x||x.permission)){for(let E=0;E<p.length;E++)if(m!==E){let b=`${p[E].floor}${wn}${p[E].id}`,M=this.pointMap.get(b);if(!M||M.permission)continue;if(p[m].type==="straightLadder"){let C=r;this.addLineItem(y,b,C,l)}else{let C=u;this.addLineItem(y,b,C,l)}}}}}),this.escalatorMap.forEach((h,p)=>{h.forEach(m=>{if(m.start&&m.end){let y=`${m.start.floor}${wn}${m.start.id}`,x=`${m.end.floor}${wn}${m.end.id}`,E=this.pointMap.get(y),b=this.pointMap.get(x);if(E&&b&&!E.permission&&!b.permission){let M=e;this.addLineItem(y,x,M,l)}}})}),this.connectionPointMap.forEach((h,p)=>{if(!(h.length<2))for(let m=0;m<h.length;m++){let y=`${h[m].floor}${wn}${h[m].id}`,x=this.pointMap.get(y);if(!(!x||x.permission)){for(let E=0;E<h.length;E++)if(m!==E){let b=`${h[E].floor}${wn}${h[E].id}`,M=this.pointMap.get(b);if(!M||M.permission)continue;this.addLineItem(y,b,100,l)}}}})}initBaseRoute(){let e=new Map((0,Ra.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,e),this.baseRoute=new Li.default(e)}initEscalatorRoute(){let e=new Map((0,Ra.cloneDeep)([...this.lineMap])),r=1e4;this.addFacilityToLineMap(1*r,this.lift_priority*r,3e4*r,e),this.escalatorRoute=new Li.default(e)}initStraightLadderRoute(){let e=new Map((0,Ra.cloneDeep)([...this.lineMap])),r=1e4;this.addFacilityToLineMap(3*r,1*r,3e4*r,e),this.straightLadderRoute=new Li.default(e)}initForwardRoute(){this.rampMap.forEach((e,r)=>{e.forEach(u=>{if(u.start&&u.end){let l=`${u.start.floor}${wn}${u.start.id}`,h=`${u.end.floor}${wn}${u.end.id}`,p=this.pointMap.get(l),m=this.pointMap.get(h);p&&m&&!p.permission&&!m.permission&&this.addLineItem(l,h,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((e,r)=>{if(!(e.length<2))for(let u=0;u<e.length;u++){let l=`${e[u].floor}${wn}${e[u].id}`,h=this.pointMap.get(l);if(!(!h||h.permission)){for(let p=0;p<e.length;p++)if(u!==p){let m=`${e[p].floor}${wn}${e[p].id}`,y=this.pointMap.get(m);if(!y||y.permission)continue;this.addLineItem(l,m,100,this.forwardLineMap)}}}}),this.forwardRoute=new Li.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let r=this.nodeMap.get(`${e.floor}${wn}${e.nodeId}`);if(r){let[u,l]=r.split(wn);return{floor:u,id:l}}}if(e.coord?.length){let r=this.roadInfo.find(l=>l.floor===e.floor);if(!r)return null;let u=r.points.reduce((l,h)=>{if(h.relatedId)return l;let p=Pa(e.coord,h.cds);return p<l.min&&(l.min=p,l.point=h),l},{min:1/0,point:r.points[0]});return{floor:r.floor,id:u.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let u=this.parkingMap.get(`${e.floor}${wn}${e.parkingSpace}`);if(u)return{floor:e.floor,id:u.id}}let r=this.transformStart(e);if(r)return r}return e.facility&&this.facilities.filter(l=>+l.type_id==+e.facility).map(l=>l.id).map(l=>this.facilityMap.get(`${l}`)).flat(2)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,r,u="",l){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(r))return"end-error";let h=this.transformStart(e);if(!h)return"no-start";let p=this.transformEnd(r);if(!p)return"no-end";let m=this.getBasePath.bind(this);switch(u){case"escalator":m=this.getEscalatorPath.bind(this);break;case"straightLadder":m=this.getStraightLadderPath.bind(this);break;case"forward":m=this.getForwardPath.bind(this);break;default:m=this.getBasePath.bind(this);break}if(p.id)return m(h,p,l);if(p.facility){let x=this.facilities.filter(b=>+b.type_id==+r.facility).map(b=>b.id).map(b=>this.facilityMap.get(`${b}`)).flat(2).filter(b=>b).filter(b=>p.floor?b.floor===p.floor:!0);if(!x.length)return null;let E=x.map(b=>m(h,{floor:b.floor,id:b.id},l)).filter(b=>!!b);return E.reduce((b,M)=>{let C=M[0].consume;return C<b.distance&&(b.distance=C,b.path=M),b},{distance:1/0,path:E[0]}).path}}getRoutePath(e,r,u){let l=`${e.floor}${wn}${e.id}`,h=`${r.floor}${wn}${r.id}`,p=u.path(l,h);if(!p)return null;let m=[],y=p.reduce((x,E,b,M)=>{if(b===0)return 0;let C=M[b-1],D=u.graph.get(C).get(E);return x+D},0);return p.map(x=>{let E=this.pointMap.get(x);if(E){let{floor:b}=E,M=E.type;if(this.isFacilityByType(E.type)){let C=this.facilities.find(D=>D.id===+E.targetId);C&&(M=C.entry_infra_type)}if(m[m.length-1]?.floor===b){let C=m[m.length-1];C.points.push(E.cds),C.endType=M,C.destId=E.nodeId,C.distance=q1(C.points)}else m.push({floor:b,points:[E.cds],endType:M,destId:E.nodeId,distance:0,consume:y})}}),m}getBasePath(e,r,u){if(!u)return this.getRoutePath(e,r,this.baseRoute);let l=(0,Ra.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(u,["","escalator","staircase","straightLadder","connectionPoint"],l,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let h=new Li.default(l);return this.getRoutePath(e,r,h)}getEscalatorPath(e,r,u){if(!u)return this.getRoutePath(e,r,this.escalatorRoute);let l=(0,Ra.cloneDeep)(this.escalatorRoute.graph),h=1e4;this.addPermissionLineToMap(u,["","escalator","staircase","straightLadder","connectionPoint"],l,new Map([["escalator",1*h],["connectionPoint",100],["straightLadder",this.lift_priority*h],["staircase",3e4*h]]));let p=new Li.default(l);return this.getRoutePath(e,r,p)}getStraightLadderPath(e,r,u){if(!u)return this.getRoutePath(e,r,this.straightLadderRoute);let l=(0,Ra.cloneDeep)(this.straightLadderRoute.graph),h=1e4;this.addPermissionLineToMap(u,["","escalator","staircase","straightLadder","connectionPoint"],l,new Map([["escalator",3*h],["connectionPoint",100],["straightLadder",1*h],["staircase",3e4*h]]));let p=new Li.default(l);return this.getRoutePath(e,r,p)}getForwardPath(e,r,u){if(!u)return this.getRoutePath(e,r,this.forwardRoute);let l=(0,Ra.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(u,["","ramp"],l,new Map([["ramp",10]]));let h=new Li.default(l);return this.getRoutePath(e,r,h)}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 Li.default,this.escalatorRoute=new Li.default,this.straightLadderRoute=new Li.default}};var hN=nr(Q1(),1);function pN(o,e,r){let u=X1(o,e,r);return 180-Math.abs(u)<15?"front":u>135?"right_front":u<-135?"left_front":u<=135&&u>=60?"right":u>=-135&&u<=-60?"left":u<60&&u>0?"right_back":u>-60&&u<0?"left_back":"front"}function j1(o){if(!o.length)return[];if(o.length===1)return[{direction:"start",distance:0,points:o}];let e=[{direction:"start",distance:Pa(o[0],o[1]),points:[o[0],o[1]]}];for(let r=2;r<o.length;r++){let u=pN(o[r-2],o[r-1],o[r]);if(u==="front"){let l=e[e.length-1],h=Pa(o[r-1],o[r]);l.distance+=h,r!==2&&l.points.push(o[r-1])}else e.push({direction:u,distance:Pa(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 tx(o){return o.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function ex(o){let e={};for(let u in o)u.startsWith("on")&&(e[tx(u.slice(2))]=o[u]);let r=async({data:u})=>{if(e[u.type])try{let l=await e[u.type](u.data);self.postMessage({type:`${u.type}_result`,key:u.key,data:l})}catch(l){self.postMessage({type:`${u.type}_result`,key:u.key,error:l})}else self.postMessage({type:`${u.type}_result`,key:u.key,error:"no_event"})};return self.addEventListener("message",r),()=>{self.removeEventListener("message",r)}}var Kd=new kf;ex({onSetRoadInfo({roadData:o,facilities:e}){Kd.initRoute(o,e)},onGetPath({start:o,end:e,type:r,permission:u}){return Kd.getPath(o,e,r,u)},onGetDirectionPath(o){return j1(o)},onClear(){Kd.clear()}});\n'], { type: "text/javascript" });
|
|
11632
11720
|
let url = URL.createObjectURL(blob);
|
|
11633
11721
|
let worker = new Worker(url);
|
|
11634
11722
|
URL.revokeObjectURL(url);
|
|
@@ -12126,13 +12214,11 @@ var Sensor = class extends EventDispatcher16 {
|
|
|
12126
12214
|
}
|
|
12127
12215
|
listenGps() {
|
|
12128
12216
|
this.gpsTimer = navigator.geolocation.watchPosition((position) => {
|
|
12129
|
-
|
|
12130
|
-
|
|
12131
|
-
|
|
12132
|
-
|
|
12133
|
-
|
|
12134
|
-
});
|
|
12135
|
-
}
|
|
12217
|
+
this.addDataItem({
|
|
12218
|
+
type: "gps" /* GPS */,
|
|
12219
|
+
timestamp: Date.now(),
|
|
12220
|
+
res: [position.coords.longitude, position.coords.latitude, position.coords.accuracy]
|
|
12221
|
+
});
|
|
12136
12222
|
});
|
|
12137
12223
|
}
|
|
12138
12224
|
async checkSensor() {
|
|
@@ -25158,7 +25244,7 @@ var AibeeLoader = class extends EventDispatcher19 {
|
|
|
25158
25244
|
return res.filter((item) => item.points);
|
|
25159
25245
|
}
|
|
25160
25246
|
async getFacilitiesData() {
|
|
25161
|
-
const floorInfo = this.floors[0];
|
|
25247
|
+
const floorInfo = this.floors.reduce((floor2, cur) => floor2.updated_at > cur.updated_at ? floor2 : cur, this.floors[0]);
|
|
25162
25248
|
if (!floorInfo) {
|
|
25163
25249
|
return null;
|
|
25164
25250
|
}
|