@maptiler/geocoding-control 2.1.4-rc1 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MapLibreBasedGeocodingControl.d.ts +51 -34
- package/leaflet-controller.js +1 -1
- package/leaflet-controller.js.map +1 -1
- package/leaflet-controller.umd.js +1 -1
- package/leaflet-controller.umd.js.map +1 -1
- package/leaflet.js +161 -161
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +2 -2
- package/leaflet.umd.js.map +1 -1
- package/maplibregl-controller.js +29 -29
- package/maplibregl-controller.js.map +1 -1
- package/maplibregl-controller.umd.js +1 -1
- package/maplibregl-controller.umd.js.map +1 -1
- package/maplibregl.d.ts +51 -34
- package/maplibregl.js +1198 -1196
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +5 -5
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.d.ts +51 -34
- package/maptilersdk.js +1199 -1197
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +5 -5
- package/maptilersdk.umd.js.map +1 -1
- package/openlayers-controller.js +35 -35
- package/openlayers-controller.js.map +1 -1
- package/openlayers-controller.umd.js +1 -1
- package/openlayers-controller.umd.js.map +1 -1
- package/openlayers.js +3 -3
- package/openlayers.js.map +1 -1
- package/openlayers.umd.js +1 -1
- package/openlayers.umd.js.map +1 -1
- package/package.json +15 -15
- package/react.js +2 -2
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
- package/svelte/GeocodingControl.svelte +4 -2
- package/svelte/GeocodingControl.svelte.d.ts +1 -1
- package/svelte/MapLibreBasedGeocodingControl.d.ts +51 -34
- package/svelte/MapLibreBasedGeocodingControl.js +4 -0
- package/svelte/info.json +1 -1
- package/svelte/leaflet-controller.js +1 -1
- package/svelte/maplibregl-controller.js +1 -1
- package/svelte/maplibregl.d.ts +51 -34
- package/svelte/maptilersdk.d.ts +51 -34
- package/svelte/openlayers-controller.js +1 -1
- package/svelte/types.d.ts +1 -1
- package/types.d.ts +1 -1
- package/vanilla.js +2 -2
- package/vanilla.js.map +1 -1
- package/vanilla.umd.js +1 -1
- package/vanilla.umd.js.map +1 -1
package/openlayers.umd.js
CHANGED
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
background-image: url(${n[3]}sprite${Jt}.png);
|
|
11
11
|
background-position: -${n[6].x/Ne}px -${n[6].y/Ne}px;
|
|
12
12
|
background-size: ${Re.width/Ne}px ${Re.height/Ne}px;
|
|
13
|
-
`)&&x(e,"style",t),r&128&&x(e,"title",n[7])},d(n){n&&te(e)}}}function Ri(i){let e,t;return{c(){e=K("span"),t=Xe(i[7]),x(e,"class","secondary svelte-w9y5n9")},m(n,r){ne(n,e,r),j(e,t)},p(n,r){r&128&&pt(t,n[7])},d(n){n&&te(e)}}}function hr(i){let e,t,n,r,u,a,o,g,h,b=(i[8]?i[0].place_name:i[0].place_name.replace(/,.*/,""))+"",S,M,k=i[2]==="always"||i[2]!=="never"&&!i[0].address&&!i[0].id.startsWith("road.")&&!i[0].id.startsWith("address.")&&!i[0].id.startsWith("postal_code.")&&(!i[0].id.startsWith("poi.")||!i[5])&&!i[8],N,C,O=(i[8]?"":i[0].place_name.replace(/[^,]*,?\s*/,""))+"",I,_,R,z,Y,Z;function B(m,c){return c&1&&(t=null),c&1&&(n=null),c&1&&(r=null),c&1&&(u=null),Re&&m[6]?cr:m[5]?fr:m[0].address?ar:(t==null&&(t=!!m[0].id.startsWith("road.")),t?ur:(n==null&&(n=!!m[0].id.startsWith("address.")),n?lr:(r==null&&(r=!!m[0].id.startsWith("postal_code.")),r?or:(u==null&&(u=!!m[0].id.startsWith("poi.")),u?sr:m[8]?rr:nr))))}let s=B(i,-1),l=s(i),f=k&&Ri(i);return{c(){e=K("li"),l.c(),a=Ee(),o=K("span"),g=K("span"),h=K("span"),S=Xe(b),M=Ee(),f&&f.c(),N=Ee(),C=K("span"),I=Xe(O),x(h,"class","primary svelte-w9y5n9"),x(g,"class","svelte-w9y5n9"),x(C,"class","line2 svelte-w9y5n9"),x(o,"class","texts svelte-w9y5n9"),x(e,"tabindex","-1"),x(e,"role","option"),x(e,"aria-selected",_=i[1]==="selected"),x(e,"aria-checked",R=i[1]==="picked"),x(e,"class",z=Ot(i[1])+" svelte-w9y5n9")},m(m,c){ne(m,e,c),l.m(e,null),j(e,a),j(e,o),j(o,g),j(g,h),j(h,S),j(g,M),f&&f.m(g,null),j(o,N),j(o,C),j(C,I),Y||(Z=[de(e,"mouseenter",i[13]),de(e,"focus",i[15]),de(e,"click",i[16])],Y=!0)},p(m,[c]){s===(s=B(m,c))&&l?l.p(m,c):(l.d(1),l=s(m),l&&(l.c(),l.m(e,a))),c&257&&b!==(b=(m[8]?m[0].place_name:m[0].place_name.replace(/,.*/,""))+"")&&pt(S,b),c&293&&(k=m[2]==="always"||m[2]!=="never"&&!m[0].address&&!m[0].id.startsWith("road.")&&!m[0].id.startsWith("address.")&&!m[0].id.startsWith("postal_code.")&&(!m[0].id.startsWith("poi.")||!m[5])&&!m[8]),k?f?f.p(m,c):(f=Ri(m),f.c(),f.m(g,null)):f&&(f.d(1),f=null),c&257&&O!==(O=(m[8]?"":m[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&pt(I,O),c&2&&_!==(_=m[1]==="selected")&&x(e,"aria-selected",_),c&2&&R!==(R=m[1]==="picked")&&x(e,"aria-checked",R),c&2&&z!==(z=Ot(m[1])+" svelte-w9y5n9")&&x(e,"class",z)},i:se,o:se,d(m){m&&te(e),l.d(),f&&f.d(),Y=!1,Ue(Z)}}}const Ii=typeof devicePixelRatio>"u"?1:devicePixelRatio>1.25,Jt=Ii?"@2x":"",Ne=Ii?2:1;let Re,At;function dr(i,e,t){let n,r,u,{feature:a}=e,{style:o="default"}=e,{showPlaceType:g}=e,{missingIconsCache:h}=e,{iconsBaseUrl:b}=e;const S=Mi();let M,k,N,C;function O(){At??(At=fetch(`${b}sprite${Jt}.json`).then(s=>s.json()).then(s=>{Re=s}).catch(()=>{Re=null}))}function I(){k&&h.add(k),_()}function _(){Re!==void 0?R():(O(),At==null||At.then(R))}function R(){do{if(C--,t(4,M=n==null?void 0:n[C]),t(6,N=M?Re==null?void 0:Re.icons[M]:void 0),N)break;t(5,k=M?b+M.replace(/ /g,"_")+".svg":void 0)}while(C>-1&&(!k||h.has(k)))}function z(s){Hn.call(this,i,s)}const Y=()=>I(),Z=()=>S("select",void 0),B=s=>{document.activeElement!==s.target&&S("select",void 0)};return i.$$set=s=>{"feature"in s&&t(0,a=s.feature),"style"in s&&t(1,o=s.style),"showPlaceType"in s&&t(2,g=s.showPlaceType),"missingIconsCache"in s&&t(11,h=s.missingIconsCache),"iconsBaseUrl"in s&&t(3,b=s.iconsBaseUrl)},i.$$.update=()=>{var s,l,f,m,c;i.$$.dirty&1&&t(12,n=(s=a.properties)==null?void 0:s.categories),i.$$.dirty&1&&t(8,r=a.place_type[0]==="reverse"),i.$$.dirty&1&&t(7,u=((f=(l=a.properties)==null?void 0:l.categories)==null?void 0:f.join(", "))??((c=(m=a.properties)==null?void 0:m.place_type_name)==null?void 0:c[0])??a.place_type[0]),i.$$.dirty&4096&&(C=(n==null?void 0:n.length)??0,_())},[a,o,g,b,M,k,N,u,r,S,I,h,n,z,Y,Z,B]}class gr extends st{constructor(e){super(),rt(this,e,dr,hr,it,{feature:0,style:1,showPlaceType:2,missingIconsCache:11,iconsBaseUrl:3})}}function mr(i){let e;return{c(){e=K("div"),e.innerHTML='<svg viewBox="0 0 18 18" width="24" height="24" class="svelte-7cmwmc"><path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"></path><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"></path></svg>',x(e,"class","svelte-7cmwmc")},m(t,n){ne(t,e,n)},p:se,i:se,o:se,d(t){t&&te(e)}}}class yr extends st{constructor(e){super(),rt(this,e,null,mr,it,{})}}function pr(i){let e,t;return{c(){e=qe("svg"),t=qe("path"),x(t,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),x(e,"viewBox","0 0 60.006 21.412"),x(e,"width","14"),x(e,"height","20"),x(e,"class","svelte-en2qvf")},m(n,r){ne(n,e,r),j(e,t)},p:se,i:se,o:se,d(n){n&&te(e)}}}class vr extends st{constructor(e){super(),rt(this,e,null,pr,it,{})}}function br(i){let e,t,n;return{c(){e=qe("svg"),t=qe("circle"),n=qe("path"),x(t,"cx","4.789"),x(t,"cy","4.787"),x(t,"r","3.85"),x(t,"class","svelte-1aq105l"),x(n,"d","M12.063 12.063 7.635 7.635"),x(n,"class","svelte-1aq105l"),x(e,"xmlns","http://www.w3.org/2000/svg"),x(e,"width","13"),x(e,"height","13"),x(e,"viewBox","0 0 13 13"),x(e,"class","svelte-1aq105l")},m(r,u){ne(r,e,u),j(e,t),j(e,n)},p:se,i:se,o:se,d(r){r&&te(e)}}}class wr extends st{constructor(e){super(),rt(this,e,null,br,it,{})}}function Er(i,e,t){const n=e[1],r=e[0],u=n-r;return i===n&&t?i:((i-r)%u+u)%u+r}function Gt(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}let wt;async function Lr(i,e,t){const n=i==null?void 0:i.getCenterAndZoom();for(const r of e??[])if(!(n&&(r.minZoom!=null&&r.minZoom>n[0]||r.maxZoom!=null&&r.maxZoom<n[0]))){if(r.type==="fixed")return r.coordinates.join(",");e:if(r.type==="client-geolocation"){if(wt&&r.cachedLocationExpiry&&wt.time+r.cachedLocationExpiry>Date.now()){if(!wt.coords)break e;return wt.coords}let u;try{return u=await new Promise((a,o)=>{t.signal.addEventListener("abort",()=>{o(Error("aborted"))}),navigator.geolocation.getCurrentPosition(g=>{a([g.coords.longitude,g.coords.latitude].map(h=>h.toFixed(6)).join(","))},g=>{o(g)},r)}),u}catch{}finally{r.cachedLocationExpiry&&(wt={time:Date.now(),coords:u})}if(t.signal.aborted)return}if(r.type==="server-geolocation")return"ip";if(n&&r.type==="map-center")return n[1].toFixed(6)+","+n[2].toFixed(6)}}const Sr=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(EAST|WEST|[EW])?$/i,Ai=/^([+-]?[0-8]?[0-9])\s+([0-5]?[0-9]\.\d{3,})[\s,]{1,}([+-]?[0-1]?[0-9]?[0-9])\s+([0-5]?[0-9]\.\d{3,})$/,Gi=/^(NORTH|SOUTH|[NS])?[\s]*([+-]?[0-8]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(NORTH|SOUTH|[NS])?[\s]*[,/;]?[\s]*(EAST|WEST|[EW])?[\s]*([+-]?[0-1]?[0-9]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(EAST|WEST|[EW])?$/i,Bi=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(EAST|WEST|[EW])?$/i,Wi=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)\s*(EAST|WEST|[EW])?$/i,Fi=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|’’|´´|["″”\.])?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|´´|’’|["″”\.])?\s*(EAST|WEST|[EW])?$/i;function _r(i){if(!["DMS","DM","DD"].includes(i))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){const e=this.decimalCoordinates.split(",").map(k=>Number(k.trim())),t=Number(e[0]),n=Number(e[1]),r=Math.abs(t),u=Math.abs(n),a=t>0?"N":"S",o=n>0?"E":"W";let g;i=="DD"&&(g=`${r}° ${a}, ${u}° ${o}`);const h=Math.floor(r),b=Math.floor(u),S=(r-h)*60,M=(u-b)*60;if(i=="DM"){let k=zi(S,3).toFixed(3).padStart(6,"0"),N=zi(M,3).toFixed(3).padStart(6,"0");k.endsWith(".000")&&N.endsWith(".000")&&(k=k.replace(/\.000$/,""),N=N.replace(/\.000$/,"")),g=`${h}° ${k}' ${a}, ${b}° ${N}' ${o}`}if(i=="DMS"){const k=Math.floor(S),N=Math.floor(M);let C=((S-k)*60).toFixed(1).padStart(4,"0"),O=((M-N)*60).toFixed(1).padStart(4,"0");const I=k.toString().padStart(2,"0"),_=N.toString().padStart(2,"0");C.endsWith(".0")&&O.endsWith(".0")&&(C=C.replace(/\.0$/,""),O=O.replace(/\.0$/,"")),g=`${h}° ${I}' ${C}" ${a}, ${b}° ${_}' ${O}" ${o}`}return g}else throw new Error("no decimal coordinates to convert")}function zi(i,e){const t=Math.pow(10,e);return Math.round((i+Number.EPSILON)*t)/t}function $t(i,e){e||(e=5),i=i.replace(/\s+/g," ").trim();let t=null,n=null,r="",u="",a=null,o=[],g=!1;if(Sr.test(i))throw new Error("invalid coordinate value");if(Ai.test(i))if(o=Ai.exec(i),g=Et(o),g)t=Math.abs(o[1])+o[2]/60,Number(o[1])<0&&(t*=-1),n=Math.abs(o[3])+o[4]/60,Number(o[3])<0&&(n*=-1),a="DM";else throw new Error("invalid coordinate format");else if(Gi.test(i))if(o=Gi.exec(i),g=Et(o),g){if(t=o[2],n=o[6],t.includes(",")&&(t=t.replace(",",".")),n.includes(",")&&(n=n.replace(",",".")),a="DD",Number(Math.round(t))==Number(t))throw new Error("integer only coordinate provided");if(Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");o[1]?(r=o[1],u=o[5]):o[4]&&(r=o[4],u=o[8])}else throw new Error("invalid decimal coordinate format");else if(Bi.test(i))if(o=Bi.exec(i),g=Et(o),g)t=Math.abs(parseInt(o[2])),o[4]&&(t+=o[4]/60,a="DM"),o[6]&&(t+=o[6].replace(",",".")/3600,a="DMS"),parseInt(o[2])<0&&(t=-1*t),n=Math.abs(parseInt(o[9])),o[11]&&(n+=o[11]/60),o[13]&&(n+=o[13].replace(",",".")/3600),parseInt(o[9])<0&&(n=-1*n),o[1]?(r=o[1],u=o[8]):o[7]&&(r=o[7],u=o[14]);else throw new Error("invalid DMS coordinates format");else if(Wi.test(i))if(o=Wi.exec(i),g=Et(o),g)t=Math.abs(parseInt(o[2])),o[4]&&(t+=o[4]/60,a="DM"),o[6]&&(t+=o[6]/3600,a="DMS"),parseInt(o[2])<0&&(t=-1*t),n=Math.abs(parseInt(o[10])),o[12]&&(n+=o[12]/60),o[14]&&(n+=o[14]/3600),parseInt(o[10])<0&&(n=-1*n),o[1]?(r=o[1],u=o[9]):o[8]&&(r=o[8],u=o[16]);else throw new Error("invalid DMS coordinates format");else if(Fi.test(i)){if(o=Fi.exec(i),g=Et(o),o.filter(h=>h).length<=5)throw new Error("invalid coordinates format");if(g)t=Math.abs(parseInt(o[2])),o[4]&&(t+=o[4].replace(",",".")/60,a="DM"),o[6]&&(t+=o[6].replace(",",".")/3600,a="DMS"),parseInt(o[2])<0&&(t=-1*t),n=Math.abs(parseInt(o[10])),o[12]&&(n+=o[12].replace(",",".")/60),o[14]&&(n+=o[14].replace(",",".")/3600),parseInt(o[10])<0&&(n=-1*n),o[1]?(r=o[1],u=o[9]):o[8]&&(r=o[8],u=o[16]);else throw new Error("invalid coordinates format")}if(g){if(Math.abs(n)>=180)throw new Error("invalid longitude value");if(Math.abs(t)>=90)throw new Error("invalid latitude value");if(r&&!u||!r&&u)throw new Error("invalid coordinates value");if(r&&r==u)throw new Error("invalid coordinates format");t.toString().includes(",")&&(t=t.replace(",",".")),n.toString().includes(",")&&(n=n.replace(",","."));let h=/S|SOUTH/i;h.test(r)&&t>0&&(t=-1*t),h=/W|WEST/i,h.test(u)&&n>0&&(n=-1*n);const b=o[0].trim();let S,M;const k=/[,/;\u0020]/g,N=b.match(k);if(N==null){const I=Math.floor(i.length/2);S=b.substring(0,I).trim(),M=b.substring(I).trim()}else{let I;N.length%2==1?I=Math.floor(N.length/2):I=N.length/2-1;let _=0;if(I==0)_=b.indexOf(N[0]),S=b.substring(0,_).trim(),M=b.substring(_+1).trim();else{let R=0,z=0;for(;R<=I;)_=b.indexOf(N[R],z),z=_+1,R++;S=b.substring(0,_).trim(),M=b.substring(_+1).trim()}}const C=S.split(".");if(C.length==2&&C[1]==0&&C[1].length!=2)throw new Error("invalid coordinates format");const O=M.split(".");if(O.length==2&&O[1]==0&&O[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(M))throw new Error("degree only coordinate/s provided");return t=Number(Number(t).toFixed(e)),n=Number(Number(n).toFixed(e)),Object.freeze({verbatimCoordinates:b,verbatimLatitude:S,verbatimLongitude:M,decimalLatitude:t,decimalLongitude:n,decimalCoordinates:`${t},${n}`,originalFormat:a,closeEnough:xr,toCoordinateFormat:_r})}else throw new Error("coordinates pattern match failed")}function Et(i){if(!isNaN(i[0]))return!1;const e=[...i];if(e.shift(),e.length%2>0)return!1;const t=/^[-+]?\d+([\.,]\d+)?$/,n=/[eastsouthnorthwest]+/i,r=e.length/2;for(let u=0;u<r;u++){const a=e[u],o=e[u+r],g=t.test(a)&&t.test(o),h=n.test(a)&&n.test(o),b=a==o;if(!(a==null&&o==null)){if(a==null||o==null)return!1;if(g||h||b)continue;return!1}}return!0}function Di(i,e){const t=Math.abs(i-e);return Number(t.toFixed(6))<=1e-5}function xr(i){if(!i)throw new Error("coords must be provided");if(i.includes(",")){const e=i.split(",");if(Number(e[0])==NaN||Number(e[1])==NaN)throw new Error("coords are not valid decimals");return Di(this.decimalLatitude,Number(e[0]))&&Di(this.decimalLongitude,e[1])}else throw new Error("coords being tested must be separated by a comma")}const Tr=Object.freeze({DMS:"DMS",DM:"DM",DD:"DD"});$t.to=Tr;const Mr=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],Nr={decimalLatitude:40.123,decimalLongitude:-74.123},Cr=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],kr=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"53 16.3863,4 52.8171",verbatimLatitude:"53 16.3863",verbatimLongitude:"4 52.8171",decimalLatitude:53.273105,decimalLongitude:4.88029},{verbatimCoordinates:"50 8.2914,-5 2.4447",verbatimLatitude:"50 8.2914",verbatimLongitude:"-5 2.4447",decimalLatitude:50.13819,decimalLongitude:-5.040745},{verbatimCoordinates:"N 48° 30,6410', E 18° 57,4583'",verbatimLatitude:"N 48° 30,6410'",verbatimLongitude:"E 18° 57,4583'",decimalLatitude:48.51068,decimalLongitude:18.95764},{verbatimCoordinates:"1.23456, 18.33453",verbatimLatitude:"1.23456",verbatimLongitude:"18.33453",decimalLatitude:1.23456,decimalLongitude:18.33453}];function Or(){const i=[];return Mr.forEach(e=>{e.decimalLatitude?i.push(e):i.push({...e,...Nr})}),[...i,...Cr,...kr]}const Pr=Or();$t.formats=Pr.map(i=>i.verbatimCoordinates);const Rr=$t;function Ui(i,e,t){const n=i.slice();return n[97]=e[t],n[99]=t,n}function qi(i){let e,t;return e=new yr({}),{c(){Je(e.$$.fragment)},m(n,r){Ve(e,n,r),t=!0},i(n){t||(ue(e.$$.fragment,n),t=!0)},o(n){ye(e.$$.fragment,n),t=!1},d(n){je(e,n)}}}function Vi(i){let e,t,n,r,u;return t=new vr({}),{c(){e=K("button"),Je(t.$$.fragment),x(e,"type","button"),x(e,"title",i[10]),x(e,"class","svelte-bz0zu3"),ct(e,"active",i[0])},m(a,o){ne(a,e,o),Ve(t,e,null),n=!0,r||(u=de(e,"click",i[79]),r=!0)},p(a,o){(!n||o[0]&1024)&&x(e,"title",a[10]),(!n||o[0]&1)&&ct(e,"active",a[0])},i(a){n||(ue(t.$$.fragment,a),n=!0)},o(a){ye(t.$$.fragment,a),n=!1},d(a){a&&te(e),je(t),r=!1,u()}}}function Ir(i){let e,t=[],n=new Map,r,u,a,o=ki(i[13]);const g=h=>h[97].id+(h[97].address?","+h[97].address:"");for(let h=0;h<o.length;h+=1){let b=Ui(i,o,h),S=g(b);n.set(S,t[h]=ji(S,b))}return{c(){e=K("ul");for(let h=0;h<t.length;h+=1)t[h].c();x(e,"class","options svelte-bz0zu3"),x(e,"role","listbox")},m(h,b){ne(h,e,b);for(let S=0;S<t.length;S+=1)t[S]&&t[S].m(e,null);r=!0,u||(a=[de(e,"mouseleave",i[27]),de(e,"blur",i[83]),de(e,"keydown",i[23])],u=!0)},p(h,b){b[0]&102823936&&(o=ki(h[13]),Rt(),t=Jn(t,b,g,1,h,o,n,e,Xn,ji,null,Ui),It())},i(h){if(!r){for(let b=0;b<o.length;b+=1)ue(t[b]);r=!0}},o(h){for(let b=0;b<t.length;b+=1)ye(t[b]);r=!1},d(h){h&&te(e);for(let b=0;b<t.length;b+=1)t[b].d();u=!1,Ue(a)}}}function Ar(i){let e,t,n,r,u,a;return t=new Pi({}),{c(){e=K("div"),Je(t.$$.fragment),n=Ee(),r=K("div"),u=Xe(i[8]),x(r,"class","svelte-bz0zu3"),x(e,"class","no-results svelte-bz0zu3")},m(o,g){ne(o,e,g),Ve(t,e,null),j(e,n),j(e,r),j(r,u),a=!0},p(o,g){(!a||g[0]&256)&&pt(u,o[8])},i(o){a||(ue(t.$$.fragment,o),a=!0)},o(o){ye(t.$$.fragment,o),a=!1},d(o){o&&te(e),je(t)}}}function Gr(i){let e="",t;return{c(){t=Xe(e)},m(n,r){ne(n,t,r)},p:se,i:se,o:se,d(n){n&&te(t)}}}function Br(i){let e,t,n,r,u,a,o,g,h,b,S;return t=new Pi({}),g=new Oi({}),{c(){e=K("div"),Je(t.$$.fragment),n=Ee(),r=K("div"),u=Xe(i[7]),a=Ee(),o=K("button"),Je(g.$$.fragment),x(r,"class","svelte-bz0zu3"),x(o,"class","svelte-bz0zu3"),x(e,"class","error svelte-bz0zu3")},m(M,k){ne(M,e,k),Ve(t,e,null),j(e,n),j(e,r),j(r,u),j(e,a),j(e,o),Ve(g,o,null),h=!0,b||(S=de(o,"click",i[80]),b=!0)},p(M,k){(!h||k[0]&128)&&pt(u,M[7])},i(M){h||(ue(t.$$.fragment,M),ue(g.$$.fragment,M),h=!0)},o(M){ye(t.$$.fragment,M),ye(g.$$.fragment,M),h=!1},d(M){M&&te(e),je(t),je(g),b=!1,S()}}}function ji(i,e){var o;let t,n,r;function u(){return e[81](e[99])}function a(){return e[82](e[97])}return n=new gr({props:{feature:e[97],showPlaceType:e[11],style:e[15]===e[99]?"selected":((o=e[14])==null?void 0:o.id)===e[97].id?"picked":"default",missingIconsCache:e[21],iconsBaseUrl:e[12]}}),n.$on("mouseenter",u),n.$on("select",a),{key:i,first:null,c(){t=Dn(),Je(n.$$.fragment),this.first=t},m(g,h){ne(g,t,h),Ve(n,g,h),r=!0},p(g,h){var S;e=g;const b={};h[0]&8192&&(b.feature=e[97]),h[0]&2048&&(b.showPlaceType=e[11]),h[0]&57344&&(b.style=e[15]===e[99]?"selected":((S=e[14])==null?void 0:S.id)===e[97].id?"picked":"default"),h[0]&4096&&(b.iconsBaseUrl=e[12]),n.$set(b)},i(g){r||(ue(n.$$.fragment,g),r=!0)},o(g){ye(n.$$.fragment,g),r=!1},d(g){g&&te(t),je(n,g)}}}function Wr(i){let e,t,n,r,u,a,o,g,h,b,S,M,k,N,C,O,I,_,R,z,Y,Z=!1;u=new wr({}),S=new Oi({});let B=i[20]&&qi(),s=i[6]==="button"&&Vi(i);const l=i[70].default,f=Bn(l,i,i[69],null),m=[Br,Gr,Ar,Ir],c=[];function v(y,d){var p,w;return y[19]?0:!y[16]&&!y[4]?1:((p=y[13])==null?void 0:p.length)===0?2:(w=y[13])!=null&&w.length&&(y[16]||y[4])?3:-1}return~(O=v(i))&&(I=c[O]=m[O](i)),{c(){e=Ee(),t=K("form"),n=K("div"),r=K("button"),Je(u.$$.fragment),a=Ee(),o=K("input"),g=Ee(),h=K("div"),b=K("button"),Je(S.$$.fragment),M=Ee(),B&&B.c(),k=Ee(),s&&s.c(),N=Ee(),f&&f.c(),C=Ee(),I&&I.c(),x(r,"class","search-button svelte-bz0zu3"),x(r,"type","button"),x(o,"placeholder",i[9]),x(o,"aria-label",i[9]),x(o,"class","svelte-bz0zu3"),x(b,"type","button"),x(b,"title",i[3]),x(b,"class","svelte-bz0zu3"),x(h,"class","clear-button-container svelte-bz0zu3"),ct(h,"displayable",i[1]!==""),x(n,"class","input-group svelte-bz0zu3"),x(t,"class",_=Ot(i[2])+" svelte-bz0zu3"),ct(t,"can-collapse",i[5]&&i[1]==="")},m(y,d){ne(y,e,d),ne(y,t,d),j(t,n),j(n,r),Ve(u,r,null),j(n,a),j(n,o),i[72](o),xi(o,i[1]),j(n,g),j(n,h),j(h,b),Ve(S,b,null),j(h,M),B&&B.m(h,null),j(n,k),s&&s.m(n,null),j(n,N),f&&f.m(n,null),j(t,C),~O&&c[O].m(t,null),R=!0,z||(Y=[de(r,"click",i[71]),de(o,"input",i[73]),de(o,"focus",i[74]),de(o,"blur",i[75]),de(o,"click",i[76]),de(o,"keydown",i[23]),de(o,"input",i[24]),de(o,"change",i[77]),de(b,"click",i[78]),de(t,"submit",Un(i[22]))],z=!0)},p(y,d){(!R||d[0]&512)&&x(o,"placeholder",y[9]),(!R||d[0]&512)&&x(o,"aria-label",y[9]),d[0]&2&&o.value!==y[1]&&xi(o,y[1]),(!R||d[0]&8)&&x(b,"title",y[3]),y[20]?B?d[0]&1048576&&ue(B,1):(B=qi(),B.c(),ue(B,1),B.m(h,null)):B&&(Rt(),ye(B,1,1,()=>{B=null}),It()),(!R||d[0]&2)&&ct(h,"displayable",y[1]!==""),y[6]==="button"?s?(s.p(y,d),d[0]&64&&ue(s,1)):(s=Vi(y),s.c(),ue(s,1),s.m(n,N)):s&&(Rt(),ye(s,1,1,()=>{s=null}),It()),f&&f.p&&(!R||d[2]&128)&&Fn(f,l,y,y[69],R?Wn(l,y[69],d,null):zn(y[69]),null);let p=O;O=v(y),O===p?~O&&c[O].p(y,d):(I&&(Rt(),ye(c[p],1,1,()=>{c[p]=null}),It()),~O?(I=c[O],I?I.p(y,d):(I=c[O]=m[O](y),I.c()),ue(I,1),I.m(t,null)):I=null),(!R||d[0]&4&&_!==(_=Ot(y[2])+" svelte-bz0zu3"))&&x(t,"class",_),(!R||d[0]&38)&&ct(t,"can-collapse",y[5]&&y[1]==="")},i(y){R||(ue(Z),ue(u.$$.fragment,y),ue(S.$$.fragment,y),ue(B),ue(s),ue(f,y),ue(I),R=!0)},o(y){ye(Z),ye(u.$$.fragment,y),ye(S.$$.fragment,y),ye(B),ye(s),ye(f,y),ye(I),R=!1},d(y){y&&(te(e),te(t)),je(u),i[72](null),je(S),B&&B.d(),s&&s.d(),f&&f.d(y),~O&&c[O].d(),z=!1,Ue(Y)}}}function Fr(i,e,t){let n,r,u,{$$slots:a={},$$scope:o}=e;const g={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};let{class:h=void 0}=e,{apiKey:b}=e,{bbox:S=void 0}=e,{clearButtonTitle:M="clear"}=e,{clearOnBlur:k=!1}=e,{clearListOnPick:N=!1}=e,{keepListOpen:C=!1}=e,{collapsed:O=!1}=e,{country:I=void 0}=e,{debounceSearch:_=200}=e,{enableReverse:R="never"}=e,{errorMessage:z="Something went wrong…"}=e,{filter:Y=()=>!0}=e,{flyTo:Z=!0}=e,{fuzzyMatch:B=!0}=e,{language:s=void 0}=e,{limit:l=void 0}=e;const f=41415112612;let{reverseGeocodingLimit:m=f}=e,{mapController:c=void 0}=e,{minLength:v=2}=e,{noResultsMessage:y="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=e,{placeholder:d="Search"}=e,{proximity:p=[{type:"server-geolocation"}]}=e,{reverseActive:w=R==="always"}=e,{reverseButtonTitle:E="toggle reverse geocoding"}=e,{searchValue:T=""}=e,{pickedResultStyle:A="full-geometry"}=e,{showPlaceType:G="if-needed"}=e,{showResultsWhileTyping:V=!0}=e,{selectFirst:Q=!0}=e,{flyToSelected:re=!1}=e,{markerOnSelected:q=!0}=e,{types:H=void 0}=e;const ge=[];let{reverseGeocodingTypes:Ke=ge}=e,{exhaustiveReverseGeocoding:ut=!1}=e,{excludeTypes:at=!1}=e;const Se=void 0;let{reverseGeocodingExcludeTypes:We=Se}=e,{zoom:pe=g}=e,{apiUrl:me="https://api.maptiler.com/geocoding"}=e,{fetchParameters:ee={}}=e,{iconsBaseUrl:wn="https://cdn.maptiler.com/maptiler-geocoding-control/v2.1.4-rc1/icons/"}=e,{adjustUrlQuery:ui=()=>{}}=e,{adjustUrl:ai=()=>{}}=e;function ys(L){Ae.focus(L)}function ps(){Ae.blur()}function En(L,le=!0,ae=!1){t(1,T=L),le?(t(15,X=-1),Sn()):(_n(void 0,!ae,ae),setTimeout(()=>{Ae.focus(),Ae.select()}))}function vs(){t(13,U=void 0),t(14,W=void 0),t(15,X=-1)}function bs(){t(64,ce=[]),t(14,W=void 0)}let U,ce,W,Ln="",Ae,X=-1,Fe,jt=[],ft,mt,yt,fi,Ye=!1;const ws=new Set,et=Mi();jn(()=>{c&&(c.setEventHandler(void 0),c.indicateReverse(!1),c.setSelectedMarker(-1),c.setFeatures(void 0,void 0,!1))});function Sn(L){if(t(17,Ye=!1),mt&&(clearTimeout(mt),mt=void 0),X>-1&&U)t(14,W=U[X]),t(1,T=W.place_type[0]==="reverse"?W.place_name:W.place_name.replace(/,.*/,"")),t(19,Fe=void 0),t(64,ce=void 0),t(15,X=-1);else if(T){const le=L||!ci(T);hi(T,{exact:!0}).then(()=>{t(64,ce=U),t(14,W=void 0),le&&Es()}).catch(ae=>t(19,Fe=ae))}}function ci(L){try{return Rr(L,6)}catch{return!1}}async function hi(L,{byId:le=!1,exact:ae=!1}={}){var xe,ze,tt;t(19,Fe=void 0),ft==null||ft.abort();const _e=new AbortController;t(20,ft=_e);try{const J=ci(L),Tt=new URL(me+"/"+encodeURIComponent(J?J.decimalLongitude+","+J.decimalLatitude:L)+".json"),Pe=Tt.searchParams;s!==void 0&&Pe.set("language",Array.isArray(s)?s.join(","):s??"");const[mi]=(c==null?void 0:c.getCenterAndZoom())??[];let De=(xe=!J||Ke===ge?H:Ke)==null?void 0:xe.map(be=>typeof be=="string"?be:mi===void 0||(be[0]??0)<=mi&&mi<(be[1]??1/0)?be[2]:void 0).filter(be=>be!==void 0);De&&(De=[...new Set(De)],Pe.set("types",De.join(",")));const Tn=!J||We===Se?at:We;if(Tn&&Pe.set("excludeTypes",String(Tn)),S&&Pe.set("bbox",S.map(be=>be.toFixed(6)).join(",")),I&&Pe.set("country",Array.isArray(I)?I.join(","):I),!le&&!J){const be=await Lr(c,p,_e);be&&Pe.set("proximity",be),(ae||!V)&&Pe.set("autocomplete","false"),Pe.set("fuzzyMatch",String(B))}const Mt=m===f?l:m;Mt!==void 0&&Mt>1&&(De==null?void 0:De.length)!==1&&console.warn("For reverse geocoding when limit > 1 then types must contain single value."),J?(Mt===1||Mt!==void 0&&(ut||(De==null?void 0:De.length)===1))&&Pe.set("limit",String(Mt)):l!==void 0&&Pe.set("limit",String(l)),Pe.set("key",b),ui(Pe),ai(Tt);const Ws=Tt.searchParams.get("types")===""&&Tt.searchParams.get("excludeTypes")!=="true",Ht=Tt.toString();if(Ht===Ln){le?(N&&t(13,U=void 0),t(14,W=jt[0])):(t(13,U=jt),((ze=U[X])==null?void 0:ze.id)!==(r==null?void 0:r.id)&&t(15,X=-1));return}Ln=Ht;let Nt;if(Ws)Nt={type:"FeatureCollection",features:[]};else{const be=await fetch(Ht,{signal:_e.signal,...ee});if(!be.ok)throw new Error(await be.text());Nt=await be.json()}et("response",{url:Ht,featureCollection:Nt}),le?(N&&t(13,U=void 0),t(14,W=Nt.features[0]),jt=[W]):(t(13,U=Nt.features.filter(Y)),J&&U.unshift({type:"Feature",properties:{},id:"reverse_"+J.decimalLongitude+"_"+J.decimalLatitude,text:J.decimalLatitude+", "+J.decimalLongitude,place_name:J.decimalLatitude+", "+J.decimalLongitude,place_type:["reverse"],center:[J.decimalLongitude,J.decimalLatitude],bbox:[J.decimalLongitude,J.decimalLatitude,J.decimalLongitude,J.decimalLatitude],geometry:{type:"Point",coordinates:[J.decimalLongitude,J.decimalLatitude]}}),jt=U,((tt=U[X])==null?void 0:tt.id)!==(r==null?void 0:r.id)&&t(15,X=-1),J&&Ae.focus())}catch(J){if(J&&typeof J=="object"&&"name"in J&&J.name==="AbortError")return;throw J}finally{_e===ft&&t(20,ft=void 0)}}function Es(){var _e;if(!(ce!=null&&ce.length)||!Z)return;const L=[180,90,-180,-90],le=!ce.some(xe=>!xe.matching_text);let ae;for(const xe of ce){const ze=xt(xe);if(ae=ae===void 0?ze:ze===void 0?ae:Math.max(ae,ze),le||!xe.matching_text)for(const tt of[0,1,2,3])L[tt]=Math[tt<2?"min":"max"](L[tt],((_e=xe.bbox)==null?void 0:_e[tt])??xe.center[tt%2])}c&&ce.length>0&&(W&&L[0]===L[2]&&L[1]===L[3]?c.flyTo(W.center,xt(W)):c.fitBounds(Gt(L),50,ae))}function di(){!W||!c||(!W.bbox||W.bbox[0]===W.bbox[2]&&W.bbox[1]===W.bbox[3]?c.flyTo(W.center,xt(W)):c.fitBounds(Gt(W.bbox),50,xt(W)))}function xt(L){var ae;if(!L.bbox||L.bbox[0]!==L.bbox[2]&&L.bbox[1]!==L.bbox[3])return;const le=L.id.replace(/\..*/,"");return(Array.isArray((ae=L.properties)==null?void 0:ae.categories)?L.properties.categories.reduce((_e,xe)=>{const ze=pe[le+"."+xe];return _e===void 0?ze:ze===void 0?_e:Math.max(_e,ze)},void 0):void 0)??pe[le]}function Ls(L){t(0,w=R==="always"),t(13,U=void 0),t(14,W=void 0),t(15,X=-1),En(L[1].toFixed(6)+", "+Er(L[0],[-180,180],!0).toFixed(6),!1,!0)}function Ss(L){if(!U)return;let le=L.key==="ArrowDown"?1:L.key==="ArrowUp"?-1:0;le&&(Ae.focus(),t(17,Ye=!0),L.preventDefault(),W&&X===-1&&t(15,X=U.findIndex(ae=>ae.id===(W==null?void 0:W.id))),X===(W||Q?0:-1)&&le===-1&&t(15,X=U.length),t(15,X+=le),X>=U.length&&t(15,X=-1),X<0&&(W||Q)&&t(15,X=0))}function _n(L,le=!0,ae=!1){if(t(19,Fe=void 0),t(14,W=void 0),t(17,Ye=!0),V||ae){if(mt&&clearTimeout(mt),T.length<v)return;const _e=T;mt=window.setTimeout(()=>{hi(_e).catch(xe=>t(19,Fe=xe))},le?_:0)}else t(13,U=void 0),t(19,Fe=void 0)}function gi(L){W&&(W==null?void 0:W.id)===(L==null?void 0:L.id)?di():(t(14,W=L),t(1,T=L.place_name))}function xn(L){t(15,X=L)}function _s(){(!Q||W)&&t(15,X=-1),re&&di()}const xs=()=>Ae.focus();function Ts(L){Kt[L?"unshift":"push"](()=>{Ae=L,t(18,Ae)})}function Ms(){T=this.value,t(1,T),t(17,Ye),t(31,k),t(16,yt)}const Ns=()=>t(17,Ye=!0),Cs=()=>t(17,Ye=!1),ks=()=>t(17,Ye=!0),Os=()=>t(14,W=void 0),Ps=()=>{t(1,T=""),t(14,W=void 0),Ae.focus()},Rs=()=>t(0,w=!w),Is=()=>t(19,Fe=void 0),As=L=>xn(L),Gs=L=>gi(L),Bs=()=>{};return i.$$set=L=>{"class"in L&&t(2,h=L.class),"apiKey"in L&&t(29,b=L.apiKey),"bbox"in L&&t(30,S=L.bbox),"clearButtonTitle"in L&&t(3,M=L.clearButtonTitle),"clearOnBlur"in L&&t(31,k=L.clearOnBlur),"clearListOnPick"in L&&t(32,N=L.clearListOnPick),"keepListOpen"in L&&t(4,C=L.keepListOpen),"collapsed"in L&&t(5,O=L.collapsed),"country"in L&&t(33,I=L.country),"debounceSearch"in L&&t(34,_=L.debounceSearch),"enableReverse"in L&&t(6,R=L.enableReverse),"errorMessage"in L&&t(7,z=L.errorMessage),"filter"in L&&t(35,Y=L.filter),"flyTo"in L&&t(36,Z=L.flyTo),"fuzzyMatch"in L&&t(37,B=L.fuzzyMatch),"language"in L&&t(38,s=L.language),"limit"in L&&t(39,l=L.limit),"reverseGeocodingLimit"in L&&t(40,m=L.reverseGeocodingLimit),"mapController"in L&&t(41,c=L.mapController),"minLength"in L&&t(42,v=L.minLength),"noResultsMessage"in L&&t(8,y=L.noResultsMessage),"placeholder"in L&&t(9,d=L.placeholder),"proximity"in L&&t(43,p=L.proximity),"reverseActive"in L&&t(0,w=L.reverseActive),"reverseButtonTitle"in L&&t(10,E=L.reverseButtonTitle),"searchValue"in L&&t(1,T=L.searchValue),"pickedResultStyle"in L&&t(44,A=L.pickedResultStyle),"showPlaceType"in L&&t(11,G=L.showPlaceType),"showResultsWhileTyping"in L&&t(45,V=L.showResultsWhileTyping),"selectFirst"in L&&t(46,Q=L.selectFirst),"flyToSelected"in L&&t(47,re=L.flyToSelected),"markerOnSelected"in L&&t(48,q=L.markerOnSelected),"types"in L&&t(49,H=L.types),"reverseGeocodingTypes"in L&&t(50,Ke=L.reverseGeocodingTypes),"exhaustiveReverseGeocoding"in L&&t(51,ut=L.exhaustiveReverseGeocoding),"excludeTypes"in L&&t(52,at=L.excludeTypes),"reverseGeocodingExcludeTypes"in L&&t(53,We=L.reverseGeocodingExcludeTypes),"zoom"in L&&t(54,pe=L.zoom),"apiUrl"in L&&t(55,me=L.apiUrl),"fetchParameters"in L&&t(56,ee=L.fetchParameters),"iconsBaseUrl"in L&&t(12,wn=L.iconsBaseUrl),"adjustUrlQuery"in L&&t(57,ui=L.adjustUrlQuery),"adjustUrl"in L&&t(58,ai=L.adjustUrl),"$$scope"in L&&t(69,o=L.$$scope)},i.$$.update=()=>{if(i.$$.dirty[0]&64&&t(0,w=R==="always"),i.$$.dirty[0]&16384|i.$$.dirty[1]&8192&&A!=="marker-only"&&W&&!W.address&&W.geometry.type==="Point"&&W.place_type[0]!=="reverse"&&hi(W.id,{byId:!0}).catch(L=>t(19,Fe=L)),i.$$.dirty[0]&16384|i.$$.dirty[1]&1058|i.$$.dirty[2]&8&&(c&&W&&W.id!==fi&&Z&&(di(),N&&t(13,U=void 0),t(64,ce=void 0),t(15,X=-1)),t(65,fi=W==null?void 0:W.id)),i.$$.dirty[0]&196608|i.$$.dirty[1]&1&&setTimeout(()=>{t(16,yt=Ye),k&&!yt&&t(1,T="")}),i.$$.dirty[0]&8194|i.$$.dirty[1]&2048&&T.length<v&&(t(13,U=void 0),t(19,Fe=void 0),t(64,ce=U)),i.$$.dirty[0]&57344|i.$$.dirty[1]&32768&&Q&&U!=null&&U.length&&X==-1&&!W&&t(15,X=0),i.$$.dirty[0]&8192|i.$$.dirty[2]&4&&ce!==U&&t(64,ce=void 0),i.$$.dirty[0]&73729|i.$$.dirty[1]&1024|i.$$.dirty[2]&4&&c&&c.setEventHandler(L=>{switch(L.type){case"mapClick":w&&Ls(L.coordinates);break;case"markerClick":{const le=U==null?void 0:U.find(ae=>ae.id===L.id);le&&gi(le)}break;case"markerMouseEnter":ce&&t(15,X=yt?(U==null?void 0:U.findIndex(le=>le.id===L.id))??-1:-1);break;case"markerMouseLeave":ce&&t(15,X=-1);break}}),i.$$.dirty[0]&40960&&t(66,r=U==null?void 0:U[X]),i.$$.dirty[1]&66592|i.$$.dirty[2]&16&&c&&r&&Z&&re&&c.flyTo(r.center,xt(r)),i.$$.dirty[1]&8192&&t(68,n=A==="full-geometry-including-polygon-center-marker"),i.$$.dirty[1]&132096|i.$$.dirty[2]&64&&(q||c==null||c.setFeatures(void 0,void 0,n)),i.$$.dirty[0]&16384|i.$$.dirty[1]&132096|i.$$.dirty[2]&84&&c&&q&&!ce&&(c.setFeatures(r?[r]:void 0,W,n),c.setSelectedMarker(r?0:-1)),i.$$.dirty[0]&16384|i.$$.dirty[1]&1024|i.$$.dirty[2]&68&&c&&c.setFeatures(ce,W,n),i.$$.dirty[0]&32768|i.$$.dirty[1]&1024|i.$$.dirty[2]&4&&ce&&c&&c.setSelectedMarker(X),i.$$.dirty[0]&2|i.$$.dirty[1]&1024&&c){const L=ci(T);c.setReverseMarker(L?[L.decimalLongitude,L.decimalLatitude]:void 0)}i.$$.dirty[2]&16&&et("select",{feature:r}),i.$$.dirty[0]&16384&&et("pick",{feature:W}),i.$$.dirty[0]&73744&&t(67,u=!!(U!=null&&U.length)&&(yt||C)),i.$$.dirty[2]&32&&et("optionsvisibilitychange",{optionsVisible:u}),i.$$.dirty[0]&8192&&et("featureslisted",{features:U}),i.$$.dirty[2]&4&&et("featuresmarked",{features:ce}),i.$$.dirty[0]&1&&et("reversetoggle",{reverse:w}),i.$$.dirty[0]&2&&et("querychange",{query:T}),i.$$.dirty[0]&1|i.$$.dirty[1]&1024&&c&&c.indicateReverse(w)},[w,T,h,M,C,O,R,z,y,d,E,G,wn,U,W,X,yt,Ye,Ae,Fe,ft,ws,Sn,Ss,_n,gi,xn,_s,g,b,S,k,N,I,_,Y,Z,B,s,l,m,c,v,p,A,V,Q,re,q,H,Ke,ut,at,We,pe,me,ee,ui,ai,ys,ps,En,vs,bs,ce,fi,r,u,n,o,a,xs,Ts,Ms,Ns,Cs,ks,Os,Ps,Rs,Is,As,Gs,Bs]}let zr=class extends st{constructor(e){super(),rt(this,e,Fr,Wr,it,{ZOOM_DEFAULTS:28,class:2,apiKey:29,bbox:30,clearButtonTitle:3,clearOnBlur:31,clearListOnPick:32,keepListOpen:4,collapsed:5,country:33,debounceSearch:34,enableReverse:6,errorMessage:7,filter:35,flyTo:36,fuzzyMatch:37,language:38,limit:39,reverseGeocodingLimit:40,mapController:41,minLength:42,noResultsMessage:8,placeholder:9,proximity:43,reverseActive:0,reverseButtonTitle:10,searchValue:1,pickedResultStyle:44,showPlaceType:11,showResultsWhileTyping:45,selectFirst:46,flyToSelected:47,markerOnSelected:48,types:49,reverseGeocodingTypes:50,exhaustiveReverseGeocoding:51,excludeTypes:52,reverseGeocodingExcludeTypes:53,zoom:54,apiUrl:55,fetchParameters:56,iconsBaseUrl:12,adjustUrlQuery:57,adjustUrl:58,focus:59,blur:60,setQuery:61,clearList:62,clearMap:63},null,[-1,-1,-1,-1])}get ZOOM_DEFAULTS(){return this.$$.ctx[28]}get focus(){return this.$$.ctx[59]}get blur(){return this.$$.ctx[60]}get setQuery(){return this.$$.ctx[61]}get clearList(){return this.$$.ctx[62]}get clearMap(){return this.$$.ctx[63]}};function Bt(i,e,t={}){const n={type:"Feature"};return(t.id===0||t.id)&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.properties=e||{},n.geometry=i,n}function ei(i,e,t={}){for(const r of i){if(r.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(r[r.length-1].length!==r[0].length)throw new Error("First and last Position are not equivalent.");for(let u=0;u<r[r.length-1].length;u++)if(r[r.length-1][u]!==r[0][u])throw new Error("First and last Position are not equivalent.")}return Bt({type:"Polygon",coordinates:i},e,t)}function ti(i,e={}){const t={type:"FeatureCollection"};return e.id&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.features=i,t}function Hi(i,e,t={}){return Bt({type:"MultiPolygon",coordinates:i},e,t)}function Zi(i,e,t){if(i!==null)for(var n,r,u,a,o,g,h,b=0,S=0,M,k=i.type,N=k==="FeatureCollection",C=k==="Feature",O=N?i.features.length:1,I=0;I<O;I++){h=N?i.features[I].geometry:C?i.geometry:i,M=h?h.type==="GeometryCollection":!1,o=M?h.geometries.length:1;for(var _=0;_<o;_++){var R=0,z=0;if(a=M?h.geometries[_]:h,a!==null){g=a.coordinates;var Y=a.type;switch(b=0,Y){case null:break;case"Point":if(e(g,S,I,R,z)===!1)return!1;S++,R++;break;case"LineString":case"MultiPoint":for(n=0;n<g.length;n++){if(e(g[n],S,I,R,z)===!1)return!1;S++,Y==="MultiPoint"&&R++}Y==="LineString"&&R++;break;case"Polygon":case"MultiLineString":for(n=0;n<g.length;n++){for(r=0;r<g[n].length-b;r++){if(e(g[n][r],S,I,R,z)===!1)return!1;S++}Y==="MultiLineString"&&R++,Y==="Polygon"&&z++}Y==="Polygon"&&R++;break;case"MultiPolygon":for(n=0;n<g.length;n++){for(z=0,r=0;r<g[n].length;r++){for(u=0;u<g[n][r].length-b;u++){if(e(g[n][r][u],S,I,R,z)===!1)return!1;S++}z++}R++}break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(Zi(a.geometries[n],e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ii(i,e){var t,n,r,u,a,o,g,h,b,S,M=0,k=i.type==="FeatureCollection",N=i.type==="Feature",C=k?i.features.length:1;for(t=0;t<C;t++){for(o=k?i.features[t].geometry:N?i.geometry:i,h=k?i.features[t].properties:N?i.properties:{},b=k?i.features[t].bbox:N?i.bbox:void 0,S=k?i.features[t].id:N?i.id:void 0,g=o?o.type==="GeometryCollection":!1,a=g?o.geometries.length:1,r=0;r<a;r++){if(u=g?o.geometries[r]:o,u===null){if(e(null,M,h,b,S)===!1)return!1;continue}switch(u.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(u,M,h,b,S)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<u.geometries.length;n++)if(e(u.geometries[n],M,h,b,S)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}M++}}function Dr(i,e){ii(i,function(t,n,r,u,a){var o=t===null?null:t.type;switch(o){case null:case"Point":case"LineString":case"Polygon":return e(Bt(t,r,{bbox:u,id:a}),n,0)===!1?!1:void 0}var g;switch(o){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var h=0;h<t.coordinates.length;h++){var b=t.coordinates[h],S={type:g,coordinates:b};if(e(Bt(S,r),n,h)===!1)return!1}})}function Ur(i,e={}){if(i.bbox!=null&&e.recompute!==!0)return i.bbox;const t=[1/0,1/0,-1/0,-1/0];return Zi(i,n=>{t[0]>n[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]<n[0]&&(t[2]=n[0]),t[3]<n[1]&&(t[3]=n[1])}),t}var Ki=Ur,qr=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ni=Math.ceil,Ce=Math.floor,we="[BigNumber Error] ",Yi=we+"Number primitive has more than 15 significant digits: ",Ie=1e14,D=14,Qi=9007199254740991,ri=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],$e=1e7,Le=1e9;function Xi(i){var e,t,n,r=_.prototype={constructor:_,toString:null,valueOf:null},u=new _(1),a=20,o=4,g=-7,h=21,b=-1e7,S=1e7,M=!1,k=1,N=0,C={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},O="0123456789abcdefghijklmnopqrstuvwxyz",I=!0;function _(s,l){var f,m,c,v,y,d,p,w,E=this;if(!(E instanceof _))return new _(s,l);if(l==null){if(s&&s._isBigNumber===!0){E.s=s.s,!s.c||s.e>S?E.c=E.e=null:s.e<b?E.c=[E.e=0]:(E.e=s.e,E.c=s.c.slice());return}if((d=typeof s=="number")&&s*0==0){if(E.s=1/s<0?(s=-s,-1):1,s===~~s){for(v=0,y=s;y>=10;y/=10,v++);v>S?E.c=E.e=null:(E.e=v,E.c=[s]);return}w=String(s)}else{if(!qr.test(w=String(s)))return n(E,w,d);E.s=w.charCodeAt(0)==45?(w=w.slice(1),-1):1}(v=w.indexOf("."))>-1&&(w=w.replace(".","")),(y=w.search(/e/i))>0?(v<0&&(v=y),v+=+w.slice(y+1),w=w.substring(0,y)):v<0&&(v=w.length)}else{if(oe(l,2,O.length,"Base"),l==10&&I)return E=new _(s),Z(E,a+E.e+1,o);if(w=String(s),d=typeof s=="number"){if(s*0!=0)return n(E,w,d,l);if(E.s=1/s<0?(w=w.slice(1),-1):1,_.DEBUG&&w.replace(/^0\.0*|\./,"").length>15)throw Error(Yi+s)}else E.s=w.charCodeAt(0)===45?(w=w.slice(1),-1):1;for(f=O.slice(0,l),v=y=0,p=w.length;y<p;y++)if(f.indexOf(m=w.charAt(y))<0){if(m=="."){if(y>v){v=p;continue}}else if(!c&&(w==w.toUpperCase()&&(w=w.toLowerCase())||w==w.toLowerCase()&&(w=w.toUpperCase()))){c=!0,y=-1,v=0;continue}return n(E,String(s),d,l)}d=!1,w=t(w,l,10,E.s),(v=w.indexOf("."))>-1?w=w.replace(".",""):v=w.length}for(y=0;w.charCodeAt(y)===48;y++);for(p=w.length;w.charCodeAt(--p)===48;);if(w=w.slice(y,++p)){if(p-=y,d&&_.DEBUG&&p>15&&(s>Qi||s!==Ce(s)))throw Error(Yi+E.s*s);if((v=v-y-1)>S)E.c=E.e=null;else if(v<b)E.c=[E.e=0];else{if(E.e=v,E.c=[],y=(v+1)%D,v<0&&(y+=D),y<p){for(y&&E.c.push(+w.slice(0,y)),p-=D;y<p;)E.c.push(+w.slice(y,y+=D));y=D-(w=w.slice(y)).length}else y-=p;for(;y--;w+="0");E.c.push(+w)}}else E.c=[E.e=0]}_.clone=Xi,_.ROUND_UP=0,_.ROUND_DOWN=1,_.ROUND_CEIL=2,_.ROUND_FLOOR=3,_.ROUND_HALF_UP=4,_.ROUND_HALF_DOWN=5,_.ROUND_HALF_EVEN=6,_.ROUND_HALF_CEIL=7,_.ROUND_HALF_FLOOR=8,_.EUCLID=9,_.config=_.set=function(s){var l,f;if(s!=null)if(typeof s=="object"){if(s.hasOwnProperty(l="DECIMAL_PLACES")&&(f=s[l],oe(f,0,Le,l),a=f),s.hasOwnProperty(l="ROUNDING_MODE")&&(f=s[l],oe(f,0,8,l),o=f),s.hasOwnProperty(l="EXPONENTIAL_AT")&&(f=s[l],f&&f.pop?(oe(f[0],-1e9,0,l),oe(f[1],0,Le,l),g=f[0],h=f[1]):(oe(f,-1e9,Le,l),g=-(h=f<0?-f:f))),s.hasOwnProperty(l="RANGE"))if(f=s[l],f&&f.pop)oe(f[0],-1e9,-1,l),oe(f[1],1,Le,l),b=f[0],S=f[1];else if(oe(f,-1e9,Le,l),f)b=-(S=f<0?-f:f);else throw Error(we+l+" cannot be zero: "+f);if(s.hasOwnProperty(l="CRYPTO"))if(f=s[l],f===!!f)if(f)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))M=f;else throw M=!f,Error(we+"crypto unavailable");else M=f;else throw Error(we+l+" not true or false: "+f);if(s.hasOwnProperty(l="MODULO_MODE")&&(f=s[l],oe(f,0,9,l),k=f),s.hasOwnProperty(l="POW_PRECISION")&&(f=s[l],oe(f,0,Le,l),N=f),s.hasOwnProperty(l="FORMAT"))if(f=s[l],typeof f=="object")C=f;else throw Error(we+l+" not an object: "+f);if(s.hasOwnProperty(l="ALPHABET"))if(f=s[l],typeof f=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(f))I=f.slice(0,10)=="0123456789",O=f;else throw Error(we+l+" invalid: "+f)}else throw Error(we+"Object expected: "+s);return{DECIMAL_PLACES:a,ROUNDING_MODE:o,EXPONENTIAL_AT:[g,h],RANGE:[b,S],CRYPTO:M,MODULO_MODE:k,POW_PRECISION:N,FORMAT:C,ALPHABET:O}},_.isBigNumber=function(s){if(!s||s._isBigNumber!==!0)return!1;if(!_.DEBUG)return!0;var l,f,m=s.c,c=s.e,v=s.s;e:if({}.toString.call(m)=="[object Array]"){if((v===1||v===-1)&&c>=-1e9&&c<=Le&&c===Ce(c)){if(m[0]===0){if(c===0&&m.length===1)return!0;break e}if(l=(c+1)%D,l<1&&(l+=D),String(m[0]).length==l){for(l=0;l<m.length;l++)if(f=m[l],f<0||f>=Ie||f!==Ce(f))break e;if(f!==0)return!0}}}else if(m===null&&c===null&&(v===null||v===1||v===-1))return!0;throw Error(we+"Invalid BigNumber: "+s)},_.maximum=_.max=function(){return z(arguments,-1)},_.minimum=_.min=function(){return z(arguments,1)},_.random=function(){var s=9007199254740992,l=Math.random()*s&2097151?function(){return Ce(Math.random()*s)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(f){var m,c,v,y,d,p=0,w=[],E=new _(u);if(f==null?f=a:oe(f,0,Le),y=ni(f/D),M)if(crypto.getRandomValues){for(m=crypto.getRandomValues(new Uint32Array(y*=2));p<y;)d=m[p]*131072+(m[p+1]>>>11),d>=9e15?(c=crypto.getRandomValues(new Uint32Array(2)),m[p]=c[0],m[p+1]=c[1]):(w.push(d%1e14),p+=2);p=y/2}else if(crypto.randomBytes){for(m=crypto.randomBytes(y*=7);p<y;)d=(m[p]&31)*281474976710656+m[p+1]*1099511627776+m[p+2]*4294967296+m[p+3]*16777216+(m[p+4]<<16)+(m[p+5]<<8)+m[p+6],d>=9e15?crypto.randomBytes(7).copy(m,p):(w.push(d%1e14),p+=7);p=y/7}else throw M=!1,Error(we+"crypto unavailable");if(!M)for(;p<y;)d=l(),d<9e15&&(w[p++]=d%1e14);for(y=w[--p],f%=D,y&&f&&(d=ri[D-f],w[p]=Ce(y/d)*d);w[p]===0;w.pop(),p--);if(p<0)w=[v=0];else{for(v=-1;w[0]===0;w.splice(0,1),v-=D);for(p=1,d=w[0];d>=10;d/=10,p++);p<D&&(v-=D-p)}return E.e=v,E.c=w,E}}(),_.sum=function(){for(var s=1,l=arguments,f=new _(l[0]);s<l.length;)f=f.plus(l[s++]);return f},t=function(){var s="0123456789";function l(f,m,c,v){for(var y,d=[0],p,w=0,E=f.length;w<E;){for(p=d.length;p--;d[p]*=m);for(d[0]+=v.indexOf(f.charAt(w++)),y=0;y<d.length;y++)d[y]>c-1&&(d[y+1]==null&&(d[y+1]=0),d[y+1]+=d[y]/c|0,d[y]%=c)}return d.reverse()}return function(f,m,c,v,y){var d,p,w,E,T,A,G,V,Q=f.indexOf("."),re=a,q=o;for(Q>=0&&(E=N,N=0,f=f.replace(".",""),V=new _(m),A=V.pow(f.length-Q),N=E,V.c=l(He(Oe(A.c),A.e,"0"),10,c,s),V.e=V.c.length),G=l(f,m,c,y?(d=O,s):(d=s,O)),w=E=G.length;G[--E]==0;G.pop());if(!G[0])return d.charAt(0);if(Q<0?--w:(A.c=G,A.e=w,A.s=v,A=e(A,V,re,q,c),G=A.c,T=A.r,w=A.e),p=w+re+1,Q=G[p],E=c/2,T=T||p<0||G[p+1]!=null,T=q<4?(Q!=null||T)&&(q==0||q==(A.s<0?3:2)):Q>E||Q==E&&(q==4||T||q==6&&G[p-1]&1||q==(A.s<0?8:7)),p<1||!G[0])f=T?He(d.charAt(1),-re,d.charAt(0)):d.charAt(0);else{if(G.length=p,T)for(--c;++G[--p]>c;)G[p]=0,p||(++w,G=[1].concat(G));for(E=G.length;!G[--E];);for(Q=0,f="";Q<=E;f+=d.charAt(G[Q++]));f=He(f,w,d.charAt(0))}return f}}(),e=function(){function s(m,c,v){var y,d,p,w,E=0,T=m.length,A=c%$e,G=c/$e|0;for(m=m.slice();T--;)p=m[T]%$e,w=m[T]/$e|0,y=G*p+w*A,d=A*p+y%$e*$e+E,E=(d/v|0)+(y/$e|0)+G*w,m[T]=d%v;return E&&(m=[E].concat(m)),m}function l(m,c,v,y){var d,p;if(v!=y)p=v>y?1:-1;else for(d=p=0;d<v;d++)if(m[d]!=c[d]){p=m[d]>c[d]?1:-1;break}return p}function f(m,c,v,y){for(var d=0;v--;)m[v]-=d,d=m[v]<c[v]?1:0,m[v]=d*y+m[v]-c[v];for(;!m[0]&&m.length>1;m.splice(0,1));}return function(m,c,v,y,d){var p,w,E,T,A,G,V,Q,re,q,H,ge,Ke,ut,at,Se,We,pe=m.s==c.s?1:-1,me=m.c,ee=c.c;if(!me||!me[0]||!ee||!ee[0])return new _(!m.s||!c.s||(me?ee&&me[0]==ee[0]:!ee)?NaN:me&&me[0]==0||!ee?pe*0:pe/0);for(Q=new _(pe),re=Q.c=[],w=m.e-c.e,pe=v+w+1,d||(d=Ie,w=ke(m.e/D)-ke(c.e/D),pe=pe/D|0),E=0;ee[E]==(me[E]||0);E++);if(ee[E]>(me[E]||0)&&w--,pe<0)re.push(1),T=!0;else{for(ut=me.length,Se=ee.length,E=0,pe+=2,A=Ce(d/(ee[0]+1)),A>1&&(ee=s(ee,A,d),me=s(me,A,d),Se=ee.length,ut=me.length),Ke=Se,q=me.slice(0,Se),H=q.length;H<Se;q[H++]=0);We=ee.slice(),We=[0].concat(We),at=ee[0],ee[1]>=d/2&&at++;do{if(A=0,p=l(ee,q,Se,H),p<0){if(ge=q[0],Se!=H&&(ge=ge*d+(q[1]||0)),A=Ce(ge/at),A>1)for(A>=d&&(A=d-1),G=s(ee,A,d),V=G.length,H=q.length;l(G,q,V,H)==1;)A--,f(G,Se<V?We:ee,V,d),V=G.length,p=1;else A==0&&(p=A=1),G=ee.slice(),V=G.length;if(V<H&&(G=[0].concat(G)),f(q,G,H,d),H=q.length,p==-1)for(;l(ee,q,Se,H)<1;)A++,f(q,Se<H?We:ee,H,d),H=q.length}else p===0&&(A++,q=[0]);re[E++]=A,q[0]?q[H++]=me[Ke]||0:(q=[me[Ke]],H=1)}while((Ke++<ut||q[0]!=null)&&pe--);T=q[0]!=null,re[0]||re.splice(0,1)}if(d==Ie){for(E=1,pe=re[0];pe>=10;pe/=10,E++);Z(Q,v+(Q.e=E+w*D-1)+1,y,T)}else Q.e=w,Q.r=+T;return Q}}();function R(s,l,f,m){var c,v,y,d,p;if(f==null?f=o:oe(f,0,8),!s.c)return s.toString();if(c=s.c[0],y=s.e,l==null)p=Oe(s.c),p=m==1||m==2&&(y<=g||y>=h)?Ft(p,y):He(p,y,"0");else if(s=Z(new _(s),l,f),v=s.e,p=Oe(s.c),d=p.length,m==1||m==2&&(l<=v||v<=g)){for(;d<l;p+="0",d++);p=Ft(p,v)}else if(l-=y,p=He(p,v,"0"),v+1>d){if(--l>0)for(p+=".";l--;p+="0");}else if(l+=v-d,l>0)for(v+1==d&&(p+=".");l--;p+="0");return s.s<0&&c?"-"+p:p}function z(s,l){for(var f,m,c=1,v=new _(s[0]);c<s.length;c++)m=new _(s[c]),(!m.s||(f=ot(v,m))===l||f===0&&v.s===l)&&(v=m);return v}function Y(s,l,f){for(var m=1,c=l.length;!l[--c];l.pop());for(c=l[0];c>=10;c/=10,m++);return(f=m+f*D-1)>S?s.c=s.e=null:f<b?s.c=[s.e=0]:(s.e=f,s.c=l),s}n=function(){var s=/^(-?)0([xbo])(?=\w[\w.]*$)/i,l=/^([^.]+)\.$/,f=/^\.([^.]+)$/,m=/^-?(Infinity|NaN)$/,c=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(v,y,d,p){var w,E=d?y:y.replace(c,"");if(m.test(E))v.s=isNaN(E)?null:E<0?-1:1;else{if(!d&&(E=E.replace(s,function(T,A,G){return w=(G=G.toLowerCase())=="x"?16:G=="b"?2:8,!p||p==w?A:T}),p&&(w=p,E=E.replace(l,"$1").replace(f,"0.$1")),y!=E))return new _(E,w);if(_.DEBUG)throw Error(we+"Not a"+(p?" base "+p:"")+" number: "+y);v.s=null}v.c=v.e=null}}();function Z(s,l,f,m){var c,v,y,d,p,w,E,T=s.c,A=ri;if(T){e:{for(c=1,d=T[0];d>=10;d/=10,c++);if(v=l-c,v<0)v+=D,y=l,p=T[w=0],E=Ce(p/A[c-y-1]%10);else if(w=ni((v+1)/D),w>=T.length)if(m){for(;T.length<=w;T.push(0));p=E=0,c=1,v%=D,y=v-D+1}else break e;else{for(p=d=T[w],c=1;d>=10;d/=10,c++);v%=D,y=v-D+c,E=y<0?0:Ce(p/A[c-y-1]%10)}if(m=m||l<0||T[w+1]!=null||(y<0?p:p%A[c-y-1]),m=f<4?(E||m)&&(f==0||f==(s.s<0?3:2)):E>5||E==5&&(f==4||m||f==6&&(v>0?y>0?p/A[c-y]:0:T[w-1])%10&1||f==(s.s<0?8:7)),l<1||!T[0])return T.length=0,m?(l-=s.e+1,T[0]=A[(D-l%D)%D],s.e=-l||0):T[0]=s.e=0,s;if(v==0?(T.length=w,d=1,w--):(T.length=w+1,d=A[D-v],T[w]=y>0?Ce(p/A[c-y]%A[y])*d:0),m)for(;;)if(w==0){for(v=1,y=T[0];y>=10;y/=10,v++);for(y=T[0]+=d,d=1;y>=10;y/=10,d++);v!=d&&(s.e++,T[0]==Ie&&(T[0]=1));break}else{if(T[w]+=d,T[w]!=Ie)break;T[w--]=0,d=1}for(v=T.length;T[--v]===0;T.pop());}s.e>S?s.c=s.e=null:s.e<b&&(s.c=[s.e=0])}return s}function B(s){var l,f=s.e;return f===null?s.toString():(l=Oe(s.c),l=f<=g||f>=h?Ft(l,f):He(l,f,"0"),s.s<0?"-"+l:l)}return r.absoluteValue=r.abs=function(){var s=new _(this);return s.s<0&&(s.s=1),s},r.comparedTo=function(s,l){return ot(this,new _(s,l))},r.decimalPlaces=r.dp=function(s,l){var f,m,c,v=this;if(s!=null)return oe(s,0,Le),l==null?l=o:oe(l,0,8),Z(new _(v),s+v.e+1,l);if(!(f=v.c))return null;if(m=((c=f.length-1)-ke(this.e/D))*D,c=f[c])for(;c%10==0;c/=10,m--);return m<0&&(m=0),m},r.dividedBy=r.div=function(s,l){return e(this,new _(s,l),a,o)},r.dividedToIntegerBy=r.idiv=function(s,l){return e(this,new _(s,l),0,1)},r.exponentiatedBy=r.pow=function(s,l){var f,m,c,v,y,d,p,w,E,T=this;if(s=new _(s),s.c&&!s.isInteger())throw Error(we+"Exponent not an integer: "+B(s));if(l!=null&&(l=new _(l)),d=s.e>14,!T.c||!T.c[0]||T.c[0]==1&&!T.e&&T.c.length==1||!s.c||!s.c[0])return E=new _(Math.pow(+B(T),d?s.s*(2-Wt(s)):+B(s))),l?E.mod(l):E;if(p=s.s<0,l){if(l.c?!l.c[0]:!l.s)return new _(NaN);m=!p&&T.isInteger()&&l.isInteger(),m&&(T=T.mod(l))}else{if(s.e>9&&(T.e>0||T.e<-1||(T.e==0?T.c[0]>1||d&&T.c[1]>=24e7:T.c[0]<8e13||d&&T.c[0]<=9999975e7)))return v=T.s<0&&Wt(s)?-0:0,T.e>-1&&(v=1/v),new _(p?1/v:v);N&&(v=ni(N/D+2))}for(d?(f=new _(.5),p&&(s.s=1),w=Wt(s)):(c=Math.abs(+B(s)),w=c%2),E=new _(u);;){if(w){if(E=E.times(T),!E.c)break;v?E.c.length>v&&(E.c.length=v):m&&(E=E.mod(l))}if(c){if(c=Ce(c/2),c===0)break;w=c%2}else if(s=s.times(f),Z(s,s.e+1,1),s.e>14)w=Wt(s);else{if(c=+B(s),c===0)break;w=c%2}T=T.times(T),v?T.c&&T.c.length>v&&(T.c.length=v):m&&(T=T.mod(l))}return m?E:(p&&(E=u.div(E)),l?E.mod(l):v?Z(E,N,o,y):E)},r.integerValue=function(s){var l=new _(this);return s==null?s=o:oe(s,0,8),Z(l,l.e+1,s)},r.isEqualTo=r.eq=function(s,l){return ot(this,new _(s,l))===0},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(s,l){return ot(this,new _(s,l))>0},r.isGreaterThanOrEqualTo=r.gte=function(s,l){return(l=ot(this,new _(s,l)))===1||l===0},r.isInteger=function(){return!!this.c&&ke(this.e/D)>this.c.length-2},r.isLessThan=r.lt=function(s,l){return ot(this,new _(s,l))<0},r.isLessThanOrEqualTo=r.lte=function(s,l){return(l=ot(this,new _(s,l)))===-1||l===0},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return this.s>0},r.isZero=function(){return!!this.c&&this.c[0]==0},r.minus=function(s,l){var f,m,c,v,y=this,d=y.s;if(s=new _(s,l),l=s.s,!d||!l)return new _(NaN);if(d!=l)return s.s=-l,y.plus(s);var p=y.e/D,w=s.e/D,E=y.c,T=s.c;if(!p||!w){if(!E||!T)return E?(s.s=-l,s):new _(T?y:NaN);if(!E[0]||!T[0])return T[0]?(s.s=-l,s):new _(E[0]?y:o==3?-0:0)}if(p=ke(p),w=ke(w),E=E.slice(),d=p-w){for((v=d<0)?(d=-d,c=E):(w=p,c=T),c.reverse(),l=d;l--;c.push(0));c.reverse()}else for(m=(v=(d=E.length)<(l=T.length))?d:l,d=l=0;l<m;l++)if(E[l]!=T[l]){v=E[l]<T[l];break}if(v&&(c=E,E=T,T=c,s.s=-s.s),l=(m=T.length)-(f=E.length),l>0)for(;l--;E[f++]=0);for(l=Ie-1;m>d;){if(E[--m]<T[m]){for(f=m;f&&!E[--f];E[f]=l);--E[f],E[m]+=Ie}E[m]-=T[m]}for(;E[0]==0;E.splice(0,1),--w);return E[0]?Y(s,E,w):(s.s=o==3?-1:1,s.c=[s.e=0],s)},r.modulo=r.mod=function(s,l){var f,m,c=this;return s=new _(s,l),!c.c||!s.s||s.c&&!s.c[0]?new _(NaN):!s.c||c.c&&!c.c[0]?new _(c):(k==9?(m=s.s,s.s=1,f=e(c,s,0,3),s.s=m,f.s*=m):f=e(c,s,0,k),s=c.minus(f.times(s)),!s.c[0]&&k==1&&(s.s=c.s),s)},r.multipliedBy=r.times=function(s,l){var f,m,c,v,y,d,p,w,E,T,A,G,V,Q,re,q=this,H=q.c,ge=(s=new _(s,l)).c;if(!H||!ge||!H[0]||!ge[0])return!q.s||!s.s||H&&!H[0]&&!ge||ge&&!ge[0]&&!H?s.c=s.e=s.s=null:(s.s*=q.s,!H||!ge?s.c=s.e=null:(s.c=[0],s.e=0)),s;for(m=ke(q.e/D)+ke(s.e/D),s.s*=q.s,p=H.length,T=ge.length,p<T&&(V=H,H=ge,ge=V,c=p,p=T,T=c),c=p+T,V=[];c--;V.push(0));for(Q=Ie,re=$e,c=T;--c>=0;){for(f=0,A=ge[c]%re,G=ge[c]/re|0,y=p,v=c+y;v>c;)w=H[--y]%re,E=H[y]/re|0,d=G*w+E*A,w=A*w+d%re*re+V[v]+f,f=(w/Q|0)+(d/re|0)+G*E,V[v--]=w%Q;V[v]=f}return f?++m:V.splice(0,1),Y(s,V,m)},r.negated=function(){var s=new _(this);return s.s=-s.s||null,s},r.plus=function(s,l){var f,m=this,c=m.s;if(s=new _(s,l),l=s.s,!c||!l)return new _(NaN);if(c!=l)return s.s=-l,m.minus(s);var v=m.e/D,y=s.e/D,d=m.c,p=s.c;if(!v||!y){if(!d||!p)return new _(c/0);if(!d[0]||!p[0])return p[0]?s:new _(d[0]?m:c*0)}if(v=ke(v),y=ke(y),d=d.slice(),c=v-y){for(c>0?(y=v,f=p):(c=-c,f=d),f.reverse();c--;f.push(0));f.reverse()}for(c=d.length,l=p.length,c-l<0&&(f=p,p=d,d=f,l=c),c=0;l;)c=(d[--l]=d[l]+p[l]+c)/Ie|0,d[l]=Ie===d[l]?0:d[l]%Ie;return c&&(d=[c].concat(d),++y),Y(s,d,y)},r.precision=r.sd=function(s,l){var f,m,c,v=this;if(s!=null&&s!==!!s)return oe(s,1,Le),l==null?l=o:oe(l,0,8),Z(new _(v),s,l);if(!(f=v.c))return null;if(c=f.length-1,m=c*D+1,c=f[c]){for(;c%10==0;c/=10,m--);for(c=f[0];c>=10;c/=10,m++);}return s&&v.e+1>m&&(m=v.e+1),m},r.shiftedBy=function(s){return oe(s,-9007199254740991,Qi),this.times("1e"+s)},r.squareRoot=r.sqrt=function(){var s,l,f,m,c,v=this,y=v.c,d=v.s,p=v.e,w=a+4,E=new _("0.5");if(d!==1||!y||!y[0])return new _(!d||d<0&&(!y||y[0])?NaN:y?v:1/0);if(d=Math.sqrt(+B(v)),d==0||d==1/0?(l=Oe(y),(l.length+p)%2==0&&(l+="0"),d=Math.sqrt(+l),p=ke((p+1)/2)-(p<0||p%2),d==1/0?l="5e"+p:(l=d.toExponential(),l=l.slice(0,l.indexOf("e")+1)+p),f=new _(l)):f=new _(d+""),f.c[0]){for(p=f.e,d=p+w,d<3&&(d=0);;)if(c=f,f=E.times(c.plus(e(v,c,w,1))),Oe(c.c).slice(0,d)===(l=Oe(f.c)).slice(0,d))if(f.e<p&&--d,l=l.slice(d-3,d+1),l=="9999"||!m&&l=="4999"){if(!m&&(Z(c,c.e+a+2,0),c.times(c).eq(v))){f=c;break}w+=4,d+=4,m=1}else{(!+l||!+l.slice(1)&&l.charAt(0)=="5")&&(Z(f,f.e+a+2,1),s=!f.times(f).eq(v));break}}return Z(f,f.e+a+1,o,s)},r.toExponential=function(s,l){return s!=null&&(oe(s,0,Le),s++),R(this,s,l,1)},r.toFixed=function(s,l){return s!=null&&(oe(s,0,Le),s=s+this.e+1),R(this,s,l)},r.toFormat=function(s,l,f){var m,c=this;if(f==null)s!=null&&l&&typeof l=="object"?(f=l,l=null):s&&typeof s=="object"?(f=s,s=l=null):f=C;else if(typeof f!="object")throw Error(we+"Argument not an object: "+f);if(m=c.toFixed(s,l),c.c){var v,y=m.split("."),d=+f.groupSize,p=+f.secondaryGroupSize,w=f.groupSeparator||"",E=y[0],T=y[1],A=c.s<0,G=A?E.slice(1):E,V=G.length;if(p&&(v=d,d=p,p=v,V-=v),d>0&&V>0){for(v=V%d||d,E=G.substr(0,v);v<V;v+=d)E+=w+G.substr(v,d);p>0&&(E+=w+G.slice(v)),A&&(E="-"+E)}m=T?E+(f.decimalSeparator||"")+((p=+f.fractionGroupSize)?T.replace(new RegExp("\\d{"+p+"}\\B","g"),"$&"+(f.fractionGroupSeparator||"")):T):E}return(f.prefix||"")+m+(f.suffix||"")},r.toFraction=function(s){var l,f,m,c,v,y,d,p,w,E,T,A,G=this,V=G.c;if(s!=null&&(d=new _(s),!d.isInteger()&&(d.c||d.s!==1)||d.lt(u)))throw Error(we+"Argument "+(d.isInteger()?"out of range: ":"not an integer: ")+B(d));if(!V)return new _(G);for(l=new _(u),w=f=new _(u),m=p=new _(u),A=Oe(V),v=l.e=A.length-G.e-1,l.c[0]=ri[(y=v%D)<0?D+y:y],s=!s||d.comparedTo(l)>0?v>0?l:w:d,y=S,S=1/0,d=new _(A),p.c[0]=0;E=e(d,l,0,1),c=f.plus(E.times(m)),c.comparedTo(s)!=1;)f=m,m=c,w=p.plus(E.times(c=w)),p=c,l=d.minus(E.times(c=l)),d=c;return c=e(s.minus(f),m,0,1),p=p.plus(c.times(w)),f=f.plus(c.times(m)),p.s=w.s=G.s,v=v*2,T=e(w,m,v,o).minus(G).abs().comparedTo(e(p,f,v,o).minus(G).abs())<1?[w,m]:[p,f],S=y,T},r.toNumber=function(){return+B(this)},r.toPrecision=function(s,l){return s!=null&&oe(s,1,Le),R(this,s,l,2)},r.toString=function(s){var l,f=this,m=f.s,c=f.e;return c===null?m?(l="Infinity",m<0&&(l="-"+l)):l="NaN":(s==null?l=c<=g||c>=h?Ft(Oe(f.c),c):He(Oe(f.c),c,"0"):s===10&&I?(f=Z(new _(f),a+c+1,o),l=He(Oe(f.c),f.e,"0")):(oe(s,2,O.length,"Base"),l=t(He(Oe(f.c),c,"0"),10,s,m,!0)),m<0&&f.c[0]&&(l="-"+l)),l},r.valueOf=r.toJSON=function(){return B(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,i!=null&&_.set(i),_}function ke(i){var e=i|0;return i>0||i===e?e:e-1}function Oe(i){for(var e,t,n=1,r=i.length,u=i[0]+"";n<r;){for(e=i[n++]+"",t=D-e.length;t--;e="0"+e);u+=e}for(r=u.length;u.charCodeAt(--r)===48;);return u.slice(0,r+1||1)}function ot(i,e){var t,n,r=i.c,u=e.c,a=i.s,o=e.s,g=i.e,h=e.e;if(!a||!o)return null;if(t=r&&!r[0],n=u&&!u[0],t||n)return t?n?0:-o:a;if(a!=o)return a;if(t=a<0,n=g==h,!r||!u)return n?0:!r^t?1:-1;if(!n)return g>h^t?1:-1;for(o=(g=r.length)<(h=u.length)?g:h,a=0;a<o;a++)if(r[a]!=u[a])return r[a]>u[a]^t?1:-1;return g==h?0:g>h^t?1:-1}function oe(i,e,t,n){if(i<e||i>t||i!==Ce(i))throw Error(we+(n||"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 ke(i.e/D)==e&&i.c[e]%2!=0}function Ft(i,e){return(i.length>1?i.charAt(0)+"."+i.slice(1):i)+(e<0?"e":"e+")+e}function He(i,e,t){var n,r;if(e<0){for(r=t+".";++e;r+=t);i=r+i}else if(n=i.length,++e>n){for(r=t,e-=n;--e;r+=t);i+=r}else e<n&&(i=i.slice(0,e)+"."+i.slice(e));return i}var Ge=Xi(),Vr=class{constructor(i){P(this,"key");P(this,"left",null);P(this,"right",null);this.key=i}},Lt=class extends Vr{constructor(i){super(i)}},jr=class{constructor(){P(this,"size",0);P(this,"modificationCount",0);P(this,"splayCount",0)}splay(i){const e=this.root;if(e==null)return this.compare(i,i),-1;let t=null,n=null,r=null,u=null,a=e;const o=this.compare;let g;for(;;)if(g=o(a.key,i),g>0){let h=a.left;if(h==null||(g=o(h.key,i),g>0&&(a.left=h.right,h.right=a,a=h,h=a.left,h==null)))break;t==null?n=a:t.left=a,t=a,a=h}else if(g<0){let h=a.right;if(h==null||(g=o(h.key,i),g<0&&(a.right=h.left,h.left=a,a=h,h=a.right,h==null)))break;r==null?u=a:r.right=a,r=a,a=h}else break;return r!=null&&(r.right=a.left,a.left=u),t!=null&&(t.left=a.right,a.right=n),this.root!==a&&(this.root=a,this.splayCount++),g}splayMin(i){let e=i,t=e.left;for(;t!=null;){const n=t;e.left=n.right,n.right=e,e=n,t=e.left}return e}splayMax(i){let e=i,t=e.right;for(;t!=null;){const n=t;e.right=n.left,n.left=e,e=n,t=e.right}return e}_delete(i){if(this.root==null||this.splay(i)!=0)return null;let t=this.root;const n=t,r=t.left;if(this.size--,r==null)this.root=t.right;else{const u=t.right;t=this.splayMax(r),t.right=u,this.root=t}return this.modificationCount++,n}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)}}},zt=class Ct extends jr{constructor(t,n){super();P(this,"root",null);P(this,"compare");P(this,"validKey");P(this,vn,"[object Set]");this.compare=t??this.defaultCompare(),this.validKey=n??(r=>r!=null&&r!=null)}delete(t){return this.validKey(t)?this._delete(t)!=null:!1}deleteAll(t){for(const n of t)this.delete(n)}forEach(t){const n=this[Symbol.iterator]();let r;for(;r=n.next(),!r.done;)t(r.value,r.value,this)}add(t){const n=this.splay(t);return n!=0&&this.addNewRoot(new Lt(t),n),this}addAndReturn(t){const n=this.splay(t);return n!=0&&this.addNewRoot(new Lt(t),n),this.root.key}addAll(t){for(const n of t)this.add(n)}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(t){if(t==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(t)<0)return this.root.key;let r=this.root.left;if(r==null)return null;let u=r.right;for(;u!=null;)r=u,u=r.right;return r.key}firstAfter(t){if(t==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(t)>0)return this.root.key;let r=this.root.right;if(r==null)return null;let u=r.left;for(;u!=null;)r=u,u=r.left;return r.key}retainAll(t){const n=new Ct(this.compare,this.validKey),r=this.modificationCount;for(const u of t){if(r!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(u)&&this.splay(u)==0&&n.add(this.root.key)}n.size!=this.size&&(this.root=n.root,this.size=n.size,this.modificationCount++)}lookup(t){return!this.validKey(t)||this.splay(t)!=0?null:this.root.key}intersection(t){const n=new Ct(this.compare,this.validKey);for(const r of this)t.has(r)&&n.add(r);return n}difference(t){const n=new Ct(this.compare,this.validKey);for(const r of this)t.has(r)||n.add(r);return n}union(t){const n=this.clone();return n.addAll(t),n}clone(){const t=new Ct(this.compare,this.validKey);return t.size=this.size,t.root=this.copyNode(this.root),t}copyNode(t){if(t==null)return null;function n(u,a){let o,g;do{if(o=u.left,g=u.right,o!=null){const h=new Lt(o.key);a.left=h,n(o,h)}if(g!=null){const h=new Lt(g.key);a.right=h,u=g,a=h}}while(g!=null)}const r=new Lt(t.key);return n(t,r),r}toSet(){return this.clone()}entries(){return new Zr(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[(bn=Symbol.iterator,vn=Symbol.toStringTag,bn)](){return new Hr(this.wrap())}},Ji=class{constructor(i){P(this,"tree");P(this,"path",new Array);P(this,"modificationCount",null);P(this,"splayCount");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}},Hr=class extends Ji{getValue(i){return i.key}},Zr=class extends Ji{getValue(i){return[i.key,i.key]}},$i=i=>()=>i,si=i=>{const e=i?(t,n)=>n.minus(t).abs().isLessThanOrEqualTo(i):$i(!1);return(t,n)=>e(t,n)?0:t.comparedTo(n)};function Kr(i){const e=i?(t,n,r,u,a)=>t.exponentiatedBy(2).isLessThanOrEqualTo(u.minus(n).exponentiatedBy(2).plus(a.minus(r).exponentiatedBy(2)).times(i)):$i(!1);return(t,n,r)=>{const u=t.x,a=t.y,o=r.x,g=r.y,h=a.minus(g).times(n.x.minus(o)).minus(u.minus(o).times(n.y.minus(g)));return e(h,u,a,o,g)?0:h.comparedTo(0)}}var Yr=i=>i,Qr=i=>{if(i){const e=new zt(si(i)),t=new zt(si(i)),n=(u,a)=>a.addAndReturn(u),r=u=>({x:n(u.x,e),y:n(u.y,t)});return r({x:new Ge(0),y:new Ge(0)}),r}return Yr},oi=i=>({set:e=>{Ze=oi(e)},reset:()=>oi(i),compare:si(i),snap:Qr(i),orient:Kr(i)}),Ze=oi(),St=(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,n=i.ur.x.isLessThan(e.ur.x)?i.ur.x:e.ur.x,r=i.ll.y.isLessThan(e.ll.y)?e.ll.y:i.ll.y,u=i.ur.y.isLessThan(e.ur.y)?i.ur.y:e.ur.y;return{ll:{x:t,y:r},ur:{x:n,y:u}}},Dt=(i,e)=>i.x.times(e.y).minus(i.y.times(e.x)),en=(i,e)=>i.x.times(e.x).plus(i.y.times(e.y)),Ut=i=>en(i,i).sqrt(),Xr=(i,e,t)=>{const n={x:e.x.minus(i.x),y:e.y.minus(i.y)},r={x:t.x.minus(i.x),y:t.y.minus(i.y)};return Dt(r,n).div(Ut(r)).div(Ut(n))},Jr=(i,e,t)=>{const n={x:e.x.minus(i.x),y:e.y.minus(i.y)},r={x:t.x.minus(i.x),y:t.y.minus(i.y)};return en(r,n).div(Ut(r)).div(Ut(n))},tn=(i,e,t)=>e.y.isZero()?null:{x:i.x.plus(e.x.div(e.y).times(t.minus(i.y))),y:t},nn=(i,e,t)=>e.x.isZero()?null:{x:t,y:i.y.plus(e.y.div(e.x).times(t.minus(i.x)))},$r=(i,e,t,n)=>{if(e.x.isZero())return nn(t,n,i.x);if(n.x.isZero())return nn(i,e,t.x);if(e.y.isZero())return tn(t,n,i.y);if(n.y.isZero())return tn(i,e,t.y);const r=Dt(e,n);if(r.isZero())return null;const u={x:t.x.minus(i.x),y:t.y.minus(i.y)},a=Dt(u,e).div(r),o=Dt(u,n).div(r),g=i.x.plus(o.times(e.x)),h=t.x.plus(a.times(n.x)),b=i.y.plus(o.times(e.y)),S=t.y.plus(a.times(n.y)),M=g.plus(h).div(2),k=b.plus(S).div(2);return{x:M,y:k}},Be=class Cn{constructor(e,t){P(this,"point");P(this,"isLeft");P(this,"segment");P(this,"otherSE");P(this,"consumedBy");e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=t}static compare(e,t){const n=Cn.comparePoints(e.point,t.point);return n!==0?n:(e.point!==t.point&&e.link(t),e.isLeft!==t.isLeft?e.isLeft?1:-1:Vt.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}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");const t=e.point.events;for(let n=0,r=t.length;n<r;n++){const u=t[n];this.point.events.push(u),u.point=this.point}this.checkForConsuming()}checkForConsuming(){const e=this.point.events.length;for(let t=0;t<e;t++){const n=this.point.events[t];if(n.segment.consumedBy===void 0)for(let r=t+1;r<e;r++){const u=this.point.events[r];u.consumedBy===void 0&&n.otherSE.point.events===u.otherSE.point.events&&n.segment.consume(u.segment)}}}getAvailableLinkedEvents(){const e=[];for(let t=0,n=this.point.events.length;t<n;t++){const r=this.point.events[t];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&e.push(r)}return e}getLeftmostComparator(e){const t=new Map,n=r=>{const u=r.otherSE;t.set(r,{sine:Xr(this.point,e.point,u.point),cosine:Jr(this.point,e.point,u.point)})};return(r,u)=>{t.has(r)||n(r),t.has(u)||n(u);const{sine:a,cosine:o}=t.get(r),{sine:g,cosine:h}=t.get(u);return a.isGreaterThanOrEqualTo(0)&&g.isGreaterThanOrEqualTo(0)?o.isLessThan(h)?1:o.isGreaterThan(h)?-1:0:a.isLessThan(0)&&g.isLessThan(0)?o.isLessThan(h)?-1:o.isGreaterThan(h)?1:0:g.isLessThan(a)?-1:g.isGreaterThan(a)?1:0}}},es=class vi{constructor(e){P(this,"events");P(this,"poly");P(this,"_isExteriorRing");P(this,"_enclosingRing");this.events=e;for(let t=0,n=e.length;t<n;t++)e[t].segment.ringOut=this;this.poly=null}static factory(e){const t=[];for(let n=0,r=e.length;n<r;n++){const u=e[n];if(!u.isInResult()||u.ringOut)continue;let a=null,o=u.leftSE,g=u.rightSE;const h=[o],b=o.point,S=[];for(;a=o,o=g,h.push(o),o.point!==b;)for(;;){const M=o.getAvailableLinkedEvents();if(M.length===0){const C=h[0].point,O=h[h.length-1].point;throw new Error(`Unable to complete output ring starting at [${C.x}, ${C.y}]. Last matching segment found ends at [${O.x}, ${O.y}].`)}if(M.length===1){g=M[0].otherSE;break}let k=null;for(let C=0,O=S.length;C<O;C++)if(S[C].point===o.point){k=C;break}if(k!==null){const C=S.splice(k)[0],O=h.splice(C.index);O.unshift(O[0].otherSE),t.push(new vi(O.reverse()));continue}S.push({index:h.length,point:o.point});const N=o.getLeftmostComparator(a);g=M.sort(N)[0].otherSE;break}t.push(new vi(h))}return t}getGeom(){let e=this.events[0].point;const t=[e];for(let h=1,b=this.events.length-1;h<b;h++){const S=this.events[h].point,M=this.events[h+1].point;Ze.orient(S,e,M)!==0&&(t.push(S),e=S)}if(t.length===1)return null;const n=t[0],r=t[1];Ze.orient(n,e,r)===0&&t.shift(),t.push(t[0]);const u=this.isExteriorRing()?1:-1,a=this.isExteriorRing()?0:t.length-1,o=this.isExteriorRing()?t.length:-1,g=[];for(let h=a;h!=o;h+=u)g.push([t[h].x.toNumber(),t[h].y.toNumber()]);return g}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(){var r,u;let e=this.events[0];for(let a=1,o=this.events.length;a<o;a++){const g=this.events[a];Be.compare(e,g)>0&&(e=g)}let t=e.segment.prevInResult(),n=t?t.prevInResult():null;for(;;){if(!t)return null;if(!n)return t.ringOut;if(n.ringOut!==t.ringOut)return((r=n.ringOut)==null?void 0:r.enclosingRing())!==t.ringOut?t.ringOut:(u=t.ringOut)==null?void 0:u.enclosingRing();t=n.prevInResult(),n=t?t.prevInResult():null}}},rn=class{constructor(i){P(this,"exteriorRing");P(this,"interiorRings");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,n=this.interiorRings.length;t<n;t++){const r=this.interiorRings[t].getGeom();r!==null&&e.push(r)}return e}},ts=class{constructor(i){P(this,"rings");P(this,"polys");this.rings=i,this.polys=this._composePolys(i)}getGeom(){const i=[];for(let e=0,t=this.polys.length;e<t;e++){const n=this.polys[e].getGeom();n!==null&&i.push(n)}return i}_composePolys(i){var t;const e=[];for(let n=0,r=i.length;n<r;n++){const u=i[n];if(!u.poly)if(u.isExteriorRing())e.push(new rn(u));else{const a=u.enclosingRing();a!=null&&a.poly||e.push(new rn(a)),(t=a==null?void 0:a.poly)==null||t.addInterior(u)}}return e}},is=class{constructor(i,e=Vt.compare){P(this,"queue");P(this,"tree");P(this,"segments");this.queue=i,this.tree=new zt(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 n=e,r=e;do n=this.tree.lastBefore(n);while(n!=null&&n.consumedBy!=null);do r=this.tree.firstAfter(r);while(r!=null&&r.consumedBy!=null);if(i.isLeft){let u=null;if(n){const o=n.getIntersection(e);if(o!==null&&(e.isAnEndpoint(o)||(u=o),!n.isAnEndpoint(o))){const g=this._splitSafely(n,o);for(let h=0,b=g.length;h<b;h++)t.push(g[h])}}let a=null;if(r){const o=r.getIntersection(e);if(o!==null&&(e.isAnEndpoint(o)||(a=o),!r.isAnEndpoint(o))){const g=this._splitSafely(r,o);for(let h=0,b=g.length;h<b;h++)t.push(g[h])}}if(u!==null||a!==null){let o=null;u===null?o=a:a===null?o=u:o=Be.comparePoints(u,a)<=0?u:a,this.queue.delete(e.rightSE),t.push(e.rightSE);const g=e.split(o);for(let h=0,b=g.length;h<b;h++)t.push(g[h])}t.length>0?(this.tree.delete(e),t.push(i)):(this.segments.push(e),e.prev=n)}else{if(n&&r){const u=n.getIntersection(r);if(u!==null){if(!n.isAnEndpoint(u)){const a=this._splitSafely(n,u);for(let o=0,g=a.length;o<g;o++)t.push(a[o])}if(!r.isAnEndpoint(u)){const a=this._splitSafely(r,u);for(let o=0,g=a.length;o<g;o++)t.push(a[o])}}}this.tree.delete(e)}return t}_splitSafely(i,e){this.tree.delete(i);const t=i.rightSE;this.queue.delete(t);const n=i.split(e);return n.push(t),i.consumedBy===void 0&&this.tree.add(i),n}},ns=class{constructor(){P(this,"type");P(this,"numMultiPolys")}run(i,e,t){_t.type=i;const n=[new on(e,!0)];for(let h=0,b=t.length;h<b;h++)n.push(new on(t[h],!1));if(_t.numMultiPolys=n.length,_t.type==="difference"){const h=n[0];let b=1;for(;b<n.length;)li(n[b].bbox,h.bbox)!==null?b++:n.splice(b,1)}if(_t.type==="intersection")for(let h=0,b=n.length;h<b;h++){const S=n[h];for(let M=h+1,k=n.length;M<k;M++)if(li(S.bbox,n[M].bbox)===null)return[]}const r=new zt(Be.compare);for(let h=0,b=n.length;h<b;h++){const S=n[h].getSweepEvents();for(let M=0,k=S.length;M<k;M++)r.add(S[M])}const u=new is(r);let a=null;for(r.size!=0&&(a=r.first(),r.delete(a));a;){const h=u.process(a);for(let b=0,S=h.length;b<S;b++){const M=h[b];M.consumedBy===void 0&&r.add(M)}r.size!=0?(a=r.first(),r.delete(a)):a=null}Ze.reset();const o=es.factory(u.segments);return new ts(o).getGeom()}},_t=new ns,qt=_t,rs=0,Vt=class Zt{constructor(e,t,n,r){P(this,"id");P(this,"leftSE");P(this,"rightSE");P(this,"rings");P(this,"windings");P(this,"ringOut");P(this,"consumedBy");P(this,"prev");P(this,"_prevInResult");P(this,"_beforeState");P(this,"_afterState");P(this,"_isInResult");this.id=++rs,this.leftSE=e,e.segment=this,e.otherSE=t,this.rightSE=t,t.segment=this,t.otherSE=e,this.rings=n,this.windings=r}static compare(e,t){const n=e.leftSE.point.x,r=t.leftSE.point.x,u=e.rightSE.point.x,a=t.rightSE.point.x;if(a.isLessThan(n))return 1;if(u.isLessThan(r))return-1;const o=e.leftSE.point.y,g=t.leftSE.point.y,h=e.rightSE.point.y,b=t.rightSE.point.y;if(n.isLessThan(r)){if(g.isLessThan(o)&&g.isLessThan(h))return 1;if(g.isGreaterThan(o)&&g.isGreaterThan(h))return-1;const S=e.comparePoint(t.leftSE.point);if(S<0)return 1;if(S>0)return-1;const M=t.comparePoint(e.rightSE.point);return M!==0?M:-1}if(n.isGreaterThan(r)){if(o.isLessThan(g)&&o.isLessThan(b))return-1;if(o.isGreaterThan(g)&&o.isGreaterThan(b))return 1;const S=t.comparePoint(e.leftSE.point);if(S!==0)return S;const M=e.comparePoint(t.rightSE.point);return M<0?1:M>0?-1:1}if(o.isLessThan(g))return-1;if(o.isGreaterThan(g))return 1;if(u.isLessThan(a)){const S=t.comparePoint(e.rightSE.point);if(S!==0)return S}if(u.isGreaterThan(a)){const S=e.comparePoint(t.rightSE.point);if(S<0)return 1;if(S>0)return-1}if(!u.eq(a)){const S=h.minus(o),M=u.minus(n),k=b.minus(g),N=a.minus(r);if(S.isGreaterThan(M)&&k.isLessThan(N))return 1;if(S.isLessThan(M)&&k.isGreaterThan(N))return-1}return u.isGreaterThan(a)?1:u.isLessThan(a)||h.isLessThan(b)?-1:h.isGreaterThan(b)?1:e.id<t.id?-1:e.id>t.id?1:0}static fromRing(e,t,n){let r,u,a;const o=Be.comparePoints(e,t);if(o<0)r=e,u=t,a=1;else if(o>0)r=t,u=e,a=-1;else throw new Error(`Tried to create degenerate segment at [${e.x}, ${e.y}]`);const g=new Be(r,!0),h=new Be(u,!1);return new Zt(g,h,[n],[a])}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 Ze.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){const t=this.bbox(),n=e.bbox(),r=li(t,n);if(r===null)return null;const u=this.leftSE.point,a=this.rightSE.point,o=e.leftSE.point,g=e.rightSE.point,h=St(t,o)&&this.comparePoint(o)===0,b=St(n,u)&&e.comparePoint(u)===0,S=St(t,g)&&this.comparePoint(g)===0,M=St(n,a)&&e.comparePoint(a)===0;if(b&&h)return M&&!S?a:!M&&S?g:null;if(b)return S&&u.x.eq(g.x)&&u.y.eq(g.y)?null:u;if(h)return M&&a.x.eq(o.x)&&a.y.eq(o.y)?null:o;if(M&&S)return null;if(M)return a;if(S)return g;const k=$r(u,this.vector(),o,e.vector());return k===null||!St(r,k)?null:Ze.snap(k)}split(e){const t=[],n=e.events!==void 0,r=new Be(e,!0),u=new Be(e,!1),a=this.rightSE;this.replaceRightSE(u),t.push(u),t.push(r);const o=new Zt(r,a,this.rings.slice(),this.windings.slice());return Be.comparePoints(o.leftSE.point,o.rightSE.point)>0&&o.swapEvents(),Be.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(r.checkForConsuming(),u.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,n=this.windings.length;t<n;t++)this.windings[t]*=-1}consume(e){let t=this,n=e;for(;t.consumedBy;)t=t.consumedBy;for(;n.consumedBy;)n=n.consumedBy;const r=Zt.compare(t,n);if(r!==0){if(r>0){const u=t;t=n,n=u}if(t.prev===n){const u=t;t=n,n=u}for(let u=0,a=n.rings.length;u<a;u++){const o=n.rings[u],g=n.windings[u],h=t.rings.indexOf(o);h===-1?(t.rings.push(o),t.windings.push(g)):t.windings[h]+=g}n.rings=null,n.windings=null,n.consumedBy=t,n.leftSE.consumedBy=t.leftSE,n.rightSE.consumedBy=t.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{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,n=this._afterState.windings,r=this._afterState.multiPolys;for(let o=0,g=this.rings.length;o<g;o++){const h=this.rings[o],b=this.windings[o],S=t.indexOf(h);S===-1?(t.push(h),n.push(b)):n[S]+=b}const u=[],a=[];for(let o=0,g=t.length;o<g;o++){if(n[o]===0)continue;const h=t[o],b=h.poly;if(a.indexOf(b)===-1)if(h.isExterior)u.push(b);else{a.indexOf(b)===-1&&a.push(b);const S=u.indexOf(h.poly);S!==-1&&u.splice(S,1)}}for(let o=0,g=u.length;o<g;o++){const h=u[o].multiPoly;r.indexOf(h)===-1&&r.push(h)}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(qt.type){case"union":{const n=e.length===0,r=t.length===0;this._isInResult=n!==r;break}case"intersection":{let n,r;e.length<t.length?(n=e.length,r=t.length):(n=t.length,r=e.length),this._isInResult=r===qt.numMultiPolys&&n<r;break}case"xor":{const n=Math.abs(e.length-t.length);this._isInResult=n%2===1;break}case"difference":{const n=r=>r.length===1&&r[0].isSubject;this._isInResult=n(e)!==n(t);break}}return this._isInResult}},sn=class{constructor(i,e,t){P(this,"poly");P(this,"isExterior");P(this,"segments");P(this,"bbox");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 n=Ze.snap({x:new Ge(i[0][0]),y:new Ge(i[0][1])});this.bbox={ll:{x:n.x,y:n.y},ur:{x:n.x,y:n.y}};let r=n;for(let u=1,a=i.length;u<a;u++){if(typeof i[u][0]!="number"||typeof i[u][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const o=Ze.snap({x:new Ge(i[u][0]),y:new Ge(i[u][1])});o.x.eq(r.x)&&o.y.eq(r.y)||(this.segments.push(Vt.fromRing(r,o,this)),o.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=o.x),o.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=o.y),o.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=o.x),o.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=o.y),r=o)}(!n.x.eq(r.x)||!n.y.eq(r.y))&&this.segments.push(Vt.fromRing(r,n,this))}getSweepEvents(){const i=[];for(let e=0,t=this.segments.length;e<t;e++){const n=this.segments[e];i.push(n.leftSE),i.push(n.rightSE)}return i}},ss=class{constructor(i,e){P(this,"multiPoly");P(this,"exteriorRing");P(this,"interiorRings");P(this,"bbox");if(!Array.isArray(i))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new sn(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,n=i.length;t<n;t++){const r=new sn(i[t],this,!1);r.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=r.bbox.ll.x),r.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=r.bbox.ll.y),r.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=r.bbox.ur.x),r.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=r.bbox.ur.y),this.interiorRings.push(r)}this.multiPoly=e}getSweepEvents(){const i=this.exteriorRing.getSweepEvents();for(let e=0,t=this.interiorRings.length;e<t;e++){const n=this.interiorRings[e].getSweepEvents();for(let r=0,u=n.length;r<u;r++)i.push(n[r])}return i}},on=class{constructor(i,e){P(this,"isSubject");P(this,"polys");P(this,"bbox");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,n=i.length;t<n;t++){const r=new ss(i[t],this);r.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=r.bbox.ll.x),r.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=r.bbox.ll.y),r.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=r.bbox.ur.x),r.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=r.bbox.ur.y),this.polys.push(r)}this.isSubject=e}getSweepEvents(){const i=[];for(let e=0,t=this.polys.length;e<t;e++){const n=this.polys[e].getSweepEvents();for(let r=0,u=n.length;r<u;r++)i.push(n[r])}return i}},os=(i,...e)=>qt.run("union",i,e),ls=(i,...e)=>qt.run("difference",i,e);Ze.set;function us(i){const e=[];if(ii(i,r=>{e.push(r.coordinates)}),e.length<2)throw new Error("Must have at least two features");const t=i.features[0].properties||{},n=ls(e[0],...e.slice(1));return n.length===0?null:n.length===1?ei(n[0],t):Hi(n,t)}var as=us;function fs(i){if(!i)throw new Error("geojson is required");var e=[];return Dr(i,function(t){e.push(t)}),ti(e)}var cs=fs;function hs(i,e={}){const t=[];if(ii(i,r=>{t.push(r.coordinates)}),t.length<2)throw new Error("Must have at least 2 geometries");const n=os(t[0],...t.slice(1));return n.length===0?null:n.length===1?ei(n[0],e.properties):Hi(n,e.properties)}var ds=hs;function ln(i,e){const t=as(ti([ei([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),i]));if(!t)return;t.properties={isMask:!0};const n=Gt(Ki(i)),r=(n[2]-n[0])/360/1e3,u=n[0]<-180,a=n[2]>180,o=cs(i);if(o.features.length>1&&(u||a))for(const g of o.features){const h=Gt(Ki(g));if(a&&h[0]<-180+r)for(const b of g.geometry.coordinates)for(const S of b)S[0]+=360-r;if(u&&h[2]>180-r)for(const b of g.geometry.coordinates)for(const S of b)S[0]-=360-r}e(ti([o.features.length<2?i:ds(o)??i,t]))}const un="EPSG:4326";function gs(i){var u;const e=i.getProperties(),{isMask:t}=e,n=(u=i.getGeometry())==null?void 0:u.getType(),r=t?0:n==="LineString"||n==="MultiLineString"?3:2;return new Rn({stroke:t?void 0:new wi({color:"#3170fe",lineDash:[r,r],width:r,lineCap:"butt"}),fill:t?new bi({color:"#00000020"}):void 0,image:new Pn({src:`/icons/marker_${e.isReverse?"reverse":e.isSelected?"selected":"unselected"}.svg`,anchor:[.5,1]}),zIndex:e.isSelected?2:e.isReverse?0:1,text:e.isSelected&&e.tooltip?new In({backgroundFill:new bi({color:"white"}),text:e.tooltip,offsetY:-40,backgroundStroke:new wi({color:"white",lineJoin:"round",width:3}),padding:[2,0,0,2]}):void 0})}function an(i,e={},t={},n=gs){let r=-1,u,a,o,g=!1;const h=new kn({updateWhileAnimating:!0});i.addLayer(h);const b=new On({});h.setSource(b),h.setStyle(n),i.on("click",N=>{i.forEachFeatureAtPixel(N.pixel,C=>{const O=C.getId();if(O)return N.stopPropagation(),a==null||a({type:"markerClick",id:O}),C})}),i.on("pointermove",N=>{const C=i.forEachFeatureAtPixel(N.pixel,O=>O.getId());u!==C&&(u&&(a==null||a({type:"markerMouseLeave",id:u})),C&&(a==null||a({type:"markerMouseEnter",id:C})),i.getTargetElement().style.cursor=C?"pointer":g?"crosshair":"",u=C)});function S(){return Qe.getUserProjection()??i.getView().getProjection()}function M(N){return N.transform(un,S())}const k=N=>{a==null||a({type:"mapClick",coordinates:Qe.toLonLat(N.coordinate,S())})};return{setEventHandler(N){N?(a=N,i.on("click",k)):(a=void 0,i.un("click",k))},flyTo(N,C){i.getView().animate({center:Qe.fromLonLat(N,S()),...C?{zoom:C}:{},duration:2e3,...e})},fitBounds(N,C,O){i.getView().fit(Qe.transformExtent(N,un,S()),{padding:[C,C,C,C],...O?{maxZoom:O}:{},duration:2e3,...t})},indicateReverse(N){g=N,i.getTargetElement().style.cursor=N?"crosshair":""},setReverseMarker(N){o?N?o.getGeometry().setCoordinates(Qe.fromLonLat(N,S())):(b.removeFeature(o),o.dispose(),o=void 0):N&&(o=new Te.Feature(new Me.Point(Qe.fromLonLat(N,S()))),o.setProperties({isReverse:!0}),b.addFeature(o))},setFeatures(N,C,O){function I(_){var R;if(_)for(const z of _.features){const Y=z.geometry.type==="Polygon"?new Me.Polygon(z.geometry.coordinates):z.geometry.type==="MultiPolygon"?new Me.MultiPolygon(z.geometry.coordinates):null;Y&&b.addFeature(new Te.Feature({isMask:!!((R=z.properties)!=null&&R.isMask),geometry:M(Y)}))}}b.clear(),o&&b.addFeature(o);e:if(C){let _=!1;if(C.geometry.type==="GeometryCollection"){const R=C.geometry.geometries.map(z=>z.type==="Polygon"?new Me.Polygon(z.coordinates):z.type==="MultiPolygon"?new Me.MultiPolygon(z.coordinates):null).filter(z=>!!z);if(R.length>0)b.addFeature(new Te.Feature(M(new Me.GeometryCollection(R)))),_=!0;else for(const z of C.geometry.geometries)z.type==="LineString"?(b.addFeature(new Te.Feature(M(new Me.LineString(z.coordinates)))),_=!0):z.type==="MultiLineString"&&b.addFeature(new Te.Feature(M(new Me.MultiLineString(z.coordinates)))),_=!0}if(!_){if(C.geometry.type==="Polygon")ln(C,I);else if(C.geometry.type==="MultiPolygon")ln(C,I);else if(C.geometry.type==="LineString"){b.addFeature(new Te.Feature(M(new Me.LineString(C.geometry.coordinates))));break e}else if(C.geometry.type==="MultiLineString"){b.addFeature(new Te.Feature(M(new Me.MultiLineString(C.geometry.coordinates))));break e}}if(!O&&C.geometry.type!=="Point")break e;b.addFeature(new Te.Feature(M(new Me.Point(C.center))))}for(const _ of N??[]){if(_===C)continue;const R=new Te.Feature(new Me.Point(Qe.fromLonLat(_.center,S())));R.setId(_.id),R.setProperties({fuzzy:!!_.matching_text,tooltip:_.place_type[0]==="reverse"?_.place_name:_.place_name.replace(/,.*/,"")}),b.addFeature(R)}},setSelectedMarker(N){var I,_,R;const C=b.getFeatures(),O=(I=C[0])!=null&&I.getProperties().isReverse?1:0;r>-1&&((_=C[r+O])==null||_.setProperties({isSelected:!1})),N>-1&&((R=C[N+O])==null||R.setProperties({isSelected:!0})),r=N},getCenterAndZoom(){const N=i.getView(),C=N.getCenter(),O=N.getZoom();if(!(!C||O===void 0))return[O,...Qe.toLonLat(C,S())]}}}class ms extends $.Control{constructor(t){const n=document.createElement("div");n.className="ol-search";super({element:n,target:t.target});yi(this,fe);yi(this,lt);const{flyTo:r,fullGeometryStyle:u,...a}=t;pi(this,fe,new zr({target:n,props:{flyTo:r===void 0?!0:!!r,...a}})),he(this,fe).$on("select",o=>{this.dispatchEvent(new fn(o.detail.feature))}),he(this,fe).$on("pick",o=>{this.dispatchEvent(new gn(o.detail.feature))}),he(this,fe).$on("featureslisted",o=>{this.dispatchEvent(new cn(o.detail.features))}),he(this,fe).$on("featuresmarked",o=>{this.dispatchEvent(new hn(o.detail.features))}),he(this,fe).$on("response",o=>{this.dispatchEvent(new yn(o.detail.url,o.detail.featureCollection))}),he(this,fe).$on("optionsvisibilitychange",o=>{this.dispatchEvent(new dn(o.detail.optionsVisible))}),he(this,fe).$on("reversetoggle",o=>{this.dispatchEvent(new pn(o.detail.reverse))}),he(this,fe).$on("querychange",o=>{this.dispatchEvent(new mn(o.detail.query))}),pi(this,lt,t)}setMap(t){var n;if(super.setMap(t),t){const{flyTo:r,fullGeometryStyle:u}=he(this,lt),a=an(t,typeof r=="boolean"?void 0:r,typeof r=="boolean"?void 0:r,u);(n=he(this,fe))==null||n.$set({mapController:a})}}setOptions(t){var a;Object.assign(he(this,lt),t);const{flyTo:n,fullGeometryStyle:r,...u}=he(this,lt);(a=he(this,fe))==null||a.$set({...u,flyTo:n===void 0?!0:!!n})}setQuery(t,n=!0){var r;(r=he(this,fe))==null||r.setQuery(t,n)}clearMap(){var t;(t=he(this,fe))==null||t.clearMap()}clearList(){var t;(t=he(this,fe))==null||t.clearList()}setReverseMode(t){var n;(n=he(this,fe))==null||n.$set({reverseActive:t})}focus(t){var n;(n=he(this,fe))==null||n.focus(t)}blur(){var t;(t=he(this,fe))==null||t.blur()}}fe=new WeakMap,lt=new WeakMap;class fn extends ie{constructor(t){super("select");P(this,"feature");this.feature=t}}class cn extends ie{constructor(t){super("featureslisted");P(this,"features");this.features=t}}class hn extends ie{constructor(t){super("featuresmarked");P(this,"features");this.features=t}}class dn extends ie{constructor(t){super("optionsvisibilitychange");P(this,"optionsVisible");this.optionsVisible=t}}class gn extends ie{constructor(t){super("pick");P(this,"feature");this.feature=t}}class mn extends ie{constructor(t){super("querychange");P(this,"query");this.query=t}}class yn extends ie{constructor(t,n){super("response");P(this,"url");P(this,"featureCollection");this.url=t,this.featureCollection=n}}class pn extends ie{constructor(t){super("reversetoggle");P(this,"reverse");this.reverse=t}}F.FeaturesListedEvent=cn,F.FeaturesMarkedEvent=hn,F.GeocodingControl=ms,F.OptionsVisibilityChangeEvent=dn,F.PickEvent=gn,F.QueryChangeEvent=mn,F.ResponseEvent=yn,F.ReverseToggleEvent=pn,F.SelectEvent=fn,F.createOpenLayersMapController=an,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
|
|
13
|
+
`)&&x(e,"style",t),r&128&&x(e,"title",n[7])},d(n){n&&te(e)}}}function Ri(i){let e,t;return{c(){e=K("span"),t=Xe(i[7]),x(e,"class","secondary svelte-w9y5n9")},m(n,r){ne(n,e,r),j(e,t)},p(n,r){r&128&&pt(t,n[7])},d(n){n&&te(e)}}}function hr(i){let e,t,n,r,u,a,o,g,h,b=(i[8]?i[0].place_name:i[0].place_name.replace(/,.*/,""))+"",S,M,k=i[2]==="always"||i[2]!=="never"&&!i[0].address&&!i[0].id.startsWith("road.")&&!i[0].id.startsWith("address.")&&!i[0].id.startsWith("postal_code.")&&(!i[0].id.startsWith("poi.")||!i[5])&&!i[8],N,C,O=(i[8]?"":i[0].place_name.replace(/[^,]*,?\s*/,""))+"",I,_,R,z,Y,Z;function B(m,c){return c&1&&(t=null),c&1&&(n=null),c&1&&(r=null),c&1&&(u=null),Re&&m[6]?cr:m[5]?fr:m[0].address?ar:(t==null&&(t=!!m[0].id.startsWith("road.")),t?ur:(n==null&&(n=!!m[0].id.startsWith("address.")),n?lr:(r==null&&(r=!!m[0].id.startsWith("postal_code.")),r?or:(u==null&&(u=!!m[0].id.startsWith("poi.")),u?sr:m[8]?rr:nr))))}let s=B(i,-1),l=s(i),f=k&&Ri(i);return{c(){e=K("li"),l.c(),a=Ee(),o=K("span"),g=K("span"),h=K("span"),S=Xe(b),M=Ee(),f&&f.c(),N=Ee(),C=K("span"),I=Xe(O),x(h,"class","primary svelte-w9y5n9"),x(g,"class","svelte-w9y5n9"),x(C,"class","line2 svelte-w9y5n9"),x(o,"class","texts svelte-w9y5n9"),x(e,"tabindex","-1"),x(e,"role","option"),x(e,"aria-selected",_=i[1]==="selected"),x(e,"aria-checked",R=i[1]==="picked"),x(e,"class",z=Ot(i[1])+" svelte-w9y5n9")},m(m,c){ne(m,e,c),l.m(e,null),j(e,a),j(e,o),j(o,g),j(g,h),j(h,S),j(g,M),f&&f.m(g,null),j(o,N),j(o,C),j(C,I),Y||(Z=[de(e,"mouseenter",i[13]),de(e,"focus",i[15]),de(e,"click",i[16])],Y=!0)},p(m,[c]){s===(s=B(m,c))&&l?l.p(m,c):(l.d(1),l=s(m),l&&(l.c(),l.m(e,a))),c&257&&b!==(b=(m[8]?m[0].place_name:m[0].place_name.replace(/,.*/,""))+"")&&pt(S,b),c&293&&(k=m[2]==="always"||m[2]!=="never"&&!m[0].address&&!m[0].id.startsWith("road.")&&!m[0].id.startsWith("address.")&&!m[0].id.startsWith("postal_code.")&&(!m[0].id.startsWith("poi.")||!m[5])&&!m[8]),k?f?f.p(m,c):(f=Ri(m),f.c(),f.m(g,null)):f&&(f.d(1),f=null),c&257&&O!==(O=(m[8]?"":m[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&pt(I,O),c&2&&_!==(_=m[1]==="selected")&&x(e,"aria-selected",_),c&2&&R!==(R=m[1]==="picked")&&x(e,"aria-checked",R),c&2&&z!==(z=Ot(m[1])+" svelte-w9y5n9")&&x(e,"class",z)},i:se,o:se,d(m){m&&te(e),l.d(),f&&f.d(),Y=!1,Ue(Z)}}}const Ii=typeof devicePixelRatio>"u"?1:devicePixelRatio>1.25,Jt=Ii?"@2x":"",Ne=Ii?2:1;let Re,At;function dr(i,e,t){let n,r,u,{feature:a}=e,{style:o="default"}=e,{showPlaceType:g}=e,{missingIconsCache:h}=e,{iconsBaseUrl:b}=e;const S=Mi();let M,k,N,C;function O(){At??(At=fetch(`${b}sprite${Jt}.json`).then(s=>s.json()).then(s=>{Re=s}).catch(()=>{Re=null}))}function I(){k&&h.add(k),_()}function _(){Re!==void 0?R():(O(),At==null||At.then(R))}function R(){do{if(C--,t(4,M=n==null?void 0:n[C]),t(6,N=M?Re==null?void 0:Re.icons[M]:void 0),N)break;t(5,k=M?b+M.replace(/ /g,"_")+".svg":void 0)}while(C>-1&&(!k||h.has(k)))}function z(s){Hn.call(this,i,s)}const Y=()=>I(),Z=()=>S("select",void 0),B=s=>{document.activeElement!==s.target&&S("select",void 0)};return i.$$set=s=>{"feature"in s&&t(0,a=s.feature),"style"in s&&t(1,o=s.style),"showPlaceType"in s&&t(2,g=s.showPlaceType),"missingIconsCache"in s&&t(11,h=s.missingIconsCache),"iconsBaseUrl"in s&&t(3,b=s.iconsBaseUrl)},i.$$.update=()=>{var s,l,f,m,c;i.$$.dirty&1&&t(12,n=(s=a.properties)==null?void 0:s.categories),i.$$.dirty&1&&t(8,r=a.place_type[0]==="reverse"),i.$$.dirty&1&&t(7,u=((f=(l=a.properties)==null?void 0:l.categories)==null?void 0:f.join(", "))??((c=(m=a.properties)==null?void 0:m.place_type_name)==null?void 0:c[0])??a.place_type[0]),i.$$.dirty&4096&&(C=(n==null?void 0:n.length)??0,_())},[a,o,g,b,M,k,N,u,r,S,I,h,n,z,Y,Z,B]}class gr extends st{constructor(e){super(),rt(this,e,dr,hr,it,{feature:0,style:1,showPlaceType:2,missingIconsCache:11,iconsBaseUrl:3})}}function mr(i){let e;return{c(){e=K("div"),e.innerHTML='<svg viewBox="0 0 18 18" width="24" height="24" class="svelte-7cmwmc"><path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"></path><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"></path></svg>',x(e,"class","svelte-7cmwmc")},m(t,n){ne(t,e,n)},p:se,i:se,o:se,d(t){t&&te(e)}}}class yr extends st{constructor(e){super(),rt(this,e,null,mr,it,{})}}function pr(i){let e,t;return{c(){e=qe("svg"),t=qe("path"),x(t,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),x(e,"viewBox","0 0 60.006 21.412"),x(e,"width","14"),x(e,"height","20"),x(e,"class","svelte-en2qvf")},m(n,r){ne(n,e,r),j(e,t)},p:se,i:se,o:se,d(n){n&&te(e)}}}class vr extends st{constructor(e){super(),rt(this,e,null,pr,it,{})}}function br(i){let e,t,n;return{c(){e=qe("svg"),t=qe("circle"),n=qe("path"),x(t,"cx","4.789"),x(t,"cy","4.787"),x(t,"r","3.85"),x(t,"class","svelte-1aq105l"),x(n,"d","M12.063 12.063 7.635 7.635"),x(n,"class","svelte-1aq105l"),x(e,"xmlns","http://www.w3.org/2000/svg"),x(e,"width","13"),x(e,"height","13"),x(e,"viewBox","0 0 13 13"),x(e,"class","svelte-1aq105l")},m(r,u){ne(r,e,u),j(e,t),j(e,n)},p:se,i:se,o:se,d(r){r&&te(e)}}}class wr extends st{constructor(e){super(),rt(this,e,null,br,it,{})}}function Er(i,e,t){const n=e[1],r=e[0],u=n-r;return i===n&&t?i:((i-r)%u+u)%u+r}function Gt(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}let wt;async function Lr(i,e,t){const n=i==null?void 0:i.getCenterAndZoom();for(const r of e??[])if(!(n&&(r.minZoom!=null&&r.minZoom>n[0]||r.maxZoom!=null&&r.maxZoom<n[0]))){if(r.type==="fixed")return r.coordinates.join(",");e:if(r.type==="client-geolocation"){if(wt&&r.cachedLocationExpiry&&wt.time+r.cachedLocationExpiry>Date.now()){if(!wt.coords)break e;return wt.coords}let u;try{return u=await new Promise((a,o)=>{t.signal.addEventListener("abort",()=>{o(Error("aborted"))}),navigator.geolocation.getCurrentPosition(g=>{a([g.coords.longitude,g.coords.latitude].map(h=>h.toFixed(6)).join(","))},g=>{o(g)},r)}),u}catch{}finally{r.cachedLocationExpiry&&(wt={time:Date.now(),coords:u})}if(t.signal.aborted)return}if(r.type==="server-geolocation")return"ip";if(n&&r.type==="map-center")return n[1].toFixed(6)+","+n[2].toFixed(6)}}const Sr=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(EAST|WEST|[EW])?$/i,Ai=/^([+-]?[0-8]?[0-9])\s+([0-5]?[0-9]\.\d{3,})[\s,]{1,}([+-]?[0-1]?[0-9]?[0-9])\s+([0-5]?[0-9]\.\d{3,})$/,Gi=/^(NORTH|SOUTH|[NS])?[\s]*([+-]?[0-8]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(NORTH|SOUTH|[NS])?[\s]*[,/;]?[\s]*(EAST|WEST|[EW])?[\s]*([+-]?[0-1]?[0-9]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(EAST|WEST|[EW])?$/i,Bi=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(EAST|WEST|[EW])?$/i,Wi=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)\s*(EAST|WEST|[EW])?$/i,Fi=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|’’|´´|["″”\.])?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|´´|’’|["″”\.])?\s*(EAST|WEST|[EW])?$/i;function _r(i){if(!["DMS","DM","DD"].includes(i))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){const e=this.decimalCoordinates.split(",").map(k=>Number(k.trim())),t=Number(e[0]),n=Number(e[1]),r=Math.abs(t),u=Math.abs(n),a=t>0?"N":"S",o=n>0?"E":"W";let g;i=="DD"&&(g=`${r}° ${a}, ${u}° ${o}`);const h=Math.floor(r),b=Math.floor(u),S=(r-h)*60,M=(u-b)*60;if(i=="DM"){let k=zi(S,3).toFixed(3).padStart(6,"0"),N=zi(M,3).toFixed(3).padStart(6,"0");k.endsWith(".000")&&N.endsWith(".000")&&(k=k.replace(/\.000$/,""),N=N.replace(/\.000$/,"")),g=`${h}° ${k}' ${a}, ${b}° ${N}' ${o}`}if(i=="DMS"){const k=Math.floor(S),N=Math.floor(M);let C=((S-k)*60).toFixed(1).padStart(4,"0"),O=((M-N)*60).toFixed(1).padStart(4,"0");const I=k.toString().padStart(2,"0"),_=N.toString().padStart(2,"0");C.endsWith(".0")&&O.endsWith(".0")&&(C=C.replace(/\.0$/,""),O=O.replace(/\.0$/,"")),g=`${h}° ${I}' ${C}" ${a}, ${b}° ${_}' ${O}" ${o}`}return g}else throw new Error("no decimal coordinates to convert")}function zi(i,e){const t=Math.pow(10,e);return Math.round((i+Number.EPSILON)*t)/t}function $t(i,e){e||(e=5),i=i.replace(/\s+/g," ").trim();let t=null,n=null,r="",u="",a=null,o=[],g=!1;if(Sr.test(i))throw new Error("invalid coordinate value");if(Ai.test(i))if(o=Ai.exec(i),g=Et(o),g)t=Math.abs(o[1])+o[2]/60,Number(o[1])<0&&(t*=-1),n=Math.abs(o[3])+o[4]/60,Number(o[3])<0&&(n*=-1),a="DM";else throw new Error("invalid coordinate format");else if(Gi.test(i))if(o=Gi.exec(i),g=Et(o),g){if(t=o[2],n=o[6],t.includes(",")&&(t=t.replace(",",".")),n.includes(",")&&(n=n.replace(",",".")),a="DD",Number(Math.round(t))==Number(t))throw new Error("integer only coordinate provided");if(Number(Math.round(n))==Number(n))throw new Error("integer only coordinate provided");o[1]?(r=o[1],u=o[5]):o[4]&&(r=o[4],u=o[8])}else throw new Error("invalid decimal coordinate format");else if(Bi.test(i))if(o=Bi.exec(i),g=Et(o),g)t=Math.abs(parseInt(o[2])),o[4]&&(t+=o[4]/60,a="DM"),o[6]&&(t+=o[6].replace(",",".")/3600,a="DMS"),parseInt(o[2])<0&&(t=-1*t),n=Math.abs(parseInt(o[9])),o[11]&&(n+=o[11]/60),o[13]&&(n+=o[13].replace(",",".")/3600),parseInt(o[9])<0&&(n=-1*n),o[1]?(r=o[1],u=o[8]):o[7]&&(r=o[7],u=o[14]);else throw new Error("invalid DMS coordinates format");else if(Wi.test(i))if(o=Wi.exec(i),g=Et(o),g)t=Math.abs(parseInt(o[2])),o[4]&&(t+=o[4]/60,a="DM"),o[6]&&(t+=o[6]/3600,a="DMS"),parseInt(o[2])<0&&(t=-1*t),n=Math.abs(parseInt(o[10])),o[12]&&(n+=o[12]/60),o[14]&&(n+=o[14]/3600),parseInt(o[10])<0&&(n=-1*n),o[1]?(r=o[1],u=o[9]):o[8]&&(r=o[8],u=o[16]);else throw new Error("invalid DMS coordinates format");else if(Fi.test(i)){if(o=Fi.exec(i),g=Et(o),o.filter(h=>h).length<=5)throw new Error("invalid coordinates format");if(g)t=Math.abs(parseInt(o[2])),o[4]&&(t+=o[4].replace(",",".")/60,a="DM"),o[6]&&(t+=o[6].replace(",",".")/3600,a="DMS"),parseInt(o[2])<0&&(t=-1*t),n=Math.abs(parseInt(o[10])),o[12]&&(n+=o[12].replace(",",".")/60),o[14]&&(n+=o[14].replace(",",".")/3600),parseInt(o[10])<0&&(n=-1*n),o[1]?(r=o[1],u=o[9]):o[8]&&(r=o[8],u=o[16]);else throw new Error("invalid coordinates format")}if(g){if(Math.abs(n)>=180)throw new Error("invalid longitude value");if(Math.abs(t)>=90)throw new Error("invalid latitude value");if(r&&!u||!r&&u)throw new Error("invalid coordinates value");if(r&&r==u)throw new Error("invalid coordinates format");t.toString().includes(",")&&(t=t.replace(",",".")),n.toString().includes(",")&&(n=n.replace(",","."));let h=/S|SOUTH/i;h.test(r)&&t>0&&(t=-1*t),h=/W|WEST/i,h.test(u)&&n>0&&(n=-1*n);const b=o[0].trim();let S,M;const k=/[,/;\u0020]/g,N=b.match(k);if(N==null){const I=Math.floor(i.length/2);S=b.substring(0,I).trim(),M=b.substring(I).trim()}else{let I;N.length%2==1?I=Math.floor(N.length/2):I=N.length/2-1;let _=0;if(I==0)_=b.indexOf(N[0]),S=b.substring(0,_).trim(),M=b.substring(_+1).trim();else{let R=0,z=0;for(;R<=I;)_=b.indexOf(N[R],z),z=_+1,R++;S=b.substring(0,_).trim(),M=b.substring(_+1).trim()}}const C=S.split(".");if(C.length==2&&C[1]==0&&C[1].length!=2)throw new Error("invalid coordinates format");const O=M.split(".");if(O.length==2&&O[1]==0&&O[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(S)||/^\d+$/.test(M))throw new Error("degree only coordinate/s provided");return t=Number(Number(t).toFixed(e)),n=Number(Number(n).toFixed(e)),Object.freeze({verbatimCoordinates:b,verbatimLatitude:S,verbatimLongitude:M,decimalLatitude:t,decimalLongitude:n,decimalCoordinates:`${t},${n}`,originalFormat:a,closeEnough:xr,toCoordinateFormat:_r})}else throw new Error("coordinates pattern match failed")}function Et(i){if(!isNaN(i[0]))return!1;const e=[...i];if(e.shift(),e.length%2>0)return!1;const t=/^[-+]?\d+([\.,]\d+)?$/,n=/[eastsouthnorthwest]+/i,r=e.length/2;for(let u=0;u<r;u++){const a=e[u],o=e[u+r],g=t.test(a)&&t.test(o),h=n.test(a)&&n.test(o),b=a==o;if(!(a==null&&o==null)){if(a==null||o==null)return!1;if(g||h||b)continue;return!1}}return!0}function Di(i,e){const t=Math.abs(i-e);return Number(t.toFixed(6))<=1e-5}function xr(i){if(!i)throw new Error("coords must be provided");if(i.includes(",")){const e=i.split(",");if(Number(e[0])==NaN||Number(e[1])==NaN)throw new Error("coords are not valid decimals");return Di(this.decimalLatitude,Number(e[0]))&&Di(this.decimalLongitude,e[1])}else throw new Error("coords being tested must be separated by a comma")}const Tr=Object.freeze({DMS:"DMS",DM:"DM",DD:"DD"});$t.to=Tr;const Mr=[{verbatimCoordinates:"40.123, -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:"40.123° N 74.123° W",verbatimLatitude:"40.123° N",verbatimLongitude:"74.123° W"},{verbatimCoordinates:'40° 7´ 22.8" N 74° 7´ 22.8" W',verbatimLatitude:'40° 7´ 22.8" N',verbatimLongitude:'74° 7´ 22.8" W'},{verbatimCoordinates:"40° 7.38’ , -74° 7.38’",verbatimLatitude:"40° 7.38’",verbatimLongitude:"-74° 7.38’"},{verbatimCoordinates:"N40°7’22.8’’, W74°7’22.8’’",verbatimLatitude:"N40°7’22.8’’",verbatimLongitude:"W74°7’22.8’’"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:`40°7'22.8"N, 74°7'22.8"W`,verbatimLatitude:`40°7'22.8"N`,verbatimLongitude:`74°7'22.8"W`},{verbatimCoordinates:"40 7 22.8, -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"},{verbatimCoordinates:"40.123 -74.123",verbatimLatitude:"40.123",verbatimLongitude:"-74.123"},{verbatimCoordinates:"40.123°,-74.123°",verbatimLatitude:"40.123°",verbatimLongitude:"-74.123°"},{verbatimCoordinates:"40.123N74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"4007.38N7407.38W",verbatimLatitude:"4007.38N",verbatimLongitude:"7407.38W"},{verbatimCoordinates:'40°7’22.8"N, 74°7’22.8"W',verbatimLatitude:'40°7’22.8"N',verbatimLongitude:'74°7’22.8"W'},{verbatimCoordinates:"400722.8N740722.8W",verbatimLatitude:"400722.8N",verbatimLongitude:"740722.8W"},{verbatimCoordinates:"N 40 7.38 W 74 7.38",verbatimLatitude:"N 40 7.38",verbatimLongitude:"W 74 7.38"},{verbatimCoordinates:"40:7:22.8N 74:7:22.8W",verbatimLatitude:"40:7:22.8N",verbatimLongitude:"74:7:22.8W"},{verbatimCoordinates:"40:7:23N,74:7:23W",verbatimLatitude:"40:7:23N",verbatimLongitude:"74:7:23W",decimalLatitude:40.1230555555,decimalLongitude:-74.1230555555},{verbatimCoordinates:'40°7’23"N 74°7’23"W',verbatimLatitude:'40°7’23"N',verbatimLongitude:'74°7’23"W',decimalLatitude:40.1230555555,decimalLongitude:-74.12305555555555},{verbatimCoordinates:'40°7’23"S 74°7’23"E',verbatimLatitude:'40°7’23"S',verbatimLongitude:'74°7’23"E',decimalLatitude:-40.1230555555,decimalLongitude:74.12305555555555},{verbatimCoordinates:'40°7’23" -74°7’23"',verbatimLatitude:'40°7’23"',verbatimLongitude:'-74°7’23"',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:'40d 7’ 23" N 74d 7’ 23" W',verbatimLatitude:'40d 7’ 23" N',verbatimLongitude:'74d 7’ 23" W',decimalLatitude:40.1230555555,decimalLongitude:-74.123055555},{verbatimCoordinates:"40.123N 74.123W",verbatimLatitude:"40.123N",verbatimLongitude:"74.123W"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40° 7.38, -74° 7.38",verbatimLatitude:"40° 7.38",verbatimLongitude:"-74° 7.38"},{verbatimCoordinates:"40 7 22.8; -74 7 22.8",verbatimLatitude:"40 7 22.8",verbatimLongitude:"-74 7 22.8"}],Nr={decimalLatitude:40.123,decimalLongitude:-74.123},Cr=[{verbatimCoordinates:`50°4'17.698"south, 14°24'2.826"east`,verbatimLatitude:`50°4'17.698"south`,verbatimLongitude:`14°24'2.826"east`,decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"50d4m17.698S 14d24m2.826E",verbatimLatitude:"50d4m17.698S",verbatimLongitude:"14d24m2.826E",decimalLatitude:-50.07158277777778,decimalLongitude:14.400785},{verbatimCoordinates:"40:26:46N,79:56:55W",verbatimLatitude:"40:26:46N",verbatimLongitude:"79:56:55W",decimalLatitude:40.44611111111111,decimalLongitude:-79.9486111111111},{verbatimCoordinates:"40:26:46.302N 79:56:55.903W",verbatimLatitude:"40:26:46.302N",verbatimLongitude:"79:56:55.903W",decimalLatitude:40.446195,decimalLongitude:-79.94886194444445},{verbatimCoordinates:"40°26′47″N 79°58′36″W",verbatimLatitude:"40°26′47″N",verbatimLongitude:"79°58′36″W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40d 26′ 47″ N 79d 58′ 36″ W",verbatimLatitude:"40d 26′ 47″ N",verbatimLongitude:"79d 58′ 36″ W",decimalLatitude:40.44638888888889,decimalLongitude:-79.97666666666667},{verbatimCoordinates:"40.446195N 79.948862W",verbatimLatitude:"40.446195N",verbatimLongitude:"79.948862W",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40,446195° 79,948862°",verbatimLatitude:"40,446195°",verbatimLongitude:"79,948862°",decimalLatitude:40.446195,decimalLongitude:79.948862},{verbatimCoordinates:"40° 26.7717, -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.446195, -79.948862",verbatimLatitude:"40.446195",verbatimLongitude:"-79.948862",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"40.123256; -74.123256",verbatimLatitude:"40.123256",verbatimLongitude:"-74.123256",decimalLatitude:40.123256,decimalLongitude:-74.123256},{verbatimCoordinates:"18°24S 22°45E",verbatimLatitude:"18°24S",verbatimLongitude:"22°45E",decimalLatitude:-18.4,decimalLongitude:22.75}],kr=[{verbatimCoordinates:"10.432342S 10.6345345E",verbatimLatitude:"10.432342S",verbatimLongitude:"10.6345345E",decimalLatitude:-10.432342,decimalLongitude:10.6345345},{verbatimCoordinates:"10.00S 10.00E",verbatimLatitude:"10.00S",verbatimLongitude:"10.00E",decimalLatitude:-10,decimalLongitude:10},{verbatimCoordinates:"00.00S 01.00E",verbatimLatitude:"00.00S",verbatimLongitude:"01.00E",decimalLatitude:0,decimalLongitude:1},{verbatimCoordinates:"18.24S 22.45E",verbatimLatitude:"18.24S",verbatimLongitude:"22.45E",decimalLatitude:-18.4,decimalLongitude:22.75},{verbatimCoordinates:"27deg 15min 45.2sec S 18deg 32min 53.7sec E",verbatimLatitude:"27deg 15min 45.2sec S",verbatimLongitude:"18deg 32min 53.7sec E",decimalLatitude:-27.262555555555554,decimalLongitude:18.54825},{verbatimCoordinates:"-23.3245° S / 28.2344° E",verbatimLatitude:"-23.3245° S",verbatimLongitude:"28.2344° E",decimalLatitude:-23.3245,decimalLongitude:28.2344},{verbatimCoordinates:"40° 26.7717 -79° 56.93172",verbatimLatitude:"40° 26.7717",verbatimLongitude:"-79° 56.93172",decimalLatitude:40.446195,decimalLongitude:-79.948862},{verbatimCoordinates:"27.15.45S 18.32.53E",verbatimLatitude:"27.15.45S",verbatimLongitude:"18.32.53E",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"-27.15.45 18.32.53",verbatimLatitude:"-27.15.45",verbatimLongitude:"18.32.53",decimalLatitude:-27.2625,decimalLongitude:18.548055},{verbatimCoordinates:"27.15.45.2S 18.32.53.4E",verbatimLatitude:"27.15.45.2S",verbatimLongitude:"18.32.53.4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"27.15.45,2S 18.32.53,4E",verbatimLatitude:"27.15.45,2S",verbatimLongitude:"18.32.53,4E",decimalLatitude:-27.262556,decimalLongitude:18.548167},{verbatimCoordinates:"S23.43563 ° E22.45634 °",verbatimLatitude:"S23.43563 °",verbatimLongitude:"E22.45634 °",decimalLatitude:-23.43563,decimalLongitude:22.45634},{verbatimCoordinates:"27,71372° S 23,07771° E",verbatimLatitude:"27,71372° S",verbatimLongitude:"23,07771° E",decimalLatitude:-27.71372,decimalLongitude:23.07771},{verbatimCoordinates:"27.45.34 S 23.23.23 E",verbatimLatitude:"27.45.34 S",verbatimLongitude:"23.23.23 E",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"S 27.45.34 E 23.23.23",verbatimLatitude:"S 27.45.34",verbatimLongitude:"E 23.23.23",decimalLatitude:-27.759444,decimalLongitude:23.38972222},{verbatimCoordinates:"53 16.3863,4 52.8171",verbatimLatitude:"53 16.3863",verbatimLongitude:"4 52.8171",decimalLatitude:53.273105,decimalLongitude:4.88029},{verbatimCoordinates:"50 8.2914,-5 2.4447",verbatimLatitude:"50 8.2914",verbatimLongitude:"-5 2.4447",decimalLatitude:50.13819,decimalLongitude:-5.040745},{verbatimCoordinates:"N 48° 30,6410', E 18° 57,4583'",verbatimLatitude:"N 48° 30,6410'",verbatimLongitude:"E 18° 57,4583'",decimalLatitude:48.51068,decimalLongitude:18.95764},{verbatimCoordinates:"1.23456, 18.33453",verbatimLatitude:"1.23456",verbatimLongitude:"18.33453",decimalLatitude:1.23456,decimalLongitude:18.33453}];function Or(){const i=[];return Mr.forEach(e=>{e.decimalLatitude?i.push(e):i.push({...e,...Nr})}),[...i,...Cr,...kr]}const Pr=Or();$t.formats=Pr.map(i=>i.verbatimCoordinates);const Rr=$t;function Ui(i,e,t){const n=i.slice();return n[97]=e[t],n[99]=t,n}function qi(i){let e,t;return e=new yr({}),{c(){Je(e.$$.fragment)},m(n,r){Ve(e,n,r),t=!0},i(n){t||(ue(e.$$.fragment,n),t=!0)},o(n){ye(e.$$.fragment,n),t=!1},d(n){je(e,n)}}}function Vi(i){let e,t,n,r,u;return t=new vr({}),{c(){e=K("button"),Je(t.$$.fragment),x(e,"type","button"),x(e,"title",i[10]),x(e,"class","svelte-bz0zu3"),ct(e,"active",i[0])},m(a,o){ne(a,e,o),Ve(t,e,null),n=!0,r||(u=de(e,"click",i[79]),r=!0)},p(a,o){(!n||o[0]&1024)&&x(e,"title",a[10]),(!n||o[0]&1)&&ct(e,"active",a[0])},i(a){n||(ue(t.$$.fragment,a),n=!0)},o(a){ye(t.$$.fragment,a),n=!1},d(a){a&&te(e),je(t),r=!1,u()}}}function Ir(i){let e,t=[],n=new Map,r,u,a,o=ki(i[13]);const g=h=>h[97].id+(h[97].address?","+h[97].address:"");for(let h=0;h<o.length;h+=1){let b=Ui(i,o,h),S=g(b);n.set(S,t[h]=ji(S,b))}return{c(){e=K("ul");for(let h=0;h<t.length;h+=1)t[h].c();x(e,"class","options svelte-bz0zu3"),x(e,"role","listbox")},m(h,b){ne(h,e,b);for(let S=0;S<t.length;S+=1)t[S]&&t[S].m(e,null);r=!0,u||(a=[de(e,"mouseleave",i[27]),de(e,"blur",i[83]),de(e,"keydown",i[23])],u=!0)},p(h,b){b[0]&102823936&&(o=ki(h[13]),Rt(),t=Jn(t,b,g,1,h,o,n,e,Xn,ji,null,Ui),It())},i(h){if(!r){for(let b=0;b<o.length;b+=1)ue(t[b]);r=!0}},o(h){for(let b=0;b<t.length;b+=1)ye(t[b]);r=!1},d(h){h&&te(e);for(let b=0;b<t.length;b+=1)t[b].d();u=!1,Ue(a)}}}function Ar(i){let e,t,n,r,u,a;return t=new Pi({}),{c(){e=K("div"),Je(t.$$.fragment),n=Ee(),r=K("div"),u=Xe(i[8]),x(r,"class","svelte-bz0zu3"),x(e,"class","no-results svelte-bz0zu3")},m(o,g){ne(o,e,g),Ve(t,e,null),j(e,n),j(e,r),j(r,u),a=!0},p(o,g){(!a||g[0]&256)&&pt(u,o[8])},i(o){a||(ue(t.$$.fragment,o),a=!0)},o(o){ye(t.$$.fragment,o),a=!1},d(o){o&&te(e),je(t)}}}function Gr(i){let e="",t;return{c(){t=Xe(e)},m(n,r){ne(n,t,r)},p:se,i:se,o:se,d(n){n&&te(t)}}}function Br(i){let e,t,n,r,u,a,o,g,h,b,S;return t=new Pi({}),g=new Oi({}),{c(){e=K("div"),Je(t.$$.fragment),n=Ee(),r=K("div"),u=Xe(i[7]),a=Ee(),o=K("button"),Je(g.$$.fragment),x(r,"class","svelte-bz0zu3"),x(o,"class","svelte-bz0zu3"),x(e,"class","error svelte-bz0zu3")},m(M,k){ne(M,e,k),Ve(t,e,null),j(e,n),j(e,r),j(r,u),j(e,a),j(e,o),Ve(g,o,null),h=!0,b||(S=de(o,"click",i[80]),b=!0)},p(M,k){(!h||k[0]&128)&&pt(u,M[7])},i(M){h||(ue(t.$$.fragment,M),ue(g.$$.fragment,M),h=!0)},o(M){ye(t.$$.fragment,M),ye(g.$$.fragment,M),h=!1},d(M){M&&te(e),je(t),je(g),b=!1,S()}}}function ji(i,e){var o;let t,n,r;function u(){return e[81](e[99])}function a(){return e[82](e[97])}return n=new gr({props:{feature:e[97],showPlaceType:e[11],style:e[15]===e[99]?"selected":((o=e[14])==null?void 0:o.id)===e[97].id?"picked":"default",missingIconsCache:e[21],iconsBaseUrl:e[12]}}),n.$on("mouseenter",u),n.$on("select",a),{key:i,first:null,c(){t=Dn(),Je(n.$$.fragment),this.first=t},m(g,h){ne(g,t,h),Ve(n,g,h),r=!0},p(g,h){var S;e=g;const b={};h[0]&8192&&(b.feature=e[97]),h[0]&2048&&(b.showPlaceType=e[11]),h[0]&57344&&(b.style=e[15]===e[99]?"selected":((S=e[14])==null?void 0:S.id)===e[97].id?"picked":"default"),h[0]&4096&&(b.iconsBaseUrl=e[12]),n.$set(b)},i(g){r||(ue(n.$$.fragment,g),r=!0)},o(g){ye(n.$$.fragment,g),r=!1},d(g){g&&te(t),je(n,g)}}}function Wr(i){let e,t,n,r,u,a,o,g,h,b,S,M,k,N,C,O,I,_,R,z,Y,Z=!1;u=new wr({}),S=new Oi({});let B=i[20]&&qi(),s=i[6]==="button"&&Vi(i);const l=i[70].default,f=Bn(l,i,i[69],null),m=[Br,Gr,Ar,Ir],c=[];function v(y,d){var p,w;return y[19]?0:!y[16]&&!y[4]?1:((p=y[13])==null?void 0:p.length)===0?2:(w=y[13])!=null&&w.length&&(y[16]||y[4])?3:-1}return~(O=v(i))&&(I=c[O]=m[O](i)),{c(){e=Ee(),t=K("form"),n=K("div"),r=K("button"),Je(u.$$.fragment),a=Ee(),o=K("input"),g=Ee(),h=K("div"),b=K("button"),Je(S.$$.fragment),M=Ee(),B&&B.c(),k=Ee(),s&&s.c(),N=Ee(),f&&f.c(),C=Ee(),I&&I.c(),x(r,"class","search-button svelte-bz0zu3"),x(r,"type","button"),x(o,"placeholder",i[9]),x(o,"aria-label",i[9]),x(o,"class","svelte-bz0zu3"),x(b,"type","button"),x(b,"title",i[3]),x(b,"class","svelte-bz0zu3"),x(h,"class","clear-button-container svelte-bz0zu3"),ct(h,"displayable",i[1]!==""),x(n,"class","input-group svelte-bz0zu3"),x(t,"class",_=Ot(i[2])+" svelte-bz0zu3"),ct(t,"can-collapse",i[5]&&i[1]==="")},m(y,d){ne(y,e,d),ne(y,t,d),j(t,n),j(n,r),Ve(u,r,null),j(n,a),j(n,o),i[72](o),xi(o,i[1]),j(n,g),j(n,h),j(h,b),Ve(S,b,null),j(h,M),B&&B.m(h,null),j(n,k),s&&s.m(n,null),j(n,N),f&&f.m(n,null),j(t,C),~O&&c[O].m(t,null),R=!0,z||(Y=[de(r,"click",i[71]),de(o,"input",i[73]),de(o,"focus",i[74]),de(o,"blur",i[75]),de(o,"click",i[76]),de(o,"keydown",i[23]),de(o,"input",i[24]),de(o,"change",i[77]),de(b,"click",i[78]),de(t,"submit",Un(i[22]))],z=!0)},p(y,d){(!R||d[0]&512)&&x(o,"placeholder",y[9]),(!R||d[0]&512)&&x(o,"aria-label",y[9]),d[0]&2&&o.value!==y[1]&&xi(o,y[1]),(!R||d[0]&8)&&x(b,"title",y[3]),y[20]?B?d[0]&1048576&&ue(B,1):(B=qi(),B.c(),ue(B,1),B.m(h,null)):B&&(Rt(),ye(B,1,1,()=>{B=null}),It()),(!R||d[0]&2)&&ct(h,"displayable",y[1]!==""),y[6]==="button"?s?(s.p(y,d),d[0]&64&&ue(s,1)):(s=Vi(y),s.c(),ue(s,1),s.m(n,N)):s&&(Rt(),ye(s,1,1,()=>{s=null}),It()),f&&f.p&&(!R||d[2]&128)&&Fn(f,l,y,y[69],R?Wn(l,y[69],d,null):zn(y[69]),null);let p=O;O=v(y),O===p?~O&&c[O].p(y,d):(I&&(Rt(),ye(c[p],1,1,()=>{c[p]=null}),It()),~O?(I=c[O],I?I.p(y,d):(I=c[O]=m[O](y),I.c()),ue(I,1),I.m(t,null)):I=null),(!R||d[0]&4&&_!==(_=Ot(y[2])+" svelte-bz0zu3"))&&x(t,"class",_),(!R||d[0]&38)&&ct(t,"can-collapse",y[5]&&y[1]==="")},i(y){R||(ue(Z),ue(u.$$.fragment,y),ue(S.$$.fragment,y),ue(B),ue(s),ue(f,y),ue(I),R=!0)},o(y){ye(Z),ye(u.$$.fragment,y),ye(S.$$.fragment,y),ye(B),ye(s),ye(f,y),ye(I),R=!1},d(y){y&&(te(e),te(t)),je(u),i[72](null),je(S),B&&B.d(),s&&s.d(),f&&f.d(y),~O&&c[O].d(),z=!1,Ue(Y)}}}function Fr(i,e,t){let n,r,u,{$$slots:a={},$$scope:o}=e;const g={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};let{class:h=void 0}=e,{apiKey:b}=e,{bbox:S=void 0}=e,{clearButtonTitle:M="clear"}=e,{clearOnBlur:k=!1}=e,{clearListOnPick:N=!1}=e,{keepListOpen:C=!1}=e,{collapsed:O=!1}=e,{country:I=void 0}=e,{debounceSearch:_=200}=e,{enableReverse:R="never"}=e,{errorMessage:z="Something went wrong…"}=e,{filter:Y=()=>!0}=e,{flyTo:Z=!0}=e,{fuzzyMatch:B=!0}=e,{language:s=void 0}=e,{limit:l=void 0}=e;const f=41415112612;let{reverseGeocodingLimit:m=f}=e,{mapController:c=void 0}=e,{minLength:v=2}=e,{noResultsMessage:y="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=e,{placeholder:d="Search"}=e,{proximity:p=[{type:"server-geolocation"}]}=e,{reverseActive:w=R==="always"}=e,{reverseButtonTitle:E="toggle reverse geocoding"}=e,{searchValue:T=""}=e,{pickedResultStyle:A="full-geometry"}=e,{showPlaceType:G="if-needed"}=e,{showResultsWhileTyping:V=!0}=e,{selectFirst:Q=!0}=e,{flyToSelected:re=!1}=e,{markerOnSelected:q=!0}=e,{types:H=void 0}=e;const ge=[];let{reverseGeocodingTypes:Ke=ge}=e,{exhaustiveReverseGeocoding:ut=!1}=e,{excludeTypes:at=!1}=e;const Se=void 0;let{reverseGeocodingExcludeTypes:We=Se}=e,{zoom:pe=g}=e,{apiUrl:me="https://api.maptiler.com/geocoding"}=e,{fetchParameters:ee={}}=e,{iconsBaseUrl:wn="https://cdn.maptiler.com/maptiler-geocoding-control/v2.1.6/icons/"}=e,{adjustUrlQuery:ui=()=>{}}=e,{adjustUrl:ai=()=>{}}=e;function ys(L){Ae.focus(L)}function ps(){Ae.blur()}function En(L,le=!0,ae=!1){t(1,T=L),le?(t(15,X=-1),Sn()):(_n(void 0,!ae,ae),setTimeout(()=>{Ae.focus(),Ae.select()}))}function vs(){t(13,U=void 0),t(14,W=void 0),t(15,X=-1)}function bs(){t(64,ce=[]),t(14,W=void 0)}let U,ce,W,Ln="",Ae,X=-1,Fe,jt=[],ft,mt,yt,fi,Ye=!1;const ws=new Set,et=Mi();jn(()=>{c&&(c.setEventHandler(void 0),c.indicateReverse(!1),c.setSelectedMarker(-1),c.setFeatures(void 0,void 0,!1))});function Sn(L){if(t(17,Ye=!1),mt&&(clearTimeout(mt),mt=void 0),X>-1&&U)t(14,W=U[X]),t(1,T=W.place_type[0]==="reverse"?W.place_name:W.place_name.replace(/,.*/,"")),t(19,Fe=void 0),t(64,ce=void 0),t(15,X=-1);else if(T){const le=L||!ci(T);hi(T,{exact:!0}).then(()=>{t(64,ce=U),t(14,W=void 0),le&&Es()}).catch(ae=>t(19,Fe=ae))}}function ci(L){try{return Rr(L,6)}catch{return!1}}async function hi(L,{byId:le=!1,exact:ae=!1}={}){var xe,ze,tt;t(19,Fe=void 0),ft==null||ft.abort();const _e=new AbortController;t(20,ft=_e);try{const J=ci(L),Tt=new URL(me+"/"+encodeURIComponent(J?J.decimalLongitude+","+J.decimalLatitude:L)+".json"),Pe=Tt.searchParams;s!==void 0&&Pe.set("language",Array.isArray(s)?s.join(","):s??"");const[mi]=(c==null?void 0:c.getCenterAndZoom())??[];let De=(xe=!J||Ke===ge?H:Ke)==null?void 0:xe.map(be=>typeof be=="string"?be:mi===void 0||(be[0]??0)<=mi&&mi<(be[1]??1/0)?be[2]:void 0).filter(be=>be!==void 0);De&&(De=[...new Set(De)],Pe.set("types",De.join(",")));const Tn=!J||We===Se?at:We;if(Tn&&Pe.set("excludeTypes",String(Tn)),S&&Pe.set("bbox",S.map(be=>be.toFixed(6)).join(",")),I&&Pe.set("country",Array.isArray(I)?I.join(","):I),!le&&!J){const be=await Lr(c,p,_e);be&&Pe.set("proximity",be),(ae||!V)&&Pe.set("autocomplete","false"),Pe.set("fuzzyMatch",String(B))}const Mt=m===f?l:m;Mt!==void 0&&Mt>1&&(De==null?void 0:De.length)!==1&&console.warn("For reverse geocoding when limit > 1 then types must contain single value."),J?(Mt===1||Mt!==void 0&&(ut||(De==null?void 0:De.length)===1))&&Pe.set("limit",String(Mt)):l!==void 0&&Pe.set("limit",String(l)),b&&Pe.set("key",b),ui(Pe),ai(Tt);const Ws=Tt.searchParams.get("types")===""&&Tt.searchParams.get("excludeTypes")!=="true",Ht=Tt.toString();if(Ht===Ln){le?(N&&t(13,U=void 0),t(14,W=jt[0])):(t(13,U=jt),((ze=U[X])==null?void 0:ze.id)!==(r==null?void 0:r.id)&&t(15,X=-1));return}Ln=Ht;let Nt;if(Ws)Nt={type:"FeatureCollection",features:[]};else{const be=await fetch(Ht,{signal:_e.signal,...ee});if(!be.ok)throw new Error(await be.text());Nt=await be.json()}et("response",{url:Ht,featureCollection:Nt}),le?(N&&t(13,U=void 0),t(14,W=Nt.features[0]),jt=[W]):(t(13,U=Nt.features.filter(Y)),J&&U.unshift({type:"Feature",properties:{},id:"reverse_"+J.decimalLongitude+"_"+J.decimalLatitude,text:J.decimalLatitude+", "+J.decimalLongitude,place_name:J.decimalLatitude+", "+J.decimalLongitude,place_type:["reverse"],center:[J.decimalLongitude,J.decimalLatitude],bbox:[J.decimalLongitude,J.decimalLatitude,J.decimalLongitude,J.decimalLatitude],geometry:{type:"Point",coordinates:[J.decimalLongitude,J.decimalLatitude]}}),jt=U,((tt=U[X])==null?void 0:tt.id)!==(r==null?void 0:r.id)&&t(15,X=-1),J&&Ae.focus())}catch(J){if(J&&typeof J=="object"&&"name"in J&&J.name==="AbortError")return;throw J}finally{_e===ft&&t(20,ft=void 0)}}function Es(){var _e;if(!(ce!=null&&ce.length)||!Z)return;const L=[180,90,-180,-90],le=!ce.some(xe=>!xe.matching_text);let ae;for(const xe of ce){const ze=xt(xe);if(ae=ae===void 0?ze:ze===void 0?ae:Math.max(ae,ze),le||!xe.matching_text)for(const tt of[0,1,2,3])L[tt]=Math[tt<2?"min":"max"](L[tt],((_e=xe.bbox)==null?void 0:_e[tt])??xe.center[tt%2])}c&&ce.length>0&&(W&&L[0]===L[2]&&L[1]===L[3]?c.flyTo(W.center,xt(W)):c.fitBounds(Gt(L),50,ae))}function di(){!W||!c||(!W.bbox||W.bbox[0]===W.bbox[2]&&W.bbox[1]===W.bbox[3]?c.flyTo(W.center,xt(W)):c.fitBounds(Gt(W.bbox),50,xt(W)))}function xt(L){var ae;if(!L.bbox||L.bbox[0]!==L.bbox[2]&&L.bbox[1]!==L.bbox[3])return;const le=L.id.replace(/\..*/,"");return(Array.isArray((ae=L.properties)==null?void 0:ae.categories)?L.properties.categories.reduce((_e,xe)=>{const ze=pe[le+"."+xe];return _e===void 0?ze:ze===void 0?_e:Math.max(_e,ze)},void 0):void 0)??pe[le]}function Ls(L){t(0,w=R==="always"),t(13,U=void 0),t(14,W=void 0),t(15,X=-1),En(L[1].toFixed(6)+", "+Er(L[0],[-180,180],!0).toFixed(6),!1,!0)}function Ss(L){if(!U)return;let le=L.key==="ArrowDown"?1:L.key==="ArrowUp"?-1:0;le&&(Ae.focus(),t(17,Ye=!0),L.preventDefault(),W&&X===-1&&t(15,X=U.findIndex(ae=>ae.id===(W==null?void 0:W.id))),X===(W||Q?0:-1)&&le===-1&&t(15,X=U.length),t(15,X+=le),X>=U.length&&t(15,X=-1),X<0&&(W||Q)&&t(15,X=0))}function _n(L,le=!0,ae=!1){if(t(19,Fe=void 0),t(14,W=void 0),t(17,Ye=!0),V||ae){if(mt&&clearTimeout(mt),T.length<v)return;const _e=T;mt=window.setTimeout(()=>{hi(_e).catch(xe=>t(19,Fe=xe))},le?_:0)}else t(13,U=void 0),t(19,Fe=void 0)}function gi(L){W&&(W==null?void 0:W.id)===(L==null?void 0:L.id)?di():(t(14,W=L),t(1,T=L.place_name))}function xn(L){t(15,X=L)}function _s(){(!Q||W)&&t(15,X=-1),re&&di()}const xs=()=>Ae.focus();function Ts(L){Kt[L?"unshift":"push"](()=>{Ae=L,t(18,Ae)})}function Ms(){T=this.value,t(1,T),t(17,Ye),t(31,k),t(16,yt)}const Ns=()=>t(17,Ye=!0),Cs=()=>t(17,Ye=!1),ks=()=>t(17,Ye=!0),Os=()=>t(14,W=void 0),Ps=()=>{t(1,T=""),t(14,W=void 0),Ae.focus()},Rs=()=>t(0,w=!w),Is=()=>t(19,Fe=void 0),As=L=>xn(L),Gs=L=>gi(L),Bs=()=>{};return i.$$set=L=>{"class"in L&&t(2,h=L.class),"apiKey"in L&&t(29,b=L.apiKey),"bbox"in L&&t(30,S=L.bbox),"clearButtonTitle"in L&&t(3,M=L.clearButtonTitle),"clearOnBlur"in L&&t(31,k=L.clearOnBlur),"clearListOnPick"in L&&t(32,N=L.clearListOnPick),"keepListOpen"in L&&t(4,C=L.keepListOpen),"collapsed"in L&&t(5,O=L.collapsed),"country"in L&&t(33,I=L.country),"debounceSearch"in L&&t(34,_=L.debounceSearch),"enableReverse"in L&&t(6,R=L.enableReverse),"errorMessage"in L&&t(7,z=L.errorMessage),"filter"in L&&t(35,Y=L.filter),"flyTo"in L&&t(36,Z=L.flyTo),"fuzzyMatch"in L&&t(37,B=L.fuzzyMatch),"language"in L&&t(38,s=L.language),"limit"in L&&t(39,l=L.limit),"reverseGeocodingLimit"in L&&t(40,m=L.reverseGeocodingLimit),"mapController"in L&&t(41,c=L.mapController),"minLength"in L&&t(42,v=L.minLength),"noResultsMessage"in L&&t(8,y=L.noResultsMessage),"placeholder"in L&&t(9,d=L.placeholder),"proximity"in L&&t(43,p=L.proximity),"reverseActive"in L&&t(0,w=L.reverseActive),"reverseButtonTitle"in L&&t(10,E=L.reverseButtonTitle),"searchValue"in L&&t(1,T=L.searchValue),"pickedResultStyle"in L&&t(44,A=L.pickedResultStyle),"showPlaceType"in L&&t(11,G=L.showPlaceType),"showResultsWhileTyping"in L&&t(45,V=L.showResultsWhileTyping),"selectFirst"in L&&t(46,Q=L.selectFirst),"flyToSelected"in L&&t(47,re=L.flyToSelected),"markerOnSelected"in L&&t(48,q=L.markerOnSelected),"types"in L&&t(49,H=L.types),"reverseGeocodingTypes"in L&&t(50,Ke=L.reverseGeocodingTypes),"exhaustiveReverseGeocoding"in L&&t(51,ut=L.exhaustiveReverseGeocoding),"excludeTypes"in L&&t(52,at=L.excludeTypes),"reverseGeocodingExcludeTypes"in L&&t(53,We=L.reverseGeocodingExcludeTypes),"zoom"in L&&t(54,pe=L.zoom),"apiUrl"in L&&t(55,me=L.apiUrl),"fetchParameters"in L&&t(56,ee=L.fetchParameters),"iconsBaseUrl"in L&&t(12,wn=L.iconsBaseUrl),"adjustUrlQuery"in L&&t(57,ui=L.adjustUrlQuery),"adjustUrl"in L&&t(58,ai=L.adjustUrl),"$$scope"in L&&t(69,o=L.$$scope)},i.$$.update=()=>{if(i.$$.dirty[0]&64&&t(0,w=R==="always"),i.$$.dirty[0]&16384|i.$$.dirty[1]&8192&&A!=="marker-only"&&W&&!W.address&&W.geometry.type==="Point"&&W.place_type[0]!=="reverse"&&hi(W.id,{byId:!0}).catch(L=>t(19,Fe=L)),i.$$.dirty[0]&16384|i.$$.dirty[1]&1058|i.$$.dirty[2]&8&&(c&&W&&W.id!==fi&&Z&&(di(),N&&t(13,U=void 0),t(64,ce=void 0),t(15,X=-1)),t(65,fi=W==null?void 0:W.id)),i.$$.dirty[0]&196608|i.$$.dirty[1]&1&&setTimeout(()=>{t(16,yt=Ye),k&&!yt&&t(1,T="")}),i.$$.dirty[0]&8194|i.$$.dirty[1]&2048&&T.length<v&&(t(13,U=void 0),t(19,Fe=void 0),t(64,ce=U)),i.$$.dirty[0]&57344|i.$$.dirty[1]&32768&&Q&&U!=null&&U.length&&X==-1&&!W&&t(15,X=0),i.$$.dirty[0]&8192|i.$$.dirty[2]&4&&ce!==U&&t(64,ce=void 0),i.$$.dirty[0]&73729|i.$$.dirty[1]&1024|i.$$.dirty[2]&4&&c&&c.setEventHandler(L=>{switch(L.type){case"mapClick":w&&Ls(L.coordinates);break;case"markerClick":{const le=U==null?void 0:U.find(ae=>ae.id===L.id);le&&gi(le)}break;case"markerMouseEnter":ce&&t(15,X=yt?(U==null?void 0:U.findIndex(le=>le.id===L.id))??-1:-1);break;case"markerMouseLeave":ce&&t(15,X=-1);break}}),i.$$.dirty[0]&40960&&t(66,r=U==null?void 0:U[X]),i.$$.dirty[1]&66592|i.$$.dirty[2]&16&&c&&r&&Z&&re&&c.flyTo(r.center,xt(r)),i.$$.dirty[1]&8192&&t(68,n=A==="full-geometry-including-polygon-center-marker"),i.$$.dirty[1]&132096|i.$$.dirty[2]&64&&(q||c==null||c.setFeatures(void 0,void 0,n)),i.$$.dirty[0]&16384|i.$$.dirty[1]&132096|i.$$.dirty[2]&84&&c&&q&&!ce&&(c.setFeatures(r?[r]:void 0,W,n),c.setSelectedMarker(r?0:-1)),i.$$.dirty[0]&16384|i.$$.dirty[1]&1024|i.$$.dirty[2]&68&&c&&c.setFeatures(ce,W,n),i.$$.dirty[0]&32768|i.$$.dirty[1]&1024|i.$$.dirty[2]&4&&ce&&c&&c.setSelectedMarker(X),i.$$.dirty[0]&2|i.$$.dirty[1]&1024&&c){const L=ci(T);c.setReverseMarker(L?[L.decimalLongitude,L.decimalLatitude]:void 0)}i.$$.dirty[2]&16&&et("select",{feature:r}),i.$$.dirty[0]&16384&&et("pick",{feature:W}),i.$$.dirty[0]&73744&&t(67,u=!!(U!=null&&U.length)&&(yt||C)),i.$$.dirty[2]&32&&et("optionsvisibilitychange",{optionsVisible:u}),i.$$.dirty[0]&8192&&et("featureslisted",{features:U}),i.$$.dirty[2]&4&&et("featuresmarked",{features:ce}),i.$$.dirty[0]&1&&et("reversetoggle",{reverse:w}),i.$$.dirty[0]&2&&et("querychange",{query:T}),i.$$.dirty[0]&1|i.$$.dirty[1]&1024&&c&&c.indicateReverse(w)},[w,T,h,M,C,O,R,z,y,d,E,G,wn,U,W,X,yt,Ye,Ae,Fe,ft,ws,Sn,Ss,_n,gi,xn,_s,g,b,S,k,N,I,_,Y,Z,B,s,l,m,c,v,p,A,V,Q,re,q,H,Ke,ut,at,We,pe,me,ee,ui,ai,ys,ps,En,vs,bs,ce,fi,r,u,n,o,a,xs,Ts,Ms,Ns,Cs,ks,Os,Ps,Rs,Is,As,Gs,Bs]}let zr=class extends st{constructor(e){super(),rt(this,e,Fr,Wr,it,{ZOOM_DEFAULTS:28,class:2,apiKey:29,bbox:30,clearButtonTitle:3,clearOnBlur:31,clearListOnPick:32,keepListOpen:4,collapsed:5,country:33,debounceSearch:34,enableReverse:6,errorMessage:7,filter:35,flyTo:36,fuzzyMatch:37,language:38,limit:39,reverseGeocodingLimit:40,mapController:41,minLength:42,noResultsMessage:8,placeholder:9,proximity:43,reverseActive:0,reverseButtonTitle:10,searchValue:1,pickedResultStyle:44,showPlaceType:11,showResultsWhileTyping:45,selectFirst:46,flyToSelected:47,markerOnSelected:48,types:49,reverseGeocodingTypes:50,exhaustiveReverseGeocoding:51,excludeTypes:52,reverseGeocodingExcludeTypes:53,zoom:54,apiUrl:55,fetchParameters:56,iconsBaseUrl:12,adjustUrlQuery:57,adjustUrl:58,focus:59,blur:60,setQuery:61,clearList:62,clearMap:63},null,[-1,-1,-1,-1])}get ZOOM_DEFAULTS(){return this.$$.ctx[28]}get focus(){return this.$$.ctx[59]}get blur(){return this.$$.ctx[60]}get setQuery(){return this.$$.ctx[61]}get clearList(){return this.$$.ctx[62]}get clearMap(){return this.$$.ctx[63]}};function Bt(i,e,t={}){const n={type:"Feature"};return(t.id===0||t.id)&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.properties=e||{},n.geometry=i,n}function ei(i,e,t={}){for(const r of i){if(r.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(r[r.length-1].length!==r[0].length)throw new Error("First and last Position are not equivalent.");for(let u=0;u<r[r.length-1].length;u++)if(r[r.length-1][u]!==r[0][u])throw new Error("First and last Position are not equivalent.")}return Bt({type:"Polygon",coordinates:i},e,t)}function ti(i,e={}){const t={type:"FeatureCollection"};return e.id&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.features=i,t}function Hi(i,e,t={}){return Bt({type:"MultiPolygon",coordinates:i},e,t)}function Zi(i,e,t){if(i!==null)for(var n,r,u,a,o,g,h,b=0,S=0,M,k=i.type,N=k==="FeatureCollection",C=k==="Feature",O=N?i.features.length:1,I=0;I<O;I++){h=N?i.features[I].geometry:C?i.geometry:i,M=h?h.type==="GeometryCollection":!1,o=M?h.geometries.length:1;for(var _=0;_<o;_++){var R=0,z=0;if(a=M?h.geometries[_]:h,a!==null){g=a.coordinates;var Y=a.type;switch(b=0,Y){case null:break;case"Point":if(e(g,S,I,R,z)===!1)return!1;S++,R++;break;case"LineString":case"MultiPoint":for(n=0;n<g.length;n++){if(e(g[n],S,I,R,z)===!1)return!1;S++,Y==="MultiPoint"&&R++}Y==="LineString"&&R++;break;case"Polygon":case"MultiLineString":for(n=0;n<g.length;n++){for(r=0;r<g[n].length-b;r++){if(e(g[n][r],S,I,R,z)===!1)return!1;S++}Y==="MultiLineString"&&R++,Y==="Polygon"&&z++}Y==="Polygon"&&R++;break;case"MultiPolygon":for(n=0;n<g.length;n++){for(z=0,r=0;r<g[n].length;r++){for(u=0;u<g[n][r].length-b;u++){if(e(g[n][r][u],S,I,R,z)===!1)return!1;S++}z++}R++}break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(Zi(a.geometries[n],e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ii(i,e){var t,n,r,u,a,o,g,h,b,S,M=0,k=i.type==="FeatureCollection",N=i.type==="Feature",C=k?i.features.length:1;for(t=0;t<C;t++){for(o=k?i.features[t].geometry:N?i.geometry:i,h=k?i.features[t].properties:N?i.properties:{},b=k?i.features[t].bbox:N?i.bbox:void 0,S=k?i.features[t].id:N?i.id:void 0,g=o?o.type==="GeometryCollection":!1,a=g?o.geometries.length:1,r=0;r<a;r++){if(u=g?o.geometries[r]:o,u===null){if(e(null,M,h,b,S)===!1)return!1;continue}switch(u.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(u,M,h,b,S)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<u.geometries.length;n++)if(e(u.geometries[n],M,h,b,S)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}M++}}function Dr(i,e){ii(i,function(t,n,r,u,a){var o=t===null?null:t.type;switch(o){case null:case"Point":case"LineString":case"Polygon":return e(Bt(t,r,{bbox:u,id:a}),n,0)===!1?!1:void 0}var g;switch(o){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var h=0;h<t.coordinates.length;h++){var b=t.coordinates[h],S={type:g,coordinates:b};if(e(Bt(S,r),n,h)===!1)return!1}})}function Ur(i,e={}){if(i.bbox!=null&&e.recompute!==!0)return i.bbox;const t=[1/0,1/0,-1/0,-1/0];return Zi(i,n=>{t[0]>n[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]<n[0]&&(t[2]=n[0]),t[3]<n[1]&&(t[3]=n[1])}),t}var Ki=Ur,qr=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ni=Math.ceil,Ce=Math.floor,we="[BigNumber Error] ",Yi=we+"Number primitive has more than 15 significant digits: ",Ie=1e14,D=14,Qi=9007199254740991,ri=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],$e=1e7,Le=1e9;function Xi(i){var e,t,n,r=_.prototype={constructor:_,toString:null,valueOf:null},u=new _(1),a=20,o=4,g=-7,h=21,b=-1e7,S=1e7,M=!1,k=1,N=0,C={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},O="0123456789abcdefghijklmnopqrstuvwxyz",I=!0;function _(s,l){var f,m,c,v,y,d,p,w,E=this;if(!(E instanceof _))return new _(s,l);if(l==null){if(s&&s._isBigNumber===!0){E.s=s.s,!s.c||s.e>S?E.c=E.e=null:s.e<b?E.c=[E.e=0]:(E.e=s.e,E.c=s.c.slice());return}if((d=typeof s=="number")&&s*0==0){if(E.s=1/s<0?(s=-s,-1):1,s===~~s){for(v=0,y=s;y>=10;y/=10,v++);v>S?E.c=E.e=null:(E.e=v,E.c=[s]);return}w=String(s)}else{if(!qr.test(w=String(s)))return n(E,w,d);E.s=w.charCodeAt(0)==45?(w=w.slice(1),-1):1}(v=w.indexOf("."))>-1&&(w=w.replace(".","")),(y=w.search(/e/i))>0?(v<0&&(v=y),v+=+w.slice(y+1),w=w.substring(0,y)):v<0&&(v=w.length)}else{if(oe(l,2,O.length,"Base"),l==10&&I)return E=new _(s),Z(E,a+E.e+1,o);if(w=String(s),d=typeof s=="number"){if(s*0!=0)return n(E,w,d,l);if(E.s=1/s<0?(w=w.slice(1),-1):1,_.DEBUG&&w.replace(/^0\.0*|\./,"").length>15)throw Error(Yi+s)}else E.s=w.charCodeAt(0)===45?(w=w.slice(1),-1):1;for(f=O.slice(0,l),v=y=0,p=w.length;y<p;y++)if(f.indexOf(m=w.charAt(y))<0){if(m=="."){if(y>v){v=p;continue}}else if(!c&&(w==w.toUpperCase()&&(w=w.toLowerCase())||w==w.toLowerCase()&&(w=w.toUpperCase()))){c=!0,y=-1,v=0;continue}return n(E,String(s),d,l)}d=!1,w=t(w,l,10,E.s),(v=w.indexOf("."))>-1?w=w.replace(".",""):v=w.length}for(y=0;w.charCodeAt(y)===48;y++);for(p=w.length;w.charCodeAt(--p)===48;);if(w=w.slice(y,++p)){if(p-=y,d&&_.DEBUG&&p>15&&(s>Qi||s!==Ce(s)))throw Error(Yi+E.s*s);if((v=v-y-1)>S)E.c=E.e=null;else if(v<b)E.c=[E.e=0];else{if(E.e=v,E.c=[],y=(v+1)%D,v<0&&(y+=D),y<p){for(y&&E.c.push(+w.slice(0,y)),p-=D;y<p;)E.c.push(+w.slice(y,y+=D));y=D-(w=w.slice(y)).length}else y-=p;for(;y--;w+="0");E.c.push(+w)}}else E.c=[E.e=0]}_.clone=Xi,_.ROUND_UP=0,_.ROUND_DOWN=1,_.ROUND_CEIL=2,_.ROUND_FLOOR=3,_.ROUND_HALF_UP=4,_.ROUND_HALF_DOWN=5,_.ROUND_HALF_EVEN=6,_.ROUND_HALF_CEIL=7,_.ROUND_HALF_FLOOR=8,_.EUCLID=9,_.config=_.set=function(s){var l,f;if(s!=null)if(typeof s=="object"){if(s.hasOwnProperty(l="DECIMAL_PLACES")&&(f=s[l],oe(f,0,Le,l),a=f),s.hasOwnProperty(l="ROUNDING_MODE")&&(f=s[l],oe(f,0,8,l),o=f),s.hasOwnProperty(l="EXPONENTIAL_AT")&&(f=s[l],f&&f.pop?(oe(f[0],-1e9,0,l),oe(f[1],0,Le,l),g=f[0],h=f[1]):(oe(f,-1e9,Le,l),g=-(h=f<0?-f:f))),s.hasOwnProperty(l="RANGE"))if(f=s[l],f&&f.pop)oe(f[0],-1e9,-1,l),oe(f[1],1,Le,l),b=f[0],S=f[1];else if(oe(f,-1e9,Le,l),f)b=-(S=f<0?-f:f);else throw Error(we+l+" cannot be zero: "+f);if(s.hasOwnProperty(l="CRYPTO"))if(f=s[l],f===!!f)if(f)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))M=f;else throw M=!f,Error(we+"crypto unavailable");else M=f;else throw Error(we+l+" not true or false: "+f);if(s.hasOwnProperty(l="MODULO_MODE")&&(f=s[l],oe(f,0,9,l),k=f),s.hasOwnProperty(l="POW_PRECISION")&&(f=s[l],oe(f,0,Le,l),N=f),s.hasOwnProperty(l="FORMAT"))if(f=s[l],typeof f=="object")C=f;else throw Error(we+l+" not an object: "+f);if(s.hasOwnProperty(l="ALPHABET"))if(f=s[l],typeof f=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(f))I=f.slice(0,10)=="0123456789",O=f;else throw Error(we+l+" invalid: "+f)}else throw Error(we+"Object expected: "+s);return{DECIMAL_PLACES:a,ROUNDING_MODE:o,EXPONENTIAL_AT:[g,h],RANGE:[b,S],CRYPTO:M,MODULO_MODE:k,POW_PRECISION:N,FORMAT:C,ALPHABET:O}},_.isBigNumber=function(s){if(!s||s._isBigNumber!==!0)return!1;if(!_.DEBUG)return!0;var l,f,m=s.c,c=s.e,v=s.s;e:if({}.toString.call(m)=="[object Array]"){if((v===1||v===-1)&&c>=-1e9&&c<=Le&&c===Ce(c)){if(m[0]===0){if(c===0&&m.length===1)return!0;break e}if(l=(c+1)%D,l<1&&(l+=D),String(m[0]).length==l){for(l=0;l<m.length;l++)if(f=m[l],f<0||f>=Ie||f!==Ce(f))break e;if(f!==0)return!0}}}else if(m===null&&c===null&&(v===null||v===1||v===-1))return!0;throw Error(we+"Invalid BigNumber: "+s)},_.maximum=_.max=function(){return z(arguments,-1)},_.minimum=_.min=function(){return z(arguments,1)},_.random=function(){var s=9007199254740992,l=Math.random()*s&2097151?function(){return Ce(Math.random()*s)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(f){var m,c,v,y,d,p=0,w=[],E=new _(u);if(f==null?f=a:oe(f,0,Le),y=ni(f/D),M)if(crypto.getRandomValues){for(m=crypto.getRandomValues(new Uint32Array(y*=2));p<y;)d=m[p]*131072+(m[p+1]>>>11),d>=9e15?(c=crypto.getRandomValues(new Uint32Array(2)),m[p]=c[0],m[p+1]=c[1]):(w.push(d%1e14),p+=2);p=y/2}else if(crypto.randomBytes){for(m=crypto.randomBytes(y*=7);p<y;)d=(m[p]&31)*281474976710656+m[p+1]*1099511627776+m[p+2]*4294967296+m[p+3]*16777216+(m[p+4]<<16)+(m[p+5]<<8)+m[p+6],d>=9e15?crypto.randomBytes(7).copy(m,p):(w.push(d%1e14),p+=7);p=y/7}else throw M=!1,Error(we+"crypto unavailable");if(!M)for(;p<y;)d=l(),d<9e15&&(w[p++]=d%1e14);for(y=w[--p],f%=D,y&&f&&(d=ri[D-f],w[p]=Ce(y/d)*d);w[p]===0;w.pop(),p--);if(p<0)w=[v=0];else{for(v=-1;w[0]===0;w.splice(0,1),v-=D);for(p=1,d=w[0];d>=10;d/=10,p++);p<D&&(v-=D-p)}return E.e=v,E.c=w,E}}(),_.sum=function(){for(var s=1,l=arguments,f=new _(l[0]);s<l.length;)f=f.plus(l[s++]);return f},t=function(){var s="0123456789";function l(f,m,c,v){for(var y,d=[0],p,w=0,E=f.length;w<E;){for(p=d.length;p--;d[p]*=m);for(d[0]+=v.indexOf(f.charAt(w++)),y=0;y<d.length;y++)d[y]>c-1&&(d[y+1]==null&&(d[y+1]=0),d[y+1]+=d[y]/c|0,d[y]%=c)}return d.reverse()}return function(f,m,c,v,y){var d,p,w,E,T,A,G,V,Q=f.indexOf("."),re=a,q=o;for(Q>=0&&(E=N,N=0,f=f.replace(".",""),V=new _(m),A=V.pow(f.length-Q),N=E,V.c=l(He(Oe(A.c),A.e,"0"),10,c,s),V.e=V.c.length),G=l(f,m,c,y?(d=O,s):(d=s,O)),w=E=G.length;G[--E]==0;G.pop());if(!G[0])return d.charAt(0);if(Q<0?--w:(A.c=G,A.e=w,A.s=v,A=e(A,V,re,q,c),G=A.c,T=A.r,w=A.e),p=w+re+1,Q=G[p],E=c/2,T=T||p<0||G[p+1]!=null,T=q<4?(Q!=null||T)&&(q==0||q==(A.s<0?3:2)):Q>E||Q==E&&(q==4||T||q==6&&G[p-1]&1||q==(A.s<0?8:7)),p<1||!G[0])f=T?He(d.charAt(1),-re,d.charAt(0)):d.charAt(0);else{if(G.length=p,T)for(--c;++G[--p]>c;)G[p]=0,p||(++w,G=[1].concat(G));for(E=G.length;!G[--E];);for(Q=0,f="";Q<=E;f+=d.charAt(G[Q++]));f=He(f,w,d.charAt(0))}return f}}(),e=function(){function s(m,c,v){var y,d,p,w,E=0,T=m.length,A=c%$e,G=c/$e|0;for(m=m.slice();T--;)p=m[T]%$e,w=m[T]/$e|0,y=G*p+w*A,d=A*p+y%$e*$e+E,E=(d/v|0)+(y/$e|0)+G*w,m[T]=d%v;return E&&(m=[E].concat(m)),m}function l(m,c,v,y){var d,p;if(v!=y)p=v>y?1:-1;else for(d=p=0;d<v;d++)if(m[d]!=c[d]){p=m[d]>c[d]?1:-1;break}return p}function f(m,c,v,y){for(var d=0;v--;)m[v]-=d,d=m[v]<c[v]?1:0,m[v]=d*y+m[v]-c[v];for(;!m[0]&&m.length>1;m.splice(0,1));}return function(m,c,v,y,d){var p,w,E,T,A,G,V,Q,re,q,H,ge,Ke,ut,at,Se,We,pe=m.s==c.s?1:-1,me=m.c,ee=c.c;if(!me||!me[0]||!ee||!ee[0])return new _(!m.s||!c.s||(me?ee&&me[0]==ee[0]:!ee)?NaN:me&&me[0]==0||!ee?pe*0:pe/0);for(Q=new _(pe),re=Q.c=[],w=m.e-c.e,pe=v+w+1,d||(d=Ie,w=ke(m.e/D)-ke(c.e/D),pe=pe/D|0),E=0;ee[E]==(me[E]||0);E++);if(ee[E]>(me[E]||0)&&w--,pe<0)re.push(1),T=!0;else{for(ut=me.length,Se=ee.length,E=0,pe+=2,A=Ce(d/(ee[0]+1)),A>1&&(ee=s(ee,A,d),me=s(me,A,d),Se=ee.length,ut=me.length),Ke=Se,q=me.slice(0,Se),H=q.length;H<Se;q[H++]=0);We=ee.slice(),We=[0].concat(We),at=ee[0],ee[1]>=d/2&&at++;do{if(A=0,p=l(ee,q,Se,H),p<0){if(ge=q[0],Se!=H&&(ge=ge*d+(q[1]||0)),A=Ce(ge/at),A>1)for(A>=d&&(A=d-1),G=s(ee,A,d),V=G.length,H=q.length;l(G,q,V,H)==1;)A--,f(G,Se<V?We:ee,V,d),V=G.length,p=1;else A==0&&(p=A=1),G=ee.slice(),V=G.length;if(V<H&&(G=[0].concat(G)),f(q,G,H,d),H=q.length,p==-1)for(;l(ee,q,Se,H)<1;)A++,f(q,Se<H?We:ee,H,d),H=q.length}else p===0&&(A++,q=[0]);re[E++]=A,q[0]?q[H++]=me[Ke]||0:(q=[me[Ke]],H=1)}while((Ke++<ut||q[0]!=null)&&pe--);T=q[0]!=null,re[0]||re.splice(0,1)}if(d==Ie){for(E=1,pe=re[0];pe>=10;pe/=10,E++);Z(Q,v+(Q.e=E+w*D-1)+1,y,T)}else Q.e=w,Q.r=+T;return Q}}();function R(s,l,f,m){var c,v,y,d,p;if(f==null?f=o:oe(f,0,8),!s.c)return s.toString();if(c=s.c[0],y=s.e,l==null)p=Oe(s.c),p=m==1||m==2&&(y<=g||y>=h)?Ft(p,y):He(p,y,"0");else if(s=Z(new _(s),l,f),v=s.e,p=Oe(s.c),d=p.length,m==1||m==2&&(l<=v||v<=g)){for(;d<l;p+="0",d++);p=Ft(p,v)}else if(l-=y,p=He(p,v,"0"),v+1>d){if(--l>0)for(p+=".";l--;p+="0");}else if(l+=v-d,l>0)for(v+1==d&&(p+=".");l--;p+="0");return s.s<0&&c?"-"+p:p}function z(s,l){for(var f,m,c=1,v=new _(s[0]);c<s.length;c++)m=new _(s[c]),(!m.s||(f=ot(v,m))===l||f===0&&v.s===l)&&(v=m);return v}function Y(s,l,f){for(var m=1,c=l.length;!l[--c];l.pop());for(c=l[0];c>=10;c/=10,m++);return(f=m+f*D-1)>S?s.c=s.e=null:f<b?s.c=[s.e=0]:(s.e=f,s.c=l),s}n=function(){var s=/^(-?)0([xbo])(?=\w[\w.]*$)/i,l=/^([^.]+)\.$/,f=/^\.([^.]+)$/,m=/^-?(Infinity|NaN)$/,c=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(v,y,d,p){var w,E=d?y:y.replace(c,"");if(m.test(E))v.s=isNaN(E)?null:E<0?-1:1;else{if(!d&&(E=E.replace(s,function(T,A,G){return w=(G=G.toLowerCase())=="x"?16:G=="b"?2:8,!p||p==w?A:T}),p&&(w=p,E=E.replace(l,"$1").replace(f,"0.$1")),y!=E))return new _(E,w);if(_.DEBUG)throw Error(we+"Not a"+(p?" base "+p:"")+" number: "+y);v.s=null}v.c=v.e=null}}();function Z(s,l,f,m){var c,v,y,d,p,w,E,T=s.c,A=ri;if(T){e:{for(c=1,d=T[0];d>=10;d/=10,c++);if(v=l-c,v<0)v+=D,y=l,p=T[w=0],E=Ce(p/A[c-y-1]%10);else if(w=ni((v+1)/D),w>=T.length)if(m){for(;T.length<=w;T.push(0));p=E=0,c=1,v%=D,y=v-D+1}else break e;else{for(p=d=T[w],c=1;d>=10;d/=10,c++);v%=D,y=v-D+c,E=y<0?0:Ce(p/A[c-y-1]%10)}if(m=m||l<0||T[w+1]!=null||(y<0?p:p%A[c-y-1]),m=f<4?(E||m)&&(f==0||f==(s.s<0?3:2)):E>5||E==5&&(f==4||m||f==6&&(v>0?y>0?p/A[c-y]:0:T[w-1])%10&1||f==(s.s<0?8:7)),l<1||!T[0])return T.length=0,m?(l-=s.e+1,T[0]=A[(D-l%D)%D],s.e=-l||0):T[0]=s.e=0,s;if(v==0?(T.length=w,d=1,w--):(T.length=w+1,d=A[D-v],T[w]=y>0?Ce(p/A[c-y]%A[y])*d:0),m)for(;;)if(w==0){for(v=1,y=T[0];y>=10;y/=10,v++);for(y=T[0]+=d,d=1;y>=10;y/=10,d++);v!=d&&(s.e++,T[0]==Ie&&(T[0]=1));break}else{if(T[w]+=d,T[w]!=Ie)break;T[w--]=0,d=1}for(v=T.length;T[--v]===0;T.pop());}s.e>S?s.c=s.e=null:s.e<b&&(s.c=[s.e=0])}return s}function B(s){var l,f=s.e;return f===null?s.toString():(l=Oe(s.c),l=f<=g||f>=h?Ft(l,f):He(l,f,"0"),s.s<0?"-"+l:l)}return r.absoluteValue=r.abs=function(){var s=new _(this);return s.s<0&&(s.s=1),s},r.comparedTo=function(s,l){return ot(this,new _(s,l))},r.decimalPlaces=r.dp=function(s,l){var f,m,c,v=this;if(s!=null)return oe(s,0,Le),l==null?l=o:oe(l,0,8),Z(new _(v),s+v.e+1,l);if(!(f=v.c))return null;if(m=((c=f.length-1)-ke(this.e/D))*D,c=f[c])for(;c%10==0;c/=10,m--);return m<0&&(m=0),m},r.dividedBy=r.div=function(s,l){return e(this,new _(s,l),a,o)},r.dividedToIntegerBy=r.idiv=function(s,l){return e(this,new _(s,l),0,1)},r.exponentiatedBy=r.pow=function(s,l){var f,m,c,v,y,d,p,w,E,T=this;if(s=new _(s),s.c&&!s.isInteger())throw Error(we+"Exponent not an integer: "+B(s));if(l!=null&&(l=new _(l)),d=s.e>14,!T.c||!T.c[0]||T.c[0]==1&&!T.e&&T.c.length==1||!s.c||!s.c[0])return E=new _(Math.pow(+B(T),d?s.s*(2-Wt(s)):+B(s))),l?E.mod(l):E;if(p=s.s<0,l){if(l.c?!l.c[0]:!l.s)return new _(NaN);m=!p&&T.isInteger()&&l.isInteger(),m&&(T=T.mod(l))}else{if(s.e>9&&(T.e>0||T.e<-1||(T.e==0?T.c[0]>1||d&&T.c[1]>=24e7:T.c[0]<8e13||d&&T.c[0]<=9999975e7)))return v=T.s<0&&Wt(s)?-0:0,T.e>-1&&(v=1/v),new _(p?1/v:v);N&&(v=ni(N/D+2))}for(d?(f=new _(.5),p&&(s.s=1),w=Wt(s)):(c=Math.abs(+B(s)),w=c%2),E=new _(u);;){if(w){if(E=E.times(T),!E.c)break;v?E.c.length>v&&(E.c.length=v):m&&(E=E.mod(l))}if(c){if(c=Ce(c/2),c===0)break;w=c%2}else if(s=s.times(f),Z(s,s.e+1,1),s.e>14)w=Wt(s);else{if(c=+B(s),c===0)break;w=c%2}T=T.times(T),v?T.c&&T.c.length>v&&(T.c.length=v):m&&(T=T.mod(l))}return m?E:(p&&(E=u.div(E)),l?E.mod(l):v?Z(E,N,o,y):E)},r.integerValue=function(s){var l=new _(this);return s==null?s=o:oe(s,0,8),Z(l,l.e+1,s)},r.isEqualTo=r.eq=function(s,l){return ot(this,new _(s,l))===0},r.isFinite=function(){return!!this.c},r.isGreaterThan=r.gt=function(s,l){return ot(this,new _(s,l))>0},r.isGreaterThanOrEqualTo=r.gte=function(s,l){return(l=ot(this,new _(s,l)))===1||l===0},r.isInteger=function(){return!!this.c&&ke(this.e/D)>this.c.length-2},r.isLessThan=r.lt=function(s,l){return ot(this,new _(s,l))<0},r.isLessThanOrEqualTo=r.lte=function(s,l){return(l=ot(this,new _(s,l)))===-1||l===0},r.isNaN=function(){return!this.s},r.isNegative=function(){return this.s<0},r.isPositive=function(){return this.s>0},r.isZero=function(){return!!this.c&&this.c[0]==0},r.minus=function(s,l){var f,m,c,v,y=this,d=y.s;if(s=new _(s,l),l=s.s,!d||!l)return new _(NaN);if(d!=l)return s.s=-l,y.plus(s);var p=y.e/D,w=s.e/D,E=y.c,T=s.c;if(!p||!w){if(!E||!T)return E?(s.s=-l,s):new _(T?y:NaN);if(!E[0]||!T[0])return T[0]?(s.s=-l,s):new _(E[0]?y:o==3?-0:0)}if(p=ke(p),w=ke(w),E=E.slice(),d=p-w){for((v=d<0)?(d=-d,c=E):(w=p,c=T),c.reverse(),l=d;l--;c.push(0));c.reverse()}else for(m=(v=(d=E.length)<(l=T.length))?d:l,d=l=0;l<m;l++)if(E[l]!=T[l]){v=E[l]<T[l];break}if(v&&(c=E,E=T,T=c,s.s=-s.s),l=(m=T.length)-(f=E.length),l>0)for(;l--;E[f++]=0);for(l=Ie-1;m>d;){if(E[--m]<T[m]){for(f=m;f&&!E[--f];E[f]=l);--E[f],E[m]+=Ie}E[m]-=T[m]}for(;E[0]==0;E.splice(0,1),--w);return E[0]?Y(s,E,w):(s.s=o==3?-1:1,s.c=[s.e=0],s)},r.modulo=r.mod=function(s,l){var f,m,c=this;return s=new _(s,l),!c.c||!s.s||s.c&&!s.c[0]?new _(NaN):!s.c||c.c&&!c.c[0]?new _(c):(k==9?(m=s.s,s.s=1,f=e(c,s,0,3),s.s=m,f.s*=m):f=e(c,s,0,k),s=c.minus(f.times(s)),!s.c[0]&&k==1&&(s.s=c.s),s)},r.multipliedBy=r.times=function(s,l){var f,m,c,v,y,d,p,w,E,T,A,G,V,Q,re,q=this,H=q.c,ge=(s=new _(s,l)).c;if(!H||!ge||!H[0]||!ge[0])return!q.s||!s.s||H&&!H[0]&&!ge||ge&&!ge[0]&&!H?s.c=s.e=s.s=null:(s.s*=q.s,!H||!ge?s.c=s.e=null:(s.c=[0],s.e=0)),s;for(m=ke(q.e/D)+ke(s.e/D),s.s*=q.s,p=H.length,T=ge.length,p<T&&(V=H,H=ge,ge=V,c=p,p=T,T=c),c=p+T,V=[];c--;V.push(0));for(Q=Ie,re=$e,c=T;--c>=0;){for(f=0,A=ge[c]%re,G=ge[c]/re|0,y=p,v=c+y;v>c;)w=H[--y]%re,E=H[y]/re|0,d=G*w+E*A,w=A*w+d%re*re+V[v]+f,f=(w/Q|0)+(d/re|0)+G*E,V[v--]=w%Q;V[v]=f}return f?++m:V.splice(0,1),Y(s,V,m)},r.negated=function(){var s=new _(this);return s.s=-s.s||null,s},r.plus=function(s,l){var f,m=this,c=m.s;if(s=new _(s,l),l=s.s,!c||!l)return new _(NaN);if(c!=l)return s.s=-l,m.minus(s);var v=m.e/D,y=s.e/D,d=m.c,p=s.c;if(!v||!y){if(!d||!p)return new _(c/0);if(!d[0]||!p[0])return p[0]?s:new _(d[0]?m:c*0)}if(v=ke(v),y=ke(y),d=d.slice(),c=v-y){for(c>0?(y=v,f=p):(c=-c,f=d),f.reverse();c--;f.push(0));f.reverse()}for(c=d.length,l=p.length,c-l<0&&(f=p,p=d,d=f,l=c),c=0;l;)c=(d[--l]=d[l]+p[l]+c)/Ie|0,d[l]=Ie===d[l]?0:d[l]%Ie;return c&&(d=[c].concat(d),++y),Y(s,d,y)},r.precision=r.sd=function(s,l){var f,m,c,v=this;if(s!=null&&s!==!!s)return oe(s,1,Le),l==null?l=o:oe(l,0,8),Z(new _(v),s,l);if(!(f=v.c))return null;if(c=f.length-1,m=c*D+1,c=f[c]){for(;c%10==0;c/=10,m--);for(c=f[0];c>=10;c/=10,m++);}return s&&v.e+1>m&&(m=v.e+1),m},r.shiftedBy=function(s){return oe(s,-9007199254740991,Qi),this.times("1e"+s)},r.squareRoot=r.sqrt=function(){var s,l,f,m,c,v=this,y=v.c,d=v.s,p=v.e,w=a+4,E=new _("0.5");if(d!==1||!y||!y[0])return new _(!d||d<0&&(!y||y[0])?NaN:y?v:1/0);if(d=Math.sqrt(+B(v)),d==0||d==1/0?(l=Oe(y),(l.length+p)%2==0&&(l+="0"),d=Math.sqrt(+l),p=ke((p+1)/2)-(p<0||p%2),d==1/0?l="5e"+p:(l=d.toExponential(),l=l.slice(0,l.indexOf("e")+1)+p),f=new _(l)):f=new _(d+""),f.c[0]){for(p=f.e,d=p+w,d<3&&(d=0);;)if(c=f,f=E.times(c.plus(e(v,c,w,1))),Oe(c.c).slice(0,d)===(l=Oe(f.c)).slice(0,d))if(f.e<p&&--d,l=l.slice(d-3,d+1),l=="9999"||!m&&l=="4999"){if(!m&&(Z(c,c.e+a+2,0),c.times(c).eq(v))){f=c;break}w+=4,d+=4,m=1}else{(!+l||!+l.slice(1)&&l.charAt(0)=="5")&&(Z(f,f.e+a+2,1),s=!f.times(f).eq(v));break}}return Z(f,f.e+a+1,o,s)},r.toExponential=function(s,l){return s!=null&&(oe(s,0,Le),s++),R(this,s,l,1)},r.toFixed=function(s,l){return s!=null&&(oe(s,0,Le),s=s+this.e+1),R(this,s,l)},r.toFormat=function(s,l,f){var m,c=this;if(f==null)s!=null&&l&&typeof l=="object"?(f=l,l=null):s&&typeof s=="object"?(f=s,s=l=null):f=C;else if(typeof f!="object")throw Error(we+"Argument not an object: "+f);if(m=c.toFixed(s,l),c.c){var v,y=m.split("."),d=+f.groupSize,p=+f.secondaryGroupSize,w=f.groupSeparator||"",E=y[0],T=y[1],A=c.s<0,G=A?E.slice(1):E,V=G.length;if(p&&(v=d,d=p,p=v,V-=v),d>0&&V>0){for(v=V%d||d,E=G.substr(0,v);v<V;v+=d)E+=w+G.substr(v,d);p>0&&(E+=w+G.slice(v)),A&&(E="-"+E)}m=T?E+(f.decimalSeparator||"")+((p=+f.fractionGroupSize)?T.replace(new RegExp("\\d{"+p+"}\\B","g"),"$&"+(f.fractionGroupSeparator||"")):T):E}return(f.prefix||"")+m+(f.suffix||"")},r.toFraction=function(s){var l,f,m,c,v,y,d,p,w,E,T,A,G=this,V=G.c;if(s!=null&&(d=new _(s),!d.isInteger()&&(d.c||d.s!==1)||d.lt(u)))throw Error(we+"Argument "+(d.isInteger()?"out of range: ":"not an integer: ")+B(d));if(!V)return new _(G);for(l=new _(u),w=f=new _(u),m=p=new _(u),A=Oe(V),v=l.e=A.length-G.e-1,l.c[0]=ri[(y=v%D)<0?D+y:y],s=!s||d.comparedTo(l)>0?v>0?l:w:d,y=S,S=1/0,d=new _(A),p.c[0]=0;E=e(d,l,0,1),c=f.plus(E.times(m)),c.comparedTo(s)!=1;)f=m,m=c,w=p.plus(E.times(c=w)),p=c,l=d.minus(E.times(c=l)),d=c;return c=e(s.minus(f),m,0,1),p=p.plus(c.times(w)),f=f.plus(c.times(m)),p.s=w.s=G.s,v=v*2,T=e(w,m,v,o).minus(G).abs().comparedTo(e(p,f,v,o).minus(G).abs())<1?[w,m]:[p,f],S=y,T},r.toNumber=function(){return+B(this)},r.toPrecision=function(s,l){return s!=null&&oe(s,1,Le),R(this,s,l,2)},r.toString=function(s){var l,f=this,m=f.s,c=f.e;return c===null?m?(l="Infinity",m<0&&(l="-"+l)):l="NaN":(s==null?l=c<=g||c>=h?Ft(Oe(f.c),c):He(Oe(f.c),c,"0"):s===10&&I?(f=Z(new _(f),a+c+1,o),l=He(Oe(f.c),f.e,"0")):(oe(s,2,O.length,"Base"),l=t(He(Oe(f.c),c,"0"),10,s,m,!0)),m<0&&f.c[0]&&(l="-"+l)),l},r.valueOf=r.toJSON=function(){return B(this)},r._isBigNumber=!0,r[Symbol.toStringTag]="BigNumber",r[Symbol.for("nodejs.util.inspect.custom")]=r.valueOf,i!=null&&_.set(i),_}function ke(i){var e=i|0;return i>0||i===e?e:e-1}function Oe(i){for(var e,t,n=1,r=i.length,u=i[0]+"";n<r;){for(e=i[n++]+"",t=D-e.length;t--;e="0"+e);u+=e}for(r=u.length;u.charCodeAt(--r)===48;);return u.slice(0,r+1||1)}function ot(i,e){var t,n,r=i.c,u=e.c,a=i.s,o=e.s,g=i.e,h=e.e;if(!a||!o)return null;if(t=r&&!r[0],n=u&&!u[0],t||n)return t?n?0:-o:a;if(a!=o)return a;if(t=a<0,n=g==h,!r||!u)return n?0:!r^t?1:-1;if(!n)return g>h^t?1:-1;for(o=(g=r.length)<(h=u.length)?g:h,a=0;a<o;a++)if(r[a]!=u[a])return r[a]>u[a]^t?1:-1;return g==h?0:g>h^t?1:-1}function oe(i,e,t,n){if(i<e||i>t||i!==Ce(i))throw Error(we+(n||"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 ke(i.e/D)==e&&i.c[e]%2!=0}function Ft(i,e){return(i.length>1?i.charAt(0)+"."+i.slice(1):i)+(e<0?"e":"e+")+e}function He(i,e,t){var n,r;if(e<0){for(r=t+".";++e;r+=t);i=r+i}else if(n=i.length,++e>n){for(r=t,e-=n;--e;r+=t);i+=r}else e<n&&(i=i.slice(0,e)+"."+i.slice(e));return i}var Ge=Xi(),Vr=class{constructor(i){P(this,"key");P(this,"left",null);P(this,"right",null);this.key=i}},Lt=class extends Vr{constructor(i){super(i)}},jr=class{constructor(){P(this,"size",0);P(this,"modificationCount",0);P(this,"splayCount",0)}splay(i){const e=this.root;if(e==null)return this.compare(i,i),-1;let t=null,n=null,r=null,u=null,a=e;const o=this.compare;let g;for(;;)if(g=o(a.key,i),g>0){let h=a.left;if(h==null||(g=o(h.key,i),g>0&&(a.left=h.right,h.right=a,a=h,h=a.left,h==null)))break;t==null?n=a:t.left=a,t=a,a=h}else if(g<0){let h=a.right;if(h==null||(g=o(h.key,i),g<0&&(a.right=h.left,h.left=a,a=h,h=a.right,h==null)))break;r==null?u=a:r.right=a,r=a,a=h}else break;return r!=null&&(r.right=a.left,a.left=u),t!=null&&(t.left=a.right,a.right=n),this.root!==a&&(this.root=a,this.splayCount++),g}splayMin(i){let e=i,t=e.left;for(;t!=null;){const n=t;e.left=n.right,n.right=e,e=n,t=e.left}return e}splayMax(i){let e=i,t=e.right;for(;t!=null;){const n=t;e.right=n.left,n.left=e,e=n,t=e.right}return e}_delete(i){if(this.root==null||this.splay(i)!=0)return null;let t=this.root;const n=t,r=t.left;if(this.size--,r==null)this.root=t.right;else{const u=t.right;t=this.splayMax(r),t.right=u,this.root=t}return this.modificationCount++,n}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)}}},zt=class Ct extends jr{constructor(t,n){super();P(this,"root",null);P(this,"compare");P(this,"validKey");P(this,vn,"[object Set]");this.compare=t??this.defaultCompare(),this.validKey=n??(r=>r!=null&&r!=null)}delete(t){return this.validKey(t)?this._delete(t)!=null:!1}deleteAll(t){for(const n of t)this.delete(n)}forEach(t){const n=this[Symbol.iterator]();let r;for(;r=n.next(),!r.done;)t(r.value,r.value,this)}add(t){const n=this.splay(t);return n!=0&&this.addNewRoot(new Lt(t),n),this}addAndReturn(t){const n=this.splay(t);return n!=0&&this.addNewRoot(new Lt(t),n),this.root.key}addAll(t){for(const n of t)this.add(n)}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(t){if(t==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(t)<0)return this.root.key;let r=this.root.left;if(r==null)return null;let u=r.right;for(;u!=null;)r=u,u=r.right;return r.key}firstAfter(t){if(t==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(t)>0)return this.root.key;let r=this.root.right;if(r==null)return null;let u=r.left;for(;u!=null;)r=u,u=r.left;return r.key}retainAll(t){const n=new Ct(this.compare,this.validKey),r=this.modificationCount;for(const u of t){if(r!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(u)&&this.splay(u)==0&&n.add(this.root.key)}n.size!=this.size&&(this.root=n.root,this.size=n.size,this.modificationCount++)}lookup(t){return!this.validKey(t)||this.splay(t)!=0?null:this.root.key}intersection(t){const n=new Ct(this.compare,this.validKey);for(const r of this)t.has(r)&&n.add(r);return n}difference(t){const n=new Ct(this.compare,this.validKey);for(const r of this)t.has(r)||n.add(r);return n}union(t){const n=this.clone();return n.addAll(t),n}clone(){const t=new Ct(this.compare,this.validKey);return t.size=this.size,t.root=this.copyNode(this.root),t}copyNode(t){if(t==null)return null;function n(u,a){let o,g;do{if(o=u.left,g=u.right,o!=null){const h=new Lt(o.key);a.left=h,n(o,h)}if(g!=null){const h=new Lt(g.key);a.right=h,u=g,a=h}}while(g!=null)}const r=new Lt(t.key);return n(t,r),r}toSet(){return this.clone()}entries(){return new Zr(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[(bn=Symbol.iterator,vn=Symbol.toStringTag,bn)](){return new Hr(this.wrap())}},Ji=class{constructor(i){P(this,"tree");P(this,"path",new Array);P(this,"modificationCount",null);P(this,"splayCount");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}},Hr=class extends Ji{getValue(i){return i.key}},Zr=class extends Ji{getValue(i){return[i.key,i.key]}},$i=i=>()=>i,si=i=>{const e=i?(t,n)=>n.minus(t).abs().isLessThanOrEqualTo(i):$i(!1);return(t,n)=>e(t,n)?0:t.comparedTo(n)};function Kr(i){const e=i?(t,n,r,u,a)=>t.exponentiatedBy(2).isLessThanOrEqualTo(u.minus(n).exponentiatedBy(2).plus(a.minus(r).exponentiatedBy(2)).times(i)):$i(!1);return(t,n,r)=>{const u=t.x,a=t.y,o=r.x,g=r.y,h=a.minus(g).times(n.x.minus(o)).minus(u.minus(o).times(n.y.minus(g)));return e(h,u,a,o,g)?0:h.comparedTo(0)}}var Yr=i=>i,Qr=i=>{if(i){const e=new zt(si(i)),t=new zt(si(i)),n=(u,a)=>a.addAndReturn(u),r=u=>({x:n(u.x,e),y:n(u.y,t)});return r({x:new Ge(0),y:new Ge(0)}),r}return Yr},oi=i=>({set:e=>{Ze=oi(e)},reset:()=>oi(i),compare:si(i),snap:Qr(i),orient:Kr(i)}),Ze=oi(),St=(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,n=i.ur.x.isLessThan(e.ur.x)?i.ur.x:e.ur.x,r=i.ll.y.isLessThan(e.ll.y)?e.ll.y:i.ll.y,u=i.ur.y.isLessThan(e.ur.y)?i.ur.y:e.ur.y;return{ll:{x:t,y:r},ur:{x:n,y:u}}},Dt=(i,e)=>i.x.times(e.y).minus(i.y.times(e.x)),en=(i,e)=>i.x.times(e.x).plus(i.y.times(e.y)),Ut=i=>en(i,i).sqrt(),Xr=(i,e,t)=>{const n={x:e.x.minus(i.x),y:e.y.minus(i.y)},r={x:t.x.minus(i.x),y:t.y.minus(i.y)};return Dt(r,n).div(Ut(r)).div(Ut(n))},Jr=(i,e,t)=>{const n={x:e.x.minus(i.x),y:e.y.minus(i.y)},r={x:t.x.minus(i.x),y:t.y.minus(i.y)};return en(r,n).div(Ut(r)).div(Ut(n))},tn=(i,e,t)=>e.y.isZero()?null:{x:i.x.plus(e.x.div(e.y).times(t.minus(i.y))),y:t},nn=(i,e,t)=>e.x.isZero()?null:{x:t,y:i.y.plus(e.y.div(e.x).times(t.minus(i.x)))},$r=(i,e,t,n)=>{if(e.x.isZero())return nn(t,n,i.x);if(n.x.isZero())return nn(i,e,t.x);if(e.y.isZero())return tn(t,n,i.y);if(n.y.isZero())return tn(i,e,t.y);const r=Dt(e,n);if(r.isZero())return null;const u={x:t.x.minus(i.x),y:t.y.minus(i.y)},a=Dt(u,e).div(r),o=Dt(u,n).div(r),g=i.x.plus(o.times(e.x)),h=t.x.plus(a.times(n.x)),b=i.y.plus(o.times(e.y)),S=t.y.plus(a.times(n.y)),M=g.plus(h).div(2),k=b.plus(S).div(2);return{x:M,y:k}},Be=class Cn{constructor(e,t){P(this,"point");P(this,"isLeft");P(this,"segment");P(this,"otherSE");P(this,"consumedBy");e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=t}static compare(e,t){const n=Cn.comparePoints(e.point,t.point);return n!==0?n:(e.point!==t.point&&e.link(t),e.isLeft!==t.isLeft?e.isLeft?1:-1:Vt.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}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");const t=e.point.events;for(let n=0,r=t.length;n<r;n++){const u=t[n];this.point.events.push(u),u.point=this.point}this.checkForConsuming()}checkForConsuming(){const e=this.point.events.length;for(let t=0;t<e;t++){const n=this.point.events[t];if(n.segment.consumedBy===void 0)for(let r=t+1;r<e;r++){const u=this.point.events[r];u.consumedBy===void 0&&n.otherSE.point.events===u.otherSE.point.events&&n.segment.consume(u.segment)}}}getAvailableLinkedEvents(){const e=[];for(let t=0,n=this.point.events.length;t<n;t++){const r=this.point.events[t];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&e.push(r)}return e}getLeftmostComparator(e){const t=new Map,n=r=>{const u=r.otherSE;t.set(r,{sine:Xr(this.point,e.point,u.point),cosine:Jr(this.point,e.point,u.point)})};return(r,u)=>{t.has(r)||n(r),t.has(u)||n(u);const{sine:a,cosine:o}=t.get(r),{sine:g,cosine:h}=t.get(u);return a.isGreaterThanOrEqualTo(0)&&g.isGreaterThanOrEqualTo(0)?o.isLessThan(h)?1:o.isGreaterThan(h)?-1:0:a.isLessThan(0)&&g.isLessThan(0)?o.isLessThan(h)?-1:o.isGreaterThan(h)?1:0:g.isLessThan(a)?-1:g.isGreaterThan(a)?1:0}}},es=class vi{constructor(e){P(this,"events");P(this,"poly");P(this,"_isExteriorRing");P(this,"_enclosingRing");this.events=e;for(let t=0,n=e.length;t<n;t++)e[t].segment.ringOut=this;this.poly=null}static factory(e){const t=[];for(let n=0,r=e.length;n<r;n++){const u=e[n];if(!u.isInResult()||u.ringOut)continue;let a=null,o=u.leftSE,g=u.rightSE;const h=[o],b=o.point,S=[];for(;a=o,o=g,h.push(o),o.point!==b;)for(;;){const M=o.getAvailableLinkedEvents();if(M.length===0){const C=h[0].point,O=h[h.length-1].point;throw new Error(`Unable to complete output ring starting at [${C.x}, ${C.y}]. Last matching segment found ends at [${O.x}, ${O.y}].`)}if(M.length===1){g=M[0].otherSE;break}let k=null;for(let C=0,O=S.length;C<O;C++)if(S[C].point===o.point){k=C;break}if(k!==null){const C=S.splice(k)[0],O=h.splice(C.index);O.unshift(O[0].otherSE),t.push(new vi(O.reverse()));continue}S.push({index:h.length,point:o.point});const N=o.getLeftmostComparator(a);g=M.sort(N)[0].otherSE;break}t.push(new vi(h))}return t}getGeom(){let e=this.events[0].point;const t=[e];for(let h=1,b=this.events.length-1;h<b;h++){const S=this.events[h].point,M=this.events[h+1].point;Ze.orient(S,e,M)!==0&&(t.push(S),e=S)}if(t.length===1)return null;const n=t[0],r=t[1];Ze.orient(n,e,r)===0&&t.shift(),t.push(t[0]);const u=this.isExteriorRing()?1:-1,a=this.isExteriorRing()?0:t.length-1,o=this.isExteriorRing()?t.length:-1,g=[];for(let h=a;h!=o;h+=u)g.push([t[h].x.toNumber(),t[h].y.toNumber()]);return g}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(){var r,u;let e=this.events[0];for(let a=1,o=this.events.length;a<o;a++){const g=this.events[a];Be.compare(e,g)>0&&(e=g)}let t=e.segment.prevInResult(),n=t?t.prevInResult():null;for(;;){if(!t)return null;if(!n)return t.ringOut;if(n.ringOut!==t.ringOut)return((r=n.ringOut)==null?void 0:r.enclosingRing())!==t.ringOut?t.ringOut:(u=t.ringOut)==null?void 0:u.enclosingRing();t=n.prevInResult(),n=t?t.prevInResult():null}}},rn=class{constructor(i){P(this,"exteriorRing");P(this,"interiorRings");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,n=this.interiorRings.length;t<n;t++){const r=this.interiorRings[t].getGeom();r!==null&&e.push(r)}return e}},ts=class{constructor(i){P(this,"rings");P(this,"polys");this.rings=i,this.polys=this._composePolys(i)}getGeom(){const i=[];for(let e=0,t=this.polys.length;e<t;e++){const n=this.polys[e].getGeom();n!==null&&i.push(n)}return i}_composePolys(i){var t;const e=[];for(let n=0,r=i.length;n<r;n++){const u=i[n];if(!u.poly)if(u.isExteriorRing())e.push(new rn(u));else{const a=u.enclosingRing();a!=null&&a.poly||e.push(new rn(a)),(t=a==null?void 0:a.poly)==null||t.addInterior(u)}}return e}},is=class{constructor(i,e=Vt.compare){P(this,"queue");P(this,"tree");P(this,"segments");this.queue=i,this.tree=new zt(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 n=e,r=e;do n=this.tree.lastBefore(n);while(n!=null&&n.consumedBy!=null);do r=this.tree.firstAfter(r);while(r!=null&&r.consumedBy!=null);if(i.isLeft){let u=null;if(n){const o=n.getIntersection(e);if(o!==null&&(e.isAnEndpoint(o)||(u=o),!n.isAnEndpoint(o))){const g=this._splitSafely(n,o);for(let h=0,b=g.length;h<b;h++)t.push(g[h])}}let a=null;if(r){const o=r.getIntersection(e);if(o!==null&&(e.isAnEndpoint(o)||(a=o),!r.isAnEndpoint(o))){const g=this._splitSafely(r,o);for(let h=0,b=g.length;h<b;h++)t.push(g[h])}}if(u!==null||a!==null){let o=null;u===null?o=a:a===null?o=u:o=Be.comparePoints(u,a)<=0?u:a,this.queue.delete(e.rightSE),t.push(e.rightSE);const g=e.split(o);for(let h=0,b=g.length;h<b;h++)t.push(g[h])}t.length>0?(this.tree.delete(e),t.push(i)):(this.segments.push(e),e.prev=n)}else{if(n&&r){const u=n.getIntersection(r);if(u!==null){if(!n.isAnEndpoint(u)){const a=this._splitSafely(n,u);for(let o=0,g=a.length;o<g;o++)t.push(a[o])}if(!r.isAnEndpoint(u)){const a=this._splitSafely(r,u);for(let o=0,g=a.length;o<g;o++)t.push(a[o])}}}this.tree.delete(e)}return t}_splitSafely(i,e){this.tree.delete(i);const t=i.rightSE;this.queue.delete(t);const n=i.split(e);return n.push(t),i.consumedBy===void 0&&this.tree.add(i),n}},ns=class{constructor(){P(this,"type");P(this,"numMultiPolys")}run(i,e,t){_t.type=i;const n=[new on(e,!0)];for(let h=0,b=t.length;h<b;h++)n.push(new on(t[h],!1));if(_t.numMultiPolys=n.length,_t.type==="difference"){const h=n[0];let b=1;for(;b<n.length;)li(n[b].bbox,h.bbox)!==null?b++:n.splice(b,1)}if(_t.type==="intersection")for(let h=0,b=n.length;h<b;h++){const S=n[h];for(let M=h+1,k=n.length;M<k;M++)if(li(S.bbox,n[M].bbox)===null)return[]}const r=new zt(Be.compare);for(let h=0,b=n.length;h<b;h++){const S=n[h].getSweepEvents();for(let M=0,k=S.length;M<k;M++)r.add(S[M])}const u=new is(r);let a=null;for(r.size!=0&&(a=r.first(),r.delete(a));a;){const h=u.process(a);for(let b=0,S=h.length;b<S;b++){const M=h[b];M.consumedBy===void 0&&r.add(M)}r.size!=0?(a=r.first(),r.delete(a)):a=null}Ze.reset();const o=es.factory(u.segments);return new ts(o).getGeom()}},_t=new ns,qt=_t,rs=0,Vt=class Zt{constructor(e,t,n,r){P(this,"id");P(this,"leftSE");P(this,"rightSE");P(this,"rings");P(this,"windings");P(this,"ringOut");P(this,"consumedBy");P(this,"prev");P(this,"_prevInResult");P(this,"_beforeState");P(this,"_afterState");P(this,"_isInResult");this.id=++rs,this.leftSE=e,e.segment=this,e.otherSE=t,this.rightSE=t,t.segment=this,t.otherSE=e,this.rings=n,this.windings=r}static compare(e,t){const n=e.leftSE.point.x,r=t.leftSE.point.x,u=e.rightSE.point.x,a=t.rightSE.point.x;if(a.isLessThan(n))return 1;if(u.isLessThan(r))return-1;const o=e.leftSE.point.y,g=t.leftSE.point.y,h=e.rightSE.point.y,b=t.rightSE.point.y;if(n.isLessThan(r)){if(g.isLessThan(o)&&g.isLessThan(h))return 1;if(g.isGreaterThan(o)&&g.isGreaterThan(h))return-1;const S=e.comparePoint(t.leftSE.point);if(S<0)return 1;if(S>0)return-1;const M=t.comparePoint(e.rightSE.point);return M!==0?M:-1}if(n.isGreaterThan(r)){if(o.isLessThan(g)&&o.isLessThan(b))return-1;if(o.isGreaterThan(g)&&o.isGreaterThan(b))return 1;const S=t.comparePoint(e.leftSE.point);if(S!==0)return S;const M=e.comparePoint(t.rightSE.point);return M<0?1:M>0?-1:1}if(o.isLessThan(g))return-1;if(o.isGreaterThan(g))return 1;if(u.isLessThan(a)){const S=t.comparePoint(e.rightSE.point);if(S!==0)return S}if(u.isGreaterThan(a)){const S=e.comparePoint(t.rightSE.point);if(S<0)return 1;if(S>0)return-1}if(!u.eq(a)){const S=h.minus(o),M=u.minus(n),k=b.minus(g),N=a.minus(r);if(S.isGreaterThan(M)&&k.isLessThan(N))return 1;if(S.isLessThan(M)&&k.isGreaterThan(N))return-1}return u.isGreaterThan(a)?1:u.isLessThan(a)||h.isLessThan(b)?-1:h.isGreaterThan(b)?1:e.id<t.id?-1:e.id>t.id?1:0}static fromRing(e,t,n){let r,u,a;const o=Be.comparePoints(e,t);if(o<0)r=e,u=t,a=1;else if(o>0)r=t,u=e,a=-1;else throw new Error(`Tried to create degenerate segment at [${e.x}, ${e.y}]`);const g=new Be(r,!0),h=new Be(u,!1);return new Zt(g,h,[n],[a])}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 Ze.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){const t=this.bbox(),n=e.bbox(),r=li(t,n);if(r===null)return null;const u=this.leftSE.point,a=this.rightSE.point,o=e.leftSE.point,g=e.rightSE.point,h=St(t,o)&&this.comparePoint(o)===0,b=St(n,u)&&e.comparePoint(u)===0,S=St(t,g)&&this.comparePoint(g)===0,M=St(n,a)&&e.comparePoint(a)===0;if(b&&h)return M&&!S?a:!M&&S?g:null;if(b)return S&&u.x.eq(g.x)&&u.y.eq(g.y)?null:u;if(h)return M&&a.x.eq(o.x)&&a.y.eq(o.y)?null:o;if(M&&S)return null;if(M)return a;if(S)return g;const k=$r(u,this.vector(),o,e.vector());return k===null||!St(r,k)?null:Ze.snap(k)}split(e){const t=[],n=e.events!==void 0,r=new Be(e,!0),u=new Be(e,!1),a=this.rightSE;this.replaceRightSE(u),t.push(u),t.push(r);const o=new Zt(r,a,this.rings.slice(),this.windings.slice());return Be.comparePoints(o.leftSE.point,o.rightSE.point)>0&&o.swapEvents(),Be.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(r.checkForConsuming(),u.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,n=this.windings.length;t<n;t++)this.windings[t]*=-1}consume(e){let t=this,n=e;for(;t.consumedBy;)t=t.consumedBy;for(;n.consumedBy;)n=n.consumedBy;const r=Zt.compare(t,n);if(r!==0){if(r>0){const u=t;t=n,n=u}if(t.prev===n){const u=t;t=n,n=u}for(let u=0,a=n.rings.length;u<a;u++){const o=n.rings[u],g=n.windings[u],h=t.rings.indexOf(o);h===-1?(t.rings.push(o),t.windings.push(g)):t.windings[h]+=g}n.rings=null,n.windings=null,n.consumedBy=t,n.leftSE.consumedBy=t.leftSE,n.rightSE.consumedBy=t.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{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,n=this._afterState.windings,r=this._afterState.multiPolys;for(let o=0,g=this.rings.length;o<g;o++){const h=this.rings[o],b=this.windings[o],S=t.indexOf(h);S===-1?(t.push(h),n.push(b)):n[S]+=b}const u=[],a=[];for(let o=0,g=t.length;o<g;o++){if(n[o]===0)continue;const h=t[o],b=h.poly;if(a.indexOf(b)===-1)if(h.isExterior)u.push(b);else{a.indexOf(b)===-1&&a.push(b);const S=u.indexOf(h.poly);S!==-1&&u.splice(S,1)}}for(let o=0,g=u.length;o<g;o++){const h=u[o].multiPoly;r.indexOf(h)===-1&&r.push(h)}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(qt.type){case"union":{const n=e.length===0,r=t.length===0;this._isInResult=n!==r;break}case"intersection":{let n,r;e.length<t.length?(n=e.length,r=t.length):(n=t.length,r=e.length),this._isInResult=r===qt.numMultiPolys&&n<r;break}case"xor":{const n=Math.abs(e.length-t.length);this._isInResult=n%2===1;break}case"difference":{const n=r=>r.length===1&&r[0].isSubject;this._isInResult=n(e)!==n(t);break}}return this._isInResult}},sn=class{constructor(i,e,t){P(this,"poly");P(this,"isExterior");P(this,"segments");P(this,"bbox");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 n=Ze.snap({x:new Ge(i[0][0]),y:new Ge(i[0][1])});this.bbox={ll:{x:n.x,y:n.y},ur:{x:n.x,y:n.y}};let r=n;for(let u=1,a=i.length;u<a;u++){if(typeof i[u][0]!="number"||typeof i[u][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const o=Ze.snap({x:new Ge(i[u][0]),y:new Ge(i[u][1])});o.x.eq(r.x)&&o.y.eq(r.y)||(this.segments.push(Vt.fromRing(r,o,this)),o.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=o.x),o.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=o.y),o.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=o.x),o.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=o.y),r=o)}(!n.x.eq(r.x)||!n.y.eq(r.y))&&this.segments.push(Vt.fromRing(r,n,this))}getSweepEvents(){const i=[];for(let e=0,t=this.segments.length;e<t;e++){const n=this.segments[e];i.push(n.leftSE),i.push(n.rightSE)}return i}},ss=class{constructor(i,e){P(this,"multiPoly");P(this,"exteriorRing");P(this,"interiorRings");P(this,"bbox");if(!Array.isArray(i))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new sn(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,n=i.length;t<n;t++){const r=new sn(i[t],this,!1);r.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=r.bbox.ll.x),r.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=r.bbox.ll.y),r.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=r.bbox.ur.x),r.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=r.bbox.ur.y),this.interiorRings.push(r)}this.multiPoly=e}getSweepEvents(){const i=this.exteriorRing.getSweepEvents();for(let e=0,t=this.interiorRings.length;e<t;e++){const n=this.interiorRings[e].getSweepEvents();for(let r=0,u=n.length;r<u;r++)i.push(n[r])}return i}},on=class{constructor(i,e){P(this,"isSubject");P(this,"polys");P(this,"bbox");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,n=i.length;t<n;t++){const r=new ss(i[t],this);r.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=r.bbox.ll.x),r.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=r.bbox.ll.y),r.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=r.bbox.ur.x),r.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=r.bbox.ur.y),this.polys.push(r)}this.isSubject=e}getSweepEvents(){const i=[];for(let e=0,t=this.polys.length;e<t;e++){const n=this.polys[e].getSweepEvents();for(let r=0,u=n.length;r<u;r++)i.push(n[r])}return i}},os=(i,...e)=>qt.run("union",i,e),ls=(i,...e)=>qt.run("difference",i,e);Ze.set;function us(i){const e=[];if(ii(i,r=>{e.push(r.coordinates)}),e.length<2)throw new Error("Must have at least two features");const t=i.features[0].properties||{},n=ls(e[0],...e.slice(1));return n.length===0?null:n.length===1?ei(n[0],t):Hi(n,t)}var as=us;function fs(i){if(!i)throw new Error("geojson is required");var e=[];return Dr(i,function(t){e.push(t)}),ti(e)}var cs=fs;function hs(i,e={}){const t=[];if(ii(i,r=>{t.push(r.coordinates)}),t.length<2)throw new Error("Must have at least 2 geometries");const n=os(t[0],...t.slice(1));return n.length===0?null:n.length===1?ei(n[0],e.properties):Hi(n,e.properties)}var ds=hs;function ln(i,e){const t=as(ti([ei([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),i]));if(!t)return;t.properties={isMask:!0};const n=Gt(Ki(i)),r=(n[2]-n[0])/360/1e3,u=n[0]<-180,a=n[2]>180,o=cs(i);if(o.features.length>1&&(u||a))for(const g of o.features){const h=Gt(Ki(g));if(a&&h[0]<-180+r)for(const b of g.geometry.coordinates)for(const S of b)S[0]+=360-r;if(u&&h[2]>180-r)for(const b of g.geometry.coordinates)for(const S of b)S[0]-=360-r}e(ti([o.features.length<2?i:ds(o)??i,t]))}const un="EPSG:4326";function gs(i){var u;const e=i.getProperties(),{isMask:t}=e,n=(u=i.getGeometry())==null?void 0:u.getType(),r=t?0:n==="LineString"||n==="MultiLineString"?3:2;return new Rn({stroke:t?void 0:new wi({color:"#3170fe",lineDash:[r,r],width:r,lineCap:"butt"}),fill:t?new bi({color:"#00000020"}):void 0,image:new Pn({src:`/icons/marker_${e.isReverse?"reverse":e.isSelected?"selected":"unselected"}.svg`,anchor:[.5,1]}),zIndex:e.isSelected?2:e.isReverse?0:1,text:e.isSelected&&e.tooltip?new In({backgroundFill:new bi({color:"white"}),text:e.tooltip,offsetY:-40,backgroundStroke:new wi({color:"white",lineJoin:"round",width:3}),padding:[2,0,0,2]}):void 0})}function an(i,e={},t={},n=gs){let r=-1,u,a,o,g=!1;const h=new kn({updateWhileAnimating:!0});i.addLayer(h);const b=new On({});h.setSource(b),h.setStyle(n),i.on("click",N=>{i.forEachFeatureAtPixel(N.pixel,C=>{const O=C.getId();if(O)return N.stopPropagation(),a==null||a({type:"markerClick",id:O}),C})}),i.on("pointermove",N=>{const C=i.forEachFeatureAtPixel(N.pixel,O=>O.getId());u!==C&&(u&&(a==null||a({type:"markerMouseLeave",id:u})),C&&(a==null||a({type:"markerMouseEnter",id:C})),i.getTargetElement().style.cursor=C?"pointer":g?"crosshair":"",u=C)});function S(){return Qe.getUserProjection()??i.getView().getProjection()}function M(N){return N.transform(un,S())}const k=N=>{a==null||a({type:"mapClick",coordinates:Qe.toLonLat(N.coordinate,S())})};return{setEventHandler(N){N?(a=N,i.on("click",k)):(a=void 0,i.un("click",k))},flyTo(N,C){i.getView().animate({center:Qe.fromLonLat(N,S()),...C?{zoom:C}:{},duration:2e3,...e})},fitBounds(N,C,O){i.getView().fit(Qe.transformExtent(N,un,S()),{padding:[C,C,C,C],...O?{maxZoom:O}:{},duration:2e3,...t})},indicateReverse(N){g=N,i.getTargetElement().style.cursor=N?"crosshair":""},setReverseMarker(N){o?N?o.getGeometry().setCoordinates(Qe.fromLonLat(N,S())):(b.removeFeature(o),o.dispose(),o=void 0):N&&(o=new Te.Feature(new Me.Point(Qe.fromLonLat(N,S()))),o.setProperties({isReverse:!0}),b.addFeature(o))},setFeatures(N,C,O){function I(_){var R;if(_)for(const z of _.features){const Y=z.geometry.type==="Polygon"?new Me.Polygon(z.geometry.coordinates):z.geometry.type==="MultiPolygon"?new Me.MultiPolygon(z.geometry.coordinates):null;Y&&b.addFeature(new Te.Feature({isMask:!!((R=z.properties)!=null&&R.isMask),geometry:M(Y)}))}}b.clear(),o&&b.addFeature(o);e:if(C){let _=!1;if(C.geometry.type==="GeometryCollection"){const R=C.geometry.geometries.map(z=>z.type==="Polygon"?new Me.Polygon(z.coordinates):z.type==="MultiPolygon"?new Me.MultiPolygon(z.coordinates):null).filter(z=>!!z);if(R.length>0)b.addFeature(new Te.Feature(M(new Me.GeometryCollection(R)))),_=!0;else for(const z of C.geometry.geometries)z.type==="LineString"?(b.addFeature(new Te.Feature(M(new Me.LineString(z.coordinates)))),_=!0):z.type==="MultiLineString"&&b.addFeature(new Te.Feature(M(new Me.MultiLineString(z.coordinates)))),_=!0}if(!_){if(C.geometry.type==="Polygon")ln(C,I);else if(C.geometry.type==="MultiPolygon")ln(C,I);else if(C.geometry.type==="LineString"){b.addFeature(new Te.Feature(M(new Me.LineString(C.geometry.coordinates))));break e}else if(C.geometry.type==="MultiLineString"){b.addFeature(new Te.Feature(M(new Me.MultiLineString(C.geometry.coordinates))));break e}}if(!O&&!C.geometry.type.endsWith("Point"))break e;b.addFeature(new Te.Feature(M(new Me.Point(C.center))))}for(const _ of N??[]){if(_===C)continue;const R=new Te.Feature(new Me.Point(Qe.fromLonLat(_.center,S())));R.setId(_.id),R.setProperties({fuzzy:!!_.matching_text,tooltip:_.place_type[0]==="reverse"?_.place_name:_.place_name.replace(/,.*/,"")}),b.addFeature(R)}},setSelectedMarker(N){var I,_,R;const C=b.getFeatures(),O=(I=C[0])!=null&&I.getProperties().isReverse?1:0;r>-1&&((_=C[r+O])==null||_.setProperties({isSelected:!1})),N>-1&&((R=C[N+O])==null||R.setProperties({isSelected:!0})),r=N},getCenterAndZoom(){const N=i.getView(),C=N.getCenter(),O=N.getZoom();if(!(!C||O===void 0))return[O,...Qe.toLonLat(C,S())]}}}class ms extends $.Control{constructor(t){const n=document.createElement("div");n.className="ol-search";super({element:n,target:t.target});yi(this,fe);yi(this,lt);const{flyTo:r,fullGeometryStyle:u,...a}=t;pi(this,fe,new zr({target:n,props:{flyTo:r===void 0?!0:!!r,...a}})),he(this,fe).$on("select",o=>{this.dispatchEvent(new fn(o.detail.feature))}),he(this,fe).$on("pick",o=>{this.dispatchEvent(new gn(o.detail.feature))}),he(this,fe).$on("featureslisted",o=>{this.dispatchEvent(new cn(o.detail.features))}),he(this,fe).$on("featuresmarked",o=>{this.dispatchEvent(new hn(o.detail.features))}),he(this,fe).$on("response",o=>{this.dispatchEvent(new yn(o.detail.url,o.detail.featureCollection))}),he(this,fe).$on("optionsvisibilitychange",o=>{this.dispatchEvent(new dn(o.detail.optionsVisible))}),he(this,fe).$on("reversetoggle",o=>{this.dispatchEvent(new pn(o.detail.reverse))}),he(this,fe).$on("querychange",o=>{this.dispatchEvent(new mn(o.detail.query))}),pi(this,lt,t)}setMap(t){var n;if(super.setMap(t),t){const{flyTo:r,fullGeometryStyle:u}=he(this,lt),a=an(t,typeof r=="boolean"?void 0:r,typeof r=="boolean"?void 0:r,u);(n=he(this,fe))==null||n.$set({mapController:a})}}setOptions(t){var a;Object.assign(he(this,lt),t);const{flyTo:n,fullGeometryStyle:r,...u}=he(this,lt);(a=he(this,fe))==null||a.$set({...u,flyTo:n===void 0?!0:!!n})}setQuery(t,n=!0){var r;(r=he(this,fe))==null||r.setQuery(t,n)}clearMap(){var t;(t=he(this,fe))==null||t.clearMap()}clearList(){var t;(t=he(this,fe))==null||t.clearList()}setReverseMode(t){var n;(n=he(this,fe))==null||n.$set({reverseActive:t})}focus(t){var n;(n=he(this,fe))==null||n.focus(t)}blur(){var t;(t=he(this,fe))==null||t.blur()}}fe=new WeakMap,lt=new WeakMap;class fn extends ie{constructor(t){super("select");P(this,"feature");this.feature=t}}class cn extends ie{constructor(t){super("featureslisted");P(this,"features");this.features=t}}class hn extends ie{constructor(t){super("featuresmarked");P(this,"features");this.features=t}}class dn extends ie{constructor(t){super("optionsvisibilitychange");P(this,"optionsVisible");this.optionsVisible=t}}class gn extends ie{constructor(t){super("pick");P(this,"feature");this.feature=t}}class mn extends ie{constructor(t){super("querychange");P(this,"query");this.query=t}}class yn extends ie{constructor(t,n){super("response");P(this,"url");P(this,"featureCollection");this.url=t,this.featureCollection=n}}class pn extends ie{constructor(t){super("reversetoggle");P(this,"reverse");this.reverse=t}}F.FeaturesListedEvent=cn,F.FeaturesMarkedEvent=hn,F.GeocodingControl=ms,F.OptionsVisibilityChangeEvent=dn,F.PickEvent=gn,F.QueryChangeEvent=mn,F.ResponseEvent=yn,F.ReverseToggleEvent=pn,F.SelectEvent=fn,F.createOpenLayersMapController=an,Object.defineProperty(F,Symbol.toStringTag,{value:"Module"})});
|
|
14
14
|
//# sourceMappingURL=openlayers.umd.js.map
|