@eodash/eodash 5.0.0-alpha → 5.0.0-alpha.1.1

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.
Files changed (66) hide show
  1. package/bin/app.js +16 -147
  2. package/bin/cli.js +57 -0
  3. package/bin/serverConfig.js +134 -0
  4. package/bin/update.js +17 -0
  5. package/bin/utils.js +33 -0
  6. package/core/App.vue +21 -0
  7. package/core/components/DashboardLayout.vue +58 -0
  8. package/core/components/DynamicWebComponent.vue +68 -0
  9. package/core/components/Footer.vue +31 -0
  10. package/core/components/Header.vue +38 -0
  11. package/core/components/IframeWrapper.vue +11 -0
  12. package/core/components/MobileLayout.vue +79 -0
  13. package/core/composables/DefineConfig.js +44 -0
  14. package/core/composables/DefineWidgets.js +118 -0
  15. package/core/composables/index.js +147 -0
  16. package/core/eodashConfig.js +136 -0
  17. package/core/main.js +4 -0
  18. package/core/plugins/index.js +27 -0
  19. package/core/plugins/router.js +20 -0
  20. package/core/plugins/vuetify.js +27 -0
  21. package/core/render.js +13 -0
  22. package/core/store/Actions.js +28 -0
  23. package/core/store/Keys.js +6 -0
  24. package/core/store/States.js +12 -0
  25. package/core/store/index.js +23 -0
  26. package/core/store/stac.js +61 -0
  27. package/core/types.d.ts +333 -0
  28. package/core/views/Dashboard.vue +49 -0
  29. package/core/vite-env.d.ts +35 -0
  30. package/package.json +20 -21
  31. package/widgets/WidgetsContainer.vue +46 -0
  32. package/dist/.gitkeep +0 -0
  33. package/dist/assets/Dashboard-4233cc52.css +0 -1
  34. package/dist/assets/Dashboard-d7d438a6.js +0 -1
  35. package/dist/assets/DashboardLayout-5ab6c4a5.js +0 -29
  36. package/dist/assets/DashboardLayout-739135c5.css +0 -1
  37. package/dist/assets/DynamicWebComponent-1b7b527a.js +0 -1
  38. package/dist/assets/Footer-0fe1887a.css +0 -1
  39. package/dist/assets/Footer-7e1ca735.js +0 -1
  40. package/dist/assets/Header-9cac598d.css +0 -1
  41. package/dist/assets/Header-ae17296c.js +0 -1
  42. package/dist/assets/IframeWrapper-b2c05ffd.js +0 -1
  43. package/dist/assets/MobileLayout-1b3cb89b.js +0 -1
  44. package/dist/assets/MobileLayout-ad647682.css +0 -1
  45. package/dist/assets/VMain-d6216866.css +0 -1
  46. package/dist/assets/VMain-f6b3f120.js +0 -1
  47. package/dist/assets/WidgetsContainer-cdad3d50.js +0 -1
  48. package/dist/assets/color-6039ab34.js +0 -1
  49. package/dist/assets/eox-chart-3b122ba4.js +0 -142
  50. package/dist/assets/eox-itemfilter-a63da0da.js +0 -981
  51. package/dist/assets/eox-jsonform-98c2af62.js +0 -239
  52. package/dist/assets/eox-layercontrol-f5e35702.js +0 -1126
  53. package/dist/assets/eox-map-7f82b0d4.js +0 -178
  54. package/dist/assets/eox-stacinfo-65a8d8f3.js +0 -388
  55. package/dist/assets/eox-timecontrol-4be63aa2.js +0 -237
  56. package/dist/assets/index-52c9d989.js +0 -34
  57. package/dist/assets/index-5d2400e5.css +0 -5
  58. package/dist/assets/materialdesignicons-webfont-48d3eec6.woff +0 -0
  59. package/dist/assets/materialdesignicons-webfont-861aea05.eot +0 -0
  60. package/dist/assets/materialdesignicons-webfont-bd725a7a.ttf +0 -0
  61. package/dist/assets/materialdesignicons-webfont-e52d60f6.woff2 +0 -0
  62. package/dist/assets/ssrBoot-0b8754a9.css +0 -1
  63. package/dist/assets/ssrBoot-d383eb61.js +0 -1
  64. package/dist/assets/webfontloader-523643f5.js +0 -1
  65. package/dist/index.html +0 -17
  66. package/dist/types/index.d.ts +0 -124
@@ -1,178 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */const Yn=globalThis,$o=Yn.ShadowRoot&&(Yn.ShadyCSS===void 0||Yn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,bh=Symbol(),ol=new WeakMap;let Uu=class{constructor(s,t,e){if(this._$cssResult$=!0,e!==bh)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=s,this.t=t}get styleSheet(){let s=this.o;const t=this.t;if($o&&s===void 0){const e=t!==void 0&&t.length===1;e&&(s=ol.get(t)),s===void 0&&((this.o=s=new CSSStyleSheet).replaceSync(this.cssText),e&&ol.set(t,s))}return s}toString(){return this.cssText}};const $u=s=>new Uu(typeof s=="string"?s:s+"",void 0,bh),Xu=(s,t)=>{if($o)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const i=document.createElement("style"),n=Yn.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=e.cssText,s.appendChild(i)}},al=$o?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return $u(e)})(s):s;/**
6
- * @license
7
- * Copyright 2017 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:Yu,defineProperty:Ku,getOwnPropertyDescriptor:Hu,getOwnPropertyNames:Zu,getOwnPropertySymbols:qu,getPrototypeOf:Ju}=Object,es=globalThis,ll=es.trustedTypes,Qu=ll?ll.emptyScript:"",hl=es.reactiveElementPolyfillSupport,Ds=(s,t)=>s,Kn={toAttribute(s,t){switch(t){case Boolean:s=s?Qu:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},Xo=(s,t)=>!Yu(s,t),cl={attribute:!0,type:String,converter:Kn,reflect:!1,hasChanged:Xo};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),es.litPropertyMetadata??(es.litPropertyMetadata=new WeakMap);class Vi extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=cl){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(t,i,e);n!==void 0&&Ku(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){const{get:n,set:r}=Hu(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o}};return{get(){return n==null?void 0:n.call(this)},set(o){const a=n==null?void 0:n.call(this);r.call(this,o),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??cl}static _$Ei(){if(this.hasOwnProperty(Ds("elementProperties")))return;const t=Ju(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Ds("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ds("properties"))){const e=this.properties,i=[...Zu(e),...qu(e)];for(const n of i)this.createProperty(n,e[n])}const t=this[Symbol.metadata];if(t!==null){const e=litPropertyMetadata.get(t);if(e!==void 0)for(const[i,n]of e)this.elementProperties.set(i,n)}this._$Eh=new Map;for(const[e,i]of this.elementProperties){const n=this._$Eu(e,i);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const n of i)e.unshift(al(n))}else t!==void 0&&e.push(al(t));return e}static _$Eu(t,e){const i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$Eg=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e;(this._$ES??(this._$ES=[])).push(t),this.renderRoot!==void 0&&this.isConnected&&((e=t.hostConnected)==null||e.call(t))}removeController(t){var e;(e=this._$ES)==null||e.splice(this._$ES.indexOf(t)>>>0,1)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Xu(t,this.constructor.elementStyles),t}connectedCallback(){var t;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)==null||t.forEach(e=>{var i;return(i=e.hostConnected)==null?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)==null||t.forEach(e=>{var i;return(i=e.hostDisconnected)==null?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e){var i;const n=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,n);if(r!==void 0&&n.reflect===!0){const o=(((i=n.converter)==null?void 0:i.toAttribute)!==void 0?n.converter:Kn).toAttribute(e,n.type);this._$Em=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,e){var i;const n=this.constructor,r=n._$Eh.get(t);if(r!==void 0&&this._$Em!==r){const o=n.getPropertyOptions(r),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)==null?void 0:i.fromAttribute)!==void 0?o.converter:Kn;this._$Em=r,this[r]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,i,n=!1,r){if(t!==void 0){if(i??(i=this.constructor.getPropertyOptions(t)),!(i.hasChanged??Xo)(n?r:this[t],e))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,i){this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this._$Ep){for(const[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[r,o]of n)o.wrapped!==!0||this._$AL.has(r)||this[r]===void 0||this.C(r,this[r],o)}let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),(t=this._$ES)==null||t.forEach(n=>{var r;return(r=n.hostUpdate)==null?void 0:r.call(n)}),this.update(i)):this._$ET()}catch(n){throw e=!1,this._$ET(),n}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)==null||e.forEach(i=>{var n;return(n=i.hostUpdated)==null?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EO(e,this[e]))),this._$ET()}updated(t){}firstUpdated(t){}}Vi.elementStyles=[],Vi.shadowRootOptions={mode:"open"},Vi[Ds("elementProperties")]=new Map,Vi[Ds("finalized")]=new Map,hl==null||hl({ReactiveElement:Vi}),(es.reactiveElementVersions??(es.reactiveElementVersions=[])).push("2.0.1");/**
10
- * @license
11
- * Copyright 2017 Google LLC
12
- * SPDX-License-Identifier: BSD-3-Clause
13
- */const Hn=globalThis,Zn=Hn.trustedTypes,ul=Zn?Zn.createPolicy("lit-html",{createHTML:s=>s}):void 0,Ih="$lit$",Ke=`lit$${(Math.random()+"").slice(9)}$`,Ph="?"+Ke,td=`<${Ph}>`,Ei=document,zs=()=>Ei.createComment(""),Ws=s=>s===null||typeof s!="object"&&typeof s!="function",Mh=Array.isArray,ed=s=>Mh(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",Kr=`[
14
- \f\r]`,Ts=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,dl=/-->/g,gl=/>/g,ci=RegExp(`>|${Kr}(?:([^\\s"'>=/]+)(${Kr}*=${Kr}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),pl=/'/g,fl=/"/g,Lh=/^(?:script|style|textarea|title)$/i,id=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),Zi=id(1),is=Symbol.for("lit-noChange"),ft=Symbol.for("lit-nothing"),_l=new WeakMap,fi=Ei.createTreeWalker(Ei,129);function Ah(s,t){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return ul!==void 0?ul.createHTML(t):t}const sd=(s,t)=>{const e=s.length-1,i=[];let n,r=t===2?"<svg>":"",o=Ts;for(let a=0;a<e;a++){const l=s[a];let h,c,u=-1,d=0;for(;d<l.length&&(o.lastIndex=d,c=o.exec(l),c!==null);)d=o.lastIndex,o===Ts?c[1]==="!--"?o=dl:c[1]!==void 0?o=gl:c[2]!==void 0?(Lh.test(c[2])&&(n=RegExp("</"+c[2],"g")),o=ci):c[3]!==void 0&&(o=ci):o===ci?c[0]===">"?(o=n??Ts,u=-1):c[1]===void 0?u=-2:(u=o.lastIndex-c[2].length,h=c[1],o=c[3]===void 0?ci:c[3]==='"'?fl:pl):o===fl||o===pl?o=ci:o===dl||o===gl?o=Ts:(o=ci,n=void 0);const g=o===ci&&s[a+1].startsWith("/>")?" ":"";r+=o===Ts?l+td:u>=0?(i.push(h),l.slice(0,u)+Ih+l.slice(u)+Ke+g):l+Ke+(u===-2?a:g)}return[Ah(s,r+(s[e]||"<?>")+(t===2?"</svg>":"")),i]};class Bs{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,o=0;const a=t.length-1,l=this.parts,[h,c]=sd(t,e);if(this.el=Bs.createElement(h,i),fi.currentNode=this.el.content,e===2){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(n=fi.nextNode())!==null&&l.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(const u of n.getAttributeNames())if(u.endsWith(Ih)){const d=c[o++],g=n.getAttribute(u).split(Ke),p=/([.?@])?(.*)/.exec(d);l.push({type:1,index:r,name:p[2],strings:g,ctor:p[1]==="."?rd:p[1]==="?"?od:p[1]==="@"?ad:Sr}),n.removeAttribute(u)}else u.startsWith(Ke)&&(l.push({type:6,index:r}),n.removeAttribute(u));if(Lh.test(n.tagName)){const u=n.textContent.split(Ke),d=u.length-1;if(d>0){n.textContent=Zn?Zn.emptyScript:"";for(let g=0;g<d;g++)n.append(u[g],zs()),fi.nextNode(),l.push({type:2,index:++r});n.append(u[d],zs())}}}else if(n.nodeType===8)if(n.data===Ph)l.push({type:2,index:r});else{let u=-1;for(;(u=n.data.indexOf(Ke,u+1))!==-1;)l.push({type:7,index:r}),u+=Ke.length-1}r++}}static createElement(t,e){const i=Ei.createElement("template");return i.innerHTML=t,i}}function ss(s,t,e=s,i){var n,r;if(t===is)return t;let o=i!==void 0?(n=e._$Co)==null?void 0:n[i]:e._$Cl;const a=Ws(t)?void 0:t._$litDirective$;return(o==null?void 0:o.constructor)!==a&&((r=o==null?void 0:o._$AO)==null||r.call(o,!1),a===void 0?o=void 0:(o=new a(s),o._$AT(s,e,i)),i!==void 0?(e._$Co??(e._$Co=[]))[i]=o:e._$Cl=o),o!==void 0&&(t=ss(s,o._$AS(s,t.values),o,i)),t}class nd{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,n=((t==null?void 0:t.creationScope)??Ei).importNode(e,!0);fi.currentNode=n;let r=fi.nextNode(),o=0,a=0,l=i[0];for(;l!==void 0;){if(o===l.index){let h;l.type===2?h=new on(r,r.nextSibling,this,t):l.type===1?h=new l.ctor(r,l.name,l.strings,this,t):l.type===6&&(h=new ld(r,this,t)),this._$AV.push(h),l=i[++a]}o!==(l==null?void 0:l.index)&&(r=fi.nextNode(),o++)}return fi.currentNode=Ei,n}p(t){let e=0;for(const i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class on{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this._$Cv}constructor(t,e,i,n){this.type=2,this._$AH=ft,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cv=(n==null?void 0:n.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=ss(this,t,e),Ws(t)?t===ft||t==null||t===""?(this._$AH!==ft&&this._$AR(),this._$AH=ft):t!==this._$AH&&t!==is&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):ed(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==ft&&Ws(this._$AH)?this._$AA.nextSibling.data=t:this.$(Ei.createTextNode(t)),this._$AH=t}g(t){var e;const{values:i,_$litType$:n}=t,r=typeof n=="number"?this._$AC(t):(n.el===void 0&&(n.el=Bs.createElement(Ah(n.h,n.h[0]),this.options)),n);if(((e=this._$AH)==null?void 0:e._$AD)===r)this._$AH.p(i);else{const o=new nd(r,this),a=o.u(this.options);o.p(i),this.$(a),this._$AH=o}}_$AC(t){let e=_l.get(t.strings);return e===void 0&&_l.set(t.strings,e=new Bs(t)),e}T(t){Mh(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const r of t)n===e.length?e.push(i=new on(this.k(zs()),this.k(zs()),this,this.options)):i=e[n],i._$AI(r),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)==null?void 0:i.call(this,!1,!0,e);t&&t!==this._$AB;){const n=t.nextSibling;t.remove(),t=n}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}}class Sr{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,n,r){this.type=1,this._$AH=ft,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=r,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=ft}_$AI(t,e=this,i,n){const r=this.strings;let o=!1;if(r===void 0)t=ss(this,t,e,0),o=!Ws(t)||t!==this._$AH&&t!==is,o&&(this._$AH=t);else{const a=t;let l,h;for(t=r[0],l=0;l<r.length-1;l++)h=ss(this,a[i+l],e,l),h===is&&(h=this._$AH[l]),o||(o=!Ws(h)||h!==this._$AH[l]),h===ft?t=ft:t!==ft&&(t+=(h??"")+r[l+1]),this._$AH[l]=h}o&&!n&&this.O(t)}O(t){t===ft?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class rd extends Sr{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===ft?void 0:t}}class od extends Sr{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==ft)}}class ad extends Sr{constructor(t,e,i,n,r){super(t,e,i,n,r),this.type=5}_$AI(t,e=this){if((t=ss(this,t,e,0)??ft)===is)return;const i=this._$AH,n=t===ft&&i!==ft||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==ft&&(i===ft||n);n&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class ld{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){ss(this,t)}}const ml=Hn.litHtmlPolyfillSupport;ml==null||ml(Bs,on),(Hn.litHtmlVersions??(Hn.litHtmlVersions=[])).push("3.1.0");const Fh=(s,t,e)=>{const i=(e==null?void 0:e.renderBefore)??t;let n=i._$litPart$;if(n===void 0){const r=(e==null?void 0:e.renderBefore)??null;i._$litPart$=n=new on(t.insertBefore(zs(),r),r,void 0,e??{})}return n._$AI(s),n};/**
16
- * @license
17
- * Copyright 2017 Google LLC
18
- * SPDX-License-Identifier: BSD-3-Clause
19
- */class qi extends Vi{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Fh(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return is}}var yl;qi._$litElement$=!0,qi.finalized=!0,(yl=globalThis.litElementHydrateSupport)==null||yl.call(globalThis,{LitElement:qi});const vl=globalThis.litElementPolyfillSupport;vl==null||vl({LitElement:qi});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.1");/**
20
- * @license
21
- * Copyright 2017 Google LLC
22
- * SPDX-License-Identifier: BSD-3-Clause
23
- */const hd=s=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(s,t)}):customElements.define(s,t)};/**
24
- * @license
25
- * Copyright 2017 Google LLC
26
- * SPDX-License-Identifier: BSD-3-Clause
27
- */const cd={attribute:!0,type:String,converter:Kn,reflect:!1,hasChanged:Xo},ud=(s=cd,t,e)=>{const{kind:i,metadata:n}=e;let r=globalThis.litPropertyMetadata.get(n);if(r===void 0&&globalThis.litPropertyMetadata.set(n,r=new Map),r.set(e.name,s),i==="accessor"){const{name:o}=e;return{set(a){const l=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,l,s)},init(a){return a!==void 0&&this.C(o,void 0,s),a}}}if(i==="setter"){const{name:o}=e;return function(a){const l=this[o];t.call(this,a),this.requestUpdate(o,l,s)}}throw Error("Unsupported decorator location: "+i)};function Ne(s){return(t,e)=>typeof e=="object"?ud(s,t,e):((i,n,r)=>{const o=n.hasOwnProperty(r);return n.constructor.createProperty(r,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(n,r):void 0})(s,t,e)}/**
28
- * @license
29
- * Copyright 2017 Google LLC
30
- * SPDX-License-Identifier: BSD-3-Clause
31
- */function Tr(s){return Ne({...s,state:!0,attribute:!1})}class dd{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}function gd(s){s.stopPropagation()}const Zt=dd,Ci={PROPERTYCHANGE:"propertychange"};class pd{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}const Yo=pd;function fd(s,t,e){let i,n;e=e||ii;let r=0,o=s.length,a=!1;for(;r<o;)i=r+(o-r>>1),n=+e(s[i],t),n<0?r=i+1:(o=i,a=!n);return a?r:~r}function ii(s,t){return s>t?1:s<t?-1:0}function Rr(s,t,e){if(s[0]<=t)return 0;const i=s.length;if(t<=s[i-1])return i-1;if(typeof e=="function"){for(let n=1;n<i;++n){const r=s[n];if(r===t)return n;if(r<t)return e(t,s[n-1],r)>0?n-1:n}return i-1}if(e>0){for(let n=1;n<i;++n)if(s[n]<t)return n-1;return i-1}if(e<0){for(let n=1;n<i;++n)if(s[n]<=t)return n;return i-1}for(let n=1;n<i;++n){if(s[n]==t)return n;if(s[n]<t)return s[n-1]-t<t-s[n]?n-1:n}return i-1}function _d(s,t,e){for(;t<e;){const i=s[t];s[t]=s[e],s[e]=i,++t,--e}}function ue(s,t){const e=Array.isArray(t)?t:[t],i=e.length;for(let n=0;n<i;n++)s[s.length]=e[n]}function Ge(s,t){const e=s.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(s[i]!==t[i])return!1;return!0}function md(s,t,e){const i=t||ii;return s.every(function(n,r){if(r===0)return!0;const o=i(s[r-1],n);return!(o>0||e&&o===0)})}function ns(){return!0}function fs(){return!1}function rs(){}function Oh(s){let t=!1,e,i,n;return function(){const r=Array.prototype.slice.call(arguments);return(!t||this!==n||!Ge(r,i))&&(t=!0,n=this,i=r,e=s.apply(this,arguments)),e}}function yd(s){function t(){let e;try{e=s()}catch(i){return Promise.reject(i)}return e instanceof Promise?e:Promise.resolve(e)}return t()}function an(s){for(const t in s)delete s[t]}function si(s){let t;for(t in s)return!1;return!t}class vd extends Yo{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e=typeof t=="string",i=e?t:t.type,n=this.listeners_&&this.listeners_[i];if(!n)return;const r=e?new Zt(t):t;r.target||(r.target=this.eventTarget_||this);const o=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});i in o||(o[i]=0,a[i]=0),++o[i];let l;for(let h=0,c=n.length;h<c;++h)if("handleEvent"in n[h]?l=n[h].handleEvent(r):l=n[h].call(this,r),l===!1||r.propagationStopped){l=!1;break}if(--o[i]===0){let h=a[i];for(delete a[i];h--;)this.removeEventListener(i,rs);delete o[i]}return l}disposeInternal(){this.listeners_&&an(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return this.listeners_?t?t in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);n!==-1&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=rs,++this.pendingRemovals_[t]):(i.splice(n,1),i.length===0&&delete this.listeners_[t]))}}const ln=vd,O={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};function W(s,t,e,i,n){if(i&&i!==s&&(e=e.bind(i)),n){const o=e;e=function(){s.removeEventListener(t,e),o.apply(this,arguments)}}const r={target:s,type:t,listener:e};return s.addEventListener(t,e),r}function Us(s,t,e,i){return W(s,t,e,i,!0)}function et(s){s&&s.target&&(s.target.removeEventListener(s.type,s.listener),an(s))}class br extends ln{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(O.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=W(this,t[r],e);return n}return W(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let r=0;r<n;++r)i[r]=Us(this,t[r],e)}else i=Us(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)xd(i);else if(Array.isArray(t))for(let n=0,r=t.length;n<r;++n)this.removeEventListener(t[n],e);else this.removeEventListener(t,e)}}br.prototype.on;br.prototype.once;br.prototype.un;function xd(s){if(Array.isArray(s))for(let t=0,e=s.length;t<e;++t)et(s[t]);else et(s)}const Dh=br;function N(){throw new Error("Unimplemented abstract method.")}let Ed=0;function D(s){return s.ol_uid||(s.ol_uid=String(++Ed))}class xl extends Zt{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class Cd extends Dh{constructor(t){super(),this.on,this.once,this.un,D(this),this.values_=null,t!==void 0&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new xl(i,t,e)),i=Ci.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new xl(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const r=n[t];n[t]=e,r!==e&&this.notify(t,r)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],si(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}const se=Cd,Et={ADD:"add",REMOVE:"remove"},El={LENGTH:"length"};class Pn extends Zt{constructor(t,e,i){super(t),this.element=e,this.index=i}}class wd extends se{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let i=0,n=this.array_.length;i<n;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(El.LENGTH)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new Pn(Et.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i<n;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new Pn(Et.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i){this.insertAt(t,e);return}if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const n=this.array_[t];this.array_[t]=e,this.dispatchEvent(new Pn(Et.REMOVE,n,t)),this.dispatchEvent(new Pn(Et.ADD,e,t))}updateLength_(){this.set(El.LENGTH,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;i<n;++i)if(this.array_[i]===t&&i!==e)throw new Error("Duplicate item added to a unique collection")}}const Rt=wd,ni=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Sd=ni.includes("firefox"),Td=ni.includes("safari")&&!ni.includes("chrom");Td&&(ni.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(ni));const Rd=ni.includes("webkit")&&!ni.includes("edge"),Ko=ni.includes("macintosh"),kh=typeof devicePixelRatio<"u"?devicePixelRatio:1,Ho=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,Zo=typeof Image<"u"&&Image.prototype.decode,bd=typeof createImageBitmap=="function",Nh=function(){let s=!1;try{const t=Object.defineProperty({},"passive",{get:function(){s=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return s}();function H(s,t){if(!s)throw new Error(t)}const Gh=new Array(6);function Yt(){return[1,0,0,1,0,0]}function Cl(s){return Ir(s,1,0,0,1,0,0)}function qo(s,t){const e=s[0],i=s[1],n=s[2],r=s[3],o=s[4],a=s[5],l=t[0],h=t[1],c=t[2],u=t[3],d=t[4],g=t[5];return s[0]=e*l+n*h,s[1]=i*l+r*h,s[2]=e*c+n*u,s[3]=i*c+r*u,s[4]=e*d+n*g+o,s[5]=i*d+r*g+a,s}function Ir(s,t,e,i,n,r,o){return s[0]=t,s[1]=e,s[2]=i,s[3]=n,s[4]=r,s[5]=o,s}function Id(s,t){return s[0]=t[0],s[1]=t[1],s[2]=t[2],s[3]=t[3],s[4]=t[4],s[5]=t[5],s}function gt(s,t){const e=t[0],i=t[1];return t[0]=s[0]*e+s[2]*i+s[4],t[1]=s[1]*e+s[3]*i+s[5],t}function Hr(s,t,e){return qo(s,Ir(Gh,t,0,0,e,0,0))}function Pd(s,t,e){return Ir(s,t,0,0,e,0,0)}function Md(s,t,e){return qo(s,Ir(Gh,1,0,0,1,t,e))}function ie(s,t,e,i,n,r,o,a){const l=Math.sin(r),h=Math.cos(r);return s[0]=i*h,s[1]=n*l,s[2]=-i*l,s[3]=n*h,s[4]=o*i*h-a*i*l+t,s[5]=o*n*l+a*n*h+e,s}function Pr(s,t){const e=Ld(t);H(e!==0,"Transformation matrix cannot be inverted");const i=t[0],n=t[1],r=t[2],o=t[3],a=t[4],l=t[5];return s[0]=o/e,s[1]=-n/e,s[2]=-r/e,s[3]=i/e,s[4]=(r*l-o*a)/e,s[5]=-(i*l-n*a)/e,s}function Ld(s){return s[0]*s[3]-s[1]*s[2]}let wl;function Jo(s){const t="matrix("+s.join(", ")+")";if(Ho)return t;const e=wl||(wl=document.createElement("div"));return e.style.transform=t,e.style.transform}const pt={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Lt(s){const t=Vt();for(let e=0,i=s.length;e<i;++e)Ns(t,s[e]);return t}function Kt(s,t,e){return e?(e[0]=s[0]-t,e[1]=s[1]-t,e[2]=s[2]+t,e[3]=s[3]+t,e):[s[0]-t,s[1]-t,s[2]+t,s[3]+t]}function jh(s,t){return t?(t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t):s.slice()}function Si(s,t,e){let i,n;return t<s[0]?i=s[0]-t:s[2]<t?i=t-s[2]:i=0,e<s[1]?n=s[1]-e:s[3]<e?n=e-s[3]:n=0,i*i+n*n}function hn(s,t){return Qo(s,t[0],t[1])}function Xt(s,t){return s[0]<=t[0]&&t[2]<=s[2]&&s[1]<=t[1]&&t[3]<=s[3]}function Qo(s,t,e){return s[0]<=t&&t<=s[2]&&s[1]<=e&&e<=s[3]}function wo(s,t){const e=s[0],i=s[1],n=s[2],r=s[3],o=t[0],a=t[1];let l=pt.UNKNOWN;return o<e?l=l|pt.LEFT:o>n&&(l=l|pt.RIGHT),a<i?l=l|pt.BELOW:a>r&&(l=l|pt.ABOVE),l===pt.UNKNOWN&&(l=pt.INTERSECTING),l}function Vt(){return[1/0,1/0,-1/0,-1/0]}function De(s,t,e,i,n){return n?(n[0]=s,n[1]=t,n[2]=e,n[3]=i,n):[s,t,e,i]}function cn(s){return De(1/0,1/0,-1/0,-1/0,s)}function ks(s,t){const e=s[0],i=s[1];return De(e,i,e,i,t)}function ta(s,t,e,i,n){const r=cn(n);return zh(r,s,t,e,i)}function ri(s,t){return s[0]==t[0]&&s[2]==t[2]&&s[1]==t[1]&&s[3]==t[3]}function Vh(s,t){return t[0]<s[0]&&(s[0]=t[0]),t[2]>s[2]&&(s[2]=t[2]),t[1]<s[1]&&(s[1]=t[1]),t[3]>s[3]&&(s[3]=t[3]),s}function Ns(s,t){t[0]<s[0]&&(s[0]=t[0]),t[0]>s[2]&&(s[2]=t[0]),t[1]<s[1]&&(s[1]=t[1]),t[1]>s[3]&&(s[3]=t[1])}function zh(s,t,e,i,n){for(;e<i;e+=n)Ad(s,t[e],t[e+1]);return s}function Ad(s,t,e){s[0]=Math.min(s[0],t),s[1]=Math.min(s[1],e),s[2]=Math.max(s[2],t),s[3]=Math.max(s[3],e)}function ea(s,t){let e;return e=t(os(s)),e||(e=t(_s(s)),e)||(e=t(un(s)),e)||(e=t(me(s)),e)?e:!1}function So(s){let t=0;return ms(s)||(t=J(s)*_t(s)),t}function os(s){return[s[0],s[1]]}function _s(s){return[s[2],s[1]]}function fe(s){return[(s[0]+s[2])/2,(s[1]+s[3])/2]}function Fd(s,t){let e;if(t==="bottom-left")e=os(s);else if(t==="bottom-right")e=_s(s);else if(t==="top-left")e=me(s);else if(t==="top-right")e=un(s);else throw new Error("Invalid corner");return e}function $s(s,t,e,i,n){const[r,o,a,l,h,c,u,d]=To(s,t,e,i);return De(Math.min(r,a,h,u),Math.min(o,l,c,d),Math.max(r,a,h,u),Math.max(o,l,c,d),n)}function To(s,t,e,i){const n=t*i[0]/2,r=t*i[1]/2,o=Math.cos(e),a=Math.sin(e),l=n*o,h=n*a,c=r*o,u=r*a,d=s[0],g=s[1];return[d-l+u,g-h-c,d-l-u,g-h+c,d+l-u,g+h+c,d+l+u,g+h-c,d-l+u,g-h-c]}function _t(s){return s[3]-s[1]}function Me(s,t,e){const i=e||Vt();return ht(s,t)?(s[0]>t[0]?i[0]=s[0]:i[0]=t[0],s[1]>t[1]?i[1]=s[1]:i[1]=t[1],s[2]<t[2]?i[2]=s[2]:i[2]=t[2],s[3]<t[3]?i[3]=s[3]:i[3]=t[3]):cn(i),i}function me(s){return[s[0],s[3]]}function un(s){return[s[2],s[3]]}function J(s){return s[2]-s[0]}function ht(s,t){return s[0]<=t[2]&&s[2]>=t[0]&&s[1]<=t[3]&&s[3]>=t[1]}function ms(s){return s[2]<s[0]||s[3]<s[1]}function Od(s,t){return t?(t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t):s}function Dd(s,t){const e=(s[2]-s[0])/2*(t-1),i=(s[3]-s[1])/2*(t-1);s[0]-=e,s[2]+=e,s[1]-=i,s[3]+=i}function kd(s,t,e){let i=!1;const n=wo(s,t),r=wo(s,e);if(n===pt.INTERSECTING||r===pt.INTERSECTING)i=!0;else{const o=s[0],a=s[1],l=s[2],h=s[3],c=t[0],u=t[1],d=e[0],g=e[1],p=(g-u)/(d-c);let f,_;r&pt.ABOVE&&!(n&pt.ABOVE)&&(f=d-(g-h)/p,i=f>=o&&f<=l),!i&&r&pt.RIGHT&&!(n&pt.RIGHT)&&(_=g-(d-l)*p,i=_>=a&&_<=h),!i&&r&pt.BELOW&&!(n&pt.BELOW)&&(f=d-(g-a)/p,i=f>=o&&f<=l),!i&&r&pt.LEFT&&!(n&pt.LEFT)&&(_=g-(d-o)*p,i=_>=a&&_<=h)}return i}function Wh(s,t){const e=t.getExtent(),i=fe(s);if(t.canWrapX()&&(i[0]<e[0]||i[0]>=e[2])){const n=J(e),r=Math.floor((i[0]-e[0])/n)*n;s[0]-=r,s[2]-=r}return s}function Nd(s,t){if(t.canWrapX()){const e=t.getExtent();if(!isFinite(s[0])||!isFinite(s[2]))return[[e[0],s[1],e[2],s[3]]];Wh(s,t);const i=J(e);if(J(s)>i)return[[e[0],s[1],e[2],s[3]]];if(s[0]<e[0])return[[s[0]+i,s[1],e[2],s[3]],[e[0],s[1],s[2],s[3]]];if(s[2]>e[2])return[[s[0],s[1],e[2],s[3]],[e[0],s[1],s[2]-i,s[3]]]}return[s]}const Xs={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]};var mt={name:"xyz",min:[0,0,0],channel:["X","Y","Z"],alias:["XYZ","ciexyz","cie1931"]};mt.whitepoint={2:{A:[109.85,100,35.585],C:[98.074,100,118.232],D50:[96.422,100,82.521],D55:[95.682,100,92.149],D65:[95.045592705167,100,108.9057750759878],D75:[94.972,100,122.638],F2:[99.187,100,67.395],F7:[95.044,100,108.755],F11:[100.966,100,64.37],E:[100,100,100]},10:{A:[111.144,100,35.2],C:[97.285,100,116.145],D50:[96.72,100,81.427],D55:[95.799,100,90.926],D65:[94.811,100,107.304],D75:[94.416,100,120.641],F2:[103.28,100,69.026],F7:[95.792,100,107.687],F11:[103.866,100,65.627],E:[100,100,100]}};mt.max=mt.whitepoint[2].D65;mt.rgb=function(s,t){t=t||mt.whitepoint[2].E;var e=s[0]/t[0],i=s[1]/t[1],n=s[2]/t[2],r,o,a;return r=e*3.240969941904521+i*-1.537383177570093+n*-.498610760293,o=e*-.96924363628087+i*1.87596750150772+n*.041555057407175,a=e*.055630079696993+i*-.20397695888897+n*1.056971514242878,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:r=r*12.92,o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o=o*12.92,a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a=a*12.92,r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),a=Math.min(Math.max(0,a),1),[r*255,o*255,a*255]};Xs.xyz=function(s,t){var e=s[0]/255,i=s[1]/255,n=s[2]/255;e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;var r=e*.41239079926595+i*.35758433938387+n*.18048078840183,o=e*.21263900587151+i*.71516867876775+n*.072192315360733,a=e*.019330818715591+i*.11919477979462+n*.95053215224966;return t=t||mt.whitepoint[2].E,[r*t[0],o*t[1],a*t[2]]};const ia={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["LUV","cieluv","cie1976"],xyz:function(s,t,e){var i,n,r,o,a,l,h,c,u,d,g,p,f;if(r=s[0],o=s[1],a=s[2],r===0)return[0,0,0];var _=.0011070564598794539;return t=t||"D65",e=e||2,u=mt.whitepoint[e][t][0],d=mt.whitepoint[e][t][1],g=mt.whitepoint[e][t][2],p=4*u/(u+15*d+3*g),f=9*d/(u+15*d+3*g),i=o/(13*r)+p||0,n=a/(13*r)+f||0,h=r>8?d*Math.pow((r+16)/116,3):d*r*_,l=h*9*i/(4*n)||0,c=h*(12-3*i-20*n)/(4*n)||0,[l,h,c]}};mt.luv=function(s,t,e){var i,n,r,o,a,l,h,c,u,d,g,p,f,_=.008856451679035631,m=903.2962962962961;t=t||"D65",e=e||2,u=mt.whitepoint[e][t][0],d=mt.whitepoint[e][t][1],g=mt.whitepoint[e][t][2],p=4*u/(u+15*d+3*g),f=9*d/(u+15*d+3*g),l=s[0],h=s[1],c=s[2],i=4*l/(l+15*h+3*c)||0,n=9*h/(l+15*h+3*c)||0;var y=h/d;return r=y<=_?m*y:116*Math.pow(y,1/3)-16,o=13*r*(i-p),a=13*r*(n-f),[r,o,a]};var Bh={name:"lchuv",channel:["lightness","chroma","hue"],alias:["LCHuv","cielchuv"],min:[0,0,0],max:[100,100,360],luv:function(s){var t=s[0],e=s[1],i=s[2],n,r,o;return o=i/360*2*Math.PI,n=e*Math.cos(o),r=e*Math.sin(o),[t,n,r]},xyz:function(s){return ia.xyz(Bh.luv(s))}};ia.lchuv=function(s){var t=s[0],e=s[1],i=s[2],n=Math.sqrt(e*e+i*i),r=Math.atan2(i,e),o=r*360/2/Math.PI;return o<0&&(o+=360),[t,n,o]};mt.lchuv=function(s){return ia.lchuv(mt.luv(s))};function Uh(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Gd={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const Sl=Uh(Gd);var Tl={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function jd(s){var t,e,i,n=[],r=1,o;if(typeof s=="number")return{space:"rgb",values:[s>>>16,(s&65280)>>>8,s&255],alpha:1};if(typeof s=="number")return{space:"rgb",values:[s>>>16,(s&65280)>>>8,s&255],alpha:1};if(s=String(s).toLowerCase(),Sl[s])n=Sl[s].slice(),o="rgb";else if(s==="transparent")r=0,o="rgb",n=[0,0,0];else if(s[0]==="#"){var a=s.slice(1),l=a.length,h=l<=4;r=1,h?(n=[parseInt(a[0]+a[0],16),parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16)],l===4&&(r=parseInt(a[3]+a[3],16)/255)):(n=[parseInt(a[0]+a[1],16),parseInt(a[2]+a[3],16),parseInt(a[4]+a[5],16)],l===8&&(r=parseInt(a[6]+a[7],16)/255)),n[0]||(n[0]=0),n[1]||(n[1]=0),n[2]||(n[2]=0),o="rgb"}else if(i=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(s)){var c=i[1];o=c.replace(/a$/,"");var u=o==="cmyk"?4:o==="gray"?1:3;n=i[2].trim().split(/\s*[,\/]\s*|\s+/),o==="color"&&(o=n.shift()),n=n.map(function(d,g){if(d[d.length-1]==="%")return d=parseFloat(d)/100,g===3?d:o==="rgb"?d*255:o[0]==="h"||o[0]==="l"&&!g?d*100:o==="lab"?d*125:o==="lch"?g<2?d*150:d*360:o[0]==="o"&&!g?d:o==="oklab"?d*.4:o==="oklch"?g<2?d*.4:d*360:d;if(o[g]==="h"||g===2&&o[o.length-1]==="h"){if(Tl[d]!==void 0)return Tl[d];if(d.endsWith("deg"))return parseFloat(d);if(d.endsWith("turn"))return parseFloat(d)*360;if(d.endsWith("grad"))return parseFloat(d)*360/400;if(d.endsWith("rad"))return parseFloat(d)*180/Math.PI}return d==="none"?0:parseFloat(d)}),r=n.length>u?n.pop():1}else/[0-9](?:\s|\/|,)/.test(s)&&(n=s.match(/([0-9]+)/g).map(function(d){return parseFloat(d)}),o=((e=(t=s.match(/([a-z])/ig))==null?void 0:t.join(""))==null?void 0:e.toLowerCase())||"rgb");return{space:o,values:n,alpha:r}}const Zr={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(s){var t=s[0]/360,e=s[1]/100,i=s[2]/100,n,r,o,a,l,h=0;if(e===0)return l=i*255,[l,l,l];for(r=i<.5?i*(1+e):i+e-i*e,n=2*i-r,a=[0,0,0];h<3;)o=t+1/3*-(h-1),o<0?o++:o>1&&o--,l=6*o<1?n+(r-n)*6*o:2*o<1?r:3*o<2?n+(r-n)*(2/3-o)*6:n,a[h++]=l*255;return a}};Xs.hsl=function(s){var t=s[0]/255,e=s[1]/255,i=s[2]/255,n=Math.min(t,e,i),r=Math.max(t,e,i),o=r-n,a,l,h;return r===n?a=0:t===r?a=(e-i)/o:e===r?a=2+(i-t)/o:i===r&&(a=4+(t-e)/o),a=Math.min(a*60,360),a<0&&(a+=360),h=(n+r)/2,r===n?l=0:h<=.5?l=o/(r+n):l=o/(2-r-n),[a,l*100,h*100]};function Vd(s){Array.isArray(s)&&s.raw&&(s=String.raw(...arguments)),s instanceof Number&&(s=+s);var t,e=jd(s);if(!e.space)return[];const i=e.space[0]==="h"?Zr.min:Xs.min,n=e.space[0]==="h"?Zr.max:Xs.max;return t=Array(3),t[0]=Math.min(Math.max(e.values[0],i[0]),n[0]),t[1]=Math.min(Math.max(e.values[1],i[1]),n[1]),t[2]=Math.min(Math.max(e.values[2],i[2]),n[2]),e.space[0]==="h"&&(t=Zr.rgb(t)),t.push(Math.min(Math.max(e.alpha,0),1)),t}function at(s,t,e){return Math.min(Math.max(s,t),e)}function zd(s,t,e,i,n,r){const o=n-e,a=r-i;if(o!==0||a!==0){const l=((s-e)*o+(t-i)*a)/(o*o+a*a);l>1?(e=n,i=r):l>0&&(e+=o*l,i+=a*l)}return Le(s,t,e,i)}function Le(s,t,e,i){const n=e-s,r=i-t;return n*n+r*r}function Wd(s){const t=s.length;for(let i=0;i<t;i++){let n=i,r=Math.abs(s[i][i]);for(let a=i+1;a<t;a++){const l=Math.abs(s[a][i]);l>r&&(r=l,n=a)}if(r===0)return null;const o=s[n];s[n]=s[i],s[i]=o;for(let a=i+1;a<t;a++){const l=-s[a][i]/s[i][i];for(let h=i;h<t+1;h++)i==h?s[a][h]=0:s[a][h]+=l*s[i][h]}}const e=new Array(t);for(let i=t-1;i>=0;i--){e[i]=s[i][t]/s[i][i];for(let n=i-1;n>=0;n--)s[n][t]-=s[n][i]*e[i]}return e}function vi(s){return s*Math.PI/180}function xi(s,t){const e=s%t;return e*t<0?e+t:e}function Gt(s,t,e){return s+e*(t-s)}function dn(s,t){const e=Math.pow(10,t);return Math.round(s*e)/e}function Rl(s,t){return Math.round(dn(s,t))}function $i(s,t){return Math.floor(dn(s,t))}function He(s,t){return Math.ceil(dn(s,t))}function $h(s){return typeof s=="string"?s:Yh(s)}const Bd=1024,Rs={};let qr=0;function Ud(s){if(s.length===4)return s;const t=s.slice();return t[3]=1,t}function bl(s){const t=mt.lchuv(Xs.xyz(s));return t[3]=s[3],t}function $d(s){const t=mt.rgb(Bh.xyz(s));return t[3]=s[3],t}function sa(s){if(Rs.hasOwnProperty(s))return Rs[s];if(qr>=Bd){let e=0;for(const i in Rs)e++&3||(delete Rs[i],--qr)}const t=Vd(s);if(t.length!==4)throw new Error('Failed to parse "'+s+'" as color');for(const e of t)if(isNaN(e))throw new Error('Failed to parse "'+s+'" as color');return Xh(t),Rs[s]=t,++qr,t}function qn(s){return Array.isArray(s)?s:sa(s)}function Xh(s){return s[0]=at(s[0]+.5|0,0,255),s[1]=at(s[1]+.5|0,0,255),s[2]=at(s[2]+.5|0,0,255),s[3]=at(s[3],0,1),s}function Yh(s){let t=s[0];t!=(t|0)&&(t=t+.5|0);let e=s[1];e!=(e|0)&&(e=e+.5|0);let i=s[2];i!=(i|0)&&(i=i+.5|0);const n=s[3]===void 0?1:Math.round(s[3]*100)/100;return"rgba("+t+","+e+","+i+","+n+")"}function Xd(s){try{return sa(s),!0}catch{return!1}}class Yd{constructor(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];!(t++&3)&&!i.hasListener()&&(delete this.cache_[e],--this.cacheSize_)}}}get(t,e,i){const n=Il(t,e,i);return n in this.cache_?this.cache_[n]:null}set(t,e,i,n){const r=Il(t,e,i);this.cache_[r]=n,++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Il(s,t,e){const i=e?$h(e):"null";return t+":"+s+":"+i}const Jn=new Yd,tt={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};class Kd extends se{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);typeof t.properties=="object"&&(delete e.properties,Object.assign(e,t.properties)),e[tt.OPACITY]=t.opacity!==void 0?t.opacity:1,H(typeof e[tt.OPACITY]=="number","Layer opacity must be a number"),e[tt.VISIBLE]=t.visible!==void 0?t.visible:!0,e[tt.Z_INDEX]=t.zIndex,e[tt.MAX_RESOLUTION]=t.maxResolution!==void 0?t.maxResolution:1/0,e[tt.MIN_RESOLUTION]=t.minResolution!==void 0?t.minResolution:0,e[tt.MIN_ZOOM]=t.minZoom!==void 0?t.minZoom:-1/0,e[tt.MAX_ZOOM]=t.maxZoom!==void 0?t.maxZoom:1/0,this.className_=e.className!==void 0?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:t===void 0?!0:t},i=this.getZIndex();return e.opacity=at(Math.round(this.getOpacity()*100)/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=i===void 0&&!e.managed?1/0:i,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return N()}getLayerStatesArray(t){return N()}getExtent(){return this.get(tt.EXTENT)}getMaxResolution(){return this.get(tt.MAX_RESOLUTION)}getMinResolution(){return this.get(tt.MIN_RESOLUTION)}getMinZoom(){return this.get(tt.MIN_ZOOM)}getMaxZoom(){return this.get(tt.MAX_ZOOM)}getOpacity(){return this.get(tt.OPACITY)}getSourceState(){return N()}getVisible(){return this.get(tt.VISIBLE)}getZIndex(){return this.get(tt.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(tt.EXTENT,t)}setMaxResolution(t){this.set(tt.MAX_RESOLUTION,t)}setMinResolution(t){this.set(tt.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(tt.MAX_ZOOM,t)}setMinZoom(t){this.set(tt.MIN_ZOOM,t)}setOpacity(t){H(typeof t=="number","Layer opacity must be a number"),this.set(tt.OPACITY,t)}setVisible(t){this.set(tt.VISIBLE,t)}setZIndex(t){this.set(tt.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}const Kh=Kd,de={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"},ot={ANIMATING:0,INTERACTING:1},kt={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"},Hh=42,na=256,as={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Hd{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=t.extent!==void 0?t.extent:null,this.worldExtent_=t.worldExtent!==void 0?t.worldExtent:null,this.axisOrientation_=t.axisOrientation!==void 0?t.axisOrientation:"enu",this.global_=t.global!==void 0?t.global:!1,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||as[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!!(t&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!!(this.global_&&t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}const ra=Hd,gn=6378137,Xi=Math.PI*gn,Zd=[-Xi,-Xi,Xi,Xi],qd=[-180,-85,180,85],Mn=gn*Math.log(Math.tan(Math.PI/2));class Oi extends ra{constructor(t){super({code:t,units:"m",extent:Zd,global:!0,worldExtent:qd,getPointResolution:function(e,i){return e/Math.cosh(i[1]/gn)}})}}const Pl=[new Oi("EPSG:3857"),new Oi("EPSG:102100"),new Oi("EPSG:102113"),new Oi("EPSG:900913"),new Oi("http://www.opengis.net/def/crs/EPSG/0/3857"),new Oi("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Jd(s,t,e){const i=s.length;e=e>1?e:2,t===void 0&&(e>2?t=s.slice():t=new Array(i));for(let n=0;n<i;n+=e){t[n]=Xi*s[n]/180;let r=gn*Math.log(Math.tan(Math.PI*(+s[n+1]+90)/360));r>Mn?r=Mn:r<-Mn&&(r=-Mn),t[n+1]=r}return t}function Qd(s,t,e){const i=s.length;e=e>1?e:2,t===void 0&&(e>2?t=s.slice():t=new Array(i));for(let n=0;n<i;n+=e)t[n]=180*s[n]/Xi,t[n+1]=360*Math.atan(Math.exp(s[n+1]/gn))/Math.PI-90;return t}const tg=6378137,Ml=[-180,-90,180,90],eg=Math.PI*tg/180;class ui extends ra{constructor(t,e){super({code:t,units:"degrees",extent:Ml,axisOrientation:e,global:!0,metersPerUnit:eg,worldExtent:Ml})}}const Ll=[new ui("CRS:84"),new ui("EPSG:4326","neu"),new ui("urn:ogc:def:crs:OGC:1.3:CRS84"),new ui("urn:ogc:def:crs:OGC:2:84"),new ui("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new ui("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new ui("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Ro={};function ig(s){return Ro[s]||Ro[s.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function sg(s,t){Ro[s]=t}let Ji={};function Qn(s,t,e){const i=s.getCode(),n=t.getCode();i in Ji||(Ji[i]={}),Ji[i][n]=e}function ng(s,t){let e;return s in Ji&&t in Ji[s]&&(e=Ji[s][t]),e}function oa(s,t){const e=(""+s).split("."),i=(""+t).split(".");for(let n=0;n<Math.max(e.length,i.length);n++){const r=parseInt(e[n]||"0",10),o=parseInt(i[n]||"0",10);if(r>o)return 1;if(o>r)return-1}return 0}function rg(s,t){return s[0]+=+t[0],s[1]+=+t[1],s}function Zh(s,t){const e=s[0],i=s[1],n=t[0],r=t[1],o=n[0],a=n[1],l=r[0],h=r[1],c=l-o,u=h-a,d=c===0&&u===0?0:(c*(e-o)+u*(i-a))/(c*c+u*u||0);let g,p;return d<=0?(g=o,p=a):d>=1?(g=l,p=h):(g=o+d*c,p=a+d*u),[g,p]}function $t(s,t){let e=!0;for(let i=s.length-1;i>=0;--i)if(s[i]!=t[i]){e=!1;break}return e}function aa(s,t){const e=Math.cos(t),i=Math.sin(t),n=s[0]*e-s[1]*i,r=s[1]*e+s[0]*i;return s[0]=n,s[1]=r,s}function og(s,t){return s[0]*=t,s[1]*=t,s}function ls(s,t){const e=s[0]-t[0],i=s[1]-t[1];return e*e+i*i}function tr(s,t){return Math.sqrt(ls(s,t))}function ag(s,t){return ls(s,Zh(s,t))}function Mr(s,t){if(t.canWrapX()){const e=J(t.getExtent()),i=lg(s,t,e);i&&(s[0]-=i*e)}return s}function lg(s,t,e){const i=t.getExtent();let n=0;return t.canWrapX()&&(s[0]<i[0]||s[0]>i[2])&&(e=e||J(i),n=Math.floor((s[0]-i[0])/e)),n}const la=63710088e-1;function bo(s,t,e){e=e||la;const i=vi(s[1]),n=vi(t[1]),r=(n-i)/2,o=vi(t[0]-s[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(i)*Math.cos(n);return 2*e*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function Jr(s,t){let e=0;for(let i=0,n=s.length;i<n-1;++i)e+=bo(s[i],s[i+1],t);return e}function qh(s,t){t=t||{};const e=t.radius||la,i=t.projection||"EPSG:3857",n=s.getType();n!=="GeometryCollection"&&(s=s.clone().transform(i,"EPSG:4326"));let r=0,o,a,l,h,c,u;switch(n){case"Point":case"MultiPoint":break;case"LineString":case"LinearRing":{o=s.getCoordinates(),r=Jr(o,e);break}case"MultiLineString":case"Polygon":{for(o=s.getCoordinates(),l=0,h=o.length;l<h;++l)r+=Jr(o[l],e);break}case"MultiPolygon":{for(o=s.getCoordinates(),l=0,h=o.length;l<h;++l)for(a=o[l],c=0,u=a.length;c<u;++c)r+=Jr(a[c],e);break}case"GeometryCollection":{const d=s.getGeometries();for(l=0,h=d.length;l<h;++l)r+=qh(d[l],t);break}default:throw new Error("Unsupported geometry type: "+n)}return r}function Ln(s,t){let e=0;const i=s.length;let n=s[i-1][0],r=s[i-1][1];for(let o=0;o<i;o++){const a=s[o][0],l=s[o][1];e+=vi(a-n)*(2+Math.sin(vi(r))+Math.sin(vi(l))),n=a,r=l}return e*t*t/2}function Jh(s,t){t=t||{};const e=t.radius||la,i=t.projection||"EPSG:3857",n=s.getType();n!=="GeometryCollection"&&(s=s.clone().transform(i,"EPSG:4326"));let r=0,o,a,l,h,c,u;switch(n){case"Point":case"MultiPoint":case"LineString":case"MultiLineString":case"LinearRing":break;case"Polygon":{for(o=s.getCoordinates(),r=Math.abs(Ln(o[0],e)),l=1,h=o.length;l<h;++l)r-=Math.abs(Ln(o[l],e));break}case"MultiPolygon":{for(o=s.getCoordinates(),l=0,h=o.length;l<h;++l)for(a=o[l],r+=Math.abs(Ln(a[0],e)),c=1,u=a.length;c<u;++c)r-=Math.abs(Ln(a[c],e));break}case"GeometryCollection":{const d=s.getGeometries();for(l=0,h=d.length;l<h;++l)r+=Jh(d[l],t);break}default:throw new Error("Unsupported geometry type: "+n)}return r}function Qh(...s){console.warn(...s)}let Io=!0;function tc(s){Io=!(s===void 0||s)}function ha(s,t){if(t!==void 0){for(let e=0,i=s.length;e<i;++e)t[e]=s[e];t=t}else t=s.slice();return t}function ca(s,t){if(t!==void 0&&s!==t){for(let e=0,i=s.length;e<i;++e)t[e]=s[e];s=t}return s}function hg(s){sg(s.getCode(),s),Qn(s,s,ha)}function cg(s){s.forEach(hg)}function it(s){return typeof s=="string"?ig(s):s||null}function er(s,t,e,i){s=it(s);let n;const r=s.getPointResolutionFunc();if(r){if(n=r(t,e),i&&i!==s.getUnits()){const o=s.getMetersPerUnit();o&&(n=n*o/as[i])}}else{const o=s.getUnits();if(o=="degrees"&&!i||i=="degrees")n=t;else{const a=Lr(s,it("EPSG:4326"));if(a===ca&&o!=="degrees")n=t*s.getMetersPerUnit();else{let h=[e[0]-t/2,e[1],e[0]+t/2,e[1],e[0],e[1]-t/2,e[0],e[1]+t/2];h=a(h,h,2);const c=bo(h.slice(0,2),h.slice(2,4)),u=bo(h.slice(4,6),h.slice(6,8));n=(c+u)/2}const l=i?as[i]:s.getMetersPerUnit();l!==void 0&&(n/=l)}}return n}function Al(s){cg(s),s.forEach(function(t){s.forEach(function(e){t!==e&&Qn(t,e,ha)})})}function ug(s,t,e,i){s.forEach(function(n){t.forEach(function(r){Qn(n,r,e),Qn(r,n,i)})})}function ua(s,t){return s?typeof s=="string"?it(s):s:it(t)}function dg(s,t){return tc(),Ar(s,"EPSG:4326",t!==void 0?t:"EPSG:3857")}function Ie(s,t){if(s===t)return!0;const e=s.getUnits()===t.getUnits();return(s.getCode()===t.getCode()||Lr(s,t)===ha)&&e}function Lr(s,t){const e=s.getCode(),i=t.getCode();let n=ng(e,i);return n||(n=ca),n}function Ys(s,t){const e=it(s),i=it(t);return Lr(e,i)}function Ar(s,t,e){return Ys(t,e)(s,void 0,s.length)}function hs(s,t){return s}function lt(s,t){return Io&&!$t(s,[0,0])&&s[0]>=-180&&s[0]<=180&&s[1]>=-90&&s[1]<=90&&(Io=!1,Qh("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),s}function da(s,t){return s}function he(s,t){return s}function gg(){Al(Pl),Al(Ll),ug(Ll,Pl,Jd,Qd)}gg();function Fl(s,t,e){return function(i,n,r,o,a){if(!i)return;if(!n&&!t)return i;const l=t?0:r[0]*n,h=t?0:r[1]*n,c=a?a[0]:0,u=a?a[1]:0;let d=s[0]+l/2+c,g=s[2]-l/2+c,p=s[1]+h/2+u,f=s[3]-h/2+u;d>g&&(d=(g+d)/2,g=d),p>f&&(p=(f+p)/2,f=p);let _=at(i[0],d,g),m=at(i[1],p,f);if(o&&e&&n){const y=30*n;_+=-y*Math.log(1+Math.max(0,d-i[0])/y)+y*Math.log(1+Math.max(0,i[0]-g)/y),m+=-y*Math.log(1+Math.max(0,p-i[1])/y)+y*Math.log(1+Math.max(0,i[1]-f)/y)}return[_,m]}}function pg(s){return s}function ga(s,t,e,i){const n=J(t)/e[0],r=_t(t)/e[1];return i?Math.min(s,Math.max(n,r)):Math.min(s,Math.min(n,r))}function pa(s,t,e){let i=Math.min(s,t);const n=50;return i*=Math.log(1+n*Math.max(0,s/t-1))/n+1,e&&(i=Math.max(i,e),i/=Math.log(1+n*Math.max(0,e/s-1))/n+1),at(i,e/2,t*2)}function fg(s,t,e,i){return t=t!==void 0?t:!0,function(n,r,o,a){if(n!==void 0){const l=s[0],h=s[s.length-1],c=e?ga(l,e,o,i):l;if(a)return t?pa(n,c,h):at(n,h,c);const u=Math.min(c,n),d=Math.floor(Rr(s,u,r));return s[d]>c&&d<s.length-1?s[d+1]:s[d]}}}function _g(s,t,e,i,n,r){return i=i!==void 0?i:!0,e=e!==void 0?e:0,function(o,a,l,h){if(o!==void 0){const c=n?ga(t,n,l,r):t;if(h)return i?pa(o,c,e):at(o,e,c);const u=1e-9,d=Math.ceil(Math.log(t/c)/Math.log(s)-u),g=-a*(.5-u)+.5,p=Math.min(c,o),f=Math.floor(Math.log(t/p)/Math.log(s)+g),_=Math.max(d,f),m=t/Math.pow(s,_);return at(m,e,c)}}}function Ol(s,t,e,i,n){return e=e!==void 0?e:!0,function(r,o,a,l){if(r!==void 0){const h=i?ga(s,i,a,n):s;return!e||!l?at(r,t,h):pa(r,h,t)}}}function fa(s){if(s!==void 0)return 0}function Dl(s){if(s!==void 0)return s}function mg(s){const t=2*Math.PI/s;return function(e,i){if(i)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e}}function yg(s){const t=s===void 0?vi(5):s;return function(e,i){return i||e===void 0?e:Math.abs(e)<=t?0:e}}function ec(s){return Math.pow(s,3)}function Ti(s){return 1-ec(1-s)}function vg(s){return 3*s*s-2*s*s*s}function xg(s){return s}function ei(s,t,e,i,n,r){r=r||[];let o=0;for(let a=t;a<e;a+=i){const l=s[a],h=s[a+1];r[o++]=n[0]*l+n[2]*h+n[4],r[o++]=n[1]*l+n[3]*h+n[5]}return r&&r.length!=o&&(r.length=o),r}function _a(s,t,e,i,n,r,o){o=o||[];const a=Math.cos(n),l=Math.sin(n),h=r[0],c=r[1];let u=0;for(let d=t;d<e;d+=i){const g=s[d]-h,p=s[d+1]-c;o[u++]=h+g*a-p*l,o[u++]=c+g*l+p*a;for(let f=d+2;f<d+i;++f)o[u++]=s[f]}return o&&o.length!=u&&(o.length=u),o}function Eg(s,t,e,i,n,r,o,a){a=a||[];const l=o[0],h=o[1];let c=0;for(let u=t;u<e;u+=i){const d=s[u]-l,g=s[u+1]-h;a[c++]=l+n*d,a[c++]=h+r*g;for(let p=u+2;p<u+i;++p)a[c++]=s[p]}return a&&a.length!=c&&(a.length=c),a}function Cg(s,t,e,i,n,r,o){o=o||[];let a=0;for(let l=t;l<e;l+=i){o[a++]=s[l]+n,o[a++]=s[l+1]+r;for(let h=l+2;h<l+i;++h)o[a++]=s[h]}return o&&o.length!=a&&(o.length=a),o}const kl=Yt();class wg extends se{constructor(){super(),this.extent_=Vt(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Oh((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return N()}closestPointXY(t,e,i,n){return N()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return N()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&cn(e),this.extentRevision_=this.getRevision()}return Od(this.extent_,t)}rotate(t,e){N()}scale(t,e,i){N()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return N()}getType(){return N()}applyTransform(t){N()}intersectsExtent(t){return N()}translate(t,e){N()}transform(t,e){const i=it(t),n=i.getUnits()=="tile-pixels"?function(r,o,a){const l=i.getExtent(),h=i.getWorldExtent(),c=_t(h)/_t(l);return ie(kl,h[0],h[3],c,-c,0,0,0),ei(r,0,r.length,a,kl,o),Ys(i,e)(r,o,a)}:Ys(i,e);return this.applyTransform(n),this}}const ic=wg;class Sg extends ic{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return ta(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return N()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=ir(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){N()}setLayout(t,e,i){let n;if(t)n=ir(t);else{for(let r=0;r<i;++r){if(e.length===0){this.layout="XY",this.stride=2;return}e=e[0]}n=e.length,t=Ri(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();_a(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){e===void 0&&(e=t),i||(i=fe(this.getExtent()));const n=this.getFlatCoordinates();if(n){const r=this.getStride();Eg(n,0,n.length,r,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();Cg(i,0,i.length,n,t,e,i),this.changed()}}}function Ri(s){let t;return s==2?t="XY":s==3?t="XYZ":s==4&&(t="XYZM"),t}function ir(s){let t;return s=="XY"?t=2:s=="XYZ"||s=="XYM"?t=3:s=="XYZM"&&(t=4),t}function Tg(s,t,e){const i=s.getFlatCoordinates();if(!i)return null;const n=s.getStride();return ei(i,0,i.length,n,t,e)}const ai=Sg;function Nl(s,t,e,i,n,r,o){const a=s[t],l=s[t+1],h=s[e]-a,c=s[e+1]-l;let u;if(h===0&&c===0)u=t;else{const d=((n-a)*h+(r-l)*c)/(h*h+c*c);if(d>1)u=e;else if(d>0){for(let g=0;g<i;++g)o[g]=Gt(s[t+g],s[e+g],d);o.length=i;return}else u=t}for(let d=0;d<i;++d)o[d]=s[u+d];o.length=i}function ma(s,t,e,i,n){let r=s[t],o=s[t+1];for(t+=i;t<e;t+=i){const a=s[t],l=s[t+1],h=Le(r,o,a,l);h>n&&(n=h),r=a,o=l}return n}function ya(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];n=ma(s,t,a,i,n),t=a}return n}function Rg(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];n=ya(s,t,a,i,n),t=a[a.length-1]}return n}function va(s,t,e,i,n,r,o,a,l,h,c){if(t==e)return h;let u,d;if(n===0){if(d=Le(o,a,s[t],s[t+1]),d<h){for(u=0;u<i;++u)l[u]=s[t+u];return l.length=i,d}return h}c=c||[NaN,NaN];let g=t+i;for(;g<e;)if(Nl(s,g-i,g,i,o,a,c),d=Le(o,a,c[0],c[1]),d<h){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i,g+=i}else g+=i*Math.max((Math.sqrt(d)-Math.sqrt(h))/n|0,1);if(r&&(Nl(s,e-i,t,i,o,a,c),d=Le(o,a,c[0],c[1]),d<h)){for(h=d,u=0;u<i;++u)l[u]=c[u];l.length=i}return h}function xa(s,t,e,i,n,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const g=e[u];h=va(s,t,g,i,n,r,o,a,l,h,c),t=g}return h}function bg(s,t,e,i,n,r,o,a,l,h,c){c=c||[NaN,NaN];for(let u=0,d=e.length;u<d;++u){const g=e[u];h=xa(s,t,g,i,n,r,o,a,l,h,c),t=g[g.length-1]}return h}function sc(s,t,e,i){for(let n=0,r=e.length;n<r;++n)s[t++]=e[n];return t}function Fr(s,t,e,i){for(let n=0,r=e.length;n<r;++n){const o=e[n];for(let a=0;a<i;++a)s[t++]=o[a]}return t}function pn(s,t,e,i,n){n=n||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=Fr(s,t,e[o],i);n[r++]=l,t=l}return n.length=r,n}function nc(s,t,e,i,n){n=n||[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=pn(s,t,e[o],i,n[r]);l.length===0&&(l[0]=t),n[r++]=l,t=l[l.length-1]}return n.length=r,n}function Or(s,t,e,i,n,r,o){const a=(e-t)/i;if(a<3){for(;t<e;t+=i)r[o++]=s[t],r[o++]=s[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const h=[t,e-i];let c=0;for(;h.length>0;){const u=h.pop(),d=h.pop();let g=0;const p=s[d],f=s[d+1],_=s[u],m=s[u+1];for(let y=d+i;y<u;y+=i){const v=s[y],x=s[y+1],E=zd(v,x,p,f,_,m);E>g&&(c=y,g=E)}g>n&&(l[(c-t)/i]=1,d+i<c&&h.push(d,c),c+i<u&&h.push(c,u))}for(let u=0;u<a;++u)l[u]&&(r[o++]=s[t+u*i],r[o++]=s[t+u*i+1]);return o}function rc(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Or(s,t,c,i,n,r,o),a.push(o),t=c}return o}function pi(s,t){return t*Math.round(s/t)}function Ig(s,t,e,i,n,r,o){if(t==e)return o;let a=pi(s[t],n),l=pi(s[t+1],n);t+=i,r[o++]=a,r[o++]=l;let h,c;do if(h=pi(s[t],n),c=pi(s[t+1],n),t+=i,t==e)return r[o++]=h,r[o++]=c,o;while(h==a&&c==l);for(;t<e;){const u=pi(s[t],n),d=pi(s[t+1],n);if(t+=i,u==h&&d==c)continue;const g=h-a,p=c-l,f=u-a,_=d-l;if(g*_==p*f&&(g<0&&f<g||g==f||g>0&&f>g)&&(p<0&&_<p||p==_||p>0&&_>p)){h=u,c=d;continue}r[o++]=h,r[o++]=c,a=h,l=c,h=u,c=d}return r[o++]=h,r[o++]=c,o}function Ea(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l];o=Ig(s,t,c,i,n,r,o),a.push(o),t=c}return o}function Pg(s,t,e,i,n,r,o,a){for(let l=0,h=e.length;l<h;++l){const c=e[l],u=[];o=Ea(s,t,c,i,n,r,o,u),a.push(u),t=c[c.length-1]}return o}function Ze(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=t;o<e;o+=i)n[r++]=s.slice(o,o+i);return n.length=r,n}function Ks(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];n[r++]=Ze(s,t,l,i,n[r]),t=l}return n.length=r,n}function Po(s,t,e,i,n){n=n!==void 0?n:[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];n[r++]=l.length===1&&l[0]===t?[]:Ks(s,t,l,i,n[r]),t=l[l.length-1]}return n.length=r,n}function oc(s,t,e,i){let n=0,r=s[e-i],o=s[e-i+1];for(;t<e;t+=i){const a=s[t],l=s[t+1];n+=o*a-r*l,r=a,o=l}return n/2}function ac(s,t,e,i){let n=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];n+=oc(s,t,a,i),t=a}return n}function Mg(s,t,e,i){let n=0;for(let r=0,o=e.length;r<o;++r){const a=e[r];n+=ac(s,t,a,i),t=a[a.length-1]}return n}class sr extends ai{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}clone(){return new sr(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<Si(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ma(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),va(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return oc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Ze(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=Or(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new sr(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Fr(this.flatCoordinates,0,t,this.stride),this.changed()}}const Gl=sr;class Ca extends ai{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Ca(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,o=Le(t,e,r[0],r[1]);if(o<n){const a=this.stride;for(let l=0;l<a;++l)i[l]=r[l];return i.length=a,o}return n}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return ks(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Qo(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=sc(this.flatCoordinates,0,t,this.stride),this.changed()}}const ge=Ca;function Lg(s,t,e,i,n){return!ea(n,function(r){return!_i(s,t,e,i,r[0],r[1])})}function _i(s,t,e,i,n,r){let o=0,a=s[e-i],l=s[e-i+1];for(;t<e;t+=i){const h=s[t],c=s[t+1];l<=r?c>r&&(h-a)*(r-l)-(n-a)*(c-l)>0&&o++:c<=r&&(h-a)*(r-l)-(n-a)*(c-l)<0&&o--,a=h,l=c}return o!==0}function wa(s,t,e,i,n,r){if(e.length===0||!_i(s,t,e[0],i,n,r))return!1;for(let o=1,a=e.length;o<a;++o)if(_i(s,e[o-1],e[o],i,n,r))return!1;return!0}function Ag(s,t,e,i,n,r){if(e.length===0)return!1;for(let o=0,a=e.length;o<a;++o){const l=e[o];if(wa(s,t,l,i,n,r))return!0;t=l[l.length-1]}return!1}function Sa(s,t,e,i,n,r,o){let a,l,h,c,u,d,g;const p=n[r+1],f=[];for(let y=0,v=e.length;y<v;++y){const x=e[y];for(c=s[x-i],d=s[x-i+1],a=t;a<x;a+=i)u=s[a],g=s[a+1],(p<=d&&g<=p||d<=p&&p<=g)&&(h=(p-d)/(g-d)*(u-c)+c,f.push(h)),c=u,d=g}let _=NaN,m=-1/0;for(f.sort(ii),c=f[0],a=1,l=f.length;a<l;++a){u=f[a];const y=Math.abs(u-c);y>m&&(h=(c+u)/2,wa(s,t,e,i,h,p)&&(_=h,m=y)),c=u}return isNaN(_)&&(_=n[r]),o?(o.push(_,p,m),o):[_,p,m]}function lc(s,t,e,i,n){let r=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];r=Sa(s,t,l,i,n,2*o,r),t=l[l.length-1]}return r}function hc(s,t,e,i,n){let r;for(t+=i;t<e;t+=i)if(r=n(s.slice(t-i,t),s.slice(t,t+i)),r)return r;return!1}function Dr(s,t,e,i,n){const r=zh(Vt(),s,t,e,i);return ht(n,r)?Xt(n,r)||r[0]>=n[0]&&r[2]<=n[2]||r[1]>=n[1]&&r[3]<=n[3]?!0:hc(s,t,e,i,function(o,a){return kd(n,o,a)}):!1}function Fg(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){if(Dr(s,t,e[r],i,n))return!0;t=e[r]}return!1}function cc(s,t,e,i,n){return!!(Dr(s,t,e,i,n)||_i(s,t,e,i,n[0],n[1])||_i(s,t,e,i,n[0],n[3])||_i(s,t,e,i,n[2],n[1])||_i(s,t,e,i,n[2],n[3]))}function uc(s,t,e,i,n){if(!cc(s,t,e[0],i,n))return!1;if(e.length===1)return!0;for(let r=1,o=e.length;r<o;++r)if(Lg(s,e[r-1],e[r],i,n)&&!Dr(s,e[r-1],e[r],i,n))return!1;return!0}function Og(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(uc(s,t,a,i,n))return!0;t=a[a.length-1]}return!1}function Dg(s,t,e,i){for(;t<e-i;){for(let n=0;n<i;++n){const r=s[t+n];s[t+n]=s[e-i+n],s[e-i+n]=r}t+=i,e-=i}}function Ta(s,t,e,i){let n=0,r=s[e-i],o=s[e-i+1];for(;t<e;t+=i){const a=s[t],l=s[t+1];n+=(a-r)*(l+o),r=a,o=l}return n===0?void 0:n>0}function Ra(s,t,e,i,n){n=n!==void 0?n:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Ta(s,t,a,i);if(r===0){if(n&&l||!n&&!l)return!1}else if(n&&!l||!n&&l)return!1;t=a}return!0}function dc(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r){const a=e[r];if(!Ra(s,t,a,i,n))return!1;a.length&&(t=a[a.length-1])}return!0}function nr(s,t,e,i,n){n=n!==void 0?n:!1;for(let r=0,o=e.length;r<o;++r){const a=e[r],l=Ta(s,t,a,i);(r===0?n&&l||!n&&!l:n&&!l||!n&&l)&&Dg(s,t,a,i),t=a}return t}function Mo(s,t,e,i,n){for(let r=0,o=e.length;r<o;++r)t=nr(s,t,e[r],i,n);return t}function gc(s,t){const e=[];let i=0,n=0,r;for(let o=0,a=t.length;o<a;++o){const l=t[o],h=Ta(s,i,l,2);if(r===void 0&&(r=h),h===r)e.push(t.slice(n,o+1));else{if(e.length===0)continue;e[e.length-1].push(t[n])}n=o+1,i=l}return e}class zt extends ai{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,e!==void 0&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?ue(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new zt(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Si(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ya(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),xa(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return wa(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return ac(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),nr(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Ks(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=fe(this.getExtent());this.flatInteriorPoint_=Sa(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new ge(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new Gl(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,n=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o],h=new Gl(e.slice(r,l),t);n.push(h),r=l}return n}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Ra(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=nr(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Ea(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new zt(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return uc(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=pn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}function rr(s){if(ms(s))throw new Error("Cannot create polygon from empty extent");const t=s[0],e=s[1],i=s[2],n=s[3],r=[t,e,t,n,i,n,i,e,t,e];return new zt(r,"XY",[r.length])}const Qr=0;class kg extends se{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=ua(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&tc(),t.center&&(t.center=lt(t.center,this.projection_)),t.extent&&(t.extent=he(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const a in kt)delete e[a];this.setProperties(e,!0);const i=Gg(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const n=Ng(t),r=i.constraint,o=jg(t);this.constraints_={center:n,resolution:r,rotation:o},this.setRotation(t.rotation!==void 0?t.rotation:0),this.setCenterInternal(t.center!==void 0?t.center:null),t.resolution!==void 0?this.setResolution(t.resolution):t.zoom!==void 0&&this.setZoom(t.zoom)}get padding(){return this.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const r=this.getResolution(),o=r/2*(n[3]-e[3]+e[1]-n[1]),a=r/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+o,i[1]-a])}}getUpdatedOptions_(t){const e=this.getProperties();return e.resolution!==void 0?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let i=0;i<e.length;++i){let n=arguments[i];n.center&&(n=Object.assign({},n),n.center=lt(n.center,this.getProjection())),n.anchor&&(n=Object.assign({},n),n.anchor=lt(n.anchor,this.getProjection())),e[i]=n}this.animateInternal.apply(this,e)}animateInternal(t){let e=arguments.length,i;e>1&&typeof arguments[e-1]=="function"&&(i=arguments[e-1],--e);let n=0;for(;n<e&&!this.isDef();++n){const c=arguments[n];c.center&&this.setCenterInternal(c.center),c.zoom!==void 0?this.setZoom(c.zoom):c.resolution&&this.setResolution(c.resolution),c.rotation!==void 0&&this.setRotation(c.rotation)}if(n===e){i&&An(i,!0);return}let r=Date.now(),o=this.targetCenter_.slice(),a=this.targetResolution_,l=this.targetRotation_;const h=[];for(;n<e;++n){const c=arguments[n],u={start:r,complete:!1,anchor:c.anchor,duration:c.duration!==void 0?c.duration:1e3,easing:c.easing||vg,callback:i};if(c.center&&(u.sourceCenter=o,u.targetCenter=c.center.slice(),o=u.targetCenter),c.zoom!==void 0?(u.sourceResolution=a,u.targetResolution=this.getResolutionForZoom(c.zoom),a=u.targetResolution):c.resolution&&(u.sourceResolution=a,u.targetResolution=c.resolution,a=u.targetResolution),c.rotation!==void 0){u.sourceRotation=l;const d=xi(c.rotation-l+Math.PI,2*Math.PI)-Math.PI;u.targetRotation=l+d,l=u.targetRotation}Vg(u)?u.complete=!0:r+=u.duration,h.push(u)}this.animations_.push(h),this.setHint(ot.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ot.ANIMATING]>0}getInteracting(){return this.hints_[ot.INTERACTING]>0}cancelAnimations(){this.setHint(ot.ANIMATING,-this.hints_[ot.ANIMATING]);let t;for(let e=0,i=this.animations_.length;e<i;++e){const n=this.animations_[e];if(n[0].callback&&An(n[0].callback,!1),!t)for(let r=0,o=n.length;r<o;++r){const a=n[r];if(!a.complete){t=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const n=this.animations_[i];let r=!0;for(let o=0,a=n.length;o<a;++o){const l=n[o];if(l.complete)continue;const h=t-l.start;let c=l.duration>0?h/l.duration:1;c>=1?(l.complete=!0,c=1):r=!1;const u=l.easing(c);if(l.sourceCenter){const d=l.sourceCenter[0],g=l.sourceCenter[1],p=l.targetCenter[0],f=l.targetCenter[1];this.nextCenter_=l.targetCenter;const _=d+u*(p-d),m=g+u*(f-g);this.targetCenter_=[_,m]}if(l.sourceResolution&&l.targetResolution){const d=u===1?l.targetResolution:l.sourceResolution+u*(l.targetResolution-l.sourceResolution);if(l.anchor){const g=this.getViewportSize_(this.getRotation()),p=this.constraints_.resolution(d,0,g,!0);this.targetCenter_=this.calculateCenterZoom(p,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=d,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){const d=u===1?xi(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+u*(l.targetRotation-l.sourceRotation);if(l.anchor){const g=this.constraints_.rotation(d,!0);this.targetCenter_=this.calculateCenterRotate(g,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=d}if(this.applyTargetState_(!0),e=!0,!l.complete)break}if(r){this.animations_[i]=null,this.setHint(ot.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const o=n[0].callback;o&&An(o,!0)}}this.animations_=this.animations_.filter(Boolean),e&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return n!==void 0&&(i=[n[0]-e[0],n[1]-e[1]],aa(i,t-this.getRotation()),rg(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();if(n!==void 0&&r!==void 0){const o=e[0]-t*(e[0]-n[0])/r,a=e[1]-t*(e[1]-n[1])/r;i=[o,a]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t&&hs(t,this.getProjection())}getCenterInternal(){return this.get(kt.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return t!==void 0?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return da(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();H(e,"The view center is not defined");const i=this.getResolution();H(i!==void 0,"The view resolution is not defined");const n=this.getRotation();return H(n!==void 0,"The view rotation is not defined"),$s(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(kt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(he(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=J(t)/e[0],n=_t(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(r){return e/Math.pow(t,r*n)}}getRotation(){return this.get(kt.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(o){return Math.log(i/o)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const o=this.getViewportSizeMinusPadding_();n=to(n,this.getViewportSize_(),[o[0]/2+r[3],o[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:t!==void 0?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return e!==void 0&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e=this.minZoom_||0,i,n;if(this.resolutions_){const r=Rr(this.resolutions_,t,1);e=r,i=this.resolutions_[r],r==this.resolutions_.length-1?n=2:n=i/this.resolutions_[r+1]}else i=this.maxResolution_,n=this.zoomFactor_;return e+Math.log(i/t)/Math.log(n)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=at(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,at(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(H(Array.isArray(t)||typeof t.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){H(!ms(t),"Cannot fit empty extent provided as `geometry`");const n=he(t,this.getProjection());i=rr(n)}else if(t.getType()==="Circle"){const n=he(t.getExtent(),this.getProjection());i=rr(n),i.rotate(this.getRotation(),fe(n))}else i=t;this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),o=t.getStride();let a=1/0,l=1/0,h=-1/0,c=-1/0;for(let u=0,d=r.length;u<d;u+=o){const g=r[u]*i-r[u+1]*n,p=r[u]*n+r[u+1]*i;a=Math.min(a,g),l=Math.min(l,p),h=Math.max(h,g),c=Math.max(c,p)}return[a,l,h,c]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());const n=e.padding!==void 0?e.padding:[0,0,0,0],r=e.nearest!==void 0?e.nearest:!1;let o;e.minResolution!==void 0?o=e.minResolution:e.maxZoom!==void 0?o=this.getResolutionForZoom(e.maxZoom):o=0;const a=this.rotatedExtentForGeometry(t);let l=this.getResolutionForExtentInternal(a,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,r?0:1);const h=this.getRotation(),c=Math.sin(h),u=Math.cos(h),d=fe(a);d[0]+=(n[1]-n[3])/2*l,d[1]+=(n[0]-n[2])/2*l;const g=d[0]*u-d[1]*c,p=d[1]*u+d[0]*c,f=this.getConstrainedCenter([g,p],l),_=e.callback?e.callback:rs;e.duration!==void 0?this.animateInternal({resolution:l,center:f,duration:e.duration,easing:e.easing},_):(this.targetResolution_=l,this.targetCenter_=f,this.applyTargetState_(!1,!0),An(_,!0))}centerOn(t,e,i){this.centerOnInternal(lt(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(to(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let r;const o=this.padding_;if(o&&t){const a=this.getViewportSizeMinusPadding_(-i),l=to(t,n,[a[0]/2+o[3],a[1]/2+o[0]],e,i);r=[t[0]-l[0],t[1]-l[1]]}return r}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(t){const e=hs(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&lt(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.getViewportSize_(this.getRotation()),r=this.constraints_.resolution(this.targetResolution_*t,0,n,i);e&&(this.targetCenter_=this.calculateCenterZoom(r,e)),this.targetResolution_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=lt(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(n,e)),this.targetRotation_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t&&lt(t,this.getProjection()))}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.constraints_.rotation(this.targetRotation_,i),r=this.getViewportSize_(n),o=this.constraints_.resolution(this.targetResolution_,0,r,i),a=this.constraints_.center(this.targetCenter_,o,r,i,this.calculateCenterShift(this.targetCenter_,o,n,r));this.get(kt.ROTATION)!==n&&this.set(kt.ROTATION,n),this.get(kt.RESOLUTION)!==o&&(this.set(kt.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(kt.CENTER)||!$t(this.get(kt.CENTER),a))&&this.set(kt.CENTER,a),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=t!==void 0?t:200;const n=e||0,r=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,n,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,r,o));if(t===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=r,this.targetCenter_=l,this.applyTargetState_();return}i=i||(t===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==r||!this.getCenterInternal()||!$t(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:r,center:l,resolution:a,duration:t,easing:Ti,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ot.INTERACTING,1)}endInteraction(t,e,i){i=i&&lt(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(ot.INTERACTING,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}}function An(s,t){setTimeout(function(){s(t)},0)}function Ng(s){if(s.extent!==void 0){const e=s.smoothExtentConstraint!==void 0?s.smoothExtentConstraint:!0;return Fl(s.extent,s.constrainOnlyCenter,e)}const t=ua(s.projection,"EPSG:3857");if(s.multiWorld!==!0&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,Fl(e,!1,!1)}return pg}function Gg(s){let t,e,i,n=s.minZoom!==void 0?s.minZoom:Qr,r=s.maxZoom!==void 0?s.maxZoom:28;const o=s.zoomFactor!==void 0?s.zoomFactor:2,a=s.multiWorld!==void 0?s.multiWorld:!1,l=s.smoothResolutionConstraint!==void 0?s.smoothResolutionConstraint:!0,h=s.showFullExtent!==void 0?s.showFullExtent:!1,c=ua(s.projection,"EPSG:3857"),u=c.getExtent();let d=s.constrainOnlyCenter,g=s.extent;if(!a&&!g&&c.isGlobal()&&(d=!1,g=u),s.resolutions!==void 0){const p=s.resolutions;e=p[n],i=p[r]!==void 0?p[r]:p[p.length-1],s.constrainResolution?t=fg(p,l,!d&&g,h):t=Ol(e,i,l,!d&&g,h)}else{const p=(u?Math.max(J(u),_t(u)):360*as.degrees/c.getMetersPerUnit())/na/Math.pow(2,Qr),f=p/Math.pow(2,28-Qr);e=s.maxResolution,e!==void 0?n=0:e=p/Math.pow(o,n),i=s.minResolution,i===void 0&&(s.maxZoom!==void 0?s.maxResolution!==void 0?i=e/Math.pow(o,r):i=p/Math.pow(o,r):i=f),r=n+Math.floor(Math.log(e/i)/Math.log(o)),i=e/Math.pow(o,r-n),s.constrainResolution?t=_g(o,e,i,l,!d&&g,h):t=Ol(e,i,l,!d&&g,h)}return{constraint:t,maxResolution:e,minResolution:i,minZoom:n,zoomFactor:o}}function jg(s){if(s.enableRotation===void 0||s.enableRotation){const t=s.constrainRotation;return t===void 0||t===!0?yg():t===!1?Dl:typeof t=="number"?mg(t):Dl}return fa}function Vg(s){return!(s.sourceCenter&&s.targetCenter&&!$t(s.sourceCenter,s.targetCenter)||s.sourceResolution!==s.targetResolution||s.sourceRotation!==s.targetRotation)}function to(s,t,e,i,n){const r=Math.cos(-n);let o=Math.sin(-n),a=s[0]*r-s[1]*o,l=s[1]*r+s[0]*o;a+=(t[0]/2-e[0])*i,l+=(e[1]-t[1]/2)*i,o=-o;const h=a*r-l*o,c=l*r+a*o;return[h,c]}const Qt=kg;class zg extends Kh{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(tt.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(tt.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(et(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=W(t,O.CHANGE,this.handleSourceChange_,this),t.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return!this.renderer_||!this.rendered?null:this.renderer_.getData(t)}isVisible(t){let e;const i=this.getMapInternal();!t&&i&&(t=i.getView()),t instanceof Qt?e={viewState:t.getState(),extent:t.calculateExtent()}:e=t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray());let n;e.layerStatesArray?n=e.layerStatesArray.find(o=>o.layer===this):n=this.getLayerState();const r=this.getExtent();return ba(n,e.viewState)&&(!r||ht(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const i=this.getSource();if(i&&(e=i.getAttributions()),!e)return[];const n=t instanceof Qt?t.getViewStateAndExtent():t;let r=e(n);return Array.isArray(r)||(r=[r]),r}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set(tt.MAP,t)}getMapInternal(){return this.get(tt.MAP)}setMap(t){this.mapPrecomposeKey_&&(et(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(et(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=W(t,de.PRECOMPOSE,function(e){const i=e.frameState.layerStatesArray,n=this.getLayerState(!1);H(!i.some(function(r){return r.layer===n.layer}),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),i.push(n)},this),this.mapRenderKey_=W(this,O.CHANGE,t.render,t),this.changed())}setSource(t){this.set(tt.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}}function ba(s,t){if(!s.visible)return!1;const e=t.resolution;if(e<s.minResolution||e>=s.maxResolution)return!1;const i=t.zoom;return i>s.minZoom&&i<=s.maxZoom}const fn=zg;class Wg extends Yo{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){N()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;ie(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),Pr(n,i)}forEachFeatureAtCoordinate(t,e,i,n,r,o,a,l){let h;const c=e.viewState;function u(x,E,C,S){return r.call(o,E,x?C:null,S)}const d=c.projection,g=Mr(t.slice(),d),p=[[0,0]];if(d.canWrapX()&&n){const x=d.getExtent(),E=J(x);p.push([-E,0],[E,0])}const f=e.layerStatesArray,_=f.length,m=[],y=[];for(let x=0;x<p.length;x++)for(let E=_-1;E>=0;--E){const C=f[E],S=C.layer;if(S.hasRenderer()&&ba(C,c)&&a.call(l,S)){const w=S.getRenderer(),P=S.getSource();if(w&&P){const L=P.getWrapX()?g:t,j=u.bind(null,C.managed);y[0]=L[0]+p[x][0],y[1]=L[1]+p[x][1],h=w.forEachFeatureAtCoordinate(y,e,i,j,m)}if(h)return h}}if(m.length===0)return;const v=1/m.length;return m.forEach((x,E)=>x.distanceSq+=E*v),m.sort((x,E)=>x.distanceSq-E.distanceSq),m.some(x=>h=x.callback(x.feature,x.layer,x.geometry)),h}hasFeatureAtCoordinate(t,e,i,n,r,o){return this.forEachFeatureAtCoordinate(t,e,i,n,ns,this,r,o)!==void 0}getMap(){return this.map_}renderFrame(t){N()}flushDeclutterItems(t){}scheduleExpireIconCache(t){Jn.canExpireCache()&&t.postRenderFunctions.push(Bg)}}function Bg(s,t){Jn.expire()}const Ug=Wg;class $g extends Zt{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}}const pc=$g,Fn="ol-hidden",Xg="ol-selectable",_e="ol-unselectable",jl="ol-unsupported",bi="ol-control",or="ol-collapsed",Yg=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`].join(""),"i"),Vl=["style","variant","weight","size","lineHeight","family"],fc=function(s){const t=s.match(Yg);if(!t)return null;const e={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let i=0,n=Vl.length;i<n;++i){const r=t[i+1];r!==void 0&&(e[Vl[i]]=r)}return e.families=e.family.split(/,\s?/),e};function St(s,t,e,i){let n;return e&&e.length?n=e.shift():Ho?n=new OffscreenCanvas(s||300,t||300):n=document.createElement("canvas"),s&&(n.width=s),t&&(n.height=t),n.getContext("2d",i)}function _n(s){const t=s.canvas;t.width=1,t.height=1,s.clearRect(0,0,1,1)}function Kg(s){let t=s.offsetWidth;const e=getComputedStyle(s);return t+=parseInt(e.marginLeft,10)+parseInt(e.marginRight,10),t}function Hg(s){let t=s.offsetHeight;const e=getComputedStyle(s);return t+=parseInt(e.marginTop,10)+parseInt(e.marginBottom,10),t}function cs(s,t){const e=t.parentNode;e&&e.replaceChild(s,t)}function ar(s){return s&&s.parentNode?s.parentNode.removeChild(s):null}function _c(s){for(;s.lastChild;)s.removeChild(s.lastChild)}function Zg(s,t){const e=s.childNodes;for(let i=0;;++i){const n=e[i],r=t[i];if(!n&&!r)break;if(n!==r){if(!n){s.appendChild(r);continue}if(!r){s.removeChild(n),--i;continue}s.insertBefore(r,n)}}}const mc="10px sans-serif",At="#000",us="round",Ae=[],Fe=0,ds="round",Hs=10,Zs="#000",qs="center",lr="middle",mi=[0,0,0,0],Js=1,Re=new se;let zi=null,Lo;const Ao={},qg=function(){const s="32px ",t=["monospace","serif"],e=t.length,i="wmytzilWMYTZIL@#/&?$%10";let n,r;function o(l,h,c){let u=!0;for(let d=0;d<e;++d){const g=t[d];if(r=hr(l+" "+h+" "+s+g,i),c!=g){const p=hr(l+" "+h+" "+s+c+","+g,i);u=u&&p!=r}}return!!u}function a(){let l=!0;const h=Re.getKeys();for(let c=0,u=h.length;c<u;++c){const d=h[c];Re.get(d)<100&&(o.apply(this,d.split(`
32
- `))?(an(Ao),zi=null,Lo=void 0,Re.set(d,100)):(Re.set(d,Re.get(d)+1,!0),l=!1))}l&&(clearInterval(n),n=void 0)}return function(l){const h=fc(l);if(!h)return;const c=h.families;for(let u=0,d=c.length;u<d;++u){const g=c[u],p=h.style+`
33
- `+h.weight+`
34
- `+g;Re.get(p)===void 0&&(Re.set(p,100,!0),o(h.style,h.weight,g)||(Re.set(p,0,!0),n===void 0&&(n=setInterval(a,32))))}}}(),Jg=function(){let s;return function(t){let e=Ao[t];if(e==null){if(Ho){const i=fc(t),n=yc(t,"Žg");e=(isNaN(Number(i.lineHeight))?1.2:Number(i.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else s||(s=document.createElement("div"),s.innerHTML="M",s.style.minHeight="0",s.style.maxHeight="none",s.style.height="auto",s.style.padding="0",s.style.border="none",s.style.position="absolute",s.style.display="block",s.style.left="-99999px"),s.style.font=t,document.body.appendChild(s),e=s.offsetHeight,document.body.removeChild(s);Ao[t]=e}return e}}();function yc(s,t){return zi||(zi=St(1,1)),s!=Lo&&(zi.font=s,Lo=zi.font),zi.measureText(t)}function hr(s,t){return yc(s,t).width}function zl(s,t,e){if(t in e)return e[t];const i=t.split(`
35
- `).reduce((n,r)=>Math.max(n,hr(s,r)),0);return e[t]=i,i}function Qg(s,t){const e=[],i=[],n=[];let r=0,o=0,a=0,l=0;for(let h=0,c=t.length;h<=c;h+=2){const u=t[h];if(u===`
36
- `||h===c){r=Math.max(r,o),n.push(o),o=0,a+=l;continue}const d=t[h+1]||s.font,g=hr(d,u);e.push(g),o+=g;const p=Jg(d);i.push(p),l=Math.max(l,p)}return{width:r,height:a,widths:e,heights:i,lineWidths:n}}function tp(s,t,e,i,n,r,o,a,l,h,c){s.save(),e!==1&&(s.globalAlpha*=e),t&&s.transform.apply(s,t),i.contextInstructions?(s.translate(l,h),s.scale(c[0],c[1]),ep(i,s)):c[0]<0||c[1]<0?(s.translate(l,h),s.scale(c[0],c[1]),s.drawImage(i,n,r,o,a,0,0,o,a)):s.drawImage(i,n,r,o,a,l,h,o*c[0],a*c[1]),s.restore()}function ep(s,t){const e=s.contextInstructions;for(let i=0,n=e.length;i<n;i+=2)Array.isArray(e[i+1])?t[e[i]].apply(t,e[i+1]):t[e[i]]=e[i+1]}class ip extends Ug{constructor(t){super(t),this.fontChangeListenerKey_=W(Re,Ci.PROPERTYCHANGE,t.redrawText.bind(t)),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=_e+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0,this.declutterLayers_=[]}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new pc(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){et(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(t),this.dispatchRenderEvent(de.PRECOMPOSE,t);const e=t.layerStatesArray.sort(function(o,a){return o.zIndex-a.zIndex}),i=t.viewState;this.children_.length=0;const n=this.declutterLayers_;n.length=0;let r=null;for(let o=0,a=e.length;o<a;++o){const l=e[o];t.layerIndex=o;const h=l.layer,c=h.getSourceState();if(!ba(l,i)||c!="ready"&&c!="undefined"){h.unrender();continue}const u=h.render(t,r);u&&(u!==r&&(this.children_.push(u),r=u),"getDeclutter"in h&&n.push(h))}this.flushDeclutterItems(t),Zg(this.element_,this.children_),this.dispatchRenderEvent(de.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}flushDeclutterItems(t){const e=this.declutterLayers_;for(let i=e.length-1;i>=0;--i)e[i].renderDeclutter(t);e.length=0}}const sp=ip;class Xe extends Zt{constructor(t,e){super(t),this.layer=e}}const eo={LAYERS:"layers"};class Ia extends Kh{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(eo.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Rt(i.slice(),{unique:!0}):H(typeof i.getArray=="function","Expected `layers` to be an array or a `Collection`"):i=new Rt(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(et),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(W(t,Et.ADD,this.handleLayersAdd_,this),W(t,Et.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(et);an(this.listenerKeys_);const e=t.getArray();for(let i=0,n=e.length;i<n;i++){const r=e[i];this.registerLayerListeners_(r),this.dispatchEvent(new Xe("addlayer",r))}this.changed()}registerLayerListeners_(t){const e=[W(t,Ci.PROPERTYCHANGE,this.handleLayerChange_,this),W(t,O.CHANGE,this.handleLayerChange_,this)];t instanceof Ia&&e.push(W(t,"addlayer",this.handleLayerGroupAdd_,this),W(t,"removelayer",this.handleLayerGroupRemove_,this)),this.listenerKeys_[D(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new Xe("addlayer",t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new Xe("removelayer",t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new Xe("addlayer",e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=D(e);this.listenerKeys_[i].forEach(et),delete this.listenerKeys_[i],this.dispatchEvent(new Xe("removelayer",e)),this.changed()}getLayers(){return this.get(eo.LAYERS)}setLayers(t){const e=this.getLayers();if(e){const i=e.getArray();for(let n=0,r=i.length;n<r;++n)this.dispatchEvent(new Xe("removelayer",i[n]))}this.set(eo.LAYERS,t)}getLayersArray(t){return t=t!==void 0?t:[],this.getLayers().forEach(function(e){e.getLayersArray(t)}),t}getLayerStatesArray(t){const e=t!==void 0?t:[],i=e.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(e)});const n=this.getLayerState();let r=n.zIndex;!t&&n.zIndex===void 0&&(r=0);for(let o=i,a=e.length;o<a;o++){const l=e[o];l.opacity*=n.opacity,l.visible=l.visible&&n.visible,l.maxResolution=Math.min(l.maxResolution,n.maxResolution),l.minResolution=Math.max(l.minResolution,n.minResolution),l.minZoom=Math.max(l.minZoom,n.minZoom),l.maxZoom=Math.min(l.maxZoom,n.maxZoom),n.extent!==void 0&&(l.extent!==void 0?l.extent=Me(l.extent,n.extent):l.extent=n.extent),l.zIndex===void 0&&(l.zIndex=r)}return e}getSourceState(){return"ready"}}const wi=Ia;class np extends Zt{constructor(t,e,i){super(t),this.map=e,this.frameState=i!==void 0?i:null}}const Wi=np;class rp extends Wi{constructor(t,e,i,n,r,o){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=n!==void 0?n:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}const be=rp,Y={SINGLECLICK:"singleclick",CLICK:O.CLICK,DBLCLICK:O.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},le={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};class op extends ln{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=e===void 0?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=W(i,le.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=W(i,le.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(O.TOUCHMOVE,this.boundHandleTouchMove_,Nh?{passive:!1}:!1)}emulateClick_(t){let e=new be(Y.CLICK,this.map_,t);this.dispatchEvent(e),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new be(Y.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const i=new be(Y.SINGLECLICK,this.map_,t);this.dispatchEvent(i)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==Y.POINTERUP||e.type==Y.POINTERCANCEL){delete this.trackedTouches_[i];for(const n in this.trackedTouches_)if(this.trackedTouches_[n].target!==e.target){delete this.trackedTouches_[n];break}}else(e.type==Y.POINTERDOWN||e.type==Y.POINTERMOVE)&&(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new be(Y.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(et),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return t.button===0}handlePointerDown_(t){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(t);const e=new be(Y.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),this.dragListenerKeys_.length===0){const i=this.map_.getOwnerDocument();this.dragListenerKeys_.push(W(i,Y.POINTERMOVE,this.handlePointerMove_,this),W(i,Y.POINTERUP,this.handlePointerUp_,this),W(this.element_,Y.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==i&&this.dragListenerKeys_.push(W(this.element_.getRootNode(),Y.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new be(Y.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!!(this.down_&&this.isMoving_(t));this.dispatchEvent(new be(Y.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;(!e||e.defaultPrevented)&&(typeof t.cancelable!="boolean"||t.cancelable===!0)&&t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(et(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(O.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(et(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(et),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}const ap=op,ae={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},ut={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},Fo=1/0;class lp{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,an(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];t.length==1?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){H(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=Fo?(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0):!1}getCount(){return this.elements_.length}getLeftChildIndex_(t){return t*2+1}getRightChildIndex_(t){return t*2+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return this.elements_.length===0}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],o=i[t],a=t;for(;t<n>>1;){const l=this.getLeftChildIndex_(t),h=this.getRightChildIndex_(t),c=h<n&&i[h]<i[l]?h:l;e[t]=e[c],i[t]=i[c],t=c}e[t]=r,i[t]=o,this.siftDown_(a,t)}siftDown_(t,e){const i=this.elements_,n=this.priorities_,r=i[e],o=n[e];for(;e>t;){const a=this.getParentIndex_(e);if(n[a]>o)i[e]=i[a],n[e]=n[a],e=a;else break}i[e]=r,n[e]=o}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let o,a,l;for(a=0;a<r;++a)o=e[a],l=t(o),l==Fo?delete this.queuedElements_[this.keyFunction_(o)]:(i[n]=l,e[n++]=o);e.length=n,i.length=n,this.heapify_()}}const hp=lp,b={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class cp extends hp{constructor(t,e){super(function(i){return t.apply(null,i)},function(i){return i[0].getKey()}),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);return e&&t[0].addEventListener(O.CHANGE,this.boundHandleTileChange_),e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===b.LOADED||i===b.ERROR||i===b.EMPTY){i!==b.ERROR&&e.removeEventListener(O.CHANGE,this.boundHandleTileChange_);const n=e.getKey();n in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[n],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0,n,r,o;for(;this.tilesLoading_<t&&i<e&&this.getCount()>0;)r=this.dequeue()[0],o=r.getKey(),n=r.getState(),n===b.IDLE&&!(o in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[o]=!0,++this.tilesLoading_,++i,r.load())}}const up=cp;function dp(s,t,e,i,n){if(!s||!(e in s.wantedTiles)||!s.wantedTiles[e][t.getKey()])return Fo;const r=s.viewState.center,o=i[0]-r[0],a=i[1]-r[1];return 65536*Math.log(n)+Math.sqrt(o*o+a*a)/n}class gp extends se{constructor(t){super();const e=t.element;e&&!t.target&&!e.style.pointerEvents&&(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){ar(this.element),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&ar(this.element);for(let e=0,i=this.listenerKeys.length;e<i;++e)et(this.listenerKeys[e]);this.listenerKeys.length=0,this.map_=t,t&&((this.target_?this.target_:t.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==rs&&this.listenerKeys.push(W(t,ae.POSTRENDER,this.render,this)),t.render())}render(t){}setTarget(t){this.target_=typeof t=="string"?document.getElementById(t):t}}const ye=gp;class pp extends ye{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=t.collapsible!==void 0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1);const e=t.className!==void 0?t.className:"ol-attribution",i=t.tipLabel!==void 0?t.tipLabel:"Attributions",n=t.expandClassName!==void 0?t.expandClassName:e+"-expand",r=t.collapseLabel!==void 0?t.collapseLabel:"›",o=t.collapseClassName!==void 0?t.collapseClassName:e+"-collapse";typeof r=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=r,this.collapseLabel_.className=o):this.collapseLabel_=r;const a=t.label!==void 0?t.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=n):this.label_=a;const l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(O.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+_e+" "+bi+(this.collapsed_&&this.collapsible_?" "+or:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=h,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=Array.from(new Set(this.getMap().getAllLayers().flatMap(n=>n.getAttributions(t)))),i=!this.getMap().getAllLayers().some(n=>n.getSource()&&n.getSource().getAttributionsCollapsible()===!1);return this.overrideCollapsible_||this.setCollapsible(i),e}updateElement_(t){if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=this.collectSourceAttributions_(t),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!Ge(e,this.renderedAttributions_)){_c(this.ulElement_);for(let n=0,r=e.length;n<r;++n){const o=document.createElement("li");o.innerHTML=e[n],this.ulElement_.appendChild(o)}this.renderedAttributions_=e}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(or),this.collapsed_?cs(this.collapseLabel_,this.label_):cs(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,!(!this.collapsible_||this.collapsed_===t)&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}const vc=pp;class fp extends ye{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=t.className!==void 0?t.className:"ol-rotate",i=t.label!==void 0?t.label:"⇧",n=t.compassClassName!==void 0?t.compassClassName:"ol-compass";this.label_=null,typeof i=="string"?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const r=t.tipLabel?t.tipLabel:"Reset rotation",o=document.createElement("button");o.className=e+"-reset",o.setAttribute("type","button"),o.title=r,o.appendChild(this.label_),o.addEventListener(O.CLICK,this.handleClick_.bind(this),!1);const a=e+" "+_e+" "+bi,l=this.element;l.className=a,l.appendChild(o),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=t.duration!==void 0?t.duration:250,this.autoHide_=t.autoHide!==void 0?t.autoHide:!0,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Fn)}handleClick_(t){t.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const e=t.getRotation();e!==void 0&&(this.duration_>0&&e%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:Ti}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const n="rotate("+i+"rad)";if(this.autoHide_){const r=this.element.classList.contains(Fn);!r&&i===0?this.element.classList.add(Fn):r&&i!==0&&this.element.classList.remove(Fn)}this.label_.style.transform=n}this.rotation_=i}}const xc=fp;class _p extends ye{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=t.className!==void 0?t.className:"ol-zoom",i=t.delta!==void 0?t.delta:1,n=t.zoomInClassName!==void 0?t.zoomInClassName:e+"-in",r=t.zoomOutClassName!==void 0?t.zoomOutClassName:e+"-out",o=t.zoomInLabel!==void 0?t.zoomInLabel:"+",a=t.zoomOutLabel!==void 0?t.zoomOutLabel:"–",l=t.zoomInTipLabel!==void 0?t.zoomInTipLabel:"Zoom in",h=t.zoomOutTipLabel!==void 0?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=n,c.setAttribute("type","button"),c.title=l,c.appendChild(typeof o=="string"?document.createTextNode(o):o),c.addEventListener(O.CLICK,this.handleClick_.bind(this,i),!1);const u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=h,u.appendChild(typeof a=="string"?document.createTextNode(a):a),u.addEventListener(O.CLICK,this.handleClick_.bind(this,-i),!1);const d=e+" "+_e+" "+bi,g=this.element;g.className=d,g.appendChild(c),g.appendChild(u),this.duration_=t.duration!==void 0?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(i!==void 0){const n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:Ti})):e.setZoom(n)}}}const Ec=_p;function Cc(s){s=s||{};const t=new Rt;return(s.zoom===void 0||s.zoom)&&t.push(new Ec(s.zoomOptions)),(s.rotate===void 0||s.rotate)&&t.push(new xc(s.rotateOptions)),(s.attribution===void 0||s.attribution)&&t.push(new vc(s.attributionOptions)),t}const Oo={ACTIVE:"active"};class mp extends se{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Oo.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Oo.ACTIVE,t)}setMap(t){this.map_=t}}function yp(s,t,e){const i=s.getCenterInternal();if(i){const n=[i[0]+t[0],i[1]+t[1]];s.animateInternal({duration:e!==void 0?e:250,easing:xg,center:s.getConstrainedCenter(n)})}}function Pa(s,t,e,i){const n=s.getZoom();if(n===void 0)return;const r=s.getConstrainedZoom(n+t),o=s.getResolutionForZoom(r);s.getAnimating()&&s.cancelAnimations(),s.animate({resolution:o,anchor:e,duration:i!==void 0?i:250,easing:Ti})}const mn=mp;class vp extends mn{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:250}handleEvent(t){let e=!1;if(t.type==Y.DBLCLICK){const i=t.originalEvent,n=t.map,r=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=n.getView();Pa(a,o,r,this.duration_),i.preventDefault(),e=!0}return!e}}const xp=vp;class Ep extends mn{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==Y.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==Y.POINTERUP){const i=this.handleUpEvent(t);this.handlingDownUpSequence=i&&this.targetPointers.length>0}}else if(t.type==Y.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==Y.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function Ma(s){const t=s.length;let e=0,i=0;for(let n=0;n<t;n++)e+=s[n].clientX,i+=s[n].clientY;return{clientX:e/t,clientY:i/t}}const Ii=Ep;function Do(s){const t=arguments;return function(e){let i=!0;for(let n=0,r=t.length;n<r&&(i=i&&t[n](e),!!i);++n);return i}}const Cp=function(s){const t=s.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},wp=function(s){const t=s.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Sp=function(s){const t=s.map.getTargetElement(),e=s.map.getOwnerDocument().activeElement;return t.contains(e)},wc=function(s){return s.map.getTargetElement().hasAttribute("tabindex")?Sp(s):!0},cr=ns,Sc=function(s){const t=s.originalEvent;return t.button==0&&!(Rd&&Ko&&t.ctrlKey)},Tp=fs,Rp=function(s){return s.type==Y.SINGLECLICK},La=function(s){const t=s.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},Wl=function(s){const t=s.originalEvent;return!t.altKey&&(Ko?t.metaKey:t.ctrlKey)&&!t.shiftKey},bp=function(s){const t=s.originalEvent;return Ko?t.metaKey:t.ctrlKey},Tc=function(s){const t=s.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Rc=function(s){const t=s.originalEvent,e=t.target.tagName;return e!=="INPUT"&&e!=="SELECT"&&e!=="TEXTAREA"&&!t.target.isContentEditable},io=function(s){const t=s.originalEvent;return H(t!==void 0,"mapBrowserEvent must originate from a pointer event"),t.pointerType=="mouse"},bc=function(s){const t=s.originalEvent;return H(t!==void 0,"mapBrowserEvent must originate from a pointer event"),t.isPrimary&&t.button===0};class Ip extends Ii{constructor(t){super({stopDown:fs}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Do(La,bc);this.condition_=t.onFocusOnly?Do(wc,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,n=e.getEventPixel(Ma(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(n[0],n[1]),this.lastCentroid){const r=[this.lastCentroid[0]-n[0],n[1]-this.lastCentroid[1]],o=t.map.getView();og(r,o.getResolution()),aa(r,o.getRotation()),o.adjustCenterInternal(r)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=n,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const n=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),o=i.getCenterInternal(),a=e.getPixelFromCoordinateInternal(o),l=e.getCoordinateFromPixelInternal([a[0]-n*Math.cos(r),a[1]-n*Math.sin(r)]);i.animateInternal({center:i.getConstrainedCenter(l),duration:500,easing:Ti})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}const Gs=Ip;class Pp extends Ii{constructor(t){t=t||{},super({stopDown:fs}),this.condition_=t.condition?t.condition:wp,this.lastAngle_=void 0,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){if(!io(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===fa)return;const n=e.getSize(),r=t.pixel,o=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(this.lastAngle_!==void 0){const a=o-this.lastAngle_;i.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(t){return io(t)?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){return io(t)&&Sc(t)&&this.condition_(t)?(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}}const Mp=Pp;class Lp extends Yo{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_,i="px",n=this.element_.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){const t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new zt([i])}getGeometry(){return this.geometry_}}const Ap=Lp,On={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class so extends Zt{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class Fp extends Ii{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.box_=new Ap(t.className||"ol-dragbox"),this.minArea_=t.minArea!==void 0?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition?t.condition:Sc,this.boxEndCondition_=t.boxEndCondition?t.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],r=i[1]-e[1];return n*n+r*r>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new so(On.BOXDRAG,t.coordinate,t))}handleUpEvent(t){this.box_.setMap(null);const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new so(e?On.BOXEND:On.BOXCANCEL,t.coordinate,t)),!1}handleDownEvent(t){return this.condition_(t)?(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new so(On.BOXSTART,t.coordinate,t)),!0):!1}onBoxEnd(t){}}const Op=Fp;class Dp extends Op{constructor(t){t=t||{};const e=t.condition?t.condition:Tc;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=t.duration!==void 0?t.duration:200,this.out_=t.out!==void 0?t.out:!1}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.out_){const n=e.rotatedExtentForGeometry(i),r=e.getResolutionForExtentInternal(n),o=e.getResolution()/r;i=i.clone(),i.scale(o*o)}e.fitInternal(i,{duration:this.duration_,easing:Ti})}}const kp=Dp,di={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class Np extends mn{constructor(t){super(),t=t||{},this.defaultCondition_=function(e){return La(e)&&Rc(e)},this.condition_=t.condition!==void 0?t.condition:this.defaultCondition_,this.duration_=t.duration!==void 0?t.duration:100,this.pixelDelta_=t.pixelDelta!==void 0?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==O.KEYDOWN){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==di.DOWN||n==di.LEFT||n==di.RIGHT||n==di.UP)){const r=t.map.getView(),o=r.getResolution()*this.pixelDelta_;let a=0,l=0;n==di.DOWN?l=-o:n==di.LEFT?a=-o:n==di.RIGHT?a=o:l=o;const h=[a,l];aa(h,r.getRotation()),yp(r,h,this.duration_),i.preventDefault(),e=!0}}return!e}}const Gp=Np;class jp extends mn{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(e){return!bp(e)&&Rc(e)},this.delta_=t.delta?t.delta:1,this.duration_=t.duration!==void 0?t.duration:100}handleEvent(t){let e=!1;if(t.type==O.KEYDOWN||t.type==O.KEYPRESS){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==="+"||n==="-")){const r=t.map,o=n==="+"?this.delta_:-this.delta_,a=r.getView();Pa(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}const Vp=jp;class zp{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;for(;i>0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],o=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(o,r),this.initialVelocity_=Math.sqrt(r*r+o*o)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}const Wp=zp;class Bp extends mn{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=t.maxDelta!==void 0?t.maxDelta:1,this.duration_=t.duration!==void 0?t.duration:250,this.timeout_=t.timeout!==void 0?t.timeout:80,this.useAnchor_=t.useAnchor!==void 0?t.useAnchor:!0,this.constrainResolution_=t.constrainResolution!==void 0?t.constrainResolution:!1;const e=t.condition?t.condition:cr;this.condition_=t.onFocusOnly?Do(wc,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();t&&t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t)||t.type!==O.WHEEL)return!0;const e=t.map,i=t.originalEvent;i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate);let n;if(t.type==O.WHEEL&&(n=i.deltaY,Sd&&i.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(n/=kh),i.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=40)),n===0)return!1;this.lastDelta_=n;const r=Date.now();this.startTime_===void 0&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(n)<4?"trackpad":"wheel");const o=e.getView();if(this.mode_==="trackpad"&&!(o.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),o.adjustZoom(-n/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=r,!1;this.totalDelta_+=n;const a=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),a),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-at(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Pa(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}const ur=Bp;class Up extends Ii{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=fs),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=t.threshold!==void 0?t.threshold:.3,this.duration_=t.duration!==void 0?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(this.lastAngle_!==void 0){const l=r-this.lastAngle_;this.rotationDelta_+=l,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=l}this.lastAngle_=r;const o=t.map,a=o.getView();a.getConstraints().rotation!==fa&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Ma(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){return this.targetPointers.length<2?(t.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}const $p=Up;class Xp extends Ii{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=fs),super(e),this.anchor_=null,this.duration_=t.duration!==void 0?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,o=i.clientY-n.clientY,a=Math.sqrt(r*r+o*o);this.lastDistance_!==void 0&&(e=this.lastDistance_/a),this.lastDistance_=a;const l=t.map,h=l.getView();e!=1&&(this.lastScaleDelta_=e),this.anchor_=l.getCoordinateFromPixelInternal(l.getEventPixel(Ma(this.targetPointers))),l.render(),h.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}const Yp=Xp;function Kp(s){s=s||{};const t=new Rt,e=new Wp(-.005,.05,100);return(s.altShiftDragRotate===void 0||s.altShiftDragRotate)&&t.push(new Mp),(s.doubleClickZoom===void 0||s.doubleClickZoom)&&t.push(new xp({delta:s.zoomDelta,duration:s.zoomDuration})),(s.dragPan===void 0||s.dragPan)&&t.push(new Gs({onFocusOnly:s.onFocusOnly,kinetic:e})),(s.pinchRotate===void 0||s.pinchRotate)&&t.push(new $p),(s.pinchZoom===void 0||s.pinchZoom)&&t.push(new Yp({duration:s.zoomDuration})),(s.keyboard===void 0||s.keyboard)&&(t.push(new Gp),t.push(new Vp({delta:s.zoomDelta,duration:s.zoomDuration}))),(s.mouseWheelZoom===void 0||s.mouseWheelZoom)&&t.push(new ur({onFocusOnly:s.onFocusOnly,duration:s.zoomDuration})),(s.shiftDragZoom===void 0||s.shiftDragZoom)&&t.push(new kp({duration:s.zoomDuration})),t}function Bl(s){return s[0]>0&&s[1]>0}function Hp(s,t,e){return e===void 0&&(e=[0,0]),e[0]=s[0]*t+.5|0,e[1]=s[1]*t+.5|0,e}function bt(s,t){return Array.isArray(s)?s:(t===void 0?t=[s,s]:(t[0]=s,t[1]=s),t)}function Ic(s){if(s instanceof fn){s.setMapInternal(null);return}s instanceof wi&&s.getLayers().forEach(Ic)}function Pc(s,t){if(s instanceof fn){s.setMapInternal(t);return}if(s instanceof wi){const e=s.getLayers().getArray();for(let i=0,n=e.length;i<n;++i)Pc(e[i],t)}}let Zp=class extends se{constructor(s){super(),s=s||{},this.on,this.once,this.un;const t=qp(s);this.renderComplete_,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=s.maxTilesLoading!==void 0?s.maxTilesLoading:16,this.pixelRatio_=s.pixelRatio!==void 0?s.pixelRatio:kh,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Yt(),this.pixelToCoordinateTransform_=Yt(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_),this.mapBrowserEventHandler_=null,this.moveTolerance_=s.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,this.resizeObserver_=new ResizeObserver(()=>this.updateSize()),this.controls=t.controls||Cc(),this.interactions=t.interactions||Kp({onFocusOnly:!0}),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new up(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(ut.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(ut.VIEW,this.handleViewChanged_),this.addChangeListener(ut.SIZE,this.handleSizeChanged_),this.addChangeListener(ut.TARGET,this.handleTargetChanged_),this.setProperties(t.values);const e=this;s.view&&!(s.view instanceof Qt)&&s.view.then(function(i){e.setView(new Qt(i))}),this.controls.addEventListener(Et.ADD,i=>{i.element.setMap(this)}),this.controls.addEventListener(Et.REMOVE,i=>{i.element.setMap(null)}),this.interactions.addEventListener(Et.ADD,i=>{i.element.setMap(this)}),this.interactions.addEventListener(Et.REMOVE,i=>{i.element.setMap(null)}),this.overlays_.addEventListener(Et.ADD,i=>{this.addOverlayInternal_(i.element)}),this.overlays_.addEventListener(Et.REMOVE,i=>{const n=i.element.getId();n!==void 0&&delete this.overlayIdIndex_[n.toString()],i.element.setMap(null)}),this.controls.forEach(i=>{i.setMap(this)}),this.interactions.forEach(i=>{i.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(s){this.getControls().push(s)}addInteraction(s){this.getInteractions().push(s)}addLayer(s){this.getLayerGroup().getLayers().push(s)}handleLayerAdd_(s){Pc(s.layer,this)}addOverlay(s){this.getOverlays().push(s)}addOverlayInternal_(s){const t=s.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=s),s.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(s,t,e){if(!this.frameState_||!this.renderer_)return;const i=this.getCoordinateFromPixelInternal(s);e=e!==void 0?e:{};const n=e.hitTolerance!==void 0?e.hitTolerance:0,r=e.layerFilter!==void 0?e.layerFilter:ns,o=e.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(i,this.frameState_,n,o,t,null,r,null)}getFeaturesAtPixel(s,t){const e=[];return this.forEachFeatureAtPixel(s,function(i){e.push(i)},t),e}getAllLayers(){const s=[];function t(e){e.forEach(function(i){i instanceof wi?t(i.getLayers()):s.push(i)})}return t(this.getLayers()),s}hasFeatureAtPixel(s,t){if(!this.frameState_||!this.renderer_)return!1;const e=this.getCoordinateFromPixelInternal(s);t=t!==void 0?t:{};const i=t.layerFilter!==void 0?t.layerFilter:ns,n=t.hitTolerance!==void 0?t.hitTolerance:0,r=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(e,this.frameState_,n,r,i,null)}getEventCoordinate(s){return this.getCoordinateFromPixel(this.getEventPixel(s))}getEventCoordinateInternal(s){return this.getCoordinateFromPixelInternal(this.getEventPixel(s))}getEventPixel(s){const t=this.viewport_.getBoundingClientRect(),e=this.getSize(),i=t.width/e[0],n=t.height/e[1],r="changedTouches"in s?s.changedTouches[0]:s;return[(r.clientX-t.left)/i,(r.clientY-t.top)/n]}getTarget(){return this.get(ut.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(s){return hs(this.getCoordinateFromPixelInternal(s),this.getView().getProjection())}getCoordinateFromPixelInternal(s){const t=this.frameState_;return t?gt(t.pixelToCoordinateTransform,s.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(s){const t=this.overlayIdIndex_[s.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(ut.LAYERGROUP)}setLayers(s){const t=this.getLayerGroup();if(s instanceof Rt){t.setLayers(s);return}const e=t.getLayers();e.clear(),e.extend(s)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const s=this.getLayerGroup().getLayerStatesArray();for(let t=0,e=s.length;t<e;++t){const i=s[t];if(!i.visible)continue;const n=i.layer.getRenderer();if(n&&!n.ready)return!0;const r=i.layer.getSource();if(r&&r.loading)return!0}return!1}getPixelFromCoordinate(s){const t=lt(s,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(s){const t=this.frameState_;return t?gt(t.coordinateToPixelTransform,s.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(ut.SIZE)}getView(){return this.get(ut.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const s=this.getTargetElement();return s?s.ownerDocument:document}getTilePriority(s,t,e,i){return dp(this.frameState_,s,t,e,i)}handleBrowserEvent(s,t){t=t||s.type;const e=new be(t,this,s);this.handleMapBrowserEvent(e)}handleMapBrowserEvent(s){if(!this.frameState_)return;const t=s.originalEvent,e=t.type;if(e===le.POINTERDOWN||e===O.WHEEL||e===O.KEYDOWN){const i=this.getOwnerDocument(),n=this.viewport_.getRootNode?this.viewport_.getRootNode():i,r=t.target;if(this.overlayContainerStopEvent_.contains(r)||!(n===i?i.documentElement:n).contains(r))return}if(s.frameState=this.frameState_,this.dispatchEvent(s)!==!1){const i=this.getInteractions().getArray().slice();for(let n=i.length-1;n>=0;n--){const r=i[n];if(!(r.getMap()!==this||!r.getActive()||!this.getTargetElement())&&(!r.handleEvent(s)||s.propagationStopped))break}}}handlePostRender(){const s=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let i=this.maxTilesLoading_,n=i;if(s){const r=s.viewHints;if(r[ot.ANIMATING]||r[ot.INTERACTING]){const o=Date.now()-s.time>8;i=o?0:8,n=o?0:2}}t.getTilesLoading()<i&&(t.reprioritize(),t.loadMoreTiles(i,n))}s&&this.renderer_&&!s.animate&&(this.renderComplete_===!0?(this.hasListener(de.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(de.RENDERCOMPLETE,s),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Wi(ae.LOADEND,this,s)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Wi(ae.LOADSTART,this,s))));const e=this.postRenderFunctions_;for(let i=0,n=e.length;i<n;++i)e[i](this,s);e.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let e=0,i=this.targetChangeHandlerKeys_.length;e<i;++e)et(this.targetChangeHandlerKeys_[e]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(O.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(O.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,ar(this.viewport_)}if(this.targetElement_){this.resizeObserver_.unobserve(this.targetElement_);const e=this.targetElement_.getRootNode();e instanceof ShadowRoot&&this.resizeObserver_.unobserve(e.host),this.setSize(void 0)}const s=this.getTarget(),t=typeof s=="string"?document.getElementById(s):s;if(this.targetElement_=t,!t)this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0);else{t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new sp(this)),this.mapBrowserEventHandler_=new ap(this,this.moveTolerance_);for(const n in Y)this.mapBrowserEventHandler_.addEventListener(Y[n],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(O.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(O.WHEEL,this.boundHandleBrowserEvent_,Nh?{passive:!1}:!1);const e=this.keyboardEventTarget_?this.keyboardEventTarget_:t;this.targetChangeHandlerKeys_=[W(e,O.KEYDOWN,this.handleBrowserEvent,this),W(e,O.KEYPRESS,this.handleBrowserEvent,this)];const i=t.getRootNode();i instanceof ShadowRoot&&this.resizeObserver_.observe(i.host),this.resizeObserver_.observe(t)}this.updateSize()}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(et(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(et(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const s=this.getView();s&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=W(s,Ci.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=W(s,O.CHANGE,this.handleViewPropertyChanged_,this),s.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(et),this.layerGroupPropertyListenerKeys_=null);const s=this.getLayerGroup();s&&(this.handleLayerAdd_(new Xe("addlayer",s)),this.layerGroupPropertyListenerKeys_=[W(s,Ci.PROPERTYCHANGE,this.render,this),W(s,O.CHANGE,this.render,this),W(s,"addlayer",this.handleLayerAdd_,this),W(s,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){const s=this.getLayerGroup().getLayerStatesArray();for(let t=0,e=s.length;t<e;++t){const i=s[t].layer;i.hasRenderer()&&i.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}flushDeclutterItems(){const s=this.frameState_;s&&this.renderer_.flushDeclutterItems(s)}removeControl(s){return this.getControls().remove(s)}removeInteraction(s){return this.getInteractions().remove(s)}removeLayer(s){return this.getLayerGroup().getLayers().remove(s)}handleLayerRemove_(s){Ic(s.layer)}removeOverlay(s){return this.getOverlays().remove(s)}renderFrame_(s){const t=this.getSize(),e=this.getView(),i=this.frameState_;let n=null;if(t!==void 0&&Bl(t)&&e&&e.isDef()){const r=e.getHints(this.frameState_?this.frameState_.viewHints:void 0),o=e.getState();if(n={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutterTree:null,extent:$s(o.center,o.resolution,o.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:s,usedTiles:{},viewState:o,viewHints:r,wantedTiles:{},mapId:D(this),renderTargets:{}},o.nextCenter&&o.nextResolution){const a=isNaN(o.nextRotation)?o.rotation:o.nextRotation;n.nextExtent=$s(o.nextCenter,o.nextResolution,a,t)}}this.frameState_=n,this.renderer_.renderFrame(n),n&&(n.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,n.postRenderFunctions),i&&(!this.previousExtent_||!ms(this.previousExtent_)&&!ri(n.extent,this.previousExtent_))&&(this.dispatchEvent(new Wi(ae.MOVESTART,this,i)),this.previousExtent_=cn(this.previousExtent_)),this.previousExtent_&&!n.viewHints[ot.ANIMATING]&&!n.viewHints[ot.INTERACTING]&&!ri(n.extent,this.previousExtent_)&&(this.dispatchEvent(new Wi(ae.MOVEEND,this,n)),jh(n.extent,this.previousExtent_))),this.dispatchEvent(new Wi(ae.POSTRENDER,this,n)),this.renderComplete_=this.hasListener(ae.LOADSTART)||this.hasListener(ae.LOADEND)||this.hasListener(de.RENDERCOMPLETE)?!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady():void 0,this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(s){const t=this.getLayerGroup();t&&this.handleLayerRemove_(new Xe("removelayer",t)),this.set(ut.LAYERGROUP,s)}setSize(s){this.set(ut.SIZE,s)}setTarget(s){this.set(ut.TARGET,s)}setView(s){if(!s||s instanceof Qt){this.set(ut.VIEW,s);return}this.set(ut.VIEW,new Qt);const t=this;s.then(function(e){t.setView(new Qt(e))})}updateSize(){const s=this.getTargetElement();let t;if(s){const i=getComputedStyle(s),n=s.offsetWidth-parseFloat(i.borderLeftWidth)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderRightWidth),r=s.offsetHeight-parseFloat(i.borderTopWidth)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderBottomWidth);!isNaN(n)&&!isNaN(r)&&(t=[n,r],!Bl(t)&&(s.offsetWidth||s.offsetHeight||s.getClientRects().length)&&Qh("No map visible because the map container's width or height are 0."))}const e=this.getSize();t&&(!e||!Ge(t,e))&&(this.setSize(t),this.updateViewportSize_(t))}updateViewportSize_(s){const t=this.getView();t&&t.setViewportSize(s)}};function qp(s){let t=null;s.keyboardEventTarget!==void 0&&(t=typeof s.keyboardEventTarget=="string"?document.getElementById(s.keyboardEventTarget):s.keyboardEventTarget);const e={},i=s.layers&&typeof s.layers.getLayers=="function"?s.layers:new wi({layers:s.layers});e[ut.LAYERGROUP]=i,e[ut.TARGET]=s.target,e[ut.VIEW]=s.view instanceof Qt?s.view:new Qt;let n;s.controls!==void 0&&(Array.isArray(s.controls)?n=new Rt(s.controls.slice()):(H(typeof s.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),n=s.controls));let r;s.interactions!==void 0&&(Array.isArray(s.interactions)?r=new Rt(s.interactions.slice()):(H(typeof s.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),r=s.interactions));let o;return s.overlays!==void 0?Array.isArray(s.overlays)?o=new Rt(s.overlays.slice()):(H(typeof s.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=s.overlays):o=new Rt,{controls:n,interactions:r,keyboardEventTarget:t,overlays:o,values:e}}const Mc=Zp,Jp=':root,:host{--ol-background-color: white;--ol-accent-background-color: #F5F5F5;--ol-subtle-background-color: rgba(128, 128, 128, .25);--ol-partial-background-color: rgba(255, 255, 255, .75);--ol-foreground-color: #333333;--ol-subtle-foreground-color: #666666;--ol-brand-color: #00AAFF}.ol-box{box-sizing:border-box;border-radius:2px;border:1.5px solid var(--ol-background-color);background-color:var(--ol-partial-background-color)}.ol-mouse-position{top:8px;right:8px;position:absolute}.ol-scale-line{background:var(--ol-partial-background-color);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute}.ol-scale-line-inner{border:1px solid var(--ol-subtle-foreground-color);border-top:none;color:var(--ol-foreground-color);font-size:10px;text-align:center;margin:1px;will-change:contents,width;transition:all .25s}.ol-scale-bar{position:absolute;bottom:8px;left:8px}.ol-scale-bar-inner{display:flex}.ol-scale-step-marker{width:1px;height:15px;background-color:var(--ol-foreground-color);float:right;z-index:10}.ol-scale-step-text{position:absolute;bottom:-5px;font-size:10px;z-index:11;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}.ol-scale-text{position:absolute;font-size:12px;text-align:center;bottom:25px;color:var(--ol-foreground-color);text-shadow:-1.5px 0 var(--ol-partial-background-color),0 1.5px var(--ol-partial-background-color),1.5px 0 var(--ol-partial-background-color),0 -1.5px var(--ol-partial-background-color)}.ol-scale-singlebar{position:relative;height:10px;z-index:9;box-sizing:border-box;border:1px solid var(--ol-foreground-color)}.ol-scale-singlebar-even{background-color:var(--ol-subtle-foreground-color)}.ol-scale-singlebar-odd{background-color:var(--ol-background-color)}.ol-unsupported{display:none}.ol-viewport,.ol-unselectable{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.ol-viewport canvas{all:unset;overflow:hidden}.ol-viewport{touch-action:pan-x pan-y}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:text;-moz-user-select:text;user-select:text}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.ol-control{position:absolute;background-color:var(--ol-subtle-background-color);border-radius:4px}.ol-zoom{top:.5em;left:.5em}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s}.ol-zoom-extent{top:4.643em;left:.5em}.ol-full-screen{right:.5em;top:.5em}.ol-control button{display:block;margin:1px;padding:0;color:var(--ol-subtle-foreground-color);font-weight:700;text-decoration:none;font-size:inherit;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:var(--ol-background-color);border:none;border-radius:2px}.ol-control button::-moz-focus-inner{border:none;padding:0}.ol-zoom-extent button{line-height:1.4em}.ol-compass{display:block;font-weight:400;will-change:transform}.ol-touch .ol-control button{font-size:1.5em}.ol-touch .ol-zoom-extent{top:5.5em}.ol-control button:hover,.ol-control button:focus{text-decoration:none;outline:1px solid var(--ol-subtle-foreground-color);color:var(--ol-foreground-color)}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em);display:flex;flex-flow:row-reverse;align-items:center}.ol-attribution a{color:var(--ol-subtle-foreground-color);text-decoration:none}.ol-attribution ul{margin:0;padding:1px .5em;color:var(--ol-foreground-color);text-shadow:0 0 2px var(--ol-background-color);font-size:12px}.ol-attribution li{display:inline;list-style:none}.ol-attribution li:not(:last-child):after{content:" "}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle}.ol-attribution button{flex-shrink:0}.ol-attribution.ol-collapsed ul{display:none}.ol-attribution:not(.ol-collapsed){background:var(--ol-partial-background-color)}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em}.ol-attribution.ol-uncollapsible button{display:none}.ol-zoomslider{top:4.5em;left:.5em;height:200px}.ol-zoomslider button{position:relative;height:10px}.ol-touch .ol-zoomslider{top:5.5em}.ol-overviewmap{left:.5em;bottom:.5em}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0}.ol-overviewmap .ol-overviewmap-map,.ol-overviewmap button{display:block}.ol-overviewmap .ol-overviewmap-map{border:1px solid var(--ol-subtle-foreground-color);height:150px;width:150px}.ol-overviewmap:not(.ol-collapsed) button{bottom:0;left:0;position:absolute}.ol-overviewmap.ol-collapsed .ol-overviewmap-map,.ol-overviewmap.ol-uncollapsible button{display:none}.ol-overviewmap:not(.ol-collapsed){background:var(--ol-subtle-background-color)}.ol-overviewmap-box{border:1.5px dotted var(--ol-subtle-foreground-color)}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move}';class Aa extends se{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if(typeof t.getSimplifiedGeometry=="function"){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Aa(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(et(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=W(t,O.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?Qp(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}function Qp(s){if(typeof s=="function")return s;let t;return Array.isArray(s)?t=s:(H(typeof s.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[s]),function(){return t}}const Pe=Aa;let Lc=class Ac extends ai{constructor(t,e,i){super(),i!==void 0&&e===void 0?this.setFlatCoordinates(i,t):(e=e||0,this.setCenterAndRadius(t,e,i))}clone(){const t=new Ac(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,o=t-r[0],a=e-r[1],l=o*o+a*a;if(l<n){if(l===0)for(let h=0;h<this.stride;++h)i[h]=r[h];else{const h=this.getRadius()/Math.sqrt(l);i[0]=r[0]+h*o,i[1]=r[1]+h*a;for(let c=2;c<this.stride;++c)i[c]=r[c]}return i.length=this.stride,l}return n}containsXY(t,e){const i=this.flatCoordinates,n=t-i[0],r=e-i[1];return n*n+r*r<=this.getRadiusSquared_()}getCenter(){return this.flatCoordinates.slice(0,this.stride)}computeExtent(t){const e=this.flatCoordinates,i=e[this.stride]-e[0];return De(e[0]-i,e[1]-i,e[0]+i,e[1]+i,t)}getRadius(){return Math.sqrt(this.getRadiusSquared_())}getRadiusSquared_(){const t=this.flatCoordinates[this.stride]-this.flatCoordinates[0],e=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];return t*t+e*e}getType(){return"Circle"}intersectsExtent(t){const e=this.getExtent();if(ht(t,e)){const i=this.getCenter();return t[0]<=i[0]&&t[2]>=i[0]||t[1]<=i[1]&&t[3]>=i[1]?!0:ea(t,this.intersectsCoordinate.bind(this))}return!1}setCenter(t){const e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+i;for(let r=1;r<e;++r)n[e+r]=t[r];this.setFlatCoordinates(this.layout,n),this.changed()}setCenterAndRadius(t,e,i){this.setLayout(i,t,0),this.flatCoordinates||(this.flatCoordinates=[]);const n=this.flatCoordinates;let r=sc(n,0,t,this.stride);n[r++]=n[0]+e;for(let o=1,a=this.stride;o<a;++o)n[r++]=n[o];n.length=r,this.changed()}getCoordinates(){return null}setCoordinates(t,e){}setRadius(t){this.flatCoordinates[this.stride]=this.flatCoordinates[0]+t,this.changed()}rotate(t,e){const i=this.getCenter(),n=this.getStride();this.setCenter(_a(i,0,i.length,n,t,e,i)),this.changed()}};Lc.prototype.transform;const tf=Lc;class dr extends ic{constructor(t){super(),this.geometries_=t||null,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(et),this.changeEventsKeys_.length=0}listenGeometriesChange_(){if(this.geometries_)for(let t=0,e=this.geometries_.length;t<e;++t)this.changeEventsKeys_.push(W(this.geometries_[t],O.CHANGE,this.changed,this))}clone(){const t=new dr(null);return t.setGeometries(this.geometries_),t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Si(this.getExtent(),t,e))return n;const r=this.geometries_;for(let o=0,a=r.length;o<a;++o)n=r[o].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){cn(t);const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)Vh(t,e[i].getExtent());return t}getGeometries(){return Ul(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],i=this.geometries_;let n=!1;for(let r=0,o=i.length;r<o;++r){const a=i[r],l=a.getSimplifiedGeometry(t);e.push(l),l!==a&&(n=!0)}if(n){const r=new dr(null);return r.setGeometriesArray(e),r}return this.simplifiedGeometryMaxMinSquaredTolerance=t,this}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=fe(this.getExtent()));const n=this.geometries_;for(let r=0,o=n.length;r<o;++r)n[r].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(Ul(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let n=0,r=i.length;n<r;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Ul(s){const t=[];for(let e=0,i=s.length;e<i;++e)t.push(s[e].clone());return t}const Fc=dr;function gr(s,t,e,i,n,r,o){let a,l;const h=(e-t)/i;if(h===1)a=t;else if(h===2)a=t,l=n;else if(h!==0){let c=s[t],u=s[t+1],d=0;const g=[0];for(let _=t+i;_<e;_+=i){const m=s[_],y=s[_+1];d+=Math.sqrt((m-c)*(m-c)+(y-u)*(y-u)),g.push(d),c=m,u=y}const p=n*d,f=fd(g,p);f<0?(l=(p-g[-f-2])/(g[-f-1]-g[-f-2]),a=t+(-f-2)*i):a=t+f*i}o=o>1?o:2,r=r||new Array(o);for(let c=0;c<o;++c)r[c]=a===void 0?NaN:l===void 0?s[a+c]:Gt(s[a+c],s[a+i+c],l);return r}function ko(s,t,e,i,n,r){if(e==t)return null;let o;if(n<s[t+i-1])return r?(o=s.slice(t,t+i),o[i-1]=n,o):null;if(s[e-1]<n)return r?(o=s.slice(e-i,e),o[i-1]=n,o):null;if(n==s[t+i-1])return s.slice(t,t+i);let a=t/i,l=e/i;for(;a<l;){const d=a+l>>1;n<s[(d+1)*i-1]?l=d:a=d+1}const h=s[a*i-1];if(n==h)return s.slice((a-1)*i,(a-1)*i+i);const c=s[(a+1)*i-1],u=(n-h)/(c-h);o=[];for(let d=0;d<i-1;++d)o.push(Gt(s[(a-1)*i+d],s[a*i+d],u));return o.push(n),o}function ef(s,t,e,i,n,r,o){if(o)return ko(s,t,e[e.length-1],i,n,r);let a;if(n<s[i-1])return r?(a=s.slice(0,i),a[i-1]=n,a):null;if(s[s.length-1]<n)return r?(a=s.slice(s.length-i),a[i-1]=n,a):null;for(let l=0,h=e.length;l<h;++l){const c=e[l];if(t!=c){if(n<s[t+i-1])return null;if(n<=s[c-1])return ko(s,t,c,i,n,!1);t=c}}return null}function Oc(s,t,e,i){let n=s[t],r=s[t+1],o=0;for(let a=t+i;a<e;a+=i){const l=s[a],h=s[a+1];o+=Math.sqrt((l-n)*(l-n)+(h-r)*(h-r)),n=l,r=h}return o}class pr extends ai{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,e!==void 0&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendCoordinate(t){ue(this.flatCoordinates,t),this.changed()}clone(){const t=new pr(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Si(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ma(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),va(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return hc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return this.layout!="XYM"&&this.layout!="XYZM"?null:(e=e!==void 0?e:!1,ko(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return Ze(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return gr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Oc(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=Or(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new pr(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return Dr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Fr(this.flatCoordinates,0,t,this.stride),this.changed()}}const Oe=pr;class fr extends ai{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(e!==void 0&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const n=t,r=[],o=[];for(let l=0,h=n.length;l<h;++l){const c=n[l];ue(r,c.getFlatCoordinates()),o.push(r.length)}const a=n.length===0?this.getLayout():n[0].getLayout();this.setFlatCoordinates(a,r),this.ends_=o}}appendLineString(t){ue(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new fr(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Si(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(ya(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),xa(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,n))}getCoordinateAtM(t,e,i){return this.layout!="XYM"&&this.layout!="XYZM"||this.flatCoordinates.length===0?null:(e=e!==void 0?e:!1,i=i!==void 0?i:!1,ef(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return Ks(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new Oe(this.flatCoordinates.slice(t===0?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,n=[];let r=0;for(let o=0,a=e.length;o<a;++o){const l=e[o],h=new Oe(t.slice(r,l),i);n.push(h),r=l}return n}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.ends_,r=this.stride;for(let o=0,a=n.length;o<a;++o){const l=n[o],h=gr(e,i,l,r,.5);ue(t,h),i=l}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=rc(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new fr(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return Fg(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=pn(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=i.length===0?0:i[i.length-1],this.changed()}}const kr=fr;class Fa extends ai{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){ue(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new Fa(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Si(this.getExtent(),t,e))return n;const r=this.flatCoordinates,o=this.stride;for(let a=0,l=r.length;a<l;a+=o){const h=Le(t,e,r[a],r[a+1]);if(h<n){n=h;for(let c=0;c<o;++c)i[c]=r[a+c];i.length=o}}return n}getCoordinates(){return Ze(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new ge(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let r=0,o=t.length;r<o;r+=i){const a=new ge(t.slice(r,r+i),e);n.push(a)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,r=e.length;n<r;n+=i){const o=e[n],a=e[n+1];if(Qo(t,o,a))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Fr(this.flatCoordinates,0,t,this.stride),this.changed()}}const Nr=Fa;function Dc(s,t,e,i){const n=[];let r=Vt();for(let o=0,a=e.length;o<a;++o){const l=e[o];r=ta(s,t,l[0],i),n.push((r[0]+r[2])/2,(r[1]+r[3])/2),t=l[l.length-1]}return n}class _r extends ai{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const n=t,r=[],o=[];for(let a=0,l=n.length;a<l;++a){const h=n[a],c=r.length,u=h.getEnds();for(let d=0,g=u.length;d<g;++d)u[d]+=c;ue(r,h.getFlatCoordinates()),o.push(u)}e=n.length===0?this.getLayout():n[0].getLayout(),t=r,i=o}e!==void 0&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(!this.flatCoordinates)this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();else{const i=this.flatCoordinates.length;ue(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let n=0,r=e.length;n<r;++n)e[n]+=i}this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let n=0;n<t;++n)e[n]=this.endss_[n].slice();const i=new _r(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,n){return n<Si(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Rg(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),bg(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,n))}containsXY(t,e){return Ag(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return Mg(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return t!==void 0?(e=this.getOrientedFlatCoordinates().slice(),Mo(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,Po(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=Dc(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=lc(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Nr(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;dc(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Mo(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Pg(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new _r(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(t===0)e=0;else{const r=this.endss_[t-1];e=r[r.length-1]}const i=this.endss_[t].slice(),n=i[i.length-1];if(e!==0)for(let r=0,o=i.length;r<o;++r)i[r]-=e;return new zt(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,n=[];let r=0;for(let o=0,a=i.length;o<a;++o){const l=i[o].slice(),h=l[l.length-1];if(r!==0)for(let u=0,d=l.length;u<d;++u)l[u]-=r;const c=new zt(e.slice(r,h),t,l);n.push(c),r=h}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return Og(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=nc(this.flatCoordinates,0,t,this.stride,this.endss_);if(i.length===0)this.flatCoordinates.length=0;else{const n=i[i.length-1];this.flatCoordinates.length=n.length===0?0:n[n.length-1]}this.changed()}}const Gr=_r,$l=Yt();class gs{constructor(t,e,i,n,r,o){this.styleFunction,this.extent_,this.id_=o,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i,this.properties_=r,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?ks(this.flatCoordinates_):ta(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=fe(this.getExtent());this.flatInteriorPoints_=Sa(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=gc(this.flatCoordinates_,this.ends_),e=Dc(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=lc(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=gr(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let n=0,r=i.length;n<r;++n){const o=i[n],a=gr(t,e,o,2,.5);ue(this.flatMidpoints_,a),e=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=it(t);const e=t.getExtent(),i=t.getWorldExtent();if(e&&i){const n=_t(i)/_t(e);ie($l,i[0],i[3],n,-n,0,0,0),ei(this.flatCoordinates_,0,this.flatCoordinates_.length,2,$l,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new gs(this.type_,this.flatCoordinates_.slice(),this.ends_.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=Oh((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=Or(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=rc(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=Ea(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n);break}return n&&(this.simplifiedGeometry_=new gs(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}gs.prototype.getFlatCoordinates=gs.prototype.getOrientedFlatCoordinates;const Jt=gs;class sf{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Pe,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?it(e.dataProjection):this.readProjection(t);e.extent&&i&&i.getUnits()==="tile-pixels"&&(i=it(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return N()}readFeature(t,e){return N()}readFeatures(t,e){return N()}readGeometry(t,e){return N()}readProjection(t){return N()}writeFeature(t,e){return N()}writeFeatures(t,e){return N()}writeGeometry(t,e){return N()}}const kc=sf;function jr(s,t,e){const i=e?it(e.featureProjection):null,n=e?it(e.dataProjection):null;let r=s;if(i&&n&&!Ie(i,n)){t&&(r=s.clone());const o=t?i:n,a=t?n:i;o.getUnits()==="tile-pixels"?r.transform(o,a):r.applyTransform(Ys(o,a))}if(t&&e&&e.decimals!==void 0){const o=Math.pow(10,e.decimals),a=function(l){for(let h=0,c=l.length;h<c;++h)l[h]=Math.round(l[h]*o)/o;return l};r===s&&(r=s.clone()),r.applyTransform(a)}return r}const nf={Point:ge,LineString:Oe,Polygon:zt,MultiPoint:Nr,MultiLineString:kr,MultiPolygon:Gr};function rf(s,t,e){return Array.isArray(t[0])?(dc(s,0,t,e)||(s=s.slice(),Mo(s,0,t,e)),s):(Ra(s,0,t,e)||(s=s.slice(),nr(s,0,t,e)),s)}function Nc(s,t){var e;const i=s.geometry;if(!i)return[];if(Array.isArray(i))return i.map(o=>Nc({...s,geometry:o})).flat();const n=i.type==="MultiPolygon"?"Polygon":i.type;if(n==="GeometryCollection"||n==="Circle")throw new Error("Unsupported geometry type: "+n);const r=i.layout.length;return jr(new Jt(n,n==="Polygon"?rf(i.flatCoordinates,i.ends,r):i.flatCoordinates,(e=i.ends)==null?void 0:e.flat(),r,s.properties||{},s.id).enableSimplifyTransformed(),!1,t)}function Oa(s,t){if(!s)return null;if(Array.isArray(s)){const i=s.map(n=>Oa(n,t));return new Fc(i)}const e=nf[s.type];return jr(new e(s.flatCoordinates,s.layout,s.ends),!1,t)}class of extends kc{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(Dn(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(Dn(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return N()}readFeaturesFromObject(t,e){return N()}readGeometry(t,e){return this.readGeometryFromObject(Dn(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return N()}readProjection(t){return this.readProjectionFromObject(Dn(t))}readProjectionFromObject(t){return N()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return N()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return N()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return N()}}function Dn(s){return typeof s=="string"?JSON.parse(s)||null:s!==null?s:null}const af=of;class lf extends af{constructor(t){t=t||{},super(),this.dataProjection=it(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=it(t.featureProjection)),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let i=null;t.type==="Feature"?i=t:i={type:"Feature",geometry:t,properties:null};const n=Da(i.geometry);if(this.featureClass===Jt)return Nc({geometry:n,id:i.id,properties:i.properties},e);const r=new Pe;return this.geometryName_?r.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in i!==void 0&&r.setGeometryName(i.geometry_name),r.setGeometry(Oa(n,e)),"id"in i&&r.setId(i.id),i.properties&&r.setProperties(i.properties,!0),r}readFeaturesFromObject(t,e){const i=t;let n=null;if(i.type==="FeatureCollection"){const r=t;n=[];const o=r.features;for(let a=0,l=o.length;a<l;++a){const h=this.readFeatureFromObject(o[a],e);h&&n.push(h)}}else n=[this.readFeatureFromObject(t,e)];return n.flat()}readGeometryFromObject(t,e){return hf(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if(e.type=="name")i=it(e.properties.name);else if(e.type==="EPSG")i=it("EPSG:"+e.properties.code);else throw new Error("Unknown SRS type");else i=this.dataProjection;return i}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},n=t.getId();if(n!==void 0&&(i.id=n),!t.hasProperties())return i;const r=t.getProperties(),o=t.getGeometry();return o&&(i.geometry=No(o,e),delete r[t.getGeometryName()]),si(r)||(i.properties=r),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,r=t.length;n<r;++n)i.push(this.writeFeatureObject(t[n],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return No(t,this.adaptOptions(e))}}function Da(s,t){if(!s)return null;let e;switch(s.type){case"Point":{e=uf(s);break}case"LineString":{e=df(s);break}case"Polygon":{e=_f(s);break}case"MultiPoint":{e=pf(s);break}case"MultiLineString":{e=gf(s);break}case"MultiPolygon":{e=ff(s);break}case"GeometryCollection":{e=cf(s);break}default:throw new Error("Unsupported GeoJSON type: "+s.type)}return e}function hf(s,t){const e=Da(s);return Oa(e,t)}function cf(s,t){return s.geometries.map(function(e){return Da(e)})}function uf(s){const t=s.coordinates;return{type:"Point",flatCoordinates:t,layout:Ri(t.length)}}function df(s){const t=s.coordinates,e=t.flat();return{type:"LineString",flatCoordinates:e,ends:[e.length],layout:Ri(t[0].length)}}function gf(s){const t=s.coordinates,e=t[0][0].length,i=[],n=pn(i,0,t,e);return{type:"MultiLineString",flatCoordinates:i,ends:n,layout:Ri(e)}}function pf(s){const t=s.coordinates;return{type:"MultiPoint",flatCoordinates:t.flat(),layout:Ri(t[0].length)}}function ff(s){const t=s.coordinates,e=[],i=t[0][0][0].length,n=nc(e,0,t,i);return{type:"MultiPolygon",flatCoordinates:e,ends:n,layout:Ri(i)}}function _f(s){const t=s.coordinates,e=[],i=t[0][0].length,n=pn(e,0,t,i);return{type:"Polygon",flatCoordinates:e,ends:n,layout:Ri(i)}}function No(s,t){s=jr(s,!0,t);const e=s.getType();let i;switch(e){case"Point":{i=Cf(s);break}case"LineString":{i=yf(s);break}case"Polygon":{i=wf(s,t);break}case"MultiPoint":{i=xf(s);break}case"MultiLineString":{i=vf(s);break}case"MultiPolygon":{i=Ef(s,t);break}case"GeometryCollection":{i=mf(s,t);break}case"Circle":{i={type:"GeometryCollection",geometries:[]};break}default:throw new Error("Unsupported geometry type: "+e)}return i}function mf(s,t){return t=Object.assign({},t),delete t.featureProjection,{type:"GeometryCollection",geometries:s.getGeometriesArray().map(function(e){return No(e,t)})}}function yf(s,t){return{type:"LineString",coordinates:s.getCoordinates()}}function vf(s,t){return{type:"MultiLineString",coordinates:s.getCoordinates()}}function xf(s,t){return{type:"MultiPoint",coordinates:s.getCoordinates()}}function Ef(s,t){let e;return t&&(e=t.rightHanded),{type:"MultiPolygon",coordinates:s.getCoordinates(e)}}function Cf(s,t){return{type:"Point",coordinates:s.getCoordinates()}}function wf(s,t){let e;return t&&(e=t.rightHanded),{type:"Polygon",coordinates:s.getCoordinates(e)}}const Gc=lf;class ka{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null}clone(){const t=this.getColor();return new ka({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){this.color_=t}}const Qs=ka,G={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class Na{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=bt(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Na({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return N()}getImage(t){return N()}getHitDetectionImage(){return N()}getPixelRatio(t){return 1}getImageState(){return N()}getImageSize(){return N()}getOrigin(){return N()}getSize(){return N()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=bt(t)}listenImageChange(t){N()}load(){N()}unlistenImageChange(t){N()}}const jc=Na;class Vc extends ln{constructor(t,e,i,n){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state=typeof n=="function"?G.IDLE:n,this.image_=null,this.loader=typeof n=="function"?n:null}changed(){this.dispatchEvent(O.CHANGE)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==G.IDLE&&this.loader){this.state=G.LOADING,this.changed();const t=this.getResolution(),e=Array.isArray(t)?t[0]:t;yd(()=>this.loader(this.getExtent(),e,this.getPixelRatio())).then(i=>{"image"in i&&(this.image_=i.image),"extent"in i&&(this.extent=i.extent),"resolution"in i&&(this.resolution=i.resolution),"pixelRatio"in i&&(this.pixelRatio_=i.pixelRatio),(i instanceof HTMLImageElement||i instanceof ImageBitmap||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement)&&(this.image_=i),this.state=G.LOADED}).catch(i=>{this.state=G.ERROR,console.error(i)}).finally(()=>this.changed())}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function Sf(s,t,e){const i=s;let n=!0,r=!1,o=!1;const a=[Us(i,O.LOAD,function(){o=!0,r||t()})];return i.src&&Zo?(r=!0,i.decode().then(function(){n&&t()}).catch(function(l){n&&(o?t():e())})):a.push(Us(i,O.ERROR,e)),function(){n=!1,a.forEach(et)}}function Tf(s,t){return new Promise((e,i)=>{function n(){o(),e(s)}function r(){o(),i(new Error("Image load error"))}function o(){s.removeEventListener("load",n),s.removeEventListener("error",r)}s.addEventListener("load",n),s.addEventListener("error",r),t&&(s.src=t)})}function zc(s,t){return t&&(s.src=t),s.src&&Zo?new Promise((e,i)=>s.decode().then(()=>e(s)).catch(n=>s.complete&&s.width?e(s):i(n))):Tf(s)}function Wc(s,t){return t&&(s.src=t),s.src&&Zo&&bd?s.decode().then(()=>createImageBitmap(s)).catch(e=>{if(s.complete&&s.width)return s;throw e}):zc(s)}let bs=null;class Rf extends ln{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=n===void 0?G.IDLE:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===G.LOADED){bs||(bs=St(1,1,void 0,{willReadFrequently:!0})),bs.drawImage(this.image_,0,0);try{bs.getImageData(0,0,1,1),this.tainted_=!1}catch{bs=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(O.CHANGE)}handleImageError_(){this.imageState_=G.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=G.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=St(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===G.IDLE){this.image_||this.initializeImage_(),this.imageState_=G.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&zc(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==G.LOADED)return;const e=this.image_,i=document.createElement("canvas");i.width=Math.ceil(e.width*t),i.height=Math.ceil(e.height*t);const n=i.getContext("2d");n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle=$h(this.color_),n.fillRect(0,0,i.width/t,i.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=i}}function bf(s,t,e,i,n){let r=t===void 0?void 0:Jn.get(t,e,n);return r||(r=new Rf(s,s instanceof HTMLImageElement?s.src||void 0:t,e,i,n),Jn.set(t,e,n,r)),r}function Xl(s,t,e,i){return e!==void 0&&i!==void 0?[e/s,i/t]:e!==void 0?e/s:i!==void 0?i/t:1}class Ga extends jc{constructor(t){t=t||{};const e=t.opacity!==void 0?t.opacity:1,i=t.rotation!==void 0?t.rotation:0,n=t.scale!==void 0?t.scale:1,r=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:e,rotation:i,scale:n,displacement:t.displacement!==void 0?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.anchor_=t.anchor!==void 0?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=t.anchorOrigin!==void 0?t.anchorOrigin:"top-left",this.anchorXUnits_=t.anchorXUnits!==void 0?t.anchorXUnits:"fraction",this.anchorYUnits_=t.anchorYUnits!==void 0?t.anchorYUnits:"fraction",this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null;const o=t.img!==void 0?t.img:null;let a=t.src;H(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||D(o)),H(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),H(!((t.width!==void 0||t.height!==void 0)&&t.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(t.src!==void 0?l=G.IDLE:o!==void 0&&(o instanceof HTMLImageElement?o.complete?l=o.src?G.LOADED:G.IDLE:l=G.LOADING:l=G.LOADED),this.color_=t.color!==void 0?qn(t.color):null,this.iconImage_=bf(o,a,this.crossOrigin_,l,this.color_),this.offset_=t.offset!==void 0?t.offset:[0,0],this.offsetOrigin_=t.offsetOrigin!==void 0?t.offsetOrigin:"top-left",this.origin_=null,this.size_=t.size!==void 0?t.size:null,t.width!==void 0||t.height!==void 0){let h,c;if(t.size)[h,c]=t.size;else{const u=this.getImage(1);if(u.width&&u.height)h=u.width,c=u.height;else if(u instanceof HTMLImageElement){this.initialOptions_=t;const d=()=>{if(this.unlistenImageChange(d),!this.initialOptions_)return;const g=this.iconImage_.getSize();this.setScale(Xl(g[0],g[1],t.width,t.height))};this.listenImageChange(d);return}}h!==void 0&&this.setScale(Xl(h,c,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new Ga({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const n=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!n)return null;t=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(t[0]*=n[0]),this.anchorYUnits_=="fraction"&&(t[1]*=n[1])}if(this.anchorOrigin_!="top-left"){if(!n)return null;t===this.anchor_&&(t=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(t[0]=-t[0]+n[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(t[1]=-t[1]+n[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if(this.offsetOrigin_!="top-left"){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(t[0]=i[0]-e[0]-t[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==G.LOADED)return this.iconImage_.getSize()[0]*t[0]}getHeight(){const t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==G.LOADED)return this.iconImage_.getSize()[1]*t[1]}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(O.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(O.CHANGE,t)}}const Bc=Ga;class ja{constructor(t){t=t||{},this.color_=t.color!==void 0?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=t.lineDash!==void 0?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.width_=t.width}clone(){const t=this.getColor();return new ja({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setWidth(t){this.width_=t}}const js=ja;function ce(s){return Array.isArray(s)?Yh(s):s}class Va extends jc{constructor(t){const e=t.rotateWithView!==void 0?t.rotateWithView:!1;super({opacity:1,rotateWithView:e,rotation:t.rotation!==void 0?t.rotation:0,scale:t.scale!==void 0?t.scale:1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode}),this.canvases_,this.hitDetectionCanvas_=null,this.fill_=t.fill!==void 0?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius_=t.radius!==void 0?t.radius:t.radius1,this.radius2_=t.radius2,this.angle_=t.angle!==void 0?t.angle:0,this.stroke_=t.stroke!==void 0?t.stroke:null,this.size_,this.renderOptions_,this.render()}clone(){const t=this.getScale(),e=new Va({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){let e=this.canvases_[t];if(!e){const i=this.renderOptions_,n=St(i.size*t,i.size*t);this.draw_(i,n,t),e=n.canvas,this.canvases_[t]=e}return e}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return G.LOADED}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(e===0||this.points_===1/0||t!=="bevel"&&t!=="miter")return e;let n=this.radius_,r=this.radius2_===void 0?n:this.radius2_;if(n<r){const x=n;n=r,r=x}const o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=r*Math.sin(a),h=Math.sqrt(r*r-l*l),c=n-h,u=Math.sqrt(l*l+c*c),d=u/l;if(t==="miter"&&d<=i)return d*e;const g=e/2/d,p=e/2*(c/u),f=Math.sqrt((n+g)*(n+g)+p*p)-n;if(this.radius2_===void 0||t==="bevel")return f*2;const _=n*Math.sin(a),m=Math.sqrt(n*n-_*_),y=r-m,v=Math.sqrt(_*_+y*y)/_;if(v<=i){const x=v*e/2-r-n;return 2*Math.max(f,x)}return f*2}createRenderOptions(){let t=us,e=ds,i=0,n=null,r=0,o,a=0;this.stroke_&&(o=ce(this.stroke_.getColor()??Zs),a=this.stroke_.getWidth()??Js,n=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,e=this.stroke_.getLineJoin()??ds,t=this.stroke_.getLineCap()??us,i=this.stroke_.getMiterLimit()??Hs);const l=this.calculateLineJoinSize_(e,a,i),h=Math.max(this.radius_,this.radius2_||0),c=Math.ceil(2*h+l);return{strokeStyle:o,strokeWidth:a,size:c,lineCap:t,lineDash:n,lineDashOffset:r,lineJoin:e,miterLimit:i}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.canvases_={},this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let n=this.fill_.getColor();n===null&&(n=At),e.fillStyle=ce(n),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),n=0;typeof i=="string"&&(i=qn(i)),i===null?n=1:Array.isArray(i)&&(n=i.length===4?i[3]:1),n===0&&(e=St(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius_;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=this.radius2_===void 0?i:this.radius2_;this.radius2_!==void 0&&(e*=2);const r=this.angle_-Math.PI/2,o=2*Math.PI/e;for(let a=0;a<e;a++){const l=r+a*o,h=a%2===0?i:n;t.lineTo(h*Math.cos(l),h*Math.sin(l))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle=At,e.fill(),t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}}const Uc=Va;class za extends Uc{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.fill,radius:t.radius,stroke:t.stroke,scale:t.scale!==void 0?t.scale:1,rotation:t.rotation!==void 0?t.rotation:0,rotateWithView:t.rotateWithView!==void 0?t.rotateWithView:!1,displacement:t.displacement!==void 0?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new za({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.radius_=t,this.render()}}const Wa=za;class te{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=Yl,t.geometry!==void 0&&this.setGeometry(t.geometry),this.fill_=t.fill!==void 0?t.fill:null,this.image_=t.image!==void 0?t.image:null,this.renderer_=t.renderer!==void 0?t.renderer:null,this.hitDetectionRenderer_=t.hitDetectionRenderer!==void 0?t.hitDetectionRenderer:null,this.stroke_=t.stroke!==void 0?t.stroke:null,this.text_=t.text!==void 0?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&typeof t=="object"&&(t=t.clone()),new te({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){typeof t=="function"?this.geometryFunction_=t:typeof t=="string"?this.geometryFunction_=function(e){return e.get(t)}:t?t!==void 0&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Yl,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function If(s){let t;if(typeof s=="function")t=s;else{let e;Array.isArray(s)?e=s:(H(typeof s.getZIndex=="function","Expected an `Style` or an array of `Style`"),e=[s]),t=function(){return e}}return t}let no=null;function Pf(s,t){if(!no){const e=new Qs({color:"rgba(255,255,255,0.4)"}),i=new js({color:"#3399CC",width:1.25});no=[new te({image:new Wa({fill:e,stroke:i,radius:5}),fill:e,stroke:i})]}return no}function $c(){const s={},t=[255,255,255,1],e=[0,153,255,1],i=3;return s.Polygon=[new te({fill:new Qs({color:[255,255,255,.5]})})],s.MultiPolygon=s.Polygon,s.LineString=[new te({stroke:new js({color:t,width:i+2})}),new te({stroke:new js({color:e,width:i})})],s.MultiLineString=s.LineString,s.Circle=s.Polygon.concat(s.LineString),s.Point=[new te({image:new Wa({radius:i*2,fill:new Qs({color:e}),stroke:new js({color:t,width:i/2})}),zIndex:1/0})],s.MultiPoint=s.Point,s.GeometryCollection=s.Polygon.concat(s.LineString,s.Point),s}function Yl(s){return s.getGeometry()}const Mf="#333";class Ba{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.scale_=t.scale,this.scaleArray_=bt(t.scale!==void 0?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=t.fill!==void 0?t.fill:new Qs({color:Mf}),this.maxAngle_=t.maxAngle!==void 0?t.maxAngle:Math.PI/4,this.placement_=t.placement!==void 0?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=t.stroke!==void 0?t.stroke:null,this.offsetX_=t.offsetX!==void 0?t.offsetX:0,this.offsetY_=t.offsetY!==void 0?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=t.padding===void 0?null:t.padding}clone(){const t=this.getScale();return new Ba({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=bt(t!==void 0?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}const Lf=Ba;var Ua={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Ua.read=function(s,t,e,i,n){var r,o,a=n*8-i-1,l=(1<<a)-1,h=l>>1,c=-7,u=e?n-1:0,d=e?-1:1,g=s[t+u];for(u+=d,r=g&(1<<-c)-1,g>>=-c,c+=a;c>0;r=r*256+s[t+u],u+=d,c-=8);for(o=r&(1<<-c)-1,r>>=-c,c+=i;c>0;o=o*256+s[t+u],u+=d,c-=8);if(r===0)r=1-h;else{if(r===l)return o?NaN:(g?-1:1)*(1/0);o=o+Math.pow(2,i),r=r-h}return(g?-1:1)*o*Math.pow(2,r-i)};Ua.write=function(s,t,e,i,n,r){var o,a,l,h=r*8-n-1,c=(1<<h)-1,u=c>>1,d=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=i?0:r-1,p=i?1:-1,f=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+u>=1?t+=d/l:t+=d*Math.pow(2,1-u),t*l>=2&&(o++,l/=2),o+u>=c?(a=0,o=c):o+u>=1?(a=(t*l-1)*Math.pow(2,n),o=o+u):(a=t*Math.pow(2,u-1)*Math.pow(2,n),o=0));n>=8;s[e+g]=a&255,g+=p,a/=256,n-=8);for(o=o<<n|a,h+=n;h>0;s[e+g]=o&255,g+=p,o/=256,h-=8);s[e+g-p]|=f*128};var Af=q,kn=Ua;function q(s){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(s)?s:new Uint8Array(s||0),this.pos=0,this.type=0,this.length=this.buf.length}q.Varint=0;q.Fixed64=1;q.Bytes=2;q.Fixed32=5;var Go=65536*65536,Kl=1/Go,Ff=12,Xc=typeof TextDecoder>"u"?null:new TextDecoder("utf8");q.prototype={destroy:function(){this.buf=null},readFields:function(s,t,e){for(e=e||this.length;this.pos<e;){var i=this.readVarint(),n=i>>3,r=this.pos;this.type=i&7,s(n,t,this),this.pos===r&&this.skip(i)}return t},readMessage:function(s,t){return this.readFields(s,t,this.readVarint()+this.pos)},readFixed32:function(){var s=Nn(this.buf,this.pos);return this.pos+=4,s},readSFixed32:function(){var s=Zl(this.buf,this.pos);return this.pos+=4,s},readFixed64:function(){var s=Nn(this.buf,this.pos)+Nn(this.buf,this.pos+4)*Go;return this.pos+=8,s},readSFixed64:function(){var s=Nn(this.buf,this.pos)+Zl(this.buf,this.pos+4)*Go;return this.pos+=8,s},readFloat:function(){var s=kn.read(this.buf,this.pos,!0,23,4);return this.pos+=4,s},readDouble:function(){var s=kn.read(this.buf,this.pos,!0,52,8);return this.pos+=8,s},readVarint:function(s){var t=this.buf,e,i;return i=t[this.pos++],e=i&127,i<128||(i=t[this.pos++],e|=(i&127)<<7,i<128)||(i=t[this.pos++],e|=(i&127)<<14,i<128)||(i=t[this.pos++],e|=(i&127)<<21,i<128)?e:(i=t[this.pos],e|=(i&15)<<28,Of(e,s,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var s=this.readVarint();return s%2===1?(s+1)/-2:s/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var s=this.readVarint()+this.pos,t=this.pos;return this.pos=s,s-t>=Ff&&Xc?Hf(this.buf,t,s):Kf(this.buf,t,s)},readBytes:function(){var s=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,s);return this.pos=s,t},readPackedVarint:function(s,t){if(this.type!==q.Bytes)return s.push(this.readVarint(t));var e=we(this);for(s=s||[];this.pos<e;)s.push(this.readVarint(t));return s},readPackedSVarint:function(s){if(this.type!==q.Bytes)return s.push(this.readSVarint());var t=we(this);for(s=s||[];this.pos<t;)s.push(this.readSVarint());return s},readPackedBoolean:function(s){if(this.type!==q.Bytes)return s.push(this.readBoolean());var t=we(this);for(s=s||[];this.pos<t;)s.push(this.readBoolean());return s},readPackedFloat:function(s){if(this.type!==q.Bytes)return s.push(this.readFloat());var t=we(this);for(s=s||[];this.pos<t;)s.push(this.readFloat());return s},readPackedDouble:function(s){if(this.type!==q.Bytes)return s.push(this.readDouble());var t=we(this);for(s=s||[];this.pos<t;)s.push(this.readDouble());return s},readPackedFixed32:function(s){if(this.type!==q.Bytes)return s.push(this.readFixed32());var t=we(this);for(s=s||[];this.pos<t;)s.push(this.readFixed32());return s},readPackedSFixed32:function(s){if(this.type!==q.Bytes)return s.push(this.readSFixed32());var t=we(this);for(s=s||[];this.pos<t;)s.push(this.readSFixed32());return s},readPackedFixed64:function(s){if(this.type!==q.Bytes)return s.push(this.readFixed64());var t=we(this);for(s=s||[];this.pos<t;)s.push(this.readFixed64());return s},readPackedSFixed64:function(s){if(this.type!==q.Bytes)return s.push(this.readSFixed64());var t=we(this);for(s=s||[];this.pos<t;)s.push(this.readSFixed64());return s},skip:function(s){var t=s&7;if(t===q.Varint)for(;this.buf[this.pos++]>127;);else if(t===q.Bytes)this.pos=this.readVarint()+this.pos;else if(t===q.Fixed32)this.pos+=4;else if(t===q.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(s,t){this.writeVarint(s<<3|t)},realloc:function(s){for(var t=this.length||16;t<this.pos+s;)t*=2;if(t!==this.length){var e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(s){this.realloc(4),Di(this.buf,s,this.pos),this.pos+=4},writeSFixed32:function(s){this.realloc(4),Di(this.buf,s,this.pos),this.pos+=4},writeFixed64:function(s){this.realloc(8),Di(this.buf,s&-1,this.pos),Di(this.buf,Math.floor(s*Kl),this.pos+4),this.pos+=8},writeSFixed64:function(s){this.realloc(8),Di(this.buf,s&-1,this.pos),Di(this.buf,Math.floor(s*Kl),this.pos+4),this.pos+=8},writeVarint:function(s){if(s=+s||0,s>268435455||s<0){kf(s,this);return}this.realloc(4),this.buf[this.pos++]=s&127|(s>127?128:0),!(s<=127)&&(this.buf[this.pos++]=(s>>>=7)&127|(s>127?128:0),!(s<=127)&&(this.buf[this.pos++]=(s>>>=7)&127|(s>127?128:0),!(s<=127)&&(this.buf[this.pos++]=s>>>7&127)))},writeSVarint:function(s){this.writeVarint(s<0?-s*2-1:s*2)},writeBoolean:function(s){this.writeVarint(!!s)},writeString:function(s){s=String(s),this.realloc(s.length*4),this.pos++;var t=this.pos;this.pos=Zf(this.buf,s,this.pos);var e=this.pos-t;e>=128&&Hl(t,e,this),this.pos=t-1,this.writeVarint(e),this.pos+=e},writeFloat:function(s){this.realloc(4),kn.write(this.buf,s,this.pos,!0,23,4),this.pos+=4},writeDouble:function(s){this.realloc(8),kn.write(this.buf,s,this.pos,!0,52,8),this.pos+=8},writeBytes:function(s){var t=s.length;this.writeVarint(t),this.realloc(t);for(var e=0;e<t;e++)this.buf[this.pos++]=s[e]},writeRawMessage:function(s,t){this.pos++;var e=this.pos;s(t,this);var i=this.pos-e;i>=128&&Hl(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeMessage:function(s,t,e){this.writeTag(s,q.Bytes),this.writeRawMessage(t,e)},writePackedVarint:function(s,t){t.length&&this.writeMessage(s,jf,t)},writePackedSVarint:function(s,t){t.length&&this.writeMessage(s,Vf,t)},writePackedBoolean:function(s,t){t.length&&this.writeMessage(s,Bf,t)},writePackedFloat:function(s,t){t.length&&this.writeMessage(s,zf,t)},writePackedDouble:function(s,t){t.length&&this.writeMessage(s,Wf,t)},writePackedFixed32:function(s,t){t.length&&this.writeMessage(s,Uf,t)},writePackedSFixed32:function(s,t){t.length&&this.writeMessage(s,$f,t)},writePackedFixed64:function(s,t){t.length&&this.writeMessage(s,Xf,t)},writePackedSFixed64:function(s,t){t.length&&this.writeMessage(s,Yf,t)},writeBytesField:function(s,t){this.writeTag(s,q.Bytes),this.writeBytes(t)},writeFixed32Field:function(s,t){this.writeTag(s,q.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(s,t){this.writeTag(s,q.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(s,t){this.writeTag(s,q.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(s,t){this.writeTag(s,q.Fixed64),this.writeSFixed64(t)},writeVarintField:function(s,t){this.writeTag(s,q.Varint),this.writeVarint(t)},writeSVarintField:function(s,t){this.writeTag(s,q.Varint),this.writeSVarint(t)},writeStringField:function(s,t){this.writeTag(s,q.Bytes),this.writeString(t)},writeFloatField:function(s,t){this.writeTag(s,q.Fixed32),this.writeFloat(t)},writeDoubleField:function(s,t){this.writeTag(s,q.Fixed64),this.writeDouble(t)},writeBooleanField:function(s,t){this.writeVarintField(s,!!t)}};function Of(s,t,e){var i=e.buf,n,r;if(r=i[e.pos++],n=(r&112)>>4,r<128||(r=i[e.pos++],n|=(r&127)<<3,r<128)||(r=i[e.pos++],n|=(r&127)<<10,r<128)||(r=i[e.pos++],n|=(r&127)<<17,r<128)||(r=i[e.pos++],n|=(r&127)<<24,r<128)||(r=i[e.pos++],n|=(r&1)<<31,r<128))return Df(s,n,t);throw new Error("Expected varint not more than 10 bytes")}function we(s){return s.type===q.Bytes?s.readVarint()+s.pos:s.pos+1}function Df(s,t,e){return e?t*4294967296+(s>>>0):(t>>>0)*4294967296+(s>>>0)}function kf(s,t){var e,i;if(s>=0?(e=s%4294967296|0,i=s/4294967296|0):(e=~(-s%4294967296),i=~(-s/4294967296),e^4294967295?e=e+1|0:(e=0,i=i+1|0)),s>=18446744073709552e3||s<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),Nf(e,i,t),Gf(i,t)}function Nf(s,t,e){e.buf[e.pos++]=s&127|128,s>>>=7,e.buf[e.pos++]=s&127|128,s>>>=7,e.buf[e.pos++]=s&127|128,s>>>=7,e.buf[e.pos++]=s&127|128,s>>>=7,e.buf[e.pos]=s&127}function Gf(s,t){var e=(s&7)<<4;t.buf[t.pos++]|=e|((s>>>=3)?128:0),s&&(t.buf[t.pos++]=s&127|((s>>>=7)?128:0),s&&(t.buf[t.pos++]=s&127|((s>>>=7)?128:0),s&&(t.buf[t.pos++]=s&127|((s>>>=7)?128:0),s&&(t.buf[t.pos++]=s&127|((s>>>=7)?128:0),s&&(t.buf[t.pos++]=s&127)))))}function Hl(s,t,e){var i=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));e.realloc(i);for(var n=e.pos-1;n>=s;n--)e.buf[n+i]=e.buf[n]}function jf(s,t){for(var e=0;e<s.length;e++)t.writeVarint(s[e])}function Vf(s,t){for(var e=0;e<s.length;e++)t.writeSVarint(s[e])}function zf(s,t){for(var e=0;e<s.length;e++)t.writeFloat(s[e])}function Wf(s,t){for(var e=0;e<s.length;e++)t.writeDouble(s[e])}function Bf(s,t){for(var e=0;e<s.length;e++)t.writeBoolean(s[e])}function Uf(s,t){for(var e=0;e<s.length;e++)t.writeFixed32(s[e])}function $f(s,t){for(var e=0;e<s.length;e++)t.writeSFixed32(s[e])}function Xf(s,t){for(var e=0;e<s.length;e++)t.writeFixed64(s[e])}function Yf(s,t){for(var e=0;e<s.length;e++)t.writeSFixed64(s[e])}function Nn(s,t){return(s[t]|s[t+1]<<8|s[t+2]<<16)+s[t+3]*16777216}function Di(s,t,e){s[e]=t,s[e+1]=t>>>8,s[e+2]=t>>>16,s[e+3]=t>>>24}function Zl(s,t){return(s[t]|s[t+1]<<8|s[t+2]<<16)+(s[t+3]<<24)}function Kf(s,t,e){for(var i="",n=t;n<e;){var r=s[n],o=null,a=r>239?4:r>223?3:r>191?2:1;if(n+a>e)break;var l,h,c;a===1?r<128&&(o=r):a===2?(l=s[n+1],(l&192)===128&&(o=(r&31)<<6|l&63,o<=127&&(o=null))):a===3?(l=s[n+1],h=s[n+2],(l&192)===128&&(h&192)===128&&(o=(r&15)<<12|(l&63)<<6|h&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):a===4&&(l=s[n+1],h=s[n+2],c=s[n+3],(l&192)===128&&(h&192)===128&&(c&192)===128&&(o=(r&15)<<18|(l&63)<<12|(h&63)<<6|c&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,a=1):o>65535&&(o-=65536,i+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),i+=String.fromCharCode(o),n+=a}return i}function Hf(s,t,e){return Xc.decode(s.subarray(t,e))}function Zf(s,t,e){for(var i=0,n,r;i<t.length;i++){if(n=t.charCodeAt(i),n>55295&&n<57344)if(r)if(n<56320){s[e++]=239,s[e++]=191,s[e++]=189,r=n;continue}else n=r-55296<<10|n-56320|65536,r=null;else{n>56319||i+1===t.length?(s[e++]=239,s[e++]=191,s[e++]=189):r=n;continue}else r&&(s[e++]=239,s[e++]=191,s[e++]=189,r=null);n<128?s[e++]=n:(n<2048?s[e++]=n>>6|192:(n<65536?s[e++]=n>>12|224:(s[e++]=n>>18|240,s[e++]=n>>12&63|128),s[e++]=n>>6&63|128),s[e++]=n&63|128)}return e}const qf=Uh(Af);class Jf extends kc{constructor(t){super(),t=t||{},this.dataProjection=new ra({code:"",units:"tile-pixels"}),this.featureClass_=t.featureClass?t.featureClass:Jt,this.geometryName_=t.geometryName,this.layerName_=t.layerName?t.layerName:"layer",this.layers_=t.layers?t.layers:null,this.idProperty_=t.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(t,e,i,n){t.pos=e.geometry;const r=t.readVarint()+t.pos;let o=1,a=0,l=0,h=0,c=0,u=0;for(;t.pos<r;){if(!a){const d=t.readVarint();o=d&7,a=d>>3}if(a--,o===1||o===2)l+=t.readSVarint(),h+=t.readSVarint(),o===1&&c>u&&(n.push(c),u=c),i.push(l,h),c+=2;else if(o===7)c>u&&(i.push(i[u],i[u+1]),c+=2);else throw new Error("Invalid command found in the PBF")}c>u&&(n.push(c),u=c)}createFeature_(t,e,i){const n=e.type;if(n===0)return null;let r;const o=e.properties;let a;this.idProperty_?(a=o[this.idProperty_],delete o[this.idProperty_]):a=e.id,o[this.layerName_]=e.layer.name;const l=[],h=[];this.readRawGeometry_(t,e,l,h);const c=s_(n,h.length);if(this.featureClass_===Jt)r=new this.featureClass_(c,l,h,2,o,a),r.transform(i.dataProjection);else{let u;if(c=="Polygon"){const p=gc(l,h);u=p.length>1?new Gr(l,"XY",p):new zt(l,"XY",h)}else u=c==="Point"?new ge(l,"XY"):c==="LineString"?new Oe(l,"XY"):c==="MultiPoint"?new Nr(l,"XY"):c==="MultiLineString"?new kr(l,"XY",h):null;const d=this.featureClass_;r=new d,this.geometryName_&&r.setGeometryName(this.geometryName_);const g=jr(u,!1,i);r.setGeometry(g),a!==void 0&&r.setId(a),r.setProperties(o,!0)}return r}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_;e=this.adaptOptions(e);const n=it(e.dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new qf(t),o=r.readFields(Qf,{}),a=[];for(const l in o){if(i&&!i.includes(l))continue;const h=o[l],c=h?[0,0,h.extent,h.extent]:null;n.setExtent(c);for(let u=0,d=h.length;u<d;++u){const g=i_(r,h,u),p=this.createFeature_(r,g,e);p!==null&&a.push(p)}}return a}readProjection(t){return this.dataProjection}setLayers(t){this.layers_=t}}function Qf(s,t,e){if(s===3){const i={keys:[],values:[],features:[]},n=e.readVarint()+e.pos;e.readFields(t_,i,n),i.length=i.features.length,i.length&&(t[i.name]=i)}}function t_(s,t,e){if(s===15)t.version=e.readVarint();else if(s===1)t.name=e.readString();else if(s===5)t.extent=e.readVarint();else if(s===2)t.features.push(e.pos);else if(s===3)t.keys.push(e.readString());else if(s===4){let i=null;const n=e.readVarint()+e.pos;for(;e.pos<n;)s=e.readVarint()>>3,i=s===1?e.readString():s===2?e.readFloat():s===3?e.readDouble():s===4?e.readVarint64():s===5?e.readVarint():s===6?e.readSVarint():s===7?e.readBoolean():null;t.values.push(i)}}function e_(s,t,e){if(s==1)t.id=e.readVarint();else if(s==2){const i=e.readVarint()+e.pos;for(;e.pos<i;){const n=t.layer.keys[e.readVarint()],r=t.layer.values[e.readVarint()];t.properties[n]=r}}else s==3?t.type=e.readVarint():s==4&&(t.geometry=e.pos)}function i_(s,t,e){s.pos=t.features[e];const i=s.readVarint()+s.pos,n={layer:t,type:0,properties:{}};return s.readFields(e_,n,i),n}function s_(s,t){let e;return s===1?e=t===1?"Point":"MultiPoint":s===2?e=t===1?"LineString":"MultiLineString":s===3&&(e="Polygon"),e}const n_=Jf;function r_(s,t,e,i,n){Yc(s,t,e||0,i||s.length-1,n||o_)}function Yc(s,t,e,i,n){for(;i>e;){if(i-e>600){var r=i-e+1,o=t-e+1,a=Math.log(r),l=.5*Math.exp(2*a/3),h=.5*Math.sqrt(a*l*(r-l)/r)*(o-r/2<0?-1:1),c=Math.max(e,Math.floor(t-o*l/r+h)),u=Math.min(i,Math.floor(t+(r-o)*l/r+h));Yc(s,t,c,u,n)}var d=s[t],g=e,p=i;for(Is(s,e,t),n(s[i],d)>0&&Is(s,e,i);g<p;){for(Is(s,g,p),g++,p--;n(s[g],d)<0;)g++;for(;n(s[p],d)>0;)p--}n(s[e],d)===0?Is(s,e,p):(p++,Is(s,p,i)),p<=t&&(e=p+1),t<=p&&(i=p-1)}}function Is(s,t,e){var i=s[t];s[t]=s[e],s[e]=i}function o_(s,t){return s<t?-1:s>t?1:0}let Kc=class{constructor(s=9){this._maxEntries=Math.max(4,s),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(s){let t=this.data;const e=[];if(!jn(s,t))return e;const i=this.toBBox,n=[];for(;t;){for(let r=0;r<t.children.length;r++){const o=t.children[r],a=t.leaf?i(o):o;jn(s,a)&&(t.leaf?e.push(o):oo(s,a)?this._all(o,e):n.push(o))}t=n.pop()}return e}collides(s){let t=this.data;if(!jn(s,t))return!1;const e=[];for(;t;){for(let i=0;i<t.children.length;i++){const n=t.children[i],r=t.leaf?this.toBBox(n):n;if(jn(s,r)){if(t.leaf||oo(s,r))return!0;e.push(n)}}t=e.pop()}return!1}load(s){if(!(s&&s.length))return this;if(s.length<this._minEntries){for(let e=0;e<s.length;e++)this.insert(s[e]);return this}let t=this._build(s.slice(),0,s.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(s){return s&&this._insert(s,this.data.height-1),this}clear(){return this.data=Bi([]),this}remove(s,t){if(!s)return this;let e=this.data;const i=this.toBBox(s),n=[],r=[];let o,a,l;for(;e||n.length;){if(e||(e=n.pop(),a=n[n.length-1],o=r.pop(),l=!0),e.leaf){const h=a_(s,e.children,t);if(h!==-1)return e.children.splice(h,1),n.push(e),this._condense(n),this}!l&&!e.leaf&&oo(e,i)?(n.push(e),r.push(o),o=0,a=e,e=e.children[0]):a?(o++,e=a.children[o],l=!1):e=null}return this}toBBox(s){return s}compareMinX(s,t){return s.minX-t.minX}compareMinY(s,t){return s.minY-t.minY}toJSON(){return this.data}fromJSON(s){return this.data=s,this}_all(s,t){const e=[];for(;s;)s.leaf?t.push(...s.children):e.push(...s.children),s=e.pop();return t}_build(s,t,e,i){const n=e-t+1;let r=this._maxEntries,o;if(n<=r)return o=Bi(s.slice(t,e+1)),ki(o,this.toBBox),o;i||(i=Math.ceil(Math.log(n)/Math.log(r)),r=Math.ceil(n/Math.pow(r,i-1))),o=Bi([]),o.leaf=!1,o.height=i;const a=Math.ceil(n/r),l=a*Math.ceil(Math.sqrt(r));ql(s,t,e,l,this.compareMinX);for(let h=t;h<=e;h+=l){const c=Math.min(h+l-1,e);ql(s,h,c,a,this.compareMinY);for(let u=h;u<=c;u+=a){const d=Math.min(u+a-1,c);o.children.push(this._build(s,u,d,i-1))}}return ki(o,this.toBBox),o}_chooseSubtree(s,t,e,i){for(;i.push(t),!(t.leaf||i.length-1===e);){let n=1/0,r=1/0,o;for(let a=0;a<t.children.length;a++){const l=t.children[a],h=ro(l),c=c_(s,l)-h;c<r?(r=c,n=h<n?h:n,o=l):c===r&&h<n&&(n=h,o=l)}t=o||t.children[0]}return t}_insert(s,t,e){const i=e?s:this.toBBox(s),n=[],r=this._chooseSubtree(i,this.data,t,n);for(r.children.push(s),Fs(r,i);t>=0&&n[t].children.length>this._maxEntries;)this._split(n,t),t--;this._adjustParentBBoxes(i,n,t)}_split(s,t){const e=s[t],i=e.children.length,n=this._minEntries;this._chooseSplitAxis(e,n,i);const r=this._chooseSplitIndex(e,n,i),o=Bi(e.children.splice(r,e.children.length-r));o.height=e.height,o.leaf=e.leaf,ki(e,this.toBBox),ki(o,this.toBBox),t?s[t-1].children.push(o):this._splitRoot(e,o)}_splitRoot(s,t){this.data=Bi([s,t]),this.data.height=s.height+1,this.data.leaf=!1,ki(this.data,this.toBBox)}_chooseSplitIndex(s,t,e){let i,n=1/0,r=1/0;for(let o=t;o<=e-t;o++){const a=As(s,0,o,this.toBBox),l=As(s,o,e,this.toBBox),h=u_(a,l),c=ro(a)+ro(l);h<n?(n=h,i=o,r=c<r?c:r):h===n&&c<r&&(r=c,i=o)}return i||e-t}_chooseSplitAxis(s,t,e){const i=s.leaf?this.compareMinX:l_,n=s.leaf?this.compareMinY:h_,r=this._allDistMargin(s,t,e,i),o=this._allDistMargin(s,t,e,n);r<o&&s.children.sort(i)}_allDistMargin(s,t,e,i){s.children.sort(i);const n=this.toBBox,r=As(s,0,t,n),o=As(s,e-t,e,n);let a=Gn(r)+Gn(o);for(let l=t;l<e-t;l++){const h=s.children[l];Fs(r,s.leaf?n(h):h),a+=Gn(r)}for(let l=e-t-1;l>=t;l--){const h=s.children[l];Fs(o,s.leaf?n(h):h),a+=Gn(o)}return a}_adjustParentBBoxes(s,t,e){for(let i=e;i>=0;i--)Fs(t[i],s)}_condense(s){for(let t=s.length-1,e;t>=0;t--)s[t].children.length===0?t>0?(e=s[t-1].children,e.splice(e.indexOf(s[t]),1)):this.clear():ki(s[t],this.toBBox)}};function a_(s,t,e){if(!e)return t.indexOf(s);for(let i=0;i<t.length;i++)if(e(s,t[i]))return i;return-1}function ki(s,t){As(s,0,s.children.length,t,s)}function As(s,t,e,i,n){n||(n=Bi(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(let r=t;r<e;r++){const o=s.children[r];Fs(n,s.leaf?i(o):o)}return n}function Fs(s,t){return s.minX=Math.min(s.minX,t.minX),s.minY=Math.min(s.minY,t.minY),s.maxX=Math.max(s.maxX,t.maxX),s.maxY=Math.max(s.maxY,t.maxY),s}function l_(s,t){return s.minX-t.minX}function h_(s,t){return s.minY-t.minY}function ro(s){return(s.maxX-s.minX)*(s.maxY-s.minY)}function Gn(s){return s.maxX-s.minX+(s.maxY-s.minY)}function c_(s,t){return(Math.max(t.maxX,s.maxX)-Math.min(t.minX,s.minX))*(Math.max(t.maxY,s.maxY)-Math.min(t.minY,s.minY))}function u_(s,t){const e=Math.max(s.minX,t.minX),i=Math.max(s.minY,t.minY),n=Math.min(s.maxX,t.maxX),r=Math.min(s.maxY,t.maxY);return Math.max(0,n-e)*Math.max(0,r-i)}function oo(s,t){return s.minX<=t.minX&&s.minY<=t.minY&&t.maxX<=s.maxX&&t.maxY<=s.maxY}function jn(s,t){return t.minX<=s.maxX&&t.minY<=s.maxY&&t.maxX>=s.minX&&t.maxY>=s.minY}function Bi(s){return{children:s,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ql(s,t,e,i,n){const r=[t,e];for(;r.length;){if(e=r.pop(),t=r.pop(),e-t<=i)continue;const o=t+Math.ceil((e-t)/i/2)*i;r_(s,o,t,e,n),r.push(t,o,o,e)}}let ys=0;const vs=0,ct=1<<ys++,F=1<<ys++,ee=1<<ys++,Ct=1<<ys++,oi=1<<ys++,Mt=Math.pow(2,ys)-1,Hc={[ct]:"boolean",[F]:"number",[ee]:"string",[Ct]:"color",[oi]:"number[]"},d_=Object.keys(Hc).map(Number).sort(ii);function wt(s){const t=[];for(const e of d_)g_(s,e)&&t.push(Hc[e]);return t.length===0?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function g_(s,t){return(s&t)===t}function pe(s,t){return!!(s&t)}function Vr(s,t){return s===t}class qe{constructor(t,e){this.type=t,this.value=e}}class p_{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Zc(){return{variables:new Set,properties:new Set,featureId:!1,style:{}}}function f_(s){switch(s){case"string":return ee;case"color":return Ct;case"number":return F;case"boolean":return ct;case"number[]":return oi;default:throw new Error(`Unrecognized type hint: ${s}`)}}function Q(s,t,e){switch(typeof s){case"boolean":return new qe(ct,s);case"number":return new qe(F,s);case"string":{let n=ee;return Xd(s)&&(n|=Ct),Vr(n&e,vs)||(n&=e),new qe(n,s)}}if(!Array.isArray(s))throw new Error("Expression must be an array or a primitive value");if(s.length===0)throw new Error("Empty expression");if(typeof s[0]=="string")return R_(s,t,e);for(const n of s)if(typeof n!="number")throw new Error("Expected an array of numbers");let i=oi;return(s.length===3||s.length===4)&&(i|=Ct),e&&(i&=e),new qe(i,s)}const T={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette"},__={[T.Get]:z(([s,t])=>t!==void 0?f_(t.value):Mt,U(1,2),m_),[T.Var]:z(([s])=>s.type,U(1,1),y_),[T.Id]:z(F|ee,Ps,v_),[T.Concat]:z(ee,U(2,1/0),Z(Mt)),[T.GeometryType]:z(ee,Ps),[T.Resolution]:z(F,Ps),[T.Zoom]:z(F,Ps),[T.Time]:z(F,Ps),[T.Any]:z(ct,U(2,1/0),Z(ct)),[T.All]:z(ct,U(2,1/0),Z(ct)),[T.Not]:z(ct,U(1,1),Z(ct)),[T.Equal]:z(ct,U(2,2),Z(Mt),gi),[T.NotEqual]:z(ct,U(2,2),Z(Mt),gi),[T.GreaterThan]:z(ct,U(2,2),Z(Mt),gi),[T.GreaterThanOrEqualTo]:z(ct,U(2,2),Z(Mt),gi),[T.LessThan]:z(ct,U(2,2),Z(Mt),gi),[T.LessThanOrEqualTo]:z(ct,U(2,2),Z(Mt),gi),[T.Multiply]:z(s=>{let t=F|Ct;for(let e=0;e<s.length;e++)t&=s[e].type;return t},U(2,1/0),Z(F|Ct),gi),[T.Divide]:z(F,U(2,2),Z(F)),[T.Add]:z(F,U(2,1/0),Z(F)),[T.Subtract]:z(F,U(2,2),Z(F)),[T.Clamp]:z(F,U(3,3),Z(F)),[T.Mod]:z(F,U(2,2),Z(F)),[T.Pow]:z(F,U(2,2),Z(F)),[T.Abs]:z(F,U(1,1),Z(F)),[T.Floor]:z(F,U(1,1),Z(F)),[T.Ceil]:z(F,U(1,1),Z(F)),[T.Round]:z(F,U(1,1),Z(F)),[T.Sin]:z(F,U(1,1),Z(F)),[T.Cos]:z(F,U(1,1),Z(F)),[T.Atan]:z(F,U(1,2),Z(F)),[T.Sqrt]:z(F,U(1,1),Z(F)),[T.Match]:z(s=>{let t=Mt;for(let e=2;e<s.length;e+=2)t&=s[e].type;return t&=s[s.length-1].type,t},U(4,1/0),Jl,E_),[T.Between]:z(ct,U(3,3),Z(F)),[T.Interpolate]:z(s=>{let t=Ct|F;for(let e=3;e<s.length;e+=2)t&=s[e].type;return t},U(6,1/0),Jl,C_),[T.Case]:z(s=>{let t=Mt;for(let e=1;e<s.length;e+=2)t&=s[e].type;return t&=s[s.length-1].type,t},U(3,1/0),x_,w_),[T.In]:z(ct,U(2,2),S_),[T.Number]:z(F,U(1,1/0),Z(Mt)),[T.String]:z(ee,U(1,1/0),Z(Mt)),[T.Array]:z(s=>s.length===3||s.length===4?oi|Ct:oi,U(1,1/0),Z(F)),[T.Color]:z(Ct,U(3,4),Z(F)),[T.Band]:z(F,U(1,3),Z(F)),[T.Palette]:z(Ct,U(2,2),T_)};function m_(s,t){const e=Q(s[1],t);if(!(e instanceof qe))throw new Error("Expected a literal argument for get operation");if(typeof e.value!="string")throw new Error("Expected a string argument for get operation");if(t.properties.add(e.value),s.length===3){const i=Q(s[2],t);return[e,i]}return[e]}function y_(s,t,e,i){const n=s[1];if(typeof n!="string")throw new Error("Expected a string argument for var operation");if(t.variables.add(n),!("variables"in t.style)||t.style.variables[n]===void 0)return[new qe(Mt,n)];const r=t.style.variables[n],o=Q(r,t);if(o.value=n,i&&!pe(i,o.type))throw new Error(`The variable ${n} has type ${wt(o.type)} but the following type was expected: ${wt(i)}`);return[o]}function v_(s,t){t.featureId=!0}function Ps(s,t){const e=s[0];if(s.length!==1)throw new Error(`Expected no arguments for ${e} operation`);return[]}function U(s,t){return function(e,i){const n=e[0],r=e.length-1;if(s===t){if(r!==s){const o=s===1?"":"s";throw new Error(`Expected ${s} argument${o} for ${n}, got ${r}`)}}else if(r<s||r>t){const o=t===1/0?`${s} or more`:`${s} to ${t}`;throw new Error(`Expected ${o} arguments for ${n}, got ${r}`)}}}function Z(s){return function(t,e){const i=t[0],n=t.length-1,r=new Array(n);for(let o=0;o<n;++o){const a=Q(t[o+1],e);if(!pe(s,a.type)){const l=wt(s),h=wt(a.type);throw new Error(`Unexpected type for argument ${o} of ${i} operation, got ${l} but expected ${h}`)}a.type&=s,r[o]=a}return r}}function gi(s,t,e){const i=s[0],n=s.length-1;let r=Mt;for(let a=0;a<e.length;++a)r&=e[a].type;if(r===vs)throw new Error(`No common type could be found for arguments of ${i} operation`);const o=new Array(n);for(let a=0;a<n;++a)o[a]=Q(s[a+1],t,r);return o}function x_(s,t){const e=s[0],i=s.length-1;if(i%2===0)throw new Error(`An odd amount of arguments was expected for operation ${e}, got ${JSON.stringify(i)} instead`)}function Jl(s,t){const e=s[0],i=s.length-1;if(i%2===1)throw new Error(`An even amount of arguments was expected for operation ${e}, got ${JSON.stringify(i)} instead`)}function E_(s,t,e,i){const n=s.length-1;let r=Q(s[1],t).type;const o=Q(s[s.length-1],t);let a=i!==void 0?i&o.type:o.type;const l=new Array(n-2);for(let c=0;c<n-2;c+=2){const u=Q(s[c+2],t),d=Q(s[c+3],t);r&=u.type,a&=d.type,l[c]=u,l[c+1]=d}const h=ee|F|ct;if(!pe(h,r))throw new Error(`Expected an input of type ${wt(h)} for the interpolate operation, got ${wt(r)} instead`);if(Vr(a,vs))throw new Error("Could not find a common output type for the following match operation: "+JSON.stringify(s));for(let c=0;c<n-2;c+=2){const u=Q(s[c+2],t,r),d=Q(s[c+3],t,a);l[c]=u,l[c+1]=d}return[Q(s[1],t,r),...l,Q(s[s.length-1],t,a)]}function C_(s,t,e,i){const n=s[1];let r;switch(n[0]){case"linear":r=1;break;case"exponential":if(r=n[1],typeof r!="number")throw new Error(`Expected a number base for exponential interpolation, got ${JSON.stringify(r)} instead`);break;default:r=null}if(!r)throw new Error(`Invalid interpolation type: ${JSON.stringify(n)}`);r=Q(r,t);let o=Q(s[2],t);if(!pe(F,o.type))throw new Error(`Expected an input of type number for the interpolate operation, got ${wt(o.type)} instead`);o=Q(s[2],t,F);const a=new Array(s.length-3);for(let l=0;l<a.length;l+=2){let h=Q(s[l+3],t);if(!pe(F,h.type))throw new Error(`Expected all stop input values in the interpolate operation to be of type number, got ${wt(h.type)} at position ${l+2} instead`);let c=Q(s[l+4],t);if(!pe(F|Ct,c.type))throw new Error(`Expected all stop output values in the interpolate operation to be a number or color, got ${wt(c.type)} at position ${l+3} instead`);h=Q(s[l+3],t,F),c=Q(s[l+4],t,F|Ct),a[l]=h,a[l+1]=c}return[r,o,...a]}function w_(s,t,e,i){const n=Q(s[s.length-1],t);let r=i!==void 0?i&n.type:n.type;const o=new Array(s.length-1);for(let a=0;a<o.length-1;a+=2){const l=Q(s[a+1],t),h=Q(s[a+2],t);if(!pe(ct,l.type))throw new Error(`Expected all conditions in the case operation to be of type boolean, got ${wt(l.type)} at position ${a} instead`);r&=h.type,o[a]=l,o[a+1]=h}if(Vr(r,vs))throw new Error("Could not find a common output type for the following case operation: "+JSON.stringify(s));for(let a=0;a<o.length-1;a+=2)o[a+1]=Q(s[a+2],t,r);return o[o.length-1]=Q(s[s.length-1],t,r),o}function S_(s,t){let e=s[2];if(!Array.isArray(e))throw new Error('The "in" operator was provided a literal value which was not an array as second argument.');if(typeof e[0]=="string"){if(e[0]!=="literal")throw new Error('For the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions.');if(!Array.isArray(e[1]))throw new Error('The "in" operator was provided a literal value which was not an array as second argument.');e=e[1]}let i=ee|F;const n=new Array(e.length);for(let r=0;r<n.length;r++){const o=Q(e[r],t);i&=o.type,n[r]=o}if(Vr(i,vs))throw new Error("Could not find a common type for the following in operation: "+JSON.stringify(s));return[Q(s[1],t,i),...n]}function T_(s,t){const e=Q(s[1],t,F);if(e.type!==F)throw new Error(`The first argument of palette must be an number, got ${wt(e.type)} instead`);const i=s[2];if(!Array.isArray(i))throw new Error("The second argument of palette must be an array");const n=new Array(i.length);for(let r=0;r<n.length;r++){const o=Q(i[r],t,Ct);if(!(o instanceof qe))throw new Error(`The palette color at index ${r} must be a literal value`);if(!pe(o.type,Ct))throw new Error(`The palette color at index ${r} should be of type color, got ${wt(o.type)} instead`);n[r]=o}return[e,...n]}function z(s,...t){return function(e,i,n){const r=e[0];let o=[];for(let l=0;l<t.length;l++)o=t[l](e,i,o,n)||o;let a=typeof s=="function"?s(o):s;if(n!==void 0){if(!pe(a,n))throw new Error(`The following expression was expected to return ${wt(n)}, but returns ${wt(a)} instead: ${JSON.stringify(e)}`);a&=n}if(a===vs)throw new Error(`No matching type was found for the following expression: ${JSON.stringify(e)}`);return new p_(a,r,...o)}}function R_(s,t,e){const i=s[0],n=__[i];if(!n)throw new Error(`Unknown operator: ${i}`);return n(s,t,e)}function qc(){return{variables:{},properties:{},resolution:NaN,featureId:null}}function li(s,t,e){const i=Q(s,e);if(!pe(t,i.type)){const n=wt(t),r=wt(i.type);throw new Error(`Expected expression to be of type ${n}, got ${r}`)}return ke(i)}function ke(s,t){if(s instanceof qe){if(s.type===Ct&&typeof s.value=="string"){const i=sa(s.value);return function(){return i}}return function(){return s.value}}const e=s.operator;switch(e){case T.Number:case T.String:return b_(s);case T.Get:case T.Var:return I_(s);case T.Id:return i=>i.featureId;case T.Concat:{const i=s.args.map(n=>ke(n));return n=>"".concat(...i.map(r=>r(n).toString()))}case T.Resolution:return i=>i.resolution;case T.Any:case T.All:case T.Not:return M_(s);case T.Equal:case T.NotEqual:case T.LessThan:case T.LessThanOrEqualTo:case T.GreaterThan:case T.GreaterThanOrEqualTo:return P_(s);case T.Multiply:case T.Divide:case T.Add:case T.Subtract:case T.Clamp:case T.Mod:case T.Pow:case T.Abs:case T.Floor:case T.Ceil:case T.Round:case T.Sin:case T.Cos:case T.Atan:case T.Sqrt:return L_(s);case T.Match:return A_(s);case T.Interpolate:return F_(s);default:throw new Error(`Unsupported operator ${e}`)}}function b_(s,t){const e=s.operator,i=s.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=ke(s.args[r]);switch(e){case T.Number:case T.String:return r=>{for(let o=0;o<i;++o){const a=n[o](r);if(typeof a===e)return a}throw new Error(`Expected one of the values to be a ${e}`)};default:throw new Error(`Unsupported assertion operator ${e}`)}}function I_(s,t){const e=s.args[0].value;switch(s.operator){case T.Get:return i=>i.properties[e];case T.Var:return i=>i.variables[e];default:throw new Error(`Unsupported accessor operator ${s.operator}`)}}function P_(s,t){const e=s.operator,i=ke(s.args[0]),n=ke(s.args[1]);switch(e){case T.Equal:return r=>i(r)===n(r);case T.NotEqual:return r=>i(r)!==n(r);case T.LessThan:return r=>i(r)<n(r);case T.LessThanOrEqualTo:return r=>i(r)<=n(r);case T.GreaterThan:return r=>i(r)>n(r);case T.GreaterThanOrEqualTo:return r=>i(r)>=n(r);default:throw new Error(`Unsupported comparison operator ${e}`)}}function M_(s,t){const e=s.operator,i=s.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=ke(s.args[r]);switch(e){case T.Any:return r=>{for(let o=0;o<i;++o)if(n[o](r))return!0;return!1};case T.All:return r=>{for(let o=0;o<i;++o)if(!n[o](r))return!1;return!0};case T.Not:return r=>!n[0](r);default:throw new Error(`Unsupported logical operator ${e}`)}}function L_(s,t){const e=s.operator,i=s.args.length,n=new Array(i);for(let r=0;r<i;++r)n[r]=ke(s.args[r]);switch(e){case T.Multiply:return r=>{let o=1;for(let a=0;a<i;++a)o*=n[a](r);return o};case T.Divide:return r=>n[0](r)/n[1](r);case T.Add:return r=>{let o=0;for(let a=0;a<i;++a)o+=n[a](r);return o};case T.Subtract:return r=>n[0](r)-n[1](r);case T.Clamp:return r=>{const o=n[0](r),a=n[1](r);if(o<a)return a;const l=n[2](r);return o>l?l:o};case T.Mod:return r=>n[0](r)%n[1](r);case T.Pow:return r=>Math.pow(n[0](r),n[1](r));case T.Abs:return r=>Math.abs(n[0](r));case T.Floor:return r=>Math.floor(n[0](r));case T.Ceil:return r=>Math.ceil(n[0](r));case T.Round:return r=>Math.round(n[0](r));case T.Sin:return r=>Math.sin(n[0](r));case T.Cos:return r=>Math.cos(n[0](r));case T.Atan:return i===2?r=>Math.atan2(n[0](r),n[1](r)):r=>Math.atan(n[0](r));case T.Sqrt:return r=>Math.sqrt(n[0](r));default:throw new Error(`Unsupported numeric operator ${e}`)}}function A_(s,t){const e=s.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=ke(s.args[n]);return n=>{const r=i[0](n);for(let o=1;o<e;o+=2)if(r===i[o](n))return i[o+1](n);return i[e-1](n)}}function F_(s,t){const e=s.args.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=ke(s.args[n]);return n=>{const r=i[0](n),o=i[1](n);let a,l;for(let h=2;h<e;h+=2){const c=i[h](n);let u=i[h+1](n);const d=Array.isArray(u);if(d&&(u=Ud(u)),c>=o)return h===2?u:d?O_(r,o,a,l,c,u):Os(r,o,a,l,c,u);a=c,l=u}return l}}function Os(s,t,e,i,n,r){const o=n-e;if(o===0)return i;const a=t-e,l=s===1?a/o:(Math.pow(s,a)-1)/(Math.pow(s,o)-1);return i+l*(r-i)}function O_(s,t,e,i,n,r){if(n-e===0)return i;const o=bl(i),a=bl(r);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);const h=[Os(s,t,e,o[0],n,a[0]),Os(s,t,e,o[1],n,a[1]),o[2]+Os(s,t,e,0,n,l),Os(s,t,e,i[3],n,r[3])];return Xh($d(h))}function D_(s){return!0}function k_(s){const t=Zc(),e=N_(s,t),i=qc();return function(n,r){if(i.properties=n.getPropertiesInternal(),i.resolution=r,t.featureId){const o=n.getId();o!==void 0?i.featureId=o:i.featureId=null}return e(i)}}function Ql(s){const t=Zc(),e=s.length,i=new Array(e);for(let o=0;o<e;++o)i[o]=jo(s[o],t);const n=qc(),r=new Array(e);return function(o,a){if(n.properties=o.getPropertiesInternal(),n.resolution=a,t.featureId){const h=o.getId();h!==void 0?n.featureId=h:n.featureId=null}let l=0;for(let h=0;h<e;++h){const c=i[h](n);c&&(r[l]=c,l+=1)}return r.length=l,r}}function N_(s,t){const e=s.length,i=new Array(e);for(let n=0;n<e;++n){const r=s[n],o="filter"in r?li(r.filter,ct,t):D_;let a;if(Array.isArray(r.style)){const l=r.style.length;a=new Array(l);for(let h=0;h<l;++h)a[h]=jo(r.style[h],t)}else a=[jo(r.style,t)];i[n]={filter:o,styles:a}}return function(n){const r=[];let o=!1;for(let a=0;a<e;++a){const l=i[a].filter;if(l(n)&&!(s[a].else&&o)){o=!0;for(const h of i[a].styles){const c=h(n);c&&r.push(c)}}}return r}}function jo(s,t){const e=tn(s,"",t),i=en(s,"",t),n=G_(s,t),r=j_(s,t),o=Ft(s,"z-index",t);if(!e&&!i&&!n&&!r&&!si(s))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(s));const a=new te;return function(l){let h=!0;if(e){const c=e(l);c&&(h=!1),a.setFill(c)}if(i){const c=i(l);c&&(h=!1),a.setStroke(c)}if(n){const c=n(l);c&&(h=!1),a.setText(c)}if(r){const c=r(l);c&&(h=!1),a.setImage(c)}return o&&a.setZIndex(o(l)),h?null:a}}function tn(s,t,e){const i=Jc(s,t+"fill-color",e);if(!i)return null;const n=new Qs;return function(r){const o=i(r);return o==="none"?null:(n.setColor(o),n)}}function en(s,t,e){const i=Ft(s,t+"stroke-width",e),n=Jc(s,t+"stroke-color",e);if(!i&&!n)return null;const r=Ye(s,t+"stroke-line-cap",e),o=Ye(s,t+"stroke-line-join",e),a=Qc(s,t+"stroke-line-dash",e),l=Ft(s,t+"stroke-line-dash-offset",e),h=Ft(s,t+"stroke-miter-limit",e),c=new js;return function(u){if(n){const d=n(u);if(d==="none")return null;c.setColor(d)}if(i&&c.setWidth(i(u)),r){const d=r(u);if(d!=="butt"&&d!=="round"&&d!=="square")throw new Error("Expected butt, round, or square line cap");c.setLineCap(d)}if(o){const d=o(u);if(d!=="bevel"&&d!=="round"&&d!=="miter")throw new Error("Expected bevel, round, or miter line join");c.setLineJoin(d)}return a&&c.setLineDash(a(u)),l&&c.setLineDashOffset(l(u)),h&&c.setMiterLimit(h(u)),c}}function G_(s,t){const e="text-",i=Ye(s,e+"value",t);if(!i)return null;const n=tn(s,e,t),r=tn(s,e+"background-",t),o=en(s,e,t),a=en(s,e+"background-",t),l=Ye(s,e+"font",t),h=Ft(s,e+"max-angle",t),c=Ft(s,e+"offset-x",t),u=Ft(s,e+"offset-y",t),d=sn(s,e+"overflow",t),g=Ye(s,e+"placement",t),p=Ft(s,e+"repeat",t),f=zr(s,e+"scale",t),_=sn(s,e+"rotate-with-view",t),m=Ft(s,e+"rotation",t),y=Ye(s,e+"align",t),v=Ye(s,e+"justify",t),x=Ye(s,e+"baseline",t),E=Qc(s,e+"padding",t),C=new Lf({});return function(S){if(C.setText(i(S)),n&&C.setFill(n(S)),r&&C.setBackgroundFill(r(S)),o&&C.setStroke(o(S)),a&&C.setBackgroundStroke(a(S)),l&&C.setFont(l(S)),h&&C.setMaxAngle(h(S)),c&&C.setOffsetX(c(S)),u&&C.setOffsetY(u(S)),d&&C.setOverflow(d(S)),g){const w=g(S);if(w!=="point"&&w!=="line")throw new Error("Expected point or line for text-placement");C.setPlacement(w)}if(p&&C.setRepeat(p(S)),f&&C.setScale(f(S)),_&&C.setRotateWithView(_(S)),m&&C.setRotation(m(S)),y){const w=y(S);if(w!=="left"&&w!=="center"&&w!=="right"&&w!=="end"&&w!=="start")throw new Error("Expected left, right, center, start, or end for text-align");C.setTextAlign(w)}if(v){const w=v(S);if(w!=="left"&&w!=="right"&&w!=="center")throw new Error("Expected left, right, or center for text-justify");C.setJustify(w)}if(x){const w=x(S);if(w!=="bottom"&&w!=="top"&&w!=="middle"&&w!=="alphabetic"&&w!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");C.setTextBaseline(w)}return E&&C.setPadding(E(S)),C}}function j_(s,t){return"icon-src"in s?V_(s,t):"shape-points"in s?z_(s,t):"circle-radius"in s?W_(s,t):null}function V_(s,t){const e="icon-",i=e+"src",n=tu(s[i],i),r=mr(s,e+"anchor",t),o=zr(s,e+"scale",t),a=Ft(s,e+"opacity",t),l=mr(s,e+"displacement",t),h=Ft(s,e+"rotation",t),c=sn(s,e+"rotate-with-view",t),u=th(s,e+"anchor-origin"),d=eh(s,e+"anchor-x-units"),g=eh(s,e+"anchor-y-units"),p=X_(s,e+"color"),f=U_(s,e+"cross-origin"),_=$_(s,e+"offset"),m=th(s,e+"offset-origin"),y=Yi(s,e+"width"),v=Yi(s,e+"height"),x=B_(s,e+"size"),E=$a(s,e+"declutter"),C=new Bc({src:n,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,color:p,crossOrigin:f,offset:_,offsetOrigin:m,height:v,width:y,size:x,declutterMode:E});return function(S){return a&&C.setOpacity(a(S)),l&&C.setDisplacement(l(S)),h&&C.setRotation(h(S)),c&&C.setRotateWithView(c(S)),o&&C.setScale(o(S)),r&&C.setAnchor(r(S)),C}}function z_(s,t){const e="shape-",i=e+"points",n=eu(s[i],i),r=tn(s,e,t),o=en(s,e,t),a=zr(s,e+"scale",t),l=mr(s,e+"displacement",t),h=Ft(s,e+"rotation",t),c=sn(s,e+"rotate-with-view",t),u=Yi(s,e+"radius"),d=Yi(s,e+"radius1"),g=Yi(s,e+"radius2"),p=Yi(s,e+"angle"),f=$a(s,e+"declutter-mode"),_=new Uc({points:n,radius:u,radius1:d,radius2:g,angle:p,declutterMode:f});return function(m){return r&&_.setFill(r(m)),o&&_.setStroke(o(m)),l&&_.setDisplacement(l(m)),h&&_.setRotation(h(m)),c&&_.setRotateWithView(c(m)),a&&_.setScale(a(m)),_}}function W_(s,t){const e="circle-",i=tn(s,e,t),n=en(s,e,t),r=Ft(s,e+"radius",t),o=zr(s,e+"scale",t),a=mr(s,e+"displacement",t),l=Ft(s,e+"rotation",t),h=sn(s,e+"rotate-with-view",t),c=$a(s,e+"declutter-mode"),u=new Wa({radius:5,declutterMode:c});return function(d){return r&&u.setRadius(r(d)),i&&u.setFill(i(d)),n&&u.setStroke(n(d)),a&&u.setDisplacement(a(d)),l&&u.setRotation(l(d)),h&&u.setRotateWithView(h(d)),o&&u.setScale(o(d)),u}}function Ft(s,t,e){if(!(t in s))return;const i=li(s[t],F,e);return function(n){return eu(i(n),t)}}function Ye(s,t,e){if(!(t in s))return null;const i=li(s[t],ee,e);return function(n){return tu(i(n),t)}}function sn(s,t,e){if(!(t in s))return null;const i=li(s[t],ct,e);return function(n){const r=i(n);if(typeof r!="boolean")throw new Error(`Expected a boolean for ${t}`);return r}}function Jc(s,t,e){if(!(t in s))return null;const i=li(s[t],Ct|ee,e);return function(n){return iu(i(n),t)}}function Qc(s,t,e){if(!(t in s))return null;const i=li(s[t],oi,e);return function(n){return yn(i(n),t)}}function mr(s,t,e){if(!(t in s))return null;const i=li(s[t],oi,e);return function(n){const r=yn(i(n),t);if(r.length!==2)throw new Error(`Expected two numbers for ${t}`);return r}}function zr(s,t,e){if(!(t in s))return null;const i=li(s[t],oi|F,e);return function(n){return Y_(i(n),t)}}function Yi(s,t){const e=s[t];if(e!==void 0){if(typeof e!="number")throw new Error(`Expected a number for ${t}`);return e}}function B_(s,t){const e=s[t];if(e!==void 0){if(typeof e=="number")return bt(e);if(!Array.isArray(e))throw new Error(`Expected a number or size array for ${t}`);if(e.length!==2||typeof e[0]!="number"||typeof e[1]!="number")throw new Error(`Expected a number or size array for ${t}`);return e}}function U_(s,t){const e=s[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);return e}}function th(s,t){const e=s[t];if(e!==void 0){if(e!=="bottom-left"&&e!=="bottom-right"&&e!=="top-left"&&e!=="top-right")throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return e}}function eh(s,t){const e=s[t];if(e!==void 0){if(e!=="pixels"&&e!=="fraction")throw new Error(`Expected pixels or fraction for ${t}`);return e}}function $_(s,t){const e=s[t];if(e!==void 0)return yn(e,t)}function $a(s,t){const e=s[t];if(e!==void 0){if(typeof e!="string")throw new Error(`Expected a string for ${t}`);if(e!=="declutter"&&e!=="obstacle"&&e!=="none")throw new Error(`Expected declutter, obstacle, or none for ${t}`);return e}}function X_(s,t){const e=s[t];if(e!==void 0)return iu(e,t)}function yn(s,t){if(!Array.isArray(s))throw new Error(`Expected an array for ${t}`);const e=s.length;for(let i=0;i<e;++i)if(typeof s[i]!="number")throw new Error(`Expected an array of numbers for ${t}`);return s}function tu(s,t){if(typeof s!="string")throw new Error(`Expected a string for ${t}`);return s}function eu(s,t){if(typeof s!="number")throw new Error(`Expected a number for ${t}`);return s}function iu(s,t){if(typeof s=="string")return s;const e=yn(s,t),i=e.length;if(i<3||i>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return e}function Y_(s,t){if(typeof s=="number")return s;const e=yn(s,t);if(e.length!==2)throw new Error(`Expected an array of two numbers for ${t}`);return e}const ih={RENDER_ORDER:"renderOrder"};class K_ extends fn{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter!==void 0?t.declutter:!1,this.renderBuffer_=t.renderBuffer!==void 0?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=t.updateWhileAnimating!==void 0?t.updateWhileAnimating:!1,this.updateWhileInteracting_=t.updateWhileInteracting!==void 0?t.updateWhileInteracting:!1}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(ih.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t){t.declutterTree||(t.declutterTree=new Kc(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(ih.RENDER_ORDER,t)}setStyle(t){this.style_=H_(t),this.styleFunction_=t===null?void 0:If(this.style_),this.changed()}}function H_(s){if(s===void 0)return Pf;if(!s)return null;if(typeof s=="function"||s instanceof te)return s;if(!Array.isArray(s))return Ql([s]);if(s.length===0)return[];const t=s.length,e=s[0];if(e instanceof te){const i=new Array(t);for(let n=0;n<t;++n){const r=s[n];if(!(r instanceof te))throw new Error("Expected a list of style instances");i[n]=r}return i}if("style"in e){const i=new Array(t);for(let n=0;n<t;++n){const r=s[n];if(!("style"in r))throw new Error("Expected a list of rules with a style property");i[n]=r}return k_(i)}return Ql(s)}const su=K_,vn={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},Vn=[vn.FILL],Je=[vn.STROKE],yi=[vn.BEGIN_PATH],sh=[vn.CLOSE_PATH],k=vn;class Z_{drawCustom(t,e,i,n){}drawGeometry(t){}setStyle(t){}drawCircle(t,e){}drawFeature(t,e){}drawGeometryCollection(t,e){}drawLineString(t,e){}drawMultiLineString(t,e){}drawMultiPoint(t,e){}drawMultiPolygon(t,e){}drawPoint(t,e){}drawPolygon(t,e){}drawText(t,e){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}const nu=Z_;class q_ extends nu{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return e==1?t:t.map(function(i){return i*e})}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.tmpCoordinate_,r=this.coordinates;let o=r.length;for(let a=0,l=t.length;a<l;a+=e)n[0]=t[a],n[1]=t[a+1],hn(i,n)&&(r[o++]=n[0],r[o++]=n[1]);return o}appendFlatLineCoordinates(t,e,i,n,r,o){const a=this.coordinates;let l=a.length;const h=this.getBufferedMaxExtent();o&&(e+=n);let c=t[e],u=t[e+1];const d=this.tmpCoordinate_;let g=!0,p,f,_;for(p=e+n;p<i;p+=n)d[0]=t[p],d[1]=t[p+1],_=wo(h,d),_!==f?(g&&(a[l++]=c,a[l++]=u,g=!1),a[l++]=d[0],a[l++]=d[1]):_===pt.INTERSECTING?(a[l++]=d[0],a[l++]=d[1],g=!1):g=!0,c=d[0],u=d[1],f=_;return(r&&g||p===e+n)&&(a[l++]=c,a[l++]=u),l}drawCustomCoordinates_(t,e,i,n,r){for(let o=0,a=i.length;o<a;++o){const l=i[o],h=this.appendFlatLineCoordinates(t,e,l,n,!1,!1);r.push(h),e=l}return e}drawCustom(t,e,i,n){this.beginGeometry(t,e);const r=t.getType(),o=t.getStride(),a=this.coordinates.length;let l,h,c,u,d;switch(r){case"MultiPolygon":l=t.getOrientedFlatCoordinates(),u=[];const g=t.getEndss();d=0;for(let p=0,f=g.length;p<f;++p){const _=[];d=this.drawCustomCoordinates_(l,d,g[p],o,_),u.push(_)}this.instructions.push([k.CUSTOM,a,u,t,i,Po]),this.hitDetectionInstructions.push([k.CUSTOM,a,u,t,n||i,Po]);break;case"Polygon":case"MultiLineString":c=[],l=r=="Polygon"?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,t.getEnds(),o,c),this.instructions.push([k.CUSTOM,a,c,t,i,Ks]),this.hitDetectionInstructions.push([k.CUSTOM,a,c,t,n||i,Ks]);break;case"LineString":case"Circle":l=t.getFlatCoordinates(),h=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([k.CUSTOM,a,h,t,i,Ze]),this.hitDetectionInstructions.push([k.CUSTOM,a,h,t,n||i,Ze]);break;case"MultiPoint":l=t.getFlatCoordinates(),h=this.appendFlatPointCoordinates(l,o),h>a&&(this.instructions.push([k.CUSTOM,a,h,t,i,Ze]),this.hitDetectionInstructions.push([k.CUSTOM,a,h,t,n||i,Ze]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([k.CUSTOM,a,h,t,i]),this.hitDetectionInstructions.push([k.CUSTOM,a,h,t,n||i]);break}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[k.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[k.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;t.reverse();let e;const i=t.length;let n,r,o=-1;for(e=0;e<i;++e)n=t[e],r=n[0],r==k.END_GEOMETRY?o=e:r==k.BEGIN_GEOMETRY&&(n[2]=e,_d(this.hitDetectionInstructions,o,e),o=-1)}setFillStrokeStyle(t,e){const i=this.state;if(t){const n=t.getColor();i.fillStyle=ce(n||At)}else i.fillStyle=void 0;if(e){const n=e.getColor();i.strokeStyle=ce(n||Zs);const r=e.getLineCap();i.lineCap=r!==void 0?r:us;const o=e.getLineDash();i.lineDash=o?o.slice():Ae;const a=e.getLineDashOffset();i.lineDashOffset=a||Fe;const l=e.getLineJoin();i.lineJoin=l!==void 0?l:ds;const h=e.getWidth();i.lineWidth=h!==void 0?h:Js;const c=e.getMiterLimit();i.miterLimit=c!==void 0?c:Hs,i.lineWidth>this.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[k.SET_FILL_STYLE,e];return typeof e!="string"&&i.push(!0),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[k.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(typeof i!="string"||t.currentFillStyle!=i)&&(i!==void 0&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,o=t.lineDashOffset,a=t.lineJoin,l=t.lineWidth,h=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!Ge(t.currentLineDash,r)||t.currentLineDashOffset!=o||t.currentLineJoin!=a||t.currentLineWidth!=l||t.currentMiterLimit!=h)&&(i!==void 0&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=o,t.currentLineJoin=a,t.currentLineWidth=l,t.currentMiterLimit=h)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[k.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=jh(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Kt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}const xn=q_;class J_ extends xn{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([k.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([k.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([k.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([k.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}const Q_=J_;class tm extends xn{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),a=[k.MOVE_TO_LINE_TO,r,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(t,e){const i=this.state,n=i.strokeStyle,r=i.lineWidth;if(n===void 0||r===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([k.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Ae,Fe],yi);const o=t.getFlatCoordinates(),a=t.getStride();this.drawFlatCoordinates_(o,0,o.length,a),this.hitDetectionInstructions.push(Je),this.endGeometry(e)}drawMultiLineString(t,e){const i=this.state,n=i.strokeStyle,r=i.lineWidth;if(n===void 0||r===void 0)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([k.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Ae,Fe],yi);const o=t.getEnds(),a=t.getFlatCoordinates(),l=t.getStride();let h=0;for(let c=0,u=o.length;c<u;++c)h=this.drawFlatCoordinates_(a,h,o[c],l);this.hitDetectionInstructions.push(Je),this.endGeometry(e)}finish(){const t=this.state;return t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Je),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){t.lastStroke!=null&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Je),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(yi)}}const em=tm;class im extends xn{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinatess_(t,e,i,n){const r=this.state,o=r.fillStyle!==void 0,a=r.strokeStyle!==void 0,l=i.length;this.instructions.push(yi),this.hitDetectionInstructions.push(yi);for(let h=0;h<l;++h){const c=i[h],u=this.coordinates.length,d=this.appendFlatLineCoordinates(t,e,c,n,!0,!a),g=[k.MOVE_TO_LINE_TO,u,d];this.instructions.push(g),this.hitDetectionInstructions.push(g),a&&(this.instructions.push(sh),this.hitDetectionInstructions.push(sh)),e=c}return o&&(this.instructions.push(Vn),this.hitDetectionInstructions.push(Vn)),a&&(this.instructions.push(Je),this.hitDetectionInstructions.push(Je)),e}drawCircle(t,e){const i=this.state,n=i.fillStyle,r=i.strokeStyle;if(n===void 0&&r===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([k.SET_FILL_STYLE,At]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([k.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Ae,Fe]);const o=t.getFlatCoordinates(),a=t.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,a,!1,!1);const h=[k.CIRCLE,l];this.instructions.push(yi,h),this.hitDetectionInstructions.push(yi,h),i.fillStyle!==void 0&&(this.instructions.push(Vn),this.hitDetectionInstructions.push(Vn)),i.strokeStyle!==void 0&&(this.instructions.push(Je),this.hitDetectionInstructions.push(Je)),this.endGeometry(e)}drawPolygon(t,e){const i=this.state,n=i.fillStyle,r=i.strokeStyle;if(n===void 0&&r===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([k.SET_FILL_STYLE,At]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([k.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Ae,Fe]);const o=t.getEnds(),a=t.getOrientedFlatCoordinates(),l=t.getStride();this.drawFlatCoordinatess_(a,0,o,l),this.endGeometry(e)}drawMultiPolygon(t,e){const i=this.state,n=i.fillStyle,r=i.strokeStyle;if(n===void 0&&r===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(t,e),i.fillStyle!==void 0&&this.hitDetectionInstructions.push([k.SET_FILL_STYLE,At]),i.strokeStyle!==void 0&&this.hitDetectionInstructions.push([k.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Ae,Fe]);const o=t.getEndss(),a=t.getOrientedFlatCoordinates(),l=t.getStride();let h=0;for(let c=0,u=o.length;c<u;++c)h=this.drawFlatCoordinatess_(a,h,o[c],l);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(t!==0){const e=this.coordinates;for(let i=0,n=e.length;i<n;++i)e[i]=pi(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;t.fillStyle!==void 0&&this.updateFillStyle(t,this.createFill),t.strokeStyle!==void 0&&this.updateStrokeStyle(t,this.applyStroke)}}const nh=im;function sm(s,t,e,i,n){const r=[];let o=e,a=0,l=t.slice(e,2);for(;a<s&&o+n<i;){const[h,c]=l.slice(-2),u=t[o+n],d=t[o+n+1],g=Math.sqrt((u-h)*(u-h)+(d-c)*(d-c));if(a+=g,a>=s){const p=(s-a+g)/g,f=Gt(h,u,p),_=Gt(c,d,p);l.push(f,_),r.push(l),l=[f,_],a==s&&(o+=n),a=0}else if(a<s)l.push(t[o+n],t[o+n+1]),o+=n;else{const p=g-a,f=Gt(h,u,p/g),_=Gt(c,d,p/g);l.push(f,_),r.push(l),l=[f,_],a=0,o+=n}}return a>0&&r.push(l),r}function nm(s,t,e,i,n){let r=e,o=e,a=0,l=0,h=e,c,u,d,g,p,f,_,m,y,v;for(u=e;u<i;u+=n){const x=t[u],E=t[u+1];p!==void 0&&(y=x-p,v=E-f,g=Math.sqrt(y*y+v*v),_!==void 0&&(l+=d,c=Math.acos((_*y+m*v)/(d*g)),c>s&&(l>a&&(a=l,r=h,o=u),l=0,h=u-n)),d=g,_=y,m=v),p=x,f=E}return l+=g,l>a?[h,u]:[r,o]}const yr={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class rm extends xn{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[At]={fillStyle:At},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e){const i=this.textFillState_,n=this.textStrokeState_,r=this.textState_;if(this.text_===""||!r||!i&&!n)return;const o=this.coordinates;let a=o.length;const l=t.getType();let h=null,c=t.getStride();if(r.placement==="line"&&(l=="LineString"||l=="MultiLineString"||l=="Polygon"||l=="MultiPolygon")){if(!ht(this.getBufferedMaxExtent(),t.getExtent()))return;let u;if(h=t.getFlatCoordinates(),l=="LineString")u=[h.length];else if(l=="MultiLineString")u=t.getEnds();else if(l=="Polygon")u=t.getEnds().slice(0,1);else if(l=="MultiPolygon"){const f=t.getEndss();u=[];for(let _=0,m=f.length;_<m;++_)u.push(f[_][0])}this.beginGeometry(t,e);const d=r.repeat,g=d?void 0:r.textAlign;let p=0;for(let f=0,_=u.length;f<_;++f){let m;d?m=sm(d*this.resolution,h,p,u[f],c):m=[h.slice(p,u[f])];for(let y=0,v=m.length;y<v;++y){const x=m[y];let E=0,C=x.length;if(g==null){const w=nm(r.maxAngle,x,0,x.length,2);E=w[0],C=w[1]}for(let w=E;w<C;w+=c)o.push(x[w],x[w+1]);const S=o.length;p=u[f],this.drawChars_(a,S),a=S}}this.endGeometry(e)}else{let u=r.overflow?null:[];switch(l){case"Point":case"MultiPoint":h=t.getFlatCoordinates();break;case"LineString":h=t.getFlatMidpoint();break;case"Circle":h=t.getCenter();break;case"MultiLineString":h=t.getFlatMidpoints(),c=2;break;case"Polygon":h=t.getFlatInteriorPoint(),r.overflow||u.push(h[2]/this.resolution),c=3;break;case"MultiPolygon":const m=t.getFlatInteriorPoints();h=[];for(let y=0,v=m.length;y<v;y+=3)r.overflow||u.push(m[y+2]/this.resolution),h.push(m[y],m[y+1]);if(h.length===0)return;c=2;break}const d=this.appendFlatPointCoordinates(h,c);if(d===a)return;if(u&&(d-a)/2!==h.length/c){let m=a/2;u=u.filter((y,v)=>{const x=o[(m+v)*2]===h[v*c]&&o[(m+v)*2+1]===h[v*c+1];return x||--m,x})}this.saveTextStates_(),(r.backgroundFill||r.backgroundStroke)&&(this.setFillStrokeStyle(r.backgroundFill,r.backgroundStroke),r.backgroundFill&&this.updateFillStyle(this.state,this.createFill),r.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);let g=r.padding;if(g!=mi&&(r.scale[0]<0||r.scale[1]<0)){let m=r.padding[0],y=r.padding[1],v=r.padding[2],x=r.padding[3];r.scale[0]<0&&(y=-y,x=-x),r.scale[1]<0&&(m=-m,v=-v),g=[m,y,v,x]}const p=this.pixelRatio;this.instructions.push([k.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,g==mi?mi:g.map(function(m){return m*p}),!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]);const f=1/p,_=this.state.fillStyle;r.backgroundFill&&(this.state.fillStyle=At,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([k.DRAW_IMAGE,a,d,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[f,f],NaN,void 0,this.declutterImageWithText_,g,!!r.backgroundFill,!!r.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?At:this.fillKey_,this.textOffsetX_,this.textOffsetY_,u]),r.backgroundFill&&(this.state.fillStyle=_,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,n=this.strokeKey_;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const r=this.textKey_;r in this.textStates||(this.textStates[r]={font:e.font,textAlign:e.textAlign||qs,justify:e.justify,textBaseline:e.textBaseline||lr,scale:e.scale});const o=this.fillKey_;i&&(o in this.fillStates||(this.fillStates[o]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,n=this.textState_,r=this.strokeKey_,o=this.textKey_,a=this.fillKey_;this.saveTextStates_();const l=this.pixelRatio,h=yr[n.textBaseline],c=this.textOffsetY_*l,u=this.text_,d=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([k.DRAW_CHARS,t,e,h,n.overflow,a,n.maxAngle,l,c,r,d*l,u,o,1]),this.hitDetectionInstructions.push([k.DRAW_CHARS,t,e,h,n.overflow,a&&At,n.maxAngle,l,c,r,d*l,u,o,1/l])}setTextStyle(t,e){let i,n,r;if(!t)this.text_="";else{const o=t.getFill();o?(n=this.textFillState_,n||(n={},this.textFillState_=n),n.fillStyle=ce(o.getColor()||At)):(n=null,this.textFillState_=n);const a=t.getStroke();if(!a)r=null,this.textStrokeState_=r;else{r=this.textStrokeState_,r||(r={},this.textStrokeState_=r);const p=a.getLineDash(),f=a.getLineDashOffset(),_=a.getWidth(),m=a.getMiterLimit();r.lineCap=a.getLineCap()||us,r.lineDash=p?p.slice():Ae,r.lineDashOffset=f===void 0?Fe:f,r.lineJoin=a.getLineJoin()||ds,r.lineWidth=_===void 0?Js:_,r.miterLimit=m===void 0?Hs:m,r.strokeStyle=ce(a.getColor()||Zs)}i=this.textState_;const l=t.getFont()||mc;qg(l);const h=t.getScaleArray();i.overflow=t.getOverflow(),i.font=l,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||lr,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||mi,i.scale=h===void 0?[1,1]:h;const c=t.getOffsetX(),u=t.getOffsetY(),d=t.getRotateWithView(),g=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=u===void 0?0:u,this.textRotateWithView_=d===void 0?!1:d,this.textRotation_=g===void 0?0:g,this.strokeKey_=r?(typeof r.strokeStyle=="string"?r.strokeStyle:D(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=n?typeof n.fillStyle=="string"?n.fillStyle:"|"+D(n.fillStyle):""}this.declutterImageWithText_=e}}const om={Circle:nh,Default:xn,Image:Q_,LineString:em,Polygon:nh,Text:rm};class am{constructor(t,e,i,n){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=n,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const n in i){const r=i[n].finish();t[e][n]=r}}return t}getBuilder(t,e){const i=t!==void 0?t.toString():"0";let n=this.buildersByZIndex_[i];n===void 0&&(n={},this.buildersByZIndex_[i]=n);let r=n[e];if(r===void 0){const o=om[e];r=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),n[e]=r}return r}}const vr=am;class lm extends Dh{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return N()}getData(t){return null}prepareFrame(t){return N()}renderFrame(t,e){return N()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return(n,r)=>{const o=this.loadedTileCallback.bind(this,i,n);return t.forEachLoadedTile(e,n,r,o)}}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;(e.getState()===G.LOADED||e.getState()===G.ERROR)&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=G.LOADED&&e!=G.ERROR&&t.addEventListener(O.CHANGE,this.boundHandleImageChange_),e==G.IDLE&&(t.load(),e=t.getState()),e==G.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&t.getSourceState()==="ready"&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}const hm=lm,rh=[];let Ui=null;function cm(){Ui=St(1,1,void 0,{willReadFrequently:!0})}class um extends hm{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=Yt(),this.pixelTransform=Yt(),this.inversePixelTransform=Yt(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){Ui||cm(),Ui.clearRect(0,0,1,1);let n;try{Ui.drawImage(t,e,i,1,1,0,0,1,1),n=Ui.getImageData(0,0,1,1).data}catch{return Ui=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return typeof e=="function"&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,o;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&Ge(qn(t.style.backgroundColor),qn(i)))){const a=t.firstElementChild;a instanceof HTMLCanvasElement&&(o=a.getContext("2d"))}if(o&&o.canvas.style.transform===e?(this.container=t,this.context=o,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=document.createElement("div"),r.className=n;let a=r.style;a.position="absolute",a.width="100%",a.height="100%",o=St();const l=o.canvas;r.appendChild(l),a=l.style,a.position="absolute",a.left="0",a.transformOrigin="top left",this.container=r,this.context=o}!this.containerReused&&i&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=me(i),r=un(i),o=_s(i),a=os(i);gt(e.coordinateToPixelTransform,n),gt(e.coordinateToPixelTransform,r),gt(e.coordinateToPixelTransform,o),gt(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;gt(l,n),gt(l,r),gt(l,o),gt(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const r=new pc(t,this.inversePixelTransform,i,e);n.dispatchEvent(r)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_(de.PRERENDER,t,e)}postRender(t,e){this.dispatchRenderEvent_(de.POSTRENDER,t,e)}getRenderTransform(t,e,i,n,r,o,a){const l=r/2,h=o/2,c=n/e,u=-c,d=-t[0]+a,g=-t[1];return ie(this.tempTransform,l,h,c,u,-i,d,g)}disposeInternal(){delete this.frameState,super.disposeInternal()}}const Xa=um;function dm(s,t,e,i,n,r,o,a,l,h,c,u){let d=s[t],g=s[t+1],p=0,f=0,_=0,m=0;function y(){p=d,f=g,t+=i,d=s[t],g=s[t+1],m+=_,_=Math.sqrt((d-p)*(d-p)+(g-f)*(g-f))}do y();while(t<e-i&&m+_<r);let v=_===0?0:(r-m)/_;const x=Gt(p,d,v),E=Gt(f,g,v),C=t-i,S=m,w=r+a*l(h,n,c);for(;t<e-i&&m+_<w;)y();v=_===0?0:(w-m)/_;const P=Gt(p,d,v),L=Gt(f,g,v);let j;if(u){const M=[x,E,P,L];_a(M,0,4,2,u,M,M),j=M[0]>M[2]}else j=x>P;const V=Math.PI,$=[],X=C+i===t;t=C,_=0,m=S,d=s[t],g=s[t+1];let A;if(X){y(),A=Math.atan2(g-f,d-p),j&&(A+=A>0?-V:V);const M=(P+x)/2,I=(L+E)/2;return $[0]=[M,I,(w-r)/2,A,n],$}n=n.replace(/\n/g," ");for(let M=0,I=n.length;M<I;){y();let B=Math.atan2(g-f,d-p);if(j&&(B+=B>0?-V:V),A!==void 0){let K=B-A;if(K+=K>V?-2*V:K<-V?2*V:0,Math.abs(K)>o)return null}A=B;const nt=M;let st=0;for(;M<I;++M){const K=j?I-M-1:M,rt=a*l(h,n[K],c);if(t+i<e&&m+_<r+st+rt/2)break;st+=rt}if(M===nt)continue;const yt=j?n.substring(I-nt,I-M):n.substring(nt,M);v=_===0?0:(r+st/2-m)/_;const R=Gt(p,d,v),dt=Gt(f,g,v);$.push([R,dt,st/2,B,yt]),r+=st}return $}const Ni=Vt(),We=[],Se=[],Te=[],Be=[];function oh(s){return s[3].declutterBox}const ah=new RegExp("[֑-ࣿיִ-﷿ﹰ-ﻼࠀ-࿿-]");function ao(s,t){return t==="start"?t=ah.test(s)?"right":"left":t==="end"&&(t=ah.test(s)?"left":"right"),yr[t]}function gm(s,t,e){return e>0&&s.push(`
37
- `,""),s.push(t,""),s}class pm{constructor(t,e,i,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=Yt(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}createLabel(t,e,i,n){const r=t+e+i+n;if(this.labels_[r])return this.labels_[r];const o=n?this.strokeStates[n]:null,a=i?this.fillStates[i]:null,l=this.textStates[e],h=this.pixelRatio,c=[l.scale[0]*h,l.scale[1]*h],u=Array.isArray(t),d=l.justify?yr[l.justify]:ao(Array.isArray(t)?t[0]:t,l.textAlign||qs),g=n&&o.lineWidth?o.lineWidth:0,p=u?t:t.split(`
38
- `).reduce(gm,[]),{width:f,height:_,widths:m,heights:y,lineWidths:v}=Qg(l,p),x=f+g,E=[],C=(x+2)*c[0],S=(_+g)*c[1],w={width:C<0?Math.floor(C):Math.ceil(C),height:S<0?Math.floor(S):Math.ceil(S),contextInstructions:E};(c[0]!=1||c[1]!=1)&&E.push("scale",c),n&&(E.push("strokeStyle",o.strokeStyle),E.push("lineWidth",g),E.push("lineCap",o.lineCap),E.push("lineJoin",o.lineJoin),E.push("miterLimit",o.miterLimit),E.push("setLineDash",[o.lineDash]),E.push("lineDashOffset",o.lineDashOffset)),i&&E.push("fillStyle",a.fillStyle),E.push("textBaseline","middle"),E.push("textAlign","center");const P=.5-d;let L=d*x+P*g;const j=[],V=[];let $=0,X=0,A=0,M=0,I;for(let B=0,nt=p.length;B<nt;B+=2){const st=p[B];if(st===`
39
- `){X+=$,$=0,L=d*x+P*g,++M;continue}const yt=p[B+1]||l.font;yt!==I&&(n&&j.push("font",yt),i&&V.push("font",yt),I=yt),$=Math.max($,y[A]);const R=[st,L+P*m[A]+d*(m[A]-v[M]),.5*(g+$)+X];L+=m[A],n&&j.push("strokeText",R),i&&V.push("fillText",R),++A}return Array.prototype.push.apply(E,j),Array.prototype.push.apply(E,V),this.labels_[r]=w,w}replayTextBackground_(t,e,i,n,r,o,a){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,r),t.lineTo.apply(t,e),o&&(this.alignFill_=o[2],this.fill_(t)),a&&(this.setStrokeStyle_(t,a),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,n,r,o,a,l,h,c,u,d,g,p,f,_){a*=d[0],l*=d[1];let m=i-a,y=n-l;const v=r+h>t?t-h:r,x=o+c>e?e-c:o,E=p[3]+v*d[0]+p[1],C=p[0]+x*d[1]+p[2],S=m-p[3],w=y-p[0];(f||u!==0)&&(We[0]=S,Be[0]=S,We[1]=w,Se[1]=w,Se[0]=S+E,Te[0]=Se[0],Te[1]=w+C,Be[1]=Te[1]);let P;return u!==0?(P=ie(Yt(),i,n,1,1,u,-i,-n),gt(P,We),gt(P,Se),gt(P,Te),gt(P,Be),De(Math.min(We[0],Se[0],Te[0],Be[0]),Math.min(We[1],Se[1],Te[1],Be[1]),Math.max(We[0],Se[0],Te[0],Be[0]),Math.max(We[1],Se[1],Te[1],Be[1]),Ni)):De(Math.min(S,S+E),Math.min(w,w+C),Math.max(S,S+E),Math.max(w,w+C),Ni),g&&(m=Math.round(m),y=Math.round(y)),{drawImageX:m,drawImageY:y,drawImageW:v,drawImageH:x,originX:h,originY:c,declutterBox:{minX:Ni[0],minY:Ni[1],maxX:Ni[2],maxY:Ni[3],value:_},canvasTransform:P,scale:d}}replayImageOrLabel_(t,e,i,n,r,o,a){const l=!!(o||a),h=n.declutterBox,c=t.canvas,u=a?a[2]*n.scale[0]/2:0;return h.minX-u<=c.width/e&&h.maxX+u>=0&&h.minY-u<=c.height/e&&h.maxY+u>=0&&(l&&this.replayTextBackground_(t,We,Se,Te,Be,o,a),tp(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){if(this.alignFill_){const e=gt(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;t.save(),t.translate(e[0]%i,e[1]%i),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,i,n){const r=this.textStates[e],o=this.createLabel(t,e,n,i),a=this.strokeStates[i],l=this.pixelRatio,h=ao(Array.isArray(t)?t[0]:t,r.textAlign||qs),c=yr[r.textBaseline||lr],u=a&&a.lineWidth?a.lineWidth:0,d=o.width/l-2*r.scale[0],g=h*d+2*(.5-h)*u,p=c*o.height/l+2*(.5-c)*u;return{label:o,anchorX:g,anchorY:p}}execute_(t,e,i,n,r,o,a,l){let h;this.pixelCoordinates_&&Ge(i,this.renderedTransform_)?h=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),h=ei(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),Id(this.renderedTransform_,i));let c=0;const u=n.length;let d=0,g,p,f,_,m,y,v,x,E,C,S,w,P=0,L=0,j=null,V=null;const $=this.coordinateCache_,X=this.viewRotation_,A=Math.round(Math.atan2(-i[1],i[0])*1e12)/1e12,M={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:X},I=this.instructions!=n||this.overlaps?0:200;let B,nt,st,yt;for(;c<u;){const R=n[c];switch(R[0]){case k.BEGIN_GEOMETRY:B=R[1],yt=R[3],B.getGeometry()?a!==void 0&&!ht(a,yt.getExtent())?c=R[2]+1:++c:c=R[2];break;case k.BEGIN_PATH:P>I&&(this.fill_(t),P=0),L>I&&(t.stroke(),L=0),!P&&!L&&(t.beginPath(),_=NaN,m=NaN),++c;break;case k.CIRCLE:d=R[1];const dt=h[d],K=h[d+1],rt=h[d+2],re=h[d+3],vt=rt-dt,ve=re-K,oe=Math.sqrt(vt*vt+ve*ve);t.moveTo(dt+oe,K),t.arc(dt,K,oe,0,2*Math.PI,!0),++c;break;case k.CLOSE_PATH:t.closePath(),++c;break;case k.CUSTOM:d=R[1],g=R[2];const En=R[3],Pi=R[4],Cn=R.length==6?R[5]:void 0;M.geometry=En,M.feature=B,c in $||($[c]=[]);const je=$[c];Cn?Cn(h,d,g,2,je):(je[0]=h[d],je[1]=h[d+1],je.length=2),Pi(je,M),++c;break;case k.DRAW_IMAGE:d=R[1],g=R[2],x=R[3],p=R[4],f=R[5];let Es=R[6];const Ve=R[7],wn=R[8],Sn=R[9],Tn=R[10];let Mi=R[11];const Ur=R[12];let It=R[13];const Wt=R[14],qt=R[15];if(!x&&R.length>=20){E=R[19],C=R[20],S=R[21],w=R[22];const Ot=this.drawLabelWithPointPlacement_(E,C,S,w);x=Ot.label,R[3]=x;const Fi=R[23];p=(Ot.anchorX-Fi)*this.pixelRatio,R[4]=p;const Bt=R[24];f=(Ot.anchorY-Bt)*this.pixelRatio,R[5]=f,Es=x.height,R[6]=Es,It=x.width,R[13]=It}let xe;R.length>25&&(xe=R[25]);let Li,hi,ze;R.length>17?(Li=R[16],hi=R[17],ze=R[18]):(Li=mi,hi=!1,ze=!1),Tn&&A?Mi+=X:!Tn&&!A&&(Mi-=X);let Ai=0;for(;d<g;d+=2){if(xe&&xe[Ai++]<It/this.pixelRatio)continue;const Ot=this.calculateImageOrLabelDimensions_(x.width,x.height,h[d],h[d+1],It,Es,p,f,wn,Sn,Mi,Ur,r,Li,hi||ze,B),Fi=[t,e,x,Ot,Ve,hi?j:null,ze?V:null];if(l){if(Wt==="none")continue;if(Wt==="obstacle"){l.insert(Ot.declutterBox);continue}else{let Bt,Ee;if(qt){const Dt=g-d;if(!qt[Dt]){qt[Dt]=Fi;continue}if(Bt=qt[Dt],delete qt[Dt],Ee=oh(Bt),l.collides(Ee))continue}if(l.collides(Ot.declutterBox))continue;Bt&&(l.insert(Ee),this.replayImageOrLabel_.apply(this,Bt)),l.insert(Ot.declutterBox)}}this.replayImageOrLabel_.apply(this,Fi)}++c;break;case k.DRAW_CHARS:const Rn=R[1],Tt=R[2],$r=R[3],zu=R[4];w=R[5];const Wu=R[6],el=R[7],il=R[8];S=R[9];const Xr=R[10];E=R[11],C=R[12];const sl=[R[13],R[13]],Yr=this.textStates[C],Cs=Yr.font,ws=[Yr.scale[0]*el,Yr.scale[1]*el];let Ss;Cs in this.widths_?Ss=this.widths_[Cs]:(Ss={},this.widths_[Cs]=Ss);const nl=Oc(h,Rn,Tt,2),rl=Math.abs(ws[0])*zl(Cs,E,Ss);if(zu||rl<=nl){const Ot=this.textStates[C].textAlign,Fi=(nl-rl)*ao(E,Ot),Bt=dm(h,Rn,Tt,2,E,Fi,Wu,Math.abs(ws[0]),zl,Cs,Ss,A?0:this.viewRotation_);t:if(Bt){const Ee=[];let Dt,bn,In,Pt,Ut;if(S)for(Dt=0,bn=Bt.length;Dt<bn;++Dt){Ut=Bt[Dt],In=Ut[4],Pt=this.createLabel(In,C,"",S),p=Ut[2]+(ws[0]<0?-Xr:Xr),f=$r*Pt.height+(.5-$r)*2*Xr*ws[1]/ws[0]-il;const Ce=this.calculateImageOrLabelDimensions_(Pt.width,Pt.height,Ut[0],Ut[1],Pt.width,Pt.height,p,f,0,0,Ut[3],sl,!1,mi,!1,B);if(l&&l.collides(Ce.declutterBox))break t;Ee.push([t,e,Pt,Ce,1,null,null])}if(w)for(Dt=0,bn=Bt.length;Dt<bn;++Dt){Ut=Bt[Dt],In=Ut[4],Pt=this.createLabel(In,C,w,""),p=Ut[2],f=$r*Pt.height-il;const Ce=this.calculateImageOrLabelDimensions_(Pt.width,Pt.height,Ut[0],Ut[1],Pt.width,Pt.height,p,f,0,0,Ut[3],sl,!1,mi,!1,B);if(l&&l.collides(Ce.declutterBox))break t;Ee.push([t,e,Pt,Ce,1,null,null])}l&&l.load(Ee.map(oh));for(let Ce=0,Bu=Ee.length;Ce<Bu;++Ce)this.replayImageOrLabel_.apply(this,Ee[Ce])}}++c;break;case k.END_GEOMETRY:if(o!==void 0){B=R[1];const Ot=o(B,yt);if(Ot)return Ot}++c;break;case k.FILL:I?P++:this.fill_(t),++c;break;case k.MOVE_TO_LINE_TO:for(d=R[1],g=R[2],nt=h[d],st=h[d+1],y=nt+.5|0,v=st+.5|0,(y!==_||v!==m)&&(t.moveTo(nt,st),_=y,m=v),d+=2;d<g;d+=2)nt=h[d],st=h[d+1],y=nt+.5|0,v=st+.5|0,(d==g-2||y!==_||v!==m)&&(t.lineTo(nt,st),_=y,m=v);++c;break;case k.SET_FILL_STYLE:j=R,this.alignFill_=R[2],P&&(this.fill_(t),P=0,L&&(t.stroke(),L=0)),t.fillStyle=R[1],++c;break;case k.SET_STROKE_STYLE:V=R,L&&(t.stroke(),L=0),this.setStrokeStyle_(t,R),++c;break;case k.STROKE:I?L++:t.stroke(),++c;break;default:++c;break}}P&&this.fill_(t),L&&t.stroke()}execute(t,e,i,n,r,o){this.viewRotation_=n,this.execute_(t,e,i,this.instructions,r,void 0,void 0,o)}executeHitDetection(t,e,i,n,r){return this.viewRotation_=i,this.execute_(t,1,e,this.hitDetectionInstructions,!0,n,r)}}const fm=pm,lo=["Polygon","Circle","LineString","Image","Text","Default"];class _m{constructor(t,e,i,n,r,o){this.maxExtent_=t,this.overlaps_=n,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Yt(),this.createExecutors_(r)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}createExecutors_(t){for(const e in t){let i=this.executorsByZIndex_[e];i===void 0&&(i={},this.executorsByZIndex_[e]=i);const n=t[e];for(const r in n){const o=n[r];i[r]=new fm(this.resolution_,this.pixelRatio_,this.overlaps_,o)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let n=0,r=t.length;n<r;++n)if(t[n]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,r,o){n=Math.round(n);const a=n*2+1,l=ie(this.hitDetectionTransform_,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=St(a,a,void 0,{willReadFrequently:!0}));const c=this.hitDetectionContext_;c.canvas.width!==a||c.canvas.height!==a?(c.canvas.width=a,c.canvas.height=a):h||c.clearRect(0,0,a,a);let u;this.renderBuffer_!==void 0&&(u=Vt(),Ns(u,t),Kt(u,e*(this.renderBuffer_+n),u));const d=mm(n);let g;function p(E,C){const S=c.getImageData(0,0,a,a).data;for(let w=0,P=d.length;w<P;w++)if(S[d[w]]>0){if(!o||g!=="Image"&&g!=="Text"||o.includes(E)){const L=(d[w]-3)/4,j=n-L%a,V=n-(L/a|0),$=r(E,C,j*j+V*V);if($)return $}c.clearRect(0,0,a,a);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);f.sort(ii);let _,m,y,v,x;for(_=f.length-1;_>=0;--_){const E=f[_].toString();for(y=this.executorsByZIndex_[E],m=lo.length-1;m>=0;--m)if(g=lo[m],v=y[g],v!==void 0&&(x=v.executeHitDetection(c,l,i,p,u),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],o=e[3],a=[i,n,i,o,r,o,r,n];return ei(a,0,8,2,t,a),a}isEmpty(){return si(this.executorsByZIndex_)}execute(t,e,i,n,r,o,a){const l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(ii),this.maxExtent_&&(t.save(),this.clip(t,i)),o=o||lo;let h,c,u,d,g,p;for(a&&l.reverse(),h=0,c=l.length;h<c;++h){const f=l[h].toString();for(g=this.executorsByZIndex_[f],u=0,d=o.length;u<d;++u){const _=o[u];p=g[_],p!==void 0&&p.execute(t,e,i,n,r,a)}}this.maxExtent_&&t.restore()}}const ho={};function mm(s){if(ho[s]!==void 0)return ho[s];const t=s*2+1,e=s*s,i=new Array(e+1);for(let r=0;r<=s;++r)for(let o=0;o<=s;++o){const a=r*r+o*o;if(a>e)break;let l=i[a];l||(l=[],i[a]=l),l.push(((s+r)*t+(s+o))*4+3),r>0&&l.push(((s-r)*t+(s+o))*4+3),o>0&&(l.push(((s+r)*t+(s-o))*4+3),r>0&&l.push(((s-r)*t+(s-o))*4+3))}const n=[];for(let r=0,o=i.length;r<o;++r)i[r]&&n.push(...i[r]);return ho[s]=n,n}const xr=_m;class ym extends nu{constructor(t,e,i,n,r,o,a){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=n,this.transformRotation_=n?dn(Math.atan2(n[1],n[0]),10):0,this.viewRotation_=r,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=Yt()}drawImages_(t,e,i,n){if(!this.image_)return;const r=ei(t,e,i,n,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let h=this.imageRotation_;this.transformRotation_===0&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let c=0,u=r.length;c<u;c+=2){const d=r[c]-this.imageAnchorX_,g=r[c+1]-this.imageAnchorY_;if(h!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){const p=d+this.imageAnchorX_,f=g+this.imageAnchorY_;ie(a,p,f,1,1,h,-p,-f),o.save(),o.transform.apply(o,a),o.translate(p,f),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,d,g,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(t,e,i,n){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const r=ei(t,e,i,n,this.transform_,this.pixelCoordinates_),o=this.context_;let a=this.textRotation_;for(this.transformRotation_===0&&(a-=this.viewRotation_),this.textRotateWithView_&&(a+=this.viewRotation_);e<i;e+=n){const l=r[e]+this.textOffsetX_,h=r[e+1]+this.textOffsetY_;a!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(o.save(),o.translate(l-this.textOffsetX_,h-this.textOffsetY_),o.rotate(a),o.translate(this.textOffsetX_,this.textOffsetY_),o.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&o.strokeText(this.text_,0,0),this.textFillState_&&o.fillText(this.text_,0,0),o.restore()):(this.textStrokeState_&&o.strokeText(this.text_,l,h),this.textFillState_&&o.fillText(this.text_,l,h))}}moveToLineTo_(t,e,i,n,r){const o=this.context_,a=ei(t,e,i,n,this.transform_,this.pixelCoordinates_);o.moveTo(a[0],a[1]);let l=a.length;r&&(l-=2);for(let h=2;h<l;h+=2)o.lineTo(a[h],a[h+1]);return r&&o.closePath(),i}drawRings_(t,e,i,n){for(let r=0,o=i.length;r<o;++r)e=this.moveToLineTo_(t,e,i[r],n,!0);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ht(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Tg(t,this.transform_,this.pixelCoordinates_),i=e[2]-e[0],n=e[3]-e[1],r=Math.sqrt(i*i+n*n),o=this.context_;o.beginPath(),o.arc(e[0],e[1],r,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t);break}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let i=0,n=e.length;i<n;++i)this.drawGeometry(e[i])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),this.text_!==""&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ht(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1),e.stroke()}if(this.text_!==""){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(ht(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const i=this.context_,n=t.getFlatCoordinates();let r=0;const o=t.getEnds(),a=t.getStride();i.beginPath();for(let l=0,h=o.length;l<h;++l)r=this.moveToLineTo_(n,r,o[l],a,!1);i.stroke()}if(this.text_!==""){const i=t.getFlatMidpoints();this.drawText_(i,0,i.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ht(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!ht(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let n=0;const r=t.getEndss(),o=t.getStride();e.beginPath();for(let a=0,l=r.length;a<l;++a){const h=r[a];n=this.drawRings_(i,n,h,o)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(this.text_!==""){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),Ge(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,n=t.textAlign?t.textAlign:qs;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(!t)this.fillState_=null;else{const i=t.getColor();this.fillState_={fillStyle:ce(i||At)}}if(!e)this.strokeState_=null;else{const i=e.getColor(),n=e.getLineCap(),r=e.getLineDash(),o=e.getLineDashOffset(),a=e.getLineJoin(),l=e.getWidth(),h=e.getMiterLimit(),c=r||Ae;this.strokeState_={lineCap:n!==void 0?n:us,lineDash:this.pixelRatio_===1?c:c.map(u=>u*this.pixelRatio_),lineDashOffset:(o||Fe)*this.pixelRatio_,lineJoin:a!==void 0?a:ds,lineWidth:(l!==void 0?l:Js)*this.pixelRatio_,miterLimit:h!==void 0?h:Hs,strokeStyle:ce(i||Zs)}}}setImageStyle(t){let e;if(!t||!(e=t.getSize())){this.image_=null;return}const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const o=t.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/i,o[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(!t)this.text_="";else{const e=t.getFill();if(!e)this.textFillState_=null;else{const g=e.getColor();this.textFillState_={fillStyle:ce(g||At)}}const i=t.getStroke();if(!i)this.textStrokeState_=null;else{const g=i.getColor(),p=i.getLineCap(),f=i.getLineDash(),_=i.getLineDashOffset(),m=i.getLineJoin(),y=i.getWidth(),v=i.getMiterLimit();this.textStrokeState_={lineCap:p!==void 0?p:us,lineDash:f||Ae,lineDashOffset:_||Fe,lineJoin:m!==void 0?m:ds,lineWidth:y!==void 0?y:Js,miterLimit:v!==void 0?v:Hs,strokeStyle:ce(g||Zs)}}const n=t.getFont(),r=t.getOffsetX(),o=t.getOffsetY(),a=t.getRotateWithView(),l=t.getRotation(),h=t.getScaleArray(),c=t.getText(),u=t.getTextAlign(),d=t.getTextBaseline();this.textState_={font:n!==void 0?n:mc,textAlign:u!==void 0?u:qs,textBaseline:d!==void 0?d:lr},this.text_=c!==void 0?Array.isArray(c)?c.reduce((g,p,f)=>g+=f%2?" ":p,""):c:"",this.textOffsetX_=r!==void 0?this.pixelRatio_*r:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}}}const vm=ym,jt=.5;function ru(s,t,e,i,n,r,o){const a=s[0]*jt,l=s[1]*jt,h=St(a,l);h.imageSmoothingEnabled=!1;const c=h.canvas,u=new vm(h,jt,n,null,o),d=e.length,g=Math.floor((256*256*256-1)/d),p={};for(let _=1;_<=d;++_){const m=e[_-1],y=m.getStyleFunction()||i;if(!y)continue;let v=y(m,r);if(!v)continue;Array.isArray(v)||(v=[v]);const x=(_*g).toString(16).padStart(7,"#00000");for(let E=0,C=v.length;E<C;++E){const S=v[E],w=S.getGeometryFunction()(m);if(!w||!ht(n,w.getExtent()))continue;const P=S.clone(),L=P.getFill();L&&L.setColor(x);const j=P.getStroke();j&&(j.setColor(x),j.setLineDash(null)),P.setText(void 0);const V=S.getImage();if(V){const M=V.getImageSize();if(!M)continue;const I=St(M[0],M[1],void 0,{alpha:!1}),B=I.canvas;I.fillStyle=x,I.fillRect(0,0,B.width,B.height),P.setImage(new Bc({img:B,anchor:V.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:V.getOrigin(),opacity:1,size:V.getSize(),scale:V.getScale(),rotation:V.getRotation(),rotateWithView:V.getRotateWithView()}))}const $=P.getZIndex()||0;let X=p[$];X||(X={},p[$]=X,X.Polygon=[],X.Circle=[],X.LineString=[],X.Point=[]);const A=w.getType();if(A==="GeometryCollection"){const M=w.getGeometriesArrayRecursive();for(let I=0,B=M.length;I<B;++I){const nt=M[I];X[nt.getType().replace("Multi","")].push(nt,P)}}else X[A.replace("Multi","")].push(w,P)}}const f=Object.keys(p).map(Number).sort(ii);for(let _=0,m=f.length;_<m;++_){const y=p[f[_]];for(const v in y){const x=y[v];for(let E=0,C=x.length;E<C;E+=2){u.setStyle(x[E+1]);for(let S=0,w=t.length;S<w;++S)u.setTransform(t[S]),u.drawGeometry(x[E])}}}return h.getImageData(0,0,c.width,c.height)}function ou(s,t,e){const i=[];if(e){const n=Math.floor(Math.round(s[0])*jt),r=Math.floor(Math.round(s[1])*jt),o=(at(n,0,e.width-1)+at(r,0,e.height-1)*e.width)*4,a=e.data[o],l=e.data[o+1],h=e.data[o+2]+256*(l+256*a),c=Math.floor((256*256*256-1)/t.length);h&&h%c===0&&i.push(t[h/c-1])}return i}const xm=.5,au={Point:Im,LineString:Tm,Polygon:Mm,MultiPoint:Pm,MultiLineString:Rm,MultiPolygon:bm,GeometryCollection:Sm,Circle:Cm};function Em(s,t){return parseInt(D(s),10)-parseInt(D(t),10)}function lu(s,t){const e=Vo(s,t);return e*e}function Vo(s,t){return xm*s/t}function Cm(s,t,e,i,n){const r=e.getFill(),o=e.getStroke();if(r||o){const l=s.getBuilder(e.getZIndex(),"Circle");l.setFillStrokeStyle(r,o),l.drawCircle(t,i)}const a=e.getText();if(a&&a.getText()){const l=(n||s).getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}function Er(s,t,e,i,n,r,o){let a=!1;const l=e.getImage();if(l){const h=l.getImageState();h==G.LOADED||h==G.ERROR?l.unlistenImageChange(n):(h==G.IDLE&&l.load(),l.listenImageChange(n),a=!0)}return wm(s,t,e,i,r,o),a}function wm(s,t,e,i,n,r){const o=e.getGeometryFunction()(t);if(!o)return;const a=o.simplifyTransformed(i,n);if(e.getRenderer())hu(s,a,e,t);else{const l=au[a.getType()];l(s,a,e,t,r)}}function hu(s,t,e,i){if(t.getType()=="GeometryCollection"){const n=t.getGeometries();for(let r=0,o=n.length;r<o;++r)hu(s,n[r],e,i);return}s.getBuilder(e.getZIndex(),"Default").drawCustom(t,i,e.getRenderer(),e.getHitDetectionRenderer())}function Sm(s,t,e,i,n){const r=t.getGeometriesArray();let o,a;for(o=0,a=r.length;o<a;++o){const l=au[r[o].getType()];l(s,r[o],e,i,n)}}function Tm(s,t,e,i,n){const r=e.getStroke();if(r){const a=s.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawLineString(t,i)}const o=e.getText();if(o&&o.getText()){const a=(n||s).getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i)}}function Rm(s,t,e,i,n){const r=e.getStroke();if(r){const a=s.getBuilder(e.getZIndex(),"LineString");a.setFillStrokeStyle(null,r),a.drawMultiLineString(t,i)}const o=e.getText();if(o&&o.getText()){const a=(n||s).getBuilder(e.getZIndex(),"Text");a.setTextStyle(o),a.drawText(t,i)}}function bm(s,t,e,i,n){const r=e.getFill(),o=e.getStroke();if(o||r){const l=s.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawMultiPolygon(t,i)}const a=e.getText();if(a&&a.getText()){const l=(n||s).getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}function Im(s,t,e,i,n){const r=e.getImage(),o=e.getText();let a;if(r){if(r.getImageState()!=G.LOADED)return;let l=s;if(n){const c=r.getDeclutterMode();if(c!=="none")if(l=n,c==="obstacle"){const u=s.getBuilder(e.getZIndex(),"Image");u.setImageStyle(r,a),u.drawPoint(t,i)}else o&&o.getText()&&(a={})}const h=l.getBuilder(e.getZIndex(),"Image");h.setImageStyle(r,a),h.drawPoint(t,i)}if(o&&o.getText()){let l=s;n&&(l=n);const h=l.getBuilder(e.getZIndex(),"Text");h.setTextStyle(o,a),h.drawText(t,i)}}function Pm(s,t,e,i,n){const r=e.getImage(),o=e.getText();let a;if(r){if(r.getImageState()!=G.LOADED)return;let l=s;if(n){const c=r.getDeclutterMode();if(c!=="none")if(l=n,c==="obstacle"){const u=s.getBuilder(e.getZIndex(),"Image");u.setImageStyle(r,a),u.drawMultiPoint(t,i)}else o&&o.getText()&&(a={})}const h=l.getBuilder(e.getZIndex(),"Image");h.setImageStyle(r,a),h.drawMultiPoint(t,i)}if(o&&o.getText()){let l=s;n&&(l=n);const h=l.getBuilder(e.getZIndex(),"Text");h.setTextStyle(o,a),h.drawText(t,i)}}function Mm(s,t,e,i,n){const r=e.getFill(),o=e.getStroke();if(r||o){const l=s.getBuilder(e.getZIndex(),"Polygon");l.setFillStrokeStyle(r,o),l.drawPolygon(t,i)}const a=e.getText();if(a&&a.getText()){const l=(n||s).getBuilder(e.getZIndex(),"Text");l.setTextStyle(a),l.drawText(t,i)}}class Lm extends Xa{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Vt(),this.wrappedRenderedExtent_=Vt(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedRenderOrder_=null,this.replayGroup_=null,this.replayGroupChanged=!0,this.declutterExecutorGroup=null,this.clipping=!0,this.compositionContext_=null,this.opacity_=1}renderWorlds(t,e,i){const n=e.extent,r=e.viewState,o=r.center,a=r.resolution,l=r.projection,h=r.rotation,c=l.getExtent(),u=this.getLayer().getSource(),d=e.pixelRatio,g=e.viewHints,p=!(g[ot.ANIMATING]||g[ot.INTERACTING]),f=this.compositionContext_,_=Math.round(e.size[0]*d),m=Math.round(e.size[1]*d),y=u.getWrapX()&&l.canWrapX(),v=y?J(c):null,x=y?Math.ceil((n[2]-c[2])/v)+1:1;let E=y?Math.floor((n[0]-c[0])/v):0;do{const C=this.getRenderTransform(o,a,h,d,_,m,E*v);t.execute(f,1,C,h,p,void 0,i)}while(++E<x)}setupCompositionContext_(){if(this.opacity_!==1){const t=St(this.context.canvas.width,this.context.canvas.height,rh);this.compositionContext_=t}else this.compositionContext_=this.context}releaseCompositionContext_(){if(this.opacity_!==1){const t=this.context.globalAlpha;this.context.globalAlpha=this.opacity_,this.context.drawImage(this.compositionContext_.canvas,0,0),this.context.globalAlpha=t,_n(this.compositionContext_),rh.push(this.compositionContext_.canvas),this.compositionContext_=null}}renderDeclutter(t){this.declutterExecutorGroup&&(this.setupCompositionContext_(),this.renderWorlds(this.declutterExecutorGroup,t,t.declutterTree),this.releaseCompositionContext_())}renderFrame(t,e){const i=t.pixelRatio,n=t.layerStatesArray[t.layerIndex];Pd(this.pixelTransform,1/i,1/i),Pr(this.inversePixelTransform,this.pixelTransform);const r=Jo(this.pixelTransform);this.useContainer(e,r,this.getBackground(t));const o=this.context,a=o.canvas,l=this.replayGroup_,h=this.declutterExecutorGroup;let c=l&&!l.isEmpty()||h&&!h.isEmpty();if(!c&&!(this.getLayer().hasListener(de.PRERENDER)||this.getLayer().hasListener(de.POSTRENDER)))return null;const u=Math.round(t.size[0]*i),d=Math.round(t.size[1]*i);a.width!=u||a.height!=d?(a.width=u,a.height=d,a.style.transform!==r&&(a.style.transform=r)):this.containerReused||o.clearRect(0,0,u,d),this.preRender(o,t);const g=t.viewState;g.projection,this.opacity_=n.opacity,this.setupCompositionContext_();let p=!1;if(c&&n.extent&&this.clipping){const f=he(n.extent);c=ht(f,t.extent),p=c&&!Xt(f,t.extent),p&&this.clipUnrotated(this.compositionContext_,t,f)}return c&&this.renderWorlds(l,t),p&&this.compositionContext_.restore(),this.releaseCompositionContext_(),this.postRender(o,t),this.renderedRotation_!==g.rotation&&(this.renderedRotation_=g.rotation,this.hitDetectionImageData_=null),this.container}getFeatures(t){return new Promise(e=>{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const i=[this.context.canvas.width,this.context.canvas.height];gt(this.pixelTransform,i);const n=this.renderedCenter_,r=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,h=this.getLayer(),c=[],u=i[0]*jt,d=i[1]*jt;c.push(this.getRenderTransform(n,r,o,jt,u,d,0).slice());const g=h.getSource(),p=a.getExtent();if(g.getWrapX()&&a.canWrapX()&&!Xt(p,l)){let f=l[0];const _=J(p);let m=0,y;for(;f<p[0];)--m,y=_*m,c.push(this.getRenderTransform(n,r,o,jt,u,d,y).slice()),f+=_;for(m=0,f=l[2];f>p[2];)++m,y=_*m,c.push(this.getRenderTransform(n,r,o,jt,u,d,y).slice()),f-=_}this.hitDetectionImageData_=ru(i,c,this.renderedFeatures_,h.getStyleFunction(),l,r,o)}e(ou(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const o=e.viewState.resolution,a=e.viewState.rotation,l=this.getLayer(),h={},c=function(g,p,f){const _=D(g),m=h[_];if(m){if(m!==!0&&f<m.distanceSq){if(f===0)return h[_]=!0,r.splice(r.lastIndexOf(m),1),n(g,l,p);m.geometry=p,m.distanceSq=f}}else{if(f===0)return h[_]=!0,n(g,l,p);r.push(h[_]={feature:g,layer:l,geometry:p,distanceSq:f,callback:n})}};let u;const d=[this.replayGroup_];return this.declutterExecutorGroup&&d.push(this.declutterExecutorGroup),d.some(g=>u=g.forEachFeatureAtCoordinate(t,o,a,i,c,g===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map(p=>p.value):null)),u}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[ot.ANIMATING],r=t.viewHints[ot.INTERACTING],o=e.getUpdateWhileAnimating(),a=e.getUpdateWhileInteracting();if(this.ready&&!o&&n||!a&&r)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const l=t.extent,h=t.viewState,c=h.projection,u=h.resolution,d=t.pixelRatio,g=e.getRevision(),p=e.getRenderBuffer();let f=e.getRenderOrder();f===void 0&&(f=Em);const _=h.center.slice(),m=Kt(l,p*u),y=m.slice(),v=[m.slice()],x=c.getExtent();if(i.getWrapX()&&c.canWrapX()&&!Xt(x,t.extent)){const A=J(x),M=Math.max(J(m)/2,A);m[0]=x[0]-M,m[2]=x[2]+M,Mr(_,c);const I=Wh(v[0],c);I[0]<x[0]&&I[2]<x[2]?v.push([I[0]+A,I[1],I[2]+A,I[3]]):I[0]>x[0]&&I[2]>x[2]&&v.push([I[0]-A,I[1],I[2]-A,I[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedRevision_==g&&this.renderedRenderOrder_==f&&Xt(this.wrappedRenderedExtent_,m))return Ge(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const E=new vr(Vo(u,d),m,u,d);let C;this.getLayer().getDeclutter()&&(C=new vr(Vo(u,d),m,u,d));let S;for(let A=0,M=v.length;A<M;++A)i.loadFeatures(v[A],u,c);const w=lu(u,d);let P=!0;const L=A=>{let M;const I=A.getStyleFunction()||e.getStyleFunction();if(I&&(M=I(A,u)),M){const B=this.renderFeature(A,w,M,E,S,C);P=P&&!B}},j=da(m),V=i.getFeaturesInExtent(j);f&&V.sort(f);for(let A=0,M=V.length;A<M;++A)L(V[A]);this.renderedFeatures_=V,this.ready=P;const $=E.finish(),X=new xr(m,u,d,i.getOverlaps(),$,e.getRenderBuffer());return C&&(this.declutterExecutorGroup=new xr(m,u,d,i.getOverlaps(),C.finish(),e.getRenderBuffer())),this.renderedResolution_=u,this.renderedRevision_=g,this.renderedRenderOrder_=f,this.renderedExtent_=y,this.wrappedRenderedExtent_=m,this.renderedCenter_=_,this.renderedProjection_=c,this.replayGroup_=X,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,r,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let l=0,h=i.length;l<h;++l)a=Er(n,t,i[l],e,this.boundHandleStyleImageChange_,r,o)||a;else a=Er(n,t,i,e,this.boundHandleStyleImageChange_,r,o);return a}}const Am=Lm;class Fm extends su{constructor(t){super(t)}createRenderer(){return new Am(this)}}const Ya=Fm;class Om{constructor(t){this.rbush_=new Kc(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[D(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n<r;n++){const o=t[n],a=e[n],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};i[n]=l,this.items_[D(a)]=l}this.rbush_.load(i)}remove(t){const e=D(t),i=this.items_[e];return delete this.items_[e],this.rbush_.remove(i)!==null}update(t,e){const i=this.items_[D(e)],n=[i.minX,i.minY,i.maxX,i.maxY];ri(n,t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).map(function(i){return i.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let n=0,r=t.length;n<r;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return si(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return De(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}const zo=Om;class Dm extends se{constructor(t){super(),this.projection=it(t.projection),this.attributions_=lh(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible!==void 0?t.attributionsCollapsible:!0,this.loading=!1,this.state_=t.state!==void 0?t.state:"ready",this.wrapX_=t.wrapX!==void 0?t.wrapX:!1,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(i,n){e.viewResolver=i,e.viewRejector=n})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=lh(t),this.changed()}setState(t){this.state_=t,this.changed()}}function lh(s){return s?Array.isArray(s)?function(t){return s}:typeof s=="function"?s:function(t){return[s]}:null}const Ka=Dm,Nt={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};function km(s,t){return[[-1/0,-1/0,1/0,1/0]]}let Nm=!1;function cu(s,t,e,i,n,r,o){const a=new XMLHttpRequest;a.open("GET",typeof s=="function"?s(e,i,n):s,!0),t.getType()=="arraybuffer"&&(a.responseType="arraybuffer"),a.withCredentials=Nm,a.onload=function(l){if(!a.status||a.status>=200&&a.status<300){const h=t.getType();let c;h=="json"?c=JSON.parse(a.responseText):h=="text"?c=a.responseText:h=="xml"?(c=a.responseXML,c||(c=new DOMParser().parseFromString(a.responseText,"application/xml"))):h=="arraybuffer"&&(c=a.response),c?r(t.readFeatures(c,{extent:e,featureProjection:n}),t.readProjection(c)):o()}else o()},a.onerror=o,a.send()}function hh(s,t){return function(e,i,n,r,o){const a=this;cu(s,t,e,i,n,function(l,h){a.addFeatures(l),r!==void 0&&r(l)},o||rs)}}class Ue extends Zt{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class Gm extends Ka{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:t.wrapX!==void 0?t.wrapX:!0}),this.on,this.once,this.un,this.loader_=rs,this.format_=t.format,this.overlaps_=t.overlaps===void 0?!0:t.overlaps,this.url_=t.url,t.loader!==void 0?this.loader_=t.loader:this.url_!==void 0&&(H(this.format_,"`format` must be set when `url` is set"),this.loader_=hh(this.url_,this.format_)),this.strategy_=t.strategy!==void 0?t.strategy:km;const e=t.useSpatialIndex!==void 0?t.useSpatialIndex:!0;this.featuresRtree_=e?new zo:null,this.loadedExtentsRtree_=new zo,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let i,n;Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),!e&&i===void 0&&(i=new Rt(n)),n!==void 0&&this.addFeaturesInternal(n),i!==void 0&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=D(t);if(!this.addToIndex_(e,t)){this.featuresCollection_&&this.featuresCollection_.remove(t);return}this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const n=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Ue(Nt.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof Jt||(this.featureChangeKeys_[t]=[W(e,O.CHANGE,this.handleFeatureChange_,this),W(e,Ci.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(e.getId()!==void 0){const n=String(e.getId());if(!(n in this.idIndex_))this.idIndex_[n]=e;else if(e instanceof Jt){const r=this.idIndex_[n];r instanceof Jt?Array.isArray(r)?r.push(e):this.idIndex_[n]=[r,e]:i=!1}else i=!1}return i&&(H(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let r=0,o=t.length;r<o;r++){const a=t[r],l=D(a);this.addToIndex_(l,a)&&i.push(a)}for(let r=0,o=i.length;r<o;r++){const a=i[r],l=D(a);this.setupChangeEvents_(l,a);const h=a.getGeometry();if(h){const c=h.getExtent();e.push(c),n.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(e,n),this.hasListener(Nt.ADDFEATURE))for(let r=0,o=i.length;r<o;r++)this.dispatchEvent(new Ue(Nt.ADDFEATURE,i[r]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Nt.ADDFEATURE,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(Nt.REMOVEFEATURE,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(Et.ADD,i=>{e||(e=!0,this.addFeature(i.element),e=!1)}),t.addEventListener(Et.REMOVE,i=>{e||(e=!0,this.removeFeature(i.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const i in this.featureChangeKeys_)this.featureChangeKeys_[i].forEach(et);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const i=n=>{this.removeFeatureInternal(n)};this.featuresRtree_.forEach(i);for(const n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new Ue(Nt.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(n){const r=n.getGeometry();if(r instanceof Jt||r.intersectsCoordinate(t))return e(n)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const n=i.getGeometry();if(n instanceof Jt||n.intersectsExtent(t)){const r=e(i);if(r)return r}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),si(this.nullGeometryFeatures_)||ue(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(i){e.push(i)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=Nd(t,e);return[].concat(...i.map(n=>this.featuresRtree_.getInExtent(n)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const o=[NaN,NaN];let a=1/0;const l=[-1/0,-1/0,1/0,1/0];return e=e||ns,this.featuresRtree_.forEachInExtent(l,function(h){if(e(h)){const c=h.getGeometry(),u=a;if(a=c instanceof Jt?0:c.closestPointXY(i,n,o,a),a<u){r=h;const d=Math.sqrt(a);l[0]=i-d,l[1]=n-d,l[2]=i+d,l[3]=n+d}}}),r}getExtent(t){return this.featuresRtree_.getExtent(t)}getFeatureById(t){const e=this.idIndex_[t.toString()];return e!==void 0?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return e!==void 0?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=D(e),n=e.getGeometry();if(!n)i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);else{const o=n.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(o,e)):this.featuresRtree_&&this.featuresRtree_.update(o,e)}const r=e.getId();if(r!==void 0){const o=r.toString();this.idIndex_[o]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[o]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new Ue(Nt.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();return e!==void 0?e in this.idIndex_:D(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&si(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(t,e,i){const n=this.loadedExtentsRtree_,r=this.strategy_(t,e,i);for(let o=0,a=r.length;o<a;++o){const l=r[o];n.forEachInExtent(l,function(h){return Xt(h.extent,l)})||(++this.loadingExtentsCount_,this.dispatchEvent(new Ue(Nt.FEATURESLOADSTART)),this.loader_.call(this,l,e,i,h=>{--this.loadingExtentsCount_,this.dispatchEvent(new Ue(Nt.FEATURESLOADEND,void 0,h))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new Ue(Nt.FEATURESLOADERROR))}),n.insert(l,{extent:l.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_;let i;e.forEachInExtent(t,function(n){if(ri(n.extent,t))return i=n,!0}),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=D(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t),this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=D(t),i=this.featureChangeKeys_[e];if(!i)return;i.forEach(et),delete this.featureChangeKeys_[e];const n=t.getId();return n!==void 0&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.dispatchEvent(new Ue(Nt.REMOVEFEATURE,t)),t}removeFromIdIndex_(t){let e=!1;for(const i in this.idIndex_){const n=this.idIndex_[i];if(t instanceof Jt&&Array.isArray(n)&&n.includes(t))n.splice(n.indexOf(t),1);else if(this.idIndex_[i]===t){delete this.idIndex_[i],e=!0;break}}return e}setLoader(t){this.loader_=t}setUrl(t){H(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(hh(t,this.format_))}}const Ha=Gm,uu=.5;let jm=class extends ln{constructor(s,t,e){super(),e=e||{},this.tileCoord=s,this.state=t,this.interimTile=null,this.key="",this.transition_=e.transition===void 0?250:e.transition,this.transitionStarts_={},this.interpolate=!!e.interpolate}changed(){this.dispatchEvent(O.CHANGE)}release(){this.state===b.ERROR&&this.setState(b.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){let s=this.interimTile;if(!s)return this;do{if(s.getState()==b.LOADED)return this.transition_=0,s;s=s.interimTile}while(s);return this}refreshInterimChain(){let s=this.interimTile;if(!s)return;let t=this;do{if(s.getState()==b.LOADED){s.interimTile=null;break}s.getState()==b.LOADING?t=s:s.getState()==b.IDLE?t.interimTile=s.interimTile:t=s,s=t.interimTile}while(s)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(s){if(this.state!==b.ERROR&&this.state>s)throw new Error("Tile load sequence violation");this.state=s,this.changed()}load(){N()}getAlpha(s,t){if(!this.transition_)return 1;let e=this.transitionStarts_[s];if(!e)e=t,this.transitionStarts_[s]=e;else if(e===-1)return 1;const i=t-e+1e3/60;return i>=this.transition_?1:ec(i/this.transition_)}inTransition(s){return this.transition_?this.transitionStarts_[s]!==-1:!1}endTransition(s){this.transition_&&(this.transitionStarts_[s]=-1)}};const Wr=jm,Vm=10,ch=.25;class zm{constructor(t,e,i,n,r,o){this.sourceProj_=t,this.targetProj_=e;let a={};const l=Ys(this.targetProj_,this.sourceProj_);this.transformInv_=function(y){const v=y[0]+"/"+y[1];return a[v]||(a[v]=l(y)),a[v]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&J(n)>=J(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?J(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?J(this.targetProj_.getExtent()):null;const h=me(i),c=un(i),u=_s(i),d=os(i),g=this.transformInv_(h),p=this.transformInv_(c),f=this.transformInv_(u),_=this.transformInv_(d),m=Vm+(o?Math.max(0,Math.ceil(Math.log2(So(i)/(o*o*256*256)))):0);if(this.addQuad_(h,c,u,d,g,p,f,_,m),this.wrapsXInSource_){let y=1/0;this.triangles_.forEach(function(v,x,E){y=Math.min(y,v.source[0][0],v.source[1][0],v.source[2][0])}),this.triangles_.forEach(v=>{if(Math.max(v.source[0][0],v.source[1][0],v.source[2][0])-y>this.sourceWorldWidth_/2){const x=[[v.source[0][0],v.source[0][1]],[v.source[1][0],v.source[1][1]],[v.source[2][0],v.source[2][1]]];x[0][0]-y>this.sourceWorldWidth_/2&&(x[0][0]-=this.sourceWorldWidth_),x[1][0]-y>this.sourceWorldWidth_/2&&(x[1][0]-=this.sourceWorldWidth_),x[2][0]-y>this.sourceWorldWidth_/2&&(x[2][0]-=this.sourceWorldWidth_);const E=Math.min(x[0][0],x[1][0],x[2][0]);Math.max(x[0][0],x[1][0],x[2][0])-E<this.sourceWorldWidth_/2&&(v.source=x)}})}a={}}addTriangle_(t,e,i,n,r,o){this.triangles_.push({source:[n,r,o],target:[t,e,i]})}addQuad_(t,e,i,n,r,o,a,l,h){const c=Lt([r,o,a,l]),u=this.sourceWorldWidth_?J(c)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,g=this.sourceProj_.canWrapX()&&u>.5&&u<1;let p=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const _=Lt([t,e,i,n]);p=J(_)/this.targetWorldWidth_>ch||p}!g&&this.sourceProj_.isGlobal()&&u&&(p=u>ch||p)}if(!p&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!ht(c,this.maxSourceExtent_))return;let f=0;if(!p&&(!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(h>0)p=!0;else if(f=(!isFinite(r[0])||!isFinite(r[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),f!=1&&f!=2&&f!=4&&f!=8)return}if(h>0){if(!p){const _=[(t[0]+i[0])/2,(t[1]+i[1])/2],m=this.transformInv_(_);let y;g?y=(xi(r[0],d)+xi(a[0],d))/2-xi(m[0],d):y=(r[0]+a[0])/2-m[0];const v=(r[1]+a[1])/2-m[1];p=y*y+v*v>this.errorThresholdSquared_}if(p){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const _=[(e[0]+i[0])/2,(e[1]+i[1])/2],m=this.transformInv_(_),y=[(n[0]+t[0])/2,(n[1]+t[1])/2],v=this.transformInv_(y);this.addQuad_(t,e,_,y,r,o,m,v,h-1),this.addQuad_(y,_,i,n,v,m,a,l,h-1)}else{const _=[(t[0]+e[0])/2,(t[1]+e[1])/2],m=this.transformInv_(_),y=[(i[0]+n[0])/2,(i[1]+n[1])/2],v=this.transformInv_(y);this.addQuad_(t,_,y,n,r,m,v,l,h-1),this.addQuad_(_,e,i,y,m,o,a,v,h-1)}return}}if(g){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}f&11||this.addTriangle_(t,i,n,r,a,l),f&14||this.addTriangle_(t,i,e,r,a,o),f&&(f&13||this.addTriangle_(e,n,t,o,l,r),f&7||this.addTriangle_(e,n,i,o,l,a))}calculateSourceExtent(){const t=Vt();return this.triangles_.forEach(function(e,i,n){const r=e.source;Ns(t,r[0]),Ns(t,r[1]),Ns(t,r[2])}),t}getTriangles(){return this.triangles_}}const du=zm;let co;const Qi=[];function uh(s,t,e,i,n){s.beginPath(),s.moveTo(0,0),s.lineTo(t,e),s.lineTo(i,n),s.closePath(),s.save(),s.clip(),s.fillRect(0,0,Math.max(t,i)+1,Math.max(e,n)),s.restore()}function uo(s,t){return Math.abs(s[t*4]-210)>2||Math.abs(s[t*4+3]-.75*255)>2}function Wm(){if(co===void 0){const s=St(6,6,Qi);s.globalCompositeOperation="lighter",s.fillStyle="rgba(210, 0, 0, 0.75)",uh(s,4,5,4,0),uh(s,4,5,0,5);const t=s.getImageData(0,0,3,3).data;co=uo(t,0)||uo(t,4)||uo(t,8),_n(s),Qi.push(s.canvas)}return co}function nn(s,t,e,i){const n=Ar(e,t,s);let r=er(t,i,e);const o=t.getMetersPerUnit();o!==void 0&&(r*=o);const a=s.getMetersPerUnit();a!==void 0&&(r/=a);const l=s.getExtent();if(!l||hn(l,n)){const h=er(s,r,n)/r;isFinite(h)&&h>0&&(r/=h)}return r}function Bm(s,t,e,i){const n=fe(e);let r=nn(s,t,n,i);return(!isFinite(r)||r<=0)&&ea(e,function(o){return r=nn(s,t,o,i),isFinite(r)&&r>0}),r}function gu(s,t,e,i,n,r,o,a,l,h,c,u,d){const g=St(Math.round(e*s),Math.round(e*t),Qi);if(u||(g.imageSmoothingEnabled=!1),l.length===0)return g.canvas;g.scale(e,e);function p(y){return Math.round(y*e)/e}g.globalCompositeOperation="lighter";const f=Vt();l.forEach(function(y,v,x){Vh(f,y.extent)});let _;if(!d||l.length!==1||h!==0){const y=J(f),v=_t(f);_=St(Math.round(e*y/i),Math.round(e*v/i),Qi),u||(_.imageSmoothingEnabled=!1);const x=e/i;l.forEach(function(E,C,S){const w=E.extent[0]-f[0],P=-(E.extent[3]-f[3]),L=J(E.extent),j=_t(E.extent);E.image.width>0&&E.image.height>0&&_.drawImage(E.image,h,h,E.image.width-2*h,E.image.height-2*h,w*x,P*x,L*x,j*x)})}const m=me(o);return a.getTriangles().forEach(function(y,v,x){const E=y.source,C=y.target;let S=E[0][0],w=E[0][1],P=E[1][0],L=E[1][1],j=E[2][0],V=E[2][1];const $=p((C[0][0]-m[0])/r),X=p(-(C[0][1]-m[1])/r),A=p((C[1][0]-m[0])/r),M=p(-(C[1][1]-m[1])/r),I=p((C[2][0]-m[0])/r),B=p(-(C[2][1]-m[1])/r),nt=S,st=w;S=0,w=0,P-=nt,L-=st,j-=nt,V-=st;const yt=[[P,L,0,0,A-$],[j,V,0,0,I-$],[0,0,P,L,M-X],[0,0,j,V,B-X]],R=Wd(yt);if(!R)return;if(g.save(),g.beginPath(),Wm()||!u){g.moveTo(A,M);const K=4,rt=$-A,re=X-M;for(let vt=0;vt<K;vt++)g.lineTo(A+p((vt+1)*rt/K),M+p(vt*re/(K-1))),vt!=K-1&&g.lineTo(A+p((vt+1)*rt/K),M+p((vt+1)*re/(K-1)));g.lineTo(I,B)}else g.moveTo(A,M),g.lineTo($,X),g.lineTo(I,B);g.clip(),g.transform(R[0],R[2],R[1],R[3],$,X),g.translate(f[0]-nt,f[3]-st);let dt;if(_)dt=_.canvas,g.scale(i/e,-i/e);else{const K=l[0],rt=K.extent;dt=K.image,g.scale(J(rt)/dt.width,-_t(rt)/dt.height)}g.drawImage(dt,0,0),g.restore()}),_&&(_n(_),Qi.push(_.canvas)),c&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(y,v,x){const E=y.target,C=(E[0][0]-m[0])/r,S=-(E[0][1]-m[1])/r,w=(E[1][0]-m[0])/r,P=-(E[1][1]-m[1])/r,L=(E[2][0]-m[0])/r,j=-(E[2][1]-m[1])/r;g.beginPath(),g.moveTo(w,P),g.lineTo(C,S),g.lineTo(L,j),g.closePath(),g.stroke()}),g.restore()),g.canvas}class Um extends Wr{constructor(t,e,i,n,r,o,a,l,h,c,u,d){super(r,b.IDLE,d),this.renderEdges_=u!==void 0?u:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=n,this.wrappedTileCoord_=o||r,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const g=n.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const _=p?Me(g,p):g;if(So(_)===0){this.state=b.EMPTY;return}const m=t.getExtent();m&&(f?f=Me(f,m):f=m);const y=n.getResolution(this.wrappedTileCoord_[0]),v=Bm(t,i,_,y);if(!isFinite(v)||v<=0){this.state=b.EMPTY;return}const x=c!==void 0?c:uu;if(this.triangulation_=new du(t,i,_,f,v*x,y),this.triangulation_.getTriangles().length===0){this.state=b.EMPTY;return}this.sourceZ_=e.getZForResolution(v);let E=this.triangulation_.calculateSourceExtent();if(f&&(t.canWrapX()?(E[1]=at(E[1],f[1],f[3]),E[3]=at(E[3],f[1],f[3])):E=Me(E,f)),!So(E))this.state=b.EMPTY;else{const C=e.getTileRangeForExtentAndZ(E,this.sourceZ_);for(let S=C.minX;S<=C.maxX;S++)for(let w=C.minY;w<=C.maxY;w++){const P=h(this.sourceZ_,S,w,a);P&&this.sourceTiles_.push(P)}this.sourceTiles_.length===0&&(this.state=b.EMPTY)}}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{e&&e.getState()==b.LOADED&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}),this.sourceTiles_.length=0,t.length===0)this.state=b.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n=typeof i=="number"?i:i[0],r=typeof i=="number"?i:i[1],o=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=gu(n,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=b.LOADED}this.changed()}load(){if(this.state==b.IDLE){this.state=b.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(e=>{const i=e.getState();if(i==b.IDLE||i==b.LOADING){t++;const n=W(e,O.CHANGE,function(r){const o=e.getState();(o==b.LOADED||o==b.ERROR||o==b.EMPTY)&&(et(n),t--,t===0&&(this.unlistenSources_(),this.reproject_()))},this);this.sourcesListenerKeys_.push(n)}}),t===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(e,i,n){e.getState()==b.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(et),this.sourcesListenerKeys_=null}release(){this.canvas_&&(_n(this.canvas_.getContext("2d")),Qi.push(this.canvas_),this.canvas_=null),super.release()}}const Wo=Um;class $m extends Wr{constructor(t,e,i,n,r,o){super(t,e,o),this.crossOrigin_=n,this.src_=i,this.key=i,this.image_=new Image,n!==null&&(this.image_.crossOrigin=n),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=b.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=b.ERROR,this.unlistenImage_(),this.image_=Xm(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=b.LOADED:this.state=b.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==b.ERROR&&(this.state=b.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==b.IDLE&&(this.state=b.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=Sf(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}function Xm(){const s=St(1,1);return s.fillStyle="rgba(0,0,0,0)",s.fillRect(0,0,1,1),s.canvas}const pu=$m;class Ym{constructor(t){this.highWaterMark=t!==void 0?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return H(i!==void 0,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return H(e!==void 0,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.key_;return t}getValues(){const t=new Array(this.count_);let e=0,i;for(i=this.newest_;i;i=i.older)t[e++]=i.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){var e;return(e=this.entries_[t])==null?void 0:e.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){H(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}const Km=Ym;class fu{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function Gi(s,t,e,i,n){return n!==void 0?(n.minX=s,n.maxX=t,n.minY=e,n.maxY=i,n):new fu(s,t,e,i)}const _u=fu;function dh(s,t,e,i){return i!==void 0?(i[0]=s,i[1]=t,i[2]=e,i):[s,t,e]}function xs(s,t,e){return s+"/"+t+"/"+e}function mu(s){return xs(s[0],s[1],s[2])}function Hm(s){const[t,e,i]=s.substring(s.lastIndexOf("/")+1,s.length).split(",").map(Number);return xs(t,e,i)}function yu(s){return s.split("/").map(Number)}function vu(s){return(s[1]<<s[0])+s[2]}function Zm(s,t){const e=s[0],i=s[1],n=s[2];if(t.getMinZoom()>e||e>t.getMaxZoom())return!1;const r=t.getFullTileRange(e);return r?r.containsXY(i,n):!0}class qm extends fn{constructor(t){t=t||{},super(t)}}const Jm=qm;class Qm extends Xa{constructor(t){super(t),this.image_=null}getImage(){return this.image_?this.image_.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,n=t.viewState,r=n.resolution,o=this.getLayer().getSource(),a=t.viewHints;let l=t.extent;if(e.extent!==void 0&&(l=Me(l,he(e.extent,n.projection))),!a[ot.ANIMATING]&&!a[ot.INTERACTING]&&!ms(l))if(o){const h=n.projection,c=o.getImage(l,r,i,h);c&&(this.loadImage(c)?this.image_=c:c.getState()===G.EMPTY&&(this.image_=null))}else this.image_=null;return!!this.image_}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=gt(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!hn(r,n))return null;const o=this.image_.getExtent(),a=this.image_.getImage(),l=J(o),h=Math.floor(a.width*((n[0]-o[0])/l));if(h<0||h>=a.width)return null;const c=_t(o),u=Math.floor(a.height*((o[3]-n[1])/c));return u<0||u>=a.height?null:this.getImageData(a,h,u)}renderFrame(t,e){const i=this.image_,n=i.getExtent(),r=i.getResolution(),[o,a]=Array.isArray(r)?r:[r,r],l=i.getPixelRatio(),h=t.layerStatesArray[t.layerIndex],c=t.pixelRatio,u=t.viewState,d=u.center,g=u.resolution,p=c*o/(g*l),f=c*a/(g*l),_=t.extent,m=u.resolution,y=u.rotation,v=Math.round(J(_)/m*c),x=Math.round(_t(_)/m*c);ie(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/c,1/c,y,-v/2,-x/2),Pr(this.inversePixelTransform,this.pixelTransform);const E=Jo(this.pixelTransform);this.useContainer(e,E,this.getBackground(t));const C=this.context,S=C.canvas;S.width!=v||S.height!=x?(S.width=v,S.height=x):this.containerReused||C.clearRect(0,0,v,x);let w=!1,P=!0;if(h.extent){const X=he(h.extent,u.projection);P=ht(X,t.extent),w=P&&!Xt(X,t.extent),w&&this.clipUnrotated(C,t,X)}const L=i.getImage(),j=ie(this.tempTransform,v/2,x/2,p,f,0,l*(n[0]-d[0])/o,l*(d[1]-n[3])/a);this.renderedResolution=a*c/l;const V=L.width*j[0],$=L.height*j[3];if(this.getLayer().getSource().getInterpolate()||(C.imageSmoothingEnabled=!1),this.preRender(C,t),P&&V>=.5&&$>=.5){const X=j[4],A=j[5],M=h.opacity;let I;M!==1&&(I=C.globalAlpha,C.globalAlpha=M),C.drawImage(L,0,0,+L.width,+L.height,X,A,V,$),M!==1&&(C.globalAlpha=I)}return this.postRender(C,t),w&&C.restore(),C.imageSmoothingEnabled=!0,E!==S.style.transform&&(S.style.transform=E),this.container}}const t0=Qm;class e0 extends Jm{constructor(t){super(t)}createRenderer(){return new t0(this)}getData(t){return super.getData(t)}}const i0=e0,Qe={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class s0 extends fn{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.setPreload(t.preload!==void 0?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0)}getPreload(){return this.get(Qe.PRELOAD)}setPreload(t){this.set(Qe.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Qe.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Qe.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}const n0=s0;class r0 extends Xa{constructor(t){super(t),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=Vt(),this.tmpTileRange_=new _u(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==b.LOADED||i==b.EMPTY||i==b.ERROR&&!n}getTile(t,e,i,n){const r=n.pixelRatio,o=n.viewState.projection,a=this.getLayer();let l=a.getSource().getTile(t,e,i,r,o);return l.getState()==b.ERROR&&a.getUseInterimTilesOnError()&&a.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(l)||(l=l.getInterimTile()),l}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=gt(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!hn(r,n))return null;const o=e.pixelRatio,a=e.viewState.projection,l=e.viewState,h=i.getRenderSource(),c=h.getTileGridForProjection(l.projection),u=h.getTilePixelRatio(e.pixelRatio);for(let d=c.getZForResolution(l.resolution);d>=c.getMinZoom();--d){const g=c.getTileCoordForCoordAndZ(n,d),p=h.getTile(d,g[1],g[2],o,a);if(!(p instanceof pu||p instanceof Wo)||p instanceof Wo&&p.getState()===b.EMPTY)return null;if(p.getState()!==b.LOADED)continue;const f=c.getOrigin(d),_=bt(c.getTileSize(d)),m=c.getResolution(d),y=Math.floor(u*((n[0]-f[0])/m-g[1]*_[0])),v=Math.floor(u*((f[1]-n[1])/m-g[2]*_[1])),x=Math.round(u*h.getGutterForProjection(l.projection));return this.getImageData(p.getImage(),y+x,v+x)}return null}loadedTileCallback(t,e,i){return this.isDrawableTile(i)?super.loadedTileCallback(t,e,i):!1}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,o=n.resolution,a=n.center,l=n.rotation,h=t.pixelRatio,c=this.getLayer(),u=c.getSource(),d=u.getRevision(),g=u.getTileGridForProjection(r),p=g.getZForResolution(o,u.zDirection),f=g.getResolution(p);let _=t.extent;const m=t.viewState.resolution,y=u.getTilePixelRatio(h),v=Math.round(J(_)/m*h),x=Math.round(_t(_)/m*h),E=i.extent&&he(i.extent);E&&(_=Me(_,he(i.extent)));const C=f*v/2/y,S=f*x/2/y,w=[a[0]-C,a[1]-S,a[0]+C,a[1]+S],P=g.getTileRangeForExtentAndZ(_,p),L={};L[p]={};const j=this.createLoadedTileFinder(u,r,L),V=this.tmpExtent,$=this.tmpTileRange_;this.newTiles_=!1;const X=l?To(n.center,m,l,t.size):void 0;for(let dt=P.minX;dt<=P.maxX;++dt)for(let K=P.minY;K<=P.maxY;++K){if(l&&!g.tileCoordIntersectsViewport([p,dt,K],X))continue;const rt=this.getTile(p,dt,K,t);if(this.isDrawableTile(rt)){const ve=D(this);if(rt.getState()==b.LOADED){L[p][rt.tileCoord.toString()]=rt;let oe=rt.inTransition(ve);oe&&i.opacity!==1&&(rt.endTransition(ve),oe=!1),!this.newTiles_&&(oe||!this.renderedTiles.includes(rt))&&(this.newTiles_=!0)}if(rt.getAlpha(ve,t.time)===1)continue}const re=g.getTileCoordChildTileRange(rt.tileCoord,$,V);let vt=!1;re&&(vt=j(p+1,re)),vt||g.forEachTileCoordParentTileRange(rt.tileCoord,j,$,V)}const A=f/o*h/y;ie(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,l,-v/2,-x/2);const M=Jo(this.pixelTransform);this.useContainer(e,M,this.getBackground(t));const I=this.context,B=I.canvas;Pr(this.inversePixelTransform,this.pixelTransform),ie(this.tempTransform,v/2,x/2,A,A,0,-v/2,-x/2),B.width!=v||B.height!=x?(B.width=v,B.height=x):this.containerReused||I.clearRect(0,0,v,x),E&&this.clipUnrotated(I,t,E),u.getInterpolate()||(I.imageSmoothingEnabled=!1),this.preRender(I,t),this.renderedTiles.length=0;let nt=Object.keys(L).map(Number);nt.sort(ii);let st,yt,R;i.opacity===1&&(!this.containerReused||u.getOpaque(t.viewState.projection))?nt=nt.reverse():(st=[],yt=[]);for(let dt=nt.length-1;dt>=0;--dt){const K=nt[dt],rt=u.getTilePixelSize(K,h,r),re=g.getResolution(K)/f,vt=rt[0]*re*A,ve=rt[1]*re*A,oe=g.getTileCoordForCoordAndZ(me(w),K),En=g.getTileCoordExtent(oe),Pi=gt(this.tempTransform,[y*(En[0]-w[0])/f,y*(w[3]-En[3])/f]),Cn=y*u.getGutterForProjection(r),je=L[K];for(const Es in je){const Ve=je[Es],wn=Ve.tileCoord,Sn=oe[1]-wn[1],Tn=Math.round(Pi[0]-(Sn-1)*vt),Mi=oe[2]-wn[2],Ur=Math.round(Pi[1]-(Mi-1)*ve),It=Math.round(Pi[0]-Sn*vt),Wt=Math.round(Pi[1]-Mi*ve),qt=Tn-It,xe=Ur-Wt,Li=p===K,hi=Li&&Ve.getAlpha(D(this),t.time)!==1;let ze=!1;if(!hi)if(st){R=[It,Wt,It+qt,Wt,It+qt,Wt+xe,It,Wt+xe];for(let Ai=0,Rn=st.length;Ai<Rn;++Ai)if(p!==K&&K<yt[Ai]){const Tt=st[Ai];ht([It,Wt,It+qt,Wt+xe],[Tt[0],Tt[3],Tt[4],Tt[7]])&&(ze||(I.save(),ze=!0),I.beginPath(),I.moveTo(R[0],R[1]),I.lineTo(R[2],R[3]),I.lineTo(R[4],R[5]),I.lineTo(R[6],R[7]),I.moveTo(Tt[6],Tt[7]),I.lineTo(Tt[4],Tt[5]),I.lineTo(Tt[2],Tt[3]),I.lineTo(Tt[0],Tt[1]),I.clip())}st.push(R),yt.push(K)}else I.clearRect(It,Wt,qt,xe);this.drawTileImage(Ve,t,It,Wt,qt,xe,Cn,Li),st&&!hi?(ze&&I.restore(),this.renderedTiles.unshift(Ve)):this.renderedTiles.push(Ve),this.updateUsedTiles(t.usedTiles,u,Ve)}}return this.renderedRevision=d,this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!ri(this.renderedExtent_,w),this.renderedExtent_=w,this.renderedPixelRatio=h,this.renderedProjection=r,this.manageTilePyramid(t,u,g,h,r,_,p,c.getPreload()),this.scheduleExpireCache(t,u),this.postRender(I,t),i.extent&&I.restore(),I.imageSmoothingEnabled=!0,M!==B.style.transform&&(B.style.transform=M),this.container}drawTileImage(t,e,i,n,r,o,a,l){const h=this.getTileImage(t);if(!h)return;const c=D(this),u=e.layerStatesArray[e.layerIndex],d=u.opacity*(l?t.getAlpha(c,e.time):1),g=d!==this.context.globalAlpha;g&&(this.context.save(),this.context.globalAlpha=d),this.context.drawImage(h,a,a,h.width-2*a,h.height-2*a,i,n,r,o),g&&this.context.restore(),d!==u.opacity?e.animate=!0:l&&t.endTransition(c)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}scheduleExpireCache(t,e){if(e.canExpireCache()){const i=(function(n,r,o){const a=D(n);a in o.usedTiles&&n.expireCache(o.viewState.projection,o.usedTiles[a])}).bind(null,e);t.postRenderFunctions.push(i)}}updateUsedTiles(t,e,i){const n=D(e);n in t||(t[n]={}),t[n][i.getKey()]=!0}manageTilePyramid(t,e,i,n,r,o,a,l,h){const c=D(e);c in t.wantedTiles||(t.wantedTiles[c]={});const u=t.wantedTiles[c],d=t.tileQueue,g=i.getMinZoom(),p=t.viewState.rotation,f=p?To(t.viewState.center,t.viewState.resolution,p,t.size):void 0;let _=0,m,y,v,x,E,C;for(C=g;C<=a;++C)for(y=i.getTileRangeForExtentAndZ(o,C,y),v=i.getResolution(C),x=y.minX;x<=y.maxX;++x)for(E=y.minY;E<=y.maxY;++E)p&&!i.tileCoordIntersectsViewport([C,x,E],f)||(a-C<=l?(++_,m=e.getTile(C,x,E,n,r),m.getState()==b.IDLE&&(u[m.getKey()]=!0,d.isKeyQueued(m.getKey())||d.enqueue([m,c,i.getTileCoordCenter(m.tileCoord),v])),h!==void 0&&h(m)):e.useTile(C,x,E,r));e.updateCacheSize(_,r)}}const xu=r0;class o0 extends n0{constructor(t){super(t)}createRenderer(){return new xu(this)}}const a0=o0;function Bo(s){return Array.isArray(s)?Math.min(...s):s}const l0={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},h0={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class c0 extends xu{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.tmpTransform_=Yt()}prepareTile(t,e,i){let n;const r=t.getState();return(r===b.LOADED||r===b.ERROR)&&(this.updateExecutorGroup_(t,e,i),this.tileImageNeedsRender_(t)&&(n=!0)),n}getTile(t,e,i,n){const r=n.pixelRatio,o=n.viewState,a=o.resolution,l=o.projection,h=this.getLayer(),c=h.getSource().getTile(t,e,i,r,l),u=n.viewHints,d=!(u[ot.ANIMATING]||u[ot.INTERACTING]);return(d||!c.wantedResolution)&&(c.wantedResolution=a),this.prepareTile(c,r,l)&&(d||Date.now()-n.time<8)&&h.getRenderMode()!=="vector"&&this.renderTileImage_(c,n),super.getTile(t,e,i,n)}isDrawableTile(t){const e=this.getLayer();return super.isDrawableTile(t)&&(e.getRenderMode()==="vector"?D(e)in t.executorGroups:t.hasContext(e))}getTileImage(t){return t.getImage(this.getLayer())}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const n=this.getLayer(),r=n.getRevision(),o=n.getRenderOrder()||null,a=t.wantedResolution,l=t.getReplayState(n);if(!l.dirty&&l.renderedResolution===a&&l.renderedRevision==r&&l.renderedRenderOrder==o)return;const h=n.getSource(),c=n.getDeclutter(),u=h.getTileGrid(),d=h.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),g=h.getSourceTiles(e,i,t),p=D(n);delete t.hitDetectionImageData[p],t.executorGroups[p]=[],c&&(t.declutterExecutorGroups[p]=[]),l.dirty=!1;for(let f=0,_=g.length;f<_;++f){const m=g[f];if(m.getState()!=b.LOADED)continue;const y=m.tileCoord,v=u.getTileCoordExtent(y),x=Me(d,v),E=Kt(x,n.getRenderBuffer()*a,this.tmpExtent),C=ri(v,x)?null:E,S=new vr(0,E,a,e),w=c?new vr(0,x,a,e):void 0,P=lu(a,e),L=function(A){let M;const I=A.getStyleFunction()||n.getStyleFunction();if(I&&(M=I(A,a)),M){const B=this.renderFeature(A,P,M,S,w);l.dirty=l.dirty||B}},j=m.getFeatures();o&&o!==l.renderedRenderOrder&&j.sort(o);for(let A=0,M=j.length;A<M;++A){const I=j[A];(!C||ht(C,I.getGeometry().getExtent()))&&L.call(this,I)}const V=S.finish(),$=n.getRenderMode()!=="vector"&&c&&g.length===1?null:x,X=new xr($,a,e,h.getOverlaps(),V,n.getRenderBuffer());if(t.executorGroups[p].push(X),w){const A=new xr(null,a,e,h.getOverlaps(),w.finish(),n.getRenderBuffer());t.declutterExecutorGroups[p].push(A)}}l.renderedRevision=r,l.renderedRenderOrder=o,l.renderedResolution=a}forEachFeatureAtCoordinate(t,e,i,n,r){const o=e.viewState.resolution,a=e.viewState.rotation;i=i??0;const l=this.getLayer(),h=l.getSource().getTileGridForProjection(e.viewState.projection),c=Lt([t]);Kt(c,o*i,c);const u={},d=function(f,_,m){let y=f.getId();y===void 0&&(y=D(f));const v=u[y];if(v){if(v!==!0&&m<v.distanceSq){if(m===0)return u[y]=!0,r.splice(r.lastIndexOf(v),1),n(f,l,_);v.geometry=_,v.distanceSq=m}}else{if(m===0)return u[y]=!0,n(f,l,_);r.push(u[y]={feature:f,layer:l,geometry:_,distanceSq:m,callback:n})}},g=this.renderedTiles;let p;for(let f=0,_=g.length;!p&&f<_;++f){const m=g[f],y=h.getTileCoordExtent(m.wrappedTileCoord);if(!ht(y,c))continue;const v=D(l),x=[m.executorGroups[v]],E=m.declutterExecutorGroups[v];E&&x.push(E),x.some(C=>{const S=C===E?e.declutterTree.all().map(w=>w.value):null;for(let w=0,P=C.length;w<P;++w)if(p=C[w].forEachFeatureAtCoordinate(t,o,a,i,d,S),p)return!0})}return p}getFeatures(t){return new Promise((e,i)=>{const n=this.getLayer(),r=D(n),o=n.getSource(),a=this.renderedProjection,l=a.getExtent(),h=this.renderedResolution,c=o.getTileGridForProjection(a),u=gt(this.renderedPixelToCoordinateTransform_,t.slice()),d=c.getTileCoordForCoordAndResolution(u,h);let g;for(let v=0,x=this.renderedTiles.length;v<x;++v)if(d.toString()===this.renderedTiles[v].tileCoord.toString()){if(g=this.renderedTiles[v],g.getState()===b.LOADED){const E=c.getTileCoordExtent(g.tileCoord);o.getWrapX()&&a.canWrapX()&&!Xt(l,E)&&Mr(u,a);break}g=void 0}if(!g||g.loadingSourceTiles>0){e([]);return}const p=c.getTileCoordExtent(g.wrappedTileCoord),f=me(p),_=[(u[0]-f[0])/h,(f[1]-u[1])/h],m=g.getSourceTiles().reduce(function(v,x){return v.concat(x.getFeatures())},[]);let y=g.hitDetectionImageData[r];if(!y){const v=bt(c.getTileSize(c.getZForResolution(h,o.zDirection))),x=this.renderedRotation_,E=[this.getRenderTransform(c.getTileCoordCenter(g.wrappedTileCoord),h,0,jt,v[0]*jt,v[1]*jt,0)];y=ru(v,E,m,n.getStyleFunction(),c.getTileCoordExtent(g.wrappedTileCoord),g.getReplayState(n).renderedResolution,x),g.hitDetectionImageData[r]=y}e(ou(_,m,y))})}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.renderedLayerRevision_!==void 0&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t){const e=this.context,i=e.globalAlpha;e.globalAlpha=this.getLayer().getOpacity();const n=t.viewHints,r=!(n[ot.ANIMATING]||n[ot.INTERACTING]),o=this.renderedTiles;for(let a=0,l=o.length;a<l;++a){const h=o[a],c=h.declutterExecutorGroups[D(this.getLayer())];if(c)for(let u=c.length-1;u>=0;--u)c[u].execute(this.context,1,this.getTileRenderTransform(h,t),t.viewState.rotation,r,void 0,t.declutterTree)}e.globalAlpha=i}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,r=n.center,o=n.resolution,a=n.rotation,l=e.size,h=Math.round(l[0]*i),c=Math.round(l[1]*i),u=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),d=t.tileCoord,g=u.getTileCoordExtent(t.wrappedTileCoord),p=u.getTileCoordExtent(d,this.tmpExtent)[0]-g[0];return qo(Hr(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,o,a,i,h,c,p))}postRender(t,e){const i=e.viewHints,n=!(i[ot.ANIMATING]||i[ot.INTERACTING]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation;const r=this.getLayer(),o=r.getRenderMode(),a=t.globalAlpha;t.globalAlpha=r.getOpacity();const l=h0[o],h=e.viewState,c=h.rotation,u=r.getSource(),d=u.getTileGridForProjection(h.projection).getZForResolution(h.resolution,u.zDirection),g=this.renderedTiles,p=[],f=[];let _=!0;for(let m=g.length-1;m>=0;--m){const y=g[m];_=_&&!y.getReplayState(r).dirty;const v=y.executorGroups[D(r)].filter(w=>w.hasExecutors(l));if(v.length===0)continue;const x=this.getTileRenderTransform(y,e),E=y.tileCoord[0];let C=!1;const S=v[0].getClipCoords(x);if(S){for(let w=0,P=p.length;w<P;++w)if(d!==E&&E<f[w]){const L=p[w];ht([S[0],S[3],S[4],S[7]],[L[0],L[3],L[4],L[7]])&&(C||(t.save(),C=!0),t.beginPath(),t.moveTo(S[0],S[1]),t.lineTo(S[2],S[3]),t.lineTo(S[4],S[5]),t.lineTo(S[6],S[7]),t.moveTo(L[6],L[7]),t.lineTo(L[4],L[5]),t.lineTo(L[2],L[3]),t.lineTo(L[0],L[1]),t.clip())}p.push(S),f.push(E)}for(let w=0,P=v.length;w<P;++w)v[w].execute(t,1,x,c,n,l);C&&t.restore()}t.globalAlpha=a,this.ready=_,super.postRender(t,e)}renderFeature(t,e,i,n,r){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let a=0,l=i.length;a<l;++a)o=Er(n,t,i[a],e,this.boundHandleStyleImageChange_,void 0,r)||o;else o=Er(n,t,i,e,this.boundHandleStyleImageChange_,void 0,r);return o}tileImageNeedsRender_(t){const e=this.getLayer();if(e.getRenderMode()==="vector")return!1;const i=t.getReplayState(e),n=e.getRevision(),r=t.wantedResolution;return i.renderedTileResolution!==r||i.renderedTileRevision!==n}renderTileImage_(t,e){const i=this.getLayer(),n=t.getReplayState(i),r=i.getRevision(),o=t.executorGroups[D(i)];n.renderedTileRevision=r;const a=t.wrappedTileCoord,l=a[0],h=i.getSource();let c=e.pixelRatio;const u=e.viewState.projection,d=h.getTileGridForProjection(u),g=d.getResolution(t.tileCoord[0]),p=e.pixelRatio/t.wantedResolution*g,f=d.getResolution(l),_=t.getContext(i);c=Math.round(Math.max(c,p/c));const m=h.getTilePixelSize(l,c,u);_.canvas.width=m[0],_.canvas.height=m[1];const y=c/p;if(y!==1){const C=Cl(this.tmpTransform_);Hr(C,y,y),_.setTransform.apply(_,C)}const v=d.getTileCoordExtent(a,this.tmpExtent),x=p/f,E=Cl(this.tmpTransform_);Hr(E,x,-x),Md(E,-v[0],-v[3]);for(let C=0,S=o.length;C<S;++C)o[C].execute(_,y,E,0,!0,l0[i.getRenderMode()]);n.renderedTileResolution=t.wantedResolution}}const u0=c0;class d0 extends su{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un;const i=t.renderMode||"hybrid";H(i=="hybrid"||i=="vector","`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=i,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(t.useInterimTilesOnError!==void 0?t.useInterimTilesOnError:!0),this.getBackground,this.setBackground}createRenderer(){return new u0(this)}getFeatures(t){return super.getFeatures(t)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(Qe.PRELOAD)}getUseInterimTilesOnError(){return this.get(Qe.USE_INTERIM_TILES_ON_ERROR)}setPreload(t){this.set(Qe.PRELOAD,t)}setUseInterimTilesOnError(t){this.set(Qe.USE_INTERIM_TILES_ON_ERROR,t)}}const g0=d0;class p0 extends Km{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(t){for(;this.canExpireCache()&&!(this.peekLast().getKey()in t);)this.pop().release()}pruneExceptNewestZ(){if(this.getCount()===0)return;const t=this.peekFirstKey(),e=yu(t)[0];this.forEach(i=>{i.tileCoord[0]!==e&&(this.remove(mu(i.tileCoord)),i.release())})}}const Za=p0,go={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"},ji=[0,0,0],$e=5;class f0{constructor(t){this.minZoom=t.minZoom!==void 0?t.minZoom:0,this.resolutions_=t.resolutions,H(md(this.resolutions_,(n,r)=>r-n,!0),"`resolutions` must be sorted in descending order");let e;if(!t.origins){for(let n=0,r=this.resolutions_.length-1;n<r;++n)if(!e)e=this.resolutions_[n]/this.resolutions_[n+1];else if(this.resolutions_[n]/this.resolutions_[n+1]!==e){e=void 0;break}}this.zoomFactor_=e,this.maxZoom=this.resolutions_.length-1,this.origin_=t.origin!==void 0?t.origin:null,this.origins_=null,t.origins!==void 0&&(this.origins_=t.origins,H(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=t.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=me(i)),H(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,t.tileSizes!==void 0&&(this.tileSizes_=t.tileSizes,H(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=t.tileSize!==void 0?t.tileSize:this.tileSizes_?null:na,H(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=i!==void 0?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],t.sizes!==void 0?this.fullTileRanges_=t.sizes.map((n,r)=>{const o=new _u(Math.min(0,n[0]),Math.max(n[0]-1,-1),Math.min(0,n[1]),Math.max(n[1]-1,-1));if(i){const a=this.getTileRangeForExtentAndZ(i,r);o.minX=Math.max(a.minX,o.minX),o.maxX=Math.min(a.maxX,o.maxX),o.minY=Math.max(a.minY,o.minY),o.maxY=Math.min(a.maxY,o.maxY)}return o}):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let r=n.minX,o=n.maxX;r<=o;++r)for(let a=n.minY,l=n.maxY;a<=l;++a)i([e,r,a])}forEachTileCoordParentTileRange(t,e,i,n){let r,o,a,l=null,h=t[0]-1;for(this.zoomFactor_===2?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,n);h>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),r=Gi(o,o,a,a,i)):r=this.getTileRangeForExtentAndZ(l,h,i),e(h,r))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(this.zoomFactor_===2){const r=t[1]*2,o=t[2]*2;return Gi(r,r+1,o,o+1,e)}const n=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],r=t[1],o=t[2];if(e===n)return Gi(r,o,r,o,i);if(this.zoomFactor_){const l=Math.pow(this.zoomFactor_,e-n),h=Math.floor(r*l),c=Math.floor(o*l);if(e<n)return Gi(h,h,c,c,i);const u=Math.floor(l*(r+1))-1,d=Math.floor(l*(o+1))-1;return Gi(h,u,c,d,i)}const a=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,ji);const n=ji[1],r=ji[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,ji);const o=ji[1],a=ji[2];return Gi(n,o,r,a,i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=bt(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),r=bt(this.getTileSize(t[0]),this.tmpSize_),o=i[0]+t[1]*r[0]*n,a=i[1]-(t[2]+1)*r[1]*n,l=o+r[0]*n,h=a+r[1]*n;return De(o,a,l,h,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,n,r){const o=this.getZForResolution(i),a=i/this.getResolution(o),l=this.getOrigin(o),h=bt(this.getTileSize(o),this.tmpSize_);let c=a*(t-l[0])/i/h[0],u=a*(l[1]-e)/i/h[1];return n?(c=He(c,$e)-1,u=He(u,$e)-1):(c=$i(c,$e),u=$i(u,$e)),dh(o,c,u,r)}getTileCoordForXYAndZ_(t,e,i,n,r){const o=this.getOrigin(i),a=this.getResolution(i),l=bt(this.getTileSize(i),this.tmpSize_);let h=(t-o[0])/a/l[0],c=(o[1]-e)/a/l[1];return n?(h=He(h,$e)-1,c=He(c,$e)-1):(h=$i(h,$e),c=$i(c,$e)),dh(i,h,c,r)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const i=Rr(this.resolutions_,t,e||0);return at(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return cc(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let n=this.minZoom;n<e;++n)i[n]=this.getTileRangeForExtentAndZ(t,n);this.fullTileRanges_=i}}const qa=f0;function Eu(s){let t=s.getDefaultTileGrid();return t||(t=y0(s),s.setDefaultTileGrid(t)),t}function _0(s,t,e){const i=t[0],n=s.getTileCoordCenter(t),r=Br(e);if(!hn(r,n)){const o=J(r),a=Math.ceil((r[0]-n[0])/o);return n[0]+=o*a,s.getTileCoordForCoordAndZ(n,i)}return t}function m0(s,t,e,i){i=i!==void 0?i:"top-left";const n=Cu(s,t,e);return new qa({extent:s,origin:Fd(s,i),resolutions:n,tileSize:e})}function Ja(s){const t=s||{},e=t.extent||it("EPSG:3857").getExtent(),i={extent:e,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Cu(e,t.maxZoom,t.tileSize,t.maxResolution)};return new qa(i)}function Cu(s,t,e,i){t=t!==void 0?t:Hh,e=bt(e!==void 0?e:na);const n=_t(s),r=J(s);i=i>0?i:Math.max(r/e[0],n/e[1]);const o=t+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=i/Math.pow(2,l);return a}function y0(s,t,e,i){const n=Br(s);return m0(n,t,e,i)}function Br(s){s=it(s);let t=s.getExtent();if(!t){const e=180*as.degrees/s.getMetersPerUnit();t=De(-e,-e,e,e)}return t}class v0 extends Ka{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.opaque_=t.opaque!==void 0?t.opaque:!1,this.tilePixelRatio_=t.tilePixelRatio!==void 0?t.tilePixelRatio:1,this.tileGrid=t.tileGrid!==void 0?t.tileGrid:null;const e=[256,256];this.tileGrid&&bt(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tileCache=new Za(t.cacheSize||0),this.tmpSize=[0,0],this.key_=t.key||"",this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}canExpireCache(){return this.tileCache.canExpireCache()}expireCache(t,e){const i=this.getTileCacheForProjection(t);i&&i.expireCache(e)}forEachLoadedTile(t,e,i,n){const r=this.getTileCacheForProjection(t);if(!r)return!1;let o=!0,a,l,h;for(let c=i.minX;c<=i.maxX;++c)for(let u=i.minY;u<=i.maxY;++u)l=xs(e,c,u),h=!1,r.containsKey(l)&&(a=r.get(l),h=a.getState()===b.LOADED,h&&(h=n(a)!==!1)),h||(o=!1);return o}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getOpaque(t){return this.opaque_}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,r){return N()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Eu(t)}getTileCacheForProjection(t){const e=this.getProjection();return H(e===null||Ie(e,t),"A VectorTile source can only be rendered if it has a projection compatible with the view projection."),this.tileCache}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),o=bt(n.getTileSize(t),this.tmpSize);return r==1?o:Hp(o,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){e=e!==void 0?e:this.getProjection();const i=this.getTileGridForProjection(e);return this.getWrapX()&&e.isGlobal()&&(t=_0(i,t,e)),Zm(t,i)?t:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(t,e){const i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)}useTile(t,e,i,n){}}class x0 extends Zt{constructor(t,e){super(t),this.tile=e}}const wu=v0;function E0(s,t){const e=/\{z\}/g,i=/\{x\}/g,n=/\{y\}/g,r=/\{-y\}/g;return function(o,a,l){if(o)return s.replace(e,o[0].toString()).replace(i,o[1].toString()).replace(n,o[2].toString()).replace(r,function(){const h=o[0],c=t.getFullTileRange(h);if(!c)throw new Error("The {-y} placeholder requires a tile grid with extent");return(c.getHeight()-o[2]-1).toString()})}}function C0(s,t){const e=s.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=E0(s[n],t);return Uo(i)}function Uo(s){return s.length===1?s[0]:function(t,e,i){if(!t)return;const n=vu(t),r=xi(n,s.length);return s[r](t,e,i)}}function Su(s){const t=[];let e=/\{([a-z])-([a-z])\}/.exec(s);if(e){const i=e[1].charCodeAt(0),n=e[2].charCodeAt(0);let r;for(r=i;r<=n;++r)t.push(s.replace(e[0],String.fromCharCode(r)));return t}if(e=/\{(\d+)-(\d+)\}/.exec(s),e){const i=parseInt(e[2],10);for(let n=parseInt(e[1],10);n<=i;n++)t.push(s.replace(e[0],n.toString()));return t}return t.push(s),t}class Qa extends wu{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===Qa.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=D(e),n=e.getState();let r;n==b.LOADING?(this.tileLoadingKeys_[i]=!0,r=go.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==b.ERROR?go.TILELOADERROR:n==b.LOADED?go.TILELOADEND:void 0),r!=null&&this.dispatchEvent(new x0(r,e))}setTileLoadFunction(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),typeof e<"u"?this.setKey(e):this.changed()}setUrl(t){const e=Su(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join(`
40
- `);this.generateTileUrlFunction_?this.setTileUrlFunction(C0(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}useTile(t,e,i){const n=xs(t,e,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}const Tu=Qa;class w0 extends Tu{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:S0,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate!==void 0?t.interpolate:!0,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=t.crossOrigin!==void 0?t.crossOrigin:null,this.tileClass=t.tileClass!==void 0?t.tileClass:pu,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1}expireCache(t,e){const i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(const n in this.tileCacheForProjection){const r=this.tileCacheForProjection[n];r.expireCache(r==i?e:{})}}getGutterForProjection(t){return this.getProjection()&&t&&!Ie(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getOpaque(t){return this.getProjection()&&t&&!Ie(this.getProjection(),t)?!1:super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||Ie(e,t)))return this.tileGrid;const i=D(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=Eu(t)),this.tileGridForProjection[i]}getTileCacheForProjection(t){const e=this.getProjection();if(!e||Ie(e,t))return this.tileCache;const i=D(t);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new Za(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]}createTile_(t,e,i,n,r,o){const a=[t,e,i],l=this.getTileCoordForTileUrlFunction(a,r),h=l?this.tileUrlFunction(l,n,r):void 0,c=new this.tileClass(a,h!==void 0?b.IDLE:b.EMPTY,h!==void 0?h:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(O.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,n,r){const o=this.getProjection();if(!o||!r||Ie(o,r))return this.getTileInternal(t,e,i,n,o||r);const a=this.getTileCacheForProjection(r),l=[t,e,i];let h;const c=mu(l);a.containsKey(c)&&(h=a.get(c));const u=this.getKey();if(h&&h.key==u)return h;const d=this.getTileGridForProjection(o),g=this.getTileGridForProjection(r),p=this.getTileCoordForTileUrlFunction(l,r),f=new Wo(o,d,r,g,l,p,this.getTilePixelRatio(n),this.getGutter(),(_,m,y,v)=>this.getTileInternal(_,m,y,v,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return f.key=u,h?(f.interimTile=h,f.refreshInterimChain(),a.replace(c,f)):a.set(c,f),f}getTileInternal(t,e,i,n,r){let o=null;const a=xs(t,e,i),l=this.getKey();if(!this.tileCache.containsKey(a))o=this.createTile_(t,e,i,n,r,l),this.tileCache.set(a,o);else if(o=this.tileCache.get(a),o.key!=l){const h=o;o=this.createTile_(t,e,i,n,r,l),h.getState()==b.IDLE?o.interimTile=h.interimTile:o.interimTile=h,o.refreshInterimChain(),this.tileCache.replace(a,o)}return o}setRenderReprojectionEdges(t){if(this.renderReprojectionEdges_!=t){this.renderReprojectionEdges_=t;for(const e in this.tileCacheForProjection)this.tileCacheForProjection[e].clear();this.changed()}}setTileGridForProjection(t,e){const i=it(t);if(i){const n=D(i);n in this.tileGridForProjection||(this.tileGridForProjection[n]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}}function S0(s,t){s.getImage().src=t}const tl=w0;class T0 extends tl{constructor(t){t=t||{};const e=t.projection!==void 0?t.projection:"EPSG:3857",i=t.tileGrid!==void 0?t.tileGrid:Ja({extent:Br(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:t.opaque,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0}getGutter(){return this.gutter_}}const Ru=T0;class R0 extends Vc{constructor(t,e,i,n,r,o,a){let l=t.getExtent();l&&t.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);let h=e.getExtent();h&&e.canWrapX()&&(h=h.slice(),h[0]=-1/0,h[2]=1/0);const c=h?Me(i,h):i,u=fe(c),d=nn(t,e,u,n),g=uu,p=new du(t,e,c,l,d*g,n),f=p.calculateSourceExtent(),_=ms(f)?null:o(f,d,r),m=_?G.IDLE:G.EMPTY,y=_?_.getPixelRatio():1;super(i,n,y,m),this.targetProj_=e,this.maxSourceExtent_=l,this.triangulation_=p,this.targetResolution_=n,this.targetExtent_=i,this.sourceImage_=_,this.sourcePixelRatio_=y,this.interpolate_=a,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==G.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_.getState();if(t==G.LOADED){const e=J(this.targetExtent_)/this.targetResolution_,i=_t(this.targetExtent_)/this.targetResolution_;this.canvas_=gu(e,i,this.sourcePixelRatio_,Bo(this.sourceImage_.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:this.sourceImage_.getExtent(),image:this.sourceImage_.getImage()}],0,void 0,this.interpolate_,!0)}this.state=t,this.changed()}load(){if(this.state==G.IDLE){this.state=G.LOADING,this.changed();const t=this.sourceImage_.getState();t==G.LOADED||t==G.ERROR?this.reproject_():(this.sourceListenerKey_=W(this.sourceImage_,O.CHANGE,function(e){const i=this.sourceImage_.getState();(i==G.LOADED||i==G.ERROR)&&(this.unlistenSource_(),this.reproject_())},this),this.sourceImage_.load())}}unlistenSource_(){et(this.sourceListenerKey_),this.sourceListenerKey_=null}}const b0=R0,ti=4,po={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class I0 extends Zt{constructor(t,e){super(t),this.image=e}}class P0 extends Ka{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:t.interpolate!==void 0?t.interpolate:!0}),this.on,this.once,this.un,this.loader=t.loader||null,this.resolutions_=t.resolutions!==void 0?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=t.loader?t.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){const i=Rr(e,t,0);t=e[i]}return t}getImage(t,e,i,n){const r=this.getProjection();if(!r||!n||Ie(r,n))return r&&(n=r),this.getImageInternal(t,e,i,n);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&Ie(this.reprojectedImage_.getProjection(),n)&&this.reprojectedImage_.getResolution()==e&&ri(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new b0(r,n,t,e,i,(o,a,l)=>this.getImageInternal(o,a,l,r),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,n){if(this.loader){const r=bu(t,e,i,1),o=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===n&&(this.wantedExtent_&&Xt(this.wantedExtent_,r)||Xt(this.image.getExtent(),r))&&(this.wantedResolution_&&Bo(this.wantedResolution_)===o||Bo(this.image.getResolution())===o)))return this.image;this.wantedProjection_=n,this.wantedExtent_=r,this.wantedResolution_=o,this.image=new Vc(r,o,i,this.loader),this.image.addEventListener(O.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case G.LOADING:this.loading=!0,i=po.IMAGELOADSTART;break;case G.LOADED:this.loading=!1,i=po.IMAGELOADEND;break;case G.ERROR:this.loading=!1,i=po.IMAGELOADERROR;break;default:return}this.hasListener(i)&&this.dispatchEvent(new I0(i,e))}}function M0(s,t){s.getImage().src=t}function bu(s,t,e,i){const n=t/e,r=fe(s),o=He(J(s)/n,ti),a=He(_t(s)/n,ti),l=He((i-1)*o/2,ti),h=o+2*l,c=He((i-1)*a/2,ti),u=a+2*c;return $s(r,n,0,[h,u])}const L0=P0;function rn(s,t){const e=[];Object.keys(t).forEach(function(n){t[n]!==null&&t[n]!==void 0&&e.push(n+"="+encodeURIComponent(t[n]))});const i=e.join("&");return s=s.replace(/[?&]$/,""),s+=s.includes("?")?"&":"?",s+i}const Cr="1.3.0",gh=[101,101];function Iu(s,t,e,i,n){n.WIDTH=e[0],n.HEIGHT=e[1];const r=i.getAxisOrientation();let o;const a=oa(n.VERSION,"1.3")>=0;return n[a?"CRS":"SRS"]=i.getCode(),a&&r.substr(0,2)=="ne"?o=[t[1],t[0],t[3],t[2]]:o=t,n.BBOX=o.join(","),rn(s,n)}function Pu(s,t,e,i,n,r,o){r=Object.assign({REQUEST:"GetMap"},r);const a=t/e,l=[Rl(J(s)/a,ti),Rl(_t(s)/a,ti)];if(e!=1)switch(o){case"geoserver":const h=90*e+.5|0;"FORMAT_OPTIONS"in r?r.FORMAT_OPTIONS+=";dpi:"+h:r.FORMAT_OPTIONS="dpi:"+h;break;case"mapserver":r.MAP_RESOLUTION=90*e;break;case"carmentaserver":case"qgis":r.DPI=90*e;break;default:throw new Error("Unknown `serverType` configured")}return Iu(n,s,l,i,r)}function wr(s,t){return Object.assign({REQUEST:t,SERVICE:"WMS",VERSION:Cr,FORMAT:"image/png",STYLES:"",TRANSPARENT:!0},s)}function A0(s){const t=s.hidpi===void 0?!0:s.hidpi,e=it(s.projection||"EPSG:3857"),i=s.ratio||1.5,n=s.load||Wc;return(r,o,a)=>{r=bu(r,o,a,i),a!=1&&(!t||s.serverType===void 0)&&(a=1);const l=Pu(r,o,a,e,s.url,wr(s.params,"GetMap"),s.serverType),h=new Image;return s.crossOrigin!==null&&(h.crossOrigin=s.crossOrigin),n(h,l).then(c=>({image:c,extent:r,pixelRatio:a}))}}function F0(s,t,e){if(s.url===void 0)return;const i=it(s.projection||"EPSG:3857"),n=$s(t,e,0,gh),r={QUERY_LAYERS:s.params.LAYERS,INFO_FORMAT:"application/json"};Object.assign(r,wr(s.params,"GetFeatureInfo"),s.params);const o=$i((t[0]-n[0])/e,ti),a=$i((n[3]-t[1])/e,ti),l=oa(r.VERSION,"1.3")>=0;return r[l?"I":"X"]=o,r[l?"J":"Y"]=a,Iu(s.url,n,gh,i,r)}function O0(s,t){if(s.url===void 0)return;const e={SERVICE:"WMS",VERSION:Cr,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(s.params===void 0||s.params.LAYER===void 0){const i=s.params.LAYERS;if(!(!Array.isArray(i)||i.length===1))return;e.LAYER=i}if(t!==void 0){const i=it(s.projection||"EPSG:3857").getMetersPerUnit()||1,n=28e-5;e.SCALE=t*i/n}return Object.assign(e,s.params),rn(s.url,e)}class D0 extends L0{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=t.crossOrigin!==void 0?t.crossOrigin:null,this.url_=t.url,this.imageLoadFunction_=t.imageLoadFunction!==void 0?t.imageLoadFunction:M0,this.params_=t.params,this.serverType_=t.serverType,this.hidpi_=t.hidpi!==void 0?t.hidpi:!0,this.renderedRevision_=0,this.ratio_=t.ratio!==void 0?t.ratio:1.5,this.loaderProjection_=null}getFeatureInfoUrl(t,e,i,n){const r=it(i),o=this.getProjection();o&&o!==r&&(e=nn(o,r,t,e),t=Ar(t,r,o));const a={url:this.url_,params:{...this.params_,...n},projection:o||r};return F0(a,t,e)}getLegendUrl(t,e){return O0({url:this.url_,params:{...this.params_,...e}},t)}getParams(){return this.params_}getImageInternal(t,e,i,n){return this.url_===void 0?null:((!this.loader||this.loaderProjection_!==n)&&(this.loaderProjection_=n,this.loader=A0({crossOrigin:this.crossOrigin_,params:this.params_,projection:n,serverType:this.serverType_,hidpi:this.hidpi_,url:this.url_,ratio:this.ratio_,load:(r,o)=>(this.image.setImage(r),this.imageLoadFunction_(this.image,o),Wc(r))})),super.getImageInternal(t,e,i,n))}getImageLoadFunction(){return this.imageLoadFunction_}getUrl(){return this.url_}setImageLoadFunction(t){this.imageLoadFunction_=t,this.changed()}setUrl(t){t!=this.url_&&(this.url_=t,this.loader=null,this.changed())}updateParams(t){Object.assign(this.params_,t),this.changed()}changed(){this.image=null,super.changed()}}const k0=D0;let N0=class extends Wr{constructor(s,t,e,i,n,r){super(s,t,r),this.extent=null,this.format_=i,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=n,this.url_=e,this.key=e}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==b.IDLE&&(this.setState(b.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(s,t){this.setFeatures(s)}onError(){this.setState(b.ERROR)}setFeatures(s){this.features_=s,this.setState(b.LOADED)}setLoader(s){this.loader_=s}};const G0=N0,ph=[];class j0 extends Wr{constructor(t,e,i,n){super(t,e,{transition:0}),this.context_={},this.executorGroups={},this.declutterExecutorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.wrappedTileCoord=i}getContext(t){const e=D(t);return e in this.context_||(this.context_[e]=St(1,1,ph)),this.context_[e]}hasContext(t){return D(t)in this.context_}getImage(t){return this.hasContext(t)?this.getContext(t).canvas:null}getReplayState(t){const e=D(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){for(const t in this.context_){const e=this.context_[t];_n(e),ph.push(e.canvas),delete this.context_[t]}super.release()}}const V0=j0;class z0 extends Tu{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||Br(e),n=t.tileGrid||Ja({extent:i,maxResolution:t.maxResolution,maxZoom:t.maxZoom!==void 0?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,opaque:!1,projection:e,state:t.state,tileGrid:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:B0,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX===void 0?!0:t.wrapX,transition:t.transition,zDirection:t.zDirection===void 0?1:t.zDirection}),this.format_=t.format?t.format:null,this.sourceTileCache=new Za(this.tileCache.highWaterMark),this.overlaps_=t.overlaps==null?!0:t.overlaps,this.tileClass=t.tileClass?t.tileClass:G0,this.tileGrids_={}}getFeaturesInExtent(t){const e=[],i=this.tileCache;if(i.getCount()===0)return e;const n=yu(i.peekFirstKey())[0],r=this.tileGrid;return i.forEach(function(o){if(o.tileCoord[0]!==n||o.getState()!==b.LOADED)return;const a=o.getSourceTiles();for(let l=0,h=a.length;l<h;++l){const c=a[l],u=c.tileCoord;if(ht(t,r.getTileCoordExtent(u))){const d=c.getFeatures();if(d)for(let g=0,p=d.length;g<p;++g){const f=d[g],_=f.getGeometry();ht(t,_.getExtent())&&e.push(f)}}}}),e}getOverlaps(){return this.overlaps_}clear(){this.tileCache.clear(),this.sourceTileCache.clear()}expireCache(t,e){const i=this.getTileCacheForProjection(t),n=Object.keys(e).reduce((r,o)=>{const a=Hm(o),l=i.peek(a);if(l){const h=l.sourceTiles;for(let c=0,u=h.length;c<u;++c)r[h[c].getKey()]=!0}return r},{});super.expireCache(t,e),this.sourceTileCache.expireCache(n)}getSourceTiles(t,e,i){if(i.getState()===b.IDLE){i.setState(b.LOADING);const n=i.wrappedTileCoord,r=this.getTileGridForProjection(e),o=r.getTileCoordExtent(n),a=n[0],l=r.getResolution(a);Kt(o,-l,o);const h=this.tileGrid,c=h.getExtent();c&&Me(o,c,o);const u=h.getZForResolution(l,this.zDirection);h.forEachTileCoord(o,u,d=>{const g=this.tileUrlFunction(d,t,e),p=this.sourceTileCache.containsKey(g)?this.sourceTileCache.get(g):new this.tileClass(d,g?b.IDLE:b.EMPTY,g,this.format_,this.tileLoadFunction);i.sourceTiles.push(p);const f=p.getState();if(f<b.LOADED){const _=m=>{this.handleTileChange(m);const y=p.getState();if(y===b.LOADED||y===b.ERROR){const v=p.getKey();v in i.errorTileKeys?p.getState()===b.LOADED&&delete i.errorTileKeys[v]:i.loadingSourceTiles--,y===b.ERROR?i.errorTileKeys[v]=!0:p.removeEventListener(O.CHANGE,_),i.loadingSourceTiles===0&&i.setState(si(i.errorTileKeys)?b.LOADED:b.ERROR)}};p.addEventListener(O.CHANGE,_),i.loadingSourceTiles++}f===b.IDLE&&(p.extent=h.getTileCoordExtent(d),p.projection=e,p.resolution=h.getResolution(d[0]),this.sourceTileCache.set(g,p),p.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(d=>d.getState()===b.ERROR)?b.ERROR:b.LOADED)}return i.sourceTiles}getTile(t,e,i,n,r){const o=xs(t,e,i),a=this.getKey();let l;if(this.tileCache.containsKey(o)&&(l=this.tileCache.get(o),l.key===a))return l;const h=[t,e,i];let c=this.getTileCoordForTileUrlFunction(h,r);const u=this.getTileGrid().getExtent(),d=this.getTileGridForProjection(r);if(c&&u){const f=d.getTileCoordExtent(c);Kt(f,-d.getResolution(t),f),ht(u,f)||(c=null)}let g=!0;if(c!==null){const f=this.tileGrid,_=d.getResolution(t),m=f.getZForResolution(_,1),y=d.getTileCoordExtent(c);Kt(y,-_,y),f.forEachTileCoord(y,m,v=>{g=g&&!this.tileUrlFunction(v,n,r)})}const p=new V0(h,g?b.EMPTY:b.IDLE,c,this.getSourceTiles.bind(this,n,r));return p.key=a,l?(p.interimTile=l,p.refreshInterimChain(),this.tileCache.replace(o,p)):this.tileCache.set(o,p),p}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const n=this.tileGrid,r=n.getResolutions().slice(),o=r.map(function(h,c){return n.getOrigin(c)}),a=r.map(function(h,c){return n.getTileSize(c)}),l=Hh+1;for(let h=r.length;h<l;++h)r.push(r[h-1]/2),o.push(o[h-1]),a.push(a[h-1]);i=new qa({extent:n.getExtent(),origins:o,resolutions:r,tileSizes:a}),this.tileGrids_[e]=i}return i}getTilePixelRatio(t){return t}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=bt(n.getTileSize(t),this.tmpSize);return[Math.round(r[0]*e),Math.round(r[1]*e)]}updateCacheSize(t,e){super.updateCacheSize(t*2,e),this.sourceTileCache.highWaterMark=this.getTileCacheForProjection(e).highWaterMark}}const W0=z0;function B0(s,t){s.setLoader(function(e,i,n){cu(t,s.getFormat(),e,i,n,s.onLoad.bind(s),s.onError.bind(s))})}const U0='&#169; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';class $0 extends Ru{constructor(t){t=t||{};let e;t.attributions!==void 0?e=t.attributions:e=[U0];const i=t.crossOrigin!==void 0?t.crossOrigin:"anonymous",n=t.url!==void 0?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:i,interpolate:t.interpolate,maxZoom:t.maxZoom!==void 0?t.maxZoom:19,opaque:t.opaque!==void 0?t.opaque:!0,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:n,wrapX:t.wrapX,zDirection:t.zDirection})}}const X0=$0;class Y0 extends tl{constructor(t){t=t||{};const e=Object.assign({},t.params),i="TRANSPARENT"in e?e.TRANSPARENT:!0;super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:!i,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:t.wrapX!==void 0?t.wrapX:!0,transition:t.transition,zDirection:t.zDirection}),this.gutter_=t.gutter!==void 0?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=t.hidpi!==void 0?t.hidpi:!0,this.tmpExtent_=Vt(),this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,i,n){const r=it(i),o=this.getProjection()||r;let a=this.getTileGrid();a||(a=this.getTileGridForProjection(o));const l=Ar(t,r,o),h=nn(o,r,t,e),c=a.getZForResolution(h,this.zDirection),u=a.getResolution(c),d=a.getTileCoordForCoordAndZ(l,c);if(a.getResolutions().length<=d[0])return;let g=a.getTileCoordExtent(d,this.tmpExtent_);const p=this.gutter_;p!==0&&(g=Kt(g,u*p,g));const f={QUERY_LAYERS:this.params_.LAYERS};Object.assign(f,wr(this.params_,"GetFeatureInfo"),n);const _=Math.floor((l[0]-g[0])/u),m=Math.floor((g[3]-l[1])/u);return f[this.v13_?"I":"X"]=_,f[this.v13_?"J":"Y"]=m,this.getRequestUrl_(d,g,1,o||r,f)}getLegendUrl(t,e){if(this.urls[0]===void 0)return;const i={SERVICE:"WMS",VERSION:Cr,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(e===void 0||e.LAYER===void 0){const n=this.params_.LAYERS;if(!(!Array.isArray(n)||n.length===1))return;i.LAYER=n}if(t!==void 0){const n=this.getProjection()?this.getProjection().getMetersPerUnit():1,r=28e-5;i.SCALE=t*n/r}return Object.assign(i,e),rn(this.urls[0],i)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,i,n,r){const o=this.urls;if(!o)return;let a;if(o.length==1)a=o[0];else{const l=xi(vu(t),o.length);a=o[l]}return Pu(e,(this.tileGrid||this.getTileGridForProjection(n)).getResolution(t[0]),i,n,a,r,this.serverType_)}getTilePixelRatio(t){return!this.hidpi_||this.serverType_===void 0?1:t}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}updateParams(t){Object.assign(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())}updateV13_(){const t=this.params_.VERSION||Cr;this.v13_=oa(t,"1.3")>=0}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;e!=1&&(!this.hidpi_||this.serverType_===void 0)&&(e=1);const r=n.getResolution(t[0]);let o=n.getTileCoordExtent(t,this.tmpExtent_);const a=this.gutter_;a!==0&&(o=Kt(o,r*a,o));const l=Object.assign({},wr(this.params_,"GetMap"));return this.getRequestUrl_(t,o,e,i,l)}}const K0=Y0;class H0 extends tl{constructor(t){const e=t.requestEncoding!==void 0?t.requestEncoding:"KVP",i=t.tileGrid;let n=t.urls;n===void 0&&t.url!==void 0&&(n=Su(t.url)),super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,urls:n,wrapX:t.wrapX!==void 0?t.wrapX:!1,transition:t.transition,zDirection:t.zDirection}),this.version_=t.version!==void 0?t.version:"1.0.0",this.format_=t.format!==void 0?t.format:"image/jpeg",this.dimensions_=t.dimensions!==void 0?t.dimensions:{},this.layer_=t.layer,this.matrixSet_=t.matrixSet,this.style_=t.style,this.requestEncoding_=e,this.setKey(this.getKeyForDimensions_()),n&&n.length>0&&(this.tileUrlFunction=Uo(n.map(this.createFromWMTSTemplate.bind(this))))}setUrls(t){this.urls=t;const e=t.join(`
41
- `);this.setTileUrlFunction(Uo(t.map(this.createFromWMTSTemplate.bind(this))),e)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){const t=this.urls?this.urls.slice(0):[];for(const e in this.dimensions_)t.push(e+"-"+this.dimensions_[e]);return t.join("/")}updateDimensions(t){Object.assign(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(t){const e=this.requestEncoding_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};e=="KVP"&&Object.assign(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t=e=="KVP"?rn(t,i):t.replace(/\{(\w+?)\}/g,function(o,a){return a.toLowerCase()in i?i[a.toLowerCase()]:o});const n=this.tileGrid,r=this.dimensions_;return function(o,a,l){if(!o)return;const h={TileMatrix:n.getMatrixId(o[0]),TileCol:o[1],TileRow:o[2]};Object.assign(h,r);let c=t;return e=="KVP"?c=rn(c,h):c=c.replace(/\{(\w+?)\}/g,function(u,d){return h[d]}),c}}}const Z0=H0,xt={ELEMENT:"element",MAP:"map",OFFSET:"offset",POSITION:"position",POSITIONING:"positioning"};class q0 extends se{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=t.insertFirst!==void 0?t.insertFirst:!0,this.stopEvent=t.stopEvent!==void 0?t.stopEvent:!0,this.element=document.createElement("div"),this.element.className=t.className!==void 0?t.className:"ol-overlay-container "+Xg,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=t.autoPan===!0?{}:t.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(xt.ELEMENT,this.handleElementChanged),this.addChangeListener(xt.MAP,this.handleMapChanged),this.addChangeListener(xt.OFFSET,this.handleOffsetChanged),this.addChangeListener(xt.POSITION,this.handlePositionChanged),this.addChangeListener(xt.POSITIONING,this.handlePositioningChanged),t.element!==void 0&&this.setElement(t.element),this.setOffset(t.offset!==void 0?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),t.position!==void 0&&this.setPosition(t.position)}getElement(){return this.get(xt.ELEMENT)}getId(){return this.id}getMap(){return this.get(xt.MAP)||null}getOffset(){return this.get(xt.OFFSET)}getPosition(){return this.get(xt.POSITION)}getPositioning(){return this.get(xt.POSITIONING)}handleElementChanged(){_c(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(ar(this.element),et(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=W(t,ae.POSTRENDER,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(xt.ELEMENT,t)}setMap(t){this.set(xt.MAP,t)}setOffset(t){this.set(xt.OFFSET,t)}setPosition(t){this.set(xt.POSITION,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(xt.POSITION))return;const i=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),r=this.getRect(n,[Kg(n),Hg(n)]);t=t||{};const o=t.margin===void 0?20:t.margin;if(!Xt(i,r)){const a=r[0]-i[0],l=i[2]-r[2],h=r[1]-i[1],c=i[3]-r[3],u=[0,0];if(a<0?u[0]=a-o:l<0&&(u[0]=Math.abs(l)+o),h<0?u[1]=h-o:c<0&&(u[1]=Math.abs(c)+o),u[0]!==0||u[1]!==0){const d=e.getView().getCenterInternal(),g=e.getPixelFromCoordinateInternal(d);if(!g)return;const p=[g[0]+u[0],g[1]+u[1]],f=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(p),duration:f.duration,easing:f.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),n=i.left+window.pageXOffset,r=i.top+window.pageYOffset;return[n,r,n+e[0],r+e[1]]}setPositioning(t){this.set(xt.POSITIONING,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e){this.setVisible(!1);return}const i=t.getPixelFromCoordinate(e),n=t.getSize();this.updateRenderedPosition(i,n)}updateRenderedPosition(t,e){const i=this.element.style,n=this.getOffset(),r=this.getPositioning();this.setVisible(!0);const o=Math.round(t[0]+n[0])+"px",a=Math.round(t[1]+n[1])+"px";let l="0%",h="0%";r=="bottom-right"||r=="center-right"||r=="top-right"?l="-100%":(r=="bottom-center"||r=="center-center"||r=="top-center")&&(l="-50%"),r=="bottom-left"||r=="bottom-center"||r=="bottom-right"?h="-100%":(r=="center-left"||r=="center-center"||r=="center-right")&&(h="-50%");const c=`translate(${l}, ${h}) translate(${o}, ${a})`;this.rendered.transform_!=c&&(this.rendered.transform_=c,i.transform=c)}getOptions(){return this.options}}const Mu=q0,fh=0,Vs=1,_h=[0,0,0,0],ts=[],fo={MODIFYSTART:"modifystart",MODIFYEND:"modifyend"};class _o extends Zt{constructor(t,e,i){super(t),this.features=e,this.mapBrowserEvent=i}}class J0 extends Ii{constructor(t){super(t),this.on,this.once,this.un,this.boundHandleFeatureChange_=this.handleFeatureChange_.bind(this),this.condition_=t.condition?t.condition:bc,this.defaultDeleteCondition_=function(i){return Cp(i)&&Rp(i)},this.deleteCondition_=t.deleteCondition?t.deleteCondition:this.defaultDeleteCondition_,this.insertVertexCondition_=t.insertVertexCondition?t.insertVertexCondition:cr,this.vertexFeature_=null,this.vertexSegments_=null,this.lastPixel_=[0,0],this.ignoreNextSingleClick_=!1,this.featuresBeingModified_=null,this.rBush_=new zo,this.pixelTolerance_=t.pixelTolerance!==void 0?t.pixelTolerance:10,this.snappedToVertex_=!1,this.changingFeature_=!1,this.dragSegments_=[],this.overlay_=new Ya({source:new Ha({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.style?t.style:ty(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.SEGMENT_WRITERS_={Point:this.writePointGeometry_.bind(this),LineString:this.writeLineStringGeometry_.bind(this),LinearRing:this.writeLineStringGeometry_.bind(this),Polygon:this.writePolygonGeometry_.bind(this),MultiPoint:this.writeMultiPointGeometry_.bind(this),MultiLineString:this.writeMultiLineStringGeometry_.bind(this),MultiPolygon:this.writeMultiPolygonGeometry_.bind(this),Circle:this.writeCircleGeometry_.bind(this),GeometryCollection:this.writeGeometryCollectionGeometry_.bind(this)},this.source_=null,this.hitDetection_=null;let e;if(t.features?e=t.features:t.source&&(this.source_=t.source,e=new Rt(this.source_.getFeatures()),this.source_.addEventListener(Nt.ADDFEATURE,this.handleSourceAdd_.bind(this)),this.source_.addEventListener(Nt.REMOVEFEATURE,this.handleSourceRemove_.bind(this))),!e)throw new Error("The modify interaction requires features, a source or a layer");t.hitDetection&&(this.hitDetection_=t.hitDetection),this.features_=e,this.features_.forEach(this.addFeature_.bind(this)),this.features_.addEventListener(Et.ADD,this.handleFeatureAdd_.bind(this)),this.features_.addEventListener(Et.REMOVE,this.handleFeatureRemove_.bind(this)),this.lastPointerEvent_=null,this.delta_=[0,0],this.snapToPointer_=t.snapToPointer===void 0?!this.hitDetection_:t.snapToPointer}addFeature_(t){const e=t.getGeometry();if(e){const n=this.SEGMENT_WRITERS_[e.getType()];n&&n(t,e)}const i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,i),t.addEventListener(O.CHANGE,this.boundHandleFeatureChange_)}willModifyFeatures_(t,e){if(!this.featuresBeingModified_){this.featuresBeingModified_=new Rt;const i=this.featuresBeingModified_.getArray();for(let n=0,r=e.length;n<r;++n){const o=e[n];for(let a=0,l=o.length;a<l;++a){const h=o[a].feature;h&&!i.includes(h)&&this.featuresBeingModified_.push(h)}}this.featuresBeingModified_.getLength()===0?this.featuresBeingModified_=null:this.dispatchEvent(new _o(fo.MODIFYSTART,this.featuresBeingModified_,t))}}removeFeature_(t){this.removeFeatureSegmentData_(t),this.vertexFeature_&&this.features_.getLength()===0&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.removeEventListener(O.CHANGE,this.boundHandleFeatureChange_)}removeFeatureSegmentData_(t){const e=this.rBush_,i=[];e.forEach(function(n){t===n.feature&&i.push(n)});for(let n=i.length-1;n>=0;--n){const r=i[n];for(let o=this.dragSegments_.length-1;o>=0;--o)this.dragSegments_[o][0]===r&&this.dragSegments_.splice(o,1);e.remove(r)}}setActive(t){this.vertexFeature_&&!t&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(t)}setMap(t){this.overlay_.setMap(t),super.setMap(t)}getOverlay(){return this.overlay_}handleSourceAdd_(t){t.feature&&this.features_.push(t.feature)}handleSourceRemove_(t){t.feature&&this.features_.remove(t.feature)}handleFeatureAdd_(t){this.addFeature_(t.element)}handleFeatureChange_(t){if(!this.changingFeature_){const e=t.target;this.removeFeature_(e),this.addFeature_(e)}}handleFeatureRemove_(t){this.removeFeature_(t.element)}writePointGeometry_(t,e){const i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),n)}writeMultiPointGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n],a={feature:t,geometry:e,depth:[n],index:n,segment:[o,o]};this.rBush_.insert(e.getExtent(),a)}}writeLineStringGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length-1;n<r;++n){const o=i.slice(n,n+2),a={feature:t,geometry:e,index:n,segment:o};this.rBush_.insert(Lt(o),a)}}writeMultiLineStringGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length-1;a<l;++a){const h=o.slice(a,a+2),c={feature:t,geometry:e,depth:[n],index:a,segment:h};this.rBush_.insert(Lt(h),c)}}}writePolygonGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length-1;a<l;++a){const h=o.slice(a,a+2),c={feature:t,geometry:e,depth:[n],index:a,segment:h};this.rBush_.insert(Lt(h),c)}}}writeMultiPolygonGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length;a<l;++a){const h=o[a];for(let c=0,u=h.length-1;c<u;++c){const d=h.slice(c,c+2),g={feature:t,geometry:e,depth:[a,n],index:c,segment:d};this.rBush_.insert(Lt(d),g)}}}}writeCircleGeometry_(t,e){const i=e.getCenter(),n={feature:t,geometry:e,index:fh,segment:[i,i]},r={feature:t,geometry:e,index:Vs,segment:[i,i]},o=[n,r];n.featureSegments=o,r.featureSegments=o,this.rBush_.insert(ks(i),n);let a=e;this.rBush_.insert(a.getExtent(),r)}writeGeometryCollectionGeometry_(t,e){const i=e.getGeometriesArray();for(let n=0;n<i.length;++n){const r=i[n],o=this.SEGMENT_WRITERS_[r.getType()];o(t,r)}}createOrUpdateVertexFeature_(t,e,i){let n=this.vertexFeature_;return n?n.getGeometry().setCoordinates(t):(n=new Pe(new ge(t)),this.vertexFeature_=n,this.overlay_.getSource().addFeature(n)),n.set("features",e),n.set("geometries",i),n}handleEvent(t){if(!t.originalEvent)return!0;this.lastPointerEvent_=t;let e;return!t.map.getView().getInteracting()&&t.type==Y.POINTERMOVE&&!this.handlingDownUpSequence&&this.handlePointerMove_(t),this.vertexFeature_&&this.deleteCondition_(t)&&(t.type!=Y.SINGLECLICK||!this.ignoreNextSingleClick_?e=this.removePoint():e=!0),t.type==Y.SINGLECLICK&&(this.ignoreNextSingleClick_=!1),super.handleEvent(t)&&!e}handleDragEvent(t){this.ignoreNextSingleClick_=!1,this.willModifyFeatures_(t,this.dragSegments_);const e=[t.coordinate[0]+this.delta_[0],t.coordinate[1]+this.delta_[1]],i=[],n=[];for(let r=0,o=this.dragSegments_.length;r<o;++r){const a=this.dragSegments_[r],l=a[0],h=l.feature;i.includes(h)||i.push(h);const c=l.geometry;n.includes(c)||n.push(c);const u=l.depth;let d;const g=l.segment,p=a[1];for(;e.length<c.getStride();)e.push(g[p][e.length]);switch(c.getType()){case"Point":d=e,g[0]=e,g[1]=e;break;case"MultiPoint":d=c.getCoordinates(),d[l.index]=e,g[0]=e,g[1]=e;break;case"LineString":d=c.getCoordinates(),d[l.index+p]=e,g[p]=e;break;case"MultiLineString":d=c.getCoordinates(),d[u[0]][l.index+p]=e,g[p]=e;break;case"Polygon":d=c.getCoordinates(),d[u[0]][l.index+p]=e,g[p]=e;break;case"MultiPolygon":d=c.getCoordinates(),d[u[1]][u[0]][l.index+p]=e,g[p]=e;break;case"Circle":if(g[0]=e,g[1]=e,l.index===fh)this.changingFeature_=!0,c.setCenter(e),this.changingFeature_=!1;else{this.changingFeature_=!0,t.map.getView().getProjection();let f=tr(lt(c.getCenter()),lt(e));c.setRadius(f),this.changingFeature_=!1}break}d&&this.setGeometryCoordinates_(c,d)}this.createOrUpdateVertexFeature_(e,i,n)}handleDownEvent(t){if(!this.condition_(t))return!1;const e=t.coordinate;this.handlePointerAtPixel_(t.pixel,t.map,e),this.dragSegments_.length=0,this.featuresBeingModified_=null;const i=this.vertexFeature_;if(i){t.map.getView().getProjection();const n=[],r=i.getGeometry().getCoordinates(),o=Lt([r]),a=this.rBush_.getInExtent(o),l={};a.sort(Q0);for(let h=0,c=a.length;h<c;++h){const u=a[h],d=u.segment;let g=D(u.geometry);const p=u.depth;if(p&&(g+="-"+p.join("-")),l[g]||(l[g]=new Array(2)),u.geometry.getType()==="Circle"&&u.index===Vs){const f=yh(e,u);$t(f,r)&&!l[g][0]&&(this.dragSegments_.push([u,0]),l[g][0]=u);continue}if($t(d[0],r)&&!l[g][0]){this.dragSegments_.push([u,0]),l[g][0]=u;continue}if($t(d[1],r)&&!l[g][1]){if(l[g][0]&&l[g][0].index===0){let f=u.geometry.getCoordinates();switch(u.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":f=f[p[1]];case"Polygon":if(u.index!==f[p[0]].length-2)continue;break}}this.dragSegments_.push([u,1]),l[g][1]=u;continue}D(d)in this.vertexSegments_&&!l[g][0]&&!l[g][1]&&this.insertVertexCondition_(t)&&n.push(u)}n.length&&this.willModifyFeatures_(t,[n]);for(let h=n.length-1;h>=0;--h)this.insertVertex_(n[h],r)}return!!this.vertexFeature_}handleUpEvent(t){for(let e=this.dragSegments_.length-1;e>=0;--e){const i=this.dragSegments_[e][0],n=i.geometry;if(n.getType()==="Circle"){const r=n.getCenter(),o=i.featureSegments[0],a=i.featureSegments[1];o.segment[0]=r,o.segment[1]=r,a.segment[0]=r,a.segment[1]=r,this.rBush_.update(ks(r),o);let l=n;this.rBush_.update(l.getExtent(),a)}else this.rBush_.update(Lt(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new _o(fo.MODIFYEND,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1}handlePointerMove_(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)}handlePointerAtPixel_(t,e,i){const n=i||e.getCoordinateFromPixel(t);e.getView().getProjection();const r=function(l,h){return mh(n,l)-mh(n,h)};let o,a;if(this.hitDetection_){const l=typeof this.hitDetection_=="object"?h=>h===this.hitDetection_:void 0;e.forEachFeatureAtPixel(t,(h,c,u)=>{u&&u.getType()==="Point"&&(u=new ge(hs(u.getCoordinates())));const d=u||h.getGeometry();if(h instanceof Pe&&this.features_.getArray().includes(h)){a=d;const g=h.getGeometry().getFlatCoordinates().slice(0,2);o=[{feature:h,geometry:a,segment:[g,g]}]}return!0},{layerFilter:l})}if(!o){const l=he(ks(n,_h)),h=e.getView().getResolution()*this.pixelTolerance_,c=da(Kt(l,h,_h));o=this.rBush_.getInExtent(c)}if(o&&o.length>0){const l=o.sort(r)[0],h=l.segment;let c=yh(n,l);const u=e.getPixelFromCoordinate(c);let d=tr(t,u);if(a||d<=this.pixelTolerance_){const g={};if(g[D(h)]=!0,this.snapToPointer_||(this.delta_[0]=c[0]-n[0],this.delta_[1]=c[1]-n[1]),l.geometry.getType()==="Circle"&&l.index===Vs)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(c,[l.feature],[l.geometry]);else{const p=e.getPixelFromCoordinate(h[0]),f=e.getPixelFromCoordinate(h[1]),_=ls(u,p),m=ls(u,f);d=Math.sqrt(Math.min(_,m)),this.snappedToVertex_=d<=this.pixelTolerance_,this.snappedToVertex_&&(c=_>m?h[1]:h[0]),this.createOrUpdateVertexFeature_(c,[l.feature],[l.geometry]);const y={};y[D(l.geometry)]=!0;for(let v=1,x=o.length;v<x;++v){const E=o[v].segment;if($t(h[0],E[0])&&$t(h[1],E[1])||$t(h[0],E[1])&&$t(h[1],E[0])){const C=D(o[v].geometry);C in y||(y[C]=!0,g[D(E)]=!0)}else break}}this.vertexSegments_=g;return}}this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null)}insertVertex_(t,e){const i=t.segment,n=t.feature,r=t.geometry,o=t.depth,a=t.index;let l;for(;e.length<r.getStride();)e.push(0);switch(r.getType()){case"MultiLineString":l=r.getCoordinates(),l[o[0]].splice(a+1,0,e);break;case"Polygon":l=r.getCoordinates(),l[o[0]].splice(a+1,0,e);break;case"MultiPolygon":l=r.getCoordinates(),l[o[1]][o[0]].splice(a+1,0,e);break;case"LineString":l=r.getCoordinates(),l.splice(a+1,0,e);break;default:return}this.setGeometryCoordinates_(r,l);const h=this.rBush_;h.remove(t),this.updateSegmentIndices_(r,a,o,1);const c={segment:[i[0],e],feature:n,geometry:r,depth:o,index:a};h.insert(Lt(c.segment),c),this.dragSegments_.push([c,1]);const u={segment:[e,i[1]],feature:n,geometry:r,depth:o,index:a+1};h.insert(Lt(u.segment),u),this.dragSegments_.push([u,0]),this.ignoreNextSingleClick_=!0}removePoint(){if(this.lastPointerEvent_&&this.lastPointerEvent_.type!=Y.POINTERDRAG){const t=this.lastPointerEvent_;this.willModifyFeatures_(t,this.dragSegments_);const e=this.removeVertex_();return this.featuresBeingModified_&&this.dispatchEvent(new _o(fo.MODIFYEND,this.featuresBeingModified_,t)),this.featuresBeingModified_=null,e}return!1}removeVertex_(){const t=this.dragSegments_,e={};let i=!1,n,r,o,a,l,h,c,u,d,g,p;for(l=t.length-1;l>=0;--l)o=t[l],g=o[0],p=D(g.feature),g.depth&&(p+="-"+g.depth.join("-")),p in e||(e[p]={}),o[1]===0?(e[p].right=g,e[p].index=g.index):o[1]==1&&(e[p].left=g,e[p].index=g.index+1);for(p in e){switch(d=e[p].right,c=e[p].left,h=e[p].index,u=h-1,c!==void 0?g=c:g=d,u<0&&(u=0),a=g.geometry,r=a.getCoordinates(),n=r,i=!1,a.getType()){case"MultiLineString":r[g.depth[0]].length>2&&(r[g.depth[0]].splice(h,1),i=!0);break;case"LineString":r.length>2&&(r.splice(h,1),i=!0);break;case"MultiPolygon":n=n[g.depth[1]];case"Polygon":n=n[g.depth[0]],n.length>4&&(h==n.length-1&&(h=0),n.splice(h,1),i=!0,h===0&&(n.pop(),n.push(n[0]),u=n.length-1));break}if(i){this.setGeometryCoordinates_(a,r);const f=[];if(c!==void 0&&(this.rBush_.remove(c),f.push(c.segment[0])),d!==void 0&&(this.rBush_.remove(d),f.push(d.segment[1])),c!==void 0&&d!==void 0){const _={depth:g.depth,feature:g.feature,geometry:g.geometry,index:u,segment:f};this.rBush_.insert(Lt(_.segment),_)}this.updateSegmentIndices_(a,h,g.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.length=0}}return i}setGeometryCoordinates_(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1}updateSegmentIndices_(t,e,i,n){this.rBush_.forEachInExtent(t.getExtent(),function(r){r.geometry===t&&(i===void 0||r.depth===void 0||Ge(r.depth,i))&&r.index>e&&(r.index+=n)})}}function Q0(s,t){return s.index-t.index}function mh(s,t,e){const i=t.geometry;if(i.getType()==="Circle"){let r=i;if(t.index===Vs){const o=ls(r.getCenter(),lt(s)),a=Math.sqrt(o)-r.getRadius();return a*a}}const n=lt(s);return ts[0]=lt(t.segment[0]),ts[1]=lt(t.segment[1]),ag(n,ts)}function yh(s,t,e){const i=t.geometry;if(i.getType()==="Circle"&&t.index===Vs)return hs(i.getClosestPoint(lt(s)));const n=lt(s);return ts[0]=lt(t.segment[0]),ts[1]=lt(t.segment[1]),hs(Zh(n,ts))}function ty(){const s=$c();return function(t,e){return s.Point}}const ey=J0,zn={DRAWSTART:"drawstart",DRAWEND:"drawend",DRAWABORT:"drawabort"};class Wn extends Zt{constructor(t,e){super(t),this.feature=e}}function iy(s,t){const e=[];for(let i=0;i<t.length;++i){const n=t[i].getGeometry();Lu(s,n,e)}return e}function Bn(s,t){return Le(s[0],s[1],t[0],t[1])}function Ki(s,t){const e=s.length;return t<0?s[t+e]:t>=e?s[t-e]:s[t]}function Un(s,t,e){let i,n;t<e?(i=t,n=e):(i=e,n=t);const r=Math.ceil(i),o=Math.floor(n);if(r>o){const l=Hi(s,i),h=Hi(s,n);return Bn(l,h)}let a=0;if(i<r){const l=Hi(s,i),h=Ki(s,r);a+=Bn(l,h)}if(o<n){const l=Ki(s,o),h=Hi(s,n);a+=Bn(l,h)}for(let l=r;l<o-1;++l){const h=Ki(s,l),c=Ki(s,l+1);a+=Bn(h,c)}return a}function Lu(s,t,e){if(t instanceof Oe){$n(s,t.getCoordinates(),!1,e);return}if(t instanceof kr){const i=t.getCoordinates();for(let n=0,r=i.length;n<r;++n)$n(s,i[n],!1,e);return}if(t instanceof zt){const i=t.getCoordinates();for(let n=0,r=i.length;n<r;++n)$n(s,i[n],!0,e);return}if(t instanceof Gr){const i=t.getCoordinates();for(let n=0,r=i.length;n<r;++n){const o=i[n];for(let a=0,l=o.length;a<l;++a)$n(s,o[a],!0,e)}return}if(t instanceof Fc){const i=t.getGeometries();for(let n=0;n<i.length;++n)Lu(s,i[n],e);return}}const mo={index:-1,endIndex:NaN};function sy(s,t,e,i){const n=s[0],r=s[1];let o=1/0,a=-1,l=NaN;for(let u=0;u<t.targets.length;++u){const d=t.targets[u],g=d.coordinates;let p=1/0,f;for(let _=0;_<g.length-1;++_){const m=g[_],y=g[_+1],v=Au(n,r,m,y);v.squaredDistance<p&&(p=v.squaredDistance,f=_+v.along)}p<o&&(o=p,d.ring&&t.targetIndex===u&&(d.endIndex>d.startIndex?f<d.startIndex&&(f+=g.length):d.endIndex<d.startIndex&&f>d.startIndex&&(f-=g.length)),l=f,a=u)}const h=t.targets[a];let c=h.ring;if(t.targetIndex===a&&c){const u=Hi(h.coordinates,l),d=e.getPixelFromCoordinate(u);tr(d,t.startPx)>i&&(c=!1)}if(c){const u=h.coordinates,d=u.length,g=h.startIndex,p=l;if(g<p){const f=Un(u,g,p);Un(u,g,p-d)<f&&(l-=d)}else{const f=Un(u,g,p);Un(u,g,p+d)<f&&(l+=d)}}return mo.index=a,mo.endIndex=l,mo}function $n(s,t,e,i){const n=s[0],r=s[1];for(let o=0,a=t.length-1;o<a;++o){const l=t[o],h=t[o+1],c=Au(n,r,l,h);if(c.squaredDistance===0){const u=o+c.along;i.push({coordinates:t,ring:e,startIndex:u,endIndex:u});return}}}const yo={along:0,squaredDistance:0};function Au(s,t,e,i){const n=e[0],r=e[1],o=i[0],a=i[1],l=o-n,h=a-r;let c=0,u=n,d=r;return(l!==0||h!==0)&&(c=at(((s-n)*l+(t-r)*h)/(l*l+h*h),0,1),u+=l*c,d+=h*c),yo.along=c,yo.squaredDistance=dn(Le(s,t,u,d),10),yo}function Hi(s,t){const e=s.length;let i=Math.floor(t);const n=t-i;i>=e?i-=e:i<0&&(i+=e);let r=i+1;r>=e&&(r-=e);const o=s[i],a=o[0],l=o[1],h=s[r],c=h[0]-a,u=h[1]-l;return[a+c*n,l+u*n]}class ny extends Ii{constructor(t){const e=t;e.stopDown||(e.stopDown=fs),super(e),this.on,this.once,this.un,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=t.source?t.source:null,this.features_=t.features?t.features:null,this.snapTolerance_=t.snapTolerance?t.snapTolerance:12,this.type_=t.type,this.mode_=ay(this.type_),this.stopClick_=!!t.stopClick,this.minPoints_=t.minPoints?t.minPoints:this.mode_==="Polygon"?3:2,this.maxPoints_=this.mode_==="Circle"?2:t.maxPoints?t.maxPoints:1/0,this.finishCondition_=t.finishCondition?t.finishCondition:ns,this.geometryLayout_=t.geometryLayout?t.geometryLayout:"XY";let i=t.geometryFunction;if(!i){const n=this.mode_;if(n==="Circle")i=function(r,o,a){const l=o||new tf([NaN,NaN]),h=lt(r[0]),c=ls(h,lt(r[r.length-1]));return l.setCenterAndRadius(h,Math.sqrt(c),this.geometryLayout_),l};else{let r;n==="Point"?r=ge:n==="LineString"?r=Oe:n==="Polygon"&&(r=zt),i=function(o,a,l){return a?n==="Polygon"?o[0].length?a.setCoordinates([o[0].concat([o[0][0]])],this.geometryLayout_):a.setCoordinates([],this.geometryLayout_):a.setCoordinates(o,this.geometryLayout_):a=new r(o,this.geometryLayout_),a}}}this.geometryFunction_=i,this.dragVertexDelay_=t.dragVertexDelay!==void 0?t.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=t.clickTolerance?t.clickTolerance*t.clickTolerance:36,this.overlay_=new Ya({source:new Ha({useSpatialIndex:!1,wrapX:t.wrapX?t.wrapX:!1}),style:t.style?t.style:ry(),updateWhileInteracting:!0}),this.geometryName_=t.geometryName,this.condition_=t.condition?t.condition:La,this.freehandCondition_,t.freehand?this.freehandCondition_=cr:this.freehandCondition_=t.freehandCondition?t.freehandCondition:Tc,this.traceCondition_,this.setTrace(t.trace||!1),this.traceState_={active:!1},this.traceSource_=t.traceSource||t.source||null,this.addChangeListener(Oo.ACTIVE,this.updateState_)}setTrace(t){let e;t?t===!0?e=cr:e=t:e=Tp,this.traceCondition_=e}setMap(t){super.setMap(t),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(t){t.originalEvent.type===O.CONTEXTMENU&&t.originalEvent.preventDefault(),this.freehand_=this.mode_!=="Point"&&this.freehandCondition_(t);let e=t.type===Y.POINTERMOVE,i=!0;return!this.freehand_&&this.lastDragTime_&&t.type===Y.POINTERDRAG&&(Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=t.pixel,this.shouldHandle_=!this.freehand_,e=!0):this.lastDragTime_=void 0,this.shouldHandle_&&this.downTimeout_!==void 0&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)),this.freehand_&&t.type===Y.POINTERDRAG&&this.sketchFeature_!==null?(this.addToDrawing_(t.coordinate),i=!1):this.freehand_&&t.type===Y.POINTERDOWN?i=!1:e&&this.getPointerCount()<2?(i=t.type===Y.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(t),this.shouldHandle_&&t.originalEvent.preventDefault()):(t.originalEvent.pointerType==="mouse"||t.type===Y.POINTERDRAG&&this.downTimeout_===void 0)&&this.handlePointerMove_(t)):t.type===Y.DBLCLICK&&(i=!1),super.handleEvent(t)&&i}handleDownEvent(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(()=>{this.handlePointerMove_(new be(Y.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))},this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(t){if(!this.traceSource_||!this.traceCondition_(t))return;if(this.traceState_.active){this.deactivateTrace_();return}const e=this.getMap(),i=e.getCoordinateFromPixel([t.pixel[0]-this.snapTolerance_,t.pixel[1]+this.snapTolerance_]),n=e.getCoordinateFromPixel([t.pixel[0]+this.snapTolerance_,t.pixel[1]-this.snapTolerance_]),r=Lt([i,n]),o=this.traceSource_.getFeaturesInExtent(r);if(o.length===0)return;const a=iy(t.coordinate,o);a.length&&(this.traceState_={active:!0,startPx:t.pixel.slice(),targets:a,targetIndex:-1})}addOrRemoveTracedCoordinates_(t,e){const i=t.startIndex<=t.endIndex,n=t.startIndex<=e;i===n?i&&e>t.endIndex||!i&&e<t.endIndex?this.addTracedCoordinates_(t,t.endIndex,e):(i&&e<t.endIndex||!i&&e>t.endIndex)&&this.removeTracedCoordinates_(e,t.endIndex):(this.removeTracedCoordinates_(t.startIndex,t.endIndex),this.addTracedCoordinates_(t,t.startIndex,e))}removeTracedCoordinates_(t,e){if(t===e)return;let i=0;if(t<e){const n=Math.ceil(t);let r=Math.floor(e);r===e&&(r-=1),i=r-n+1}else{const n=Math.floor(t);let r=Math.ceil(e);r===e&&(r+=1),i=n-r+1}i>0&&this.removeLastPoints_(i)}addTracedCoordinates_(t,e,i){if(e===i)return;const n=[];if(e<i){const r=Math.ceil(e);let o=Math.floor(i);o===i&&(o-=1);for(let a=r;a<=o;++a)n.push(Ki(t.coordinates,a))}else{const r=Math.floor(e);let o=Math.ceil(i);o===i&&(o+=1);for(let a=r;a>=o;--a)n.push(Ki(t.coordinates,a))}n.length&&this.appendCoordinates(n)}updateTrace_(t){const e=this.traceState_;if(!e.active||e.targetIndex===-1&&tr(e.startPx,t.pixel)<this.snapTolerance_)return;const i=sy(t.coordinate,e,this.getMap(),this.snapTolerance_);if(e.targetIndex!==i.index){if(e.targetIndex!==-1){const l=e.targets[e.targetIndex];this.removeTracedCoordinates_(l.startIndex,l.endIndex)}const a=e.targets[i.index];this.addTracedCoordinates_(a,a.startIndex,i.endIndex)}else{const a=e.targets[e.targetIndex];this.addOrRemoveTracedCoordinates_(a,i.endIndex)}e.targetIndex=i.index;const n=e.targets[e.targetIndex];n.endIndex=i.endIndex;const r=Hi(n.coordinates,n.endIndex),o=this.getMap().getPixelFromCoordinate(r);t.coordinate=r,t.pixel=[Math.round(o[0]),Math.round(o[1])]}handleUpEvent(t){let e=!0;if(this.getPointerCount()===0){this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);const i=this.traceState_.active;if(this.toggleTraceState_(t),this.shouldHandle_){const n=!this.finishCoordinate_;n&&this.startDrawing_(t.coordinate),!n&&this.freehand_?this.finishDrawing():!this.freehand_&&(!n||this.mode_==="Point")&&(this.atFinish_(t.pixel,i)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate)),e=!1}else this.freehand_&&this.abortDrawing()}return!e&&this.stopClick_&&t.preventDefault(),e}handlePointerMove_(t){if(this.pointerType_=t.originalEvent.pointerType,this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){const e=this.downPx_,i=t.pixel,n=e[0]-i[0],r=e[1]-i[1],o=n*n+r*r;if(this.shouldHandle_=this.freehand_?o>this.squaredClickTolerance_:o<=this.squaredClickTolerance_,!this.shouldHandle_)return}if(!this.finishCoordinate_){this.createOrUpdateSketchPoint_(t.coordinate.slice());return}this.updateTrace_(t),this.modifyDrawing_(t.coordinate)}atFinish_(t,e){let i=!1;if(this.sketchFeature_){let n=!1,r=[this.finishCoordinate_];const o=this.mode_;if(o==="Point")i=!0;else if(o==="Circle")i=this.sketchCoords_.length===2;else if(o==="LineString")n=!e&&this.sketchCoords_.length>this.minPoints_;else if(o==="Polygon"){const a=this.sketchCoords_;n=a[0].length>this.minPoints_,r=[a[0][0],a[0][a[0].length-2]],e?r=[a[0][0]]:r=[a[0][0],a[0][a[0].length-2]]}if(n){const a=this.getMap();for(let l=0,h=r.length;l<h;l++){const c=r[l],u=a.getPixelFromCoordinate(c),d=t[0]-u[0],g=t[1]-u[1],p=this.freehand_?1:this.snapTolerance_;if(i=Math.sqrt(d*d+g*g)<=p,i){this.finishCoordinate_=c;break}}}}return i}createOrUpdateSketchPoint_(t){this.sketchPoint_?this.sketchPoint_.getGeometry().setCoordinates(t):(this.sketchPoint_=new Pe(new ge(t)),this.updateSketchFeatures_())}createOrUpdateCustomSketchLine_(t){this.sketchLine_||(this.sketchLine_=new Pe);const e=t.getLinearRing(0);let i=this.sketchLine_.getGeometry();i?(i.setFlatCoordinates(e.getLayout(),e.getFlatCoordinates()),i.changed()):(i=new Oe(e.getFlatCoordinates(),e.getLayout()),this.sketchLine_.setGeometry(i))}startDrawing_(t){const e=this.getMap().getView().getProjection(),i=ir(this.geometryLayout_);for(;t.length<i;)t.push(0);this.finishCoordinate_=t,this.mode_==="Point"?this.sketchCoords_=t.slice():this.mode_==="Polygon"?(this.sketchCoords_=[[t.slice(),t.slice()]],this.sketchLineCoords_=this.sketchCoords_[0]):this.sketchCoords_=[t.slice(),t.slice()],this.sketchLineCoords_&&(this.sketchLine_=new Pe(new Oe(this.sketchLineCoords_)));const n=this.geometryFunction_(this.sketchCoords_,void 0,e);this.sketchFeature_=new Pe,this.geometryName_&&this.sketchFeature_.setGeometryName(this.geometryName_),this.sketchFeature_.setGeometry(n),this.updateSketchFeatures_(),this.dispatchEvent(new Wn(zn.DRAWSTART,this.sketchFeature_))}modifyDrawing_(t){const e=this.getMap(),i=this.sketchFeature_.getGeometry(),n=e.getView().getProjection(),r=ir(this.geometryLayout_);let o,a;for(;t.length<r;)t.push(0);this.mode_==="Point"?a=this.sketchCoords_:this.mode_==="Polygon"?(o=this.sketchCoords_[0],a=o[o.length-1],this.atFinish_(e.getPixelFromCoordinate(t))&&(t=this.finishCoordinate_.slice())):(o=this.sketchCoords_,a=o[o.length-1]),a[0]=t[0],a[1]=t[1],this.geometryFunction_(this.sketchCoords_,i,n),this.sketchPoint_&&this.sketchPoint_.getGeometry().setCoordinates(t),i.getType()==="Polygon"&&this.mode_!=="Polygon"?this.createOrUpdateCustomSketchLine_(i):this.sketchLineCoords_&&this.sketchLine_.getGeometry().setCoordinates(this.sketchLineCoords_),this.updateSketchFeatures_()}addToDrawing_(t){const e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection();let n,r;const o=this.mode_;o==="LineString"||o==="Circle"?(this.finishCoordinate_=t.slice(),r=this.sketchCoords_,r.length>=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(t.slice()),this.geometryFunction_(r,e,i)):o==="Polygon"&&(r=this.sketchCoords_[0],r.length>=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(t.slice()),n&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,e,i)),this.createOrUpdateSketchPoint_(t.slice()),this.updateSketchFeatures_(),n&&this.finishDrawing()}removeLastPoints_(t){if(!this.sketchFeature_)return;const e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),n=this.mode_;for(let r=0;r<t;++r){let o;if(n==="LineString"||n==="Circle"){if(o=this.sketchCoords_,o.splice(-2,1),o.length>=2){this.finishCoordinate_=o[o.length-2].slice();const a=this.finishCoordinate_.slice();o[o.length-1]=a,this.createOrUpdateSketchPoint_(a)}this.geometryFunction_(o,e,i),e.getType()==="Polygon"&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if(n==="Polygon"){o=this.sketchCoords_[0],o.splice(-2,1);const a=this.sketchLine_.getGeometry();if(o.length>=2){const l=o[o.length-2].slice();o[o.length-1]=l,this.createOrUpdateSketchPoint_(l)}a.setCoordinates(o),this.geometryFunction_(this.sketchCoords_,e,i)}if(o.length===1){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const t=this.abortDrawing_();if(!t)return;let e=this.sketchCoords_;const i=t.getGeometry(),n=this.getMap().getView().getProjection();this.mode_==="LineString"?(e.pop(),this.geometryFunction_(e,i,n)):this.mode_==="Polygon"&&(e[0].pop(),this.geometryFunction_(e,i,n),e=i.getCoordinates()),this.type_==="MultiPoint"?t.setGeometry(new Nr([e])):this.type_==="MultiLineString"?t.setGeometry(new kr([e])):this.type_==="MultiPolygon"&&t.setGeometry(new Gr([e])),this.dispatchEvent(new Wn(zn.DRAWEND,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}abortDrawing_(){this.finishCoordinate_=null;const t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),t}abortDrawing(){const t=this.abortDrawing_();t&&this.dispatchEvent(new Wn(zn.DRAWABORT,t))}appendCoordinates(t){const e=this.mode_,i=!this.sketchFeature_;i&&this.startDrawing_(t[0]);let n;if(e==="LineString"||e==="Circle")n=this.sketchCoords_;else if(e==="Polygon")n=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[];else return;i&&n.shift(),n.pop();for(let o=0;o<t.length;o++)this.addToDrawing_(t[o]);const r=t[t.length-1];this.addToDrawing_(r),this.modifyDrawing_(r)}extend(t){const e=t.getGeometry();this.sketchFeature_=t,this.sketchCoords_=e.getCoordinates();const i=this.sketchCoords_[this.sketchCoords_.length-1];this.finishCoordinate_=i.slice(),this.sketchCoords_.push(i.slice()),this.sketchPoint_=new Pe(new ge(i)),this.updateSketchFeatures_(),this.dispatchEvent(new Wn(zn.DRAWSTART,this.sketchFeature_))}updateSketchFeatures_(){const t=[];this.sketchFeature_&&t.push(this.sketchFeature_),this.sketchLine_&&t.push(this.sketchLine_),this.sketchPoint_&&t.push(this.sketchPoint_);const e=this.overlay_.getSource();e.clear(!0),e.addFeatures(t)}updateState_(){const t=this.getMap(),e=this.getActive();(!t||!e)&&this.abortDrawing(),this.overlay_.setMap(e?t:null)}}function ry(){const s=$c();return function(t,e){return s[t.getGeometry().getType()]}}function oy(){return function(s,t,e){const i=Lt([s[0],s[s.length-1]].map(function(r){return lt(r)})),n=[[os(i),_s(i),un(i),me(i),os(i)]];return t?t.setCoordinates(n):t=new zt(n),t}}function ay(s){switch(s){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+s)}}const ly=ny;function hy(s,t,e){const i=Object.assign({},e);if(s.interactions[i.id])throw Error(`Interaction with id: ${i.id} already exists.`);i.modify=typeof i.modify=="boolean"?i.modify:!0;const n=t.getSource();i.type==="Box"&&(i.geometryFunction=oy(),i.type="Circle");const r=new ly({...i,source:n});i.active===!1&&r.setActive(!1);const o=new Gc;r.on("drawend",h=>{const c=h.feature.getGeometry();if(c instanceof Oe){const p=qh(c,{radius:6378137,projection:"EPSG:3857"});h.feature.set("measure",p)}else if(c instanceof zt){const p=Jh(c,{radius:6378137,projection:"EPSG:3857"});h.feature.set("measure",p)}const u=D(h.feature);h.feature.set("id",u),h.feature.setId(u);const d=o.writeFeatureObject(h.feature),g=new CustomEvent("drawend",{detail:{originalEvent:h,geojson:d}});s.dispatchEvent(g)}),s.map.addInteraction(r),s.interactions[i.id]=r;const a=new ey({source:n});a.setActive(i.modify),s.map.addInteraction(a),s.interactions[`${i.id}_modify`]=a;const l=()=>{s.getLayerById(t.get("id"))||(s.removeInteraction(i.id),s.removeInteraction(`${i.id}_modify`),s.map.getLayerGroup().un("change",l))};s.map.getLayerGroup().on("change",l)}class Fu extends qi{constructor(){super(...arguments),this.templates={},this._renderedTemplates={}}setBindingSyntax(t,e){this._startExpression=t,this._endExpression=e;const i=this.escapeRegex(this._startExpression),n=this.escapeRegex(this._endExpression);this._expression=new RegExp(`${i}\\s*([$\\w\\.,'"\\s()\\[\\]]+)\\s*${n}`,"g")}hasTemplate(t){return this.templates&&!!this.templates[t]}renderTemplate(t,e,i){if(!this.hasTemplate(t))return null;i=i||t;const n=Zi` <slot name=${i}></slot> `,r={[t]:{...e}};if(this._renderedTemplates.hasOwnProperty(i)){const{slot:a}=this._renderedTemplates[i];this.contains(a)&&this.removeChild(a)}const o=document.createElement("div");return o.slot=i,o.dataset.generated="template",this._renderTemplate(o,this.templates[t],r),this.appendChild(o),this._renderedTemplates[i]={context:r,slot:o},n}getTemplates(){const t={};for(let e=0;e<this.children.length;e++){const i=this.children[e];if(i.nodeName==="RENDER-TEMPLATE"){const n=i;n.dataset.type?t[n.dataset.type]=n:t.default=n,n.templateOrder=e}}return t}_renderTemplate(t,e,i){let n;if(e&&e.childNodes.length){const r=e.cloneNode(!0);n=this.renderNode(r,t,i)}n&&t.appendChild(n)}expandExpressionsAsString(t,e){return t.replace(this.expression,(i,n)=>{const r=this.evalInContext(n||this.trimExpression(i),e);return r?typeof r=="object"?JSON.stringify(r):r.toString():""})}get expression(){return this._expression||this.setBindingSyntax("{{","}}"),this._expression}escapeRegex(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}evalInContext(t,e){e={...e};const i=new Function("with(this) { return "+t+";}");let n;try{n=i.call(e)}catch{}return n}trimExpression(t){return t=t.trim(),t.startsWith(this._startExpression)&&t.endsWith(this._endExpression)&&(t=t.substr(this._startExpression.length,t.length-this._startExpression.length-this._endExpression.length),t=t.trim()),t}renderNode(t,e,i){if(t.nodeName==="#text")return t.textContent=this.expandExpressionsAsString(t.textContent,i),t;if(t.nodeName==="TEMPLATE")return t.$parentTemplateContext=i,t;for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];this.renderNode(r,e,i)}return t}firstUpdated(){this.templates=this.getTemplates()}}var cy=Object.defineProperty,uy=Object.getOwnPropertyDescriptor,dy=(s,t,e,i)=>{for(var n=i>1?void 0:i?uy(t,e):t,r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=(i?o(t,e,n):o(n))||n);return i&&n&&cy(t,e,n),n};class Ou extends Fu{constructor(){super(),this.propertyTransform=(t,e)=>t}renderContent(t){Fh(this.hasTemplate("properties")?Zi`${this.renderTemplate("properties",t.getProperties(),"tooltip-1")}`:Zi` <style>
42
- ul {
43
- margin: 0;
44
- padding: 15px 15px 15px 30px;
45
- background: #0008;
46
- border-radius: 15px;
47
- color: white;
48
- max-width: 250px;
49
- font-size: small;
50
- }
51
- span {
52
- font-weight: bold;
53
- }
54
- </style>
55
- <ul>
56
- ${Object.entries(t.getProperties()).map(([e,i])=>this.propertyTransform({key:e,value:i},t)).filter(e=>e).map(({key:e,value:i})=>Zi`<li><span>${e}</span>: ${i}</li>`)}
57
- </ul>`,this.shadowRoot)}}dy([Ne()],Ou.prototype,"propertyTransform",2);customElements.define("eox-map-tooltip",Ou);class gy{constructor(t,e,i){var n,r;this.eoxMap=t,this.selectLayer=e,this.options=i,this.active=i.active||e.getVisible(),this.panIn=i.panIn||!1;const o=this.eoxMap.map.getOverlayById("eox-map-tooltip");let a;this.selectedFids=[],o?(this.tooltip=o.getElement(),a=o):(this.tooltip=this.eoxMap.querySelector("eox-map-tooltip")||((n=i.overlay)==null?void 0:n.element),this.tooltip&&(a=new Mu({element:this.tooltip,position:void 0,offset:[0,0],positioning:"top-left",className:"eox-map-tooltip",id:"eox-map-tooltip",...i.overlay}),this.eoxMap.map.addOverlay(a)));const l=()=>{i.condition==="pointermove"&&a.setPosition(void 0)};t.map.on("change:target",p=>{var f,_;(f=p.oldValue)==null||f.removeEventListener("pointerleave",l),(_=p.target.getTargetElement())==null||_.addEventListener("pointerleave",l)}),(r=t.map.getTargetElement())==null||r.addEventListener("pointerleave",l);let h;if(this.options.layer)h=this.options.layer;else{const p=this.selectLayer.get("_jsonDefinition");h={...p,style:i.style,properties:{id:this.selectLayer.get("id")+"_select"},source:{type:p.type}}}h.renderMode="vector",delete h.interactions,this.selectStyleLayer=ps(t,h),this.selectStyleLayer.setSource(this.selectLayer.getSource()),this.selectStyleLayer.setMap(this.eoxMap.map);const c=this.selectStyleLayer.getStyleFunction();this.selectStyleLayer.setStyle((p,f)=>this.selectedFids.length&&this.selectedFids.includes(this.getId(p))?c(p,f):null);const u=p=>{this.panIn&&this.eoxMap.map.getView().fit(p.getGeometry().getExtent(),{duration:750})},d=p=>{if(!this.active)return;const f=this.eoxMap.map.getView().getZoom();p.dragging||!this.active||f<this.selectLayer.getMinZoom()||f>this.selectLayer.getMaxZoom()||this.selectLayer.getFeatures(p.pixel).then(_=>{const m=_.length?_[0]:null,y=m?[this.getId(m)]:[],v=this.selectedFids[0]!==y[0];if(this.selectedFids=y,v&&(this.selectStyleLayer.changed(),m&&u(m)),a){const E=p.pixel[0]>this.eoxMap.offsetWidth/2?"right":"left",C=p.pixel[1]>this.eoxMap.offsetHeight/2?"bottom":"top";a.setPositioning(`${C}-${E}`),a.setPosition(m?p.coordinate:null),m&&this.tooltip.renderContent&&this.tooltip.renderContent(m)}const x=new CustomEvent("select",{detail:{id:i.id,originalEvent:p,feature:m}});this.eoxMap.dispatchEvent(x)})};this.eoxMap.map.on(i.condition||"click",d),this.selectLayer.on("change:opacity",()=>{this.selectStyleLayer.setOpacity(this.selectLayer.getOpacity())}),this.selectLayer.on("change:visible",()=>{const p=this.selectLayer.getVisible();this.selectStyleLayer.setVisible(p),this.setActive(p)}),this.changeSourceListener=()=>{this.selectStyleLayer.setSource(this.selectLayer.getSource())},this.selectLayer.on("change:source",this.changeSourceListener),this.removeListener=()=>{},this.eoxMap.map.getLayers().on("remove",this.removeListener);const g=()=>{t.getLayerById(e.get("id"))||(t.selectInteractions[i.id].remove(),t.map.getLayerGroup().un("change",g))};t.map.getLayerGroup().on("change",g)}setActive(t){this.active=t}highlightById(t){this.selectedFids=t,this.selectStyleLayer.changed()}remove(){this.selectStyleLayer.setMap(null),delete this.eoxMap.selectInteractions[this.options.id],this.selectLayer.un("change:source",this.changeSourceListener),this.eoxMap.map.getLayers().un("remove",this.removeListener)}getId(t){if(this.options.idProperty)return t.get(this.options.idProperty);if(t.getId()!==void 0)return t.getId();if(t.get("id")!==void 0)return t.get("id");throw Error("No feature id found. Please provide which feature property should be taken instead using idProperty.")}}function py(s,t,e){if(s.interactions[e.id])throw Error(`Interaction with id: ${e.id} already exists.`);return s.selectInteractions[e.id]=new gy(s,t,e),s.selectInteractions[e.id]}const fy={GeoJSON:Gc,MVT:n_},_y={Group:wi,Image:i0,Tile:a0,Vector:Ya,VectorTile:g0},my={ImageWMS:k0,OSM:X0,Tile:wu,TileWMS:K0,Vector:Ha,VectorTile:W0,WMTS:Z0,XYZ:Ru};function ps(s,t,e=!0){var i,n;t=JSON.parse(JSON.stringify(t));const r={...fy,...window.eoxMapAdvancedOlFormats},o={..._y,...window.eoxMapAdvancedOlLayers},a={...my,...window.eoxMapAdvancedOlSources},l=o[t.type],h=a[(i=t.source)==null?void 0:i.type];if(!l)throw window.eoxMapAdvancedOlLayers?new Error(`Layer type ${t.type} not supported!`):new Error(`Layer type ${t.type} not created! Forgot to import advanced layers & sources plugin from @eox/map/dist/eox-map-advanced-layers-and-sources.js?`);if(t.source&&!h)throw window.eoxMapAdvancedOlSources?new Error(`Source type ${t.source.type} not supported!`):new Error(`Source type ${t.source.type} not created! Forgot to import advanced layers & sources plugin from @eox/map/dist/eox-map-advanced-layers-and-sources.js?`);const c=new l({...t,...t.source&&{source:new h({...t.source,...t.source.format&&{format:new r[t.source.format]},...t.source.tileGrid&&{tileGrid:Ja({...t.source.tileGrid})}})},...t.type==="Group"&&{layers:[]},...t.properties,style:void 0});if(c.set("_jsonDefinition",t,!0),t.type==="Group"){const u=t.layers.reverse().map(d=>ps(s,d));u.forEach(d=>d.set("_group",c,!0)),c.setLayers(new Rt(u))}if(t.style&&c.setStyle(t.style),e&&(n=t.interactions)!=null&&n.length)for(let u=0,d=t.interactions.length;u<d;u++){const g=t.interactions[u];Du(s,c,g)}return Nu(c,t),c}function Du(s,t,e){e.type==="draw"?hy(s,t,e.options):e.type==="select"&&py(s,t,e.options)}function ku(s,t,e){var i,n,r,o;const a=e.get("_jsonDefinition");if(t.type!==a.type||((i=t.source)==null?void 0:i.type)!==((n=a.source)==null?void 0:n.type))throw new Error("Layers are not compatible to be updated");const l=ps(s,t,!1);if(JSON.stringify(t.source)!==JSON.stringify(a.source)&&e.setSource(l.getSource()),["Vector","VectorTile"].includes(t.type)&&JSON.stringify(t.style)!==JSON.stringify(a.style)&&e.setStyle(l.getStyle()),JSON.stringify(t.properties)!==JSON.stringify(a.properties)&&e.setProperties(t.properties),t.visible!==a.visible&&e.setVisible(t.visible),t.opacity!==a.opacity&&e.setOpacity(t.opacity),JSON.stringify(t.interactions)!==JSON.stringify(a.interactions)&&((r=a.interactions)==null||r.forEach(h=>{const c=t.interactions.find(u=>u.type===h.type);c?c.type==="draw"?(s.interactions[c.options.id].setActive(c.options.active),s.interactions[`${c.options.id}_modify`].setActive(c.options.modify)):s.selectInteractions[c.options.id].setActive(c.options.active):s.removeInteraction(h.options.id)}),(o=t.interactions)==null||o.forEach(h=>{a.interactions.find(c=>c.type===h.type)||Du(s,e,h)})),t.type==="Group"){const h=t.layers.map(u=>{var d;return(d=u.properties)==null?void 0:d.id}),c=e.getLayers();c.forEach(u=>{h.includes(u.get("id"))||c.remove(u)}),t.layers.forEach(u=>{const d=u.properties.id;if(c.getArray().map(g=>g.get("id")).includes(d))ku(s,u,s.getLayerById(d));else{const g=ps(s,u);c.push(g)}}),c.getArray().sort((u,d)=>h.indexOf(u.get("id"))-h.indexOf(d.get("id"))),c.changed()}return Nu(e,t),e}const yy=(s,t)=>t?[...t].reverse().map(e=>ps(s,e)):[];function Nu(s,t){s.on("change:opacity",()=>{t.opacity=s.getOpacity()}),s.on("change:visible",()=>{t.visible=s.getVisible()}),s.on("change:zIndex",()=>{t.zIndex=s.getZIndex()}),s.on("propertychange",e=>{e.key!=="map"&&(t.properties[e.key]=e.target.get(e.key))})}function vo(s,t){return Gu(s.map.getLayers().getArray()).find(e=>e.get("id")===t)}function Gu(s){const t=[];t.push(...s);let e=t.filter(i=>i instanceof wi);for(;e.length;){const i=[];for(let n=0,r=e.length;n<r;n++){const o=e[n].getLayers().getArray();t.push(...o),i.push(...o.filter(a=>a instanceof wi))}e=i}return t}function vh(s){if(s){const t=s;return!$t(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90?dg(t):t}return[0,0]}const xh=["fullscreenchange","webkitfullscreenchange","MSFullscreenChange"],Eh={ENTERFULLSCREEN:"enterfullscreen",LEAVEFULLSCREEN:"leavefullscreen"};class vy extends ye{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target}),this.on,this.once,this.un,this.keys_=t.keys!==void 0?t.keys:!1,this.source_=t.source,this.isInFullscreen_=!1,this.boundHandleMapTargetChange_=this.handleMapTargetChange_.bind(this),this.cssClassName_=t.className!==void 0?t.className:"ol-full-screen",this.documentListeners_=[],this.activeClassName_=t.activeClassName!==void 0?t.activeClassName.split(" "):[this.cssClassName_+"-true"],this.inactiveClassName_=t.inactiveClassName!==void 0?t.inactiveClassName.split(" "):[this.cssClassName_+"-false"];const e=t.label!==void 0?t.label:"⤢";this.labelNode_=typeof e=="string"?document.createTextNode(e):e;const i=t.labelActive!==void 0?t.labelActive:"×";this.labelActiveNode_=typeof i=="string"?document.createTextNode(i):i;const n=t.tipLabel?t.tipLabel:"Toggle full-screen";this.button_=document.createElement("button"),this.button_.title=n,this.button_.setAttribute("type","button"),this.button_.appendChild(this.labelNode_),this.button_.addEventListener(O.CLICK,this.handleClick_.bind(this),!1),this.setClassName_(this.button_,this.isInFullscreen_),this.element.className=`${this.cssClassName_} ${_e} ${bi}`,this.element.appendChild(this.button_)}handleClick_(t){t.preventDefault(),this.handleFullScreen_()}handleFullScreen_(){const t=this.getMap();if(!t)return;const e=t.getOwnerDocument();if(Ch(e))if(wh(e))Ey(e);else{let i;this.source_?i=typeof this.source_=="string"?e.getElementById(this.source_):this.source_:i=t.getTargetElement(),this.keys_?xy(i):ju(i)}}handleFullScreenChange_(){const t=this.getMap();if(!t)return;const e=this.isInFullscreen_;this.isInFullscreen_=wh(t.getOwnerDocument()),e!==this.isInFullscreen_&&(this.setClassName_(this.button_,this.isInFullscreen_),this.isInFullscreen_?(cs(this.labelActiveNode_,this.labelNode_),this.dispatchEvent(Eh.ENTERFULLSCREEN)):(cs(this.labelNode_,this.labelActiveNode_),this.dispatchEvent(Eh.LEAVEFULLSCREEN)),t.updateSize())}setClassName_(t,e){e?(t.classList.remove(...this.inactiveClassName_),t.classList.add(...this.activeClassName_)):(t.classList.remove(...this.activeClassName_),t.classList.add(...this.inactiveClassName_))}setMap(t){const e=this.getMap();e&&e.removeChangeListener(ut.TARGET,this.boundHandleMapTargetChange_),super.setMap(t),this.handleMapTargetChange_(),t&&t.addChangeListener(ut.TARGET,this.boundHandleMapTargetChange_)}handleMapTargetChange_(){const t=this.documentListeners_;for(let i=0,n=t.length;i<n;++i)et(t[i]);t.length=0;const e=this.getMap();if(e){const i=e.getOwnerDocument();Ch(i)?this.element.classList.remove(jl):this.element.classList.add(jl);for(let n=0,r=xh.length;n<r;++n)t.push(W(i,xh[n],this.handleFullScreenChange_,this));this.handleFullScreenChange_()}}}function Ch(s){const t=s.body;return!!(t.webkitRequestFullscreen||t.requestFullscreen&&s.fullscreenEnabled)}function wh(s){return!!(s.webkitIsFullScreen||s.fullscreenElement)}function ju(s){s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen&&s.webkitRequestFullscreen()}function xy(s){s.webkitRequestFullscreen?s.webkitRequestFullscreen():ju(s)}function Ey(s){s.exitFullscreen?s.exitFullscreen():s.webkitExitFullscreen&&s.webkitExitFullscreen()}const Cy=vy,xo="projection",Sh="coordinateFormat";class wy extends ye{constructor(t){t=t||{};const e=document.createElement("div");e.className=t.className!==void 0?t.className:"ol-mouse-position",super({element:e,render:t.render,target:t.target}),this.on,this.once,this.un,this.addChangeListener(xo,this.handleProjectionChanged_),t.coordinateFormat&&this.setCoordinateFormat(t.coordinateFormat),t.projection&&this.setProjection(t.projection),this.renderOnMouseOut_=t.placeholder!==void 0,this.placeholder_=this.renderOnMouseOut_?t.placeholder:"&#160;",this.renderedHTML_=e.innerHTML,this.mapProjection_=null,this.transform_=null,this.wrapX_=t.wrapX!==!1}handleProjectionChanged_(){this.transform_=null}getCoordinateFormat(){return this.get(Sh)}getProjection(){return this.get(xo)}handleMouseMove(t){const e=this.getMap();this.updateHTML_(e.getEventPixel(t))}handleMouseOut(t){this.updateHTML_(null)}setMap(t){if(super.setMap(t),t){const e=t.getViewport();this.listenerKeys.push(W(e,le.POINTERMOVE,this.handleMouseMove,this)),this.renderOnMouseOut_&&this.listenerKeys.push(W(e,le.POINTEROUT,this.handleMouseOut,this)),this.updateHTML_(null)}}setCoordinateFormat(t){this.set(Sh,t)}setProjection(t){this.set(xo,it(t))}updateHTML_(t){let e=this.placeholder_;if(t&&this.mapProjection_){if(!this.transform_){const n=this.getProjection();n?this.transform_=Lr(this.mapProjection_,n):this.transform_=ca}const i=this.getMap().getCoordinateFromPixelInternal(t);if(i){if(this.transform_(i,i),this.wrapX_){const r=this.getProjection()||this.mapProjection_;Mr(i,r)}const n=this.getCoordinateFormat();n?e=n(i):e=i.toString()}}(!this.renderedHTML_||e!==this.renderedHTML_)&&(this.element.innerHTML=e,this.renderedHTML_=e)}render(t){const e=t.frameState;e?this.mapProjection_!=e.viewState.projection&&(this.mapProjection_=e.viewState.projection,this.transform_=null):this.mapProjection_=null}}const Sy=wy,Eo=.75,Xn=.1;class Ty extends ye{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.boundHandleRotationChanged_=this.handleRotationChanged_.bind(this),this.collapsed_=t.collapsed!==void 0?t.collapsed:!0,this.collapsible_=t.collapsible!==void 0?t.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.rotateWithView_=t.rotateWithView!==void 0?t.rotateWithView:!1,this.viewExtent_=void 0;const e=t.className!==void 0?t.className:"ol-overviewmap",i=t.tipLabel!==void 0?t.tipLabel:"Overview map",n=t.collapseLabel!==void 0?t.collapseLabel:"‹";typeof n=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=n):this.collapseLabel_=n;const r=t.label!==void 0?t.label:"›";typeof r=="string"?(this.label_=document.createElement("span"),this.label_.textContent=r):this.label_=r;const o=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_,a=document.createElement("button");a.setAttribute("type","button"),a.title=i,a.appendChild(o),a.addEventListener(O.CLICK,this.handleClick_.bind(this),!1),this.ovmapDiv_=document.createElement("div"),this.ovmapDiv_.className="ol-overviewmap-map",this.view_=t.view;const l=new Mc({view:t.view,controls:new Rt,interactions:new Rt});this.ovmap_=l,t.layers&&t.layers.forEach(function(y){l.addLayer(y)});const h=document.createElement("div");h.className="ol-overviewmap-box",h.style.boxSizing="border-box",this.boxOverlay_=new Mu({position:[0,0],positioning:"center-center",element:h}),this.ovmap_.addOverlay(this.boxOverlay_);const c=e+" "+_e+" "+bi+(this.collapsed_&&this.collapsible_?" "+or:"")+(this.collapsible_?"":" ol-uncollapsible"),u=this.element;u.className=c,u.appendChild(this.ovmapDiv_),u.appendChild(a);const d=this,g=this.boxOverlay_,p=this.boxOverlay_.getElement(),f=function(y){return{clientX:y.clientX,clientY:y.clientY}},_=function(y){const v=f(y),x=l.getEventCoordinateInternal(v);g.setPosition(x)},m=function(y){const v=l.getEventCoordinateInternal(y);d.getMap().getView().setCenterInternal(v),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",m)};p.addEventListener("mousedown",function(){window.addEventListener("mousemove",_),window.addEventListener("mouseup",m)})}setMap(t){const e=this.getMap();if(t!==e){if(e){const i=e.getView();i&&this.unbindView_(i),this.ovmap_.setTarget(null)}if(super.setMap(t),t){this.ovmap_.setTarget(this.ovmapDiv_),this.listenerKeys.push(W(t,Ci.PROPERTYCHANGE,this.handleMapPropertyChange_,this));const i=t.getView();i&&(this.bindView_(i),i.isDef()&&(this.ovmap_.updateSize(),this.resetExtent_())),this.ovmap_.isRendered()||this.updateBoxAfterOvmapIsRendered_()}}}handleMapPropertyChange_(t){if(t.key===ut.VIEW){const e=t.oldValue;e&&this.unbindView_(e);const i=this.getMap().getView();this.bindView_(i)}else!this.ovmap_.isRendered()&&(t.key===ut.TARGET||t.key===ut.SIZE)&&this.ovmap_.updateSize()}bindView_(t){if(!this.view_){const e=new Qt({projection:t.getProjection()});this.ovmap_.setView(e)}t.addChangeListener(kt.ROTATION,this.boundHandleRotationChanged_),this.handleRotationChanged_()}unbindView_(t){t.removeChangeListener(kt.ROTATION,this.boundHandleRotationChanged_)}handleRotationChanged_(){this.rotateWithView_&&this.ovmap_.getView().setRotation(this.getMap().getView().getRotation())}validateExtent_(){const t=this.getMap(),e=this.ovmap_;if(!t.isRendered()||!e.isRendered())return;const i=t.getSize(),n=t.getView().calculateExtentInternal(i);if(this.viewExtent_&&ri(n,this.viewExtent_))return;this.viewExtent_=n;const r=e.getSize(),o=e.getView().calculateExtentInternal(r),a=e.getPixelFromCoordinateInternal(me(n)),l=e.getPixelFromCoordinateInternal(_s(n)),h=Math.abs(a[0]-l[0]),c=Math.abs(a[1]-l[1]),u=r[0],d=r[1];h<u*Xn||c<d*Xn||h>u*Eo||c>d*Eo?this.resetExtent_():Xt(o,n)||this.recenter_()}resetExtent_(){const t=this.getMap(),e=this.ovmap_,i=t.getSize(),n=t.getView().calculateExtentInternal(i),r=e.getView(),o=Math.log(Eo/Xn)/Math.LN2,a=1/(Math.pow(2,o/2)*Xn);Dd(n,a),r.fitInternal(rr(n))}recenter_(){const t=this.getMap(),e=this.ovmap_,i=t.getView();e.getView().setCenterInternal(i.getCenterInternal())}updateBox_(){const t=this.getMap(),e=this.ovmap_;if(!t.isRendered()||!e.isRendered())return;const i=t.getSize(),n=t.getView(),r=e.getView(),o=this.rotateWithView_?0:-n.getRotation(),a=this.boxOverlay_,l=this.boxOverlay_.getElement(),h=n.getCenterInternal(),c=n.getResolution(),u=r.getResolution(),d=i[0]*c/u,g=i[1]*c/u;if(a.setPosition(h),l){l.style.width=d+"px",l.style.height=g+"px";const p="rotate("+o+"rad)";l.style.transform=p}}updateBoxAfterOvmapIsRendered_(){this.ovmapPostrenderKey_||(this.ovmapPostrenderKey_=Us(this.ovmap_,ae.POSTRENDER,function(t){delete this.ovmapPostrenderKey_,this.updateBox_()},this))}handleClick_(t){t.preventDefault(),this.handleToggle_()}handleToggle_(){this.element.classList.toggle(or),this.collapsed_?cs(this.collapseLabel_,this.label_):cs(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;const t=this.ovmap_;if(!this.collapsed_){if(t.isRendered()){this.viewExtent_=void 0,t.render();return}t.updateSize(),this.resetExtent_(),this.updateBoxAfterOvmapIsRendered_()}}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())}setCollapsed(t){!this.collapsible_||this.collapsed_===t||this.handleToggle_()}getCollapsed(){return this.collapsed_}getRotateWithView(){return this.rotateWithView_}setRotateWithView(t){this.rotateWithView_!==t&&(this.rotateWithView_=t,this.getMap().getView().getRotation()!==0&&(this.rotateWithView_?this.handleRotationChanged_():this.ovmap_.getView().setRotation(0),this.viewExtent_=void 0,this.validateExtent_(),this.updateBox_()))}getOverviewMap(){return this.ovmap_}render(t){this.validateExtent_(),this.updateBox_()}}const Ry=Ty,Co="units",by=[1,2,5],Ms=25.4/.28;class Iy extends ye{constructor(t){t=t||{};const e=document.createElement("div");e.style.pointerEvents="none",super({element:e,render:t.render,target:t.target}),this.on,this.once,this.un;const i=t.className!==void 0?t.className:t.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=i+"-inner",this.element.className=i+" "+_e,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=t.minWidth!==void 0?t.minWidth:64,this.maxWidth_=t.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(Co,this.handleUnitsChanged_),this.setUnits(t.units||"metric"),this.scaleBar_=t.bar||!1,this.scaleBarSteps_=t.steps||4,this.scaleBarText_=t.text||!1,this.dpi_=t.dpi||void 0}getUnits(){return this.get(Co)}handleUnitsChanged_(){this.updateElement_()}setUnits(t){this.set(Co,t)}setDpi(t){this.dpi_=t}updateElement_(){const t=this.viewState_;if(!t){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}const e=t.center,i=t.projection,n=this.getUnits(),r=n=="degrees"?"degrees":"m";let o=er(i,t.resolution,e,r);const a=this.minWidth_*(this.dpi_||Ms)/Ms,l=this.maxWidth_!==void 0?this.maxWidth_*(this.dpi_||Ms)/Ms:void 0;let h=a*o,c="";if(n=="degrees"){const v=as.degrees;h*=v,h<v/60?(c="″",o*=3600):h<v?(c="′",o*=60):c="°"}else if(n=="imperial")h<.9144?(c="in",o/=.0254):h<1609.344?(c="ft",o/=.3048):(c="mi",o/=1609.344);else if(n=="nautical")o/=1852,c="NM";else if(n=="metric")h<.001?(c="μm",o*=1e6):h<1?(c="mm",o*=1e3):h<1e3?c="m":(c="km",o/=1e3);else if(n=="us")h<.9144?(c="in",o*=39.37):h<1609.344?(c="ft",o/=.30480061):(c="mi",o/=1609.3472);else throw new Error("Invalid units");let u=3*Math.floor(Math.log(a*o)/Math.log(10)),d,g,p,f,_,m;for(;;){p=Math.floor(u/3);const v=Math.pow(10,p);if(d=by[(u%3+3)%3]*v,g=Math.round(d/o),isNaN(g)){this.element.style.display="none",this.renderedVisible_=!1;return}if(l!==void 0&&g>=l){d=f,g=_,p=m;break}else if(g>=a)break;f=d,_=g,m=p,++u}const y=this.scaleBar_?this.createScaleBar(g,d,c):d.toFixed(p<0?-p:0)+" "+c;this.renderedHTML_!=y&&(this.innerElement_.innerHTML=y,this.renderedHTML_=y),this.renderedWidth_!=g&&(this.innerElement_.style.width=g+"px",this.renderedWidth_=g),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(t,e,i){const n=this.getScaleForResolution(),r=n<1?Math.round(1/n).toLocaleString()+" : 1":"1 : "+Math.round(n).toLocaleString(),o=this.scaleBarSteps_,a=t/o,l=[this.createMarker("absolute")];for(let h=0;h<o;++h){const c=h%2===0?"ol-scale-singlebar-odd":"ol-scale-singlebar-even";l.push(`<div><div class="ol-scale-singlebar ${c}" style="width: ${a}px;"></div>`+this.createMarker("relative")+(h%2===0||o===2?this.createStepText(h,t,!1,e,i):"")+"</div>")}return l.push(this.createStepText(o,t,!0,e,i)),(this.scaleBarText_?`<div class="ol-scale-text" style="width: ${t}px;">`+r+"</div>":"")+l.join("")}createMarker(t){return`<div class="ol-scale-step-marker" style="position: ${t}; top: ${t==="absolute"?3:-10}px;"></div>`}createStepText(t,e,i,n,r){const o=(t===0?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(t===0?"":" "+r),a=t===0?-3:e/this.scaleBarSteps_*-1,l=t===0?0:e/this.scaleBarSteps_*2;return`<div class="ol-scale-step-text" style="margin-left: ${a}px;text-align: ${t===0?"left":"center"};min-width: ${l}px;left: ${i?e+"px":"unset"};">`+o+"</div>"}getScaleForResolution(){const t=er(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m"),e=this.dpi_||Ms,i=1e3/25.4;return t*i*e}render(t){const e=t.frameState;e?this.viewState_=e.viewState:this.viewState_=null,this.updateElement_()}}const Py=Iy,Ls={VERTICAL:0,HORIZONTAL:1};class My extends ye{constructor(t){t=t||{},super({target:t.target,element:document.createElement("div"),render:t.render}),this.dragListenerKeys_=[],this.currentResolution_=void 0,this.direction_=Ls.VERTICAL,this.dragging_,this.heightLimit_=0,this.widthLimit_=0,this.startX_,this.startY_,this.thumbSize_=null,this.sliderInitialized_=!1,this.duration_=t.duration!==void 0?t.duration:200;const e=t.className!==void 0?t.className:"ol-zoomslider",i=document.createElement("button");i.setAttribute("type","button"),i.className=e+"-thumb "+_e;const n=this.element;n.className=e+" "+_e+" "+bi,n.appendChild(i),n.addEventListener(le.POINTERDOWN,this.handleDraggerStart_.bind(this),!1),n.addEventListener(le.POINTERMOVE,this.handleDraggerDrag_.bind(this),!1),n.addEventListener(le.POINTERUP,this.handleDraggerEnd_.bind(this),!1),n.addEventListener(O.CLICK,this.handleContainerClick_.bind(this),!1),i.addEventListener(O.CLICK,gd,!1)}setMap(t){super.setMap(t),t&&t.render()}initSlider_(){const t=this.element;let e=t.offsetWidth,i=t.offsetHeight;if(e===0&&i===0)return this.sliderInitialized_=!1;const n=getComputedStyle(t);e-=parseFloat(n.paddingRight)+parseFloat(n.paddingLeft),i-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom);const r=t.firstElementChild,o=getComputedStyle(r),a=r.offsetWidth+parseFloat(o.marginRight)+parseFloat(o.marginLeft),l=r.offsetHeight+parseFloat(o.marginTop)+parseFloat(o.marginBottom);return this.thumbSize_=[a,l],e>i?(this.direction_=Ls.HORIZONTAL,this.widthLimit_=e-a):(this.direction_=Ls.VERTICAL,this.heightLimit_=i-l),this.sliderInitialized_=!0}handleContainerClick_(t){const e=this.getMap().getView(),i=this.getRelativePosition_(t.offsetX-this.thumbSize_[0]/2,t.offsetY-this.thumbSize_[1]/2),n=this.getResolutionForPosition_(i),r=e.getConstrainedZoom(e.getZoomForResolution(n));e.animateInternal({zoom:r,duration:this.duration_,easing:Ti})}handleDraggerStart_(t){if(!this.dragging_&&t.target===this.element.firstElementChild){const e=this.element.firstElementChild;if(this.getMap().getView().beginInteraction(),this.startX_=t.clientX-parseFloat(e.style.left),this.startY_=t.clientY-parseFloat(e.style.top),this.dragging_=!0,this.dragListenerKeys_.length===0){const i=this.handleDraggerDrag_,n=this.handleDraggerEnd_,r=this.getMap().getOwnerDocument();this.dragListenerKeys_.push(W(r,le.POINTERMOVE,i,this),W(r,le.POINTERUP,n,this))}}}handleDraggerDrag_(t){if(this.dragging_){const e=t.clientX-this.startX_,i=t.clientY-this.startY_,n=this.getRelativePosition_(e,i);this.currentResolution_=this.getResolutionForPosition_(n),this.getMap().getView().setResolution(this.currentResolution_)}}handleDraggerEnd_(t){this.dragging_&&(this.getMap().getView().endInteraction(),this.dragging_=!1,this.startX_=void 0,this.startY_=void 0,this.dragListenerKeys_.forEach(et),this.dragListenerKeys_.length=0)}setThumbPosition_(t){const e=this.getPositionForResolution_(t),i=this.element.firstElementChild;this.direction_==Ls.HORIZONTAL?i.style.left=this.widthLimit_*e+"px":i.style.top=this.heightLimit_*e+"px"}getRelativePosition_(t,e){let i;return this.direction_===Ls.HORIZONTAL?i=t/this.widthLimit_:i=e/this.heightLimit_,at(i,0,1)}getResolutionForPosition_(t){return this.getMap().getView().getResolutionForValueFunction()(1-t)}getPositionForResolution_(t){const e=this.getMap().getView().getValueForResolutionFunction();return at(1-e(t),0,1)}render(t){if(!t.frameState||!this.sliderInitialized_&&!this.initSlider_())return;const e=t.frameState.viewState.resolution;this.currentResolution_=e,this.setThumbPosition_(e)}}const Ly=My;class Ay extends ye{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target}),this.extent=t.extent?t.extent:null;const e=t.className!==void 0?t.className:"ol-zoom-extent",i=t.label!==void 0?t.label:"E",n=t.tipLabel!==void 0?t.tipLabel:"Fit to extent",r=document.createElement("button");r.setAttribute("type","button"),r.title=n,r.appendChild(typeof i=="string"?document.createTextNode(i):i),r.addEventListener(O.CLICK,this.handleClick_.bind(this),!1);const o=e+" "+_e+" "+bi,a=this.element;a.className=o,a.appendChild(r)}handleClick_(t){t.preventDefault(),this.handleZoomToExtent()}handleZoomToExtent(){const t=this.getMap().getView(),e=this.extent?this.extent:t.getProjection().getExtent();t.fitInternal(rr(e))}}const Fy=Ay,Oy=Object.freeze(Object.defineProperty({__proto__:null,Attribution:vc,Control:ye,FullScreen:Cy,MousePosition:Sy,OverviewMap:Ry,Rotate:xc,ScaleLine:Py,Zoom:Ec,ZoomSlider:Ly,ZoomToExtent:Fy,defaults:Cc},Symbol.toStringTag,{value:"Module"}));function Dy(s,t,e,i){t&&t[e]?JSON.stringify(t[e])!==JSON.stringify(i)&&(s.removeControl(e),Th(s,e,i)):Th(s,e,i)}function Th(s,t,e){const i=Object.assign({},e);e&&e.layers&&(i.layers=yy(s,e.layers));const n=new Oy[t](i);s.map.addControl(n),s.mapControls[t]=n}var ky=Object.defineProperty,Ny=Object.getOwnPropertyDescriptor,Gy=(s,t,e,i)=>{for(var n=i>1?void 0:i?Ny(t,e):t,r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=(i?o(t,e,n):o(n))||n);return i&&n&&ky(t,e,n),n};class Vu extends Fu{constructor(){super(...arguments),this.value=50}render(){return Zi`
58
- <style>
59
- :host {
60
- display: block;
61
- }
62
- /* Inspired by https://www.codehim.com/html5-css3/html-css-image-comparison-slider/ */
63
- .eox-map-compare {
64
- --thumb-bgc: #fff;
65
- --thumb-w: 0.2rem;
66
-
67
- position: relative;
68
- }
69
- .eox-map-compare::after {
70
- content: "";
71
- display: block;
72
- padding-bottom: 50%;
73
- }
74
- .eox-map-compare__first,
75
- .eox-map-compare__second {
76
- height: 100%;
77
- object-fit: cover;
78
- position: absolute;
79
- top: 0;
80
- width: 100%;
81
- }
82
- .eox-map-compare__first {
83
- clip-path: polygon(
84
- 0% 0%,
85
- ${this.value}% 0%,
86
- ${this.value}% 100%,
87
- 0% 100%
88
- );
89
- }
90
- .eox-map-compare__second {
91
- clip-path: polygon(
92
- 100% 0%,
93
- ${this.value}% 0%,
94
- ${this.value}% 100%,
95
- 100% 100%
96
- );
97
- }
98
- .eox-map-compare__range {
99
- background-color: transparent;
100
- box-sizing: border-box;
101
- font-family: inherit;
102
- height: 100%;
103
- margin: 0;
104
- outline: none;
105
- position: absolute;
106
- top: 0;
107
- width: 100%;
108
- pointer-events: none;
109
- }
110
- .eox-map-compare__range::-moz-range-thumb {
111
- background-color: var(--thumb-bgc);
112
- cursor: ew-resize;
113
- height: 100%;
114
- width: var(--thumb-w);
115
- pointer-events: all;
116
- box-shadow: 0 0 5px black;
117
- clip-path: inset(0 -5px 0 -5px);
118
- }
119
- .eox-map-compare__range::-webkit-slider-thumb {
120
- background-color: var(--thumb-bgc);
121
- cursor: ew-resize;
122
- height: 100%;
123
- width: var(--thumb-w);
124
- pointer-events: all;
125
- position: relative;
126
- box-shadow: 0 0 5px black;
127
- -webkit-clip-path: inset(0 -5px 0 -5px);
128
- clip-path: inset(0 -5px 0 -5px);
129
- }
130
- .eox-map-compare__range::-moz-range-track {
131
- background: transparent;
132
- background-size: 100%;
133
- box-sizing: border-box;
134
- }
135
- .eox-map-compare__range::-webkit-slider-runnable-track {
136
- background: transparent;
137
- background-size: 100%;
138
- box-sizing: border-box;
139
- height: 100%;
140
- }
141
- .eox-map-compare__range,
142
- .eox-map-compare__range::-webkit-slider-runnable-track,
143
- .eox-map-compare__range::-webkit-slider-thumb {
144
- -webkit-appearance: none;
145
- appearance: none;
146
- }
147
- </style>
148
- <div class="eox-map-compare">
149
- <div class="eox-map-compare__first">
150
- <slot name="first"></slot>
151
- </div>
152
- <div class="eox-map-compare__second">
153
- <slot name="second"></slot>
154
- </div>
155
- <input
156
- type="range"
157
- class="eox-map-compare__range"
158
- min="0"
159
- max="100"
160
- value=${this.value}
161
- @input=${t=>this.value=parseInt(t.target.value)}
162
- />
163
- </div>
164
- `}}Gy([Ne()],Vu.prototype,"value",2);customElements.define("eox-map-compare",Vu);function Rh(s,t=!1){t?(s.addInteraction(new ur({condition:Wl})),"ontouchstart"in window||navigator.maxTouchPoints>0?s.addInteraction(new Gs({condition:function(e){return this.getPointerCount()===2||Wl(e)}})):s.addInteraction(new Gs)):(s.addInteraction(new ur),s.addInteraction(new Gs))}function jy(s){s.getInteractions().getArray().forEach(t=>{(t instanceof ur||t instanceof Gs)&&s.removeInteraction(t)})}var Vy=Object.defineProperty,zy=Object.getOwnPropertyDescriptor,ne=(s,t,e,i)=>{for(var n=i>1?void 0:i?zy(t,e):t,r=s.length-1,o;r>=0;r--)(o=s[r])&&(n=(i?o(t,e,n):o(n))||n);return i&&n&&Vy(t,e,n),n};let Ht=class extends qi{constructor(){super(...arguments),this.center=[0,0],this.zoom=0,this.map=new Mc({controls:[],layers:[],view:new Qt({center:[0,0],zoom:0})}),this.interactions={},this.selectInteractions={},this.mapControls={},this.addOrUpdateLayer=s=>{var t;s.interactions||(s.interactions=[]);const e=(t=s.properties)==null?void 0:t.id,i=e?vo(this,e):!1;let n;return i?(ku(this,s,i),n=i):(n=ps(this,s),this.map.addLayer(n)),n},this.removeInteraction=s=>{this.map.removeInteraction(this.interactions[s]),delete this.interactions[s],this.interactions[`${s}_modify`]&&(this.map.removeInteraction(this.interactions[`${s}_modify`]),delete this.interactions[`${s}_modify`])},this.removeSelect=s=>{this.selectInteractions[s].remove(),delete this.selectInteractions[s]},this.removeControl=s=>{this.map.removeControl(this.mapControls[s]),delete this.mapControls[s]},this.getLayerById=s=>vo(this,s),this.getFlatLayersArray=Gu}set controls(s){const t=this._controls,e=s;if(t){const i=Object.keys(t),n=Object.keys(e);for(let r=0,o=i.length;r<o;r++){const a=i[r];n.includes(a)||this.removeControl(a)}}if(e){const i=Object.keys(s);for(let n=0,r=i.length;n<r;n++){const o=i[n];Dy(this,t,o,s[o])}}this._controls=e}get controls(){return this._controls}set layers(s){const t=this._layers,e=JSON.parse(JSON.stringify(s)).reverse();t&&t.forEach(n=>{var r,o;if(!((r=n.properties)!=null&&r.id)||!e.find(a=>a.properties.id===n.properties.id)){const a=vo(this,(o=n.properties)==null?void 0:o.id);this.map.removeLayer(a)}}),e.forEach(n=>{this.addOrUpdateLayer(n)});const i=e.map(n=>{var r;return(r=n.properties)==null?void 0:r.id});this.map.getLayers().getArray().sort((n,r)=>i.indexOf(n.get("id"))-i.indexOf(r.get("id"))),this._layers=e}get layers(){return this._layers}set preventScroll(s){s?(jy(this.map),Rh(this.map,!0)):Rh(this.map),this._preventScroll=s}get preventScroll(){return this._preventScroll}set config(s){var t;this._config=s,this.center=(t=s.view)==null?void 0:t.center,this.zoom=s==null?void 0:s.view.zoom,this.layers=s==null?void 0:s.layers,this.controls=s==null?void 0:s.controls,this.preventScroll===void 0&&(this.preventScroll=s==null?void 0:s.preventScroll)}get config(){return this._config}render(){return Zi`
165
- <style>
166
- ${`
167
- :host {
168
- display: block;
169
- }
170
- .eox-map-tooltip {
171
- pointer-events: none !important;
172
- }
173
- `}
174
- ${Jp}
175
- </style>
176
- <div style="width: 100%; height: 100%"></div>
177
- <slot></slot>
178
- `}buffer(s,t){return Kt(s,t)}firstUpdated(){if(this.sync){const s=document.querySelector(this.sync);s&&this.map.setView(s.map.getView())}else this.center&&this.map.getView().setCenter(vh(this.center)),this.zoom&&this.map.getView().setZoom(this.zoom);this.map.setTarget(this.renderRoot.querySelector("div")),this.map.on("loadend",()=>{this.dispatchEvent(new CustomEvent("loadend",{detail:this.map}))})}updated(s){s.has("center")&&this.map.getView().setCenter(vh(this.center)),s.has("zoom")&&this.map.getView().setZoom(this.zoom||0)}};ne([Ne({attribute:!1,type:Array})],Ht.prototype,"center",2);ne([Ne({attribute:!1,type:Array})],Ht.prototype,"layers",1);ne([Ne({attribute:"prevent-scroll",type:Boolean})],Ht.prototype,"preventScroll",1);ne([Ne({attribute:!1,type:Object})],Ht.prototype,"config",1);ne([Ne({attribute:!1,type:Number})],Ht.prototype,"zoom",2);ne([Ne()],Ht.prototype,"sync",2);ne([Tr()],Ht.prototype,"map",2);ne([Tr()],Ht.prototype,"interactions",2);ne([Tr()],Ht.prototype,"selectInteractions",2);ne([Tr()],Ht.prototype,"mapControls",2);Ht=ne([hd("eox-map")],Ht);export{Ht as EOxMap};