@maptiler/geocoding-control 3.0.0-rc.3 → 3.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/README.md +0 -2
- package/dist/index.js +1 -1
- package/dist/index.umd.js +9 -9
- package/dist/index.umd.js.map +1 -1
- package/dist/leaflet.public.js +25 -22
- package/dist/leaflet.public.js.map +1 -1
- package/dist/leaflet.public.umd.js +6 -6
- package/dist/leaflet.public.umd.js.map +1 -1
- package/dist/maplibregl.js +40 -45
- package/dist/maplibregl.js.map +1 -1
- package/dist/maplibregl.umd.js +23 -23
- package/dist/maplibregl.umd.js.map +1 -1
- package/dist/maptilersdk.js +143 -122
- package/dist/maptilersdk.js.map +1 -1
- package/dist/maptilersdk.umd.js +45 -45
- package/dist/maptilersdk.umd.js.map +1 -1
- package/dist/openlayers.public.js +135 -131
- package/dist/openlayers.public.js.map +1 -1
- package/dist/openlayers.public.umd.js +28 -28
- package/dist/openlayers.public.umd.js.map +1 -1
- package/dist/src/controls/base-control.d.ts +4 -0
- package/dist/src/controls/leaflet-control.d.ts +1 -0
- package/dist/src/controls/leaflet-events.d.ts +55 -26
- package/dist/src/controls/maplibregl-control.d.ts +1 -0
- package/dist/src/controls/maplibregl-events.d.ts +54 -25
- package/dist/src/controls/maptilersdk-control.d.ts +17 -0
- package/dist/src/controls/maptilersdk-events.d.ts +72 -2
- package/dist/src/controls/maptilersdk-options.d.ts +10 -0
- package/dist/src/controls/openlayers-control.d.ts +5 -4
- package/dist/src/controls/openlayers-events.d.ts +55 -25
- package/dist/src/geocoder/geocoder-events.d.ts +40 -27
- package/dist/src/geocoder/geocoder-options.d.ts +1 -3
- package/dist/src/leaflet.public.d.ts +1 -1
- package/dist/src/maplibregl.d.ts +1 -1
- package/dist/src/maptilersdk.d.ts +1 -1
- package/dist/src/openlayers.public.d.ts +1 -1
- package/package.json +3 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @license
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const lt=globalThis,Tt=lt.ShadowRoot&&(lt.ShadyCSS===void 0||lt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ot=Symbol(),ui=new WeakMap;let di=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Ot)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Tt&&e===void 0){const r=t!==void 0&&t.length===1;r&&(e=ui.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&ui.set(t,e))}return e}toString(){return this.cssText}};const at=i=>new di(typeof i=="string"?i:i+"",void 0,Ot),Le=(i,...e)=>{const t=i.length===1?i[0]:e.reduce(((r,s,n)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal
|
|
5
|
+
*/const lt=globalThis,Tt=lt.ShadowRoot&&(lt.ShadyCSS===void 0||lt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ot=Symbol(),ui=new WeakMap;let di=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Ot)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Tt&&e===void 0){const r=t!==void 0&&t.length===1;r&&(e=ui.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&ui.set(t,e))}return e}toString(){return this.cssText}};const at=i=>new di(typeof i=="string"?i:i+"",void 0,Ot),Le=(i,...e)=>{const t=i.length===1?i[0]:e.reduce(((r,s,n)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal undefined, but take care to ensure page security.")})(s)+i[n+1]),i[0]);return new di(t,i,Ot)},Sr=(i,e)=>{if(Tt)i.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const t of e){const r=document.createElement("style"),s=lt.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=t.cssText,i.appendChild(r)}},fi=Tt?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return at(t)})(i):i;/**
|
|
6
6
|
* @license
|
|
7
7
|
* Copyright 2017 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
13
|
*/const Nt=globalThis,ut=Nt.trustedTypes,gi=ut?ut.createPolicy("lit-html",{createHTML:i=>i}):void 0,yi="$lit$",_e=`lit$${Math.random().toFixed(9).slice(2)}$`,vi="?"+_e,kr=`<${vi}>`,Ae=document,We=()=>Ae.createComment(""),ze=i=>i===null||typeof i!="object"&&typeof i!="function",It=Array.isArray,Nr=i=>It(i)||typeof i?.[Symbol.iterator]=="function",Pt=`[
|
|
14
14
|
\f\r]`,qe=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,bi=/-->/g,Ei=/>/g,Te=RegExp(`>|${Pt}(?:([^\\s"'>=/]+)(${Pt}*=${Pt}*(?:[^
|
|
15
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),wi=/'/g,xi=/"/g,Si=/^(?:script|style|textarea|title)$/i,Li=i=>(e,...t)=>({_$litType$:i,strings:e,
|
|
15
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),wi=/'/g,xi=/"/g,Si=/^(?:script|style|textarea|title)$/i,Li=i=>(e,...t)=>({_$litType$:i,strings:e,undefined:t}),Z=Li(1),He=Li(2),Ee=Symbol.for("lit-noChange"),V=Symbol.for("lit-nothing"),_i=new WeakMap,Oe=Ae.createTreeWalker(Ae,129);function $i(i,e){if(!It(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return gi!==void 0?gi.createHTML(e):e}const Ir=(i,e)=>{const t=i.length-1,r=[];let s,n=e===2?"<svg>":e===3?"<math>":"",o=qe;for(let l=0;l<t;l++){const u=i[l];let d,x,w=-1,_=0;for(;_<u.length&&(o.lastIndex=_,x=o.exec(u),x!==null);)_=o.lastIndex,o===qe?x[1]==="!--"?o=bi:x[1]!==void 0?o=Ei:x[2]!==void 0?(Si.test(x[2])&&(s=RegExp("</"+x[2],"g")),o=Te):x[3]!==void 0&&(o=Te):o===Te?x[0]===">"?(o=s??qe,w=-1):x[1]===void 0?w=-2:(w=o.lastIndex-x[2].length,d=x[1],o=x[3]===void 0?Te:x[3]==='"'?xi:wi):o===xi||o===wi?o=Te:o===bi||o===Ei?o=qe:(o=Te,s=void 0);const M=o===Te&&i[l+1].startsWith("/>")?" ":"";n+=o===qe?u+kr:w>=0?(r.push(d),u.slice(0,w)+yi+u.slice(w)+_e+M):u+_e+(w===-2?l:M)}return[$i(i,n+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class je{constructor({strings:e,_$litType$:t},r){let s;this.parts=[];let n=0,o=0;const l=e.length-1,u=this.parts,[d,x]=Ir(e,t);if(this.el=je.createElement(d,r),Oe.currentNode=this.el.content,t===2||t===3){const w=this.el.content.firstChild;w.replaceWith(...w.childNodes)}for(;(s=Oe.nextNode())!==null&&u.length<l;){if(s.nodeType===1){if(s.hasAttributes())for(const w of s.getAttributeNames())if(w.endsWith(yi)){const _=x[o++],M=s.getAttribute(w).split(_e),C=/([.?@])?(.*)/.exec(_);u.push({type:1,index:n,name:C[2],strings:M,ctor:C[1]==="."?Rr:C[1]==="?"?Gr:C[1]==="@"?Ur:dt}),s.removeAttribute(w)}else w.startsWith(_e)&&(u.push({type:6,index:n}),s.removeAttribute(w));if(Si.test(s.tagName)){const w=s.textContent.split(_e),_=w.length-1;if(_>0){s.textContent=ut?ut.emptyScript:"";for(let M=0;M<_;M++)s.append(w[M],We()),Oe.nextNode(),u.push({type:2,index:++n});s.append(w[_],We())}}}else if(s.nodeType===8)if(s.data===vi)u.push({type:2,index:n});else{let w=-1;for(;(w=s.data.indexOf(_e,w+1))!==-1;)u.push({type:7,index:n}),w+=_e.length-1}n++}}static createElement(e,t){const r=Ae.createElement("template");return r.innerHTML=e,r}}function Re(i,e,t=i,r){if(e===Ee)return e;let s=r!==void 0?t._$Co?.[r]:t._$Cl;const n=ze(e)?void 0:e._$litDirective$;return s?.constructor!==n&&(s?._$AO?.(!1),n===void 0?s=void 0:(s=new n(i),s._$AT(i,t,r)),r!==void 0?(t._$Co??=[])[r]=s:t._$Cl=s),s!==void 0&&(e=Re(i,s._$AS(i,e.undefined),s,r)),e}let Pr=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,s=(e?.creationScope??Ae).importNode(t,!0);Oe.currentNode=s;let n=Oe.nextNode(),o=0,l=0,u=r[0];for(;u!==void 0;){if(o===u.index){let d;u.type===2?d=new Ge(n,n.nextSibling,this,e):u.type===1?d=new u.ctor(n,u.name,u.strings,this,e):u.type===6&&(d=new Br(n,this,e)),this._$AV.push(d),u=r[++l]}o!==u?.index&&(n=Oe.nextNode(),o++)}return Oe.currentNode=Ae,s}p(e){let t=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}};class Ge{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,s){this.type=2,this._$AH=V,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Re(this,e,t),ze(e)?e===V||e==null||e===""?(this._$AH!==V&&this._$AR(),this._$AH=V):e!==this._$AH&&e!==Ee&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Nr(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==V&&ze(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ae.createTextNode(e)),this._$AH=e}$(e){const{undefined:t,_$litType$:r}=e,s=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=je.createElement($i(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===s)this._$AH.p(t);else{const n=new Pr(s,this),o=n.u(this.options);n.p(t),this.T(o),this._$AH=n}}_$AC(e){let t=_i.get(e.strings);return t===void 0&&_i.set(e.strings,t=new je(e)),t}k(e){It(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,s=0;for(const n of e)s===t.length?t.push(r=new Ge(this.O(We()),this.O(We()),this,this.options)):r=t[s],r._$AI(n),s++;s<t.length&&(this._$AR(r&&r._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class dt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,s,n){this.type=1,this._$AH=V,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=V}_$AI(e,t=this,r,s){const n=this.strings;let o=!1;if(n===void 0)e=Re(this,e,t,0),o=!ze(e)||e!==this._$AH&&e!==Ee,o&&(this._$AH=e);else{const l=e;let u,d;for(e=n[0],u=0;u<n.length-1;u++)d=Re(this,l[r+u],t,u),d===Ee&&(d=this._$AH[u]),o||=!ze(d)||d!==this._$AH[u],d===V?e=V:e!==V&&(e+=(d??"")+n[u+1]),this._$AH[u]=d}o&&!s&&this.j(e)}j(e){e===V?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Rr extends dt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===V?void 0:e}}class Gr extends dt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==V)}}class Ur extends dt{constructor(e,t,r,s,n){super(e,t,r,s,n),this.type=5}_$AI(e,t=this){if((e=Re(this,e,t,0)??V)===Ee)return;const r=this._$AH,s=e===V&&r!==V||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,n=e!==V&&(r===V||s);s&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class Br{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Re(this,e)}}const Dr={I:Ge},Fr=Nt.litHtmlPolyfillSupport;Fr?.(je,Ge),(Nt.litHtmlVersions??=[]).push("3.3.1");const Wr=(i,e,t)=>{const r=t?.renderBefore??e;let s=r._$litPart$;if(s===void 0){const n=t?.renderBefore??null;r._$litPart$=s=new Ge(e.insertBefore(We(),n),n,void 0,t??{})}return s._$AI(i),s};/**
|
|
16
16
|
* @license
|
|
17
17
|
* Copyright 2017 Google LLC
|
|
18
18
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
* @license
|
|
132
132
|
* Copyright 2017 Google LLC
|
|
133
133
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
134
|
-
*/const Ut={ATTRIBUTE:1,CHILD:2},Bt=i=>(...e)=>({_$litDirective$:i,
|
|
134
|
+
*/const Ut={ATTRIBUTE:1,CHILD:2},Bt=i=>(...e)=>({_$litDirective$:i,undefined:e});let Dt=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};/**
|
|
135
135
|
* @license
|
|
136
136
|
* Copyright 2018 Google LLC
|
|
137
137
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
* @license
|
|
144
144
|
* Copyright 2017 Google LLC
|
|
145
145
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
146
|
-
*/const Pi=(i,e,t)=>{const r=new Map;for(let s=e;s<=t;s++)r.set(i[s],s);return r},bs=Bt(class extends Dt{constructor(i){if(super(i),i.type!==Ut.CHILD)throw Error("repeat() can only be used in text expressions")}dt(i,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);const s=[],n=[];let o=0;for(const l of i)s[o]=r?r(l,o):o,n[o]=t(l,o),o++;return{
|
|
146
|
+
*/const Pi=(i,e,t)=>{const r=new Map;for(let s=e;s<=t;s++)r.set(i[s],s);return r},bs=Bt(class extends Dt{constructor(i){if(super(i),i.type!==Ut.CHILD)throw Error("repeat() can only be used in text expressions")}dt(i,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);const s=[],n=[];let o=0;for(const l of i)s[o]=r?r(l,o):o,n[o]=t(l,o),o++;return{undefined:n,keys:s}}render(i,e,t){return this.dt(i,e,t).undefined}update(i,[e,t,r]){const s=vs(i),{undefined:n,keys:o}=this.dt(e,t,r);if(!Array.isArray(s))return this.ut=o,n;const l=this.ut??=[],u=[];let d,x,w=0,_=s.length-1,M=0,C=n.length-1;for(;w<=_&&M<=C;)if(s[w]===null)w++;else if(s[_]===null)_--;else if(l[w]===o[M])u[M]=ke(s[w],n[M]),w++,M++;else if(l[_]===o[C])u[C]=ke(s[_],n[C]),_--,C--;else if(l[w]===o[C])u[C]=ke(s[w],n[C]),Ze(i,u[C+1],s[w]),w++,C--;else if(l[_]===o[M])u[M]=ke(s[_],n[M]),Ze(i,s[w],s[_]),_--,M++;else if(d===void 0&&(d=Pi(o,M,C),x=Pi(l,w,_)),d.has(l[w]))if(d.has(l[_])){const G=x.get(o[M]),N=G!==void 0?s[G]:null;if(N===null){const W=Ze(i,s[w]);ke(W,n[M]),u[M]=W}else u[M]=ke(N,n[M]),Ze(i,s[w],N),s[G]=null;M++}else Ft(s[_]),_--;else Ft(s[w]),w++;for(;M<=C;){const G=Ze(i,u[C+1]);ke(G,n[M]),u[M++]=G}for(;w<=_;){const G=s[w++];G!==null&&Ft(G)}return this.ut=o,ys(i,u),Ee}});function Es(i){if(!i)throw new Error("geojson is required");switch(i.type){case"Feature":return Ri(i);case"FeatureCollection":return ws(i);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Wt(i);default:throw new Error("unknown GeoJSON type")}}function Ri(i){const e={type:"Feature"};return Object.keys(i).forEach(t=>{switch(t){case"type":case"properties":case"geometry":return;default:e[t]=i[t]}}),e.properties=Gi(i.properties),i.geometry==null?e.geometry=null:e.geometry=Wt(i.geometry),e}function Gi(i){const e={};return i&&Object.keys(i).forEach(t=>{const r=i[t];typeof r=="object"?r===null?e[t]=null:Array.isArray(r)?e[t]=r.map(s=>s):e[t]=Gi(r):e[t]=r}),e}function ws(i){const e={type:"FeatureCollection"};return Object.keys(i).forEach(t=>{switch(t){case"type":case"features":return;default:e[t]=i[t]}}),e.features=i.features.map(t=>Ri(t)),e}function Wt(i){const e={type:i.type};return i.bbox&&(e.bbox=i.bbox),i.type==="GeometryCollection"?(e.geometries=i.geometries.map(t=>Wt(t)),e):(e.coordinates=Ui(i.coordinates),e)}function Ui(i){const e=i;return typeof e[0]!="object"?e.slice():e.map(t=>Ui(t))}var xs=Es;function Ss(i,e,t){const r=e[1],s=e[0],n=r-s;return i===r&&t?i:((i-s)%n+n)%n+s}function Ke(i){const e=[...i];return e[2]<e[0]&&(Math.abs((e[0]+e[2]+360)/2)>Math.abs((e[0]-360+e[2])/2)?e[0]-=360:e[2]+=360),e}function Bi(i,e){const t=xs(i);for(const r of t.features)if(r.geometry.type=="MultiPolygon")for(const s of r.geometry.coordinates)Di(s,e);else Di(r.geometry.coordinates,e);return t}function Di(i,e){for(const t of i)for(const r of t)r[0]+=e}let Ye;async function Ls(i,e,t){for(const r of e??[])if(!(i&&(r.minZoom!=null&&r.minZoom>i[0]||r.maxZoom!=null&&r.maxZoom<i[0]))){if(r.type==="fixed")return r.coordinates.join(",");if(r.type==="client-geolocation")if(Ye&&r.cachedLocationExpiry&&Ye.time+r.cachedLocationExpiry>Date.now()){if(Ye.coords)return Ye.coords}else{let s;try{return s=await new Promise((n,o)=>{t.signal.addEventListener("abort",()=>{o(Error("aborted"))}),navigator.geolocation.getCurrentPosition(l=>{n([l.coords.longitude,l.coords.latitude].map(u=>u.toFixed(6)).join(","))},l=>{o(l)},r)}),s}catch{}finally{r.cachedLocationExpiry&&(Ye={time:Date.now(),coords:s})}if(t.signal.aborted)return}if(r.type==="server-geolocation")return"ip";if(i&&r.type==="map-center")return i[1].toFixed(6)+","+i[2].toFixed(6)}}/**
|
|
147
147
|
* @license
|
|
148
148
|
* Copyright 2018 Google LLC
|
|
149
149
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
@@ -249,7 +249,7 @@
|
|
|
249
249
|
@mouseenter=${()=>{P(this,O,tr).call(this,t)}}
|
|
250
250
|
@select=${()=>{P(this,O,er).call(this,e)}}
|
|
251
251
|
.missingIconsCache=${re(this,jt)}
|
|
252
|
-
.iconsBaseUrl=${this.iconsBaseUrl??"https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.
|
|
252
|
+
.iconsBaseUrl=${this.iconsBaseUrl??"https://cdn.maptiler.com/maptiler-geocoding-control/v3.0.0-rc.5/icons/"}
|
|
253
253
|
>
|
|
254
254
|
${e.place_name}
|
|
255
255
|
</maptiler-geocoder-feature-item>
|
|
@@ -272,5 +272,5 @@
|
|
|
272
272
|
</svg>
|
|
273
273
|
`}},$.MaptilerGeocodeMarkerElement.styles=Le`
|
|
274
274
|
${at(Ps)}
|
|
275
|
-
`,$.MaptilerGeocodeMarkerElement=Gs([$e("maptiler-geocode-marker")],$.MaptilerGeocodeMarkerElement);function et(i,e,t={}){const r={type:"Feature"};return(t.id===0||t.id)&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.properties=e||{},r.geometry=i,r}function Jt(i,e,t={}){for(const s of i){if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(s[s.length-1].length!==s[0].length)throw new Error("First and last Position are not equivalent.");for(let n=0;n<s[s.length-1].length;n++)if(s[s.length-1][n]!==s[0][n])throw new Error("First and last Position are not equivalent.")}return et({type:"Polygon",coordinates:i},e,t)}function tt(i,e={}){const t={type:"FeatureCollection"};return e.id&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.features=i,t}function sr(i,e,t={}){return et({type:"MultiPolygon",coordinates:i},e,t)}function nr(i,e,t){if(i!==null)for(var r,s,n,o,l,u,d,x=0,w=0,_,M=i.type,C=M==="FeatureCollection",G=M==="Feature",N=C?i.features.length:1,W=0;W<N;W++){d=C?i.features[W].geometry:G?i.geometry:i,_=d?d.type==="GeometryCollection":!1,l=_?d.geometries.length:1;for(var L=0;L<l;L++){var Q=0,ne=0;if(o=_?d.geometries[L]:d,o!==null){u=o.coordinates;var ve=o.type;switch(x=0,ve){case null:break;case"Point":if(e(u,w,W,Q,ne)===!1)return!1;w++,Q++;break;case"LineString":case"MultiPoint":for(r=0;r<u.length;r++){if(e(u[r],w,W,Q,ne)===!1)return!1;w++,ve==="MultiPoint"&&Q++}ve==="LineString"&&Q++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(s=0;s<u[r].length-x;s++){if(e(u[r][s],w,W,Q,ne)===!1)return!1;w++}ve==="MultiLineString"&&Q++,ve==="Polygon"&&ne++}ve==="Polygon"&&Q++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for(ne=0,s=0;s<u[r].length;s++){for(n=0;n<u[r][s].length-x;n++){if(e(u[r][s][n],w,W,Q,ne)===!1)return!1;w++}ne++}Q++}break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(nr(o.geometries[r],e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ei(i,e){var t,r,s,n,o,l,u,d,x,w,_=0,M=i.type==="FeatureCollection",C=i.type==="Feature",G=M?i.features.length:1;for(t=0;t<G;t++){for(l=M?i.features[t].geometry:C?i.geometry:i,d=M?i.features[t].properties:C?i.properties:{},x=M?i.features[t].bbox:C?i.bbox:void 0,w=M?i.features[t].id:C?i.id:void 0,u=l?l.type==="GeometryCollection":!1,o=u?l.geometries.length:1,s=0;s<o;s++){if(n=u?l.geometries[s]:l,n===null){if(e(null,_,d,x,w)===!1)return!1;continue}switch(n.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(n,_,d,x,w)===!1)return!1;break}case"GeometryCollection":{for(r=0;r<n.geometries.length;r++)if(e(n.geometries[r],_,d,x,w)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}_++}}function Us(i,e){ei(i,function(t,r,s,n,o){var l=t===null?null:t.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return e(et(t,s,{bbox:n,id:o}),r,0)===!1?!1:void 0}var u;switch(l){case"MultiPoint":u="Point";break;case"MultiLineString":u="LineString";break;case"MultiPolygon":u="Polygon";break}for(var d=0;d<t.coordinates.length;d++){var x=t.coordinates[d],w={type:u,coordinates:x};if(e(et(w,s),r,d)===!1)return!1}})}function Bs(i,e={}){if(i.bbox!=null&&e.recompute!==!0)return i.bbox;const t=[1/0,1/0,-1/0,-1/0];return nr(i,r=>{t[0]>r[0]&&(t[0]=r[0]),t[1]>r[1]&&(t[1]=r[1]),t[2]<r[0]&&(t[2]=r[0]),t[3]<r[1]&&(t[3]=r[1])}),t}var ti=Bs,Ds=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ii=Math.ceil,ce=Math.floor,se="[BigNumber Error] ",or=se+"Number primitive has more than 15 significant digits: ",pe=1e14,R=14,ri=9007199254740991,si=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Ce=1e7,X=1e9;function lr(i){var e,t,r,s=L.prototype={constructor:L,toString:null,valueOf:null},n=new L(1),o=20,l=4,u=-7,d=21,x=-1e7,w=1e7,_=!1,M=1,C=0,G={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},N="0123456789abcdefghijklmnopqrstuvwxyz",W=!0;function L(a,c){var h,v,p,g,E,f,m,b,y=this;if(!(y instanceof L))return new L(a,c);if(c==null){if(a&&a._isBigNumber===!0){y.s=a.s,!a.c||a.e>w?y.c=y.e=null:a.e<x?y.c=[y.e=0]:(y.e=a.e,y.c=a.c.slice());return}if((f=typeof a=="number")&&a*0==0){if(y.s=1/a<0?(a=-a,-1):1,a===~~a){for(g=0,E=a;E>=10;E/=10,g++);g>w?y.c=y.e=null:(y.e=g,y.c=[a]);return}b=String(a)}else{if(!Ds.test(b=String(a)))return r(y,b,f);y.s=b.charCodeAt(0)==45?(b=b.slice(1),-1):1}(g=b.indexOf("."))>-1&&(b=b.replace(".","")),(E=b.search(/e/i))>0?(g<0&&(g=E),g+=+b.slice(E+1),b=b.substring(0,E)):g<0&&(g=b.length)}else{if(q(c,2,N.length,"Base"),c==10&&W)return y=new L(a),de(y,o+y.e+1,l);if(b=String(a),f=typeof a=="number"){if(a*0!=0)return r(y,b,f,c);if(y.s=1/a<0?(b=b.slice(1),-1):1,L.DEBUG&&b.replace(/^0\.0*|\./,"").length>15)throw Error(or+a)}else y.s=b.charCodeAt(0)===45?(b=b.slice(1),-1):1;for(h=N.slice(0,c),g=E=0,m=b.length;E<m;E++)if(h.indexOf(v=b.charAt(E))<0){if(v=="."){if(E>g){g=m;continue}}else if(!p&&(b==b.toUpperCase()&&(b=b.toLowerCase())||b==b.toLowerCase()&&(b=b.toUpperCase()))){p=!0,E=-1,g=0;continue}return r(y,String(a),f,c)}f=!1,b=t(b,c,10,y.s),(g=b.indexOf("."))>-1?b=b.replace(".",""):g=b.length}for(E=0;b.charCodeAt(E)===48;E++);for(m=b.length;b.charCodeAt(--m)===48;);if(b=b.slice(E,++m)){if(m-=E,f&&L.DEBUG&&m>15&&(a>ri||a!==ce(a)))throw Error(or+y.s*a);if((g=g-E-1)>w)y.c=y.e=null;else if(g<x)y.c=[y.e=0];else{if(y.e=g,y.c=[],E=(g+1)%R,g<0&&(E+=R),E<m){for(E&&y.c.push(+b.slice(0,E)),m-=R;E<m;)y.c.push(+b.slice(E,E+=R));E=R-(b=b.slice(E)).length}else E-=m;for(;E--;b+="0");y.c.push(+b)}}else y.c=[y.e=0]}L.clone=lr,L.ROUND_UP=0,L.ROUND_DOWN=1,L.ROUND_CEIL=2,L.ROUND_FLOOR=3,L.ROUND_HALF_UP=4,L.ROUND_HALF_DOWN=5,L.ROUND_HALF_EVEN=6,L.ROUND_HALF_CEIL=7,L.ROUND_HALF_FLOOR=8,L.EUCLID=9,L.config=L.set=function(a){var c,h;if(a!=null)if(typeof a=="object"){if(a.hasOwnProperty(c="DECIMAL_PLACES")&&(h=a[c],q(h,0,X,c),o=h),a.hasOwnProperty(c="ROUNDING_MODE")&&(h=a[c],q(h,0,8,c),l=h),a.hasOwnProperty(c="EXPONENTIAL_AT")&&(h=a[c],h&&h.pop?(q(h[0],-X,0,c),q(h[1],0,X,c),u=h[0],d=h[1]):(q(h,-X,X,c),u=-(d=h<0?-h:h))),a.hasOwnProperty(c="RANGE"))if(h=a[c],h&&h.pop)q(h[0],-X,-1,c),q(h[1],1,X,c),x=h[0],w=h[1];else if(q(h,-X,X,c),h)x=-(w=h<0?-h:h);else throw Error(se+c+" cannot be zero: "+h);if(a.hasOwnProperty(c="CRYPTO"))if(h=a[c],h===!!h)if(h)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))_=h;else throw _=!h,Error(se+"crypto unavailable");else _=h;else throw Error(se+c+" not true or false: "+h);if(a.hasOwnProperty(c="MODULO_MODE")&&(h=a[c],q(h,0,9,c),M=h),a.hasOwnProperty(c="POW_PRECISION")&&(h=a[c],q(h,0,X,c),C=h),a.hasOwnProperty(c="FORMAT"))if(h=a[c],typeof h=="object")G=h;else throw Error(se+c+" not an object: "+h);if(a.hasOwnProperty(c="ALPHABET"))if(h=a[c],typeof h=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(h))W=h.slice(0,10)=="0123456789",N=h;else throw Error(se+c+" invalid: "+h)}else throw Error(se+"Object expected: "+a);return{DECIMAL_PLACES:o,ROUNDING_MODE:l,EXPONENTIAL_AT:[u,d],RANGE:[x,w],CRYPTO:_,MODULO_MODE:M,POW_PRECISION:C,FORMAT:G,ALPHABET:N}},L.isBigNumber=function(a){if(!a||a._isBigNumber!==!0)return!1;if(!L.DEBUG)return!0;var c,h,v=a.c,p=a.e,g=a.s;e:if({}.toString.call(v)=="[object Array]"){if((g===1||g===-1)&&p>=-X&&p<=X&&p===ce(p)){if(v[0]===0){if(p===0&&v.length===1)return!0;break e}if(c=(p+1)%R,c<1&&(c+=R),String(v[0]).length==c){for(c=0;c<v.length;c++)if(h=v[c],h<0||h>=pe||h!==ce(h))break e;if(h!==0)return!0}}}else if(v===null&&p===null&&(g===null||g===1||g===-1))return!0;throw Error(se+"Invalid BigNumber: "+a)},L.maximum=L.max=function(){return ne(arguments,-1)},L.minimum=L.min=function(){return ne(arguments,1)},L.random=(function(){var a=9007199254740992,c=Math.random()*a&2097151?function(){return ce(Math.random()*a)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(h){var v,p,g,E,f,m=0,b=[],y=new L(n);if(h==null?h=o:q(h,0,X),E=ii(h/R),_)if(crypto.getRandomValues){for(v=crypto.getRandomValues(new Uint32Array(E*=2));m<E;)f=v[m]*131072+(v[m+1]>>>11),f>=9e15?(p=crypto.getRandomValues(new Uint32Array(2)),v[m]=p[0],v[m+1]=p[1]):(b.push(f%1e14),m+=2);m=E/2}else if(crypto.randomBytes){for(v=crypto.randomBytes(E*=7);m<E;)f=(v[m]&31)*281474976710656+v[m+1]*1099511627776+v[m+2]*4294967296+v[m+3]*16777216+(v[m+4]<<16)+(v[m+5]<<8)+v[m+6],f>=9e15?crypto.randomBytes(7).copy(v,m):(b.push(f%1e14),m+=7);m=E/7}else throw _=!1,Error(se+"crypto unavailable");if(!_)for(;m<E;)f=c(),f<9e15&&(b[m++]=f%1e14);for(E=b[--m],h%=R,E&&h&&(f=si[R-h],b[m]=ce(E/f)*f);b[m]===0;b.pop(),m--);if(m<0)b=[g=0];else{for(g=-1;b[0]===0;b.splice(0,1),g-=R);for(m=1,f=b[0];f>=10;f/=10,m++);m<R&&(g-=R-m)}return y.e=g,y.c=b,y}})(),L.sum=function(){for(var a=1,c=arguments,h=new L(c[0]);a<c.length;)h=h.plus(c[a++]);return h},t=(function(){var a="0123456789";function c(h,v,p,g){for(var E,f=[0],m,b=0,y=h.length;b<y;){for(m=f.length;m--;f[m]*=v);for(f[0]+=g.indexOf(h.charAt(b++)),E=0;E<f.length;E++)f[E]>p-1&&(f[E+1]==null&&(f[E+1]=0),f[E+1]+=f[E]/p|0,f[E]%=p)}return f.reverse()}return function(h,v,p,g,E){var f,m,b,y,S,A,T,D,H=h.indexOf("."),K=o,U=l;for(H>=0&&(y=C,C=0,h=h.replace(".",""),D=new L(v),A=D.pow(h.length-H),C=y,D.c=c(we(ue(A.c),A.e,"0"),10,p,a),D.e=D.c.length),T=c(h,v,p,E?(f=N,a):(f=a,N)),b=y=T.length;T[--y]==0;T.pop());if(!T[0])return f.charAt(0);if(H<0?--b:(A.c=T,A.e=b,A.s=g,A=e(A,D,K,U,p),T=A.c,S=A.r,b=A.e),m=b+K+1,H=T[m],y=p/2,S=S||m<0||T[m+1]!=null,S=U<4?(H!=null||S)&&(U==0||U==(A.s<0?3:2)):H>y||H==y&&(U==4||S||U==6&&T[m-1]&1||U==(A.s<0?8:7)),m<1||!T[0])h=S?we(f.charAt(1),-K,f.charAt(0)):f.charAt(0);else{if(T.length=m,S)for(--p;++T[--m]>p;)T[m]=0,m||(++b,T=[1].concat(T));for(y=T.length;!T[--y];);for(H=0,h="";H<=y;h+=f.charAt(T[H++]));h=we(h,b,f.charAt(0))}return h}})(),e=(function(){function a(v,p,g){var E,f,m,b,y=0,S=v.length,A=p%Ce,T=p/Ce|0;for(v=v.slice();S--;)m=v[S]%Ce,b=v[S]/Ce|0,E=T*m+b*A,f=A*m+E%Ce*Ce+y,y=(f/g|0)+(E/Ce|0)+T*b,v[S]=f%g;return y&&(v=[y].concat(v)),v}function c(v,p,g,E){var f,m;if(g!=E)m=g>E?1:-1;else for(f=m=0;f<g;f++)if(v[f]!=p[f]){m=v[f]>p[f]?1:-1;break}return m}function h(v,p,g,E){for(var f=0;g--;)v[g]-=f,f=v[g]<p[g]?1:0,v[g]=f*E+v[g]-p[g];for(;!v[0]&&v.length>1;v.splice(0,1));}return function(v,p,g,E,f){var m,b,y,S,A,T,D,H,K,U,F,J,Ct,ai,ci,be,nt,fe=v.s==p.s?1:-1,te=v.c,j=p.c;if(!te||!te[0]||!j||!j[0])return new L(!v.s||!p.s||(te?j&&te[0]==j[0]:!j)?NaN:te&&te[0]==0||!j?fe*0:fe/0);for(H=new L(fe),K=H.c=[],b=v.e-p.e,fe=g+b+1,f||(f=pe,b=he(v.e/R)-he(p.e/R),fe=fe/R|0),y=0;j[y]==(te[y]||0);y++);if(j[y]>(te[y]||0)&&b--,fe<0)K.push(1),S=!0;else{for(ai=te.length,be=j.length,y=0,fe+=2,A=ce(f/(j[0]+1)),A>1&&(j=a(j,A,f),te=a(te,A,f),be=j.length,ai=te.length),Ct=be,U=te.slice(0,be),F=U.length;F<be;U[F++]=0);nt=j.slice(),nt=[0].concat(nt),ci=j[0],j[1]>=f/2&&ci++;do{if(A=0,m=c(j,U,be,F),m<0){if(J=U[0],be!=F&&(J=J*f+(U[1]||0)),A=ce(J/ci),A>1)for(A>=f&&(A=f-1),T=a(j,A,f),D=T.length,F=U.length;c(T,U,D,F)==1;)A--,h(T,be<D?nt:j,D,f),D=T.length,m=1;else A==0&&(m=A=1),T=j.slice(),D=T.length;if(D<F&&(T=[0].concat(T)),h(U,T,F,f),F=U.length,m==-1)for(;c(j,U,be,F)<1;)A++,h(U,be<F?nt:j,F,f),F=U.length}else m===0&&(A++,U=[0]);K[y++]=A,U[0]?U[F++]=te[Ct]||0:(U=[te[Ct]],F=1)}while((Ct++<ai||U[0]!=null)&&fe--);S=U[0]!=null,K[0]||K.splice(0,1)}if(f==pe){for(y=1,fe=K[0];fe>=10;fe/=10,y++);de(H,g+(H.e=y+b*R-1)+1,E,S)}else H.e=b,H.r=+S;return H}})();function Q(a,c,h,v){var p,g,E,f,m;if(h==null?h=l:q(h,0,8),!a.c)return a.toString();if(p=a.c[0],E=a.e,c==null)m=ue(a.c),m=v==1||v==2&&(E<=u||E>=d)?xt(m,E):we(m,E,"0");else if(a=de(new L(a),c,h),g=a.e,m=ue(a.c),f=m.length,v==1||v==2&&(c<=g||g<=u)){for(;f<c;m+="0",f++);m=xt(m,g)}else if(c-=E+(v===2&&g>E),m=we(m,g,"0"),g+1>f){if(--c>0)for(m+=".";c--;m+="0");}else if(c+=g-f,c>0)for(g+1==f&&(m+=".");c--;m+="0");return a.s<0&&p?"-"+m:m}function ne(a,c){for(var h,v,p=1,g=new L(a[0]);p<a.length;p++)v=new L(a[p]),(!v.s||(h=Ie(g,v))===c||h===0&&g.s===c)&&(g=v);return g}function ve(a,c,h){for(var v=1,p=c.length;!c[--p];c.pop());for(p=c[0];p>=10;p/=10,v++);return(h=v+h*R-1)>w?a.c=a.e=null:h<x?a.c=[a.e=0]:(a.e=h,a.c=c),a}r=(function(){var a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,c=/^([^.]+)\.$/,h=/^\.([^.]+)$/,v=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(g,E,f,m){var b,y=f?E:E.replace(p,"");if(v.test(y))g.s=isNaN(y)?null:y<0?-1:1;else{if(!f&&(y=y.replace(a,function(S,A,T){return b=(T=T.toLowerCase())=="x"?16:T=="b"?2:8,!m||m==b?A:S}),m&&(b=m,y=y.replace(c,"$1").replace(h,"0.$1")),E!=y))return new L(y,b);if(L.DEBUG)throw Error(se+"Not a"+(m?" base "+m:"")+" number: "+E);g.s=null}g.c=g.e=null}})();function de(a,c,h,v){var p,g,E,f,m,b,y,S=a.c,A=si;if(S){e:{for(p=1,f=S[0];f>=10;f/=10,p++);if(g=c-p,g<0)g+=R,E=c,m=S[b=0],y=ce(m/A[p-E-1]%10);else if(b=ii((g+1)/R),b>=S.length)if(v){for(;S.length<=b;S.push(0));m=y=0,p=1,g%=R,E=g-R+1}else break e;else{for(m=f=S[b],p=1;f>=10;f/=10,p++);g%=R,E=g-R+p,y=E<0?0:ce(m/A[p-E-1]%10)}if(v=v||c<0||S[b+1]!=null||(E<0?m:m%A[p-E-1]),v=h<4?(y||v)&&(h==0||h==(a.s<0?3:2)):y>5||y==5&&(h==4||v||h==6&&(g>0?E>0?m/A[p-E]:0:S[b-1])%10&1||h==(a.s<0?8:7)),c<1||!S[0])return S.length=0,v?(c-=a.e+1,S[0]=A[(R-c%R)%R],a.e=-c||0):S[0]=a.e=0,a;if(g==0?(S.length=b,f=1,b--):(S.length=b+1,f=A[R-g],S[b]=E>0?ce(m/A[p-E]%A[E])*f:0),v)for(;;)if(b==0){for(g=1,E=S[0];E>=10;E/=10,g++);for(E=S[0]+=f,f=1;E>=10;E/=10,f++);g!=f&&(a.e++,S[0]==pe&&(S[0]=1));break}else{if(S[b]+=f,S[b]!=pe)break;S[b--]=0,f=1}for(g=S.length;S[--g]===0;S.pop());}a.e>w?a.c=a.e=null:a.e<x&&(a.c=[a.e=0])}return a}function Se(a){var c,h=a.e;return h===null?a.toString():(c=ue(a.c),c=h<=u||h>=d?xt(c,h):we(c,h,"0"),a.s<0?"-"+c:c)}return s.absoluteValue=s.abs=function(){var a=new L(this);return a.s<0&&(a.s=1),a},s.comparedTo=function(a,c){return Ie(this,new L(a,c))},s.decimalPlaces=s.dp=function(a,c){var h,v,p,g=this;if(a!=null)return q(a,0,X),c==null?c=l:q(c,0,8),de(new L(g),a+g.e+1,c);if(!(h=g.c))return null;if(v=((p=h.length-1)-he(this.e/R))*R,p=h[p])for(;p%10==0;p/=10,v--);return v<0&&(v=0),v},s.dividedBy=s.div=function(a,c){return e(this,new L(a,c),o,l)},s.dividedToIntegerBy=s.idiv=function(a,c){return e(this,new L(a,c),0,1)},s.exponentiatedBy=s.pow=function(a,c){var h,v,p,g,E,f,m,b,y,S=this;if(a=new L(a),a.c&&!a.isInteger())throw Error(se+"Exponent not an integer: "+Se(a));if(c!=null&&(c=new L(c)),f=a.e>14,!S.c||!S.c[0]||S.c[0]==1&&!S.e&&S.c.length==1||!a.c||!a.c[0])return y=new L(Math.pow(+Se(S),f?a.s*(2-wt(a)):+Se(a))),c?y.mod(c):y;if(m=a.s<0,c){if(c.c?!c.c[0]:!c.s)return new L(NaN);v=!m&&S.isInteger()&&c.isInteger(),v&&(S=S.mod(c))}else{if(a.e>9&&(S.e>0||S.e<-1||(S.e==0?S.c[0]>1||f&&S.c[1]>=24e7:S.c[0]<8e13||f&&S.c[0]<=9999975e7)))return g=S.s<0&&wt(a)?-0:0,S.e>-1&&(g=1/g),new L(m?1/g:g);C&&(g=ii(C/R+2))}for(f?(h=new L(.5),m&&(a.s=1),b=wt(a)):(p=Math.abs(+Se(a)),b=p%2),y=new L(n);;){if(b){if(y=y.times(S),!y.c)break;g?y.c.length>g&&(y.c.length=g):v&&(y=y.mod(c))}if(p){if(p=ce(p/2),p===0)break;b=p%2}else if(a=a.times(h),de(a,a.e+1,1),a.e>14)b=wt(a);else{if(p=+Se(a),p===0)break;b=p%2}S=S.times(S),g?S.c&&S.c.length>g&&(S.c.length=g):v&&(S=S.mod(c))}return v?y:(m&&(y=n.div(y)),c?y.mod(c):g?de(y,C,l,E):y)},s.integerValue=function(a){var c=new L(this);return a==null?a=l:q(a,0,8),de(c,c.e+1,a)},s.isEqualTo=s.eq=function(a,c){return Ie(this,new L(a,c))===0},s.isFinite=function(){return!!this.c},s.isGreaterThan=s.gt=function(a,c){return Ie(this,new L(a,c))>0},s.isGreaterThanOrEqualTo=s.gte=function(a,c){return(c=Ie(this,new L(a,c)))===1||c===0},s.isInteger=function(){return!!this.c&&he(this.e/R)>this.c.length-2},s.isLessThan=s.lt=function(a,c){return Ie(this,new L(a,c))<0},s.isLessThanOrEqualTo=s.lte=function(a,c){return(c=Ie(this,new L(a,c)))===-1||c===0},s.isNaN=function(){return!this.s},s.isNegative=function(){return this.s<0},s.isPositive=function(){return this.s>0},s.isZero=function(){return!!this.c&&this.c[0]==0},s.minus=function(a,c){var h,v,p,g,E=this,f=E.s;if(a=new L(a,c),c=a.s,!f||!c)return new L(NaN);if(f!=c)return a.s=-c,E.plus(a);var m=E.e/R,b=a.e/R,y=E.c,S=a.c;if(!m||!b){if(!y||!S)return y?(a.s=-c,a):new L(S?E:NaN);if(!y[0]||!S[0])return S[0]?(a.s=-c,a):new L(y[0]?E:l==3?-0:0)}if(m=he(m),b=he(b),y=y.slice(),f=m-b){for((g=f<0)?(f=-f,p=y):(b=m,p=S),p.reverse(),c=f;c--;p.push(0));p.reverse()}else for(v=(g=(f=y.length)<(c=S.length))?f:c,f=c=0;c<v;c++)if(y[c]!=S[c]){g=y[c]<S[c];break}if(g&&(p=y,y=S,S=p,a.s=-a.s),c=(v=S.length)-(h=y.length),c>0)for(;c--;y[h++]=0);for(c=pe-1;v>f;){if(y[--v]<S[v]){for(h=v;h&&!y[--h];y[h]=c);--y[h],y[v]+=pe}y[v]-=S[v]}for(;y[0]==0;y.splice(0,1),--b);return y[0]?ve(a,y,b):(a.s=l==3?-1:1,a.c=[a.e=0],a)},s.modulo=s.mod=function(a,c){var h,v,p=this;return a=new L(a,c),!p.c||!a.s||a.c&&!a.c[0]?new L(NaN):!a.c||p.c&&!p.c[0]?new L(p):(M==9?(v=a.s,a.s=1,h=e(p,a,0,3),a.s=v,h.s*=v):h=e(p,a,0,M),a=p.minus(h.times(a)),!a.c[0]&&M==1&&(a.s=p.s),a)},s.multipliedBy=s.times=function(a,c){var h,v,p,g,E,f,m,b,y,S,A,T,D,H,K,U=this,F=U.c,J=(a=new L(a,c)).c;if(!F||!J||!F[0]||!J[0])return!U.s||!a.s||F&&!F[0]&&!J||J&&!J[0]&&!F?a.c=a.e=a.s=null:(a.s*=U.s,!F||!J?a.c=a.e=null:(a.c=[0],a.e=0)),a;for(v=he(U.e/R)+he(a.e/R),a.s*=U.s,m=F.length,S=J.length,m<S&&(D=F,F=J,J=D,p=m,m=S,S=p),p=m+S,D=[];p--;D.push(0));for(H=pe,K=Ce,p=S;--p>=0;){for(h=0,A=J[p]%K,T=J[p]/K|0,E=m,g=p+E;g>p;)b=F[--E]%K,y=F[E]/K|0,f=T*b+y*A,b=A*b+f%K*K+D[g]+h,h=(b/H|0)+(f/K|0)+T*y,D[g--]=b%H;D[g]=h}return h?++v:D.splice(0,1),ve(a,D,v)},s.negated=function(){var a=new L(this);return a.s=-a.s||null,a},s.plus=function(a,c){var h,v=this,p=v.s;if(a=new L(a,c),c=a.s,!p||!c)return new L(NaN);if(p!=c)return a.s=-c,v.minus(a);var g=v.e/R,E=a.e/R,f=v.c,m=a.c;if(!g||!E){if(!f||!m)return new L(p/0);if(!f[0]||!m[0])return m[0]?a:new L(f[0]?v:p*0)}if(g=he(g),E=he(E),f=f.slice(),p=g-E){for(p>0?(E=g,h=m):(p=-p,h=f),h.reverse();p--;h.push(0));h.reverse()}for(p=f.length,c=m.length,p-c<0&&(h=m,m=f,f=h,c=p),p=0;c;)p=(f[--c]=f[c]+m[c]+p)/pe|0,f[c]=pe===f[c]?0:f[c]%pe;return p&&(f=[p].concat(f),++E),ve(a,f,E)},s.precision=s.sd=function(a,c){var h,v,p,g=this;if(a!=null&&a!==!!a)return q(a,1,X),c==null?c=l:q(c,0,8),de(new L(g),a,c);if(!(h=g.c))return null;if(p=h.length-1,v=p*R+1,p=h[p]){for(;p%10==0;p/=10,v--);for(p=h[0];p>=10;p/=10,v++);}return a&&g.e+1>v&&(v=g.e+1),v},s.shiftedBy=function(a){return q(a,-ri,ri),this.times("1e"+a)},s.squareRoot=s.sqrt=function(){var a,c,h,v,p,g=this,E=g.c,f=g.s,m=g.e,b=o+4,y=new L("0.5");if(f!==1||!E||!E[0])return new L(!f||f<0&&(!E||E[0])?NaN:E?g:1/0);if(f=Math.sqrt(+Se(g)),f==0||f==1/0?(c=ue(E),(c.length+m)%2==0&&(c+="0"),f=Math.sqrt(+c),m=he((m+1)/2)-(m<0||m%2),f==1/0?c="5e"+m:(c=f.toExponential(),c=c.slice(0,c.indexOf("e")+1)+m),h=new L(c)):h=new L(f+""),h.c[0]){for(m=h.e,f=m+b,f<3&&(f=0);;)if(p=h,h=y.times(p.plus(e(g,p,b,1))),ue(p.c).slice(0,f)===(c=ue(h.c)).slice(0,f))if(h.e<m&&--f,c=c.slice(f-3,f+1),c=="9999"||!v&&c=="4999"){if(!v&&(de(p,p.e+o+2,0),p.times(p).eq(g))){h=p;break}b+=4,f+=4,v=1}else{(!+c||!+c.slice(1)&&c.charAt(0)=="5")&&(de(h,h.e+o+2,1),a=!h.times(h).eq(g));break}}return de(h,h.e+o+1,l,a)},s.toExponential=function(a,c){return a!=null&&(q(a,0,X),a++),Q(this,a,c,1)},s.toFixed=function(a,c){return a!=null&&(q(a,0,X),a=a+this.e+1),Q(this,a,c)},s.toFormat=function(a,c,h){var v,p=this;if(h==null)a!=null&&c&&typeof c=="object"?(h=c,c=null):a&&typeof a=="object"?(h=a,a=c=null):h=G;else if(typeof h!="object")throw Error(se+"Argument not an object: "+h);if(v=p.toFixed(a,c),p.c){var g,E=v.split("."),f=+h.groupSize,m=+h.secondaryGroupSize,b=h.groupSeparator||"",y=E[0],S=E[1],A=p.s<0,T=A?y.slice(1):y,D=T.length;if(m&&(g=f,f=m,m=g,D-=g),f>0&&D>0){for(g=D%f||f,y=T.substr(0,g);g<D;g+=f)y+=b+T.substr(g,f);m>0&&(y+=b+T.slice(g)),A&&(y="-"+y)}v=S?y+(h.decimalSeparator||"")+((m=+h.fractionGroupSize)?S.replace(new RegExp("\\d{"+m+"}\\B","g"),"$&"+(h.fractionGroupSeparator||"")):S):y}return(h.prefix||"")+v+(h.suffix||"")},s.toFraction=function(a){var c,h,v,p,g,E,f,m,b,y,S,A,T=this,D=T.c;if(a!=null&&(f=new L(a),!f.isInteger()&&(f.c||f.s!==1)||f.lt(n)))throw Error(se+"Argument "+(f.isInteger()?"out of range: ":"not an integer: ")+Se(f));if(!D)return new L(T);for(c=new L(n),b=h=new L(n),v=m=new L(n),A=ue(D),g=c.e=A.length-T.e-1,c.c[0]=si[(E=g%R)<0?R+E:E],a=!a||f.comparedTo(c)>0?g>0?c:b:f,E=w,w=1/0,f=new L(A),m.c[0]=0;y=e(f,c,0,1),p=h.plus(y.times(v)),p.comparedTo(a)!=1;)h=v,v=p,b=m.plus(y.times(p=b)),m=p,c=f.minus(y.times(p=c)),f=p;return p=e(a.minus(h),v,0,1),m=m.plus(p.times(b)),h=h.plus(p.times(v)),m.s=b.s=T.s,g=g*2,S=e(b,v,g,l).minus(T).abs().comparedTo(e(m,h,g,l).minus(T).abs())<1?[b,v]:[m,h],w=E,S},s.toNumber=function(){return+Se(this)},s.toPrecision=function(a,c){return a!=null&&q(a,1,X),Q(this,a,c,2)},s.toString=function(a){var c,h=this,v=h.s,p=h.e;return p===null?v?(c="Infinity",v<0&&(c="-"+c)):c="NaN":(a==null?c=p<=u||p>=d?xt(ue(h.c),p):we(ue(h.c),p,"0"):a===10&&W?(h=de(new L(h),o+p+1,l),c=we(ue(h.c),h.e,"0")):(q(a,2,N.length,"Base"),c=t(we(ue(h.c),p,"0"),10,a,v,!0)),v<0&&h.c[0]&&(c="-"+c)),c},s.valueOf=s.toJSON=function(){return Se(this)},s._isBigNumber=!0,s[Symbol.toStringTag]="BigNumber",s[Symbol.for("nodejs.util.inspect.custom")]=s.valueOf,i!=null&&L.set(i),L}function he(i){var e=i|0;return i>0||i===e?e:e-1}function ue(i){for(var e,t,r=1,s=i.length,n=i[0]+"";r<s;){for(e=i[r++]+"",t=R-e.length;t--;e="0"+e);n+=e}for(s=n.length;n.charCodeAt(--s)===48;);return n.slice(0,s+1||1)}function Ie(i,e){var t,r,s=i.c,n=e.c,o=i.s,l=e.s,u=i.e,d=e.e;if(!o||!l)return null;if(t=s&&!s[0],r=n&&!n[0],t||r)return t?r?0:-l:o;if(o!=l)return o;if(t=o<0,r=u==d,!s||!n)return r?0:!s^t?1:-1;if(!r)return u>d^t?1:-1;for(l=(u=s.length)<(d=n.length)?u:d,o=0;o<l;o++)if(s[o]!=n[o])return s[o]>n[o]^t?1:-1;return u==d?0:u>d^t?1:-1}function q(i,e,t,r){if(i<e||i>t||i!==ce(i))throw Error(se+(r||"Argument")+(typeof i=="number"?i<e||i>t?" out of range: ":" not an integer: ":" not a primitive number: ")+String(i))}function wt(i){var e=i.c.length-1;return he(i.e/R)==e&&i.c[e]%2!=0}function xt(i,e){return(i.length>1?i.charAt(0)+"."+i.slice(1):i)+(e<0?"e":"e+")+e}function we(i,e,t){var r,s;if(e<0){for(s=t+".";++e;s+=t);i=s+i}else if(r=i.length,++e>r){for(s=t,e-=r;--e;s+=t);i+=s}else e<r&&(i=i.slice(0,e)+"."+i.slice(e));return i}var ge=lr(),Fs=class{key;left=null;right=null;constructor(i){this.key=i}},it=class extends Fs{constructor(i){super(i)}},Ws=class{size=0;modificationCount=0;splayCount=0;splay(i){const e=this.root;if(e==null)return this.compare(i,i),-1;let t=null,r=null,s=null,n=null,o=e;const l=this.compare;let u;for(;;)if(u=l(o.key,i),u>0){let d=o.left;if(d==null||(u=l(d.key,i),u>0&&(o.left=d.right,d.right=o,o=d,d=o.left,d==null)))break;t==null?r=o:t.left=o,t=o,o=d}else if(u<0){let d=o.right;if(d==null||(u=l(d.key,i),u<0&&(o.right=d.left,d.left=o,o=d,d=o.right,d==null)))break;s==null?n=o:s.right=o,s=o,o=d}else break;return s!=null&&(s.right=o.left,o.left=n),t!=null&&(t.left=o.right,o.right=r),this.root!==o&&(this.root=o,this.splayCount++),u}splayMin(i){let e=i,t=e.left;for(;t!=null;){const r=t;e.left=r.right,r.right=e,e=r,t=e.left}return e}splayMax(i){let e=i,t=e.right;for(;t!=null;){const r=t;e.right=r.left,r.left=e,e=r,t=e.right}return e}_delete(i){if(this.root==null||this.splay(i)!=0)return null;let t=this.root;const r=t,s=t.left;if(this.size--,s==null)this.root=t.right;else{const n=t.right;t=this.splayMax(s),t.right=n,this.root=t}return this.modificationCount++,r}addNewRoot(i,e){this.size++,this.modificationCount++;const t=this.root;if(t==null){this.root=i;return}e<0?(i.left=t,i.right=t.right,t.right=null):(i.right=t,i.left=t.left,t.left=null),this.root=i}_first(){const i=this.root;return i==null?null:(this.root=this.splayMin(i),this.root)}_last(){const i=this.root;return i==null?null:(this.root=this.splayMax(i),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(i){return this.validKey(i)&&this.splay(i)==0}defaultCompare(){return(i,e)=>i<e?-1:i>e?1:0}wrap(){return{getRoot:()=>this.root,setRoot:i=>{this.root=i},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:i=>{this.splayCount=i},splay:i=>this.splay(i),has:i=>this.has(i)}}},St=class ot extends Ws{root=null;compare;validKey;constructor(e,t){super(),this.compare=e??this.defaultCompare(),this.validKey=t??(r=>r!=null&&r!=null)}delete(e){return this.validKey(e)?this._delete(e)!=null:!1}deleteAll(e){for(const t of e)this.delete(t)}forEach(e){const t=this[Symbol.iterator]();let r;for(;r=t.next(),!r.done;)e(r.value,r.value,this)}add(e){const t=this.splay(e);return t!=0&&this.addNewRoot(new it(e),t),this}addAndReturn(e){const t=this.splay(e);return t!=0&&this.addNewRoot(new it(e),t),this.root.key}addAll(e){for(const t of e)this.add(t)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(this.size==0)throw"Bad state: No element";return this._first().key}last(){if(this.size==0)throw"Bad state: No element";return this._last().key}lastBefore(e){if(e==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(e)<0)return this.root.key;let r=this.root.left;if(r==null)return null;let s=r.right;for(;s!=null;)r=s,s=r.right;return r.key}firstAfter(e){if(e==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(e)>0)return this.root.key;let r=this.root.right;if(r==null)return null;let s=r.left;for(;s!=null;)r=s,s=r.left;return r.key}retainAll(e){const t=new ot(this.compare,this.validKey),r=this.modificationCount;for(const s of e){if(r!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(s)&&this.splay(s)==0&&t.add(this.root.key)}t.size!=this.size&&(this.root=t.root,this.size=t.size,this.modificationCount++)}lookup(e){return!this.validKey(e)||this.splay(e)!=0?null:this.root.key}intersection(e){const t=new ot(this.compare,this.validKey);for(const r of this)e.has(r)&&t.add(r);return t}difference(e){const t=new ot(this.compare,this.validKey);for(const r of this)e.has(r)||t.add(r);return t}union(e){const t=this.clone();return t.addAll(e),t}clone(){const e=new ot(this.compare,this.validKey);return e.size=this.size,e.root=this.copyNode(this.root),e}copyNode(e){if(e==null)return null;function t(s,n){let o,l;do{if(o=s.left,l=s.right,o!=null){const u=new it(o.key);n.left=u,t(o,u)}if(l!=null){const u=new it(l.key);n.right=u,s=l,n=u}}while(l!=null)}const r=new it(e.key);return t(e,r),r}toSet(){return this.clone()}entries(){return new qs(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[Symbol.iterator](){return new zs(this.wrap())}[Symbol.toStringTag]="[object Set]"},ar=class{tree;path=new Array;modificationCount=null;splayCount;constructor(i){this.tree=i,this.splayCount=i.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;const i=this.path[this.path.length-1];return this.getValue(i)}rebuildPath(i){this.path.splice(0,this.path.length),this.tree.splay(i),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(i){for(;i!=null;)this.path.push(i),i=i.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let t=this.tree.getRoot();for(;t!=null;)this.path.push(t),t=t.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let i=this.path[this.path.length-1],e=i.right;if(e!=null){for(;e!=null;)this.path.push(e),e=e.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===i;)i=this.path.pop();return this.path.length>0}},zs=class extends ar{getValue(i){return i.key}},qs=class extends ar{getValue(i){return[i.key,i.key]}},cr=i=>()=>i,ni=i=>{const e=i?(t,r)=>r.minus(t).abs().isLessThanOrEqualTo(i):cr(!1);return(t,r)=>e(t,r)?0:t.comparedTo(r)};function Hs(i){const e=i?(t,r,s,n,o)=>t.exponentiatedBy(2).isLessThanOrEqualTo(n.minus(r).exponentiatedBy(2).plus(o.minus(s).exponentiatedBy(2)).times(i)):cr(!1);return(t,r,s)=>{const n=t.x,o=t.y,l=s.x,u=s.y,d=o.minus(u).times(r.x.minus(l)).minus(n.minus(l).times(r.y.minus(u)));return e(d,n,o,l,u)?0:d.comparedTo(0)}}var js=i=>i,Vs=i=>{if(i){const e=new St(ni(i)),t=new St(ni(i)),r=(n,o)=>o.addAndReturn(n),s=n=>({x:r(n.x,e),y:r(n.y,t)});return s({x:new ge(0),y:new ge(0)}),s}return js},oi=i=>({set:e=>{xe=oi(e)},reset:()=>oi(i),compare:ni(i),snap:Vs(i),orient:Hs(i)}),xe=oi(),rt=(i,e)=>i.ll.x.isLessThanOrEqualTo(e.x)&&e.x.isLessThanOrEqualTo(i.ur.x)&&i.ll.y.isLessThanOrEqualTo(e.y)&&e.y.isLessThanOrEqualTo(i.ur.y),li=(i,e)=>{if(e.ur.x.isLessThan(i.ll.x)||i.ur.x.isLessThan(e.ll.x)||e.ur.y.isLessThan(i.ll.y)||i.ur.y.isLessThan(e.ll.y))return null;const t=i.ll.x.isLessThan(e.ll.x)?e.ll.x:i.ll.x,r=i.ur.x.isLessThan(e.ur.x)?i.ur.x:e.ur.x,s=i.ll.y.isLessThan(e.ll.y)?e.ll.y:i.ll.y,n=i.ur.y.isLessThan(e.ur.y)?i.ur.y:e.ur.y;return{ll:{x:t,y:s},ur:{x:r,y:n}}},Lt=(i,e)=>i.x.times(e.y).minus(i.y.times(e.x)),hr=(i,e)=>i.x.times(e.x).plus(i.y.times(e.y)),_t=i=>hr(i,i).sqrt(),Zs=(i,e,t)=>{const r={x:e.x.minus(i.x),y:e.y.minus(i.y)},s={x:t.x.minus(i.x),y:t.y.minus(i.y)};return Lt(s,r).div(_t(s)).div(_t(r))},Ks=(i,e,t)=>{const r={x:e.x.minus(i.x),y:e.y.minus(i.y)},s={x:t.x.minus(i.x),y:t.y.minus(i.y)};return hr(s,r).div(_t(s)).div(_t(r))},ur=(i,e,t)=>e.y.isZero()?null:{x:i.x.plus(e.x.div(e.y).times(t.minus(i.y))),y:t},dr=(i,e,t)=>e.x.isZero()?null:{x:t,y:i.y.plus(e.y.div(e.x).times(t.minus(i.x)))},Ys=(i,e,t,r)=>{if(e.x.isZero())return dr(t,r,i.x);if(r.x.isZero())return dr(i,e,t.x);if(e.y.isZero())return ur(t,r,i.y);if(r.y.isZero())return ur(i,e,t.y);const s=Lt(e,r);if(s.isZero())return null;const n={x:t.x.minus(i.x),y:t.y.minus(i.y)},o=Lt(n,e).div(s),l=Lt(n,r).div(s),u=i.x.plus(l.times(e.x)),d=t.x.plus(o.times(r.x)),x=i.y.plus(l.times(e.y)),w=t.y.plus(o.times(r.y)),_=u.plus(d).div(2),M=x.plus(w).div(2);return{x:_,y:M}},ye=class xr{point;isLeft;segment;otherSE;consumedBy;static compare(e,t){const r=xr.comparePoints(e.point,t.point);return r!==0?r:(e.point!==t.point&&e.link(t),e.isLeft!==t.isLeft?e.isLeft?1:-1:Mt.compare(e.segment,t.segment))}static comparePoints(e,t){return e.x.isLessThan(t.x)?-1:e.x.isGreaterThan(t.x)?1:e.y.isLessThan(t.y)?-1:e.y.isGreaterThan(t.y)?1:0}constructor(e,t){e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=t}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");const t=e.point.events;for(let r=0,s=t.length;r<s;r++){const n=t[r];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){const e=this.point.events.length;for(let t=0;t<e;t++){const r=this.point.events[t];if(r.segment.consumedBy===void 0)for(let s=t+1;s<e;s++){const n=this.point.events[s];n.consumedBy===void 0&&r.otherSE.point.events===n.otherSE.point.events&&r.segment.consume(n.segment)}}}getAvailableLinkedEvents(){const e=[];for(let t=0,r=this.point.events.length;t<r;t++){const s=this.point.events[t];s!==this&&!s.segment.ringOut&&s.segment.isInResult()&&e.push(s)}return e}getLeftmostComparator(e){const t=new Map,r=s=>{const n=s.otherSE;t.set(s,{sine:Zs(this.point,e.point,n.point),cosine:Ks(this.point,e.point,n.point)})};return(s,n)=>{t.has(s)||r(s),t.has(n)||r(n);const{sine:o,cosine:l}=t.get(s),{sine:u,cosine:d}=t.get(n);return o.isGreaterThanOrEqualTo(0)&&u.isGreaterThanOrEqualTo(0)?l.isLessThan(d)?1:l.isGreaterThan(d)?-1:0:o.isLessThan(0)&&u.isLessThan(0)?l.isLessThan(d)?-1:l.isGreaterThan(d)?1:0:u.isLessThan(o)?-1:u.isGreaterThan(o)?1:0}}},Xs=class hi{events;poly;_isExteriorRing;_enclosingRing;static factory(e){const t=[];for(let r=0,s=e.length;r<s;r++){const n=e[r];if(!n.isInResult()||n.ringOut)continue;let o=null,l=n.leftSE,u=n.rightSE;const d=[l],x=l.point,w=[];for(;o=l,l=u,d.push(l),l.point!==x;)for(;;){const _=l.getAvailableLinkedEvents();if(_.length===0){const G=d[0].point,N=d[d.length-1].point;throw new Error(`Unable to complete output ring starting at [${G.x}, ${G.y}]. Last matching segment found ends at [${N.x}, ${N.y}].`)}if(_.length===1){u=_[0].otherSE;break}let M=null;for(let G=0,N=w.length;G<N;G++)if(w[G].point===l.point){M=G;break}if(M!==null){const G=w.splice(M)[0],N=d.splice(G.index);N.unshift(N[0].otherSE),t.push(new hi(N.reverse()));continue}w.push({index:d.length,point:l.point});const C=l.getLeftmostComparator(o);u=_.sort(C)[0].otherSE;break}t.push(new hi(d))}return t}constructor(e){this.events=e;for(let t=0,r=e.length;t<r;t++)e[t].segment.ringOut=this;this.poly=null}getGeom(){let e=this.events[0].point;const t=[e];for(let d=1,x=this.events.length-1;d<x;d++){const w=this.events[d].point,_=this.events[d+1].point;xe.orient(w,e,_)!==0&&(t.push(w),e=w)}if(t.length===1)return null;const r=t[0],s=t[1];xe.orient(r,e,s)===0&&t.shift(),t.push(t[0]);const n=this.isExteriorRing()?1:-1,o=this.isExteriorRing()?0:t.length-1,l=this.isExteriorRing()?t.length:-1,u=[];for(let d=o;d!=l;d+=n)u.push([t[d].x.toNumber(),t[d].y.toNumber()]);return u}isExteriorRing(){if(this._isExteriorRing===void 0){const e=this.enclosingRing();this._isExteriorRing=e?!e.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let e=this.events[0];for(let s=1,n=this.events.length;s<n;s++){const o=this.events[s];ye.compare(e,o)>0&&(e=o)}let t=e.segment.prevInResult(),r=t?t.prevInResult():null;for(;;){if(!t)return null;if(!r)return t.ringOut;if(r.ringOut!==t.ringOut)return r.ringOut?.enclosingRing()!==t.ringOut?t.ringOut:t.ringOut?.enclosingRing();t=r.prevInResult(),r=t?t.prevInResult():null}}},fr=class{exteriorRing;interiorRings;constructor(i){this.exteriorRing=i,i.poly=this,this.interiorRings=[]}addInterior(i){this.interiorRings.push(i),i.poly=this}getGeom(){const i=this.exteriorRing.getGeom();if(i===null)return null;const e=[i];for(let t=0,r=this.interiorRings.length;t<r;t++){const s=this.interiorRings[t].getGeom();s!==null&&e.push(s)}return e}},Qs=class{rings;polys;constructor(i){this.rings=i,this.polys=this._composePolys(i)}getGeom(){const i=[];for(let e=0,t=this.polys.length;e<t;e++){const r=this.polys[e].getGeom();r!==null&&i.push(r)}return i}_composePolys(i){const e=[];for(let t=0,r=i.length;t<r;t++){const s=i[t];if(!s.poly)if(s.isExteriorRing())e.push(new fr(s));else{const n=s.enclosingRing();n?.poly||e.push(new fr(n)),n?.poly?.addInterior(s)}}return e}},Js=class{queue;tree;segments;constructor(i,e=Mt.compare){this.queue=i,this.tree=new St(e),this.segments=[]}process(i){const e=i.segment,t=[];if(i.consumedBy)return i.isLeft?this.queue.delete(i.otherSE):this.tree.delete(e),t;i.isLeft&&this.tree.add(e);let r=e,s=e;do r=this.tree.lastBefore(r);while(r!=null&&r.consumedBy!=null);do s=this.tree.firstAfter(s);while(s!=null&&s.consumedBy!=null);if(i.isLeft){let n=null;if(r){const l=r.getIntersection(e);if(l!==null&&(e.isAnEndpoint(l)||(n=l),!r.isAnEndpoint(l))){const u=this._splitSafely(r,l);for(let d=0,x=u.length;d<x;d++)t.push(u[d])}}let o=null;if(s){const l=s.getIntersection(e);if(l!==null&&(e.isAnEndpoint(l)||(o=l),!s.isAnEndpoint(l))){const u=this._splitSafely(s,l);for(let d=0,x=u.length;d<x;d++)t.push(u[d])}}if(n!==null||o!==null){let l=null;n===null?l=o:o===null?l=n:l=ye.comparePoints(n,o)<=0?n:o,this.queue.delete(e.rightSE),t.push(e.rightSE);const u=e.split(l);for(let d=0,x=u.length;d<x;d++)t.push(u[d])}t.length>0?(this.tree.delete(e),t.push(i)):(this.segments.push(e),e.prev=r)}else{if(r&&s){const n=r.getIntersection(s);if(n!==null){if(!r.isAnEndpoint(n)){const o=this._splitSafely(r,n);for(let l=0,u=o.length;l<u;l++)t.push(o[l])}if(!s.isAnEndpoint(n)){const o=this._splitSafely(s,n);for(let l=0,u=o.length;l<u;l++)t.push(o[l])}}}this.tree.delete(e)}return t}_splitSafely(i,e){this.tree.delete(i);const t=i.rightSE;this.queue.delete(t);const r=i.split(e);return r.push(t),i.consumedBy===void 0&&this.tree.add(i),r}},en=class{type;numMultiPolys;run(i,e,t){st.type=i;const r=[new mr(e,!0)];for(let d=0,x=t.length;d<x;d++)r.push(new mr(t[d],!1));if(st.numMultiPolys=r.length,st.type==="difference"){const d=r[0];let x=1;for(;x<r.length;)li(r[x].bbox,d.bbox)!==null?x++:r.splice(x,1)}if(st.type==="intersection")for(let d=0,x=r.length;d<x;d++){const w=r[d];for(let _=d+1,M=r.length;_<M;_++)if(li(w.bbox,r[_].bbox)===null)return[]}const s=new St(ye.compare);for(let d=0,x=r.length;d<x;d++){const w=r[d].getSweepEvents();for(let _=0,M=w.length;_<M;_++)s.add(w[_])}const n=new Js(s);let o=null;for(s.size!=0&&(o=s.first(),s.delete(o));o;){const d=n.process(o);for(let x=0,w=d.length;x<w;x++){const _=d[x];_.consumedBy===void 0&&s.add(_)}s.size!=0?(o=s.first(),s.delete(o)):o=null}xe.reset();const l=Xs.factory(n.segments);return new Qs(l).getGeom()}},st=new en,$t=st,tn=0,Mt=class At{id;leftSE;rightSE;rings;windings;ringOut;consumedBy;prev;_prevInResult;_beforeState;_afterState;_isInResult;static compare(e,t){const r=e.leftSE.point.x,s=t.leftSE.point.x,n=e.rightSE.point.x,o=t.rightSE.point.x;if(o.isLessThan(r))return 1;if(n.isLessThan(s))return-1;const l=e.leftSE.point.y,u=t.leftSE.point.y,d=e.rightSE.point.y,x=t.rightSE.point.y;if(r.isLessThan(s)){if(u.isLessThan(l)&&u.isLessThan(d))return 1;if(u.isGreaterThan(l)&&u.isGreaterThan(d))return-1;const w=e.comparePoint(t.leftSE.point);if(w<0)return 1;if(w>0)return-1;const _=t.comparePoint(e.rightSE.point);return _!==0?_:-1}if(r.isGreaterThan(s)){if(l.isLessThan(u)&&l.isLessThan(x))return-1;if(l.isGreaterThan(u)&&l.isGreaterThan(x))return 1;const w=t.comparePoint(e.leftSE.point);if(w!==0)return w;const _=e.comparePoint(t.rightSE.point);return _<0?1:_>0?-1:1}if(l.isLessThan(u))return-1;if(l.isGreaterThan(u))return 1;if(n.isLessThan(o)){const w=t.comparePoint(e.rightSE.point);if(w!==0)return w}if(n.isGreaterThan(o)){const w=e.comparePoint(t.rightSE.point);if(w<0)return 1;if(w>0)return-1}if(!n.eq(o)){const w=d.minus(l),_=n.minus(r),M=x.minus(u),C=o.minus(s);if(w.isGreaterThan(_)&&M.isLessThan(C))return 1;if(w.isLessThan(_)&&M.isGreaterThan(C))return-1}return n.isGreaterThan(o)?1:n.isLessThan(o)||d.isLessThan(x)?-1:d.isGreaterThan(x)?1:e.id<t.id?-1:e.id>t.id?1:0}constructor(e,t,r,s){this.id=++tn,this.leftSE=e,e.segment=this,e.otherSE=t,this.rightSE=t,t.segment=this,t.otherSE=e,this.rings=r,this.windings=s}static fromRing(e,t,r){let s,n,o;const l=ye.comparePoints(e,t);if(l<0)s=e,n=t,o=1;else if(l>0)s=t,n=e,o=-1;else throw new Error(`Tried to create degenerate segment at [${e.x}, ${e.y}]`);const u=new ye(s,!0),d=new ye(n,!1);return new At(u,d,[r],[o])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const e=this.leftSE.point.y,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e.isLessThan(t)?e:t},ur:{x:this.rightSE.point.x,y:e.isGreaterThan(t)?e:t}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(e){return e.x.eq(this.leftSE.point.x)&&e.y.eq(this.leftSE.point.y)||e.x.eq(this.rightSE.point.x)&&e.y.eq(this.rightSE.point.y)}comparePoint(e){return xe.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){const t=this.bbox(),r=e.bbox(),s=li(t,r);if(s===null)return null;const n=this.leftSE.point,o=this.rightSE.point,l=e.leftSE.point,u=e.rightSE.point,d=rt(t,l)&&this.comparePoint(l)===0,x=rt(r,n)&&e.comparePoint(n)===0,w=rt(t,u)&&this.comparePoint(u)===0,_=rt(r,o)&&e.comparePoint(o)===0;if(x&&d)return _&&!w?o:!_&&w?u:null;if(x)return w&&n.x.eq(u.x)&&n.y.eq(u.y)?null:n;if(d)return _&&o.x.eq(l.x)&&o.y.eq(l.y)?null:l;if(_&&w)return null;if(_)return o;if(w)return u;const M=Ys(n,this.vector(),l,e.vector());return M===null||!rt(s,M)?null:xe.snap(M)}split(e){const t=[],r=e.events!==void 0,s=new ye(e,!0),n=new ye(e,!1),o=this.rightSE;this.replaceRightSE(n),t.push(n),t.push(s);const l=new At(s,o,this.rings.slice(),this.windings.slice());return ye.comparePoints(l.leftSE.point,l.rightSE.point)>0&&l.swapEvents(),ye.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(s.checkForConsuming(),n.checkForConsuming()),t}swapEvents(){const e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let t=0,r=this.windings.length;t<r;t++)this.windings[t]*=-1}consume(e){let t=this,r=e;for(;t.consumedBy;)t=t.consumedBy;for(;r.consumedBy;)r=r.consumedBy;const s=At.compare(t,r);if(s!==0){if(s>0){const n=t;t=r,r=n}if(t.prev===r){const n=t;t=r,r=n}for(let n=0,o=r.rings.length;n<o;n++){const l=r.rings[n],u=r.windings[n],d=t.rings.indexOf(l);d===-1?(t.rings.push(l),t.windings.push(u)):t.windings[d]+=u}r.rings=null,r.windings=null,r.consumedBy=t,r.leftSE.consumedBy=t.leftSE,r.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{const e=this.prev.consumedBy||this.prev;this._beforeState=e.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};const t=this._afterState.rings,r=this._afterState.windings,s=this._afterState.multiPolys;for(let l=0,u=this.rings.length;l<u;l++){const d=this.rings[l],x=this.windings[l],w=t.indexOf(d);w===-1?(t.push(d),r.push(x)):r[w]+=x}const n=[],o=[];for(let l=0,u=t.length;l<u;l++){if(r[l]===0)continue;const d=t[l],x=d.poly;if(o.indexOf(x)===-1)if(d.isExterior)n.push(x);else{o.indexOf(x)===-1&&o.push(x);const w=n.indexOf(d.poly);w!==-1&&n.splice(w,1)}}for(let l=0,u=n.length;l<u;l++){const d=n[l].multiPoly;s.indexOf(d)===-1&&s.push(d)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const e=this.beforeState().multiPolys,t=this.afterState().multiPolys;switch($t.type){case"union":{const r=e.length===0,s=t.length===0;this._isInResult=r!==s;break}case"intersection":{let r,s;e.length<t.length?(r=e.length,s=t.length):(r=t.length,s=e.length),this._isInResult=s===$t.numMultiPolys&&r<s;break}case"xor":{const r=Math.abs(e.length-t.length);this._isInResult=r%2===1;break}case"difference":{const r=s=>s.length===1&&s[0].isSubject;this._isInResult=r(e)!==r(t);break}}return this._isInResult}},pr=class{poly;isExterior;segments;bbox;constructor(i,e,t){if(!Array.isArray(i)||i.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=t,this.segments=[],typeof i[0][0]!="number"||typeof i[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const r=xe.snap({x:new ge(i[0][0]),y:new ge(i[0][1])});this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let s=r;for(let n=1,o=i.length;n<o;n++){if(typeof i[n][0]!="number"||typeof i[n][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const l=xe.snap({x:new ge(i[n][0]),y:new ge(i[n][1])});l.x.eq(s.x)&&l.y.eq(s.y)||(this.segments.push(Mt.fromRing(s,l,this)),l.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=l.x),l.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=l.y),l.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=l.x),l.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=l.y),s=l)}(!r.x.eq(s.x)||!r.y.eq(s.y))&&this.segments.push(Mt.fromRing(s,r,this))}getSweepEvents(){const i=[];for(let e=0,t=this.segments.length;e<t;e++){const r=this.segments[e];i.push(r.leftSE),i.push(r.rightSE)}return i}},rn=class{multiPoly;exteriorRing;interiorRings;bbox;constructor(i,e){if(!Array.isArray(i))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new pr(i[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 t=1,r=i.length;t<r;t++){const s=new pr(i[t],this,!1);s.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=s.bbox.ur.y),this.interiorRings.push(s)}this.multiPoly=e}getSweepEvents(){const i=this.exteriorRing.getSweepEvents();for(let e=0,t=this.interiorRings.length;e<t;e++){const r=this.interiorRings[e].getSweepEvents();for(let s=0,n=r.length;s<n;s++)i.push(r[s])}return i}},mr=class{isSubject;polys;bbox;constructor(i,e){if(!Array.isArray(i))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof i[0][0][0]=="number"&&(i=[i])}catch{}this.polys=[],this.bbox={ll:{x:new ge(Number.POSITIVE_INFINITY),y:new ge(Number.POSITIVE_INFINITY)},ur:{x:new ge(Number.NEGATIVE_INFINITY),y:new ge(Number.NEGATIVE_INFINITY)}};for(let t=0,r=i.length;t<r;t++){const s=new rn(i[t],this);s.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=s.bbox.ur.y),this.polys.push(s)}this.isSubject=e}getSweepEvents(){const i=[];for(let e=0,t=this.polys.length;e<t;e++){const r=this.polys[e].getSweepEvents();for(let s=0,n=r.length;s<n;s++)i.push(r[s])}return i}},sn=(i,...e)=>$t.run("union",i,e),nn=(i,...e)=>$t.run("difference",i,e);xe.set;function on(i,e={}){const t=[];if(ei(i,s=>{t.push(s.coordinates)}),t.length<2)throw new Error("Must have at least 2 geometries");const r=sn(t[0],...t.slice(1));return r.length===0?null:r.length===1?Jt(r[0],e.properties):sr(r,e.properties)}var gr=on;function ln(i){const e=[];if(ei(i,s=>{e.push(s.coordinates)}),e.length<2)throw new Error("Must have at least two features");const t=i.features[0].properties||{},r=nn(e[0],...e.slice(1));return r.length===0?null:r.length===1?Jt(r[0],t):sr(r,t)}var an=ln;function cn(i){if(!i)throw new Error("geojson is required");var e=[];return Us(i,function(t){e.push(t)}),tt(e)}var hn=cn;function yr(i){const e=an(tt([Jt([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),i]));if(!e)return;e.properties={isMask:!0};const t=Ke(ti(i)),r=(t[2]-t[0])/360/1e3,s=t[0]<-180,n=t[2]>180,o=hn(i);if(o.features.length>1&&(s||n))for(const l of o.features){const u=Ke(ti(l));if(n&&u[0]<-180+r)for(const d of l.geometry.coordinates)for(const x of d)x[0]+=360-r;if(s&&u[2]>180-r)for(const d of l.geometry.coordinates)for(const x of d)x[0]-=360-r}return tt([o.features.length<2?i:gr(o)??i,e])}const vr={continental_marine:4,country:4,major_landform:8,region:5,subregion:6,county:7,joint_municipality:8,joint_submunicipality:9,municipality:10,municipal_district:11,locality:12,neighbourhood:13,place:14,postal_code:14,road:16,poi:17,address:18,"poi.peak":15,"poi.shop":18,"poi.cafe":18,"poi.restaurant":18,"poi.aerodrome":13},br=i=>{const e=i?.geometry.type,t=i?.properties?.isMask,r=t?0:e==="LineString"||e==="MultiLineString"?3:2;return{color:"#3170fe",fillColor:"#000",fillOpacity:t?.1:0,weight:r,dashArray:[r,r],lineCap:"butt"}};class Er extends oe.Control{}Object.assign(Er.prototype,oe.Evented.prototype);class wr extends Er{#e;#t;constructor(e={}){super(e)}onAdd(e){this.#e=e,this.#t=e.getContainer().ownerDocument.createElement("maptiler-geocoder"),this.#t.classList.add("leaflet-geocoder"),this.#m(),this.#b(),this.#$();const t=e.getContainer().ownerDocument.createElement("div");return t.classList.add("leaflet-ctrl-geocoder","leaflet-bar"),t.style.zIndex="850",t.appendChild(this.#t),oe.DomEvent.disableClickPropagation(t),oe.DomEvent.disableScrollPropagation(t),t}onRemove(){this.#E(),this.#M(),this.#e=void 0,this.#t=void 0}setOptions(e){Object.assign(this.options,e),this.#m()}setQuery(e){this.#t?.setQuery(e)}submitQuery(e){this.#t?.submitQuery(e)}clearMap(){this.#n=[],this.#c(void 0,void 0)}clearList(){this.#t?.clearList()}setReverseMode(e){this.setOptions({reverseActive:e})}focus(e){this.#t?.focus(e)}blur(){this.#t?.blur()}#o=new Map;#l;#s;#n;#d;#r;#f={reversetoggle:e=>{const t=this.#e?.getContainer();t&&(t.style.cursor=e.detail.reverse?"crosshair":""),this.#i("reversetoggle",e.detail)},querychange:e=>{const t=e.detail.reverseCoords;this.#v(t?{lng:t.decimalLongitude,lat:t.decimalLatitude}:void 0),this.#i("querychange",e.detail)},queryclear:()=>{this.#v(void 0),this.#i("queryclear")},request:e=>{this.#i("request",e.detail)},response:e=>{this.#i("response",e.detail)},select:e=>{const t=e.detail.feature;t&&this.#h&&this.options.flyToSelected&&this.#g({lng:t.center[0],lat:t.center[1]},this.#a(t)),this.#n&&t&&this.#_(t),this.#i("select",e.detail)},pick:e=>{const t=e.detail.feature;t&&t.id!==this.#d&&this.#h&&(this.#w(t),this.#c(this.#n,t)),this.#d=t?.id,this.#i("pick",e.detail)},featuresshow:()=>{this.#i("featuresshow")},featureshide:()=>{this.#i("featureshide")},featureslisted:e=>{const t=e.detail.features;this.#n=t,this.#c(this.#n,void 0),this.#x(t),this.#i("featureslisted",e.detail)},featuresclear:()=>{this.#n=void 0,this.#c(void 0,void 0),this.#i("featuresclear")},focusin:()=>{this.#i("focusin")},focusout:()=>{this.#i("focusout")}};#p={render:()=>{const e=this.#e?.getZoom(),t=this.#e?.getCenter();this.#t?.handleMapChange(e&&t?[e,t.lng,t.lat]:void 0)},click:e=>{this.#t?.handleMapClick([e.latlng.lng,e.latlng.lat])}};#m(){this.#t&&(this.#t.setOptions(this.options),this.#t.fetchFullGeometryOnPick=this.options.pickedResultStyle!=="marker-only",this.#t.openListOnTop=this.options.position==="bottomleft"||this.options.position==="bottomright")}#b(){if(!(!this.#t||!this.#e)){for(const[e,t]of Object.entries(this.#f))this.#t.addEventListener(e,t);this.#e.on(this.#p)}}#E(){if(!(!this.#t||!this.#e)){for(const[e,t]of Object.entries(this.#f))this.#t.removeEventListener(e,t);this.#e.off(this.#p)}}#i(e,t){return super.fire(e,t)}#w(e){e.bbox[0]===e.bbox[2]&&e.bbox[1]===e.bbox[3]?this.#g({lng:e.center[0],lat:e.center[1]},this.#a(e)):this.#y(Ke(e.bbox),50,this.#a(e))}#x(e){if(!e||e.length===0||!this.#h)return;const t=e.every(n=>n.matching_text),r=e.reduce((n,o)=>t||!o.matching_text?[Math.min(n[0],o.bbox[0]),Math.min(n[1],o.bbox[1]),Math.max(n[2],o.bbox[2]),Math.max(n[3],o.bbox[3])]:n,[180,90,-180,-90]),s=e.map(n=>this.#a(n)).filter(n=>n!==void 0).reduce((n,o)=>n===void 0?o:Math.max(n,o),void 0);this.#y(Ke(r),50,s)}#a(e){if(e.bbox[0]!==e.bbox[2]||e.bbox[1]!==e.bbox[3])return;const t=e.id.replace(/\..*/,""),r=this.options.zoom??vr;return(Array.isArray(e.properties?.categories)?e.properties.categories.reduce((s,n)=>{const o=r[t+"."+n];return s===void 0?o:o===void 0?s:Math.max(s,o)},void 0):void 0)??r[t]}get#h(){return!!this.options.flyTo||this.options.flyTo===void 0}get#S(){return typeof this.options.flyTo=="boolean"?{}:this.options.flyTo}get#L(){return typeof this.options.flyTo=="boolean"?{}:this.options.flyTo}#g(e,t){this.#e?.flyTo(e,t,this.#S??void 0)}#y(e,t,r){this.#e?.fitBounds([[e[1],e[0]],[e[3],e[2]]],{padding:[t,t],...r?{maxZoom:r}:{},...this.#L})}#v(e){if(!(this.options.marker===!1||this.options.marker===null||!this.#e)){if(!e){this.#s?.remove(),this.#s=void 0;return}this.#s||(this.options.marker instanceof Function?this.#s=this.options.marker(this.#e)??void 0:(this.#s=this.#u(e,this.options.marker).addTo(this.#e),this.#s.getElement()?.classList.add("marker-reverse"))),this.#s?.setLatLng(e)}}#c(e,t){if(!this.#e)return;for(const s of this.#o.values())s.remove();this.#o=new Map,this.#r?.clearLayers();const r=()=>{if(!t||!this.#e||this.options.marker===!1||this.options.marker===null)return;const s=this.options.marker instanceof Function?this.options.marker(this.#e,t):this.#u({lng:t.center[0],lat:t.center[1]},this.options.marker).addTo(this.#e);s&&this.#o.set(t,s)};if(t?.geometry.type==="GeometryCollection"){const s=t.geometry.geometries.filter(n=>n.type==="Polygon"||n.type==="MultiPolygon");if(s.length>0){const n=gr(tt(s.map(o=>et(o))));if(n){const o=yr({...t,geometry:n.geometry});if(o){const l=[...o.features],u=Ke(ti(t)),d=u[2]-u[0];u[0]-d/4<-180&&l.push(...Bi(o,-360).features),u[2]+d/4>180&&l.push(...Bi(o,360).features),this.#r?.addData(tt(l))}}}else{const n=t.geometry.geometries.filter(o=>o.type==="LineString"||o.type==="MultiLineString");n.length>0&&this.#r?.addData({...t,geometry:{type:"GeometryCollection",geometries:n}})}}else if(t?.geometry.type.endsWith("Polygon")){const s=yr(t);s&&this.#r?.addData(s),this.options.pickedResultStyle==="full-geometry-including-polygon-center-marker"&&r()}else t?.geometry.type.endsWith("LineString")?this.#r?.addData(t):t?.geometry.type.endsWith("Point")&&r();if(this.options.showResultMarkers!==!1&&this.options.showResultMarkers!==null)for(const s of e??[]){if(s.id===t?.id||s.place_type.includes("reverse"))continue;let n;if(this.options.showResultMarkers instanceof Function){if(n=this.options.showResultMarkers(this.#e,s),!n)continue}else n=this.#u({lng:s.center[0],lat:s.center[1]},this.options.showResultMarkers).bindPopup(new oe.Popup({offset:[.3,-21],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setContent(s.place_type[0]==="reverse"?s.place_name:s.place_name.replace(/,.*/,""))).addTo(this.#e),n.getElement()?.classList.add("marker-interactive");const o=n.getElement();o?.addEventListener("click",l=>{l.stopPropagation(),this.#i("markerclick",{feature:s,marker:n})}),o?.addEventListener("mouseenter",()=>{this.#i("markermouseenter",{feature:s,marker:n}),n.togglePopup()}),o?.addEventListener("mouseleave",()=>{this.#i("markermouseleave",{feature:s,marker:n}),n.togglePopup()}),o?.classList.toggle("marker-fuzzy",!!s.matching_text),this.#o.set(s,n)}}#_(e){this.#l?.getElement()?.classList.toggle("marker-selected",!1),this.#l=void 0,this.options.markerOnSelected!==!1&&(this.#l=this.#o.get(e),this.#l?.getElement()?.classList.toggle("marker-selected",!0))}#$(){this.#e&&(this.#r=new oe.GeoJSON(void 0,{style:this.#C(),interactive:!1}).addTo(this.#e))}#M(){this.#e&&(this.#r?.removeFrom(this.#e),this.#r=void 0)}#u(e,t){return typeof t!="object"&&(t={icon:new oe.DivIcon({html:this.#e?.getContainer().ownerDocument.createElement("maptiler-geocode-marker"),iconAnchor:[12.3,30],className:""})}),new oe.Marker(e,t)}#C(){const{fullGeometryStyle:e}=this.options;if(e===!0||e===void 0)return br;if(!(e===!1||e===null))return e}}$.DEFAULT_GEOMETRY_STYLE=br,$.GeocodingControl=wr,$.LeafletGeocodingControl=wr,$.ZOOM_DEFAULTS=vr,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})}));
|
|
275
|
+
`,$.MaptilerGeocodeMarkerElement=Gs([$e("maptiler-geocode-marker")],$.MaptilerGeocodeMarkerElement);function et(i,e,t={}){const r={type:"Feature"};return(t.id===0||t.id)&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.properties=e||{},r.geometry=i,r}function Jt(i,e,t={}){for(const s of i){if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(s[s.length-1].length!==s[0].length)throw new Error("First and last Position are not equivalent.");for(let n=0;n<s[s.length-1].length;n++)if(s[s.length-1][n]!==s[0][n])throw new Error("First and last Position are not equivalent.")}return et({type:"Polygon",coordinates:i},e,t)}function tt(i,e={}){const t={type:"FeatureCollection"};return e.id&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.features=i,t}function sr(i,e,t={}){return et({type:"MultiPolygon",coordinates:i},e,t)}function nr(i,e,t){if(i!==null)for(var r,s,n,o,l,u,d,x=0,w=0,_,M=i.type,C=M==="FeatureCollection",G=M==="Feature",N=C?i.features.length:1,W=0;W<N;W++){d=C?i.features[W].geometry:G?i.geometry:i,_=d?d.type==="GeometryCollection":!1,l=_?d.geometries.length:1;for(var L=0;L<l;L++){var Q=0,ne=0;if(o=_?d.geometries[L]:d,o!==null){u=o.coordinates;var ve=o.type;switch(x=0,ve){case null:break;case"Point":if(e(u,w,W,Q,ne)===!1)return!1;w++,Q++;break;case"LineString":case"MultiPoint":for(r=0;r<u.length;r++){if(e(u[r],w,W,Q,ne)===!1)return!1;w++,ve==="MultiPoint"&&Q++}ve==="LineString"&&Q++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(s=0;s<u[r].length-x;s++){if(e(u[r][s],w,W,Q,ne)===!1)return!1;w++}ve==="MultiLineString"&&Q++,ve==="Polygon"&&ne++}ve==="Polygon"&&Q++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for(ne=0,s=0;s<u[r].length;s++){for(n=0;n<u[r][s].length-x;n++){if(e(u[r][s][n],w,W,Q,ne)===!1)return!1;w++}ne++}Q++}break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(nr(o.geometries[r],e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ei(i,e){var t,r,s,n,o,l,u,d,x,w,_=0,M=i.type==="FeatureCollection",C=i.type==="Feature",G=M?i.features.length:1;for(t=0;t<G;t++){for(l=M?i.features[t].geometry:C?i.geometry:i,d=M?i.features[t].properties:C?i.properties:{},x=M?i.features[t].bbox:C?i.bbox:void 0,w=M?i.features[t].id:C?i.id:void 0,u=l?l.type==="GeometryCollection":!1,o=u?l.geometries.length:1,s=0;s<o;s++){if(n=u?l.geometries[s]:l,n===null){if(e(null,_,d,x,w)===!1)return!1;continue}switch(n.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(n,_,d,x,w)===!1)return!1;break}case"GeometryCollection":{for(r=0;r<n.geometries.length;r++)if(e(n.geometries[r],_,d,x,w)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}_++}}function Us(i,e){ei(i,function(t,r,s,n,o){var l=t===null?null:t.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return e(et(t,s,{bbox:n,id:o}),r,0)===!1?!1:void 0}var u;switch(l){case"MultiPoint":u="Point";break;case"MultiLineString":u="LineString";break;case"MultiPolygon":u="Polygon";break}for(var d=0;d<t.coordinates.length;d++){var x=t.coordinates[d],w={type:u,coordinates:x};if(e(et(w,s),r,d)===!1)return!1}})}function Bs(i,e={}){if(i.bbox!=null&&e.recompute!==!0)return i.bbox;const t=[1/0,1/0,-1/0,-1/0];return nr(i,r=>{t[0]>r[0]&&(t[0]=r[0]),t[1]>r[1]&&(t[1]=r[1]),t[2]<r[0]&&(t[2]=r[0]),t[3]<r[1]&&(t[3]=r[1])}),t}var ti=Bs,Ds=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ii=Math.ceil,ce=Math.floor,se="[BigNumber Error] ",or=se+"Number primitive has more than 15 significant digits: ",pe=1e14,R=14,ri=9007199254740991,si=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Ce=1e7,X=1e9;function lr(i){var e,t,r,s=L.prototype={constructor:L,toString:null,valueOf:null},n=new L(1),o=20,l=4,u=-7,d=21,x=-1e7,w=1e7,_=!1,M=1,C=0,G={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},N="0123456789abcdefghijklmnopqrstuvwxyz",W=!0;function L(a,c){var h,v,p,g,E,f,m,b,y=this;if(!(y instanceof L))return new L(a,c);if(c==null){if(a&&a._isBigNumber===!0){y.s=a.s,!a.c||a.e>w?y.c=y.e=null:a.e<x?y.c=[y.e=0]:(y.e=a.e,y.c=a.c.slice());return}if((f=typeof a=="number")&&a*0==0){if(y.s=1/a<0?(a=-a,-1):1,a===~~a){for(g=0,E=a;E>=10;E/=10,g++);g>w?y.c=y.e=null:(y.e=g,y.c=[a]);return}b=String(a)}else{if(!Ds.test(b=String(a)))return r(y,b,f);y.s=b.charCodeAt(0)==45?(b=b.slice(1),-1):1}(g=b.indexOf("."))>-1&&(b=b.replace(".","")),(E=b.search(/e/i))>0?(g<0&&(g=E),g+=+b.slice(E+1),b=b.substring(0,E)):g<0&&(g=b.length)}else{if(q(c,2,N.length,"Base"),c==10&&W)return y=new L(a),de(y,o+y.e+1,l);if(b=String(a),f=typeof a=="number"){if(a*0!=0)return r(y,b,f,c);if(y.s=1/a<0?(b=b.slice(1),-1):1,L.DEBUG&&b.replace(/^0\.0*|\./,"").length>15)throw Error(or+a)}else y.s=b.charCodeAt(0)===45?(b=b.slice(1),-1):1;for(h=N.slice(0,c),g=E=0,m=b.length;E<m;E++)if(h.indexOf(v=b.charAt(E))<0){if(v=="."){if(E>g){g=m;continue}}else if(!p&&(b==b.toUpperCase()&&(b=b.toLowerCase())||b==b.toLowerCase()&&(b=b.toUpperCase()))){p=!0,E=-1,g=0;continue}return r(y,String(a),f,c)}f=!1,b=t(b,c,10,y.s),(g=b.indexOf("."))>-1?b=b.replace(".",""):g=b.length}for(E=0;b.charCodeAt(E)===48;E++);for(m=b.length;b.charCodeAt(--m)===48;);if(b=b.slice(E,++m)){if(m-=E,f&&L.DEBUG&&m>15&&(a>ri||a!==ce(a)))throw Error(or+y.s*a);if((g=g-E-1)>w)y.c=y.e=null;else if(g<x)y.c=[y.e=0];else{if(y.e=g,y.c=[],E=(g+1)%R,g<0&&(E+=R),E<m){for(E&&y.c.push(+b.slice(0,E)),m-=R;E<m;)y.c.push(+b.slice(E,E+=R));E=R-(b=b.slice(E)).length}else E-=m;for(;E--;b+="0");y.c.push(+b)}}else y.c=[y.e=0]}L.clone=lr,L.ROUND_UP=0,L.ROUND_DOWN=1,L.ROUND_CEIL=2,L.ROUND_FLOOR=3,L.ROUND_HALF_UP=4,L.ROUND_HALF_DOWN=5,L.ROUND_HALF_EVEN=6,L.ROUND_HALF_CEIL=7,L.ROUND_HALF_FLOOR=8,L.EUCLID=9,L.config=L.set=function(a){var c,h;if(a!=null)if(typeof a=="object"){if(a.hasOwnProperty(c="DECIMAL_PLACES")&&(h=a[c],q(h,0,X,c),o=h),a.hasOwnProperty(c="ROUNDING_MODE")&&(h=a[c],q(h,0,8,c),l=h),a.hasOwnProperty(c="EXPONENTIAL_AT")&&(h=a[c],h&&h.pop?(q(h[0],-X,0,c),q(h[1],0,X,c),u=h[0],d=h[1]):(q(h,-X,X,c),u=-(d=h<0?-h:h))),a.hasOwnProperty(c="RANGE"))if(h=a[c],h&&h.pop)q(h[0],-X,-1,c),q(h[1],1,X,c),x=h[0],w=h[1];else if(q(h,-X,X,c),h)x=-(w=h<0?-h:h);else throw Error(se+c+" cannot be zero: "+h);if(a.hasOwnProperty(c="CRYPTO"))if(h=a[c],h===!!h)if(h)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))_=h;else throw _=!h,Error(se+"crypto unavailable");else _=h;else throw Error(se+c+" not true or false: "+h);if(a.hasOwnProperty(c="MODULO_MODE")&&(h=a[c],q(h,0,9,c),M=h),a.hasOwnProperty(c="POW_PRECISION")&&(h=a[c],q(h,0,X,c),C=h),a.hasOwnProperty(c="FORMAT"))if(h=a[c],typeof h=="object")G=h;else throw Error(se+c+" not an object: "+h);if(a.hasOwnProperty(c="ALPHABET"))if(h=a[c],typeof h=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(h))W=h.slice(0,10)=="0123456789",N=h;else throw Error(se+c+" invalid: "+h)}else throw Error(se+"Object expected: "+a);return{DECIMAL_PLACES:o,ROUNDING_MODE:l,EXPONENTIAL_AT:[u,d],RANGE:[x,w],CRYPTO:_,MODULO_MODE:M,POW_PRECISION:C,FORMAT:G,ALPHABET:N}},L.isBigNumber=function(a){if(!a||a._isBigNumber!==!0)return!1;if(!L.DEBUG)return!0;var c,h,v=a.c,p=a.e,g=a.s;e:if({}.toString.call(v)=="[object Array]"){if((g===1||g===-1)&&p>=-X&&p<=X&&p===ce(p)){if(v[0]===0){if(p===0&&v.length===1)return!0;break e}if(c=(p+1)%R,c<1&&(c+=R),String(v[0]).length==c){for(c=0;c<v.length;c++)if(h=v[c],h<0||h>=pe||h!==ce(h))break e;if(h!==0)return!0}}}else if(v===null&&p===null&&(g===null||g===1||g===-1))return!0;throw Error(se+"Invalid BigNumber: "+a)},L.maximum=L.max=function(){return ne(arguments,-1)},L.minimum=L.min=function(){return ne(arguments,1)},L.random=(function(){var a=9007199254740992,c=Math.random()*a&2097151?function(){return ce(Math.random()*a)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(h){var v,p,g,E,f,m=0,b=[],y=new L(n);if(h==null?h=o:q(h,0,X),E=ii(h/R),_)if(crypto.getRandomValues){for(v=crypto.getRandomValues(new Uint32Array(E*=2));m<E;)f=v[m]*131072+(v[m+1]>>>11),f>=9e15?(p=crypto.getRandomValues(new Uint32Array(2)),v[m]=p[0],v[m+1]=p[1]):(b.push(f%1e14),m+=2);m=E/2}else if(crypto.randomBytes){for(v=crypto.randomBytes(E*=7);m<E;)f=(v[m]&31)*281474976710656+v[m+1]*1099511627776+v[m+2]*4294967296+v[m+3]*16777216+(v[m+4]<<16)+(v[m+5]<<8)+v[m+6],f>=9e15?crypto.randomBytes(7).copy(v,m):(b.push(f%1e14),m+=7);m=E/7}else throw _=!1,Error(se+"crypto unavailable");if(!_)for(;m<E;)f=c(),f<9e15&&(b[m++]=f%1e14);for(E=b[--m],h%=R,E&&h&&(f=si[R-h],b[m]=ce(E/f)*f);b[m]===0;b.pop(),m--);if(m<0)b=[g=0];else{for(g=-1;b[0]===0;b.splice(0,1),g-=R);for(m=1,f=b[0];f>=10;f/=10,m++);m<R&&(g-=R-m)}return y.e=g,y.c=b,y}})(),L.sum=function(){for(var a=1,c=arguments,h=new L(c[0]);a<c.length;)h=h.plus(c[a++]);return h},t=(function(){var a="0123456789";function c(h,v,p,g){for(var E,f=[0],m,b=0,y=h.length;b<y;){for(m=f.length;m--;f[m]*=v);for(f[0]+=g.indexOf(h.charAt(b++)),E=0;E<f.length;E++)f[E]>p-1&&(f[E+1]==null&&(f[E+1]=0),f[E+1]+=f[E]/p|0,f[E]%=p)}return f.reverse()}return function(h,v,p,g,E){var f,m,b,y,S,A,T,D,H=h.indexOf("."),K=o,U=l;for(H>=0&&(y=C,C=0,h=h.replace(".",""),D=new L(v),A=D.pow(h.length-H),C=y,D.c=c(we(ue(A.c),A.e,"0"),10,p,a),D.e=D.c.length),T=c(h,v,p,E?(f=N,a):(f=a,N)),b=y=T.length;T[--y]==0;T.pop());if(!T[0])return f.charAt(0);if(H<0?--b:(A.c=T,A.e=b,A.s=g,A=e(A,D,K,U,p),T=A.c,S=A.r,b=A.e),m=b+K+1,H=T[m],y=p/2,S=S||m<0||T[m+1]!=null,S=U<4?(H!=null||S)&&(U==0||U==(A.s<0?3:2)):H>y||H==y&&(U==4||S||U==6&&T[m-1]&1||U==(A.s<0?8:7)),m<1||!T[0])h=S?we(f.charAt(1),-K,f.charAt(0)):f.charAt(0);else{if(T.length=m,S)for(--p;++T[--m]>p;)T[m]=0,m||(++b,T=[1].concat(T));for(y=T.length;!T[--y];);for(H=0,h="";H<=y;h+=f.charAt(T[H++]));h=we(h,b,f.charAt(0))}return h}})(),e=(function(){function a(v,p,g){var E,f,m,b,y=0,S=v.length,A=p%Ce,T=p/Ce|0;for(v=v.slice();S--;)m=v[S]%Ce,b=v[S]/Ce|0,E=T*m+b*A,f=A*m+E%Ce*Ce+y,y=(f/g|0)+(E/Ce|0)+T*b,v[S]=f%g;return y&&(v=[y].concat(v)),v}function c(v,p,g,E){var f,m;if(g!=E)m=g>E?1:-1;else for(f=m=0;f<g;f++)if(v[f]!=p[f]){m=v[f]>p[f]?1:-1;break}return m}function h(v,p,g,E){for(var f=0;g--;)v[g]-=f,f=v[g]<p[g]?1:0,v[g]=f*E+v[g]-p[g];for(;!v[0]&&v.length>1;v.splice(0,1));}return function(v,p,g,E,f){var m,b,y,S,A,T,D,H,K,U,F,J,Ct,ai,ci,be,nt,fe=v.s==p.s?1:-1,te=v.c,j=p.c;if(!te||!te[0]||!j||!j[0])return new L(!v.s||!p.s||(te?j&&te[0]==j[0]:!j)?NaN:te&&te[0]==0||!j?fe*0:fe/0);for(H=new L(fe),K=H.c=[],b=v.e-p.e,fe=g+b+1,f||(f=pe,b=he(v.e/R)-he(p.e/R),fe=fe/R|0),y=0;j[y]==(te[y]||0);y++);if(j[y]>(te[y]||0)&&b--,fe<0)K.push(1),S=!0;else{for(ai=te.length,be=j.length,y=0,fe+=2,A=ce(f/(j[0]+1)),A>1&&(j=a(j,A,f),te=a(te,A,f),be=j.length,ai=te.length),Ct=be,U=te.slice(0,be),F=U.length;F<be;U[F++]=0);nt=j.slice(),nt=[0].concat(nt),ci=j[0],j[1]>=f/2&&ci++;do{if(A=0,m=c(j,U,be,F),m<0){if(J=U[0],be!=F&&(J=J*f+(U[1]||0)),A=ce(J/ci),A>1)for(A>=f&&(A=f-1),T=a(j,A,f),D=T.length,F=U.length;c(T,U,D,F)==1;)A--,h(T,be<D?nt:j,D,f),D=T.length,m=1;else A==0&&(m=A=1),T=j.slice(),D=T.length;if(D<F&&(T=[0].concat(T)),h(U,T,F,f),F=U.length,m==-1)for(;c(j,U,be,F)<1;)A++,h(U,be<F?nt:j,F,f),F=U.length}else m===0&&(A++,U=[0]);K[y++]=A,U[0]?U[F++]=te[Ct]||0:(U=[te[Ct]],F=1)}while((Ct++<ai||U[0]!=null)&&fe--);S=U[0]!=null,K[0]||K.splice(0,1)}if(f==pe){for(y=1,fe=K[0];fe>=10;fe/=10,y++);de(H,g+(H.e=y+b*R-1)+1,E,S)}else H.e=b,H.r=+S;return H}})();function Q(a,c,h,v){var p,g,E,f,m;if(h==null?h=l:q(h,0,8),!a.c)return a.toString();if(p=a.c[0],E=a.e,c==null)m=ue(a.c),m=v==1||v==2&&(E<=u||E>=d)?xt(m,E):we(m,E,"0");else if(a=de(new L(a),c,h),g=a.e,m=ue(a.c),f=m.length,v==1||v==2&&(c<=g||g<=u)){for(;f<c;m+="0",f++);m=xt(m,g)}else if(c-=E+(v===2&&g>E),m=we(m,g,"0"),g+1>f){if(--c>0)for(m+=".";c--;m+="0");}else if(c+=g-f,c>0)for(g+1==f&&(m+=".");c--;m+="0");return a.s<0&&p?"-"+m:m}function ne(a,c){for(var h,v,p=1,g=new L(a[0]);p<a.length;p++)v=new L(a[p]),(!v.s||(h=Ie(g,v))===c||h===0&&g.s===c)&&(g=v);return g}function ve(a,c,h){for(var v=1,p=c.length;!c[--p];c.pop());for(p=c[0];p>=10;p/=10,v++);return(h=v+h*R-1)>w?a.c=a.e=null:h<x?a.c=[a.e=0]:(a.e=h,a.c=c),a}r=(function(){var a=/^(-?)0([xbo])(?=\w[\w.]*$)/i,c=/^([^.]+)\.$/,h=/^\.([^.]+)$/,v=/^-?(Infinity|NaN)$/,p=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(g,E,f,m){var b,y=f?E:E.replace(p,"");if(v.test(y))g.s=isNaN(y)?null:y<0?-1:1;else{if(!f&&(y=y.replace(a,function(S,A,T){return b=(T=T.toLowerCase())=="x"?16:T=="b"?2:8,!m||m==b?A:S}),m&&(b=m,y=y.replace(c,"$1").replace(h,"0.$1")),E!=y))return new L(y,b);if(L.DEBUG)throw Error(se+"Not a"+(m?" base "+m:"")+" number: "+E);g.s=null}g.c=g.e=null}})();function de(a,c,h,v){var p,g,E,f,m,b,y,S=a.c,A=si;if(S){e:{for(p=1,f=S[0];f>=10;f/=10,p++);if(g=c-p,g<0)g+=R,E=c,m=S[b=0],y=ce(m/A[p-E-1]%10);else if(b=ii((g+1)/R),b>=S.length)if(v){for(;S.length<=b;S.push(0));m=y=0,p=1,g%=R,E=g-R+1}else break e;else{for(m=f=S[b],p=1;f>=10;f/=10,p++);g%=R,E=g-R+p,y=E<0?0:ce(m/A[p-E-1]%10)}if(v=v||c<0||S[b+1]!=null||(E<0?m:m%A[p-E-1]),v=h<4?(y||v)&&(h==0||h==(a.s<0?3:2)):y>5||y==5&&(h==4||v||h==6&&(g>0?E>0?m/A[p-E]:0:S[b-1])%10&1||h==(a.s<0?8:7)),c<1||!S[0])return S.length=0,v?(c-=a.e+1,S[0]=A[(R-c%R)%R],a.e=-c||0):S[0]=a.e=0,a;if(g==0?(S.length=b,f=1,b--):(S.length=b+1,f=A[R-g],S[b]=E>0?ce(m/A[p-E]%A[E])*f:0),v)for(;;)if(b==0){for(g=1,E=S[0];E>=10;E/=10,g++);for(E=S[0]+=f,f=1;E>=10;E/=10,f++);g!=f&&(a.e++,S[0]==pe&&(S[0]=1));break}else{if(S[b]+=f,S[b]!=pe)break;S[b--]=0,f=1}for(g=S.length;S[--g]===0;S.pop());}a.e>w?a.c=a.e=null:a.e<x&&(a.c=[a.e=0])}return a}function Se(a){var c,h=a.e;return h===null?a.toString():(c=ue(a.c),c=h<=u||h>=d?xt(c,h):we(c,h,"0"),a.s<0?"-"+c:c)}return s.absoluteValue=s.abs=function(){var a=new L(this);return a.s<0&&(a.s=1),a},s.comparedTo=function(a,c){return Ie(this,new L(a,c))},s.decimalPlaces=s.dp=function(a,c){var h,v,p,g=this;if(a!=null)return q(a,0,X),c==null?c=l:q(c,0,8),de(new L(g),a+g.e+1,c);if(!(h=g.c))return null;if(v=((p=h.length-1)-he(this.e/R))*R,p=h[p])for(;p%10==0;p/=10,v--);return v<0&&(v=0),v},s.dividedBy=s.div=function(a,c){return e(this,new L(a,c),o,l)},s.dividedToIntegerBy=s.idiv=function(a,c){return e(this,new L(a,c),0,1)},s.exponentiatedBy=s.pow=function(a,c){var h,v,p,g,E,f,m,b,y,S=this;if(a=new L(a),a.c&&!a.isInteger())throw Error(se+"Exponent not an integer: "+Se(a));if(c!=null&&(c=new L(c)),f=a.e>14,!S.c||!S.c[0]||S.c[0]==1&&!S.e&&S.c.length==1||!a.c||!a.c[0])return y=new L(Math.pow(+Se(S),f?a.s*(2-wt(a)):+Se(a))),c?y.mod(c):y;if(m=a.s<0,c){if(c.c?!c.c[0]:!c.s)return new L(NaN);v=!m&&S.isInteger()&&c.isInteger(),v&&(S=S.mod(c))}else{if(a.e>9&&(S.e>0||S.e<-1||(S.e==0?S.c[0]>1||f&&S.c[1]>=24e7:S.c[0]<8e13||f&&S.c[0]<=9999975e7)))return g=S.s<0&&wt(a)?-0:0,S.e>-1&&(g=1/g),new L(m?1/g:g);C&&(g=ii(C/R+2))}for(f?(h=new L(.5),m&&(a.s=1),b=wt(a)):(p=Math.abs(+Se(a)),b=p%2),y=new L(n);;){if(b){if(y=y.times(S),!y.c)break;g?y.c.length>g&&(y.c.length=g):v&&(y=y.mod(c))}if(p){if(p=ce(p/2),p===0)break;b=p%2}else if(a=a.times(h),de(a,a.e+1,1),a.e>14)b=wt(a);else{if(p=+Se(a),p===0)break;b=p%2}S=S.times(S),g?S.c&&S.c.length>g&&(S.c.length=g):v&&(S=S.mod(c))}return v?y:(m&&(y=n.div(y)),c?y.mod(c):g?de(y,C,l,E):y)},s.integerValue=function(a){var c=new L(this);return a==null?a=l:q(a,0,8),de(c,c.e+1,a)},s.isEqualTo=s.eq=function(a,c){return Ie(this,new L(a,c))===0},s.isFinite=function(){return!!this.c},s.isGreaterThan=s.gt=function(a,c){return Ie(this,new L(a,c))>0},s.isGreaterThanOrEqualTo=s.gte=function(a,c){return(c=Ie(this,new L(a,c)))===1||c===0},s.isInteger=function(){return!!this.c&&he(this.e/R)>this.c.length-2},s.isLessThan=s.lt=function(a,c){return Ie(this,new L(a,c))<0},s.isLessThanOrEqualTo=s.lte=function(a,c){return(c=Ie(this,new L(a,c)))===-1||c===0},s.isNaN=function(){return!this.s},s.isNegative=function(){return this.s<0},s.isPositive=function(){return this.s>0},s.isZero=function(){return!!this.c&&this.c[0]==0},s.minus=function(a,c){var h,v,p,g,E=this,f=E.s;if(a=new L(a,c),c=a.s,!f||!c)return new L(NaN);if(f!=c)return a.s=-c,E.plus(a);var m=E.e/R,b=a.e/R,y=E.c,S=a.c;if(!m||!b){if(!y||!S)return y?(a.s=-c,a):new L(S?E:NaN);if(!y[0]||!S[0])return S[0]?(a.s=-c,a):new L(y[0]?E:l==3?-0:0)}if(m=he(m),b=he(b),y=y.slice(),f=m-b){for((g=f<0)?(f=-f,p=y):(b=m,p=S),p.reverse(),c=f;c--;p.push(0));p.reverse()}else for(v=(g=(f=y.length)<(c=S.length))?f:c,f=c=0;c<v;c++)if(y[c]!=S[c]){g=y[c]<S[c];break}if(g&&(p=y,y=S,S=p,a.s=-a.s),c=(v=S.length)-(h=y.length),c>0)for(;c--;y[h++]=0);for(c=pe-1;v>f;){if(y[--v]<S[v]){for(h=v;h&&!y[--h];y[h]=c);--y[h],y[v]+=pe}y[v]-=S[v]}for(;y[0]==0;y.splice(0,1),--b);return y[0]?ve(a,y,b):(a.s=l==3?-1:1,a.c=[a.e=0],a)},s.modulo=s.mod=function(a,c){var h,v,p=this;return a=new L(a,c),!p.c||!a.s||a.c&&!a.c[0]?new L(NaN):!a.c||p.c&&!p.c[0]?new L(p):(M==9?(v=a.s,a.s=1,h=e(p,a,0,3),a.s=v,h.s*=v):h=e(p,a,0,M),a=p.minus(h.times(a)),!a.c[0]&&M==1&&(a.s=p.s),a)},s.multipliedBy=s.times=function(a,c){var h,v,p,g,E,f,m,b,y,S,A,T,D,H,K,U=this,F=U.c,J=(a=new L(a,c)).c;if(!F||!J||!F[0]||!J[0])return!U.s||!a.s||F&&!F[0]&&!J||J&&!J[0]&&!F?a.c=a.e=a.s=null:(a.s*=U.s,!F||!J?a.c=a.e=null:(a.c=[0],a.e=0)),a;for(v=he(U.e/R)+he(a.e/R),a.s*=U.s,m=F.length,S=J.length,m<S&&(D=F,F=J,J=D,p=m,m=S,S=p),p=m+S,D=[];p--;D.push(0));for(H=pe,K=Ce,p=S;--p>=0;){for(h=0,A=J[p]%K,T=J[p]/K|0,E=m,g=p+E;g>p;)b=F[--E]%K,y=F[E]/K|0,f=T*b+y*A,b=A*b+f%K*K+D[g]+h,h=(b/H|0)+(f/K|0)+T*y,D[g--]=b%H;D[g]=h}return h?++v:D.splice(0,1),ve(a,D,v)},s.negated=function(){var a=new L(this);return a.s=-a.s||null,a},s.plus=function(a,c){var h,v=this,p=v.s;if(a=new L(a,c),c=a.s,!p||!c)return new L(NaN);if(p!=c)return a.s=-c,v.minus(a);var g=v.e/R,E=a.e/R,f=v.c,m=a.c;if(!g||!E){if(!f||!m)return new L(p/0);if(!f[0]||!m[0])return m[0]?a:new L(f[0]?v:p*0)}if(g=he(g),E=he(E),f=f.slice(),p=g-E){for(p>0?(E=g,h=m):(p=-p,h=f),h.reverse();p--;h.push(0));h.reverse()}for(p=f.length,c=m.length,p-c<0&&(h=m,m=f,f=h,c=p),p=0;c;)p=(f[--c]=f[c]+m[c]+p)/pe|0,f[c]=pe===f[c]?0:f[c]%pe;return p&&(f=[p].concat(f),++E),ve(a,f,E)},s.precision=s.sd=function(a,c){var h,v,p,g=this;if(a!=null&&a!==!!a)return q(a,1,X),c==null?c=l:q(c,0,8),de(new L(g),a,c);if(!(h=g.c))return null;if(p=h.length-1,v=p*R+1,p=h[p]){for(;p%10==0;p/=10,v--);for(p=h[0];p>=10;p/=10,v++);}return a&&g.e+1>v&&(v=g.e+1),v},s.shiftedBy=function(a){return q(a,-ri,ri),this.times("1e"+a)},s.squareRoot=s.sqrt=function(){var a,c,h,v,p,g=this,E=g.c,f=g.s,m=g.e,b=o+4,y=new L("0.5");if(f!==1||!E||!E[0])return new L(!f||f<0&&(!E||E[0])?NaN:E?g:1/0);if(f=Math.sqrt(+Se(g)),f==0||f==1/0?(c=ue(E),(c.length+m)%2==0&&(c+="0"),f=Math.sqrt(+c),m=he((m+1)/2)-(m<0||m%2),f==1/0?c="5e"+m:(c=f.toExponential(),c=c.slice(0,c.indexOf("e")+1)+m),h=new L(c)):h=new L(f+""),h.c[0]){for(m=h.e,f=m+b,f<3&&(f=0);;)if(p=h,h=y.times(p.plus(e(g,p,b,1))),ue(p.c).slice(0,f)===(c=ue(h.c)).slice(0,f))if(h.e<m&&--f,c=c.slice(f-3,f+1),c=="9999"||!v&&c=="4999"){if(!v&&(de(p,p.e+o+2,0),p.times(p).eq(g))){h=p;break}b+=4,f+=4,v=1}else{(!+c||!+c.slice(1)&&c.charAt(0)=="5")&&(de(h,h.e+o+2,1),a=!h.times(h).eq(g));break}}return de(h,h.e+o+1,l,a)},s.toExponential=function(a,c){return a!=null&&(q(a,0,X),a++),Q(this,a,c,1)},s.toFixed=function(a,c){return a!=null&&(q(a,0,X),a=a+this.e+1),Q(this,a,c)},s.toFormat=function(a,c,h){var v,p=this;if(h==null)a!=null&&c&&typeof c=="object"?(h=c,c=null):a&&typeof a=="object"?(h=a,a=c=null):h=G;else if(typeof h!="object")throw Error(se+"Argument not an object: "+h);if(v=p.toFixed(a,c),p.c){var g,E=v.split("."),f=+h.groupSize,m=+h.secondaryGroupSize,b=h.groupSeparator||"",y=E[0],S=E[1],A=p.s<0,T=A?y.slice(1):y,D=T.length;if(m&&(g=f,f=m,m=g,D-=g),f>0&&D>0){for(g=D%f||f,y=T.substr(0,g);g<D;g+=f)y+=b+T.substr(g,f);m>0&&(y+=b+T.slice(g)),A&&(y="-"+y)}v=S?y+(h.decimalSeparator||"")+((m=+h.fractionGroupSize)?S.replace(new RegExp("\\d{"+m+"}\\B","g"),"$&"+(h.fractionGroupSeparator||"")):S):y}return(h.prefix||"")+v+(h.suffix||"")},s.toFraction=function(a){var c,h,v,p,g,E,f,m,b,y,S,A,T=this,D=T.c;if(a!=null&&(f=new L(a),!f.isInteger()&&(f.c||f.s!==1)||f.lt(n)))throw Error(se+"Argument "+(f.isInteger()?"out of range: ":"not an integer: ")+Se(f));if(!D)return new L(T);for(c=new L(n),b=h=new L(n),v=m=new L(n),A=ue(D),g=c.e=A.length-T.e-1,c.c[0]=si[(E=g%R)<0?R+E:E],a=!a||f.comparedTo(c)>0?g>0?c:b:f,E=w,w=1/0,f=new L(A),m.c[0]=0;y=e(f,c,0,1),p=h.plus(y.times(v)),p.comparedTo(a)!=1;)h=v,v=p,b=m.plus(y.times(p=b)),m=p,c=f.minus(y.times(p=c)),f=p;return p=e(a.minus(h),v,0,1),m=m.plus(p.times(b)),h=h.plus(p.times(v)),m.s=b.s=T.s,g=g*2,S=e(b,v,g,l).minus(T).abs().comparedTo(e(m,h,g,l).minus(T).abs())<1?[b,v]:[m,h],w=E,S},s.toNumber=function(){return+Se(this)},s.toPrecision=function(a,c){return a!=null&&q(a,1,X),Q(this,a,c,2)},s.toString=function(a){var c,h=this,v=h.s,p=h.e;return p===null?v?(c="Infinity",v<0&&(c="-"+c)):c="NaN":(a==null?c=p<=u||p>=d?xt(ue(h.c),p):we(ue(h.c),p,"0"):a===10&&W?(h=de(new L(h),o+p+1,l),c=we(ue(h.c),h.e,"0")):(q(a,2,N.length,"Base"),c=t(we(ue(h.c),p,"0"),10,a,v,!0)),v<0&&h.c[0]&&(c="-"+c)),c},s.valueOf=s.toJSON=function(){return Se(this)},s._isBigNumber=!0,s[Symbol.toStringTag]="BigNumber",s[Symbol.for("nodejs.util.inspect.custom")]=s.valueOf,i!=null&&L.set(i),L}function he(i){var e=i|0;return i>0||i===e?e:e-1}function ue(i){for(var e,t,r=1,s=i.length,n=i[0]+"";r<s;){for(e=i[r++]+"",t=R-e.length;t--;e="0"+e);n+=e}for(s=n.length;n.charCodeAt(--s)===48;);return n.slice(0,s+1||1)}function Ie(i,e){var t,r,s=i.c,n=e.c,o=i.s,l=e.s,u=i.e,d=e.e;if(!o||!l)return null;if(t=s&&!s[0],r=n&&!n[0],t||r)return t?r?0:-l:o;if(o!=l)return o;if(t=o<0,r=u==d,!s||!n)return r?0:!s^t?1:-1;if(!r)return u>d^t?1:-1;for(l=(u=s.length)<(d=n.length)?u:d,o=0;o<l;o++)if(s[o]!=n[o])return s[o]>n[o]^t?1:-1;return u==d?0:u>d^t?1:-1}function q(i,e,t,r){if(i<e||i>t||i!==ce(i))throw Error(se+(r||"Argument")+(typeof i=="number"?i<e||i>t?" out of range: ":" not an integer: ":" not a primitive number: ")+String(i))}function wt(i){var e=i.c.length-1;return he(i.e/R)==e&&i.c[e]%2!=0}function xt(i,e){return(i.length>1?i.charAt(0)+"."+i.slice(1):i)+(e<0?"e":"e+")+e}function we(i,e,t){var r,s;if(e<0){for(s=t+".";++e;s+=t);i=s+i}else if(r=i.length,++e>r){for(s=t,e-=r;--e;s+=t);i+=s}else e<r&&(i=i.slice(0,e)+"."+i.slice(e));return i}var ge=lr(),Fs=class{key;left=null;right=null;constructor(i){this.key=i}},it=class extends Fs{constructor(i){super(i)}},Ws=class{size=0;modificationCount=0;splayCount=0;splay(i){const e=this.root;if(e==null)return this.compare(i,i),-1;let t=null,r=null,s=null,n=null,o=e;const l=this.compare;let u;for(;;)if(u=l(o.key,i),u>0){let d=o.left;if(d==null||(u=l(d.key,i),u>0&&(o.left=d.right,d.right=o,o=d,d=o.left,d==null)))break;t==null?r=o:t.left=o,t=o,o=d}else if(u<0){let d=o.right;if(d==null||(u=l(d.key,i),u<0&&(o.right=d.left,d.left=o,o=d,d=o.right,d==null)))break;s==null?n=o:s.right=o,s=o,o=d}else break;return s!=null&&(s.right=o.left,o.left=n),t!=null&&(t.left=o.right,o.right=r),this.root!==o&&(this.root=o,this.splayCount++),u}splayMin(i){let e=i,t=e.left;for(;t!=null;){const r=t;e.left=r.right,r.right=e,e=r,t=e.left}return e}splayMax(i){let e=i,t=e.right;for(;t!=null;){const r=t;e.right=r.left,r.left=e,e=r,t=e.right}return e}_delete(i){if(this.root==null||this.splay(i)!=0)return null;let t=this.root;const r=t,s=t.left;if(this.size--,s==null)this.root=t.right;else{const n=t.right;t=this.splayMax(s),t.right=n,this.root=t}return this.modificationCount++,r}addNewRoot(i,e){this.size++,this.modificationCount++;const t=this.root;if(t==null){this.root=i;return}e<0?(i.left=t,i.right=t.right,t.right=null):(i.right=t,i.left=t.left,t.left=null),this.root=i}_first(){const i=this.root;return i==null?null:(this.root=this.splayMin(i),this.root)}_last(){const i=this.root;return i==null?null:(this.root=this.splayMax(i),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(i){return this.validKey(i)&&this.splay(i)==0}defaultCompare(){return(i,e)=>i<e?-1:i>e?1:0}wrap(){return{getRoot:()=>this.root,setRoot:i=>{this.root=i},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:i=>{this.splayCount=i},splay:i=>this.splay(i),has:i=>this.has(i)}}},St=class ot extends Ws{root=null;compare;validKey;constructor(e,t){super(),this.compare=e??this.defaultCompare(),this.validKey=t??(r=>r!=null&&r!=null)}delete(e){return this.validKey(e)?this._delete(e)!=null:!1}deleteAll(e){for(const t of e)this.delete(t)}forEach(e){const t=this[Symbol.iterator]();let r;for(;r=t.next(),!r.done;)e(r.value,r.value,this)}add(e){const t=this.splay(e);return t!=0&&this.addNewRoot(new it(e),t),this}addAndReturn(e){const t=this.splay(e);return t!=0&&this.addNewRoot(new it(e),t),this.root.key}addAll(e){for(const t of e)this.add(t)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(this.size==0)throw"Bad state: No element";return this._first().key}last(){if(this.size==0)throw"Bad state: No element";return this._last().key}lastBefore(e){if(e==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(e)<0)return this.root.key;let r=this.root.left;if(r==null)return null;let s=r.right;for(;s!=null;)r=s,s=r.right;return r.key}firstAfter(e){if(e==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(e)>0)return this.root.key;let r=this.root.right;if(r==null)return null;let s=r.left;for(;s!=null;)r=s,s=r.left;return r.key}retainAll(e){const t=new ot(this.compare,this.validKey),r=this.modificationCount;for(const s of e){if(r!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(s)&&this.splay(s)==0&&t.add(this.root.key)}t.size!=this.size&&(this.root=t.root,this.size=t.size,this.modificationCount++)}lookup(e){return!this.validKey(e)||this.splay(e)!=0?null:this.root.key}intersection(e){const t=new ot(this.compare,this.validKey);for(const r of this)e.has(r)&&t.add(r);return t}difference(e){const t=new ot(this.compare,this.validKey);for(const r of this)e.has(r)||t.add(r);return t}union(e){const t=this.clone();return t.addAll(e),t}clone(){const e=new ot(this.compare,this.validKey);return e.size=this.size,e.root=this.copyNode(this.root),e}copyNode(e){if(e==null)return null;function t(s,n){let o,l;do{if(o=s.left,l=s.right,o!=null){const u=new it(o.key);n.left=u,t(o,u)}if(l!=null){const u=new it(l.key);n.right=u,s=l,n=u}}while(l!=null)}const r=new it(e.key);return t(e,r),r}toSet(){return this.clone()}entries(){return new qs(this.wrap())}keys(){return this[Symbol.iterator]()}undefined(){return this[Symbol.iterator]()}[Symbol.iterator](){return new zs(this.wrap())}[Symbol.toStringTag]="[object Set]"},ar=class{tree;path=new Array;modificationCount=null;splayCount;constructor(i){this.tree=i,this.splayCount=i.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;const i=this.path[this.path.length-1];return this.getValue(i)}rebuildPath(i){this.path.splice(0,this.path.length),this.tree.splay(i),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(i){for(;i!=null;)this.path.push(i),i=i.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let t=this.tree.getRoot();for(;t!=null;)this.path.push(t),t=t.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let i=this.path[this.path.length-1],e=i.right;if(e!=null){for(;e!=null;)this.path.push(e),e=e.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===i;)i=this.path.pop();return this.path.length>0}},zs=class extends ar{getValue(i){return i.key}},qs=class extends ar{getValue(i){return[i.key,i.key]}},cr=i=>()=>i,ni=i=>{const e=i?(t,r)=>r.minus(t).abs().isLessThanOrEqualTo(i):cr(!1);return(t,r)=>e(t,r)?0:t.comparedTo(r)};function Hs(i){const e=i?(t,r,s,n,o)=>t.exponentiatedBy(2).isLessThanOrEqualTo(n.minus(r).exponentiatedBy(2).plus(o.minus(s).exponentiatedBy(2)).times(i)):cr(!1);return(t,r,s)=>{const n=t.x,o=t.y,l=s.x,u=s.y,d=o.minus(u).times(r.x.minus(l)).minus(n.minus(l).times(r.y.minus(u)));return e(d,n,o,l,u)?0:d.comparedTo(0)}}var js=i=>i,Vs=i=>{if(i){const e=new St(ni(i)),t=new St(ni(i)),r=(n,o)=>o.addAndReturn(n),s=n=>({x:r(n.x,e),y:r(n.y,t)});return s({x:new ge(0),y:new ge(0)}),s}return js},oi=i=>({set:e=>{xe=oi(e)},reset:()=>oi(i),compare:ni(i),snap:Vs(i),orient:Hs(i)}),xe=oi(),rt=(i,e)=>i.ll.x.isLessThanOrEqualTo(e.x)&&e.x.isLessThanOrEqualTo(i.ur.x)&&i.ll.y.isLessThanOrEqualTo(e.y)&&e.y.isLessThanOrEqualTo(i.ur.y),li=(i,e)=>{if(e.ur.x.isLessThan(i.ll.x)||i.ur.x.isLessThan(e.ll.x)||e.ur.y.isLessThan(i.ll.y)||i.ur.y.isLessThan(e.ll.y))return null;const t=i.ll.x.isLessThan(e.ll.x)?e.ll.x:i.ll.x,r=i.ur.x.isLessThan(e.ur.x)?i.ur.x:e.ur.x,s=i.ll.y.isLessThan(e.ll.y)?e.ll.y:i.ll.y,n=i.ur.y.isLessThan(e.ur.y)?i.ur.y:e.ur.y;return{ll:{x:t,y:s},ur:{x:r,y:n}}},Lt=(i,e)=>i.x.times(e.y).minus(i.y.times(e.x)),hr=(i,e)=>i.x.times(e.x).plus(i.y.times(e.y)),_t=i=>hr(i,i).sqrt(),Zs=(i,e,t)=>{const r={x:e.x.minus(i.x),y:e.y.minus(i.y)},s={x:t.x.minus(i.x),y:t.y.minus(i.y)};return Lt(s,r).div(_t(s)).div(_t(r))},Ks=(i,e,t)=>{const r={x:e.x.minus(i.x),y:e.y.minus(i.y)},s={x:t.x.minus(i.x),y:t.y.minus(i.y)};return hr(s,r).div(_t(s)).div(_t(r))},ur=(i,e,t)=>e.y.isZero()?null:{x:i.x.plus(e.x.div(e.y).times(t.minus(i.y))),y:t},dr=(i,e,t)=>e.x.isZero()?null:{x:t,y:i.y.plus(e.y.div(e.x).times(t.minus(i.x)))},Ys=(i,e,t,r)=>{if(e.x.isZero())return dr(t,r,i.x);if(r.x.isZero())return dr(i,e,t.x);if(e.y.isZero())return ur(t,r,i.y);if(r.y.isZero())return ur(i,e,t.y);const s=Lt(e,r);if(s.isZero())return null;const n={x:t.x.minus(i.x),y:t.y.minus(i.y)},o=Lt(n,e).div(s),l=Lt(n,r).div(s),u=i.x.plus(l.times(e.x)),d=t.x.plus(o.times(r.x)),x=i.y.plus(l.times(e.y)),w=t.y.plus(o.times(r.y)),_=u.plus(d).div(2),M=x.plus(w).div(2);return{x:_,y:M}},ye=class xr{point;isLeft;segment;otherSE;consumedBy;static compare(e,t){const r=xr.comparePoints(e.point,t.point);return r!==0?r:(e.point!==t.point&&e.link(t),e.isLeft!==t.isLeft?e.isLeft?1:-1:Mt.compare(e.segment,t.segment))}static comparePoints(e,t){return e.x.isLessThan(t.x)?-1:e.x.isGreaterThan(t.x)?1:e.y.isLessThan(t.y)?-1:e.y.isGreaterThan(t.y)?1:0}constructor(e,t){e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=t}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");const t=e.point.events;for(let r=0,s=t.length;r<s;r++){const n=t[r];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){const e=this.point.events.length;for(let t=0;t<e;t++){const r=this.point.events[t];if(r.segment.consumedBy===void 0)for(let s=t+1;s<e;s++){const n=this.point.events[s];n.consumedBy===void 0&&r.otherSE.point.events===n.otherSE.point.events&&r.segment.consume(n.segment)}}}getAvailableLinkedEvents(){const e=[];for(let t=0,r=this.point.events.length;t<r;t++){const s=this.point.events[t];s!==this&&!s.segment.ringOut&&s.segment.isInResult()&&e.push(s)}return e}getLeftmostComparator(e){const t=new Map,r=s=>{const n=s.otherSE;t.set(s,{sine:Zs(this.point,e.point,n.point),cosine:Ks(this.point,e.point,n.point)})};return(s,n)=>{t.has(s)||r(s),t.has(n)||r(n);const{sine:o,cosine:l}=t.get(s),{sine:u,cosine:d}=t.get(n);return o.isGreaterThanOrEqualTo(0)&&u.isGreaterThanOrEqualTo(0)?l.isLessThan(d)?1:l.isGreaterThan(d)?-1:0:o.isLessThan(0)&&u.isLessThan(0)?l.isLessThan(d)?-1:l.isGreaterThan(d)?1:0:u.isLessThan(o)?-1:u.isGreaterThan(o)?1:0}}},Xs=class hi{events;poly;_isExteriorRing;_enclosingRing;static factory(e){const t=[];for(let r=0,s=e.length;r<s;r++){const n=e[r];if(!n.isInResult()||n.ringOut)continue;let o=null,l=n.leftSE,u=n.rightSE;const d=[l],x=l.point,w=[];for(;o=l,l=u,d.push(l),l.point!==x;)for(;;){const _=l.getAvailableLinkedEvents();if(_.length===0){const G=d[0].point,N=d[d.length-1].point;throw new Error(`Unable to complete output ring starting at [${G.x}, ${G.y}]. Last matching segment found ends at [${N.x}, ${N.y}].`)}if(_.length===1){u=_[0].otherSE;break}let M=null;for(let G=0,N=w.length;G<N;G++)if(w[G].point===l.point){M=G;break}if(M!==null){const G=w.splice(M)[0],N=d.splice(G.index);N.unshift(N[0].otherSE),t.push(new hi(N.reverse()));continue}w.push({index:d.length,point:l.point});const C=l.getLeftmostComparator(o);u=_.sort(C)[0].otherSE;break}t.push(new hi(d))}return t}constructor(e){this.events=e;for(let t=0,r=e.length;t<r;t++)e[t].segment.ringOut=this;this.poly=null}getGeom(){let e=this.events[0].point;const t=[e];for(let d=1,x=this.events.length-1;d<x;d++){const w=this.events[d].point,_=this.events[d+1].point;xe.orient(w,e,_)!==0&&(t.push(w),e=w)}if(t.length===1)return null;const r=t[0],s=t[1];xe.orient(r,e,s)===0&&t.shift(),t.push(t[0]);const n=this.isExteriorRing()?1:-1,o=this.isExteriorRing()?0:t.length-1,l=this.isExteriorRing()?t.length:-1,u=[];for(let d=o;d!=l;d+=n)u.push([t[d].x.toNumber(),t[d].y.toNumber()]);return u}isExteriorRing(){if(this._isExteriorRing===void 0){const e=this.enclosingRing();this._isExteriorRing=e?!e.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let e=this.events[0];for(let s=1,n=this.events.length;s<n;s++){const o=this.events[s];ye.compare(e,o)>0&&(e=o)}let t=e.segment.prevInResult(),r=t?t.prevInResult():null;for(;;){if(!t)return null;if(!r)return t.ringOut;if(r.ringOut!==t.ringOut)return r.ringOut?.enclosingRing()!==t.ringOut?t.ringOut:t.ringOut?.enclosingRing();t=r.prevInResult(),r=t?t.prevInResult():null}}},fr=class{exteriorRing;interiorRings;constructor(i){this.exteriorRing=i,i.poly=this,this.interiorRings=[]}addInterior(i){this.interiorRings.push(i),i.poly=this}getGeom(){const i=this.exteriorRing.getGeom();if(i===null)return null;const e=[i];for(let t=0,r=this.interiorRings.length;t<r;t++){const s=this.interiorRings[t].getGeom();s!==null&&e.push(s)}return e}},Qs=class{rings;polys;constructor(i){this.rings=i,this.polys=this._composePolys(i)}getGeom(){const i=[];for(let e=0,t=this.polys.length;e<t;e++){const r=this.polys[e].getGeom();r!==null&&i.push(r)}return i}_composePolys(i){const e=[];for(let t=0,r=i.length;t<r;t++){const s=i[t];if(!s.poly)if(s.isExteriorRing())e.push(new fr(s));else{const n=s.enclosingRing();n?.poly||e.push(new fr(n)),n?.poly?.addInterior(s)}}return e}},Js=class{queue;tree;segments;constructor(i,e=Mt.compare){this.queue=i,this.tree=new St(e),this.segments=[]}process(i){const e=i.segment,t=[];if(i.consumedBy)return i.isLeft?this.queue.delete(i.otherSE):this.tree.delete(e),t;i.isLeft&&this.tree.add(e);let r=e,s=e;do r=this.tree.lastBefore(r);while(r!=null&&r.consumedBy!=null);do s=this.tree.firstAfter(s);while(s!=null&&s.consumedBy!=null);if(i.isLeft){let n=null;if(r){const l=r.getIntersection(e);if(l!==null&&(e.isAnEndpoint(l)||(n=l),!r.isAnEndpoint(l))){const u=this._splitSafely(r,l);for(let d=0,x=u.length;d<x;d++)t.push(u[d])}}let o=null;if(s){const l=s.getIntersection(e);if(l!==null&&(e.isAnEndpoint(l)||(o=l),!s.isAnEndpoint(l))){const u=this._splitSafely(s,l);for(let d=0,x=u.length;d<x;d++)t.push(u[d])}}if(n!==null||o!==null){let l=null;n===null?l=o:o===null?l=n:l=ye.comparePoints(n,o)<=0?n:o,this.queue.delete(e.rightSE),t.push(e.rightSE);const u=e.split(l);for(let d=0,x=u.length;d<x;d++)t.push(u[d])}t.length>0?(this.tree.delete(e),t.push(i)):(this.segments.push(e),e.prev=r)}else{if(r&&s){const n=r.getIntersection(s);if(n!==null){if(!r.isAnEndpoint(n)){const o=this._splitSafely(r,n);for(let l=0,u=o.length;l<u;l++)t.push(o[l])}if(!s.isAnEndpoint(n)){const o=this._splitSafely(s,n);for(let l=0,u=o.length;l<u;l++)t.push(o[l])}}}this.tree.delete(e)}return t}_splitSafely(i,e){this.tree.delete(i);const t=i.rightSE;this.queue.delete(t);const r=i.split(e);return r.push(t),i.consumedBy===void 0&&this.tree.add(i),r}},en=class{type;numMultiPolys;run(i,e,t){st.type=i;const r=[new mr(e,!0)];for(let d=0,x=t.length;d<x;d++)r.push(new mr(t[d],!1));if(st.numMultiPolys=r.length,st.type==="difference"){const d=r[0];let x=1;for(;x<r.length;)li(r[x].bbox,d.bbox)!==null?x++:r.splice(x,1)}if(st.type==="intersection")for(let d=0,x=r.length;d<x;d++){const w=r[d];for(let _=d+1,M=r.length;_<M;_++)if(li(w.bbox,r[_].bbox)===null)return[]}const s=new St(ye.compare);for(let d=0,x=r.length;d<x;d++){const w=r[d].getSweepEvents();for(let _=0,M=w.length;_<M;_++)s.add(w[_])}const n=new Js(s);let o=null;for(s.size!=0&&(o=s.first(),s.delete(o));o;){const d=n.process(o);for(let x=0,w=d.length;x<w;x++){const _=d[x];_.consumedBy===void 0&&s.add(_)}s.size!=0?(o=s.first(),s.delete(o)):o=null}xe.reset();const l=Xs.factory(n.segments);return new Qs(l).getGeom()}},st=new en,$t=st,tn=0,Mt=class At{id;leftSE;rightSE;rings;windings;ringOut;consumedBy;prev;_prevInResult;_beforeState;_afterState;_isInResult;static compare(e,t){const r=e.leftSE.point.x,s=t.leftSE.point.x,n=e.rightSE.point.x,o=t.rightSE.point.x;if(o.isLessThan(r))return 1;if(n.isLessThan(s))return-1;const l=e.leftSE.point.y,u=t.leftSE.point.y,d=e.rightSE.point.y,x=t.rightSE.point.y;if(r.isLessThan(s)){if(u.isLessThan(l)&&u.isLessThan(d))return 1;if(u.isGreaterThan(l)&&u.isGreaterThan(d))return-1;const w=e.comparePoint(t.leftSE.point);if(w<0)return 1;if(w>0)return-1;const _=t.comparePoint(e.rightSE.point);return _!==0?_:-1}if(r.isGreaterThan(s)){if(l.isLessThan(u)&&l.isLessThan(x))return-1;if(l.isGreaterThan(u)&&l.isGreaterThan(x))return 1;const w=t.comparePoint(e.leftSE.point);if(w!==0)return w;const _=e.comparePoint(t.rightSE.point);return _<0?1:_>0?-1:1}if(l.isLessThan(u))return-1;if(l.isGreaterThan(u))return 1;if(n.isLessThan(o)){const w=t.comparePoint(e.rightSE.point);if(w!==0)return w}if(n.isGreaterThan(o)){const w=e.comparePoint(t.rightSE.point);if(w<0)return 1;if(w>0)return-1}if(!n.eq(o)){const w=d.minus(l),_=n.minus(r),M=x.minus(u),C=o.minus(s);if(w.isGreaterThan(_)&&M.isLessThan(C))return 1;if(w.isLessThan(_)&&M.isGreaterThan(C))return-1}return n.isGreaterThan(o)?1:n.isLessThan(o)||d.isLessThan(x)?-1:d.isGreaterThan(x)?1:e.id<t.id?-1:e.id>t.id?1:0}constructor(e,t,r,s){this.id=++tn,this.leftSE=e,e.segment=this,e.otherSE=t,this.rightSE=t,t.segment=this,t.otherSE=e,this.rings=r,this.windings=s}static fromRing(e,t,r){let s,n,o;const l=ye.comparePoints(e,t);if(l<0)s=e,n=t,o=1;else if(l>0)s=t,n=e,o=-1;else throw new Error(`Tried to create degenerate segment at [${e.x}, ${e.y}]`);const u=new ye(s,!0),d=new ye(n,!1);return new At(u,d,[r],[o])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const e=this.leftSE.point.y,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e.isLessThan(t)?e:t},ur:{x:this.rightSE.point.x,y:e.isGreaterThan(t)?e:t}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(e){return e.x.eq(this.leftSE.point.x)&&e.y.eq(this.leftSE.point.y)||e.x.eq(this.rightSE.point.x)&&e.y.eq(this.rightSE.point.y)}comparePoint(e){return xe.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){const t=this.bbox(),r=e.bbox(),s=li(t,r);if(s===null)return null;const n=this.leftSE.point,o=this.rightSE.point,l=e.leftSE.point,u=e.rightSE.point,d=rt(t,l)&&this.comparePoint(l)===0,x=rt(r,n)&&e.comparePoint(n)===0,w=rt(t,u)&&this.comparePoint(u)===0,_=rt(r,o)&&e.comparePoint(o)===0;if(x&&d)return _&&!w?o:!_&&w?u:null;if(x)return w&&n.x.eq(u.x)&&n.y.eq(u.y)?null:n;if(d)return _&&o.x.eq(l.x)&&o.y.eq(l.y)?null:l;if(_&&w)return null;if(_)return o;if(w)return u;const M=Ys(n,this.vector(),l,e.vector());return M===null||!rt(s,M)?null:xe.snap(M)}split(e){const t=[],r=e.events!==void 0,s=new ye(e,!0),n=new ye(e,!1),o=this.rightSE;this.replaceRightSE(n),t.push(n),t.push(s);const l=new At(s,o,this.rings.slice(),this.windings.slice());return ye.comparePoints(l.leftSE.point,l.rightSE.point)>0&&l.swapEvents(),ye.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(s.checkForConsuming(),n.checkForConsuming()),t}swapEvents(){const e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let t=0,r=this.windings.length;t<r;t++)this.windings[t]*=-1}consume(e){let t=this,r=e;for(;t.consumedBy;)t=t.consumedBy;for(;r.consumedBy;)r=r.consumedBy;const s=At.compare(t,r);if(s!==0){if(s>0){const n=t;t=r,r=n}if(t.prev===r){const n=t;t=r,r=n}for(let n=0,o=r.rings.length;n<o;n++){const l=r.rings[n],u=r.windings[n],d=t.rings.indexOf(l);d===-1?(t.rings.push(l),t.windings.push(u)):t.windings[d]+=u}r.rings=null,r.windings=null,r.consumedBy=t,r.leftSE.consumedBy=t.leftSE,r.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{const e=this.prev.consumedBy||this.prev;this._beforeState=e.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};const t=this._afterState.rings,r=this._afterState.windings,s=this._afterState.multiPolys;for(let l=0,u=this.rings.length;l<u;l++){const d=this.rings[l],x=this.windings[l],w=t.indexOf(d);w===-1?(t.push(d),r.push(x)):r[w]+=x}const n=[],o=[];for(let l=0,u=t.length;l<u;l++){if(r[l]===0)continue;const d=t[l],x=d.poly;if(o.indexOf(x)===-1)if(d.isExterior)n.push(x);else{o.indexOf(x)===-1&&o.push(x);const w=n.indexOf(d.poly);w!==-1&&n.splice(w,1)}}for(let l=0,u=n.length;l<u;l++){const d=n[l].multiPoly;s.indexOf(d)===-1&&s.push(d)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const e=this.beforeState().multiPolys,t=this.afterState().multiPolys;switch($t.type){case"union":{const r=e.length===0,s=t.length===0;this._isInResult=r!==s;break}case"intersection":{let r,s;e.length<t.length?(r=e.length,s=t.length):(r=t.length,s=e.length),this._isInResult=s===$t.numMultiPolys&&r<s;break}case"xor":{const r=Math.abs(e.length-t.length);this._isInResult=r%2===1;break}case"difference":{const r=s=>s.length===1&&s[0].isSubject;this._isInResult=r(e)!==r(t);break}}return this._isInResult}},pr=class{poly;isExterior;segments;bbox;constructor(i,e,t){if(!Array.isArray(i)||i.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=t,this.segments=[],typeof i[0][0]!="number"||typeof i[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const r=xe.snap({x:new ge(i[0][0]),y:new ge(i[0][1])});this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let s=r;for(let n=1,o=i.length;n<o;n++){if(typeof i[n][0]!="number"||typeof i[n][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const l=xe.snap({x:new ge(i[n][0]),y:new ge(i[n][1])});l.x.eq(s.x)&&l.y.eq(s.y)||(this.segments.push(Mt.fromRing(s,l,this)),l.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=l.x),l.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=l.y),l.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=l.x),l.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=l.y),s=l)}(!r.x.eq(s.x)||!r.y.eq(s.y))&&this.segments.push(Mt.fromRing(s,r,this))}getSweepEvents(){const i=[];for(let e=0,t=this.segments.length;e<t;e++){const r=this.segments[e];i.push(r.leftSE),i.push(r.rightSE)}return i}},rn=class{multiPoly;exteriorRing;interiorRings;bbox;constructor(i,e){if(!Array.isArray(i))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new pr(i[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 t=1,r=i.length;t<r;t++){const s=new pr(i[t],this,!1);s.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=s.bbox.ur.y),this.interiorRings.push(s)}this.multiPoly=e}getSweepEvents(){const i=this.exteriorRing.getSweepEvents();for(let e=0,t=this.interiorRings.length;e<t;e++){const r=this.interiorRings[e].getSweepEvents();for(let s=0,n=r.length;s<n;s++)i.push(r[s])}return i}},mr=class{isSubject;polys;bbox;constructor(i,e){if(!Array.isArray(i))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof i[0][0][0]=="number"&&(i=[i])}catch{}this.polys=[],this.bbox={ll:{x:new ge(Number.POSITIVE_INFINITY),y:new ge(Number.POSITIVE_INFINITY)},ur:{x:new ge(Number.NEGATIVE_INFINITY),y:new ge(Number.NEGATIVE_INFINITY)}};for(let t=0,r=i.length;t<r;t++){const s=new rn(i[t],this);s.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=s.bbox.ur.y),this.polys.push(s)}this.isSubject=e}getSweepEvents(){const i=[];for(let e=0,t=this.polys.length;e<t;e++){const r=this.polys[e].getSweepEvents();for(let s=0,n=r.length;s<n;s++)i.push(r[s])}return i}},sn=(i,...e)=>$t.run("union",i,e),nn=(i,...e)=>$t.run("difference",i,e);xe.set;function on(i,e={}){const t=[];if(ei(i,s=>{t.push(s.coordinates)}),t.length<2)throw new Error("Must have at least 2 geometries");const r=sn(t[0],...t.slice(1));return r.length===0?null:r.length===1?Jt(r[0],e.properties):sr(r,e.properties)}var gr=on;function ln(i){const e=[];if(ei(i,s=>{e.push(s.coordinates)}),e.length<2)throw new Error("Must have at least two features");const t=i.features[0].properties||{},r=nn(e[0],...e.slice(1));return r.length===0?null:r.length===1?Jt(r[0],t):sr(r,t)}var an=ln;function cn(i){if(!i)throw new Error("geojson is required");var e=[];return Us(i,function(t){e.push(t)}),tt(e)}var hn=cn;function yr(i){const e=an(tt([Jt([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),i]));if(!e)return;e.properties={isMask:!0};const t=Ke(ti(i)),r=(t[2]-t[0])/360/1e3,s=t[0]<-180,n=t[2]>180,o=hn(i);if(o.features.length>1&&(s||n))for(const l of o.features){const u=Ke(ti(l));if(n&&u[0]<-180+r)for(const d of l.geometry.coordinates)for(const x of d)x[0]+=360-r;if(s&&u[2]>180-r)for(const d of l.geometry.coordinates)for(const x of d)x[0]-=360-r}return tt([o.features.length<2?i:gr(o)??i,e])}const vr={continental_marine:4,country:4,major_landform:8,region:5,subregion:6,county:7,joint_municipality:8,joint_submunicipality:9,municipality:10,municipal_district:11,locality:12,neighbourhood:13,place:14,postal_code:14,road:16,poi:17,address:18,"poi.peak":15,"poi.shop":18,"poi.cafe":18,"poi.restaurant":18,"poi.aerodrome":13},br=i=>{const e=i?.geometry.type,t=i?.properties?.isMask,r=t?0:e==="LineString"||e==="MultiLineString"?3:2;return{color:"#3170fe",fillColor:"#000",fillOpacity:t?.1:0,weight:r,dashArray:[r,r],lineCap:"butt"}};class Er extends oe.Control{}Object.assign(Er.prototype,oe.Evented.prototype);class wr extends Er{#e;#t;constructor(e={}){super(e)}onAdd(e){this.#e=e,this.#t=e.getContainer().ownerDocument.createElement("maptiler-geocoder"),this.#t.classList.add("leaflet-geocoder"),this.#m(),this.#b(),this.#$();const t=e.getContainer().ownerDocument.createElement("div");return t.classList.add("leaflet-ctrl-geocoder","leaflet-bar"),t.style.zIndex="850",t.appendChild(this.#t),oe.DomEvent.disableClickPropagation(t),oe.DomEvent.disableScrollPropagation(t),t}onRemove(){this.#E(),this.#M(),this.#e=void 0,this.#t=void 0}getOptions(){return{...this.options}}setOptions(e){Object.assign(this.options,e),this.#m()}setQuery(e){this.#t?.setQuery(e)}submitQuery(e){this.#t?.submitQuery(e)}clearMap(){this.#n=[],this.#c(void 0,void 0)}clearList(){this.#t?.clearList()}setReverseMode(e){this.setOptions({reverseActive:e})}focus(e){this.#t?.focus(e)}blur(){this.#t?.blur()}#o=new Map;#l;#s;#n;#d;#r;#f={reversetoggle:e=>{const t=this.#e?.getContainer();t&&(t.style.cursor=e.detail.reverse?"crosshair":""),this.#i("reversetoggle",e.detail)},querychange:e=>{const t=e.detail.reverseCoords;this.#v(t?{lng:t.decimalLongitude,lat:t.decimalLatitude}:void 0),this.#i("querychange",e.detail)},queryclear:()=>{this.#v(void 0),this.#i("queryclear")},request:e=>{this.#i("request",e.detail)},response:e=>{this.#i("response",e.detail)},select:e=>{const t=e.detail.feature;t&&this.#h&&this.options.flyToSelected&&this.#g({lng:t.center[0],lat:t.center[1]},this.#a(t)),this.#n&&t&&this.#_(t),this.#i("select",e.detail)},pick:e=>{const t=e.detail.feature;t&&t.id!==this.#d&&this.#h&&(this.#w(t),this.#c(this.#n,t)),this.#d=t?.id,this.#i("pick",e.detail)},featuresshow:()=>{this.#i("featuresshow")},featureshide:()=>{this.#i("featureshide")},featureslisted:e=>{const t=e.detail.features;this.#n=t,this.#c(this.#n,void 0),this.#x(t),this.#i("featureslisted",e.detail)},featuresclear:()=>{this.#n=void 0,this.#c(void 0,void 0),this.#i("featuresclear")},focusin:()=>{this.#i("focusin")},focusout:()=>{this.#i("focusout")}};#p={render:()=>{const e=this.#e?.getZoom(),t=this.#e?.getCenter();this.#t?.handleMapChange(e&&t?[e,t.lng,t.lat]:void 0)},click:e=>{this.#t?.handleMapClick([e.latlng.lng,e.latlng.lat])}};#m(){this.#t&&(this.#t.setOptions(this.options),this.#t.fetchFullGeometryOnPick=this.options.pickedResultStyle!=="marker-only",this.#t.openListOnTop=this.options.position==="bottomleft"||this.options.position==="bottomright")}#b(){if(!(!this.#t||!this.#e)){for(const[e,t]of Object.entries(this.#f))this.#t.addEventListener(e,t);this.#e.on(this.#p)}}#E(){if(!(!this.#t||!this.#e)){for(const[e,t]of Object.entries(this.#f))this.#t.removeEventListener(e,t);this.#e.off(this.#p)}}#i(e,t){return super.fire(e,t)}#w(e){e.bbox[0]===e.bbox[2]&&e.bbox[1]===e.bbox[3]?this.#g({lng:e.center[0],lat:e.center[1]},this.#a(e)):this.#y(Ke(e.bbox),50,this.#a(e))}#x(e){if(!e||e.length===0||!this.#h)return;const t=e.every(n=>n.matching_text),r=e.reduce((n,o)=>t||!o.matching_text?[Math.min(n[0],o.bbox[0]),Math.min(n[1],o.bbox[1]),Math.max(n[2],o.bbox[2]),Math.max(n[3],o.bbox[3])]:n,[180,90,-180,-90]),s=e.map(n=>this.#a(n)).filter(n=>n!==void 0).reduce((n,o)=>n===void 0?o:Math.max(n,o),void 0);this.#y(Ke(r),50,s)}#a(e){if(e.bbox[0]!==e.bbox[2]||e.bbox[1]!==e.bbox[3])return;const t=e.id.replace(/\..*/,""),r=this.options.zoom??vr;return(Array.isArray(e.properties?.categories)?e.properties.categories.reduce((s,n)=>{const o=r[t+"."+n];return s===void 0?o:o===void 0?s:Math.max(s,o)},void 0):void 0)??r[t]}get#h(){return!!this.options.flyTo||this.options.flyTo===void 0}get#S(){return typeof this.options.flyTo=="boolean"?{}:this.options.flyTo}get#L(){return typeof this.options.flyTo=="boolean"?{}:this.options.flyTo}#g(e,t){this.#e?.flyTo(e,t,this.#S??void 0)}#y(e,t,r){this.#e?.fitBounds([[e[1],e[0]],[e[3],e[2]]],{padding:[t,t],...r?{maxZoom:r}:{},...this.#L})}#v(e){if(!(this.options.marker===!1||this.options.marker===null||!this.#e)){if(!e){this.#s?.remove(),this.#s=void 0;return}this.#s||(this.options.marker instanceof Function?this.#s=this.options.marker(this.#e)??void 0:(this.#s=this.#u(e,this.options.marker).addTo(this.#e),this.#s.getElement()?.classList.add("marker-reverse"))),this.#s?.setLatLng(e)}}#c(e,t){if(!this.#e)return;for(const s of this.#o.undefined())s.remove();this.#o=new Map,this.#r?.clearLayers();const r=()=>{if(!t||!this.#e||this.options.marker===!1||this.options.marker===null)return;const s=this.options.marker instanceof Function?this.options.marker(this.#e,t):this.#u({lng:t.center[0],lat:t.center[1]},this.options.marker).addTo(this.#e);s&&this.#o.set(t,s)};if(t?.geometry.type==="GeometryCollection"){const s=t.geometry.geometries.filter(n=>n.type==="Polygon"||n.type==="MultiPolygon");if(s.length>0){const n=gr(tt(s.map(o=>et(o))));if(n){const o=yr({...t,geometry:n.geometry});if(o){const l=[...o.features],u=Ke(ti(t)),d=u[2]-u[0];u[0]-d/4<-180&&l.push(...Bi(o,-360).features),u[2]+d/4>180&&l.push(...Bi(o,360).features),this.#r?.addData(tt(l))}}}else{const n=t.geometry.geometries.filter(o=>o.type==="LineString"||o.type==="MultiLineString");n.length>0&&this.#r?.addData({...t,geometry:{type:"GeometryCollection",geometries:n}})}}else if(t?.geometry.type.endsWith("Polygon")){const s=yr(t);s&&this.#r?.addData(s),this.options.pickedResultStyle==="full-geometry-including-polygon-center-marker"&&r()}else t?.geometry.type.endsWith("LineString")?this.#r?.addData(t):t?.geometry.type.endsWith("Point")&&r();if(this.options.showResultMarkers!==!1&&this.options.showResultMarkers!==null)for(const s of e??[]){if(s.id===t?.id||s.place_type.includes("reverse"))continue;let n;if(this.options.showResultMarkers instanceof Function){if(n=this.options.showResultMarkers(this.#e,s),!n)continue}else n=this.#u({lng:s.center[0],lat:s.center[1]},this.options.showResultMarkers).bindPopup(new oe.Popup({offset:[.3,-21],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setContent(s.place_type[0]==="reverse"?s.place_name:s.place_name.replace(/,.*/,""))).addTo(this.#e),n.getElement()?.classList.add("marker-interactive");const o=n.getElement();o?.addEventListener("click",l=>{l.stopPropagation(),this.#i("markerclick",{feature:s,marker:n})}),o?.addEventListener("mouseenter",()=>{this.#i("markermouseenter",{feature:s,marker:n}),n.togglePopup()}),o?.addEventListener("mouseleave",()=>{this.#i("markermouseleave",{feature:s,marker:n}),n.togglePopup()}),o?.classList.toggle("marker-fuzzy",!!s.matching_text),this.#o.set(s,n)}}#_(e){this.#l?.getElement()?.classList.toggle("marker-selected",!1),this.#l=void 0,this.options.markerOnSelected!==!1&&(this.#l=this.#o.get(e),this.#l?.getElement()?.classList.toggle("marker-selected",!0))}#$(){this.#e&&(this.#r=new oe.GeoJSON(void 0,{style:this.#C(),interactive:!1}).addTo(this.#e))}#M(){this.#e&&(this.#r?.removeFrom(this.#e),this.#r=void 0)}#u(e,t){return typeof t!="object"&&(t={icon:new oe.DivIcon({html:this.#e?.getContainer().ownerDocument.createElement("maptiler-geocode-marker"),iconAnchor:[12.3,30],className:""})}),new oe.Marker(e,t)}#C(){const{fullGeometryStyle:e}=this.options;if(e===!0||e===void 0)return br;if(!(e===!1||e===null))return e}}$.DEFAULT_GEOMETRY_STYLE=br,$.GeocodingControl=wr,$.LeafletGeocodingControl=wr,$.ZOOM_DEFAULTS=vr,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})}));
|
|
276
276
|
//# sourceMappingURL=leaflet.public.umd.js.map
|