@maptiler/geocoding-control 2.0.0-rc.4 → 2.0.0-rc.5
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/MapLibreBasedGeocodingControl.d.ts +18 -1
- package/leaflet-controller.d.ts +2 -1
- package/leaflet-controller.js +222 -219
- package/leaflet-controller.js.map +1 -1
- package/leaflet-controller.umd.js +2 -2
- package/leaflet-controller.umd.js.map +1 -1
- package/leaflet.js +1012 -1021
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +3 -3
- package/leaflet.umd.js.map +1 -1
- package/maplibregl-controller.d.ts +2 -1
- package/maplibregl-controller.js +213 -210
- package/maplibregl-controller.js.map +1 -1
- package/maplibregl-controller.umd.js +3 -3
- package/maplibregl-controller.umd.js.map +1 -1
- package/maplibregl.d.ts +17 -0
- package/maplibregl.js +1452 -1459
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +3 -3
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.d.ts +17 -0
- package/maptilersdk.js +1454 -1461
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +3 -3
- package/maptilersdk.umd.js.map +1 -1
- package/openlayers-controller.d.ts +2 -1
- package/openlayers-controller.js +298 -295
- package/openlayers-controller.js.map +1 -1
- package/openlayers-controller.umd.js +3 -3
- package/openlayers-controller.umd.js.map +1 -1
- package/openlayers.js +1263 -1272
- package/openlayers.js.map +1 -1
- package/openlayers.umd.js +3 -3
- package/openlayers.umd.js.map +1 -1
- package/package.json +1 -1
- package/react.js +680 -695
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
- package/svelte/GeocodingControl.svelte +22 -47
- package/svelte/GeocodingControl.svelte.d.ts +0 -1
- package/svelte/MapLibreBasedGeocodingControl.d.ts +18 -1
- package/svelte/MapLibreBasedGeocodingControl.js +4 -0
- package/svelte/leaflet-controller.d.ts +2 -1
- package/svelte/leaflet-controller.js +6 -2
- package/svelte/leaflet.js +4 -0
- package/svelte/maplibregl-controller.d.ts +2 -1
- package/svelte/maplibregl-controller.js +6 -2
- package/svelte/maplibregl.d.ts +17 -0
- package/svelte/maptilersdk.d.ts +17 -0
- package/svelte/openlayers-controller.d.ts +2 -1
- package/svelte/openlayers-controller.js +6 -2
- package/svelte/openlayers.js +5 -2
- package/svelte/types.d.ts +1 -1
- package/types.d.ts +1 -1
- package/vanilla.js +610 -625
- package/vanilla.js.map +1 -1
- package/vanilla.umd.js +1 -1
- package/vanilla.umd.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(M,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("leaflet")):typeof define=="function"&&define.amd?define(["exports","leaflet"],L):(M=typeof globalThis<"u"?globalThis:M||self,L(M.leafletMaptilerGeocodingController={},M.L))})(this,function(M,L){"use strict";var fn=Object.defineProperty;var cn=(M,L,j)=>L in M?fn(M,L,{enumerable:!0,configurable:!0,writable:!0,value:j}):M[L]=j;var St=(M,L,j)=>cn(M,typeof L!="symbol"?L+"":L,j);function j(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>r[e]})}}return t.default=r,Object.freeze(t)}const Q=j(L);function V(r,t,e={}){const n={type:"Feature"};return(e.id===0||e.id)&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.properties=t||{},n.geometry=r,n}function lt(r,t,e={}){for(const i of r){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let o=0;o<i[i.length-1].length;o++)if(i[i.length-1][o]!==i[0][o])throw new Error("First and last Position are not equivalent.")}return V({type:"Polygon",coordinates:r},t,e)}function Z(r,t={}){const e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}function Pt(r,t,e={}){return V({type:"MultiPolygon",coordinates:r},t,e)}function Mt(r,t,e){if(r!==null)for(var n,i,o,f,s,c,u,p=0,l=0,h,a=r.type,
|
|
1
|
+
(function(M,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("leaflet")):typeof define=="function"&&define.amd?define(["exports","leaflet"],L):(M=typeof globalThis<"u"?globalThis:M||self,L(M.leafletMaptilerGeocodingController={},M.L))})(this,function(M,L){"use strict";var fn=Object.defineProperty;var cn=(M,L,j)=>L in M?fn(M,L,{enumerable:!0,configurable:!0,writable:!0,value:j}):M[L]=j;var St=(M,L,j)=>cn(M,typeof L!="symbol"?L+"":L,j);function j(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>r[e]})}}return t.default=r,Object.freeze(t)}const Q=j(L);function V(r,t,e={}){const n={type:"Feature"};return(e.id===0||e.id)&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.properties=t||{},n.geometry=r,n}function lt(r,t,e={}){for(const i of r){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let o=0;o<i[i.length-1].length;o++)if(i[i.length-1][o]!==i[0][o])throw new Error("First and last Position are not equivalent.")}return V({type:"Polygon",coordinates:r},t,e)}function Z(r,t={}){const e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}function Pt(r,t,e={}){return V({type:"MultiPolygon",coordinates:r},t,e)}function Mt(r,t,e){if(r!==null)for(var n,i,o,f,s,c,u,p=0,l=0,h,a=r.type,x=a==="FeatureCollection",g=a==="Feature",y=x?r.features.length:1,d=0;d<y;d++){u=x?r.features[d].geometry:g?r.geometry:r,h=u?u.type==="GeometryCollection":!1,s=h?u.geometries.length:1;for(var m=0;m<s;m++){var b=0,v=0;if(f=h?u.geometries[m]:u,f!==null){c=f.coordinates;var w=f.type;switch(p=0,w){case null:break;case"Point":if(t(c,l,d,b,v)===!1)return!1;l++,b++;break;case"LineString":case"MultiPoint":for(n=0;n<c.length;n++){if(t(c[n],l,d,b,v)===!1)return!1;l++,w==="MultiPoint"&&b++}w==="LineString"&&b++;break;case"Polygon":case"MultiLineString":for(n=0;n<c.length;n++){for(i=0;i<c[n].length-p;i++){if(t(c[n][i],l,d,b,v)===!1)return!1;l++}w==="MultiLineString"&&b++,w==="Polygon"&&v++}w==="Polygon"&&b++;break;case"MultiPolygon":for(n=0;n<c.length;n++){for(v=0,i=0;i<c[n].length;i++){for(o=0;o<c[n][i].length-p;o++){if(t(c[n][i][o],l,d,b,v)===!1)return!1;l++}v++}b++}break;case"GeometryCollection":for(n=0;n<f.geometries.length;n++)if(Mt(f.geometries[n],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ut(r,t){var e,n,i,o,f,s,c,u,p,l,h=0,a=r.type==="FeatureCollection",x=r.type==="Feature",g=a?r.features.length:1;for(e=0;e<g;e++){for(s=a?r.features[e].geometry:x?r.geometry:r,u=a?r.features[e].properties:x?r.properties:{},p=a?r.features[e].bbox:x?r.bbox:void 0,l=a?r.features[e].id:x?r.id:void 0,c=s?s.type==="GeometryCollection":!1,f=c?s.geometries.length:1,i=0;i<f;i++){if(o=c?s.geometries[i]:s,o===null){if(t(null,h,u,p,l)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,h,u,p,l)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<o.geometries.length;n++)if(t(o.geometries[n],h,u,p,l)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function ie(r,t){ut(r,function(e,n,i,o,f){var s=e===null?null:e.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return t(V(e,i,{bbox:o,id:f}),n,0)===!1?!1:void 0}var c;switch(s){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var u=0;u<e.coordinates.length;u++){var p=e.coordinates[u],l={type:c,coordinates:p};if(t(V(l,i),n,u)===!1)return!1}})}function oe(r,t={}){if(r.bbox!=null&&t.recompute!==!0)return r.bbox;const e=[1/0,1/0,-1/0,-1/0];return Mt(r,n=>{e[0]>n[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]<n[0]&&(e[2]=n[0]),e[3]<n[1]&&(e[3]=n[1])}),e}var ft=oe;function se(r){if(!r)throw new Error("geojson is required");switch(r.type){case"Feature":return Lt(r);case"FeatureCollection":return le(r);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return ct(r);default:throw new Error("unknown GeoJSON type")}}function Lt(r){const t={type:"Feature"};return Object.keys(r).forEach(e=>{switch(e){case"type":case"properties":case"geometry":return;default:t[e]=r[e]}}),t.properties=Ct(r.properties),r.geometry==null?t.geometry=null:t.geometry=ct(r.geometry),t}function Ct(r){const t={};return r&&Object.keys(r).forEach(e=>{const n=r[e];typeof n=="object"?n===null?t[e]=null:Array.isArray(n)?t[e]=n.map(i=>i):t[e]=Ct(n):t[e]=n}),t}function le(r){const t={type:"FeatureCollection"};return Object.keys(r).forEach(e=>{switch(e){case"type":case"features":return;default:t[e]=r[e]}}),t.features=r.features.map(e=>Lt(e)),t}function ct(r){const t={type:r.type};return r.bbox&&(t.bbox=r.bbox),r.type==="GeometryCollection"?(t.geometries=r.geometries.map(e=>ct(e)),t):(t.coordinates=Rt(r.coordinates),t)}function Rt(r){const t=r;return typeof t[0]!="object"?t.slice():t.map(e=>Rt(e))}var ue=se;/**
|
|
2
2
|
* splaytree v3.1.2
|
|
3
3
|
* Fast Splay tree for Node and browser
|
|
4
4
|
*
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
20
20
|
and limitations under the License.
|
|
21
21
|
***************************************************************************** */function fe(r,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,f;return f={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function s(u){return function(p){return c([u,p])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;e;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return e.label++,{value:u[1],done:!1};case 5:e.label++,i=u[1],u=[0];continue;case 7:u=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){e.label=u[1];break}if(u[0]===6&&e.label<o[1]){e.label=o[1],o=u;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(u);break}o[2]&&e.ops.pop(),e.trys.pop();continue}u=t.call(r,e)}catch(p){u=[6,p],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}var G=function(){function r(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null}return r}();function ce(r,t){return r>t?1:r<t?-1:0}function T(r,t,e){for(var n=new G(null,null),i=n,o=n;;){var f=e(r,t.key);if(f<0){if(t.left===null)break;if(e(r,t.left.key)<0){var s=t.left;if(t.left=s.right,s.right=t,t=s,t.left===null)break}o.left=t,o=t,t=t.left}else if(f>0){if(t.right===null)break;if(e(r,t.right.key)>0){var s=t.right;if(t.right=s.left,s.left=t,t=s,t.right===null)break}i.right=t,i=t,t=t.right}else break}return i.right=t.left,o.left=t.right,t.left=n.right,t.right=n.left,t}function ht(r,t,e,n){var i=new G(r,t);if(e===null)return i.left=i.right=null,i;e=T(r,e,n);var o=n(r,e.key);return o<0?(i.left=e.left,i.right=e,e.left=null):o>=0&&(i.right=e.right,i.left=e,e.right=null),i}function It(r,t,e){var n=null,i=null;if(t){t=T(r,t,e);var o=e(t.key,r);o===0?(n=t.left,i=t.right):o<0?(i=t.right,t.right=null,n=t):(n=t.left,t.left=null,i=t)}return{left:n,right:i}}function he(r,t,e){return t===null?r:(r===null||(t=T(r.key,t,e),t.left=r),t)}function at(r,t,e,n,i){if(r){n(""+t+(e?"└── ":"├── ")+i(r)+`
|
|
22
|
-
`);var o=t+(e?" ":"│ ");r.left&&at(r.left,o,!1,n,i),r.right&&at(r.right,o,!0,n,i)}}var pt=function(){function r(t){t===void 0&&(t=ce),this._root=null,this._size=0,this._comparator=t}return r.prototype.insert=function(t,e){return this._size++,this._root=ht(t,e,this._root,this._comparator)},r.prototype.add=function(t,e){var n=new G(t,e);this._root===null&&(n.left=n.right=null,this._size++,this._root=n);var i=this._comparator,o=T(t,this._root,i),f=i(t,o.key);return f===0?this._root=o:(f<0?(n.left=o.left,n.right=o,o.left=null):f>0&&(n.right=o.right,n.left=o,o.right=null),this._size++,this._root=n),this._root},r.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},r.prototype._remove=function(t,e,n){var i;if(e===null)return null;e=T(t,e,n);var o=n(t,e.key);return o===0?(e.left===null?i=e.right:(i=T(t,e.left,n),i.right=e.right),this._size--,i):e},r.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=T(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},r.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var i=n(t,e.key);if(i===0)return e;i<0?e=e.left:e=e.right}return null},r.prototype.find=function(t){return this._root&&(this._root=T(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},r.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var i=n(t,e.key);if(i===0)return!0;i<0?e=e.left:e=e.right}return!1},r.prototype.forEach=function(t,e){for(var n=this._root,i=[],o=!1;!o;)n!==null?(i.push(n),n=n.left):i.length!==0?(n=i.pop(),t.call(e,n),n=n.right):o=!0;return this},r.prototype.range=function(t,e,n,i){for(var o=[],f=this._comparator,s=this._root,c;o.length!==0||s;)if(s)o.push(s),s=s.left;else{if(s=o.pop(),c=f(s.key,e),c>0)break;if(f(s.key,t)>=0&&n.call(i,s))return this;s=s.right}return this},r.prototype.keys=function(){var t=[];return this.forEach(function(e){var n=e.key;return t.push(n)}),t},r.prototype.values=function(){var t=[];return this.forEach(function(e){var n=e.data;return t.push(n)}),t},r.prototype.min=function(){return this._root?this.minNode(this._root).key:null},r.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},r.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},r.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},r.prototype.at=function(t){for(var e=this._root,n=!1,i=0,o=[];!n;)if(e)o.push(e),e=e.left;else if(o.length>0){if(e=o.pop(),i===t)return e;i++,e=e.right}else n=!0;return null},r.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var i=this._comparator;e;){var o=i(t.key,e.key);if(o===0)break;o<0?(n=e,e=e.left):e=e.right}return n},r.prototype.prev=function(t){var e=this._root,n=null;if(t.left!==null){for(n=t.left;n.right;)n=n.right;return n}for(var i=this._comparator;e;){var o=i(t.key,e.key);if(o===0)break;o<0?e=e.left:(n=e,e=e.right)}return n},r.prototype.clear=function(){return this._root=null,this._size=0,this},r.prototype.toList=function(){return pe(this._root)},r.prototype.load=function(t,e,n){e===void 0&&(e=[]),n===void 0&&(n=!1);var i=t.length,o=this._comparator;if(n&&dt(t,e,0,i-1,o),this._root===null)this._root=gt(t,e,0,i),this._size=i;else{var f=ge(this.toList(),ae(t,e),o);i=this._size+i,this._root=yt({head:f},0,i)}return this},r.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(r.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),r.prototype.toString=function(t){t===void 0&&(t=function(n){return String(n.key)});var e=[];return at(this._root,"",!0,function(n){return e.push(n)},t),e.join("")},r.prototype.update=function(t,e,n){var i=this._comparator,o=It(t,this._root,i),f=o.left,s=o.right;i(t,e)<0?s=ht(e,n,s,i):f=ht(e,n,f,i),this._root=he(f,s,i)},r.prototype.split=function(t){return It(t,this._root,this._comparator)},r.prototype[Symbol.iterator]=function(){var t,e,n;return fe(this,function(i){switch(i.label){case 0:t=this._root,e=[],n=!1,i.label=1;case 1:return n?[3,6]:t===null?[3,2]:(e.push(t),t=t.left,[3,5]);case 2:return e.length===0?[3,4]:(t=e.pop(),[4,t]);case 3:return i.sent(),t=t.right,[3,5];case 4:n=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},r}();function gt(r,t,e,n){var i=n-e;if(i>0){var o=e+Math.floor(i/2),f=r[o],s=t[o],c=new G(f,s);return c.left=gt(r,t,e,o),c.right=gt(r,t,o+1,n),c}return null}function ae(r,t){for(var e=new G(null,null),n=e,i=0;i<r.length;i++)n=n.next=new G(r[i],t[i]);return n.next=null,e.next}function pe(r){for(var t=r,e=[],n=!1,i=new G(null,null),o=i;!n;)t?(e.push(t),t=t.left):e.length>0?(t=o=o.next=e.pop(),t=t.right):n=!0;return o.next=null,i.next}function yt(r,t,e){var n=e-t;if(n>0){var i=t+Math.floor(n/2),o=yt(r,t,i),f=r.head;return f.left=o,r.head=r.head.next,f.right=yt(r,i+1,e),f}return null}function ge(r,t,e){for(var n=new G(null,null),i=n,o=r,f=t;o!==null&&f!==null;)e(o.key,f.key)<0?(i.next=o,o=o.next):(i.next=f,f=f.next),i=i.next;return o!==null?i.next=o:f!==null&&(i.next=f),n.next}function dt(r,t,e,n,i){if(!(e>=n)){for(var o=r[e+n>>1],f=e-1,s=n+1;;){do f++;while(i(r[f],o)<0);do s--;while(i(r[s],o)>0);if(f>=s)break;var c=r[f];r[f]=r[s],r[s]=c,c=t[f],t[f]=t[s],t[s]=c}dt(r,t,e,s,i),dt(r,t,s+1,n,i)}}const N=11102230246251565e-32,E=134217729,ye=(3+8*N)*N;function xt(r,t,e,n,i){let o,f,s,c,u=t[0],p=n[0],l=0,h=0;p>u==p>-u?(o=u,u=t[++l]):(o=p,p=n[++h]);let a=0;if(l<r&&h<e)for(p>u==p>-u?(f=u+o,s=o-(f-u),u=t[++l]):(f=p+o,s=o-(f-p),p=n[++h]),o=f,s!==0&&(i[a++]=s);l<r&&h<e;)p>u==p>-u?(f=o+u,c=f-o,s=o-(f-c)+(u-c),u=t[++l]):(f=o+p,c=f-o,s=o-(f-c)+(p-c),p=n[++h]),o=f,s!==0&&(i[a++]=s);for(;l<r;)f=o+u,c=f-o,s=o-(f-c)+(u-c),u=t[++l],o=f,s!==0&&(i[a++]=s);for(;h<e;)f=o+p,c=f-o,s=o-(f-c)+(p-c),p=n[++h],o=f,s!==0&&(i[a++]=s);return(o!==0||a===0)&&(i[a++]=o),a}function de(r,t){let e=t[0];for(let n=1;n<r;n++)e+=t[n];return e}function J(r){return new Float64Array(r)}const xe=(3+16*N)*N,me=(2+12*N)*N,ve=(9+64*N)*N*N,U=J(4),$t=J(8),kt=J(12),Ot=J(16),P=J(4);function be(r,t,e,n,i,o,f){let s,c,u,p,l,h,a,y,g,x,d,v,m,b,w,_,R,S;const $=r-i,k=e-i,O=t-o,A=n-o;b=$*A,h=E*$,a=h-(h-$),y=$-a,h=E*A,g=h-(h-A),x=A-g,w=y*x-(b-a*g-y*g-a*x),_=O*k,h=E*O,a=h-(h-O),y=O-a,h=E*k,g=h-(h-k),x=k-g,R=y*x-(_-a*g-y*g-a*x),d=w-R,l=w-d,U[0]=w-(d+l)+(l-R),v=b+d,l=v-b,m=b-(v-l)+(d-l),d=m-_,l=m-d,U[1]=m-(d+l)+(l-_),S=v+d,l=S-v,U[2]=v-(S-l)+(d-l),U[3]=S;let B=de(4,U),et=me*f;if(B>=et||-B>=et||(l=r-$,s=r-($+l)+(l-i),l=e-k,u=e-(k+l)+(l-i),l=t-O,c=t-(O+l)+(l-o),l=n-A,p=n-(A+l)+(l-o),s===0&&c===0&&u===0&&p===0)||(et=ve*f+ye*Math.abs(B),B+=$*p+A*s-(O*u+k*c),B>=et||-B>=et))return B;b=s*A,h=E*s,a=h-(h-s),y=s-a,h=E*A,g=h-(h-A),x=A-g,w=y*x-(b-a*g-y*g-a*x),_=c*k,h=E*c,a=h-(h-c),y=c-a,h=E*k,g=h-(h-k),x=k-g,R=y*x-(_-a*g-y*g-a*x),d=w-R,l=w-d,P[0]=w-(d+l)+(l-R),v=b+d,l=v-b,m=b-(v-l)+(d-l),d=m-_,l=m-d,P[1]=m-(d+l)+(l-_),S=v+d,l=S-v,P[2]=v-(S-l)+(d-l),P[3]=S;const sn=xt(4,U,4,P,$t);b=$*p,h=E*$,a=h-(h-$),y=$-a,h=E*p,g=h-(h-p),x=p-g,w=y*x-(b-a*g-y*g-a*x),_=O*u,h=E*O,a=h-(h-O),y=O-a,h=E*u,g=h-(h-u),x=u-g,R=y*x-(_-a*g-y*g-a*x),d=w-R,l=w-d,P[0]=w-(d+l)+(l-R),v=b+d,l=v-b,m=b-(v-l)+(d-l),d=m-_,l=m-d,P[1]=m-(d+l)+(l-_),S=v+d,l=S-v,P[2]=v-(S-l)+(d-l),P[3]=S;const ln=xt(sn,$t,4,P,kt);b=s*p,h=E*s,a=h-(h-s),y=s-a,h=E*p,g=h-(h-p),x=p-g,w=y*x-(b-a*g-y*g-a*x),_=c*u,h=E*c,a=h-(h-c),y=c-a,h=E*u,g=h-(h-u),x=u-g,R=y*x-(_-a*g-y*g-a*x),d=w-R,l=w-d,P[0]=w-(d+l)+(l-R),v=b+d,l=v-b,m=b-(v-l)+(d-l),d=m-_,l=m-d,P[1]=m-(d+l)+(l-_),S=v+d,l=S-v,P[2]=v-(S-l)+(d-l),P[3]=S;const un=xt(ln,kt,4,P,Ot);return Ot[un-1]}function we(r,t,e,n,i,o){const f=(t-o)*(e-i),s=(r-i)*(n-o),c=f-s,u=Math.abs(f+s);return Math.abs(c)>=xe*u?c:-be(r,t,e,n,i,o,u)}const W=(r,t)=>r.ll.x<=t.x&&t.x<=r.ur.x&&r.ll.y<=t.y&&t.y<=r.ur.y,mt=(r,t)=>{if(t.ur.x<r.ll.x||r.ur.x<t.ll.x||t.ur.y<r.ll.y||r.ur.y<t.ll.y)return null;const e=r.ll.x<t.ll.x?t.ll.x:r.ll.x,n=r.ur.x<t.ur.x?r.ur.x:t.ur.x,i=r.ll.y<t.ll.y?t.ll.y:r.ll.y,o=r.ur.y<t.ur.y?r.ur.y:t.ur.y;return{ll:{x:e,y:i},ur:{x:n,y:o}}};let z=Number.EPSILON;z===void 0&&(z=Math.pow(2,-52));const Ee=z*z,At=(r,t)=>{if(-z<r&&r<z&&-z<t&&t<z)return 0;const e=r-t;return e*e<Ee*r*t?0:r<t?-1:1};class _e{constructor(){this.reset()}reset(){this.xRounder=new Nt,this.yRounder=new Nt}round(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}class Nt{constructor(){this.tree=new pt,this.round(0)}round(t){const e=this.tree.add(t),n=this.tree.prev(e);if(n!==null&&At(e.key,n.key)===0)return this.tree.remove(t),n.key;const i=this.tree.next(e);return i!==null&&At(e.key,i.key)===0?(this.tree.remove(t),i.key):t}}const K=new _e,nt=(r,t)=>r.x*t.y-r.y*t.x,Bt=(r,t)=>r.x*t.x+r.y*t.y,Gt=(r,t,e)=>{const n=we(r.x,r.y,t.x,t.y,e.x,e.y);return n>0?-1:n<0?1:0},rt=r=>Math.sqrt(Bt(r,r)),Se=(r,t,e)=>{const n={x:t.x-r.x,y:t.y-r.y},i={x:e.x-r.x,y:e.y-r.y};return nt(i,n)/rt(i)/rt(n)},Pe=(r,t,e)=>{const n={x:t.x-r.x,y:t.y-r.y},i={x:e.x-r.x,y:e.y-r.y};return Bt(i,n)/rt(i)/rt(n)},Tt=(r,t,e)=>t.y===0?null:{x:r.x+t.x/t.y*(e-r.y),y:e},zt=(r,t,e)=>t.x===0?null:{x:e,y:r.y+t.y/t.x*(e-r.x)},Me=(r,t,e,n)=>{if(t.x===0)return zt(e,n,r.x);if(n.x===0)return zt(r,t,e.x);if(t.y===0)return Tt(e,n,r.y);if(n.y===0)return Tt(r,t,e.y);const i=nt(t,n);if(i==0)return null;const o={x:e.x-r.x,y:e.y-r.y},f=nt(o,t)/i,s=nt(o,n)/i,c=r.x+s*t.x,u=e.x+f*n.x,p=r.y+s*t.y,l=e.y+f*n.y,h=(c+u)/2,a=(p+l)/2;return{x:h,y:a}};class C{static compare(t,e){const n=C.comparePoints(t.point,e.point);return n!==0?n:(t.point!==e.point&&t.link(e),t.isLeft!==e.isLeft?t.isLeft?1:-1:F.compare(t.segment,e.segment))}static comparePoints(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}constructor(t,e){t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=e}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const e=t.point.events;for(let n=0,i=e.length;n<i;n++){const o=e[n];this.point.events.push(o),o.point=this.point}this.checkForConsuming()}checkForConsuming(){const t=this.point.events.length;for(let e=0;e<t;e++){const n=this.point.events[e];if(n.segment.consumedBy===void 0)for(let i=e+1;i<t;i++){const o=this.point.events[i];o.consumedBy===void 0&&n.otherSE.point.events===o.otherSE.point.events&&n.segment.consume(o.segment)}}}getAvailableLinkedEvents(){const t=[];for(let e=0,n=this.point.events.length;e<n;e++){const i=this.point.events[e];i!==this&&!i.segment.ringOut&&i.segment.isInResult()&&t.push(i)}return t}getLeftmostComparator(t){const e=new Map,n=i=>{const o=i.otherSE;e.set(i,{sine:Se(this.point,t.point,o.point),cosine:Pe(this.point,t.point,o.point)})};return(i,o)=>{e.has(i)||n(i),e.has(o)||n(o);const{sine:f,cosine:s}=e.get(i),{sine:c,cosine:u}=e.get(o);return f>=0&&c>=0?s<u?1:s>u?-1:0:f<0&&c<0?s<u?-1:s>u?1:0:c<f?-1:c>f?1:0}}}let Le=0;class F{static compare(t,e){const n=t.leftSE.point.x,i=e.leftSE.point.x,o=t.rightSE.point.x,f=e.rightSE.point.x;if(f<n)return 1;if(o<i)return-1;const s=t.leftSE.point.y,c=e.leftSE.point.y,u=t.rightSE.point.y,p=e.rightSE.point.y;if(n<i){if(c<s&&c<u)return 1;if(c>s&&c>u)return-1;const l=t.comparePoint(e.leftSE.point);if(l<0)return 1;if(l>0)return-1;const h=e.comparePoint(t.rightSE.point);return h!==0?h:-1}if(n>i){if(s<c&&s<p)return-1;if(s>c&&s>p)return 1;const l=e.comparePoint(t.leftSE.point);if(l!==0)return l;const h=t.comparePoint(e.rightSE.point);return h<0?1:h>0?-1:1}if(s<c)return-1;if(s>c)return 1;if(o<f){const l=e.comparePoint(t.rightSE.point);if(l!==0)return l}if(o>f){const l=t.comparePoint(e.rightSE.point);if(l<0)return 1;if(l>0)return-1}if(o!==f){const l=u-s,h=o-n,a=p-c,y=f-i;if(l>h&&a<y)return 1;if(l<h&&a>y)return-1}return o>f?1:o<f||u<p?-1:u>p?1:t.id<e.id?-1:t.id>e.id?1:0}constructor(t,e,n,i){this.id=++Le,this.leftSE=t,t.segment=this,t.otherSE=e,this.rightSE=e,e.segment=this,e.otherSE=t,this.rings=n,this.windings=i}static fromRing(t,e,n){let i,o,f;const s=C.comparePoints(t,e);if(s<0)i=t,o=e,f=1;else if(s>0)i=e,o=t,f=-1;else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);const c=new C(i,!0),u=new C(o,!1);return new F(c,u,[n],[f])}replaceRightSE(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}comparePoint(t){if(this.isAnEndpoint(t))return 0;const e=this.leftSE.point,n=this.rightSE.point,i=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;const o=(t.y-e.y)/i.y,f=e.x+o*i.x;if(t.x===f)return 0;const s=(t.x-e.x)/i.x,c=e.y+s*i.y;return t.y===c?0:t.y<c?-1:1}getIntersection(t){const e=this.bbox(),n=t.bbox(),i=mt(e,n);if(i===null)return null;const o=this.leftSE.point,f=this.rightSE.point,s=t.leftSE.point,c=t.rightSE.point,u=W(e,s)&&this.comparePoint(s)===0,p=W(n,o)&&t.comparePoint(o)===0,l=W(e,c)&&this.comparePoint(c)===0,h=W(n,f)&&t.comparePoint(f)===0;if(p&&u)return h&&!l?f:!h&&l?c:null;if(p)return l&&o.x===c.x&&o.y===c.y?null:o;if(u)return h&&f.x===s.x&&f.y===s.y?null:s;if(h&&l)return null;if(h)return f;if(l)return c;const a=Me(o,this.vector(),s,t.vector());return a===null||!W(i,a)?null:K.round(a.x,a.y)}split(t){const e=[],n=t.events!==void 0,i=new C(t,!0),o=new C(t,!1),f=this.rightSE;this.replaceRightSE(o),e.push(o),e.push(i);const s=new F(i,f,this.rings.slice(),this.windings.slice());return C.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),C.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),e}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let e=0,n=this.windings.length;e<n;e++)this.windings[e]*=-1}consume(t){let e=this,n=t;for(;e.consumedBy;)e=e.consumedBy;for(;n.consumedBy;)n=n.consumedBy;const i=F.compare(e,n);if(i!==0){if(i>0){const o=e;e=n,n=o}if(e.prev===n){const o=e;e=n,n=o}for(let o=0,f=n.rings.length;o<f;o++){const s=n.rings[o],c=n.windings[o],u=e.rings.indexOf(s);u===-1?(e.rings.push(s),e.windings.push(c)):e.windings[u]+=c}n.rings=null,n.windings=null,n.consumedBy=e,n.leftSE.consumedBy=e.leftSE,n.rightSE.consumedBy=e.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};const e=this._afterState.rings,n=this._afterState.windings,i=this._afterState.multiPolys;for(let s=0,c=this.rings.length;s<c;s++){const u=this.rings[s],p=this.windings[s],l=e.indexOf(u);l===-1?(e.push(u),n.push(p)):n[l]+=p}const o=[],f=[];for(let s=0,c=e.length;s<c;s++){if(n[s]===0)continue;const u=e[s],p=u.poly;if(f.indexOf(p)===-1)if(u.isExterior)o.push(p);else{f.indexOf(p)===-1&&f.push(p);const l=o.indexOf(u.poly);l!==-1&&o.splice(l,1)}}for(let s=0,c=o.length;s<c;s++){const u=o[s].multiPoly;i.indexOf(u)===-1&&i.push(u)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(I.type){case"union":{const n=t.length===0,i=e.length===0;this._isInResult=n!==i;break}case"intersection":{let n,i;t.length<e.length?(n=t.length,i=e.length):(n=e.length,i=t.length),this._isInResult=i===I.numMultiPolys&&n<i;break}case"xor":{const n=Math.abs(t.length-e.length);this._isInResult=n%2===1;break}case"difference":{const n=i=>i.length===1&&i[0].isSubject;this._isInResult=n(t)!==n(e);break}default:throw new Error(`Unrecognized operation type found ${I.type}`)}return this._isInResult}}class Ft{constructor(t,e,n){if(!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=n,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const i=K.round(t[0][0],t[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};let o=i;for(let f=1,s=t.length;f<s;f++){if(typeof t[f][0]!="number"||typeof t[f][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let c=K.round(t[f][0],t[f][1]);c.x===o.x&&c.y===o.y||(this.segments.push(F.fromRing(o,c,this)),c.x<this.bbox.ll.x&&(this.bbox.ll.x=c.x),c.y<this.bbox.ll.y&&(this.bbox.ll.y=c.y),c.x>this.bbox.ur.x&&(this.bbox.ur.x=c.x),c.y>this.bbox.ur.y&&(this.bbox.ur.y=c.y),o=c)}(i.x!==o.x||i.y!==o.y)&&this.segments.push(F.fromRing(o,i,this))}getSweepEvents(){const t=[];for(let e=0,n=this.segments.length;e<n;e++){const i=this.segments[e];t.push(i.leftSE),t.push(i.rightSE)}return t}}class Ce{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Ft(t[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,i=t.length;n<i;n++){const o=new Ft(t[n],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=e}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let e=0,n=this.interiorRings.length;e<n;e++){const i=this.interiorRings[e].getSweepEvents();for(let o=0,f=i.length;o<f;o++)t.push(i[o])}return t}}class qt{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof t[0][0][0]=="number"&&(t=[t])}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,i=t.length;n<i;n++){const o=new Ce(t[n],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=e}getSweepEvents(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const i=this.polys[e].getSweepEvents();for(let o=0,f=i.length;o<f;o++)t.push(i[o])}return t}}class it{static factory(t){const e=[];for(let n=0,i=t.length;n<i;n++){const o=t[n];if(!o.isInResult()||o.ringOut)continue;let f=null,s=o.leftSE,c=o.rightSE;const u=[s],p=s.point,l=[];for(;f=s,s=c,u.push(s),s.point!==p;)for(;;){const h=s.getAvailableLinkedEvents();if(h.length===0){const g=u[0].point,x=u[u.length-1].point;throw new Error(`Unable to complete output ring starting at [${g.x}, ${g.y}]. Last matching segment found ends at [${x.x}, ${x.y}].`)}if(h.length===1){c=h[0].otherSE;break}let a=null;for(let g=0,x=l.length;g<x;g++)if(l[g].point===s.point){a=g;break}if(a!==null){const g=l.splice(a)[0],x=u.splice(g.index);x.unshift(x[0].otherSE),e.push(new it(x.reverse()));continue}l.push({index:u.length,point:s.point});const y=s.getLeftmostComparator(f);c=h.sort(y)[0].otherSE;break}e.push(new it(u))}return e}constructor(t){this.events=t;for(let e=0,n=t.length;e<n;e++)t[e].segment.ringOut=this;this.poly=null}getGeom(){let t=this.events[0].point;const e=[t];for(let u=1,p=this.events.length-1;u<p;u++){const l=this.events[u].point,h=this.events[u+1].point;Gt(l,t,h)!==0&&(e.push(l),t=l)}if(e.length===1)return null;const n=e[0],i=e[1];Gt(n,t,i)===0&&e.shift(),e.push(e[0]);const o=this.isExteriorRing()?1:-1,f=this.isExteriorRing()?0:e.length-1,s=this.isExteriorRing()?e.length:-1,c=[];for(let u=f;u!=s;u+=o)c.push([e[u].x,e[u].y]);return c}isExteriorRing(){if(this._isExteriorRing===void 0){const t=this.enclosingRing();this._isExteriorRing=t?!t.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let i=1,o=this.events.length;i<o;i++){const f=this.events[i];C.compare(t,f)>0&&(t=f)}let e=t.segment.prevInResult(),n=e?e.prevInResult():null;for(;;){if(!e)return null;if(!n)return e.ringOut;if(n.ringOut!==e.ringOut)return n.ringOut.enclosingRing()!==e.ringOut?e.ringOut:e.ringOut.enclosingRing();e=n.prevInResult(),n=e?e.prevInResult():null}}}class jt{constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(let e=0,n=this.interiorRings.length;e<n;e++){const i=this.interiorRings[e].getGeom();i!==null&&t.push(i)}return t}}class Re{constructor(t){this.rings=t,this.polys=this._composePolys(t)}getGeom(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const i=this.polys[e].getGeom();i!==null&&t.push(i)}return t}_composePolys(t){const e=[];for(let n=0,i=t.length;n<i;n++){const o=t[n];if(!o.poly)if(o.isExteriorRing())e.push(new jt(o));else{const f=o.enclosingRing();f.poly||e.push(new jt(f)),f.poly.addInterior(o)}}return e}}class Ie{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:F.compare;this.queue=t,this.tree=new pt(e),this.segments=[]}process(t){const e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;const i=t.isLeft?this.tree.add(e):this.tree.find(e);if(!i)throw new Error(`Unable to find segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] in SweepLine tree.`);let o=i,f=i,s,c;for(;s===void 0;)o=this.tree.prev(o),o===null?s=null:o.key.consumedBy===void 0&&(s=o.key);for(;c===void 0;)f=this.tree.next(f),f===null?c=null:f.key.consumedBy===void 0&&(c=f.key);if(t.isLeft){let u=null;if(s){const l=s.getIntersection(e);if(l!==null&&(e.isAnEndpoint(l)||(u=l),!s.isAnEndpoint(l))){const h=this._splitSafely(s,l);for(let a=0,y=h.length;a<y;a++)n.push(h[a])}}let p=null;if(c){const l=c.getIntersection(e);if(l!==null&&(e.isAnEndpoint(l)||(p=l),!c.isAnEndpoint(l))){const h=this._splitSafely(c,l);for(let a=0,y=h.length;a<y;a++)n.push(h[a])}}if(u!==null||p!==null){let l=null;u===null?l=p:p===null?l=u:l=C.comparePoints(u,p)<=0?u:p,this.queue.remove(e.rightSE),n.push(e.rightSE);const h=e.split(l);for(let a=0,y=h.length;a<y;a++)n.push(h[a])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&c){const u=s.getIntersection(c);if(u!==null){if(!s.isAnEndpoint(u)){const p=this._splitSafely(s,u);for(let l=0,h=p.length;l<h;l++)n.push(p[l])}if(!c.isAnEndpoint(u)){const p=this._splitSafely(c,u);for(let l=0,h=p.length;l<h;l++)n.push(p[l])}}}this.tree.remove(e)}return n}_splitSafely(t,e){this.tree.remove(t);const n=t.rightSE;this.queue.remove(n);const i=t.split(e);return i.push(n),t.consumedBy===void 0&&this.tree.add(t),i}}const Qt=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,$e=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class ke{run(t,e,n){I.type=t,K.reset();const i=[new qt(e,!0)];for(let l=0,h=n.length;l<h;l++)i.push(new qt(n[l],!1));if(I.numMultiPolys=i.length,I.type==="difference"){const l=i[0];let h=1;for(;h<i.length;)mt(i[h].bbox,l.bbox)!==null?h++:i.splice(h,1)}if(I.type==="intersection")for(let l=0,h=i.length;l<h;l++){const a=i[l];for(let y=l+1,g=i.length;y<g;y++)if(mt(a.bbox,i[y].bbox)===null)return[]}const o=new pt(C.compare);for(let l=0,h=i.length;l<h;l++){const a=i[l].getSweepEvents();for(let y=0,g=a.length;y<g;y++)if(o.insert(a[y]),o.size>Qt)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const f=new Ie(o);let s=o.size,c=o.pop();for(;c;){const l=c.key;if(o.size===s){const a=l.segment;throw new Error(`Unable to pop() ${l.isLeft?"left":"right"} SweepEvent [${l.point.x}, ${l.point.y}] from segment #${a.id} [${a.leftSE.point.x}, ${a.leftSE.point.y}] -> [${a.rightSE.point.x}, ${a.rightSE.point.y}] from queue.`)}if(o.size>Qt)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(f.segments.length>$e)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const h=f.process(l);for(let a=0,y=h.length;a<y;a++){const g=h[a];g.consumedBy===void 0&&o.insert(g)}s=o.size,c=o.pop()}K.reset();const u=it.factory(f.segments);return new Re(u).getGeom()}}const I=new ke;var Ut={union:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return I.run("union",r,e)},intersection:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return I.run("intersection",r,e)},xor:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return I.run("xor",r,e)},difference:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return I.run("difference",r,e)}};function Oe(r,t={}){const e=[];if(ut(r,i=>{e.push(i.coordinates)}),e.length<2)throw new Error("Must have at least 2 geometries");const n=Ut.union(e[0],...e.slice(1));return n.length===0?null:n.length===1?lt(n[0],t.properties):Pt(n,t.properties)}var Dt=Oe;function vt(r){const t=[...r];return t[2]<t[0]&&(Math.abs((t[0]+t[2]+360)/2)>Math.abs((t[0]-360+t[2])/2)?t[0]-=360:t[2]+=360),t}function H(){}function Yt(r){return r()}function Xt(){return Object.create(null)}function ot(r){r.forEach(Yt)}function Vt(r){return typeof r=="function"}function Ae(r,t){return r!=r?t==t:r!==t||r&&typeof r=="object"||typeof r=="function"}function Ne(r){return Object.keys(r).length===0}function Be(r,t){r.appendChild(t)}function Ge(r,t,e){r.insertBefore(t,e||null)}function Zt(r){r.parentNode&&r.parentNode.removeChild(r)}function Jt(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function q(r,t,e){e==null?r.removeAttribute(t):r.getAttribute(t)!==e&&r.setAttribute(t,e)}function Te(r){return Array.from(r.childNodes)}function st(r,t,e){r.classList.toggle(t,!!e)}let bt;function tt(r){bt=r}const D=[],Wt=[];let Y=[];const Kt=[],ze=Promise.resolve();let wt=!1;function Fe(){wt||(wt=!0,ze.then(Ht))}function Et(r){Y.push(r)}const _t=new Set;let X=0;function Ht(){if(X!==0)return;const r=bt;do{try{for(;X<D.length;){const t=D[X];X++,tt(t),qe(t.$$)}}catch(t){throw D.length=0,X=0,t}for(tt(null),D.length=0,X=0;Wt.length;)Wt.pop()();for(let t=0;t<Y.length;t+=1){const e=Y[t];_t.has(e)||(_t.add(e),e())}Y.length=0}while(D.length);for(;Kt.length;)Kt.pop()();wt=!1,_t.clear(),tt(r)}function qe(r){if(r.fragment!==null){r.update(),ot(r.before_update);const t=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,t),r.after_update.forEach(Et)}}function je(r){const t=[],e=[];Y.forEach(n=>r.indexOf(n)===-1?t.push(n):e.push(n)),e.forEach(n=>n()),Y=t}const Qe=new Set;function Ue(r,t){r&&r.i&&(Qe.delete(r),r.i(t))}function De(r,t,e){const{fragment:n,after_update:i}=r.$$;n&&n.m(t,e),Et(()=>{const o=r.$$.on_mount.map(Yt).filter(Vt);r.$$.on_destroy?r.$$.on_destroy.push(...o):ot(o),r.$$.on_mount=[]}),i.forEach(Et)}function Ye(r,t){const e=r.$$;e.fragment!==null&&(je(e.after_update),ot(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Xe(r,t){r.$$.dirty[0]===-1&&(D.push(r),Fe(),r.$$.dirty.fill(0)),r.$$.dirty[t/31|0]|=1<<t%31}function Ve(r,t,e,n,i,o,f=null,s=[-1]){const c=bt;tt(r);const u=r.$$={fragment:null,ctx:[],props:o,update:H,not_equal:i,bound:Xt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(c?c.$$.context:[])),callbacks:Xt(),dirty:s,skip_bound:!1,root:t.target||c.$$.root};f&&f(u.root);let p=!1;if(u.ctx=e?e(r,t.props||{},(l,h,...a)=>{const y=a.length?a[0]:h;return u.ctx&&i(u.ctx[l],u.ctx[l]=y)&&(!u.skip_bound&&u.bound[l]&&u.bound[l](y),p&&Xe(r,l)),h}):[],u.update(),p=!0,ot(u.before_update),u.fragment=n?n(u.ctx):!1,t.target){if(t.hydrate){const l=Te(t.target);u.fragment&&u.fragment.l(l),l.forEach(Zt)}else u.fragment&&u.fragment.c();t.intro&&Ue(r.$$.fragment),De(r,t.target,t.anchor),Ht()}tt(c)}class Ze{constructor(){St(this,"$$");St(this,"$$set")}$destroy(){Ye(this,1),this.$destroy=H}$on(t,e){if(!Vt(e))return H;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const i=n.indexOf(e);i!==-1&&n.splice(i,1)}}$set(t){this.$$set&&!Ne(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Je="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Je);function We(r){let t,e,n;return{c(){t=Jt("svg"),e=Jt("path"),q(e,"stroke-width","4"),q(e,"d","M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"),q(e,"class","svelte-gzo3ar"),q(t,"width",n=r[0]==="list"?20:void 0),q(t,"viewBox","0 0 70 85"),q(t,"fill","none"),q(t,"class","svelte-gzo3ar"),st(t,"in-map",r[0]!=="list"),st(t,"list-icon",r[0]==="list")},m(i,o){Ge(i,t,o),Be(t,e)},p(i,[o]){o&1&&n!==(n=i[0]==="list"?20:void 0)&&q(t,"width",n),o&1&&st(t,"in-map",i[0]!=="list"),o&1&&st(t,"list-icon",i[0]==="list")},i:H,o:H,d(i){i&&Zt(t)}}}function Ke(r,t,e){let{displayIn:n}=t;return r.$$set=i=>{"displayIn"in i&&e(0,n=i.displayIn)},[n]}class He extends Ze{constructor(t){super(),Ve(this,t,Ke,We,Ae,{displayIn:0})}}function tn(r){const t=[];if(ut(r,i=>{t.push(i.coordinates)}),t.length<2)throw new Error("Must have at least two features");const e=r.features[0].properties||{},n=Ut.difference(t[0],...t.slice(1));return n.length===0?null:n.length===1?lt(n[0],e):Pt(n,e)}var en=tn;function nn(r){if(!r)throw new Error("geojson is required");var t=[];return ie(r,function(e){t.push(e)}),Z(t)}var rn=nn;function te(r,t){const e=en(Z([lt([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),r]));if(!e)return;e.properties={isMask:!0};const n=vt(ft(r)),i=(n[2]-n[0])/360/1e3,o=n[0]<-180,f=n[2]>180,s=rn(r);if(s.features.length>1&&(o||f))for(const c of s.features){const u=vt(ft(c));if(f&&u[0]<-180+i)for(const p of c.geometry.coordinates)for(const l of p)l[0]+=360-i;if(o&&u[2]>180-i)for(const p of c.geometry.coordinates)for(const l of p)l[0]-=360-i}t(Z([s.features.length<2?r:Dt(s)??r,e]))}const ee=r=>{var n,i,o;const t=(n=r==null?void 0:r.geometry)==null?void 0:n.type,e=(i=r==null?void 0:r.properties)!=null&&i.isMask?0:t==="LineString"||t==="MultiLineString"?3:2;return{color:"#3170fe",fillColor:"#000",fillOpacity:(o=r==null?void 0:r.properties)!=null&&o.isMask?.1:0,weight:e,dashArray:[e,e],lineCap:"butt"}};function on(r,t=!0,e=!0,n={},i={},o=ee,f=!1){let s;const c=[];let u,p;const l=Q.geoJSON(void 0,{style:o===!0?ee:o===!1?void 0:o??void 0,interactive:!1}).addTo(r),h=y=>{s==null||s({type:"mapClick",coordinates:[y.latlng.lng,y.latlng.lat]})};function a(y,g=!1){const x=document.createElement("div");return new He({props:{displayIn:"leaflet"},target:x}),new Q.Marker(y,{interactive:g,icon:new Q.DivIcon({html:x,className:"",iconAnchor:[12,26],iconSize:[25,30],tooltipAnchor:[1,-24]})})}return{setEventHandler(y){y?(s=y,r.on("click",h)):(s=void 0,r.off("click",h))},flyTo(y,g){r.flyTo([y[1],y[0]],g,{duration:2,...n})},fitBounds(y,g,x){r.flyToBounds([[y[1],y[0]],[y[3],y[2]]],{padding:[g,g],duration:2,...x?{maxZoom:x}:{},...i})},indicateReverse(y){r.getContainer().style.cursor=y?"crosshair":""},setReverseMarker(y){var x;if(!t)return;const g=y&&[y[1],y[0]];p?g?p.setLatLng(g):(p.remove(),p=void 0):g&&(t instanceof Function?p=t(r)??void 0:(p=(typeof t=="object"?new Q.Marker(g,t):a(g)).addTo(r),(x=p.getElement())==null||x.classList.add("marker-reverse")))},setMarkers(y,g){function x(d){l.clearLayers(),d&&l.addData(d)}for(const d of c)d.remove();if(c.length=0,x(),g){let d=!1;if(g.geometry.type==="GeometryCollection"){const v=g.geometry.geometries.filter(m=>m.type==="Polygon"||m.type==="MultiPolygon");t:if(v.length>0){const m=Dt(Z(v.map(b=>V(b))));if(!m)break t;te({...g,geometry:m.geometry},x),d=!0}else{const m=g.geometry.geometries.filter(b=>b.type==="LineString"||b.type==="MultiLineString");m.length>0&&(x({...g,geometry:{type:"GeometryCollection",geometries:m}}),d=!0)}}if(!d){if(g.geometry.type==="Polygon"||g.geometry.type==="MultiPolygon")te(g,v=>{if(!v)return;const m=[...v.features],b=vt(ft(g)),w=b[2]-b[0];b[0]-w/4<-180&&m.push(...ne(v,-360).features),b[2]+w/4>180&&m.push(...ne(v,360).features),x(Z(m))});else if(g.geometry.type==="LineString"||g.geometry.type==="MultiLineString"){x(g);return}}if(!f&&g.geometry.type!=="Point")return;if(t instanceof Function){const v=t(r,g);v&&c.push(v.addTo(r))}else if(t){const v=[g.center[1],g.center[0]];c.push(typeof t=="object"?new Q.Marker(v,t):a(v).addTo(r))}}if(e)for(const d of y??[]){if(d===g)continue;const v=[d.center[1],d.center[0]];let m;if(e instanceof Function){if(m=e(r,d),!m)continue}else m=(typeof e=="object"?new Q.Marker(v,e):a(v,!0)).addTo(r).bindTooltip(d.place_type[0]==="reverse"?d.place_name:d.place_name.replace(/,.*/,""),{direction:"top"});const b=m.getElement();b&&(b.addEventListener("click",w=>{w.stopPropagation(),s==null||s({type:"markerClick",id:d.id})}),b.addEventListener("mouseenter",()=>{s==null||s({type:"markerMouseEnter",id:d.id})}),b.addEventListener("mouseleave",()=>{s==null||s({type:"markerMouseLeave",id:d.id})}),b.classList.toggle("marker-fuzzy",!!d.matching_text)),c.push(m)}},setSelectedMarker(y){var g,x;u&&((g=u.getElement())==null||g.classList.toggle("marker-selected",!1)),u=y>-1?c[y]:void 0,(x=u==null?void 0:u.getElement())==null||x.classList.toggle("marker-selected",!0)},getCenterAndZoom(){const y=r.getCenter();return[r.getZoom(),y.lng,y.lat]}}}function ne(r,t){const e=ue(r);for(const n of e.features)if(n.geometry.type=="MultiPolygon")for(const i of n.geometry.coordinates)re(i,t);else re(n.geometry.coordinates,t);return e}function re(r,t){for(const e of r)for(const n of e)n[0]+=t}M.createLeafletMapController=on,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})});
|
|
22
|
+
`);var o=t+(e?" ":"│ ");r.left&&at(r.left,o,!1,n,i),r.right&&at(r.right,o,!0,n,i)}}var pt=function(){function r(t){t===void 0&&(t=ce),this._root=null,this._size=0,this._comparator=t}return r.prototype.insert=function(t,e){return this._size++,this._root=ht(t,e,this._root,this._comparator)},r.prototype.add=function(t,e){var n=new G(t,e);this._root===null&&(n.left=n.right=null,this._size++,this._root=n);var i=this._comparator,o=T(t,this._root,i),f=i(t,o.key);return f===0?this._root=o:(f<0?(n.left=o.left,n.right=o,o.left=null):f>0&&(n.right=o.right,n.left=o,o.right=null),this._size++,this._root=n),this._root},r.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},r.prototype._remove=function(t,e,n){var i;if(e===null)return null;e=T(t,e,n);var o=n(t,e.key);return o===0?(e.left===null?i=e.right:(i=T(t,e.left,n),i.right=e.right),this._size--,i):e},r.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=T(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},r.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var i=n(t,e.key);if(i===0)return e;i<0?e=e.left:e=e.right}return null},r.prototype.find=function(t){return this._root&&(this._root=T(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},r.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var i=n(t,e.key);if(i===0)return!0;i<0?e=e.left:e=e.right}return!1},r.prototype.forEach=function(t,e){for(var n=this._root,i=[],o=!1;!o;)n!==null?(i.push(n),n=n.left):i.length!==0?(n=i.pop(),t.call(e,n),n=n.right):o=!0;return this},r.prototype.range=function(t,e,n,i){for(var o=[],f=this._comparator,s=this._root,c;o.length!==0||s;)if(s)o.push(s),s=s.left;else{if(s=o.pop(),c=f(s.key,e),c>0)break;if(f(s.key,t)>=0&&n.call(i,s))return this;s=s.right}return this},r.prototype.keys=function(){var t=[];return this.forEach(function(e){var n=e.key;return t.push(n)}),t},r.prototype.values=function(){var t=[];return this.forEach(function(e){var n=e.data;return t.push(n)}),t},r.prototype.min=function(){return this._root?this.minNode(this._root).key:null},r.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},r.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},r.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},r.prototype.at=function(t){for(var e=this._root,n=!1,i=0,o=[];!n;)if(e)o.push(e),e=e.left;else if(o.length>0){if(e=o.pop(),i===t)return e;i++,e=e.right}else n=!0;return null},r.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var i=this._comparator;e;){var o=i(t.key,e.key);if(o===0)break;o<0?(n=e,e=e.left):e=e.right}return n},r.prototype.prev=function(t){var e=this._root,n=null;if(t.left!==null){for(n=t.left;n.right;)n=n.right;return n}for(var i=this._comparator;e;){var o=i(t.key,e.key);if(o===0)break;o<0?e=e.left:(n=e,e=e.right)}return n},r.prototype.clear=function(){return this._root=null,this._size=0,this},r.prototype.toList=function(){return pe(this._root)},r.prototype.load=function(t,e,n){e===void 0&&(e=[]),n===void 0&&(n=!1);var i=t.length,o=this._comparator;if(n&&dt(t,e,0,i-1,o),this._root===null)this._root=gt(t,e,0,i),this._size=i;else{var f=ge(this.toList(),ae(t,e),o);i=this._size+i,this._root=yt({head:f},0,i)}return this},r.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(r.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),r.prototype.toString=function(t){t===void 0&&(t=function(n){return String(n.key)});var e=[];return at(this._root,"",!0,function(n){return e.push(n)},t),e.join("")},r.prototype.update=function(t,e,n){var i=this._comparator,o=It(t,this._root,i),f=o.left,s=o.right;i(t,e)<0?s=ht(e,n,s,i):f=ht(e,n,f,i),this._root=he(f,s,i)},r.prototype.split=function(t){return It(t,this._root,this._comparator)},r.prototype[Symbol.iterator]=function(){var t,e,n;return fe(this,function(i){switch(i.label){case 0:t=this._root,e=[],n=!1,i.label=1;case 1:return n?[3,6]:t===null?[3,2]:(e.push(t),t=t.left,[3,5]);case 2:return e.length===0?[3,4]:(t=e.pop(),[4,t]);case 3:return i.sent(),t=t.right,[3,5];case 4:n=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},r}();function gt(r,t,e,n){var i=n-e;if(i>0){var o=e+Math.floor(i/2),f=r[o],s=t[o],c=new G(f,s);return c.left=gt(r,t,e,o),c.right=gt(r,t,o+1,n),c}return null}function ae(r,t){for(var e=new G(null,null),n=e,i=0;i<r.length;i++)n=n.next=new G(r[i],t[i]);return n.next=null,e.next}function pe(r){for(var t=r,e=[],n=!1,i=new G(null,null),o=i;!n;)t?(e.push(t),t=t.left):e.length>0?(t=o=o.next=e.pop(),t=t.right):n=!0;return o.next=null,i.next}function yt(r,t,e){var n=e-t;if(n>0){var i=t+Math.floor(n/2),o=yt(r,t,i),f=r.head;return f.left=o,r.head=r.head.next,f.right=yt(r,i+1,e),f}return null}function ge(r,t,e){for(var n=new G(null,null),i=n,o=r,f=t;o!==null&&f!==null;)e(o.key,f.key)<0?(i.next=o,o=o.next):(i.next=f,f=f.next),i=i.next;return o!==null?i.next=o:f!==null&&(i.next=f),n.next}function dt(r,t,e,n,i){if(!(e>=n)){for(var o=r[e+n>>1],f=e-1,s=n+1;;){do f++;while(i(r[f],o)<0);do s--;while(i(r[s],o)>0);if(f>=s)break;var c=r[f];r[f]=r[s],r[s]=c,c=t[f],t[f]=t[s],t[s]=c}dt(r,t,e,s,i),dt(r,t,s+1,n,i)}}const N=11102230246251565e-32,_=134217729,ye=(3+8*N)*N;function xt(r,t,e,n,i){let o,f,s,c,u=t[0],p=n[0],l=0,h=0;p>u==p>-u?(o=u,u=t[++l]):(o=p,p=n[++h]);let a=0;if(l<r&&h<e)for(p>u==p>-u?(f=u+o,s=o-(f-u),u=t[++l]):(f=p+o,s=o-(f-p),p=n[++h]),o=f,s!==0&&(i[a++]=s);l<r&&h<e;)p>u==p>-u?(f=o+u,c=f-o,s=o-(f-c)+(u-c),u=t[++l]):(f=o+p,c=f-o,s=o-(f-c)+(p-c),p=n[++h]),o=f,s!==0&&(i[a++]=s);for(;l<r;)f=o+u,c=f-o,s=o-(f-c)+(u-c),u=t[++l],o=f,s!==0&&(i[a++]=s);for(;h<e;)f=o+p,c=f-o,s=o-(f-c)+(p-c),p=n[++h],o=f,s!==0&&(i[a++]=s);return(o!==0||a===0)&&(i[a++]=o),a}function de(r,t){let e=t[0];for(let n=1;n<r;n++)e+=t[n];return e}function J(r){return new Float64Array(r)}const xe=(3+16*N)*N,me=(2+12*N)*N,ve=(9+64*N)*N*N,U=J(4),$t=J(8),kt=J(12),Ot=J(16),P=J(4);function be(r,t,e,n,i,o,f){let s,c,u,p,l,h,a,x,g,y,d,m,b,v,w,E,R,S;const $=r-i,k=e-i,O=t-o,A=n-o;v=$*A,h=_*$,a=h-(h-$),x=$-a,h=_*A,g=h-(h-A),y=A-g,w=x*y-(v-a*g-x*g-a*y),E=O*k,h=_*O,a=h-(h-O),x=O-a,h=_*k,g=h-(h-k),y=k-g,R=x*y-(E-a*g-x*g-a*y),d=w-R,l=w-d,U[0]=w-(d+l)+(l-R),m=v+d,l=m-v,b=v-(m-l)+(d-l),d=b-E,l=b-d,U[1]=b-(d+l)+(l-E),S=m+d,l=S-m,U[2]=m-(S-l)+(d-l),U[3]=S;let B=de(4,U),et=me*f;if(B>=et||-B>=et||(l=r-$,s=r-($+l)+(l-i),l=e-k,u=e-(k+l)+(l-i),l=t-O,c=t-(O+l)+(l-o),l=n-A,p=n-(A+l)+(l-o),s===0&&c===0&&u===0&&p===0)||(et=ve*f+ye*Math.abs(B),B+=$*p+A*s-(O*u+k*c),B>=et||-B>=et))return B;v=s*A,h=_*s,a=h-(h-s),x=s-a,h=_*A,g=h-(h-A),y=A-g,w=x*y-(v-a*g-x*g-a*y),E=c*k,h=_*c,a=h-(h-c),x=c-a,h=_*k,g=h-(h-k),y=k-g,R=x*y-(E-a*g-x*g-a*y),d=w-R,l=w-d,P[0]=w-(d+l)+(l-R),m=v+d,l=m-v,b=v-(m-l)+(d-l),d=b-E,l=b-d,P[1]=b-(d+l)+(l-E),S=m+d,l=S-m,P[2]=m-(S-l)+(d-l),P[3]=S;const sn=xt(4,U,4,P,$t);v=$*p,h=_*$,a=h-(h-$),x=$-a,h=_*p,g=h-(h-p),y=p-g,w=x*y-(v-a*g-x*g-a*y),E=O*u,h=_*O,a=h-(h-O),x=O-a,h=_*u,g=h-(h-u),y=u-g,R=x*y-(E-a*g-x*g-a*y),d=w-R,l=w-d,P[0]=w-(d+l)+(l-R),m=v+d,l=m-v,b=v-(m-l)+(d-l),d=b-E,l=b-d,P[1]=b-(d+l)+(l-E),S=m+d,l=S-m,P[2]=m-(S-l)+(d-l),P[3]=S;const ln=xt(sn,$t,4,P,kt);v=s*p,h=_*s,a=h-(h-s),x=s-a,h=_*p,g=h-(h-p),y=p-g,w=x*y-(v-a*g-x*g-a*y),E=c*u,h=_*c,a=h-(h-c),x=c-a,h=_*u,g=h-(h-u),y=u-g,R=x*y-(E-a*g-x*g-a*y),d=w-R,l=w-d,P[0]=w-(d+l)+(l-R),m=v+d,l=m-v,b=v-(m-l)+(d-l),d=b-E,l=b-d,P[1]=b-(d+l)+(l-E),S=m+d,l=S-m,P[2]=m-(S-l)+(d-l),P[3]=S;const un=xt(ln,kt,4,P,Ot);return Ot[un-1]}function we(r,t,e,n,i,o){const f=(t-o)*(e-i),s=(r-i)*(n-o),c=f-s,u=Math.abs(f+s);return Math.abs(c)>=xe*u?c:-be(r,t,e,n,i,o,u)}const W=(r,t)=>r.ll.x<=t.x&&t.x<=r.ur.x&&r.ll.y<=t.y&&t.y<=r.ur.y,mt=(r,t)=>{if(t.ur.x<r.ll.x||r.ur.x<t.ll.x||t.ur.y<r.ll.y||r.ur.y<t.ll.y)return null;const e=r.ll.x<t.ll.x?t.ll.x:r.ll.x,n=r.ur.x<t.ur.x?r.ur.x:t.ur.x,i=r.ll.y<t.ll.y?t.ll.y:r.ll.y,o=r.ur.y<t.ur.y?r.ur.y:t.ur.y;return{ll:{x:e,y:i},ur:{x:n,y:o}}};let z=Number.EPSILON;z===void 0&&(z=Math.pow(2,-52));const Ee=z*z,At=(r,t)=>{if(-z<r&&r<z&&-z<t&&t<z)return 0;const e=r-t;return e*e<Ee*r*t?0:r<t?-1:1};class _e{constructor(){this.reset()}reset(){this.xRounder=new Nt,this.yRounder=new Nt}round(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}class Nt{constructor(){this.tree=new pt,this.round(0)}round(t){const e=this.tree.add(t),n=this.tree.prev(e);if(n!==null&&At(e.key,n.key)===0)return this.tree.remove(t),n.key;const i=this.tree.next(e);return i!==null&&At(e.key,i.key)===0?(this.tree.remove(t),i.key):t}}const K=new _e,nt=(r,t)=>r.x*t.y-r.y*t.x,Bt=(r,t)=>r.x*t.x+r.y*t.y,Gt=(r,t,e)=>{const n=we(r.x,r.y,t.x,t.y,e.x,e.y);return n>0?-1:n<0?1:0},rt=r=>Math.sqrt(Bt(r,r)),Se=(r,t,e)=>{const n={x:t.x-r.x,y:t.y-r.y},i={x:e.x-r.x,y:e.y-r.y};return nt(i,n)/rt(i)/rt(n)},Pe=(r,t,e)=>{const n={x:t.x-r.x,y:t.y-r.y},i={x:e.x-r.x,y:e.y-r.y};return Bt(i,n)/rt(i)/rt(n)},Tt=(r,t,e)=>t.y===0?null:{x:r.x+t.x/t.y*(e-r.y),y:e},zt=(r,t,e)=>t.x===0?null:{x:e,y:r.y+t.y/t.x*(e-r.x)},Me=(r,t,e,n)=>{if(t.x===0)return zt(e,n,r.x);if(n.x===0)return zt(r,t,e.x);if(t.y===0)return Tt(e,n,r.y);if(n.y===0)return Tt(r,t,e.y);const i=nt(t,n);if(i==0)return null;const o={x:e.x-r.x,y:e.y-r.y},f=nt(o,t)/i,s=nt(o,n)/i,c=r.x+s*t.x,u=e.x+f*n.x,p=r.y+s*t.y,l=e.y+f*n.y,h=(c+u)/2,a=(p+l)/2;return{x:h,y:a}};class C{static compare(t,e){const n=C.comparePoints(t.point,e.point);return n!==0?n:(t.point!==e.point&&t.link(e),t.isLeft!==e.isLeft?t.isLeft?1:-1:F.compare(t.segment,e.segment))}static comparePoints(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}constructor(t,e){t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=e}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const e=t.point.events;for(let n=0,i=e.length;n<i;n++){const o=e[n];this.point.events.push(o),o.point=this.point}this.checkForConsuming()}checkForConsuming(){const t=this.point.events.length;for(let e=0;e<t;e++){const n=this.point.events[e];if(n.segment.consumedBy===void 0)for(let i=e+1;i<t;i++){const o=this.point.events[i];o.consumedBy===void 0&&n.otherSE.point.events===o.otherSE.point.events&&n.segment.consume(o.segment)}}}getAvailableLinkedEvents(){const t=[];for(let e=0,n=this.point.events.length;e<n;e++){const i=this.point.events[e];i!==this&&!i.segment.ringOut&&i.segment.isInResult()&&t.push(i)}return t}getLeftmostComparator(t){const e=new Map,n=i=>{const o=i.otherSE;e.set(i,{sine:Se(this.point,t.point,o.point),cosine:Pe(this.point,t.point,o.point)})};return(i,o)=>{e.has(i)||n(i),e.has(o)||n(o);const{sine:f,cosine:s}=e.get(i),{sine:c,cosine:u}=e.get(o);return f>=0&&c>=0?s<u?1:s>u?-1:0:f<0&&c<0?s<u?-1:s>u?1:0:c<f?-1:c>f?1:0}}}let Le=0;class F{static compare(t,e){const n=t.leftSE.point.x,i=e.leftSE.point.x,o=t.rightSE.point.x,f=e.rightSE.point.x;if(f<n)return 1;if(o<i)return-1;const s=t.leftSE.point.y,c=e.leftSE.point.y,u=t.rightSE.point.y,p=e.rightSE.point.y;if(n<i){if(c<s&&c<u)return 1;if(c>s&&c>u)return-1;const l=t.comparePoint(e.leftSE.point);if(l<0)return 1;if(l>0)return-1;const h=e.comparePoint(t.rightSE.point);return h!==0?h:-1}if(n>i){if(s<c&&s<p)return-1;if(s>c&&s>p)return 1;const l=e.comparePoint(t.leftSE.point);if(l!==0)return l;const h=t.comparePoint(e.rightSE.point);return h<0?1:h>0?-1:1}if(s<c)return-1;if(s>c)return 1;if(o<f){const l=e.comparePoint(t.rightSE.point);if(l!==0)return l}if(o>f){const l=t.comparePoint(e.rightSE.point);if(l<0)return 1;if(l>0)return-1}if(o!==f){const l=u-s,h=o-n,a=p-c,x=f-i;if(l>h&&a<x)return 1;if(l<h&&a>x)return-1}return o>f?1:o<f||u<p?-1:u>p?1:t.id<e.id?-1:t.id>e.id?1:0}constructor(t,e,n,i){this.id=++Le,this.leftSE=t,t.segment=this,t.otherSE=e,this.rightSE=e,e.segment=this,e.otherSE=t,this.rings=n,this.windings=i}static fromRing(t,e,n){let i,o,f;const s=C.comparePoints(t,e);if(s<0)i=t,o=e,f=1;else if(s>0)i=e,o=t,f=-1;else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);const c=new C(i,!0),u=new C(o,!1);return new F(c,u,[n],[f])}replaceRightSE(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}comparePoint(t){if(this.isAnEndpoint(t))return 0;const e=this.leftSE.point,n=this.rightSE.point,i=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;const o=(t.y-e.y)/i.y,f=e.x+o*i.x;if(t.x===f)return 0;const s=(t.x-e.x)/i.x,c=e.y+s*i.y;return t.y===c?0:t.y<c?-1:1}getIntersection(t){const e=this.bbox(),n=t.bbox(),i=mt(e,n);if(i===null)return null;const o=this.leftSE.point,f=this.rightSE.point,s=t.leftSE.point,c=t.rightSE.point,u=W(e,s)&&this.comparePoint(s)===0,p=W(n,o)&&t.comparePoint(o)===0,l=W(e,c)&&this.comparePoint(c)===0,h=W(n,f)&&t.comparePoint(f)===0;if(p&&u)return h&&!l?f:!h&&l?c:null;if(p)return l&&o.x===c.x&&o.y===c.y?null:o;if(u)return h&&f.x===s.x&&f.y===s.y?null:s;if(h&&l)return null;if(h)return f;if(l)return c;const a=Me(o,this.vector(),s,t.vector());return a===null||!W(i,a)?null:K.round(a.x,a.y)}split(t){const e=[],n=t.events!==void 0,i=new C(t,!0),o=new C(t,!1),f=this.rightSE;this.replaceRightSE(o),e.push(o),e.push(i);const s=new F(i,f,this.rings.slice(),this.windings.slice());return C.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),C.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),e}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let e=0,n=this.windings.length;e<n;e++)this.windings[e]*=-1}consume(t){let e=this,n=t;for(;e.consumedBy;)e=e.consumedBy;for(;n.consumedBy;)n=n.consumedBy;const i=F.compare(e,n);if(i!==0){if(i>0){const o=e;e=n,n=o}if(e.prev===n){const o=e;e=n,n=o}for(let o=0,f=n.rings.length;o<f;o++){const s=n.rings[o],c=n.windings[o],u=e.rings.indexOf(s);u===-1?(e.rings.push(s),e.windings.push(c)):e.windings[u]+=c}n.rings=null,n.windings=null,n.consumedBy=e,n.leftSE.consumedBy=e.leftSE,n.rightSE.consumedBy=e.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};const e=this._afterState.rings,n=this._afterState.windings,i=this._afterState.multiPolys;for(let s=0,c=this.rings.length;s<c;s++){const u=this.rings[s],p=this.windings[s],l=e.indexOf(u);l===-1?(e.push(u),n.push(p)):n[l]+=p}const o=[],f=[];for(let s=0,c=e.length;s<c;s++){if(n[s]===0)continue;const u=e[s],p=u.poly;if(f.indexOf(p)===-1)if(u.isExterior)o.push(p);else{f.indexOf(p)===-1&&f.push(p);const l=o.indexOf(u.poly);l!==-1&&o.splice(l,1)}}for(let s=0,c=o.length;s<c;s++){const u=o[s].multiPoly;i.indexOf(u)===-1&&i.push(u)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(I.type){case"union":{const n=t.length===0,i=e.length===0;this._isInResult=n!==i;break}case"intersection":{let n,i;t.length<e.length?(n=t.length,i=e.length):(n=e.length,i=t.length),this._isInResult=i===I.numMultiPolys&&n<i;break}case"xor":{const n=Math.abs(t.length-e.length);this._isInResult=n%2===1;break}case"difference":{const n=i=>i.length===1&&i[0].isSubject;this._isInResult=n(t)!==n(e);break}default:throw new Error(`Unrecognized operation type found ${I.type}`)}return this._isInResult}}class Ft{constructor(t,e,n){if(!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=n,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const i=K.round(t[0][0],t[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};let o=i;for(let f=1,s=t.length;f<s;f++){if(typeof t[f][0]!="number"||typeof t[f][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let c=K.round(t[f][0],t[f][1]);c.x===o.x&&c.y===o.y||(this.segments.push(F.fromRing(o,c,this)),c.x<this.bbox.ll.x&&(this.bbox.ll.x=c.x),c.y<this.bbox.ll.y&&(this.bbox.ll.y=c.y),c.x>this.bbox.ur.x&&(this.bbox.ur.x=c.x),c.y>this.bbox.ur.y&&(this.bbox.ur.y=c.y),o=c)}(i.x!==o.x||i.y!==o.y)&&this.segments.push(F.fromRing(o,i,this))}getSweepEvents(){const t=[];for(let e=0,n=this.segments.length;e<n;e++){const i=this.segments[e];t.push(i.leftSE),t.push(i.rightSE)}return t}}class Ce{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Ft(t[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,i=t.length;n<i;n++){const o=new Ft(t[n],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=e}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let e=0,n=this.interiorRings.length;e<n;e++){const i=this.interiorRings[e].getSweepEvents();for(let o=0,f=i.length;o<f;o++)t.push(i[o])}return t}}class qt{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof t[0][0][0]=="number"&&(t=[t])}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,i=t.length;n<i;n++){const o=new Ce(t[n],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=e}getSweepEvents(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const i=this.polys[e].getSweepEvents();for(let o=0,f=i.length;o<f;o++)t.push(i[o])}return t}}class it{static factory(t){const e=[];for(let n=0,i=t.length;n<i;n++){const o=t[n];if(!o.isInResult()||o.ringOut)continue;let f=null,s=o.leftSE,c=o.rightSE;const u=[s],p=s.point,l=[];for(;f=s,s=c,u.push(s),s.point!==p;)for(;;){const h=s.getAvailableLinkedEvents();if(h.length===0){const g=u[0].point,y=u[u.length-1].point;throw new Error(`Unable to complete output ring starting at [${g.x}, ${g.y}]. Last matching segment found ends at [${y.x}, ${y.y}].`)}if(h.length===1){c=h[0].otherSE;break}let a=null;for(let g=0,y=l.length;g<y;g++)if(l[g].point===s.point){a=g;break}if(a!==null){const g=l.splice(a)[0],y=u.splice(g.index);y.unshift(y[0].otherSE),e.push(new it(y.reverse()));continue}l.push({index:u.length,point:s.point});const x=s.getLeftmostComparator(f);c=h.sort(x)[0].otherSE;break}e.push(new it(u))}return e}constructor(t){this.events=t;for(let e=0,n=t.length;e<n;e++)t[e].segment.ringOut=this;this.poly=null}getGeom(){let t=this.events[0].point;const e=[t];for(let u=1,p=this.events.length-1;u<p;u++){const l=this.events[u].point,h=this.events[u+1].point;Gt(l,t,h)!==0&&(e.push(l),t=l)}if(e.length===1)return null;const n=e[0],i=e[1];Gt(n,t,i)===0&&e.shift(),e.push(e[0]);const o=this.isExteriorRing()?1:-1,f=this.isExteriorRing()?0:e.length-1,s=this.isExteriorRing()?e.length:-1,c=[];for(let u=f;u!=s;u+=o)c.push([e[u].x,e[u].y]);return c}isExteriorRing(){if(this._isExteriorRing===void 0){const t=this.enclosingRing();this._isExteriorRing=t?!t.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let i=1,o=this.events.length;i<o;i++){const f=this.events[i];C.compare(t,f)>0&&(t=f)}let e=t.segment.prevInResult(),n=e?e.prevInResult():null;for(;;){if(!e)return null;if(!n)return e.ringOut;if(n.ringOut!==e.ringOut)return n.ringOut.enclosingRing()!==e.ringOut?e.ringOut:e.ringOut.enclosingRing();e=n.prevInResult(),n=e?e.prevInResult():null}}}class jt{constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(let e=0,n=this.interiorRings.length;e<n;e++){const i=this.interiorRings[e].getGeom();i!==null&&t.push(i)}return t}}class Re{constructor(t){this.rings=t,this.polys=this._composePolys(t)}getGeom(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const i=this.polys[e].getGeom();i!==null&&t.push(i)}return t}_composePolys(t){const e=[];for(let n=0,i=t.length;n<i;n++){const o=t[n];if(!o.poly)if(o.isExteriorRing())e.push(new jt(o));else{const f=o.enclosingRing();f.poly||e.push(new jt(f)),f.poly.addInterior(o)}}return e}}class Ie{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:F.compare;this.queue=t,this.tree=new pt(e),this.segments=[]}process(t){const e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;const i=t.isLeft?this.tree.add(e):this.tree.find(e);if(!i)throw new Error(`Unable to find segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] in SweepLine tree.`);let o=i,f=i,s,c;for(;s===void 0;)o=this.tree.prev(o),o===null?s=null:o.key.consumedBy===void 0&&(s=o.key);for(;c===void 0;)f=this.tree.next(f),f===null?c=null:f.key.consumedBy===void 0&&(c=f.key);if(t.isLeft){let u=null;if(s){const l=s.getIntersection(e);if(l!==null&&(e.isAnEndpoint(l)||(u=l),!s.isAnEndpoint(l))){const h=this._splitSafely(s,l);for(let a=0,x=h.length;a<x;a++)n.push(h[a])}}let p=null;if(c){const l=c.getIntersection(e);if(l!==null&&(e.isAnEndpoint(l)||(p=l),!c.isAnEndpoint(l))){const h=this._splitSafely(c,l);for(let a=0,x=h.length;a<x;a++)n.push(h[a])}}if(u!==null||p!==null){let l=null;u===null?l=p:p===null?l=u:l=C.comparePoints(u,p)<=0?u:p,this.queue.remove(e.rightSE),n.push(e.rightSE);const h=e.split(l);for(let a=0,x=h.length;a<x;a++)n.push(h[a])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&c){const u=s.getIntersection(c);if(u!==null){if(!s.isAnEndpoint(u)){const p=this._splitSafely(s,u);for(let l=0,h=p.length;l<h;l++)n.push(p[l])}if(!c.isAnEndpoint(u)){const p=this._splitSafely(c,u);for(let l=0,h=p.length;l<h;l++)n.push(p[l])}}}this.tree.remove(e)}return n}_splitSafely(t,e){this.tree.remove(t);const n=t.rightSE;this.queue.remove(n);const i=t.split(e);return i.push(n),t.consumedBy===void 0&&this.tree.add(t),i}}const Qt=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,$e=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class ke{run(t,e,n){I.type=t,K.reset();const i=[new qt(e,!0)];for(let l=0,h=n.length;l<h;l++)i.push(new qt(n[l],!1));if(I.numMultiPolys=i.length,I.type==="difference"){const l=i[0];let h=1;for(;h<i.length;)mt(i[h].bbox,l.bbox)!==null?h++:i.splice(h,1)}if(I.type==="intersection")for(let l=0,h=i.length;l<h;l++){const a=i[l];for(let x=l+1,g=i.length;x<g;x++)if(mt(a.bbox,i[x].bbox)===null)return[]}const o=new pt(C.compare);for(let l=0,h=i.length;l<h;l++){const a=i[l].getSweepEvents();for(let x=0,g=a.length;x<g;x++)if(o.insert(a[x]),o.size>Qt)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const f=new Ie(o);let s=o.size,c=o.pop();for(;c;){const l=c.key;if(o.size===s){const a=l.segment;throw new Error(`Unable to pop() ${l.isLeft?"left":"right"} SweepEvent [${l.point.x}, ${l.point.y}] from segment #${a.id} [${a.leftSE.point.x}, ${a.leftSE.point.y}] -> [${a.rightSE.point.x}, ${a.rightSE.point.y}] from queue.`)}if(o.size>Qt)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(f.segments.length>$e)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const h=f.process(l);for(let a=0,x=h.length;a<x;a++){const g=h[a];g.consumedBy===void 0&&o.insert(g)}s=o.size,c=o.pop()}K.reset();const u=it.factory(f.segments);return new Re(u).getGeom()}}const I=new ke;var Ut={union:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return I.run("union",r,e)},intersection:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return I.run("intersection",r,e)},xor:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return I.run("xor",r,e)},difference:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return I.run("difference",r,e)}};function Oe(r,t={}){const e=[];if(ut(r,i=>{e.push(i.coordinates)}),e.length<2)throw new Error("Must have at least 2 geometries");const n=Ut.union(e[0],...e.slice(1));return n.length===0?null:n.length===1?lt(n[0],t.properties):Pt(n,t.properties)}var Dt=Oe;function vt(r){const t=[...r];return t[2]<t[0]&&(Math.abs((t[0]+t[2]+360)/2)>Math.abs((t[0]-360+t[2])/2)?t[0]-=360:t[2]+=360),t}function H(){}function Yt(r){return r()}function Xt(){return Object.create(null)}function ot(r){r.forEach(Yt)}function Vt(r){return typeof r=="function"}function Ae(r,t){return r!=r?t==t:r!==t||r&&typeof r=="object"||typeof r=="function"}function Ne(r){return Object.keys(r).length===0}function Be(r,t){r.appendChild(t)}function Ge(r,t,e){r.insertBefore(t,e||null)}function Zt(r){r.parentNode&&r.parentNode.removeChild(r)}function Jt(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function q(r,t,e){e==null?r.removeAttribute(t):r.getAttribute(t)!==e&&r.setAttribute(t,e)}function Te(r){return Array.from(r.childNodes)}function st(r,t,e){r.classList.toggle(t,!!e)}let bt;function tt(r){bt=r}const D=[],Wt=[];let Y=[];const Kt=[],ze=Promise.resolve();let wt=!1;function Fe(){wt||(wt=!0,ze.then(Ht))}function Et(r){Y.push(r)}const _t=new Set;let X=0;function Ht(){if(X!==0)return;const r=bt;do{try{for(;X<D.length;){const t=D[X];X++,tt(t),qe(t.$$)}}catch(t){throw D.length=0,X=0,t}for(tt(null),D.length=0,X=0;Wt.length;)Wt.pop()();for(let t=0;t<Y.length;t+=1){const e=Y[t];_t.has(e)||(_t.add(e),e())}Y.length=0}while(D.length);for(;Kt.length;)Kt.pop()();wt=!1,_t.clear(),tt(r)}function qe(r){if(r.fragment!==null){r.update(),ot(r.before_update);const t=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,t),r.after_update.forEach(Et)}}function je(r){const t=[],e=[];Y.forEach(n=>r.indexOf(n)===-1?t.push(n):e.push(n)),e.forEach(n=>n()),Y=t}const Qe=new Set;function Ue(r,t){r&&r.i&&(Qe.delete(r),r.i(t))}function De(r,t,e){const{fragment:n,after_update:i}=r.$$;n&&n.m(t,e),Et(()=>{const o=r.$$.on_mount.map(Yt).filter(Vt);r.$$.on_destroy?r.$$.on_destroy.push(...o):ot(o),r.$$.on_mount=[]}),i.forEach(Et)}function Ye(r,t){const e=r.$$;e.fragment!==null&&(je(e.after_update),ot(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Xe(r,t){r.$$.dirty[0]===-1&&(D.push(r),Fe(),r.$$.dirty.fill(0)),r.$$.dirty[t/31|0]|=1<<t%31}function Ve(r,t,e,n,i,o,f=null,s=[-1]){const c=bt;tt(r);const u=r.$$={fragment:null,ctx:[],props:o,update:H,not_equal:i,bound:Xt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(c?c.$$.context:[])),callbacks:Xt(),dirty:s,skip_bound:!1,root:t.target||c.$$.root};f&&f(u.root);let p=!1;if(u.ctx=e?e(r,t.props||{},(l,h,...a)=>{const x=a.length?a[0]:h;return u.ctx&&i(u.ctx[l],u.ctx[l]=x)&&(!u.skip_bound&&u.bound[l]&&u.bound[l](x),p&&Xe(r,l)),h}):[],u.update(),p=!0,ot(u.before_update),u.fragment=n?n(u.ctx):!1,t.target){if(t.hydrate){const l=Te(t.target);u.fragment&&u.fragment.l(l),l.forEach(Zt)}else u.fragment&&u.fragment.c();t.intro&&Ue(r.$$.fragment),De(r,t.target,t.anchor),Ht()}tt(c)}class Ze{constructor(){St(this,"$$");St(this,"$$set")}$destroy(){Ye(this,1),this.$destroy=H}$on(t,e){if(!Vt(e))return H;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const i=n.indexOf(e);i!==-1&&n.splice(i,1)}}$set(t){this.$$set&&!Ne(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Je="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Je);function We(r){let t,e,n;return{c(){t=Jt("svg"),e=Jt("path"),q(e,"stroke-width","4"),q(e,"d","M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"),q(e,"class","svelte-gzo3ar"),q(t,"width",n=r[0]==="list"?20:void 0),q(t,"viewBox","0 0 70 85"),q(t,"fill","none"),q(t,"class","svelte-gzo3ar"),st(t,"in-map",r[0]!=="list"),st(t,"list-icon",r[0]==="list")},m(i,o){Ge(i,t,o),Be(t,e)},p(i,[o]){o&1&&n!==(n=i[0]==="list"?20:void 0)&&q(t,"width",n),o&1&&st(t,"in-map",i[0]!=="list"),o&1&&st(t,"list-icon",i[0]==="list")},i:H,o:H,d(i){i&&Zt(t)}}}function Ke(r,t,e){let{displayIn:n}=t;return r.$$set=i=>{"displayIn"in i&&e(0,n=i.displayIn)},[n]}class He extends Ze{constructor(t){super(),Ve(this,t,Ke,We,Ae,{displayIn:0})}}function tn(r){const t=[];if(ut(r,i=>{t.push(i.coordinates)}),t.length<2)throw new Error("Must have at least two features");const e=r.features[0].properties||{},n=Ut.difference(t[0],...t.slice(1));return n.length===0?null:n.length===1?lt(n[0],e):Pt(n,e)}var en=tn;function nn(r){if(!r)throw new Error("geojson is required");var t=[];return ie(r,function(e){t.push(e)}),Z(t)}var rn=nn;function te(r,t){const e=en(Z([lt([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),r]));if(!e)return;e.properties={isMask:!0};const n=vt(ft(r)),i=(n[2]-n[0])/360/1e3,o=n[0]<-180,f=n[2]>180,s=rn(r);if(s.features.length>1&&(o||f))for(const c of s.features){const u=vt(ft(c));if(f&&u[0]<-180+i)for(const p of c.geometry.coordinates)for(const l of p)l[0]+=360-i;if(o&&u[2]>180-i)for(const p of c.geometry.coordinates)for(const l of p)l[0]-=360-i}t(Z([s.features.length<2?r:Dt(s)??r,e]))}const ee=r=>{var n,i,o;const t=(n=r==null?void 0:r.geometry)==null?void 0:n.type,e=(i=r==null?void 0:r.properties)!=null&&i.isMask?0:t==="LineString"||t==="MultiLineString"?3:2;return{color:"#3170fe",fillColor:"#000",fillOpacity:(o=r==null?void 0:r.properties)!=null&&o.isMask?.1:0,weight:e,dashArray:[e,e],lineCap:"butt"}};function on(r,t=!0,e=!0,n={},i={},o=ee,f=!1){let s;const c=[];let u,p,l=f;const h=Q.geoJSON(void 0,{style:o===!0?ee:o===!1?void 0:o??void 0,interactive:!1}).addTo(r),a=g=>{s==null||s({type:"mapClick",coordinates:[g.latlng.lng,g.latlng.lat]})};function x(g,y=!1){const d=document.createElement("div");return new He({props:{displayIn:"leaflet"},target:d}),new Q.Marker(g,{interactive:y,icon:new Q.DivIcon({html:d,className:"",iconAnchor:[12,26],iconSize:[25,30],tooltipAnchor:[1,-24]})})}return{setEventHandler(g){g?(s=g,r.on("click",a)):(s=void 0,r.off("click",a))},flyTo(g,y){r.flyTo([g[1],g[0]],y,{duration:2,...n})},fitBounds(g,y,d){r.flyToBounds([[g[1],g[0]],[g[3],g[2]]],{padding:[y,y],duration:2,...d?{maxZoom:d}:{},...i})},indicateReverse(g){r.getContainer().style.cursor=g?"crosshair":""},setReverseMarker(g){var d;if(!t)return;const y=g&&[g[1],g[0]];p?y?p.setLatLng(y):(p.remove(),p=void 0):y&&(t instanceof Function?p=t(r)??void 0:(p=(typeof t=="object"?new Q.Marker(y,t):x(y)).addTo(r),(d=p.getElement())==null||d.classList.add("marker-reverse")))},setMarkers(g,y){function d(m){h.clearLayers(),m&&h.addData(m)}for(const m of c)m.remove();if(c.length=0,d(),y){let m=!1;if(y.geometry.type==="GeometryCollection"){const b=y.geometry.geometries.filter(v=>v.type==="Polygon"||v.type==="MultiPolygon");t:if(b.length>0){const v=Dt(Z(b.map(w=>V(w))));if(!v)break t;te({...y,geometry:v.geometry},d),m=!0}else{const v=y.geometry.geometries.filter(w=>w.type==="LineString"||w.type==="MultiLineString");v.length>0&&(d({...y,geometry:{type:"GeometryCollection",geometries:v}}),m=!0)}}if(!m){if(y.geometry.type==="Polygon"||y.geometry.type==="MultiPolygon")te(y,b=>{if(!b)return;const v=[...b.features],w=vt(ft(y)),E=w[2]-w[0];w[0]-E/4<-180&&v.push(...ne(b,-360).features),w[2]+E/4>180&&v.push(...ne(b,360).features),d(Z(v))});else if(y.geometry.type==="LineString"||y.geometry.type==="MultiLineString"){d(y);return}}if(!l&&y.geometry.type!=="Point")return;if(t instanceof Function){const b=t(r,y);b&&c.push(b.addTo(r))}else if(t){const b=[y.center[1],y.center[0]];c.push(typeof t=="object"?new Q.Marker(b,t):x(b).addTo(r))}}if(e)for(const m of g??[]){if(m===y)continue;const b=[m.center[1],m.center[0]];let v;if(e instanceof Function){if(v=e(r,m),!v)continue}else v=(typeof e=="object"?new Q.Marker(b,e):x(b,!0)).addTo(r).bindTooltip(m.place_type[0]==="reverse"?m.place_name:m.place_name.replace(/,.*/,""),{direction:"top"});const w=v.getElement();w&&(w.addEventListener("click",E=>{E.stopPropagation(),s==null||s({type:"markerClick",id:m.id})}),w.addEventListener("mouseenter",()=>{s==null||s({type:"markerMouseEnter",id:m.id})}),w.addEventListener("mouseleave",()=>{s==null||s({type:"markerMouseLeave",id:m.id})}),w.classList.toggle("marker-fuzzy",!!m.matching_text)),c.push(v)}},setSelectedMarker(g){var y,d;u&&((y=u.getElement())==null||y.classList.toggle("marker-selected",!1)),u=g>-1?c[g]:void 0,(d=u==null?void 0:u.getElement())==null||d.classList.toggle("marker-selected",!0)},getCenterAndZoom(){const g=r.getCenter();return[r.getZoom(),g.lng,g.lat]},setShowPolygonMarker(g){l=g}}}function ne(r,t){const e=ue(r);for(const n of e.features)if(n.geometry.type=="MultiPolygon")for(const i of n.geometry.coordinates)re(i,t);else re(n.geometry.coordinates,t);return e}function re(r,t){for(const e of r)for(const n of e)n[0]+=t}M.createLeafletMapController=on,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})});
|
|
23
23
|
//# sourceMappingURL=leaflet-controller.umd.js.map
|