1 line
1.7 MiB
Plaintext
1 line
1.7 MiB
Plaintext
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),a=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:"Module"}),r},l=(o,a,l)=>(l=null!=o?e(i(o)):{},((e,i,o,a)=>{if(i&&"object"==typeof i||"function"==typeof i)for(var l,c=r(i),u=0,h=c.length;u<h;u++)l=c[u],s.call(e,l)||void 0===l||t(e,l,{get:(e=>i[e]).bind(null,l),enumerable:!(a=n(i,l))||a.enumerable});return e})(!a&&o&&o.__esModule&&s.call(o,"default")?l:t(l,"default",{value:o,enumerable:!0}),o)),c=(e=>"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(e,{get:(e,t)=>("undefined"!=typeof require?require:e)[t]}):e)(function(e){if("undefined"!=typeof require)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const n of e)if("childList"===n.type)for(const e of n.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)}).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();var u,h=Object.prototype,d=Symbol("undefined"),p=function(e){return e[e.ADD=0]="ADD",e[e.ONCE=1]="ONCE",e[e.REMOVE=2]="REMOVE",e}(p||{}),f=1,g=class{_descriptors;_mixins;_isInit;_lazyChains;_values;_revisions;source;proto;_parent;_listeners;_listenersVersion=1;_inheritedEnd=-1;_flattenedVersion=0;constructor(e){this._parent=void 0,this._descriptors=void 0,this._mixins=void 0,this._lazyChains=void 0,this._values=void 0,this._revisions=void 0,this._isInit=!1,this.source=e,this.proto=void 0===e.constructor?void 0:e.constructor.prototype,this._listeners=void 0}get parent(){let e=this._parent;if(void 0===e){let t=m(this.source);this._parent=e=null===t||t===h?null:w(t)}return e}setInitializing(){this._isInit=!0}unsetInitializing(){this._isInit=!1}isInitializing(){return this._isInit}isPrototypeMeta(e){return this.proto===this.source&&this.source===e}_getOrCreateOwnMap(e){return this[e]||(this[e]=Object.create(null))}_getOrCreateOwnSet(e){return this[e]||(this[e]=new Set)}_findInheritedMap(e,t){let n=this;for(;null!==n;){let r=n[e];if(void 0!==r){let e=r.get(t);if(void 0!==e)return e}n=n.parent}}_hasInInheritedSet(e,t){let n=this;for(;null!==n;){let r=n[e];if(void 0!==r&&r.has(t))return!0;n=n.parent}return!1}valueFor(e){let t=this._values;return void 0!==t?t[e]:void 0}setValueFor(e,t){this._getOrCreateOwnMap("_values")[e]=t}revisionFor(e){let t=this._revisions;return void 0!==t?t[e]:void 0}setRevisionFor(e,t){this._getOrCreateOwnMap("_revisions")[e]=t}writableLazyChainsFor(e){let t=this._getOrCreateOwnMap("_lazyChains"),n=t[e];return void 0===n&&(n=t[e]=[]),n}readableLazyChainsFor(e){let t=this._lazyChains;if(void 0!==t)return t[e]}addMixin(e){this._getOrCreateOwnSet("_mixins").add(e)}hasMixin(e){return this._hasInInheritedSet("_mixins",e)}forEachMixins(e){let t,n=this;for(;null!==n;){let r=n._mixins;void 0!==r&&(t=void 0===t?new Set:t,r.forEach(n=>{t.has(n)||(t.add(n),e(n))})),n=n.parent}}writeDescriptors(e,t){(this._descriptors||(this._descriptors=new Map)).set(e,t)}peekDescriptors(e){let t=this._findInheritedMap("_descriptors",e);return t===d?void 0:t}removeDescriptors(e){this.writeDescriptors(e,d)}forEachDescriptors(e){let t,n=this;for(;null!==n;){let r=n._descriptors;void 0!==r&&(t=void 0===t?new Set:t,r.forEach((n,r)=>{t.has(r)||(t.add(r),n!==d&&e(r,n))})),n=n.parent}}addToListeners(e,t,n,r,i){this.pushListener(e,t,n,r?p.ONCE:p.ADD,i)}removeFromListeners(e,t,n){this.pushListener(e,t,n,p.REMOVE)}pushListener(e,t,n,r,i=!1){let s=this.writableListeners(),o=_(s,e,t,n);if(-1!==o&&o<this._inheritedEnd&&(s.splice(o,1),this._inheritedEnd--,o=-1),-1===o)s.push({event:e,target:t,method:n,kind:r,sync:i});else{let e=s[o];r===p.REMOVE&&e.kind!==p.REMOVE?s.splice(o,1):(e.kind=r,e.sync=i)}}writableListeners(){return this._flattenedVersion!==f||this.source!==this.proto&&-1!==this._inheritedEnd||f++,-1===this._inheritedEnd&&(this._inheritedEnd=0,this._listeners=[]),this._listeners}flattenedListeners(){if(this._flattenedVersion<f){let e=this.parent;if(null!==e){let t=e.flattenedListeners();if(void 0!==t)if(void 0===this._listeners)this._listeners=t;else{let e=this._listeners;this._inheritedEnd>0&&(e.splice(0,this._inheritedEnd),this._inheritedEnd=0);for(let n of t)-1===_(e,n.event,n.target,n.method)&&(e.unshift(n),this._inheritedEnd++)}}this._flattenedVersion=f}return this._listeners}matchingListeners(e){let t,n=this.flattenedListeners();if(void 0!==n)for(let r of n)r.event!==e||r.kind!==p.ADD&&r.kind!==p.ONCE||(void 0===t&&(t=[]),t.push(r.target,r.method,r.kind===p.ONCE));return t}observerEvents(){let e,t=this.flattenedListeners();if(void 0!==t)for(let n of t)n.kind!==p.ADD&&n.kind!==p.ONCE||-1===n.event.indexOf(":change")||(void 0===e&&(e=[]),e.push(n));return e}},m=Object.getPrototypeOf,y=new WeakMap;function v(e,t){y.set(e,t)}function b(e){let t=y.get(e);if(void 0!==t)return t;let n=m(e);for(;null!==n;){if(t=y.get(n),void 0!==t)return t.proto!==n&&(t.proto=n),t;n=m(n)}return null}var w=function(e){let t=b(e);if(null!==t&&t.source===e)return t;let n=new g(e);return v(e,n),n};function _(e,t,n,r){for(let i=e.length-1;i>=0;i--){let s=e[i];if(s.event===t&&s.target===n&&s.method===r)return i}return-1}function x(e){let[t,n,r]=e;return 3===e.length&&("function"==typeof t||"object"==typeof t&&null!==t)&&"string"==typeof n&&("object"==typeof r&&null!==r||void 0===r)}function C(e){let t=function(){return e};return A(t),t}var S=class{enumerable=!0;configurable=!0;_dependentKeys=void 0;_meta=void 0;setup(e,t,n,r){r.writeDescriptors(t,this)}teardown(e,t,n){n.removeDescriptors(t)}};function k(e,t){return function(){return t.get(this,e)}}function E(e,t){let n=function(n){return t.set(this,e,n)};return R.add(n),n}var R=new WeakSet;function T(e,t){let n=function(t,n,r,i){let s=3===arguments.length?w(t):i;return e.setup(t,n,r,s),{enumerable:e.enumerable,configurable:e.configurable,get:k(n,e),set:E(n,e)}};return A(n,e),Object.setPrototypeOf(n,t.prototype),n}var L=new WeakMap;function I(e,t,n){let r=void 0===n?b(e):n;if(null!==r)return r.peekDescriptors(t)}function P(e){return L.get(e)}function M(e){return"function"==typeof e&&L.has(e)}function A(e,t=!0){L.set(e,t)}var O={ENABLE_OPTIONAL_FEATURES:!1,EXTEND_PROTOTYPES:{Array:!1},LOG_STACKTRACE_ON_DEPRECATION:!0,LOG_VERSION:!0,LOG_INSPECTOR_HINT:!0,RAISE_ON_DEPRECATION:!1,STRUCTURED_PROFILE:!1,_DEBUG_RENDER_TREE:!1,_ALL_DEPRECATIONS_ENABLED:!1,_OVERRIDE_DEPRECATION_VERSION:null,_DEFAULT_ASYNC_OBSERVERS:!1,_RERENDER_LOOP_LIMIT:1e3,FEATURES:{}},N=globalThis.EmberENV;if("object"==typeof N&&null!==N){for(let t in N){if(!Object.prototype.hasOwnProperty.call(N,t)||"EXTEND_PROTOTYPES"===t||"EMBER_LOAD_HOOKS"===t)continue;let e=O[t];O[t]=!0===e?!1!==N[t]:!1===e?!0===N[t]:N[t]}let{FEATURES:e}=N;if("object"==typeof e&&null!==e)for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(O.FEATURES[t]=!0===e[t])}function F(){return O}var D,z,j,U,B,$,q,V,W=()=>{},H=new WeakMap,G=Symbol("BrandedArray");function K(e){return Array.isArray(e)&&G in e}function Z(e,t){if(null===e)return t;if(K(e))return e.push(t),e;{const n=[e,t];return n[G]=!0,n}}function Y(e,t){K(e)?e.forEach(t):null!==e&&t(e)}function X(e,t){if(K(e)&&e.length>1){let n=e.indexOf(t),r=e.length-1;return n!==r&&(e[n]=e[r]),e.length=r,e}return null}function J(e){let t=H.get(e);return void 0===t&&(t={parents:null,children:null,eagerDestructors:null,destructors:null,state:0},H.set(e,t)),t}function Q(e,t){let n=J(e),r=J(t);return n.children=Z(n.children,t),r.parents=Z(r.parents,e),t}function ee(e,t,n=!1){let r=J(e),i=n?"eagerDestructors":"destructors";return r[i]=Z(r[i],t),t}function te(e){let t=J(e);if(t.state>=1)return;let{parents:n,children:r,eagerDestructors:i,destructors:s}=t;t.state=1,Y(r,te),Y(i,t=>{t(e)}),Y(s,t=>{D(e,t)}),z(()=>{Y(n,t=>{!function(e,t){let n=J(t);2!==n.state&&(n.children=X(n.children,e))}(e,t)}),t.state=2})}function ne(e){let t=H.get(e);return void 0!==t&&null!==t.children}function re(e){let t=H.get(e);return void 0!==t&&t.state>=1}function ie(e){let t=H.get(e);return void 0!==t&&t.state>=2}var se=1;function oe(){se++}var ae=Symbol("TAG_COMPUTE");function le(e){return e[ae]()}function ce(e,t){return t>=e[ae]()}var ue=Symbol("TAG_TYPE"),he=class e{static combine(t){switch(t.length){case 0:return me;case 1:return t[0];default:{let n=new e(2);return n.subtag=t,n}}}revision=1;lastChecked=1;lastValue=1;isUpdating=!1;subtag=null;subtagBufferCache=null;constructor(e){this[ue]=e}[ae](){let{lastChecked:e}=this;if(this.isUpdating)this.lastChecked=++se;else if(e!==se){this.isUpdating=!0,this.lastChecked=se;try{let{subtag:e,revision:t}=this;if(null!==e)if(Array.isArray(e))for(const n of e){let e=n[ae]();t=Math.max(e,t)}else{let n=e[ae]();n===this.subtagBufferCache?t=Math.max(t,this.lastValue):(this.subtagBufferCache=null,t=Math.max(t,n))}this.lastValue=t}finally{this.isUpdating=!1}}return this.lastValue}static updateTag(e,t){let n=e,r=t;r===me?n.subtag=null:(n.subtagBufferCache=r[ae](),n.subtag=r)}static dirtyTag(e,t){e.revision=++se,W()}},de=he.dirtyTag,pe=he.updateTag;function fe(){return new he(0)}function ge(){return new he(1)}var me=new he(3);function ye(e){return e===me}var ve=class{[ue]=100;[ae](){return NaN}},be=new ve,we=class{[ue]=101;[ae](){return se}},_e=new we,xe=he.combine,Ce=ge(),Se=ge(),ke=ge();le(Ce),de(Ce),le(Ce),pe(Ce,xe([Se,ke])),le(Ce),de(Se),le(Ce),de(ke),le(Ce),pe(Ce,ke),le(Ce),de(ke),le(Ce);var Ee=class{tags=new Set;last=null;add(e){e!==me&&(this.tags.add(e),this.last=e)}combine(){let{tags:e}=this;return 0===e.size?me:1===e.size?this.last:xe(Array.from(this.tags))}},Re=null,Te=[];function Le(){Te.push(Re),Re=new Ee}function Ie(){let e=Re;return Re=Te.pop()||null,function(e){if(null==e)throw new Error("Expected value to be present");return e}(e).combine()}function Pe(){Te.push(Re),Re=null}function Me(){Re=Te.pop()||null}function Ae(){for(;Te.length>0;)Te.pop();Re=null}function Oe(){return null!==Re}function Ne(e){null!==Re&&Re.add(e)}var Fe=Symbol("FN"),De=Symbol("LAST_VALUE"),ze=Symbol("TAG"),je=Symbol("SNAPSHOT");function Ue(e){return{[Fe]:e,[De]:void 0,[ze]:void 0,[je]:-1}}function Be(e){let t=e[Fe],n=e[ze],r=e[je];if(void 0!==n&&ce(n,r))Ne(n);else{Le();try{e[De]=t()}finally{n=Ie(),e[ze]=n,e[je]=le(n),Ne(n)}}return e[De]}function $e(e){return ye(e[ze])}function qe(e){let t;Le();try{e()}finally{t=Ie()}return t}function Ve(e){Pe();try{return e()}finally{Me()}}var We=new WeakMap;function He(e,t,n){let r=void 0===n?We.get(e):n;if(void 0===r)return;let i=r.get(t);void 0!==i&&de(i,!0)}function Ge(e){let t=We.get(e);return void 0===t&&(t=new Map,We.set(e,t)),t}function Ke(e,t,n){let r=void 0===n?Ge(e):n,i=r.get(t);return void 0===i&&(i=ge(),r.set(t,i)),i}function Ze(e){return null!==e&&("object"==typeof e||"function"==typeof e)}function Ye(e){return e}function Xe(e){return e}function Je(e){return!!e&&e.length>0}function Qe(e){return 0===e.length?void 0:e[e.length-1]}function et(e){return 0===e.length?void 0:e[0]}function tt(){return Object.create(null)}function nt(e){return null!=e}function rt(e){return"function"==typeof e||"object"==typeof e&&null!==e}var it=class{stack;current=null;constructor(e=[]){this.stack=e}get size(){return this.stack.length}push(e){this.current=e,this.stack.push(e)}pop(){let e=this.stack.pop();return this.current=Qe(this.stack)??null,void 0===e?null:e}nth(e){let t=this.stack.length;return t<e?null:this.stack[t-e]}isEmpty(){return 0===this.stack.length}snapshot(){return[...this.stack]}toArray(){return this.stack}},st=Symbol("REFERENCE"),ot=class{[st];tag=null;lastRevision=1;lastValue;children=null;compute=null;update=null;debugLabel;constructor(e){this[st]=e}};function at(e){const t=new ot(2);return t.tag=me,t.lastValue=e,t}var lt=at(void 0),ct=at(null),ut=at(!0),ht=at(!1);function dt(e){const t=new ot(0);return t.lastValue=e,t.tag=me,t}function pt(e){const t=new ot(2);return t.lastValue=e,t.tag=me,t}function ft(e,t=null){const n=new ot(1);return n.compute=e,n.update=t,n}function gt(e){return bt(e)?ft(()=>wt(e),null,e.debugLabel):e}function mt(e){return 3===e[st]}function yt(e){const t=ft(()=>wt(e),t=>_t(e,t));return t.debugLabel=e.debugLabel,t[st]=3,t}function vt(e){return e.tag===me}function bt(e){return null!==e.update}function wt(e){const t=e;let{tag:n}=t;if(n===me)return t.lastValue;const{lastRevision:r}=t;let i;if(null!==n&&ce(n,r))i=t.lastValue;else{const{compute:e}=t,r=qe(()=>{i=t.lastValue=e()});n=t.tag=r,t.lastRevision=le(r)}return Ne(n),i}function _t(e,t){(0,e.update)(t)}function xt(e,t){const n=e,r=n[st];let i,s=n.children;if(null===s)s=n.children=new Map;else{const e=s.get(t);if(e)return e}if(2===r){const e=wt(n);i=nt(e)?pt(e[t]):lt}else i=ft(()=>{const e=wt(n);if(nt(e))return B(e,t)},e=>{const r=wt(n);if(nt(r))return $(r,t,e)});return s.set(t,i),i}function Ct(e,t){let n=e;for(const r of t)n=xt(n,r);return n}var St=new WeakMap;function kt(e){return St.get(e)}function Et(e,t){St.set(e,t)}function Rt(e){if("symbol"==typeof e)return null;const t=Number(e);return isNaN(t)?null:t%1==0?t:null}var Tt=class{constructor(e){this.named=e}get(e,t){const n=this.named[t];if(void 0!==n)return wt(n)}has(e,t){return t in this.named}ownKeys(){return Object.keys(this.named)}isExtensible(){return!1}getOwnPropertyDescriptor(e,t){return{enumerable:!0,configurable:!0}}},Lt=class{constructor(e){this.positional=e}get(e,t){let{positional:n}=this;if("length"===t)return n.length;const r=Rt(t);return null!==r&&r>=0&&r<n.length?wt(n[r]):e[t]}isExtensible(){return!1}has(e,t){const n=Rt(t);return null!==n&&n>=0&&n<this.positional.length}},It=e=>{const{named:t,positional:n}=e,r=new Tt(t),i=new Lt(n),s=Object.create(null),o=new Proxy(s,r),a=new Proxy([],i);return Et(o,(e,n)=>function(e,t){return qe(()=>{t in e&&wt(e[t])})}(t,n)),Et(a,(e,t)=>function(e,t){return qe(()=>{"[]"===t&&e.forEach(wt);const n=Rt(t);null!==n&&n>=0&&n<e.length&&wt(e[n])})}(n,t)),{named:o,positional:a}};function Pt(e,t){return Array.isArray(e)?e[t]:e.objectAt(t)}var Mt=Symbol("SELF_TAG");function At(e,t,n=!1,r){let i=kt(e);return void 0!==i?i(e,t,n):Ke(e,t,r)}function Ot(e){return Ze(e)?Ke(e,Mt):me}function Nt(e,t){He(e,t),He(e,Mt)}var Ft=new WeakSet;function Dt(e,t,n){let r=e.readableLazyChainsFor(t);if(void 0!==r){if(Ze(n))for(let[e,t]of r)pe(e,jt(n,t,Ge(n),b(n)));r.length=0}}function zt(e,t,n,r){let i=[];for(let s of t)Ut(i,e,s,n,r);return xe(i)}function jt(e,t,n,r){return xe(Ut([],e,t,n,r))}function Ut(e,t,n,r,i){let s,o,a=t,l=r,c=i,u=n.length,h=-1;for(;;){let t=h+1;if(h=n.indexOf(".",t),-1===h&&(h=u),s=n.slice(t,h),"@each"===s&&h!==u){t=h+1,h=n.indexOf(".",t);let r=a.length;if("number"!=typeof r||!Array.isArray(a)&&!("objectAt"in a))break;if(0===r){e.push(At(a,"[]"));break}s=-1===h?n.slice(t):n.slice(t,h);for(let t=0;t<r;t++){let n=Pt(a,t);n&&(e.push(At(n,s,!0)),c=b(n),o=null!==c?c.peekDescriptors(s):void 0,void 0!==o&&"string"==typeof o.altKey&&n[s])}e.push(At(a,"[]",!0,l));break}let r=At(a,s,!0,l);if(o=null!==c?c.peekDescriptors(s):void 0,e.push(r),h===u){Ft.has(o)&&a[s];break}if(void 0===o)a=s in a||"function"!=typeof a.unknownProperty?a[s]:a.unknownProperty(s);else if(Ft.has(o))a=a[s];else{let t=c.source===a?c:w(a),i=t.revisionFor(s);if(void 0===i||!ce(r,i)){let r=t.writableLazyChainsFor(s),i=n.substring(h+1),o=ge();r.push([o,i]),e.push(o);break}a=t.valueFor(s)}if(!Ze(a))break;l=Ge(a),c=b(a)}return e}var Bt=/\.(_super|call\(this|apply\(this)/,$t=Function.prototype.toString,qt=$t.call(function(){return this}).indexOf("return this")>-1?function(e){return Bt.test($t.call(e))}:function(){return!0},Vt=new WeakMap,Wt=Object.freeze(function(){});function Ht(e){let t=Vt.get(e);return void 0===t&&(t=qt(e),Vt.set(e,t)),t}Vt.set(Wt,!1);var Gt=class{listeners=void 0;observers=void 0},Kt=new WeakMap;function Zt(e){let t=Kt.get(e);return void 0===t&&(t=new Gt,Kt.set(e,t)),t}function Yt(e){return Kt.get(e)}function Xt(e,t){Zt(e).observers=t}function Jt(e,t){Zt(e).listeners=t}var Qt=new WeakSet;function en(e,t){return Ht(e)?!Qt.has(t)&&Ht(t)?tn(e,tn(t,Wt)):tn(e,t):e}function tn(e,t){function n(){let n=this._super;this._super=t;let r=e.apply(this,arguments);return this._super=n,r}Qt.add(n);let r=Kt.get(e);return void 0!==r&&Kt.set(n,r),n}function nn(e,t,n,r,i,s=!0){r||"function"!=typeof n||(r=n,n=null),w(e).addToListeners(t,n,r,!0===i,s)}function rn(e,t,n,r){let i,s;"object"==typeof n?(i=n,s=r):(i=null,s=n),w(e).removeFromListeners(t,i,s)}function sn(e,t,n,r,i){if(void 0===r){let n=void 0===i?b(e):i;r=null!==n?n.matchingListeners(t):void 0}if(void 0===r||0===r.length)return!1;for(let s=r.length-3;s>=0;s-=3){let i=r[s],o=r[s+1],a=r[s+2];if(!o)continue;a&&rn(e,t,i,o),i||(i=e);let l=typeof o;"string"!==l&&"symbol"!==l||(o=i[o]),o.apply(i,n)}return!0}function on(e,t){let n=b(e);if(null===n)return!1;let r=n.matchingListeners(t);return void 0!==r&&r.length>0}function an(...e){let t=e.pop();return Jt(t,e),t}function ln(e){return e+":change"}var cn=!O._DEFAULT_ASYNC_OBSERVERS,un=new Map,hn=new Map;function dn(e,t,n,r,i=cn){let s=ln(t);nn(e,s,n,r,!1,i);let o=b(e);null!==o&&(o.isPrototypeMeta(e)||o.isInitializing())||fn(e,s,i)}function pn(e,t,n,r,i=cn){let s=ln(t),o=b(e);null!==o&&(o.isPrototypeMeta(e)||o.isInitializing())||yn(e,s,i),rn(e,s,n,r)}function fn(e,t,n=!1){let r=function(e,t){let n=!0===t?un:hn;return n.has(e)||(n.set(e,new Map),ee(e,()=>function(e){un.size>0&&un.delete(e),hn.size>0&&hn.delete(e)}(e),!0)),n.get(e)}(e,n);if(r.has(t))r.get(t).count++;else{let n=t.substring(0,t.lastIndexOf(":")),i=jt(e,n,Ge(e),b(e));r.set(t,{count:1,path:n,tag:i,lastRevision:le(i),suspended:!1})}}var gn=!1,mn=[];function yn(e,t,n=!1){if(!0===gn)return void mn.push([e,t,n]);let r=!0===n?un:hn,i=r.get(e);if(void 0!==i){let n=i.get(t);n.count--,0===n.count&&(i.delete(t),0===i.size&&r.delete(e))}}function vn(e){hn.has(e)&&hn.get(e).forEach(t=>{t.tag=jt(e,t.path,Ge(e),b(e)),t.lastRevision=le(t.tag)}),un.has(e)&&un.get(e).forEach(t=>{t.tag=jt(e,t.path,Ge(e),b(e)),t.lastRevision=le(t.tag)})}var bn=0;function wn(e){let t=le(_e);bn!==t&&(bn=t,hn.forEach((t,n)=>{let r=b(n);t.forEach((t,i)=>{if(!ce(t.tag,t.lastRevision)){let s=()=>{try{sn(n,i,[n,t.path],void 0,r)}finally{t.tag=jt(n,t.path,Ge(n),b(n)),t.lastRevision=le(t.tag)}};e?e("actions",s):s()}})}))}function _n(){un.forEach((e,t)=>{let n=b(t);e.forEach((e,r)=>{if(!e.suspended&&!ce(e.tag,e.lastRevision))try{e.suspended=!0,sn(t,r,[t,e.path],void 0,n)}finally{e.tag=jt(t,e.path,Ge(t),b(t)),e.lastRevision=le(e.tag),e.suspended=!1}})})}function xn(e,t,n){let r=un.get(e);if(!r)return;let i=r.get(ln(t));i&&(i.suspended=n)}var Cn=()=>{},{toString:Sn}=Object.prototype,{toString:kn}=Function.prototype,{isArray:En}=Array,{keys:Rn}=Object,{stringify:Tn}=JSON,Ln=100,In=/^[\w$]+$/;function Pn(e){return"number"==typeof e&&2===arguments.length?this:Mn(e,0)}function Mn(e,t,n){let r=!1;switch(typeof e){case"undefined":return"undefined";case"object":if(null===e)return"null";if(En(e)){r=!0;break}if(e.toString===Sn||void 0===e.toString)break;return e.toString();case"function":return e.toString===kn?e.name?`[Function:${e.name}]`:"[Function]":e.toString();case"string":return Tn(e);default:return e.toString()}if(void 0===n)n=new WeakSet;else if(n.has(e))return"[Circular]";return n.add(e),r?function(e,t,n){if(t>4)return"[Array]";let r="[";for(let i=0;i<e.length;i++){if(r+=0===i?" ":", ",i>=Ln){r+=`... ${e.length-Ln} more items`;break}r+=Mn(e[i],t,n)}return r+=" ]",r}(e,t+1,n):function(e,t,n){if(t>4)return"[Object]";let r="{",i=Rn(e);for(let s=0;s<i.length;s++){if(r+=0===s?" ":", ",s>=Ln){r+=`... ${i.length-Ln} more keys`;break}let o=i[s];Cn(),r+=`${An(String(o))}: ${Mn(e[o],t,n)}`}return r+=" }",r}(e,t+1,n)}function An(e){return In.test(e)?e:Tn(e)}var On=/\.@each$/;function Nn(e,t){let n=e.indexOf("{");n<0?t(e.replace(On,".[]")):Fn("",e,n,t)}function Fn(e,t,n,r){let i,s,o=t.indexOf("}"),a=0,l=t.substring(n+1,o).split(","),c=t.substring(o+1);for(e+=t.substring(0,n),s=l.length;a<s;)i=c.indexOf("{"),i<0?r((e+l[a++]+c).replace(On,".[]")):Fn(e+l[a++],c,i,r)}function Dn(e,t,n,r,i){let s=void 0===i?w(e):i,o=I(e,t,s),a=void 0!==o;a&&o.teardown(e,t,s),M(n)?zn(e,t,n,s):null==n?jn(e,t,r,a,!0):Object.defineProperty(e,t,n),s.isPrototypeMeta(e)||vn(e)}function zn(e,t,n,r){let i;return i=n(e,t,void 0,r),Object.defineProperty(e,t,i),n}function jn(e,t,n,r,i=!0){return!0===r||!1===i?Object.defineProperty(e,t,{configurable:!0,enumerable:i,writable:!0,value:n}):e[t]=n,n}var Un=Symbol("PROPERTY_DID_CHANGE"),Bn=0;function $n(e,t,n,r){let i=void 0===n?b(e):n;null!==i&&(i.isInitializing()||i.isPrototypeMeta(e))||(Nt(e,t),Bn<=0&&_n(),Un in e&&(4===arguments.length?e[Un](t,r):e[Un](t)))}function qn(){Bn++,gn=!0}function Vn(){--Bn<=0&&(_n(),function(){gn=!1;for(let[e,t,n]of mn)yn(e,t,n);mn=[]}())}function Wn(e){qn();try{e()}finally{Vn()}}function Hn(){}var Gn=class extends S{_readOnly=!1;_hasConfig=!1;_getter=void 0;_setter=void 0;constructor(e){super();let t=e[e.length-1];if("function"==typeof t||null!==t&&"object"==typeof t){this._hasConfig=!0;let t=e.pop();if("function"==typeof t)this._getter=t;else{const e=t;this._getter=e.get||Hn,this._setter=e.set}}e.length>0&&this._property(...e)}setup(e,t,n,r){if(super.setup(e,t,n,r),!1===this._hasConfig){let{get:e,set:t}=n;void 0!==e&&(this._getter=e),void 0!==t&&(this._setter=function(n,r){let i=t.call(this,r);return void 0!==e&&void 0===i?e.call(this):i})}}_property(...e){let t=[];function n(e){t.push(e)}for(let r of e)Nn(r,n);this._dependentKeys=t}get(e,t){let n,r=w(e),i=Ge(e),s=Ke(e,t,i),o=r.revisionFor(t);if(void 0!==o&&ce(s,o))n=r.valueFor(t);else{let{_getter:o,_dependentKeys:a}=this;Ve(()=>{n=o.call(e,t)}),void 0!==a&&pe(s,zt(e,a,i,r)),r.setValueFor(t,n),r.setRevisionFor(t,le(s)),Dt(r,t,n)}return Ne(s),Array.isArray(n)&&Ne(Ke(n,"[]")),n}set(e,t,n){this._readOnly&&this._throwReadOnlyError(e,t);let r,i=w(e);i.isInitializing()&&void 0!==this._dependentKeys&&this._dependentKeys.length>0&&"function"==typeof e[Un]&&e.isComponent&&dn(e,t,()=>{e[Un](t)},void 0,!0);try{qn(),r=this._set(e,t,n,i),Dt(i,t,r);let s=Ge(e),o=Ke(e,t,s),{_dependentKeys:a}=this;void 0!==a&&pe(o,zt(e,a,s,i)),i.setRevisionFor(t,le(o))}finally{Vn()}return r}_throwReadOnlyError(e,t){throw new Error(`Cannot set read-only property "${t}" on object: ${Pn(e)}`)}_set(e,t,n,r){let i,s=void 0!==r.revisionFor(t),o=r.valueFor(t),{_setter:a}=this;xn(e,t,!0);try{i=a.call(e,t,n,o)}finally{xn(e,t,!1)}return s&&o===i||(r.setValueFor(t,i),$n(e,t,r,n)),i}teardown(e,t,n){void 0!==n.revisionFor(t)&&(n.setRevisionFor(t,void 0),n.setValueFor(t,void 0)),super.teardown(e,t,n)}},Kn=class extends Gn{get(e,t){let n,r=w(e),i=Ge(e),s=Ke(e,t,i),o=r.revisionFor(t);if(void 0!==o&&ce(s,o))n=r.valueFor(t);else{let{_getter:i}=this,o=qe(()=>{n=i.call(e,t)});pe(s,o),r.setValueFor(t,n),r.setRevisionFor(t,le(s)),Dt(r,t,n)}return Ne(s),Array.isArray(n)&&Ne(Ke(n,"[]",i)),n}},Zn=class extends Function{readOnly(){return P(this)._readOnly=!0,this}meta(e){let t=P(this);return 0===arguments.length?t._meta||{}:(t._meta=e,this)}get _getter(){return P(this)._getter}set enumerable(e){P(this).enumerable=e}};function Yn(...e){return x(e)?T(new Gn([]),Zn)(e[0],e[1],e[2]):T(new Gn(e),Zn)}function Xn(...e){return T(new Kn(e),Zn)}function Jn(e,t){return Boolean(I(e,t))}function Qn(e,t){let n=b(e);return n?n.valueFor(t):void 0}var er=new WeakSet;function tr(e){return!!Ze(e)&&er.has(e)}function nr(e){Ze(e)&&er.add(e)}var rr=new WeakSet;function ir(e){return rr.has(e)}var sr=class{size=0;misses=0;hits=0;constructor(e,t,n=new Map){this.limit=e,this.func=t,this.store=n}get(e){return this.store.has(e)?(this.hits++,this.store.get(e)):(this.misses++,this.set(e,this.func(e)))}set(e,t){return this.limit>this.size&&(this.size++,this.store.set(e,t)),t}purge(){this.store.clear(),this.size=0,this.hits=0,this.misses=0}},or=new sr(1e3,e=>e.indexOf("."));function ar(e){return"string"==typeof e&&-1!==or.get(e)}var lr=Symbol("PROXY_CONTENT");function cr(e){return"object"==typeof e&&null!==e&&"function"==typeof e.unknownProperty}function ur(e,t){return ar(t)?dr(e,t):hr(e,t)}function hr(e,t){if(null==e)return;let n;return"object"==typeof e||"function"==typeof e?(n=e[t],void 0===n&&"object"==typeof e&&!(t in e)&&cr(e)&&(n=e.unknownProperty(t)),Oe()&&(Ne(Ke(e,t)),(Array.isArray(n)||ir(n))&&Ne(Ke(n,"[]")))):n=e[t],n}function dr(e,t,n){let r="string"==typeof t?t.split("."):t;for(let i of r){if(null==e||e.isDestroyed)return;if(n&&("__proto__"===i||"constructor"===i))return;e=hr(e,i)}return e}hr("foo","a"),hr("foo",1),hr({},"a"),hr({},1),hr({unknownProperty(){}},"a"),hr({unknownProperty(){}},1),ur({},"foo"),ur({},"foo.bar");var pr={};function fr(e,t){let n=e;do{let e=Object.getOwnPropertyDescriptor(n,t);if(void 0!==e)return e;n=Object.getPrototypeOf(n)}while(null!==n);return null}function gr(e,t,n,r){return e.isDestroyed?n:ar(t)?function(e,t,n,r){let i=t.split("."),s=i.pop(),o=dr(e,i,!0);if(null!=o)return gr(o,s,n);if(!r)throw new Error(`Property set failed: object in path "${i.join(".")}" could not be found.`)}(e,t,n,r):mr(e,t,n)}function mr(e,t,n){let r,i=fr(e,t);return null!==i&&R.has(i.set)?(e[t]=n,n):(r=e[t],void 0!==r||"object"!=typeof e||t in e||"function"!=typeof e.setUnknownProperty?(e[t]=n,r!==n&&$n(e,t)):e.setUnknownProperty(t,n),n)}function yr(e,t,n){return gr(e,t,n,!0)}function vr(e){return T(new wr(e),br)}nr(pr),qe(()=>hr({},"a")),qe(()=>hr({},1)),qe(()=>hr({a:[]},"a")),qe(()=>hr({a:pr},"a"));var br=class extends Function{readOnly(){return P(this).readOnly(),this}oneWay(){return P(this).oneWay(),this}meta(e){let t=P(this);if(0===arguments.length)return t._meta||{};t._meta=e}},wr=class extends S{altKey;constructor(e){super(),this.altKey=e}setup(e,t,n,r){super.setup(e,t,n,r),Ft.add(this)}get(e,t){let n,r=w(e),i=Ge(e),s=Ke(e,t,i);Ve(()=>{n=ur(e,this.altKey)});let o=r.revisionFor(t);return void 0!==o&&ce(s,o)||(pe(s,jt(e,this.altKey,i,r)),r.setRevisionFor(t,le(s)),Dt(r,t,n)),Ne(s),n}set(e,t,n){return gr(e,this.altKey,n)}readOnly(){this.set=_r}oneWay(){this.set=xr}};function _r(e,t){throw new Error(`Cannot set read-only property '${t}' on object: ${Pn(e)}`)}function xr(e,t,n){return Dn(e,t,null),gr(e,t,n)}function Cr(e,t,n,r){return void 0===t?(t=0,n=r=-1):(void 0===n&&(n=-1),void 0===r&&(r=-1)),sn(e,"@array:before",[e,t,n,r]),e}function Sr(e,t,n,r,i=!0){void 0===t?(t=0,n=r=-1):(void 0===n&&(n=-1),void 0===r&&(r=-1));let s=b(e);if(i&&((r<0||n<0||r-n!==0)&&$n(e,"length",s),$n(e,"[]",s)),sn(e,"@array:change",[e,t,n,r]),null!==s){let i=-1===n?0:n,o=e.length-((-1===r?0:r)-i),a=t<0?o+t:t;void 0!==s.revisionFor("firstObject")&&0===a&&$n(e,"firstObject",s),void 0!==s.revisionFor("lastObject")&&o-1<a+i&&$n(e,"lastObject",s)}return e}var kr=Object.freeze([]);function Er(e,t,n,r=kr){var i;null!=(i=e)&&"function"==typeof i.replace?e.replace(t,n,r):Tr(e,t,n,r)}var Rr=6e4;function Tr(e,t,n,r){if(Cr(e,t,n,r.length),r.length<=Rr)e.splice(t,n,...r);else{e.splice(t,n);for(let n=0;n<r.length;n+=Rr){let i=r.slice(n,n+Rr);e.splice(t+n,0,...i)}}Sr(e,t,n,r.length)}function Lr(e,t,n,r){let{willChange:i,didChange:s}=n;return r(e,"@array:before",t,i),r(e,"@array:change",t,s),e._revalidate?.(),e}function Ir(e,t,n){return Lr(e,t,n,nn)}function Pr(e,t,n){return Lr(e,t,n,rn)}var Mr=a({default:()=>Ar}),Ar="7.2.0",Or=class{_registry;_coreLibIndex;constructor(){this._registry=[],this._coreLibIndex=0}_getLibraryByName(e){let t=this._registry;for(let n of t)if(n.name===e)return n}register(e,t,n){let r=this._registry.length;this._getLibraryByName(e)||(n&&(r=this._coreLibIndex++),this._registry.splice(r,0,{name:e,version:t}))}registerCoreLibrary(e,t){this.register(e,t,!0)}deRegister(e){let t,n=this._getLibraryByName(e);n&&(t=this._registry.indexOf(n),this._registry.splice(t,1))}},Nr=new Or;function Fr(e,t){let n,r={},i=1;for(2===arguments.length&&Array.isArray(t)?(i=0,n=arguments[1]):n=Array.from(arguments);i<n.length;i++){let t=n[i];r[t]=ur(e,t)}return r}function Dr(e,t){return null===t||"object"!=typeof t||Wn(()=>{let n=Object.keys(t);for(let r of n)gr(e,r,t[r])}),t}Nr.registerCoreLibrary("Ember",Ar);var zr=Symbol("OWNER");function jr(e){return e[zr]}function Ur(e){return jr(e)}function Br(e,t){!function(e,t){e[zr]=t}(e,t)}function $r(e,...t){let n,r;x(t)?n=t:"string"==typeof t[0]&&(r=t[0]);let i=Yn({get:function(t){return(Ur(this)||this.container).lookup(`${e}:${r||t}`)},set(e,t){Dn(this,e,null,t)}});return n?i(n[0],n[1],n[2]):i}function qr(e,t){let n=new WeakMap,r="function"==typeof t;return{getter:function(i){let s;return Ne(Ke(i,e)),r&&!n.has(i)?(s=t.call(i),n.set(i,s)):s=n.get(i),s},setter:function(t,r){He(t,e),n.set(t,r)}}}function Vr(...e){if(!x(e)){let t=e[0],n=t?t.initializer:void 0,r=t?t.value:void 0,i=function(e,t){return Wr([e,t,{initializer:n||(()=>r)}])};return A(i),i}return Wr(e)}function Wr([e,t,n]){let{getter:r,setter:i}=qr(t,n?n.initializer:void 0);function s(){let e=r(this);return(Array.isArray(e)||ir(e))&&Ne(Ke(e,"[]")),e}function o(e){i(this,e),He(this,Mt)}let a={enumerable:!0,configurable:!0,isTracked:!0,get:s,set:o};return R.add(o),w(e).writeDescriptors(t,new Hr(s,o)),a}var Hr=class{constructor(e,t){this._get=e,this._set=t,Ft.add(this)}get(e){return this._get.call(e)}set(e,t,n){this._set.call(e,n)}},Gr=(...e)=>{const[t,n,r]=e,i=new WeakMap,s=r.get;r.get=function(){return i.has(this)||i.set(this,Ue(s.bind(this))),Be(i.get(this))}},Kr=a({ENV:()=>O,context:()=>Xr,getENV:()=>F,getLookup:()=>Jr,setLookup:()=>Qr}),Zr=globalThis,Yr=Zr.Ember,Xr=void 0===Yr?{imports:Zr,exports:Zr,lookup:Zr}:{imports:Yr.imports||Zr,exports:Yr.exports||Zr,lookup:Yr.lookup||Zr};function Jr(){return Xr.lookup}function Qr(e){Xr.lookup=e}var ei=new WeakMap;function ti(e,t){Ze(e)&&ei.set(e,t)}function ni(e){return ei.get(e)}var ri=Object.prototype.hasOwnProperty,ii=!1,si={_set:0,_unprocessedNamespaces:!1,get unprocessedNamespaces(){return this._unprocessedNamespaces},set unprocessedNamespaces(e){this._set++,this._unprocessedNamespaces=e}},oi=!1,ai=[],li=Object.create(null);function ci(e){si.unprocessedNamespaces=!0,ai.push(e)}function ui(e){let t=ni(e);delete li[t],ai.splice(ai.indexOf(e),1),t in Xr.lookup&&e===Xr.lookup[t]&&(Xr.lookup[t]=void 0)}function hi(){if(!si.unprocessedNamespaces)return;let e=Xr.lookup,t=Object.keys(e);for(let n of t){if(!wi(n.charCodeAt(0)))continue;let t=_i(e,n);t&&ti(t,n)}}function di(e){return ii||fi(),li[e]}function pi(e){vi([e.toString()],e,new Set)}function fi(){let e=si.unprocessedNamespaces;if(e&&(hi(),si.unprocessedNamespaces=!1),e||oi){let e=ai;for(let t of e)pi(t);oi=!1}}function gi(){return ii}function mi(e){ii=Boolean(e)}function yi(){oi=!0}function vi(e,t,n){let r=e.length,i=e.join(".");li[i]=t,ti(t,i);for(let s in t){if(!ri.call(t,s))continue;let i=t[s];if(e[r]=s,i&&void 0===ni(i))ti(i,e.join("."));else if(i&&bi(i)){if(n.has(i))continue;n.add(i),vi(e,i,n)}}e.length=r}function bi(e){return null!=e&&"object"==typeof e&&e.isNamespace}function wi(e){return e>=65&&e<=90}function _i(e,t){try{let n=e[t];return(null!==n&&"object"==typeof n||"function"==typeof n)&&n.isNamespace&&n}catch(n){}}var xi=a({ASYNC_OBSERVERS:()=>hn,ComputedDescriptor:()=>S,ComputedProperty:()=>Gn,DEBUG_INJECTION_FUNCTIONS:()=>{},Libraries:()=>Or,NAMESPACES:()=>ai,NAMESPACES_BY_ID:()=>li,PROPERTY_DID_CHANGE:()=>Un,PROXY_CONTENT:()=>lr,SYNC_OBSERVERS:()=>un,TrackedDescriptor:()=>Hr,_getPath:()=>dr,_getProp:()=>hr,_setProp:()=>mr,activateObserver:()=>fn,addArrayObserver:()=>Ir,addListener:()=>nn,addNamespace:()=>ci,addObserver:()=>dn,alias:()=>vr,arrayContentDidChange:()=>Sr,arrayContentWillChange:()=>Cr,autoComputed:()=>Xn,beginPropertyChanges:()=>qn,cached:()=>Gr,changeProperties:()=>Wn,computed:()=>Yn,createCache:()=>Ue,defineDecorator:()=>zn,defineProperty:()=>Dn,defineValue:()=>jn,deprecateProperty:()=>Ci,descriptorForDecorator:()=>P,descriptorForProperty:()=>I,eachProxyArrayDidChange:()=>Ei,eachProxyArrayWillChange:()=>ki,endPropertyChanges:()=>Vn,expandProperties:()=>Nn,findNamespace:()=>di,findNamespaces:()=>hi,flushAsyncObservers:()=>wn,get:()=>ur,getCachedValueFor:()=>Qn,getProperties:()=>Fr,getValue:()=>Be,hasListeners:()=>on,hasUnknownProperty:()=>cr,inject:()=>$r,isClassicDecorator:()=>M,isComputed:()=>Jn,isConst:()=>$e,isElementDescriptor:()=>x,isNamespaceSearchDisabled:()=>gi,libraries:()=>Nr,makeComputedDecorator:()=>T,markObjectAsDirty:()=>Nt,nativeDescDecorator:()=>C,notifyPropertyChange:()=>$n,objectAt:()=>Pt,on:()=>an,processAllNamespaces:()=>fi,processNamespace:()=>pi,removeArrayObserver:()=>Pr,removeListener:()=>rn,removeNamespace:()=>ui,removeObserver:()=>pn,replace:()=>Er,replaceInNativeArray:()=>Tr,revalidateObservers:()=>vn,sendEvent:()=>sn,set:()=>gr,setClassicDecorator:()=>A,setNamespaceSearchDisabled:()=>mi,setProperties:()=>Dr,setUnprocessedMixins:()=>yi,tagForObject:()=>Ot,tagForProperty:()=>At,tracked:()=>Vr,trySet:()=>yr});function Ci(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,set(e){gr(this,n,e)},get(){return ur(this,n)}})}var Si=new WeakMap;function ki(e,t,n,r){let i=Si.get(e);void 0!==i&&i.arrayWillChange(e,t,n,r)}function Ei(e,t,n,r){let i=Si.get(e);void 0!==i&&i.arrayDidChange(e,t,n,r)}var Ri={get onerror(){}},Ti=setTimeout,Li=()=>{};function Ii(e){if("function"==typeof Promise){const t=Promise.resolve();return()=>t.then(e)}if("function"==typeof MutationObserver){let t=0,n=new MutationObserver(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),()=>(t=++t%2,r.data=""+t,t)}return()=>Ti(e,0)}function Pi(e){let t=Li;return{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),now:()=>Date.now(),next:Ii(e),clearNext:t}}var Mi=/\d+/;function Ai(e){let t=typeof e;return"number"===t&&e==e||"string"===t&&Mi.test(e)}function Oi(e){return e.onError||e.onErrorTarget&&e.onErrorTarget[e.onErrorMethod]}function Ni(e,t,n){let r=-1;for(let i=0,s=n.length;i<s;i+=4)if(n[i]===e&&n[i+1]===t){r=i;break}return r}function Fi(e,t,n){let r=-1;for(let i=2,s=n.length;i<s;i+=6)if(n[i]===e&&n[i+1]===t){r=i-2;break}return r}function Di(e,t,n=0){let r=[];for(let i=0;i<e.length;i+=t){let t=e[i+3+n],s={target:e[i+0+n],method:e[i+1+n],args:e[i+2+n],stack:void 0!==t&&"stack"in t?t.stack:""};r.push(s)}return r}function zi(e,t){let n,r,i=0,s=t.length-6;for(;i<s;)r=(s-i)/6,n=i+r-r%6,e>=t[n]?i=n+6:s=n;return e>=t[i]?i+6:i}var ji=class{constructor(e,t={},n={}){this._queueBeingFlushed=[],this.targetQueues=new Map,this.index=0,this._queue=[],this.name=e,this.options=t,this.globalOptions=n}stackFor(e){if(e<this._queue.length){let t=this._queue[3*e+4];return t?t.stack:null}}flush(e){let t,n,r,i,s,{before:o,after:a}=this.options;this.targetQueues.clear(),0===this._queueBeingFlushed.length&&(this._queueBeingFlushed=this._queue,this._queue=[]),void 0!==o&&o();let l=this._queueBeingFlushed;if(l.length>0){let e=Oi(this.globalOptions);s=e?this.invokeWithOnError:this.invoke;for(let o=this.index;o<l.length;o+=4)if(this.index+=4,n=l[o+1],null!==n&&(t=l[o],r=l[o+2],i=l[o+3],s(t,n,r,e,i)),this.index!==this._queueBeingFlushed.length&&this.globalOptions.mustYield&&this.globalOptions.mustYield())return 1}void 0!==a&&a(),this._queueBeingFlushed.length=0,this.index=0,!1!==e&&this._queue.length>0&&this.flush(!0)}hasWork(){return this._queueBeingFlushed.length>0||this._queue.length>0}cancel({target:e,method:t}){let n=this._queue,r=this.targetQueues.get(e);void 0!==r&&r.delete(t);let i=Ni(e,t,n);return i>-1?(n[i+1]=null,!0):(n=this._queueBeingFlushed,i=Ni(e,t,n),i>-1&&(n[i+1]=null,!0))}push(e,t,n,r){return this._queue.push(e,t,n,r),{queue:this,target:e,method:t}}pushUnique(e,t,n,r){let i=this.targetQueues.get(e);void 0===i&&(i=new Map,this.targetQueues.set(e,i));let s=i.get(t);if(void 0===s){let s=this._queue.push(e,t,n,r)-4;i.set(t,s)}else{let e=this._queue;e[s+2]=n,e[s+3]=r}return{queue:this,target:e,method:t}}_getDebugInfo(e){if(e)return Di(this._queue,4)}invoke(e,t,n){void 0===n?t.call(e):t.apply(e,n)}invokeWithOnError(e,t,n,r,i){try{void 0===n?t.call(e):t.apply(e,n)}catch(_6){r(_6,i)}}},Ui=class{constructor(e=[],t){this.queues={},this.queueNameIndex=0,this.queueNames=e,e.reduce(function(e,n){return e[n]=new ji(n,t[n],t),e},this.queues)}schedule(e,t,n,r,i,s){let o=this.queues[e];if(void 0===o)throw new Error(`You attempted to schedule an action in a queue (${e}) that doesn't exist`);if(null==n)throw new Error(`You attempted to schedule an action in a queue (${e}) for a method that doesn't exist`);return this.queueNameIndex=0,i?o.pushUnique(t,n,r,s):o.push(t,n,r,s)}flush(e=!1){let t,n,r=this.queueNames.length;for(;this.queueNameIndex<r;)if(n=this.queueNames[this.queueNameIndex],t=this.queues[n],!1===t.hasWork()){if(this.queueNameIndex++,e&&this.queueNameIndex<r)return 1}else if(1===t.flush(!1))return 1}_getDebugInfo(e){if(e){let t,n,r={},i=this.queueNames.length,s=0;for(;s<i;)n=this.queueNames[s],t=this.queues[n],r[n]=t._getDebugInfo(e),s++;return r}}};function Bi(e){let t=e(),n=t.next();for(;!1===n.done;)n.value(),n=t.next()}var $i=function(){},qi=Object.freeze([]);function Vi(){let e,t,n,r=arguments.length;if(0===r);else if(1===r)n=null,t=arguments[0];else{let i=2,s=arguments[0],o=arguments[1],a=typeof o;if("function"===a?(n=s,t=o):null!==s&&"string"===a&&o in s?(n=s,t=n[o]):"function"==typeof s&&(i=1,n=null,t=s),r>i){let t=r-i;e=new Array(t);for(let n=0;n<t;n++)e[n]=arguments[n+i]}}return[n,t,e]}function Wi(){let e,t,n,r,i;return 2===arguments.length?(t=arguments[0],i=arguments[1],e=null):([e,t,r]=Vi(...arguments),void 0===r?i=0:(i=r.pop(),Ai(i)||(n=!0===i,i=r.pop()))),i=parseInt(i,10),[e,t,r,i,n]}var Hi=0,Gi=0,Ki=0,Zi=0,Yi=0,Xi=0,Ji=0,Qi=0,es=0,ts=0,ns=0,rs=0,is=0,ss=0,os=0,as=0,ls=0,cs=0,us=0,hs=0,ds=0,ps=class{constructor(e,t){this.DEBUG=!1,this.currentInstance=null,this.instanceStack=[],this._eventCallbacks={end:[],begin:[]},this._timerTimeoutId=null,this._timers=[],this._autorun=!1,this._autorunStack=null,this.queueNames=e,this.options=t||{},"string"==typeof this.options.defaultQueue?this._defaultQueue=this.options.defaultQueue:this._defaultQueue=this.queueNames[0],this._onBegin=this.options.onBegin||$i,this._onEnd=this.options.onEnd||$i,this._boundRunExpiredTimers=this._runExpiredTimers.bind(this),this._boundAutorunEnd=()=>{us++,!1!==this._autorun&&(this._autorun=!1,this._autorunStack=null,this._end(!0))};let n=this.options._buildPlatform||Pi;this._platform=n(this._boundAutorunEnd)}get counters(){return{begin:Gi,end:Ki,events:{begin:Zi,end:0},autoruns:{created:cs,completed:us},run:Yi,join:Xi,defer:Ji,schedule:Qi,scheduleIterable:es,deferOnce:ts,scheduleOnce:ns,setTimeout:rs,later:is,throttle:ss,debounce:os,cancelTimers:as,cancel:ls,loops:{total:hs,nested:ds}}}get defaultQueue(){return this._defaultQueue}begin(){Gi++;let e,t=this.options,n=this.currentInstance;return!1!==this._autorun?(e=n,this._cancelAutorun()):(null!==n&&(ds++,this.instanceStack.push(n)),hs++,e=this.currentInstance=new Ui(this.queueNames,t),Zi++,this._trigger("begin",e,n)),this._onBegin(e,n),e}end(){Ki++,this._end(!1)}on(e,t){if("function"!=typeof t)throw new TypeError("Callback must be a function");let n=this._eventCallbacks[e];if(void 0===n)throw new TypeError(`Cannot on() event ${e} because it does not exist`);n.push(t)}off(e,t){let n=this._eventCallbacks[e];if(!e||void 0===n)throw new TypeError(`Cannot off() event ${e} because it does not exist`);let r=!1;if(t)for(let i=0;i<n.length;i++)n[i]===t&&(r=!0,n.splice(i,1),i--);if(!r)throw new TypeError("Cannot off() callback that does not exist")}run(){Yi++;let[e,t,n]=Vi(...arguments);return this._run(e,t,n)}join(){Xi++;let[e,t,n]=Vi(...arguments);return this._join(e,t,n)}defer(e,t,n,...r){return Ji++,this.schedule(e,t,n,...r)}schedule(e,...t){Qi++;let[n,r,i]=Vi(...t),s=this.DEBUG?new Error:void 0;return this._ensureInstance().schedule(e,n,r,i,!1,s)}scheduleIterable(e,t){es++;let n=this.DEBUG?new Error:void 0;return this._ensureInstance().schedule(e,null,Bi,[t],!1,n)}deferOnce(e,t,n,...r){return ts++,this.scheduleOnce(e,t,n,...r)}scheduleOnce(e,...t){ns++;let[n,r,i]=Vi(...t),s=this.DEBUG?new Error:void 0;return this._ensureInstance().schedule(e,n,r,i,!0,s)}setTimeout(){return rs++,this.later(...arguments)}later(){is++;let[e,t,n,r]=function(){let[e,t,n]=Vi(...arguments),r=0,i=void 0!==n?n.length:0;return i>0&&Ai(n[i-1])&&(r=parseInt(n.pop(),10)),[e,t,n,r]}(...arguments);return this._later(e,t,n,r)}throttle(){ss++;let e,[t,n,r,i,s=!0]=Wi(...arguments),o=Fi(t,n,this._timers);if(-1===o)e=this._later(t,n,s?qi:r,i),s&&this._join(t,n,r);else{e=this._timers[o+1];let t=o+4;this._timers[t]!==qi&&(this._timers[t]=r)}return e}debounce(){os++;let e,[t,n,r,i,s=!1]=Wi(...arguments),o=this._timers,a=Fi(t,n,o);if(-1===a)e=this._later(t,n,s?qi:r,i),s&&this._join(t,n,r);else{let s=this._platform.now()+i,l=a+4;o[l]===qi&&(r=qi),e=o[a+1];let c=zi(s,o);if(a+6===c)o[a]=s,o[l]=r;else{let i=this._timers[a+5];this._timers.splice(c,0,s,e,t,n,r,i),this._timers.splice(a,6)}0===a&&this._reinstallTimerTimeout()}return e}cancelTimers(){as++,this._clearTimerTimeout(),this._timers=[],this._cancelAutorun()}hasTimers(){return this._timers.length>0||this._autorun}cancel(e){if(ls++,null==e)return!1;let t=typeof e;return"number"===t?this._cancelLaterTimer(e):!("object"!==t||!e.queue||!e.method)&&e.queue.cancel(e)}ensureInstance(){this._ensureInstance()}getDebugInfo(){if(this.DEBUG)return{autorun:this._autorunStack,counters:this.counters,timers:Di(this._timers,6,2),instanceStack:[this.currentInstance,...this.instanceStack].map(e=>e&&e._getDebugInfo(this.DEBUG))}}_end(e){let t=this.currentInstance,n=null;if(null===t)throw new Error("end called without begin");let r,i=!1;try{r=t.flush(e)}finally{if(!i)if(i=!0,1===r){const e=this.queueNames[t.queueNameIndex];this._scheduleAutorun(e)}else this.currentInstance=null,this.instanceStack.length>0&&(n=this.instanceStack.pop(),this.currentInstance=n),this._trigger("end",t,n),this._onEnd(t,n)}}_join(e,t,n){return null===this.currentInstance?this._run(e,t,n):void 0===e&&void 0===n?t():t.apply(e,n)}_run(e,t,n){let r=Oi(this.options);if(this.begin(),r)try{return t.apply(e,n)}catch(_6){r(_6)}finally{this.end()}else try{return t.apply(e,n)}finally{this.end()}}_cancelAutorun(){this._autorun&&(this._platform.clearNext(),this._autorun=!1,this._autorunStack=null)}_later(e,t,n,r){let i=this.DEBUG?new Error:void 0,s=this._platform.now()+r,o=Hi++;if(0===this._timers.length)this._timers.push(s,o,e,t,n,i),this._installTimerTimeout();else{let r=zi(s,this._timers);this._timers.splice(r,0,s,o,e,t,n,i),this._reinstallTimerTimeout()}return o}_cancelLaterTimer(e){for(let t=1;t<this._timers.length;t+=6)if(this._timers[t]===e)return this._timers.splice(t-1,6),1===t&&this._reinstallTimerTimeout(),!0;return!1}_trigger(e,t,n){let r=this._eventCallbacks[e];if(void 0!==r)for(let i=0;i<r.length;i++)r[i](t,n)}_runExpiredTimers(){this._timerTimeoutId=null,this._timers.length>0&&(this.begin(),this._scheduleExpiredTimers(),this.end())}_scheduleExpiredTimers(){let e=this._timers,t=0,n=e.length,r=this._defaultQueue,i=this._platform.now();for(;t<n&&!(e[t]>i);t+=6){let n=e[t+4];if(n!==qi){let i=e[t+2],s=e[t+3],o=e[t+5];this.currentInstance.schedule(r,i,s,n,!1,o)}}e.splice(0,t),this._installTimerTimeout()}_reinstallTimerTimeout(){this._clearTimerTimeout(),this._installTimerTimeout()}_clearTimerTimeout(){null!==this._timerTimeoutId&&(this._platform.clearTimeout(this._timerTimeoutId),this._timerTimeoutId=null)}_installTimerTimeout(){if(0===this._timers.length)return;let e=this._timers[0],t=this._platform.now(),n=Math.max(0,e-t);this._timerTimeoutId=this._platform.setTimeout(this._boundRunExpiredTimers,n)}_ensureInstance(){let e=this.currentInstance;return null===e&&(this._autorunStack=this.DEBUG?new Error:void 0,e=this.begin(),this._scheduleAutorun(this.queueNames[0])),e}_scheduleAutorun(e){cs++;const t=this._platform.next,n=this.options.flush;n?n(e,t):t(),this._autorun=!0}};ps.Queue=ji,ps.buildPlatform=Pi,ps.buildNext=Ii;var fs=a({_backburner:()=>bs,_cancelTimers:()=>Rs,_getCurrentRunLoop:()=>ms,_hasScheduledTimers:()=>Es,_queues:()=>vs,_rsvpErrorQueue:()=>ys,begin:()=>Cs,bind:()=>xs,cancel:()=>Ms,debounce:()=>As,end:()=>Ss,join:()=>_s,later:()=>Ts,next:()=>Ps,once:()=>Ls,run:()=>ws,schedule:()=>ks,scheduleOnce:()=>Is,throttle:()=>Os}),gs=null;function ms(){return gs}var ys=`${Math.random()}${Date.now()}`.replace(".",""),vs=["actions","routerTransitions","render","afterRender","destroy",ys],bs=new ps(vs,{defaultQueue:"actions",onBegin:function(e){gs=e},onEnd:function(e,t){gs=t,wn(ks)},onErrorTarget:Ri,onErrorMethod:"onerror",flush:function(e,t){"render"!==e&&e!==ys||wn(ks),t()}});function ws(...e){return bs.run(...e)}function _s(e,t,...n){return bs.join(e,t,...n)}function xs(...e){return(...t)=>_s(...e.concat(t))}function Cs(){bs.begin()}function Ss(){bs.end()}function ks(...e){return bs.schedule(...e)}function Es(){return bs.hasTimers()}function Rs(){bs.cancelTimers()}function Ts(...e){return bs.later(...e)}function Ls(...e){return bs.scheduleOnce("actions",...e)}function Is(...e){return bs.scheduleOnce(...e)}function Ps(...e){return bs.later(...e,1)}function Ms(e){return bs.cancel(e)}function As(...e){return bs.debounce(...e)}function Os(...e){return bs.throttle(...e)}var Ns=new Set([Symbol.iterator,"concat","entries","every","filter","find","findIndex","flat","flatMap","forEach","includes","indexOf","join","keys","lastIndexOf","map","reduce","reduceRight","slice","some","values"]),Fs=new Set(["fill","push","unshift"]);function Ds(e){if("symbol"==typeof e)return null;const t=Number(e);return isNaN(t)?null:t%1==0?t:null}var zs=class e{#e;constructor(t,n){this.#e=n;const r=t.slice(),i=this,s=new Map;let o=!1;return new Proxy(r,{get(e,t){const n=Ds(t);if(null!==n)return i.#t(n),Ne(i.#n),e[n];if("length"===t)return o?o=!1:Ne(i.#n),e[t];if(Fs.has(t)&&(o=!0),Ns.has(t)){let n=s.get(t);return void 0===n&&(n=(...n)=>(Ne(i.#n),e[t](...n)),s.set(t,n)),n}return e[t]},set(e,t,n){if(i.#e.equals(e[t],n))return!0;e[t]=n;const r=Ds(t);return null!==r?(i.#r(r),i.#i()):"length"===t&&i.#i(),!0},getPrototypeOf:()=>e.prototype})}#n=ge();#s=new Map;#t(e){let t=this.#s.get(e);void 0===t&&(t=ge(),this.#s.set(e,t)),Ne(t)}#r(e){const t=this.#s.get(e);t&&de(t)}#i(){de(this.#n),this.#s.clear()}};function js(e,t){return new zs(e??[],{equals:t?.equals??Object.is,description:t?.description})}Object.setPrototypeOf(zs.prototype,Array.prototype);var Us=class e{#e;#s=new Map;#n=ge();#t(e){let t=this.#s.get(e);void 0===t&&(t=ge(),this.#s.set(e,t)),Ne(t)}#r(e){const t=this.#s.get(e);t&&de(t)}#i(){de(this.#n)}constructor(t,n){this.#e=n;const r=Object.getPrototypeOf(t),i=Object.getOwnPropertyDescriptors(t),s=Object.create(r);for(const e in i)Object.defineProperty(s,e,i[e]);const o=this;return new Proxy(s,{get:(e,t)=>(o.#t(t),e[t]),has:(e,t)=>(o.#t(t),t in e),ownKeys:e=>(Ne(o.#n),Reflect.ownKeys(e)),set:(e,t,n)=>(o.#e.equals(e[t],n)||(e[t]=n,o.#r(t),o.#i()),!0),deleteProperty:(e,t)=>(t in e&&(delete e[t],o.#r(t),o.#s.delete(t),o.#i()),!0),getPrototypeOf:()=>e.prototype})}};function Bs(e,t){return new Us(e??{},{equals:t?.equals??Object.is,description:t?.description})}function $s(e,t){const n=t?.equals??Object.is,r=new Set(e??[]),i=ge(),s=new Map;function o(e){const t=s.get(e);t&&de(t)}const a=new Proxy(r,{get(e,t,r){if("add"===t)return function(t){if(e.has(t)){if(n(t,t))return a}else de(i);return o(t),e.add(t),a};if("delete"===t)return function(t){return!!e.has(t)&&(o(t),de(i),s.delete(t),e.delete(t))};if("clear"===t)return function(){0!==e.size&&(s.forEach(e=>de(e)),de(i),s.clear(),e.clear())};if("has"===t)return function(t){return Ne(function(e){let t=s.get(e);return void 0===t&&(t=ge(),s.set(e,t)),t}(t)),e.has(t)};if("size"===t)return Ne(i),e.size;const l=Reflect.get(e,t,r);return"function"==typeof l?function(...t){return Ne(i),l.apply(e,t)}:l}});return a}function qs(e,t){const n=t?.equals??Object.is,r=new WeakSet(e??[]),i=new WeakMap;function s(e){const t=i.get(e);t&&de(t)}const o=new Proxy(r,{get(e,t,r){if("add"===t)return function(t){return e.has(t)&&n(t,t)||(e.add(t),s(t)),o};if("delete"===t)return function(t){return!!e.has(t)&&(s(t),i.delete(t),e.delete(t))};if("has"===t)return function(t){return Ne(function(e){let t=i.get(e);return void 0===t&&(t=ge(),i.set(e,t)),t}(t)),e.has(t)};const a=Reflect.get(e,t,r);return"function"==typeof a?a.bind(e):a}});return o}function Vs(e,t){const n=t?.equals??Object.is,r=e instanceof Map?new Map(e.entries()):new Map(e??[]),i=ge(),s=new Map;function o(e){let t=s.get(e);return void 0===t&&(t=ge(),s.set(e,t)),t}function a(e){const t=s.get(e);t&&de(t)}const l=new Proxy(r,{get(e,t,r){if("set"===t)return function(t,r){return e.has(t)&&n(e.get(t),r)||(a(t),de(i),e.set(t,r)),l};if("delete"===t)return function(t){return!!e.has(t)&&(a(t),de(i),s.delete(t),e.delete(t))};if("clear"===t)return function(){0!==e.size&&(s.forEach(e=>de(e)),s.clear(),de(i),e.clear())};if("get"===t)return function(t){return Ne(o(t)),e.get(t)};if("has"===t)return function(t){return Ne(o(t)),e.has(t)};if("size"===t)return Ne(i),e.size;const c=Reflect.get(e,t,r);return"function"==typeof c?function(...t){return Ne(i),c.apply(e,t)}:c}});return l}function Ws(e,t){const n=t?.equals??Object.is,r=e??[],i=r instanceof WeakMap?r:new WeakMap(r),s=new WeakMap;function o(e){let t=s.get(e);return void 0===t&&(t=ge(),s.set(e,t)),t}function a(e){const t=s.get(e);t&&de(t)}const l=new Proxy(i,{get(e,t,r){if("set"===t)return function(t,r){return e.has(t)&&n(e.get(t),r)||(a(t),e.set(t,r)),l};if("delete"===t)return function(t){return!!e.has(t)&&(a(t),s.delete(t),e.delete(t))};if("get"===t)return function(t){return Ne(o(t)),e.get(t)};if("has"===t)return function(t){return Ne(o(t)),e.has(t)};const i=Reflect.get(e,t,r);return"function"==typeof i?i.bind(e):i}});return l}var Hs=a({ALLOW_CYCLES:()=>{},COMPUTE:()=>ae,CONSTANT:()=>0,CONSTANT_TAG:()=>me,CURRENT_TAG:()=>_e,CurrentTag:()=>we,INITIAL:()=>1,VOLATILE:()=>NaN,VOLATILE_TAG:()=>be,VolatileTag:()=>ve,beginTrackFrame:()=>Le,beginUntrackFrame:()=>Pe,bump:()=>oe,combine:()=>xe,consumeTag:()=>Ne,createCache:()=>Ue,createTag:()=>fe,createUpdatableTag:()=>ge,debug:()=>Gs,dirtyTag:()=>de,dirtyTagFor:()=>He,endTrackFrame:()=>Ie,endUntrackFrame:()=>Me,getValue:()=>Be,isConst:()=>$e,isConstTag:()=>ye,isTracking:()=>Oe,resetTracking:()=>Ae,tagFor:()=>Ke,tagMetaFor:()=>Ge,track:()=>qe,trackedArray:()=>js,trackedData:()=>qr,trackedMap:()=>Vs,trackedObject:()=>Bs,trackedSet:()=>$s,trackedWeakMap:()=>Ws,trackedWeakSet:()=>qs,untrack:()=>Ve,updateTag:()=>pe,validateTag:()=>ce,valueForTag:()=>le}),Gs={},Ks=Symbol("GLIMMER_VALIDATOR_REGISTRATION");if(Reflect.has(globalThis,Ks))throw new Error("The `@glimmer/validator` library has been included twice in this application. It could be different versions of the package, or the same version included twice by mistake. `@glimmer/validator` depends on having a single copy of the package in use at any time in an application, even if they are the same version. You must dedupe your build to remove the duplicate packages in order to prevent this error.");Reflect.set(globalThis,Ks,!0);var Zs="@warp-drive/core",Ys=globalThis;Ys.__warpDrive_universalCache=Ys.__warpDrive_universalCache??{},Ys[Zs]=Ys[Zs]??{__version:"5.8.2"};var Xs=Ys[Zs],Js=Xs.__warpDrive_ModuleScopedCaches??{};if(Xs.__warpDrive_hasOtherCopy)throw new Error("Multiple copies of WarpDrive detected, the application will malfunction.");function Qs(e,t){return t}function eo(e){return Js[`(transient) ${e}`]??null}function to(e,t){return t}Xs.__warpDrive_hasOtherCopy=!0,to(0,Symbol.for("wd:skip-cache")),to(0,Symbol.for("wd:enable-hydration")),Qs(0,Symbol("IS_FUTURE")),Qs(0,Symbol("DOC")),Qs(0,Symbol("FROZEN")),Qs(0,Symbol.for("Collection"));var no=to(0,new WeakMap);function ro(e,t){no.set(e,t)}to(0,new Map),Qs(0,Symbol("IS_CACHE_HANDLER"));var io=Qs(0,Symbol("#[]"));function so(e,t){return eo("signalHooks").createSignal(e,t)}Qs(0,Symbol("#{}"));var oo={isInitializer:!0};function ao(e){return"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===oo}var lo=Qs(0,Symbol("Signals"));function co(e){return e[lo]||function(e){e[lo]=new Map}(e),e[lo]}function uo(e,t,n,r){const i={key:n,context:t,signal:so(t,n),value:ao(r)?r.value.call(t):r,isStale:!1};return e.set(n,i),i}function ho(e,t){return e?.get(t)}function po(e,t){return{enumerable:!0,configurable:!1,get(){const n=function(e,t,n,r){let i=ho(e,n);return i||(i=uo(e,t,n,r)),function(e){eo("signalHooks").consumeSignal(e)}(i.signal),i}(co(this),this,e,t);return n.isStale=!1,n.value},set(n){const r=function(e,t,n,r){let i=ho(e,n);return i||(i=uo(e,t,n,r)),i}(co(this),this,e,t);var i;r.value!==n&&(r.value=n,(i=r)&&(i.isStale=!0,function(e){eo("signalHooks").notifySignal(e)}(i.signal)))}}}function fo(e,t,n){Object.defineProperty(e,t,po(t,n))}function go(e,t,n){const r=po(t,n);r.enumerable=!1,Object.defineProperty(e,t,r)}function mo(e,t,n){const r=n.get;return n.get=function(){const e=co(this);let n=e.get(t);return n||(n=function(e,t,n,r){{const i=function(e,t,n){return eo("signalHooks").createMemo(e,t,n)}(t,n,r);return e.set(n,i),i}}(e,this,t,r.bind(this))),n()},n}var yo=new WeakMap;function vo(e){return e instanceof DOMException&&"AbortError"===e.name}var bo=class{_stream=null;_future;_triggered=!1;_trigger(){if(this._triggered)return;this._triggered=!0;const e=this._future.getStream();e.sizeHint&&(this._sizeHint=e.sizeHint),this.promise=e.then(e=>e?async function(e,t){const n=t,r=e.getReader();let i=0,s=null!==n._stream&&n._stream.readable.locked,o=s,a=n._stream?.writable.getWriter();const l=[];for(n._isPending=!1,n._isStarted=!0,n._startTime=performance.now();;){const{value:e,done:t}=await r.read();if(t)break;if(i+=e.byteLength,n._bytesLoaded=i,n._lastPacketTime=performance.now(),s=s||null!==n._stream&&n._stream.readable.locked,s){if(!o){o=!0,a=n._stream.writable.getWriter();for(const e of l)await a.ready,await a.write(e);l.length=0}await a.ready,await a.write(e)}else l.push(e)}o?(await a.ready,await a.close()):n._stream&&(await n._stream.readable.cancel("The Stream Has Already Ended"),n._stream=null),n._endTime=performance.now(),n._isComplete=!0,n._isStarted=!1}(e,this):(this._isPending=!1,void(this._isComplete=!0)),e=>{this._isPending=!1,this._isStarted=!1,vo(e)&&(this._isCancelled=!0,this._isComplete=!0),this._isErrored=!0,this._error=e})}promise=null;get isPending(){return this._trigger(),this._isPending}get sizeHint(){return this._trigger(),this._sizeHint}get stream(){if(this._trigger(),!this._stream){if(this._isComplete||this._isCancelled||this._isErrored)return null;this._stream=new TransformStream}return this._stream.readable}get isStarted(){return this._trigger(),this._isStarted}get bytesLoaded(){return this._trigger(),this._bytesLoaded}get startTime(){return this._trigger(),this._startTime}get endTime(){return this._trigger(),this._endTime}get lastPacketTime(){return this._trigger(),this._lastPacketTime}get isComplete(){return this._trigger(),this._isComplete}get isCancelled(){return this._trigger(),this._isCancelled}get isErrored(){return this._trigger(),this._isErrored}get error(){return this._trigger(),this._error}get elapsedTime(){return(this.endTime||this.lastPacketTime)-this.startTime}get completedRatio(){return this.sizeHint?this.bytesLoaded/this.sizeHint:0}get remainingRatio(){return 1-this.completedRatio}get duration(){return this.endTime-this.startTime}get speed(){return this.bytesLoaded/(this.elapsedTime/1e3)}constructor(e){this._future=e}abort=()=>{this._future.abort()}};go(bo.prototype,"_isPending",!0),go(bo.prototype,"_isStarted",!1),go(bo.prototype,"_isComplete",!1),go(bo.prototype,"_isCancelled",!1),go(bo.prototype,"_isErrored",!1),go(bo.prototype,"_error",null),go(bo.prototype,"_sizeHint",0),go(bo.prototype,"_bytesLoaded",0),go(bo.prototype,"_startTime",0),go(bo.prototype,"_endTime",0),go(bo.prototype,"_lastPacketTime",0);var wo={};function _o(e,t,n){const r=Object.assign({},t),i=Object.assign({},r.cacheOptions);return n?i.reload=!0:!1===n?(delete i.reload,i.backgroundReload=!0):(delete i.backgroundReload,delete i.reload),r.cacheOptions=i,e.request(r)}function xo(e,t,n){let r={...Object.getOwnPropertyDescriptor(e,t)};for(let i of n)r=i(e,t,r)||r;void 0!==r.initializer&&(r.value=r.initializer?r.initializer.call(e):void 0,r.initializer=void 0),Object.defineProperty(e,t,r)}fo(wo,"reason",null),fo(wo,"value",null),fo(wo,"result",null),fo(wo,"error",null),fo(wo,"status","pending"),fo(wo,"isPending",!0),fo(wo,"isLoading",!0),fo(wo,"isSuccess",!1),fo(wo,"isError",!1),fo(wo,"request",null),fo(wo,"response",null),Object.defineProperty(wo,"isCancelled",{get(){return this.isError&&vo(this.reason)}}),Object.defineProperty(wo,"loadingState",{get(){return this._loadingState||(this._loadingState=new bo(this._request)),this._loadingState}});var Co=Symbol.dispose||Symbol.for("dispose"),So=class{_requester;constructor(e,t){this._args=t,this.store=e,this._subscribedTo=null,this._subscription=null,this._intervalStart=null,this._invalidated=!1,this._nextInterval=null,this._requester=null,this.isDestroyed=!1,this[Co]=Eo,this._installListeners(),this._beginPolling()}async _beginPolling(){try{this.isIdle||await this.request}catch{}finally{this.isDestroyed||this._scheduleInterval()}}get isIdle(){const{request:e,query:t}=this._args;return Boolean(!e&&!t)}static{xo(this.prototype,"isIdle",[mo])}get autorefreshTypes(){const{autorefresh:e}=this._args;let t;return t=!0===e?["online","invalid"]:"string"==typeof e?e.split(","):[],new Set(t)}static{xo(this.prototype,"autorefreshTypes",[mo])}async _scheduleInterval(){const{autorefreshThreshold:e}=this._args;if("undefined"!=typeof window&&"number"==typeof e&&e>0&&this.autorefreshTypes.has("interval")&&null===this._intervalStart){if(this._latestRequest){try{await this._latestRequest}catch{}if(this.isDestroyed)return}this._intervalStart=Date.now(),this._nextInterval=setTimeout(()=>{this._maybeUpdate()},e)}}_clearInterval(){this._nextInterval&&(clearTimeout(this._nextInterval),this._intervalStart=null)}_updateSubscriptions(){if(this.isIdle)return;const e=this._request.lid;if(this._subscribedTo===e)return;this._removeSubscriptions();const t=this._getRequester();this._requester=t,e&&ko(t)&&(this._subscribedTo=e,this._subscription=t.notifications.subscribe(e,(n,r)=>{if(!this._isUpdating)switch(r){case"invalidated":this.autorefreshTypes.has("invalid")&&(this._invalidated=!0,this._maybeUpdate());break;case"state":{const n=t.requestManager._deduped.get(e)?.priority,r=this.reqState;n?n.blocking&&!r.isLoading?(this.isRefreshing=!1,this._maybeUpdate("policy",!0)):this.isRefreshing=!0:this.isRefreshing=!1}}}))}_removeSubscriptions(){const e=this._requester;this._subscription&&e&&ko(e)&&(e.notifications.unsubscribe(this._subscription),this._subscribedTo=null,this._subscription=null,this._requester=null)}_installListeners(){"undefined"!=typeof window&&(this.isOnline=window.navigator.onLine,this._unavailableStart=this.isOnline?null:Date.now(),this.isHidden="hidden"===document.visibilityState,this._onlineChanged=e=>{this.isOnline="online"===e.type,"offline"===e.type&&null===this._unavailableStart&&(this._unavailableStart=Date.now()),this._maybeUpdate()},this._backgroundChanged=()=>{const e="hidden"===document.visibilityState;this.isHidden=e,e&&null===this._unavailableStart&&(this._unavailableStart=Date.now()),this._maybeUpdate()},window.addEventListener("online",this._onlineChanged,{passive:!0,capture:!0}),window.addEventListener("offline",this._onlineChanged,{passive:!0,capture:!0}),document.addEventListener("visibilitychange",this._backgroundChanged,{passive:!0,capture:!0}))}_maybeUpdate(e,t){if(this.isIdle)return;const{reqState:n}=this;if(n.isPending)return;if(!Boolean(this.isOnline&&!this.isHidden&&(e||this.autorefreshTypes.size))){if(!t&&e&&"_invalidated"!==e)throw new Error("Reload not available: the network is not online or the tab is hidden");return}const{autorefreshTypes:r}=this;let i=this._invalidated||Boolean(e);if(!i&&r.has("online")){const{_unavailableStart:e}=this,{autorefreshThreshold:t}=this._args,n="number"==typeof t?t:3e4;i=Boolean(e&&Date.now()-e>n)}if(!i&&r.has("interval")){const{_intervalStart:e}=this,{autorefreshThreshold:t}=this._args;e&&"number"==typeof t&&t>0&&(i=Boolean(Date.now()-e>=t))}if(this._unavailableStart=null,this._invalidated=!1,i){this._clearInterval(),this._isUpdating=!0;const t=("_invalidated"===e?null:e)??this._args.autorefreshBehavior??"policy",r=this._getRequester();switch(n._request.requester||(n._request.requester=r),t){case"reload":this._latestRequest=n.reload();break;case"refresh":this._latestRequest=n.refresh();break;case"policy":this._latestRequest=n.refresh(!0)}"refresh"!==t&&(this._localRequest=this._latestRequest),this._scheduleInterval(),this._latestRequest.finally(()=>{this._isUpdating=!1})}}_getRequester(){return this._args.request?.requester?this._args.request.requester:this.store}retry=async()=>{this._maybeUpdate("reload"),await this._localRequest};refresh=async()=>{this._maybeUpdate("refresh"),await this._latestRequest};get errorFeatures(){return{isHidden:this.isHidden,isOnline:this.isOnline,retry:this.retry}}static{xo(this.prototype,"errorFeatures",[mo])}get contentFeatures(){const e={isHidden:this.isHidden,isOnline:this.isOnline,reload:this.retry,refresh:this.refresh,isRefreshing:this.isRefreshing,latestRequest:this._latestRequest};return e.isRefreshing&&(e.abort=()=>{this._latestRequest?.abort()}),e}static{xo(this.prototype,"contentFeatures",[mo])}get _request(){const{request:e,query:t}=this._args,{_localRequest:n,_originalRequest:r,_originalQuery:i}=this;return n&&e===r&&t===i?n:(this._originalQuery=t,this._originalRequest=e,e||this.store.request(t))}static{xo(this.prototype,"_request",[mo])}get request(){{const e=this._request;return this._updateSubscriptions(),e}}static{xo(this.prototype,"request",[mo])}get reqState(){return function(e){let t=yo.get(e);return t||(t=function(e){const t=(n=e,no.get(n));var n;const r=Object.create(wo);return r._request=e,r.reload=()=>_o(e.requester,r.request,!0),r.refresh=(t=!1)=>_o(e.requester,r.request,!0===t&&null),t?t.isError?(r.error=t.result,r.reason=t.result,r.status="rejected",r.isError=!0,r.isPending=!1,r.isLoading=!1,r.request=t.result.request,r.response=t.result.response):(r.result=t.result.content,r.value=t.result.content,r.status="fulfilled",r.isSuccess=!0,r.isPending=!1,r.isLoading=!1,r.request=t.result.request,r.response=t.result.response):e.then(t=>{ro(e,{isError:!1,result:t}),r.result=t.content,r.value=t.content,r.status="fulfilled",r.isSuccess=!0,r.isPending=!1,r.isLoading=!1,r.request=t.request,r.response=t.response},t=>{ro(e,{isError:!0,result:t}),r.error=t,r.reason=t,r.status="rejected",r.isError=!0,r.isPending=!1,r.isLoading=!1,r.request=t.request,r.response=t.response}),r}(e),yo.set(e,t)),t}(this.request)}get result(){return this.reqState.result}};function ko(e){return"requestManager"in e}function Eo(){const e=this;e.isDestroyed=!0,e._removeSubscriptions(),"undefined"!=typeof window&&(e._clearInterval(),window.removeEventListener("online",e._onlineChanged,{passive:!0,capture:!0}),window.removeEventListener("offline",e._onlineChanged,{passive:!0,capture:!0}),document.removeEventListener("visibilitychange",e._backgroundChanged,{passive:!0,capture:!0}))}fo(So.prototype,"isOnline",!0),fo(So.prototype,"isHidden",!1),fo(So.prototype,"isRefreshing",!1),fo(So.prototype,"_localRequest",void 0),fo(So.prototype,"_latestRequest",void 0);var Ro={};fo(Ro,"reason",null),fo(Ro,"value",null),fo(Ro,"result",null),fo(Ro,"error",null),fo(Ro,"status","pending"),fo(Ro,"isPending",!0),fo(Ro,"isLoading",!0),fo(Ro,"isSuccess",!1),fo(Ro,"isError",!1);var To=de;!function(){const e=function(e){const t=e.wellknown.Array;return{createSignal:(e,n)=>n===t?[At(e,n),At(e,"length"),At(e,"[]")]:At(e,n),consumeSignal(e){if(Array.isArray(e))return Ne(e[0]),Ne(e[1]),void Ne(e[2]);Ne(e)},notifySignal(e){if(Array.isArray(e))return To(e[0]),To(e[1]),void To(e[2]);To(e)},createMemo:(e,t,n)=>{{const r=At(e,t),i=Ue(n);let s;const o=()=>{s=Be(i)};return()=>{const e=qe(o);return pe(r,e),Ne(e),s}}},willSyncFlushWatchers:()=>!!bs.currentInstance&&!0!==bs._autorun,waitFor:async e=>e}}({wellknown:{Array:io}});var t;t=e,Js["(transient) signalHooks"]=t}();var Lo=a({getOwner:()=>Io,setOwner:()=>Br}),Io=Ur;function Po(e){let t=Object.create(e);return t._dict=null,delete t._dict,t}var Mo="object"==typeof self&&null!==self&&self.Object===Object&&"undefined"!=typeof Window&&self.constructor===Window&&"object"==typeof document&&null!==document&&self.document===document&&"object"==typeof location&&null!==location&&self.location===location&&"object"==typeof history&&null!==history&&self.history===history&&"object"==typeof navigator&&null!==navigator&&self.navigator===navigator&&"string"==typeof navigator.userAgent;function Ao(e){let t=e._promiseCallbacks;return t||(t=e._promiseCallbacks={}),t}var Oo={mixin(e){return e.on=this.on,e.off=this.off,e.trigger=this.trigger,e._promiseCallbacks=void 0,e},on(e,t){if("function"!=typeof t)throw new TypeError("Callback must be a function");let n=Ao(this),r=n[e];r||(r=n[e]=[]),-1===r.indexOf(t)&&r.push(t)},off(e,t){let n=Ao(this);if(!t)return void(n[e]=[]);let r=n[e],i=r.indexOf(t);-1!==i&&r.splice(i,1)},trigger(e,t,n){let r=Ao(this)[e];if(r){let e;for(let i=0;i<r.length;i++)e=r[i],e(t,n)}}},No={instrument:!1};function Fo(e,t){if(2!==arguments.length)return No[e];No[e]=t}Oo.mixin(No);var Do=[];function zo(e,t,n){1===Do.push({name:e,payload:{key:t._guidKey,id:t._id,eventName:e,detail:t._result,childId:n&&n._id,label:t._label,timeStamp:Date.now(),error:No["instrument-with-stack"]?new Error(t._label):null}})&&setTimeout(()=>{for(let e=0;e<Do.length;e++){let t=Do[e],n=t.payload;n.guid=n.key+n.id,n.childGuid=n.key+n.childId,n.error&&(n.stack=n.error.stack),No.trigger(t.name,t.payload)}Do.length=0},50)}function jo(e,t){if(e&&"object"==typeof e&&e.constructor===this)return e;let n=new this(Uo,t);return Wo(n,e),n}function Uo(){}var Bo=void 0,$o=1,qo=2;function Vo(e,t,n){t.constructor===e.constructor&&n===Jo&&e.constructor.resolve===jo?function(e,t){t._state===$o?Go(e,t._result):t._state===qo?(t._onError=null,Ko(e,t._result)):Zo(t,void 0,n=>{t===n?Go(e,n):Wo(e,n)},t=>Ko(e,t))}(e,t):"function"==typeof n?function(e,t,n){No.async(e=>{let r=!1,i=function(n,i){try{n.call(i,n=>{r||(r=!0,t===n?Go(e,n):Wo(e,n))},t=>{r||(r=!0,Ko(e,t))})}catch(s){return s}}(n,t,e._label);!r&&i&&(r=!0,Ko(e,i))},e)}(e,t,n):Go(e,t)}function Wo(e,t){if(e===t)Go(e,t);else if(function(e){let t=typeof e;return null!==e&&("object"===t||"function"===t)}(t)){let n;try{n=t.then}catch(_6){return void Ko(e,_6)}Vo(e,t,n)}else Go(e,t)}function Ho(e){e._onError&&e._onError(e._result),Yo(e)}function Go(e,t){e._state===Bo&&(e._result=t,e._state=$o,0===e._subscribers.length?No.instrument&&zo("fulfilled",e):No.async(Yo,e))}function Ko(e,t){e._state===Bo&&(e._state=qo,e._result=t,No.async(Ho,e))}function Zo(e,t,n,r){let i=e._subscribers,s=i.length;e._onError=null,i[s]=t,i[s+$o]=n,i[s+qo]=r,0===s&&e._state&&No.async(Yo,e)}function Yo(e){let t=e._subscribers,n=e._state;if(No.instrument&&zo(n===$o?"fulfilled":"rejected",e),0===t.length)return;let r,i,s=e._result;for(let o=0;o<t.length;o+=3)r=t[o],i=t[o+n],r?Xo(n,r,i,s):i(s);e._subscribers.length=0}function Xo(e,t,n,r){let i,s,o="function"==typeof n,a=!0;if(o)try{i=n(r)}catch(l){a=!1,s=l}else i=r;t._state!==Bo||(i===t?Ko(t,new TypeError("A promises callback cannot return that same promise.")):!1===a?Ko(t,s):o?Wo(t,i):e===$o?Go(t,i):e===qo&&Ko(t,i))}function Jo(e,t,n){let r=this,i=r._state;if(i===$o&&!e||i===qo&&!t)return No.instrument&&zo("chained",r,r),r;r._onError=null;let s=new r.constructor(Uo,n),o=r._result;if(No.instrument&&zo("chained",r,s),i===Bo)Zo(r,s,e,t);else{let n=i===$o?e:t;No.async(()=>Xo(i,s,n,o))}return s}var Qo=class{constructor(e,t,n,r){this._instanceConstructor=e,this.promise=new e(Uo,r),this._abortOnReject=n,this._isUsingOwnPromise=e===ra,this._isUsingOwnResolve=e.resolve===jo,this._init(...arguments)}_init(e,t){let n=t.length||0;this.length=n,this._remaining=n,this._result=new Array(n),this._enumerate(t)}_enumerate(e){let t=this.length,n=this.promise;for(let r=0;n._state===Bo&&r<t;r++)this._eachEntry(e[r],r,!0);this._checkFullfillment()}_checkFullfillment(){if(0===this._remaining){let e=this._result;Go(this.promise,e),this._result=null}}_settleMaybeThenable(e,t,n){let r=this._instanceConstructor;if(this._isUsingOwnResolve){let s,o,a=!0;try{s=e.then}catch(i){a=!1,o=i}if(s===Jo&&e._state!==Bo)e._onError=null,this._settledAt(e._state,t,e._result,n);else if("function"!=typeof s)this._settledAt($o,t,e,n);else if(this._isUsingOwnPromise){let i=new r(Uo);!1===a?Ko(i,o):(Vo(i,e,s),this._willSettleAt(i,t,n))}else this._willSettleAt(new r(t=>t(e)),t,n)}else this._willSettleAt(r.resolve(e),t,n)}_eachEntry(e,t,n){null!==e&&"object"==typeof e?this._settleMaybeThenable(e,t,n):this._setResultAt($o,t,e,n)}_settledAt(e,t,n,r){let i=this.promise;i._state===Bo&&(this._abortOnReject&&e===qo?Ko(i,n):(this._setResultAt(e,t,n,r),this._checkFullfillment()))}_setResultAt(e,t,n,r){this._remaining--,this._result[t]=n}_willSettleAt(e,t,n){Zo(e,void 0,e=>this._settledAt($o,t,e,n),e=>this._settledAt(qo,t,e,n))}};function ea(e,t,n){this._remaining--,this._result[t]=e===$o?{state:"fulfilled",value:n}:{state:"rejected",reason:n}}var ta="rsvp_"+Date.now()+"-",na=0,ra=class e{constructor(t,n){this._id=na++,this._label=n,this._state=void 0,this._result=void 0,this._subscribers=[],No.instrument&&zo("created",this),Uo!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){let n=!1;try{t(t=>{n||(n=!0,Wo(e,t))},t=>{n||(n=!0,Ko(e,t))})}catch(r){Ko(e,r)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}_onError(e){No.after(()=>{this._onError&&No.trigger("error",e,this._label)})}catch(e,t){return this.then(void 0,e,t)}finally(e,t){let n=this,r=n.constructor;return"function"==typeof e?n.then(t=>r.resolve(e()).then(()=>t),t=>r.resolve(e()).then(()=>{throw t})):n.then(e,e)}};function ia(e,t){return{then:(n,r)=>e.call(t,n,r)}}function sa(e,t){let n=function(){let n=arguments.length,r=new Array(n+1),i=!1;for(let e=0;e<n;++e){let t=arguments[e];if(!i){if(null!==t&&"object"==typeof t)if(t.constructor===ra)i=!0;else try{i=t.then}catch(_6){let t=new ra(Uo);return Ko(t,_6),t}else i=!1;i&&!0!==i&&(t=ia(i,t))}r[e]=t}let s=new ra(Uo);return r[n]=function(e,n){e?Ko(s,e):void 0===t?Wo(s,n):!0===t?Wo(s,function(e){let t=e.length,n=new Array(t-1);for(let r=1;r<t;r++)n[r-1]=e[r];return n}(arguments)):Array.isArray(t)?Wo(s,function(e,t){let n={},r=e.length,i=new Array(r);for(let s=0;s<r;s++)i[s]=e[s];for(let s=0;s<t.length;s++)n[t[s]]=i[s+1];return n}(arguments,t)):Wo(s,n)},i?function(e,t,n,r){return ra.all(t).then(t=>oa(e,t,n,r))}(s,r,e,this):oa(s,r,e,this)};return n.__proto__=e,n}function oa(e,t,n,r){try{n.apply(r,t)}catch(_6){Ko(e,_6)}return e}function aa(e,t){return ra.all(e,t)}ra.cast=jo,ra.all=function(e,t){return Array.isArray(e)?new Qo(this,e,!0,t).promise:this.reject(new TypeError("Promise.all must be called with an array"),t)},ra.race=function(e,t){let n=this,r=new n(Uo,t);if(!Array.isArray(e))return Ko(r,new TypeError("Promise.race must be called with an array")),r;for(let i=0;r._state===Bo&&i<e.length;i++)Zo(n.resolve(e[i]),void 0,e=>Wo(r,e),e=>Ko(r,e));return r},ra.resolve=jo,ra.reject=function(e,t){let n=new this(Uo,t);return Ko(n,e),n},ra.prototype._guidKey=ta,ra.prototype.then=Jo;var la=class extends Qo{constructor(e,t,n){super(e,t,!1,n)}};function ca(e,t){return Array.isArray(e)?new la(ra,e,t).promise:ra.reject(new TypeError("Promise.allSettled must be called with an array"),t)}function ua(e,t){return ra.race(e,t)}la.prototype._setResultAt=ea;var ha=class extends Qo{constructor(e,t,n=!0,r){super(e,t,n,r)}_init(e,t){this._result={},this._enumerate(t)}_enumerate(e){let t,n,r=Object.keys(e),i=r.length,s=this.promise;this._remaining=i;for(let o=0;s._state===Bo&&o<i;o++)t=r[o],n=e[t],this._eachEntry(n,t,!0);this._checkFullfillment()}};function da(e,t){return ra.resolve(e,t).then(function(e){if(null===e||"object"!=typeof e)throw new TypeError("Promise.hash must be called with an object");return new ha(ra,e,t).promise})}var pa=class extends ha{constructor(e,t,n){super(e,t,!1,n)}};function fa(e,t){return ra.resolve(e,t).then(function(e){if(null===e||"object"!=typeof e)throw new TypeError("hashSettled must be called with an object");return new pa(ra,e,!1,t).promise})}function ga(e){throw setTimeout(()=>{throw e}),e}function ma(e){let t={resolve:void 0,reject:void 0};return t.promise=new ra((e,n)=>{t.resolve=e,t.reject=n},e),t}pa.prototype._setResultAt=ea;var ya=class extends Qo{constructor(e,t,n,r){super(e,t,!0,r,n)}_init(e,t,n,r,i){let s=t.length||0;this.length=s,this._remaining=s,this._result=new Array(s),this._mapFn=i,this._enumerate(t)}_setResultAt(e,t,n,r){if(r)try{this._eachEntry(this._mapFn(n,t),t,!1)}catch(_6){this._settledAt(qo,t,_6,!1)}else this._remaining--,this._result[t]=n}};function va(e,t,n){return"function"!=typeof t?ra.reject(new TypeError("map expects a function as a second argument"),n):ra.resolve(e,n).then(function(e){if(!Array.isArray(e))throw new TypeError("map must be called with an array");return new ya(ra,e,t,n).promise})}function ba(e,t){return ra.resolve(e,t)}function wa(e,t){return ra.reject(e,t)}var _a={},xa=class extends ya{_checkFullfillment(){if(0===this._remaining&&null!==this._result){let e=this._result.filter(e=>e!==_a);Go(this.promise,e),this._result=null}}_setResultAt(e,t,n,r){if(r){this._result[t]=n;let e,r=!0;try{e=this._mapFn(n,t)}catch(_6){r=!1,this._settledAt(qo,t,_6,!1)}r&&this._eachEntry(e,t,!1)}else this._remaining--,n||(this._result[t]=_a)}};function Ca(e,t,n){return"function"!=typeof t?ra.reject(new TypeError("filter expects function as a second argument"),n):ra.resolve(e,n).then(function(e){if(!Array.isArray(e))throw new TypeError("filter must be called with an array");return new xa(ra,e,t,n).promise})}var Sa,ka=0;function Ea(e,t){Oa[ka]=e,Oa[ka+1]=t,2===(ka+=2)&&Aa()}var Ra="undefined"!=typeof window?window:void 0,Ta=Ra||{},La=Ta.MutationObserver||Ta.WebKitMutationObserver,Ia="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),Pa="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function Ma(){return()=>setTimeout(Na,1)}var Aa,Oa=new Array(1e3);function Na(){for(let e=0;e<ka;e+=2)(0,Oa[e])(Oa[e+1]),Oa[e]=void 0,Oa[e+1]=void 0;ka=0}Aa=Ia?function(){let e=process.nextTick,t=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);return Array.isArray(t)&&"0"===t[1]&&"10"===t[2]&&(e=setImmediate),()=>e(Na)}():La?function(){let e=0,t=new La(Na),n=document.createTextNode("");return t.observe(n,{characterData:!0}),()=>n.data=e=++e%2}():Pa?function(){let e=new MessageChannel;return e.port1.onmessage=Na,()=>e.port2.postMessage(0)}():void 0===Ra&&"function"==typeof window.require?function(){try{const e=Function("return this")().require("vertx");return void 0!==(Sa=e.runOnLoop||e.runOnContext)?function(){Sa(Na)}:Ma()}catch(e){return Ma()}}():Ma(),No.async=Ea,No.after=e=>setTimeout(e,0);var Fa=ba,Da=(e,t)=>No.async(e,t);function za(){No.on(...arguments)}function ja(){No.off(...arguments)}if("undefined"!=typeof window&&"object"==typeof window.__PROMISE_INSTRUMENTATION__){let e=window.__PROMISE_INSTRUMENTATION__;Fo("instrument",!0);for(let t in e)e.hasOwnProperty(t)&&za(t,e[t])}var Ua={asap:Ea,cast:Fa,Promise:ra,EventTarget:Oo,all:aa,allSettled:ca,race:ua,hash:da,hashSettled:fa,rethrow:ga,defer:ma,denodeify:sa,configure:Fo,on:za,off:ja,resolve:ba,reject:wa,map:va,async:Da,filter:Ca},Ba=Object.freeze(Object.defineProperty({__proto__:null,EventTarget:Oo,Promise:ra,all:aa,allSettled:ca,asap:Ea,async:Da,cast:Fa,configure:Fo,default:Ua,defer:ma,denodeify:sa,filter:Ca,hash:da,hashSettled:fa,map:va,off:ja,on:za,race:ua,reject:wa,resolve:ba,rethrow:ga},Symbol.toStringTag,{value:"Module"}));function $a(e){let t=function(e){if(!e)return;let t=e;return t.errorThrown?function(e){let t=e.errorThrown;return"string"==typeof t&&(t=new Error(t)),Object.defineProperty(t,"__reason_with_error_thrown__",{value:e,enumerable:!1}),t}(t):"UnrecognizedURLError"!==e.name&&"TransitionAborted"!==e.name?e:void 0}(e);if(t){let e=null;if(!e)throw t;e(t)}}Fo("async",(e,t)=>{bs.schedule("actions",null,e,t)}),Fo("after",e=>{bs.schedule(ys,null,e)}),za("error",$a);var qa=class{static _leakTracking;owner;registry;cache;factoryManagerCache;validationCache;isDestroyed;isDestroying;constructor(e,t={}){this.registry=e,this.owner=t.owner||null,this.cache=Po(t.cache||null),this.factoryManagerCache=Po(t.factoryManagerCache||null),this.isDestroyed=!1,this.isDestroying=!1}lookup(e,t){if(this.isDestroyed)throw new Error(`Cannot call \`.lookup('${e}')\` after the owner has been destroyed`);return function(e,t,n={}){let r=t;if(!0===n.singleton||void 0===n.singleton&&Va(e,t)){let t=e.cache[r];if(void 0!==t)return t}return function(e,t,n,r){let i=Ha(e,t,n);if(void 0!==i){if(function(e,t,{instantiate:n,singleton:r}){return!1!==r&&!1!==n&&(!0===r||Va(e,t))&&Wa(e,t)}(e,n,r)){let n=e.cache[t]=i.create();return e.isDestroying&&"function"==typeof n.destroy&&n.destroy(),n}if(function(e,t,{instantiate:n,singleton:r}){return!1!==n&&(!1===r||!Va(e,t))&&Wa(e,t)}(e,n,r))return i.create();if(function(e,t,{instantiate:n,singleton:r}){return!1!==r&&!n&&Va(e,t)&&!Wa(e,t)}(e,n,r)||function(e,t,{instantiate:n,singleton:r}){return!(!1!==n||!1!==r&&Va(e,t)||Wa(e,t))}(e,n,r))return i.class;throw new Error("Could not create factory")}}(e,r,t,n)}(this,this.registry.normalize(e),t)}destroy(){this.isDestroying=!0,Ga(this)}finalizeDestroy(){Ka(this),this.isDestroyed=!0}reset(e){this.isDestroyed||(void 0===e?(Ga(this),Ka(this)):function(e,t){let n=e.cache[t];delete e.factoryManagerCache[t],n&&(delete e.cache[t],n.destroy&&n.destroy())}(this,this.registry.normalize(e)))}ownerInjection(){let e={};return Br(e,this.owner),e}factoryFor(e){if(this.isDestroyed)throw new Error(`Cannot call \`.factoryFor('${e}')\` after the owner has been destroyed`);return Ha(this,this.registry.normalize(e),e)}};function Va(e,t){return!1!==e.registry.getOption(t,"singleton")}function Wa(e,t){return!1!==e.registry.getOption(t,"instantiate")}function Ha(e,t,n){let r=e.factoryManagerCache[t];if(void 0!==r)return r;let i=e.registry.resolve(t);if(void 0===i)return;let s=new Ja(e,i,n,t);return e.factoryManagerCache[t]=s,s}function Ga(e){let t=e.cache,n=Object.keys(t);for(let r of n){let e=t[r];e.destroy&&e.destroy()}}function Ka(e){e.cache=Po(null),e.factoryManagerCache=Po(null)}var Za=Symbol("INIT_FACTORY");function Ya(e){return e[Za]}function Xa(e,t){e[Za]=t}var Ja=class{container;owner;class;fullName;normalizedName;madeToString;injections;constructor(e,t,n,r){this.container=e,this.owner=e.owner,this.class=t,this.fullName=n,this.normalizedName=r,this.madeToString=void 0,this.injections=void 0}toString(){return void 0===this.madeToString&&(this.madeToString=this.container.registry.makeToString(this.class,this.fullName)),this.madeToString}create(e){let{container:t}=this;if(t.isDestroyed)throw new Error(`Cannot create new instances after the owner has been destroyed (you attempted to create ${this.fullName})`);let n=e?{...e}:{};return Br(n,t.owner),Xa(n,this),this.class.create(n)}};function Qa(e){let t=Object.create(null);t[e]=1;for(let n in t)if(n===e)return n;return e}var el=0;function tl(){return++el}var nl="ember",rl=new WeakMap,il=new Map,sl=Qa(`__ember${Date.now()}`);function ol(e,t=nl){let n=t+tl().toString();return Ze(e)&&rl.set(e,n),n}function al(e){let t;if(Ze(e))t=rl.get(e),void 0===t&&(t=`${nl}${tl()}`,rl.set(e,t));else if(t=il.get(e),void 0===t){let n=typeof e;t="string"===n?`st${tl()}`:"number"===n?`nu${tl()}`:"symbol"===n?`sy${tl()}`:`(${e})`,il.set(e,t)}return t}var ll=Array.prototype.concat;function cl(e,t,n,r){let i=n[e]||r[e];return t[e]&&(i=i?ll.call(i,t[e]):t[e]),i}function ul(e,t,n,r){if(!0===n)return t;let i=n._getter;if(void 0===i)return t;let s=r[e],o="function"==typeof s?P(s):s;if(void 0===o||!0===o)return t;let a=o._getter;if(void 0===a)return t;let l,c=en(i,a),u=n._setter,h=o._setter;if(l=void 0!==h?void 0!==u?en(u,h):h:u,c!==i||l!==u){let e=n._dependentKeys||[],t=new Gn([...e,{get:c,set:l}]);return t._readOnly=n._readOnly,t._meta=n._meta,t.enumerable=n.enumerable,T(t,Gn)}return t}function hl(e,t,n,r){if(void 0!==r[e])return t;let i=n[e];return"function"==typeof i?en(t,i):t}function dl(e){return e?Array.isArray(e)?e:[e]:[]}function pl(e,t,n){return dl(n[e]).concat(dl(t))}function fl(e,t,n){let r=n[e];if(!r)return t;let i=Object.assign({},r),s=!1,o=Object.keys(t);for(let a of o){let e=t[a];"function"==typeof e?(s=!0,i[a]=hl(a,e,r,{})):i[a]=e}return s&&(i._super=Wt),i}function gl(e,t,n,r,i,s,o){let a;for(let l=0;l<e.length;l++)if(a=e[l],bl.has(a)){if(t.hasMixin(a))continue;t.addMixin(a);let{properties:e,mixins:l}=a;void 0!==e?ml(t,e,n,r,i,s,o):void 0!==l&&(gl(l,t,n,r,i,s,o),a instanceof wl&&void 0!==a._without&&a._without.forEach(e=>{let t=s.indexOf(e);-1!==t&&s.splice(t,1)}))}else ml(t,a,n,r,i,s,o)}function ml(e,t,n,r,i,s,o){let a=cl("concatenatedProperties",t,r,i),l=cl("mergedProperties",t,r,i),c=Object.keys(t);for(let u of c){let c=t[u];if(void 0===c)continue;if(-1===s.indexOf(u)){s.push(u);let t=e.peekDescriptors(u);if(void 0===t){if(!M(c)){let e=r[u]=i[u];"function"==typeof e&&yl(i,u,e,!1)}}else n[u]=t,o.push(u),t.teardown(i,u,e)}let h="function"==typeof c;if(h){let e=P(c);if(void 0!==e){n[u]=ul(u,c,e,n),r[u]=void 0;continue}}a&&a.indexOf(u)>=0||"concatenatedProperties"===u||"mergedProperties"===u?c=pl(u,c,r):l&&l.indexOf(u)>-1?c=fl(u,c,r):h&&(c=hl(u,c,r,n)),r[u]=c,n[u]=void 0}}function yl(e,t,n,r){let i=Yt(n);if(void 0===i)return;let{observers:s,listeners:o}=i;if(void 0!==s){let n=r?dn:pn;for(let r of s.paths)n(e,r,null,t,s.sync)}if(void 0!==o){let n=r?nn:rn;for(let r of o)n(e,r,null,t)}}function vl(e,t,n=!1){let r=Object.create(null),i=Object.create(null),s=w(e),o=[],a=[];e._super=Wt,gl(t,s,r,i,e,o,a);for(let l of o){let t=i[l],o=r[l];void 0!==t?("function"==typeof t&&yl(e,l,t,!0),jn(e,l,t,-1!==a.indexOf(l),!n)):void 0!==o&&zn(e,l,o,s)}return s.isPrototypeMeta(e)||vn(e),e}var bl=new WeakSet,wl=class e{mixins;properties;ownerConstructor;_without;constructor(e,t){bl.add(this),this.properties=function(e){if(void 0!==e)for(let t of Object.keys(e)){let n=Object.getOwnPropertyDescriptor(e,t);void 0===n.get&&void 0===n.set||Object.defineProperty(e,t,{value:C(n)})}return e}(t),this.mixins=_l(e),this.ownerConstructor=void 0,this._without=void 0}static create(...e){return yi(),new this(e,void 0)}static mixins(e){let t=b(e),n=[];return null===t||t.forEachMixins(e=>{e.properties||n.push(e)}),n}reopen(...t){if(0===t.length)return this;if(this.properties){let t=new e(void 0,this.properties);this.properties=void 0,this.mixins=[t]}else this.mixins||(this.mixins=[]);return this.mixins=this.mixins.concat(_l(t)),this}apply(e,t=!1){return vl(e,[this],t)}applyPartial(e){return vl(e,[this])}detect(e){if("object"!=typeof e||null===e)return!1;if(bl.has(e))return xl(e,this);let t=b(e);return null!==t&&t.hasMixin(this)}without(...t){let n=new e([this]);return n._without=t,n}keys(){return Cl(this)}toString(){return"(unknown mixin)"}};function _l(e){let t,n=e&&e.length||0;if(n>0){t=new Array(n);for(let r=0;r<n;r++){let n=e[r];bl.has(n)?t[r]=n:t[r]=new wl(void 0,n)}}return t}function xl(e,t,n=new Set){if(n.has(e))return!1;if(n.add(e),e===t)return!0;let r=e.mixins;return!!r&&r.some(e=>xl(e,t,n))}function Cl(e,t=new Set,n=new Set){if(!n.has(e)){if(n.add(e),e.properties){let n=Object.keys(e.properties);for(let e of n)t.add(e)}else e.mixins&&e.mixins.forEach(e=>Cl(e,t,n));return t}}var Sl=wl.create({mergedProperties:["actions"],send(e,...t){if(this.actions&&this.actions[e]&&!0!==this.actions[e].apply(this,t))return;let n=ur(this,"target");n&&n.send(...arguments)}}),{isArray:kl}=Array;function El(e){return null==e?[]:kl(e)?e:[e]}var Rl=a({default:()=>Nl});function Tl(e){return"object"==typeof e&&null!==e&&"function"==typeof e.setUnknownProperty}var Ll=wl.prototype.reopen,Il=new WeakSet,Pl=new WeakMap,Ml=new Set;function Al(e){Ml.has(e)||e.destroy()}function Ol(e,t){let n=w(e);if(void 0!==t){let r=e.concatenatedProperties,i=e.mergedProperties,s=Object.keys(t);for(let o of s){let s=t[o],a=I(e,o,n),l=void 0!==a;if(!l){if(void 0!==r&&r.length>0&&r.includes(o)){let t=e[o];s=t?El(t).concat(s):El(s)}if(void 0!==i&&i.length>0&&i.includes(o)){let t=e[o];s=Object.assign({},t,s)}}l?a.set(e,o,s):Tl(e)&&!(o in e)?e.setUnknownProperty(o,s):e[o]=s}}e.init(t),n.unsetInitializing();let r=n.observerEvents();if(void 0!==r)for(let i=0;i<r.length;i++)fn(e,r[i].event,r[i].sync);sn(e,"init",void 0,void 0,n)}var Nl=class{[zr];constructor(e){let t;this[zr]=e,this.constructor.proto(),t=this;const n=t;ee(t,Al,!0),ee(t,()=>n.willDestroy()),w(t).setInitializing()}reopen(...e){return vl(this,e),this}init(e){}get isDestroyed(){return ie(this)}set isDestroyed(e){}get isDestroying(){return re(this)}set isDestroying(e){}destroy(){Ml.add(this);try{te(this)}finally{Ml.delete(this)}return this}willDestroy(){}toString(){let e="object"==typeof this&&null!==this&&"function"==typeof this.toStringExtension?`:${this.toStringExtension()}`:"";return`<${Ya(this)||"(unknown)"}:${al(this)}${e}>`}static extend(...e){let t=class extends(this){};return Ll.apply(t.PrototypeMixin,e),t}static create(...e){let t,n=e[0];return void 0!==n?(t=new this(Ur(n)),Xa(t,Ya(n))):t=new this,e.length<=1?Ol(t,n):Ol(t,Fl.apply(this,e)),t}static reopen(...e){return this.willReopen(),Ll.apply(this.PrototypeMixin,e),this}static willReopen(){let e=this.prototype;Il.has(e)&&(Il.delete(e),Pl.has(this)&&Pl.set(this,wl.create(this.PrototypeMixin)))}static reopenClass(...e){return vl(this,e),this}static detect(e){if("function"!=typeof e)return!1;for(;e;){if(e===this)return!0;e=e.superclass}return!1}static detectInstance(e){return e instanceof this}static metaForProperty(e){return I(this.proto(),e)._meta||{}}static eachComputedProperty(e,t=this){this.proto();let n={};w(this.prototype).forEachDescriptors((r,i)=>{if(i.enumerable){let s=i._meta||n;e.call(t,r,s)}})}static get PrototypeMixin(){let e=Pl.get(this);return void 0===e&&(e=wl.create(),e.ownerConstructor=this,Pl.set(this,e)),e}static get superclass(){let e=Object.getPrototypeOf(this);return e!==Function.prototype?e:void 0}static proto(){let e=this.prototype;if(!Il.has(e)){Il.add(e);let t=this.superclass;t&&t.proto(),Pl.has(this)&&this.PrototypeMixin.apply(e)}return e}static toString(){return`<${Ya(this)||"(unknown)"}:constructor>`}static isClass=!0;static isMethod=!1;static _onLookup;static _lazyInjections};function Fl(...e){let t={};for(let n of e){let e=Object.keys(n);for(let r=0,i=e.length;r<i;r++){let i=e[r];t[i]=n[i]}}return t}var Dl=a({default:()=>zl}),zl=wl.create({get(e){return ur(this,e)},getProperties(...e){return Fr(this,...e)},set(e,t){return gr(this,e,t)},setProperties(e){return Dr(this,e)},beginPropertyChanges(){return qn(),this},endPropertyChanges(){return Vn(),this},notifyPropertyChange(e){return $n(this,e),this},addObserver(e,t,n,r){return dn(this,e,t,n,r),this},removeObserver(e,t,n,r){return pn(this,e,t,n,r),this},hasObserverFor(e){return on(this,`${e}:change`)},incrementProperty(e,t=1){return gr(this,e,(parseFloat(ur(this,e))||0)+t)},decrementProperty(e,t=1){return gr(this,e,(ur(this,e)||0)-t)},toggleProperty(e){return gr(this,e,!ur(this,e))},cacheFor(e){let t=b(this);return null!==t?t.valueFor(e):void 0}}),jl=a({action:()=>ql,computed:()=>Yn,default:()=>Ul,defineProperty:()=>Dn,get:()=>ur,getProperties:()=>Fr,notifyPropertyChange:()=>$n,observer:()=>Vl,set:()=>gr,setProperties:()=>Dr,trySet:()=>yr}),Ul=class extends(Nl.extend(zl)){get _debugContainerKey(){let e=Ya(this);return void 0!==e&&e.fullName}},Bl=new WeakMap;function $l(e,t,n){var r;if(null!=(r=e)&&void 0!==r.constructor&&"function"==typeof r.constructor.proto&&e.constructor.proto(),!Object.prototype.hasOwnProperty.call(e,"actions")){let t=e.actions;e.actions=t?Object.assign({},t):{}}return e.actions[t]=n,{get(){let e=Bl.get(this);void 0===e&&(e=new Map,Bl.set(this,e));let t=e.get(n);return void 0===t&&(t=n.bind(this),e.set(n,t)),t}}}function ql(...e){let t;if(!x(e)){t=e[0];let n=function(e,n){return $l(e,n,t)};return A(n),n}let[n,r,i]=e;return t=i?.value,$l(n,r,t)}function Vl(...e){let t,n,r,i=e.pop();"function"==typeof i?(t=i,n=e,r=!O._DEFAULT_ASYNC_OBSERVERS):(t=i.fn,n=i.dependentKeys,r=i.sync);let s=[];for(let o of n)Nn(o,e=>s.push(e));return Xt(t,{paths:s,sync:r}),t}function Wl(e){if(!(e instanceof MouseEvent))return!1;let t=e.shiftKey||e.metaKey||e.altKey||e.ctrlKey,n=0!==e.button;return!t&&!n}function Hl(e){return'Binding style attributes may introduce cross-site scripting vulnerabilities; please ensure that values being bound are properly escaped. For more information, including how to disable this warning, see https://deprecations.emberjs.com/v1.x/#toc_binding-style-attributes. Style affected: "'+e+'"'}function Gl(e){let t=e.lookup("-view-registry:main"),n=[];return Object.keys(t).forEach(e=>{let r=t[e];null===r.parentView&&n.push(r)}),n}function Kl(e){return""!==e.tagName&&e.elementId?e.elementId:al(e)}A(ql);var Zl=new WeakMap,Yl=new WeakMap;function Xl(e){return Zl.get(e)||null}function Jl(e){return Yl.get(e)||null}function Ql(e,t){Zl.set(e,t)}function ec(e,t){Yl.set(e,t)}function tc(e){Zl.delete(e)}function nc(e){Yl.delete(e)}var rc=new WeakMap;function ic(e){return function(e,t){let n=[],r=rc.get(e);return void 0!==r&&r.forEach(e=>{let r=t[e];!r||r.isDestroying||r.isDestroyed||n.push(r)}),n}(e,Ur(e).lookup("-view-registry:main"))}function sc(e,t){let n=rc.get(e);void 0===n&&(n=function(e){let t=new Set;return rc.set(e,t),t}(e)),n.add(Kl(t))}function oc(e){return e.renderer.getBounds(e)}function ac(e){let t=oc(e),n=document.createRange();return n.setStartBefore(t.firstNode),n.setEndAfter(t.lastNode),n}function lc(e){return ac(e).getClientRects()}function cc(e){return ac(e).getBoundingClientRect()}var uc="ember-application",hc=class extends Ul{events={touchstart:"touchStart",touchmove:"touchMove",touchend:"touchEnd",touchcancel:"touchCancel",keydown:"keyDown",keyup:"keyUp",keypress:"keyPress",mousedown:"mouseDown",mouseup:"mouseUp",contextmenu:"contextMenu",click:"click",dblclick:"doubleClick",focusin:"focusIn",focusout:"focusOut",submit:"submit",input:"input",change:"change",dragstart:"dragStart",drag:"drag",dragenter:"dragEnter",dragleave:"dragLeave",dragover:"dragOver",drop:"drop",dragend:"dragEnd"};rootElement="body";_eventHandlers=Object.create(null);_didSetup=!1;finalEventNameMapping=null;_sanitizedRootElement=null;lazyEvents=new Map;_reverseEventNameMapping=null;setup(e,t){let n=this.finalEventNameMapping={...ur(this,"events"),...e};this._reverseEventNameMapping=Object.keys(n).reduce((e,t)=>{let r=n[t];return r?{...e,[r]:t}:e},{});let r=this.lazyEvents;null!=t&&gr(this,"rootElement",t);let i=ur(this,"rootElement"),s="string"!=typeof i?i:document.querySelector(i);s.classList.add(uc),this._sanitizedRootElement=s;for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&r.set(o,n[o]??null);this._didSetup=!0}setupHandlerForBrowserEvent(e){this.setupHandler(this._sanitizedRootElement,e,this.finalEventNameMapping[e]??null)}setupHandlerForEmberEvent(e){let t=this._reverseEventNameMapping?.[e];t&&this.setupHandler(this._sanitizedRootElement,t,e)}setupHandler(e,t,n){if(null===n||!this.lazyEvents.has(t))return;let r=(e,t)=>{let r=Xl(e),i=!0;return r&&(i=r.handleEvent(n,t)),i},i=this._eventHandlers[t]=e=>{let t=e.target;do{if(Xl(t)){if(!1===r(t,e)){e.preventDefault(),e.stopPropagation();break}if(!0===e.cancelBubble)break}t=t.parentNode}while(t instanceof Element)};e.addEventListener(t,i),this.lazyEvents.delete(t)}destroy(){if(!1===this._didSetup)return;let e=this._sanitizedRootElement;if(e){for(let t in this._eventHandlers)e.removeEventListener(t,this._eventHandlers[t]);return e.classList.remove(uc),this._super(...arguments)}}toString(){return"(EventDispatcher)"}},dc=/^[^:]+:[^:]+$/,pc=class{_failSet;resolver;fallback;registrations;_normalizeCache;_options;_resolveCache;_typeOptions;constructor(e={}){this.fallback=e.fallback||null,this.resolver=e.resolver||null,this.registrations=Po(e.registrations||null),this._normalizeCache=Po(null),this._resolveCache=Po(null),this._failSet=new Set,this._options=Po(null),this._typeOptions=Po(null)}container(e){return new qa(this,e)}register(e,t,n={}){let r=this.normalize(e);this._failSet.delete(r),this.registrations[r]=t,this._options[r]=n}unregister(e){let t=this.normalize(e);delete this.registrations[t],delete this._resolveCache[t],delete this._options[t],this._failSet.delete(t)}resolve(e){let t=function(e,t){let n,r=t,i=e._resolveCache[r];return void 0!==i?i:e._failSet.has(r)?void 0:(e.resolver&&(n=e.resolver.resolve(r)),void 0===n&&(n=e.registrations[r]),void 0===n?e._failSet.add(r):e._resolveCache[r]=n,n)}(this,this.normalize(e));return void 0===t&&null!==this.fallback&&(t=this.fallback.resolve(e)),t}describe(e){return null!==this.resolver&&this.resolver.lookupDescription?this.resolver.lookupDescription(e):null!==this.fallback?this.fallback.describe(e):e}normalizeFullName(e){return null!==this.resolver&&this.resolver.normalize?this.resolver.normalize(e):null!==this.fallback?this.fallback.normalizeFullName(e):e}normalize(e){return this._normalizeCache[e]||(this._normalizeCache[e]=this.normalizeFullName(e))}makeToString(e,t){return null!==this.resolver&&this.resolver.makeToString?this.resolver.makeToString(e,t):null!==this.fallback?this.fallback.makeToString(e,t):"string"==typeof e?e:e.name??"(unknown class)"}has(e){return!!this.isValidFullName(e)&&function(e,t){return void 0!==e.resolve(t)}(this,this.normalize(e))}optionsForType(e,t){this._typeOptions[e]=t}getOptionsForType(e){let t=this._typeOptions[e];return void 0===t&&null!==this.fallback&&(t=this.fallback.getOptionsForType(e)),t}options(e,t){let n=this.normalize(e);this._options[n]=t}getOptions(e){let t=this.normalize(e),n=this._options[t];return void 0===n&&null!==this.fallback&&(n=this.fallback.getOptions(e)),n}getOption(e,t){let n=this._options[e];if(void 0!==n&&void 0!==n[t])return n[t];let r=e.split(":")[0];return n=this._typeOptions[r],n&&void 0!==n[t]?n[t]:null!==this.fallback?this.fallback.getOption(e,t):void 0}knownForType(e){let t,n,r=Po(null),i=Object.keys(this.registrations);for(let s of i)s.split(":")[0]===e&&(r[s]=!0);return null!==this.fallback&&(t=this.fallback.knownForType(e)),null!==this.resolver&&this.resolver.knownForType&&(n=this.resolver.knownForType(e)),Object.assign({},t,r,n)}isValidFullName(e){return dc.test(e)}},fc=Po(null),gc=`${Math.random()}${Date.now()}`.replace(".","");function mc([e]){let t=fc[e];if(t)return t;let[n,r]=e.split(":");return fc[e]=Qa(`${n}:${r}-${gc}`)}var yc=a({default:()=>vc,on:()=>an}),vc=wl.create({on(e,t,n){return nn(this,e,t,n),this},one(e,t,n){return nn(this,e,t,n,!0),this},trigger(e,...t){sn(this,e,t)},off(e,t,n){return rn(this,e,t,n),this},has(e){return on(this,e)}}),bc=wl.create(),wc=a({default:()=>_c}),_c=wl.create(bc),xc={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object AsyncFunction]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object","[object FileList]":"filelist"},{toString:Cc}=Object.prototype;function Sc(e){if(null===e)return"null";if(void 0===e)return"undefined";let t=xc[Cc.call(e)]||"object";return"function"===t?Nl.detect(e)&&(t="class"):"object"===t&&(e instanceof Error?t="error":e instanceof Nl?t="instance":e instanceof Date&&(t="date")),t}var kc=wl.create({compare:null}),Ec={undefined:0,null:1,boolean:2,number:3,string:4,array:5,object:6,instance:7,function:8,class:9,date:10,regexp:11,filelist:12,error:13};function Rc(e,t){return Math.sign(e-t)}function Tc(e,t){if(e===t)return 0;let n=Sc(e),r=Sc(t);if("instance"===n&&Lc(e)&&e.constructor.compare)return e.constructor.compare(e,t);if("instance"===r&&Lc(t)&&t.constructor.compare)return-1*t.constructor.compare(t,e);let i=Rc(Ec[n],Ec[r]);if(0!==i)return i;switch(n){case"boolean":return Rc(Number(e),Number(t));case"number":return Rc(e,t);case"string":return Rc(e.localeCompare(t),0);case"array":{let n=e.length,r=t.length,i=Math.min(n,r);for(let s=0;s<i;s++){let n=Tc(e[s],t[s]);if(0!==n)return n}return Rc(n,r)}case"instance":return Lc(e)&&e.compare?e.compare(e,t):0;case"date":return Rc(e.getTime(),t.getTime());default:return 0}}function Lc(e){return kc.detect(e)}function Ic(e){if(!e||e.setInterval)return!1;if(Array.isArray(e)||ir(e))return!0;let t=Sc(e);if("array"===t)return!0;let n=e.length;return"number"==typeof n&&n==n&&"object"===t}var Pc=a({A:()=>Zc,MutableArray:()=>Hc,NativeArray:()=>Gc,default:()=>Wc,isArray:()=>Ic,makeArray:()=>El,removeAt:()=>Bc,uniqBy:()=>Oc}),Mc=Object.freeze([]),Ac=e=>e;function Oc(e,t=Ac){let n=Zc(),r=new Set,i="function"==typeof t?t:e=>ur(e,t);return e.forEach(e=>{let t=i(e);r.has(t)||(r.add(t),n.push(e))}),n}function Nc(...e){let t=2===e.length,[n,r]=e;return t?e=>r===ur(e,n):e=>Boolean(ur(e,n))}function Fc(e,t,n){let r=e.length;for(let i=n;i<r;i++)if(t(Pt(e,i),i,e))return i;return-1}function Dc(e,t,n=null){let r=Fc(e,t.bind(n),0);return-1===r?void 0:Pt(e,r)}function zc(e,t,n=null){return-1!==Fc(e,t.bind(n),0)}function jc(e,t,n=null){let r=t.bind(n);return-1===Fc(e,(e,t,n)=>!r(e,t,n),0)}function Uc(e,t,n=0,r){let i=e.length;return n<0&&(n+=i),Fc(e,r&&t!=t?e=>e!=e:e=>e===t,n)}function Bc(e,t,n){return Er(e,t,n??1,Mc),e}function $c(e,t,n){return Er(e,t,0,[n]),n}function qc(e){let t=Yn(e);return t.enumerable=!1,t}function Vc(e){return this.map(t=>ur(t,e))}var Wc=wl.create(bc,{init(){this._super(...arguments),rr.add(this)},objectsAt(e){return e.map(e=>Pt(this,e))},"[]":qc({get(){return this},set(e,t){return this.replace(0,this.length,t),this}}),firstObject:qc(function(){return Pt(this,0)}).readOnly(),lastObject:qc(function(){return Pt(this,this.length-1)}).readOnly(),slice(e=0,t){let n,r=Zc(),i=this.length;for(e<0&&(e=i+e),n=void 0===t||t>i?i:t<0?i+t:t;e<n;)r[r.length]=Pt(this,e++);return r},indexOf(e,t){return Uc(this,e,t,!1)},lastIndexOf(e,t){let n=this.length;(void 0===t||t>=n)&&(t=n-1),t<0&&(t+=n);for(let r=t;r>=0;r--)if(Pt(this,r)===e)return r;return-1},forEach(e,t=null){let n=this.length;for(let r=0;r<n;r++){let n=this.objectAt(r);e.call(t,n,r,this)}return this},getEach:Vc,setEach(e,t){return this.forEach(n=>gr(n,e,t))},map(e,t=null){let n=Zc();return this.forEach((r,i,s)=>n[i]=e.call(t,r,i,s)),n},mapBy:Vc,filter(e,t=null){let n=Zc();return this.forEach((r,i,s)=>{e.call(t,r,i,s)&&n.push(r)}),n},reject(e,t=null){return this.filter(function(){return!e.apply(t,arguments)})},filterBy(){return this.filter(Nc(...arguments))},rejectBy(){return this.reject(Nc(...arguments))},find(e,t=null){return Dc(this,e,t)},findBy(){return Dc(this,Nc(...arguments))},every(e,t=null){return jc(this,e,t)},isEvery(){return jc(this,Nc(...arguments))},any(e,t=null){return zc(this,e,t)},isAny(){return zc(this,Nc(...arguments))},reduce(e,t){let n=t,r=0;if(!(arguments.length>1)){if(0===this.length)throw new TypeError("Reduce of empty array with no initial value");n=this.objectAt(0),r=1}for(let i=r;i<this.length;i++)n=e(n,this.objectAt(i),i,this);return n},invoke(e,...t){let n=Zc();return this.forEach(r=>n.push(r[e]?.(...t))),n},toArray(){return this.map(e=>e)},compact(){return this.filter(e=>null!=e)},includes(e,t){return-1!==Uc(this,e,t,!0)},sortBy(){let e=arguments;return this.toArray().sort((t,n)=>{for(let r=0;r<e.length;r++){let i=e[r],s=Tc(ur(t,i),ur(n,i));if(s)return s}return 0})},uniq(){return Oc(this)},uniqBy(e){return Oc(this,e)},without(e){if(!this.includes(e))return this;let t=e==e?t=>t!==e:e=>e==e;return this.filter(t)}}),Hc=wl.create(Wc,_c,{clear(){let e=this.length;return 0===e||this.replace(0,e,Mc),this},insertAt(e,t){return $c(this,e,t),this},removeAt(e,t){return Bc(this,e,t)},pushObject(e){return $c(this,this.length,e)},pushObjects(e){return this.replace(this.length,0,e),this},popObject(){let e=this.length;if(0===e)return null;let t=Pt(this,e-1);return this.removeAt(e-1,1),t},shiftObject(){if(0===this.length)return null;let e=Pt(this,0);return this.removeAt(0),e},unshiftObject(e){return $c(this,0,e)},unshiftObjects(e){return this.replace(0,0,e),this},reverseObjects(){let e=this.length;if(0===e)return this;let t=this.toArray().reverse();return this.replace(0,e,t),this},setObjects(e){if(0===e.length)return this.clear();let t=this.length;return this.replace(0,t,e),this},removeObject(e){let t=this.length||0;for(;--t>=0;)Pt(this,t)===e&&this.removeAt(t);return this},removeObjects(e){qn();for(let t=e.length-1;t>=0;t--)this.removeObject(e[t]);return Vn(),this},addObject(e){return this.includes(e)||this.pushObject(e),this},addObjects(e){return qn(),e.forEach(e=>this.addObject(e)),Vn(),this}}),Gc=wl.create(Hc,zl,{objectAt(e){return this[e]},replace(e,t,n=Mc){return Tr(this,e,t,n),this}}),Kc=["length"];Gc.keys().forEach(e=>{Array.prototype[e]&&Kc.push(e)}),Gc=Gc.without(...Kc);var Zc=function(e){return ir(e)?e:Gc.apply(e??[])},Yc=class extends Ul{},Xc=a({ControllerMixin:()=>Qc,default:()=>eu,inject:()=>tu}),Jc=Symbol("MODEL"),Qc=wl.create(Sl,{isController:!0,concatenatedProperties:["queryParams"],target:null,store:null,init(){this._super(...arguments);let e=Ur(this);e&&(this.namespace=e.lookup("application:main"),this.target=e.lookup("router:main"))},model:Yn({get(){return this[Jc]},set(e,t){return this[Jc]=t}}),queryParams:null,_qpDelegate:null,_qpChanged(e,t){let n=t.indexOf(".[]"),r=-1===n?t:t.slice(0,n);(0,e._qpDelegate)(r,ur(e,r))}}),eu=class extends(Yc.extend(Qc)){};function tu(...e){return $r("controller",...e)}var nu=!1;function ru(){return nu}function iu(e){nu=Boolean(e)}var su=Symbol("ENGINE_PARENT");function ou(e){return e[su]}var au=wl.create({__container__:null,ownerInjection(){return this.__container__.ownerInjection()},lookup(e,t){return this.__container__.lookup(e,t)},destroy(){let e=this.__container__;e&&_s(()=>{e.destroy(),ks("destroy",e,"finalizeDestroy")}),this._super()},factoryFor(e){return this.__container__.factoryFor(e)}}),lu=wl.create({__registry__:null,resolveRegistration(e){return this.__registry__.resolve(e)},register:cu("register"),unregister:cu("unregister"),hasRegistration:cu("has"),registeredOption:cu("getOption"),registerOptions:cu("options"),registeredOptions:cu("getOptions"),registerOptionsForType:cu("optionsForType"),registeredOptionsForType:cu("getOptionsForType")});function cu(e){return function(...t){return this.__registry__[e](...t)}}var uu=class extends(Ul.extend(lu,au)){static setupRegistry(e,t){}[su];_booted=!1;init(e){super.init(e),al(this),this.base??=this.application;let t=this.__registry__=new pc({fallback:this.base.__registry__});this.__container__=t.container({owner:this}),this._booted=!1}_bootPromise=null;boot(e){return this._bootPromise||(this._bootPromise=new Ba.Promise(t=>{t(this._bootSync(e))})),this._bootPromise}_bootSync(e){return this._booted||(this.cloneParentDependencies(),this.setupRegistry(e),this.base.runInstanceInitializers(this),this._booted=!0),this}setupRegistry(e=this.__container__.lookup("-environment:main")){this.constructor.setupRegistry(this.__registry__,e)}unregister(e){this.__container__.reset(e),this.__registry__.unregister(e)}buildChildEngineInstance(e,t={}){let n=this.lookup(`engine:${e}`);if(!n)throw new Error(`You attempted to mount the engine '${e}', but it is not registered with its parent.`);let r=n.buildInstance(t);return r[su]=this,r}cloneParentDependencies(){const e=ou(this);["route:basic","service:-routing"].forEach(t=>{let n=e.resolveRegistration(t);this.register(t,n)});let t=e.lookup("-environment:main");this.register("-environment:main",t,{instantiate:!1});let n=["router:main",mc`-bucket-cache:main`,"-view-registry:main","renderer:-dom","service:-document"];t.isInteractive&&n.push("event_dispatcher:main"),n.forEach(t=>{let n=e.lookup(t);this.register(t,n,{instantiate:!1})})}},hu=function(e,t,n){let{get:r}=n;return void 0!==r&&(n.get=function(){let e,n=Ke(this,t),i=qe(()=>{e=r.call(this)});return pe(n,i),Ne(i),e}),n};function du(...e){if(x(e)){let[t,n,r]=e;return hu(0,n,r)}{const t=e[0];let n=function(e,n){return hu(0,n,t)};return A(n),n}}A(du);var pu={Empty:0,dynamicLayout:1,dynamicTag:2,prepareArgs:4,createArgs:8,attributeHook:16,elementHook:32,dynamicScope:64,createCaller:128,updateHook:256,createInstance:512,wrapped:1024,willDestroy:2048,hasSubOwner:4096},fu=pu.Empty;function gu(e){return fu|mu(e,"dynamicLayout")|mu(e,"dynamicTag")|mu(e,"prepareArgs")|mu(e,"createArgs")|mu(e,"attributeHook")|mu(e,"elementHook")|mu(e,"dynamicScope")|mu(e,"createCaller")|mu(e,"updateHook")|mu(e,"createInstance")|mu(e,"wrapped")|mu(e,"willDestroy")|mu(e,"hasSubOwner")}function mu(e,t){return e[t]?pu[t]:fu}function yu(e,t,n){return!!(t&n)}function vu(e,t){return!!(e&t)}function bu(e,t={}){return{hasValue:Boolean(t.hasValue),hasDestroyable:Boolean(t.hasDestroyable),hasScheduledEffect:Boolean(t.hasScheduledEffect)}}function wu(e){return e.capabilities.hasValue}function _u(e){return e.capabilities.hasDestroyable}var xu=class{constructor(e){this.factory=e}helperManagerDelegates=new WeakMap;undefinedDelegate=null;getDelegateForOwner(e){let t=this.helperManagerDelegates.get(e);if(void 0===t){let{factory:n}=this;t=n(e),this.helperManagerDelegates.set(e,t)}return t}getDelegateFor(e){if(void 0===e){let{undefinedDelegate:e}=this;if(null===e){let{factory:t}=this;this.undefinedDelegate=e=t(void 0)}return e}return this.getDelegateForOwner(e)}getHelper(e){return(t,n)=>{let r=this.getDelegateFor(n);const i=It(t),s=r.createHelper(e,i);if(wu(r)){let e=ft(()=>r.getValue(s),null);return _u(r)&&Q(e,r.getDestroyable(s)),e}if(_u(r)){let e=dt(void 0);return Q(e,r.getDestroyable(s)),e}return lt}}},Cu=class{capabilities={hasValue:!0,hasDestroyable:!1,hasScheduledEffect:!1};createHelper(e,t){return{fn:e,args:t}}getValue({fn:e,args:t}){return Object.keys(t.named).length>0?e(...t.positional,t.named):e(...t.positional)}getDebugName(e){return e.name?`(helper function ${e.name})`:"(anonymous helper function)"}},Su=new WeakMap,ku=new WeakMap,Eu=new WeakMap,Ru=Object.getPrototypeOf;function Tu(e,t,n){return e.set(n,t),n}function Lu(e,t){let n=t;for(;null!==n;){const t=e.get(n);if(void 0!==t)return t;n=Ru(n)}}function Iu(e,t){return Tu(ku,e,t)}function Pu(e){const t=Lu(ku,e);return void 0===t?null:t}function Mu(e,t){return Tu(Eu,e,t)}var Au=new xu(()=>new Cu);function Ou(e){let t=Lu(Eu,e);return void 0===t&&"function"==typeof e&&(t=Au),t||null}function Nu(e,t){return Tu(Su,e,t)}function Fu(e){const t=Lu(Su,e);return void 0===t?null:t}function Du(e){return void 0!==Lu(Su,e)}function zu(e){return function(e){return"function"==typeof e}(e)||void 0!==Lu(Eu,e)}function ju(e){return void 0!==Lu(ku,e)}var Uu=Object.create;function Bu(){var e=Uu(null);return e.__=void 0,delete e.__,e}var $u=function(e,t,n){this.path=e,this.matcher=t,this.delegate=n};$u.prototype.to=function(e,t){var n=this.delegate;if(n&&n.willAddRoute&&(e=n.willAddRoute(this.matcher.target,e)),this.matcher.add(this.path,e),t){if(0===t.length)throw new Error("You must have an argument in the function passed to `to`");this.matcher.addChild(this.path,e,t,this.delegate)}};var qu=function(e){this.routes=Bu(),this.children=Bu(),this.target=e};function Vu(e,t,n){return function(r,i){var s=e+r;if(!i)return new $u(s,t,n);i(Vu(s,t,n))}}function Wu(e,t,n){for(var r=0,i=0;i<e.length;i++)r+=e[i].path.length;var s={path:t=t.substr(r),handler:n};e.push(s)}function Hu(e,t,n,r){for(var i=t.routes,s=Object.keys(i),o=0;o<s.length;o++){var a=s[o],l=e.slice();Wu(l,a,i[a]);var c=t.children[a];c?Hu(l,c,n,r):n.call(r,l)}}function Gu(e){return e.split("/").map(Zu).join("/")}qu.prototype.add=function(e,t){this.routes[e]=t},qu.prototype.addChild=function(e,t,n,r){var i=new qu(t);this.children[e]=i;var s=Vu(e,i,r);r&&r.contextEntered&&r.contextEntered(t,s),n(s)};var Ku=/%|\//g;function Zu(e){return e.length<3||-1===e.indexOf("%")?e:decodeURIComponent(e).replace(Ku,encodeURIComponent)}var Yu=/%(?:2(?:4|6|B|C)|3(?:B|D|A)|40)/g;function Xu(e){return encodeURIComponent(e).replace(Yu,decodeURIComponent)}var Ju=/(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\)/g,Qu=Array.isArray,eh=Object.prototype.hasOwnProperty;function th(e,t){if("object"!=typeof e||null===e)throw new Error("You must pass an object as the second argument to `generate`.");if(!eh.call(e,t))throw new Error("You must provide param `"+t+"` to `generate`.");var n=e[t],r="string"==typeof n?n:""+n;if(0===r.length)throw new Error("You must provide a param `"+t+"`.");return r}var nh=[];nh[0]=function(e,t){for(var n=t,r=e.value,i=0;i<r.length;i++){var s=r.charCodeAt(i);n=n.put(s,!1,!1)}return n},nh[1]=function(e,t){return t.put(47,!0,!0)},nh[2]=function(e,t){return t.put(-1,!1,!0)},nh[4]=function(e,t){return t};var rh=[];rh[0]=function(e){return e.value.replace(Ju,"\\$1")},rh[1]=function(){return"([^/]+)"},rh[2]=function(){return"(.+)"},rh[4]=function(){return""};var ih=[];ih[0]=function(e){return e.value},ih[1]=function(e,t){var n=th(t,e.value);return fh.ENCODE_AND_DECODE_PATH_SEGMENTS?Xu(n):n},ih[2]=function(e,t){return th(t,e.value)},ih[4]=function(){return""};var sh=Object.freeze({}),oh=Object.freeze([]);function ah(e,t,n){t.length>0&&47===t.charCodeAt(0)&&(t=t.substr(1));for(var r=t.split("/"),i=void 0,s=void 0,o=0;o<r.length;o++){var a,l,c=r[o];12&(a=2<<(l=""===c?4:58===c.charCodeAt(0)?1:42===c.charCodeAt(0)?2:0))&&(c=c.slice(1),(i=i||[]).push(c),(s=s||[]).push(!!(4&a))),14&a&&n[l]++,e.push({type:l,value:Zu(c)})}return{names:i||oh,shouldDecodes:s||oh}}function lh(e,t,n){return e.char===t&&e.negate===n}var ch=function(e,t,n,r,i){this.states=e,this.id=t,this.char=n,this.negate=r,this.nextStates=i?t:null,this.pattern="",this._regex=void 0,this.handlers=void 0,this.types=void 0};function uh(e,t){return e.negate?e.char!==t&&-1!==e.char:e.char===t||-1===e.char}function hh(e,t){for(var n=[],r=0,i=e.length;r<i;r++){var s=e[r];n=n.concat(s.match(t))}return n}ch.prototype.regex=function(){return this._regex||(this._regex=new RegExp(this.pattern)),this._regex},ch.prototype.get=function(e,t){var n=this.nextStates;if(null!==n)if(Qu(n))for(var r=0;r<n.length;r++){var i=this.states[n[r]];if(lh(i,e,t))return i}else{var s=this.states[n];if(lh(s,e,t))return s}},ch.prototype.put=function(e,t,n){var r;if(r=this.get(e,t))return r;var i=this.states;return r=new ch(i,i.length,e,t,n),i[i.length]=r,null==this.nextStates?this.nextStates=r.id:Qu(this.nextStates)?this.nextStates.push(r.id):this.nextStates=[this.nextStates,r.id],r},ch.prototype.match=function(e){var t=this.nextStates;if(!t)return[];var n=[];if(Qu(t))for(var r=0;r<t.length;r++){var i=this.states[t[r]];uh(i,e)&&n.push(i)}else{var s=this.states[t];uh(s,e)&&n.push(s)}return n};var dh=function(e){this.length=0,this.queryParams=e||{}};function ph(e){var t;e=e.replace(/\+/gm,"%20");try{t=decodeURIComponent(e)}catch(_6){t=""}return t}dh.prototype.splice=Array.prototype.splice,dh.prototype.slice=Array.prototype.slice,dh.prototype.push=Array.prototype.push;var fh=function(){this.names=Bu();var e=[],t=new ch(e,0,-1,!0,!1);e[0]=t,this.states=e,this.rootState=t};function gh(){let e=new Error("TransitionAborted");return e.name="TransitionAborted",e.code="TRANSITION_ABORTED",e}function mh(e){if("object"==typeof(t=e)&&null!==t&&"boolean"==typeof t.isAborted&&e.isAborted)throw gh();var t}fh.prototype.add=function(e,t){for(var n,r=this.rootState,i="^",s=[0,0,0],o=new Array(e.length),a=[],l=!0,c=0,u=0;u<e.length;u++){for(var h=e[u],d=ah(a,h.path,s),p=d.names,f=d.shouldDecodes;c<a.length;c++){var g=a[c];4!==g.type&&(l=!1,r=r.put(47,!1,!1),i+="/",r=nh[g.type](g,r),i+=rh[g.type](g))}o[u]={handler:h.handler,names:p,shouldDecodes:f}}l&&(r=r.put(47,!1,!1),i+="/"),r.handlers=o,r.pattern=i+"$",r.types=s,"object"==typeof t&&null!==t&&t.as&&(n=t.as),n&&(this.names[n]={segments:a,handlers:o})},fh.prototype.handlersFor=function(e){var t=this.names[e];if(!t)throw new Error("There is no route named "+e);for(var n=new Array(t.handlers.length),r=0;r<t.handlers.length;r++){var i=t.handlers[r];n[r]=i}return n},fh.prototype.hasRoute=function(e){return!!this.names[e]},fh.prototype.generate=function(e,t){var n=this.names[e],r="";if(!n)throw new Error("There is no route named "+e);for(var i=n.segments,s=0;s<i.length;s++){var o=i[s];4!==o.type&&(r+="/",r+=ih[o.type](o,t))}return"/"!==r.charAt(0)&&(r="/"+r),t&&t.queryParams&&(r+=this.generateQueryString(t.queryParams)),r},fh.prototype.generateQueryString=function(e){var t=[],n=Object.keys(e);n.sort();for(var r=0;r<n.length;r++){var i=n[r],s=e[i];if(null!=s){var o=encodeURIComponent(i);if(Qu(s))for(var a=0;a<s.length;a++){var l=i+"[]="+encodeURIComponent(s[a]);t.push(l)}else o+="="+encodeURIComponent(s),t.push(o)}}return 0===t.length?"":"?"+t.join("&")},fh.prototype.parseQueryString=function(e){for(var t=e.split("&"),n={},r=0;r<t.length;r++){var i=t[r].split("="),s=ph(i[0]),o=s.length,a=!1,l=void 0;1===i.length?l="true":(o>2&&"[]"===s.slice(o-2)&&(a=!0,n[s=s.slice(0,o-2)]||(n[s]=[])),l=i[1]?ph(i[1]):""),a?n[s].push(l):n[s]=l}return n},fh.prototype.recognize=function(e){var t,n=[this.rootState],r={},i=!1,s=e.indexOf("#");-1!==s&&(e=e.substr(0,s));var o=e.indexOf("?");if(-1!==o){var a=e.substr(o+1,e.length);e=e.substr(0,o),r=this.parseQueryString(a)}"/"!==e.charAt(0)&&(e="/"+e);var l=e;fh.ENCODE_AND_DECODE_PATH_SEGMENTS?e=Gu(e):(e=decodeURI(e),l=decodeURI(l));var c=e.length;c>1&&"/"===e.charAt(c-1)&&(e=e.substr(0,c-1),l=l.substr(0,l.length-1),i=!0);for(var u=0;u<e.length&&(n=hh(n,e.charCodeAt(u))).length;u++);for(var h=[],d=0;d<n.length;d++)n[d].handlers&&h.push(n[d]);n=function(e){return e.sort(function(e,t){var n=e.types||[0,0,0],r=n[0],i=n[1],s=n[2],o=t.types||[0,0,0],a=o[0],l=o[1],c=o[2];if(s!==c)return s-c;if(s){if(r!==a)return a-r;if(i!==l)return l-i}return i!==l?i-l:r!==a?a-r:0})}(h);var p=h[0];return p&&p.handlers&&(i&&p.pattern&&"(.+)$"===p.pattern.slice(-5)&&(l+="/"),t=function(e,t,n){var r=e.handlers,i=e.regex();if(!i||!r)throw new Error("state not initialized");var s=t.match(i),o=1,a=new dh(n);a.length=r.length;for(var l=0;l<r.length;l++){var c=r[l],u=c.names,h=c.shouldDecodes,d=sh,p=!1;if(u!==oh&&h!==oh)for(var f=0;f<u.length;f++){p=!0;var g=u[f],m=s&&s[o++];d===sh&&(d={}),fh.ENCODE_AND_DECODE_PATH_SEGMENTS&&h[f]?d[g]=m&&decodeURIComponent(m):d[g]=m}a[l]={handler:c.handler,params:d,isDynamic:p}}return a}(p,l,r)),t},fh.VERSION="0.3.4",fh.ENCODE_AND_DECODE_PATH_SEGMENTS=!0,fh.Normalizer={normalizeSegment:Zu,normalizePath:Gu,encodePathSegment:Xu},fh.prototype.map=function(e,t){var n=new qu;e(Vu("",n,this.delegate)),Hu([],n,function(e){t?t(this,e):this.add(e)},this)};var yh=Array.prototype.slice,vh=Object.prototype.hasOwnProperty;function bh(e,t){for(let n in t)vh.call(t,n)&&(e[n]=t[n])}function wh(e){let t,n,r=e&&e.length;if(r&&r>0){let i=e[r-1];if(function(e){if(e&&"object"==typeof e){let t=e;return"queryParams"in t&&Object.keys(t.queryParams).every(e=>"string"==typeof e)}return!1}(i))return n=i.queryParams,t=yh.call(e,0,r-1),[t,n]}return[e,null]}function _h(e){for(let t in e){let n=e[t];if("number"==typeof n)e[t]=String(n);else if(Array.isArray(n))for(let e=0,t=n.length;e<t;e++)n[e]=String(n[e])}}function xh(e,...t){if(e.log)if(2===t.length){let[n,r]=t;e.log("Transition #"+n+": "+r)}else{let[n]=t;e.log(n)}}function Ch(e){return"string"==typeof e||e instanceof String||"number"==typeof e||e instanceof Number}function Sh(e,t){for(let n=0,r=e.length;n<r&&!1!==t(e[n]);n++);}function kh(e,t){let n,r={all:{},changed:{},removed:{}};bh(r.all,t);let i=!1;for(n in _h(e),_h(t),e)vh.call(e,n)&&(vh.call(t,n)||(i=!0,r.removed[n]=e[n]));for(n in t)if(vh.call(t,n)){let s=e[n],o=t[n];if(Eh(s)&&Eh(o))if(s.length!==o.length)r.changed[n]=t[n],i=!0;else for(let e=0,a=s.length;e<a;e++)s[e]!==o[e]&&(r.changed[n]=t[n],i=!0);else e[n]!==t[n]&&(r.changed[n]=t[n],i=!0)}return i?r:void 0}function Eh(e){return Array.isArray(e)}function Rh(e){return"Router: "+e}var Th="__STATE__-2619860001345920-3322w3",Lh="__PARAMS__-261986232992830203-23323",Ih="__QPS__-2619863929824844-32323",Ph="__RDS__-2619863929824844-32323",Mh=class e{[Th];from=null;to=void 0;router;data;intent;resolvedModels;[Ih];promise;error;[Lh];routeInfos;targetName;pivotHandler;sequence;isAborted=!1;isActive=!0;urlMethod="update";resolveIndex=0;queryParamsOnly=!1;isTransition=!0;isCausedByAbortingTransition=!1;isCausedByInitialTransition=!1;isCausedByAbortingReplaceTransition=!1;_visibleQueryParams={};isIntermediate=!1;[Ph];constructor(e,t,n,r,i){if(this[Th]=n||e.state,this.intent=t,this.router=e,this.data=t&&t.data||{},this.resolvedModels={},this[Ih]={},this.promise=void 0,this.error=void 0,this[Lh]={},this.routeInfos=[],this.targetName=void 0,this.pivotHandler=void 0,this.sequence=-1,r)return this.promise=ra.reject(r),void(this.error=r);if(this.isCausedByAbortingTransition=Boolean(i),this.isCausedByInitialTransition=Boolean(i)&&(i.isCausedByInitialTransition||0===i.sequence),this.isCausedByAbortingReplaceTransition=Boolean(i)&&"replace"===i.urlMethod&&(!i.isCausedByAbortingTransition||i.isCausedByAbortingReplaceTransition),n){this[Lh]=n.params,this[Ih]=n.queryParams,this.routeInfos=n.routeInfos;let t=n.routeInfos.length;t&&(this.targetName=n.routeInfos[t-1].name);for(let e=0;e<t;++e){let t=n.routeInfos[e];if(!t.isResolved)break;this.pivotHandler=t.route}this.sequence=e.currentSequence++,this.promise=n.resolve(this).catch(e=>{throw this.router.transitionDidError(e,this)},Rh("Handle Abort"))}else this.promise=ra.resolve(this[Th]),this[Lh]={}}then(e,t,n){return this.promise.then(e,t,n)}catch(e,t){return this.promise.catch(e,t)}finally(e,t){return this.promise.finally(e,t)}abort(){this.rollback();let t=new e(this.router,void 0,void 0,void 0);return t.to=this.from,t.from=this.from,t.isAborted=!0,this.router.routeWillChange(t),this.router.routeDidChange(t),this}rollback(){this.isAborted||(xh(this.router,this.sequence,this.targetName+": transition was aborted"),void 0!==this.intent&&null!==this.intent&&(this.intent.preTransitionState=this.router.state),this.isAborted=!0,this.isActive=!1,this.router.activeTransition=void 0)}redirect(e){this[Ph]=e,this.rollback(),this.router.routeWillChange(e)}retry(){this.abort();let e=this.router.transitionByIntent(this.intent,!1);return null!==this.urlMethod&&e.method(this.urlMethod),e}method(e){return this.urlMethod=e,this}send(e=!1,t,n,r,i){this.trigger(e,t,n,r,i)}trigger(e=!1,t,...n){"string"==typeof e&&(t=e,e=!1),this.router.triggerEvent(this[Th].routeInfos.slice(0,this.resolveIndex+1),e,t,n)}followRedirects(){return this.promise.catch(e=>this[Ph]?this[Ph].followRedirects():ra.reject(e))}toString(){return"Transition (sequence "+this.sequence+")"}log(e){xh(this.router,this.sequence,e)}};function Ah(e){return xh(e.router,e.sequence,"detected abort."),gh()}function Oh(e){return"object"==typeof e&&e instanceof Mh&&e.isTransition}var Nh=function(){function e(t){let n=Error.call(this,t);this.name="UnrecognizedURLError",this.message=t||"UnrecognizedURL",Error.captureStackTrace?Error.captureStackTrace(this,e):this.stack=n.stack}return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}();function Fh(e,t){let n=e.factoryFor("controller:basic").class;n=class extends n{toString(){return`(generated ${t} controller)`}};let r=`controller:${t}`;return e.register(r,n),e.factoryFor(r)}function Dh(e,t){Fh(e,t);let n=`controller:${t}`;return e.lookup(n)}var zh=/\./g;function jh(e){let t,n,r=(e=e.slice())[e.length-1];return function(e){if(e&&"object"==typeof e){let t=e.queryParams;if(t&&"object"==typeof t)return Object.keys(t).every(e=>"string"==typeof e)}return!1}(r)?(e.pop(),t=r.queryParams):t={},"string"==typeof e[0]&&(n=e.shift()),{routeName:n,models:e,queryParams:t}}function Uh(e,t){if(t._namesStashed)return;let n,r=t[t.length-1].name,i=e._routerMicrolib.recognizer.handlersFor(r);for(let s=0;s<t.length;++s){let e=t[s],r=i[s].names;r.length&&(n=e),e._names=r,e.route._stashNames(e,n)}t._namesStashed=!0}function Bh(e,t){let n=e.split("."),r="";for(let i=0;i<n.length;i++){let e=n.slice(0,i+1).join(".");if(0!==t.indexOf(e))break;r=e}return r}function $h(e,t=[],n){let r="";for(let i of t){let t,s=Bh(e,i);if(n)if(s&&s in n){let e=0===i.indexOf(s)?i.substring(s.length+1):i;t=ur(n[s],e)}else t=ur(n,i);r+=`::${i}:${t}`}return e+r.replace(zh,"-")}function qh(e,t){let n="string"==typeof e?{[e]:{as:null}}:e;for(let r in n){if(!Object.prototype.hasOwnProperty.call(n,r))return;let e=n[r],i="string"==typeof e?{as:e}:e;t[r]={...t[r]||{as:null,scope:"model"},...i}}}function Vh(e){return"string"==typeof e&&(""===e||"/"===e[0])}function Wh(e,t){let n=0,r=0;for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(e[i]!==t[i])return!1;n++}for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&r++;return n===r}var Hh=new WeakMap;function Gh(e,t,n,r){let i={configurable:!0,enumerable:!0,writable:!0,initializer:null};r&&(i.initializer=r);for(let s of n)i=s(e,t,i)||i;void 0===i.initializer?Object.defineProperty(e,t,i):function(e,t,n){let r=Hh.get(e);r||(r=new Map,Hh.set(e,r)),r.set(t,n)}(e,t,i)}function Kh(e,t,n){let r={...Object.getOwnPropertyDescriptor(e,t)};for(let i of n)r=i(e,t,r)||r;void 0!==r.initializer&&(r.value=r.initializer?r.initializer.call(e):void 0,r.initializer=void 0),Object.defineProperty(e,t,r)}function Zh(e,t){let n=function(e,t){var n;let r=e.prototype;for(;r;){let e=null==(n=Hh.get(r))?void 0:n.get(t);if(e)return e;r=Object.getPrototypeOf(r)}}(e.constructor,t);n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(e):void 0})}var Yh=Symbol("render"),Xh=Symbol("render-state"),Jh=class extends(Ul.extend(Sl,vc)){static isRouteFactory=!0;context={};_bucketCache;_internalName;_names;_router;constructor(e){if(super(e),e){let t=e.lookup("router:main"),n=e.lookup(mc`-bucket-cache:main`);this._router=t,this._bucketCache=n,this._topLevelViewTemplate=e.lookup("template:-outlet"),this._environment=e.lookup("-environment:main")}}serialize(e,t){if(t.length<1||!e)return;let n={};if(1===t.length){let[r]=t;"object"==typeof e&&r in e?n[r]=ur(e,r):/_id$/.test(r)?n[r]=ur(e,"id"):tr(e)&&(n[r]=ur(e,r))}else n=Fr(e,t);return n}_setRouteName(e){this.routeName=e;let t=Ur(this);this.fullRouteName=rd(t,e)}_stashNames(e,t){if(this._names)return;let n=this._names=e._names;n.length||(n=(e=t)&&e._names||[]);let r=ur(this,"_qp").qps,i=new Array(n.length);for(let s=0;s<n.length;++s)i[s]=`${e.name}.${n[s]}`;for(let s of r)"model"===s.scope&&(s.parts=i)}_activeQPChanged(e,t){this._router._activeQPChanged(e.scopedPropertyName,t)}_updatingQPChanged(e){this._router._updatingQPChanged(e.urlKey)}paramsFor(e){let t=Ur(this).lookup(`route:${e}`);if(void 0===t)return{};let n=this._router._routerMicrolib.activeTransition,r=n?n[Th]:this._router._routerMicrolib.state,i=t.fullRouteName,s={...r.params[i]},o=td(t,r);return Object.entries(o).reduce((e,[t,n])=>(e[t]=n,e),s)}serializeQueryParamKey(e){return e}serializeQueryParam(e,t,n){return this._router._serializeQueryParam(e,n)}deserializeQueryParam(e,t,n){return this._router._deserializeQueryParam(e,n)}_optionsForQueryParam(e){const t=ur(this,"queryParams");return ur(t,e.urlKey)||ur(t,e.prop)||t[e.urlKey]||t[e.prop]||{}}resetController(e,t,n){return this}exit(e){this.deactivate(e),this.trigger("deactivate",e),this.teardownViews()}_internalReset(e,t){let n=this.controller;n._qpDelegate=ur(this,"_qp").states.inactive,this.resetController(n,e,t)}enter(e){this[Xh]=void 0,this.activate(e),this.trigger("activate",e)}deactivate(e){}activate(e){}intermediateTransitionTo(...e){let[t,...n]=function(e,t){let n,r=Ur(e),i=r.mountPoint;if(r.routable&&"string"==typeof t[0]){if(n=t[0],Vh(n))throw new Error("Programmatic transitions by URL cannot be used within an Engine. Please use the route name instead.");n=`${i}.${n}`,t[0]=n}return t}(this,e);this._router.intermediateTransitionTo(t,...n)}refresh(){return this._router._routerMicrolib.refresh(this)}setup(e,t){let n=this.controllerName||this.routeName,r=this.controllerFor(n,!0)??this.generateController(n),i=ur(this,"_qp");if(!this.controller){let e=i.propertyNames;!function(e,t){t.forEach(t=>{if(void 0===I(e,t)){let n=fr(e,t);null===n||"function"!=typeof n.get&&"function"!=typeof n.set||Dn(e,t,du({get:n.get,set:n.set}))}dn(e,`${t}.[]`,e,e._qpChanged,!1)})}(r,e),this.controller=r}if(r._qpDelegate=i.states.allowOverrides,t){Uh(this._router,t[Th].routeInfos);let e=this._bucketCache,n=t[Lh];i.propertyNames.forEach(t=>{let s=i.map[t];s.values=n;let o=$h(s.route.fullRouteName,s.parts,s.values),a=e.lookup(o,t,s.undecoratedDefaultValue);gr(r,t,a)});let s=td(this,t[Th]);Dr(r,s)}this.setupController(r,e,t),this._environment.options.shouldRender&&this[Yh](),wn(!1)}_qpChanged(e,t,n){if(!n)return;let r=this._bucketCache,i=$h(n.route.fullRouteName,n.parts,n.values);r.stash(i,e,t)}beforeModel(e){}afterModel(e,t){}redirect(e,t){}contextDidChange(){this.currentModel=this.context}model(e,t){let n,r,i=ur(this,"_qp").map;for(let s in e){if("queryParams"===s||i&&s in i)continue;let e=s.match(/^(.*)_id$/);null!==e&&(n=e[1]),r=!0}if(!n){if(r)return Object.assign({},e);if(t.resolveIndex<1)return;return t[Th].routeInfos[t.resolveIndex-1].context}}deserialize(e,t){return this.model(this._paramsFor(this.routeName,e),t)}setupController(e,t,n){e&&void 0!==t&&gr(e,"model",t)}controllerFor(e,t=!1){let n=Ur(this),r=n.lookup(`route:${e}`);return r&&r.controllerName&&(e=r.controllerName),n.lookup(`controller:${e}`)}generateController(e){return Dh(Ur(this),e)}modelFor(e){let t,n=Ur(this),r=this._router&&this._router._routerMicrolib?this._router._routerMicrolib.activeTransition:void 0;t=n.routable&&void 0!==r?rd(n,e):e;let i=n.lookup(`route:${t}`);if(null!=r){let e=i&&i.routeName||t;if(Object.prototype.hasOwnProperty.call(r.resolvedModels,e))return r.resolvedModels[e]}return i?.currentModel}[Xh]=void 0;[Yh](){this[Xh]=function(e){let t,n=Ur(e),r=e.routeName,i=n.lookup(`controller:${e.controllerName||r}`),s=e.currentModel,o=n.lookup(`template:${e.templateName||r}`);return t=o?Du(o)?o:o(n):e._topLevelViewTemplate(n),{owner:n,name:r,controller:i,model:s,template:t}}(this),Ls(this._router,"_setOutlets")}willDestroy(){this.teardownViews()}teardownViews(){this[Xh]&&(this[Xh]=void 0,Ls(this._router,"_setOutlets"))}buildRouteInfoMetadata(){}_paramsFor(e,t){return void 0!==this._router._routerMicrolib.activeTransition?this.paramsFor(e):t}get _store(){const e=Ur(this);return this.routeName,{find(t,n){let r=e.factoryFor(`model:${t}`);if(r)return r=r.class,r.find(n)}}}static{Kh(this.prototype,"_store",[Yn])}get _qp(){let e={},t=this.controllerName||this.routeName,n=Ur(this),r=n.lookup(`controller:${t}`),i=ur(this,"queryParams"),s=Object.keys(i).length>0;r?e=function(e,t){let n={},r={defaultValue:!0,type:!0,scope:!0,as:!0};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]={...e[i],...t[i]},r[i]=!0);for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&!r[i]&&(n[i]={...t[i],...e[i]});return n}(function(e){let t={};for(let n of e)qh(n,t);return t}(ur(r,"queryParams")||[]),i):s&&(r=Dh(n,t),e=i);let o=[],a={},l=[];for(let c in e){if(!Object.prototype.hasOwnProperty.call(e,c))continue;if("unknownProperty"===c||"_super"===c)continue;let n,i=e[c],s=i.scope||"model";"controller"===s&&(n=[]);let u=i.as||this.serializeQueryParamKey(c),h=ur(r,c);h=nd(h);let d=i.type||Sc(h),p=this.serializeQueryParam(h,u,d),f=`${t}:${c}`,g={undecoratedDefaultValue:ur(r,c),defaultValue:h,serializedDefaultValue:p,serializedValue:p,type:d,urlKey:u,prop:c,scopedPropertyName:f,controllerName:t,route:this,parts:n,values:null,scope:s};a[c]=a[u]=a[f]=g,o.push(g),l.push(c)}return{qps:o,map:a,propertyNames:l,states:{inactive:(e,t)=>{let n=a[e];this._qpChanged(e,t,n)},active:(e,t)=>{let n=a[e];return this._qpChanged(e,t,n),this._activeQPChanged(n,t)},allowOverrides:(e,t)=>{let n=a[e];return this._qpChanged(e,t,n),this._updatingQPChanged(n)}}}}static{Kh(this.prototype,"_qp",[Yn])}};function Qh(e){return e[Xh]}function ed(e,t){if(t.fullQueryParams)return t.fullQueryParams;let n=t.routeInfos.every(e=>e.route),r={...t.queryParams};return e._deserializeQueryParams(t.routeInfos,r),n&&(t.fullQueryParams=r),r}function td(e,t){t.queryParamsFor=t.queryParamsFor||{};let n=e.fullRouteName,r=t.queryParamsFor[n];if(r)return r;let i=ed(e._router,t),s=t.queryParamsFor[n]={},o=ur(e,"_qp").qps;for(let a of o){let e=a.prop in i;s[a.prop]=e?i[a.prop]:nd(a.defaultValue)}return s}function nd(e){return Array.isArray(e)?Zc(e.slice()):e}function rd(e,t){if(e.routable){let n=e.mountPoint;return"application"===t?n:`${n}.${t}`}return t}var id=Jh.prototype.serialize;Jh.reopen({mergedProperties:["queryParams"],queryParams:{},templateName:null,controllerName:null,send(...e){if(this._router&&this._router._routerMicrolib||!ru())this._router.send(...e);else{let t=e.shift(),n=this.actions[t];if(n)return n.apply(this,e)}},actions:{queryParamsDidChange(e,t,n){let r=ur(this,"_qp").map,i=Object.keys(e).concat(Object.keys(n));for(let s of i){let e=r[s];if(e&&ur(this._optionsForQueryParam(e),"refreshModel")&&this._router.currentState){this.refresh();break}}return!0},finalizeQueryParamChange(e,t,n){if("application"!==this.fullRouteName)return!0;if(!n)return;let r,i=n[Th].routeInfos,s=this._router,o=s._queryParamsFor(i),a=s._qpUpdates,l=!1;Uh(s,i);for(let c of o.qps){let i,s,o=c.route,u=o.controller,h=c.urlKey in e&&c.urlKey;if(a.has(c.urlKey)?(i=ur(u,c.prop),s=o.serializeQueryParam(i,c.urlKey,c.type)):h?(s=e[h],void 0!==s&&(i=o.deserializeQueryParam(s,c.urlKey,c.type))):(s=c.serializedDefaultValue,i=nd(c.defaultValue)),u._qpDelegate=ur(o,"_qp").states.inactive,s!==c.serializedValue){if(n.queryParamsOnly&&!1!==r){let e=ur(o._optionsForQueryParam(c),"replace");e?r=!0:!1===e&&(r=!1)}gr(u,c.prop,i),l=!0}c.serializedValue=s,c.serializedDefaultValue!==s&&t.push({value:s,visible:!0,key:h||c.urlKey})}!0===l&&wn(!1),r&&n.method("replace"),o.qps.forEach(e=>{let t=ur(e.route,"_qp");e.route.controller._qpDelegate=ur(t,"states.active")}),s._qpUpdates.clear()}}});var sd=0;function od(e){return"function"==typeof e}var ad=class e{parent;matches;enableLoadingSubstates;explicitIndex=!1;options;constructor(e=null,t){this.parent=e,this.enableLoadingSubstates=Boolean(t&&t.enableLoadingSubstates),this.matches=[],this.options=t}route(t,n,r){let i,s=null,o=`/_unused_dummy_error_path_route_${t}/:error`;if(od(n)?(i={},s=n):od(r)?(i=n,s=r):i=n||{},this.enableLoadingSubstates&&(cd(this,`${t}_loading`,{resetNamespace:i.resetNamespace}),cd(this,`${t}_error`,{resetNamespace:i.resetNamespace,path:o})),s){let n=ld(this,t,i.resetNamespace),r=new e(n,this.options);cd(r,"loading"),cd(r,"error",{path:o}),s.call(r),cd(this,t,i,r.generate())}else cd(this,t,i)}push(e,t,n,r){let i=t.split(".");if(this.options.engineInfo){let e=t.slice(this.options.engineInfo.fullName.length+1),n=Object.assign({localFullName:e},this.options.engineInfo);r&&(n.serializeMethod=r),this.options.addRouteForEngine(t,n)}else if(r)throw new Error(`Defining a route serializer on route '${t}' outside an Engine is not allowed.`);""!==e&&"/"!==e&&"index"!==i[i.length-1]||(this.explicitIndex=!0),this.matches.push(e,t,n)}generate(){let e=this.matches;return this.explicitIndex||this.route("index",{path:"/"}),t=>{for(let n=0;n<e.length;n+=3)t(e[n]).to(e[n+1],e[n+2])}}mount(t,n={}){let r=this.options.resolveRouteMap(t),i=t;n.as&&(i=n.as);let s,o=ld(this,i,n.resetNamespace),a={name:t,instanceId:sd++,mountPoint:o,fullName:o},l=n.path;"string"!=typeof l&&(l=`/${i}`);let c=`/_unused_dummy_error_path_route_${i}/:error`;if(r){let t=!1,n=this.options.engineInfo;n&&(t=!0,this.options.engineInfo=a);let i=Object.assign({engineInfo:a},this.options),l=new e(o,i);cd(l,"loading"),cd(l,"error",{path:c}),r.class.call(l),s=l.generate(),t&&(this.options.engineInfo=n)}let u=Object.assign({localFullName:"application"},a);if(this.enableLoadingSubstates){let e=`${i}_loading`,t="application_loading",r=Object.assign({localFullName:t},a);cd(this,e,{resetNamespace:n.resetNamespace}),this.options.addRouteForEngine(e,r),e=`${i}_error`,t="application_error",r=Object.assign({localFullName:t},a),cd(this,e,{resetNamespace:n.resetNamespace,path:c}),this.options.addRouteForEngine(e,r)}this.options.addRouteForEngine(o,u),this.push(l,o,s)}};function ld(e,t,n){return function(e){return"application"!==e.parent}(e)&&!0!==n?`${e.parent}.${t}`:t}function cd(e,t,n={},r){let i=ld(e,t,n.resetNamespace);"string"!=typeof n.path&&(n.path=`/${t}`),e.push(n.path,i,r,n.serialize)}var ud=class{router;emberRouter;routerJsState;constructor(e,t,n){this.emberRouter=e,this.router=t,this.routerJsState=n}isActiveIntent(e,t,n){let r=this.routerJsState;if(!this.router.isActiveIntent(e,t,void 0,r))return!1;if(void 0!==n&&Object.keys(n).length>0){let i=Object.assign({},n);return this.emberRouter._prepareQueryParams(e,t,i),Wh(i,r.queryParams)}return!0}},hd=new WeakMap;function dd(e,t={},n={includeAttributes:!1,localizeMapUpdates:!1}){const r=new WeakMap;return e.map((i,s)=>{let{name:o,params:a,paramNames:l,context:c,route:u}=i,h=i;if(hd.has(h)&&n.includeAttributes){let e=hd.get(h);e=function(e,t){let n={get metadata(){return fd(e)}};return!Object.isExtensible(t)||t.hasOwnProperty("metadata")?Object.freeze(Object.assign({},t,n)):Object.assign(t,n)}(u,e);let t=pd(e,c);return r.set(h,e),n.localizeMapUpdates||hd.set(h,t),t}const d=n.localizeMapUpdates?r:hd;let p={find(t,n){let r,i=[];3===t.length&&(i=e.map(e=>d.get(e)));for(let s=0;e.length>s;s++)if(r=d.get(e[s]),t.call(n,r,s,i))return r},get name(){return o},get paramNames(){return l},get metadata(){return fd(i.route)},get parent(){let t=e[s-1];return void 0===t?null:d.get(t)},get child(){let t=e[s+1];return void 0===t?null:d.get(t)},get localName(){let e=this.name.split(".");return e[e.length-1]},get params(){return a},get queryParams(){return t}};return n.includeAttributes&&(p=pd(p,c)),r.set(i,p),n.localizeMapUpdates||hd.set(i,p),p})}function pd(e,t){let n={get attributes(){return t}};return!Object.isExtensible(e)||e.hasOwnProperty("attributes")?Object.freeze(Object.assign({},e,n)):Object.assign(e,n)}function fd(e){return null!=e&&void 0!==e.buildRouteInfoMetadata?e.buildRouteInfoMetadata():null}var gd=class{_routePromise=void 0;_route=null;router;params={};isResolved=!1;constructor(e,t,n,r){this.name=t,this.paramNames=n,this.router=e,r&&this._processRoute(r)}getModel(e){return ra.resolve(this.context)}serialize(e){return this.params||{}}resolve(e){return ra.resolve(this.routePromise).then(t=>(mh(e),t)).then(()=>this.runBeforeModelHook(e)).then(()=>mh(e)).then(()=>this.getModel(e)).then(t=>(mh(e),t)).then(t=>this.runAfterModelHook(e,t)).then(t=>this.becomeResolved(e,t))}becomeResolved(e,t){let n,r=this.serialize(t);e&&(this.stashResolvedModel(e,t),e[Lh]=e[Lh]||{},e[Lh][this.name]=r);let i=t===this.context;!("context"in this)&&i||(n=t);let s=hd.get(this),o=new md(this.router,this.name,this.paramNames,r,this.route,n);return void 0!==s&&hd.set(o,s),o}shouldSupersede(e){if(!e)return!0;let t=e.context===this.context;return e.name!==this.name||"context"in this&&!t||this.hasOwnProperty("params")&&!function(e,t){if(e===t)return!0;if(!e||!t)return!1;for(let n in e)if(e.hasOwnProperty(n)&&e[n]!==t[n])return!1;return!0}(this.params,e.params)}get route(){return null!==this._route?this._route:this.fetchRoute()}set route(e){this._route=e}get routePromise(){return this._routePromise||this.fetchRoute(),this._routePromise}set routePromise(e){this._routePromise=e}log(e,t){e.log&&e.log(this.name+": "+t)}updateRoute(e){return e._internalName=this.name,this.route=e}runBeforeModelHook(e){let t;return e.trigger&&e.trigger(!0,"willResolveModel",e,this.route),this.route&&void 0!==this.route.beforeModel&&(t=this.route.beforeModel(e)),Oh(t)&&(t=null),ra.resolve(t)}runAfterModelHook(e,t){let n,r=this.name;var i;return this.stashResolvedModel(e,t),void 0!==this.route&&void 0!==this.route.afterModel&&(n=this.route.afterModel(t,e)),n=Oh(i=n)?null:i,ra.resolve(n).then(()=>e.resolvedModels[r])}stashResolvedModel(e,t){e.resolvedModels=e.resolvedModels||{},e.resolvedModels[this.name]=t}fetchRoute(){let e=this.router.getRoute(this.name);return this._processRoute(e)}_processRoute(e){return this.routePromise=ra.resolve(e),function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.then}(e)?(this.routePromise=this.routePromise.then(e=>this.updateRoute(e)),void(this.route=void 0)):e?this.updateRoute(e):void 0}},md=class extends gd{isResolved;context;constructor(e,t,n,r,i,s){super(e,t,n,i),this.params=r,this.isResolved=!0,this.context=s}resolve(e){return e&&e.resolvedModels&&(e.resolvedModels[this.name]=this.context),ra.resolve(this)}},yd=class extends gd{params={};constructor(e,t,n,r,i){super(e,t,n,i),r&&(this.params=r)}getModel(e){let t=this.params;e&&e[Ih]&&(t={},bh(t,this.params),t.queryParams=e[Ih]);let n,r=this.route;return r.deserialize?n=r.deserialize(t,e):r.model&&(n=r.model(t,e)),n&&Oh(n)&&(n=void 0),ra.resolve(n)}},vd=class extends gd{serializer;constructor(e,t,n,r){super(e,t,n),this.context=r,this.serializer=this.router.getSerializer(t)}getModel(e){return void 0!==this.router.log&&this.router.log(this.name+": resolving provided model"),super.getModel(e)}serialize(e){let{paramNames:t,context:n}=this;e||(e=n);let r={};if(Ch(e))return r[t[0]]=e,r;if(this.serializer)return this.serializer.call(null,e,t);if(void 0!==this.route&&this.route.serialize)return this.route.serialize(e,t);if(1!==t.length)return;let i=t[0];return/_id$/.test(i)?r[i]=e.id:r[i]=e,r}},bd=class{data;router;constructor(e,t={}){this.router=e,this.data=t}preTransitionState};function wd(e,t,n){let r=e.routeInfos,i=t.resolveIndex>=r.length?r.length-1:t.resolveIndex,s=t.isAborted;throw new Sd(n,e.routeInfos[i].route,s,e)}function _d(e,t){if(t.resolveIndex===e.routeInfos.length)return;let n=e.routeInfos[t.resolveIndex],r=xd.bind(null,e,t);return n.resolve(t).then(r,null,e.promiseLabel("Proceed"))}function xd(e,t,n){let r=e.routeInfos[t.resolveIndex].isResolved;if(e.routeInfos[t.resolveIndex++]=n,!r){let{route:e}=n;void 0!==e&&e.redirect&&e.redirect(n.context,t)}return mh(t),_d(e,t)}var Cd=class{routeInfos=[];queryParams={};params={};promiseLabel(e){let t="";return Sh(this.routeInfos,function(e){return""!==t&&(t+="."),t+=e.name,!0}),Rh("'"+t+"': "+e)}resolve(e){let t=this.params;Sh(this.routeInfos,e=>(t[e.name]=e.params||{},!0)),e.resolveIndex=0;let n=_d.bind(null,this,e),r=wd.bind(null,this,e);return ra.resolve(null,this.promiseLabel("Start transition")).then(n,null,this.promiseLabel("Resolve route")).catch(r,this.promiseLabel("Handle error")).then(()=>this)}},Sd=class{constructor(e,t,n,r){this.error=e,this.route=t,this.wasAborted=n,this.state=r}},kd=class extends bd{name;pivotHandler;contexts;queryParams;preTransitionState=void 0;constructor(e,t,n,r=[],i={},s){super(e,s),this.name=t,this.pivotHandler=n,this.contexts=r,this.queryParams=i}applyToState(e,t){let n=this.router.recognizer.handlersFor(this.name),r=n[n.length-1].handler;return this.applyToHandlers(e,n,r,t,!1)}applyToHandlers(e,t,n,r,i){let s,o,a=new Cd,l=this.contexts.slice(0),c=t.length;if(this.pivotHandler)for(s=0,o=t.length;s<o;++s)if(t[s].handler===this.pivotHandler._internalName){c=s;break}for(s=t.length-1;s>=0;--s){let o=t[s],u=o.handler,h=e.routeInfos[s],d=null;if(d=o.names.length>0?s>=c?this.createParamHandlerInfo(u,o.names,l,h):this.getHandlerInfoForDynamicSegment(u,o.names,l,h,n,s):this.createParamHandlerInfo(u,o.names,l,h),i){d=d.becomeResolved(null,d.context);let e=h&&h.context;o.names.length>0&&void 0!==h.context&&d.context===e&&(d.params=h&&h.params),d.context=e}let p=h;(s>=c||d.shouldSupersede(h))&&(c=Math.min(s,c),p=d),r&&!i&&(p=p.becomeResolved(null,p.context)),a.routeInfos.unshift(p)}if(l.length>0)throw new Error("More context objects were passed than there are dynamic segments for the route: "+n);return r||this.invalidateChildren(a.routeInfos,c),bh(a.queryParams,this.queryParams||{}),r&&e.queryParams&&bh(a.queryParams,e.queryParams),a}invalidateChildren(e,t){for(let n=t,r=e.length;n<r;++n)if(e[n].isResolved){let{name:t,params:r,route:i,paramNames:s}=e[n];e[n]=new yd(this.router,t,s,r,i)}}getHandlerInfoForDynamicSegment(e,t,n,r,i,s){let o;if(n.length>0){if(o=n[n.length-1],Ch(o))return this.createParamHandlerInfo(e,t,n,r);n.pop()}else{if(r&&r.name===e)return r;if(!this.preTransitionState)return r;o=this.preTransitionState.routeInfos[s]?.context}return new vd(this.router,e,t,o)}createParamHandlerInfo(e,t,n,r){let i={},s=t.length,o=[];for(;s--;){let a=r&&e===r.name&&r.params||{},l=n[n.length-1],c=t[s];Ch(l)?i[c]=String(n.pop()):a.hasOwnProperty(c)?i[c]=a[c]:o.push(c)}if(o.length>0)throw new Error(`You didn't provide enough string/numeric parameters to satisfy all of the dynamic segments for route ${e}. Missing params: ${o}`);return new yd(this.router,e,t,i)}},Ed=class extends bd{preTransitionState;url;constructor(e,t,n){super(e,n),this.url=t,this.preTransitionState=void 0}applyToState(e){let t,n,r=new Cd,i=this.router.recognizer.recognize(this.url);if(!i)throw new Nh(this.url);let s=!1,o=this.url;function a(e){if(e&&e.inaccessibleByURL)throw new Nh(o);return e}for(t=0,n=i.length;t<n;++t){let n=i[t],o=n.handler,l=[];this.router.recognizer.hasRoute(o)&&(l=this.router.recognizer.handlersFor(o)[t].names);let c=new yd(this.router,o,l,n.params),u=c.route;u?a(u):c.routePromise=c.routePromise.then(a);let h=e.routeInfos[t];s||c.shouldSupersede(h)?(s=!0,r.routeInfos[t]=c):r.routeInfos[t]=h}return bh(r.queryParams,i.queryParams),r}},Rd=class{_lastQueryParams={};log;state=void 0;oldState=void 0;activeTransition=void 0;currentRouteInfos=void 0;_changedQueryParams=void 0;currentSequence=0;recognizer;constructor(e){this.log=e,this.recognizer=new fh,this.reset()}map(e){this.recognizer.map(e,function(e,t){for(let n=t.length-1,r=!0;n>=0&&r;--n){let i=t[n],s=i.handler;e.add(t,{as:s}),r="/"===i.path||""===i.path||".index"===s.slice(-6)}})}hasRoute(e){return this.recognizer.hasRoute(e)}queryParamsTransition(e,t,n,r){if(this.fireQueryParamDidChange(r,e),!t&&this.activeTransition)return this.activeTransition;{let e=new Mh(this,void 0,void 0);return e.queryParamsOnly=!0,n.queryParams=this.finalizeQueryParamChange(r.routeInfos,r.queryParams,e),e[Ih]=r.queryParams,this.toReadOnlyInfos(e,r),this.routeWillChange(e),e.promise=e.promise.then(t=>(e.isAborted||(this._updateURL(e,n),this.didTransition(this.currentRouteInfos),this.toInfos(e,r.routeInfos,!0),this.routeDidChange(e)),t),null,Rh("Transition complete")),e}}transitionByIntent(e,t){try{return this.getTransitionByIntent(e,t)}catch(n){return new Mh(this,e,void 0,n,void 0)}}recognize(e){let t=new Ed(this,e),n=this.generateNewState(t);if(null===n)return n;let r=dd(n.routeInfos,n.queryParams,{includeAttributes:!1,localizeMapUpdates:!0});return r[r.length-1]}recognizeAndLoad(e){let t=new Ed(this,e),n=this.generateNewState(t);if(null===n)return ra.reject(`URL ${e} was not recognized`);let r=new Mh(this,t,n,void 0);return r.then(()=>{let e=dd(n.routeInfos,r[Ih],{includeAttributes:!0,localizeMapUpdates:!1});return e[e.length-1]})}generateNewState(e){try{return e.applyToState(this.state,!1)}catch(t){return null}}getTransitionByIntent(e,t){let n,r=Boolean(this.activeTransition),i=r?this.activeTransition[Th]:this.state,s=e.applyToState(i,t),o=kh(i.queryParams,s.queryParams);if(Td(s.routeInfos,i.routeInfos)){if(o){let e=this.queryParamsTransition(o,r,i,s);return e.queryParamsOnly=!0,e}return this.activeTransition||new Mh(this,void 0,void 0)}if(t){let e=new Mh(this,void 0,s);return e.isIntermediate=!0,this.toReadOnlyInfos(e,s),this.setupContexts(s,e),this.routeWillChange(e),this.activeTransition}return n=new Mh(this,e,s,void 0,this.activeTransition),function(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;++n){if(e[n].name!==t[n].name)return!1;if(!Ld(e[n].params,t[n].params))return!1}return!0}(s.routeInfos,i.routeInfos)&&(n.queryParamsOnly=!0),this.toReadOnlyInfos(n,s),this.activeTransition&&this.activeTransition.redirect(n),this.activeTransition=n,n.promise=n.promise.then(e=>this.finalizeTransition(n,e),null,Rh("Settle transition promise when transition is finalized")),r||this.notifyExistingHandlers(s,n),this.fireQueryParamDidChange(s,o),n}doTransition(e,t=[],n=!1){let r,i=t[t.length-1],s={};if(i&&Object.prototype.hasOwnProperty.call(i,"queryParams")&&(s=t.pop().queryParams),void 0===e){xh(this,"Updating query params");let{routeInfos:e}=this.state;r=new kd(this,e[e.length-1].name,void 0,[],s)}else"/"===e.charAt(0)?(xh(this,"Attempting URL transition to "+e),r=new Ed(this,e)):(xh(this,"Attempting transition to "+e),r=new kd(this,e,void 0,t,s));return this.transitionByIntent(r,n)}finalizeTransition(e,t){try{xh(e.router,e.sequence,"Resolved all models on destination route; finalizing transition.");let n=t.routeInfos;return this.setupContexts(t,e),e.isAborted?(this.state.routeInfos=this.currentRouteInfos,ra.reject(Ah(e))):(this._updateURL(e,t),e.isActive=!1,this.activeTransition=void 0,this.triggerEvent(this.currentRouteInfos,!0,"didTransition",[]),this.didTransition(this.currentRouteInfos),this.toInfos(e,t.routeInfos,!0),this.routeDidChange(e),xh(this,e.sequence,"TRANSITION COMPLETE."),n[n.length-1].route)}catch(r){if("object"!=typeof(n=r)||null===n||"TRANSITION_ABORTED"!==n.code){let t=e[Th].routeInfos;e.trigger(!0,"error",r,e,t[t.length-1].route),e.abort()}throw r}var n}setupContexts(e,t){let n,r,i,s=this.partitionRoutes(this.state,e);for(n=0,r=s.exited.length;n<r;n++)i=s.exited[n].route,delete i.context,void 0!==i&&(void 0!==i._internalReset&&i._internalReset(!0,t),void 0!==i.exit&&i.exit(t));let o=this.oldState=this.state;this.state=e;let a=this.currentRouteInfos=s.unchanged.slice();try{for(n=0,r=s.reset.length;n<r;n++)i=s.reset[n].route,void 0!==i&&void 0!==i._internalReset&&i._internalReset(!1,t);for(n=0,r=s.updatedContext.length;n<r;n++)this.routeEnteredOrUpdated(a,s.updatedContext[n],!1,t);for(n=0,r=s.entered.length;n<r;n++)this.routeEnteredOrUpdated(a,s.entered[n],!0,t)}catch(l){throw this.state=o,this.currentRouteInfos=o.routeInfos,l}this.state.queryParams=this.finalizeQueryParamChange(a,e.queryParams,t)}fireQueryParamDidChange(e,t){t&&(this._changedQueryParams=t.all,this.triggerEvent(e.routeInfos,!0,"queryParamsDidChange",[t.changed,t.all,t.removed]),this._changedQueryParams=void 0)}routeEnteredOrUpdated(e,t,n,r){let i=t.route,s=t.context;function o(i){return n&&void 0!==i.enter&&i.enter(r),mh(r),i.context=s,void 0!==i.contextDidChange&&i.contextDidChange(),void 0!==i.setup&&i.setup(s,r),mh(r),e.push(t),i}return void 0===i?t.routePromise=t.routePromise.then(o):o(i),!0}partitionRoutes(e,t){let n,r,i,s=e.routeInfos,o=t.routeInfos,a={updatedContext:[],exited:[],entered:[],unchanged:[],reset:[]},l=!1;for(r=0,i=o.length;r<i;r++){let e=s[r],t=o[r];e&&e.route===t.route||(n=!0),n?(a.entered.push(t),e&&a.exited.unshift(e)):l||e.context!==t.context?(l=!0,a.updatedContext.push(t)):a.unchanged.push(e)}for(r=o.length,i=s.length;r<i;r++)a.exited.unshift(s[r]);return a.reset=a.updatedContext.slice(),a.reset.reverse(),a}_updateURL(e,t){let n=e.urlMethod;if(!n)return;let{routeInfos:r}=t,{name:i}=r[r.length-1],s={};for(let o=r.length-1;o>=0;--o){let e=r[o];bh(s,e.params),e.route.inaccessibleByURL&&(n=null)}if(n){s.queryParams=e._visibleQueryParams||t.queryParams;let r=this.recognizer.generate(i,s),o=e.isCausedByInitialTransition,a="replace"===n&&!e.isCausedByAbortingTransition,l=e.queryParamsOnly&&"replace"===n,c="replace"===n&&e.isCausedByAbortingReplaceTransition;o||a||l||c?this.replaceURL(r):this.updateURL(r)}}finalizeQueryParamChange(e,t,n){for(let s in t)t.hasOwnProperty(s)&&null===t[s]&&delete t[s];let r=[];this.triggerEvent(e,!0,"finalizeQueryParamChange",[t,r,n]),n&&(n._visibleQueryParams={});let i={};for(let s=0,o=r.length;s<o;++s){let e=r[s];i[e.key]=e.value,n&&!1!==e.visible&&(n._visibleQueryParams[e.key]=e.value)}return i}toReadOnlyInfos(e,t){let n=this.state.routeInfos;this.fromInfos(e,n),this.toInfos(e,t.routeInfos),this._lastQueryParams=t.queryParams}fromInfos(e,t){if(void 0!==e&&t.length>0){let n=dd(t,Object.assign({},this._lastQueryParams),{includeAttributes:!0,localizeMapUpdates:!1});e.from=n[n.length-1]||null}}toInfos(e,t,n=!1){if(void 0!==e&&t.length>0){let r=dd(t,Object.assign({},e[Ih]),{includeAttributes:n,localizeMapUpdates:!1});e.to=r[r.length-1]||null}}notifyExistingHandlers(e,t){let n,r,i,s,o=this.state.routeInfos;for(r=o.length,n=0;n<r&&(i=o[n],s=e.routeInfos[n],s&&i.name===s.name);n++)s.isResolved;this.triggerEvent(o,!0,"willTransition",[t]),this.routeWillChange(t),this.willTransition(o,e.routeInfos,t)}reset(){this.state&&Sh(this.state.routeInfos.slice().reverse(),function(e){let t=e.route;return void 0!==t&&void 0!==t.exit&&t.exit(),!0}),this.oldState=void 0,this.state=new Cd,this.currentRouteInfos=void 0}handleURL(e){return"/"!==e.charAt(0)&&(e="/"+e),this.doTransition(e).method(null)}transitionTo(e,...t){return"object"==typeof e?(t.push(e),this.doTransition(void 0,t,!1)):this.doTransition(e,t)}intermediateTransitionTo(e,...t){return this.doTransition(e,t,!0)}refresh(e){let t=this.activeTransition,n=t?t[Th]:this.state,r=n.routeInfos;void 0===e&&(e=r[0].route),xh(this,"Starting a refresh transition");let i=r[r.length-1].name,s=new kd(this,i,e,[],this._changedQueryParams||n.queryParams),o=this.transitionByIntent(s,!1);return t&&"replace"===t.urlMethod&&o.method(t.urlMethod),o}replaceWith(e){return this.doTransition(e).method("replace")}generate(e,...t){let n=wh(t),r=n[0],i=n[1],s=new kd(this,e,void 0,r).applyToState(this.state,!1),o={};for(let a=0,l=s.routeInfos.length;a<l;++a)bh(o,s.routeInfos[a].serialize());return o.queryParams=i,this.recognizer.generate(e,o)}applyIntent(e,t){let n=new kd(this,e,void 0,t),r=this.activeTransition&&this.activeTransition[Th]||this.state;return n.applyToState(r,!1)}isActiveIntent(e,t,n,r){let i,s,o=r||this.state,a=o.routeInfos;if(!a.length)return!1;let l=a[a.length-1].name,c=this.recognizer.handlersFor(l),u=0;for(s=c.length;u<s&&(i=a[u],i.name!==e);++u);if(u===c.length)return!1;let h=new Cd;h.routeInfos=a.slice(0,u+1),c=c.slice(0,u+1);let d=Td(new kd(this,l,void 0,t).applyToHandlers(h,c,l,!0,!0).routeInfos,h.routeInfos);if(!n||!d)return d;let p={};bh(p,n);let f=o.queryParams;for(let g in f)f.hasOwnProperty(g)&&p.hasOwnProperty(g)&&(p[g]=f[g]);return d&&!kh(p,n)}isActive(e,...t){let[n,r]=wh(t);return this.isActiveIntent(e,n,r)}trigger(e,...t){this.triggerEvent(this.currentRouteInfos,!1,e,t)}};function Td(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;++n)if(e[n]!==t[n])return!1;return!0}function Ld(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0,s=n.length;i<s;++i){let r=n[i];if(e[r]!==t[r])return!1}return!0}function Id(){return this}var{slice:Pd}=Array.prototype,Md=class extends(Ul.extend(vc)){_routerMicrolib;_didSetupRouter=!1;_initialTransitionStarted=!1;currentURL=null;currentRouteName=null;currentPath=null;currentRoute=null;_qpCache=Object.create(null);_qpUpdates=new Set;_queuedQPChanges={};_bucketCache;_toplevelView=null;_handledErrors=new Set;_engineInstances=Object.create(null);_engineInfoByRoute=Object.create(null);_routerService;_slowTransitionTimer=null;namespace;static dslCallbacks;static map(e){return this.dslCallbacks||(this.dslCallbacks=[],this.reopenClass({dslCallbacks:this.dslCallbacks})),this.dslCallbacks.push(e),this}static _routePath(e){let t,n,r,i=[];function s(e,t){for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}for(let o=1;o<e.length;o++){for(t=e[o].name,n=t.split("."),r=Pd.call(i);r.length&&!s(r,n);)r.shift();i.push(...n.slice(r.length))}return i.join(".")}constructor(e){super(e),this._resetQueuedQueryParameterChanges(),this.namespace=e.lookup("application:main");let t=e.lookup(mc`-bucket-cache:main`);this._bucketCache=t;let n=e.lookup("service:router");this._routerService=n}_initRouterJs(){let e=ur(this,"location"),t=this;const n=Io(this);let r=Object.create(null),i=this._routerMicrolib=new class extends Rd{getRoute(e){let i=e,s=n,o=t._engineInfoByRoute[i];o&&(s=t._getEngineInstance(o),i=o.localFullName);let a=`route:${i}`,l=s.lookup(a);if(r[e])return l;if(r[e]=!0,!l){let e=s.factoryFor("route:basic").class;s.register(a,class extends e{}),l=s.lookup(a)}if(l._setRouteName(i),o&&!function(e){return e.serialize===id}(l))throw new Error("Defining a custom serialize method on an Engine route is not supported.");return l}getSerializer(e){let n=t._engineInfoByRoute[e];if(n)return n.serializeMethod||id}updateURL(n){Ls(()=>{e.setURL(n),gr(t,"currentURL",n)})}didTransition(e){t.didTransition(e)}willTransition(e,n){t.willTransition(e,n)}triggerEvent(e,n,r,i){return zd.bind(t)(e,n,r,i)}routeWillChange(e){t.trigger("routeWillChange",e),t._routerService.trigger("routeWillChange",e),e.isIntermediate&&t.set("currentRoute",e.to)}routeDidChange(e){t.set("currentRoute",e.to),Ls(()=>{t.trigger("routeDidChange",e),t._routerService.trigger("routeDidChange",e)})}transitionDidError(e,n){return e.wasAborted||n.isAborted?Ah(n):(n.trigger(!1,"error",e.error,n,e.route),t._isErrorHandled(e.error)?(n.rollback(),this.routeDidChange(n),e.error):(n.abort(),e.error))}replaceURL(n){e.replaceURL?Ls(()=>{e.replaceURL(n),gr(t,"currentURL",n)}):this.updateURL(n)}},s=this.constructor.dslCallbacks||[Id],o=this._buildDSL();o.route("application",{path:"/",resetNamespace:!0,overrideNameAssertion:!0},function(){for(let e=0;e<s.length;e++)s[e].call(this)}),i.map(o.generate())}_buildDSL(){let e=this._hasModuleBasedResolver(),t=this;const n=Io(this);return new ad(null,{enableLoadingSubstates:e,resolveRouteMap:e=>n.factoryFor(`route-map:${e}`),addRouteForEngine(e,n){t._engineInfoByRoute[e]||(t._engineInfoByRoute[e]=n)}})}_resetQueuedQueryParameterChanges(){this._queuedQPChanges={}}_hasModuleBasedResolver(){let e=ur(Io(this),"application.__registry__.resolver.moduleBasedResolver");return Boolean(e)}startRouting(){if(this.setupRouter()){let e=ur(this,"initialURL");void 0===e&&(e=ur(this,"location").getURL());let t=this.handleURL(e);if(t&&t.error)throw t.error}}setupRouter(){if(this._didSetupRouter)return!1;this._didSetupRouter=!0,this._setupLocation();let e=ur(this,"location");return!ur(e,"cancelRouterSetup")&&(this._initRouterJs(),e.onUpdateURL(e=>{this.handleURL(e)}),!0)}_setOutlets(){if(this.isDestroying||this.isDestroyed)return;let e=this._routerMicrolib.currentRouteInfos;if(!e)return;let t=null,n=null;for(let r of e){let e=Qh(r.route);if(!e)break;{let r={render:e,outlets:{main:void 0}};n?n.outlets.main=r:t=r,n=r}}if(null!==t)if(this._toplevelView)this._toplevelView.setOutletState(t);else{let e=Io(this),n=e.factoryFor("view:-outlet"),r=e.lookup("application:main"),i=e.lookup("-environment:main"),s=e.lookup("template:-outlet");this._toplevelView=n.create({environment:i,template:s,application:r}),this._toplevelView.setOutletState(t),e.lookup("-application-instance:main").didCreateRootView(this._toplevelView)}}handleURL(e){let t=e.split(/#(.+)?/)[0];return this._doURLTransition("handleURL",t)}_doURLTransition(e,t){this._initialTransitionStarted=!0;let n=this._routerMicrolib[e](t||"/");return Bd(n,this),n}transitionTo(...e){if(Vh(e[0]))return this._doURLTransition("transitionTo",e[0]);let{routeName:t,models:n,queryParams:r}=jh(e);return this._doTransition(t,n,r)}intermediateTransitionTo(e,...t){this._routerMicrolib.intermediateTransitionTo(e,...t),Ud(this)}replaceWith(...e){return this.transitionTo(...e).method("replace")}generate(e,...t){let n=this._routerMicrolib.generate(e,...t);return this.location.formatURL(n)}isActive(e){return this._routerMicrolib.isActive(e)}isActiveIntent(e,t,n){return this.currentState.isActiveIntent(e,t,n)}send(e,...t){this._routerMicrolib.trigger(e,...t)}hasRoute(e){return this._routerMicrolib.hasRoute(e)}reset(){this._didSetupRouter=!1,this._initialTransitionStarted=!1,this._routerMicrolib&&this._routerMicrolib.reset()}willDestroy(){this._toplevelView&&(this._toplevelView.destroy(),this._toplevelView=null),super.willDestroy(),this.reset();let e=this._engineInstances;for(let t in e){let n=e[t];for(let e in n)ws(n[e],"destroy")}}_activeQPChanged(e,t){this._queuedQPChanges[e]=t,Ls(this,this._fireQueryParamTransition)}_updatingQPChanged(e){this._qpUpdates.add(e)}_fireQueryParamTransition(){this.transitionTo({queryParams:this._queuedQPChanges}),this._resetQueuedQueryParameterChanges()}_setupLocation(){let e=this.location,t=this.rootURL,n=Io(this);"string"==typeof e&&(e=gr(this,"location",n.lookup(`location:${e}`))),null!==e&&"object"==typeof e&&(t&&gr(e,"rootURL",t),"function"==typeof e.initState&&e.initState())}_serializeQueryParams(e,t){$d(this,e,t,(e,n,r)=>{if(r)delete t[e],t[r.urlKey]=r.route.serializeQueryParam(n,r.urlKey,r.type);else{if(void 0===n)return;t[e]=this._serializeQueryParam(n,Sc(n))}})}_serializeQueryParam(e,t){return null==e?e:"array"===t?JSON.stringify(e):`${e}`}_deserializeQueryParams(e,t){$d(this,e,t,(e,n,r)=>{r&&(delete t[e],t[r.prop]=r.route.deserializeQueryParam(n,r.urlKey,r.type))})}_deserializeQueryParam(e,t){return null==e?e:"boolean"===t?"true"===e:"number"===t?Number(e).valueOf():"array"===t?Zc(JSON.parse(e)):e}_pruneDefaultQueryParamValues(e,t){let n=this._queryParamsFor(e);for(let r in t){let e=n.map[r];e&&e.serializedDefaultValue===t[r]&&delete t[r]}}_doTransition(e,t,n,r){let i=e||function(e){let t=e.activeTransition?e.activeTransition[Th].routeInfos:e.state.routeInfos;return t[t.length-1].name}(this._routerMicrolib);this._initialTransitionStarted=!0;let s={};this._processActiveTransitionQueryParams(i,t,s,n),Object.assign(s,n),this._prepareQueryParams(i,t,s,Boolean(r));let o=this._routerMicrolib.transitionTo(i,...t,{queryParams:s});return Bd(o,this),o}_processActiveTransitionQueryParams(e,t,n,r){if(!this._routerMicrolib.activeTransition)return;let i={},s=this._qpUpdates,o=ed(this,this._routerMicrolib.activeTransition[Th]);for(let a in o)s.has(a)||(i[a]=o[a]);this._fullyScopeQueryParams(e,t,r),this._fullyScopeQueryParams(e,t,i),Object.assign(n,i)}_prepareQueryParams(e,t,n,r){let i=jd(this,e,t);this._hydrateUnsuppliedQueryParams(i,n,Boolean(r)),this._serializeQueryParams(i.routeInfos,n),r||this._pruneDefaultQueryParamValues(i.routeInfos,n)}_getQPMeta(e){let t=e.route;return t&&ur(t,"_qp")}_queryParamsFor(e){let t=e[e.length-1].name,n=this._qpCache[t];if(void 0!==n)return n;let r,i=!0,s={},o=[];for(let l of e)if(r=this._getQPMeta(l),r){for(let e of r.qps)o.push(e);Object.assign(s,r.map)}else i=!1;let a={qps:o,map:s};return i&&(this._qpCache[t]=a),a}_fullyScopeQueryParams(e,t,n){let r,i=jd(this,e,t).routeInfos;for(let s of i)if(r=this._getQPMeta(s),r)for(let e of r.qps){let t=e.prop in n&&e.prop||e.scopedPropertyName in n&&e.scopedPropertyName||e.urlKey in n&&e.urlKey;t&&t!==e.scopedPropertyName&&(n[e.scopedPropertyName]=n[t],delete n[t])}}_hydrateUnsuppliedQueryParams(e,t,n){let r,i,s,o=e.routeInfos,a=this._bucketCache;for(let l of o)if(r=this._getQPMeta(l),r)for(let n=0,o=r.qps.length;n<o;++n)if(i=r.qps[n],s=i.prop in t&&i.prop||i.scopedPropertyName in t&&i.scopedPropertyName||i.urlKey in t&&i.urlKey,s)s!==i.scopedPropertyName&&(t[i.scopedPropertyName]=t[s],delete t[s]);else{let n=$h(i.route.fullRouteName,i.parts,e.params);t[i.scopedPropertyName]=a.lookup(n,i.prop,i.defaultValue)}}_scheduleLoadingEvent(e,t){this._cancelSlowTransitionTimer(),this._slowTransitionTimer=Is("routerTransitions",this,this._handleSlowTransition,e,t)}currentState=null;targetState=null;_handleSlowTransition(e,t){if(!this._routerMicrolib.activeTransition)return;let n=new ud(this,this._routerMicrolib,this._routerMicrolib.activeTransition[Th]);this.set("targetState",n),e.trigger(!0,"loading",e,t)}_cancelSlowTransitionTimer(){this._slowTransitionTimer&&Ms(this._slowTransitionTimer),this._slowTransitionTimer=null}_markErrorAsHandled(e){this._handledErrors.add(e)}_isErrorHandled(e){return this._handledErrors.has(e)}_clearHandledError(e){this._handledErrors.delete(e)}_getEngineInstance({name:e,instanceId:t,mountPoint:n}){let r=this._engineInstances,i=r[e];i||(i=Object.create(null),r[e]=i);let s=i[t];return s||(s=Io(this).buildChildEngineInstance(e,{routable:!0,mountPoint:n}),s.boot(),i[t]=s),s}};function Ad(e,t){for(let n=e.length-1;n>=0;--n){let r=e[n],i=r.route;if(void 0!==i&&!0!==t(i,r))return}}var Od={willResolveModel(e,t,n){this._scheduleLoadingEvent(t,n)},error(e,t,n){let r=this,i=e[e.length-1];Ad(e,(e,n)=>{if(n!==i){let n=Fd(e,"error");if(n)return r._markErrorAsHandled(t),r.intermediateTransitionTo(n,t),!1}let s=Nd(e,"error");return!s||(r._markErrorAsHandled(t),r.intermediateTransitionTo(s,t),!1)}),function(e,t){let n,r=[];n=e&&"object"==typeof e&&"object"==typeof e.errorThrown?e.errorThrown:e,t&&r.push(t),n&&(n.message&&r.push(n.message),n.stack&&r.push(n.stack),"string"==typeof n&&r.push(n)),console.error(...r)}(t,`Error while processing route: ${n.targetName}`)},loading(e,t){let n=this,r=e[e.length-1];Ad(e,(e,i)=>{if(i!==r){let t=Fd(e,"loading");if(t)return n.intermediateTransitionTo(t),!1}let s=Nd(e,"loading");return s?(n.intermediateTransitionTo(s),!1):t.pivotHandler!==e})}};function Nd(e,t){let n=Io(e),{routeName:r,fullRouteName:i,_router:s}=e,o=`${i}_${t}`;return Dd(n,s,`${r}_${t}`,o)?o:""}function Fd(e,t){let n=Io(e),{routeName:r,fullRouteName:i,_router:s}=e,o="application"===i?t:`${i}.${t}`;return Dd(n,s,"application"===r?t:`${r}.${t}`,o)?o:""}function Dd(e,t,n,r){let i=t.hasRoute(r),s=e.factoryFor(`template:${n}`)||e.factoryFor(`route:${n}`);return i&&s}function zd(e,t,n,r){if(!e){if(t)return;throw new Error(`Can't trigger action '${n}' because your app hasn't finished transitioning into its first route. To trigger an action on destination routes during a transition, you can call \`.send()\` on the \`Transition\` object passed to the \`model/beforeModel/afterModel\` hooks.`)}let i,s,o,a=!1;for(let c=e.length-1;c>=0;c--)if(i=e[c],s=i.route,o=s&&s.actions&&s.actions[n],o){if(!0!==o.apply(s,r))return void("error"===n&&s._router._markErrorAsHandled(r[0]));a=!0}let l=Od[n];if(l)l.call(this,e,...r);else if(!a&&!t)throw new Error(`Nothing handled the action '${n}'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble.`)}function jd(e,t,n){let r=e._routerMicrolib.applyIntent(t,n),{routeInfos:i,params:s}=r;for(let o of i)o.isResolved?s[o.name]=o.params:s[o.name]=o.serialize(o.context);return r}function Ud(e){let t=e._routerMicrolib.currentRouteInfos;if(0===t.length)return;let n=Md._routePath(t),r=t[t.length-1].name,i=e.location.getURL();gr(e,"currentPath",n),gr(e,"currentRouteName",r),gr(e,"currentURL",i)}function Bd(e,t){let n=new ud(t,t._routerMicrolib,e[Th]);t.currentState||t.set("currentState",n),t.set("targetState",n),e.promise=e.catch(e=>{if(!t._isErrorHandled(e))throw e;t._clearHandledError(e)},"Transition Error")}function $d(e,t,n,r){let i=e._queryParamsFor(t);for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&r(s,n[s],i.map[s])}function qd(e){return void 0!==e.hash?e.hash.substring(0):""}Md.reopen({didTransition:function(){Ud(this),this._cancelSlowTransitionTimer(),this.notifyPropertyChange("url"),this.set("currentState",this.targetState)},willTransition:function(){},rootURL:"/",location:"hash",url:Yn(function(){let e=ur(this,"location");if("string"!=typeof e)return e.getURL()})});var Vd=class extends Ul{_hashchangeHandler;_location;init(){this.location=this._location??window.location,this._hashchangeHandler=void 0}getHash(){return qd(this.location)}getURL(){let e=this.getHash().substring(1),t=e;return"/"!==t[0]&&(t="/",e&&(t+=`#${e}`)),t}setURL(e){this.location.hash=e,this.lastSetURL=e}replaceURL(e){this.location.replace(`#${e}`),this.lastSetURL=e}lastSetURL=null;onUpdateURL(e){this._removeEventListener(),this._hashchangeHandler=xs(this,function(){let t=this.getURL();this.lastSetURL!==t&&(this.lastSetURL=null,e(t))}),window.addEventListener("hashchange",this._hashchangeHandler)}formatURL(e){return`#${e}`}willDestroy(){this._removeEventListener()}_removeEventListener(){this._hashchangeHandler&&window.removeEventListener("hashchange",this._hashchangeHandler)}};function Wd(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t,n;return t=16*Math.random()|0,n="x"===e?t:3&t|8,n.toString(16)})}var Hd=class extends Ul{history;_popstateHandler;rootURL="/";getHash(){return qd(this.location)}init(){this._super(...arguments);let e=document.querySelector("base"),t="";null!==e&&e.hasAttribute("href")&&(t=e.getAttribute("href")??""),this.baseURL=t,this.location=this.location??window.location,this._popstateHandler=void 0}initState(){let e=this.history??window.history;this.history=e;let{state:t}=e,n=this.formatURL(this.getURL());t&&t.path===n||this.replaceState(n)}getURL(){let{location:e,rootURL:t,baseURL:n}=this,r=e.pathname;t=t.replace(/\/$/,""),n=n.replace(/\/$/,"");let i=r.replace(new RegExp(`^${n}(?=/|$)`),"").replace(new RegExp(`^${t}(?=/|$)`),"").replace(/\/\//g,"/");return i+=(e.search||"")+this.getHash(),i}setURL(e){let{state:t}=this.history;e=this.formatURL(e),t&&t.path===e||this.pushState(e)}replaceURL(e){let{state:t}=this.history;e=this.formatURL(e),t&&t.path===e||this.replaceState(e)}pushState(e){let t={path:e,uuid:Wd()};this.history.pushState(t,"",e)}replaceState(e){let t={path:e,uuid:Wd()};this.history.replaceState(t,"",e)}onUpdateURL(e){this._removeEventListener(),this._popstateHandler=()=>{e(this.getURL())},window.addEventListener("popstate",this._popstateHandler)}formatURL(e){let{rootURL:t,baseURL:n}=this;return""!==e?(t=t.replace(/\/$/,""),n=n.replace(/\/$/,"")):"/"===n[0]&&"/"===t[0]&&(n=n.replace(/\/$/,"")),n+t+e}willDestroy(){this._removeEventListener()}_removeEventListener(){this._popstateHandler&&window.removeEventListener("popstate",this._popstateHandler)}},Gd=class extends Ul{updateCallback;initState(){this._super(...arguments);let{rootURL:e}=this}getURL(){let{path:e,rootURL:t}=this;return t=t.replace(/\/$/,""),e.replace(new RegExp(`^${t}(?=/|$)`),"")}setURL(e){this.path=e}onUpdateURL(e){this.updateCallback=e}handleURL(e){this.path=e,this.updateCallback&&this.updateCallback(e)}formatURL(e){let{rootURL:t}=this;return""!==e&&(t=t.replace(/\/$/,"")),t+e}};function Kd(e,t){return(e,...n)=>{let r=function(e,t){let n=[];function r(e){n.push(e)}for(let i of t)Nn(i,r);return n}(0,[e,...n]);return Yn(...r,function(){let e=r.length-1;for(let n=0;n<e;n++){let e=ur(this,r[n]);if(!t(e))return e}return ur(this,r[e])})}}function Zd(e){return vr(e).readOnly()}Gd.reopen({path:"",rootURL:"/"}),Kd(0,e=>e),Kd(0,e=>!e);var Yd=/[ _]/g,Xd=new sr(1e3,e=>{return(t=e,rp.get(t)).replace(Yd,"-");var t}),Jd=/^(-|_)+(.)?/,Qd=/(.)(-|_|\.|\s)+(.)?/g,ep=/(^|\/|\.)([a-z])/g,tp=new sr(1e3,e=>{let t=(e,t,n)=>n?`_${n.toUpperCase()}`:"",n=(e,t,n,r)=>t+(r?r.toUpperCase():""),r=e.split("/");for(let i=0;i<r.length;i++)r[i]=r[i].replace(Jd,t).replace(Qd,n);return r.join("/").replace(ep,e=>e.toUpperCase())}),np=/([a-z\d])([A-Z])/g,rp=new sr(1e3,e=>e.replace(np,"$1_$2").toLowerCase());function ip(e){return Xd.get(e)}function sp(e){return Object.hasOwnProperty.call(e.since,"enabled")||O._ALL_DEPRECATIONS_ENABLED}var op=parseFloat(O._OVERRIDE_DEPRECATION_VERSION??"7.2.0");function ap(e){return function(e,t=op){let n=e.replace(/(\.0+)/g,"");return t>=parseFloat(n)}(e.until)}function lp(e){return{options:e,test:!sp(e),isEnabled:sp(e)||ap(e),isRemoved:ap(e)}}var cp={DEPRECATE_IMPORT_EMBER:e=>lp({id:`deprecate-import-${ip(e).toLowerCase()}-from-ember`,for:"ember-source",since:{available:"5.10.0",enabled:"6.5.0"},until:"7.0.0",url:`https://deprecations.emberjs.com/id/import-${ip(e).toLowerCase()}-from-ember`}),DEPRECATE_IMPORT_INJECT:lp({for:"ember-source",id:"importing-inject-from-ember-service",since:{available:"6.2.0",enabled:"6.3.0"},until:"7.0.0",url:"https://deprecations.emberjs.com/id/importing-inject-from-ember-service"})},up=a({default:()=>pp,inject:()=>hp,service:()=>dp});function hp(...e){return function(e,t){const{options:n}=t;if(t.isRemoved)throw new Error(`The API deprecated by ${n.id} was removed in ember-source ${n.until}. The message was: Importing \`inject\` from \`@ember/service\` is deprecated. Please import \`service\` instead.. Please see ${n.url} for more details.`)}(0,cp.DEPRECATE_IMPORT_INJECT),$r("service",...e)}function dp(...e){return $r("service",...e)}var pp=class extends Yc{static isServiceFactory=!0},fp=Symbol("ROUTER");function gp(e,t){return"/"===t?e:e.substring(t.length)}var mp=class extends(pp.extend(vc)){[fp];get _router(){let e=this[fp];if(void 0!==e)return e;let t=Ur(this).lookup("router:main");return this[fp]=t}willDestroy(){super.willDestroy(),this[fp]=void 0}transitionTo(...e){if(Vh(e[0]))return this._router._doURLTransition("transitionTo",e[0]);let{routeName:t,models:n,queryParams:r}=jh(e);return this._router._doTransition(t,n,r,!0)}replaceWith(...e){return this.transitionTo(...e).method("replace")}urlFor(e,...t){return this._router.setupRouter(),this._router.generate(e,...t)}isActive(...e){let{routeName:t,models:n,queryParams:r}=jh(e);this._router.setupRouter();let i=this._router._routerMicrolib;if(Ne(Ke(this._router,"currentURL")),!i.isActiveIntent(t,n))return!1;if(Object.keys(r).length>0){let e=t;r=Object.assign({},r),this._router._prepareQueryParams(e,n,r,!0);let s=Object.assign({},i.state.queryParams);return this._router._prepareQueryParams(e,n,s,!0),Wh(r,s)}return!0}recognize(e){this._router.setupRouter();let t=gp(e,this.rootURL);return this._router._routerMicrolib.recognize(t)}recognizeAndLoad(e){this._router.setupRouter();let t=gp(e,this.rootURL);return this._router._routerMicrolib.recognizeAndLoad(t)}refresh(e){if(!e)return this._router._routerMicrolib.refresh();let t=Ur(this).lookup(`route:${e}`);return this._router._routerMicrolib.refresh(t)}static{Gh(this.prototype,"currentRouteName",[Zd("_router.currentRouteName")])}#o=void Zh(this,"currentRouteName");static{Gh(this.prototype,"currentURL",[Zd("_router.currentURL")])}#a=void Zh(this,"currentURL");static{Gh(this.prototype,"location",[Zd("_router.location")])}#l=void Zh(this,"location");static{Gh(this.prototype,"rootURL",[Zd("_router.rootURL")])}#c=void Zh(this,"rootURL");static{Gh(this.prototype,"currentRoute",[Zd("_router.currentRoute")])}#u=void Zh(this,"currentRoute")},yp=class extends pp{[fp];get router(){let e=this[fp];if(void 0!==e)return e;let t=Ur(this).lookup("router:main");return t.setupRouter(),this[fp]=t}hasRoute(e){return this.router.hasRoute(e)}transitionTo(e,t,n,r){let i=this.router._doTransition(e,t,n);return r&&i.method("replace"),i}normalizeQueryParams(e,t,n){this.router._prepareQueryParams(e,t,n)}_generateURL(e,t,n){let r={};return n&&(Object.assign(r,n),this.normalizeQueryParams(e,t,r)),this.router.generate(e,...t,{queryParams:r})}generateURL(e,t,n){if(this.router._initialTransitionStarted)return this._generateURL(e,t,n);try{return this._generateURL(e,t,n)}catch(r){return}}isActiveForRoute(e,t,n,r){let i=this.router._routerMicrolib.recognizer.handlersFor(n),s=i[i.length-1].handler,o=function(e,t){let n=0;for(let r=0;r<t.length&&(n+=t[r].names.length,t[r].handler!==e);r++);return n}(n,i);return e.length>o&&(n=s),r.isActiveIntent(n,e,t)}};yp.reopen({targetState:Zd("router.targetState"),currentState:Zd("router.currentState"),currentRouteName:Zd("router.currentRouteName"),currentPath:Zd("router.currentPath")});var vp=class{cache;constructor(){this.cache=new Map}has(e){return this.cache.has(e)}stash(e,t,n){let r=this.cache.get(e);void 0===r&&(r=new Map,this.cache.set(e,r)),r.set(t,n)}lookup(e,t,n){if(!this.has(e))return n;let r=this.cache.get(e);return r.has(t)?r.get(t):n}},bp=Mo?self:null,wp=Mo?self.location:null,_p=Mo?self.history:null,xp=Mo?self.navigator.userAgent:"Lynx (textmode)",Cp=!(!Mo||"object"!=typeof chrome||"object"==typeof opera),Sp=!!Mo&&/Firefox|FxiOS/.test(xp),kp=Object.freeze(Object.defineProperty({__proto__:null,hasDOM:Mo,history:_p,isChrome:Cp,isFirefox:Sp,location:wp,userAgent:xp,window:bp},Symbol.toStringTag,{value:"Module"})),Ep=-536870913;function Rp(e){return(e|=0)<0?function(e){return e&Ep}(e):function(e){return~e}(e)}function Tp(e){return(e|=0)>Ep?function(e){return~e}(e):function(e){return 536870912|e}(e)}function Lp(e){if("number"==typeof e)return e;{let t=e.errors[0];throw new Error(`Compile Error: ${t.problem} @ ${t.span.start}..${t.span.end}`)}}function Ip(e){if("error"===e.result)throw new Error(`Compile Error: ${e.problem} @ ${e.span.start}..${e.span.end}`);return e}[1,-1].forEach(e=>Tp(Rp(e)));var Pp=new WeakMap,Mp=Reflect.getPrototypeOf;function Ap(e,t){return Pp.set(t,e),t}function Op(e){let t=e;for(;null!==t;){let e=Pp.get(t);if(void 0!==e)return e;t=Mp(t)}}var Np=Object.assign;function Fp(e){return Object.values(e)}function Dp(e){return Object.entries(e)}function zp(e){return Object.keys(e)}var jp=Object.freeze([]);function Up(){return jp}var Bp=Up(),$p=Up();function qp(e){return e===jp}function*Vp(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function*Wp(e){let t=0;for(const n of e)yield[t++,n]}function*Hp(e,t){for(let n=0;n<e.length;n++)yield[n,e[n],t[n]]}function*Gp(e,t){for(let n=0;n<e.length;n++)yield[n<t.length?"retain":"pop",n,e[n],t[n]];for(let n=e.length;n<t.length;n++)yield["push",n,void 0,t[n]]}function Kp(){}var Zp=class{constructor(e){this.buffer=e}size=0;encode(e,t,...n){if(e>255)throw new Error(`Opcode type over 8-bits. Got ${e}.`);let r=e|t|arguments.length-2<<8;this.buffer.push(r);for(const i of n)this.buffer.push(i);this.size=this.buffer.length}patch(e,t){if(-1!==this.buffer[e+1])throw new Error("Trying to patch operand in populated slot instead of a reserved slot.");this.buffer[e+1]=t}},Yp=32,Xp=31;function Jp(e){return t=>{if(!function(e){return Array.isArray(e)&&2===e.length}(t))return!1;let n=t[0];return n===Xp||n===Yp||n===e}}var Qp=Jp(39),ef=Jp(38),tf=Jp(37),nf=Jp(35);function rf(e,t,n,r){let{symbols:{upvars:i}}=n,s=i[e[1]],o=t?.lookupBuiltInHelper?.(s)??null;return r.helper(o,s)}var sf=1004,of=1005,af=1010,lf=1e3,cf=1001,uf=1002;function hf(e){return{type:1,value:e}}function df(e){return{type:5,value:e}}function pf(e){return{type:7,value:e}}function ff(e){return{type:8,value:e}}var gf=class{labels=tt();targets=[];label(e,t){this.labels[e]=t}target(e,t){this.targets.push({at:e,target:t})}patch(e){let{targets:t,labels:n}=this;for(const{at:r,target:i}of t){let t=n[i]-r;Kp(e.getbyaddr(r)),e.setbyaddr(r,t)}}};function mf(e,t,n,r){let{program:{constants:i},resolver:s}=t;if(function(e){return e<1e3}(r[0])){let[t,...n]=r;e.push(i,t,...n)}else switch(r[0]){case lf:return e.label(r[1]);case cf:return e.startLabels();case uf:return e.stopLabels();case sf:return function(e,t,n,[,r,i]){if(Qp(r),r[0]===Yp){let{scopeValues:e,owner:s,symbols:{lexical:o}}=n,a=e[r[1]];i(t.component(a,s,!1,o?.at(r[1])))}else{let{symbols:{upvars:s},owner:o}=n,a=s[r[1]],l=e?.lookupComponent?.(a,o)??null;i(t.resolvedComponent(l,a))}}(s,i,n,r);case 1003:return function(e,t,n,[,r,i]){ef(r);let s=r[0];if(s===Yp){let{scopeValues:e,symbols:{lexical:s}}=n,o=e[r[1]];i(t.modifier(o,s?.at(r[1])??void 0))}else if(s===Xp){let{symbols:{upvars:s}}=n,o=s[r[1]],a=e?.lookupBuiltInModifier?.(o)??null;i(t.modifier(a,o))}else{let{symbols:{upvars:s},owner:o}=n,a=s[r[1]],l=e?.lookupModifier?.(a,o)??null;i(t.modifier(l))}}(s,i,n,r);case of:return function(e,t,n,[,r,i]){tf(r);let s=r[0];if(s===Yp){let{scopeValues:e}=n,s=e[r[1]];i(t.helper(s))}else if(s===Xp)i(rf(r,e,n,t));else{let{symbols:{upvars:s},owner:o}=n,a=s[r[1]],l=e?.lookupHelper?.(a,o)??null;i(t.helper(l,a))}}(s,i,n,r);case 1007:return function(e,t,n,[,r,{ifComponent:i,ifHelper:s}]){nf(r);let o=r[0];if(o===Yp){let{scopeValues:e,owner:o,symbols:{lexical:a}}=n,l=e[r[1]],c=t.component(l,o,!0,a?.at(r[1]));if(null!==c)return void i(c);s(t.helper(l,null,!0))}else if(o===Xp)s(rf(r,e,n,t));else{let{symbols:{upvars:o},owner:a}=n,l=o[r[1]],c=e?.lookupComponent?.(l,a)??null;if(null!==c)i(t.resolvedComponent(c,l));else{let n=e?.lookupHelper?.(l,a)??null;s(t.helper(n,l))}}}(s,i,n,r);case 1008:return function(e,t,n,[,r,{ifComponent:i,ifHelper:s,ifValue:o}]){nf(r);let a=r[0];if(a===Yp){let{scopeValues:e,owner:a,symbols:{lexical:l}}=n,c=e[r[1]];if("function"!=typeof c&&("object"!=typeof c||null===c))return void o(t.value(c));let u=t.component(c,a,!0,l?.at(r[1]));if(null!==u)return void i(u);let h=t.helper(c,null,!0);if(null!==h)return void s(h);o(t.value(c))}else if(a===Xp)s(rf(r,e,n,t));else{let{symbols:{upvars:o},owner:a}=n,l=o[r[1]],c=e?.lookupComponent?.(l,a)??null;if(null!==c)return void i(t.resolvedComponent(c,l));let u=e?.lookupHelper?.(l,a)??null;null!==u&&s(t.helper(u,l))}}(s,i,n,r);case af:{let[,e,t]=r;t(n.symbols.upvars[e],n.moduleName);break}case 1011:{let[,e,t]=r,s=n.scopeValues[e];t(i.value(s));break}default:throw new Error(`Unexpected high level opcode ${r[0]}`)}}var yf=class{labelsStack=new it;encoder=new Zp([]);errors=[];handle;constructor(e,t,n){this.heap=e,this.meta=t,this.stdlib=n,this.handle=e.malloc()}error(e){this.encoder.encode(30,0),this.errors.push(e)}commit(e){let t=this.handle;return this.heap.pushMachine(5),this.heap.finishMalloc(t,e),Je(this.errors)?{errors:this.errors,handle:t}:t}push(e,t,...n){let{heap:r}=this,i=t|((s=t)>=0&&s<=15?1024:0)|n.length<<8;var s;r.pushRaw(i);for(let o=0;o<n.length;o++){let t=n[o];r.pushRaw(this.operand(e,t))}}operand(e,t){if("number"==typeof t)return t;if("object"==typeof t&&null!==t){if(Array.isArray(t))return e.array(t);switch(t.type){case 1:return this.currentLabels.target(this.heap.offset,t.value),-1;case 2:return e.value(this.meta.isStrictMode);case 3:case 6:case 7:case 8:return e.value(t.value);case 4:return e.value((n=t.value,r=this.meta,new Qf(n[0],r,{parameters:n[1]||jp})));case 5:return this.stdlib[t.value]}}var n,r;return e.value(t)}get currentLabels(){return this.labelsStack.current}label(e){this.currentLabels.label(e,this.heap.offset+1)}startLabels(){this.labelsStack.push(new gf)}stopLabels(){this.labelsStack.pop().patch(this.heap)}};function vf(e,t){return{evaluation:e,encoder:new yf(e.program.heap,t,e.stdlib),meta:t}}var bf=class{names={};funcs=[];add(e,t){this.names[e]=this.funcs.push(t)-1}compile(e,t){let n=t[0],r=this.names[n],i=this.funcs[r];t[0],i(e,t)}},wf=new bf;function _f(e,t){if(void 0!==t&&0!==t.length)for(let n=0;n<t.length;n++)e(22,t[n])}function xf(e,t){Array.isArray(t)?wf.compile(e,t):(Sf(e,t),e(31))}function Cf(e,t){Sf(e,t),e(31)}function Sf(e,t){let n=t;var r;"number"==typeof n&&(n=(r=n)%1==0&&r<=536870911&&r>=-536870912?Rp(n):function(e){return{type:6,value:e}}(n)),e(30,n)}function kf(e,t,n,r){e(0),Af(e,n,r,!1),e(16,t),e(1),e(36,8)}function Ef(e,t,n,r){e(0),Af(e,t,n,!1),e(33,2,1),e(107),r?(e(36,8),r(),e(1),e(34,1)):(e(1),e(34,1),e(36,8))}function Rf(e,t,n,r,i){e(0),Af(e,r,i,!1),e(86),xf(e,n),e(77,t,{type:2,value:void 0}),e(1),e(36,8)}function Tf(e,t,n){Af(e,n,null,!0),e(23,t),e(24),e(61),e(64),e(40),e(1)}function Lf(e,t){!function(e,t){null!==t?e(63,pf({parameters:t})):Sf(e,null)}(e,t&&t[1]),e(62),Mf(e,t)}function If(e,t){e(0),Mf(e,t),e(61),e(2),e(1)}function Pf(e,t,n){let r=t[1],i=r.length,s=Math.min(n,i);if(0!==s){if(e(0),s){e(39);for(let t=0;t<s;t++)e(33,2,n-t),e(19,r[t])}Mf(e,t),e(61),e(2),s&&e(40),e(1)}else If(e,t)}function Mf(e,t){null===t?Sf(e,null):e(28,{type:4,value:t})}function Af(e,t,n,r){if(null===t&&null===n)return void e(83);let i=Of(e,t)<<4;r&&(i|=8);let s=Bp;if(n){s=n[0];let t=n[1];for(let n=0;n<t.length;n++)xf(e,t[n])}e(82,s,Bp,i)}function Of(e,t){if(null===t)return 0;for(let n=0;n<t.length;n++)xf(e,t[n]);return t.length}function Nf(e){let[,t,n]=e.block,r=e.scope?.()??null;return{symbols:{locals:t,upvars:n,lexical:r?Object.keys(r):void 0},scopeValues:r?Object.values(r):null,isStrictMode:e.isStrictMode,moduleName:e.moduleName,owner:e.owner,size:t.length}}wf.add(29,(e,[,t])=>{for(let n of t)xf(e,n);e(27,t.length)}),wf.add(28,(e,[,t,n,r])=>{tf(t)?e(of,t,t=>{kf(e,t,n,r)}):(xf(e,t),Ef(e,n,r))}),wf.add(50,(e,[,t,n,r,i])=>{Rf(e,n,t,r,i)}),wf.add(30,(e,[,t,n])=>{e(21,t),_f(e,n)}),wf.add(Yp,(e,[,t,n])=>{e(1011,t,t=>{e(29,t),_f(e,n)})}),wf.add(Xp,(e,t)=>{e(af,t[1],()=>{e(of,t,t=>{kf(e,t,null,null)})})}),wf.add(37,(e,t)=>{e(af,t[1],()=>{e(of,t,t=>{kf(e,t,null,null)})})}),wf.add(27,e=>Cf(e,void 0)),wf.add(48,(e,[,t])=>{xf(e,t),e(25)}),wf.add(49,(e,[,t])=>{xf(e,t),e(24),e(61),e(26)}),wf.add(52,(e,[,t,n,r])=>{xf(e,r),xf(e,n),xf(e,t),e(109)}),wf.add(51,(e,[,t])=>{xf(e,t),e(110)}),wf.add(53,(e,[,t])=>{xf(e,t),e(111)}),wf.add(54,(e,[,t])=>{e(0),Af(e,t,null,!1),e(112),e(1),e(36,8)});var Ff=class e{names;constructor(e){this.blocks=e,this.names=e?Object.keys(e):[]}get(e){return this.blocks&&this.blocks[e]||null}has(e){let{blocks:t}=this;return null!==t&&e in t}with(t,n){let{blocks:r}=this;return new e(r?Np({},r,{[t]:n}):{[t]:n})}get hasAny(){return null!==this.blocks}},Df=new Ff(null);function zf(e){if(null===e)return Df;let t=tt(),[n,r]=e;for(const[i,s]of Wp(n))t[s]=Ye(r[i]);return new Ff(t)}function jf(e,t,n){let r=[],i=0;n(function(e,t){r.push({match:e,callback:t,label:"CLAUSE"+i++})}),e(69,1),t(),e(cf);for(let s of r.slice(0,-1))e(67,hf(s.label),s.match);for(let s=r.length-1;s>=0;s--){let t=Ye(r[s]);e(lf,t.label),e(34,1),t.callback(),0!==s&&e(4,hf("END"))}e(lf,"END"),e(uf),e(70)}function Uf(e,t,n){e(cf),e(0),e(6,hf("ENDINITIAL")),e(69,t()),n(),e(lf,"FINALLY"),e(70),e(5),e(lf,"ENDINITIAL"),e(1),e(uf)}function Bf(e,t,n,r){return Uf(e,t,()=>{e(66,hf("ELSE")),n(),e(4,hf("FINALLY")),e(lf,"ELSE"),void 0!==r&&r()})}var $f="&attrs";function qf(e,t,n,r,i,s){let{compilable:o,capabilities:a,handle:l}=t,c=n?[n,[]]:null,u=zf(s);o?(e(78,l),function(e,{capabilities:t,layout:n,elementBlock:r,positional:i,named:s,blocks:o}){let{symbolTable:a}=n;if(vu(t,pu.prepareArgs))return void Wf(e,{capabilities:t,elementBlock:r,positional:i,named:s,atNames:!0,blocks:o,layout:n});e(36,4),e(33,3,1),e(35,4),e(0);let{symbols:l}=a,c=[],u=[],h=[],d=o.names;if(null!==r){let t=l.indexOf($f);-1!==t&&(Lf(e,r),c.push(t))}for(const p of d){let t=l.indexOf(`&${p}`);-1!==t&&(Lf(e,o.get(p)),c.push(t))}if(vu(t,pu.createArgs)){let t=Of(e,i)<<4;t|=8;let n=Bp;if(null!==s){n=s[0];let t=s[1];for(let r=0;r<t.length;r++){let i=l.indexOf(Ye(n[r]));xf(e,t[r]),u.push(i)}}e(82,n,Bp,t),u.push(-1)}else if(null!==s){let t=s[0],n=s[1];for(let r=0;r<n.length;r++){let i=Ye(t[r]),s=l.indexOf(i);-1!==s&&(xf(e,n[r]),u.push(s),h.push(i))}}e(97,4),vu(t,pu.dynamicScope)&&e(59),vu(t,pu.createInstance)&&e(87,0|o.has("default")),e(88,4),vu(t,pu.createArgs)?e(90,4):e(90,4,h),e(37,l.length+1,Object.keys(o).length>0?1:0),e(19,0);for(const p of Vp(u))-1===p?e(34,1):e(19,p+1);null!==i&&e(34,i.length);for(const p of Vp(c))e(20,p+1);e(28,ff(n)),e(61),e(2),e(100,4),e(1),e(40),vu(t,pu.dynamicScope)&&e(60),e(98),e(35,4)}(e,{capabilities:a,layout:o,elementBlock:c,positional:r,named:i,blocks:u})):(e(78,l),Wf(e,{capabilities:a,elementBlock:c,positional:r,named:i,atNames:!0,blocks:u}))}function Vf(e,t,n,r,i,s,o,a){let l=n?[n,[]]:null,c=zf(s);Uf(e,()=>(xf(e,t),e(33,3,0),2),()=>{e(66,hf("ELSE")),a?e(81):e(80,{type:2,value:void 0}),e(79),Wf(e,{capabilities:!0,elementBlock:l,positional:r,named:i,atNames:o,blocks:c}),e(lf,"ELSE")})}function Wf(e,{capabilities:t,elementBlock:n,positional:r,named:i,atNames:s,blocks:o,layout:a}){let l=Boolean(o),c=!0===t||vu(t,pu.prepareArgs)||0!==i?.[0].length,u=o.with("attrs",n);e(36,4),e(33,3,1),e(35,4),e(0),function(e,t,n,r,i){let s=r.names;for(const l of s)Lf(e,r.get(l));let o=Of(e,t)<<4;i&&(o|=8),r.hasAny&&(o|=7);let a=jp;if(n){a=n[0];let t=n[1];for(let n=0;n<t.length;n++)xf(e,t[n])}e(82,a,s,o)}(e,r,i,u,s),e(85,4),Hf(e,u.has("default"),l,c,()=>{a?(e(63,pf(a.symbolTable)),e(28,ff(a)),e(61)):e(92,4),e(95,4)}),e(35,4)}function Hf(e,t,n,r,i=null){e(97,4),e(59),e(87,0|t),i&&i(),e(88,4),e(90,4),e(38,4),e(19,0),r&&e(17,4),n&&e(18,4),e(34,1),e(96,4),e(100,4),e(1),e(40),e(60),e(98)}var Gf=new bf,Kf=["class","id","value","name","type","style","href"],Zf=["div","span","p","a"];function Yf(e){return"string"==typeof e?e:Zf[e]}function Xf(e){return"string"==typeof e?e:Kf[e]}function Jf(e){return null===e?null:[e[0].map(e=>`@${e}`),e[1]]}Gf.add(3,(e,t)=>e(42,t[1])),Gf.add(13,e=>e(55)),Gf.add(12,e=>e(54)),Gf.add(4,(e,[,t,n,r])=>{ef(t)?e(1003,t,t=>{e(0),Af(e,n,r,!1),e(57,t),e(1)}):(xf(e,t),e(0),Af(e,n,r,!1),e(33,2,1),e(108),e(1))}),Gf.add(14,(e,[,t,n,r])=>{e(51,Xf(t),n,r??null)}),Gf.add(24,(e,[,t,n,r])=>{e(105,Xf(t),n,r??null)}),Gf.add(15,(e,[,t,n,r])=>{xf(e,n),e(52,Xf(t),!1,r??null)}),Gf.add(22,(e,[,t,n,r])=>{xf(e,n),e(52,Xf(t),!0,r??null)}),Gf.add(16,(e,[,t,n,r])=>{xf(e,n),e(53,Xf(t),!1,r??null)}),Gf.add(23,(e,[,t,n,r])=>{xf(e,n),e(53,Xf(t),!0,r??null)}),Gf.add(10,(e,[,t])=>{e(48,Yf(t))}),Gf.add(11,(e,[,t])=>{e(89),e(48,Yf(t))}),Gf.add(8,(e,[,t,n,r,i])=>{Qp(t)?e(sf,t,t=>{qf(e,t,n,null,r,i)}):Vf(e,t,n,null,r,i,!0,!0)}),Gf.add(18,(e,[,t,n])=>Tf(e,t,n)),Gf.add(17,(e,[,t])=>Tf(e,t,null)),Gf.add(26,(e,[,t,n,r])=>{e(103,function(e,t,n){return{type:3,value:{locals:e,upvars:t,lexical:n}}}(t,n,r))}),Gf.add(1,(e,[,t])=>{if(Array.isArray(t))if(nf(t))e(1008,t,{ifComponent(t){qf(e,t,null,null,null,null)},ifHelper(t){e(0),kf(e,t,null,null),e(3,df("cautious-non-dynamic-append")),e(1)},ifValue(t){e(0),e(29,t),e(3,df("cautious-non-dynamic-append")),e(1)}});else if(28===t[0]){let[,n,r,i]=t;nf(n)?e(1007,n,{ifComponent(t){qf(e,t,null,r,Jf(i),null)},ifHelper(t){e(0),kf(e,t,r,i),e(3,df("cautious-non-dynamic-append")),e(1)}}):jf(e,()=>{xf(e,n),e(106)},t=>{t(0,()=>{e(68),e(81),e(79),Wf(e,{capabilities:!0,elementBlock:null,positional:r,named:i,atNames:!1,blocks:zf(null)})}),t(1,()=>{Ef(e,r,i,()=>{e(3,df("cautious-non-dynamic-append"))})})})}else e(0),xf(e,t),e(3,df("cautious-append")),e(1);else e(41,null==t?"":String(t))}),Gf.add(2,(e,[,t])=>{Array.isArray(t)?(e(0),xf(e,t),e(3,df("trusting-append")),e(1)):e(41,null==t?"":String(t))}),Gf.add(6,(e,[,t,n,r,i])=>{Qp(t)?e(sf,t,t=>{qf(e,t,null,n,Jf(r),i)}):Vf(e,t,null,n,r,i,!1,!1)}),Gf.add(40,(e,[,t,n,r,i])=>{Bf(e,()=>(xf(e,n),void 0===i?Cf(e,void 0):xf(e,i),xf(e,r),e(33,3,0),4),()=>{e(50),If(e,t),e(56)})}),Gf.add(41,(e,[,t,n,r])=>Bf(e,()=>(xf(e,t),e(71),1),()=>{If(e,n)},r?()=>{If(e,r)}:void 0)),Gf.add(42,(e,[,t,n,r,i])=>Uf(e,()=>(n?xf(e,n):Cf(e,null),xf(e,t),2),()=>{e(72,hf("BODY"),hf("ELSE")),e(0),e(33,2,1),e(6,hf("ITER")),e(lf,"ITER"),e(74,hf("BREAK")),e(lf,"BODY"),Pf(e,r,2),e(34,2),e(4,hf("FINALLY")),e(lf,"BREAK"),e(1),e(73),e(4,hf("FINALLY")),e(lf,"ELSE"),i&&If(e,i)})),Gf.add(44,(e,[,t,n])=>{Pf(e,n,Of(e,t))}),Gf.add(45,(e,[,t,n])=>{if(t){let[r,i]=t;Of(e,i),function(e,t,n){e(59),e(58,t),n(),e(60)}(e,r,()=>{If(e,n)})}else If(e,n)}),Gf.add(46,(e,[,t,n,r,i])=>{Qp(t)?e(sf,t,t=>{qf(e,t,null,n,Jf(r),i)}):Vf(e,t,null,n,r,i,!1,!1)});var Qf=class{compiled=new WeakMap;constructor(e,t,n,r="plain block"){this.statements=e,this.meta=t,this.symbolTable=n,this.moduleName=r}compile(e){return function(e,t){if(e.compiled.has(t))return e.compiled.get(t);e.compiled.set(t,-1);let{statements:n,meta:r}=e,i=function(e,t,n){let r=Gf,i=vf(n,t),{encoder:s,evaluation:o}=i;function a(...e){mf(s,o,t,e)}for(const l of e)r.compile(a,l);return i.encoder.commit(t.size)}(n,r,t);return e.compiled.set(t,i),i}(this,e)}},eg=class{symbolTable;compiled=null;attrsBlockNumber;meta;constructor(e,t){this.layout=e,this.moduleName=t;let{block:n}=e,[,r]=n;r=r.slice();let i=r.indexOf($f);this.attrsBlockNumber=-1===i?r.push($f):i+1,this.symbolTable={symbols:r},this.meta=Nf(e)}compile(e){if(null!==this.compiled)return this.compiled;let t=Nf(this.layout),n=vf(e,t),{encoder:r,evaluation:i}=n;var s,o,a;s=function(...e){mf(r,i,t,e)},o=this.layout,a=this.attrsBlockNumber,s(cf),function(e,t,n){e(36,5),n(),e(35,5)}(s,0,()=>{s(91,4),s(31),s(33,3,0)}),s(66,hf("BODY")),s(36,5),s(89),s(49),s(99,4),Tf(s,a,null),s(54),s(lf,"BODY"),If(s,[o.block[0],[]]),s(36,5),s(66,hf("END")),s(55),s(lf,"END"),s(35,5),s(uf);let l=n.encoder.commit(t.size);return"number"!=typeof l||(this.compiled=l),l}},tg=0,ng={cacheHit:0,cacheMiss:0};function rg({id:e,moduleName:t,block:n,scope:r,isStrictMode:i}){let s,o=e||"client-"+tg++,a=null,l=new WeakMap,c=e=>{if(void 0===s&&(s=JSON.parse(n)),void 0===e)return null===a?(ng.cacheMiss++,a=new ig({id:o,block:s,moduleName:t,owner:null,scope:r,isStrictMode:i})):ng.cacheHit++,a;let c=l.get(e);return void 0===c?(ng.cacheMiss++,c=new ig({id:o,block:s,moduleName:t,owner:e,scope:r,isStrictMode:i}),l.set(e,c)):ng.cacheHit++,c};return c.__id=o,c.__meta={moduleName:t},c}var ig=class{result="ok";layout=null;wrappedLayout=null;constructor(e){this.parsedLayout=e}get moduleName(){return this.parsedLayout.moduleName}get id(){return this.parsedLayout.id}get referrer(){return{moduleName:this.parsedLayout.moduleName,owner:this.parsedLayout.owner}}asLayout(){return this.layout?this.layout:this.layout=function(e,t){let[n,r]=e.block;return new Qf(n,Nf(e),{symbols:r},t)}(Np({},this.parsedLayout),this.moduleName)}asWrappedLayout(){return this.wrappedLayout?this.wrappedLayout:this.wrappedLayout=new eg(Np({},this.parsedLayout),this.moduleName)}},sg=class{offset=0;constructor(e){this.heap=e}get size(){return 1+((768&this.heap.getbyaddr(this.offset))>>8)}get isMachine(){return 1024&this.heap.getbyaddr(this.offset)?1:0}get type(){return 255&this.heap.getbyaddr(this.offset)}get op1(){return this.heap.getbyaddr(this.offset+1)}get op2(){return this.heap.getbyaddr(this.offset+2)}get op3(){return this.heap.getbyaddr(this.offset+3)}},og=1048576,ag=class{offset=0;heap;handleTable;handleState;constructor(){this.heap=new Int32Array(og),this.handleTable=[],this.handleState=[]}entries(){return this.offset}pushRaw(e){this.sizeCheck(),this.heap[this.offset++]=e}pushOp(e){this.pushRaw(e)}pushMachine(e){this.pushRaw(1024|e)}sizeCheck(){let{heap:e}=this;if(this.offset===this.heap.length){let t=new Int32Array(e.length+og);t.set(e,0),this.heap=t}}getbyaddr(e){return this.heap[e]}setbyaddr(e,t){this.heap[e]=t}malloc(){return this.handleTable.push(this.offset),this.handleTable.length-1}finishMalloc(e){}size(){return this.offset}getaddr(e){return this.handleTable[e]}sizeof(e){return this.handleTable,-1}free(e){this.handleState[e]=1}compact(){let e=0,{handleTable:t,handleState:n,heap:r}=this;for(let i=0;i<length;i++){let s=Ye(t[i]),o=Ye(t[i+1])-Ye(s),a=n[i];if(2!==a)if(1===a)n[i]=2,e+=o;else if(0===a){for(let t=s;t<=i+o;t++)r[t-e]=Ye(r[t]);t[i]=s-e}else 3===a&&(t[i]=s-e)}this.offset=this.offset-e}},lg=class{_opcode;constructor(e,t){this.constants=e,this.heap=t,this._opcode=new sg(this.heap)}opcode(e){return this._opcode.offset=e,this._opcode}},cg={id:"1b32f5c2-7623-43d6-a0ad-9672898920a1",moduleName:"__default__.hbs",block:JSON.stringify([[[18,1,null]],["&default"],[]]),scope:null,isStrictMode:!0},ug=Object.freeze([]),hg=[!1,!0,null,void 0,ug],dg=hg.indexOf(ug),pg=class{reifiedArrs={[dg]:ug};defaultTemplate=rg(cg)();helperDefinitionCount=0;modifierDefinitionCount=0;componentDefinitionCount=0;values=hg.slice();indexMap=new Map(this.values.map((e,t)=>[e,t]));helperDefinitionCache=new WeakMap;modifierDefinitionCache=new WeakMap;componentDefinitionCache=new WeakMap;value(e){let t=this.indexMap,n=t.get(e);return void 0===n&&(n=this.values.push(e)-1,t.set(e,n)),n}array(e){if(0===e.length)return dg;let t=new Array(e.length);for(let n=0;n<e.length;n++)t[n]=this.value(e[n]);return this.value(t)}toPool(){return this.values}hasHandle(e){return this.values.length>e}helper(e,t=null,n){let r=this.helperDefinitionCache.get(e);if(void 0===r){let t=Ou(e);if(null===t)return this.helperDefinitionCache.set(e,null),null;let n="function"==typeof t?t:t.getHelper(e);r=this.value(n),this.helperDefinitionCache.set(e,r),this.helperDefinitionCount++}return r}modifier(e,t=null,n){let r=this.modifierDefinitionCache.get(e);if(void 0===r){let n=Pu(e);if(null===n)return this.modifierDefinitionCache.set(e,null),null;let i={resolvedName:t,manager:n,state:e};r=this.value(i),this.modifierDefinitionCache.set(e,r),this.modifierDefinitionCount++}return r}component(e,t,n,r){let i=this.componentDefinitionCache.get(e);if(void 0===i){let n=Fu(e);if(null===n)return this.componentDefinitionCache.set(e,null),null;let s,o=gu(n.getCapabilities(e)),a=Op(e),l=null;s=yu(0,o,pu.dynamicLayout)?a?.(t):a?.(t)??this.defaultTemplate,void 0!==s&&(s=Ip(s),l=yu(0,o,pu.wrapped)?s.asWrappedLayout():s.asLayout()),i={resolvedName:null,handle:-1,manager:n,capabilities:o,state:e,compilable:l},i.handle=this.value(i),r&&(i.debugName=r),this.componentDefinitionCache.set(e,i),this.componentDefinitionCount++}return i}resolvedComponent(e,t){let n=this.componentDefinitionCache.get(e);if(void 0===n){let{manager:r,state:i,template:s}=e,o=gu(r.getCapabilities(e)),a=null;yu(0,o,pu.dynamicLayout)||(s=s??this.defaultTemplate),null!==s&&(s=Ip(s),a=yu(0,o,pu.wrapped)?s.asWrappedLayout():s.asLayout()),n={resolvedName:t,handle:-1,manager:r,capabilities:o,state:i,compilable:a},n.handle=this.value(n),this.componentDefinitionCache.set(e,n),this.componentDefinitionCount++}return n}getValue(e){return this.values[e]}getArray(e){let t=this.reifiedArrs,n=t[e];if(void 0===n){let r=this.getValue(e);n=new Array(r.length);for(const[e,t]of Wp(r))n[e]=this.getValue(t);t[e]=n}return n}},fg=class{constructor(e,t){this.element=e,this.nextSibling=t}},gg=class{constructor(e,t,n){this.parentNode=e,this.first=t,this.last=n}parentElement(){return this.parentNode}firstNode(){return this.first}lastNode(){return this.last}};function mg(e,t){let n=e.parentElement(),r=e.firstNode(),i=e.lastNode(),s=r;for(;;){let e=s.nextSibling;if(n.insertBefore(s,t),s===i)return e;s=Xe(e)}}function yg(e){let t=e.parentElement(),n=e.firstNode(),r=e.lastNode(),i=n;for(;;){let e=i.nextSibling;if(t.removeChild(i),i===r)return e;i=Xe(e)}}function vg(e){return bg(e)?"":String(e)}function bg(e){return null==e||"function"!=typeof e.toString}function wg(e){return null!==e&&"object"==typeof e}function _g(e){return wg(e)&&"function"==typeof e.toHTML}function xg(e){return"string"==typeof e}function Cg(e,t){let n,r;if(t in e)r=t,n="prop";else{let i=t.toLowerCase();i in e?(n="prop",r=i):(n="attr",r=t)}return"prop"!==n||"style"!==r.toLowerCase()&&!function(e,t){let n=kg[e.toUpperCase()];return!(!n||!n[t.toLowerCase()])}(e.tagName,r)||(n="attr"),{normalized:r,type:n}}var Sg,kg={INPUT:{form:!0,autocorrect:!0,list:!0},SELECT:{form:!0},OPTION:{form:!0},TEXTAREA:{form:!0},LABEL:{form:!0},FIELDSET:{form:!0},LEGEND:{form:!0},OBJECT:{form:!0},OUTPUT:{form:!0},BUTTON:{form:!0}},Eg="http://www.w3.org/1998/Math/MathML",Rg=["javascript:","vbscript:"],Tg=["A","AREA","BODY","LINK","IMG","IFRAME","BASE","FORM","BUTTON","INPUT"],Lg=["EMBED"],Ig=["IFRAME","OBJECT"],Pg=["href","src","background","action","formaction","xlink:href"],Mg=["src"],Ag=["src","data"];function Og(e,t){return-1!==e.indexOf(t)}function Ng(e,t){return(null===e||Og(Tg,e.toUpperCase()))&&Og(Pg,t)}function Fg(e,t){return null!==e&&Og(Lg,e.toUpperCase())&&Og(Mg,t)}function Dg(e,t){return null!==e&&Og(Ig,e.toUpperCase())&&Og(Ag,t)}function zg(e,t){return Ng(e,t)||Fg(e,t)||Dg(e,t)}function jg(e){return Sg||(Sg=function(){const e=URL;if("object"==typeof e&&null!==e&&"function"==typeof e.parse){let t=e;return e=>{let n=null;return"string"==typeof e&&(n=t.parse(e.replace(/[\t\n\r]/gu,"")).protocol),null===n?":":n}}if("function"==typeof e)return t=>{try{return new e(t).protocol}catch{return":"}};throw new Error('@glimmer/runtime needs a valid "globalThis.URL"')}()),Sg(e)}function Ug(e,t,n){if(null==n)return n;if(_g(n))return n.toHTML();const r=e.tagName;let i=vg(n);if(Ng(r,t)){let e=jg(i);if(Og(Rg,e))return`unsafe:${i}`}if(Dg(r,t)){let e=jg(i);if("data:"===e||Og(Rg,e))return`unsafe:${i}`}return Fg(r,t)?`unsafe:${i}`:i}function Bg(e,t,n){const{tagName:r,namespaceURI:i}=e,s={element:e,name:t,namespace:n};if("http://www.w3.org/2000/svg"===i)return $g(r,t,s);const{type:o,normalized:a}=Cg(e,t);return"attr"===o?$g(r,a,s):function(e,t,n){return zg(e,t)?new Hg(t,n):function(e,t){return("INPUT"===e||"TEXTAREA"===e)&&"value"===t}(e,t)?new Kg(t,n):function(e,t){return"OPTION"===e&&"selected"===t}(e,t)?new Zg(t,n):new Wg(t,n)}(r,a,s)}function $g(e,t,n){return zg(e,t)?new Gg(n):new Vg(n)}var qg=class{constructor(e){this.attribute=e}},Vg=class extends qg{set(e,t,n){const r=Yg(t);if(null!==r){const{name:t,namespace:n}=this.attribute;e.__setAttribute(t,r,n)}}update(e,t){const n=Yg(e),{element:r,name:i}=this.attribute;null===n?r.removeAttribute(i):r.setAttribute(i,n)}},Wg=class extends qg{constructor(e,t){super(t),this.normalizedName=e}value;set(e,t,n){null!=t&&(this.value=t,e.__setProperty(this.normalizedName,t))}update(e,t){const{element:n}=this.attribute;this.value!==e&&(n[this.normalizedName]=this.value=e,null==e&&this.removeAttribute())}removeAttribute(){const{element:e,namespace:t}=this.attribute;t?e.removeAttributeNS(t,this.normalizedName):e.removeAttribute(this.normalizedName)}},Hg=class extends Wg{set(e,t,n){const{element:r,name:i}=this.attribute,s=Ug(r,i,t);super.set(e,s,n)}update(e,t){const{element:n,name:r}=this.attribute,i=Ug(n,r,e);super.update(i,t)}},Gg=class extends Vg{set(e,t,n){const{element:r,name:i}=this.attribute,s=Ug(r,i,t);super.set(e,s,n)}update(e,t){const{element:n,name:r}=this.attribute,i=Ug(n,r,e);super.update(i,t)}},Kg=class extends Wg{set(e,t){const n=vg(t);e.__setProperty("value",n),""===t&&"INPUT"===this.attribute.element.tagName&&e.__setAttribute("value","",null)}update(e){const t=this.attribute.element,n=t.value,r=vg(e);n!==r&&(t.value=r)}},Zg=class extends Wg{set(e,t){null!=t&&!1!==t&&e.__setProperty("selected",!0)}update(e){this.attribute.element.selected=!!e}};function Yg(e){return!1===e||null==e||void 0===e.toString?null:!0===e?"":"function"==typeof e?null:String(e)}var Xg=class{constructor(e){this.node=e}firstNode(){return this.node}},Jg=class{constructor(e){this.node=e}lastNode(){return this.node}},Qg=class{dom;updateOperations;constructing=null;operations=null;env;cursors=new it;modifierStack=new it;blockStack=new it;static forInitialRender(e,t){return new this(e,t.element,t.nextSibling).initialize()}static resume(e,t){let n=new this(e,t.parentElement(),t.reset(e)).initialize();return n.pushBlock(t),n}constructor(e,t,n){this.pushElement(t,n),this.env=e,this.dom=e.getAppendOperations(),this.updateOperations=e.getDOM()}initialize(){return this.pushAppendingBlock(),this}debugBlocks(){return this.blockStack.toArray()}get element(){return this.cursors.current.element}get nextSibling(){return this.cursors.current.nextSibling}get hasBlocks(){return this.blockStack.size>0}block(){return this.blockStack.current}popElement(){this.cursors.pop(),this.cursors.current}pushAppendingBlock(){return this.pushBlock(new em(this.element))}pushResettableBlock(){return this.pushBlock(new nm(this.element))}pushBlockList(e){return this.pushBlock(new rm(this.element,e))}pushBlock(e,t=!1){let n=this.blockStack.current;return null!==n&&(t||n.didAppendBounds(e)),this.__openBlock(),this.blockStack.push(e),e}popBlock(){return this.block().finalize(this),this.__closeBlock(),this.blockStack.pop()}__openBlock(){}__closeBlock(){}openElement(e){let t=this.__openElement(e);return this.constructing=t,t}__openElement(e){return this.dom.createElement(e,this.element)}flushElement(e){let t=this.element,n=this.constructing;this.__flushElement(t,n),this.constructing=null,this.operations=null,this.pushModifiers(e),this.pushElement(n,null),this.didOpenElement(n)}__flushElement(e,t){this.dom.insertBefore(e,t,this.nextSibling)}closeElement(){return this.willCloseElement(),this.popElement(),this.popModifiers()}pushRemoteElement(e,t,n){return this.__pushRemoteElement(e,t,n)}__pushRemoteElement(e,t,n){if(this.pushElement(e,n),void 0===n)for(;e.lastChild;)e.removeChild(e.lastChild);let r=new tm(e);return this.pushBlock(r,!0)}popRemoteElement(){const e=this.popBlock();return this.popElement(),e}pushElement(e,t=null){this.cursors.push(new fg(e,t))}pushModifiers(e){this.modifierStack.push(e)}popModifiers(){return this.modifierStack.pop()}didAppendBounds(e){return this.block().didAppendBounds(e),e}didAppendNode(e){return this.block().didAppendNode(e),e}didOpenElement(e){return this.block().openElement(e),e}willCloseElement(){this.block().closeElement()}appendText(e){return this.didAppendNode(this.__appendText(e))}__appendText(e){let{dom:t,element:n,nextSibling:r}=this,i=t.createTextNode(e);return t.insertBefore(n,i,r),i}__appendNode(e){return this.dom.insertBefore(this.element,e,this.nextSibling),e}__appendFragment(e){let t=e.firstChild;if(t){let n=new gg(this.element,t,e.lastChild);return this.dom.insertBefore(this.element,e,this.nextSibling),n}{const e=this.__appendComment("");return new gg(this.element,e,e)}}__appendHTML(e){return this.dom.insertHTMLBefore(this.element,this.nextSibling,e)}appendDynamicHTML(e){let t=this.trustedContent(e);this.didAppendBounds(t)}appendDynamicText(e){let t=this.untrustedContent(e);return this.didAppendNode(t),t}appendDynamicFragment(e){let t=this.__appendFragment(e);this.didAppendBounds(t)}appendDynamicNode(e){let t=this.__appendNode(e),n=new gg(this.element,t,t);this.didAppendBounds(n)}trustedContent(e){return this.__appendHTML(e)}untrustedContent(e){return this.__appendText(e)}appendComment(e){return this.didAppendNode(this.__appendComment(e))}__appendComment(e){let{dom:t,element:n,nextSibling:r}=this,i=t.createComment(e);return t.insertBefore(n,i,r),i}__setAttribute(e,t,n){this.dom.setAttribute(this.constructing,e,t,n)}__setProperty(e,t){this.constructing[e]=t}setStaticAttribute(e,t,n){this.__setAttribute(e,t,n)}setDynamicAttribute(e,t,n,r){let i=Bg(this.constructing,e,r);return i.set(this,t,this.env),i}},em=class{first=null;last=null;nesting=0;constructor(e){this.parent=e}parentElement(){return this.parent}firstNode(){return this.first.firstNode()}lastNode(){return this.last.lastNode()}openElement(e){this.didAppendNode(e),this.nesting++}closeElement(){this.nesting--}didAppendNode(e){0===this.nesting&&(this.first||(this.first=new Xg(e)),this.last=new Jg(e))}didAppendBounds(e){0===this.nesting&&(this.first||(this.first=e),this.last=e)}finalize(e){null===this.first&&e.appendComment("")}},tm=class extends em{constructor(e){super(e),ee(this,()=>{this.parentElement()===this.firstNode().parentNode&&yg(this)})}},nm=class extends em{constructor(e){super(e)}reset(){te(this);let e=yg(this);return this.first=null,this.last=null,this.nesting=0,e}},rm=class{constructor(e,t){this.parent=e,this.boundList=t,this.parent=e,this.boundList=t}parentElement(){return this.parent}firstNode(){return this.boundList[0].firstNode()}lastNode(){let e=this.boundList;return e[e.length-1].lastNode()}openElement(e){}closeElement(){}didAppendNode(e){}didAppendBounds(e){}finalize(e){this.boundList.length}};function im(e,t){return Qg.forInitialRender(e,t)}var sm={foreignObject:1,desc:1,title:1},om=Object.create(null),am=class{constructor(e){this.document=e,this.setupUselessElement()}setupUselessElement(){this.uselessElement=this.document.createElement("div")}createElement(e,t){let n,r,i,s;if(t?(n="http://www.w3.org/2000/svg"===t.namespaceURI||"svg"===e,i=t.namespaceURI===Eg||"math"===e,r=!!sm[t.tagName]):(n="svg"===e,i="math"===e,r=!1),!i&&!n||r)return this.document.createElement(e);if(om[e])throw new Error(`Cannot create a ${e} inside an SVG context`);return s=i?Eg:"http://www.w3.org/2000/svg",this.document.createElementNS(s,e)}insertBefore(e,t,n){e.insertBefore(t,n)}insertHTMLBefore(e,t,n){if(""===n){const n=this.createComment("");return e.insertBefore(n,t),new gg(e,n,n)}const r=t?t.previousSibling:e.lastChild;let i;if(null===t)e.insertAdjacentHTML("beforeend",n),i=e.lastChild;else if(t instanceof HTMLElement)t.insertAdjacentHTML("beforebegin",n),i=t.previousSibling;else{const{uselessElement:r}=this;e.insertBefore(r,t),r.insertAdjacentHTML("beforebegin",n),i=r.previousSibling,e.removeChild(r)}const s=r?r.nextSibling:e.firstChild;return new gg(e,s,i)}createTextNode(e){return this.document.createTextNode(e)}createComment(e){return this.document.createComment(e)}},lm=class extends am{createElementNS(e,t){return this.document.createElementNS(e,t)}setAttribute(e,t,n,r=null){r?e.setAttributeNS(r,t,n):e.setAttribute(t,n)}};function cm(e){return e}function um(e){return"getDebugCustomRenderTree"in e}new class{validate(e){switch(e){case 4:case 5:case 3:case 2:case 1:case 0:case 6:case 7:case 8:return!0;default:return!1}}expected(){return"Register"}};var hm=Symbol("TYPE"),dm=Symbol("INNER"),pm=Symbol("OWNER"),fm=Symbol("ARGS"),gm=Symbol("RESOLVED"),mm=new WeakSet;function ym(e){return mm.has(e)}function vm(e,t){return ym(e)&&e[hm]===t}var bm=class{[hm];[dm];[pm];[fm];[gm];constructor(e,t,n,r,i=!1){mm.add(this),this[hm]=e,this[dm]=t,this[pm]=n,this[fm]=r,this[gm]=i}};function wm(e){let t,n,r,i,s,o=e;for(;;){let{[fm]:e,[dm]:a}=o;if(null!==e){let{named:r,positional:i}=e;i.length>0&&(t=void 0===t?i:i.concat(t)),void 0===n&&(n=[]),n.unshift(r)}if(!ym(a)){r=a,i=o[pm],s=o[gm];break}o=a}return{definition:r,owner:i,resolved:s,positional:t,named:n}}function _m(e,t,n,r,i=!1){return new bm(e,t,n,r,i)}var xm=0,Cm=class{id=xm++;value;constructor(e){this.value=e}get(){return this.value}release(){this.value=null}toString(){let e=`Ref ${this.id}`;if(null===this.value)return`${e} (released)`;try{return`${e}: ${this.value}`}catch{return e}}},Sm=class{stack=new it;refs=new WeakMap;roots=new Set;nodes=new WeakMap;begin(){this.reset()}create(e,t){let n=Np({},t,{bounds:null,refs:new Set});this.nodes.set(e,n),this.appendChild(n,e),this.enter(e)}update(e){this.enter(e)}didRender(e,t){this.nodeFor(e).bounds=t,this.exit()}willDestroy(e){this.refs.get(e).release()}commit(){this.reset()}capture(){return this.captureRefs(this.roots)}reset(){if(0!==this.stack.size){let e=this.stack.toArray()[0],t=this.refs.get(e);for(void 0!==t&&this.roots.delete(t);!this.stack.isEmpty();)this.stack.pop()}}enter(e){this.stack.push(e)}exit(){this.stack.pop()}nodeFor(e){return this.nodes.get(e)}appendChild(e,t){let n=this.stack.current,r=new Cm(t);if(this.refs.set(t,r),n){let t=this.nodeFor(n);t.refs.add(r),e.parent=t}else this.roots.add(r)}captureRefs(e){let t=[];return e.forEach(n=>{let r=n.get();r?t.push(this.captureNode(`render-node:${n.id}`,r)):e.delete(n)}),t}captureNode(e,t){let n=this.nodeFor(t),{type:r,name:i,args:s,instance:o,refs:a}=n,l=this.captureBounds(n),c=this.captureRefs(a);return{id:e,type:r,name:i,args:iy(s),instance:o,bounds:l,children:c}}captureBounds(e){let t=e.bounds;return{parentElement:t.parentElement(),firstNode:t.firstNode(),lastNode:t.lastNode()}}},km=new class{evaluateOpcode=new Array(113).fill(null);constructor(){}add(e,t,n="syscall"){this.evaluateOpcode[e]={syscall:"machine"!==n,evaluate:t}}evaluate(e,t,n){let r=this.evaluateOpcode[n];r.syscall?(t.isMachine,r.syscall,t.isMachine,t.type,r.evaluate(e,t)):(t.isMachine,r.syscall,t.isMachine,t.type,r.evaluate(e.lowlevel,t))}};km.add(39,e=>e.pushChildScope()),km.add(40,e=>e.popScope()),km.add(59,e=>e.pushDynamicScope()),km.add(60,e=>e.popDynamicScope()),km.add(28,(e,{op1:t})=>{e.stack.push(e.constants.getValue(t))}),km.add(29,(e,{op1:t})=>{e.stack.push(dt(e.constants.getValue(t)))}),km.add(30,(e,{op1:t})=>{let n=e.stack;if(t>=0){let r=e.constants.getValue(t);n.push(r)}else n.push(Tp(t))}),km.add(31,e=>{let t,n=e.stack,r=cm(n.pop());t=void 0===r?lt:null===r?ct:!0===r?ut:!1===r?ht:at(r),n.push(t)}),km.add(33,(e,{op1:t,op2:n})=>{let r=cm(e.fetchValue(cm(t)))-n;e.stack.dup(r)}),km.add(34,(e,{op1:t})=>{e.stack.pop(t)}),km.add(35,(e,{op1:t})=>{e.load(cm(t))}),km.add(36,(e,{op1:t})=>{e.fetch(cm(t))}),km.add(58,(e,{op1:t})=>{let n=e.constants.getArray(t);e.bindDynamicScope(n)}),km.add(69,(e,{op1:t})=>{e.enter(t)}),km.add(70,e=>{e.exit()}),km.add(63,(e,{op1:t})=>{e.stack.push(e.constants.getValue(t))}),km.add(62,e=>{e.stack.push(e.scope())}),km.add(61,e=>{let t=e.stack,n=t.pop();n?t.push(e.compile(n)):t.push(null)}),km.add(64,e=>{let{stack:t}=e,n=cm(t.pop()),r=cm(t.pop()),i=cm(t.pop()),s=cm(t.pop());if(null===i||null===n)return e.lowlevel.pushFrame(),void e.pushScope(r??e.scope());let o=r;{let e=i.parameters,t=e.length;if(t>0){o=o.child();for(let n=0;n<t;n++)o.bindSymbol(Ye(e[n]),s.at(n))}}e.lowlevel.pushFrame(),e.pushScope(o),e.call(n)}),km.add(65,(e,{op1:t})=>{let n=cm(e.stack.pop()),r=Boolean(wt(n));vt(n)?r&&e.lowlevel.goto(t):(r&&e.lowlevel.goto(t),e.updateWith(new Em(n)))}),km.add(66,(e,{op1:t})=>{let n=cm(e.stack.pop()),r=Boolean(wt(n));vt(n)?r||e.lowlevel.goto(t):(r||e.lowlevel.goto(t),e.updateWith(new Em(n)))}),km.add(67,(e,{op1:t,op2:n})=>{cm(e.stack.peek())===n&&e.lowlevel.goto(t)}),km.add(68,e=>{let t=cm(e.stack.peek());vt(t)||e.updateWith(new Em(t))}),km.add(71,e=>{let{stack:t}=e,n=cm(t.pop());t.push(ft(()=>U(wt(n))))});var Em=class{last;constructor(e){this.ref=e,this.last=wt(e)}evaluate(e){let{last:t,ref:n}=this;t!==wt(n)&&e.throw()}},Rm=class{last;constructor(e,t){this.ref=e,this.filter=t,this.last=t(wt(e))}evaluate(e){let{last:t,ref:n,filter:r}=this;t!==r(wt(n))&&e.throw()}},Tm=class{tag=me;lastRevision=1;target;finalize(e,t){this.target=t,this.didModify(e)}evaluate(e){let{tag:t,target:n,lastRevision:r}=this;!e.alwaysRevalidate&&ce(t,r)&&(Ne(t),e.goto(n))}didModify(e){this.tag=e,this.lastRevision=le(this.tag),Ne(e)}},Lm=class{constructor(e){this.debugLabel=e}evaluate(){Le(this.debugLabel)}},Im=class{constructor(e){this.target=e}evaluate(){let e=Ie();this.target.didModify(e)}};km.add(41,(e,{op1:t})=>{e.tree().appendText(e.constants.getValue(t))}),km.add(42,(e,{op1:t})=>{e.tree().appendComment(e.constants.getValue(t))}),km.add(48,(e,{op1:t})=>{e.tree().openElement(e.constants.getValue(t))}),km.add(49,e=>{let t=cm(wt(cm(e.stack.pop())));e.tree().openElement(t)}),km.add(50,e=>{let t=cm(e.stack.pop()),n=cm(e.stack.pop()),r=cm(e.stack.pop()),i=cm(wt(t)),s=cm(wt(n)),o=wt(r);vt(t)||e.updateWith(new Em(t)),void 0===s||vt(n)||e.updateWith(new Em(n));let a=e.tree().pushRemoteElement(i,o,s);if(e.associateDestroyable(a),void 0!==e.env.debugRenderTree){let r=Ym(void 0===s?{}:{insertBefore:n},[t]);e.env.debugRenderTree.create(a,{type:"keyword",name:"in-element",args:r,instance:null}),ee(a,()=>{e.env.debugRenderTree?.willDestroy(a)})}}),km.add(56,e=>{let t=e.tree().popRemoteElement();void 0!==e.env.debugRenderTree&&e.env.debugRenderTree.didRender(t,t)}),km.add(54,e=>{let t=cm(e.fetchValue(6)),n=null;t&&(n=t.flush(e),e.loadValue(6,null)),e.tree().flushElement(n)}),km.add(55,e=>{let t=e.tree().closeElement();null!==t&&t.forEach(t=>{e.env.scheduleInstallModifier(t);const n=t.manager.getDestroyable(t.state);null!==n&&e.associateDestroyable(n)})}),km.add(57,(e,{op1:t})=>{let n=cm(e.stack.pop());if(!e.env.isInteractive)return;let r=e.getOwner(),i=e.constants.getValue(t),{manager:s}=i,{constructing:o}=e.tree(),a=n.capture(),l=s.create(r,o,i.state,a),c={manager:s,state:l,definition:i};cm(e.fetchValue(6)).addModifier(e,c,a);let u=s.getTag(l);return null!==u?(Ne(u),e.updateWith(new Pm(u,c))):void 0}),km.add(108,e=>{let{stack:t}=e,n=cm(t.pop()),r=cm(t.pop());if(!e.env.isInteractive)return;let i=r.capture(),{positional:s,named:o}=i,{constructing:a}=e.tree(),l=e.getOwner(),c=ft(()=>{let e,t,r=wt(n);if(!rt(r))return;if(vm(r,2)){let{definition:n,owner:a,positional:l,named:c}=wm(r);t=n,e=a,void 0!==l&&(i.positional=l.concat(s)),void 0!==c&&(i.named=Object.assign({},...c,o))}else t=r,e=l;let c=Pu(t);if(null===c)throw new Error("BUG: modifier manager expected");let u={resolvedName:null,manager:c,state:t};return{manager:c,state:c.create(e,a,u.state,i),definition:u}}),u=wt(c),h=null;return void 0!==u&&(cm(e.fetchValue(6)).addModifier(e,u,i),h=u.manager.getTag(u.state),null!==h&&Ne(h)),!vt(n)||h?e.updateWith(new Mm(h,u,c)):void 0});var Pm=class{lastUpdated;constructor(e,t){this.tag=e,this.modifier=t,this.lastUpdated=le(e)}evaluate(e){let{modifier:t,tag:n,lastUpdated:r}=this;Ne(n),ce(n,r)||(e.env.scheduleUpdateModifier(t),this.lastUpdated=le(n))}},Mm=class{lastUpdated;constructor(e,t,n){this.tag=e,this.instance=t,this.instanceRef=n,this.lastUpdated=le(e??_e)}evaluate(e){let{tag:t,lastUpdated:n,instance:r,instanceRef:i}=this,s=wt(i);if(s!==r){if(void 0!==r){let e=r.manager.getDestroyable(r.state);null!==e&&te(e)}if(void 0!==s){let{manager:n,state:r}=s,i=n.getDestroyable(r);null!==i&&Q(this,i),t=n.getTag(r),null!==t&&(this.lastUpdated=le(t)),this.tag=t,e.env.scheduleInstallModifier(s)}this.instance=s}else null===t||ce(t,n)||(e.env.scheduleUpdateModifier(r),this.lastUpdated=le(t));null!==t&&Ne(t)}};km.add(51,(e,{op1:t,op2:n,op3:r})=>{let i=e.constants.getValue(t),s=e.constants.getValue(n),o=r?e.constants.getValue(r):null;e.tree().setStaticAttribute(i,s,o)}),km.add(52,(e,{op1:t,op2:n,op3:r})=>{let i=e.constants.getValue(t),s=e.constants.getValue(n),o=cm(e.stack.pop()),a=wt(o),l=r?e.constants.getValue(r):null,c=e.tree().setDynamicAttribute(i,a,s,l);vt(o)||e.updateWith(new Am(o,c,e.env))});var Am=class{updateRef;constructor(e,t,n){let r=!1;this.updateRef=ft(()=>{let i=wt(e);r?t.update(i,n):r=!0}),wt(this.updateRef)}evaluate(){wt(this.updateRef)}};km.add(78,(e,{op1:t})=>{let n=e.constants.getValue(t),{manager:r,capabilities:i}=n,s={definition:n,manager:r,capabilities:i,state:null,handle:null,table:null,lookup:null};e.stack.push(s)}),km.add(80,(e,{op1:t})=>{let n,r=e.stack,i=cm(wt(cm(r.pop()))),s=e.constants,o=e.getOwner();if(s.getValue(t),e.loadValue(7,null),"string"==typeof i){let t=function(e,t,n,r){let i=e?.lookupComponent?.(n,r)??null;return t.resolvedComponent(i,n)}(e.context.resolver,s,i,o);n=t}else n=ym(i)?i:s.component(i,o);r.push(n)}),km.add(81,e=>{let t,n=e.stack,r=wt(cm(n.pop())),i=e.constants;t=ym(r)?r:i.component(r,e.getOwner(),!0),n.push(t)}),km.add(79,e=>{let t,n,{stack:r}=e,i=r.pop();ym(i)?n=t=null:(n=i.manager,t=i.capabilities),r.push({definition:i,capabilities:t,manager:n,state:null,handle:null,table:null})}),km.add(82,(e,{op1:t,op2:n,op3:r})=>{let i=e.stack,s=e.constants.getArray(t),o=r>>4,a=8&r,l=7&r?e.constants.getArray(n):Bp;e.args.setup(i,s,l,o,!!a),i.push(e.args)}),km.add(83,e=>{let{stack:t}=e;t.push(e.args.empty(t))}),km.add(86,e=>{let t=e.stack,n=cm(t.pop()).capture();t.push(n)}),km.add(85,(e,{op1:t})=>{let n=e.stack,r=e.fetchValue(cm(t)),i=cm(n.pop()),{definition:s}=r;if(vm(s,0)){s.manager;let t=e.constants,{definition:n,owner:o,resolved:a,positional:l,named:c}=wm(s);if(a)s=n;else if("string"==typeof n){let r=e.context.resolver?.lookupComponent?.(n,o)??null;s=t.resolvedComponent(r,n)}else s=t.component(n,o);void 0!==c&&i.named.merge(Np({},...c)),void 0!==l&&(i.realloc(l.length),i.positional.prepend(l));let{manager:u}=s;r.definition=s,r.manager=u,r.capabilities=s.capabilities,e.loadValue(7,o)}let{manager:o,state:a}=s;if(!yu(0,r.capabilities,pu.prepareArgs))return void n.push(i);let l=i.blocks.values,c=i.blocks.names,u=o.prepareArgs(a,i);if(u){i.clear();for(let i=0;i<l.length;i++)n.push(l[i]);let{positional:e,named:t}=u,r=e.length;for(let i=0;i<r;i++)n.push(e[i]);let s=Object.keys(t);for(let i=0;i<s.length;i++)n.push(t[Ye(s[i])]);i.setup(n,s,c,r,!1)}n.push(i)}),km.add(87,(e,{op1:t})=>{let n=cm(e.fetchValue(4)),{definition:r,manager:i,capabilities:s}=n;if(!yu(0,s,pu.createInstance))return;let o=null;yu(0,s,pu.dynamicScope)&&(o=e.dynamicScope());let a=1&t,l=null;yu(0,s,pu.createArgs)&&(l=cm(e.stack.peek()));let c=null;yu(0,s,pu.createCaller)&&(c=e.getSelf());let u=i.create(e.getOwner(),r.state,l,e.env,o,c,!!a);n.state=u,yu(0,s,pu.updateHook)&&e.updateWith(new zm(u,i,o))}),km.add(88,(e,{op1:t})=>{let{manager:n,state:r,capabilities:i}=cm(e.fetchValue(cm(t))),s=n.getDestroyable(r);s&&e.associateDestroyable(s)}),km.add(97,(e,{op1:t})=>{e.beginCacheGroup(void 0),e.tree().pushAppendingBlock()}),km.add(89,e=>{e.loadValue(6,new Om)}),km.add(53,(e,{op1:t,op2:n,op3:r})=>{let i=e.constants.getValue(t),s=e.constants.getValue(n),o=cm(e.stack.pop()),a=r?e.constants.getValue(r):null;cm(e.fetchValue(6)).setAttribute(i,o,s,a)}),km.add(105,(e,{op1:t,op2:n,op3:r})=>{let i=e.constants.getValue(t),s=e.constants.getValue(n),o=r?e.constants.getValue(r):null;cm(e.fetchValue(6)).setStaticAttribute(i,s,o)});var Om=class{attributes=tt();classes=[];modifiers=[];setAttribute(e,t,n,r){let i={value:t,namespace:r,trusting:n};"class"===e&&this.classes.push(t),this.attributes[e]=i}setStaticAttribute(e,t,n){let r={value:t,namespace:n};"class"===e&&this.classes.push(t),this.attributes[e]=r}addModifier(e,t,n){if(this.modifiers.push(t),void 0!==e.env.debugRenderTree){const{manager:r,definition:i,state:s}=t;if(null===s||"object"!=typeof s&&"function"!=typeof s)return;let{element:o,constructing:a}=e.tree(),l=i.resolvedName??r.getDebugName(i.state),c=r.getDebugInstance(s),u=new gg(o,a,a);e.env.debugRenderTree.create(s,{type:"modifier",name:l,args:n,instance:c}),e.env.debugRenderTree.didRender(s,u),e.associateDestroyable(s),e.updateWith(new Um(s)),e.updateWith(new Bm(s,u)),ee(s,()=>{e.env.debugRenderTree?.willDestroy(s)})}}flush(e){let t,n=this.attributes;for(let r in this.attributes){if("type"===r){t=n[r];continue}let i=Ye(this.attributes[r]);"class"===r?Fm(e,"class",Nm(this.classes),i.namespace,i.trusting):Fm(e,r,i.value,i.namespace,i.trusting)}return void 0!==t&&Fm(e,"type",t.value,t.namespace,t.trusting),this.modifiers}};function Nm(e){return 0===e.length?"":1===e.length?e[0]:function(e){return e.every(e=>"string"==typeof e)}(e)?e.join(" "):(t=e,ft(()=>{let e=[];for(const n of t){let t=vg("string"==typeof n?n:wt(n));t&&e.push(t)}return 0===e.length?null:e.join(" ")}));var t}function Fm(e,t,n,r,i=!1){if("string"==typeof n)e.tree().setStaticAttribute(t,n,r);else{let s=e.tree().setDynamicAttribute(t,wt(n),i,r);vt(n)||e.updateWith(new Am(n,s,e.env))}}function Dm(e,t,n,r,i){let s=n.table.symbols.indexOf(e),o=r.get(t);-1!==s&&i.scope().bindBlock(s+1,o),n.lookup&&(n.lookup[e]=o)}km.add(99,(e,{op1:t})=>{let{definition:n,state:r}=cm(e.fetchValue(cm(t))),{manager:i}=n,s=cm(e.fetchValue(6));i.didCreateElement(r,e.tree().constructing,s)}),km.add(90,(e,{op1:t,op2:n})=>{let{definition:r,state:i}=cm(e.fetchValue(cm(t))),{manager:s}=r,o=s.getSelf(i);if(void 0!==e.env.debugRenderTree){let r,s=cm(e.fetchValue(cm(t))),{definition:a,manager:l}=s;if(e.stack.peek()===e.args)r=e.args.capture();else{let t=e.constants.getArray(n);e.args.setup(e.stack,t,[],0,!0),r=e.args.capture()}let c=a.compilable;if(null===c){yu(0,s.capabilities,pu.dynamicLayout);let t=e.context.resolver;c=null===t?null:l.getDynamicLayout(i,t)}if(e.associateDestroyable(s),um(l))l.getDebugCustomRenderTree(s.definition.state,s.state,r).forEach(t=>{let{bucket:n}=t;e.env.debugRenderTree.create(n,t),ee(s,()=>{e.env.debugRenderTree?.willDestroy(n)}),e.updateWith(new Um(n))});else{let t=function(e,t=e.manager){return e.resolvedName??e.debugName??t.getDebugName(e.state)}(a,l);e.env.debugRenderTree.create(s,{type:"component",name:t,args:r,instance:wt(o)}),ee(s,()=>{e.env.debugRenderTree?.willDestroy(s)}),e.updateWith(new Um(s))}}e.stack.push(o)}),km.add(91,(e,{op1:t})=>{let{definition:n,state:r}=cm(e.fetchValue(cm(t))),{manager:i}=n,s=i.getTagName(r);e.stack.push(s)}),km.add(92,(e,{op1:t})=>{let n=cm(e.fetchValue(cm(t))),{manager:r,definition:i}=n,{stack:s}=e,{compilable:o}=i;if(null===o){let{capabilities:t}=n;yu(0,t,pu.dynamicLayout);let i=e.context.resolver;o=null===i?null:r.getDynamicLayout(n.state,i),null===o&&(o=yu(0,t,pu.wrapped)?Ip(e.constants.defaultTemplate).asWrappedLayout():Ip(e.constants.defaultTemplate).asLayout())}let a=o.compile(e.context);s.push(o.symbolTable),s.push(a)}),km.add(75,(e,{op1:t})=>{let n=cm(e.stack.pop()),r=cm(e.stack.pop()),{manager:i,capabilities:s}=n,o={definition:n,manager:i,capabilities:s,state:null,handle:r.handle,table:r.symbolTable,lookup:null};e.loadValue(cm(t),o)}),km.add(95,(e,{op1:t})=>{let{stack:n}=e,r=cm(n.pop()),i=cm(n.pop()),s=cm(e.fetchValue(cm(t)));s.handle=r,s.table=i}),km.add(38,(e,{op1:t})=>{let n,{table:r,manager:i,capabilities:s,state:o}=cm(e.fetchValue(cm(t)));yu(0,s,pu.hasSubOwner)?(n=i.getOwner(o),e.loadValue(7,null)):(n=e.fetchValue(7),null===n?n=e.getOwner():e.loadValue(7,null)),e.pushRootScope(r.symbols.length+1,n)}),km.add(17,(e,{op1:t})=>{let n=cm(e.fetchValue(cm(t))),r=e.scope(),i=cm(e.stack.peek()),s=i.named.atNames;for(let o=s.length-1;o>=0;o--){let e=Ye(s[o]),t=n.table.symbols.indexOf(e),a=i.named.get(e,!0);-1!==t&&r.bindSymbol(t+1,a),n.lookup&&(n.lookup[e]=a)}}),km.add(18,(e,{op1:t})=>{let n=cm(e.fetchValue(cm(t))),{blocks:r}=cm(e.stack.peek());for(const[i]of Wp(r.names))Dm(Ye(r.symbolNames[i]),Ye(r.names[i]),n,r,e)}),km.add(96,(e,{op1:t})=>{let n=cm(e.fetchValue(cm(t)));e.call(n.handle)}),km.add(100,(e,{op1:t})=>{let n=cm(e.fetchValue(cm(t))),{manager:r,state:i,capabilities:s}=n,o=e.tree().popBlock();void 0!==e.env.debugRenderTree&&(um(r)?r.getDebugCustomRenderTree(n.definition.state,i,ay).reverse().forEach(t=>{let{bucket:n}=t;e.env.debugRenderTree.didRender(n,o),e.updateWith(new Bm(n,o))}):(e.env.debugRenderTree.didRender(n,o),e.updateWith(new Bm(n,o)))),yu(0,s,pu.createInstance)&&(cm(r).didRenderLayout(i,o),e.env.didCreate(n),e.updateWith(new jm(n,o)))}),km.add(98,e=>{e.commitCacheGroup()});var zm=class{constructor(e,t,n){this.component=e,this.manager=t,this.dynamicScope=n}evaluate(e){let{component:t,manager:n,dynamicScope:r}=this;n.update(t,r)}},jm=class{constructor(e,t){this.component=e,this.bounds=t}evaluate(e){let{component:t,bounds:n}=this,{manager:r,state:i}=t;r.didUpdateLayout(i,n),e.env.didUpdate(t)}},Um=class{constructor(e){this.bucket=e}evaluate(e){e.env.debugRenderTree?.update(this.bucket)}},Bm=class{constructor(e,t){this.bucket=e,this.bounds=t}evaluate(e){e.env.debugRenderTree?.didRender(this.bucket,this.bounds)}},$m=(new class{validate(e){return"object"==typeof e&&null!==e&&st in e}expected(){return"Reference"}},class{stack=null;positional=new Vm;named=new Wm;blocks=new Km;constructor(){}empty(e){let t=e.registers[3]+1;return this.named.empty(e,t),this.positional.empty(e,t),this.blocks.empty(e,t),this}setup(e,t,n,r,i){this.stack=e;let s=this.named,o=t.length,a=e.registers[3]-o+1;s.setup(e,a,o,t,i);let l=a-r;this.positional.setup(e,l,r);let c=this.blocks,u=n.length,h=l-3*u;c.setup(e,h,u,n)}get base(){return this.blocks.base}get length(){return this.positional.length+this.named.length+3*this.blocks.length}at(e){return this.positional.at(e)}realloc(e){let{stack:t}=this;if(e>0&&null!==t){let{positional:n,named:r}=this,i=n.base+e;for(let e=n.length+r.length-1;e>=0;e--)t.copy(e+n.base,e+i);n.base+=e,r.base+=e,t.registers[3]+=e}}capture(){let e=0===this.positional.length?oy:this.positional.capture();return{named:0===this.named.length?sy:this.named.capture(),positional:e}}clear(){let{stack:e,length:t}=this;t>0&&null!==e&&e.pop(t)}}),qm=Up(),Vm=class{base=0;length=0;stack=null;_references=null;constructor(){}empty(e,t){this.stack=e,this.base=t,this.length=0,this._references=qm}setup(e,t,n){this.stack=e,this.base=t,this.length=n,this._references=0===n?qm:null}at(e){let{base:t,length:n,stack:r}=this;return e<0||e>=n?lt:cm(r.get(e,t))}capture(){return this.references}prepend(e){let t=e.length;if(t>0){let{base:n,length:r,stack:i}=this;this.base=n-=t,this.length=r+t;for(let s=0;s<t;s++)i.set(e[s],s,n);this._references=null}}get references(){let e=this._references;if(!e){let{stack:t,base:n,length:r}=this;e=this._references=t.slice(n,n+r)}return e}},Wm=class{base=0;length=0;_references=null;_names=Bp;_atNames=Bp;constructor(){}empty(e,t){this.stack=e,this.base=t,this.length=0,this._references=qm,this._names=Bp,this._atNames=Bp}setup(e,t,n,r,i){this.stack=e,this.base=t,this.length=n,0===n?(this._references=qm,this._names=Bp,this._atNames=Bp):(this._references=null,i?(this._names=null,this._atNames=r):(this._names=r,this._atNames=null))}get names(){let e=this._names;return e||(e=this._names=this._atNames.map(this.toSyntheticName)),e}get atNames(){let e=this._atNames;return e||(e=this._atNames=this._names.map(this.toAtName)),e}has(e){return-1!==this.names.indexOf(e)}get(e,t=!1){let{base:n,stack:r}=this,i=(t?this.atNames:this.names).indexOf(e);return-1===i?lt:r.get(i,n)}capture(){let{names:e,references:t}=this,n=tt();for(const[r,i]of Wp(e))n[i]=Ye(t[r]);return n}merge(e){let t=Object.keys(e);if(t.length>0){let{names:n,length:r,stack:i}=this,s=n.slice();for(const o of t)-1===s.indexOf(o)&&(r=s.push(o),i.push(e[o]));this.length=r,this._references=null,this._names=s,this._atNames=null}}get references(){let e=this._references;if(!e){let{base:t,length:n,stack:r}=this;e=this._references=r.slice(t,t+n)}return e}toSyntheticName(e){return e.slice(1)}toAtName(e){return`@${e}`}};function Hm(e){return`&${e}`}var Gm=Up(),Km=class{internalValues=null;_symbolNames=null;internalTag=null;names=Bp;length=0;base=0;constructor(){}empty(e,t){this.stack=e,this.names=Bp,this.base=t,this.length=0,this._symbolNames=null,this.internalTag=me,this.internalValues=Gm}setup(e,t,n,r){this.stack=e,this.names=r,this.base=t,this.length=n,this._symbolNames=null,0===n?(this.internalTag=me,this.internalValues=Gm):(this.internalTag=null,this.internalValues=null)}get values(){let e=this.internalValues;if(!e){let{base:t,length:n,stack:r}=this;e=this.internalValues=r.slice(t,t+3*n)}return e}has(e){return-1!==this.names.indexOf(e)}get(e){let t=this.names.indexOf(e);if(-1===t)return null;let{base:n,stack:r}=this,i=cm(r.get(3*t,n)),s=cm(r.get(3*t+1,n)),o=cm(r.get(3*t+2,n));return null===o?null:[o,s,i]}capture(){return new Zm(this.names,this.values)}get symbolNames(){let e=this._symbolNames;return null===e&&(e=this._symbolNames=this.names.map(Hm)),e}},Zm=class{length;constructor(e,t){this.names=e,this.values=t,this.length=e.length}has(e){return-1!==this.names.indexOf(e)}get(e){let t=this.names.indexOf(e);return-1===t?null:[this.values[3*t+2],this.values[3*t+1],this.values[3*t]]}};function Ym(e,t){return{named:e,positional:t}}function Xm(e){let t=tt();for(const[n,r]of Object.entries(e))t[n]=wt(r);return t}function Jm(e){return e.map(wt)}function Qm(e){return{named:Xm(e.named),positional:Jm(e.positional)}}var ey=Symbol("ARGUMENT_ERROR");function ty(e){return null!==e&&"object"==typeof e&&e[ey]}function ny(e){return{[ey]:!0,error:e}}function ry(e){let t=tt();for(const[r,i]of Object.entries(e))try{t[r]=wt(i)}catch(n){t[r]=ny(n)}return t}function iy(e){return{named:ry(e.named),positional:(t=e.positional,t.map(e=>{try{return wt(e)}catch(t){return ny(t)}}))};var t}var sy=Object.freeze(Object.create(null)),oy=qm,ay=Ym(sy,oy),ly=a({FALSE_REFERENCE:()=>ht,NULL_REFERENCE:()=>ct,REFERENCE:()=>st,TRUE_REFERENCE:()=>ut,UNDEFINED_REFERENCE:()=>lt,childRefFor:()=>xt,childRefFromParts:()=>Ct,createComputeRef:()=>ft,createConstRef:()=>dt,createDebugAliasRef:()=>{},createInvokableRef:()=>yt,createIteratorItemRef:()=>yy,createIteratorRef:()=>my,createPrimitiveRef:()=>at,createReadOnlyRef:()=>gt,createUnboundRef:()=>pt,isConstRef:()=>vt,isInvokableRef:()=>mt,isUpdatableRef:()=>bt,updateRef:()=>_t,valueForRef:()=>wt}),cy={},uy=(e,t)=>t,hy=(e,t)=>String(t),dy=e=>null===e?cy:e,py=class{_weakMap;_primitiveMap;get weakMap(){return void 0===this._weakMap&&(this._weakMap=new WeakMap),this._weakMap}get primitiveMap(){return void 0===this._primitiveMap&&(this._primitiveMap=new Map),this._primitiveMap}set(e,t){rt(e)?this.weakMap.set(e,t):this.primitiveMap.set(e,t)}get(e){return rt(e)?this.weakMap.get(e):this.primitiveMap.get(e)}},fy=new py;function gy(e){let t=new py;return(n,r)=>{let i=e(n,r),s=t.get(i)||0;return t.set(i,s+1),0===s?i:function(e,t){let n=fy.get(e);void 0===n&&(n=[],fy.set(e,n));let r=n[t];return void 0===r&&(r={value:e,count:t},n[t]=r),r}(i,s)}}function my(e,t){return ft(()=>{let n=wt(e),r=function(e){switch(e){case"@key":return gy(uy);case"@index":return gy(hy);case"@identity":return gy(dy);default:return t=e,gy(e=>null==e?e:q(e,t))}var t}(t);if(Array.isArray(n))return new by(n,r);let i=j(n);return null===i?new by(jp,()=>null):new vy(i,r)})}function yy(e){let t=e,n=fe();return ft(()=>(Ne(n),t),e=>{t!==e&&(t=e,de(n))})}var vy=class{constructor(e,t){this.inner=e,this.keyFor=t}isEmpty(){return this.inner.isEmpty()}next(){let e=this.inner.next();return null!==e&&(e.key=this.keyFor(e.value,e.memo)),e}},by=class{current;pos=0;constructor(e,t){this.iterator=e,this.keyFor=t,0===e.length?this.current={kind:"empty"}:this.current={kind:"first",value:e[this.pos]}}isEmpty(){return"empty"===this.current.kind}next(){let e,t=this.current;if("first"===t.kind)this.current={kind:"progress"},e=t.value;else{if(this.pos>=this.iterator.length-1)return null;e=this.iterator[++this.pos]}let{keyFor:n}=this;return{key:n(e,this.pos),value:e,memo:this.pos}}},wy=class e{bucket;constructor(e){this.bucket=e?Np({},e):{}}get(e){return this.bucket[e]}set(e,t){return this.bucket[e]=t}child(){return new e(this.bucket)}},_y=class e{static root(t,{self:n,size:r=0}){let i=new Array(r+1).fill(lt);return new e(t,i,null).init({self:n})}static sized(t,n=0){let r=new Array(n+1).fill(lt);return new e(t,r,null)}owner;slots;callerScope;constructor(e,t,n){this.owner=e,this.slots=t,this.callerScope=n}init({self:e}){return this.slots[0]=e,this}snapshot(){return this.slots.slice()}getSelf(){return this.get(0)}getSymbol(e){return this.get(e)}getBlock(e){let t=this.get(e);return t===lt?null:t}bind(e,t){this.set(e,t)}bindSelf(e){this.set(0,e)}bindSymbol(e,t){this.set(e,t)}bindBlock(e,t){this.set(e,t)}bindCallerScope(e){this.callerScope=e}getCallerScope(){return this.callerScope}child(){return new e(this.owner,this.slots.slice(),this.callerScope)}get(e){if(e>=this.slots.length)throw new RangeError(`BUG: cannot get $${e} from scope; length=${this.slots.length}`);return this.slots[e]}set(e,t){if(e>=this.slots.length)throw new RangeError(`BUG: cannot get $${e} from scope; length=${this.slots.length}`);this.slots[e]=t}};["b","big","blockquote","body","br","center","code","dd","div","dl","dt","em","embed","h1","h2","h3","h4","h5","h6","head","hr","i","img","li","listing","main","meta","nobr","ol","p","pre","ruby","s","small","span","strong","strike","sub","sup","table","tt","u","ul","var"].forEach(e=>om[e]=1);var xy=/[\t\n\v\f\r \xa0\u{1680}\u{180e}\u{2000}-\u{200a}\u{2028}\u{2029}\u{202f}\u{205f}\u{3000}\u{feff}]/u;function Cy(e){return xy.test(e)}var Sy=class extends am{namespace;constructor(e){super(e),this.document=e,this.namespace=null}setAttribute(e,t,n){e.setAttribute(t,n)}removeAttribute(e,t){e.removeAttribute(t)}insertAfter(e,t,n){this.insertBefore(e,t,n.nextSibling)}},ky=Sy,Ey=Symbol("TRANSACTION"),Ry=class{scheduledInstallModifiers=[];scheduledUpdateModifiers=[];createdComponents=[];updatedComponents=[];didCreate(e){this.createdComponents.push(e)}didUpdate(e){this.updatedComponents.push(e)}scheduleInstallModifier(e){this.scheduledInstallModifiers.push(e)}scheduleUpdateModifier(e){this.scheduledUpdateModifiers.push(e)}commit(){let{createdComponents:e,updatedComponents:t}=this;for(const{manager:i,state:s}of e)i.didCreate(s);for(const{manager:i,state:s}of t)i.didUpdate(s);let{scheduledInstallModifiers:n,scheduledUpdateModifiers:r}=this;for(const{manager:i,state:s,definition:o}of n){let e=i.getTag(s);if(null!==e){let t=qe(()=>i.install(s));pe(e,t)}else i.install(s)}for(const{manager:i,state:s,definition:o}of r){let e=i.getTag(s);if(null!==e){let t=qe(()=>i.update(s));pe(e,t)}else i.update(s)}}},Ty=class{[Ey]=null;updateOperations;isInteractive;isArgumentCaptureError;debugRenderTree;constructor(e,t){this.delegate=t,this.isInteractive=t.isInteractive,this.debugRenderTree=this.delegate.enableDebugTooling?new Sm:void 0,this.isArgumentCaptureError=this.delegate.enableDebugTooling?ty:void 0,e.appendOperations?(this.appendOperations=e.appendOperations,this.updateOperations=e.updateOperations):e.document&&(this.appendOperations=new lm(e.document),this.updateOperations=new Sy(e.document))}getAppendOperations(){return this.appendOperations}getDOM(){return this.updateOperations}begin(){this[Ey],this.debugRenderTree?.begin(),this[Ey]=new Ry}get transaction(){return this[Ey]}didCreate(e){this.transaction.didCreate(e)}didUpdate(e){this.transaction.didUpdate(e)}scheduleInstallModifier(e){this.isInteractive&&this.transaction.scheduleInstallModifier(e)}scheduleUpdateModifier(e){this.isInteractive&&this.transaction.scheduleUpdateModifier(e)}commit(){let e=this.transaction;this[Ey]=null,e.commit(),this.debugRenderTree?.commit(),this.delegate.onTransactionCommit()}};function Ly(e,t,n,r){return{env:new Ty(e,t),program:new lg(n.constants,n.heap),resolver:r}}function Iy(e,t){if(e[Ey])t();else{e.begin();try{t()}finally{e.commit()}}}function Py(e){return"string"==typeof e?e:"function"!=typeof e.toString?"":String(e)}function My(e){let t,n=Ou(e);return t=null===n?null:"function"==typeof n?n:n.getHelper(e),t}function Ay(e){return e===lt}km.add(77,(e,{op1:t,op2:n})=>{let r=e.stack,i=r.pop(),s=r.pop(),o=e.getOwner();e.context.resolver,e.loadValue(8,function(e,t,n,r){let i,s;return ft(()=>{let o=wt(t);return o===i||(s=vm(o,e)?r?_m(e,o,n,r):r:0===e&&"string"==typeof o&&o||rt(o)?_m(e,o,n,r):null,i=o),s})}(t,i,o,s))}),km.add(107,e=>{let t,n=e.stack,r=n.pop(),i=n.pop().capture(),s=e.getOwner(),o=ft(()=>{void 0!==t&&te(t);let e=wt(r);if(vm(e,1)){let{definition:n,owner:r,positional:s,named:a}=wm(e),l=My(n);void 0!==a&&(i.named=Np({},...a,i.named)),void 0!==s&&(i.positional=s.concat(i.positional)),t=l(i,r),Q(o,t)}else rt(e)?(t=My(e)(i,s),ne(t)&&Q(o,t)):t=lt}),a=ft(()=>(wt(o),wt(t)));e.associateDestroyable(o),e.loadValue(8,a)}),km.add(16,(e,{op1:t})=>{let n=e.stack,r=e.constants.getValue(t)(n.pop().capture(),e.getOwner(),e.dynamicScope());ne(r)&&e.associateDestroyable(r),e.loadValue(8,r)}),km.add(21,(e,{op1:t})=>{let n=e.referenceForSymbol(t);e.stack.push(n)}),km.add(19,(e,{op1:t})=>{let n=e.stack.pop();e.scope().bindSymbol(t,n)}),km.add(20,(e,{op1:t})=>{let n=e.stack.pop(),r=e.stack.pop(),i=e.stack.pop();e.scope().bindBlock(t,[n,r,i])}),km.add(37,(e,{op1:t})=>{e.pushRootScope(t,e.getOwner())}),km.add(22,(e,{op1:t})=>{let n=e.constants.getValue(t),r=e.stack.pop();e.stack.push(xt(r,n))}),km.add(23,(e,{op1:t})=>{let{stack:n}=e,r=e.scope().getBlock(t);n.push(r)}),km.add(24,e=>{let{stack:t}=e,n=t.pop();if(n&&!Ay(n)){let[e,r,i]=n;t.push(i),t.push(r),t.push(e)}else t.push(null),t.push(null),t.push(null)}),km.add(25,e=>{let{stack:t}=e,n=t.pop();n&&!Ay(n)?t.push(ut):t.push(ht)}),km.add(26,e=>{e.stack.pop(),e.stack.pop();let t=e.stack.pop(),n=t&&t.parameters.length;e.stack.push(n?ut:ht)}),km.add(27,(e,{op1:t})=>{let n=new Array(t);for(let i=t;i>0;i--)n[i-1]=cm(e.stack.pop());var r;e.stack.push((r=n,ft(()=>{const e=[];for(const t of r){const n=wt(t);null!=n&&e.push(Py(n))}return e.length>0?e.join(""):null})))}),km.add(109,e=>{let t=e.stack.pop(),n=e.stack.pop(),r=e.stack.pop();e.stack.push(ft(()=>U(wt(t))?wt(n):wt(r)))}),km.add(110,e=>{let t=e.stack.pop();e.stack.push(ft(()=>!U(wt(t))))}),km.add(111,e=>{let t=e.dynamicScope(),n=e.stack,r=n.pop();n.push(ft(()=>{let e=String(wt(r));return wt(t.get(e))}))}),km.add(112,e=>{let{positional:t}=e.stack.pop().capture();e.loadValue(8,ft(()=>{console.log(...Jm(t))}))});var Oy=class{constructor(e,t,n){this.node=e,this.reference=t,this.lastValue=n}evaluate(){let e,t=wt(this.reference),{lastValue:n}=this;t!==n&&(e=bg(t)?"":xg(t)?t:String(t),e!==n)&&(this.node.nodeValue=this.lastValue=e)}};function Ny(e){return function(e){return xg(e)||bg(e)||"boolean"==typeof e||"number"==typeof e}(e)?2:vm(e,0)||Du(e)?0:vm(e,1)||zu(e)?1:_g(e)?4:function(e){return wg(e)&&11===e.nodeType}(e)?5:function(e){return wg(e)&&"number"==typeof e.nodeType}(e)?6:2}function Fy(e){return rt(e)?vm(e,0)||Du(e)?0:1:2}function Dy(e,t){console.info("Use `context`, and `get(<path>)` to debug this template."),t("this")}km.add(76,e=>{let t=e.stack.peek();e.stack.push(Ny(wt(t))),vt(t)||e.updateWith(new Rm(t,Ny))}),km.add(106,e=>{let t=e.stack.peek();e.stack.push(Fy(wt(t))),vt(t)||e.updateWith(new Rm(t,Fy))}),km.add(43,e=>{let t=wt(e.stack.pop()),n=bg(t)?"":String(t);e.tree().appendDynamicHTML(n)}),km.add(44,e=>{let t=wt(e.stack.pop()).toHTML(),n=bg(t)?"":t;e.tree().appendDynamicHTML(n)}),km.add(47,e=>{let t=e.stack.pop(),n=wt(t),r=bg(n)?"":String(n),i=e.tree().appendDynamicText(r);vt(t)||e.updateWith(new Oy(i,t,r))}),km.add(45,e=>{let t=wt(e.stack.pop());e.tree().appendDynamicFragment(t)}),km.add(46,e=>{let t=wt(e.stack.pop());e.tree().appendDynamicNode(t)});var zy=Dy;function jy(e){zy=e}function Uy(){zy=Dy}var By=class{#h;constructor(e,t){this.scope=e,this.#h=t}get(e){let t,{scope:n}=this,r=this.#h,i=e.split("."),[s,...o]=e.split(".");return"this"===s?t=n.getSelf():r.locals[s]?t=n.getSymbol(r.locals[s]):(t=this.scope.getSelf(),o=i),o.reduce((e,t)=>xt(e,t),t)}};km.add(103,(e,{op1:t})=>{let n=e.constants.getValue(t),r=new By(e.scope(),n);zy(wt(e.getSelf()),e=>wt(r.get(e)))}),km.add(72,(e,{op1:t,op2:n})=>{let r=e.stack,i=r.pop(),s=wt(r.pop()),o=my(i,null===s?"@identity":String(s)),a=wt(o);e.updateWith(new Rm(o,e=>e.isEmpty())),a.isEmpty()?e.lowlevel.goto(n+1):(e.enterList(o,t),e.stack.push(a))}),km.add(73,e=>{e.exitList()}),km.add(74,(e,{op1:t})=>{let n=e.stack.peek().next();null!==n?e.registerItem(e.enterItem(n)):e.lowlevel.goto(t)});var $y=class{currentOpSize=0;registers;context;constructor(e,t,n,r){this.stack=e,this.externs=n,this.context=t,this.registers=r}fetchRegister(e){return this.registers[e]}loadRegister(e,t){this.registers[e]=t}setPc(e){this.registers[0]=e}pushFrame(){this.stack.push(this.registers[1]),this.stack.push(this.registers[2]),this.registers[2]=this.registers[3]-1}popFrame(){this.registers[3]=this.registers[2]-1,this.registers[1]=this.stack.get(0),this.registers[2]=this.stack.get(1)}pushSmallFrame(){this.stack.push(this.registers[1])}popSmallFrame(){this.registers[1]=this.stack.pop()}goto(e){this.setPc(this.target(e))}target(e){return this.registers[0]+e-this.currentOpSize}call(e){this.registers[1]=this.registers[0],this.setPc(this.context.program.heap.getaddr(e))}returnTo(e){this.registers[1]=this.target(e)}return(){this.setPc(this.registers[1])}nextStatement(){let{registers:e,context:t}=this,n=e[0];if(-1===n)return null;let r=t.program.opcode(n),i=this.currentOpSize=r.size;return this.registers[0]+=i,r}evaluateOuter(e,t){this.evaluateInner(e,t)}evaluateInner(e,t){e.isMachine?this.evaluateMachine(e,t):this.evaluateSyscall(e,t)}evaluateMachine(e,t){switch(e.type){case 0:return void this.pushFrame();case 1:return void this.popFrame();case 3:return void this.call(e.op1);case 2:return void t.call(this.stack.pop());case 4:return void this.goto(e.op1);case 5:return void t.return();case 6:return void this.returnTo(e.op1)}}evaluateSyscall(e,t){km.evaluate(t,e,e.type)}},qy=class{env;dom;alwaysRevalidate;frameStack=new it;constructor(e,{alwaysRevalidate:t=!1}){this.env=e,this.dom=e.getDOM(),this.alwaysRevalidate=t}execute(e,t){this._execute(e,t)}_execute(e,t){let{frameStack:n}=this;for(this.try(e,t);!n.isEmpty();){let e=this.frame.nextStatement();void 0!==e?e.evaluate(this):n.pop()}}get frame(){return this.frameStack.current}goto(e){this.frame.goto(e)}try(e,t){this.frameStack.push(new Ky(e,t))}throw(){this.frame.handleException(),this.frameStack.pop()}},Vy=class{children;bounds;constructor(e,t,n,r){this.state=e,this.context=t,this.children=r,this.bounds=n}parentElement(){return this.bounds.parentElement()}firstNode(){return this.bounds.firstNode()}lastNode(){return this.bounds.lastNode()}evaluate(e){e.try(this.children,null)}},Wy=class extends Vy{type="try";evaluate(e){e.try(this.children,this)}handleException(){let{state:e,bounds:t,context:{env:n}}=this;!function(e){let{children:t}=J(e);Y(t,te)}(this);let r=Qg.resume(n,t),i=e.evaluate(r),s=this.children=[],o=i.execute(e=>{e.updateWith(this),e.pushUpdating(s)});Q(this,o.drop)}},Hy=class extends Wy{retained=!1;index=-1;constructor(e,t,n,r,i,s){super(e,t,n,[]),this.key=r,this.memo=i,this.value=s}shouldRemove(){return!this.retained}reset(){this.retained=!1}},Gy=class extends Vy{type="list-block";opcodeMap=new Map;marker=null;lastIterator;constructor(e,t,n,r,i){super(e,t,n,r),this.iterableRef=i,this.lastIterator=wt(i)}initializeChild(e){e.index=this.children.length-1,this.opcodeMap.set(e.key,e)}evaluate(e){let t=wt(this.iterableRef);if(this.lastIterator!==t){let{bounds:n}=this,{dom:r}=e,i=this.marker=r.createComment("");r.insertAfter(n.parentElement(),i,n.lastNode()),this.sync(t),this.parentElement().removeChild(i),this.marker=null,this.lastIterator=t}super.evaluate(e)}sync(e){let{opcodeMap:t,children:n}=this,r=0,i=0;for(this.children=this.bounds.boundList=[];;){let s=e.next();if(null===s)break;let o=n[r],{key:a}=s;for(;void 0!==o&&o.retained;)o=n[++r];if(void 0!==o&&o.key===a)this.retainItem(o,s),r++;else if(t.has(a)){let e=t.get(a);if(e.index<i)this.moveItem(e,s,o);else{i=e.index;let t=!1;for(let e=r+1;e<i;e++)if(!Ye(n[e]).retained){t=!0;break}t?(this.moveItem(e,s,o),r++):(this.retainItem(e,s),r=i+1)}}else this.insertItem(s,o)}for(const s of n)s.retained?s.reset():this.deleteItem(s)}retainItem(e,t){let{children:n}=this;_t(e.memo,t.memo),_t(e.value,t.value),e.retained=!0,e.index=n.length,n.push(e)}insertItem(e,t){let{opcodeMap:n,bounds:r,state:i,children:s,context:{env:o}}=this,{key:a}=e,l=void 0===t?this.marker:t.firstNode(),c=Qg.forInitialRender(o,{element:r.parentElement(),nextSibling:l});i.evaluate(c).execute(t=>{let r=t.enterItem(e);r.index=s.length,s.push(r),n.set(a,r),Q(this,r)})}moveItem(e,t,n){let r,i,{children:s}=this;_t(e.memo,t.memo),_t(e.value,t.value),e.retained=!0,void 0===n?mg(e,this.marker):(r=e.lastNode().nextSibling,i=n.firstNode(),r!==i&&mg(e,i)),e.index=s.length,s.push(e)}deleteItem(e){te(e),yg(e),this.opcodeMap.delete(e.key)}},Ky=class{current=0;constructor(e,t){this.ops=e,this.exceptionHandler=t}goto(e){this.current=e}nextStatement(){return this.ops[this.current++]}handleException(){this.exceptionHandler&&this.exceptionHandler.handleException()}},Zy=class{constructor(e,t,n,r){this.env=e,this.updating=t,this.bounds=n,this.drop=r,Q(this,r),ee(this,()=>yg(this.bounds))}rerender({alwaysRevalidate:e=!1}={alwaysRevalidate:!1}){let{env:t,updating:n}=this;new qy(t,{alwaysRevalidate:e}).execute(n,this)}parentElement(){return this.bounds.parentElement()}firstNode(){return this.bounds.firstNode()}lastNode(){return this.bounds.lastNode()}handleException(){}},Yy=class{static restore(e,t){const n=new this(e.slice(),function(e){return[0,-1,e,0]}(e.length-1));return n.registers[0]=t,n.registers[3]=e.length-1,n.registers[2]=-1,n}registers;constructor(e=[],t){this.stack=e,this.registers=t}push(e){this.stack[++this.registers[3]]=e}dup(e=this.registers[3]){this.stack[++this.registers[3]]=this.stack[e]}copy(e,t){this.stack[t]=this.stack[e]}pop(e=1){let t=this.stack[this.registers[3]];return this.registers[3]-=e,t}peek(e=0){return this.stack[this.registers[3]-e]}get(e,t=this.registers[2]){return this.stack[t+e]}set(e,t,n=this.registers[2]){this.stack[n+t]=e}slice(e,t){return this.stack.slice(e,t)}capture(e){let t=this.registers[3]+1,n=t-e;return this.stack.slice(n,t)}reset(){this.stack.length=0}},Xy=class{drop={};scope=new it;dynamicScope=new it;updating=new it;cache=new it;list=new it;destroyable=new it;constructor(e,t){this.scope.push(e),this.dynamicScope.push(t),this.destroyable.push(this.drop)}},Jy=class e{#d;args;lowlevel;debug;trace;get stack(){return this.lowlevel.stack}get pc(){return this.lowlevel.fetchRegister(0)}#p=[null,null,null,null,null,null,null,null,null];fetch(e){let t=this.fetchValue(e);this.stack.push(t)}load(e){let t=this.stack.pop();this.loadValue(e,t)}loadValue(e,t){this.#p[e]=t}fetchValue(e){return function(e){return e<=3}(e)?this.lowlevel.fetchRegister(e):this.#p[e]}call(e){null!==e&&this.lowlevel.call(e)}return(){this.lowlevel.return()}#f;context;constructor({scope:e,dynamicScope:t,stack:n,pc:r},i,s){let o=Yy.restore(n,r);this.#f=s,this.context=i,this.#d=new Xy(e,t),this.args=new $m,this.lowlevel=new $y(o,i,void 0,o.registers),this.pushUpdating()}static initial(t,n){let r=_y.root(n.owner,n.scope??{self:lt,size:0});const i=function(e,t,n){return{pc:e,scope:t,dynamicScope:n,stack:[]}}(t.program.heap.getaddr(n.handle),r,n.dynamicScope);return new e(i,t,n.tree)}compile(e){return Lp(e.compile(this.context))}get constants(){return this.context.program.constants}get program(){return this.context.program}get env(){return this.context.env}captureClosure(e,t=this.lowlevel.fetchRegister(0)){return{pc:t,scope:this.scope(),dynamicScope:this.dynamicScope(),stack:this.stack.capture(e)}}capture(e,t=this.lowlevel.fetchRegister(0)){return new Qy(this.captureClosure(e,t),this.context)}beginCacheGroup(e){let t=this.updating(),n=new Tm;t.push(n),t.push(new Lm(e)),this.#d.cache.push(n),Le()}commitCacheGroup(){let e=this.updating(),t=this.#d.cache.pop(),n=Ie();e.push(new Im(t)),t.finalize(n,e.length)}enter(e){let t=this.capture(e),n=this.tree().pushResettableBlock(),r=new Wy(t,this.context,n,[]);this.didEnter(r)}enterItem({key:e,value:t,memo:n}){let{stack:r}=this,i=yy(t),s=yy(n);r.push(i),r.push(s);let o=this.capture(2),a=this.tree().pushResettableBlock(),l=new Hy(o,this.context,a,e,s,i);return this.didEnter(l),l}registerItem(e){this.listBlock().initializeChild(e)}enterList(e,t){let n=[],r=this.lowlevel.target(t),i=this.capture(0,r),s=this.tree().pushBlockList(n),o=new Gy(i,this.context,s,n,e);this.#d.list.push(o),this.didEnter(o)}didEnter(e){this.associateDestroyable(e),this.#d.destroyable.push(e),this.updateWith(e),this.pushUpdating(e.children)}exit(){this.#d.destroyable.pop(),this.#f.popBlock(),this.popUpdating()}exitList(){this.exit(),this.#d.list.pop()}pushRootScope(e,t){let n=_y.sized(t,e);return this.#d.scope.push(n),n}pushChildScope(){this.#d.scope.push(this.scope().child())}pushScope(e){this.#d.scope.push(e)}popScope(){this.#d.scope.pop()}pushDynamicScope(){let e=this.dynamicScope().child();return this.#d.dynamicScope.push(e),e}bindDynamicScope(e){let t=this.dynamicScope();for(const n of Vp(e))t.set(n,this.stack.pop())}pushUpdating(e=[]){this.#d.updating.push(e)}popUpdating(){return this.#d.updating.pop()}updateWith(e){this.updating().push(e)}listBlock(){return this.#d.list.current}associateDestroyable(e){Q(this.#d.destroyable.current,e)}updating(){return this.#d.updating.current}tree(){return this.#f}scope(){return this.#d.scope.current}dynamicScope(){return this.#d.dynamicScope.current}popDynamicScope(){this.#d.dynamicScope.pop()}getOwner(){return this.scope().owner}getSelf(){return this.scope().getSelf()}referenceForSymbol(e){return this.scope().getSymbol(e)}execute(e){return this._execute(e)}_execute(e){let t;e&&e(this);do{t=this.next()}while(!t.done);return t.value}next(){let e,{env:t}=this,n=this.lowlevel.nextStatement();return null!==n?(this.lowlevel.evaluateOuter(n,this),e={done:!1,value:null}):(this.stack.reset(),e={done:!0,value:new Zy(t,this.popUpdating(),this.#f.popBlock(),this.#d.drop)}),e}},Qy=class{state;context;constructor(e,t){this.state=e,this.context=t}evaluate(e){return new Jy(this.state,this.context,e)}},ev=class{constructor(e){this.vm=e}next(){return this.vm.next()}sync(){return this.vm.execute()}};function tv(e,t){let n;return Iy(e,()=>n=t.sync()),n}function nv(e,t,n,r,i,s=new wy){let o=Lp(i.compile(e)),a=i.symbolTable.symbols.length,l=Jy.initial(e,{scope:{self:n,size:a},dynamicScope:s,tree:r,handle:o,owner:t});return new ev(l)}function rv(e,t,n,r,i={},s=new wy){return function(e,t,n,r,i){const s=Object.keys(i).map(e=>[e,i[e]]),o=["main","else","attrs"],a=s.map(([e])=>`@${e}`);let l=e.constants.component(r,n,void 0,"{ROOT}");e.lowlevel.pushFrame();for(let h=0;h<3*o.length;h++)e.stack.push(null);e.stack.push(null),s.forEach(([,t])=>{e.stack.push(t)}),e.args.setup(e.stack,a,o,0,!0);const c=l.compilable,u={handle:Lp(c.compile(t)),symbolTable:c.symbolTable};return e.stack.push(e.args),e.stack.push(u),e.stack.push(l),new ev(e)}(Jy.initial(e,{tree:t,handle:e.stdlib.main,dynamicScope:s,owner:n}),e,n,r,function(e){const t=dt(e);return Object.keys(e).reduce((e,n)=>(e[n]=xt(t,n),e),{})}(i))}var iv=a({_instrumentStart:()=>hv,flaggedInstrument:()=>cv,instrument:()=>lv,reset:()=>fv,subscribe:()=>dv,subscribers:()=>sv,unsubscribe:()=>pv}),sv=[],ov={},av=()=>performance.now();function lv(e,t,n,r){let i,s,o;if(arguments.length<=3&&"function"==typeof t?(s=t,o=n):(i=t,s=n,o=r),0===sv.length)return s.call(o);let a=i||{},l=hv(e,()=>a);return l===uv?s.call(o):function(e,t,n,r){try{return e.call(r)}catch(i){throw n.exception=i,i}finally{t()}}(s,l,a,o)}function cv(e,t,n){return n()}function uv(){}function hv(e,t,n){if(0===sv.length)return uv;let r=ov[e];if(r||(r=function(e){let t=[];for(let n of sv)n.regex.test(e)&&t.push(n.object);return ov[e]=t,t}(e)),0===r.length)return uv;let i,s=t(n),o=O.STRUCTURED_PROFILE;o&&(i=`${e}: ${s.object}`,console.time(i));let a=[],l=av();for(let u of r)a.push(u.before(e,l,s));const c=r;return function(){let t=av();for(let n=0;n<c.length;n++){let r=c[n];"function"==typeof r.after&&r.after(e,t,s,a[n])}o&&console.timeEnd(i)}}function dv(e,t){let n=e.split("."),r=[];for(let o of n)"*"===o?r.push("[^\\.]*"):r.push(o);let i=r.join("\\.");i=`${i}(\\..*)?`;let s={pattern:e,regex:new RegExp(`^${i}$`),object:t};return sv.push(s),ov={},s}function pv(e){let t=0;for(let n=0;n<sv.length;n++)sv[n]===e&&(t=n);sv.splice(t,1),ov={}}function fv(){sv.length=0,ov={}}var gv=Symbol("MUTABLE_CELL");function mv(e){if("error"===e.result)throw new Error(`Compile Error: ${e.problem} @ ${e.span.start}..${e.span.end}`);return e}function yv(e,t){return"attrs"===t[0]&&(t.shift(),1===t.length)?xt(e,t[0]):Ct(e,t)}function vv(e){let t=e.indexOf(":");return-1===t?[e,e,!0]:[e.substring(0,t),e.substring(t+1),!1]}function bv(e,t,n,r){let[i,s,o]=n;if("id"===s){let t=ur(e,i);null==t&&(t=e.elementId);let n=at(t);return void r.setAttribute("id",n,!0,null)}let a=i.indexOf(".")>-1?yv(t,i.split(".")):xt(t,i);r.setAttribute(s,a,!1,null)}function wv(e,t){let n;return ft(()=>{let r=wt(e);return!0===r?n||(n=ip(t)):r||0===r?String(r):null})}function _v(){}var xv=class{classRef=null;rootRef;argsRevision;constructor(e,t,n,r,i,s){this.component=e,this.args=t,this.argsTag=n,this.finalizer=r,this.hasWrappedElement=i,this.isInteractive=s,this.classRef=null,this.argsRevision=null===t?0:le(n),this.rootRef=dt(e),ee(this,()=>this.willDestroy(),!0),ee(this,()=>this.component.destroy())}willDestroy(){let{component:e,isInteractive:t}=this;if(t){Pe(),e.trigger("willDestroyElement"),e.trigger("willClearRender"),Me();let t=Jl(e);t&&(tc(t),nc(e))}e.renderer.unregister(e)}finalize(){let{finalizer:e}=this;e(),this.finalizer=_v}};function Cv(e){let t=Object.create(null),n=Object.create(null);for(let r in e){let i=e[r],s=wt(i);bt(i)?t[r]=new kv(i,s):t[r]=s,n[r]=s}return n.attrs=t,n}var Sv=Symbol("REF"),kv=class{value;[gv];[Sv];constructor(e,t){this[gv]=!0,this[Sv]=e,this.value=t}update(e){_t(this[Sv],e)}},Ev=new WeakMap,Rv=Symbol("DIRTY_TAG"),Tv=Symbol("IS_DISPATCHING_ATTRS"),Lv=Symbol("BOUNDS"),Iv=at("ember-view"),Pv=class{templateFor(e){let t,{layout:n,layoutName:r}=e,i=Ur(e);if(void 0===n){if(void 0===r)return null;t=i.lookup(`template:${r}`)}else{if("function"!=typeof n)return null;t=n}return mv(t(i)).asWrappedLayout()}getDynamicLayout(e){return this.templateFor(e.component)}getTagName(e){let{component:t,hasWrappedElement:n}=e;return n?t&&t.tagName||"div":null}getCapabilities(){return Ov}prepareArgs(e,t){if(t.named.has("__ARGS__")){let{__ARGS__:e,...n}=t.named.capture(),r=wt(e);return{positional:r.positional,named:{...n,...r.named}}}const{positionalParams:n}=e.class??e;if(null==n||0===t.positional.length)return null;let r;if("string"==typeof n){let e=t.positional.capture();r={[n]:ft(()=>Jm(e))},Object.assign(r,t.named.capture())}else{if(!(Array.isArray(n)&&n.length>0))return null;{const e=Math.min(n.length,t.positional.length);r={},Object.assign(r,t.named.capture());for(let i=0;i<e;i++)r[n[i]]=t.positional.at(i)}}return{positional:jp,named:r}}create(e,t,n,{isInteractive:r},i,s){let o=i.view,a=n.named.capture();Le();let l=Cv(a),c=Ie();!function(e,t){e.named.has("id")&&(t.elementId=t.id)}(n,l),l.parentView=o,l._target=wt(s),Br(l,e),Pe();let u=t.create(l);Ev.set(u,a);let h=hv("render.component",Mv,u);i.view=u,null!=o&&sc(o,u),u.trigger("didReceiveAttrs");let d=""!==u.tagName;d||(r&&u.trigger("willRender"),u._transitionTo("hasElement"),r&&u.trigger("willInsertElement"));let p=new xv(u,a,c,h,d,r);return n.named.has("class")&&(p.classRef=n.named.get("class")),r&&d&&u.trigger("willRender"),Me(),Ne(p.argsTag),Ne(u[Rv]),p}getDebugName(e){return e.fullName||e.normalizedName||e.class?.name||e.name}getSelf({rootRef:e}){return e}didCreateElement({component:e,classRef:t,isInteractive:n,rootRef:r},i,s){ec(e,i),Ql(i,e);let{attributeBindings:o,classNames:a,classNameBindings:l}=e;if(o&&o.length)!function(e,t,n,r){let i=[],s=e.length-1;for(;-1!==s;){let o=vv(e[s]),a=o[1];-1===i.indexOf(a)&&(i.push(a),bv(t,n,o,r)),s--}if(-1===i.indexOf("id")){let e=t.elementId?t.elementId:al(t);r.setAttribute("id",at(e),!1,null)}}(o,e,r,s);else{let t=e.elementId?e.elementId:al(e);s.setAttribute("id",at(t),!1,null)}if(t){const e=wv(t);s.setAttribute("class",e,!1,null)}a&&a.length&&a.forEach(e=>{s.setAttribute("class",at(e),!1,null)}),l&&l.length&&l.forEach(e=>{!function(e,t,n){let[r,i,s]=t.split(":");if(""===r)n.setAttribute("class",at(i),!0,null);else{let t,o=r.indexOf(".")>-1,a=o?r.split("."):[],l=o?yv(e,a):xt(e,r);t=void 0===i?wv(l,o?a[a.length-1]:r):function(e,t,n){return ft(()=>wt(e)?t:n)}(l,i,s),n.setAttribute("class",t,!1,null)}}(r,e,s)}),s.setAttribute("class",Iv,!1,null),"ariaRole"in e&&s.setAttribute("role",xt(r,"ariaRole"),!1,null),e._transitionTo("hasElement"),n&&(Pe(),e.trigger("willInsertElement"),Me())}didRenderLayout(e,t){e.component[Lv]=t,e.finalize()}didCreate({component:e,isInteractive:t}){t&&(e._transitionTo("inDOM"),e.trigger("didInsertElement"),e.trigger("didRender"))}update(e){let{component:t,args:n,argsTag:r,argsRevision:i,isInteractive:s}=e;if(e.finalizer=hv("render.component",Av,t),Pe(),null!==n&&!ce(r,i)){Le();let i=Cv(n);r=e.argsTag=Ie(),e.argsRevision=le(r),t[Tv]=!0,t.setProperties(i),t[Tv]=!1,t.trigger("didUpdateAttrs"),t.trigger("didReceiveAttrs")}s&&(t.trigger("willUpdate"),t.trigger("willRender")),Me(),Ne(r),Ne(t[Rv])}didUpdateLayout(e){e.finalize()}didUpdate({component:e,isInteractive:t}){t&&(e.trigger("didUpdate"),e.trigger("didRender"))}getDestroyable(e){return e}};function Mv(e){return e.instrumentDetails({initialRender:!0})}function Av(e){return e.instrumentDetails({initialRender:!1})}var Ov={dynamicLayout:!0,dynamicTag:!0,prepareArgs:!0,createArgs:!0,attributeHook:!0,elementHook:!0,createCaller:!0,dynamicScope:!0,updateHook:!0,createInstance:!0,wrapped:!0,willDestroy:!0,hasSubOwner:!1},Nv=new Pv;function Fv(e){return e===Nv}function Dv(e){let t=ur(e,"content");return pe(Ot(e),Ot(t)),t}function zv(e,t,n){let r=Ge(e),i=Ke(e,t,r);if(t in e)return i;{let s=[i,Ke(e,"content",r)],o=Dv(e);return Ze(o)&&s.push(At(o,t,n)),xe(s)}}var jv=wl.create({content:null,init(){this._super(...arguments),nr(this),Ot(this),Et(this,zv)},willDestroy(){this.set("content",null),this._super(...arguments)},isTruthy:Yn("content",function(){return Boolean(ur(this,"content"))}),unknownProperty(e){let t=Dv(this);return t?ur(t,e):void 0},setUnknownProperty(e,t){let n=w(this);return n.isInitializing()||n.isPrototypeMeta(this)?(Dn(this,e,null,t),t):gr(Dv(this),e,t)}});function Uv(e){return Mu(e,{})}var Bv=class{__string;constructor(e){this.__string=e}toString(){return`${this.__string}`}toHTML(){return this.toString()}},$v=function(e){return null==e?e="":"string"!=typeof e&&(e=String(e)),new Bv(e)};function qv(e){return Mu(e,{})}var Vv=qv(({positional:e})=>ft(()=>Jm(e),null)),Wv=qv(({positional:e})=>{let t=e[0];return ft(()=>(...n)=>{let[r,...i]=Jm(e);if(mt(t)){let e=i.length>0?i[0]:n[0];return void _t(t,e)}return r.call(null,...i,...n)},null)}),Hv=qv(({named:e})=>{let t=ft(()=>Xm(e),null),n=new Map;for(let r in e)n.set(r,e[r]);return t.children=n,t}),Gv=e=>(e=>null==e||"function"!=typeof e.toString)(e)?"":String(e),Kv=qv(({positional:e})=>ft(()=>Jm(e).map(Gv).join(""),null)),Zv=qv(({positional:e})=>{let t=e[0]??lt,n=e[1]??lt;return ft(()=>{let e=wt(t);if(nt(e))return q(e,String(wt(n)))},e=>{let r=wt(t);if(nt(r))return V(r,String(wt(n)),e)})}),Yv=class{tag=ge();element;args;listener=null;constructor(e,t){this.element=e,this.args=t,ee(this,()=>{let{element:e,listener:t}=this;if(t){let{eventName:n,callback:r,options:i}=t;Qv(e,n,r,i)}})}updateListener(){let e,t,n,{element:r,args:i,listener:s}=this,o=i.positional[0],a=o?wt(o):void 0,l=i.positional[1],c=l?wt(l):void 0;{let{once:r,passive:s,capture:o}=i.named;r&&(e=wt(r)),s&&(t=wt(s)),o&&(n=wt(o))}let u,h=!1;if(h=null===s||a!==s.eventName||c!==s.userProvidedCallback||e!==s.once||t!==s.passive||n!==s.capture,h&&(void 0===e&&void 0===t&&void 0===n||(u={once:e,passive:t,capture:n})),h){let i=c;this.listener={eventName:a,callback:i,userProvidedCallback:c,once:e,passive:t,capture:n,options:u},s&&Qv(r,s.eventName,s.callback,s.options),function(e,t,n,r){Xv++,e.addEventListener(t,n,r)}(r,a,i,u)}}},Xv=0,Jv=0;function Qv(e,t,n,r){Jv++,e.removeEventListener(t,n,r)}var eb,tb=Iu(new class{getDebugName(){return"on"}getDebugInstance(){return null}get counters(){return{adds:Xv,removes:Jv}}create(e,t,n,r){return new Yv(t,r)}getTag({tag:e}){return e}install(e){e.updateListener()}update(e){e.updateListener()}getDestroyable(e){return e}},{}),nb={dynamicLayout:!1,dynamicTag:!1,prepareArgs:!1,createArgs:!1,attributeHook:!1,elementHook:!1,createCaller:!1,dynamicScope:!1,updateHook:!1,createInstance:!1,wrapped:!1,willDestroy:!1,hasSubOwner:!1},rb=class{getCapabilities(){return nb}getDebugName({name:e}){return e}getSelf(){return ct}getDestroyable(){return null}},ib=new rb,sb=class{constructor(e="@glimmer/component/template-only",t="(unknown template-only component)"){this.moduleName=e,this.name=t}toString(){return this.moduleName}};function ob(e,t){return new sb(e,t)}Nu(ib,sb.prototype);var ab={dynamicLayout:!1,dynamicTag:!1,prepareArgs:!1,createArgs:!0,attributeHook:!1,elementHook:!1,createCaller:!1,dynamicScope:!0,updateHook:!0,createInstance:!0,wrapped:!1,willDestroy:!1,hasSubOwner:!1};function lb(e,t={}){let n=Boolean(t.updateHook);return{asyncLifeCycleCallbacks:Boolean(t.asyncLifecycleCallbacks),destructor:Boolean(t.destructor),updateHook:n}}function cb(e){return e.capabilities.asyncLifeCycleCallbacks}function ub(e){return e.capabilities.updateHook}var hb=class{componentManagerDelegates=new WeakMap;constructor(e){this.factory=e}getDelegateFor(e){let{componentManagerDelegates:t}=this,n=t.get(e);if(void 0===n){let{factory:r}=this;n=r(e),t.set(e,n)}return n}create(e,t,n){let r=this.getDelegateFor(e),i=It(n.capture()),s=r.createComponent(t,i);return new db(s,r,i)}getDebugName(e){return"function"==typeof e?e.name:e.toString()}update(e){let{delegate:t}=e;if(ub(t)){let{component:n,args:r}=e;t.updateComponent(n,r)}}didCreate({component:e,delegate:t}){cb(t)&&t.didCreateComponent(e)}didUpdate({component:e,delegate:t}){(function(e){return cb(e)&&ub(e)})(t)&&t.didUpdateComponent(e)}didRenderLayout(){}didUpdateLayout(){}getSelf({component:e,delegate:t}){return dt(t.getContext(e))}getDestroyable(e){const{delegate:t}=e;if(function(e){return e.capabilities.destructor}(t)){const{component:n}=e;return ee(e,()=>t.destroyComponent(n)),e}return null}getCapabilities(){return ab}},db=class{constructor(e,t,n){this.component=e,this.delegate=t,this.args=n}};function pb(e,t={}){return{disableAutoTracking:Boolean(t.disableAutoTracking)}}var fb=class{componentManagerDelegates=new WeakMap;constructor(e){this.factory=e}getDelegateFor(e){let{componentManagerDelegates:t}=this,n=t.get(e);if(void 0===n){let{factory:r}=this;n=r(e),t.set(e,n)}return n}create(e,t,n,r){let i,s=this.getDelegateFor(e),o=It(r),a=s.createModifier(n,o);return i={tag:ge(),element:t,delegate:s,args:o,modifier:a},ee(i,()=>s.destroyModifier(a,o)),i}getDebugName(e){return"function"==typeof e?e.name||e.toString():"<unknown>"}getDebugInstance({modifier:e}){return e}getTag({tag:e}){return e}install({element:e,args:t,modifier:n,delegate:r}){let{capabilities:i}=r;i.disableAutoTracking?Ve(()=>r.installModifier(n,e,t)):r.installModifier(n,e,t)}update({args:e,modifier:t,delegate:n}){let{capabilities:r}=n;r.disableAutoTracking?Ve(()=>n.updateModifier(t,e)):n.updateModifier(t,e)}getDestroyable(e){return e}};function gb(e,t){return Nu(new hb(e),t)}function mb(e,t){return Iu(new fb(e),t)}function yb(e,t){return Mu(new xu(e),t)}var vb=Symbol("RECOMPUTE_TAG"),bb=Symbol("IS_CLASSIC_HELPER"),wb=class extends Yc{static isHelperFactory=!0;static[bb]=!0;static helper=kb;init(e){super.init(e),this[vb]=fe()}recompute(){_s(()=>de(this[vb]))}},_b=class{capabilities=bu(0,{hasValue:!0,hasDestroyable:!0});ownerInjection;constructor(e){let t={};Br(t,e),this.ownerInjection=t}createHelper(e,t){return{instance:(n=e,null!=n&&"class"in n?e.create():e.create(this.ownerInjection)),args:t};var n}getDestroyable({instance:e}){return e}getValue({instance:e,args:t}){let{positional:n,named:r}=t,i=e.compute(n,r);return Ne(e[vb]),i}getDebugName(e){return eb((e.class||e).prototype)}};yb(e=>new _b(e),wb);var xb=Ou(wb),Cb=class{isHelperFactory=!0;constructor(e){this.compute=e}create(){return{compute:this.compute}}},Sb=new class{capabilities=bu(0,{hasValue:!0});createHelper(e,t){return()=>e.compute.call(null,t.positional,t.named)}getValue(e){return e()}getDebugName(e){return eb(e.compute)}};function kb(e){return new Cb(e)}yb(()=>Sb,Cb.prototype);var Eb=Uv(()=>dt("30000000-1000-4000-2000-100000000000".replace(/[0-3]/g,e=>(4*e^16*Math.random()>>(2&e)).toString(16)))),Rb=class{constructor(e,t,n,r,i){this.main=e,this.trustingGuardedAppend=t,this.cautiousGuardedAppend=n,this.trustingNonDynamicAppend=r,this.cautiousNonDynamicAppend=i}get"trusting-append"(){return this.trustingGuardedAppend}get"cautious-append"(){return this.cautiousGuardedAppend}get"trusting-non-dynamic-append"(){return this.trustingNonDynamicAppend}get"cautious-non-dynamic-append"(){return this.cautiousNonDynamicAppend}getAppend(e){return e?this.trustingGuardedAppend:this.cautiousGuardedAppend}};function Tb(e,t,n){jf(e,()=>e(76),r=>{r(2,()=>{t?(e(68),e(43)):e(47)}),"number"==typeof n?(r(0,()=>{e(68),e(81),e(79),function(e){e(36,4),e(33,3,1),e(35,4),e(0),e(83),e(85,4),Hf(e,!1,!1,!0,()=>{e(92,4),e(95,4)}),e(35,4)}(e)}),r(1,()=>{Ef(e,null,null,()=>{e(3,n)})})):(r(0,()=>{e(47)}),r(1,()=>{e(47)})),r(4,()=>{e(68),e(44)}),r(5,()=>{e(68),e(45)}),r(6,()=>{e(68),e(46)})})}var Lb={symbols:{locals:null,upvars:null},moduleName:"stdlib",scopeValues:null,isStrictMode:!0,owner:null,size:0};function Ib(e,t){let n=new yf(e.program.heap,Lb);t(function(...t){mf(n,e,Lb,t)});let r=n.commit(0);if("number"!=typeof r)throw new Error("Unexpected errors compiling std");return r}var Pb=class{constants;heap;resolver;stdlib;createOp;env;program;constructor({constants:e,heap:t},n,r){this.constants=e,this.heap=t,this.resolver=r.resolver,this.createOp=n,this.env=r.env,this.program=r.program,this.stdlib=function(e){let t=Ib(e,e=>function(e){e(75,4),Hf(e,!1,!1,!0)}(e)),n=Ib(e,e=>Tb(e,!0,null)),r=Ib(e,e=>Tb(e,!1,null)),i=Ib(e,e=>Tb(e,!0,n)),s=Ib(e,e=>Tb(e,!1,r));return new Rb(t,i,s,n,r)}(this)}};function Mb(e){return{object:`${e.name}:main`}}var Ab,Ob={dynamicLayout:!1,dynamicTag:!1,prepareArgs:!1,createArgs:!1,attributeHook:!1,elementHook:!1,createCaller:!1,dynamicScope:!0,updateHook:!1,createInstance:!0,wrapped:!1,willDestroy:!1,hasSubOwner:!1},Nb=gu(Ob),Fb=new class{create(e,t,n,r,i){let s=i.get("outletState"),o=t.ref;i.set("outletState",o);let a={finalize:hv("render.outlet",Mb,t)};if(void 0!==r.debugRenderTree){let e=wt(s)?.render?.owner,t=wt(o)?.render?.owner;if(e&&e!==t){let e=t,{mountPoint:n}=e;n&&(a.engine={mountPoint:n,instance:e})}}return a}getDebugName({name:e}){return`{{outlet}} for ${e}`}getDebugCustomRenderTree(e,t){let n=[];return n.push({bucket:t,type:"outlet",name:"main",args:ay,instance:void 0}),t.engine&&n.push({bucket:t.engine,type:"engine",name:t.engine.mountPoint,args:ay,instance:t.engine.instance}),n}getCapabilities(){return Ob}getSelf(){return lt}didCreate(){}didUpdate(){}didRenderLayout(e){e.finalize()}didUpdateLayout(){}getDestroyable(){return null}},Db=rg({id:null,block:'[[[8,[30,1],null,[["@controller","@model"],[[30,2],[30,3]]],null]],["@Component","@controller","@model"],[]]',moduleName:"(unknown template module)",isStrictMode:!0}),zb=class{handle=-1;resolvedName=null;manager=Fb;capabilities=Nb;compilable;constructor(e,t){this.state=t,this.compilable=mv(Db(e)).asLayout()}},jb=class extends Pv{component;constructor(e){super(),this.component=e}create(e,t,n,{isInteractive:r},i){let s=this.component,o=hv("render.component",Mv,s);i.view=s;let a=""!==s.tagName;a||(r&&s.trigger("willRender"),s._transitionTo("hasElement"),r&&s.trigger("willInsertElement"));let l=new xv(s,null,me,o,a,r);return Ne(s[Rv]),l}},Ub={dynamicLayout:!0,dynamicTag:!0,prepareArgs:!1,createArgs:!1,attributeHook:!0,elementHook:!0,createCaller:!0,dynamicScope:!0,updateHook:!0,createInstance:!0,wrapped:!0,willDestroy:!1,hasSubOwner:!1},Bb=class{handle=-1;resolvedName="-top-level";state;manager;capabilities=gu(Ub);compilable=null;constructor(e){this.manager=new jb(e);let t=Ya(e);this.state=t}},$b=class{constructor(e){this.inner=e}},qb=Uv(({positional:e})=>{const t=e[0];return ft(()=>{let e=wt(t);return Ne(Ot(e)),tr(e)&&(e=Dv(e)),new $b(e)})}),Vb=class{position=0;constructor(e){this.length=e}isEmpty(){return!1}memoFor(e){return e}next(){let{length:e,position:t}=this;if(t>=e)return null;let n=this.valueFor(t),r=this.memoFor(t);return this.position++,{value:n,memo:r}}},Wb=class extends Vb{static from(e){return e.length>0?new this(e):null}static fromForEachable(e){let t=[];return e.forEach(e=>t.push(e)),this.from(t)}constructor(e){super(e.length),this.array=e}valueFor(e){return this.array[e]}},Hb=class extends Vb{static from(e){return e.length>0?new this(e):null}constructor(e){super(e.length),this.array=e}valueFor(e){return Pt(this.array,e)}},Gb=class extends Vb{static fromIndexable(e){let t=Object.keys(e);if(0===t.length)return null;{let n=[];for(let r of t){let t;t=e[r],Oe()&&(Ne(Ke(e,r)),Array.isArray(t)&&Ne(Ke(t,"[]"))),n.push(t)}return new this(t,n)}}static fromForEachable(e){let t=[],n=[],r=0,i=!1;return e.forEach(function(e,s){i=i||arguments.length>=2,i&&t.push(s),n.push(e),r++}),0===r?null:i?new this(t,n):new Wb(n)}constructor(e,t){super(t.length),this.keys=e,this.values=t}valueFor(e){return this.values[e]}memoFor(e){return this.keys[e]}},Kb=class{static from(e){let t=e[Symbol.iterator](),n=t.next(),{done:r}=n;return r?null:new this(t,n)}position=0;constructor(e,t){this.iterable=e,this.result=t}isEmpty(){return!1}next(){let{iterable:e,result:t,position:n}=this;if(t.done)return null;let r=this.valueFor(t,n),i=this.memoFor(t,n);return this.position++,this.result=e.next(),{value:r,memo:i}}},Zb=class extends Kb{valueFor(e){return e.value}memoFor(e,t){return t}},Yb=class extends Kb{valueFor(e){return e.value[1]}memoFor(e){return e.value[0]}};function Xb(e){return null!=e&&"function"==typeof e.forEach}function Jb(e){return null!=e&&"function"==typeof e[Symbol.iterator]}W=(Ab={scheduleRevalidate(){bs.ensureInstance()},toBool:function(e){return tr(e)?(Ne(At(e,"content")),Boolean(ur(e,"isTruthy"))):Ic(e)?(Ne(At(e,"[]")),0!==e.length):null!==(t=e)&&"object"==typeof t&&"function"==typeof t.toHTML?Boolean(e.toString()):Boolean(e);var t},toIterator:function(e){return e instanceof $b?function(e){return null===(t=e)||"object"!=typeof t&&"function"!=typeof t?null:Array.isArray(e)||ir(e)?Gb.fromIndexable(e):Jb(e)?Yb.from(e):Xb(e)?Gb.fromForEachable(e):Gb.fromIndexable(e);var t}(e.inner):function(e){return Ze(e)?Array.isArray(e)?Wb.from(e):ir(e)?Hb.from(e):Jb(e)?Zb.from(e):Xb(e)?Wb.fromForEachable(e):null:null}(e)},getProp:hr,setProp:mr,getPath:ur,setPath:gr,scheduleDestroy(e,t){ks("actions",null,t,e)},scheduleDestroyed(e){ks("destroy",null,e)},warnIfStyleNotTrusted(e){},assert(e,t,n){},deprecate(e,t,n){}}).scheduleRevalidate,D=Ab.scheduleDestroy,z=Ab.scheduleDestroyed,j=Ab.toIterator,U=Ab.toBool,B=Ab.getProp,$=Ab.setProp,q=Ab.getPath,V=Ab.setPath;var Qb=class{enableDebugTooling=O._DEBUG_RENDER_TREE;constructor(e,t){this.owner=e,this.isInteractive=t}onTransactionCommit(){}},ew=Uv(({positional:e,named:t})=>{const n=e[0];let r=t.type,i=t.loc,s=t.original;return wt(r),wt(i),wt(s),ft(()=>wt(n))}),tw=Uv(e=>e.positional[0]),nw=Uv(({positional:e})=>ft(()=>{let t=e[0],n=e[1],r=wt(t).split("."),i=r[r.length-1],s=wt(n);return!0===s?ip(i):s||0===s?String(s):""})),rw=Uv(({positional:e},t)=>{let n=wt(e[0]);return dt(t.factoryFor(n)?.class)}),iw=Uv(({positional:e})=>{const t=e[0];return ft(()=>{let e=wt(t);return Ze(e)&&Ne(At(e,"[]")),e})}),sw=Uv(({positional:e})=>yt(e[0])),ow=Uv(({positional:e})=>gt(e[0])),aw=Uv(({positional:e,named:t})=>pt(wt(e[0]))),lw={dynamicLayout:!0,dynamicTag:!1,prepareArgs:!1,createArgs:!0,attributeHook:!1,elementHook:!1,createCaller:!0,dynamicScope:!0,updateHook:!0,createInstance:!0,wrapped:!1,willDestroy:!1,hasSubOwner:!0},cw=new class{getDynamicLayout(e){return mv(e.engine.lookup("template:application")(e.engine)).asLayout()}getCapabilities(){return lw}getOwner(e){return e.engine}create(e,{name:t},n,r){let i=e.buildChildEngineInstance(t);i.boot();let s,o,a,l,c=i.factoryFor("controller:application")||Fh(i,"application");if(n.named.has("model")&&(l=n.named.get("model")),void 0===l)s=c.create(),o=dt(s),a={engine:i,controller:s,self:o,modelRef:l};else{let e=wt(l);s=c.create({model:e}),o=dt(s),a={engine:i,controller:s,self:o,modelRef:l}}return r.debugRenderTree&&Q(i,s),a}getDebugName({name:e}){return e}getDebugCustomRenderTree(e,t,n){return[{bucket:t.engine,instance:t.engine,type:"engine",name:e.name,args:n},{bucket:t.controller,instance:t.controller,type:"route-template",name:"application",args:n}]}getSelf({self:e}){return e}getDestroyable(e){return e.engine}didCreate(){}didUpdate(){}didRenderLayout(){}didUpdateLayout(){}update(e){let{controller:t,modelRef:n}=e;void 0!==n&&t.set("model",wt(n))}},uw=class{handle=-1;state;manager=cw;compilable=null;capabilities=gu(lw);constructor(e){this.resolvedName=e,this.state={name:e}}},hw=Uv((e,t)=>{let n,r,i,s=e.positional[0];return n=Ym(e.named,oy),ft(()=>{let e=wt(s);return"string"==typeof e?(r===e||(r=e,i=_m(0,new uw(e),t,n,!0)),i):(i=null,r=null,null)})}),dw={dynamicLayout:!1,dynamicTag:!1,prepareArgs:!1,createArgs:!0,attributeHook:!1,elementHook:!1,createCaller:!1,dynamicScope:!1,updateHook:!1,createInstance:!0,wrapped:!1,willDestroy:!1,hasSubOwner:!1},pw=gu(dw),fw=new class{create(e,t,n){let r=n.named.get("controller");return{self:r,controller:wt(r)}}getSelf({self:e}){return e}getDebugName({name:e}){return`route-template (${e})`}getDebugCustomRenderTree({name:e},t,n){return[{bucket:t,type:"route-template",name:e,args:n,instance:t.controller}]}getCapabilities(){return dw}didRenderLayout(){}didUpdateLayout(){}didCreate(){}didUpdate(){}getDestroyable(){return null}},gw=class{handle=-1;resolvedName;state;manager=fw;capabilities=pw;compilable;constructor(e,t){let n=mv(t);this.resolvedName=e,this.state={name:e},this.compilable=n.asLayout()}};function mw(e,t,n){return _m(0,new gw(t,n),e,null,!0)}var yw=Uv((e,t,n)=>{let r=ft(()=>wt(n.get("outletState"))?.outlets?.main),i=null,s=null;return ft(()=>{let e=wt(r),n=function(e,t){if(void 0===t)return null;let n=t.render;if(void 0===n)return null;let r=n.template;return null==r?null:{ref:e,name:n.name,template:r,controller:n.controller}}(r,e);if(!function(e,t){return null!==e&&null!==t&&e.template===t.template&&e.controller===t.controller}(n,i))if(i=n,null!==n){let o,a=e?.render?.owner??t,l=tt(),c=n.template;o=Du(c)?c:mw(a,n.name,c),l.Component=dt(o),l.controller=dt(n.controller);let u=Ct(r,["render","model"]),h=wt(u);l.model=ft(()=>(i===n&&(h=wt(u)),h));let d=Ym(l,oy);s=_m(0,new zb(t,n),a,d,!0)}else s=null;return s})});function vw(e){return{object:`component:${e}`}}var bw={mut:sw,readonly:ow,unbound:aw,"-hash":Hv,"-each-in":qb,"-normalize-class":nw,"-resolve":rw,"-track-array":iw,"-mount":hw,"-outlet":yw,"-in-el-null":tw},ww={...bw,array:Vv,concat:Kv,fn:Wv,get:Zv,hash:Hv,"unique-id":Eb};ww["-disallow-dynamic-resolution"]=ew;var _w={},xw={..._w,on:tb},Cw=class{componentDefinitionCache=new Map;lookupPartial(){return null}lookupHelper(e,t){let n=ww[e];if(void 0!==n)return n;let r=t.factoryFor(`helper:${e}`);if(void 0===r)return null;let i=r.class;return void 0===i?null:"function"==typeof i&&!0===i[bb]?(Mu(xb,r),r):i}lookupBuiltInHelper(e){return bw[e]??null}lookupModifier(e,t){let n=xw[e];if(void 0!==n)return n;let r=t.factoryFor(`modifier:${e}`);return void 0===r?null:r.class||null}lookupBuiltInModifier(e){return _w[e]??null}lookupComponent(e,t){let n=function(e,t){let n=function(e,t){let n=`component:${e}`;return t.factoryFor(n)||null}(t,e);if(null!=(r=n)&&"function"==typeof r.create&&n.class){let e=Op(n.class);if(void 0!==e)return{component:n,layout:e}}var r;return null===n?null:{component:n,layout:null}}(t,e);if(null===n)return null;let r,i=null;r=null===n.component?i=n.layout(t):n.component;let s=this.componentDefinitionCache.get(r);if(void 0!==s)return s;null===i&&null!==n.layout&&(i=n.layout(t));let o=hv("render.getComponentDefinition",vw,e),a=null;if(null===n.component)a={state:ob(void 0,e),manager:ib,template:i};else{let e=n.component,t=e.class,r=Fu(t);a={state:Fv(r)?e:t,manager:r,template:i}}return o(),this.componentDefinitionCache.set(r,a),a}},Sw="-top-level",kw=class e{static extend(t){return class extends e{static create(e){return e?super.create(Object.assign({},t,e)):super.create(t)}}}static reopenClass(e){Object.assign(this,e)}static create(t){let{environment:n,application:r,template:i}=t,s=Ur(t),o=i(s);return new e(n,s,o,r)}ref;state;constructor(e,t,n,r){this._environment=e,this.owner=t,this.template=n,this.namespace=r;let i=fe(),s={outlets:{main:void 0},render:{owner:t,name:Sw,controller:void 0,model:void 0,template:n}},o=this.ref=ft(()=>(Ne(i),s),e=>{de(i),s.outlets.main=e});this.state={ref:o,name:Sw,template:n,controller:void 0}}appendTo(e){let t;t=this._environment.hasDOM&&"string"==typeof e?document.querySelector(e):e,ks("render",this.owner.lookup("renderer:-dom"),"appendOutletView",this,t)}rerender(){}setOutletState(e){_t(this.ref,e)}destroy(){}},Ew=class e{constructor(e,t){this.view=e,this.outletState=t}child(){return new e(this.view,this.outletState)}get(e){return this.outletState}set(e,t){return this.outletState=t,t}},Rw=()=>{},Tw=class{type="component";#g;#m;constructor(e,t,n){this.#m=()=>{let r=rv(e.context,e.builder(e.env,n.into),e.owner,t,n?.args),i=this.#g=r.sync();Q(this,this.#g),this.#m=()=>{if(!re(i)&&!ie(i))return i.rerender({alwaysRevalidate:!1})}}}isFor(e){return!1}render(){this.#m()}destroy(){te(this)}get destroyed(){return ie(this)}get result(){return this.#g}},Lw=class{type="classic";id;result;destroyed;render;env;constructor(e,t,n,r,i,s,o,a){this.root=e,this.id=e instanceof kw?al(e):Kl(e),this.result=void 0,this.destroyed=!1,this.env=t.env,this.render=()=>{let e=mv(r).asLayout(),l=nv(t,n,i,a(t.env,{element:s,nextSibling:null}),e,o),c=this.result=l.sync();Q(this,c),this.render=()=>{if(!re(c)&&!ie(c))return c.rerender({alwaysRevalidate:!1})}}}isFor(e){return this.root===e}destroy(){let{result:e,env:t}=this;this.destroyed=!0,this.root=null,this.result=void 0,this.render=void 0,void 0!==e&&Iy(t,()=>te(e))}},Iw=[];function Pw(e){let t=Iw.indexOf(e);Iw.splice(t,1)}var Mw=null,Aw=0;bs.on("begin",function(){for(let e of Iw)e.rerender()}),bs.on("end",function(){for(let e of Iw)if(!e.isValid()){if(Aw>O._RERENDER_LOOP_LIMIT)throw Aw=0,e.destroy(),new Error("infinite rendering invalidation detected");return Aw++,bs.join(null,Rw)}Aw=0,function(){if(null!==Mw){let e=Mw.resolve;Mw=null,bs.join(null,e)}}()});var Ow=class e{static create(t,n){const r=new e(t,n);return Q(n,r),r}#y;#v=-1;#b=!1;#w=!1;#_=[];#x=[];constructor(e,t){this.#y=e,ee(this,()=>{this.clearAllRoots(t)})}get debug(){return{roots:this.#_,inRenderTransaction:this.#b,isInteractive:this.isInteractive}}get roots(){return this.#_}get owner(){return this.#y.owner}get builder(){return this.#y.builder}get context(){return this.#y.context}get env(){return this.context.env}get isInteractive(){return this.#y.context.env.isInteractive}renderRoot(e,t){let n=this.#_;return n.push(e),Q(this,e),1===n.length&&function(e){Iw.push(e)}(t),this.#C(t),e}#C(e){if(this.#b)return;this.#b=!0;let t=!1;try{this.renderRoots(e),t=!0}finally{t||(this.#v=le(_e)),this.#b=!1}}renderRoots(e){let t,n=this.#_,r=this.#x;do{t=n.length,Iy(this.context.env,()=>{for(let e=0;e<n.length;e++){let i=n[e];i.destroyed?r.push(i):e>=t||i.render()}this.#v=le(_e)})}while(n.length>t);for(;r.length;){let e=r.pop(),t=n.indexOf(e);n.splice(t,1)}0===this.#_.length&&Pw(e)}scheduleRevalidate(e){bs.scheduleOnce("render",this,this.revalidate,e)}isValid(){return this.#w||0===this.#_.length||ce(_e,this.#v)}revalidate(e){this.isValid()||this.#C(e)}clearAllRoots(e){let t=this.#_;for(let n of t)te(n);this.#x.length=0,this.#_=[],t.length&&Pw(e)}},Nw=class e{static strict(t,n,r){return new e(t,{hasDOM:Mo,...r},n,new Cw,im)}state;constructor(e,t,n,r,i){let s={constants:new pg,heap:new ag},o=Ly({document:n},new Qb(e,t.isInteractive),s,r),a=new Pb(s,e=>new sg(e),o);this.state=Ow.create({owner:e,context:a,builder:i},this)}get debugRenderTree(){let{debugRenderTree:e}=this.state.env;return e}isValid(){return this.state.isValid()}destroy(){te(this)}render(e,t){const n=new Tw(this.state,e,{args:t.args,into:(r=t.into,"element"in r?r:{element:r,nextSibling:null})});var r;return this.state.renderRoot(n,this)}rerender(){this.state.scheduleRevalidate(this)}},Fw=class extends Nw{static strict(e,t,n){return new Nw(e,{hasDOM:Mo,...n},t,new Cw,im)}_rootTemplate;_viewRegistry;static create(e){let{_viewRegistry:t}=e,n=Ur(e),r=n.lookup("service:-document"),i=n.lookup("-environment:main"),s=n.lookup(mc`template:-root`),o=n.lookup("service:-dom-builder");return new this(n,r,i,s,t,o)}constructor(e,t,n,r,i,s=im,o=new Cw){super(e,n,t,o,s),this._rootTemplate=r(e),this._viewRegistry=i||e.lookup("-view-registry:main")}appendOutletView(e,t){let n=new zb((r=e).owner,r.state);var r;let{name:i,template:s}=e.state,o=tt();o.Component=dt(mw(e.owner,i,s)),o.controller=lt,o.model=lt;let a=Ym(o,oy);this._appendDefinition(e,_m(0,n,e.owner,a,!0),t)}appendTo(e,t){let n=new Bb(e);this._appendDefinition(e,_m(0,n,this.state.owner,null,!0),t)}_appendDefinition(e,t,n){let r=dt(t),i=new Ew(null,lt),s=new Lw(e,this.state.context,this.state.owner,this._rootTemplate,r,n,i,this.state.builder);this.state.renderRoot(s,this)}cleanupRootFor(e){if(ie(this))return;let t=this.state.roots,n=t.length;for(;n--;){let r=t[n];"classic"===r.type&&r.isFor(e)&&(r.destroy(),t.splice(n,1))}}remove(e){e._transitionTo("destroying"),this.cleanupRootFor(e),this.state.isInteractive&&e.trigger("didDestroyElement")}get _roots(){return this.state.debug.roots}get _inRenderTransaction(){return this.state.debug.inRenderTransaction}get _isInteractive(){return this.state.debug.isInteractive}get _context(){return this.state.context}register(e){let t=Kl(e);this._viewRegistry[t]=e}unregister(e){delete this._viewRegistry[Kl(e)]}getElement(e){if(this._isInteractive)return Jl(e);throw new Error("Accessing `this.element` is not allowed in non-interactive environments (such as FastBoot).")}getBounds(e){let t=e[Lv];return{parentElement:t.parentElement(),firstNode:t.firstNode(),lastNode:t.lastNode()}}},Dw=class extends uu{rootElement=null;init(e){super.init(e),this.application._watchInstance(this),this.register("-application-instance:main",this,{instantiate:!1})}_bootSync(e){return this._booted||(e=new zw(e),this.setupRegistry(e),e.rootElement?this.rootElement=e.rootElement:this.rootElement=this.application.rootElement,e.location&&gr(this.router,"location",e.location),this.application.runInstanceInitializers(this),e.isInteractive&&this.setupEventDispatcher(),this._booted=!0),this}setupRegistry(e){this.constructor.setupRegistry(this.__registry__,e)}_router;get router(){if(!this._router){let e=this.lookup("router:main");this._router=e}return this._router}didCreateRootView(e){e.appendTo(this.rootElement)}startRouting(){this.router.startRouting()}setupRouter(){this.router.setupRouter()}handleURL(e){return this.setupRouter(),this.router.handleURL(e)}setupEventDispatcher(){let e=this.lookup("event_dispatcher:main"),t=ur(this.application,"customEvents"),n=ur(this,"customEvents"),r=Object.assign({},t,n);return e.setup(r,this.rootElement),e}getURL(){return this.router.url}visit(e){this.setupRouter();let t=this.__container__.lookup("-environment:main"),n=this.router,r=ur(n,"location");return r.setURL(e),n.handleURL(r.getURL()).followRedirects().then(()=>t.options.shouldRender?function(){if(null===Mw){let e;Mw={promise:new Promise(t=>e=t),resolve:e},ms()||bs.schedule("actions",null,Rw)}return Mw.promise}().then(()=>this):this,e=>{throw e.error&&e.error instanceof Error?e.error:"TransitionAborted"===e.name?new Error(e.message):e})}willDestroy(){super.willDestroy(),this.application._unwatchInstance(this)}static setupRegistry(e,t={}){let n=t instanceof zw?t:new zw(t);e.register("-environment:main",n.toEnvironment(),{instantiate:!1}),e.register("service:-document",n.document,{instantiate:!1}),super.setupRegistry(e,n)}},zw=class{isInteractive;_renderMode;isBrowser;location=null;shouldRender;document;rootElement;constructor(e={}){this.isInteractive=Boolean(Mo),this._renderMode=e._renderMode,void 0!==e.isBrowser?this.isBrowser=Boolean(e.isBrowser):this.isBrowser=Boolean(Mo),this.isBrowser||(this.isInteractive=!1,this.location="none"),void 0!==e.shouldRender?this.shouldRender=Boolean(e.shouldRender):this.shouldRender=!0,this.shouldRender||(this.isInteractive=!1),e.document?this.document=e.document:this.document="undefined"!=typeof document?document:null,e.rootElement&&(this.rootElement=e.rootElement),void 0!==e.location&&(this.location=e.location),void 0!==e.isInteractive&&(this.isInteractive=Boolean(e.isInteractive))}toEnvironment(){return{...kp,hasDOM:this.isBrowser,isInteractive:this.isInteractive,_renderMode:this._renderMode,options:this}}},jw=a({default:()=>Uw}),Uw=class extends Ul{static NAMESPACES=ai;static NAMESPACES_BY_ID=li;static processAll=fi;static byName=di;init(e){super.init(e),ci(this)}toString(){let e=ur(this,"name")||ur(this,"modulePrefix");if(e)return e;hi();let t=ni(this);return void 0===t&&(t=al(this),ti(this,t)),t}nameClasses(){pi(this)}destroy(){return ui(this),super.destroy()}};Uw.prototype.isNamespace=!0;var Bw=function(){function e(){this._vertices=new $w}return e.prototype.add=function(e,t,n,r){if(!e)throw new Error("argument `key` is required");var i=this._vertices,s=i.add(e);if(s.val=t,n)if("string"==typeof n)i.addEdge(s,i.add(n));else for(var o=0;o<n.length;o++)i.addEdge(s,i.add(n[o]));if(r)if("string"==typeof r)i.addEdge(i.add(r),s);else for(o=0;o<r.length;o++)i.addEdge(i.add(r[o]),s)},e.prototype.addEdges=function(e,t,n,r){this.add(e,t,n,r)},e.prototype.each=function(e){this._vertices.walk(e)},e.prototype.topsort=function(e){this.each(e)},e}(),$w=function(){function e(){this.length=0,this.stack=new qw,this.path=new qw,this.result=new qw}return e.prototype.add=function(e){if(!e)throw new Error("missing key");for(var t,n=0|this.length,r=0;r<n;r++)if((t=this[r]).key===e)return t;return this.length=n+1,this[n]={idx:n,key:e,val:void 0,out:!1,flag:!1,length:0}},e.prototype.addEdge=function(e,t){this.check(e,t.key);for(var n=0|t.length,r=0;r<n;r++)if(t[r]===e.idx)return;t.length=n+1,t[n]=e.idx,e.out=!0},e.prototype.walk=function(e){this.reset();for(var t=0;t<this.length;t++){var n=this[t];n.out||this.visit(n,"")}this.each(this.result,e)},e.prototype.check=function(e,t){if(e.key===t)throw new Error("cycle detected: "+t+" <- "+t);if(0!==e.length){for(var n=0;n<e.length;n++)if(this[e[n]].key===t)throw new Error("cycle detected: "+t+" <- "+e.key+" <- "+t);if(this.reset(),this.visit(e,t),this.path.length>0){var r="cycle detected: "+t;throw this.each(this.path,function(e){r+=" <- "+e}),new Error(r)}}},e.prototype.reset=function(){this.stack.length=0,this.path.length=0,this.result.length=0;for(var e=0,t=this.length;e<t;e++)this[e].flag=!1},e.prototype.visit=function(e,t){var n=this,r=n.stack,i=n.path,s=n.result;for(r.push(e.idx);r.length;){var o=0|r.pop();if(o>=0){var a=this[o];if(a.flag)continue;if(a.flag=!0,i.push(o),t===a.key)break;r.push(~o),this.pushIncoming(a)}else i.pop(),s.push(~o)}},e.prototype.pushIncoming=function(e){for(var t=this.stack,n=e.length-1;n>=0;n--){var r=e[n];this[r].flag||t.push(r)}},e.prototype.each=function(e,t){for(var n=0,r=e.length;n<r;n++){var i=this[e[n]];t(i.key,i.val)}},e}(),qw=function(){function e(){this.length=0}return e.prototype.push=function(e){this[this.length++]=0|e},e.prototype.pop=function(){return 0|this[--this.length]},e}(),Vw=class extends Ul{constructor(e){super(e),this.resolver=Ur(this).lookup("resolver-for-debugging:main")}resolver;canCatalogEntriesByType(e){return"model"!==e&&"template"!==e}catalogEntriesByType(e){let t=Uw.NAMESPACES,n=[],r=new RegExp(`${i=e,tp.get(i)}$`);var i;return t.forEach(e=>{for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.test(t)&&"class"===Sc(e[t])&&n.push(ip(t.replace(r,"")))}),n}},Ww=tb;function Hw(){}var Gw=class{static toString(){return"internal component"}constructor(e,t,n){this.owner=e,this.args=t,this.caller=n,Br(this,e)}get id(){return al(this)}get class(){return"ember-view"}validateArguments(){for(let e of Object.keys(this.args.named))this.isSupportedArgument(e)||this.onUnsupportedArgument(e)}named(e){let t=this.args.named[e];return t?wt(t):void 0}positional(e){let t=this.args.positional[e];return t?wt(t):void 0}listenerFor(e){return this.named(e)||Hw}isSupportedArgument(e){return!1}onUnsupportedArgument(e){}toString(){return`<${this.constructor}:${al(this)}>`}},Kw=new WeakMap;function Zw(e,t){let n={create(){throw void 0},toString:()=>e.toString()};return Kw.set(n,e),Nu(Xw,n),Ap(t,n),n}var Yw={dynamicLayout:!1,dynamicTag:!1,prepareArgs:!1,createArgs:!0,attributeHook:!1,elementHook:!1,createCaller:!0,dynamicScope:!1,updateHook:!1,createInstance:!0,wrapped:!1,willDestroy:!1,hasSubOwner:!1},Xw=new class{getCapabilities(){return Yw}create(e,t,n,r,i,s){let o=new(a=t,Kw.get(a))(e,n.capture(),wt(s));var a;return Ve(o.validateArguments.bind(o)),o}didCreate(){}didUpdate(){}didRenderLayout(){}didUpdateLayout(){}getDebugName(e){return e.toString()}getSelf(e){return dt(e)}getDestroyable(e){return e}},Jw=rg({id:null,block:'[[[11,"input"],[16,1,[30,0,["id"]]],[16,0,[30,0,["class"]]],[17,1],[16,4,[30,0,["type"]]],[16,"checked",[30,0,["checked"]]],[16,2,[30,0,["value"]]],[4,[32,0],["change",[30,0,["change"]]],null],[4,[32,0],["input",[30,0,["input"]]],null],[4,[32,0],["keyup",[30,0,["keyUp"]]],null],[4,[32,0],["paste",[30,0,["valueDidChange"]]],null],[4,[32,0],["cut",[30,0,["valueDidChange"]]],null],[12],[13]],["&attrs"],[]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/input.hbs",scope:()=>({on:Ww}),isStrictMode:!0}),Qw=Object.freeze({});function e_(e){return function(e){return e.target}(e).value}function t_(e){return void 0===e?new r_(void 0):vt(e)?new r_(wt(e)):bt(e)?new i_(e):new s_(e)}var n_,r_=class{static{Gh(this.prototype,"value",[Vr])}#S=void Zh(this,"value");constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}},i_=class{constructor(e){this.reference=e}get(){return wt(this.reference)}set(e){_t(this.reference,e)}},s_=class{local;upstream;lastUpstreamValue=Qw;constructor(e){this.upstream=new i_(e)}get(){let e=this.upstream.get();return e!==this.lastUpstreamValue&&(this.lastUpstreamValue=e,this.local=new r_(e)),this.local.get()}set(e){this.local.set(e)}},o_=class extends Gw{validateArguments(){super.validateArguments()}_value=t_(this.args.named.value);get value(){return this._value.get()}set value(e){this._value.set(e)}valueDidChange(e){this.value=e_(e)}static{Kh(this.prototype,"valueDidChange",[ql])}change(e){this.valueDidChange(e)}input(e){this.valueDidChange(e)}keyUp(e){switch(e.key){case"Enter":this.listenerFor("enter")(e),this.listenerFor("insert-newline")(e);break;case"Escape":this.listenerFor("escape-press")(e)}}static{Kh(this.prototype,"keyUp",[ql])}listenerFor(e){let t=super.listenerFor(e);return this.isVirtualEventListener(e,t)?function(e){return t=>e(e_(t),t)}(t):t}isVirtualEventListener(e,t){return-1!==["enter","insert-newline","escape-press"].indexOf(e)}};if(Mo){const e=Object.create(null),t=document.createElement("input");e[""]=!1,e.text=!0,e.checkbox=!0,n_=n=>{let r=e[n];if(void 0===r){try{t.type=n,r=t.type===n}catch(i){r=!1}finally{t.type="text"}e[n]=r}return r}}else n_=e=>""!==e;var a_=class extends o_{static toString(){return"Input"}get class(){return this.isCheckbox?"ember-checkbox ember-view":"ember-text-field ember-view"}get type(){let e=this.named("type");return null==e?"text":n_(e)?e:"text"}get isCheckbox(){return"checkbox"===this.named("type")}_checked=t_(this.args.named.checked);get checked(){return this.isCheckbox?this._checked.get():void 0}set checked(e){this._checked.set(e)}change(e){this.isCheckbox?this.checkedDidChange(e):super.change(e)}static{Kh(this.prototype,"change",[ql])}input(e){this.isCheckbox||super.input(e)}static{Kh(this.prototype,"input",[ql])}checkedDidChange(e){let t=e.target;this.checked=t.checked}static{Kh(this.prototype,"checkedDidChange",[ql])}isSupportedArgument(e){return-1!==["type","value","checked","enter","insert-newline","escape-press"].indexOf(e)||super.isSupportedArgument(e)}},l_=Zw(a_,Jw),c_=rg({id:null,block:'[[[11,"textarea"],[16,1,[30,0,["id"]]],[16,0,[30,0,["class"]]],[17,1],[16,2,[30,0,["value"]]],[4,[32,0],["change",[30,0,["change"]]],null],[4,[32,0],["input",[30,0,["input"]]],null],[4,[32,0],["keyup",[30,0,["keyUp"]]],null],[4,[32,0],["paste",[30,0,["valueDidChange"]]],null],[4,[32,0],["cut",[30,0,["valueDidChange"]]],null],[12],[13]],["&attrs"],[]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/textarea.hbs",scope:()=>({on:Ww}),isStrictMode:!0}),u_=class extends o_{static toString(){return"Textarea"}get class(){return"ember-text-area ember-view"}change(e){super.change(e)}static{Kh(this.prototype,"change",[ql])}input(e){super.input(e)}static{Kh(this.prototype,"input",[ql])}isSupportedArgument(e){return-1!==["type","value","enter","insert-newline","escape-press"].indexOf(e)||super.isSupportedArgument(e)}},h_=Zw(u_,c_),d_=rg({id:null,block:'[[[11,3],[16,1,[30,0,["id"]]],[16,0,[30,0,["class"]]],[16,"role",[30,0,["role"]]],[16,"title",[30,0,["title"]]],[16,"rel",[30,0,["rel"]]],[16,"tabindex",[30,0,["tabindex"]]],[16,"target",[30,0,["target"]]],[17,1],[16,6,[30,0,["href"]]],[4,[32,0],["click",[30,0,["click"]]],null],[12],[18,2,null],[13]],["&attrs","&default"],["yield"]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/link-to.hbs",scope:()=>({on:Ww}),isStrictMode:!0}),p_=[],f_={};function g_(e){return null==e}function m_(e){return"object"==typeof e&&null!==e&&!0===e.isQueryParams}var y_=class extends Gw{static toString(){return"LinkTo"}static{Gh(this.prototype,"routing",[dp("-routing")])}#k=void Zh(this,"routing");validateArguments(){super.validateArguments()}get class(){let e="ember-view";return this.isActive?(e+=this.classFor("active"),!1===this.willBeActive&&(e+=" ember-transitioning-out")):this.willBeActive&&(e+=" ember-transitioning-in"),this.isLoading&&(e+=this.classFor("loading")),this.isDisabled&&(e+=this.classFor("disabled")),e}get href(){if(this.isLoading)return"#";let{routing:e,route:t,models:n,query:r}=this;return Ne(Ke(e,"currentState")),e.generateURL(t,n,r)}click(e){if(!Wl(e))return;let t=e.currentTarget,n=t instanceof SVGAElement?t.target.baseVal:t.target;if(""!==n&&"_self"!==n)return;if(this.preventDefault(e),this.isDisabled)return;if(this.isLoading)return;let{routing:r,route:i,models:s,query:o,replace:a}=this,l={transition:void 0};cv(0,0,()=>{l.transition=r.transitionTo(i,s,o,a)})}static{Kh(this.prototype,"click",[ql])}get route(){if("route"in this.args.named){let e=this.named("route");return e&&this.namespaceRoute(e)}return this.currentRoute}currentRouteCache=Ue(()=>(Ne(Ke(this.routing,"currentState")),Ve(()=>this.routing.currentRouteName)));get currentRoute(){return Be(this.currentRouteCache)}get models(){return"models"in this.args.named?this.named("models"):"model"in this.args.named?[this.named("model")]:p_}get query(){return"query"in this.args.named?{...this.named("query")}:f_}get replace(){return!0===this.named("replace")}get isActive(){return this.isActiveForState(this.routing.currentState)}get willBeActive(){let e=this.routing.currentState,t=this.routing.targetState;return e===t?null:this.isActiveForState(t)}get isLoading(){return g_(this.route)||this.models.some(e=>g_(e))}get isDisabled(){return Boolean(this.named("disabled"))}get isEngine(){return void 0!==ou(this.owner)}get engineMountPoint(){return this.owner.mountPoint}classFor(e){let t=this.named(`${e}Class`);return!0===t||g_(t)?` ${e}`:t?` ${t}`:""}namespaceRoute(e){let{engineMountPoint:t}=this;return void 0===t?e:"application"===e?t:`${t}.${e}`}isActiveForState(e){if(g_(e))return!1;if(this.isLoading)return!1;let t=this.named("current-when");if("boolean"==typeof t)return t;if("string"==typeof t){let{routing:n}=this;return t.split(" ").some(t=>n.isActiveForRoute([],void 0,this.namespaceRoute(t),e))}{let{route:t,models:n,query:r,routing:i}=this;return i.isActiveForRoute(n,r,t,e)}}preventDefault(e){e.preventDefault()}isSupportedArgument(e){return-1!==["route","model","models","query","replace","disabled","current-when","activeClass","loadingClass","disabledClass"].indexOf(e)||super.isSupportedArgument(e)}},{prototype:v_}=y_,b_=(e,t)=>e?Object.getOwnPropertyDescriptor(e,t)||b_(Object.getPrototypeOf(e),t):null;{let e=v_.onUnsupportedArgument;Object.defineProperty(v_,"onUnsupportedArgument",{configurable:!0,enumerable:!1,value:function(t){"href"===t||e.call(this,t)}})}{let e=b_(v_,"models").get;Object.defineProperty(v_,"models",{configurable:!0,enumerable:!1,get:function(){let t=e.call(this);return t.length>0&&!("query"in this.args.named)&&m_(t[t.length-1])&&(t=t.slice(0,-1)),t}});let t=b_(v_,"query").get;Object.defineProperty(v_,"query",{configurable:!0,enumerable:!1,get:function(){if("query"in this.args.named){let e=t.call(this);return m_(e)?e.values??f_:e}{let t=e.call(this);if(t.length>0){let e=t[t.length-1];if(m_(e)&&null!==e.values)return e.values}return f_}}})}{let e=v_.onUnsupportedArgument;Object.defineProperty(v_,"onUnsupportedArgument",{configurable:!0,enumerable:!1,value:function(t){"params"!==t&&e.call(this,t)}})}var w_=Zw(y_,d_),__="%+b:0%";function x_(e){return e.nodeValue===__}var C_=class extends fg{candidate=null;openBlockDepth;injectedOmittedNode=!1;constructor(e,t,n){super(e,t),this.startingBlockDepth=n,this.openBlockDepth=n-1}},S_=class extends Qg{unmatchedAttributes=null;blockDepth=0;startingBlockOffset;constructor(e,t,n){if(super(e,t,n),n)throw new Error("Rehydration with nextSibling not supported");let r=this.currentCursor.element.firstChild;for(;null!==r&&!k_(r);)r=r.nextSibling;this.candidate=r;const i=R_(r);if(0!==i){const e=i-1,t=this.dom.createComment(`%+b:${e}%`);r.parentNode.insertBefore(t,this.candidate);let n=r.nextSibling;for(;null!==n&&(!E_(n)||R_(n)!==i);)n=n.nextSibling;const s=this.dom.createComment(`%-b:${e}%`);r.parentNode.insertBefore(s,n.nextSibling),this.candidate=t,this.startingBlockOffset=e}else this.startingBlockOffset=0}get currentCursor(){return this.cursors.current}get candidate(){return this.currentCursor?this.currentCursor.candidate:null}set candidate(e){this.currentCursor.candidate=e}disableRehydration(e){const t=this.currentCursor;t.candidate=null,t.nextSibling=e}enableRehydration(e){const t=this.currentCursor;t.candidate=e,t.nextSibling=null}pushElement(e,t=null){const n=new C_(e,t,this.blockDepth||0);null!==this.candidate&&(n.candidate=e.firstChild,this.candidate=e.nextSibling),this.cursors.push(n)}clearMismatch(e){let t=e;const n=this.currentCursor;if(null!==n){const e=n.openBlockDepth;if(e>=n.startingBlockDepth)for(;t&&!(E_(t)&&e>=T_(t,this.startingBlockOffset));)t=this.remove(t);else for(;null!==t;)t=this.remove(t);this.disableRehydration(t)}}__openBlock(){const{currentCursor:e}=this;if(null===e)return;const t=this.blockDepth;this.blockDepth++;const{candidate:n}=e;if(null===n)return;const{tagName:r}=e.element;k_(n)&&T_(n,this.startingBlockOffset)===t?(this.candidate=this.remove(n),e.openBlockDepth=t):"TITLE"!==r&&"SCRIPT"!==r&&"STYLE"!==r&&this.clearMismatch(n)}__closeBlock(){const{currentCursor:e}=this;if(null===e)return;const t=e.openBlockDepth;this.blockDepth--;const{candidate:n}=e;let r=!1;if(null!==n)if(r=!0,E_(n)&&T_(n,this.startingBlockOffset)===t){const t=this.remove(n);this.candidate=t,e.openBlockDepth--}else this.clearMismatch(n),r=!1;if(!r){const t=e.nextSibling;if(null!==t&&E_(t)&&T_(t,this.startingBlockOffset)===this.blockDepth){const n=this.remove(t);this.enableRehydration(n),e.openBlockDepth--}}}__appendNode(e){const{candidate:t}=this;return t||super.__appendNode(e)}__appendHTML(e){const t=this.markerBounds();if(t){const e=t.firstNode(),n=t.lastNode(),r=new gg(this.element,e.nextSibling,n.previousSibling),i=this.remove(e);return this.remove(n),null!==i&&P_(i)&&(this.candidate=this.remove(i),null!==this.candidate&&this.clearMismatch(this.candidate)),r}return super.__appendHTML(e)}remove(e){const t=e.parentNode,n=e.nextSibling;return t.removeChild(e),n}markerBounds(){const e=this.candidate;if(e&&I_(e)){const t=e;let n=t.nextSibling;for(;!I_(n);)n=Xe(n.nextSibling);return new gg(this.element,t,n)}return null}__appendText(e){const{candidate:t}=this;return t?3===t.nodeType?(t.nodeValue!==e&&(t.nodeValue=e),this.candidate=t.nextSibling,t):8===(n=t).nodeType&&"%|%"===n.nodeValue||P_(t)&&""===e?(this.candidate=this.remove(t),this.__appendText(e)):(this.clearMismatch(t),super.__appendText(e)):super.__appendText(e);var n}__appendComment(e){const t=this.candidate;return t&&8===t.nodeType?(t.nodeValue!==e&&(t.nodeValue=e),this.candidate=t.nextSibling,t):(t&&this.clearMismatch(t),super.__appendComment(e))}__openElement(e){const t=this.candidate;if(t&&L_(t)&&function(e,t){return"http://www.w3.org/2000/svg"===e.namespaceURI?e.tagName===t:e.tagName===t.toUpperCase()}(t,e))return this.unmatchedAttributes=[].slice.call(t.attributes),t;if(t){if(L_(t)&&"TBODY"===t.tagName)return this.pushElement(t,null),this.currentCursor.injectedOmittedNode=!0,this.__openElement(e);this.clearMismatch(t)}return super.__openElement(e)}__setAttribute(e,t,n){const r=this.unmatchedAttributes;if(r){const n=M_(r,e);if(n)return n.value!==t&&(n.value=t),void r.splice(r.indexOf(n),1)}return super.__setAttribute(e,t,n)}__setProperty(e,t){const n=this.unmatchedAttributes;if(n){const r=M_(n,e);if(r)return r.value!==t&&(r.value=t),void n.splice(n.indexOf(r),1)}return super.__setProperty(e,t)}__flushElement(e,t){const{unmatchedAttributes:n}=this;if(n){for(const e of n)this.constructing.removeAttribute(e.name);this.unmatchedAttributes=null}else super.__flushElement(e,t)}willCloseElement(){const{candidate:e,currentCursor:t}=this;null!==e&&this.clearMismatch(e),t&&t.injectedOmittedNode&&this.popElement(),super.willCloseElement()}getMarker(e,t){const n=e.querySelector(`script[glmr="${t}"]`);return n?(function(e){e.nodeType}(r=n),r):null;var r}__pushRemoteElement(e,t,n){const r=this.getMarker(e,t);if(!r||r.parentNode,void 0===n){for(;null!==e.firstChild&&e.firstChild!==r;)this.remove(e.firstChild);n=null}const i=new C_(e,null,this.blockDepth);this.cursors.push(i),null===r?this.disableRehydration(n):this.candidate=this.remove(r);const s=new tm(e);return this.pushBlock(s,!0)}didAppendBounds(e){if(super.didAppendBounds(e),this.candidate){const t=e.lastNode();this.candidate=t.nextSibling}return e}};function k_(e){return 8===e.nodeType&&0===e.nodeValue.lastIndexOf("%+b:",0)}function E_(e){return 8===e.nodeType&&0===e.nodeValue.lastIndexOf("%-b:",0)}function R_(e){return parseInt(e.nodeValue.slice(4),10)}function T_(e,t){return R_(e)-t}function L_(e){return 1===e.nodeType}function I_(e){return 8===e.nodeType&&"%glmr%"===e.nodeValue}function P_(e){return 8===e.nodeType&&"% %"===e.nodeValue}function M_(e,t){for(const n of e)if(n.name===t)return n}function A_(e,t){return S_.forInitialRender(e,t)}var O_=new WeakMap,N_=class extends Qg{serializeBlockDepth=0;__openBlock(){let{tagName:e}=this.element;if("TITLE"!==e&&"SCRIPT"!==e&&"STYLE"!==e){let e=this.serializeBlockDepth++;this.__appendComment(`%+b:${e}%`)}super.__openBlock()}__closeBlock(){let{tagName:e}=this.element;if(super.__closeBlock(),"TITLE"!==e&&"SCRIPT"!==e&&"STYLE"!==e){let e=--this.serializeBlockDepth;this.__appendComment(`%-b:${e}%`)}}__appendHTML(e){let{tagName:t}=this.element;if("TITLE"===t||"SCRIPT"===t||"STYLE"===t)return super.__appendHTML(e);let n=this.__appendComment("%glmr%");if("TABLE"===t){let t=e.indexOf("<");t>-1&&"tr"===e.slice(t+1,t+3)&&(e=`<tbody>${e}</tbody>`)}""===e?this.__appendComment("% %"):super.__appendHTML(e);let r=this.__appendComment("%glmr%");return new gg(this.element,n,r)}__appendText(e){let{tagName:t}=this.element,n=function(e){let{element:t,nextSibling:n}=e;return null===n?t.lastChild:n.previousSibling}(this);return"TITLE"===t||"SCRIPT"===t||"STYLE"===t?super.__appendText(e):""===e?this.__appendComment("% %"):(n&&3===n.nodeType&&this.__appendComment("%|%"),super.__appendText(e))}closeElement(){return O_.has(this.element)&&(O_.delete(this.element),super.closeElement()),super.closeElement()}openElement(e){return"tr"===e&&"TBODY"!==this.element.tagName&&"THEAD"!==this.element.tagName&&"TFOOT"!==this.element.tagName&&(this.openElement("tbody"),O_.set(this.constructing,!0),this.flushElement(null)),super.openElement(e)}pushRemoteElement(e,t,n=null){let{dom:r}=this,i=r.createElement("script");return i.setAttribute("glmr",t),r.insertBefore(e,i,n),super.pushRemoteElement(e,t,n)}};function F_(e,t){return N_.forInitialRender(e,t)}var D_=rg({id:null,block:'[[[46,[30,0],null,null,null]],[],["component"]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/root.hbs",isStrictMode:!0}),z_=rg({id:null,block:'[[[46,[28,[32,0],null,null],null,null,null]],[],["component"]]',moduleName:"packages/@ember/-internals/glimmer/lib/templates/outlet.hbs",scope:()=>({outletHelper:yw}),isStrictMode:!0});function j_(e){e.register("service:-dom-builder",{create(e){switch(Ur(e).lookup("-environment:main")._renderMode){case"serialize":return F_.bind(null);case"rehydrate":return A_.bind(null);default:return im.bind(null)}}}),e.register(mc`template:-root`,D_),e.register("renderer:-dom",Fw)}var U_=class e{moduleBasedResolver=!0;#E=new Map;original;static create({namespace:t}){return new e(t.modules)}constructor(e){this.addModules(e)}addModules(e){for(let[t,n]of Object.entries(e))this.#E.set(this.#R(t),n)}#R(e){return e.replace(B_,"").replace($_,"")}#T(e){return"config"===e?e:e+"s"}resolve(e){let[t,n]=e.split(":");n=this.#L(t,n);for(let r of[this.#I,this.#P,this.#M,this.#A]){let e=r.call(this,t,n);if(e)return this.#O(e.hit)}}#O(e){return e&&e.default&&(e=e.default),e}normalize(e){let[t,n]=e.split(":");return n=this.#L(t,n),`${t}:${n}`}#L(e,t){return"component"===e||"helper"===e||"modifier"===e||"template"===e&&0===t.indexOf("components/")?t.replace(/_/g,"-"):t.replace(/\./g,"/").replace(q_,"$1_$2").toLowerCase().replace(V_,"-")}#I(e,t){if("resolver"===e&&"current"===t)return{hit:{create:()=>this}}}#P(e,t){if("main"===t){let t=this.#E.get(e);if(t)return{hit:t}}}#M(e,t){let n=`${this.#T(e)}/${t}`,r=this.#E.get(n);if(r)return{hit:r}}#A(e,t){if("component"!==e)return;let n=`${this.#T(e)}/${t}/index`,r=this.#E.get(n);return r?{hit:r}:void 0}},B_=/\.\w{1,4}$/,$_=/^\.\//,q_=/([a-z\d])([A-Z])/g,V_=/[ _]/g,W_=class extends(Uw.extend(lu)){static initializers=Object.create(null);static instanceInitializers=Object.create(null);static initializer=G_("initializers");static instanceInitializer=G_("instanceInitializers");static buildRegistry(e){let t=new pc({resolver:H_(e)});return t.set=gr,t.register("application:main",e,{instantiate:!1}),function(e){e.optionsForType("component",{singleton:!1}),e.optionsForType("view",{singleton:!1}),e.register("controller:basic",eu,{instantiate:!1}),e.register("service:-routing",yp),e.register("resolver-for-debugging:main",e.resolver,{instantiate:!1}),e.register("container-debug-adapter:main",Vw)}(t),function(e){e.optionsForType("template",{instantiate:!1}),e.register("view:-outlet",kw),e.register("template:-outlet",z_),e.optionsForType("helper",{instantiate:!1}),e.register("component:input",l_),e.register("component:link-to",w_),e.register("component:textarea",h_)}(t),t}Resolver=U_;init(e){super.init(e),this.buildRegistry()}_initializersRan=!1;ensureInitializers(){this._initializersRan||(this.runInitializers(),this._initializersRan=!0)}buildInstance(e={}){return this.ensureInitializers(),uu.create({...e,base:this})}buildRegistry(){return this.__registry__=this.constructor.buildRegistry(this)}initializer(e){this.constructor.initializer(e)}instanceInitializer(e){this.constructor.instanceInitializer(e)}runInitializers(){this._runInitializer("initializers",(e,t)=>{t.initialize(this)})}runInstanceInitializers(e){this._runInitializer("instanceInitializers",(t,n)=>{n.initialize(e)})}_runInitializer(e,t){let n,r=ur(this.constructor,e),i=function(e){let t=[];for(let n in e)t.push(n);return t}(r),s=new Bw;for(let o of i)n=r[o],s.add(n.name,n,n.before,n.after);s.topsort(t)}};function H_(e){let t={namespace:e};return e.Resolver.create(t)}function G_(e){return function(t){let n=this.superclass;if(void 0!==n[e]&&n[e]===this[e]){let t={[e]:Object.create(this[e])};this.reopenClass(t)}this[e][t.name]=t}}var K_=a({default:()=>X_,getOwner:()=>Z_,setOwner:()=>Y_}),Z_=Io,Y_=Br,X_=class extends W_{static buildRegistry(e){let t=super.buildRegistry(e);return function(e){e.register("router:main",Md),e.register("-view-registry:main",{create:()=>Po(null)}),e.register("route:basic",Jh),e.register("event_dispatcher:main",hc),e.register("location:hash",Vd),e.register("location:history",Hd),e.register("location:none",Gd),e.register(mc`-bucket-cache:main`,{create:()=>new vp}),e.register("service:router",mp)}(t),j_(t),t}static initializer=G_("initializers");static instanceInitializer=G_("instanceInitializers");init(e){super.init(e),this.rootElement??="body",this._document??=null,this.eventDispatcher??=null,this.customEvents??=null,this.autoboot??=!0,this._document??=Mo?window.document:null,this._readinessDeferrals=1,this._booted=!1,this._applicationInstances=new Set,this.autoboot=Boolean(this.autoboot),this.autoboot&&(this.Router=(this.Router||Md).extend(),this._buildDeprecatedInstance(),this.waitForDOMReady())}buildInstance(e={}){return Dw.create({...e,base:this,application:this})}_watchInstance(e){this._applicationInstances.add(e)}_unwatchInstance(e){return this._applicationInstances.delete(e)}Router;__deprecatedInstance__;__container__;_buildDeprecatedInstance(){let e=this.buildInstance();this.__deprecatedInstance__=e,this.__container__=e.__container__}waitForDOMReady(){const e=this._document;if(null===e||"loading"!==e.readyState)ks("actions",this,this.domReady);else{let t=()=>{e.removeEventListener("DOMContentLoaded",t),ws(this,this.domReady)};e.addEventListener("DOMContentLoaded",t)}}domReady(){this.isDestroying||this.isDestroyed||this._bootSync()}deferReadiness(){this._readinessDeferrals++}advanceReadiness(){this._readinessDeferrals--,0===this._readinessDeferrals&&Ls(this,this.didBecomeReady)}_bootPromise=null;boot(){if(this._bootPromise)return this._bootPromise;try{this._bootSync()}catch(e){}return this._bootPromise}_bootResolver=null;_bootSync(){if(this._booted||this.isDestroying||this.isDestroyed)return;let e=this._bootResolver=Ba.defer();this._bootPromise=e.promise;try{this.runInitializers(),this.advanceReadiness()}catch(_6){throw e.reject(_6),_6}}reset(){let e=this.__deprecatedInstance__;this._readinessDeferrals=1,this._bootPromise=null,this._bootResolver=null,this._booted=!1,_s(this,function(){ws(e,"destroy"),this._buildDeprecatedInstance(),ks("actions",this,"_bootSync")})}didBecomeReady(){if(!this.isDestroying&&!this.isDestroyed)try{if(this.autoboot){let e=this.__deprecatedInstance__;e._bootSync(),this.ready(),e.startRouting()}this._bootResolver.resolve(this),this._booted=!0}catch(_6){throw this._bootResolver.reject(_6),_6}}ready(){return this}willDestroy(){super.willDestroy(),this._applicationInstances.size&&(this._applicationInstances.forEach(e=>e.destroy()),this._applicationInstances.clear())}visit(e,t){return this.boot().then(()=>{let n=this.buildInstance();return n.boot(t).then(()=>n.visit(e)).catch(e=>{throw ws(n,"destroy"),e})})}},J_=Object.assign({},{});function Q_(){return ex.global}var ex=globalThis.__embroider_macros__runtime_config__||={};ex.packages||={},ex.global||={};Object.assign(ex.packages,{}),Object.assign(ex.global,{});var tx="undefined"!=typeof window?window._embroider_macros_runtime_config:void 0;if(tx){let e={config:function(e){return ex.packages[e]},getGlobalConfig:Q_,setConfig(e,t){ex.packages[e]=t},setGlobalConfig(e,t){ex.global[e]=t}};for(let t of tx)t(e)}var nx=a({default:()=>rx,enterTestMode:()=>ix}),rx={modulePrefix:"marco",environment:"production",rootURL:"/",locationType:"history",EmberENV:{},APP:{}};function ix(){rx.locationType="none",rx.APP.rootElement="#ember-testing",rx.APP.autoboot=!1;const e=Q_()["@embroider/macros"];e&&(e.isTesting=!0)}var sx=()=>{},ox=()=>{};function ax(e){let t=e.lookup("renderer:-dom");if(!t)throw new Error("BUG: owner is missing renderer");return t.debugRenderTree.capture()}var lx=a({_warnIfUsingStrippedFeatureFlags:()=>{},assert:()=>Cn,captureRenderTree:()=>ax,debug:()=>dx,debugFreeze:()=>fx,debugSeal:()=>px,deprecate:()=>bx,deprecateFunc:()=>vx,getDebugFunction:()=>yx,info:()=>ux,inspect:()=>Pn,isTesting:()=>ru,registerDeprecationHandler:()=>sx,registerWarnHandler:()=>ox,runInDebug:()=>gx,setDebugFunction:()=>mx,setTesting:()=>iu,warn:()=>hx}),cx=()=>{},ux=cx,hx=cx,dx=cx,px=cx,fx=cx,gx=cx,mx=cx,yx=cx,vx=function(){return arguments[arguments.length-1]};function bx(){}var wx,_x=a({});wx={throwOnUnhandled:!1,workflow:[]},self.deprecationWorkflow=self.deprecationWorkflow||{},self.deprecationWorkflow.deprecationLog={messages:new Set},self.deprecationWorkflow.flushDeprecations=e=>function({handler:e="silence",config:t={}}={}){let n=self.deprecationWorkflow.deprecationLog.messages,r=t.workflow??[],i=n.values().filter(e=>!r.some(t=>t.matchId===e)).map(t=>({handler:e,matchId:t})),s={...t,workflow:[...r,...i]};return`import setupDeprecationWorkflow from 'ember-cli-deprecation-workflow';\n\nsetupDeprecationWorkflow(${JSON.stringify(s,void 0,2)});`}({config:wx,...e}),function(){const e="TEST_WAITERS",t="undefined"!=typeof Symbol?Symbol.for(e):e,n=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;throw new Error("unable to locate global object")}();let r=n[t];void 0===r&&(r=n[t]=new Map)}();var xx=class{name;constructor(e){this.name=e}beginAsync(){return this}endAsync(){}waitUntil(){return!0}debugInfo(){return[]}reset(){}};function Cx(e){return new xx(e)}Cx("@ember/test-waiters:promise-waiter"),Cx("@ember/test-waiters:generator-waiter");var Sx,kx=a({assertDestroyablesDestroyed:()=>{},associateDestroyableChild:()=>Q,destroy:()=>te,enableDestroyableTracking:()=>{},isDestroyed:()=>ie,isDestroying:()=>re,registerDestructor:()=>Ex,unregisterDestructor:()=>Rx});function Ex(e,t){return ee(e,t)}function Rx(e,t){return function(e,t,n=!1){let r=J(e),i=n?"eagerDestructors":"destructors";r[i]=X(r[i],t)}(e,t)}(Sx=Lo,Sx?.__esModule?Sx:{default:Sx,...Sx}).getOwner;var Tx=Md,Lx=a({default:()=>Ix}),Ix=class extends Tx{location=rx.locationType;rootURL=rx.rootURL};function Px(e){return 0===e||3===e||1e4<=e&&e<2e4}function Mx(e){return 3e4<=e&&e<4e4}function Ax(e,t){const n=t instanceof Array?t:[t];return function(e){if(!(e instanceof Object))return!1;if("number"!=typeof e.kind)return!1;if("string"!=typeof e.content)return!1;if("number"!=typeof e.created_at)return!1;if("string"!=typeof e.pubkey)return!1;if(!e.pubkey.match(/^[a-f0-9]{64}$/))return!1;if(!Array.isArray(e.tags))return!1;for(let t=0;t<e.tags.length;t++){let n=e.tags[t];if(!Array.isArray(n))return!1;for(let e=0;e<n.length;e++)if("string"!=typeof n[e])return!1}return!0}(e)&&n.includes(e.kind)||!1}function Ox(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function Nx(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function Fx(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}Ix.map(function(){this.route("place",{path:"/place/:place_id"}),this.route("place.new",{path:"/place/new"}),this.route("search"),this.route("menu"),this.route("lists",function(){this.route("list",{path:"/:list_id"})}),this.route("contributions"),this.route("oauth",function(){this.route("osm-callback",{path:"/osm/callback"})})});var Dx="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,zx=e=>e instanceof Uint8Array,jx=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Ux=(e,t)=>e<<32-t|e>>>t;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");function Bx(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),!zx(e))throw new Error("expected Uint8Array, got "+typeof e);return e}var $x=class{clone(){return this._cloneInto()}};function qx(e){const t=t=>e().update(Bx(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Vx(e=32){if(Dx&&"function"==typeof Dx.getRandomValues)return Dx.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}var Wx=class extends $x{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=jx(this.buffer)}update(e){Fx(this);const{view:t,buffer:n,blockLen:r}=this,i=(e=Bx(e)).length;for(let s=0;s<i;){const o=Math.min(r-this.pos,i-s);if(o===r){const t=jx(e);for(;r<=i-s;s+=r)this.process(t,s);continue}n.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Fx(this),function(e,t){Nx(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:i}=this;let{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>r-s&&(this.process(n,0),s=0);for(let u=s;u<r;u++)t[u]=0;!function(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),l=r?4:0,c=r?0:4;e.setUint32(t+l,o,r),e.setUint32(t+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const o=jx(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)o.setUint32(4*u,c[u],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:s,pos:o}=this;return e.length=r,e.pos=o,e.finished=i,e.destroyed=s,r%t&&e.buffer.set(n),e}},Hx=(e,t,n)=>e&t^~e&n,Gx=(e,t,n)=>e&t^e&n^t&n,Kx=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Zx=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Yx=new Uint32Array(64),Xx=class extends Wx{constructor(){super(64,32,8,!1),this.A=0|Zx[0],this.B=0|Zx[1],this.C=0|Zx[2],this.D=0|Zx[3],this.E=0|Zx[4],this.F=0|Zx[5],this.G=0|Zx[6],this.H=0|Zx[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:s,G:o,H:a}=this;return[e,t,n,r,i,s,o,a]}set(e,t,n,r,i,s,o,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let u=0;u<16;u++,t+=4)Yx[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const e=Yx[u-15],t=Yx[u-2],n=Ux(e,7)^Ux(e,18)^e>>>3,r=Ux(t,17)^Ux(t,19)^t>>>10;Yx[u]=r+Yx[u-7]+n+Yx[u-16]|0}let{A:n,B:r,C:i,D:s,E:o,F:a,G:l,H:c}=this;for(let u=0;u<64;u++){const e=c+(Ux(o,6)^Ux(o,11)^Ux(o,25))+Hx(o,a,l)+Kx[u]+Yx[u]|0,t=(Ux(n,2)^Ux(n,13)^Ux(n,22))+Gx(n,r,i)|0;c=l,l=a,a=o,o=s+e|0,s=i,i=r,r=n,n=e+t|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,s=s+this.D|0,o=o+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,i,s,o,a,l,c)}roundClean(){Yx.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Jx=qx(()=>new Xx),Qx=a({bitGet:()=>bC,bitLen:()=>vC,bitMask:()=>_C,bitSet:()=>wC,bytesToHex:()=>sC,bytesToNumberBE:()=>cC,bytesToNumberLE:()=>uC,concatBytes:()=>gC,createHmacDrbg:()=>SC,ensureBytes:()=>fC,equalBytes:()=>mC,hexToBytes:()=>lC,hexToNumber:()=>aC,numberToBytesBE:()=>hC,numberToBytesLE:()=>dC,numberToHexUnpadded:()=>oC,numberToVarBytesBE:()=>pC,utf8ToBytes:()=>yC,validateObject:()=>EC}),eC=BigInt(0),tC=BigInt(1),nC=BigInt(2),rC=e=>e instanceof Uint8Array,iC=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function sC(e){if(!rC(e))throw new Error("Uint8Array expected");let t="";for(let n=0;n<e.length;n++)t+=iC[e[n]];return t}function oC(e){const t=e.toString(16);return 1&t.length?`0${t}`:t}function aC(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}function lC(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(t/2);for(let r=0;r<n.length;r++){const t=2*r,i=e.slice(t,t+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");n[r]=s}return n}function cC(e){return aC(sC(e))}function uC(e){if(!rC(e))throw new Error("Uint8Array expected");return aC(sC(Uint8Array.from(e).reverse()))}function hC(e,t){return lC(e.toString(16).padStart(2*t,"0"))}function dC(e,t){return hC(e,t).reverse()}function pC(e){return lC(oC(e))}function fC(e,t,n){let r;if("string"==typeof t)try{r=lC(t)}catch(s){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${s}`)}else{if(!rC(t))throw new Error(`${e} must be hex string or Uint8Array`);r=Uint8Array.from(t)}const i=r.length;if("number"==typeof n&&i!==n)throw new Error(`${e} expected ${n} bytes, got ${i}`);return r}function gC(...e){const t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));let n=0;return e.forEach(e=>{if(!rC(e))throw new Error("Uint8Array expected");t.set(e,n),n+=e.length}),t}function mC(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function yC(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function vC(e){let t;for(t=0;e>eC;e>>=tC,t+=1);return t}function bC(e,t){return e>>BigInt(t)&tC}var wC=(e,t,n)=>e|(n?tC:eC)<<BigInt(t),_C=e=>(nC<<BigInt(e-1))-tC,xC=e=>new Uint8Array(e),CC=e=>Uint8Array.from(e);function SC(e,t,n){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=xC(e),i=xC(e),s=0;const o=()=>{r.fill(1),i.fill(0),s=0},a=(...e)=>n(i,r,...e),l=(e=xC())=>{i=a(CC([0]),e),r=a(),0!==e.length&&(i=a(CC([1]),e),r=a())},c=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e<t;){r=a();const t=r.slice();n.push(t),e+=r.length}return gC(...n)};return(e,t)=>{let n;for(o(),l(e);!(n=t(c()));)l();return o(),n}}var kC={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function EC(e,t,n={}){const r=(t,n,r)=>{const i=kC[n];if("function"!=typeof i)throw new Error(`Invalid validator "${n}", expected function`);const s=e[t];if(!(r&&void 0===s||i(s,e)))throw new Error(`Invalid param ${String(t)}=${s} (${typeof s}), expected ${n}`)};for(const[i,s]of Object.entries(t))r(i,s,!1);for(const[i,s]of Object.entries(n))r(i,s,!0);return e}var RC=BigInt(0),TC=BigInt(1),LC=BigInt(2),IC=BigInt(3),PC=BigInt(4),MC=BigInt(5),AC=BigInt(8);function OC(e,t){const n=e%t;return n>=RC?n:t+n}function NC(e,t,n){if(n<=RC||t<RC)throw new Error("Expected power/modulo > 0");if(n===TC)return RC;let r=TC;for(;t>RC;)t&TC&&(r=r*e%n),e=e*e%n,t>>=TC;return r}function FC(e,t,n){let r=e;for(;t-- >RC;)r*=r,r%=n;return r}function DC(e,t){if(e===RC||t<=RC)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=OC(e,t),r=t,i=RC,s=TC,o=TC,a=RC;for(;n!==RC;){const e=r/n,t=r%n,l=i-o*e,c=s-a*e;r=n,n=t,i=o,s=a,o=l,a=c}if(r!==TC)throw new Error("invert: does not exist");return OC(i,t)}BigInt(9),BigInt(16);var zC=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function jC(e,t){const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function UC(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function BC(e){const t=UC(e);return t+Math.ceil(t/2)}var $C=BigInt(0),qC=BigInt(1);function VC(e){return function(e){const t=zC.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});EC(e,t)}(e.Fp),EC(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...jC(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}var{bytesToNumberBE:WC,hexToBytes:HC}=Qx,GC={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=GC;if(e.length<2||2!==e[0])throw new t("Invalid signature integer tag");const n=e[1],r=e.subarray(2,n+2);if(!n||r.length!==n)throw new t("Invalid signature integer: wrong length");if(128&r[0])throw new t("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:WC(r),l:e.subarray(n+2)}},toSig(e){const{Err:t}=GC,n="string"==typeof e?HC(e):e;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new t("Invalid signature tag");if(n[1]!==r-2)throw new t("Invalid signature: incorrect length");const{d:i,l:s}=GC._parseInt(n.subarray(2)),{d:o,l:a}=GC._parseInt(s);if(a.length)throw new t("Invalid signature: left bytes after parsing");return{r:i,s:o}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,n=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},r=t(n(e.s)),i=t(n(e.r)),s=r.length/2,o=i.length/2,a=n(s),l=n(o);return`30${n(o+s+4)}02${l}${i}02${a}${r}`}},KC=BigInt(0),ZC=BigInt(1),YC=BigInt(3);var XC=class extends $x{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");Ox(e.outputLen),Ox(e.blockLen)}(e);const n=Bx(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let s=0;s<i.length;s++)i[s]^=54;this.iHash.update(i),this.oHash=e.create();for(let s=0;s<i.length;s++)i[s]^=106;this.oHash.update(i),i.fill(0)}update(e){return Fx(this),this.iHash.update(e),this}digestInto(e){Fx(this),Nx(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:s,outputLen:o}=this;return e.finished=r,e.destroyed=i,e.blockLen=s,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},JC=(e,t,n)=>new XC(e,t).update(n).digest();function QC(e){return{hash:e,hmac:(t,...n)=>JC(e,t,function(...e){const t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));let n=0;return e.forEach(e=>{if(!zx(e))throw new Error("Uint8Array expected");t.set(e,n),n+=e.length}),t}(...n)),randomBytes:Vx}}JC.create=(e,t)=>new XC(e,t);var eS=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),tS=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),nS=BigInt(1),rS=BigInt(2),iS=(e,t)=>(e+t/rS)/t;function sS(e){const t=eS,n=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),c=e*e*e%t,u=c*c*e%t,h=FC(u,n,t)*u%t,d=FC(h,n,t)*u%t,p=FC(d,rS,t)*c%t,f=FC(p,i,t)*p%t,g=FC(f,s,t)*f%t,m=FC(g,a,t)*g%t,y=FC(m,l,t)*m%t,v=FC(y,a,t)*g%t,b=FC(v,n,t)*u%t,w=FC(b,o,t)*f%t,_=FC(w,r,t)*c%t,x=FC(_,rS,t);if(!oS.eql(oS.sqr(x),e))throw new Error("Cannot find square root");return x}var oS=function(e,t,n=!1,r={}){if(e<=RC)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:s}=jC(e,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=function(e){if(e%PC===IC){const t=(e+TC)/PC;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}if(e%AC===MC){const t=(e-MC)/AC;return function(e,n){const r=e.mul(n,LC),i=e.pow(r,t),s=e.mul(n,i),o=e.mul(e.mul(s,LC),i),a=e.mul(s,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(e){const t=(e-TC)/LC;let n,r,i;for(n=e-TC,r=0;n%LC===RC;n/=LC,r++);for(i=LC;i<e&&NC(i,t,e)!==e-TC;i++);if(1===r){const t=(e+TC)/PC;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}const s=(n+TC)/LC;return function(e,o){if(e.pow(o,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let a=r,l=e.pow(e.mul(e.ONE,i),n),c=e.pow(o,s),u=e.pow(o,n);for(;!e.eql(u,e.ONE);){if(e.eql(u,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(u);t<a&&!e.eql(r,e.ONE);t++)r=e.sqr(r);const n=e.pow(l,TC<<BigInt(a-t-1));l=e.sqr(n),c=e.mul(c,n),u=e.mul(u,l),a=t}return c}}(e)}(e),a=Object.freeze({ORDER:e,BITS:i,BYTES:s,MASK:_C(i),ZERO:RC,ONE:TC,create:t=>OC(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return RC<=t&&t<e},is0:e=>e===RC,isOdd:e=>(e&TC)===TC,neg:t=>OC(-t,e),eql:(e,t)=>e===t,sqr:t=>OC(t*t,e),add:(t,n)=>OC(t+n,e),sub:(t,n)=>OC(t-n,e),mul:(t,n)=>OC(t*n,e),pow:(e,t)=>function(e,t,n){if(n<RC)throw new Error("Expected power > 0");if(n===RC)return e.ONE;if(n===TC)return t;let r=e.ONE,i=t;for(;n>RC;)n&TC&&(r=e.mul(r,i)),i=e.sqr(i),n>>=TC;return r}(a,e,t),div:(t,n)=>OC(t*DC(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>DC(t,e),sqrt:r.sqrt||(e=>o(a,e)),invertBatch:e=>function(e,t){const n=new Array(t.length),r=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),i=e.inv(r);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),i),n}(a,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?dC(e,s):hC(e,s),fromBytes:e=>{if(e.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${e.length}`);return n?uC(e):cC(e)}});return Object.freeze(a)}(eS,void 0,void 0,{sqrt:sS}),aS=function(e,t){const n=t=>function(e){const t=function(e){const t=VC(e);return EC(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:n,n:r}=t,i=n.BYTES+1,s=2*n.BYTES+1;function o(e){return OC(e,r)}function a(e){return DC(e,r)}const{ProjectivePoint:l,normPrivateKeyToScalar:c,weierstrassEquation:u,isWithinCurveOrder:h}=function(e){const t=function(e){const t=VC(e);EC(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=t;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:n}=t,r=t.toBytes||((e,t)=>{const r=t.toAffine();return gC(Uint8Array.from([4]),n.toBytes(r.x),n.toBytes(r.y))}),i=t.fromBytes||(e=>{const t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}});function s(e){const{a:r,b:i}=t,s=n.sqr(e),o=n.mul(s,e);return n.add(n.add(o,n.mul(e,r)),i)}if(!n.eql(n.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function o(e){return"bigint"==typeof e&&KC<e&&e<t.n}function a(e){if(!o(e))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(e){const{allowedPrivateKeyLengths:n,nByteLength:r,wrapPrivateKey:i,n:s}=t;if(n&&"bigint"!=typeof e){if(e instanceof Uint8Array&&(e=sC(e)),"string"!=typeof e||!n.includes(e.length))throw new Error("Invalid key");e=e.padStart(2*r,"0")}let o;try{o="bigint"==typeof e?e:cC(fC("private key",e,r))}catch(_6){throw new Error(`private key must be ${r} bytes, hex or bigint, not ${typeof e}`)}return i&&(o=OC(o,s)),a(o),o}const c=new Map;function u(e){if(!(e instanceof h))throw new Error("ProjectivePoint expected")}class h{constructor(e,t,r){if(this.px=e,this.py=t,this.pz=r,null==e||!n.isValid(e))throw new Error("x required");if(null==t||!n.isValid(t))throw new Error("y required");if(null==r||!n.isValid(r))throw new Error("z required")}static fromAffine(e){const{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw new Error("invalid affine point");if(e instanceof h)throw new Error("projective point not allowed");const i=e=>n.eql(e,n.ZERO);return i(t)&&i(r)?h.ZERO:new h(t,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=n.invertBatch(e.map(e=>e.pz));return e.map((e,n)=>e.toAffine(t[n])).map(h.fromAffine)}static fromHex(e){const t=h.fromAffine(i(fC("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return h.BASE.multiply(l(e))}_setWindowSize(e){this._WINDOW_SIZE=e,c.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:r}=this.toAffine();if(!n.isValid(e)||!n.isValid(r))throw new Error("bad point: x or y not FE");const i=n.sqr(r),o=s(e);if(!n.eql(i,o))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(n.isOdd)return!n.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){u(e);const{px:t,py:r,pz:i}=this,{px:s,py:o,pz:a}=e,l=n.eql(n.mul(t,a),n.mul(s,i)),c=n.eql(n.mul(r,a),n.mul(o,i));return l&&c}negate(){return new h(this.px,n.neg(this.py),this.pz)}double(){const{a:e,b:r}=t,i=n.mul(r,YC),{px:s,py:o,pz:a}=this;let l=n.ZERO,c=n.ZERO,u=n.ZERO,d=n.mul(s,s),p=n.mul(o,o),f=n.mul(a,a),g=n.mul(s,o);return g=n.add(g,g),u=n.mul(s,a),u=n.add(u,u),l=n.mul(e,u),c=n.mul(i,f),c=n.add(l,c),l=n.sub(p,c),c=n.add(p,c),c=n.mul(l,c),l=n.mul(g,l),u=n.mul(i,u),f=n.mul(e,f),g=n.sub(d,f),g=n.mul(e,g),g=n.add(g,u),u=n.add(d,d),d=n.add(u,d),d=n.add(d,f),d=n.mul(d,g),c=n.add(c,d),f=n.mul(o,a),f=n.add(f,f),d=n.mul(f,g),l=n.sub(l,d),u=n.mul(f,p),u=n.add(u,u),u=n.add(u,u),new h(l,c,u)}add(e){u(e);const{px:r,py:i,pz:s}=this,{px:o,py:a,pz:l}=e;let c=n.ZERO,d=n.ZERO,p=n.ZERO;const f=t.a,g=n.mul(t.b,YC);let m=n.mul(r,o),y=n.mul(i,a),v=n.mul(s,l),b=n.add(r,i),w=n.add(o,a);b=n.mul(b,w),w=n.add(m,y),b=n.sub(b,w),w=n.add(r,s);let _=n.add(o,l);return w=n.mul(w,_),_=n.add(m,v),w=n.sub(w,_),_=n.add(i,s),c=n.add(a,l),_=n.mul(_,c),c=n.add(y,v),_=n.sub(_,c),p=n.mul(f,w),c=n.mul(g,v),p=n.add(c,p),c=n.sub(y,p),p=n.add(y,p),d=n.mul(c,p),y=n.add(m,m),y=n.add(y,m),v=n.mul(f,v),w=n.mul(g,w),y=n.add(y,v),v=n.sub(m,v),v=n.mul(f,v),w=n.add(w,v),m=n.mul(y,w),d=n.add(d,m),m=n.mul(_,w),c=n.mul(b,c),c=n.sub(c,m),m=n.mul(b,y),p=n.mul(_,p),p=n.add(p,m),new h(c,d,p)}subtract(e){return this.add(e.negate())}is0(){return this.equals(h.ZERO)}wNAF(e){return p.wNAFCached(this,c,e,e=>{const t=n.invertBatch(e.map(e=>e.pz));return e.map((e,n)=>e.toAffine(t[n])).map(h.fromAffine)})}multiplyUnsafe(e){const r=h.ZERO;if(e===KC)return r;if(a(e),e===ZC)return this;const{endo:i}=t;if(!i)return p.unsafeLadder(this,e);let{k1neg:s,k1:o,k2neg:l,k2:c}=i.splitScalar(e),u=r,d=r,f=this;for(;o>KC||c>KC;)o&ZC&&(u=u.add(f)),c&ZC&&(d=d.add(f)),f=f.double(),o>>=ZC,c>>=ZC;return s&&(u=u.negate()),l&&(d=d.negate()),d=new h(n.mul(d.px,i.beta),d.py,d.pz),u.add(d)}multiply(e){a(e);let r,i,s=e;const{endo:o}=t;if(o){const{k1neg:e,k1:t,k2neg:a,k2:l}=o.splitScalar(s);let{p:c,f:u}=this.wNAF(t),{p:d,f:f}=this.wNAF(l);c=p.constTimeNegate(e,c),d=p.constTimeNegate(a,d),d=new h(n.mul(d.px,o.beta),d.py,d.pz),r=c.add(d),i=u.add(f)}else{const{p:e,f:t}=this.wNAF(s);r=e,i=t}return h.normalizeZ([r,i])[0]}multiplyAndAddUnsafe(e,t,n){const r=h.BASE,i=(e,t)=>t!==KC&&t!==ZC&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),s=i(this,t).add(i(e,n));return s.is0()?void 0:s}toAffine(e){const{px:t,py:r,pz:i}=this,s=this.is0();null==e&&(e=s?n.ONE:n.inv(i));const o=n.mul(t,e),a=n.mul(r,e),l=n.mul(i,e);if(s)return{x:n.ZERO,y:n.ZERO};if(!n.eql(l,n.ONE))throw new Error("invZ was invalid");return{x:o,y:a}}isTorsionFree(){const{h:e,isTorsionFree:n}=t;if(e===ZC)return!0;if(n)return n(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:n}=t;return e===ZC?this:n?n(h,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),r(h,this,e)}toHex(e=!0){return sC(this.toRawBytes(e))}}h.BASE=new h(t.Gx,t.Gy,n.ONE),h.ZERO=new h(n.ZERO,n.ONE,n.ZERO);const d=t.nBitLength,p=function(e,t){const n=(e,t)=>{const n=t.negate();return e?n:t},r=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:n,unsafeLadder(t,n){let r=e.ZERO,i=t;for(;n>$C;)n&qC&&(r=r.add(i)),i=i.double(),n>>=qC;return r},precomputeWindow(e,t){const{windows:n,windowSize:i}=r(t),s=[];let o=e,a=o;for(let r=0;r<n;r++){a=o,s.push(a);for(let e=1;e<i;e++)a=a.add(o),s.push(a);o=a.double()}return s},wNAF(t,i,s){const{windows:o,windowSize:a}=r(t);let l=e.ZERO,c=e.BASE;const u=BigInt(2**t-1),h=2**t,d=BigInt(t);for(let e=0;e<o;e++){const t=e*a;let r=Number(s&u);s>>=d,r>a&&(r-=h,s+=qC);const o=t,p=t+Math.abs(r)-1,f=e%2!=0,g=r<0;0===r?c=c.add(n(f,i[o])):l=l.add(n(g,i[p]))}return{p:l,f:c}},wNAFCached(e,t,n,r){const i=e._WINDOW_SIZE||1;let s=t.get(e);return s||(s=this.precomputeWindow(e,i),1!==i&&t.set(e,r(s))),this.wNAF(i,s,n)}}}(h,t.endo?Math.ceil(d/2):d);return{CURVE:t,ProjectivePoint:h,normPrivateKeyToScalar:l,weierstrassEquation:s,isWithinCurveOrder:o}}({...t,toBytes(e,t,r){const i=t.toAffine(),s=n.toBytes(i.x),o=gC;return r?o(Uint8Array.from([t.hasEvenY()?2:3]),s):o(Uint8Array.from([4]),s,n.toBytes(i.y))},fromBytes(e){const t=e.length,r=e[0],o=e.subarray(1);if(t!==i||2!==r&&3!==r){if(t===s&&4===r)return{x:n.fromBytes(o.subarray(0,n.BYTES)),y:n.fromBytes(o.subarray(n.BYTES,2*n.BYTES))};throw new Error(`Point of length ${t} was invalid. Expected ${i} compressed bytes or ${s} uncompressed bytes`)}{const e=cC(o);if(!(KC<(a=e)&&a<n.ORDER))throw new Error("Point is not on curve");const t=u(e);let i=n.sqrt(t);return!(1&~r)!=((i&ZC)===ZC)&&(i=n.neg(i)),{x:e,y:i}}var a}}),d=e=>sC(hC(e,t.nByteLength));function p(e){return e>r>>ZC}const f=(e,t,n)=>cC(e.slice(t,n));class g{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){const n=t.nByteLength;return e=fC("compactSignature",e,2*n),new g(f(e,0,n),f(e,n,2*n))}static fromDER(e){const{r:t,s:n}=GC.toSig(fC("DER",e));return new g(t,n)}assertValidity(){if(!h(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!h(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new g(this.r,this.s,e)}recoverPublicKey(e){const{r:r,s:i,recovery:s}=this,c=b(fC("msgHash",e));if(null==s||![0,1,2,3].includes(s))throw new Error("recovery id invalid");const u=2===s||3===s?r+t.n:r;if(u>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const h=1&s?"03":"02",p=l.fromHex(h+d(u)),f=a(u),g=o(-c*f),m=o(i*f),y=l.BASE.multiplyAndAddUnsafe(p,g,m);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new g(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return lC(this.toDERHex())}toDERHex(){return GC.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return lC(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}const m={isValidPrivateKey(e){try{return c(e),!0}catch(_6){return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{const e=BC(t.n);return function(e,t,n=!1){const r=e.length,i=UC(t),s=BC(t);if(r<16||r<s||r>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);const o=OC(n?cC(e):uC(e),t-TC)+TC;return n?dC(o,i):hC(o,i)}(t.randomBytes(e),t.n)},precompute:(e=8,t=l.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function y(e){const t=e instanceof Uint8Array,n="string"==typeof e,r=(t||n)&&e.length;return t?r===i||r===s:n?r===2*i||r===2*s:e instanceof l}const v=t.bits2int||function(e){const n=cC(e),r=8*e.length-t.nBitLength;return r>0?n>>BigInt(r):n},b=t.bits2int_modN||function(e){return o(v(e))},w=_C(t.nBitLength);function _(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(KC<=e&&e<w))throw new Error(`bigint expected < 2^${t.nBitLength}`);return hC(e,t.nByteLength)}const x={lowS:t.lowS,prehash:!1},C={lowS:t.lowS,prehash:!1};return l.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return l.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,n=!0){if(y(e))throw new Error("first arg must be private key");if(!y(t))throw new Error("second arg must be public key");return l.fromHex(t).multiply(c(e)).toRawBytes(n)},sign:function(e,r,i=x){const{seed:s,k2sig:u}=function(e,r,i=x){if(["recovered","canonical"].some(e=>e in i))throw new Error("sign() legacy options not supported");const{hash:s,randomBytes:u}=t;let{lowS:d,prehash:f,extraEntropy:m}=i;null==d&&(d=!0),e=fC("msgHash",e),f&&(e=fC("prehashed msgHash",s(e)));const y=b(e),w=c(r),C=[_(w),_(y)];if(null!=m){const e=!0===m?u(n.BYTES):m;C.push(fC("extraEntropy",e))}const S=gC(...C),k=y;return{seed:S,k2sig:function(e){const t=v(e);if(!h(t))return;const n=a(t),r=l.BASE.multiply(t).toAffine(),i=o(r.x);if(i===KC)return;const s=o(n*o(k+i*w));if(s===KC)return;let c=(r.x===i?0:2)|Number(r.y&ZC),u=s;return d&&p(s)&&(u=function(e){return p(e)?o(-e):e}(s),c^=1),new g(i,u,c)}}}(e,r,i),d=t;return SC(d.hash.outputLen,d.nByteLength,d.hmac)(s,u)},verify:function(e,n,r,i=C){const s=e;if(n=fC("msgHash",n),r=fC("publicKey",r),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:c,prehash:u}=i;let h,d;try{if("string"==typeof s||s instanceof Uint8Array)try{h=g.fromDER(s)}catch(x){if(!(x instanceof GC.Err))throw x;h=g.fromCompact(s)}else{if("object"!=typeof s||"bigint"!=typeof s.r||"bigint"!=typeof s.s)throw new Error("PARSE");{const{r:e,s:t}=s;h=new g(e,t)}}d=l.fromHex(r)}catch(_6){if("PARSE"===_6.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(c&&h.hasHighS())return!1;u&&(n=t.hash(n));const{r:p,s:f}=h,m=b(n),y=a(f),v=o(m*y),w=o(p*y),_=l.BASE.multiplyAndAddUnsafe(d,v,w)?.toAffine();return!!_&&o(_.x)===p},ProjectivePoint:l,Signature:g,utils:m}}({...e,...QC(t)});return Object.freeze({...n(t),create:n})}({a:BigInt(0),b:BigInt(7),Fp:oS,n:tS,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=tS,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-nS*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,o=BigInt("0x100000000000000000000000000000000"),a=iS(s*e,t),l=iS(-r*e,t);let c=OC(e-a*n-l*i,t),u=OC(-a*r-l*s,t);const h=c>o,d=u>o;if(h&&(c=t-c),d&&(u=t-u),c>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:h,k1:c,k2neg:d,k2:u}}}},Jx),lS=BigInt(0),cS=e=>"bigint"==typeof e&&lS<e&&e<eS,uS={};function hS(e,...t){let n=uS[e];if(void 0===n){const t=Jx(Uint8Array.from(e,e=>e.charCodeAt(0)));n=gC(t,t),uS[e]=n}return Jx(gC(n,...t))}var dS=e=>e.toRawBytes(!0).slice(1),pS=e=>hC(e,32),fS=e=>OC(e,eS),gS=e=>OC(e,tS),mS=aS.ProjectivePoint;function yS(e){let t=aS.utils.normPrivateKeyToScalar(e),n=mS.fromPrivateKey(t);return{scalar:n.hasEvenY()?t:gS(-t),bytes:dS(n)}}function vS(e){if(!cS(e))throw new Error("bad x: need 0 < x < p");const t=fS(e*e);let n=sS(fS(t*e+BigInt(7)));n%rS!==lS&&(n=fS(-n));const r=new mS(e,n,nS);return r.assertValidity(),r}function bS(...e){return gS(cC(hS("BIP0340/challenge",...e)))}function wS(e){return yS(e).bytes}function _S(e,t,n=Vx(32)){const r=fC("message",e),{bytes:i,scalar:s}=yS(t),o=fC("auxRand",n,32),a=hS("BIP0340/nonce",pS(s^cC(hS("BIP0340/aux",o))),i,r),l=gS(cC(a));if(l===lS)throw new Error("sign failed: k is zero");const{bytes:c,scalar:u}=yS(l),h=bS(c,i,r),d=new Uint8Array(64);if(d.set(c,0),d.set(pS(gS(u+h*s)),32),!xS(d,r,i))throw new Error("sign: Invalid signature produced");return d}function xS(e,t,n){const r=fC("signature",e,64),i=fC("message",t),s=fC("publicKey",n,32);try{const e=vS(cC(s)),t=cC(r.subarray(0,32));if(!cS(t))return!1;const n=cC(r.subarray(32,64));if(!(e=>"bigint"==typeof e&&lS<e&&e<tS)(n))return!1;const c=bS(pS(t),dS(e),i),u=(o=e,a=n,l=gS(-c),mS.BASE.multiplyAndAddUnsafe(o,a,l));return!(!u||!u.hasEvenY()||u.toAffine().x!==t)}catch(_6){return!1}var o,a,l}var CS=(()=>({getPublicKey:wS,sign:_S,verify:xS,utils:{randomPrivateKey:aS.utils.randomPrivateKey,lift_x:vS,pointToBytes:dS,numberToBytesBE:hC,bytesToNumberBE:cC,taggedHash:hS,mod:OC}}))(),SS="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,kS=e=>e instanceof Uint8Array,ES=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),RS=(e,t)=>e<<32-t|e>>>t;if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");var TS=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function LS(e){if(!kS(e))throw new Error("Uint8Array expected");let t="";for(let n=0;n<e.length;n++)t+=TS[e[n]];return t}function IS(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(t/2);for(let r=0;r<n.length;r++){const t=2*r,i=e.slice(t,t+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");n[r]=s}return n}function PS(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),!kS(e))throw new Error("expected Uint8Array, got "+typeof e);return e}function MS(...e){const t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));let n=0;return e.forEach(e=>{if(!kS(e))throw new Error("Uint8Array expected");t.set(e,n),n+=e.length}),t}var AS=class{clone(){return this._cloneInto()}};function OS(e){const t=t=>e().update(PS(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function NS(e=32){if(SS&&"function"==typeof SS.getRandomValues)return SS.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function FS(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function DS(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}var zS={number:FS,bool:function(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)},bytes:DS,hash:function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");FS(e.outputLen),FS(e.blockLen)},exists:function(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")},output:function(e,t){DS(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}},jS=class extends AS{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ES(this.buffer)}update(e){zS.exists(this);const{view:t,buffer:n,blockLen:r}=this,i=(e=PS(e)).length;for(let s=0;s<i;){const o=Math.min(r-this.pos,i-s);if(o===r){const t=ES(e);for(;r<=i-s;s+=r)this.process(t,s);continue}n.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){zS.exists(this),zS.output(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:i}=this;let{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>r-s&&(this.process(n,0),s=0);for(let u=s;u<r;u++)t[u]=0;!function(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),l=r?4:0,c=r?0:4;e.setUint32(t+l,o,r),e.setUint32(t+c,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const o=ES(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)o.setUint32(4*u,c[u],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:s,pos:o}=this;return e.length=r,e.pos=o,e.finished=i,e.destroyed=s,r%t&&e.buffer.set(n),e}},US=(e,t,n)=>e&t^~e&n,BS=(e,t,n)=>e&t^e&n^t&n,$S=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),qS=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),VS=new Uint32Array(64),WS=class extends jS{constructor(){super(64,32,8,!1),this.A=0|qS[0],this.B=0|qS[1],this.C=0|qS[2],this.D=0|qS[3],this.E=0|qS[4],this.F=0|qS[5],this.G=0|qS[6],this.H=0|qS[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:s,G:o,H:a}=this;return[e,t,n,r,i,s,o,a]}set(e,t,n,r,i,s,o,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let u=0;u<16;u++,t+=4)VS[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const e=VS[u-15],t=VS[u-2],n=RS(e,7)^RS(e,18)^e>>>3,r=RS(t,17)^RS(t,19)^t>>>10;VS[u]=r+VS[u-7]+n+VS[u-16]|0}let{A:n,B:r,C:i,D:s,E:o,F:a,G:l,H:c}=this;for(let u=0;u<64;u++){const e=c+(RS(o,6)^RS(o,11)^RS(o,25))+US(o,a,l)+$S[u]+VS[u]|0,t=(RS(n,2)^RS(n,13)^RS(n,22))+BS(n,r,i)|0;c=l,l=a,a=o,o=s+e|0,s=i,i=r,r=n,n=e+t|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,s=s+this.D|0,o=o+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,i,s,o,a,l,c)}roundClean(){VS.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},HS=class extends WS{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}},GS=OS(()=>new WS);function KS(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function ZS(...e){const t=(e,t)=>n=>e(t(n));return{encode:Array.from(e).reverse().reduce((e,n)=>e?t(e,n.encode):n.encode,void 0),decode:e.reduce((e,n)=>e?t(e,n.decode):n.decode,void 0)}}function YS(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map(t=>{if(KS(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]})},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map(t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const n=e.indexOf(t);if(-1===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n})}}}function XS(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function JS(e,t="="){if(KS(e),"string"!=typeof t)throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let r=n.length;if(r*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if(!((r-1)*e%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function QS(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function ek(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let r=0;const i=[],s=Array.from(e);for(s.forEach(e=>{if(KS(e),e<0||e>=t)throw new Error(`Wrong integer: ${e}`)});;){let e=0,o=!0;for(let i=r;i<s.length;i++){const a=s[i],l=t*e+a;if(!Number.isSafeInteger(l)||t*e/t!==e||l-a!==t*e)throw new Error("convertRadix: carry overflow");if(e=l%n,s[i]=Math.floor(l/n),!Number.isSafeInteger(s[i])||s[i]*n+e!==l)throw new Error("convertRadix: carry overflow");o&&(s[i]?o=!1:r=i)}if(i.push(e),o)break}for(let o=0;o<e.length-1&&0===e[o];o++)i.push(0);return i.reverse()}OS(()=>new HS);var tk=(e,t)=>t?tk(t,e%t):e,nk=(e,t)=>e+(t-tk(e,t));function rk(e,t,n,r){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(nk(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${nk(t,n)}`);let i=0,s=0;const o=2**n-1,a=[];for(const l of e){if(KS(l),l>=2**t)throw new Error(`convertRadix2: invalid data word=${l} from=${t}`);if(i=i<<t|l,s+t>32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${t}`);for(s+=t;s>=n;s-=n)a.push((i>>s-n&o)>>>0);i&=2**s-1}if(i=i<<n-s&o,!r&&s>=t)throw new Error("Excess padding");if(!r&&i)throw new Error(`Non-zero padding: ${i}`);return r&&s>0&&a.push(i>>>0),a}function ik(e,t=!1){if(KS(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(nk(8,e)>32||nk(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!(n instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return rk(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(rk(n,e,8,t))}}}function sk(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(n){}}}var ok=ZS(ik(4),YS("0123456789ABCDEF"),XS("")),ak=ZS(ik(5),YS("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),JS(5),XS("")),lk=(ZS(ik(5),YS("0123456789ABCDEFGHIJKLMNOPQRSTUV"),JS(5),XS("")),ZS(ik(5),YS("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),XS(""),QS(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),ZS(ik(6),YS("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),JS(6),XS(""))),ck=ZS(ik(6),YS("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),JS(6),XS("")),uk=e=>ZS((KS(58),{encode:e=>{if(!(e instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return ek(Array.from(e),256,58)},decode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(ek(e,58,256))}}),YS(e),XS("")),hk=uk("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),dk=(uk("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),uk("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"),[0,2,3,5,6,7,9,10,11]),pk={encode(e){let t="";for(let n=0;n<e.length;n+=8){const r=e.subarray(n,n+8);t+=hk.encode(r).padStart(dk[r.length],"1")}return t},decode(e){let t=[];for(let n=0;n<e.length;n+=11){const r=e.slice(n,n+11),i=dk.indexOf(r.length),s=hk.decode(r);for(let e=0;e<s.length-i;e++)if(0!==s[e])throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(s.slice(s.length-i)))}return Uint8Array.from(t)}},fk=ZS(YS("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),XS("")),gk=[996825010,642813549,513874426,1027748829,705979059];function mk(e){const t=e>>25;let n=(33554431&e)<<5;for(let r=0;r<gk.length;r++)1==(t>>r&1)&&(n^=gk[r]);return n}function yk(e,t,n=1){const r=e.length;let i=1;for(let s=0;s<r;s++){const t=e.charCodeAt(s);if(t<33||t>126)throw new Error(`Invalid prefix (${e})`);i=mk(i)^t>>5}i=mk(i);for(let s=0;s<r;s++)i=mk(i)^31&e.charCodeAt(s);for(let s of t)i=mk(i)^s;for(let s=0;s<6;s++)i=mk(i);return i^=n,fk.encode(rk([i%2**30],30,5,!1))}function vk(e){const t="bech32"===e?1:734539939,n=ik(5),r=n.decode,i=n.encode,s=sk(r);function o(e,n=90){if("string"!=typeof e)throw new Error("bech32.decode input should be string, not "+typeof e);if(e.length<8||!1!==n&&e.length>n)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${n})`);const r=e.toLowerCase();if(e!==r&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=(e=r).lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const s=e.slice(0,i),o=e.slice(i+1);if(o.length<6)throw new Error("Data must be at least 6 characters long");const a=fk.decode(o).slice(0,-6),l=yk(s,a,t);if(!o.endsWith(l))throw new Error(`Invalid checksum in ${e}: expected "${l}"`);return{prefix:s,words:a}}return{encode:function(e,n,r=90){if("string"!=typeof e)throw new Error("bech32.encode prefix should be string, not "+typeof e);if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof n);const i=e.length+7+n.length;if(!1!==r&&i>r)throw new TypeError(`Length ${i} exceeds limit ${r}`);return`${e=e.toLowerCase()}1${fk.encode(n)}${yk(e,n,t)}`},decode:o,decodeToBytes:function(e){const{prefix:t,words:n}=o(e,!1);return{prefix:t,words:n,bytes:r(n)}},decodeUnsafe:sk(o),fromWords:r,fromWordsUnsafe:s,toWords:i}}var bk=vk("bech32"),wk=(vk("bech32m"),{utf8:{encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},hex:ZS(ik(4),YS("0123456789abcdef"),XS(""),QS(e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})),base16:ok,base32:ak,base64:lk,base64url:ck,base58:hk,base58xmr:pk});function _k(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function xk(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)}function Ck(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function Sk(e,...t){if(!Ck(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function kk(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Ek(e,t){Sk(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}Object.keys(wk).join(", ");var Rk=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Tk=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),Lk=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw new Error("Non little-endian hardware is not supported");var Ik=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Pk(e){Sk(e);let t="";for(let n=0;n<e.length;n++)t+=Ik[e[n]];return t}function Mk(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0}function Ak(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,s=0;i<n;i++,s+=2){const t=Mk(e.charCodeAt(s)),n=Mk(e.charCodeAt(s+1));if(void 0===t||void 0===n){const t=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+s)}r[i]=16*t+n}return r}function Ok(e){if("string"==typeof e)e=function(e){if("string"!=typeof e)throw new Error("string expected, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e);else{if(!Ck(e))throw new Error("Uint8Array expected, got "+typeof e);e=e.slice()}return e}function Nk(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n}var Fk=(e,t)=>(Object.assign(t,e),t);function Dk(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),l=r?4:0,c=r?0:4;e.setUint32(t+l,o,r),e.setUint32(t+c,a,r)}var zk=16,jk=new Uint8Array(16),Uk=Tk(jk),Bk=(e,t,n,r)=>({s3:n<<31|r>>>1,s2:t<<31|n>>>1,s1:e<<31|t>>>1,s0:e>>>1^225<<24&-(1&r)}),$k=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255,qk=class{constructor(e,t){this.blockLen=zk,this.outputLen=zk,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,Sk(e=Ok(e),16);const n=Lk(e);let r=n.getUint32(0,!1),i=n.getUint32(4,!1),s=n.getUint32(8,!1),o=n.getUint32(12,!1);const a=[];for(let d=0;d<128;d++)a.push({s0:$k(r),s1:$k(i),s2:$k(s),s3:$k(o)}),({s0:r,s1:i,s2:s,s3:o}=Bk(r,i,s,o));const l=(e=>e>65536?8:e>1024?4:2)(t||1024);if(![1,2,4,8].includes(l))throw new Error(`ghash: wrong window size=${l}, should be 2, 4 or 8`);this.W=l;const c=128/l,u=this.windowSize=2**l,h=[];for(let d=0;d<c;d++)for(let e=0;e<u;e++){let t=0,n=0,r=0,i=0;for(let s=0;s<l;s++){if(!(e>>>l-s-1&1))continue;const{s0:o,s1:c,s2:u,s3:h}=a[l*d+s];t^=o,n^=c,r^=u,i^=h}h.push({s0:t,s1:n,s2:r,s3:i})}this.t=h}_updateBlock(e,t,n,r){e^=this.s0,t^=this.s1,n^=this.s2,r^=this.s3;const{W:i,t:s,windowSize:o}=this;let a=0,l=0,c=0,u=0;const h=(1<<i)-1;let d=0;for(const p of[e,t,n,r])for(let e=0;e<4;e++){const t=p>>>8*e&255;for(let e=8/i-1;e>=0;e--){const n=t>>>i*e&h,{s0:r,s1:p,s2:f,s3:g}=s[d*o+n];a^=r,l^=p,c^=f,u^=g,d+=1}}this.s0=a,this.s1=l,this.s2=c,this.s3=u}update(e){e=Ok(e),kk(this);const t=Tk(e),n=Math.floor(e.length/zk),r=e.length%zk;for(let i=0;i<n;i++)this._updateBlock(t[4*i+0],t[4*i+1],t[4*i+2],t[4*i+3]);return r&&(jk.set(e.subarray(n*zk)),this._updateBlock(Uk[0],Uk[1],Uk[2],Uk[3]),Uk.fill(0)),this}destroy(){const{t:e}=this;for(const t of e)t.s0=0,t.s1=0,t.s2=0,t.s3=0}digestInto(e){kk(this),Ek(e,this),this.finished=!0;const{s0:t,s1:n,s2:r,s3:i}=this,s=Tk(e);return s[0]=t,s[1]=n,s[2]=r,s[3]=i,e}digest(){const e=new Uint8Array(zk);return this.digestInto(e),this.destroy(),e}},Vk=class extends qk{constructor(e,t){const n=function(e){e.reverse();const t=1&e[15];let n=0;for(let r=0;r<e.length;r++){const t=e[r];e[r]=t>>>1|n,n=(1&t)<<7}return e[0]^=225&-t,e}((e=Ok(e)).slice());super(n,t),n.fill(0)}update(e){e=Ok(e),kk(this);const t=Tk(e),n=e.length%zk,r=Math.floor(e.length/zk);for(let i=0;i<r;i++)this._updateBlock($k(t[4*i+3]),$k(t[4*i+2]),$k(t[4*i+1]),$k(t[4*i+0]));return n&&(jk.set(e.subarray(r*zk)),this._updateBlock($k(Uk[3]),$k(Uk[2]),$k(Uk[1]),$k(Uk[0])),Uk.fill(0)),this}digestInto(e){kk(this),Ek(e,this),this.finished=!0;const{s0:t,s1:n,s2:r,s3:i}=this,s=Tk(e);return s[0]=t,s[1]=n,s[2]=r,s[3]=i,e.reverse()}};function Wk(e){const t=(t,n)=>e(n,t.length).update(Ok(t)).digest(),n=e(new Uint8Array(16),0);return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=(t,n)=>e(t,n),t}var Hk=Wk((e,t)=>new qk(e,t)),Gk=Wk((e,t)=>new Vk(e,t)),Kk=16,Zk=new Uint8Array(Kk);function Yk(e){return e<<1^283&-(e>>7)}function Xk(e,t){let n=0;for(;t>0;t>>=1)n^=e&-(1&t),e=Yk(e);return n}var Jk=(()=>{let e=new Uint8Array(256);for(let n=0,r=1;n<256;n++,r^=Yk(r))e[n]=r;const t=new Uint8Array(256);t[0]=99;for(let n=0;n<255;n++){let r=e[255-n];r|=r<<8,t[e[n]]=255&(r^r>>4^r>>5^r>>6^r>>7^99)}return t})(),Qk=Jk.map((e,t)=>Jk.indexOf(t)),eE=e=>e<<24|e>>>8,tE=e=>e<<8|e>>>24;function nE(e,t){if(256!==e.length)throw new Error("Wrong sbox length");const n=new Uint32Array(256).map((n,r)=>t(e[r])),r=n.map(tE),i=r.map(tE),s=i.map(tE),o=new Uint32Array(65536),a=new Uint32Array(65536),l=new Uint16Array(65536);for(let c=0;c<256;c++)for(let t=0;t<256;t++){const u=256*c+t;o[u]=n[c]^r[t],a[u]=i[c]^s[t],l[u]=e[c]<<8|e[t]}return{sbox:e,sbox2:l,T0:n,T1:r,T2:i,T3:s,T01:o,T23:a}}var rE=nE(Jk,e=>Xk(e,3)<<24|e<<16|e<<8|Xk(e,2)),iE=nE(Qk,e=>Xk(e,11)<<24|Xk(e,13)<<16|Xk(e,9)<<8|Xk(e,14)),sE=(()=>{const e=new Uint8Array(16);for(let t=0,n=1;t<16;t++,n=Yk(n))e[t]=n;return e})();function oE(e){Sk(e);const t=e.length;if(![16,24,32].includes(t))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${t}`);const{sbox2:n}=rE,r=Tk(e),i=r.length,s=e=>cE(n,e,e,e,e),o=new Uint32Array(t+28);o.set(r);for(let a=i;a<o.length;a++){let e=o[a-1];a%i===0?e=s(eE(e))^sE[a/i-1]:i>6&&a%i===4&&(e=s(e)),o[a]=o[a-i]^e}return o}function aE(e){const t=oE(e),n=t.slice(),r=t.length,{sbox2:i}=rE,{T0:s,T1:o,T2:a,T3:l}=iE;for(let c=0;c<r;c+=4)for(let e=0;e<4;e++)n[c+e]=t[r-c-4+e];t.fill(0);for(let c=4;c<r-4;c++){const e=n[c],t=cE(i,e,e,e,e);n[c]=s[255&t]^o[t>>>8&255]^a[t>>>16&255]^l[t>>>24]}return n}function lE(e,t,n,r,i,s){return e[n<<8&65280|r>>>8&255]^t[i>>>8&65280|s>>>24&255]}function cE(e,t,n,r,i){return e[255&t|65280&n]|e[r>>>16&255|i>>>16&65280]<<16}function uE(e,t,n,r,i){const{sbox2:s,T01:o,T23:a}=rE;let l=0;t^=e[l++],n^=e[l++],r^=e[l++],i^=e[l++];const c=e.length/4-2;for(let u=0;u<c;u++){const s=e[l++]^lE(o,a,t,n,r,i),c=e[l++]^lE(o,a,n,r,i,t),u=e[l++]^lE(o,a,r,i,t,n),h=e[l++]^lE(o,a,i,t,n,r);t=s,n=c,r=u,i=h}return{s0:e[l++]^cE(s,t,n,r,i),s1:e[l++]^cE(s,n,r,i,t),s2:e[l++]^cE(s,r,i,t,n),s3:e[l++]^cE(s,i,t,n,r)}}function hE(e,t,n,r,i){const{sbox2:s,T01:o,T23:a}=iE;let l=0;t^=e[l++],n^=e[l++],r^=e[l++],i^=e[l++];const c=e.length/4-2;for(let u=0;u<c;u++){const s=e[l++]^lE(o,a,t,i,r,n),c=e[l++]^lE(o,a,n,t,i,r),u=e[l++]^lE(o,a,r,n,t,i),h=e[l++]^lE(o,a,i,r,n,t);t=s,n=c,r=u,i=h}return{s0:e[l++]^cE(s,t,i,r,n),s1:e[l++]^cE(s,n,t,i,r),s2:e[l++]^cE(s,r,n,t,i),s3:e[l++]^cE(s,i,r,n,t)}}function dE(e,t){if(!t)return new Uint8Array(e);if(Sk(t),t.length<e)throw new Error(`aes: wrong destination length, expected at least ${e}, got: ${t.length}`);return t}function pE(e,t,n,r,i){Sk(n,Kk),Sk(r),i=dE(r.length,i);const s=n,o=Tk(s),a=Lk(s),l=Tk(r),c=Tk(i),u=t?0:12,h=r.length;let d=a.getUint32(u,t),{s0:p,s1:f,s2:g,s3:m}=uE(e,o[0],o[1],o[2],o[3]);for(let v=0;v+4<=l.length;v+=4)c[v+0]=l[v+0]^p,c[v+1]=l[v+1]^f,c[v+2]=l[v+2]^g,c[v+3]=l[v+3]^m,d=d+1>>>0,a.setUint32(u,d,t),({s0:p,s1:f,s2:g,s3:m}=uE(e,o[0],o[1],o[2],o[3]));const y=Kk*Math.floor(l.length/4);if(y<h){const e=new Uint32Array([p,f,g,m]),t=Rk(e);for(let n=y,s=0;n<h;n++,s++)i[n]=r[n]^t[s]}return i}function fE(e){if(Sk(e),e.length%Kk!==0)throw new Error("aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size 16")}function gE(e,t,n){let r=e.length;const i=r%Kk;if(!t&&0!==i)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");const s=Tk(e);if(t){let e=Kk-i;e||(e=Kk),r+=e}const o=dE(r,n);return{b:s,o:Tk(o),out:o}}function mE(e,t){if(!t)return e;const n=e.length;if(!n)throw new Error("aes/pcks5: empty ciphertext not allowed");const r=e[n-1];if(r<=0||r>16)throw new Error(`aes/pcks5: wrong padding byte: ${r}`);const i=e.subarray(0,-r);for(let s=0;s<r;s++)if(e[n-s-1]!==r)throw new Error("aes/pcks5: wrong padding");return i}function yE(e){const t=new Uint8Array(16),n=Tk(t);t.set(e);const r=Kk-e.length;for(let i=Kk-r;i<Kk;i++)t[i]=r;return n}Fk({blockSize:16,nonceLength:16},function(e,t){function n(n,r){const i=oE(e),s=t.slice(),o=function(e,t,n,r){Sk(t,Kk),Sk(n);const i=n.length;r=dE(i,r);const s=t,o=Tk(s);let{s0:a,s1:l,s2:c,s3:u}=uE(e,o[0],o[1],o[2],o[3]);const h=Tk(n),d=Tk(r);for(let f=0;f+4<=h.length;f+=4){d[f+0]=h[f+0]^a,d[f+1]=h[f+1]^l,d[f+2]=h[f+2]^c,d[f+3]=h[f+3]^u;let t=1;for(let e=s.length-1;e>=0;e--)t=t+(255&s[e])|0,s[e]=255&t,t>>>=8;({s0:a,s1:l,s2:c,s3:u}=uE(e,o[0],o[1],o[2],o[3]))}const p=Kk*Math.floor(h.length/4);if(p<i){const e=new Uint32Array([a,l,c,u]),t=Rk(e);for(let s=p,o=0;s<i;s++,o++)r[s]=n[s]^t[o]}return r}(i,s,n,r);return i.fill(0),s.fill(0),o}return Sk(e),Sk(t,Kk),{encrypt:(e,t)=>n(e,t),decrypt:(e,t)=>n(e,t)}}),Fk({blockSize:16},function(e,t={}){Sk(e);const n=!t.disablePadding;return{encrypt:(t,r)=>{Sk(t);const{b:i,o:s,out:o}=gE(t,n,r),a=oE(e);let l=0;for(;l+4<=i.length;){const{s0:e,s1:t,s2:n,s3:r}=uE(a,i[l+0],i[l+1],i[l+2],i[l+3]);s[l++]=e,s[l++]=t,s[l++]=n,s[l++]=r}if(n){const e=yE(t.subarray(4*l)),{s0:n,s1:r,s2:i,s3:o}=uE(a,e[0],e[1],e[2],e[3]);s[l++]=n,s[l++]=r,s[l++]=i,s[l++]=o}return a.fill(0),o},decrypt:(t,r)=>{fE(t);const i=aE(e),s=dE(t.length,r),o=Tk(t),a=Tk(s);for(let e=0;e+4<=o.length;){const{s0:t,s1:n,s2:r,s3:s}=hE(i,o[e+0],o[e+1],o[e+2],o[e+3]);a[e++]=t,a[e++]=n,a[e++]=r,a[e++]=s}return i.fill(0),mE(s,n)}}});var vE=Fk({blockSize:16,nonceLength:16},function(e,t,n={}){Sk(e),Sk(t,16);const r=!n.disablePadding;return{encrypt:(n,i)=>{const s=oE(e),{b:o,o:a,out:l}=gE(n,r,i),c=Tk(t);let u=c[0],h=c[1],d=c[2],p=c[3],f=0;for(;f+4<=o.length;)u^=o[f+0],h^=o[f+1],d^=o[f+2],p^=o[f+3],({s0:u,s1:h,s2:d,s3:p}=uE(s,u,h,d,p)),a[f++]=u,a[f++]=h,a[f++]=d,a[f++]=p;if(r){const e=yE(n.subarray(4*f));u^=e[0],h^=e[1],d^=e[2],p^=e[3],({s0:u,s1:h,s2:d,s3:p}=uE(s,u,h,d,p)),a[f++]=u,a[f++]=h,a[f++]=d,a[f++]=p}return s.fill(0),l},decrypt:(n,i)=>{fE(n);const s=aE(e),o=Tk(t),a=dE(n.length,i),l=Tk(n),c=Tk(a);let u=o[0],h=o[1],d=o[2],p=o[3];for(let e=0;e+4<=l.length;){const t=u,n=h,r=d,i=p;u=l[e+0],h=l[e+1],d=l[e+2],p=l[e+3];const{s0:o,s1:a,s2:f,s3:g}=hE(s,u,h,d,p);c[e++]=o^t,c[e++]=a^n,c[e++]=f^r,c[e++]=g^i}return s.fill(0),mE(a,r)}}});function bE(e,t,n,r,i){const s=e.create(n,r.length+(i?.length||0));i&&s.update(i),s.update(r);const o=new Uint8Array(16),a=Lk(o);return i&&Dk(a,0,BigInt(8*i.length),t),Dk(a,8,BigInt(8*r.length),t),s.update(o),s.digest()}Fk({blockSize:16,nonceLength:16},function(e,t){function n(n,r,i){const s=oE(e),o=n.length;i=dE(o,i);const a=Tk(n),l=Tk(i),c=r?l:a,u=Tk(t);let h=u[0],d=u[1],p=u[2],f=u[3];for(let e=0;e+4<=a.length;){const{s0:t,s1:n,s2:r,s3:i}=uE(s,h,d,p,f);l[e+0]=a[e+0]^t,l[e+1]=a[e+1]^n,l[e+2]=a[e+2]^r,l[e+3]=a[e+3]^i,h=c[e++],d=c[e++],p=c[e++],f=c[e++]}const g=Kk*Math.floor(a.length/4);if(g<o){({s0:h,s1:d,s2:p,s3:f}=uE(s,h,d,p,f));const e=Rk(new Uint32Array([h,d,p,f]));for(let t=g,r=0;t<o;t++,r++)i[t]=n[t]^e[r];e.fill(0)}return s.fill(0),i}return Sk(e),Sk(t,16),{encrypt:(e,t)=>n(e,!0,t),decrypt:(e,t)=>n(e,!1,t)}}),Fk({blockSize:16,nonceLength:12,tagLength:16},function(e,t,n){if(Sk(t),0===t.length)throw new Error("aes/gcm: empty nonce");function r(e,t,r){const i=bE(Hk,!1,e,r,n);for(let n=0;n<t.length;n++)i[n]^=t[n];return i}function i(){const n=oE(e),r=Zk.slice(),i=Zk.slice();if(pE(n,!1,i,i,r),12===t.length)i.set(t);else{const e=Zk.slice();Dk(Lk(e),8,BigInt(8*t.length),!1),Hk.create(r).update(t).update(e).digestInto(i)}return{xk:n,authKey:r,counter:i,tagMask:pE(n,!1,i,Zk)}}return{encrypt:e=>{Sk(e);const{xk:t,authKey:n,counter:s,tagMask:o}=i(),a=new Uint8Array(e.length+16);pE(t,!1,s,e,a);const l=r(n,o,a.subarray(0,a.length-16));return a.set(l,e.length),t.fill(0),a},decrypt:e=>{if(Sk(e),e.length<16)throw new Error("aes/gcm: ciphertext less than tagLen (16)");const{xk:t,authKey:n,counter:s,tagMask:o}=i(),a=e.subarray(0,-16),l=e.subarray(-16);if(!Nk(r(n,o,a),l))throw new Error("aes/gcm: invalid ghash tag");const c=pE(t,!1,s,a);return n.fill(0),o.fill(0),t.fill(0),c}}});var wE=(e,t,n)=>r=>{if(!Number.isSafeInteger(r)||t>r||r>n)throw new Error(`${e}: invalid value=${r}, must be [${t}..${n}]`)},_E=(Fk({blockSize:16,nonceLength:12,tagLength:16},function(e,t,n){const r=wE("AAD",0,2**36),i=wE("plaintext",0,2**36),s=wE("nonce",12,12),o=wE("ciphertext",16,2**36+16);function a(){const n=e.length;if(16!==n&&24!==n&&32!==n)throw new Error(`key length must be 16, 24 or 32 bytes, got: ${n} bytes`);const r=oE(e),i=new Uint8Array(n),s=new Uint8Array(16),o=Tk(t);let a=0,l=o[0],c=o[1],u=o[2],h=0;for(const e of[s,i].map(Tk)){const t=Tk(e);for(let e=0;e<t.length;e+=2){const{s0:n,s1:i}=uE(r,a,l,c,u);t[e+0]=n,t[e+1]=i,a=++h}}return r.fill(0),{authKey:s,encKey:oE(i)}}function l(e,r,i){const s=bE(Gk,!0,r,i,n);for(let n=0;n<12;n++)s[n]^=t[n];s[15]&=127;const o=Tk(s);let a=o[0],l=o[1],c=o[2],u=o[3];return({s0:a,s1:l,s2:c,s3:u}=uE(e,a,l,c,u)),o[0]=a,o[1]=l,o[2]=c,o[3]=u,s}function c(e,t,n){let r=t.slice();return r[15]|=128,pE(e,!0,r,n)}return Sk(t),s(t.length),n&&(Sk(n),r(n.length)),{encrypt:e=>{Sk(e),i(e.length);const{encKey:t,authKey:n}=a(),r=l(t,n,e),s=new Uint8Array(e.length+16);return s.set(r,e.length),s.set(c(t,r,e)),t.fill(0),n.fill(0),s},decrypt:e=>{Sk(e),o(e.length);const t=e.subarray(-16),{encKey:n,authKey:r}=a(),i=c(n,t,e.subarray(0,-16)),s=l(n,r,i);if(n.fill(0),r.fill(0),!Nk(t,s))throw new Error("invalid polyval tag");return i}}}),(e,t)=>255&e[t++]|(255&e[t++])<<8),xE=class{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,Sk(e=Ok(e),32);const t=_E(e,0),n=_E(e,2),r=_E(e,4),i=_E(e,6),s=_E(e,8),o=_E(e,10),a=_E(e,12),l=_E(e,14);this.r[0]=8191&t,this.r[1]=8191&(t>>>13|n<<3),this.r[2]=7939&(n>>>10|r<<6),this.r[3]=8191&(r>>>7|i<<9),this.r[4]=255&(i>>>4|s<<12),this.r[5]=s>>>1&8190,this.r[6]=8191&(s>>>14|o<<2),this.r[7]=8065&(o>>>11|a<<5),this.r[8]=8191&(a>>>8|l<<8),this.r[9]=l>>>5&127;for(let c=0;c<8;c++)this.pad[c]=_E(e,16+2*c)}process(e,t,n=!1){const r=n?0:2048,{h:i,r:s}=this,o=s[0],a=s[1],l=s[2],c=s[3],u=s[4],h=s[5],d=s[6],p=s[7],f=s[8],g=s[9],m=_E(e,t+0),y=_E(e,t+2),v=_E(e,t+4),b=_E(e,t+6),w=_E(e,t+8),_=_E(e,t+10),x=_E(e,t+12),C=_E(e,t+14);let S=i[0]+(8191&m),k=i[1]+(8191&(m>>>13|y<<3)),E=i[2]+(8191&(y>>>10|v<<6)),R=i[3]+(8191&(v>>>7|b<<9)),T=i[4]+(8191&(b>>>4|w<<12)),L=i[5]+(w>>>1&8191),I=i[6]+(8191&(w>>>14|_<<2)),P=i[7]+(8191&(_>>>11|x<<5)),M=i[8]+(8191&(x>>>8|C<<8)),A=i[9]+(C>>>5|r),O=0,N=O+S*o+k*(5*g)+E*(5*f)+R*(5*p)+T*(5*d);O=N>>>13,N&=8191,N+=L*(5*h)+I*(5*u)+P*(5*c)+M*(5*l)+A*(5*a),O+=N>>>13,N&=8191;let F=O+S*a+k*o+E*(5*g)+R*(5*f)+T*(5*p);O=F>>>13,F&=8191,F+=L*(5*d)+I*(5*h)+P*(5*u)+M*(5*c)+A*(5*l),O+=F>>>13,F&=8191;let D=O+S*l+k*a+E*o+R*(5*g)+T*(5*f);O=D>>>13,D&=8191,D+=L*(5*p)+I*(5*d)+P*(5*h)+M*(5*u)+A*(5*c),O+=D>>>13,D&=8191;let z=O+S*c+k*l+E*a+R*o+T*(5*g);O=z>>>13,z&=8191,z+=L*(5*f)+I*(5*p)+P*(5*d)+M*(5*h)+A*(5*u),O+=z>>>13,z&=8191;let j=O+S*u+k*c+E*l+R*a+T*o;O=j>>>13,j&=8191,j+=L*(5*g)+I*(5*f)+P*(5*p)+M*(5*d)+A*(5*h),O+=j>>>13,j&=8191;let U=O+S*h+k*u+E*c+R*l+T*a;O=U>>>13,U&=8191,U+=L*o+I*(5*g)+P*(5*f)+M*(5*p)+A*(5*d),O+=U>>>13,U&=8191;let B=O+S*d+k*h+E*u+R*c+T*l;O=B>>>13,B&=8191,B+=L*a+I*o+P*(5*g)+M*(5*f)+A*(5*p),O+=B>>>13,B&=8191;let $=O+S*p+k*d+E*h+R*u+T*c;O=$>>>13,$&=8191,$+=L*l+I*a+P*o+M*(5*g)+A*(5*f),O+=$>>>13,$&=8191;let q=O+S*f+k*p+E*d+R*h+T*u;O=q>>>13,q&=8191,q+=L*c+I*l+P*a+M*o+A*(5*g),O+=q>>>13,q&=8191;let V=O+S*g+k*f+E*p+R*d+T*h;O=V>>>13,V&=8191,V+=L*u+I*c+P*l+M*a+A*o,O+=V>>>13,V&=8191,O=(O<<2)+O|0,O=O+N|0,N=8191&O,O>>>=13,F+=O,i[0]=N,i[1]=F,i[2]=D,i[3]=z,i[4]=j,i[5]=U,i[6]=B,i[7]=$,i[8]=q,i[9]=V}finalize(){const{h:e,pad:t}=this,n=new Uint16Array(10);let r=e[1]>>>13;e[1]&=8191;for(let o=2;o<10;o++)e[o]+=r,r=e[o]>>>13,e[o]&=8191;e[0]+=5*r,r=e[0]>>>13,e[0]&=8191,e[1]+=r,r=e[1]>>>13,e[1]&=8191,e[2]+=r,n[0]=e[0]+5,r=n[0]>>>13,n[0]&=8191;for(let o=1;o<10;o++)n[o]=e[o]+r,r=n[o]>>>13,n[o]&=8191;n[9]-=8192;let i=(1^r)-1;for(let o=0;o<10;o++)n[o]&=i;i=~i;for(let o=0;o<10;o++)e[o]=e[o]&i|n[o];e[0]=65535&(e[0]|e[1]<<13),e[1]=65535&(e[1]>>>3|e[2]<<10),e[2]=65535&(e[2]>>>6|e[3]<<7),e[3]=65535&(e[3]>>>9|e[4]<<4),e[4]=65535&(e[4]>>>12|e[5]<<1|e[6]<<14),e[5]=65535&(e[6]>>>2|e[7]<<11),e[6]=65535&(e[7]>>>5|e[8]<<8),e[7]=65535&(e[8]>>>8|e[9]<<5);let s=e[0]+t[0];e[0]=65535&s;for(let o=1;o<8;o++)s=(e[o]+t[o]|0)+(s>>>16)|0,e[o]=65535&s}update(e){kk(this);const{buffer:t,blockLen:n}=this,r=(e=Ok(e)).length;for(let i=0;i<r;){const s=Math.min(n-this.pos,r-i);if(s!==n)t.set(e.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===n&&(this.process(t,0,!1),this.pos=0);else for(;n<=r-i;i+=n)this.process(e,i)}return this}destroy(){this.h.fill(0),this.r.fill(0),this.buffer.fill(0),this.pad.fill(0)}digestInto(e){kk(this),Ek(e,this),this.finished=!0;const{buffer:t,h:n}=this;let{pos:r}=this;if(r){for(t[r++]=1;r<16;r++)t[r]=0;this.process(t,0,!0)}this.finalize();let i=0;for(let s=0;s<8;s++)e[i++]=n[s]>>>0,e[i++]=n[s]>>>8;return e}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}},CE=function(e){const t=(t,n)=>e(n).update(Ok(t)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}(e=>new xE(e)),SE=e=>Uint8Array.from(e.split("").map(e=>e.charCodeAt(0))),kE=SE("expand 16-byte k"),EE=SE("expand 32-byte k"),RE=Tk(kE),TE=Tk(EE);function LE(e,t){return e<<t|e>>>32-t}function IE(e){return e.byteOffset%4==0}TE.slice();var PE=2**32-1,ME=new Uint32Array;function AE(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:s,rounds:o}=function(e,t){if(null==t||"object"!=typeof t)throw new Error("options must be defined");return Object.assign({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t)}(0,t);if("function"!=typeof e)throw new Error("core must be a function");return _k(i),_k(o),xk(s),xk(n),(t,a,l,c,u=0)=>{Sk(t),Sk(a),Sk(l);const h=l.length;if(c||(c=new Uint8Array(h)),Sk(c),_k(u),u<0||u>=PE)throw new Error("arx: counter overflow");if(c.length<h)throw new Error(`arx: output (${c.length}) is shorter than data (${h})`);const d=[];let p,f,g=t.length;if(32===g)p=t.slice(),d.push(p),f=TE;else{if(16!==g||!n)throw new Error(`arx: invalid 32-byte key, got length=${g}`);p=new Uint8Array(32),p.set(t),p.set(t,16),f=RE,d.push(p)}IE(a)||(a=a.slice(),d.push(a));const m=Tk(p);if(r){if(24!==a.length)throw new Error("arx: extended nonce must be 24 bytes");r(f,m,Tk(a.subarray(0,16)),m),a=a.subarray(16)}const y=16-i;if(y!==a.length)throw new Error(`arx: nonce must be ${y} or 16 bytes`);if(12!==y){const e=new Uint8Array(12);e.set(a,s?0:12-a.length),a=e,d.push(a)}const v=Tk(a);for(function(e,t,n,r,i,s,o,a){const l=i.length,c=new Uint8Array(64),u=Tk(c),h=IE(i)&&IE(s),d=h?Tk(i):ME,p=h?Tk(s):ME;for(let f=0;f<l;o++){if(e(t,n,r,u,o,a),o>=PE)throw new Error("arx: counter overflow");const g=Math.min(64,l-f);if(h&&64===g){const e=f/4;if(f%4!=0)throw new Error("arx: invalid block position");for(let t,n=0;n<16;n++)t=e+n,p[t]=d[t]^u[n];f+=64;continue}for(let e,t=0;t<g;t++)e=f+t,s[e]=i[e]^c[t];f+=g}}(e,f,m,v,l,c,u,o);d.length>0;)d.pop().fill(0);return c}}function OE(e,t,n,r,i,s=20){let o=e[0],a=e[1],l=e[2],c=e[3],u=t[0],h=t[1],d=t[2],p=t[3],f=t[4],g=t[5],m=t[6],y=t[7],v=i,b=n[0],w=n[1],_=n[2],x=o,C=a,S=l,k=c,E=u,R=h,T=d,L=p,I=f,P=g,M=m,A=y,O=v,N=b,F=w,D=_;for(let j=0;j<s;j+=2)x=x+E|0,O=LE(O^x,16),I=I+O|0,E=LE(E^I,12),x=x+E|0,O=LE(O^x,8),I=I+O|0,E=LE(E^I,7),C=C+R|0,N=LE(N^C,16),P=P+N|0,R=LE(R^P,12),C=C+R|0,N=LE(N^C,8),P=P+N|0,R=LE(R^P,7),S=S+T|0,F=LE(F^S,16),M=M+F|0,T=LE(T^M,12),S=S+T|0,F=LE(F^S,8),M=M+F|0,T=LE(T^M,7),k=k+L|0,D=LE(D^k,16),A=A+D|0,L=LE(L^A,12),k=k+L|0,D=LE(D^k,8),A=A+D|0,L=LE(L^A,7),x=x+R|0,D=LE(D^x,16),M=M+D|0,R=LE(R^M,12),x=x+R|0,D=LE(D^x,8),M=M+D|0,R=LE(R^M,7),C=C+T|0,O=LE(O^C,16),A=A+O|0,T=LE(T^A,12),C=C+T|0,O=LE(O^C,8),A=A+O|0,T=LE(T^A,7),S=S+L|0,N=LE(N^S,16),I=I+N|0,L=LE(L^I,12),S=S+L|0,N=LE(N^S,8),I=I+N|0,L=LE(L^I,7),k=k+E|0,F=LE(F^k,16),P=P+F|0,E=LE(E^P,12),k=k+E|0,F=LE(F^k,8),P=P+F|0,E=LE(E^P,7);let z=0;r[z++]=o+x|0,r[z++]=a+C|0,r[z++]=l+S|0,r[z++]=c+k|0,r[z++]=u+E|0,r[z++]=h+R|0,r[z++]=d+T|0,r[z++]=p+L|0,r[z++]=f+I|0,r[z++]=g+P|0,r[z++]=m+M|0,r[z++]=y+A|0,r[z++]=v+O|0,r[z++]=b+N|0,r[z++]=w+F|0,r[z++]=_+D|0}var NE=AE(OE,{counterRight:!1,counterLength:4,allowShortKeys:!1}),FE=AE(OE,{counterRight:!1,counterLength:8,extendNonceFn:function(e,t,n,r){let i=e[0],s=e[1],o=e[2],a=e[3],l=t[0],c=t[1],u=t[2],h=t[3],d=t[4],p=t[5],f=t[6],g=t[7],m=n[0],y=n[1],v=n[2],b=n[3];for(let _=0;_<20;_+=2)i=i+l|0,m=LE(m^i,16),d=d+m|0,l=LE(l^d,12),i=i+l|0,m=LE(m^i,8),d=d+m|0,l=LE(l^d,7),s=s+c|0,y=LE(y^s,16),p=p+y|0,c=LE(c^p,12),s=s+c|0,y=LE(y^s,8),p=p+y|0,c=LE(c^p,7),o=o+u|0,v=LE(v^o,16),f=f+v|0,u=LE(u^f,12),o=o+u|0,v=LE(v^o,8),f=f+v|0,u=LE(u^f,7),a=a+h|0,b=LE(b^a,16),g=g+b|0,h=LE(h^g,12),a=a+h|0,b=LE(b^a,8),g=g+b|0,h=LE(h^g,7),i=i+c|0,b=LE(b^i,16),f=f+b|0,c=LE(c^f,12),i=i+c|0,b=LE(b^i,8),f=f+b|0,c=LE(c^f,7),s=s+u|0,m=LE(m^s,16),g=g+m|0,u=LE(u^g,12),s=s+u|0,m=LE(m^s,8),g=g+m|0,u=LE(u^g,7),o=o+h|0,y=LE(y^o,16),d=d+y|0,h=LE(h^d,12),o=o+h|0,y=LE(y^o,8),d=d+y|0,h=LE(h^d,7),a=a+l|0,v=LE(v^a,16),p=p+v|0,l=LE(l^p,12),a=a+l|0,v=LE(v^a,8),p=p+v|0,l=LE(l^p,7);let w=0;r[w++]=i,r[w++]=s,r[w++]=o,r[w++]=a,r[w++]=m,r[w++]=y,r[w++]=v,r[w++]=b},allowShortKeys:!1}),DE=new Uint8Array(16),zE=(e,t)=>{e.update(t);const n=t.length%16;n&&e.update(DE.subarray(n))},jE=new Uint8Array(32);function UE(e,t,n,r,i){const s=e(t,n,jE),o=CE.create(s);i&&zE(o,i),zE(o,r);const a=new Uint8Array(16),l=Lk(a);Dk(l,0,BigInt(i?i.length:0),!0),Dk(l,8,BigInt(r.length),!0),o.update(a);const c=o.digest();return s.fill(0),c}var BE=e=>(t,n,r)=>(Sk(t,32),Sk(n),{encrypt:(i,s)=>{const o=i.length,a=o+16;s?Sk(s,a):s=new Uint8Array(a),e(t,n,i,s,1);const l=UE(e,t,n,s.subarray(0,-16),r);return s.set(l,o),s},decrypt:(i,s)=>{const o=i.length,a=o-16;if(o<16)throw new Error("encrypted data must be at least 16 bytes");s?Sk(s,a):s=new Uint8Array(a);const l=i.subarray(0,-16);if(!Nk(i.subarray(-16),UE(e,t,n,l,r)))throw new Error("invalid tag");return e(t,n,l,s,1),s}}),$E=(BE(NE),BE(FE),class extends AS{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,zS.hash(e);const n=PS(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let s=0;s<i.length;s++)i[s]^=54;this.iHash.update(i),this.oHash=e.create();for(let s=0;s<i.length;s++)i[s]^=106;this.oHash.update(i),i.fill(0)}update(e){return zS.exists(this),this.iHash.update(e),this}digestInto(e){zS.exists(this),zS.bytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:s,outputLen:o}=this;return e.finished=r,e.destroyed=i,e.blockLen=s,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}),qE=(e,t,n)=>new $E(e,t).update(n).digest();qE.create=(e,t)=>new $E(e,t);var VE=new Uint8Array([0]),WE=new Uint8Array,HE=Object.defineProperty,GE=(e,t)=>{for(var n in t)HE(e,n,{get:t[n],enumerable:!0})},KE=Symbol("verified");function ZE(e){if(!(e instanceof Object))return!1;if("number"!=typeof e.kind)return!1;if("string"!=typeof e.content)return!1;if("number"!=typeof e.created_at)return!1;if("string"!=typeof e.pubkey)return!1;if(!e.pubkey.match(/^[a-f0-9]{64}$/))return!1;if(!Array.isArray(e.tags))return!1;for(let t=0;t<e.tags.length;t++){let n=e.tags[t];if(!Array.isArray(n))return!1;for(let e=0;e<n.length;e++)if("string"!=typeof n[e])return!1}return!0}GE({},{Queue:()=>rR,QueueNode:()=>nR,binarySearch:()=>tR,bytesToHex:()=>LS,hexToBytes:()=>IS,insertEventIntoAscendingList:()=>eR,insertEventIntoDescendingList:()=>QE,normalizeURL:()=>JE,utf8Decoder:()=>YE,utf8Encoder:()=>XE});var YE=new TextDecoder("utf-8"),XE=new TextEncoder;function JE(e){try{-1===e.indexOf("://")&&(e="wss://"+e);let t=new URL(e);return"http:"===t.protocol?t.protocol="ws:":"https:"===t.protocol&&(t.protocol="wss:"),t.pathname=t.pathname.replace(/\/+/g,"/"),t.pathname.endsWith("/")&&(t.pathname=t.pathname.slice(0,-1)),("80"===t.port&&"ws:"===t.protocol||"443"===t.port&&"wss:"===t.protocol)&&(t.port=""),t.searchParams.sort(),t.hash="",t.toString()}catch(t){throw new Error(`Invalid URL: ${e}`)}}function QE(e,t){const[n,r]=tR(e,e=>t.id===e.id?0:t.created_at===e.created_at?-1:e.created_at-t.created_at);return r||e.splice(n,0,t),e}function eR(e,t){const[n,r]=tR(e,e=>t.id===e.id?0:t.created_at===e.created_at?-1:t.created_at-e.created_at);return r||e.splice(n,0,t),e}function tR(e,t){let n=0,r=e.length-1;for(;n<=r;){const i=Math.floor((n+r)/2),s=t(e[i]);if(0===s)return[i,!0];s<0?r=i-1:n=i+1}return[n,!1]}var nR=class{value;next=null;prev=null;constructor(e){this.value=e}},rR=class{first;last;constructor(){this.first=null,this.last=null}enqueue(e){const t=new nR(e);return this.last?this.last===this.first?(this.last=t,this.last.prev=this.first,this.first.next=t):(t.prev=this.last,this.last.next=t,this.last=t):(this.first=t,this.last=t),!0}dequeue(){if(!this.first)return null;if(this.first===this.last){const e=this.first;return this.first=null,this.last=null,e.value}const e=this.first;return this.first=e.next,this.first&&(this.first.prev=null),e.value}};function iR(e){return LS(GS(XE.encode(function(e){if(!ZE(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}(e))))}var sR=new class{generateSecretKey(){return CS.utils.randomPrivateKey()}getPublicKey(e){return LS(CS.getPublicKey(e))}finalizeEvent(e,t){const n=e;return n.pubkey=LS(CS.getPublicKey(t)),n.id=iR(n),n.sig=LS(CS.sign(iR(n),t)),n[KE]=!0,n}verifyEvent(e){if("boolean"==typeof e[KE])return e[KE];const t=iR(e);if(t!==e.id)return e[KE]=!1,!1;try{const n=CS.verify(e.sig,t,e.pubkey);return e[KE]=n,n}catch(RD){return e[KE]=!1,!1}}},oR=sR.generateSecretKey,aR=sR.getPublicKey,lR=sR.finalizeEvent,cR=sR.verifyEvent,uR={};function hR(e){return e<1e4&&0!==e&&3!==e}function dR(e){return 0===e||3===e||1e4<=e&&e<2e4}function pR(e){return 2e4<=e&&e<3e4}function fR(e){return 3e4<=e&&e<4e4}function gR(e){return hR(e)?"regular":dR(e)?"replaceable":pR(e)?"ephemeral":fR(e)?"parameterized":"unknown"}function mR(e,t){const n=t instanceof Array?t:[t];return ZE(e)&&n.includes(e.kind)||!1}GE(uR,{Application:()=>BT,BadgeAward:()=>kR,BadgeDefinition:()=>OT,BlockedRelaysList:()=>pT,BlossomServerList:()=>wT,BookmarkList:()=>uT,Bookmarksets:()=>PT,Calendar:()=>KT,CalendarEventRSVP:()=>ZT,ChannelCreation:()=>NR,ChannelHideMessage:()=>zR,ChannelMessage:()=>DR,ChannelMetadata:()=>FR,ChannelMuteUser:()=>jR,ChatMessage:()=>ER,ClassifiedListing:()=>VT,ClientAuth:()=>CT,Comment:()=>VR,CommunitiesList:()=>hT,CommunityDefinition:()=>QT,CommunityPostApproval:()=>JR,Contacts:()=>wR,CreateOrUpdateProduct:()=>DT,CreateOrUpdateStall:()=>FT,Curationsets:()=>MT,Date:()=>HT,DirectMessageRelaysList:()=>vT,DraftClassifiedListing:()=>WT,DraftLong:()=>jT,Emojisets:()=>UT,EncryptedDirectMessage:()=>_R,EventDeletion:()=>xR,FavoriteRelays:()=>gT,FileMessage:()=>IR,FileMetadata:()=>qR,FileServerPreference:()=>bT,Followsets:()=>TT,ForumThread:()=>RR,GenericRepost:()=>PR,Genericlists:()=>LT,GiftWrap:()=>BR,GroupMetadata:()=>eL,HTTPAuth:()=>RT,Handlerinformation:()=>JT,Handlerrecommendation:()=>XT,Highlights:()=>sT,InterestsList:()=>mT,Interestsets:()=>NT,JobFeedback:()=>tT,JobRequest:()=>QR,JobResult:()=>eT,Label:()=>XR,LightningPubRPC:()=>xT,LiveChatMessage:()=>WR,LiveEvent:()=>$T,LongFormArticle:()=>zT,Metadata:()=>yR,Mutelist:()=>aT,NWCWalletInfo:()=>_T,NWCWalletRequest:()=>ST,NWCWalletResponse:()=>kT,NormalVideo:()=>AR,NostrConnect:()=>ET,OpenTimestamps:()=>UR,Photo:()=>MR,Pinlist:()=>lT,Poll:()=>$R,PollResponse:()=>oT,PrivateDirectMessage:()=>LR,ProblemTracker:()=>KR,ProfileBadges:()=>AT,PublicChatsList:()=>dT,Reaction:()=>SR,RecommendRelay:()=>bR,RelayList:()=>cT,RelayReview:()=>YT,Relaysets:()=>IT,Report:()=>ZR,Reporting:()=>YR,Repost:()=>CR,Seal:()=>TR,SearchRelaysList:()=>fT,ShortTextNote:()=>vR,ShortVideo:()=>OR,Time:()=>GT,UserEmojiList:()=>yT,UserStatuses:()=>qT,Voice:()=>HR,VoiceComment:()=>GR,Zap:()=>iT,ZapGoal:()=>nT,ZapRequest:()=>rT,classifyKind:()=>gR,isAddressableKind:()=>fR,isEphemeralKind:()=>pR,isKind:()=>mR,isRegularKind:()=>hR,isReplaceableKind:()=>dR});var yR=0,vR=1,bR=2,wR=3,_R=4,xR=5,CR=6,SR=7,kR=8,ER=9,RR=11,TR=13,LR=14,IR=15,PR=16,MR=20,AR=21,OR=22,NR=40,FR=41,DR=42,zR=43,jR=44,UR=1040,BR=1059,$R=1068,qR=1063,VR=1111,WR=1311,HR=1222,GR=1244,KR=1971,ZR=1984,YR=1984,XR=1985,JR=4550,QR=5999,eT=6999,tT=7e3,nT=9041,rT=9734,iT=9735,sT=9802,oT=1018,aT=1e4,lT=10001,cT=10002,uT=10003,hT=10004,dT=10005,pT=10006,fT=10007,gT=10012,mT=10015,yT=10030,vT=10050,bT=10096,wT=10063,_T=13194,xT=21e3,CT=22242,ST=23194,kT=23195,ET=24133,RT=27235,TT=3e4,LT=30001,IT=30002,PT=30003,MT=30004,AT=30008,OT=30009,NT=30015,FT=30017,DT=30018,zT=30023,jT=30024,UT=30030,BT=30078,$T=30311,qT=30315,VT=30402,WT=30403,HT=31922,GT=31923,KT=31924,ZT=31925,YT=31987,XT=31989,JT=31990,QT=34550,eL=39e3;function tL(e,t){let n=t.length+3,r=e.indexOf(`"${t}":`)+n,i=e.slice(r).indexOf('"')+r+1;return e.slice(i,i+64)}function nL(e,t){let n=t.length,r=e.indexOf(`"${t}":`)+n+3,i=e.slice(r),s=Math.min(i.indexOf(","),i.indexOf("}"));return parseInt(i.slice(0,s),10)}function rL(e){let t=e.slice(0,22).indexOf('"EVENT"');if(-1===t)return null;let n=e.slice(t+7+1).indexOf('"');if(-1===n)return null;let r=t+7+1+n,i=e.slice(r+1,80).indexOf('"');if(-1===i)return null;let s=r+1+i;return e.slice(r+1,s)}function iL(e,t){return t===tL(e,"id")}function sL(e,t){return t===tL(e,"pubkey")}function oL(e,t){return t===nL(e,"kind")}function aL(e,t){return{kind:CT,created_at:Math.floor(Date.now()/1e3),tags:[["relay",e],["challenge",t]],content:""}}GE({},{getHex64:()=>tL,getInt:()=>nL,getSubscriptionId:()=>rL,matchEventId:()=>iL,matchEventKind:()=>oL,matchEventPubkey:()=>sL}),GE({},{makeAuthEvent:()=>aL});try{WebSocket}catch{}try{WebSocket}catch{}GE({},{BECH32_REGEX:()=>uL,Bech32MaxSize:()=>cL,NostrTypeGuard:()=>lL,decode:()=>dL,decodeNostrURI:()=>hL,encodeBytes:()=>vL,naddrEncode:()=>_L,neventEncode:()=>wL,noteEncode:()=>mL,nprofileEncode:()=>bL,npubEncode:()=>gL,nsecEncode:()=>fL});var lL={isNProfile:e=>/^nprofile1[a-z\d]+$/.test(e||""),isNEvent:e=>/^nevent1[a-z\d]+$/.test(e||""),isNAddr:e=>/^naddr1[a-z\d]+$/.test(e||""),isNSec:e=>/^nsec1[a-z\d]{58}$/.test(e||""),isNPub:e=>/^npub1[a-z\d]{58}$/.test(e||""),isNote:e=>/^note1[a-z\d]+$/.test(e||""),isNcryptsec:e=>/^ncryptsec1[a-z\d]+$/.test(e||"")},cL=5e3,uL=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function hL(e){try{return e.startsWith("nostr:")&&(e=e.substring(6)),dL(e)}catch(t){return{type:"invalid",data:null}}}function dL(e){let{prefix:t,words:n}=bk.decode(e,cL),r=new Uint8Array(bk.fromWords(n));switch(t){case"nprofile":{let e=pL(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for nprofile");if(32!==e[0][0].length)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:LS(e[0][0]),relays:e[1]?e[1].map(e=>YE.decode(e)):[]}}}case"nevent":{let e=pL(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for nevent");if(32!==e[0][0].length)throw new Error("TLV 0 should be 32 bytes");if(e[2]&&32!==e[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(e[3]&&4!==e[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:LS(e[0][0]),relays:e[1]?e[1].map(e=>YE.decode(e)):[],author:e[2]?.[0]?LS(e[2][0]):void 0,kind:e[3]?.[0]?parseInt(LS(e[3][0]),16):void 0}}}case"naddr":{let e=pL(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!e[2]?.[0])throw new Error("missing TLV 2 for naddr");if(32!==e[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(!e[3]?.[0])throw new Error("missing TLV 3 for naddr");if(4!==e[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:YE.decode(e[0][0]),pubkey:LS(e[2][0]),kind:parseInt(LS(e[3][0]),16),relays:e[1]?e[1].map(e=>YE.decode(e)):[]}}}case"nsec":return{type:t,data:r};case"npub":case"note":return{type:t,data:LS(r)};default:throw new Error(`unknown prefix ${t}`)}}function pL(e){let t={},n=e;for(;n.length>0;){let e=n[0],r=n[1],i=n.slice(2,2+r);if(n=n.slice(2+r),i.length<r)throw new Error(`not enough data to read on TLV ${e}`);t[e]=t[e]||[],t[e].push(i)}return t}function fL(e){return vL("nsec",e)}function gL(e){return vL("npub",IS(e))}function mL(e){return vL("note",IS(e))}function yL(e,t){let n=bk.toWords(t);return bk.encode(e,n,cL)}function vL(e,t){return yL(e,t)}function bL(e){return yL("nprofile",xL({0:[IS(e.pubkey)],1:(e.relays||[]).map(e=>XE.encode(e))}))}function wL(e){let t;return void 0!==e.kind&&(t=function(e){const t=new Uint8Array(4);return t[0]=e>>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=255&e,t}(e.kind)),yL("nevent",xL({0:[IS(e.id)],1:(e.relays||[]).map(e=>XE.encode(e)),2:e.author?[IS(e.author)]:[],3:t?[new Uint8Array(t)]:[]}))}function _L(e){let t=new ArrayBuffer(4);return new DataView(t).setUint32(0,e.kind,!1),yL("naddr",xL({0:[XE.encode(e.identifier)],1:(e.relays||[]).map(e=>XE.encode(e)),2:[IS(e.pubkey)],3:[new Uint8Array(t)]}))}function xL(e){let t=[];return Object.entries(e).reverse().forEach(([e,n])=>{n.forEach(n=>{let r=new Uint8Array(n.length+2);r.set([parseInt(e)],0),r.set([n.length],1),r.set(n,2),t.push(r)})}),MS(...t)}var CL={};function SL(e,t,n){const r=e instanceof Uint8Array?LS(e):e,i=EL(aS.getSharedSecret(r,"02"+t));let s=Uint8Array.from(NS(16)),o=XE.encode(n),a=vE(i,s).encrypt(o);return`${lk.encode(new Uint8Array(a))}?iv=${lk.encode(new Uint8Array(s.buffer))}`}function kL(e,t,n){const r=e instanceof Uint8Array?LS(e):e;let[i,s]=n.split("?iv="),o=EL(aS.getSharedSecret(r,"02"+t)),a=lk.decode(s),l=lk.decode(i),c=vE(o,a).decrypt(l);return YE.decode(c)}function EL(e){return e.slice(1,33)}GE(CL,{decrypt:()=>kL,encrypt:()=>SL}),GE({},{NIP05_REGEX:()=>TL,isNip05:()=>LL,isValid:()=>AL,queryProfile:()=>ML,searchDomain:()=>PL,useFetchImplementation:()=>IL});var RL,TL=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,LL=e=>TL.test(e||"");try{RL=fetch}catch(Ite){}function IL(e){RL=e}async function PL(e,t=""){try{const n=`https://${e}/.well-known/nostr.json?name=${t}`,r=await RL(n,{redirect:"manual"});if(200!==r.status)throw Error("Wrong response code");return(await r.json()).names}catch(Ite){return{}}}async function ML(e){const t=e.match(TL);if(!t)return null;const[,n="_",r]=t;try{const e=`https://${r}/.well-known/nostr.json?name=${n}`,t=await RL(e,{redirect:"manual"});if(200!==t.status)throw Error("Wrong response code");const i=await t.json(),s=i.names[n];return s?{pubkey:s,relays:i.relays?.[s]}:null}catch(i){return null}}async function AL(e,t){const n=await ML(t);return!!n&&n.pubkey===e}function OL(e){const t={reply:void 0,root:void 0,mentions:[],profiles:[],quotes:[]};let n,r;for(let i=e.tags.length-1;i>=0;i--){const s=e.tags[i];if("e"===s[0]&&s[1]){const[e,i,o,a,l]=s,c={id:i,relays:o?[o]:[],author:l};if("root"===a){t.root=c;continue}if("reply"===a){t.reply=c;continue}if("mention"===a){t.mentions.push(c);continue}n?r=c:n=c,t.mentions.push(c);continue}if("q"===s[0]&&s[1]){const[e,n,r]=s;t.quotes.push({id:n,relays:r?[r]:[]})}"p"===s[0]&&s[1]&&t.profiles.push({pubkey:s[1],relays:s[2]?[s[2]]:[]})}return t.root||(t.root=r||n||t.reply),t.reply||(t.reply=n||t.root),[t.reply,t.root].forEach(e=>{if(!e)return;let n=t.mentions.indexOf(e);if(-1!==n&&t.mentions.splice(n,1),e.author){let n=t.profiles.find(t=>t.pubkey===e.author);n&&n.relays&&(e.relays||(e.relays=[]),n.relays.forEach(t=>{-1===e.relays?.indexOf(t)&&e.relays.push(t)}),n.relays=e.relays)}}),t.mentions.forEach(e=>{if(e.author){let n=t.profiles.find(t=>t.pubkey===e.author);n&&n.relays&&(e.relays||(e.relays=[]),n.relays.forEach(t=>{-1===e.relays.indexOf(t)&&e.relays.push(t)}),n.relays=e.relays)}}),t}function NL(){}async function FL(e){return await(await fetch(e.replace("ws://","http://").replace("wss://","https://"),{headers:{Accept:"application/nostr+json"}})).json()}function DL(e){let t=0;for(let n=0;n<64;n+=8){const r=parseInt(e.substring(n,n+8),16);if(0!==r){t+=Math.clz32(r);break}t+=32}return t}function zL(e,t){let n=0;const r=e,i=["nonce",n.toString(),t.toString()];for(r.tags.push(i);;){const e=Math.floor((new Date).getTime()/1e3);if(e!==r.created_at&&(n=0,r.created_at=e),i[1]=(++n).toString(),r.id=jL(r),DL(r.id)>=t)break}return r}function jL(e){return LS(GS(XE.encode(JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content]))))}GE({},{parse:()=>OL}),GE({},{fetchRelayInformation:()=>FL,useFetchImplementation:()=>NL}),GE({},{fastEventHash:()=>jL,getPow:()=>DL,minePow:()=>zL}),GE({},{unwrapEvent:()=>uI,unwrapManyEvents:()=>hI,wrapEvent:()=>lI,wrapManyEvents:()=>cI}),GE({},{createRumor:()=>tI,createSeal:()=>nI,createWrap:()=>rI,unwrapEvent:()=>oI,unwrapManyEvents:()=>aI,wrapEvent:()=>iI,wrapManyEvents:()=>sI});var UL={};GE(UL,{decrypt:()=>KL,encrypt:()=>GL,getConversationKey:()=>qL,v2:()=>ZL});var BL=1,$L=65535;function qL(e,t){const n=aS.getSharedSecret(e,"02"+t).subarray(1,33);return r=GS,i=n,s="nip44-v2",zS.hash(r),void 0===s&&(s=new Uint8Array(r.outputLen)),qE(r,PS(s),PS(i));var r,i,s}function VL(e,t){const n=function(e,t,n,r=32){if(zS.hash(e),zS.number(r),r>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(r/e.outputLen);void 0===n&&(n=WE);const s=new Uint8Array(i*e.outputLen),o=qE.create(e,t),a=o._cloneInto(),l=new Uint8Array(o.outputLen);for(let c=0;c<i;c++)VE[0]=c+1,a.update(0===c?WE:l).update(n).update(VE).digestInto(l),s.set(l,e.outputLen*c),o._cloneInto(a);return o.destroy(),a.destroy(),l.fill(0),VE.fill(0),s.slice(0,r)}(GS,e,t,76);return{chacha_key:n.subarray(0,32),chacha_nonce:n.subarray(32,44),hmac_key:n.subarray(44,76)}}function WL(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("expected positive integer");if(e<=32)return 32;const t=1<<Math.floor(Math.log2(e-1))+1,n=t<=256?32:t/8;return n*(Math.floor((e-1)/n)+1)}function HL(e,t,n){if(32!==n.length)throw new Error("AAD associated data must be 32 bytes");const r=MS(n,t);return qE(GS,e,r)}function GL(e,t,n=NS(32)){const{chacha_key:r,chacha_nonce:i,hmac_key:s}=VL(t,n),o=function(e){const t=XE.encode(e),n=t.length;return MS(function(e){if(!Number.isSafeInteger(e)||e<BL||e>$L)throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");const t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!1),t}(n),t,new Uint8Array(WL(n)-n))}(e),a=NE(r,i,o),l=HL(s,a,n);return lk.encode(MS(new Uint8Array([2]),n,a,l))}function KL(e,t){const{nonce:n,ciphertext:r,mac:i}=function(e){if("string"!=typeof e)throw new Error("payload must be a valid string");const t=e.length;if(t<132||t>87472)throw new Error("invalid payload length: "+t);if("#"===e[0])throw new Error("unknown encryption version");let n;try{n=lk.decode(e)}catch(_6){throw new Error("invalid base64: "+_6.message)}const r=n.length;if(r<99||r>65603)throw new Error("invalid data length: "+r);const i=n[0];if(2!==i)throw new Error("unknown encryption version "+i);return{nonce:n.subarray(1,33),ciphertext:n.subarray(33,-32),mac:n.subarray(-32)}}(e),{chacha_key:s,chacha_nonce:o,hmac_key:a}=VL(t,n);if(!Nk(HL(a,r,n),i))throw new Error("invalid MAC");return function(e){const t=new DataView(e.buffer).getUint16(0),n=e.subarray(2,2+t);if(t<BL||t>$L||n.length!==t||e.length!==2+WL(t))throw new Error("invalid padding");return YE.decode(n)}(NE(s,o,r))}var ZL={utils:{getConversationKey:qL,calcPaddedLen:WL},encrypt:GL,decrypt:KL},YL=()=>Math.round(Date.now()/1e3),XL=()=>Math.round(YL()-172800*Math.random()),JL=(e,t)=>qL(e,t),QL=(e,t,n)=>GL(JSON.stringify(e),JL(t,n)),eI=(e,t)=>JSON.parse(KL(e.content,JL(t,e.pubkey)));function tI(e,t){const n={created_at:YL(),content:"",tags:[],...e,pubkey:aR(t)};return n.id=iR(n),n}function nI(e,t,n){return lR({kind:TR,content:QL(e,t,n),created_at:XL(),tags:[]},t)}function rI(e,t){const n=oR();return lR({kind:BR,content:QL(e,n,t),created_at:XL(),tags:[["p",t]]},n)}function iI(e,t,n){return rI(nI(tI(e,t),t,n),n)}function sI(e,t,n){if(!n||0===n.length)throw new Error("At least one recipient is required.");const r=[iI(e,t,aR(t))];return n.forEach(n=>{r.push(iI(e,t,n))}),r}function oI(e,t){return eI(eI(e,t),t)}function aI(e,t){let n=[];return e.forEach(e=>{n.push(oI(e,t))}),n.sort((e,t)=>e.created_at-t.created_at),n}function lI(e,t,n,r,i){return iI(function(e,t,n,r){const i={created_at:Math.ceil(Date.now()/1e3),kind:LR,tags:[],content:t};return(Array.isArray(e)?e:[e]).forEach(({publicKey:e,relayUrl:t})=>{i.tags.push(t?["p",e,t]:["p",e])}),r&&i.tags.push(["e",r.eventId,r.relayUrl||"","reply"]),n&&i.tags.push(["subject",n]),i}(t,n,r,i),e,t.publicKey)}function cI(e,t,n,r,i){if(!t||0===t.length)throw new Error("At least one recipient is required.");return[{publicKey:aR(e)},...t].map(t=>lI(e,t,n,r,i))}var uI=oI,hI=aI;function dI(e,t,n,r){let i;const s=[...e.tags??[],["e",t.id,n],["p",t.pubkey]];return t.kind===vR?i=CR:(i=PR,s.push(["k",String(t.kind)])),lR({kind:i,tags:s,content:""===e.content||t.tags?.find(e=>"-"===e[0])?"":JSON.stringify(t),created_at:e.created_at},r)}function pI(e){if(![CR,PR].includes(e.kind))return;let t,n;for(let r=e.tags.length-1;r>=0&&(void 0===t||void 0===n);r--){const i=e.tags[r];i.length>=2&&("e"===i[0]&&void 0===t?t=i:"p"===i[0]&&void 0===n&&(n=i))}return void 0!==t?{id:t[1],relays:[t[2],n?.[2]].filter(e=>"string"==typeof e),author:n?.[1]}:void 0}function fI(e,{skipVerification:t}={}){const n=pI(e);if(void 0===n||""===e.content)return;let r;try{r=JSON.parse(e.content)}catch(_6){return}return r.id===n.id&&(t||cR(r))?r:void 0}GE({},{finishRepostEvent:()=>dI,getRepostedEvent:()=>fI,getRepostedEventPointer:()=>pI}),GE({},{NOSTR_URI_REGEX:()=>gI,parse:()=>yI,test:()=>mI});var gI=new RegExp(`nostr:(${uL.source})`);function mI(e){return"string"==typeof e&&new RegExp(`^${gI.source}$`).test(e)}function yI(e){const t=e.match(new RegExp(`^${gI.source}$`));if(!t)throw new Error(`Invalid Nostr URI: ${e}`);return{uri:t[0],value:t[1],decoded:dL(t[1])}}function vI(e,t,n){const r=t.tags.filter(e=>e.length>=2&&("e"===e[0]||"p"===e[0]));return lR({...e,kind:SR,tags:[...e.tags??[],...r,["e",t.id],["p",t.pubkey]],content:e.content??"+"},n)}function bI(e){if(e.kind!==SR)return;let t,n;for(let r=e.tags.length-1;r>=0&&(void 0===t||void 0===n);r--){const i=e.tags[r];i.length>=2&&("e"===i[0]&&void 0===t?t=i:"p"===i[0]&&void 0===n&&(n=i))}return void 0!==t&&void 0!==n?{id:t[1],relays:[t[2],n[2]].filter(e=>void 0!==e),author:n[1]}:void 0}GE({},{finishReactionEvent:()=>vI,getReactedEventPointer:()=>bI}),GE({},{parse:()=>CI});var wI=/\W/m,_I=/[^\w\/] |[^\w\/]$|$|,| /m,xI=42;function*CI(e){let t=[];if("string"!=typeof e){for(let n=0;n<e.tags.length;n++){const r=e.tags[n];"emoji"===r[0]&&r.length>=3&&t.push({type:"emoji",shortcode:r[1],url:r[2]})}e=e.content}const n=e.length;let r=0,i=0;e:for(;i<n;){const o=e.indexOf(":",i),a=e.indexOf("#",i);if(-1===o&&-1===a)break e;if(-1===o||a>=0&&a<o){if(0===a||" "===e[a-1]){const t=e.slice(a+1,a+xI).match(wI),s=t?a+1+t.index:n;yield{type:"text",text:e.slice(r,a)},yield{type:"hashtag",value:e.slice(a+1,s)},i=s,r=i;continue e}i=a+1}else if("nostr"===e.slice(o-5,o)){const t=e.slice(o+60).match(wI),a=t?o+60+t.index:n;try{let t,{data:n,type:s}=dL(e.slice(o+1,a));switch(s){case"npub":t={pubkey:n};break;case"note":t={id:n};break;case"nsec":i=a+1;continue;default:t=n}r!==o-5&&(yield{type:"text",text:e.slice(r,o-5)}),yield{type:"reference",pointer:t},i=a,r=i;continue e}catch(s){i=o+1;continue e}}else if("https"===e.slice(o-5,o)||"http"===e.slice(o-4,o)){const t=e.slice(o+4).match(_I),a=t?o+4+t.index:n,l="s"===e[o-1]?5:4;try{let t=new URL(e.slice(o-l,a));if(-1===t.hostname.indexOf("."))throw new Error("invalid url");if(r!==o-l&&(yield{type:"text",text:e.slice(r,o-l)}),/\.(png|jpe?g|gif|webp|heic|svg)$/i.test(t.pathname)){yield{type:"image",url:t.toString()},i=a,r=i;continue e}if(/\.(mp4|avi|webm|mkv|mov)$/i.test(t.pathname)){yield{type:"video",url:t.toString()},i=a,r=i;continue e}if(/\.(mp3|aac|ogg|opus|wav|flac)$/i.test(t.pathname)){yield{type:"audio",url:t.toString()},i=a,r=i;continue e}yield{type:"url",url:t.toString()},i=a,r=i;continue e}catch(s){i=a+1;continue e}}else{if("wss"!==e.slice(o-3,o)&&"ws"!==e.slice(o-2,o)){for(let n=0;n<t.length;n++){const s=t[n];if(":"===e[o+s.shortcode.length+1]&&e.slice(o+1,o+s.shortcode.length+1)===s.shortcode){r!==o&&(yield{type:"text",text:e.slice(r,o)}),yield s,i=o+s.shortcode.length+2,r=i;continue e}}i=o+1;continue e}{const t=e.slice(o+4).match(_I),a=t?o+4+t.index:n,l="s"===e[o-1]?3:2;try{let t=new URL(e.slice(o-l,a));if(-1===t.hostname.indexOf("."))throw new Error("invalid ws url");r!==o-l&&(yield{type:"text",text:e.slice(r,o-l)}),yield{type:"relay",url:t.toString()},i=a,r=i;continue e}catch(s){i=a+1;continue e}}}}r!==n&&(yield{type:"text",text:e.slice(r)})}GE({},{channelCreateEvent:()=>SI,channelHideMessageEvent:()=>RI,channelMessageEvent:()=>EI,channelMetadataEvent:()=>kI,channelMuteUserEvent:()=>TI});var SI=(e,t)=>{let n;if("object"==typeof e.content)n=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;n=e.content}return lR({kind:NR,tags:[...e.tags??[]],content:n,created_at:e.created_at},t)},kI=(e,t)=>{let n;if("object"==typeof e.content)n=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;n=e.content}return lR({kind:FR,tags:[["e",e.channel_create_event_id],...e.tags??[]],content:n,created_at:e.created_at},t)},EI=(e,t)=>{const n=[["e",e.channel_create_event_id,e.relay_url,"root"]];return e.reply_to_channel_message_event_id&&n.push(["e",e.reply_to_channel_message_event_id,e.relay_url,"reply"]),lR({kind:DR,tags:[...n,...e.tags??[]],content:e.content,created_at:e.created_at},t)},RI=(e,t)=>{let n;if("object"==typeof e.content)n=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;n=e.content}return lR({kind:zR,tags:[["e",e.channel_message_event_id],...e.tags??[]],content:n,created_at:e.created_at},t)},TI=(e,t)=>{let n;if("object"==typeof e.content)n=JSON.stringify(e.content);else{if("string"!=typeof e.content)return;n=e.content}return lR({kind:jR,tags:[["p",e.pubkey_to_mute],...e.tags??[]],content:n,created_at:e.created_at},t)};GE({},{EMOJI_SHORTCODE_REGEX:()=>PI,matchAll:()=>AI,regex:()=>MI,replaceAll:()=>OI});var LI,II,PI=/:(\w+):/,MI=()=>new RegExp(`\\B${PI.source}\\B`,"g");function*AI(e){const t=e.matchAll(MI());for(const r of t)try{const[e,t]=r;yield{shortcode:e,name:t,start:r.index,end:r.index+e.length}}catch(n){}}function OI(e,t){return e.replaceAll(MI(),(e,n)=>t({shortcode:e,name:n}))}GE({},{useFetchImplementation:()=>NI,validateGithub:()=>FI});try{LI=fetch}catch{}function NI(e){LI=e}async function FI(e,t,n){try{return await(await LI(`https://gist.github.com/${t}/${n}/raw`)).text()===`Verifying that I control the following Nostr public key: ${e}`}catch(Ite){return!1}}function DI(e){const{host:t,pathname:n,searchParams:r}=new URL(e),i=n||t,s=r.get("relay"),o=r.get("secret");if(!i||!s||!o)throw new Error("invalid connection string");return{pubkey:i,relay:s,secret:o}}async function zI(e,t,n){const r=SL(t,e,JSON.stringify({method:"pay_invoice",params:{invoice:n}}));return lR({kind:ST,created_at:Math.round(Date.now()/1e3),content:r,tags:[["p",e]]},t)}function jI(e){return e=(e=e.trim().toLowerCase()).normalize("NFKC"),Array.from(e).map(e=>/\p{Letter}/u.test(e)||/\p{Number}/u.test(e)?e:"-").join("")}GE({},{makeNwcRequestEvent:()=>zI,parseConnectionString:()=>DI}),GE({},{normalizeIdentifier:()=>jI}),GE({},{getSatoshisAmountFromBolt11:()=>WI,getZapEndpoint:()=>BI,makeZapReceipt:()=>VI,makeZapRequest:()=>$I,useFetchImplementation:()=>UI,validateZapRequest:()=>qI});try{II=fetch}catch{}function UI(e){II=e}async function BI(e){try{let t="",{lud06:n,lud16:r}=JSON.parse(e.content);if(r){let[e,n]=r.split("@");t=new URL(`/.well-known/lnurlp/${e}`,`https://${n}`).toString()}else{if(!n)return null;{let{words:e}=bk.decode(n,1e3),r=bk.fromWords(e);t=YE.decode(r)}}let i=await(await II(t)).json();if(i.allowsNostr&&i.nostrPubkey)return i.callback}catch(RD){}return null}function $I(e){let t={kind:9734,created_at:Math.round(Date.now()/1e3),content:e.comment||"",tags:[["p","pubkey"in e?e.pubkey:e.event.pubkey],["amount",e.amount.toString()],["relays",...e.relays]]};if("event"in e){if(t.tags.push(["e",e.event.id]),dR(e.event.kind)){const n=["a",`${e.event.kind}:${e.event.pubkey}:`];t.tags.push(n)}else if(fR(e.event.kind)){let n=e.event.tags.find(([e,t])=>"d"===e&&t);if(!n)throw new Error("d tag not found or is empty");const r=["a",`${e.event.kind}:${e.event.pubkey}:${n[1]}`];t.tags.push(r)}t.tags.push(["k",e.event.kind.toString()])}return t}function qI(e){let t;try{t=JSON.parse(e)}catch(RD){return"Invalid zap request JSON."}if(!ZE(t))return"Zap request is not a valid Nostr event.";if(!cR(t))return"Invalid signature on zap request.";let n=t.tags.find(([e,t])=>"p"===e&&t);if(!n)return"Zap request doesn't have a 'p' tag.";if(!n[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let r=t.tags.find(([e,t])=>"e"===e&&t);return r&&!r[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":t.tags.find(([e,t])=>"relays"===e&&t)?null:"Zap request doesn't have a 'relays' tag."}function VI({zapRequest:e,preimage:t,bolt11:n,paidAt:r}){let i=JSON.parse(e),s=i.tags.filter(([e])=>"e"===e||"p"===e||"a"===e),o={kind:9735,created_at:Math.round(r.getTime()/1e3),content:"",tags:[...s,["P",i.pubkey],["bolt11",n],["description",e]]};return t&&o.tags.push(["preimage",t]),o}function WI(e){if(e.length<50)return 0;const t=(e=e.substring(0,50)).lastIndexOf("1");if(-1===t)return 0;const n=e.substring(0,t);if(!n.startsWith("lnbc"))return 0;const r=n.substring(4);if(r.length<1)return 0;const i=r[r.length-1],s=i.charCodeAt(0)-"0".charCodeAt(0),o=s>=0&&s<=9;let a=r.length-1;if(o&&a++,a<1)return 0;const l=parseInt(r.substring(0,a));switch(i){case"m":return 1e5*l;case"u":return 100*l;case"n":return l/10;case"p":return l/1e4;default:return 1e8*l}}GE({},{Negentropy:()=>QI,NegentropyStorageVector:()=>JI,NegentropySync:()=>nP});var HI=32,GI=class{_raw;length;constructor(e){"number"==typeof e?(this._raw=new Uint8Array(e),this.length=0):e instanceof Uint8Array?(this._raw=new Uint8Array(e),this.length=e.length):(this._raw=new Uint8Array(512),this.length=0)}unwrap(){return this._raw.subarray(0,this.length)}get capacity(){return this._raw.byteLength}extend(e){if(e instanceof GI&&(e=e.unwrap()),"number"!=typeof e.length)throw Error("bad length");const t=e.length+this.length;if(this.capacity<t){const e=this._raw,n=Math.max(2*this.capacity,t);this._raw=new Uint8Array(n),this._raw.set(e)}this._raw.set(e,this.length),this.length+=e.length}shift(){const e=this._raw[0];return this._raw=this._raw.subarray(1),this.length--,e}shiftN(e=1){const t=this._raw.subarray(0,e);return this._raw=this._raw.subarray(e),this.length-=e,t}};function KI(e){let t=0;for(;;){if(0===e.length)throw Error("parse ends prematurely");let n=e.shift();if(t=t<<7|127&n,!(128&n))break}return t}function ZI(e){if(0===e)return new GI(new Uint8Array([0]));let t=[];for(;0!==e;)t.push(127&e),e>>>=7;t.reverse();for(let n=0;n<t.length-1;n++)t[n]|=128;return new GI(new Uint8Array(t))}function YI(e,t){if(e.length<t)throw Error("parse ends prematurely");return e.shiftN(t)}var XI=class{buf;constructor(){this.setToZero()}setToZero(){this.buf=new Uint8Array(HI)}add(e){let t=0,n=0,r=new DataView(this.buf.buffer),i=new DataView(e.buffer);for(let s=0;s<8;s++){let e=4*s,o=r.getUint32(e,!0);o+=t,o+=i.getUint32(e,!0),o>4294967295&&(n=1),r.setUint32(e,4294967295&o,!0),t=n,n=0}}negate(){let e=new DataView(this.buf.buffer);for(let n=0;n<8;n++){let t=4*n;e.setUint32(t,~e.getUint32(t,!0))}let t=new Uint8Array(HI);t[0]=1,this.add(t)}getFingerprint(e){let t=new GI;return t.extend(this.buf),t.extend(ZI(e)),GS(t.unwrap()).subarray(0,16)}},JI=class{items;sealed;constructor(){this.items=[],this.sealed=!1}insert(e,t){if(this.sealed)throw Error("already sealed");const n=Ak(t);if(n.byteLength!==HI)throw Error("bad id size for added item");this.items.push({timestamp:e,id:n})}seal(){if(this.sealed)throw Error("already sealed");this.sealed=!0,this.items.sort(tP);for(let e=1;e<this.items.length;e++)if(0===tP(this.items[e-1],this.items[e]))throw Error("duplicate item inserted")}unseal(){this.sealed=!1}size(){return this._checkSealed(),this.items.length}getItem(e){if(this._checkSealed(),e>=this.items.length)throw Error("out of range");return this.items[e]}iterate(e,t,n){this._checkSealed(),this._checkBounds(e,t);for(let r=e;r<t&&n(this.items[r],r);++r);}findLowerBound(e,t,n){return this._checkSealed(),this._checkBounds(e,t),this._binarySearch(this.items,e,t,e=>tP(e,n)<0)}fingerprint(e,t){let n=new XI;return n.setToZero(),this.iterate(e,t,e=>(n.add(e.id),!0)),n.getFingerprint(t-e)}_checkSealed(){if(!this.sealed)throw Error("not sealed")}_checkBounds(e,t){if(e>t||t>this.items.length)throw Error("bad range")}_binarySearch(e,t,n,r){let i=n-t;for(;i>0;){let n=t,s=Math.floor(i/2);n+=s,r(e[n])?(t=++n,i-=s+1):i=s}return t}},QI=class{storage;frameSizeLimit;lastTimestampIn;lastTimestampOut;constructor(e,t=6e4){if(t<4096)throw Error("frameSizeLimit too small");this.storage=e,this.frameSizeLimit=t,this.lastTimestampIn=0,this.lastTimestampOut=0}_bound(e,t){return{timestamp:e,id:t||new Uint8Array(0)}}initiate(){let e=new GI;return e.extend(new Uint8Array([97])),this.splitRange(0,this.storage.size(),this._bound(Number.MAX_VALUE),e),Pk(e.unwrap())}reconcile(e,t,n){const r=new GI(Ak(e));this.lastTimestampIn=this.lastTimestampOut=0;let i=new GI;i.extend(new Uint8Array([97]));let s=YI(r,1)[0];if(s<96||s>111)throw Error("invalid negentropy protocol version byte");if(97!==s)throw Error("unsupported negentropy protocol version requested: "+(s-96));let o=this.storage.size(),a=this._bound(0),l=0,c=!1;for(;0!==r.length;){let e=new GI,s=()=>{c&&(c=!1,e.extend(this.encodeBound(a)),e.extend(ZI(0)))},u=this.decodeBound(r),h=KI(r),d=l,p=this.storage.findLowerBound(l,o,u);if(0===h)c=!0;else if(1===h)0!==eP(YI(r,16),this.storage.fingerprint(d,p))?(s(),this.splitRange(d,p,u,e)):c=!0;else{if(2!==h)throw Error("unexpected mode");{let e=KI(r),i={};for(let t=0;t<e;t++){let e=YI(r,HI);i[Pk(e)]=e}if(c=!0,this.storage.iterate(d,p,e=>{let n=e.id;const r=Pk(n);return i[r]?delete i[Pk(n)]:t?.(r),!0}),n)for(let t of Object.values(i))n(Pk(t))}}if(this.exceededFrameSizeLimit(i.length+e.length)){let e=this.storage.fingerprint(p,o);i.extend(this.encodeBound(this._bound(Number.MAX_VALUE))),i.extend(ZI(1)),i.extend(e);break}i.extend(e),l=p,a=u}return 1===i.length?null:Pk(i.unwrap())}splitRange(e,t,n,r){let i=t-e;if(i<32)r.extend(this.encodeBound(n)),r.extend(ZI(2)),r.extend(ZI(i)),this.storage.iterate(e,t,e=>(r.extend(e.id),!0));else{let s=Math.floor(i/16),o=i%16,a=e;for(let e=0;e<16;e++){let i,l=s+(e<o?1:0),c=this.storage.fingerprint(a,a+l);if(a+=l,a===t)i=n;else{let e,t;this.storage.iterate(a-1,a+1,(n,r)=>(r===a-1?e=n:t=n,!0)),i=this.getMinimalBound(e,t)}r.extend(this.encodeBound(i)),r.extend(ZI(1)),r.extend(c)}}}exceededFrameSizeLimit(e){return e>this.frameSizeLimit-200}decodeTimestampIn(e){let t=KI(e);return t=0===t?Number.MAX_VALUE:t-1,this.lastTimestampIn===Number.MAX_VALUE||t===Number.MAX_VALUE?(this.lastTimestampIn=Number.MAX_VALUE,Number.MAX_VALUE):(t+=this.lastTimestampIn,this.lastTimestampIn=t,t)}decodeBound(e){let t=this.decodeTimestampIn(e),n=KI(e);if(n>HI)throw Error("bound key too long");return{timestamp:t,id:YI(e,n)}}encodeTimestampOut(e){if(e===Number.MAX_VALUE)return this.lastTimestampOut=Number.MAX_VALUE,ZI(0);let t=e;return e-=this.lastTimestampOut,this.lastTimestampOut=t,ZI(e+1)}encodeBound(e){let t=new GI;return t.extend(this.encodeTimestampOut(e.timestamp)),t.extend(ZI(e.id.length)),t.extend(e.id),t}getMinimalBound(e,t){if(t.timestamp!==e.timestamp)return this._bound(t.timestamp);{let n=0,r=t.id,i=e.id;for(let e=0;e<HI&&r[e]===i[e];e++)n++;return this._bound(t.timestamp,t.id.subarray(0,n+1))}}};function eP(e,t){for(let n=0;n<e.byteLength;n++){if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return e.byteLength>t.byteLength?1:e.byteLength<t.byteLength?-1:0}function tP(e,t){return e.timestamp===t.timestamp?eP(e.id,t.id):e.timestamp-t.timestamp}var nP=class{relay;storage;neg;filter;subscription;onhave;onneed;constructor(e,t,n,r={}){this.relay=e,this.storage=t,this.neg=new QI(t),this.onhave=r.onhave,this.onneed=r.onneed,this.filter=n,this.subscription=this.relay.prepareSubscription([{}],{label:r.label||"negentropy"}),this.subscription.oncustom=e=>{switch(e[0]){case"NEG-MSG":e.length<3&&console.warn(`got invalid NEG-MSG from ${this.relay.url}: ${e}`);try{const t=this.neg.reconcile(e[2],this.onhave,this.onneed);t?this.relay.send(`["NEG-MSG", "${this.subscription.id}", "${t}"]`):(this.close(),r.onclose?.())}catch(_6){console.error("negentropy reconcile error:",_6),r?.onclose?.(`reconcile error: ${_6}`)}break;case"NEG-CLOSE":{const t=e[2];console.warn("negentropy error:",t),r.onclose?.(t);break}case"NEG-ERR":r.onclose?.()}}}async start(){const e=this.neg.initiate();this.relay.send(`["NEG-OPEN","${this.subscription.id}",${JSON.stringify(this.filter)},"${e}"]`)}close(){this.relay.send(`["NEG-CLOSE","${this.subscription.id}"]`),this.subscription.close()}};GE({},{getToken:()=>iP,hashPayload:()=>hP,unpackEventFromToken:()=>oP,validateEvent:()=>pP,validateEventKind:()=>lP,validateEventMethodTag:()=>uP,validateEventPayloadTag:()=>dP,validateEventTimestamp:()=>aP,validateEventUrlTag:()=>cP,validateToken:()=>sP});var rP="Nostr ";async function iP(e,t,n,r=!1,i){const s={kind:RT,tags:[["u",e],["method",t]],created_at:Math.round((new Date).getTime()/1e3),content:""};i&&s.tags.push(["payload",hP(i)]);const o=await n(s);return(r?rP:"")+lk.encode(XE.encode(JSON.stringify(o)))}async function sP(e,t,n){return await pP(await oP(e).catch(e=>{throw e}),t,n).catch(e=>{throw e})}async function oP(e){if(!e)throw new Error("Missing token");e=e.replace(rP,"");const t=YE.decode(lk.decode(e));if(!t||0===t.length||!t.startsWith("{"))throw new Error("Invalid token");return JSON.parse(t)}function aP(e){return!!e.created_at&&Math.round((new Date).getTime()/1e3)-e.created_at<60}function lP(e){return e.kind===RT}function cP(e,t){const n=e.tags.find(e=>"u"===e[0]);return!!n&&n.length>0&&n[1]===t}function uP(e,t){const n=e.tags.find(e=>"method"===e[0]);return!!n&&n.length>0&&n[1].toLowerCase()===t.toLowerCase()}function hP(e){return LS(GS(XE.encode(JSON.stringify(e))))}function dP(e,t){const n=e.tags.find(e=>"payload"===e[0]);if(!n)return!1;const r=hP(t);return n.length>0&&n[1]===r}async function pP(e,t,n,r){if(!cR(e))throw new Error("Invalid nostr event, signature invalid");if(!lP(e))throw new Error("Invalid nostr event, kind invalid");if(!aP(e))throw new Error("Invalid nostr event, created_at timestamp invalid");if(!cP(e,t))throw new Error("Invalid nostr event, url tag invalid");if(!uP(e,n))throw new Error("Invalid nostr event, method tag invalid");if(Boolean(r)&&"object"==typeof r&&Object.keys(r).length>0&&!dP(e,r))throw new Error("Invalid nostr event, payload tag does not match request body hash");return!0}var fP=Symbol("verified");new TextDecoder("utf-8");var gP=new TextEncoder;function mP(e){return LS(GS(gP.encode(function(e){if(!function(e){if(!(e instanceof Object))return!1;if("number"!=typeof e.kind)return!1;if("string"!=typeof e.content)return!1;if("number"!=typeof e.created_at)return!1;if("string"!=typeof e.pubkey)return!1;if(!e.pubkey.match(/^[a-f0-9]{64}$/))return!1;if(!Array.isArray(e.tags))return!1;for(let t=0;t<e.tags.length;t++){let n=e.tags[t];if(!Array.isArray(n))return!1;for(let e=0;e<n.length;e++)if("string"!=typeof n[e])return!1}return!0}(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}(e))))}var yP=new class{generateSecretKey(){return CS.utils.randomPrivateKey()}getPublicKey(e){return LS(CS.getPublicKey(e))}finalizeEvent(e,t){const n=e;return n.pubkey=LS(CS.getPublicKey(t)),n.id=mP(n),n.sig=LS(CS.sign(mP(n),t)),n[fP]=!0,n}verifyEvent(e){if("boolean"==typeof e[fP])return e[fP];const t=mP(e);if(t!==e.id)return e[fP]=!1,!1;try{const n=CS.verify(e.sig,t,e.pubkey);return e[fP]=n,n}catch(RD){return e[fP]=!1,!1}}},vP=yP.generateSecretKey,bP=yP.getPublicKey,wP=yP.finalizeEvent,_P=yP.verifyEvent;function xP(e,t,n){if(Reflect.has(e,t))return Reflect.get(e,t);{const r=n();return Reflect.set(e,t,r),r}}function CP(e,t){const[n,r]=SP(e,e=>t.id===e.id?0:t.created_at===e.created_at?-1:e.created_at-t.created_at);return r||e.splice(n,0,t),e}function SP(e,t){let n=0,r=e.length-1;for(;n<=r;){const i=Math.floor((n+r)/2),s=t(e[i]);if(0===s)return[i,!0];s<0?r=i-1:n=i+1}return[n,!1]}new TextDecoder("utf-8"),new TextEncoder;var kP=Symbol.for("event-store"),EP=Symbol.for("event-uid"),RP=Symbol.for("replaceable-address"),TP=Symbol.for("from-cache"),LP=Symbol.for("replaceable-identifier");function IP(e){return Px(e)||Mx(e)}function PP(e){return IP(e.kind)?xP(e,RP,()=>MP(e.kind,e.pubkey,OP(e))):null}function MP(e,t,n){return e+":"+t+":"+(n??"")}function AP(e){Reflect.set(e,TP,!0)}function OP(e){return xP(e,LP,()=>e.tags.find(e=>"d"===e[0])?.[1]??"")}var NP=Symbol.for("encrypted-content"),FP={[uR.EncryptedDirectMessage]:"nip04",[uR.Seal]:"nip44",[uR.GiftWrap]:"nip44"};function DP(e,t){return FP[e]=t,e}function zP(e,t,n){const r=n??FP[e];if(!r)throw new Error(`Event kind ${e} does not support encrypted content`);const i=t[r];if(!i)throw new Error(`Signer does not support ${r} encryption`);return i}var jP=new Set([NP]);function UP(e){return e}function BP(...e){return qP(e.filter(e=>!!e),jP)}function $P(...e){return qP(e.filter(e=>!!e))}function qP(e,t){return 0===e.length?UP:async function(n){return e.reduce(async(e,n)=>{const r=await n(await e);if(t&&"object"==typeof r&&null!==r&&"object"==typeof e&&null!==e){const e=Reflect.ownKeys(r).filter(e=>"symbol"==typeof e);for(const n of e)t.has(n)||Reflect.deleteProperty(r,n)}return r},n)}}function VP(){return Math.round(Date.now()/1e3)}var WP=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&n[e]];return t};function HP(e,t){return void 0!==e[0]&&void 0!==e[1]&&(!t||e[0]===t)}function GP(e){return HP(e,"e")}function KP(e){return HP(e,"p")}function ZP(e){return HP(e,"r")}function YP(e){return HP(e,"a")}var XP=(e,...t)=>t.reduce((e,t)=>{const n=[];for(const r of e)try{const e=t(r);if(void 0===e)continue;n.push(e)}catch(_6){}return n},e),JP=new TextDecoder("utf-8"),QP=(new TextEncoder,5e3);function eM(e){let t={},n=e;for(;n.length>0;){let e=n[0],r=n[1],i=n.slice(2,2+r);if(n=n.slice(2+r),i.length<r)throw new Error(`not enough data to read on TLV ${e}`);t[e]=t[e]||[],t[e].push(i)}return t}function tM(e,t="https:"){return/^[a-zA-Z][a-zA-Z0-9+.-]+:/.test(e)?e:t+"//"+e}function nM(e){const t="string"==typeof e?new URL(tM(e,"http:")):new URL(e);return"ws:"===t.protocol?t.protocol="http:":("wss:"===t.protocol||"http:"!==t.protocol)&&(t.protocol="https:"),"string"==typeof e?t.toString():t}function rM(e){let t=new URL(e);return t.pathname=t.pathname.replace(/\/+/g,"/"),("80"!==t.port||"ws:"!==t.protocol&&"http:"!==t.protocol)&&("443"!==t.port||"wss:"!==t.protocol&&"https:"!==t.protocol)||(t.port=""),"string"==typeof e?t.toString():t}var iM=Symbol.for("seen-relays");function sM(e){return rM(function(e){const t="string"==typeof e?new URL(tM(e,"wss:")):new URL(e);return"http:"===t.protocol?t.protocol="ws:":("https:"===t.protocol||"ws:"!==t.protocol)&&(t.protocol="wss:"),"string"==typeof e?t.toString():t}(e))}function oM(e,t){let n=Reflect.get(e,iM);return n?(n.add(t),n):(n=new Set([t]),Reflect.set(e,iM,n),n)}var aM=/^wss?:\/\/([-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}|localhost)\b([-a-zA-Z0-9()@:%_\+.~#?&\/\/=]*)$/;function lM(e){return e.length>=8&&aM.test(e)}function cM(...e){const t=new Set;for(const n of e)if(n)if("string"==typeof n)try{t.add(sM(n))}catch(_6){}else if(Reflect.has(n,Symbol.iterator))for(const e of n)try{t.add(sM(e))}catch(_6){}return Array.from(t)}function uM(e){return!!e&&64===e.length&&!!e.toLowerCase().match(/^[0-9a-f]{64}$/)}function hM(e){const t=e[1];if(!t||!uM(t))return null;const n={id:t};return e[2]&&lM(e[2])&&(n.relays=[rM(e[2])]),n}function dM(e){if(!e[1])return null;const t=function(e,t=!1){const n=e.split(":"),r=n[0]?parseInt(n[0]):void 0,i=n[1];if(void 0===r)return null;if(void 0===i||""===i||!uM(i))return null;const s=n.slice(2).join(":");return t&&""===s?null:{kind:r,pubkey:i,identifier:s}}(e[1]);return t?(e[2]&&lM(e[2])&&(t.relays=[rM(e[2])]),t):null}function pM(e){const t=e[1];if(!t||!uM(t))return null;const n={pubkey:t};return e[2]&&lM(e[2])&&(n.relays=[rM(e[2])]),n}function fM(e){return"object"==typeof e&&null!==e&&"id"in e&&"string"==typeof e.id}function gM(e,t){return fM(t)?e.id===t.id&&(!t.author||e.pubkey===t.author):e.kind===t.kind&&e.pubkey===t.pubkey&&OP(e)===(t.identifier??"")}var mM=NP,yM=zP,vM=new Set([DP(uR.DraftLong,"nip04")]);function bM(e,t){return vM.add(DP(e,t)),e}function wM(e){return function(e){return void 0!==FP[e]}(e)&&vM.has(e)}function _M(e){if(wM(e.kind))return mM in e?Reflect.get(e,mM):function(e){return Reflect.get(e,NP)}(e)}function xM(e,t){if(!wM(e.kind))throw new Error("Event kind does not support hidden content");!function(e,t){Reflect.set(e,NP,t),function(e){if(!function(e){return null!=e&&64===e.id?.length&&"string"==typeof e.sig&&"string"==typeof e.pubkey&&64===e.pubkey.length&&"string"==typeof e.content&&Array.isArray(e.tags)&&"number"==typeof e.created_at&&e.created_at>0}(e))return;const t=function(e){return Reflect.get(e,kP)}(e);t&&t.update(e)}(e)}(e,t)}var CM=Symbol.for("hidden-tags"),SM=new Set([bM(uR.BookmarkList,"nip04"),bM(uR.InterestsList,"nip04"),bM(uR.Mutelist,"nip04"),bM(uR.CommunitiesList,"nip04"),bM(uR.PublicChatsList,"nip04"),bM(uR.SearchRelaysList,"nip04"),bM(10009,"nip04"),bM(uR.Bookmarksets,"nip04"),bM(uR.Relaysets,"nip04"),bM(uR.Followsets,"nip04"),bM(uR.Curationsets,"nip04"),bM(uR.Interestsets,"nip04")]);function kM(e){return wM(e)&&SM.has(e)}function EM(e){return kM(e.kind)&&function(e){return wM(e.kind)&&function(e){return e.content.length>0}(e)}(e)}function RM(e){if(!kM(e.kind))return;if(CM in e)return e[CM];const t=_M(e);if(void 0===t)return;const n=JSON.parse(t);if(!Array.isArray(n))throw new Error("Content is not an array of tags");const r=n.filter(e=>Array.isArray(e)).map(e=>e.map(e=>String(e)));return Reflect.set(e,CM,r),r}var TM=Symbol.for("public-contacts"),LM=Symbol.for("hidden-contacts"),IM=function(e,t){return IM=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},IM(e,t)};function PM(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}IM(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var MM=function(){return MM=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},MM.apply(this,arguments)};function AM(e,t){var n,r,i,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(l){a=[6,l],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}}function OM(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function NM(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(_6){i={error:_6}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}function FM(e,t,n){if(n||2===arguments.length)for(var r,i=0,s=t.length;i<s;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function DM(e){return this instanceof DM?(this.v=e,this):new DM(e)}function zM(e){return"function"==typeof e}function jM(e){var t=e(function(e){Error.call(e),e.stack=(new Error).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var UM=jM(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}});function BM(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var $M=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var o=OM(s),a=o.next();!a.done;a=o.next())a.value.remove(this)}catch(p){e={error:p}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else s.remove(this);var l=this.initialTeardown;if(zM(l))try{l()}catch(f){i=f instanceof UM?f.errors:[f]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var u=OM(c),h=u.next();!h.done;h=u.next()){var d=h.value;try{WM(d)}catch(RD){i=null!=i?i:[],RD instanceof UM?i=FM(FM([],NM(i)),NM(RD.errors)):i.push(RD)}}}catch(g){n={error:g}}finally{try{h&&!h.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}if(i)throw new UM(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)WM(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&BM(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&BM(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),qM=$M.EMPTY;function VM(e){return e instanceof $M||e&&"closed"in e&&zM(e.remove)&&zM(e.add)&&zM(e.unsubscribe)}function WM(e){zM(e)?e():e.unsubscribe()}var HM={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=HM.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,FM([e,t],NM(n))):setTimeout.apply(void 0,FM([e,t],NM(n)))},clearTimeout:function(e){var t=HM.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function GM(e){HM.setTimeout(function(){throw e})}function KM(){}var ZM=YM("C",void 0,void 0);function YM(e,t,n){return{kind:e,value:t,error:n}}function XM(e){e()}var JM=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,VM(t)&&t.add(n)):n.destination=rA,n}return PM(t,e),t.create=function(e,t,n){return new eA(e,t,n)},t.prototype.next=function(e){this.isStopped?nA(function(e){return YM("N",e,void 0)}(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?nA(function(e){return YM("E",void 0,e)}(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?nA(ZM,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}($M);Function.prototype.bind;var QM=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(_6){tA(_6)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(_6){tA(_6)}else tA(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(_6){tA(_6)}},e}(),eA=function(e){function t(t,n,r){var i,s=e.call(this)||this;return i=zM(t)||!t?{next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:t,s.destination=new QM(i),s}return PM(t,e),t}(JM);function tA(e){GM(e)}function nA(){}var rA={closed:!0,next:KM,error:function(e){throw e},complete:KM},iA="function"==typeof Symbol&&Symbol.observable||"@@observable";function sA(e){return e}var oA=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=this,s=(r=e)&&r instanceof JM||function(e){return e&&zM(e.next)&&zM(e.error)&&zM(e.complete)}(r)&&VM(r)?e:new eA(e,t,n);return XM(function(){var e=i,t=e.operator,n=e.source;s.add(t?t.call(s,n):n?i._subscribe(s):i._trySubscribe(s))}),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(RD){e.error(RD)}},e.prototype.forEach=function(e,t){var n=this;return new(t=aA(t))(function(t,r){var i=new eA({next:function(t){try{e(t)}catch(RD){r(RD),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)})},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[iA]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===(n=e).length?sA:1===n.length?n[0]:function(e){return n.reduce(function(e,t){return t(e)},e)})(this);var n},e.prototype.toPromise=function(e){var t=this;return new(e=aA(e))(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function aA(e){var t;return null!==(t=null!=e?e:void 0)&&void 0!==t?t:Promise}function lA(e){return function(t){if(function(e){return zM(null==e?void 0:e.lift)}(t))return t.lift(function(t){try{return e(t,this)}catch(RD){this.error(RD)}});throw new TypeError("Unable to lift unknown Observable type")}}function cA(e,t,n,r,i){return new uA(e,t,n,r,i)}var uA=function(e){function t(t,n,r,i,s,o){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=o,a._next=n?function(e){try{n(e)}catch(RD){t.error(RD)}}:e.prototype._next,a._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=r?function(){try{r()}catch(RD){t.error(RD)}finally{this.unsubscribe()}}:e.prototype._complete,a}return PM(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},t}(JM),hA=jM(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),dA=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return PM(t,e),t.prototype.lift=function(e){var t=new pA(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new hA},t.prototype.next=function(e){var t=this;XM(function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=OM(t.currentObservers),s=i.next();!s.done;s=i.next())s.value.next(e)}catch(o){n={error:o}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;XM(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;XM(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,s=n.observers;return r||i?qM:(this.currentObservers=null,s.push(e),new $M(function(){t.currentObservers=null,BM(s,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new oA;return e.source=this,e},t.create=function(e,t){return new pA(e,t)},t}(oA),pA=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return PM(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:qM},t}(dA),fA=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return PM(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(dA),gA={now:function(){return(gA.delegate||Date).now()},delegate:void 0},mA=function(e){function t(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=gA);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return PM(t,e),t.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,o=n._timestampProvider,a=n._windowTime;r||(i.push(t),!s&&i.push(o.now()+a)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!e.closed;i+=n?1:2)e.next(r[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,n=e._timestampProvider,r=e._buffer,i=e._infiniteTimeWindow,s=(i?1:2)*t;if(t<1/0&&s<r.length&&r.splice(0,r.length-s),!i){for(var o=n.now(),a=0,l=1;l<r.length&&r[l]<=o;l+=2)a=l;a&&r.splice(0,a+1)}},t}(dA),yA=function(e){function t(){return e.call(this)||this}return PM(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}($M),vA={setInterval:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=vA.delegate;return(null==i?void 0:i.setInterval)?i.setInterval.apply(i,FM([e,t],NM(n))):setInterval.apply(void 0,FM([e,t],NM(n)))},clearInterval:function(e){var t=vA.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},bA=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return PM(t,e),t.prototype.schedule=function(e,t){var n;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,t)),this.pending=!0,this.delay=t,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),vA.setInterval(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&vA.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e){var t,n=!1;try{this.work(e)}catch(r){n=!0,t=r||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),t},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,BM(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(yA),wA=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=gA.now,e}(),_A=function(e){function t(t,n){void 0===n&&(n=wA.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return PM(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},t}(wA),xA=new _A(bA),CA=xA,SA=new oA(function(e){return e.complete()});function kA(e){return e&&zM(e.schedule)}function EA(e){return e[e.length-1]}function RA(e){return kA(EA(e))?e.pop():void 0}function TA(e,t){return"number"==typeof EA(e)?e.pop():t}var LA=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function IA(e){return zM(null==e?void 0:e.then)}function PA(e){return zM(e[iA])}function MA(e){return Symbol.asyncIterator&&zM(null==e?void 0:e[Symbol.asyncIterator])}function AA(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var OA="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function NA(e){return zM(null==e?void 0:e[OA])}function FA(e){return function(t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=function(){var t,n,r;return AM(this,function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,DM(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,DM(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,DM(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})}.apply(t,n||[]),s=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",function(e){return function(t){return Promise.resolve(t).then(e,c)}}),r[Symbol.asyncIterator]=function(){return this},r;function o(e,t){i[e]&&(r[e]=function(t){return new Promise(function(n,r){s.push([e,t,n,r])>1||a(e,t)})},t&&(r[e]=t(r[e])))}function a(e,t){try{(n=i[e](t)).value instanceof DM?Promise.resolve(n.value.v).then(l,c):u(s[0][2],n)}catch(r){u(s[0][3],r)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}(this,arguments)}function DA(e){return zM(null==e?void 0:e.getReader)}function zA(e){if(e instanceof oA)return e;if(null!=e){if(PA(e))return r=e,new oA(function(e){var t=r[iA]();if(zM(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")});if(LA(e))return function(e){return new oA(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}(e);if(IA(e))return n=e,new oA(function(e){n.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,GM)});if(MA(e))return jA(e);if(NA(e))return t=e,new oA(function(e){var n,r;try{for(var i=OM(t),s=i.next();!s.done;s=i.next()){var o=s.value;if(e.next(o),e.closed)return}}catch(a){n={error:a}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()});if(DA(e))return jA(FA(e))}var t,n,r;throw AA(e)}function jA(e){return new oA(function(t){(function(e,t){var n,r,i,s;return function(e,t,n,r){return new(n||(n=Promise))(function(t,i){function s(e){try{a(r.next(e))}catch(t){i(t)}}function o(e){try{a(r.throw(e))}catch(t){i(t)}}function a(e){var r;e.done?t(e.value):(r=e.value,r instanceof n?r:new n(function(e){e(r)})).then(s,o)}a((r=r.apply(e,[])).next())})}(this,0,void 0,function(){var o,a;return AM(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),n=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=OM(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){!function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}(r,i,(t=e[n](t)).done,t.value)})}}}(e),l.label=1;case 1:return[4,n.next()];case 2:if((r=l.sent()).done)return[3,4];if(o=r.value,t.next(o),t.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=l.sent(),i={error:a},[3,11];case 6:return l.trys.push([6,,9,10]),r&&!r.done&&(s=n.return)?[4,s.call(n)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}function UA(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var s=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(s),!i)return s}function BA(e,t){return void 0===t&&(t=0),lA(function(n,r){n.subscribe(cA(r,function(n){return UA(r,e,function(){return r.next(n)},t)},function(){return UA(r,e,function(){return r.complete()},t)},function(n){return UA(r,e,function(){return r.error(n)},t)}))})}function $A(e,t){return void 0===t&&(t=0),lA(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function qA(e,t){if(!e)throw new Error("Iterable cannot be null");return new oA(function(n){UA(n,t,function(){var r=e[Symbol.asyncIterator]();UA(n,t,function(){r.next().then(function(e){e.done?n.complete():n.next(e.value)})},0,!0)})})}function VA(e,t){return t?function(e,t){if(null!=e){if(PA(e))return function(e,t){return zA(e).pipe($A(t),BA(t))}(e,t);if(LA(e))return function(e,t){return new oA(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}(e,t);if(IA(e))return function(e,t){return zA(e).pipe($A(t),BA(t))}(e,t);if(MA(e))return qA(e,t);if(NA(e))return function(e,t){return new oA(function(n){var r;return UA(n,t,function(){r=e[OA](),UA(n,t,function(){var e,t,i;try{t=(e=r.next()).value,i=e.done}catch(RD){return void n.error(RD)}i?n.complete():n.next(t)},0,!0)}),function(){return zM(null==r?void 0:r.return)&&r.return()}})}(e,t);if(DA(e))return function(e,t){return qA(FA(e),t)}(e,t)}throw AA(e)}(e,t):zA(e)}function WA(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return VA(e,RA(e))}function HA(e,t){var n=zM(e)?e:function(){return e},r=function(e){return e.error(n())};return new oA(t?function(e){return t.schedule(r,0,e)}:r)}function GA(e){return!!e&&(e instanceof oA||zM(e.lift)&&zM(e.subscribe))}var KA=jM(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function ZA(e,t){var n="object"==typeof t;return new Promise(function(r,i){var s,o=!1;e.subscribe({next:function(e){s=e,o=!0},error:i,complete:function(){o?r(s):n?r(t.defaultValue):i(new KA)}})})}function YA(e,t){var n="object"==typeof t;return new Promise(function(r,i){var s=new eA({next:function(e){r(e),s.unsubscribe()},error:i,complete:function(){n?r(t.defaultValue):i(new KA)}});e.subscribe(s)})}function XA(e){return e instanceof Date&&!isNaN(e)}var JA=jM(function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function QA(e,t){var n=XA(e)?{first:e}:"number"==typeof e?{each:e}:e,r=n.first,i=n.each,s=n.with,o=void 0===s?eO:s,a=n.scheduler,l=void 0===a?null!=t?t:xA:a,c=n.meta,u=void 0===c?null:c;if(null==r&&null==i)throw new TypeError("No timeout provided.");return lA(function(e,t){var n,s,a=null,c=0,h=function(e){s=UA(t,l,function(){try{n.unsubscribe(),zA(o({meta:u,lastValue:a,seen:c})).subscribe(t)}catch(RD){t.error(RD)}},e)};n=e.subscribe(cA(t,function(e){null==s||s.unsubscribe(),c++,t.next(a=e),i>0&&h(i)},void 0,void 0,function(){(null==s?void 0:s.closed)||null==s||s.unsubscribe(),a=null})),!c&&h(null!=r?"number"==typeof r?r:+r-l.now():i)})}function eO(e){throw new JA(e)}function tO(e,t){return lA(function(n,r){var i=0;n.subscribe(cA(r,function(n){r.next(e.call(t,n,i++))}))})}var nO=Array.isArray,rO=Array.isArray,iO=Object.getPrototypeOf,sO=Object.prototype,oO=Object.keys;function aO(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=RA(e),r=function(e){return zM(EA(e))?e.pop():void 0}(e),i=function(e){if(1===e.length){var t=e[0];if(rO(t))return{args:t,keys:null};if((r=t)&&"object"==typeof r&&iO(r)===sO){var n=oO(t);return{args:n.map(function(e){return t[e]}),keys:n}}}var r;return{args:e,keys:null}}(e),s=i.args,o=i.keys;if(0===s.length)return VA([],n);var a=new oA(function(e,t,n){return void 0===n&&(n=sA),function(r){lO(t,function(){for(var i=e.length,s=new Array(i),o=i,a=i,l=function(i){lO(t,function(){var l=VA(e[i],t),c=!1;l.subscribe(cA(r,function(e){s[i]=e,c||(c=!0,a--),a||r.next(n(s.slice()))},function(){--o||r.complete()}))},r)},c=0;c<i;c++)l(c)},r)}}(s,n,o?function(e){return function(e,t){return e.reduce(function(e,n,r){return e[n]=t[r],e},{})}(o,e)}:sA));return r?a.pipe(function(e){return tO(function(t){return function(e,t){return nO(t)?e.apply(void 0,FM([],NM(t))):e(t)}(e,t)})}(r)):a}function lO(e,t,n){e?UA(n,e,t):t()}function cO(e,t,n){return void 0===n&&(n=1/0),zM(t)?cO(function(n,r){return tO(function(e,i){return t(n,e,r,i)})(zA(e(n,r)))},n):("number"==typeof t&&(n=t),lA(function(t,r){return function(e,t,n,r){var i=[],s=0,o=0,a=!1,l=function(){!a||i.length||s||t.complete()},c=function(e){s++;var a=!1;zA(n(e,o++)).subscribe(cA(t,function(e){t.next(e)},function(){a=!0},void 0,function(){if(a)try{s--;for(var e=function(){var e=i.shift();c(e)};i.length&&s<r;)e();l()}catch(RD){t.error(RD)}}))};return e.subscribe(cA(t,function(e){return s<r?c(e):i.push(e)},function(){a=!0,l()})),function(){}}(t,r,e,n)}))}function uO(e){return void 0===e&&(e=1/0),cO(sA,e)}function hO(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return uO(1)(VA(e,RA(e)))}function dO(e){return new oA(function(t){zA(e()).subscribe(t)})}function pO(e,t,n){void 0===e&&(e=0),void 0===n&&(n=CA);var r=-1;return null!=t&&(kA(t)?n=t:r=t),new oA(function(t){var i=XA(e)?+e-n.now():e;i<0&&(i=0);var s=0;return n.schedule(function(){t.closed||(t.next(s++),0<=r?this.schedule(void 0,r):t.complete())},i)})}function fO(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=RA(e),r=TA(e,1/0),i=e;return i.length?1===i.length?zA(i[0]):uO(r)(VA(i,n)):SA}var gO=new oA(KM),mO=Array.isArray;function yO(e){return 1===e.length&&mO(e[0])?e[0]:e}function vO(e,t){return lA(function(n,r){var i=0;n.subscribe(cA(r,function(n){return e.call(t,n,i++)&&r.next(n)}))})}function bO(e){for(var t,n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var s=null!==(t=RA(r))&&void 0!==t?t:xA,o=null!==(n=r[0])&&void 0!==n?n:null,a=r[1]||1/0;return lA(function(t,n){var r=[],i=!1,l=function(e){var t=e.buffer;e.subs.unsubscribe(),BM(r,e),n.next(t),i&&c()},c=function(){if(r){var t=new $M;n.add(t);var i={buffer:[],subs:t};r.push(i),UA(t,s,function(){return l(i)},e)}};null!==o&&o>=0?UA(n,s,c,o,!0):i=!0,c();var u=cA(n,function(e){var t,n,i=r.slice();try{for(var s=OM(i),o=s.next();!o.done;o=s.next()){var c=o.value,u=c.buffer;u.push(e),a<=u.length&&l(c)}}catch(h){t={error:h}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}},function(){for(;null==r?void 0:r.length;)n.next(r.shift().buffer);null==u||u.unsubscribe(),n.complete(),n.unsubscribe()},void 0,function(){return r=null});t.subscribe(u)})}function wO(e){return lA(function(t,n){var r,i=null,s=!1;i=t.subscribe(cA(n,void 0,void 0,function(o){r=zA(e(o,wO(e)(t))),i?(i.unsubscribe(),i=null,r.subscribe(n)):s=!0})),s&&(i.unsubscribe(),i=null,r.subscribe(n))})}function _O(e,t,n,r,i){return function(s,o){var a=n,l=t,c=0;s.subscribe(cA(o,function(t){var n=c++;l=a?e(l,t,n):(a=!0,t),r&&o.next(l)},i&&function(){a&&o.next(l),o.complete()}))}}var xO=function(e,t){return e.push(t),e},CO={connector:function(){return new dA}};function SO(e,t){void 0===t&&(t=CO);var n=t.connector;return lA(function(t,r){var i,s=n();zA(e((i=s,new oA(function(e){return i.subscribe(e)})))).subscribe(r),r.add(t.subscribe(s))})}function kO(e){return e<=0?function(){return SA}:lA(function(t,n){var r=0;t.subscribe(cA(n,function(t){++r<=e&&(n.next(t),e<=r&&n.complete())}))})}function EO(){return lA(function(e,t){e.subscribe(cA(t,KM))})}function RO(e,t){return void 0===t&&(t=sA),e=null!=e?e:TO,lA(function(n,r){var i,s=!0;n.subscribe(cA(r,function(n){var o=t(n);!s&&e(i,o)||(s=!1,i=o,r.next(n))}))})}function TO(e,t){return e===t}function LO(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return hO(t,WA.apply(void 0,FM([],NM(e))))}}function IO(e){return lA(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}function PO(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=RA(e),r=TA(e,1/0);return lA(function(t,i){uO(r)(VA(FM([t],NM(e)),n)).subscribe(i)})}function MO(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return PO.apply(void 0,FM([],NM(e)))}function AO(e){var t,n,r=1/0;return null!=e&&("object"==typeof e?(t=e.count,r=void 0===t?1/0:t,n=e.delay):r=e),r<=0?function(){return SA}:lA(function(e,t){var i,s=0,o=function(){if(null==i||i.unsubscribe(),i=null,null!=n){var e="number"==typeof n?pO(n):zA(n(s)),r=cA(t,function(){r.unsubscribe(),a()});e.subscribe(r)}else a()},a=function(){var n=!1;i=e.subscribe(cA(t,void 0,function(){++s<r?i?o():n=!0:t.complete()})),n&&o()};a()})}function OO(e){var t;void 0===e&&(e=1/0);var n=(t=e&&"object"==typeof e?e:{count:e}).count,r=void 0===n?1/0:n,i=t.delay,s=t.resetOnSuccess,o=void 0!==s&&s;return r<=0?sA:lA(function(e,t){var n,s=0,a=function(){var l=!1;n=e.subscribe(cA(t,function(e){o&&(s=0),t.next(e)},void 0,function(e){if(s++<r){var o=function(){n?(n.unsubscribe(),n=null,a()):l=!0};if(null!=i){var c="number"==typeof i?pO(i):zA(i(e,s)),u=cA(t,function(){u.unsubscribe(),o()},function(){t.complete()});c.subscribe(u)}else o()}else t.error(e)})),l&&(n.unsubscribe(),n=null,a())};a()})}function NO(e,t){return lA(_O(e,t,arguments.length>=2,!0))}function FO(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new dA}:t,r=e.resetOnError,i=void 0===r||r,s=e.resetOnComplete,o=void 0===s||s,a=e.resetOnRefCountZero,l=void 0===a||a;return function(e){var t,r,s,a=0,c=!1,u=!1,h=function(){null==r||r.unsubscribe(),r=void 0},d=function(){h(),t=s=void 0,c=u=!1},p=function(){var e=t;d(),null==e||e.unsubscribe()};return lA(function(e,f){a++,u||c||h();var g=s=null!=s?s:n();f.add(function(){0!==--a||u||c||(r=DO(p,l))}),g.subscribe(f),!t&&a>0&&(t=new eA({next:function(e){return g.next(e)},error:function(e){u=!0,h(),r=DO(d,i,e),g.error(e)},complete:function(){c=!0,h(),r=DO(d,o),g.complete()}}),zA(e).subscribe(t))})(e)}}function DO(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==t){if(!1!==t){var i=new eA({next:function(){i.unsubscribe(),e()}});return zA(t.apply(void 0,FM([],NM(n)))).subscribe(i)}}else e()}function zO(e,t,n){var r,i,s,o,a=!1;return e&&"object"==typeof e?(r=e.bufferSize,o=void 0===r?1/0:r,i=e.windowTime,t=void 0===i?1/0:i,a=void 0!==(s=e.refCount)&&s,n=e.scheduler):o=null!=e?e:1/0,FO({connector:function(){return new mA(o,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:a})}function jO(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=RA(e);return lA(function(t,r){(n?hO(e,t,n):hO(e,t)).subscribe(r)})}function UO(e,t){return lA(function(n,r){var i=null,s=0,o=!1,a=function(){return o&&!i&&r.complete()};n.subscribe(cA(r,function(n){null==i||i.unsubscribe();var o=0,l=s++;zA(e(n,l)).subscribe(i=cA(r,function(e){return r.next(t?t(n,e,l,o++):e)},function(){i=null,a()}))},function(){o=!0,a()}))})}function BO(e){return lA(function(t,n){zA(e).subscribe(cA(n,function(){return n.complete()},KM)),!n.closed&&t.subscribe(n)})}function $O(e,t){return void 0===t&&(t=!1),lA(function(n,r){var i=0;n.subscribe(cA(r,function(n){var s=e(n,i++);(s||t)&&r.next(n),!s&&r.complete()}))})}function qO(e,t,n){var r=zM(e)||t||n?{next:e,error:t,complete:n}:e;return r?lA(function(e,t){var n;null===(n=r.subscribe)||void 0===n||n.call(r);var i=!0;e.subscribe(cA(t,function(e){var n;null===(n=r.next)||void 0===n||n.call(r,e),t.next(e)},function(){var e;i=!1,null===(e=r.complete)||void 0===e||e.call(r),t.complete()},function(e){var n;i=!1,null===(n=r.error)||void 0===n||n.call(r,e),t.error(e)},function(){var e,t;i&&(null===(e=r.unsubscribe)||void 0===e||e.call(r)),null===(t=r.finalize)||void 0===t||t.call(r)}))}):sA}var VO=o((e,t)=>{var n=1e3,r=60*n,i=60*r,s=24*i,o=7*s;function a(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}t.exports=function(e,t){t=t||{};var l,c,u=typeof e;if("string"===u&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var a=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return a*o;case"days":case"day":case"d":return a*s;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(e);if("number"===u&&isFinite(e))return t.long?(l=e,(c=Math.abs(l))>=s?a(l,c,s,"day"):c>=i?a(l,c,i,"hour"):c>=r?a(l,c,r,"minute"):c>=n?a(l,c,n,"second"):l+" ms"):function(e){var t=Math.abs(e);return t>=s?Math.round(e/s)+"d":t>=i?Math.round(e/i)+"h":t>=r?Math.round(e/r)+"m":t>=n?Math.round(e/n)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}}),WO=o((e,t)=>{t.exports=function(e){function t(e){let r,i,s,o=null;function a(...e){if(!a.enabled)return;const n=a,i=Number(new Date);n.diff=i-(r||i),n.prev=r,n.curr=i,r=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,i)=>{if("%%"===r)return"%";s++;const o=t.formatters[i];if("function"==typeof o){const t=e[s];r=o.call(n,t),e.splice(s,1),s--}return r}),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(i!==t.namespaces&&(i=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e,t){let n=0,r=0,i=-1,s=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||"*"===t[r]))"*"===t[r]?(i=r,s=n,r++):(n++,r++);else{if(-1===i)return!1;r=i+1,s++,n=s}for(;r<t.length&&"*"===t[r];)r++;return r===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const r of n)"-"===r[0]?t.skips.push(r.slice(1)):t.names.push(r)},t.enabled=function(e){for(const n of t.skips)if(r(e,n))return!1;for(const n of t.names)if(r(e,n))return!0;return!1},t.humanize=VO(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(n=>{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}}),HO=o((e,t)=>{e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))}),e.splice(i,0,n)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(_6){}},e.load=function(){let t;try{t=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch(_6){}return!t&&"undefined"!=typeof process&&"env"in process&&(t={}.DEBUG),t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(_6){}}(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=WO()(e);var{formatters:n}=t.exports;n.j=function(e){try{return JSON.stringify(e)}catch(_6){return"[UnexpectedJSONParseError]: "+_6.message}}}),GO=l(HO(),1),KO=(0,GO.default)("applesauce"),ZO=KO.extend("event-cache"),YO=Symbol("expiration-timestamp");function XO(e){return xP(e,YO,()=>{const t=e.tags.find(e=>"expiration"===e[0])?.[1];return t?parseInt(t):void 0})}var JO=o((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!==i--;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(s=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!==i--;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;0!==i--;){var o=s[i];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}}),QO=l(JO(),1),eN="abcdefghijklmnopqrstuvwxyz",tN=new Set((eN+eN.toUpperCase()).split("")),nN=Symbol.for("indexable-tags");function rN(e){let t=Reflect.get(e,nN);if(!t){const n=new Set;for(const t of e.tags)t.length>=2&&1===t[0].length&&tN.has(t[0])&&n.add(t[0]+":"+t[1]);t=n,Reflect.set(e,nN,n)}return t}function iN(e,t){if(e.ids&&-1===e.ids.indexOf(t.id))return!1;if(e.kinds&&-1===e.kinds.indexOf(t.kind))return!1;if(e.authors&&-1===e.authors.indexOf(t.pubkey))return!1;if(e.since&&t.created_at<e.since)return!1;if(e.until&&t.created_at>e.until)return!1;for(let n in e)if("&"===n[0]){let r=n.slice(1),i=e[n];if(i&&i.length>0){const e=rN(t);for(const t of i)if(!e.has(r+":"+t))return!1}}for(let n in e)if("#"===n[0]){let r=n.slice(1),i=e[n];if(i){const n=e[`&${r}`],s=n?i.filter(e=>!n.includes(e)):i;if(0===s.length)continue;const o=rN(t);if(!1===s.some(e=>o.has(r+":"+e)))return!1}}return!0}function sN(e,t){for(let n=0;n<e.length;n++)if(iN(e[n],t))return!0;return!1}function oN(e,t){return(0,QO.default)(e,t)}var aN=class{first=null;items=Object.create(null);last=null;max;resetTtl;size;ttl;constructor(e=0,t=0,n=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=n,this.size=0,this.ttl=t}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){const t=this.items[e];delete this.items[e],this.size--,null!==t.prev&&(t.prev.next=t.next),null!==t.next&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),this.last===t&&(this.last=t.prev)}return this}entries(e=this.keys()){return e.map(e=>[e,this.get(e)])}evict(e=!1){if(e||this.size>0){const e=this.first;delete this.items[e.key],0===--this.size?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(e){let t;return this.has(e)&&(t=this.items[e].expiry),t}get(e){let t;if(this.has(e)){const n=this.items[e];this.ttl>0&&n.expiry<=Date.now()?this.delete(e):(t=n.value,this.set(e,t,!0))}return t}has(e){return e in this.items}keys(){const e=[];let t=this.first;for(;null!==t;)e.push(t.key),t=t.next;return e}set(e,t,n=!1,r=this.resetTtl){let i;if(n||this.has(e)){if(i=this.items[e],i.value=t,!1===n&&r&&(i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==i){const e=this.last,t=i.next,n=i.prev;this.first===i&&(this.first=i.next),i.next=null,i.prev=this.last,e.next=i,null!==n&&(n.next=t),null!==t&&(t.prev=n)}}else this.max>0&&this.size===this.max&&this.evict(!0),i=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t},1===++this.size?this.first=i:this.last.next=i;return this.last=i,this}values(e=this.keys()){return e.map(e=>this.get(e))}},lN=Symbol.for("mailboxes-inboxes"),cN=Symbol.for("mailboxes-outboxes");function uN(e){return xP(e,lN,()=>{const t=[];for(const n of e.tags)if(ZP(n))try{const[,e,r]=n;!e||!lM(e)||t.includes(e)||"read"!==r&&void 0!==r||t.push(rM(e))}catch{}return t})}function hN(e){return xP(e,cN,()=>{const t=[];for(const n of e.tags)if(ZP(n))try{const[e,r,i]=n;"r"!==e||!lM(r)||t.includes(r)||"write"!==i&&void 0!==i||t.push(rM(r))}catch{}return t})}var dN=Symbol.for("profile-content");function pN(e){return xP(e,dN,()=>{const t=function(e){try{return JSON.parse(e)}catch(_6){return}}(e.content);if(t)return t.nip05&&"string"!=typeof t.nip05&&(t.nip05=String(t.nip05)),t.website&&t.website?.length>0&&!1===t.website?.startsWith("http")&&(t.website="https://"+t.website),t})}function fN(e){return!(!e||e.kind!==uR.Metadata&&e.kind!==uR.Handlerinformation||!pN(e))}function gN(e,t){return Object.fromEntries(Array.from(Object.entries(e)).map(([e,n])=>[e,{authors:n.map(e=>e.pubkey),...t}]))}function mN(e,t=!0){return n=>function(e,t,n=!0){const r=e.find(e=>e[0]===t[0]);return r?n?e.map(e=>e===r?t:e):e:[...e,t]}(n,e,t)}function yN(e,t=!0){return vN(mN(e,t))}function vN(...e){return async t=>({...t,tags:await $P(...e)(Array.from(t.tags))})}function bN(e,...t){return 0===(t=t.filter(e=>!!e)).length?e=>e:async n=>{if(!e)throw new Error("Missing signer for hidden tags");if(!kM(n.kind))throw new Error("Event kind does not support hidden tags");let r,i;if(EM(n)?(i=RM(n),void 0===i&&(EM(n)?(r=await e.getPublicKey(),i=await async function(e,t,n){if(!kM(e.kind))throw new Error("Event kind does not support hidden tags");if(function(e){if(!kM(e.kind))return!1;try{return CM in e||function(e){return!!wM(e.kind)&&function(e){return!0===Reflect.has(e,NP)}(e)&&!0===Reflect.has(e,mM)}(e)&&void 0!==RM(e)}catch{}return!1}(e))return e[CM];await async function(e,t,n){if(!wM(e.kind))throw new Error("Event kind does not support hidden content");if(mM in e)return Reflect.get(e,mM);const r=await zP(e.kind,t,n).decrypt(e.pubkey,e.content);return xM(e,r),r}(e,t,n);const r=RM(e);if(void 0===r)throw new Error("Failed to unlock hidden tags");return function(e,t){if(!kM(e.kind))throw new Error("Event kind does not support hidden tags");Reflect.set(e,CM,t),xM(e,JSON.stringify(t))}(e,r),r}({...n,pubkey:r},e)):i=[])):i=[],void 0===i)throw new Error("Failed to find hidden tags");const s=await $P(...t)(i),o=function(e,t){return yM(e,t)}(n.kind,e);r||(r=await e.getPublicKey());const a=JSON.stringify(s),l=await o.encrypt(r,a);return{...n,content:l,[NP]:a}}}function wN(e){return yN(["alt",e])}function _N(e){return yN(["expiration",e.toString()],!0)}function xN(e=!0){return vN(e?mN(["-"]):e=>e.filter(e=>!("-"===e[0])))}function CN(e){return async t=>{if(!e)throw new Error("Missing signer");Reflect.deleteProperty(t,"id"),Reflect.deleteProperty(t,"sig");const n=await e.getPublicKey(),r={...t,pubkey:n};return Reflect.has(t,NP)&&Reflect.set(r,NP,Reflect.get(t,NP)),r}}var SN=class e extends Promise{static fromKind(t){return new e(e=>e({kind:t,created_at:VP(),tags:[],content:""}))}static fromEvent(t){return new e(e=>e(function(e){return{kind:e.kind,created_at:VP(),tags:Array.from(e.tags),content:e.content}}(t)))}_signerRef={};get signer(){return this._signerRef.signer}set signer(e){this._signerRef.signer=e}chain(e){const t=new(0,this.constructor)(t=>t(this.then(async t=>{const n=await e(t);for(const e of Reflect.ownKeys(n))"symbol"!=typeof e||jP.has(e)||Reflect.deleteProperty(n,e);return n})));return t._signerRef=this._signerRef,t}as(e){return this._signerRef.signer=e,this}strip(){return new e(e=>e(this.then(e=>({content:e.content,tags:e.tags,created_at:e.created_at,kind:e.kind}))))}stamp(t=this.signer){return new e((e,n)=>{if(!t)return n(new Error("Signer required for stamping"));e(this.then(e=>CN(t)(e)))})}async sign(e=this.signer){if(!e)throw new Error("Missing signer");this.signer||(this.signer=e);const t=await(this),n=await function(e){return async t=>{if(!e)throw new Error("Missing signer");const n=await CN(e)(t),r=await e.signEvent(n);if(Reflect.has(t,"pubkey")&&Reflect.get(t,"pubkey")!==r.pubkey)throw new Error("Signer modified pubkey");if(!Ax(r,t.kind))throw new Error("Signer modified event kind");return Reflect.has(t,NP)&&Reflect.set(r,NP,Reflect.get(t,NP)),r}}(e)(t);if(Reflect.has(t,"pubkey")&&Reflect.get(t,"pubkey")!==n.pubkey)throw new Error("Signer modified pubkey");if(Ax(n,t.kind))return n;throw new Error("Signer modified event kind")}kind(t){return new e(e=>({...e,kind:t}))}content(e){return this.chain(t=>({...t,content:e}))}created(e=VP()){return e instanceof Date&&(e=Math.floor(e.getTime()/1e3)),this.chain(t=>({...t,created_at:e}))}meta(e){return this.chain(function(e){return BP(e?.protected?xN(!0):e=>e,e?.expiration?_N(e.expiration):e=>e,e?.alt?wN(e.alt):e=>e)}(e))}alt(e){return this.chain(wN(e))}expiration(e){return this.chain(_N(e))}contentWarning(e){return this.chain(function(e){return t=>{let n=Array.from(t.tags);return n=n.filter(e=>"content-warning"!==e[0]),"string"==typeof e?n.push(["content-warning",e]):!0===e&&n.push(["content-warning"]),{...t,tags:n}}}(e))}protected(e){return this.chain(xN(e))}modifyTags(...e){let t;return t=this.chain(n=>function(e,t){let n=[],r=[];return void 0===e?n=r=[]:Array.isArray(e)?n=e:"function"==typeof e?n=[e]:("function"==typeof e.public?n=[e.public]:e.public&&(n=e.public),"function"==typeof e.hidden?r=[e.hidden]:e.hidden&&(r=e.hidden)),BP(n.length>0?vN(...n):void 0,r.length>0?bN(t,...r):void 0)}(e[0],t.signer)(n)),t}modifyPublicTags(...e){return this.chain(vN(...e))}modifyHiddenTags(...e){let t;return t=this.chain(n=>bN(t.signer,...e)(n)),t}encryptedContent(e,t,n){let r;return r=this.chain(i=>{const s=r.signer;if(!s)throw new Error("Signer required for encrypted content");return function(e,t,n,r){return async i=>{if(!n)throw new Error("Signer required for encrypted content");const s=await zP(i.kind,n,r).encrypt(e,t);return{...i,content:s,[NP]:t}}}(e,t,s,n)(i)}),r}},kN=o((e,t)=>{function n(e,t){var n,r;if(0===t.length)return e;for(n=0,r=t.length;n<r;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return e<0?-2*e:e}function r(e,t,i,s){var o,a=n(n(n(e,i),(o=t,Object.prototype.toString.call(o))),typeof t);if(null===t)return n(a,"null");if(void 0===t)return n(a,"undefined");if("object"==typeof t||"function"==typeof t){if(-1!==s.indexOf(t))return n(a,"[Circular]"+i);s.push(t);var l=function(e,t,n){return Object.keys(t).sort().reduce(function(e,i){return r(e,t[i],i,n)},e)}(a,t,s);if(!("valueOf"in t)||"function"!=typeof t.valueOf)return l;try{return n(l,String(t.valueOf()))}catch(RD){return n(l,"[valueOf exception]"+(RD.stack||RD.message))}}return n(a,t.toString())}t.exports=function(e){return function(e){for(;e.length<8;)e="0"+e;return e}(r(0,e,"",[]).toString(16))}}),EN=l(kN(),1),RN=class{deleted$;deletedSubject=new dA;deletedIds=new Map;deletedIdentifiers=new Map;constructor(){this.deleted$=this.deletedSubject.asObservable()}add(e){if(e.kind!==uR.EventDeletion)return[];const t=e.pubkey,n=[],r=function(e){return e.tags.filter(GP).map(hM).filter(e=>null!==e).map(t=>(t.author=e.pubkey,t))}(e);if(r.length>0){let i=this.deletedIds.get(t);i||(i=new Set,this.deletedIds.set(t,i));for(const t of r){i.add(t.id);const r={pointer:t,until:e.created_at};n.push(r),this.deletedSubject.next(r)}}const i=function(e){return e.tags.filter(YP).map(dM).filter(e=>null!==e).filter(t=>t.pubkey===e.pubkey)}(e);if(i.length>0){let r=this.deletedIdentifiers.get(t);r||(r=new Map,this.deletedIdentifiers.set(t,r));for(const t of i){const i=t.kind+"|"+t.identifier;r.set(i,e.created_at);const s={pointer:t,until:e.created_at};n.push(s),this.deletedSubject.next(s)}}return n}check(e){const t=e.pubkey;if(Px(e.kind)||Mx(e.kind)){const n=this.deletedIdentifiers.get(t);if(!n)return!1;const r=OP(e),i=e.kind+"|"+r,s=n.get(i);return void 0!==s&&s>=e.created_at}{const n=this.deletedIds.get(t);return!!n&&n.has(e.id)}}filter(e){return e.filter(e=>!1===this.check(e))}},TN=class{log=KO.extend("EventMemory");kinds=new Map;authors=new Map;tags=new aN;created_at=[];kindAuthor=new Map;events=new aN;replaceable=new Map;get size(){return this.events.size}hasEvent(e){return this.events.has(e)}getEvent(e){return this.events.get(e)}hasReplaceable(e,t,n){const r=this.replaceable.get(MP(e,t,n));return!!r&&r.length>0}getReplaceable(e,t,n){const r=MP(e,t,n);return this.replaceable.get(r)?.[0]}getReplaceableHistory(e,t,n){const r=MP(e,t,n);return this.replaceable.get(r)}getByFilters(e){return Array.from(this.getEventsForFilters(Array.isArray(e)?e:[e]))}getTimeline(e){const t=[],n=this.getByFilters(e);for(const r of n)CP(t,r);return t}add(e){const t=e.id,n=this.events.get(t);if(n)return n;this.events.set(t,e),this.getKindIndex(e.kind).add(e),this.getAuthorsIndex(e.pubkey).add(e),this.getKindAuthorIndex(e.kind,e.pubkey).add(e);for(const r of rN(e))this.tags.has(r)&&this.getTagIndex(r).add(e);if(CP(this.created_at,e),IP(e.kind)){const t=e.tags.find(e=>"d"===e[0])?.[1],n=MP(e.kind,e.pubkey,t);let r=this.replaceable.get(n);this.replaceable.has(n)||(r=[],this.replaceable.set(n,r)),CP(r,e)}return e}remove(e){let t="string"==typeof e?this.events.get(e):e;if(!t)return!1;const n=t.id;if(!this.events.has(n))return!1;const r=this.authors.get(t.pubkey);r&&(r.delete(t),0===r.size&&this.authors.delete(t.pubkey));const i=this.kinds.get(t.kind);i&&(i.delete(t),0===i.size&&this.kinds.delete(t.kind));const s=`${t.kind}:${t.pubkey}`,o=this.kindAuthor.get(s);o&&(o.delete(t),0===o.size&&this.kindAuthor.delete(s));for(const a of rN(t))if(this.tags.has(a)){const e=this.getTagIndex(a);e.delete(t),0===e.size&&this.tags.delete(a)}if(this.removeFromSortedArray(this.created_at,t),this.events.delete(n),IP(t.kind)){const e=t.tags.find(e=>"d"===e[0])?.[1],n=MP(t.kind,t.pubkey,e),r=this.replaceable.get(n);r&&(this.removeFromSortedArray(r,t),0===r.length&&this.replaceable.delete(n))}return this.claims.delete(t),!0}removeByFilters(e){const t=this.getByFilters(e);let n=0;for(const r of t)this.remove(r)&&n++;return n}update(e){}claims=new WeakMap;touch(e){this.events.has(e.id)&&this.events.set(e.id,e)}claim(e){const t=this.claims.get(e)||0;this.claims.set(e,t+1),this.touch(e)}isClaimed(e){const t=this.claims.get(e);return void 0!==t&&t>0}removeClaim(e){const t=this.claims.get(e);if(void 0!==t&&t>0){const n=t-1;0===n?this.claims.delete(e):this.claims.set(e,n)}}clearClaim(e){this.claims.delete(e)}*unclaimed(){let e=this.events.first;for(;e;){const t=e.value;this.isClaimed(t)||(yield t),e=e.next}return 0}prune(e){let t=0;const n=this.unclaimed();for(const r of n)if(this.remove(r),t++,e&&t>=e)break;return t}getKindIndex(e){return this.kinds.has(e)||this.kinds.set(e,new Set),this.kinds.get(e)}getAuthorsIndex(e){return this.authors.has(e)||this.authors.set(e,new Set),this.authors.get(e)}getKindAuthorIndex(e,t){const n=`${e}:${t}`;return this.kindAuthor.has(n)||this.kindAuthor.set(n,new Set),this.kindAuthor.get(n)}getTagIndex(e){if(!this.tags.has(e)){const t=new Set,n=Date.now();for(const i of this.events.values())rN(i).has(e)&&t.add(i);const r=Date.now()-n;r>100&&this.log(`Built index ${e} took ${r}ms`),this.tags.set(e,t)}return this.tags.get(e)}removeFromSortedArray(e,t){if(0===e.length)return;const n=SP(e,e=>e.created_at-t.created_at);if(n){let r=n[0],i=!1;if(e[r]===t)return void e.splice(r,1);for(let n=r-1;n>=0&&e[n].created_at===t.created_at;n--)if(e[n]===t){e.splice(n,1),i=!0;break}if(i)return;for(let n=r+1;n<e.length&&e[n].created_at===t.created_at;n++)if(e[n]===t)return void e.splice(n,1)}const r=e.indexOf(t);-1!==r&&e.splice(r,1)}*iterateAuthors(e){for(const t of e){const e=this.authors.get(t);if(e)for(const t of e)yield t}}*iterateTag(e,t){for(const n of t){const t=this.getTagIndex(e+":"+n);if(t)for(const e of t)yield e}}*iterateKinds(e){for(const t of e){const e=this.kinds.get(t);if(e)for(const t of e)yield t}}*iterateTime(e,t){if(0===this.created_at.length)return;let n=0,r=this.created_at.length-1,i=t?SP(this.created_at,e=>e.created_at-t):void 0;i&&(n=Math.max(0,Math.min(i[0],this.created_at.length-1)));const s=e?SP(this.created_at,t=>t.created_at-e):void 0;if(s&&(r=Math.max(0,Math.min(s[0],this.created_at.length-1))),!(n>r))for(let o=n;o<=r;o++){const n=this.created_at[o];if(!(void 0!==t&&n.created_at>t)){if(void 0!==e&&n.created_at<e)break;yield n}}}*iterateIds(e){for(const t of e)this.events.has(t)&&(yield this.events.get(t))}getEventsForFilter(e){if(e.search)return new Set;let t=!0,n=new Set;const r=e=>{const r=e instanceof Set?e:new Set(e);if(t)n=r,t=!1;else for(const t of n)r.has(t)||n.delete(t);return n};e.ids&&r(this.iterateIds(e.ids));let i=null;void 0!==e.since&&(i=Array.from(this.iterateTime(e.since,e.until)),r(i));for(const s of tN){const t=e[`&${s}`];if(t?.length)for(const e of t)r(this.iterateTag(s,[e]))}for(const s of tN){const t=e[`#${s}`];if(t?.length){const n=e[`&${s}`],i=n?t.filter(e=>!n.includes(e)):t;i.length>0&&r(this.iterateTag(s,i))}}if(e.authors&&e.kinds&&e.authors.length*e.kinds.length<=20){const t=new Set;for(const n of e.kinds)for(const r of e.authors){const e=`${n}:${r}`,i=this.kindAuthor.get(e);if(i)for(const n of i)t.add(n)}r(t)}else e.authors&&r(this.iterateAuthors(e.authors)),e.kinds&&r(this.iterateKinds(e.kinds));if(void 0===e.since&&void 0!==e.until&&(i=Array.from(this.iterateTime(e.since,e.until)),r(i)),t)return new Set(this.events.values());if(e.limit&&i){const t=new Set;for(const r of i){if(t.size>=e.limit)break;n.has(r)&&t.add(r)}return t}return n}getEventsForFilters(e){if(0===e.length)return new Set;let t=new Set;for(const n of e){const e=this.getEventsForFilter(n);for(const n of e)t.add(n)}return t}reset(){this.events.clear(),this.kinds.clear(),this.authors.clear(),this.kindAuthor.clear(),this.tags.clear(),this.created_at=[],this.replaceable.clear(),this.claims=new WeakMap}};function LN(e){return t=>{const n=new Set;return t.pipe(qO(t=>{if(void 0!==t)if(Array.isArray(t))for(const r of t)n.has(r)||(n.add(r),e.claim(r));else n.has(t)||(n.add(t),e.claim(t))}),IO(()=>{for(const t of n)e.removeClaim(t)}))}}function IN(e){return t=>{let n;return t.pipe(qO(t=>{n!==t&&(n&&e.removeClaim(n),t&&e.claim(t),n=t)}),IO(()=>{n&&e.removeClaim(n)}))}}function PN(e,t){return UO(n=>n?WA(n):e.eventLoader?VA(e.eventLoader(t)).pipe(jO(void 0)):WA(n))}function MN(e){return"string"==typeof e&&(e={id:e}),t=>fO(dO(()=>function(e,t){const n=e.getEvent(t.id);return n instanceof Promise?VA(n):WA(n)}(t,e)).pipe(t.eventLoader?PN(t,e):sA),t.insert$.pipe(vO(t=>t.id===e.id)),t.remove$.pipe(vO(t=>t.id===e.id),kO(1),tO(()=>{}))).pipe(RO((e,t)=>e?.id===t?.id),IN(t))}function AN(e){return t=>{let n;return fO(dO(()=>function(e,t){const n=e.getReplaceable(t.kind,t.pubkey,t.identifier);return n instanceof Promise?VA(n):WA(n)}(t,e)).pipe(t.eventLoader?PN(t,e):sA),t.insert$.pipe(vO(t=>t.pubkey==e.pubkey&&t.kind===e.kind&&(void 0===e.identifier||OP(t)===e.identifier)))).pipe(qO(e=>n=e),MO(t.remove$.pipe(vO(e=>e.id===n?.id),tO(()=>{}))),RO((e,t)=>void 0===e||void 0===t?e===t:t.created_at<e.created_at),IN(t))}}function ON(e,t){return e=Array.isArray(e)?e:[e],n=>{const r=new Map,i=e=>t?e.id:function(e){let t=Reflect.get(e,EP);return t||(t=IP(e.kind)?PP(e)??e.id:e.id,Reflect.set(e,EP,t)),t}(e);return dO(()=>{const t=n.getTimeline(e);return t instanceof Promise?VA(t):WA(t)}).pipe(LN(n),MO(n.insert$.pipe(vO(t=>sN(e,t)),LN(n))),MO(n.remove$.pipe(vO(t=>sN(e,t)),tO(e=>e.id))),NO((e,n)=>{if("string"==typeof n){const t=e.find(e=>e.id===n);if(t){const e=i(t);r.get(e)?.id===n&&r.delete(e)}return e.filter(e=>e.id!==n)}if(Array.isArray(n)){r.clear();for(const e of n)r.set(i(e),e);return[...n]}let s=[...e];const o=i(n),a=r.get(o);if(a&&(!IP(n.kind)||!t&&n.created_at<a.created_at))return[...e];if(!t&&IP(n.kind)){if(r.set(o,n),a){const e=s.indexOf(a);-1!==e&&s.splice(e,1)}}else r.set(o,n);return CP(s,n),s},[]),RO(),IO(()=>r.clear()))}}function NN(e,t=!1){return e=Array.isArray(e)?e:[e],n=>{const r=t?SA:dO(()=>function(e,t){const n=e.getByFilters(t);return n instanceof Promise?VA(n).pipe(cO(e=>VA(e))):VA(n)}(n,e));return fO(r,n.insert$.pipe(vO(t=>sN(e,t))))}}function FN(e){return"string"==typeof e&&(e={pubkey:e}),t=>{return t.replaceable({kind:uR.Contacts,pubkey:e.pubkey,relays:e.relays}).pipe((n=t,e=>{let t;return fO(e.pipe(qO(e=>t=e)),n.update$.pipe(vO(e=>e.id===t?.id)))}),tO(e=>{return e?function(...e){const t=new Map;for(const n of e)if(Array.isArray(n))for(const e of n)e&&t.set(e.pubkey,e);else n&&t.set(n.pubkey,n);return Array.from(t.values())}(function(e){return xP(e,TM,()=>XP(e.tags,e=>KP(e)?e:void 0,e=>pM(e)??void 0))}(t=e),function(e){if(LM in e)return e[LM];const t=RM(e);if(!t)return;const n=XP(t,e=>KP(e)?e:void 0,e=>pM(e)??void 0);return Reflect.set(e,LM,n),n}(t)):[];var t}));var n}}function DN(e){return"string"==typeof e&&(e={pubkey:e}),t=>t.replaceable({kind:uR.RelayList,pubkey:e.pubkey,relays:e.relays}).pipe(tO(e=>e&&{inboxes:uN(e),outboxes:hN(e)}))}function zN(e){return"string"==typeof e&&(e={pubkey:e}),t=>t.replaceable({kind:uR.Metadata,pubkey:e.pubkey,relays:e.relays}).pipe(vO(fN),tO(e=>e&&pN(e)))}var jN=class{models=new Map;modelKeepWarm=6e4;destroy$=new mA(1);model(e,...t){let n=this.models.get(e);n||(n=new Map,this.models.set(e,n));const r=e.getKey?e.getKey(...t):(0,EN.default)(t);let i=n.get(r);if(!i){const s=()=>{n.get(r)===i&&n.delete(r)};i=e(...t)(this).pipe(IO(s),FO({connector:()=>new mA(1),resetOnComplete:()=>fO(pO(this.modelKeepWarm),this.destroy$),resetOnRefCountZero:()=>fO(pO(this.modelKeepWarm),this.destroy$)}),BO(this.destroy$)),n.set(r,i)}return i}filters(e,t=!1){return Array.isArray(e)||(e=[e]),this.model(NN,e,t)}event(e){return"string"==typeof e||fM(e)?this.model(MN,e):this.replaceable(e)}replaceable(...e){let t;if(1===e.length)t=e[0];else if(3===e.length||2===e.length){let[n,r,i]=e;t={kind:n,pubkey:r,identifier:i}}if(!t)throw new Error("Invalid arguments, expected address pointer or kind, pubkey, identifier");return this.model(AN,t)}addressable(e){return this.replaceable(e)}timeline(e,t=!1){return this.model(ON,e,t)}profile(e){return this.model(zN,e)}contacts(e){return"string"==typeof e&&(e={pubkey:e}),this.model(FN,e)}mailboxes(e){return"string"==typeof e&&(e={pubkey:e}),this.model(DN,e)}dispose(){this.destroy$.next(),this.destroy$.complete()}},UN=class{expired$;expiredSubject;expirations=new Map;timer=null;nextCheck=null;constructor(){this.expiredSubject=new dA,this.expired$=this.expiredSubject.asObservable()}track(e){const t=XO(e);if(!t||!Number.isFinite(t))return;const n=VP();if(t<=n)return;if(this.expirations.set(e.id,t),this.timer&&this.nextCheck&&this.nextCheck<=t)return;this.timer&&clearTimeout(this.timer);const r=t-n;r>0&&(this.timer=setTimeout(this.emitNotifications.bind(this),1e3*r+10),this.nextCheck=t)}forget(e){this.expirations.delete(e)}check(e){const t=XO(e);return!!t&&t<=VP()}dispose(){this.timer&&clearTimeout(this.timer),this.timer=null,this.nextCheck=null,this.expirations.clear(),this.expiredSubject.complete()}[Symbol.dispose](){this.dispose()}emitNotifications(){const e=VP();let t=1/0;for(const[n,r]of this.expirations)r<=e?(this.expirations.delete(n),this.expiredSubject.next(n)):r<t&&(t=r);if(t!==1/0){this.timer&&clearTimeout(this.timer),this.nextCheck=null,this.timer=null;const n=t-e;n>0&&(this.timer=setTimeout(this.emitNotifications.bind(this),1e3*n+10),this.nextCheck=t)}}},BN=class e extends jN{database;memory;deletes;expiration;keepOldVersions=!1;keepExpired=!1;keepDeleted=!1;_verifyEventMethod=_P;get verifyEvent(){return this._verifyEventMethod}set verifyEvent(e){this._verifyEventMethod=e,void 0===e&&console.warn("[applesauce-core] EventStore.verifyEvent is undefined; signature checks are disabled.")}insert$=new dA;update$=new dA;remove$=new dA;eventLoader;internalSubscriptions=new $M;constructor(e){super(),e?.database?(this.database=e.database,this.memory=new TN):this.database=this.memory=new TN,void 0!==e?.keepDeleted&&(this.keepDeleted=e.keepDeleted),void 0!==e?.keepExpired&&(this.keepExpired=e.keepExpired),void 0!==e?.keepOldVersions&&(this.keepOldVersions=e.keepOldVersions),e?.verifyEvent&&(this.verifyEvent=e.verifyEvent),this.deletes=e?.deleteManager??new RN,this.internalSubscriptions.add(this.deletes.deleted$.subscribe(this.handleDeleteNotification.bind(this))),this.expiration=e?.expirationManager??new UN,this.internalSubscriptions.add(this.expiration.expired$.subscribe(this.handleExpiredNotification.bind(this)))}mapToMemory(e){if(void 0!==e)return this.memory?this.memory.add(e):e}handleDeleteNotification({pointer:e,until:t}){if(!this.keepDeleted)if(fM(e)){const n=this.getEvent(e.id);n&&t>=n.created_at&&gM(n,e)&&this.remove(n)}else if(function(e){return"object"==typeof e&&null!==e&&"identifier"in e&&"pubkey"in e&&"kind"in e&&"string"==typeof e.identifier&&"string"==typeof e.pubkey&&"number"==typeof e.kind}(e)){const n=this.getReplaceableHistory(e.kind,e.pubkey,e.identifier);if(n)for(const r of n)t>=r.created_at&&gM(r,e)&&this.remove(r)}}handleExpiredNotification(e){this.keepExpired||this.remove(e)}static copySymbolsToDuplicateEvent(e,t){if(e.kind!==t.kind)throw new Error("Source and destination events must have the same kind");if((n=e.kind)<1e4&&0!==n&&3!==n&&e.id!==t.id)throw new Error("Source and destination events must have the same ID");var n;if(IP(e.kind)&&e.pubkey!==t.pubkey&&OP(e)!==OP(t))throw new Error("Source and destination events must have the same pubkey and replaceable identifier");let r=!1;const i=(s=e,Reflect.get(s,iM));var s;if(i){for(const e of i)oM(t,e);r=!0}const o=[TP,fP,NP];for(const a of o)a in e&&!(a in t)&&(Reflect.set(t,a,Reflect.get(e,a)),r=!0);return r}add(t,n){if(t.kind===uR.EventDeletion)return this.deletes.add(t),t;if(this.deletes.check(t))return t;const r=XO(t);if(!1===this.keepExpired&&r&&r<=VP())return null;n&&oM(t,n);const i=IP(t.kind)?OP(t):void 0;if(!1===this.keepOldVersions&&IP(t.kind)){const n=this.database.getReplaceableHistory(t.kind,t.pubkey,i);if(n&&n.length>0){let r=n[0];for(const e of n)(e.created_at>r.created_at||e.created_at===r.created_at&&e.id<r.id)&&(r=e);if(!(t.created_at>r.created_at||t.created_at===r.created_at&&t.id<r.id))return e.copySymbolsToDuplicateEvent(t,r)&&this.update(r),r}}if(this.verifyEvent&&!1===this.verifyEvent(t))return null;const s=this.memory.add(t);if(s&&s!==t)return e.copySymbolsToDuplicateEvent(t,s)&&this.update(s),s;const o=this.mapToMemory(this.database.add(t));if(o===t?(Reflect.set(o,kP,this),this.insert$.next(o)):e.copySymbolsToDuplicateEvent(t,o)&&this.update(o),!1===this.keepOldVersions&&IP(t.kind)){const e=this.database.getReplaceableHistory(t.kind,t.pubkey,i);if(e&&e.length>0){let t=e[0];for(const r of e)(r.created_at>t.created_at||r.created_at===t.created_at&&r.id<t.id)&&(t=r);const n=e.filter(e=>e!==t);for(const e of n)this.remove(e);if(n.length>0)return t}}return!1===this.keepExpired&&void 0!==r&&this.expiration.track(o),o}remove(e){const t="string"==typeof e?e:e.id;let n=this.memory.getEvent(t);this.expiration.forget(t),n&&Reflect.deleteProperty(n,kP),this.memory!==this.database&&this.memory.remove(e);const r=this.database.remove(e);return r&&n&&this.remove$.next(n),r}removeByFilters(e){const t=this.getByFilters(e);for(const r of t)this.expiration.forget(r.id);this.memory!==this.database&&this.memory.removeByFilters(e);const n=this.database.removeByFilters(e);for(const r of t)this.remove$.next(r);return n}update(e){return!!this.database.add(e)&&(this.database.update?.(e),this.update$.next(e),!0)}hasEvent(e){return"string"==typeof e?this.memory.hasEvent(e)||this.database.hasEvent(e):fM(e)?this.memory.hasEvent(e.id)||this.database.hasEvent(e.id):this.hasReplaceable(e.kind,e.pubkey,e.identifier)}getEvent(e){return"string"==typeof e?this.memory.getEvent(e)??this.mapToMemory(this.database.getEvent(e)):fM(e)?this.memory.getEvent(e.id)??this.mapToMemory(this.database.getEvent(e.id)):this.getReplaceable(e.kind,e.pubkey,e.identifier)}hasReplaceable(e,t,n){return this.memory.hasReplaceable(e,t,n)||this.database.hasReplaceable(e,t,n)}getReplaceable(e,t,n){return this.memory.getReplaceable(e,t,n)??this.mapToMemory(this.database.getReplaceable(e,t,n))}getReplaceableHistory(e,t,n){return this.memory.getReplaceableHistory(e,t,n)??this.database.getReplaceableHistory(e,t,n)?.map(e=>this.mapToMemory(e)??e)}getByFilters(e){const t=this.database.getByFilters(e);return this.memory?t.map(e=>this.mapToMemory(e)):t}getTimeline(e){const t=this.database.getTimeline(e);return this.memory?t.map(e=>this.mapToMemory(e)):t}touch(e){return this.memory.touch(e)}claim(e){return this.memory.claim(e)}isClaimed(e){return this.memory.isClaimed(e)??!1}removeClaim(e){return this.memory.removeClaim(e)}clearClaim(e){return this.memory.clearClaim(e)}unclaimed(){return this.memory.unclaimed()||function*(){}()}prune(e){return this.memory.prune(e)??0}dispose(){const e=this.eventLoader;e&&"function"==typeof e[Symbol.dispose]&&e[Symbol.dispose](),this.eventLoader=void 0,super.dispose(),this.internalSubscriptions.unsubscribe(),this.expiration.dispose?.(),this.insert$.complete(),this.update$.complete(),this.remove$.complete()}[Symbol.dispose](){this.dispose()}};function $N(e,t=!0){return n=>{const r=n.pipe(FO());return r.pipe(cO(t=>{if("string"==typeof t)return SA;const n=e.add(t);return n instanceof Promise?VA(n):WA(n)}),wO(()=>WA(null)),vO(e=>null!==e),t?lA(function(e,t){var n=new Set;e.subscribe(cA(t,function(e){var r=e;n.has(r)||(n.add(r),t.next(e))}))}):sA,MO(r.pipe(vO(e=>"string"==typeof e))))}}function qN(e){return $N(e,!0)}var VN=class extends Error{};function WN(e,t){return QA({first:e,with:()=>HA(()=>new VN(t??"Timeout"))})}function HN(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name&&"BYTES_PER_ELEMENT"in e&&1===e.BYTES_PER_ELEMENT}var GN=e=>e?`"${e}" `:"";function KN(e,t,n=""){if(HN(e)&&(void 0===t||e.length===t))return e;void 0!==t&&function(e,t=""){if("number"!=typeof e)throw new TypeError(GN(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(GN(t)+"expected integer >= 0, got "+e)}(t,"length");const r=HN(e),i=void 0!==t?` of length ${t}`:"",s=r?`length=${e.length}`:"type="+typeof e,o=GN(n)+"expected Uint8Array"+i+", got "+s;if(!r)throw new TypeError(o);throw new RangeError(o)}var ZN=(e,t)=>{if(null===e||"object"!=typeof e||Array.isArray(e))throw new TypeError(("object"===t?"":`"${t}" `)+"expected object, got type="+typeof e)};function YN(e,t=!0){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function XN(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function JN(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function QN(e,t){return e<<32-t|e>>>t}function eF(e,t={}){if("function"!=typeof e)throw new TypeError('"hashCons" expected function, got type='+typeof e);t=function(e,t,n="opts"){return ZN(e,"defaults"),void 0!==t&&ZN(t,n),Object.assign(e,t)}({},t,"info");const n=(t,n)=>e(n).update(t).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=t=>e(t),Object.assign(n,t),Object.freeze(n)}var tF=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function nF(e,t,n){return e&t^~e&n}function rF(e,t,n){return e&t^e&n^t&n}var iF=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,r){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=JN(this.buffer)}update(e){YN(this),KN(e);const{view:t,buffer:n,blockLen:r}=this,i=e.length;let s=!1;for(let o=0;o<i;){const a=Math.min(r-this.pos,i-o);if(a===r){const t=JN(e);for(;r<=i-o;o+=r)this.process(t,o);s=!0;continue}n.set(0===o&&a===i?e:e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===r&&(this.process(t,0),this.pos=0,s=!0)}return this.length+=e.length,s&&this.roundClean(),this}digestInto(e){YN(this),function(e,t){KN(e,void 0,"output");const n=t.outputLen;if(!(e.length>=n))throw new RangeError('"output" expected length >= '+n)}(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:i}=this;let{pos:s}=this;t[s++]=128,t.fill(0,s),this.padOffset>r-s&&(this.process(n,0),t.fill(0)),function(e,t,n,r){const i=(e=>e/2**32|0)(n),s=(e=>e>>>0)(n);e.setUint32(t,r?s:i,r),e.setUint32(t+4,r?i:s,r)}(n,r-8,8*this.length,i),this.process(n,0),this.roundClean();const o=e===t?n:JN(e),a=this.outputLen,l=a/4,c=this.get();if(a%4||l>c.length)throw new Error("invalid outputLen");for(let u=0;u<l;u++)o.setUint32(4*u,c[u],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneIntoMeta(e){const{buffer:t,length:n,finished:r,destroyed:i,pos:s}=this;return e.destroyed=i,e.finished=r,e.length=n,e.pos=s,s&&e.buffer.set(t),e}clone(){return this._cloneInto()}},sF=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),oF=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),aF=new Uint32Array(64),lF=class extends iF{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(e,t){super(64,e,8,!1),this.A=0|t[0],this.B=0|t[1],this.C=0|t[2],this.D=0|t[3],this.E=0|t[4],this.F=0|t[5],this.G=0|t[6],this.H=0|t[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:s,G:o,H:a}=this;return[e,t,n,r,i,s,o,a]}set(e,t,n,r,i,s,o,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|s,this.G=0|o,this.H=0|a}_cloneInto(e){return(e||=new this.constructor).set(...this.get()),this._cloneIntoMeta(e)}process(e,t){for(let u=0;u<16;u++,t+=4)aF[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const e=aF[u-15],t=aF[u-2],n=QN(e,7)^QN(e,18)^e>>>3,r=QN(t,17)^QN(t,19)^t>>>10;aF[u]=r+aF[u-7]+n+aF[u-16]|0}let{A:n,B:r,C:i,D:s,E:o,F:a,G:l,H:c}=this;for(let u=0;u<64;u++){const e=c+(QN(o,6)^QN(o,11)^QN(o,25))+nF(o,a,l)+oF[u]+aF[u]|0,t=(QN(n,2)^QN(n,13)^QN(n,22))+rF(n,r,i)|0;c=l,l=a,a=o,o=s+e|0,s=i,i=r,r=n,n=e+t|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,s=s+this.D|0,o=o+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,i,s,o,a,l,c)}roundClean(){XN(aF)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),XN(this.buffer)}},cF=class extends lF{constructor(){super(32,sF)}},uF=eF(()=>new cF,tF(1)),hF=new WeakMap;function dF(e,t,n,r){let i={configurable:!0,enumerable:!0,writable:!0,initializer:null};r&&(i.initializer=r);for(let s of n)i=s(e,t,i)||i;void 0===i.initializer?Object.defineProperty(e,t,i):function(e,t,n){let r=hF.get(e);r||(r=new Map,hF.set(e,r)),r.set(t,n)}(e,t,i)}function pF(e,t,n){let r={...Object.getOwnPropertyDescriptor(e,t)};for(let i of n)r=i(e,t,r)||r;void 0!==r.initializer&&(r.value=r.initializer?r.initializer.call(e):void 0,r.initializer=void 0),Object.defineProperty(e,t,r)}function fF(e,t){let n=function(e,t){var n;let r=e.prototype;for(;r;){let e=null==(n=hF.get(r))?void 0:n.get(t);if(e)return e;r=Object.getPrototypeOf(r)}}(e.constructor,t);n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(e):void 0})}var gF=a({DEFAULT_BLOSSOM_SERVER:()=>mF,default:()=>vF}),mF="https://blossom.nostr.build";function yF(e,t){let n=e||"https://blossom.nostr.build";return n.endsWith("/")&&(n=n.slice(0,-1)),t.startsWith("/")?`${n}${t}`:`${n}/${t}`}var vF=class extends pp{static{dF(this.prototype,"nostrAuth",[dp])}#N=void fF(this,"nostrAuth");static{dF(this.prototype,"nostrData",[dp])}#F=void fF(this,"nostrData");static{dF(this.prototype,"settings",[dp])}#D=void fF(this,"settings");get servers(){const e=this.nostrData.blossomServers,t=e.length?e:[mF];return this.settings.nostrPhotoFallbackUploads?t:[t[0]]}async _getAuthHeader(e,t,n){const r=Math.floor(Date.now()/1e3),i=new URL(n).hostname,s=await SN.fromKind(24242).content("upload"===e?"Upload photo for place":"Delete photo").modifyPublicTags(()=>[["t",e],["x",t],["expiration",String(r+3600)],["server",i]]).created(r).as(this.nostrAuth.signer).sign();return`Nostr ${btoa(JSON.stringify(s)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}async _uploadToServer(e,t,n,r){const i=yF(n,"upload");r&&r("signing");const s=await this._getAuthHeader("upload",t,n);r&&r("uploading");const o=await fetch(i,{method:"PUT",headers:{Authorization:s,"X-SHA-256":t},body:e});if(!o.ok){const e=await o.text();throw new Error(`Upload failed (${o.status}): ${e}`)}return o.json()}async upload(e,t={sequential:!1}){if(!this.nostrAuth.isConnected)throw new Error("Not connected");const n=await e.arrayBuffer();let r;r="undefined"!=typeof crypto&&crypto.subtle&&crypto.subtle.digest?await crypto.subtle.digest("SHA-256",n):uF(new Uint8Array(n));const i=function(e){return Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,"0")).join("")}(r),s=this.servers,o=s[0],a=s.slice(1),l=[];let c;if(t.sequential){c=await this._uploadToServer(e,i,o,t.onProgress);for(const n of a)try{const r=await this._uploadToServer(e,i,n,t.onProgress);l.push(r.url)}catch(_6){console.warn(`Fallback upload to ${n} failed:`,_6)}}else{const n=this._uploadToServer(e,i,o,t.onProgress),r=a.map(n=>this._uploadToServer(e,i,n,t.onProgress));c=await n;const s=await Promise.allSettled(r);for(let e=0;e<s.length;e++){const t=s[e];"fulfilled"===t.status?l.push(t.value.url):console.warn(`Fallback upload to ${a[e]} failed:`,t.reason)}}return{url:c.url,fallbackUrls:l,hash:i,type:e.type}}async _deleteFromServer(e,t){const n=yF(t,e),r=await this._getAuthHeader("delete",e,t),i=await fetch(n,{method:"DELETE",headers:{Authorization:r}});if(!i.ok){const e=await i.text();throw new Error(e||i.statusText)}}async delete(e){if(!this.nostrAuth.isConnected)throw new Error("Not connected");const t=this.servers,n=t[0],r=t.slice(1),i=this._deleteFromServer(e,n),s=r.map(t=>this._deleteFromServer(e,t));await i;const o=await Promise.allSettled(s);for(let a=0;a<o.length;a++){const e=o[a];"rejected"===e.status&&console.warn(`Fallback delete from ${r[a]} failed:`,e.reason)}}},bF=a({ContributionEntry:()=>_F,groupPhotoContributions:()=>CF}),wF=3600,_F=class{type="photo";placeIdentifier;osmType;osmId;photos;createdAt;eventCount;static{dF(this.prototype,"placeName",[Vr],function(){return null})}#z=void fF(this,"placeName");static{dF(this.prototype,"placeNameLoading",[Vr],function(){return!0})}#j=void fF(this,"placeNameLoading");constructor({placeIdentifier:e,osmType:t,osmId:n,photos:r,createdAt:i,eventCount:s}){this.placeIdentifier=e,this.osmType=t,this.osmId=n,this.photos=r,this.createdAt=i,this.eventCount=s}};function xF(e){const t=e.tags||[],n=t.filter(e=>"t"===e[0]).map(e=>e[1]).filter(Boolean),r=t.find(e=>"imeta"===e[0]);if(!r)return null;let i=null,s=null,o=null,a=!1,l=16/9,c=null;for(const p of r.slice(1))if(p.startsWith("url "))i=p.substring(4);else if(p.startsWith("thumb "))s=p.substring(6);else if(p.startsWith("blurhash "))o=p.substring(9);else if(p.startsWith("dim ")){const[e,t]=p.substring(4).split("x").map(Number);e&&t&&(l=e/t,e>t&&(a=!0))}else if(p.startsWith("alt ")){const e=p.substring(4).trim();c="A photo of a place"===e?null:e||null}if(!i)return null;const u=t.find(e=>"i"===e[0])?.[1],h=t.find(e=>"published_at"===e[0])?.[1],d=h?Number(h):null;return{eventId:e.id,pubkey:e.pubkey,createdAt:e.created_at,publishedAt:d&&d>0?d:null,url:i,thumbUrl:s,blurhash:o,isLandscape:a,aspectRatio:l,placeIdentifier:u,tags:n,alt:c}}function CF(e,t=3){if(!e||0===e.length)return[];const n=function(e){const t=new Set;for(const n of e)if(5===n.kind)for(const e of n.tags||[])"e"===e[0]&&e[1]&&t.add(e[1]);return e.filter(e=>360===e.kind&&!t.has(e.id))}(e);if(0===n.length)return[];const r=new Map;for(const o of n){const e=(o.tags||[]).find(e=>"i"===e[0])?.[1];e&&(r.has(e)||r.set(e,[]),r.get(e).push(o))}const i=t*wF,s=[];for(const[o,a]of r){const e=[...a].sort((e,t)=>t.created_at-e.created_at);let t=[],n=null;for(const r of e)null!==n&&n-r.created_at>i&&(s.push(SF(o,t)),t=[]),t.push(r),n=r.created_at;t.length>0&&s.push(SF(o,t))}return s.filter(e=>e.photos.length>0).sort((e,t)=>t.createdAt-e.createdAt)}function SF(e,t){const n=t.map(xF).filter(Boolean).sort((e,t)=>e.createdAt-t.createdAt),r=t.reduce((e,t)=>t.created_at>e?t.created_at:e,0),[,i,s]=e.split(":");return new _F({placeIdentifier:e,osmType:i,osmId:s,photos:n,createdAt:r,eventCount:t.length})}var kF=a({default:()=>RF}),EF="contributions-name-cache",RF=class extends pp{static{dF(this.prototype,"nostrData",[dp])}#F=void fF(this,"nostrData");static{dF(this.prototype,"nostrAuth",[dp])}#N=void fF(this,"nostrAuth");static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");static{dF(this.prototype,"osm",[dp])}#B=void fF(this,"osm");static{dF(this.prototype,"localForage",[dp])}#$=void fF(this,"localForage");static{dF(this.prototype,"items",[Vr],function(){return[]})}#q=void fF(this,"items");_sub=null;_pendingBatchPromise=null;_lastBatchSignature="";_unresolvable=new Set;async _resolveCachedName(e){const t=this.storage.findPlaceById(e.osmId);return t?.title?t.title:await this.localForage.get(EF,e.placeIdentifier)||(await this.osm.getCachedOsmObject(e.osmType,e.osmId))?.title||null}async _resolveFromCache(e){const t=e.filter(e=>e.placeNameLoading);0!==t.length?(await Promise.all(t.map(async e=>{const t=await this._resolveCachedName(e);t&&(e.placeName=t,e.placeNameLoading=!1)})),this.items=[...this.items],this._maybeBatchFetchNames(this.items)):this._maybeBatchFetchNames(this.items)}async load(e){e?(this._sub=this.nostrData.store.timeline([{kinds:[360,5],authors:[e]}]).subscribe(e=>{this._updateItems(e)}),await this.nostrData.loadMyContributions(e)):this.items=[]}stop(){this._sub&&(this._sub.unsubscribe(),this._sub=null),this.items=[],this._lastBatchSignature="",this._pendingBatchPromise=null,this._unresolvable.clear()}willDestroy(){this.stop(),super.willDestroy(...arguments)}_updateItems(e){const t=CF(e);for(const n of t){const e=this.storage.findPlaceById(n.osmId);e?.title&&(n.placeName=e.title,n.placeNameLoading=!1)}this.items=t,this._resolveFromCache(t)}_isUnresolvable(e){return this._unresolvable.has(e.placeIdentifier)}_maybeBatchFetchNames(e){const t=e.filter(e=>e.placeNameLoading&&!this._isUnresolvable(e));for(const r of e)r.placeNameLoading&&this._isUnresolvable(r)&&(r.placeName=this._fallbackName(r),r.placeNameLoading=!1);if(0===t.length)return void(this.items.some(e=>!e.placeNameLoading)&&(this.items=[...this.items]));const n=t.map(e=>e.placeIdentifier).sort().join("|");n===this._lastBatchSignature&&this._pendingBatchPromise||(this._lastBatchSignature=n,this._pendingBatchPromise=this._batchResolveNames(t).then(e=>{for(const t of this.items)t.placeNameLoading&&(e.has(t.placeIdentifier)?(t.placeName=e.get(t.placeIdentifier),t.placeNameLoading=!1):(this._unresolvable.add(t.placeIdentifier),t.placeName=this._fallbackName(t),t.placeNameLoading=!1));this.items=[...this.items]}).catch(e=>{console.error("[contributions] Batch name resolution failed",e);for(const t of this.items)t.placeNameLoading&&(this._unresolvable.add(t.placeIdentifier),t.placeName=this._fallbackName(t),t.placeNameLoading=!1);this.items=[...this.items]}).finally(()=>{this._pendingBatchPromise=null}))}_fallbackName(e){return`OSM ${e.osmType} ${e.osmId}`}async _batchResolveNames(e){const t=new Map,n=[];for(const s of e){const e=await this._resolveCachedName(s);e?t.set(s.placeIdentifier,e):n.push({osmType:s.osmType,osmId:s.osmId})}if(0===n.length)return t;const r=await this.osm.fetchOsmObjectsBatch(n),i=[];for(const s of e){if(t.has(s.placeIdentifier))continue;const e=`${s.osmType}:${s.osmId}`,n=r.get(e);n?.title&&(t.set(s.placeIdentifier,n.title),i.push(this.localForage.set(EF,s.placeIdentifier,n.title)))}return await Promise.all(i),t}};function TF(e){return new Worker("/assets/image-processor-TE4QOxly.js",{name:e?.name})}var LF=a({default:()=>IF}),IF=class extends pp{_worker=null;_callbacks=new Map;_msgId=0;constructor(){super(...arguments),this._initWorker()}_initWorker(){if(!this._worker&&void 0!==TF)try{this._worker=new TF,this._worker.onmessage=this._handleMessage.bind(this),this._worker.onerror=this._handleError.bind(this)}catch(e){console.warn("Failed to initialize image-processor worker:",e)}}_handleMessage(e){const{id:t,success:n,blob:r,dim:i,blurhash:s,error:o}=e.data,a=this._callbacks.get(t);a&&(this._callbacks.delete(t),n?a.resolve({blob:r,dim:i,blurhash:s}):a.reject(new Error(o)))}_handleError(e){console.error("Image Processor Worker Error:",e);for(const[,t]of this._callbacks.entries())t.reject(new Error("Worker crashed"));this._callbacks.clear(),this._worker.terminate(),this._worker=null,this._initWorker()}_getImageDimensions(e){return new Promise((t,n)=>{const r=new Image,i=URL.createObjectURL(e);r.onload=()=>{const e={width:r.width,height:r.height};URL.revokeObjectURL(i),t(e)},r.onerror=()=>{URL.revokeObjectURL(i),n(new Error("Could not read image dimensions"))},r.src=i})}async process(e,t,n,r=!1){if(!this._worker)throw new Error("Image processor worker is not available.");try{const{width:i,height:s}=await this._getImageDimensions(e);let o=i,a=s;return i>s?i>t&&(a=Math.round(s*(t/i)),o=t):s>t&&(o=Math.round(i*(t/s)),a=t),new Promise((t,i)=>{const s=++this._msgId;this._callbacks.set(s,{resolve:t,reject:i}),this._worker.postMessage({type:"PROCESS_IMAGE",id:s,file:e,targetWidth:o,targetHeight:a,quality:n,computeBlurhash:r})})}catch(i){throw new Error(`Failed to process image: ${i.message}`,{cause:i})}}willDestroy(){super.willDestroy(...arguments),this._worker&&(this._worker.terminate(),this._worker=null),this._callbacks.clear()}},PF=o((e,t)=>{!function(n){"object"==typeof e&&void 0!==t?t.exports=n():"function"==typeof define&&define.amd?define([],n):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).localforage=n()}(function(){return function e(t,n,r){function i(o,a){if(!n[o]){if(!t[o]){var l="function"==typeof c&&c;if(!a&&l)return l(o,!0);if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var h=n[o]={exports:{}};t[o][0].call(h.exports,function(e){return i(t[o][1][e]||e)},h,h.exports,e,t,n,r)}return n[o].exports}for(var s="function"==typeof c&&c,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t){(function(e){var n,r,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var s=0,o=new i(u),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),n=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){u(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(u,0)};else{var l=new e.MessageChannel;l.port1.onmessage=u,n=function(){l.port2.postMessage(0)}}var c=[];function u(){var e,t;r=!0;for(var n=c.length;n;){for(t=c,c=[],e=-1;++e<n;)t[e]();n=c.length}r=!1}t.exports=function(e){1!==c.push(e)||r||n()}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t){var n=e(1);function r(){}var i={},s=["REJECTED"],o=["FULFILLED"],a=["PENDING"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=a,this.queue=[],this.outcome=void 0,e!==r&&d(this,e)}function c(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function u(e,t,r){n(function(){var n;try{n=t(r)}catch(s){return i.reject(e,s)}n===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,n)})}function h(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(e,t){var n=!1;function r(t){n||(n=!0,i.reject(e,t))}function s(t){n||(n=!0,i.resolve(e,t))}var o=p(function(){t(s,r)});"error"===o.status&&r(o.value)}function p(e,t){var n={};try{n.value=e(t),n.status="success"}catch(r){n.status="error",n.value=r}return n}t.exports=l,l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===o||"function"!=typeof t&&this.state===s)return this;var n=new this.constructor(r);return this.state!==a?u(n,this.state===o?e:t,this.outcome):this.queue.push(new c(n,e,t)),n},c.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},c.prototype.otherCallFulfilled=function(e){u(this.promise,this.onFulfilled,e)},c.prototype.callRejected=function(e){i.reject(this.promise,e)},c.prototype.otherCallRejected=function(e){u(this.promise,this.onRejected,e)},i.resolve=function(e,t){var n=p(h,t);if("error"===n.status)return i.reject(e,n.value);var r=n.value;if(r)d(e,r);else{e.state=o,e.outcome=t;for(var s=-1,a=e.queue.length;++s<a;)e.queue[s].callFulfilled(t)}return e},i.reject=function(e,t){e.state=s,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:i.resolve(new this(r),e)},l.reject=function(e){var t=new this(r);return i.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,s=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,l=-1,c=new this(r);++l<n;)u(e[l],l);return c;function u(e,r){t.resolve(e).then(function(e){o[r]=e,++a!==n||s||(s=!0,i.resolve(c,o))},function(e){s||(s=!0,i.reject(c,e))})}},l.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,s=!1;if(!n)return this.resolve([]);for(var o=-1,a=new this(r);++o<n;)l(e[o]);return a;function l(e){t.resolve(e).then(function(e){s||(s=!0,i.resolve(a,e))},function(e){s||(s=!0,i.reject(a,e))})}}},{1:1}],3:[function(e){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(i){if("TypeError"!==i.name)throw i;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var s=Promise;function o(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function a(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function l(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function c(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var u="local-forage-detect-blob-support",h=void 0,d={},p=Object.prototype.toString,f="readonly",g="readwrite";function m(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),i=0;i<t;i++)r[i]=e.charCodeAt(i);return n}function y(e){var t=d[e.name],n={};n.promise=new s(function(e,t){n.resolve=e,n.reject=t}),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then(function(){return n.promise}):t.dbReady=n.promise}function v(e){var t=d[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function b(e,t){var n=d[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function w(e,t){return new s(function(n,i){if(d[e.name]=d[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);y(e),e.db.close()}var s=[e.name];t&&s.push(e.version);var o=r.open.apply(r,s);t&&(o.onupgradeneeded=function(t){var n=o.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(u)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),o.onerror=function(e){e.preventDefault(),i(o.error)},o.onsuccess=function(){var t=o.result;t.onversionchange=function(e){e.target.close()},n(t),v(e)}})}function _(e){return w(e,!1)}function x(e){return w(e,!0)}function C(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,i=e.version>e.db.version;if(r&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),i||n){if(n){var s=e.db.version+1;s>e.version&&(e.version=s)}return!0}return!1}function S(e){return i([m(atob(e.data))],{type:e.type})}function k(e){return e&&e.__local_forage_encoded_blob}function E(e){var t=this,n=t._initReady().then(function(){var e=d[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return a(n,e,e),n}function R(e,t,n,r){void 0===r&&(r=1);try{n(null,e.db.transaction(e.storeName,t))}catch(RD){if(r>0&&(!e.db||"InvalidStateError"===RD.name||"NotFoundError"===RD.name))return s.resolve().then(function(){if(!e.db||"NotFoundError"===RD.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),x(e)}).then(function(){return function(e){y(e);for(var t=d[e.name],n=t.forages,r=0;r<n.length;r++){var i=n[r];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return e.db=null,_(e).then(function(t){return e.db=t,C(e)?x(e):t}).then(function(r){e.db=t.db=r;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=r}).catch(function(t){throw b(e,t),t})}(e).then(function(){R(e,t,n,r-1)})}).catch(n);n(RD)}}var T={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var i=d[n.name];i||(i={forages:[],db:null,dbReady:null,deferredOperations:[]},d[n.name]=i),i.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=E);var o=[];function a(){return s.resolve()}for(var l=0;l<i.forages.length;l++){var c=i.forages[l];c!==t&&o.push(c._initReady().catch(a))}var u=i.forages.slice(0);return s.all(o).then(function(){return n.db=i.db,_(n)}).then(function(e){return n.db=e,C(n,t._defaultConfig.version)?x(n):e}).then(function(e){n.db=i.db=e,t._dbInfo=n;for(var r=0;r<u.length;r++){var s=u[r];s!==t&&(s._dbInfo.db=n.db,s._dbInfo.version=n.version)}})},_support:function(){try{if(!r||!r.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(n){return!1}}(),iterate:function(e,t){var n=this,r=new s(function(t,r){n.ready().then(function(){R(n._dbInfo,f,function(i,s){if(i)return r(i);try{var o=s.objectStore(n._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var n=o.result;if(n){var r=n.value;k(r)&&(r=S(r));var i=e(r,n.key,a++);void 0!==i?t(i):n.continue()}else t()},o.onerror=function(){r(o.error)}}catch(l){r(l)}})}).catch(r)});return o(r,t),r},getItem:function(e,t){var n=this;e=l(e);var r=new s(function(t,r){n.ready().then(function(){R(n._dbInfo,f,function(i,s){if(i)return r(i);try{var o=s.objectStore(n._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),k(e)&&(e=S(e)),t(e)},o.onerror=function(){r(o.error)}}catch(a){r(a)}})}).catch(r)});return o(r,t),r},setItem:function(e,t,n){var r=this;e=l(e);var a=new s(function(n,o){var a;r.ready().then(function(){return a=r._dbInfo,"[object Blob]"===p.call(t)?function(e){return"boolean"==typeof h?s.resolve(h):function(e){return new s(function(t){var n=e.transaction(u,g),r=i([""]);n.objectStore(u).put(r,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/);t(navigator.userAgent.match(/Edge\//)||!e||parseInt(e[1],10)>=43)}}).catch(function(){return!1})}(e).then(function(e){return h=e})}(a.db).then(function(e){return e?t:(n=t,new s(function(e,t){var r=new FileReader;r.onerror=t,r.onloadend=function(t){e({__local_forage_encoded_blob:!0,data:btoa(t.target.result||""),type:n.type})},r.readAsBinaryString(n)}));var n}):t}).then(function(t){R(r._dbInfo,g,function(i,s){if(i)return o(i);try{var a=s.objectStore(r._dbInfo.storeName);null===t&&(t=void 0);var l=a.put(t,e);s.oncomplete=function(){void 0===t&&(t=null),n(t)},s.onabort=s.onerror=function(){o(l.error?l.error:l.transaction.error)}}catch(c){o(c)}})}).catch(o)});return o(a,n),a},removeItem:function(e,t){var n=this;e=l(e);var r=new s(function(t,r){n.ready().then(function(){R(n._dbInfo,g,function(i,s){if(i)return r(i);try{var o=s.objectStore(n._dbInfo.storeName).delete(e);s.oncomplete=function(){t()},s.onerror=function(){r(o.error)},s.onabort=function(){r(o.error?o.error:o.transaction.error)}}catch(a){r(a)}})}).catch(r)});return o(r,t),r},clear:function(e){var t=this,n=new s(function(e,n){t.ready().then(function(){R(t._dbInfo,g,function(r,i){if(r)return n(r);try{var s=i.objectStore(t._dbInfo.storeName).clear();i.oncomplete=function(){e()},i.onabort=i.onerror=function(){n(s.error?s.error:s.transaction.error)}}catch(o){n(o)}})}).catch(n)});return o(n,e),n},length:function(e){var t=this,n=new s(function(e,n){t.ready().then(function(){R(t._dbInfo,f,function(r,i){if(r)return n(r);try{var s=i.objectStore(t._dbInfo.storeName).count();s.onsuccess=function(){e(s.result)},s.onerror=function(){n(s.error)}}catch(o){n(o)}})}).catch(n)});return o(n,e),n},key:function(e,t){var n=this,r=new s(function(t,r){e<0?t(null):n.ready().then(function(){R(n._dbInfo,f,function(i,s){if(i)return r(i);try{var o=s.objectStore(n._dbInfo.storeName),a=!1,l=o.openKeyCursor();l.onsuccess=function(){var n=l.result;n?0===e||a?t(n.key):(a=!0,n.advance(e)):t(null)},l.onerror=function(){r(l.error)}}catch(c){r(c)}})}).catch(r)});return o(r,t),r},keys:function(e){var t=this,n=new s(function(e,n){t.ready().then(function(){R(t._dbInfo,f,function(r,i){if(r)return n(r);try{var s=i.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];s.onsuccess=function(){var t=s.result;t?(o.push(t.key),t.continue()):e(o)},s.onerror=function(){n(s.error)}}catch(a){n(a)}})}).catch(n)});return o(n,e),n},dropInstance:function(e,t){t=c.apply(this,arguments);var n,i=this.config();if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||i.name,e.storeName=e.storeName||i.storeName),e.name){var a=e.name===i.name&&this._dbInfo.db?s.resolve(this._dbInfo.db):_(e).then(function(t){var n=d[e.name],r=n.forages;n.db=t;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=t;return t});n=e.storeName?a.then(function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;y(e);var i=d[e.name],o=i.forages;t.close();for(var a=0;a<o.length;a++){var l=o[a];l._dbInfo.db=null,l._dbInfo.version=n}return new s(function(t,i){var s=r.open(e.name,n);s.onerror=function(e){s.result.close(),i(e)},s.onupgradeneeded=function(){s.result.deleteObjectStore(e.storeName)},s.onsuccess=function(){var e=s.result;e.close(),t(e)}}).then(function(e){i.db=e;for(var t=0;t<o.length;t++){var n=o[t];n._dbInfo.db=e,v(n._dbInfo)}}).catch(function(t){throw(b(e,t)||s.resolve()).catch(function(){}),t})}}):a.then(function(t){y(e);var n=d[e.name],i=n.forages;t.close();for(var o=0;o<i.length;o++)i[o]._dbInfo.db=null;return new s(function(t,n){var i=r.deleteDatabase(e.name);i.onerror=function(){var e=i.result;e&&e.close(),n(i.error)},i.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},i.onsuccess=function(){var e=i.result;e&&e.close(),t(e)}}).then(function(e){n.db=e;for(var t=0;t<i.length;t++)v(i[t]._dbInfo)}).catch(function(t){throw(b(e,t)||s.resolve()).catch(function(){}),t})})}else n=s.reject("Invalid arguments");return o(n,t),n}},L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",I=/^~~local_forage_type~([^~]+)~/,P="__lfsc__:",M="arbf",A="blob",O="si08",N="ui08",F="uic8",D="si16",z="si32",j="ur16",U="ui32",B="fl32",$="fl64",q=Object.prototype.toString;function V(e){var t,n,r,i,s,o=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var c=new ArrayBuffer(o),u=new Uint8Array(c);for(t=0;t<a;t+=4)n=L.indexOf(e[t]),r=L.indexOf(e[t+1]),i=L.indexOf(e[t+2]),s=L.indexOf(e[t+3]),u[l++]=n<<2|r>>4,u[l++]=(15&r)<<4|i>>2,u[l++]=(3&i)<<6|63&s;return c}function W(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=L[n[t]>>2],r+=L[(3&n[t])<<4|n[t+1]>>4],r+=L[(15&n[t+1])<<2|n[t+2]>>6],r+=L[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var H={serialize:function(e,t){var n="";if(e&&(n=q.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===q.call(e.buffer))){var r,i=P;e instanceof ArrayBuffer?(r=e,i+=M):(r=e.buffer,"[object Int8Array]"===n?i+=O:"[object Uint8Array]"===n?i+=N:"[object Uint8ClampedArray]"===n?i+=F:"[object Int16Array]"===n?i+=D:"[object Uint16Array]"===n?i+=j:"[object Int32Array]"===n?i+=z:"[object Uint32Array]"===n?i+=U:"[object Float32Array]"===n?i+=B:"[object Float64Array]"===n?i+=$:t(new Error("Failed to get type for BinaryArray"))),t(i+W(r))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var n="~~local_forage_type~"+e.type+"~"+W(this.result);t(P+A+n)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(o){console.error("Couldn't convert value into a JSON string: ",e),t(null,o)}},deserialize:function(e){if(e.substring(0,9)!==P)return JSON.parse(e);var t,n=e.substring(13),r=e.substring(9,13);if(r===A&&I.test(n)){var s=n.match(I);t=s[1],n=n.substring(s[0].length)}var o=V(n);switch(r){case M:return o;case A:return i([o],{type:t});case O:return new Int8Array(o);case N:return new Uint8Array(o);case F:return new Uint8ClampedArray(o);case D:return new Int16Array(o);case j:return new Uint16Array(o);case z:return new Int32Array(o);case U:return new Uint32Array(o);case B:return new Float32Array(o);case $:return new Float64Array(o);default:throw new Error("Unkown type: "+r)}},stringToBuffer:V,bufferToString:W};function G(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function K(e,t,n,r,i,s){e.executeSql(n,r,i,function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(e,a){a.rows.length?s(e,o):G(e,t,function(){e.executeSql(n,r,i,s)},s)},s):s(e,o)},s)}function Z(e,t,n,r){var i=this;e=l(e);var a=new s(function(s,o){i.ready().then(function(){void 0===t&&(t=null);var a=t,l=i._dbInfo;l.serializer.serialize(t,function(t,c){c?o(c):l.db.transaction(function(n){K(n,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,t],function(){s(a)},function(e,t){o(t)})},function(t){if(t.code===t.QUOTA_ERR){if(r>0)return void s(Z.apply(i,[e,a,n,r-1]));o(t)}})})}).catch(o)});return o(a,n),a}var Y={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]="string"!=typeof e[r]?e[r].toString():e[r];var i=new s(function(e,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(i){return r(i)}n.db.transaction(function(i){G(i,n,function(){t._dbInfo=n,e()},function(e,t){r(t)})},r)});return n.serializer=H,i},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,r=new s(function(t,r){n.ready().then(function(){var i=n._dbInfo;i.db.transaction(function(n){K(n,i,"SELECT * FROM "+i.storeName,[],function(n,r){for(var s=r.rows,o=s.length,a=0;a<o;a++){var l=s.item(a),c=l.value;if(c&&(c=i.serializer.deserialize(c)),void 0!==(c=e(c,l.key,a+1)))return void t(c)}t()},function(e,t){r(t)})})}).catch(r)});return o(r,t),r},getItem:function(e,t){var n=this;e=l(e);var r=new s(function(t,r){n.ready().then(function(){var i=n._dbInfo;i.db.transaction(function(n){K(n,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],function(e,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=i.serializer.deserialize(r)),t(r)},function(e,t){r(t)})})}).catch(r)});return o(r,t),r},setItem:function(e,t,n){return Z.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=l(e);var r=new s(function(t,r){n.ready().then(function(){var i=n._dbInfo;i.db.transaction(function(n){K(n,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){r(t)})})}).catch(r)});return o(r,t),r},clear:function(e){var t=this,n=new s(function(e,n){t.ready().then(function(){var r=t._dbInfo;r.db.transaction(function(t){K(t,r,"DELETE FROM "+r.storeName,[],function(){e()},function(e,t){n(t)})})}).catch(n)});return o(n,e),n},length:function(e){var t=this,n=new s(function(e,n){t.ready().then(function(){var r=t._dbInfo;r.db.transaction(function(t){K(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],function(t,n){var r=n.rows.item(0).c;e(r)},function(e,t){n(t)})})}).catch(n)});return o(n,e),n},key:function(e,t){var n=this,r=new s(function(t,r){n.ready().then(function(){var i=n._dbInfo;i.db.transaction(function(n){K(n,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,n){t(n.rows.length?n.rows.item(0).key:null)},function(e,t){r(t)})})}).catch(r)});return o(r,t),r},keys:function(e){var t=this,n=new s(function(e,n){t.ready().then(function(){var r=t._dbInfo;r.db.transaction(function(t){K(t,r,"SELECT key FROM "+r.storeName,[],function(t,n){for(var r=[],i=0;i<n.rows.length;i++)r.push(n.rows.item(i).key);e(r)},function(e,t){n(t)})})}).catch(n)});return o(n,e),n},dropInstance:function(e,t){t=c.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,i=this;return r=e.name?new s(function(t){var r;r=e.name===n.name?i._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:r,storeNames:[e.storeName]}):t(function(e){return new s(function(t,n){e.transaction(function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(n,r){for(var i=[],s=0;s<r.rows.length;s++)i.push(r.rows.item(s).name);t({db:e,storeNames:i})},function(e,t){n(t)})},function(e){n(e)})})}(r))}).then(function(e){return new s(function(t,n){e.db.transaction(function(r){function i(e){return new s(function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){n(t)})})}for(var o=[],a=0,l=e.storeNames.length;a<l;a++)o.push(i(e.storeNames[a]));s.all(o).then(function(){t()}).catch(function(e){n(e)})},function(e){n(e)})})}):s.reject("Invalid arguments"),o(r,t),r}};function X(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}var J={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=X(e,this._defaultConfig),!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(t){return!0}}()||localStorage.length>0?(this._dbInfo=t,t.serializer=H,s.resolve()):s.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=n.ready().then(function(){for(var t=n._dbInfo,r=t.keyPrefix,i=r.length,s=localStorage.length,o=1,a=0;a<s;a++){var l=localStorage.key(a);if(0===l.indexOf(r)){var c=localStorage.getItem(l);if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,l.substring(i),o++)))return c}}});return o(r,t),r},getItem:function(e,t){var n=this;e=l(e);var r=n.ready().then(function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e);return r&&(r=t.serializer.deserialize(r)),r});return o(r,t),r},setItem:function(e,t,n){var r=this;e=l(e);var i=r.ready().then(function(){void 0===t&&(t=null);var n=t;return new s(function(i,s){var o=r._dbInfo;o.serializer.serialize(t,function(t,r){if(r)s(r);else try{localStorage.setItem(o.keyPrefix+e,t),i(n)}catch(a){"QuotaExceededError"!==a.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==a.name||s(a),s(a)}})})});return o(i,n),i},removeItem:function(e,t){var n=this;e=l(e);var r=n.ready().then(function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)});return o(r,t),r},clear:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(e)&&localStorage.removeItem(r)}});return o(n,e),n},length:function(e){var t=this.keys().then(function(e){return e.length});return o(t,e),t},key:function(e,t){var n=this,r=n.ready().then(function(){var t,r=n._dbInfo;try{t=localStorage.key(e)}catch(_6){t=null}return t&&(t=t.substring(r.keyPrefix.length)),t});return o(r,t),r},keys:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo,n=localStorage.length,r=[],i=0;i<n;i++){var s=localStorage.key(i);0===s.indexOf(e.keyPrefix)&&r.push(s.substring(e.keyPrefix.length))}return r});return o(n,e),n},dropInstance:function(e,t){if(t=c.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var r,i=this;return r=e.name?new s(function(t){e.storeName?t(X(e,i._defaultConfig)):t(e.name+"/")}).then(function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}}):s.reject("Invalid arguments"),o(r,t),r}},Q=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},ee=function(e,t){for(var n=e.length,r=0;r<n;){if(Q(e[r],t))return!0;r++}return!1},te=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ne={},re={},ie={INDEXEDDB:T,WEBSQL:Y,LOCALSTORAGE:J},se=[ie.INDEXEDDB._driver,ie.WEBSQL._driver,ie.LOCALSTORAGE._driver],oe=["dropInstance"],ae=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(oe),le={description:"",driver:se.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ce(e,t){e[t]=function(){var n=arguments;return e.ready().then(function(){return e[t].apply(e,n)})}}function ue(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(te(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}t.exports=new(function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ie)if(ie.hasOwnProperty(n)){var r=ie[n],i=r._driver;this[n]=i,ne[i]||this.defineDriver(r)}this._defaultConfig=ue({},le),this._config=ue({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":n(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var r=new s(function(t,n){try{var r=e._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(i);for(var a=ae.concat("_initStorage"),l=0,c=a.length;l<c;l++){var u=a[l];if((!ee(oe,u)||e[u])&&"function"!=typeof e[u])return void n(i)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=s.reject(t);return o(n,arguments[arguments.length-1]),n}},n=0,r=oe.length;n<r;n++){var i=oe[n];e[i]||(e[i]=t(i))}}();var h=function(n){ne[r]&&console.info("Redefining LocalForage driver: "+r),ne[r]=e,re[r]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(h,n):h(!!e._support):h(!0)}catch(d){n(d)}});return a(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=ne[e]?s.resolve(ne[e]):s.reject(new Error("Driver not found."));return a(r,t,n),r},e.prototype.getSerializer=function(e){var t=s.resolve(H);return a(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return a(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this;te(e)||(e=[e]);var i=this._getSupportedDrivers(e);function o(){r._config.driver=r.driver()}function l(e){return r._extend(e),o(),r._ready=r._initStorage(r._config),r._ready}var c=null!==this._driverSet?this._driverSet.catch(function(){return s.resolve()}):s.resolve();return this._driverSet=c.then(function(){var e=i[0];return r._dbInfo=null,r._ready=null,r.getDriver(e).then(function(e){r._driver=e._driver,o(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(e){return function(){var t=0;return function n(){for(;t<e.length;){var i=e[t];return t++,r._dbInfo=null,r._ready=null,r.getDriver(i).then(l).catch(n)}o();var a=new Error("No available storage method found.");return r._driverSet=s.reject(a),r._driverSet}()}}(i)})}).catch(function(){o();var e=new Error("No available storage method found.");return r._driverSet=s.reject(e),r._driverSet}),a(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!re[e]},e.prototype._extend=function(e){ue(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];this.supports(i)&&t.push(i)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=ae.length;e<t;e++)ce(this,ae[e])},e.prototype.createInstance=function(t){return new e(t)},e}())},{3:3}]},{},[4])(4)})}),MF=a({default:()=>OF}),AF=l(PF(),1),OF=class extends pp{_instances=new Map;_instance(e){let t=this._instances.get(e);return t||(t=AF.default.createInstance({name:"marco",storeName:e}),this._instances.set(e,t)),t}async get(e,t){return this._instance(e).getItem(t)}async set(e,t,n){return this._instance(e).setItem(t,n)}async remove(e,t){return this._instance(e).removeItem(t)}async keys(e){return this._instance(e).keys()}async clear(e){return this._instance(e).clear()}async iterate(e,t){return this._instance(e).iterate(t)}},NF=a({default:()=>FF}),FF=class extends pp{static{dF(this.prototype,"nostrData",[dp])}#F=void fF(this,"nostrData");static{dF(this.prototype,"selectedPlace",[Vr],function(){return null})}#V=void fF(this,"selectedPlace");static{dF(this.prototype,"isSearching",[Vr],function(){return!1})}#W=void fF(this,"isSearching");static{dF(this.prototype,"isCreating",[Vr],function(){return!1})}#H=void fF(this,"isCreating");static{dF(this.prototype,"creationCoordinates",[Vr],function(){return null})}#G=void fF(this,"creationCoordinates");static{dF(this.prototype,"returnToSearch",[Vr],function(){return!1})}#K=void fF(this,"returnToSearch");static{dF(this.prototype,"returnToRoute",[Vr],function(){return null})}#Z=void fF(this,"returnToRoute");static{dF(this.prototype,"currentCenter",[Vr],function(){return null})}#Y=void fF(this,"currentCenter");static{dF(this.prototype,"currentBounds",[Vr],function(){return null})}#X=void fF(this,"currentBounds");static{dF(this.prototype,"currentZoom",[Vr],function(){return null})}#J=void fF(this,"currentZoom");static{dF(this.prototype,"searchBoxHasFocus",[Vr],function(){return!1})}#Q=void fF(this,"searchBoxHasFocus");static{dF(this.prototype,"selectionOptions",[Vr],function(){return{}})}#ee=void fF(this,"selectionOptions");static{dF(this.prototype,"preventNextZoom",[Vr],function(){return!1})}#te=void fF(this,"preventNextZoom");static{dF(this.prototype,"searchResults",[Vr],function(){return[]})}#ne=void fF(this,"searchResults");static{dF(this.prototype,"currentSearch",[Vr],function(){return null})}#re=void fF(this,"currentSearch");static{dF(this.prototype,"loadingState",[Vr],function(){return null})}#ie=void fF(this,"loadingState");static{dF(this.prototype,"isSidebarVisible",[Vr],function(){return!1})}#se=void fF(this,"isSidebarVisible");static{dF(this.prototype,"isSidebarOpening",[Vr],function(){return!1})}#oe=void fF(this,"isSidebarOpening");scrollPositions={};saveScrollPosition(e,t){this.scrollPositions[e]=t}static{pF(this.prototype,"saveScrollPosition",[ql])}getScrollPosition(e){return this.scrollPositions[e]||0}static{pF(this.prototype,"getScrollPosition",[ql])}showSidebar(){this.isSidebarVisible||(this.isSidebarVisible=!0,this.isSidebarOpening=!0,setTimeout(()=>{this.isSidebarOpening=!1},250))}hideSidebar(){this.isSidebarVisible=!1,this.isSidebarOpening=!1}selectPlace(e,t={}){this.selectedPlace=e,this.selectionOptions=t,this.nostrData.loadPhotosForPlace(e)}clearSelection(){this.selectedPlace=null,this.selectionOptions={},this.preventNextZoom=!1,this.nostrData.loadPhotosForPlace(null)}setSearchResults(e){this.searchResults=e||[]}clearSearchResults(){this.searchResults=[],this.currentSearch=null}startSearch(){this.isSearching=!0,this.isCreating=!1,this.preventNextZoom=!1}stopSearch(){this.isSearching=!1}startCreating(){this.isCreating=!0,this.isSearching=!1}stopCreating(){this.isCreating=!1,this.creationCoordinates=null}updateCreationCoordinates(e,t){this.creationCoordinates={lat:e,lon:t}}setSearchBoxFocus(e){this.searchBoxHasFocus=e}updateCenter(e,t){this.currentCenter={lat:e,lon:t}}updateZoom(e){this.currentZoom=e}updateBounds(e){this.currentBounds=e}startLoading(e,t){this.loadingState={type:e,value:t}}stopLoading(e=null,t=null){e||t?this.loadingState&&this.loadingState.type===e&&this.loadingState.value===t&&(this.loadingState=null):this.loadingState=null}};function DF(){let e,t;const n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n}"navigator"in globalThis&&navigator.userAgent.includes("Android")&&navigator.clipboard&&navigator.clipboard.readText;var zF=class extends Error{},jF=class{get nip04(){return window.nostr?.nip04}get nip44(){return window.nostr?.nip44}pubkey=void 0;async getPublicKey(){if(!window.nostr)throw new zF("Signer extension missing");if(this.pubkey)return this.pubkey;const e=await window.nostr.getPublicKey();if(!uM(e))throw new Error("Extension returned an invalid public key");return this.pubkey=e,this.pubkey}async signEvent(e){if(!window.nostr)throw new zF("Signer extension missing");const t=await window.nostr.signEvent(e);if(!_P(t))throw new Error("Extension returned an invalid event");return t}};function UF(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name&&"BYTES_PER_ELEMENT"in e&&1===e.BYTES_PER_ELEMENT}function BF(e,t){return!!Array.isArray(t)&&(0===t.length||(e?t.every(e=>"string"==typeof e):t.every(e=>Number.isSafeInteger(e))))}function $F(e){if("function"!=typeof e)throw new TypeError("function expected");return!0}function qF(e,t){if("string"!=typeof t)throw new TypeError(`${e}: string expected`);return!0}function VF(e){if("number"!=typeof e)throw new TypeError("number expected, got "+typeof e);if(!Number.isSafeInteger(e))throw new RangeError(`invalid integer: ${e}`)}function WF(e){if(!Array.isArray(e))throw new TypeError("array expected")}function HF(e,t){if(!BF(!0,t))throw new TypeError(`${e}: array of strings expected`)}function GF(e,t){if(!BF(!1,t))throw new TypeError(`${e}: array of numbers expected`)}function KF(...e){const t=e=>e,n=(e,t)=>n=>e(t(n));return{encode:e.map(e=>e.encode).reduceRight(n,t),decode:e.map(e=>e.decode).reduce(n,t)}}function ZF(e){const t="string"==typeof e?e.split(""):e,n=t.length;HF("alphabet",t);const r=new Map(t.map((e,t)=>[e,t]));return{encode:r=>(WF(r),r.map(r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${r}". Allowed: ${e}`);return t[r]})),decode:t=>(WF(t),t.map(t=>{qF("alphabet.decode",t);const n=r.get(t);if(void 0===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n}))}}function YF(e=""){return qF("join",e),{encode:t=>(HF("join.decode",t),t.join(e)),decode:t=>(qF("join.decode",t),t.split(e))}}function XF(e,t="="){return VF(e),qF("padding",t),{encode(n){for(HF("padding.encode",n);n.length*e%8;)n.push(t);return n},decode(n){HF("padding.decode",n);let r=n.length;if(r*e%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if((r-1)*e%8==0)throw new Error("padding: invalid, string has too much padding");return n.slice(0,r)}}}function JF(e){return $F(e),{encode:e=>e,decode:t=>e(t)}}var QF=(e,t)=>0===t?e:QF(t,e%t),eD=(e,t)=>e+(t-QF(e,t)),tD=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function nD(e,t,n,r){if(WF(e),t<=0||t>32)throw new RangeError(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new RangeError(`convertRadix2: wrong to=${n}`);if(eD(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${eD(t,n)}`);let i=0,s=0;const o=tD[t],a=tD[n]-1,l=[];for(const c of e){if(VF(c),c>=o)throw new Error(`convertRadix2: invalid data word=${c} from=${t}`);if(i=i<<t|c,s+t>32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${t}`);for(s+=t;s>=n;s-=n)l.push((i>>s-n&a)>>>0);const e=tD[s];if(void 0===e)throw new Error("invalid carry");i&=e-1}if(i=i<<n-s&a,!r&&s>=t)throw new Error("Excess padding");if(!r&&i>0)throw new Error(`Non-zero padding: ${i}`);return r&&s>0&&l.push(i>>>0),l}function rD(e,t=!1){if(VF(e),e<=0||e>32)throw new RangeError("radix2: bits should be in (0..32]");if(eD(8,e)>32||eD(e,8)>32)throw new RangeError("radix2: carry overflow");return{encode:n=>{if(!UF(n))throw new TypeError("radix2.encode input should be Uint8Array");return nD(Array.from(n),8,e,!t)},decode:n=>(GF("radix2.decode",n),Uint8Array.from(nD(n,e,8,t)))}}function iD(e){return $F(e),function(...t){try{return e.apply(null,t)}catch(n){}}}KF(rD(4),ZF("0123456789ABCDEF"),YF("")),KF(rD(5),ZF("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),XF(5),YF("")),KF(rD(5),ZF("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),YF("")),KF(rD(5),ZF("0123456789ABCDEFGHIJKLMNOPQRSTUV"),XF(5),YF("")),KF(rD(5),ZF("0123456789ABCDEFGHIJKLMNOPQRSTUV"),YF("")),KF(rD(5),ZF("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),YF(""),JF(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));var sD=(()=>"function"==typeof Uint8Array.from([]).toBase64&&"function"==typeof Uint8Array.fromBase64)(),oD=(sD||KF(rD(6),ZF("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),XF(6),YF("")),KF(rD(6),ZF("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),YF("")),sD||KF(rD(6),ZF("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),XF(6),YF("")),KF(rD(6),ZF("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),YF("")),KF(ZF("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),YF(""))),aD=[996825010,642813549,513874426,1027748829,705979059];function lD(e){const t=e>>25;let n=(33554431&e)<<5;for(let r=0;r<aD.length;r++)1==(t>>r&1)&&(n^=aD[r]);return n}function cD(e,t,n=1){const r=e.length;let i=1;for(let s=0;s<r;s++){const t=e.charCodeAt(s);if(t<33||t>126)throw new Error(`Invalid prefix (${e})`);i=lD(i)^t>>5}i=lD(i);for(let s=0;s<r;s++)i=lD(i)^31&e.charCodeAt(s);for(let s of t)i=lD(i)^s;for(let s=0;s<6;s++)i=lD(i);return i^=n,oD.encode(nD([i%tD[30]],30,5,!1))}function uD(e){const t="bech32"===e?1:734539939,n=rD(5),r=n.decode,i=n.encode,s=iD(r);function o(e,n,r=90){qF("bech32.encode prefix",e),UF(n)&&(n=Array.from(n)),GF("bech32.encode",n);const i=e.length;if(0===i)throw new TypeError(`Invalid prefix length ${i}`);const s=i+7+n.length;if(!1!==r&&s>r)throw new TypeError(`Length ${s} exceeds limit ${r}`);const o=e.toLowerCase(),a=cD(o,n,t);return`${o}1${oD.encode(n)}${a}`}function a(e,n=90){qF("bech32.decode input",e);const r=e.length;if(r<8||!1!==n&&r>n)throw new TypeError(`invalid string length: ${r} (${e}). Expected (8..${n})`);const i=e.toLowerCase();if(e!==i&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const s=i.lastIndexOf("1");if(0===s||-1===s)throw new Error('Letter "1" must be present between prefix and data only');const o=i.slice(0,s),a=i.slice(s+1);if(a.length<6)throw new Error("Data must be at least 6 characters long");const l=oD.decode(a).slice(0,-6),c=cD(o,l,t);if(!a.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:o,words:l}}return{encode:o,decode:a,encodeFromBytes:function(e,t){return o(e,i(t))},decodeToBytes:function(e){const{prefix:t,words:n}=a(e,!1);return{prefix:t,words:n,bytes:r(n)}},decodeUnsafe:iD(a),fromWords:r,fromWordsUnsafe:s,toWords:i}}var hD,dD,pD=Object.freeze(uD("bech32")),fD=(uD("bech32m"),(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)()||KF(rD(4),ZF("0123456789abcdef"),YF(""),JF(e=>{if("string"!=typeof e||e.length%2!=0)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})),new TextEncoder),gD=new TextDecoder;function mD(e){if(!uM(e.remote))throw new Error("Invalid nbunksec: remote is not a valid hex key");if(!uM(e.clientKey))throw new Error("Invalid nbunksec: clientKey is not a valid hex key");if(0===e.relays.length)throw new Error("Invalid nbunksec: missing relays");return function(e){try{const t=[],n=IS(e.pubkey);t.push(new Uint8Array([0,n.length]),n);const r=IS(e.local_key);t.push(new Uint8Array([1,r.length]),r);for(const a of e.relays){const e=fD.encode(a);t.push(new Uint8Array([2,e.length]),e)}if(e.secret){const n=fD.encode(e.secret);t.push(new Uint8Array([3,n.length]),n)}const i=t.reduce((e,t)=>e+t.length,0),s=new Uint8Array(i);let o=0;for(const e of t)s.set(e,o),o+=e.length;return pD.encode("nbunksec",pD.toWords(s),!1)}catch(_6){throw new Error(`Failed to encode bunker info: ${_6}`)}}({pubkey:e.remote,local_key:e.clientKey,relays:e.relays,secret:e.bunkerSecret??e.secret})}bM(uR.NostrConnect,"nip44"),function(e){e.GetPublicKey="get_public_key",e.SignEvent="sign_event",e.Ping="ping",e.Nip04Encrypt="nip04_encrypt",e.Nip04Decrypt="nip04_decrypt",e.Nip44Encrypt="nip44_encrypt",e.Nip44Decrypt="nip44_decrypt",e.SwitchRelays="switch_relays"}(hD||(hD={})),function(e){e.Connect="connect",e.CreateAccount="create_account",e.GetPublicKey="get_public_key",e.SignEvent="sign_event",e.Ping="ping",e.Nip04Encrypt="nip04_encrypt",e.Nip04Decrypt="nip04_decrypt",e.Nip44Encrypt="nip44_encrypt",e.Nip44Decrypt="nip44_decrypt",e.SwitchRelays="switch_relays",e.Logout="logout"}(dD||(dD={}));var yD=class e{key;constructor(e){this.key=e||vP()}async getPublicKey(){return bP(this.key)}async signEvent(e){return wP(e,this.key)}nip04={encrypt:async(e,t)=>CL.encrypt(this.key,e,t),decrypt:async(e,t)=>CL.decrypt(this.key,e,t)};nip44={encrypt:async(e,t)=>UL.v2.encrypt(t,UL.v2.utils.getConversationKey(this.key,e)),decrypt:async(e,t)=>UL.v2.decrypt(t,UL.v2.utils.getConversationKey(this.key,e))};static fromKey(t){const n=function(e){if(e instanceof Uint8Array)return 32!==e.length?null:e;if(uM(e))return IS(e);try{const t=function(e){let{prefix:t,words:n}=bk.decode(e,5e3),r=new Uint8Array(bk.fromWords(n));switch(t){case"nprofile":{let e=eM(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for nprofile");if(32!==e[0][0].length)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:LS(e[0][0]),relays:e[1]?e[1].map(e=>JP.decode(e)):[]}}}case"nevent":{let e=eM(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for nevent");if(32!==e[0][0].length)throw new Error("TLV 0 should be 32 bytes");if(e[2]&&32!==e[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(e[3]&&4!==e[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:LS(e[0][0]),relays:e[1]?e[1].map(e=>JP.decode(e)):[],author:e[2]?.[0]?LS(e[2][0]):void 0,kind:e[3]?.[0]?parseInt(LS(e[3][0]),16):void 0}}}case"naddr":{let e=eM(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!e[2]?.[0])throw new Error("missing TLV 2 for naddr");if(32!==e[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(!e[3]?.[0])throw new Error("missing TLV 3 for naddr");if(4!==e[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:JP.decode(e[0][0]),pubkey:LS(e[2][0]),kind:parseInt(LS(e[3][0]),16),relays:e[1]?e[1].map(e=>JP.decode(e)):[]}}}case"nsec":return{type:t,data:r};case"npub":case"note":return{type:t,data:LS(r)};default:throw new Error(`unknown prefix ${t}`)}}(e);return"nsec"!==t.type?null:t.data}catch{return null}}(t);if(!n)throw new Error("Invalid private key");return new e(n)}};async function vD(e){window.open(e,"auth","width=400,height=600,resizable=no,status=no,location=no,toolbar=no,menubar=no")}var bD=class e{static subscriptionMethod=void 0;static publishMethod=void 0;static pool=void 0;publishMethod;subscriptionMethod;log=KO.extend("NostrConnectSigner");signer;listening=!1;isConnected=!1;pubkey;relays;remote;get clientPubkey(){return bP(this.signer.key)}onAuth=vD;verifyEvent=_P;connectSecret;bunkerSecret;get secret(){return this.connectSecret}set secret(e){this.connectSecret=e}nip04;nip44;constructor(t){this.relays=t.relays,this.pubkey=t.pubkey,this.remote=t.remote,this.connectSecret=t.connectSecret||t.secret||WP(12),this.bunkerSecret=t.bunkerSecret;const{subscriptionMethod:n,publishMethod:r}=function(e,t){const n=e.subscriptionMethod||e.pool?.subscription.bind(e.pool)||t?.subscriptionMethod||t?.pool?.subscription.bind(t.pool);if(!n)throw new Error("Missing subscriptionMethod, either pass a method or set subscriptionMethod globally on the class");const r=e.publishMethod||e.pool?.publish.bind(e.pool)||t?.publishMethod||t?.pool?.publish.bind(t.pool);if(!r)throw new Error("Missing publishMethod, either pass a method or set publishMethod globally on the class");return{subscriptionMethod:n,publishMethod:r}}(t,e);this.subscriptionMethod=(e,t)=>n(e,t),this.publishMethod=(e,t)=>r(e,t),t.onAuth&&(this.onAuth=t.onAuth),this.signer=t?.signer||new yD,this.nip04={encrypt:this.nip04Encrypt.bind(this),decrypt:this.nip04Decrypt.bind(this)},this.nip44={encrypt:this.nip44Encrypt.bind(this),decrypt:this.nip44Decrypt.bind(this)}}req;async open(){if(this.listening)return;this.listening=!0;const e=await this.signer.getPublicKey();this.req=VA(this.subscriptionMethod(this.relays,[{kinds:[uR.NostrConnect],"#p":[e]}])).pipe(AO(),OO(),vO(e=>"string"!=typeof e)).subscribe(this.handleEvent.bind(this)),this.log("Opened",this.relays)}async close(){this.listening=!1,this.isConnected=!1,this.req&&(this.req.unsubscribe(),this.req=void 0),this.waitingPromise&&(this.waitingPromise.reject(new Error("Closed")),this.waitingPromise=null),this.log("Closed")}requests=new Map;auths=new Set;async handleEvent(e){if(this.verifyEvent(e)&&(!this.remote||e.pubkey===this.remote))try{const n=_M(e)??(function(e){const t=e.length;return!(t<28)&&"?"==e[t-28]&&"i"==e[t-27]&&"v"==e[t-26]&&"="==e[t-25]}(e.content)?await this.signer.nip04.decrypt(e.pubkey,e.content):await this.signer.nip44.decrypt(e.pubkey,e.content));if(!n)return;const r=JSON.parse(n);if(!this.remote&&("ack"===r.result||this.connectSecret&&r.result===this.connectSecret))return this.log("Got ack response from",e.pubkey,r.result),this.isConnected=!0,this.remote=e.pubkey,this.waitingPromise?.resolve(),void(this.waitingPromise=null);if(r.id){const e=this.requests.get(r.id);if(!e)return;if(r.error)if(this.log("Got Error",r.id,r.result,r.error),"auth_url"===r.result){if(!this.auths.has(r.id)&&(this.auths.add(r.id),this.onAuth))try{await this.onAuth(r.error)}catch(t){e.reject(t)}}else e.reject(new Error(r.error));else r.result&&(this.log("Got Response",r.id,r.result),e.resolve(r.result))}}catch(t){}}async createRequestEvent(e,t=this.remote,n=uR.NostrConnect){if(!t)throw new Error("Missing target pubkey");return await this.signer.signEvent({kind:n,created_at:VP(),tags:[["p",t]],content:e})}async makeRequest(e,t,n=uR.NostrConnect){if(!this.remote)throw new Error("Missing remote signer pubkey");const r=WP(8),i={id:r,method:e,params:t},s=await this.signer.nip44.encrypt(this.remote,JSON.stringify(i)),o=await this.createRequestEvent(s,this.remote,n);this.log(`Sending ${r} (${e}) ${JSON.stringify(t)}`);const a=DF();this.requests.set(r,a);const l=this.publishMethod?.(this.relays,o);return l instanceof Promise?await l:"subscribe"in l&&await new Promise(e=>l.subscribe({complete:e})),this.log(`Sent ${r} (${e})`),a}async connect(e,t){if(!this.remote&&this.pubkey&&(this.remote=this.pubkey),!this.remote)throw new Error("Missing remote signer pubkey");await this.open();try{void 0!==e&&(this.bunkerSecret=e);const n=await this.makeRequest(dD.Connect,[this.remote,this.bunkerSecret||"",t?.join(",")??""]);return this.isConnected=!0,n}catch(n){throw this.isConnected=!1,this.close(),n}}waitingPromise=null;waitForSigner(e){return this.isConnected?Promise.resolve():(this.open(),this.waitingPromise=DF(),e?.addEventListener("abort",()=>{this.waitingPromise?.reject(new Error("Aborted")),this.waitingPromise=null,this.close()},!0),this.waitingPromise)}async createAccount(e,t,n,r){if(!this.remote)throw new Error("Remote pubkey must be set");await this.open();try{const i=await this.makeRequest(dD.CreateAccount,[e,t,n??"",r?.join(",")??""]);return this.pubkey=i,this.isConnected=!0,i}catch(i){throw this.isConnected=!1,this.close(),i}}async requireConnection(){this.isConnected||await this.connect()}async getPublicKey(){if(this.pubkey)return this.pubkey;await this.requireConnection();const e=await this.makeRequest(dD.GetPublicKey,[]);if(!uM(e))throw new Error("Remote signer returned an invalid public key");return e}async signEvent(e){await this.requireConnection();const t=await this.makeRequest(dD.SignEvent,[JSON.stringify(e)]),n=JSON.parse(t);if(!this.verifyEvent(n))throw new Error("Invalid event");return n}async nip04Encrypt(e,t){return await this.requireConnection(),this.makeRequest(dD.Nip04Encrypt,[e,t])}async nip04Decrypt(e,t){await this.requireConnection();const n=await this.makeRequest(dD.Nip04Decrypt,[e,t]);return n.startsWith('["')&&n.endsWith('"]')?JSON.parse(n)[0]:n}async nip44Encrypt(e,t){return await this.requireConnection(),this.makeRequest(dD.Nip44Encrypt,[e,t])}async nip44Decrypt(e,t){await this.requireConnection();const n=await this.makeRequest(dD.Nip44Decrypt,[e,t]);return n.startsWith('["')&&n.endsWith('"]')?JSON.parse(n)[0]:n}async ping(){return await this.requireConnection(),this.makeRequest(dD.Ping,[])}async switchRelays(){await this.requireConnection();const e=await this.makeRequest(dD.SwitchRelays,[]);return null!==e&&Array.isArray(e)&&e.length>0&&(this.log("Switching relays from",this.relays,"to",e),this.relays=e,this.listening&&(await this.close(),await this.open())),e}async logout(){try{this.isConnected&&this.remote&&await this.makeRequest(dD.Logout,[])}catch(_6){this.log("Failed to send logout request",_6)}finally{this.isConnected=!1,await this.close()}}getNostrConnectURI(e){return function(e){const t=new URLSearchParams,n=e.connectSecret??e.secret;if(!n)throw new Error("Invalid nostrconnect URI: missing secret");t.set("secret",n),e.metadata?.name&&t.set("name",e.metadata.name),e.metadata?.url&&t.set("url",String(e.metadata.url)),e.metadata?.image&&t.set("image",e.metadata.image),e.metadata?.permissions&&t.set("perms",e.metadata.permissions.join(","));for(const r of e.relays)t.append("relay",r);return`nostrconnect://${e.client}?`+t.toString()}({client:bP(this.signer.key),connectSecret:this.connectSecret,relays:this.relays,metadata:e})}getNbunksec(){if(!this.remote)throw new Error("Cant create nbunksec when remote signer is not set");return mD({remote:this.remote,clientKey:LS(this.signer.key),relays:this.relays,bunkerSecret:this.bunkerSecret})}static parseBunkerURI(e){return function(e){const t=new URL(e),n=t.host||t.pathname.replace("//","");if(!uM(n))throw new Error("Invalid bunker URI: remote is not a valid hex key");const r=t.searchParams.getAll("relay");if(0===r.length)throw new Error("Invalid bunker URI: missing relays");const i=t.searchParams.get("secret")??void 0;return{remote:n,relays:r,secret:i,bunkerSecret:i}}(e)}static parseNbunksec(e){return function(e){const t=function(e){try{const{prefix:t,words:n}=pD.decode(e,!1);if("nbunksec"!==t)throw new Error(`Invalid prefix: ${t}`);const r=pD.fromWords(n);let i=0;const s={pubkey:"",local_key:"",relays:[]};for(;i<r.length;){const e=r[i],t=r[i+1];i+=2;const n=r.slice(i,i+t);switch(i+=t,e){case 0:s.pubkey=LS(n);break;case 1:s.local_key=LS(n);break;case 2:s.relays.push(gD.decode(n));break;case 3:s.secret=gD.decode(n);break;default:throw new Error(`Unknown type: ${e}`)}}return s}catch(_6){throw new Error(`Failed to decode bunker info: ${_6}`)}}(e);if(!uM(t.pubkey))throw new Error("Invalid nbunksec: remote is not a valid hex key");if(!uM(t.local_key))throw new Error("Invalid nbunksec: clientKey is not a valid hex key");if(0===t.relays.length)throw new Error("Invalid nbunksec: missing relays");return{remote:t.pubkey,clientKey:t.local_key,relays:t.relays,secret:t.secret,bunkerSecret:t.secret}}(e)}static createNbunksec(e){return mD(e)}static buildSigningPermissions(e){return function(e){return[hD.GetPublicKey,...e.map(e=>`${hD.SignEvent}:${e}`)]}(e)}static async fromBunkerURI(t,n){const{remote:r,relays:i,bunkerSecret:s}=e.parseBunkerURI(t),o=new e({relays:i,remote:r,bunkerSecret:s,...n});return await o.connect(s,n?.permissions),o}static async fromNbunksec(t,n){const{remote:r,clientKey:i,relays:s,bunkerSecret:o}=e.parseNbunksec(t),a=new e({relays:s,remote:r,signer:new yD(IS(i)),bunkerSecret:o,...n});return await a.connect(o,n?.permissions),a}},wD=Object.freeze({p:115792089237316195423570985008687907853269984665640564039457584007908834671663n,n:115792089237316195423570985008687907852837564279074904382605163141518161494337n,h:1n,a:0n,b:7n,Gx:55066263022277343669578718895168534326250603453777594175500187360389116729240n,Gy:32670510020758816978083085130507043184471273380659243275938904335757337482424n}),{p:_D,n:xD,Gx:CD,Gy:SD,b:kD}=wD,ED={publicKey:33,publicKeyUncompressed:65,signature:64,seed:48},RD=(e="",t=Error)=>{const n=new t(e),{captureStackTrace:r}=Error;throw"function"==typeof r&&r(n,RD),n},TD=(e,t,n="")=>{const r=(i=e)instanceof Uint8Array||ArrayBuffer.isView(i)&&"Uint8Array"===i.constructor.name&&1===i.BYTES_PER_ELEMENT;var i;const s=e?.length,o=void 0!==t;return!r||o&&s!==t?RD((n&&`"${n}" `)+"expected Uint8Array"+(o?` of length ${t}`:"")+", got "+(r?`length=${s}`:"type="+typeof e),r?RangeError:TypeError):e},LD=e=>new Uint8Array(e),ID=(e,t)=>e.toString(16).padStart(t,"0"),PD=e=>{let t="";for(const n of TD(e))t+=ID(n,2);return t},MD=e=>e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0,AD=e=>{const t="hex invalid";if("string"!=typeof e)return RD(t);const n=e.length,r=n/2;if(n%2)return RD(t);const i=LD(r);for(let s=0,o=0;s<r;s++,o+=2){const n=MD(e.charCodeAt(o)),r=MD(e.charCodeAt(o+1));if(void 0===n||void 0===r)return RD(t);i[s]=16*n+r}return i},OD=(...e)=>{let t=0;for(const i of e)t+=TD(i).length;const n=LD(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return n},ND=BigInt,FD=(e,t,n,r="bad number: out of range")=>"bigint"!=typeof e?RD(r,TypeError):t<=e&&e<n?e:RD(r,RangeError),DD=(e,t=_D)=>{const n=e%t;return n>=0n?n:t+n},zD=e=>e instanceof VD?e:RD("Point expected"),jD=e=>DD(DD(e*e)*e+kD),UD=e=>FD(e,0n,_D),BD=e=>FD(e,1n,_D),$D=e=>!(1n&e),qD=e=>Uint8Array.of(e),VD=class e{static BASE;static ZERO;X;Y;Z;constructor(e,t,n){this.X=UD(e),this.Y=BD(t),this.Z=UD(n),Object.freeze(this)}static CURVE(){return wD}static fromAffine(t){const{x:n,y:r}=t;return 0n===n&&0n===r?HD:new e(n,r,1n)}static fromBytes(t){TD(t);const{publicKey:n,publicKeyUncompressed:r}=ED;let i;const s=t.length,o=t[0],a=t.subarray(1),l=GD(a,0,32);if(s===n&&(2===o||3===o)){let t=(e=>{const t=jD(BD(e));let n=1n;for(let r=t,i=(_D+1n)/4n;i>0n;i>>=1n)1n&i&&(n=n*r%_D),r=r*r%_D;return DD(n*n)!==t&&RD("sqrt invalid"),$D(n)?n:DD(-n)})(l);3===o&&(t=DD(-t)),i=new e(l,t,1n)}return s===r&&4===o&&(i=new e(l,GD(a,32,64),1n)),i?i.assertValidity():RD("bad point: not on curve")}static fromHex(t){return e.fromBytes(AD(t))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}equals(e){const{X:t,Y:n,Z:r}=this,{X:i,Y:s,Z:o}=zD(e),a=DD(t*o),l=DD(i*r),c=DD(n*o),u=DD(s*r);return a===l&&c===u}is0(){return this.equals(HD)}negate(){return new e(this.X,DD(-this.Y),this.Z)}double(){return this.add(this)}add(t){const{X:n,Y:r,Z:i}=this,{X:s,Y:o,Z:a}=zD(t);let l=0n,c=0n,u=0n;const h=DD(3n*kD);let d=DD(n*s),p=DD(r*o),f=DD(i*a),g=DD(n+r),m=DD(s+o);g=DD(g*m),m=DD(d+p),g=DD(g-m),m=DD(n+i);let y=DD(s+a);return m=DD(m*y),y=DD(d+f),m=DD(m-y),y=DD(r+i),l=DD(o+a),y=DD(y*l),l=DD(p+f),y=DD(y-l),u=DD(0n*m),l=DD(h*f),u=DD(l+u),l=DD(p-u),u=DD(p+u),c=DD(l*u),p=DD(d+d),p=DD(p+d),f=DD(0n*f),m=DD(h*m),p=DD(p+f),f=DD(d-f),f=DD(0n*f),m=DD(m+f),d=DD(p*m),c=DD(c+d),d=DD(y*m),l=DD(g*l),l=DD(l-d),d=DD(g*p),u=DD(y*u),u=DD(u+d),new e(l,c,u)}subtract(e){return this.add(zD(e).negate())}multiply(e,t=!0){if(!t&&0n===e)return HD;if((e=>{FD(e,1n,xD)})(e),1n===e)return this;if(this.equals(WD))return QD(e).p;let n=HD,r=WD;for(let i=this;e>0n;i=i.double(),e>>=1n)1n&e?n=n.add(i):t&&(r=r.add(i));return n}multiplyUnsafe(e){return this.multiply(e,!1)}toAffine(){const{X:e,Y:t,Z:n}=this;if(this.equals(HD))return{x:0n,y:0n};if(1n===n)return{x:e,y:t};const r=((e,t)=>{(0n===e||t<=0n)&&RD("no inverse n="+e+" mod="+t);let n=DD(e,t),r=t,i=0n,s=1n,o=1n,a=0n;for(;0n!==n;){const e=r/n,t=r%n,l=i-o*e,c=s-a*e;r=n,n=t,i=o,s=a,o=l,a=c}return 1n===r?DD(i,t):RD("no inverse")})(n,_D);return 1n!==DD(n*r)&&RD("inverse invalid"),{x:DD(e*r),y:DD(t*r)}}assertValidity(){const{x:e,y:t}=this.toAffine();return BD(e),BD(t),DD(t*t)===jD(e)?this:RD("bad point: not on curve")}toBytes(e=!0){const{x:t,y:n}=this.assertValidity().toAffine(),r=ZD(t);return e?OD((e=>qD($D(e)?2:3))(n),r):OD(qD(4),r,ZD(n))}toHex(e){return PD(this.toBytes(e))}},WD=new VD(CD,SD,1n),HD=new VD(0n,1n,0n);VD.BASE=WD,VD.ZERO=HD;var GD=(e,t,n)=>(e=>ND("0x"+(PD(e)||"0")))(e.subarray(t,n)),KD=2n**256n,ZD=e=>AD(ID(FD(e,0n,KD),64)),YD=Math.ceil(32)+1,XD=void 0,JD=(e,t)=>{const n=t.negate();return e?n:t},QD=e=>{const t=XD||(XD=(()=>{const e=[];let t=WD,n=t;for(let r=0;r<YD;r++){n=t,e.push(n);for(let r=1;r<128;r++)n=n.add(t),e.push(n);t=n.double()}return e})());let n=HD,r=WD;const i=ND(255),s=ND(8);for(let o=0;o<YD;o++){let a=Number(e&i);e>>=s,a>128&&(a-=256,e+=1n);const l=128*o,c=l,u=l+Math.abs(a)-1,h=o%2!=0,d=a<0;0===a?r=r.add(JD(h,t[c])):n=n.add(JD(d,t[u]))}return 0n!==e&&RD("invalid wnaf"),{p:n,f:r}};function ez(e){return VD.fromHex(e).toHex().substring(2)}var tz=new TextDecoder("utf-8"),nz=new TextEncoder;function rz(e){return btoa(String.fromCharCode(...e))}function iz(e){return new Uint8Array(atob(e).split("").map(e=>e.charCodeAt(0)))}(class e{log=KO.extend("SerialPortSigner");writer=null;pubkey;get isConnected(){return!!this.writer}verifyEvent=_P;nip04;constructor(){this.nip04={encrypt:this.nip04Encrypt.bind(this),decrypt:this.nip04Decrypt.bind(this)}}lastCommand=null;async callMethodOnDevice(t,n,r={}){if(!e.SUPPORTED)throw new Error("Serial devices are not supported");if(this.writer||await this.connectToDevice(r),this.lastCommand)throw new Error("Previous command to device still pending!");const i=DF();return this.lastCommand=i,this.sendCommand(t,n),setTimeout(()=>{i.reject(new Error("Device timeout")),this.lastCommand===i&&(this.lastCommand=null)},6e3),this.lastCommand}async connectToDevice({onConnect:t,onDisconnect:n,onError:r,onDone:i}){let s,o=await window.navigator.serial.requestPort();await o.open({baudRate:9600}),await new Promise(e=>setTimeout(e,1e3)),(async()=>{for(;o&&o.readable;){const t=new window.TextDecoderStream;o.readable.pipeTo(t.writable),s=t.readable.getReader();const n=this.readFromSerialPort(s);try{for(;;){const{value:t,done:r}=await n("\n");if(t){const{method:n,data:r}=this.parseResponse(t);if("/ping"===n&&this.log("Pong"),-1===e.PUBLIC_METHODS.indexOf(n))continue;this.log("Received: ",n,r),this.lastCommand&&(this.lastCommand.resolve(r),this.lastCommand=null)}if(r)return this.lastCommand=null,this.writer=null,void(i&&i())}}catch(_6){if(_6 instanceof Error)throw this.writer=null,r&&r(_6),this.lastCommand&&(this.lastCommand.reject(_6),this.lastCommand=null),_6}}})();const a=new window.TextEncoderStream;a.readable.pipeTo(o.writable),this.writer=a.writable.getWriter(),await this.sendCommand(e.METHOD_PING),await this.sendCommand(e.METHOD_PING,[window.location.host]),t&&t(),o.addEventListener("disconnect",()=>{this.log("Disconnected"),this.lastCommand=null,this.writer=null,n&&n()})}async sendCommand(e,t=[]){if(!this.writer)return;this.log("Send command",e,t);const n=[e].concat(t).join(" ");await this.writer.write(n+"\n")}readFromSerialPort(e){let t,n=[];return async(r="\n")=>{if(n.length)return{value:n.shift().trim(),done:!1};const i=[];for(t&&(i.push(t),t=void 0);;){const{value:s,done:o}=await e.read();if(s){const e=s.split(r);if(e.length>1)return i.push(e.shift()),t=e.pop(),n=e,{value:i.join("").trim(),done:!1};i.push(s)}if(o)return{value:i.join("").trim(),done:!0}}}}parseResponse(e){const t=e.split(" ")[0];return{method:t,data:e.substring(t.length).trim()}}async nip04Encrypt(t,n){const r=IS(await this.callMethodOnDevice(e.METHOD_SHARED_SECRET,[ez(t)]));let i=Uint8Array.from(window.crypto.getRandomValues(new Uint8Array(16))),s=nz.encode(n),o=await crypto.subtle.importKey("raw",r,{name:"AES-CBC"},!1,["encrypt"]),a=await crypto.subtle.encrypt({name:"AES-CBC",iv:i},o,s);return`${rz(new Uint8Array(a))}?iv=${rz(new Uint8Array(i.buffer))}`}async nip04Decrypt(t,n){let[r,i]=n.split("?iv=");const s=IS(await this.callMethodOnDevice(e.METHOD_SHARED_SECRET,[ez(t)]));let o=await crypto.subtle.importKey("raw",s,{name:"AES-CBC"},!1,["decrypt"]),a=iz(r),l=iz(i),c=await crypto.subtle.decrypt({name:"AES-CBC",iv:l},o,a);return tz.decode(c)}async getPublicKey(){const t=await this.callMethodOnDevice(e.METHOD_PUBLIC_KEY,[]);return this.pubkey=t,t}async restore(t){await this.callMethodOnDevice(e.METHOD_RESTORE,[LS(t)])}async signEvent(t){const n=t.pubkey||this.pubkey;if(!n)throw new Error("Unknown signer pubkey");const r={...t,id:mP({...t,pubkey:n})},i=await this.callMethodOnDevice(e.METHOD_SIGN_MESSAGE,[r.id]),s={...r,sig:i,pubkey:n};if(!this.verifyEvent(s))throw new Error("Invalid signature");return s}ping(){this.sendCommand(e.METHOD_PING,[window.location.host])}static SUPPORTED="navigator"in globalThis&&!!navigator.serial;static METHOD_PING="/ping";static METHOD_LOG="/log";static METHOD_SIGN_MESSAGE="/sign-message";static METHOD_SHARED_SECRET="/shared-secret";static METHOD_PUBLIC_KEY="/public-key";static METHOD_RESTORE="/restore";static PUBLIC_METHODS=[e.METHOD_PUBLIC_KEY,e.METHOD_SIGN_MESSAGE,e.METHOD_SHARED_SECRET,e.METHOD_RESTORE]});var sz=a({isMobile:()=>oz});function oz(){return"undefined"!=typeof navigator&&/Mobi|Android|iPhone|iPad/i.test(navigator.userAgent)}var az,lz=a({default:()=>gz}),cz="marco:nostr_pubkey",uz="marco:nostr_signer_type",hz="marco:nostr_connect_local_key",dz="marco:nostr_connect_remote_pubkey",pz="marco:nostr_connect_relay",fz="wss://nostr.kosmos.org",gz=class extends pp{static{dF(this.prototype,"nostrRelay",[dp])}#ae=void fF(this,"nostrRelay");static{dF(this.prototype,"nostrData",[dp])}#F=void fF(this,"nostrData");static{dF(this.prototype,"pubkey",[Vr],function(){return null})}#le=void fF(this,"pubkey");static{dF(this.prototype,"signerType",[Vr],function(){return null})}#ce=void fF(this,"signerType");static{dF(this.prototype,"connectStatus",[Vr],function(){return null})}#ue=void fF(this,"connectStatus");static{dF(this.prototype,"connectUri",[Vr],function(){return null})}#he=void fF(this,"connectUri");_signerInstance=null;constructor(){super(...arguments),"undefined"!=typeof localStorage&&(localStorage.debug="applesauce:*");const e=localStorage.getItem(cz),t=localStorage.getItem(uz);e&&(this.pubkey=e,this.signerType=t||"extension",this._verifyPubkey())}async _verifyPubkey(){if("extension"===this.signerType){if(void 0===window.nostr)return void this.disconnect();try{const e=await(new jF).getPublicKey();e!==this.pubkey&&(this.pubkey=e,localStorage.setItem(cz,this.pubkey)),this.nostrData.loadProfile(this.pubkey)}catch(e){console.warn("Failed to verify extension nostr pubkey, logging out",e),this.disconnect()}}else if("connect"===this.signerType)try{await this._initConnectSigner()}catch(e){console.warn("Failed to verify connect nostr pubkey, logging out",e),this.disconnect()}}get isMobile(){return oz()}get isConnected(){return!!this.pubkey&&("extension"!==this.signerType||void 0!==window.nostr)}get signer(){return this._signerInstance?this._signerInstance:"extension"===this.signerType&&void 0!==window.nostr?new jF:(this.signerType,null)}async connectWithExtension(){if(void 0===window.nostr)throw new Error("No NIP-07 Nostr extension found (e.g., Alby, nos2x).");try{return this._signerInstance=new jF,this.pubkey=await this._signerInstance.getPublicKey(),this.signerType="extension",localStorage.setItem(cz,this.pubkey),localStorage.setItem(uz,"extension"),this.nostrData.loadProfile(this.pubkey),this.pubkey}catch(_6){throw console.error("Failed to get public key from extension:",_6),_6}}_getLocalSigner(){let e,t=localStorage.getItem(hz);return t?e=yD.fromKey(t):(e=new yD,t=Array.from(e.key).map(e=>e.toString(16).padStart(2,"0")).join(""),localStorage.setItem(hz,t)),e}async connectWithApp(){this.connectStatus="waiting";try{const t=this._getLocalSigner(),n=fz;localStorage.setItem(pz,n),this._signerInstance=new bD({pool:this.nostrRelay.pool,relays:[n],signer:t,onAuth:async e=>{confirm(`Your signer app requests authentication via a web page. Open it now?\n\nURL: ${e}`)&&window.open(e,"_blank")}}),this.connectUri=this._signerInstance.getNostrConnectURI({name:"Marco",url:window.location.origin,description:"An unhosted maps application.",icons:[]}),this.isMobile&&(console.debug("Mobile detected, triggering deep link intent."),window.location.href=this.connectUri),console.debug("Opening signer connection to relay..."),await this._signerInstance.open(),console.debug("Signer connection opened successfully."),console.debug("Waiting for remote signer to ack via relay...");try{await this._signerInstance.waitForSigner(),console.debug("Remote signer ack received!")}catch(e){throw console.error("Error while waiting for remote signer ack:",e),e}return this.pubkey=await this._signerInstance.getPublicKey(),this.signerType="connect",this.connectStatus="connected",localStorage.setItem(cz,this.pubkey),localStorage.setItem(uz,"connect"),localStorage.setItem(dz,this._signerInstance.remote),this.nostrData.loadProfile(this.pubkey),this.pubkey}catch(_6){throw this.connectStatus=null,console.error("Failed to connect via Nostr Connect:",_6),_6}}async _initConnectSigner(){const e=localStorage.getItem(dz),t=localStorage.getItem(pz)||fz;if(!e)throw new Error("Missing Nostr Connect remote pubkey.");const n=this._getLocalSigner();if(this._signerInstance=new bD({pool:this.nostrRelay.pool,relays:[t],signer:n,remote:e,onAuth:async e=>{confirm(`Your signer app requests authentication via a web page. Open it now?\n\nURL: ${e}`)&&window.open(e,"_blank")}}),await this._signerInstance.open(),await this._signerInstance.getPublicKey()!==this.pubkey)throw new Error("Remote signer pubkey mismatch");this.nostrData.loadProfile(this.pubkey)}async signEvent(e){if(!this.signer)throw new Error("Not connected or extension missing. Please connect Nostr again.");return await this.signer.signEvent(e)}async disconnect(){this.pubkey=null,this.nostrData?.loadProfile(null),this.signerType=null,this.connectStatus=null,this.connectUri=null,this._signerInstance&&"function"==typeof this._signerInstance.close&&await this._signerInstance.close(),this._signerInstance=null,localStorage.removeItem(cz),localStorage.removeItem(uz),localStorage.removeItem(hz),localStorage.removeItem(dz),localStorage.removeItem(pz)}};function mz(e){return Array.from(new Set(e))}function yz(e){const t={};t.kinds=mz(e.map(e=>e.kind)),t.authors=mz(e.map(e=>e.pubkey));const n=mz(e.map(e=>e.identifier).filter(e=>void 0!==e));return n.length>0&&(t["#d"]=n),t}function vz(e){const t=e.filter(e=>Px(e.kind)),n=e.filter(e=>Mx(e.kind)),r=[],i=e=>{if(0===e.length)return;const t=function(e){const t=new Set(e.map(e=>e.kind));return new Set(e.map(e=>e.pubkey)).size<t.size?function(e){const t=new Map;for(const n of e)t.has(n.pubkey)?t.get(n.pubkey).push(n):t.set(n.pubkey,[n]);return t}(e):function(e){const t=new Map;for(const n of e)t.has(n.kind)?t.get(n.kind).push(n):t.set(n.kind,[n]);return t}(e)}(e);r.push(...Array.from(t.values()).map(yz))};return i(t),i(n),r}function bz(e){return Mx(e.kind)?void 0!==e.identifier:Px(e.kind)}function wz(e,t){return function(e,t){const n=e(t);if(GA(n))return n;if(n instanceof Promise)return VA(n).pipe(UO(e=>Array.isArray(e)?VA(e):WA(e)),qO(e=>AP(e)));if(Array.isArray(n)){for(const e of n)AP(e);return VA(n)}return AP(n),WA(n)}(e,t)}function _z(e,t){return GA(e)?e.pipe(kO(1),UO(t)):t(e)}function xz(e,t,n,r,i){const s=new dA,o=new dA,a=s.pipe(e,vO(e=>e.length>0),tO(e=>t(e).pipe(BO(o),FO({resetOnRefCountZero:!1,resetOnComplete:!1,resetOnError:!1}))),BO(o),FO()),l=()=>{o.next(),o.complete(),s.complete()};return i?.signal&&(i.signal.aborted?l():i.signal.addEventListener("abort",l,{once:!0})),Object.assign(e=>new oA(t=>{const i=a.pipe(kO(1),uO(),vO(t=>n(e,t)),r??sA).subscribe(t);return s.next(e),i}),{stop:l,[Symbol.dispose]:l})}function Cz(e){return(t,n)=>function(e,t,n){if("function"==typeof e)return e(t,n);if("object"==typeof e&&"request"in e)return e.request(t,n);throw new Error("Invalid upstream pool")}(e,t,n)}function Sz(e){return(...t)=>{return n=e(...t),new oA(e=>{let t;const r=i=>{const s=i?n.next(i):n.next(),o=n=>{if(n.done)return e.complete();const i=[];GA(n.value)?t=n.value.subscribe({next:t=>{i.push(t),e.next(t)},error:t=>{e.error(t)},complete:()=>{r(i)}}):(i.push(n.value),e.next(n.value),r(i))};s instanceof Promise?s.then(o,t=>e.error(t)):o(s)};return r(),()=>t?.unsubscribe()}).pipe(FO());var n}}function kz(e,t){return n=>_z(t,t=>0===t.length?SA:e(t,vz(n)))}function Ez(e){const t={...e};return e.relays&&(t.relays=[...e.relays]),t}function Rz(e,t){return n=>_z(t,t=>e(t,[{ids:n.map(e=>e.id)}]))}function Tz(e,t){return Rz(e,[t])}function Lz(e,t=Tz){const n=new Map;return r=>{const i=function(e){let t=new Map;for(const n of e){let e=cM(n.relays,void 0);for(const r of e)t.has(r)?t.get(r)?.push(n):t.set(r,[n])}return t}(r);return fO(...Array.from(i).map(([r,i])=>(r=>{let i=n.get(r);return i||(i=t(e,r),n.set(r,i)),i})(r)(i)))}}!function(e){e.Error="error",e.Missing="missing",e.Found="found"}(az||(az={}));var Iz,Pz,Mz=(e,t)=>t.some(t=>e instanceof t),Az=new WeakMap,Oz=new WeakMap,Nz=new WeakMap,Fz={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return Az.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return zz(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Dz(e){Fz=e(Fz)}function zz(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{t(zz(e.result)),r()},s=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",s)});return Nz.set(t,e),t}(e);if(Oz.has(e))return Oz.get(e);const t=function(e){return"function"==typeof e?(t=e,(Pz||(Pz=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(jz(this),e),zz(this.request)}:function(...e){return zz(t.apply(jz(this),e))}):(e instanceof IDBTransaction&&function(e){if(Az.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),r()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});Az.set(e,t)}(e),Mz(e,Iz||(Iz=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,Fz):e);var t}(e);return t!==e&&(Oz.set(e,t),Nz.set(t,e)),t}var jz=e=>Nz.get(e),Uz=["get","getKey","getAll","getAllKeys","count"],Bz=["put","add","delete","clear"],$z=new Map;function qz(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if($z.get(t))return $z.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=Bz.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!Uz.includes(n))return;const s=async function(e,...t){const s=this.transaction(e,i?"readwrite":"readonly");let o=s.store;return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&s.done]))[0]};return $z.set(t,s),s}Dz(e=>({...e,get:(t,n,r)=>qz(t,n)||e.get(t,n,r),has:(t,n)=>!!qz(t,n)||e.has(t,n)}));var Vz=["continue","continuePrimaryKey","advance"],Wz={},Hz=new WeakMap,Gz=new WeakMap,Kz={get(e,t){if(!Vz.includes(t))return e[t];let n=Wz[t];return n||(n=Wz[t]=function(...e){Hz.set(this,Gz.get(this)[t](...e))}),n}};async function*Zz(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;const n=new Proxy(t,Kz);for(Gz.set(n,t),Nz.set(n,jz(t));t;)yield n,t=await(Hz.get(n)||t.continue()),Hz.delete(n)}function Yz(e,t){return t===Symbol.asyncIterator&&Mz(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&Mz(e,[IDBIndex,IDBObjectStore])}function Xz(e){return 0===e||3===e||e>=1e4&&e<2e4}function Jz(e){return e>=3e4&&e<4e4}function Qz(e){return e>=2e4&&e<3e4}Dz(e=>({...e,get:(t,n,r)=>Yz(t,n)?Zz:e.get(t,n,r),has:(t,n)=>Yz(t,n)||e.has(t,n)}));var ej=Symbol.for("indexable-tags");function tj(e,t){if(e.ids&&-1===e.ids.indexOf(t.id))return!1;if(e.kinds&&-1===e.kinds.indexOf(t.kind))return!1;if(e.authors&&-1===e.authors.indexOf(t.pubkey))return!1;if(e.since&&t.created_at<e.since)return!1;if(e.until&&t.created_at>e.until)return!1;const n=function(e){let t=Reflect.get(e,ej);if(!t){t=new Set;for(const n of e.tags)n.length>=2&&1===n[0].length&&t.add(n[0]+":"+n[1]);Reflect.set(e,ej,t)}return t}(t);for(const r in e)if("&"===r[0]){const t=r.slice(1),i=e[r];if(i&&i.length>0)for(const e of i)if(!n.has(t+":"+e))return!1}for(const r in e)if("#"===r[0]){const t=r.slice(1),i=e[r];if(i){const r=e[`&${t}`],s=r?i.filter(e=>!r.includes(e)):i;if(0===s.length)continue;if(!s.some(e=>n.has(t+":"+e)))return!1}}return!0}function nj(e,t){for(let n=0;n<e.length;n++)if(tj(e[n],t))return!0;return!1}var rj="abcdefghijklmnopqrstuvwxyz",ij=(rj+rj.toUpperCase()).split(""),sj=Symbol.for("event-uid");function oj(e){return e.tags.filter(e=>e.length>=2&&1===e[0].length&&ij.includes(e[0])).map(e=>e[0]+e[1])}function aj(e){if(Reflect.has(e,sj))return Reflect.get(e,sj);let t;if(Xz(e.kind)||Jz(e.kind)){const n=e.tags.find(e=>"d"===e[0])?.[1];t=e.kind+":"+e.pubkey+":"+(n??"")}else t=e.id;return Reflect.set(e,sj,t),t}async function lj(e="nostr-idb",t){return await function(e,t,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(e,t),a=zz(o);return r&&o.addEventListener("upgradeneeded",e=>{r(zz(o.result),e.oldVersion,e.newVersion,zz(o.transaction),e)}),n&&o.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),a.then(e=>{s&&e.addEventListener("close",()=>s()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a}(e,3,{...t,async upgrade(e,n,r,i,s){if(0===n){const t=e.createObjectStore("events");t.createIndex("id","event.id",{unique:!0}),t.createIndex("pubkey","event.pubkey"),t.createIndex("kind","event.kind"),t.createIndex("created_at","event.created_at"),t.createIndex("tags","tags",{multiEntry:!0}),e.createObjectStore("used",{keyPath:"uid"}).createIndex("date","date")}1===n&&(e.deleteObjectStore("events"),e.deleteObjectStore("used"),e.deleteObjectStore("seen")),n<=2&&await async function(e){const t=e.objectStore("events");let n=await t.openCursor();const r=[];for(;n;){const e=n.primaryKey,t=n.value,i=t.event;if(Xz(i.kind)||Jz(i.kind)){const n=aj(i);e!==n&&r.push({oldKey:e,newKey:n,value:t})}n=await n.continue()}for(const{oldKey:i,newKey:s,value:o}of r)await t.delete(i),await t.put(o,s)}(i),t?.upgrade&&t.upgrade(e,n,r,i,s)}})}function cj(e,t){return t.created_at-e.created_at}var uj=a({countEventsForFilters:()=>wj,getEventsForFilters:()=>bj,getIdsForFilter:()=>yj,getIdsForFilters:()=>vj,queryForKinds:()=>gj,queryForPubkeys:()=>hj,queryForTag:()=>dj,queryForTagAnd:()=>pj,queryForTime:()=>mj});function hj(e,t=[],n){const r=[],i=new Set;if(n)for(const l of t){const e=n.getPubkeyIndex(l);if(e){for(const t of e)i.add(t);r.push(l)}}if(r.length===t.length)return Promise.resolve(i);const s=e.transaction("events","readonly"),o=s.objectStore("events").index("pubkey"),a=t.filter(e=>!r.includes(e)).map(e=>o.getAllKeys(e).then(t=>((e,t)=>{for(const n of t)i.add(n);n&&n.setPubkeyIndex(e,new Set(t))})(e,t)));return s.commit(),Promise.all(a).then(()=>i)}function dj(e,t,n,r){const i=[],s=new Set;if(r)for(const c of n){const e=r.getTagIndex(t+c);if(e){for(const t of e)s.add(t);i.push(c)}}if(i.length===n.length)return Promise.resolve(s);const o=e.transaction("events","readonly"),a=o.objectStore("events").index("tags"),l=n.map(e=>a.getAllKeys(t+e).then(n=>((e,n)=>{for(const t of n)s.add(t);r&&r.setTagIndex(t+e,new Set(n))})(e,n)));return o.commit(),Promise.all(l).then(()=>s)}function pj(e,t,n,r){if(0===n.length)return Promise.resolve(new Set);if(1===n.length)return dj(e,t,n,r);const i=[],s=[];if(r)for(const c of n){const e=r.getTagIndex(t+c);e&&(s.push(e),i.push(c))}if(i.length===n.length)return Promise.resolve(fj(s));const o=e.transaction("events","readonly"),a=o.objectStore("events").index("tags"),l=n.filter(e=>!i.includes(e)).map(e=>a.getAllKeys(t+e).then(n=>((e,n)=>{const i=new Set(n);s.push(i),r&&r.setTagIndex(t+e,i)})(e,n)));return o.commit(),Promise.all(l).then(()=>fj(s))}function fj(e){if(0===e.length)return new Set;const t=e.slice().sort((e,t)=>e.size-t.size);let n=t[0];for(let r=1;r<t.length;r++){const e=t[r],i=new Set;for(const t of n)e.has(t)&&i.add(t);if(n=i,0===n.size)return n}return n}function gj(e,t=[],n){const r=[],i=new Set;if(n)for(const l of t){const e=n.getKindIndex(l);if(e){for(const t of e)i.add(t);r.push(l)}}if(r.length===t.length)return Promise.resolve(i);const s=e.transaction("events","readonly"),o=s.objectStore("events").index("kind"),a=t.filter(e=>!r.includes(e)).map(e=>o.getAllKeys(e).then(t=>((e,t)=>{for(const n of t)i.add(n);n&&n.setKindIndex(e,new Set(t))})(e,t)));return s.commit(),Promise.all(a).then(()=>i)}async function mj(e,t,n){let r;if(void 0!==t&&void 0!==n)r=IDBKeyRange.bound(t,n);else if(void 0!==t)r=IDBKeyRange.lowerBound(t);else{if(void 0===n)throw new Error("Missing since or until");r=IDBKeyRange.upperBound(n)}return(await e.getAllKeysFromIndex("events","created_at",r)).reverse()}async function yj(e,t,n){if(t.search)return new Set;if(t.ids)return new Set(t.ids);let r=null;const i=e=>{const t=e instanceof Set?e:new Set(e);if(r)for(const n of r)t.has(n)||r.delete(n);else r=t;return r};let s=null;void 0!==t.since&&(s=await mj(e,t.since,t.until),i(s));for(const o of ij){const r=t[`&${o}`],s=t[`#${o}`];if(r?.length&&i(await pj(e,o,r,n)),s?.length){const t=r?.length?s.filter(e=>!r.includes(e)):s;t.length>0&&i(await dj(e,o,t,n))}}if(t.authors&&i(await hj(e,t.authors,n)),t.kinds&&i(await gj(e,t.kinds,n)),void 0===t.since&&void 0!==t.until&&(s=await mj(e,t.since,t.until),i(s)),t.limit&&s){const e=new Set;for(const n of s){if(e.size>=t.limit)break;r.has(n)&&e.add(n)}return e}if(null===r)throw new Error("Empty filter");return r}async function vj(e,t,n){if(0===t.length)throw new Error("No Filters");let r=new Set;for(const i of t){const t=await yj(e,i,n);for(const e of t)r.add(e)}return r}async function bj(e,t,n,r){const i=await vj(e,t,n);return await async function(e,t,n,r){const i=[];let s=[];if(r)for(const d of t){const e=r.get(d);e?i.push(e):s.push(d)}else s=t;const o=e.transaction("events","readonly"),a=o.objectStore("events"),l=e=>e&&i.push(e.event),c=Array.from(s).map(e=>a.get(e).then(l));o.commit();const u=await Promise.all(c).then(()=>i.sort(cj));let h=1/0;for(const d of n)d.limit&&d.limit<h&&(h=d.limit);return u.length>h&&(u.length=h),u}(e,Array.from(i),t,r)}async function wj(e,t,n){return(await vj(e,t,n)).size}var _j=GO.default("nostr-idb"),xj=_j.extend("prune");async function Cj(e,t,n){const r=e.transaction("events","readwrite"),i=r.objectStore("events"),s=await i.get(t);if(!s)return await r.commit(),!1;if(await i.delete(t),await r.commit(),n){const e=s.event;n.removeEvent(e)}return!0}var Sj=_j.extend("WriteQueue"),kj=class{db;queuedIds=new Set;eventQueue=[];lastUsedQueue=new Set;processEvents=null;constructor(e){this.db=e}addEvent(e){const t=aj(e);this.queuedIds.has(t)||(this.eventQueue.push(e),this.queuedIds.add(t),this.touch(e))}addEvents(e){const t=e.filter(e=>!this.queuedIds.has(aj(e)));if(0!==t.length){this.eventQueue.push(...t);for(const e of t)this.queuedIds.add(aj(e));this.touch(t)}}touch(e){if(Array.isArray(e))for(const t of e)this.lastUsedQueue.add(aj(t));else this.lastUsedQueue.add(aj(e))}matchPending(e){return this.eventQueue.filter(t=>nj(e,t))}async flush(e=1e3){if(this.eventQueue.length>0){let t=[];for(let n=0;n<e;n++){const e=this.eventQueue.shift();if(!e)break;t.push(e),this.queuedIds.delete(aj(e))}this.processEvents&&(t=await this.processEvents(t)||t),await async function(e,t){const n=(t=t.filter(e=>function(e){if("object"!=typeof e||null===e)return!1;if("number"!=typeof e.kind)return!1;if("string"!=typeof e.content)return!1;if("number"!=typeof e.created_at)return!1;if("string"!=typeof e.id)return!1;if(!/^[a-f0-9]{64}$/.test(e.id))return!1;if("string"!=typeof e.pubkey)return!1;if(!/^[a-f0-9]{64}$/.test(e.pubkey))return!1;if(!Array.isArray(e.tags))return!1;for(const t of e.tags){if(!Array.isArray(t))return!1;for(const e of t)if("string"!=typeof e)return!1}return!0}(e))).filter(e=>Xz(e.kind)||Jz(e.kind)),r={};if(n.length>0){const t=e.transaction("events","readonly"),i=n.map(e=>{const n=aj(e);return t.store.get(n).then(e=>e&&(r[n]=e.event.created_at))});t.commit(),await Promise.all(i)}const i=e.transaction("events","readwrite");for(const s of t){const e=aj(s);(!r[e]||s.created_at>r[e])&&i.objectStore("events").put({event:s,tags:oj(s)},e)}await i.commit()}(this.db,t),Sj(`Wrote ${t.length} to database`),this.eventQueue.length>0&&Sj(`${this.eventQueue.length} left`)}this.lastUsedQueue.size>0&&(await async function(e,t){const n=e.transaction("used","readwrite"),r=Math.floor((new Date).valueOf()/1e3);for(const i of t)n.objectStore("used").put({uid:i,date:r});await n.commit()}(this.db,this.lastUsedQueue),this.lastUsedQueue.clear())}clear(){this.eventQueue=[]}},Ej=_j.extend("cache:indexes"),Rj=class extends Set{type;key;constructor(e,t,n){super(e),this.type=t,this.key=n}},Tj=class{kinds=new Map;pubkeys=new Map;tags=new Map;get count(){return this.kinds.size+this.pubkeys.size+this.tags.size}max=1e3;lastUsed=[];useIndex(e){const t=this.lastUsed.indexOf(e);-1!==t&&this.lastUsed.splice(t,t+1),this.lastUsed.push(e)}getKindIndex(e){const t=this.kinds.get(e);return t&&this.useIndex(t),t}setKindIndex(e,t){const n=new Rj(t,"kind",e);this.kinds.set(e,n),this.useIndex(n),this.pruneIndexes()}getPubkeyIndex(e){const t=this.pubkeys.get(e);return t&&this.useIndex(t),t}setPubkeyIndex(e,t){const n=new Rj(t,"pubkey",e);this.pubkeys.set(e,n),this.useIndex(n),this.pruneIndexes()}getTagIndex(e){const t=this.tags.get(e);return t&&this.useIndex(t),t}setTagIndex(e,t){const n=new Rj(t,"tag",e);this.tags.set(e,n),this.useIndex(n),this.pruneIndexes()}addEventToIndexes(e){const t=aj(e);this.getKindIndex(e.kind)?.add(t),this.getPubkeyIndex(e.pubkey)?.add(t);const n=oj(e);for(const r of n)this.getTagIndex(r)?.add(t)}removeEvent(e){const t=aj(e);this.getKindIndex(e.kind)?.delete(t),this.getPubkeyIndex(e.pubkey)?.delete(t);const n=oj(e);for(const r of n)this.getTagIndex(r)?.delete(t)}clear(){this.kinds.clear(),this.pubkeys.clear(),this.tags.clear(),this.lastUsed=[]}pruneIndexes(){for(;this.lastUsed.length>0&&this.lastUsed.length>this.max;){const e=this.lastUsed.shift();if(!e)return;switch(Ej(`Forgetting ${e.type}:${e.key}`),e.type){case"kind":this.kinds.delete(e.key);break;case"pubkey":this.pubkeys.delete(e.key);break;case"tag":this.tags.delete(e.key)}}}},Lj={},Ij=function(e,t){let n=Promise.resolve();if(t&&t.length>0){const e=document.getElementsByTagName("link"),i=document.querySelector("meta[property=csp-nonce]"),s=i?.nonce||i?.getAttribute("nonce");r=t.map(t=>{var n;if(n=t=function(e){return"/"+e}(t),(t=import.meta.resolve?import.meta.resolve(n):new URL(n,import.meta.url).href)in Lj)return;Lj[t]=!0;const r=t.endsWith(".css");for(let s=e.length-1;s>=0;s--){const n=e[s];if(n.href===t&&(!r||"stylesheet"===n.rel))return}const i=document.createElement("link");return i.rel=r?"stylesheet":"modulepreload",r||(i.as="script"),i.crossOrigin="",i.href=t,s&&i.setAttribute("nonce",s),document.head.appendChild(i),r?new Promise((e,n)=>{i.addEventListener("load",e),i.addEventListener("error",()=>n(new Error(`Unable to preload CSS for ${t}`)))}):void 0}),n=Promise.all(r.map(e=>Promise.resolve(e).then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))))}var r;function i(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return n.then(t=>{for(const e of t||[])"rejected"===e.status&&i(e.reason);return e().catch(i)})},Pj={batchWrite:1e3,writeInterval:100,cacheIndexes:1e3,pruneInterval:6e4,maxEvents:1e4},Mj=_j.extend("nostridb"),Aj=class{options;running=!1;writeInterval;pruneInterval;eventMap=new Map;writeQueue=null;indexCache;db=null;baseEoseTimeout=4400;subscriptions=new Map;constructor(e,t={}){this.options={...Pj,...t},e&&(this.db=e,this.writeQueue=new kj(e)),this.indexCache=new Tj,this.indexCache.max=this.options.cacheIndexes,this.start()}async getDb(){return this.db||(this.db=await lj()),this.db}async getWriteQueue(){if(this.writeQueue)return this.writeQueue;const e=await this.getDb();return this.writeQueue=new kj(e),this.writeQueue}async flush(){await(await this.getWriteQueue()).flush(),this.writeInterval=setTimeout(this.flush.bind(this),this.options.writeInterval)}async start(){if(this.running)return;Mj("Starting"),this.running=!0;const e=await this.getDb();await this.flush(),this.pruneInterval=setInterval(()=>{!async function(e,t){const n=await function(e){return e.transaction("events","readonly").store.count()}(e);if(n<=t)return;const r=n-t;if(r<=0)return;xj(`Pruning database to ${t}`);const i=(await e.getAll("used")).sort((e,t)=>e.date-t.date),s=[];let o=r;for(const u of i){if(o<=0)break;const e=u.uid;s.push(e),o--}if(0===s.length)return;const a=e.transaction("events","readwrite"),l=e.transaction("used","readwrite"),c=[];for(const u of s)c.push(a.store.delete(u)),c.push(l.store.delete(u));a.commit(),l.commit(),await Promise.all(c),xj(`Removed ${s.length} old events`)}(e,this.options.maxEvents)},this.options.pruneInterval)}async stop(){this.running&&(this.writeInterval&&(clearTimeout(this.writeInterval),this.writeInterval=void 0),this.pruneInterval&&(clearInterval(this.pruneInterval),this.pruneInterval=void 0),this.running=!1,Mj("Stopped"))}async add(e){Qz(e.kind)||((await this.getWriteQueue()).addEvent(e),this.indexCache.addEventToIndexes(e));const t=aj(e);if(!this.eventMap.has(t)){Qz(e.kind)||this.eventMap.set(t,e);for(const[t,n]of this.subscriptions)n.event&&nj(n.filters,e)&&n.event(e)}return!0}async event(e){return(await(await this.getDb()).get("events",e))?.event}async replaceable(e,t,n){return this.event([e,t,n??""].join(":"))}async count(e){const t=Array.isArray(e)?e:[e],n=await this.getDb();return await wj(n,t)}async query(e){const t=Array.isArray(e)?e:[e],n=await this.getDb(),r=(await this.getWriteQueue()).matchPending(t),i=await bj(n,t,this.indexCache,this.eventMap);this.addToEventMaps(i);const s=new Set(r.map(e=>aj(e)));return r.length>0?[...i.filter(e=>!s.has(aj(e))),...r].sort(cj):i}async*subscribe(e){const t=Array.isArray(e)?e:[e],n=[],r=new Set;let i=null,s=!1;const o=this.subscribeInternal(t,{event:e=>{const t=aj(e);if(!r.has(t)&&(r.add(t),n.push(e),i)){const e=i;i=null,e()}},complete:()=>{if(s=!0,i){const e=i;i=null,e()}}});try{for(;;){for(;n.length>0;)yield n.shift();if(s)break;await new Promise(e=>{i=e})}}finally{o.close()}}async supports(){return[]}async deleteEvent(e){const t=await this.getDb(),n=await Cj(t,e,this.indexCache);return this.eventMap.delete(e),n}async deleteReplaceable(e,t,n){const r=await this.getDb(),i=await async function(e,t,n,r,i){if(!Xz(n)&&!Jz(n))throw new Error(`Kind ${n} is not replaceable`);return await Cj(e,`${n}:${t}:${r??""}`,i)}(r,e,t,n,this.indexCache);if(i){const r=`${t}:${e}:${n??""}`;this.eventMap.delete(r)}return i}async deleteByFilters(e){const t=Array.isArray(e)?e:[e],n=await this.getDb(),r=await this.getEventIdsForFilters(t),i=await async function(e,t,n){const r=await vj(e,t,n);return await async function(e,t,n){if(0===t.length)return 0;const r=e.transaction("events","readwrite"),i=r.objectStore("events");let s=0;const o=[];for(const a of t){const e=await i.get(a);e&&(o.push(e.event),await i.delete(a),s++)}if(await r.commit(),n&&o.length>0)for(const a of o)n.removeEvent(a);return s}(e,Array.from(r),n)}(n,t,this.indexCache);if(i>0)for(const s of r)this.eventMap.delete(s);return i}async deleteAllEvents(){const e=await this.getDb();await async function(e,t){const n=e.transaction("events","readwrite");await n.objectStore("events").clear(),await n.commit(),t&&t.clear()}(e,this.indexCache),this.eventMap.clear()}async getEventIdsForFilters(e){const t=await this.getDb(),{getIdsForFilters:n}=await Ij(async()=>{const{getIdsForFilters:e}=await Promise.resolve().then(()=>uj);return{getIdsForFilters:e}},void 0),r=await n(t,e,this.indexCache);return Array.from(r)}addToEventMaps(e){for(const t of e)this.eventMap.set(aj(t),t)}subscribeInternal(e,t){const n=((e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>e+((t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),""))(),r={id:n,filters:e,closed:!1,close:()=>this.unsubscribe(n),...t};return this.subscriptions.set(n,r),this.executeSubscription(r),r}async executeSubscription(e){const t=(new Date).valueOf();Mj(`Running ${e.id}`,e.filters);const n=(await this.getWriteQueue()).matchPending(e.filters);return new Promise(async r=>{const i=await this.getDb(),s=setTimeout(()=>{e.eose&&!e.closed&&e.eose(),r()},this.baseEoseTimeout);bj(i,e.filters,this.indexCache,this.eventMap).then(i=>{if(clearTimeout(s),this.addToEventMaps(i),e.event&&!e.closed){const r=new Set(n.map(e=>aj(e))),s=n.length>0?[...i.filter(e=>!r.has(aj(e))),...n].sort(cj):i;for(const t of s)try{e.event(t)}catch(_6){Mj("event handler failed with error",_6)}const o=(new Date).valueOf()-t;Mj(`Finished ${e.id} took ${o}ms and got ${s.length} events`)}e.eose&&!e.closed&&e.eose(),r()})})}unsubscribe(e){const t=this.subscriptions.get(e);t&&(Mj(`Closing ${e}`),t.closed=!0,t.complete?.(),this.subscriptions.delete(e))}},Oj=a({excludeRequiredRelays:()=>zj,mergeRequiredRelays:()=>Dj,normalizeRelayUrl:()=>Nj,parsePlacePhotos:()=>jj,uniqNormalizedRelays:()=>Fj});function Nj(e){if(!e)return"";let t=e.trim().toLowerCase();if(!t)return"";for(t.startsWith("ws://")||t.startsWith("wss://")||(t="wss://"+t);t.endsWith("/");)t=t.slice(0,-1);return t}function Fj(e=[]){return Array.from(new Set(e.map(Nj).filter(Boolean)))}function Dj(e=[],t=[]){const n=new Set(e.filter(Boolean)),r=[...e.filter(Boolean)];for(const i of Fj(t))n.has(i)||r.push(i);return r}function zj(e=[],t=[]){const n=new Set(t.filter(Boolean));return Fj(e).filter(e=>!n.has(e))}function jj(e){if(!e||0===e.length)return[];const t=[...e].sort((e,t)=>e.created_at-t.created_at),n=[];for(const i of t){const e=i.tags.filter(e=>"t"===e[0]).map(e=>e[1]).filter(Boolean),t=i.tags.filter(e=>"imeta"===e[0]);for(const r of t){let t=null,s=null,o=null,a=!1,l=16/9,c=null,u=i.tags.find(e=>"i"===e[0])?.[1];const h=i.tags.find(e=>"published_at"===e[0])?.[1],d=h?Number(h):null;for(const e of r.slice(1))if(e.startsWith("url "))t=e.substring(4);else if(e.startsWith("thumb "))s=e.substring(6);else if(e.startsWith("blurhash "))o=e.substring(9);else if(e.startsWith("dim ")){const[t,n]=e.substring(4).split("x").map(Number);t&&n&&(l=t/n,t>n&&(a=!0))}else if(e.startsWith("alt ")){const t=e.substring(4).trim();c="A photo of a place"===t?null:t||null}t&&n.push({eventId:i.id,pubkey:i.pubkey,createdAt:i.created_at,publishedAt:d&&d>0?d:null,url:t,thumbUrl:s,blurhash:o,isLandscape:a,aspectRatio:l,placeIdentifier:u,tags:e,alt:c})}}if(0===n.length)return[];const r=n.findIndex(e=>e.isLandscape);if(r>0){const[e]=n.splice(r,1);n.unshift(e)}return n}var Uj="0123456789bcdefghjkmnpqrstuvwxyz",Bj=class e{static encode(t,n,r){if(void 0===r){for(let r=1;r<=12;r++){const i=e.encode(t,n,r),s=e.decode(i);if(s.lat==t&&s.lon==n)return i}r=12}if(t=Number(t),n=Number(n),r=Number(r),isNaN(t)||isNaN(n)||isNaN(r))throw new Error("Invalid geohash");let i=0,s=0,o=!0,a="",l=-90,c=90,u=-180,h=180;for(;a.length<r;){if(o){const e=(u+h)/2;n>=e?(i=2*i+1,u=e):(i*=2,h=e)}else{const e=(l+c)/2;t>=e?(i=2*i+1,l=e):(i*=2,c=e)}o=!o,5==++s&&(a+=Uj.charAt(i),s=0,i=0)}return a}static decode(t){const n=e.bounds(t),r=n.sw.lat,i=n.sw.lon,s=n.ne.lat,o=n.ne.lon;let a=(r+s)/2,l=(i+o)/2;return a=a.toFixed(Math.floor(2-Math.log(s-r)/Math.LN10)),l=l.toFixed(Math.floor(2-Math.log(o-i)/Math.LN10)),{lat:Number(a),lon:Number(l)}}static bounds(e){if(0==e.length)throw new Error("Invalid geohash");e=e.toLowerCase();let t=!0,n=-90,r=90,i=-180,s=180;for(let o=0;o<e.length;o++){const a=e.charAt(o),l=Uj.indexOf(a);if(-1==l)throw new Error("Invalid geohash");for(let e=4;e>=0;e--){const o=l>>e&1;if(t){const e=(i+s)/2;1==o?i=e:s=e}else{const e=(n+r)/2;1==o?n=e:r=e}t=!t}}return{sw:{lat:n,lon:i},ne:{lat:r,lon:s}}}static adjacent(t,n){if(t=t.toLowerCase(),n=n.toLowerCase(),0==t.length)throw new Error("Invalid geohash");if(-1=="nsew".indexOf(n))throw new Error("Invalid direction");const r=t.slice(-1);let i=t.slice(0,-1);const s=t.length%2;return-1!={n:["prxz","bcfguvyz"],s:["028b","0145hjnp"],e:["bcfguvyz","prxz"],w:["0145hjnp","028b"]}[n][s].indexOf(r)&&""!=i&&(i=e.adjacent(i,n)),i+Uj.charAt({n:["p0r21436x8zb9dcf5h7kjnmqesgutwvy","bc01fg45238967deuvhjyznpkmstqrwx"],s:["14365h7k9dcfesgujnmqp0r2twvyx8zb","238967debc01fg45kmstqrwxuvhjyznp"],e:["bc01fg45238967deuvhjyznpkmstqrwx","p0r21436x8zb9dcf5h7kjnmqesgutwvy"],w:["238967debc01fg45kmstqrwxuvhjyznp","14365h7k9dcfesgujnmqp0r2twvyx8zb"]}[n][s].indexOf(r))}static neighbours(t){return{n:e.adjacent(t,"n"),ne:e.adjacent(e.adjacent(t,"n"),"e"),e:e.adjacent(t,"e"),se:e.adjacent(e.adjacent(t,"s"),"e"),s:e.adjacent(t,"s"),sw:e.adjacent(e.adjacent(t,"s"),"w"),w:e.adjacent(t,"w"),nw:e.adjacent(e.adjacent(t,"n"),"w")}}},$j=a({getGeohashPrefixesInBbox:()=>qj});function qj(e){const{minLat:t,minLon:n,maxLat:r,maxLon:i}=e,s=new Set;if(Math.abs(r-t)>20||Math.abs(i-n)>20)return console.debug("BBox too large for 4-char geohash scanning, aborting fine scan."),[];for(let a=t;a<=r+.1;a+=.1)for(let e=n;e<=i+.1;e+=.1){const t=Math.min(a,r),n=Math.min(e,i);try{const e=Bj.encode(t,n,4);s.add(e)}catch(o){}}try{s.add(Bj.encode(t,n,4))}catch(o){}try{s.add(Bj.encode(r,i,4))}catch(o){}try{s.add(Bj.encode(t,i,4))}catch(o){}try{s.add(Bj.encode(r,n,4))}catch(o){}return Array.from(s)}var Vj=a({default:()=>Kj}),Wj=["wss://relay.primal.net","wss://nos.lol","wss://relay.damus.io"],Hj=["wss://nostr.kosmos.org"],Gj=[],Kj=class extends pp{static{dF(this.prototype,"nostrRelay",[dp])}#ae=void fF(this,"nostrRelay");static{dF(this.prototype,"nostrAuth",[dp])}#N=void fF(this,"nostrAuth");static{dF(this.prototype,"settings",[dp])}#D=void fF(this,"settings");store=new BN;static{dF(this.prototype,"profile",[Vr],function(){return null})}#de=void fF(this,"profile");static{dF(this.prototype,"mailboxes",[Vr],function(){return null})}#pe=void fF(this,"mailboxes");static{dF(this.prototype,"blossomServers",[Vr],function(){return[]})}#fe=void fF(this,"blossomServers");static{dF(this.prototype,"placePhotos",[Vr],function(){return[]})}#ge=void fF(this,"placePhotos");static{dF(this.prototype,"myContributionEvents",[Vr],function(){return[]})}#me=void fF(this,"myContributionEvents");static{dF(this.prototype,"profiles",[Vr],function(){return{}})}#ye=void fF(this,"profiles");_profileSub=null;_mailboxesSub=null;_blossomSub=null;_photosSub=null;_contributionsSub=null;_profileModelSubs=new Map;_requestSub=null;_cachePromise=null;_currentPlaceEntityId=null;loadedGeohashPrefixes=new Set;constructor(){super(...arguments),function(e,t,n){const r=function(e,t){const n=function(e,t){const n=Cz(e);return xz(bO(t?.bufferTime??1e3,void 0,t?.bufferSize??200),function(...e){return Sz(function*(t){if(0===(t=function(e){let t=new Map;for(let n of e){let e=t.get(n.id);e&&n.relays?e.relays?e.relays=[...e.relays,...n.relays.filter(t=>!e.relays.includes(t))]:e.relays=[...n.relays]:e||t.set(n.id,{...n})}return Array.from(t.values())}(t)).length)return;const n=new Set;let r=Array.from(t);for(const i of e)if(void 0!==i&&(yield i(r).pipe(wO(()=>SA),qO(e=>n.add(e.id))),r=r.filter(e=>!n.has(e.id)),0===r.length))return})}(t?.cacheRequest?function(e){return t=>(t=t.filter(e=>!1!==e.cache),0===t.length?SA:wz(e,[{ids:t.map(e=>e.id)}]))}(t.cacheRequest):void 0,!1!==t?.followRelayHints?Lz(n):void 0,t?.extraRelays?Rz(n,t.extraRelays):void 0),(e,t)=>t.id===e.id,null===t?.eventStore?sA:qN(t?.eventStore||new TN),{signal:t?.signal})}(e,{bufferTime:t?.bufferTime,bufferSize:t?.bufferSize,eventStore:t?.eventStore,cacheRequest:t?.cacheRequest,followRelayHints:t?.followRelayHints,extraRelays:t?.extraRelays,signal:t?.signal}),r=function(e,t){const n=Cz(e);return xz(bO(t?.bufferTime??1e3,void 0,t?.bufferSize??200),function(...e){return Sz(function*(t){if(0===(t=function(e){const t=new Map;for(const n of e){const e=MP(n.kind,n.pubkey,n.identifier);if(t.has(e)){const r=t.get(e);n.relays&&n.relays.length>0&&(r.relays?r.relays=cM(r.relays,n.relays):r.relays=n.relays),!1===n.cache&&(r.cache=!1)}else t.set(e,Ez(n))}return Array.from(t.values())}(t.filter(bz))).length)return;let n=Array.from(t);for(const r of e){if(void 0===r)continue;const e=yield r(n).pipe(wO(()=>SA)),t=new Set(e.filter(e=>IP(e.kind)).map(e=>PP(e)));if(n=n.filter(e=>!t.has(MP(e.kind,e.pubkey,e.identifier))),0===n.length)return}})}(t?.cacheRequest?function(e){return t=>(t=t.filter(e=>!1!==e.cache),0===t.length?SA:wz(e,vz(t)))}(t.cacheRequest):void 0,!1!==t?.followRelayHints?function(e){return t=>{const n=cM(...t.map(e=>e.relays));return 0===n.length?SA:e(n,vz(t))}}(n):void 0,t?.extraRelays?kz(n,t.extraRelays):void 0,t?.lookupRelays?kz(n,t.lookupRelays):void 0),(e,t)=>t.kind===e.kind&&t.pubkey===e.pubkey&&(void 0===e.identifier||OP(t)===e.identifier),null===t?.eventStore?sA:qN(t?.eventStore||new TN),{signal:t?.signal})}(e,{bufferTime:t?.bufferTime,bufferSize:t?.bufferSize,eventStore:t?.eventStore,cacheRequest:t?.cacheRequest,followRelayHints:t?.followRelayHints,extraRelays:t?.extraRelays,lookupRelays:t?.lookupRelays,signal:t?.signal}),i=()=>{n.stop(),r.stop()};return Object.assign(e=>fM(e)?n(e):r(e),{stop:i,[Symbol.dispose]:i})}(t,{...n,eventStore:e});e.eventLoader=r}(this.store,this.nostrRelay.pool,{cacheRequest:e=>this.cache?VA(this.cache.query(e)):SA,lookupRelays:Wj}),this._cachePromise=lj("applesauce-events").then(async e=>{this.cache=new Aj(e,{cacheIndexes:1e3,maxEvents:1e4}),await this.cache.start(),this._stopPersisting=function(e,t,n){const r=n?.batchTime??5e3,i=e.insert$.pipe(vO(e=>{return t=e,!(!0===Reflect.get(t,TP));var t}),n?.maxBatchSize?bO(r,void 0,n?.maxBatchSize??100):bO(r),vO(e=>e.length>0)).subscribe(e=>{t(e).then(()=>ZO(`Saved ${e.length} events to cache`)).catch(t=>ZO(`Failed to save ${e.length} events to cache`,t))});return()=>i.unsubscribe()}(this.store,async e=>{const t=e.filter(e=>0===e.kind||5===e.kind||10002===e.kind||10063===e.kind||360===e.kind);t.length>0&&await Promise.all(t.map(e=>this.cache.add(e)))},{batchTime:1e3,maxBatchSize:100})}),this.nostrRelay.pool.relays$.subscribe(()=>{})}get requiredReadRelays(){return Hj}get requiredWriteRelays(){return Gj}get mailboxReadRelays(){return(this.mailboxes?.inboxes||[]).map(Nj).filter(Boolean)}get mailboxWriteRelays(){return(this.mailboxes?.outboxes||[]).map(Nj).filter(Boolean)}get configuredReadRelays(){return zj(Fj([...this.mailboxReadRelays,...this.settings.nostrReadRelays||[]]),this.settings.nostrReadRelayExclusions||[])}get configuredWriteRelays(){return zj(Fj([...this.mailboxWriteRelays,...this.settings.nostrWriteRelays||[]]),this.settings.nostrWriteRelayExclusions||[])}get activeReadRelays(){return Dj(this.requiredReadRelays,this.configuredReadRelays)}get activeWriteRelays(){return Dj(this.requiredWriteRelays,this.configuredWriteRelays)}async loadPlacesInBounds(e){const t=qj(e).filter(e=>!this.loadedGeohashPrefixes.has(e));if(0!==t.length){console.debug("[nostr-data] Loading place photos for prefixes:",t);try{await this._cachePromise;const e=await this.cache.query([{kinds:[360],"#g":t}]);if(e&&e.length>0)for(const t of e)this.store.add(t)}catch(n){console.warn("[nostr-data] Failed to read photos from local Nostr IDB cache",n)}this.nostrRelay.pool.request(this.activeReadRelays,[{kinds:[360],"#g":t}]).subscribe({next:e=>{this.store.add(e)},error:e=>{console.error("[nostr-data] Error fetching place photos by geohash:",e)}});for(const e of t)this.loadedGeohashPrefixes.add(e)}}async loadPhotosForPlace(e){const t=e&&e.osmId&&e.osmType?`osm:${e.osmType}:${e.osmId}`:null;if((!t||t!==this._currentPlaceEntityId)&&(this._photosSub&&(this._photosSub.unsubscribe(),this._photosSub=null),this.placePhotos=[],this._clearProfileSubs(),this._currentPlaceEntityId=t,t)){this._photosSub=this.store.timeline([{kinds:[360],"#i":[t]}]).subscribe(e=>{this.placePhotos=e;const t=[...new Set(e.map(e=>e.pubkey))];this.loadProfiles(t)});try{await this._cachePromise;const e=await this.cache.query([{kinds:[360,5],"#i":[t]}]);if(e&&e.length>0)for(const t of e)this.store.add(t)}catch(n){console.warn("[nostr-data] Failed to read photos for place from local Nostr IDB cache",n)}this.nostrRelay.pool.request(this.activeReadRelays,[{kinds:[360,5],"#i":[t]}]).subscribe({next:e=>{this.store.add(e)},error:e=>{console.error("[nostr-data] Error fetching place photos for place:",e)}})}}async loadMyContributions(e){if(!e)return;this.myContributionEvents=[],this._contributionsSub&&(this._contributionsSub.unsubscribe(),this._contributionsSub=null);const t=[{kinds:[360,5],authors:[e]}];this._contributionsSub=this.store.timeline(t).subscribe(e=>{this.myContributionEvents=e});try{await this._cachePromise;const e=await this.cache.query(t);if(e&&e.length>0)for(const t of e)this.store.add(t)}catch(n){console.warn("[nostr-data] Failed to read my contributions from local Nostr IDB cache",n)}this.nostrRelay.pool.request(this.activeReadRelays,t).subscribe({next:e=>{this.store.add(e)},error:e=>{console.error("[nostr-data] Error fetching my contribution events:",e)}})}loadProfiles(e){const t=e.filter(e=>e&&!this._profileModelSubs.has(e));for(const n of t){const e=this.store.model(zN,n).subscribe(e=>{this.profiles={...this.profiles,[n]:e}});this._profileModelSubs.set(n,e)}}getProfile(e){return this.profiles[e]}_clearProfileSubs(){for(const e of this._profileModelSubs.values())e.unsubscribe();this._profileModelSubs.clear(),this.profiles={}}async loadProfile(e){if(!e)return;this.profile=null,this.mailboxes=null,this.blossomServers=[],this._cleanupSubscriptions(),this._profileSub=this.store.model(zN,e).subscribe(e=>{this.profile=e}),this._mailboxesSub=this.store.model(DN,e).subscribe(e=>{this.mailboxes=e}),this._blossomSub=this.store.replaceable(10063,e).subscribe(e=>{e&&e.tags?this.blossomServers=e.tags.filter(e=>"server"===e[0]&&e[1]).map(e=>e[1]):this.blossomServers=[]});try{await this._cachePromise;const t=await this.cache.query([{authors:[e],kinds:[0,10002,10063]}]);if(t&&t.length>0)for(const e of t)this.store.add(e)}catch(n){console.warn("Failed to read from local Nostr IDB cache",n)}const t=Array.from(new Set([...Wj,...this.activeWriteRelays]));this._requestSub=this.nostrRelay.pool.request(t,[{authors:[e],kinds:[0,10002,10063]}]).subscribe({next:e=>{this.store.add(e)},error:e=>{console.error("Error fetching profile events:",e)}})}get userDisplayName(){if(this.profile){if(this.profile.nip05)return this.profile.nip05;if(this.profile.displayName||this.profile.display_name)return this.profile.displayName||this.profile.display_name;if(this.profile.name)return this.profile.name}if(this.nostrAuth.pubkey)try{const e=function(e,t){return function(e,t){let n=bk.toWords(t);return bk.encode("npub",n,QP)}(0,t)}(0,IS(this.nostrAuth.pubkey));return`${e.slice(0,9)}...${e.slice(-4)}`}catch{return this.nostrAuth.pubkey}return"Not connected"}async clearCache(){await this._cachePromise,this.cache&&await this.cache.deleteAllEvents()}_cleanupSubscriptions(){this._requestSub&&(this._requestSub.unsubscribe(),this._requestSub=null),this._profileSub&&(this._profileSub.unsubscribe(),this._profileSub=null),this._mailboxesSub&&(this._mailboxesSub.unsubscribe(),this._mailboxesSub=null),this._blossomSub&&(this._blossomSub.unsubscribe(),this._blossomSub=null),this._photosSub&&(this._photosSub.unsubscribe(),this._photosSub=null),this._contributionsSub&&(this._contributionsSub.unsubscribe(),this._contributionsSub=null)}willDestroy(){super.willDestroy(...arguments),this._cleanupSubscriptions(),this._clearProfileSubs(),this._stopPersisting&&this._stopPersisting(),this.cache&&this.cache.stop()}};function Zj(e,t=e=>!!e){return SO(n=>{const r=t?n.pipe(e,vO(t),kO(1)):n.pipe(e,kO(1));return n.pipe(BO(r))})}function Yj(e){return wO(t=>WA({ok:!1,from:e.url,message:t?.message||"Unknown error"}))}var Xj,Jj=class e{relays$=new fA([]);status$;get relays(){if(this.relays$ instanceof fA)return this.relays$.value;throw new Error("This group was created with an observable, relays are not available")}constructor(e){this.relays$=Array.isArray(e)?new fA(e):e,this.status$=this.relays$.pipe(UO(e=>0===e.length?WA({}):fO(...e.map(e=>e.status$)).pipe(NO((e,t)=>({...e,[t.url]:t}),{}),jO({}))),zO(1))}get controlled(){return this.relays$ instanceof fA==0}has(e){if(this.controlled)throw new Error("This group was created with an observable, relays are not available");return"string"==typeof e?this.relays.some(t=>t.url===e):this.relays.includes(e)}add(e){this.has(e)||this.relays$.next([...this.relays,e])}remove(e){this.has(e)&&this.relays$.next(this.relays.filter(t=>t!==e))}internalSubscription(e){const t=new WeakMap;return this.relays$.pipe(function(e){return lA((t,n)=>{let r=null,i=!1;const s=()=>{i&&!r&&n.complete()};t.subscribe(cA(n,t=>{const i=r,o=r=cA(n,e=>n.next(e),()=>{r!==o&&null!==r||(r=null,s())});VA(e(t)).subscribe(r),i?.unsubscribe()},()=>{i=!0,s()}))})}(n=>{const r=[];for(const i of n){if(t.has(i)){r.push(t.get(i));continue}const n=e(i).pipe(wO(e=>WA({type:"ERROR",from:i.url,error:e})));r.push(n),t.set(i,n)}return fO(...r)}),FO())}internalPublish(e){const t=new WeakMap;return this.relays$.pipe(kO(1),UO(n=>{const r=[];for(const i of n){if(t.has(i)){r.push(t.get(i));continue}const n=e(i).pipe(Yj(i));r.push(n),t.set(i,n)}return fO(...r)}),FO())}req(e,t){return this.internalSubscription(n=>n.req(e,t))}event(e){return this.internalPublish(t=>t.event(e))}async negentropy(e,t,n,r){const i=(await Promise.all(this.relays.map(async e=>[e,await e.getSupported()]))).filter(([e,t])=>t?.includes(77)).map(([e])=>e);if(0===i.length)throw new Error("No relays support NIP-77 negentropy sync");if(!r?.parallel)throw new Error("Negentropy sync must be parallel (for now)");return await Promise.allSettled(i.map(i=>i.negentropy(e,t,n,r))),!0}publish(e,t){return ZA(this.internalPublish(n=>VA(n.publish(e,t))).pipe(lA(function(e,t){(function(e,t){return lA(_O(e,t,arguments.length>=2,!1,!0))})(xO,[])(e).subscribe(t)}),(n=[],lA(function(e,t){var r=!1;e.subscribe(cA(t,function(e){r=!0,t.next(e)},function(){r||t.next(n),t.complete()}))}))));var n}request(t,n){const r=n?.complete??e.completeOnAny(e.completeAfterFirstRelay(5e3),e.completeOnAllEose());return this.internalSubscription(e=>e.req(t,{...n,reconnect:n?.reconnect??e.requestReconnect})).pipe(r?Zj(r):sA,QA({first:n?.timeout??3e4}),vO(e=>"EVENT"===e.type),tO(e=>e.event),null===n?.eventStore?sA:qN(n?.eventStore??new TN),FO())}subscription(e,t){return this.internalSubscription(n=>n.req(e,{...t,reconnect:t?.reconnect??n.subscriptionReconnect})).pipe(vO(e=>"EVENT"===e.type),tO(e=>e.event),null===t?.eventStore?sA:qN(t?.eventStore??new TN),FO())}count(e,t=WP()){return this.relays$.pipe(UO(n=>aO(Object.fromEntries(n.map(n=>[n.url,n.count(e,t)])))),FO())}sync(e,t,n){return dO(async()=>{const e=(await Promise.all(this.relays.map(async e=>[e,await e.getSupported()]))).filter(([e,t])=>t?.includes(77)).map(([e])=>e);if(0===e.length)throw new Error("No relays support NIP-77 negentropy sync");return e}).pipe(UO(r=>fO(...r.map(r=>r.sync(e,t,n)))),FO())}static completeAfterFirstRelay(e=5e3){return t=>t.pipe(vO(e=>"EOSE"===e.type)).pipe(kO(1),UO(()=>pO(e)),tO(()=>!0))}static completeOnAllEose(){return e=>e.pipe(vO(e=>"OPEN"===e.type||"EOSE"===e.type||"ERROR"===e.type),NO((e,t)=>e.set(t.from,t.type),new Map),tO(e=>Array.from(e.values()).every(e=>"OPEN"!==e)))}static completeOnAny(...e){return SO(t=>fO(...e.map(e=>t.pipe(e))))}static completeOnAll(...e){return SO(t=>aO(e.map(e=>t.pipe(e))).pipe(tO(e=>e.every(e=>!!e))))}},Qj={url:"",deserializer:function(e){return JSON.parse(e.data)},serializer:function(e){return JSON.stringify(e)}},eU=function(e){function t(t,n){var r=e.call(this)||this;if(r._socket=null,t instanceof oA)r.destination=n,r.source=t;else{var i=r._config=MM({},Qj);if(r._output=new dA,"string"==typeof t)i.url=t;else for(var s in t)t.hasOwnProperty(s)&&(i[s]=t[s]);if(!i.WebSocketCtor&&WebSocket)i.WebSocketCtor=WebSocket;else if(!i.WebSocketCtor)throw new Error("no WebSocket constructor can be found");r.destination=new mA}return r}return PM(t,e),t.prototype.lift=function(e){var n=new t(this._config,this.destination);return n.operator=e,n.source=this,n},t.prototype._resetState=function(){this._socket=null,this.source||(this.destination=new mA),this._output=new dA},t.prototype.multiplex=function(e,t,n){var r=this;return new oA(function(i){try{r.next(e())}catch(RD){i.error(RD)}var s=r.subscribe({next:function(e){try{n(e)&&i.next(e)}catch(RD){i.error(RD)}},error:function(e){return i.error(e)},complete:function(){return i.complete()}});return function(){try{r.next(t())}catch(RD){i.error(RD)}s.unsubscribe()}})},t.prototype._connectSocket=function(){var e=this,t=this._config,n=t.WebSocketCtor,r=t.protocol,i=t.url,s=t.binaryType,o=this._output,a=null;try{a=r?new n(i,r):new n(i),this._socket=a,s&&(this._socket.binaryType=s)}catch(c){return void o.error(c)}var l=new $M(function(){e._socket=null,a&&1===a.readyState&&a.close()});a.onopen=function(t){if(!e._socket)return a.close(),void e._resetState();var n=e._config.openObserver;n&&n.next(t);var r=e.destination;e.destination=JM.create(function(t){if(1===a.readyState)try{var n=e._config.serializer;a.send(n(t))}catch(c){e.destination.error(c)}},function(t){var n=e._config.closingObserver;n&&n.next(void 0),t&&t.code?a.close(t.code,t.reason):o.error(new TypeError("WebSocketSubject.error must be called with an object with an error code, and an optional reason: { code: number, reason: string }")),e._resetState()},function(){var t=e._config.closingObserver;t&&t.next(void 0),a.close(),e._resetState()}),r&&r instanceof mA&&l.add(r.subscribe(e.destination))},a.onerror=function(t){e._resetState(),o.error(t)},a.onclose=function(t){a===e._socket&&e._resetState();var n=e._config.closeObserver;n&&n.next(t),t.wasClean?o.complete():o.error(t)},a.onmessage=function(t){try{var n=e._config.deserializer;o.next(n(t))}catch(RD){o.error(RD)}}},t.prototype._subscribe=function(e){var t=this,n=this.source;return n?n.subscribe(e):(this._socket||this._connectSocket(),this._output.subscribe(e),e.add(function(){var e=t._socket;0===t._output.observers.length&&(!e||1!==e.readyState&&0!==e.readyState||e.close(),t._resetState())}),e)},t.prototype.unsubscribe=function(){var t=this._socket;!t||1!==t.readyState&&0!==t.readyState||t.close(),this._resetState(),e.prototype.unsubscribe.call(this)},t}(pA),tU="auth-required:",nU={count:3,delay:(e,t)=>pO(1e3*t),resetOnSuccess:!0};function rU(e){return"number"==typeof e?{...nU,count:e}:{...nU,...e??{}}}!function(e){e[e.RECEIVE=1]="RECEIVE",e[e.SEND=2]="SEND",e[e.BOTH=3]="BOTH"}(Xj||(Xj={}));var iU=class extends Error{reason;constructor(e){super(e),this.reason=e,this.name="RelayClosedError"}},sU=class extends iU{constructor(e){super(e),this.name="AuthRequiredError"}},oU={"auth-required":sU,unsupported:iU,error:iU,blocked:iU,restricted:iU,"rate-limited":iU,pow:iU,invalid:iU,duplicate:iU,mute:iU};function aU(e){const t=oU[e.split(":")[0]];return t?new t(e):null}var lU={ids:["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"],limit:0},cU=class e{url;log=KO.extend("Relay");socket;_ready$=new fA(!0);ready$=this._ready$.asObservable();reconnectTimer;attempts$=new fA(0);connected$=new fA(!1);challenge$=new fA(null);authenticated$;authenticatedAs$;authentication$=new fA(null);authenticationResponse$=new fA(null);notices$=new fA([]);error$=new fA(null);message$;notice$;lastMessageReceivedAt=0;_lastMessageAt$=new fA(0);lastMessageAt$=this._lastMessageAt$.asObservable();status$;information$;_nip11=null;icon$;limitations$;supported$;open$=new dA;close$=new dA;closing$=new dA;reqs$=new fA({});get ready(){return this._ready$.value}get connected(){return this.connected$.value}get challenge(){return this.challenge$.value}get notices(){return this.notices$.value}get authenticated(){return!0===this.authenticationResponse?.ok}get authentication(){return this.authentication$.value}get authenticatedAs(){return this.authenticated?this.authentication?.pubkey??null:null}get authenticationResponse(){return this.authenticationResponse$.value}get information(){return this._nip11}get lastMessageAt(){return this._lastMessageAt$.value}get reqs(){return this.reqs$.value}eventTimeout=1e4;publishTimeout=3e4;keepAlive=3e4;enablePing=!1;pingFrequency=29e3;pingTimeout=2e4;subscriptionReconnect;requestReconnect;publishRetry;onUnresponsive;receivedAuthRequiredForReq=new fA(!1);receivedAuthRequiredForEvent=new fA(!1);authRequiredForRead$;authRequiredForPublish$;resetState(){null!==this.challenge$.value&&this.challenge$.next(null),this.authenticationResponse$.value&&this.authenticationResponse$.next(null),null!==this.authentication$.value&&this.authentication$.next(null),this.notices$.value.length>0&&this.notices$.next([]),this.receivedAuthRequiredForReq.value&&this.receivedAuthRequiredForReq.next(!1),this.receivedAuthRequiredForEvent.value&&this.receivedAuthRequiredForEvent.next(!1)}watchTower;internalSubscriptions=new $M;reconnectSubscription=null;destroy$=new mA(1);constructor(t,n){var r;this.url=t,this.log=this.log.extend(t),void 0!==n?.eventTimeout&&(this.eventTimeout=n.eventTimeout),void 0!==n?.publishTimeout&&(this.publishTimeout=n.publishTimeout),void 0!==n?.keepAlive&&(this.keepAlive=n.keepAlive),void 0!==n?.enablePing&&(this.enablePing=n.enablePing),void 0!==n?.pingFrequency&&(this.pingFrequency=n.pingFrequency),void 0!==n?.pingTimeout&&(this.pingTimeout=n.pingTimeout),void 0!==n?.onUnresponsive&&(this.onUnresponsive=n.onUnresponsive),this.subscriptionReconnect=rU(n?.subscriptionReconnect),this.requestReconnect=rU(n?.requestReconnect),this.publishRetry={...nU,...n?.publishRetry??{}},this.authenticated$=this.authenticationResponse$.pipe(tO(e=>!0===e?.ok)),this.authenticatedAs$=aO([this.authenticated$,this.authentication$]).pipe(tO(([e,t])=>e&&t?t.pubkey:null)),this.reconnectTimer=e.createReconnectTimer(t),this.internalSubscriptions.add(this.open$.subscribe(()=>{this.log("Connected"),this.connected$.next(!0),this.attempts$.next(0),this.error$.next(null),this.resetState()})),this.internalSubscriptions.add(this.close$.subscribe(e=>{this.connected$.value?this.log("Disconnected"):this.log("Failed to connect"),this.connected$.value&&this.connected$.next(!1),this.attempts$.next(this.attempts$.value+1),this.resetState(),e.wasClean||this.startReconnectTimer(e)})),this.socket=(r={url:t,openObserver:this.open$,closeObserver:this.close$,closingObserver:this.closing$,WebSocketCtor:n?.WebSocket},new eU(r)),this.information$=dO(()=>(this.log("Fetching NIP-11 information document"),e.fetchInformationDocument(this.url))).pipe(wO(()=>WA(null)),qO(e=>this._nip11=e),zO(1)),this.limitations$=this.information$.pipe(tO(e=>e?e.limitation:null)),this.supported$=this.information$.pipe(tO(e=>e&&Array.isArray(e.supported_nips)?e.supported_nips.filter(e=>"number"==typeof e):null)),this.icon$=this.information$.pipe(tO(e=>e?.icon||new URL("/favicon.ico",nM(this.url)).toString())),this.authRequiredForRead$=this.receivedAuthRequiredForReq,this.authRequiredForPublish$=this.receivedAuthRequiredForEvent,this.internalSubscriptions.add(this.authRequiredForRead$.pipe(vO(e=>!0===e),kO(1)).subscribe(()=>this.log("Auth required for REQ"))),this.internalSubscriptions.add(this.authRequiredForPublish$.pipe(vO(e=>!0===e),kO(1)).subscribe(()=>this.log("Auth required for EVENT"))),this.status$=aO({url:WA(this.url),connected:this.connected$,authenticated:this.authenticated$,authenticatedAs:this.authenticatedAs$,ready:this._ready$,authRequiredForRead:this.authRequiredForRead$,authRequiredForPublish:this.authRequiredForPublish$,challenge:this.challenge$.asObservable()}).pipe(zO(1));const i=this.socket.pipe(vO(e=>Array.isArray(e)&&"NOTICE"===e[0]),tO(e=>e[1]),NO((e,t)=>[...e,t],[]),qO(e=>this.notices$.next(e))),s=this.socket.pipe(vO(e=>"AUTH"===e[0]),tO(e=>e[1]),qO(e=>{this.log("Received AUTH challenge",e),this.challenge$.next(e)})),o=new dA,a=this.socket.pipe(qO(e=>{const t=Date.now();this.lastMessageReceivedAt=t,this._lastMessageAt$.next(t),o.next(e)}));this.message$=o.asObservable(),this.notice$=this.message$.pipe(vO(e=>Array.isArray(e)&&"NOTICE"===e[0]),tO(e=>e[1]));const l=this.connected$.pipe(UO(e=>e&&this.enablePing?pO(this.pingFrequency,this.pingFrequency).pipe(cO(()=>{if(Date.now()-this.lastMessageReceivedAt<this.pingFrequency)return gO;const e="ping:"+WP();return this.send(["REQ",e,lU]),this.message$.pipe(vO(t=>Array.isArray(t)&&("EOSE"===t[0]||"CLOSED"===t[0])&&t[1]===e),kO(1),QA({first:this.pingTimeout,with:()=>{const e=Date.now(),t=this.onUnresponsive?.({url:this.url,lastMessageAt:this.lastMessageReceivedAt,now:e,attempts:this.attempts$.value})??"reconnect",n=new Error(`Relay ping timeout after ${this.pingTimeout}ms`);return"reconnect"===t?(this.log("Relay connection has become unresponsive, triggering reconnect"),this.startReconnectTimer(n)):"close"===t?(this.log("Relay connection has become unresponsive, closing connection"),this.error$.next(n),this.socket.complete()):this.log("Relay connection has become unresponsive (ignoring per policy)"),gO}}),IO(()=>this.send(["CLOSE",e])))})):gO),wO(()=>gO));this.watchTower=this.ready$.pipe(UO(e=>e?fO(a,i,s,l).pipe(EO(),wO(e=>(this.startReconnectTimer(e instanceof Error?e:new Error("Connection error")),gO)),FO({resetOnRefCountZero:()=>pO(this.keepAlive).pipe(BO(this.destroy$))})):gO),FO())}startReconnectTimer(e){this.ready&&(this.error$.next(e instanceof Error?e:new Error("Connection error")),this._ready$.next(!1),this.reconnectSubscription?.unsubscribe(),this.reconnectSubscription=this.reconnectTimer(e,this.attempts$.value).pipe(kO(1)).subscribe(()=>{this.reconnectSubscription=null,this._ready$.next(!0)}))}waitForAuth(e,t){return aO([e,this.authenticated$]).pipe(MO(this.watchTower),vO(([e,t])=>!e||t),kO(1),UO(()=>t))}waitForReady(e){return this.ready?e:this.ready$.pipe(vO(e=>e),kO(1),UO(()=>e))}multiplex(e,t,n){return this.socket.multiplex(e,t,n)}send(e){this.socket.next(e)}req(e,t){const n=t?.id??WP(),r=t?.waitForAuth??!0;let i;if("function"==typeof e){const t=e(this);i=(GA(t)?t:fO(WA(t),gO)).pipe(tO(e=>Array.isArray(e)?e:[e]))}else i=(GA(e)?e:fO(WA(e),gO)).pipe(tO(e=>Array.isArray(e)?e:[e]));const s=i.pipe(EO(),LO(!0));let o=!1,a=!1;const l=this.socket.pipe(vO(e=>Array.isArray(e)&&("EVENT"===e[0]||"CLOSED"===e[0]||"EOSE"===e[0])&&e[1]===n),tO(e=>"EVENT"===e[0]&&"object"==typeof e[2]?{type:"EVENT",from:this.url,id:e[1],event:e[2]}:"CLOSED"===e[0]?{type:"CLOSED",from:this.url,id:e[1],reason:e[2]??""}:{type:"EOSE",from:this.url,id:e[1]}),qO(e=>{if("CLOSED"===e.type){o=!0;const t=aU(e.reason);if(t)throw t;a=!0}}),$O(e=>"CLOSED"!==e.type,!0),FO()),c=i.pipe(tO(e=>(o=!1,a=!1,this.socket.next(["REQ",n,...e]),this.reqs$.next({...this.reqs$.value,[n]:e}),{type:"OPEN",id:n,filters:e,from:this.url})),IO(()=>{o||this.socket.next(["CLOSE",n]);const{[n]:e,...t}=this.reqs$.value;this.reqs$.next(t)}),UO(e=>l.pipe(jO(e)))),u=fO(this.watchTower,c).pipe(BO(l.pipe(EO(),LO(!0))),BO(s),qO(e=>{"EVENT"===e.type&&oM(e.event,this.url)}),FO()),h=r?this.waitForAuth(this.authRequiredForRead$,u):u;return dO(()=>this.waitForReady(h)).pipe(OO({delay:e=>e instanceof sU?(this.log("Auth required for REQ"),this.receivedAuthRequiredForReq.next(!0),r?this.authenticated$.pipe(vO(e=>e),kO(1)):HA(()=>e)):HA(()=>e)}),this.customConnectionRetryOperator(t?.reconnect),this.customRepeatOperator(t?.resubscribe,()=>a),FO())}count(e,t=WP()){let n=!1;const r=this.socket.pipe(vO(e=>Array.isArray(e)&&("COUNT"===e[0]||"CLOSED"===e[0])&&e[1]===t),tO(e=>{if("COUNT"===e[0])return e[2];if("CLOSED"===e[0]){n=!0;const t=aU(e[2]??"");if(t)throw t}return null}),$O(e=>null!==e,!0),vO(e=>null!==e),FO()),i=dO(()=>(n=!1,this.socket.next(Array.isArray(e)?["COUNT",t,...e]:["COUNT",t,e]),r)).pipe(IO(()=>{n||this.socket.next(["CLOSE",t])})),s=fO(this.watchTower,i).pipe(BO(r.pipe(EO(),LO(!0))),kO(1),wO(e=>(e instanceof sU&&!this.receivedAuthRequiredForReq.value&&(this.log("Auth required for COUNT"),this.receivedAuthRequiredForReq.next(!0)),HA(()=>e))),QA({first:1e4,with:()=>HA(()=>new Error("COUNT timeout"))}));return this.waitForReady(this.waitForAuth(this.authRequiredForRead$,s)).pipe(FO())}event(e,t="EVENT"){const n=dO(()=>(this.socket.next([t,e]),this.socket.pipe(vO(t=>"OK"===t[0]&&t[1]===e.id),tO(e=>({ok:e[2],message:e[3],from:this.url}))))).pipe(FO()),r=fO(this.watchTower,n).pipe(BO(n.pipe(EO(),LO(!0))),kO(1),qO(({ok:e,message:t})=>{!1===e&&t?.startsWith(tU)&&!this.receivedAuthRequiredForEvent.value&&(this.log("Auth required for publish"),this.receivedAuthRequiredForEvent.next(!0))}),QA({first:this.eventTimeout,with:()=>WA({ok:!1,from:this.url,message:"Timeout"})}));return"AUTH"===t?this.waitForReady(r).pipe(FO()):this.waitForReady(this.waitForAuth(this.authRequiredForPublish$,r)).pipe(FO())}auth(e){return this.authentication$.next(e),ZA(this.event(e,"AUTH").pipe(qO(e=>this.authenticationResponse$.next(e))))}async negentropy(e,t,n,r){if(!1===(await this.getSupported())?.includes(77))throw new Error("Relay does not support NIP-77");const{buildStorageVector:i,buildStorageFromFilter:s,negentropySync:o}=await Ij(async()=>{const{buildStorageVector:e,buildStorageFromFilter:t,negentropySync:n}=await import("./negentropy-YVHJ2Mgy.js");return{buildStorageVector:e,buildStorageFromFilter:t,negentropySync:n}},[]);return o(Array.isArray(e)?i(e):await s(e,t),this.socket,t,n,r)}authenticate(e){if(!this.challenge)throw new Error("Have not received authentication challenge");const t=e.signEvent(function(e,t){return{kind:22242,created_at:Math.floor(Date.now()/1e3),tags:[["relay",e],["challenge",t]],content:""}}(this.url,this.challenge));return ZA((t instanceof Promise?VA(t):WA(t)).pipe(UO(e=>this.auth(e))))}customRetryOperator(e,t){return!1===e||void 0===e?sA:"number"==typeof e?OO({...t,count:e}):!0===e?t?OO(t):OO():OO({...t,...e})}customConnectionRetryOperator(e,t){if(!1===e||void 0===e)return sA;const n="number"==typeof e?{...t,count:e}:!0===e?t??{}:{...t,...e};return OO({...n,delay:(e,t)=>e instanceof iU?HA(()=>e):"number"==typeof n.delay?pO(n.delay):"function"==typeof n.delay?n.delay(e,t):WA(null)})}customRepeatOperator(e,t){if(!1===e||void 0===e)return sA;const n=n=>{if(t&&!t())return SA;if("object"==typeof e){if("number"==typeof e.delay)return pO(e.delay);if("function"==typeof e.delay)return e.delay(n)}return WA(null)};return AO(!0===e?{delay:n}:"number"==typeof e?{count:e,delay:n}:{...e,delay:n})}customTimeoutOperator(e,t){return!1===e?sA:WN(!0===e?t:e??t)}subscription(e,t){return this.req(e,{...t,reconnect:t?.reconnect??this.subscriptionReconnect}).pipe(vO(e=>"EOSE"===e.type||"EVENT"===e.type),tO(e=>"EOSE"===e.type?"EOSE":e.event),FO())}request(e,t){return this.req(e,{...t,reconnect:t?.reconnect??this.requestReconnect}).pipe(t?.complete?Zj(t?.complete):sA,QA({first:t?.timeout??3e4}),$O(e=>"EOSE"!==e.type),vO(e=>"EVENT"===e.type),tO(e=>e.event),FO())}publish(e,t){return ZA(this.event(e).pipe(cO(e=>!1===e.ok&&e.message?.startsWith(tU)?HA(()=>new sU(e.message??"")):WA(e)),this.customRetryOperator(t?.retries??t?.reconnect??!0,this.publishRetry),this.customTimeoutOperator(t?.timeout,this.publishTimeout)))}sync(e,t,n=Xj.RECEIVE){return new oA(r=>{const i=new AbortController;let s=!1;return this.negentropy(e,t,async(t,i)=>{if(n&Xj.SEND&&t.length>0){const n=await(async t=>Array.isArray(e)?e.filter(e=>t.includes(e.id)):e.getByFilters({ids:t}))(t);await Promise.allSettled(n.map(async e=>{const t=await ZA(this.event(e));return t.ok&&oM(e,this.url),t}))}n&Xj.RECEIVE&&i.length>0&&await ZA(this.req({ids:i}).pipe($O(e=>"EOSE"!==e.type),vO(e=>"EVENT"===e.type),tO(e=>e.event),Reflect.has(e,"add")?$N(e):sA,qO(e=>r.next(e))))},{signal:i.signal}).then(()=>{s||r.complete()}).catch(e=>{s||r.error(e)}),()=>{s||(s=!0,i.abort())}}).pipe(FO())}close(){this.destroy$.next(),this.destroy$.complete(),this.reconnectSubscription?.unsubscribe(),this.reconnectSubscription=null,this.internalSubscriptions.unsubscribe(),this.connected$.value&&this.connected$.next(!1),this._ready$.next(!1),this._ready$.complete(),this.socket.unsubscribe()}async getInformation(){return YA(this.information$)}async getLimitations(){return YA(this.limitations$)}async getSupported(){return YA(this.supported$)}static fetchInformationDocument(e){return VA(fetch(nM(e),{headers:{Accept:"application/nostr+json"}}).then(e=>e.json())).pipe(wO(()=>WA(null)),WN(1e4))}static createReconnectTimer(e){return(e,t=0)=>pO(Math.min(1e3*Math.pow(1.5,t),3e5))}static afterOpen(e){return t=>t.pipe(vO(e=>"OPEN"===e.type),UO(()=>t.pipe(e)))}static completeOr(...e){return t=>aO(e.map(e=>t.pipe(e,jO(!1)))).pipe(tO(e=>e.some(e=>!!e)))}static completeAnd(...e){return t=>aO(e.map(e=>t.pipe(e,jO(!1)))).pipe(tO(e=>e.every(e=>!!e)))}static defaultComplete(e,t=1e4){return this.completeOr(()=>pO(e),this.afterOpen(()=>pO(t)))}},uU=class{options;relays$=new fA(new Map);get relays(){return this.relays$.value}status$;ignoreOffline=!1;add$=new dA;remove$=new dA;constructor(e){this.options=e,this.status$=this.relays$.pipe(tO(e=>Array.from(e.values())),UO(e=>0===e.length?WA({}):fO(...e.map(e=>e.status$)).pipe(NO((e,t)=>({...e,[t.url]:t}),{}),jO({}))),zO(1))}relay(e){e=rM(e);let t=this.relays.get(e);return t||(t=new cU(e,this.options),this.relays.set(e,t),this.relays$.next(this.relays),this.add$.next(t),t)}group(e,t=this.ignoreOffline){let n=Array.isArray(e)?e.map(e=>this.relay(e)):e.pipe(tO(e=>e.map(e=>this.relay(e))));return t&&(n=(Array.isArray(n)?WA(n):n).pipe(UO(e=>0===e.length?WA([]):aO(e.map(e=>e.ready$.pipe(vO(e=>e),kO(1),tO(()=>e),jO(null)))).pipe(tO(e=>e.filter(e=>null!==e)))))),new Jj(n)}remove(e,t=!0){let n;if("string"==typeof e){if(n=this.relays.get(e),!n)return}else{if(!Array.from(this.relays.values()).some(t=>t===e))return;n=e}t&&n?.close(),this.relays.delete(n.url),this.relays$.next(this.relays),this.remove$.next(n)}close(){for(const e of[...this.relays.values()])this.remove(e,!0)}req(e,t,n){return this.group(e).req(t,n)}event(e,t){return this.group(e).event(t)}negentropy(e,t,n,r,i){return this.group(e).negentropy(t,n,r,i)}publish(e,t,n){return this.group(e).publish(t,n)}request(e,t,n){return this.group(e).request(t,n)}subscription(e,t,n){return this.group(e).subscription(t,n)}subscriptionMap(e,t){const n=GA(e)?e:WA(e);return this.group(n.pipe(tO(e=>Object.keys(e)))).subscription(e=>n.pipe(tO(t=>t[e.url]),RO(oN)),t)}outboxSubscription(e,t,n){const r=GA(e)?e.pipe(tO(e=>gN(e,t))):gN(e,t);return this.subscriptionMap(r,n)}count(e,t,n){return this.group(e,!1).count(t,n)}sync(e,t,n,r){return this.group(e,!1).sync(t,n,r)}},hU=a({default:()=>dU}),dU=class extends pp{pool=new uU({enablePing:!0});async publish(e,t){if(!e||0===e.length)throw new Error("No relays provided to publish the event.");const n=await this.pool.publish(e,t);if(!n.some(e=>e.ok))throw new Error(`Failed to publish event. Responses: ${JSON.stringify(n)}`);return n}},pU=class{},fU=class extends pU{constructor(e){super(),this.message=e}},gU=class extends pU{},mU=class extends pU{},yU=class extends pU{},vU=class extends pU{},bU=class extends pU{},wU=class extends pU{},_U={invalid_request:class extends pU{},invalid_grant:class extends bU{},unauthorized_client:class extends vU{},access_denied:class extends vU{},unsupported_response_type:class extends vU{},invalid_scope:class extends pU{},server_error:class extends vU{},temporarily_unavailable:class extends vU{},invalid_client:class extends bU{},unsupported_grant_type:class extends bU{},invalid_token:class extends pU{}},xU=e=>{const t=_U[e];return t?new t:new fU(e)},CU="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",SU=e=>{const t=e.slice(7).replace(/"/g,"").split(",").map(e=>{const[t,n]=e.trim().split("=");return{[t]:n}}).reduce((e,t)=>({...e,...t}),{});return{realm:t.realm,error:t.error,errorDescription:t.error_description,errorUri:t.error_uri}},kU=e=>{let t=btoa(e);return t=t.replace(/\+/g,"-"),t=t.replace(/\//g,"_"),t=t.replace(/=/g,""),t},EU=(e,t)=>{let n=t.split("?");if(n.length<2)return;n=n[1].split("#");const r=n[0].split("&");for(const i of r){const[t,n]=i.split("=");if(t===e)return decodeURIComponent(n)}},RU=e=>Object.entries(e).map(([e,t])=>`${e}=${encodeURIComponent(t)}`).join("&"),TU="WWW-Authenticate",LU=class{constructor(e,t){this.state={},this.config=e,this.storage=t||PU,this.ready=new Promise(e=>this.setReady=e),this.recoverState()}async reset(){this.state={},await this.saveState(),this.authCodeForAccessTokenPromise=void 0,this.refreshTokenForAccessTokenPromise=void 0}async requestAuthorizationCode(e){const{clientId:t,extraAuthorizationParams:n,redirectUrl:r,scopes:i}=this.config,{codeChallenge:s,codeVerifier:o}=await(async()=>{const e=new Uint32Array(96);crypto.getRandomValues(e);const t=kU(Array.from(e).map(e=>CU[e%66]).join("")),n=await crypto.subtle.digest("SHA-256",(new TextEncoder).encode(t)),r=new Uint8Array(n);let i="";const s=r.byteLength;for(let o=0;o<s;o++)i+=String.fromCharCode(r[o]);return{codeChallenge:kU(i),codeVerifier:t}})(),a=(()=>{const e=new Uint32Array(32);return crypto.getRandomValues(e),Array.from(e).map(e=>CU[e%66]).join("")})();this.state={...this.state,codeChallenge:s,codeVerifier:o,stateQueryParam:a},await this.saveState();let l=this.config.authorizationUrl+`?response_type=code&client_id=${encodeURIComponent(t)}&redirect_uri=${encodeURIComponent(r)}&state=${a}&code_challenge=${encodeURIComponent(s)}&code_challenge_method=S256`;if(i&&(l+=`&scope=${encodeURIComponent(i.join(" "))}`),n||e){const t={...n,...e};l+=`&${RU(t)}`}location.replace(l)}isReturningFromAuthServer(){return!!EU("code",location.href)}async receiveCode(){await this.ready;const e=EU("error",location.href);if(e)throw xU(e);if(EU("state",location.href)!==this.state.stateQueryParam)throw console.warn('"state" parameter doesn\'t match the one sent! Possible malicious activity.'),new yU;if(this.state.authorizationCode=EU("code",location.href),!this.state.authorizationCode)throw new mU;this.saveState()}async getTokens(e){const{accessToken:t,authorizationCode:n,idToken:r,refreshToken:i,scopes:s}=this.state;if(n)return this.exchangeAuthCodeForAccessToken(e);if(!t)throw new gU;if(this.isAccessTokenExpired()){if(this.config.onAccessTokenExpiry)return this.config.onAccessTokenExpiry();throw new wU}return Promise.resolve({accessToken:t,idToken:r,refreshToken:i,scopes:s})}async exchangeAuthCodeForAccessToken(e){this.authCodeForAccessTokenPromise||(this.authCodeForAccessTokenPromise=this.fetchAccessTokenUsingCode(e));const t=await this.authCodeForAccessTokenPromise;return this.authCodeForAccessTokenPromise=void 0,this.state.authorizationCode=void 0,this.setTokens(t)}async exchangeRefreshTokenForAccessToken(){this.refreshTokenForAccessTokenPromise||(this.refreshTokenForAccessTokenPromise=this.fetchAccessTokenUsingRefreshToken());const e=await this.refreshTokenForAccessTokenPromise;return this.refreshTokenForAccessTokenPromise=void 0,this.setTokens(e)}makeRetryFetchFunction(e){return async(t,...n)=>{const r=await e(t,...n);if(401===r.status){const i=r.headers.get(TU.toLowerCase());if(i&&"invalid_token"===SU(i).error)return await this.exchangeRefreshTokenForAccessToken(),t=await this.requestInterceptor(t),e(t,...n)}return r}}decorateFetchWithInterceptors(e){return async(t,...n)=>{"string"==typeof t&&(t=new Request(t)),t=await this.requestInterceptor(t);const r=await e(t,...n);return this.responseInterceptor(r)}}async requestInterceptor(e){const t=await this.getTokens();return e.headers.set("Authorization",`Bearer ${t.accessToken}`),e}async responseInterceptor(e){if(401!==e.status)return e;const t=e.headers.get(TU.toLowerCase());if(t){const e=SU(t).error;throw"invalid_grant"===e&&this.config.onInvalidGrant&&await this.config.onInvalidGrant(),"invalid_token"===e&&this.config.onInvalidToken&&await this.config.onInvalidToken(),xU(e)}return e}getGrantedScopes(){return this.state.scopes}isAuthorized(){return!!this.state.accessToken}isAccessTokenExpired(){const{accessTokenExpiry:e}=this.state;return Boolean(e&&new Date>=new Date(e))}async fetchAccessTokenUsingCode(e){const{authorizationCode:t,codeVerifier:n=""}=this.state,{clientId:r,redirectUrl:i}=this.config;n?t||console.warn("No authorization grant code is being passed."):console.warn("No code verifier is being sent.");const s=this.config.tokenUrl,o={grant_type:"authorization_code",code:t,redirect_uri:i,client_id:r,code_verifier:n,...e},a=new URLSearchParams(o).toString();return this.makeTokenRequest(s,a)}fetchAccessTokenUsingRefreshToken(){const{extraRefreshParams:e,clientId:t,tokenUrl:n}=this.config,{refreshToken:r}=this.state;r||console.warn("No refresh token is present.");const i=n;let s=`grant_type=refresh_token&refresh_token=${r}&client_id=${t}`;return e&&(s=`${s}&${RU(e)}`),this.makeTokenRequest(i,s)}async makeTokenRequest(e,t){const n=await fetch(e,{method:"POST",body:t,headers:{"Content-Type":"application/x-www-form-urlencoded"}}),r=await n.json();if(!n.ok)throw"invalid_grant"===r.error&&this.config.onInvalidGrant&&await this.config.onInvalidGrant(),xU(r.error);const{access_token:i,expires_in:s,id_token:o,refresh_token:a,scope:l}=r;return{accessToken:i,expiresIn:s,idToken:o,refreshToken:a,scope:l}}async setTokens(e){const{accessToken:t,expiresIn:n,idToken:r,refreshToken:i,scope:s}=e;return this.state.accessToken=t,n&&(this.state.accessTokenExpiry=new Date(Date.now()+1e3*parseInt(n,10)).toString()),r&&(this.state.idToken=r),i&&(this.state.refreshToken=i),s&&(this.state.scopes=s.split(" ")),await this.saveState(),{accessToken:this.state.accessToken,idToken:this.state.idToken,refreshToken:this.state.refreshToken,scopes:s?this.state.scopes:[]}}async recoverState(){this.state=JSON.parse(await this.storage.loadState()||"{}"),this.setReady(),this.config.storeRefreshToken||(this.state.refreshToken=this.refreshToken)}async saveState(){this.refreshToken=this.state.refreshToken;const e={...this.state};this.config.storeRefreshToken||delete e.refreshToken,await this.storage.saveState(JSON.stringify(e))}},IU="oauth2authcodepkce-state",PU={saveState:e=>localStorage.setItem(IU,e),loadState:()=>localStorage.getItem(IU)},MU=a({default:()=>OU}),AU=class{saveState(e){localStorage.setItem("marco:osm_auth_state",e)}loadState(){const e=localStorage.getItem("marco:osm_auth_state");if(!e)return!1;try{return JSON.parse(e),e}catch(t){return console.warn("Failed to parse OSM auth state",t),!1}}},OU=class extends pp{static{dF(this.prototype,"isConnected",[Vr],function(){return!1})}#ve=void fF(this,"isConnected");static{dF(this.prototype,"userDisplayName",[Vr],function(){return null})}#be=void fF(this,"userDisplayName");oauthClient;constructor(){super(...arguments);const e="https://www.openstreetmap.org",t=`${window.location.origin}/oauth/osm/callback`;this.oauthClient=new LU({scopes:["read_prefs","write_api"],authorizationUrl:`${e}/oauth2/authorize`,tokenUrl:`${e}/oauth2/token`,clientId:"jIn8l5mT8FZOGYiIYXG1Yvj_2FZKB9TJ1edZwOJPsRU",redirectUrl:t,storeRefreshToken:!0,onAccessTokenExpiry(){return this.exchangeRefreshTokenForAccessToken()}},new AU),this.restoreSession()}async restoreSession(){try{await this.oauthClient.ready}catch(e){console.warn("oauthClient.ready failed",e)}if(await this.oauthClient.isAuthorized()){this.isConnected=!0;const e=localStorage.getItem("marco:osm_user_display_name");e?this.userDisplayName=e:await this.fetchUserInfo()}}async login(){await this.oauthClient.requestAuthorizationCode()}async handleCallback(){await this.oauthClient.receiveCode(),await this.oauthClient.getTokens(),this.isConnected=!0,await this.fetchUserInfo()}async logout(){await this.oauthClient.reset(),this.isConnected=!1,this.userDisplayName=null,localStorage.removeItem("marco:osm_user_display_name")}async fetchUserInfo(){try{const e=await this.oauthClient.getTokens(),t=await fetch("https://api.openstreetmap.org/api/0.6/user/details.json",{headers:{Authorization:`Bearer ${e.accessToken}`}});if(t.ok){const e=await t.json();console.debug("OSM data:",e);const n=e.user.display_name;this.userDisplayName=n,localStorage.setItem("marco:osm_user_display_name",n)}else console.error("Failed to fetch OSM user info",t.status)}catch(e){console.error("Error fetching OSM user info",e)}}},NU=a({capitalize:()=>DU,formatRelativeDate:()=>zU,humanizeOsmTag:()=>FU});function FU(e){return"string"==typeof e&&e?e.replace(/[_-]/g," ").replace(/\w\S*/g,e=>e.replace(/^\w/,e=>e.toUpperCase())):""}function DU(e){return"string"==typeof e&&e?e.charAt(0).toUpperCase()+e.slice(1):""}function zU(e){if(!e)return"";const t=new Date(1e3*e),n=new Date-t,r=Math.floor(n/6e4),i=Math.floor(r/60),s=Math.floor(i/24);return r<1?"just now":r<60?`${r} min ago`:i<24?`${i} hr ago`:s<7?`${s} day${1===s?"":"s"} ago`:t.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}var jU=a({getLocalizedName:()=>UU,getPlaceType:()=>$U});function UU(e,t="Untitled Place"){if(!e)return t;const n=navigator.languages||[navigator.language||"en"];for(const r of n){if(!r)continue;const t=`name:${r.split("-")[0]}`;if(e[t])return e[t]}return e.name?e.name:e["name:en"]?e["name:en"]:t}var BU=["amenity","shop","tourism","historic","leisure","office","craft","building","landuse","public_transport","highway","aeroway","waterway","natural","place","border_type","admin_title"];function $U(e){if(!e)return null;let t=null;for(const n of BU){const r=e[n];if(r){if("yes"===r){t||(t=n);continue}return FU(r)}}return t?FU(t):null}var qU=a({POI_CATEGORIES:()=>VU,getCategoryById:()=>WU}),VU=[{id:"restaurants",label:"Restaurants",icon:"fork-and-knife",filter:['["amenity"~"^(restaurant|fast_food|food_court|pub|cafe)$"]["cuisine"!~"coffee"]'],types:["node","way"]},{id:"coffee",label:"Coffee",icon:"cup-and-saucer",filter:['["amenity"~"^(cafe|ice_cream)$"]','["shop"~"^(coffee|tea)$"]','["cuisine"~"coffee_shop"]'],types:["node","way"]},{id:"groceries",label:"Groceries",icon:"shopping-basket",filter:['["shop"~"^(supermarket|convenience|grocery|greengrocer|bakery|butcher|deli|farm|seafood)$"]'],types:["node","way"]},{id:"things-to-do",label:"Things to do",icon:"feather-camera",filter:['["tourism"~"^(museum|gallery|attraction|viewpoint|zoo|theme_park|aquarium|artwork|information)$"]','["amenity"~"^(cinema|theatre|arts_centre|planetarium)$"]','["leisure"~"^(sports_centre|stadium|water_park)$"]','["historic"]','["shop"="flea_market"]'],types:["node","way","relation"]},{id:"accommodation",label:"Hotels",icon:"person-sleeping-in-bed",filter:['["tourism"~"^(hotel|hostel|motel|chalet|guest_house)$"]'],types:["node","way","relation"]}];function WU(e){return VU.find(t=>t.id===e)}var HU,GU=a({default:()=>KU}),KU=class e extends pp{static{dF(this.prototype,"settings",[dp])}#D=void fF(this,"settings");static{dF(this.prototype,"localForage",[dp])}#$=void fF(this,"localForage");controller=null;cachedResults=null;lastQueryKey=null;cachedPlaces=new Map;static STORE_NAME="osm-cache";static CACHE_TTL_MS=6048e5;static IN_MEMORY_TTL_MS=1e4;_buildCacheKey(e,t){return`${e}:${t}`}async _readLocalCache(t,n){const r=this._buildCacheKey(t,n);try{const t=await this.localForage.get(e.STORE_NAME,r);if(!t)return null;const n="string"==typeof t?JSON.parse(t):t;return!n||"number"!=typeof n.timestamp||Date.now()-n.timestamp>e.CACHE_TTL_MS?(await this.localForage.remove(e.STORE_NAME,r),null):n.data}catch{try{await this.localForage.remove(e.STORE_NAME,r)}catch{}return null}}async _writeLocalCache(t,n,r){if(!r)return;const i=this._buildCacheKey(t,n);try{await this.localForage.set(e.STORE_NAME,i,{data:r,timestamp:Date.now()})}catch(s){console.debug("[osm] Failed to write IndexedDB cache entry",s)}}async getCachedOsmObject(t,n){if(!t||!n)return null;const r=this._buildCacheKey(t,n),i=this.cachedPlaces.get(r);return i&&Date.now()-i.timestamp<e.IN_MEMORY_TTL_MS?i.data:this._readLocalCache(t,n)}_storeInMemoryAndLocalStorage(t,n,r,i){i&&i.title?(this.cachedPlaces.set(t,{data:i,timestamp:Date.now()}),setTimeout(()=>{this.cachedPlaces.delete(t)},e.IN_MEMORY_TTL_MS),this._writeLocalCache(n,r,i)):console.debug(`[osm] Skipping cache write for ${t}: data has no title`)}cancelAll(){this.controller&&(this.controller.abort(),this.controller=null)}async getNearbyPois(e,t,n=50){const r=`${e},${t},${n}`;if(this.lastQueryKey===r&&this.cachedResults)return console.debug("Returning cached Overpass results for:",r),this.cachedResults;this.controller&&this.controller.abort(),this.controller=new AbortController;const i=this.controller.signal,s=[`~"^(${["amenity","shop","tourism","historic","leisure","office","craft","building","landuse","public_transport","aeroway"].join("|")})$"~".*"`],o=Object.entries({public_transport:["stop_area","platform"]}).map(([e,t])=>`["${e}"!~"^(${t.join("|")})$"]`).join(""),a=`\n[out:json][timeout:25];\n(\n node(around:${n},${e},${t})\n [${s}]${o}[~"^name"~"."];\n way(around:${n},${e},${t})\n [${s}]${o}[~"^name"~"."];\n relation(around:${n},${e},${t})\n [${s}]${o}[~"^name"~"."];\n);\nout center;\n `.trim(),l=`${this.settings.overpassApi}?data=${encodeURIComponent(a)}`;try{const e=await this.fetchWithRetry(l,{signal:i});if(!e.ok)throw new Error("Overpass request failed");const t=(await e.json()).elements.map(this.normalizePoi);return this.lastQueryKey=r,this.cachedResults=t,t}catch(c){if("AbortError"===c.name)return console.debug("Overpass request aborted"),[];throw c}}async getCategoryPois(e,t,n,r){const i=WU(t);if(!i||!e)return[];const s=n&&r?`cat:${t}:${n}:${r}`:null;if(s&&this.lastQueryKey===s&&this.cachedResults)return console.debug("Returning cached category results for:",s),this.cachedResults;this.controller&&this.controller.abort(),this.controller=new AbortController;const o=this.controller.signal,{minLat:a,minLon:l,maxLat:c,maxLon:u}=e,h=[],d=i.types||["node","way","relation"];i.filter.forEach(e=>{d.forEach(t=>{h.push(`${t}${e}[~"^name"~"."];`)})});const p=`\n[out:json][timeout:25][bbox:${a},${l},${c},${u}];\n(\n ${h.join("\n ")}\n);\nout center;\n `.trim(),f=`${this.settings.overpassApi}?data=${encodeURIComponent(p)}`;try{const e=await this.fetchWithRetry(f,{signal:o});if(!e.ok)throw new Error("Overpass request failed");const t=(await e.json()).elements.map(this.normalizePoi);return s&&(this.lastQueryKey=s,this.cachedResults=t),t}catch(g){if("AbortError"===g.name)return console.debug("Category search aborted"),[];throw console.error("Category search failed",g),g}}normalizePoi(e){const t=e.tags||{},n=$U(t)||"Point of Interest";return{title:UU(t),lat:e.lat||e.center?.lat,lon:e.lon||e.center?.lon,url:t.website,osmId:String(e.id),osmType:e.type,osmTags:t,description:t.description,source:"osm",type:n}}async fetchWithRetry(e,t={},n=3){try{const r=await fetch(e,t);return!r.ok&&n>0&&[502,503,504,429].includes(r.status)?(console.warn(`Overpass request failed with ${r.status}. Retrying... (${n} left)`),await new Promise(e=>setTimeout(e,1e3)),this.fetchWithRetry(e,t,n-1)):r}catch(r){if(n>0&&"AbortError"!==r.name)return console.debug(`Retrying Overpass request... (${n} left)`),await new Promise(e=>setTimeout(e,1e3)),this.fetchWithRetry(e,t,n-1);throw r}}async getPoiById(e,t=null){let n;n="node"===t?`[out:json][timeout:25];node(${e});out center;`:"way"===t?`[out:json][timeout:25];way(${e});out center;`:`\n[out:json][timeout:25];\n(\n node(${e});\n way(${e});\n);\nout center;\n `.trim();const r=`${this.settings.overpassApi}?data=${encodeURIComponent(n)}`,i=await this.fetchWithRetry(r);if(!i.ok)throw new Error("Overpass request failed");const s=await i.json();return s.elements[0]?this.normalizePoi(s.elements[0]):null}async fetchOsmObject(t,n,{forceFresh:r=!1}={}){if(!t||!n)return null;const i=this._buildCacheKey(n,t);if(r)return this._fetchAndCacheOsmObject(t,n,i);const s=this.cachedPlaces.get(i);if(s&&Date.now()-s.timestamp<e.IN_MEMORY_TTL_MS)return console.debug(`Using in-memory cached OSM object for ${i}`),s.data;const o=await this._readLocalCache(n,t);return o?(console.debug(`Using IndexedDB cached OSM object for ${i}`),this._refreshOsmObject(t,n,i).catch(e=>{console.debug("[osm] Background refresh failed for",i,e)}),o):this._fetchAndCacheOsmObject(t,n,i)}async _refreshOsmObject(e,t,n){const r=await this._fetchOsmObjectFromApi(e,t);return r&&this._storeInMemoryAndLocalStorage(n,t,e,r),r}async _fetchAndCacheOsmObject(e,t,n){const r=await this._fetchOsmObjectFromApi(e,t);return r&&this._storeInMemoryAndLocalStorage(n,t,e,r),r}async _fetchOsmObjectFromApi(e,t){let n;if("node"===t)n=`https://www.openstreetmap.org/api/0.6/node/${e}.json`;else if("way"===t)n=`https://www.openstreetmap.org/api/0.6/way/${e}/full.json`;else{if("relation"!==t)return console.error("Unknown OSM type:",t),null;n=`https://www.openstreetmap.org/api/0.6/relation/${e}/full.json`}try{const r=await this.fetchWithRetry(n);if(!r.ok){if(410===r.status)return console.warn("OSM object has been deleted"),null;throw new Error(`OSM API request failed: ${r.status}`)}const i=await r.json();return this.normalizeOsmApiData(i.elements,e,t)}catch(r){return console.error("Failed to fetch OSM object:",r),null}}async fetchOsmObjectsBatch(e){const t=new Map;if(!e||0===e.length)return t;const n=[];for(const{osmType:s,osmId:o}of e){if(!s||!o)continue;const e=this._buildCacheKey(s,o),r=await this.getCachedOsmObject(s,o);r?t.set(e,r):n.push({osmType:s,osmId:o,cacheKey:e})}if(0===n.length)return t;const r=new Map;for(const s of n)r.has(s.osmType)||r.set(s.osmType,[]),r.get(s.osmType).push(s);const i=[];for(const[s,o]of r)i.push(this._fetchOsmObjectsByType(s,o,t));return await Promise.allSettled(i),t}async _fetchOsmObjectsByType(e,t,n){for(let i=0;i<t.length;i+=50){const s=t.slice(i,i+50),o=s.map(e=>e.osmId).join(","),a="way"===e?"ways":e+"s",l=`https://www.openstreetmap.org/api/0.6/${a}.json?${a}=${o}`;try{const t=await this.fetchWithRetry(l);if(!t.ok){console.warn(`[osm] Batch fetch failed for ${e} (${t.status})`,o);continue}const r=await t.json();for(const i of s){const t=this.normalizeOsmApiData(r.elements,i.osmId,e);t&&n.set(i.cacheKey,t)}}catch(r){console.error(`[osm] Batch fetch error for ${e}:`,r)}}}normalizeOsmApiData(e,t,n){if(!e||0===e.length)return null;let r=e.find(e=>String(e.id)===String(t)&&e.type===n);if(!r)return null;let i=r;if("relation"===n&&r.members){const t=r.members.find(e=>"label"===e.role&&"node"===e.type),n=r.members.find(e=>"admin_centre"===e.role&&"node"===e.type),s=t||n;if(s){const t=e.find(e=>String(e.id)===String(s.ref)&&"node"===e.type);t&&(i=t)}}let s=i.lat,o=i.lon,a=null,l=null;if("way"===n&&r.nodes){const t=new Map;e.forEach(e=>{"node"===e.type&&t.set(e.id,[e.lon,e.lat])});const n=r.nodes.map(e=>t.get(e)).filter(Boolean);if(n.length>0){if(i===r){const e=n.reduce((e,t)=>e+t[1],0),t=n.reduce((e,t)=>e+t[0],0);s=e/n.length,o=t/n.length}const e=n.map(e=>e[1]),t=n.map(e=>e[0]);if(a={minLat:Math.min(...e),maxLat:Math.max(...e),minLon:Math.min(...t),maxLon:Math.max(...t)},n.length>1){const e=n[0],t=n[n.length-1];l=e[0]===t[0]&&e[1]===t[1]?{type:"Polygon",coordinates:[n]}:{type:"LineString",coordinates:n}}}}else if("relation"===n&&r.members){const t=[],n=new Map;e.forEach(e=>{"node"===e.type&&n.set(e.id,e)});const c=[];if(r.members.forEach(r=>{if("node"===r.type){const e=n.get(r.ref);e&&t.push(e)}else if("way"===r.type){const i=e.find(e=>"way"===e.type&&e.id===r.ref);if(i&&i.nodes){const e=[];i.nodes.forEach(r=>{const i=n.get(r);i&&(t.push(i),e.push([i.lon,i.lat]))}),e.length>1&&c.push(e)}}}),t.length>0){if(i===r){const e=t.reduce((e,t)=>e+t.lat,0),n=t.reduce((e,t)=>e+t.lon,0);s=e/t.length,o=n/t.length}const e=t.map(e=>e.lat),n=t.map(e=>e.lon);a={minLat:Math.min(...e),maxLat:Math.max(...e),minLon:Math.min(...n),maxLon:Math.max(...n)}}c.length>0&&(l={type:"MultiLineString",coordinates:c})}const c=i.tags||{},u=$U(c)||"Point of Interest";return{title:UU(c),lat:s,lon:o,bbox:a,geojson:l,url:c.website,osmId:String(i.id),osmType:i.type,osmTags:c,description:c.description,source:"osm",type:u}}},ZU=a({default:()=>YU}),YU=class extends pp{static{dF(this.prototype,"settings",[dp])}#D=void fF(this,"settings");controller=null;cancelAll(){this.controller&&(this.controller.abort(),this.controller=null)}get baseUrl(){return this.settings.photonApi}async search(e,t,n,r=10){if(!e||e.length<2)return[];this.controller&&this.controller.abort(),this.controller=new AbortController;const i=this.controller.signal,s=new URLSearchParams({q:e,limit:String(r)});t&&n&&(s.append("lat",parseFloat(t).toFixed(4)),s.append("lon",parseFloat(n).toFixed(4)));const o=`${this.baseUrl}?${s.toString()}`;try{const e=await this.fetchWithRetry(o,{signal:i});if(!e.ok)throw new Error(`Photon request failed with status ${e.status}`);const t=await e.json();return t.features?t.features.map(e=>this.normalizeFeature(e)):[]}catch(a){return"AbortError"===a.name||console.error("Photon search error:",a),[]}}normalizeFeature(e){const t=e.properties||{},n=(e.geometry||{}).coordinates||[],r=n[0],i=n[1],s=[];t.street&&s.push(t.housenumber?`${t.street} ${t.housenumber}`:t.street),t.city&&t.city!==t.name&&s.push(t.city),t.state&&t.state!==t.city&&s.push(t.state),t.country&&s.push(t.country);const o=s.join(", "),a=t.name||o||"Unknown Place",l={...t};t.osm_key&&t.osm_value&&(l[t.osm_key]=t.osm_value);const c=$U(l)||FU(t.osm_value);return{title:a,lat:i,lon:r,osmId:t.osm_id,osmType:{N:"node",W:"way",R:"relation"}[t.osm_type]||t.osm_type,osmTags:l,description:t.name?o:s.slice(1).join(", "),source:"photon",type:c}}async fetchWithRetry(e,t={},n=3){try{const r=await fetch(e,t);return!r.ok&&n>0&&[502,503,504,429].includes(r.status)?(console.warn(`Photon request failed with ${r.status}. Retrying... (${n} left)`),await new Promise(e=>setTimeout(e,1e3)),this.fetchWithRetry(e,t,n-1)):r}catch(r){if(n>0&&"AbortError"!==r.name)return console.debug(`Retrying Photon request... (${n} left)`,r),await new Promise(e=>setTimeout(e,1e3)),this.fetchWithRetry(e,t,n-1);throw r}}},XU=a({default:()=>QU}),JU={overpassApi:"https://overpass-api.de/api/interpreter",mapKinetic:!0,photonApi:"https://photon.komoot.io/api/",showQuickSearchButtons:!0,nostrPhotoFallbackUploads:!1,nostrReadRelays:null,nostrWriteRelays:null,nostrReadRelayExclusions:null,nostrWriteRelayExclusions:null,experimentalEnablePhotoDeletion:!1},QU=class extends pp{static{dF(this.prototype,"overpassApi",[Vr],function(){return JU.overpassApi})}#we=void fF(this,"overpassApi");static{dF(this.prototype,"mapKinetic",[Vr],function(){return JU.mapKinetic})}#_e=void fF(this,"mapKinetic");static{dF(this.prototype,"photonApi",[Vr],function(){return JU.photonApi})}#xe=void fF(this,"photonApi");static{dF(this.prototype,"showQuickSearchButtons",[Vr],function(){return JU.showQuickSearchButtons})}#Ce=void fF(this,"showQuickSearchButtons");static{dF(this.prototype,"nostrPhotoFallbackUploads",[Vr],function(){return JU.nostrPhotoFallbackUploads})}#Se=void fF(this,"nostrPhotoFallbackUploads");static{dF(this.prototype,"nostrReadRelays",[Vr],function(){return JU.nostrReadRelays})}#ke=void fF(this,"nostrReadRelays");static{dF(this.prototype,"nostrWriteRelays",[Vr],function(){return JU.nostrWriteRelays})}#Ee=void fF(this,"nostrWriteRelays");static{dF(this.prototype,"nostrReadRelayExclusions",[Vr],function(){return JU.nostrReadRelayExclusions})}#Re=void fF(this,"nostrReadRelayExclusions");static{dF(this.prototype,"nostrWriteRelayExclusions",[Vr],function(){return JU.nostrWriteRelayExclusions})}#Te=void fF(this,"nostrWriteRelayExclusions");static{dF(this.prototype,"experimentalEnablePhotoDeletion",[Vr],function(){return JU.experimentalEnablePhotoDeletion})}#Le=void fF(this,"experimentalEnablePhotoDeletion");overpassApis=[{name:"overpass-api.de (DE)",url:"https://overpass-api.de/api/interpreter"},{name:"private.coffee (AT)",url:"https://overpass.private.coffee/api/interpreter"}];photonApis=[{name:"photon.komoot.io",url:"https://photon.komoot.io/api/"}];constructor(){super(...arguments),this.loadSettings()}loadSettings(){let e={};const t=localStorage.getItem("marco:settings");if(t)try{e=JSON.parse(t)}catch(r){console.error("Failed to parse settings from localStorage",r)}else{const t=localStorage.getItem("marco:overpass-api");t&&(e.overpassApi=t);const n=localStorage.getItem("marco:map-kinetic");null!==n&&(e.mapKinetic="true"===n);const r=localStorage.getItem("marco:show-quick-search");null!==r&&(e.showQuickSearchButtons="true"===r);const i=localStorage.getItem("marco:nostr-photo-fallback-uploads");null!==i&&(e.nostrPhotoFallbackUploads="true"===i);const s=localStorage.getItem("marco:photon-api");s&&(e.photonApi=s)}const n={...JU,...e};this.overpassApis.some(e=>e.url===n.overpassApi)||(n.overpassApi=JU.overpassApi),this.overpassApi=n.overpassApi,this.mapKinetic=n.mapKinetic,this.photonApi=n.photonApi,this.showQuickSearchButtons=n.showQuickSearchButtons,this.nostrPhotoFallbackUploads=n.nostrPhotoFallbackUploads,this.nostrReadRelays=n.nostrReadRelays,this.nostrWriteRelays=n.nostrWriteRelays,this.nostrReadRelayExclusions=n.nostrReadRelayExclusions,this.nostrWriteRelayExclusions=n.nostrWriteRelayExclusions,this.experimentalEnablePhotoDeletion=n.experimentalEnablePhotoDeletion,this.saveSettings()}saveSettings(){const e={overpassApi:this.overpassApi,mapKinetic:this.mapKinetic,photonApi:this.photonApi,showQuickSearchButtons:this.showQuickSearchButtons,nostrPhotoFallbackUploads:this.nostrPhotoFallbackUploads,nostrReadRelays:this.nostrReadRelays,nostrWriteRelays:this.nostrWriteRelays,nostrReadRelayExclusions:this.nostrReadRelayExclusions,nostrWriteRelayExclusions:this.nostrWriteRelayExclusions,experimentalEnablePhotoDeletion:this.experimentalEnablePhotoDeletion};localStorage.setItem("marco:settings",JSON.stringify(e))}update(e,t){e in JU&&(this[e]=t,this.saveSettings())}},eB=o((e,t)=>{var n,r;n=e,r=function(){return function(){var e={548:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Access=void 0;class n{constructor(e){this.rs=e,this.reset(!1)}get scopes(){return Object.keys(this.scopeModeMap).map(e=>({name:e,mode:this.scopeModeMap[e]}))}get scopeParameter(){return this.scopes.map(e=>`${this._scopeNameForParameter(e)}:${e.mode}`).join(" ")}claim(e,t){if("string"!=typeof e||-1!==e.indexOf("/")||0===e.length)throw new Error("Scope should be a non-empty string without forward slashes");if("string"!=typeof t||!t.match(/^rw?$/))throw new Error("Mode should be either 'r' or 'rw'");this._adjustRootPaths(e),this.scopeModeMap[e]=t,this._notifyChange()}get(e){return this.scopeModeMap[e]}remove(e){const t={};for(const n in this.scopeModeMap)t[n]=this.scopeModeMap[n];this.reset(!1),delete t[e];for(const n in t)this._adjustRootPaths(n),this.scopeModeMap[n]=t[n];this._notifyChange()}checkPermission(e,t){const n=this.get(e);return n&&("r"===t||"rw"===n)}checkPathPermission(e,t){if(this.checkPermission("*",t))return!0;const n=this._getModuleName(e);return!!this.checkPermission(n,t)}reset(e=!0){this.rootPaths=[],this.scopeModeMap={},e&&this._notifyChange()}_getModuleName(e){if("/"!==e[0])throw new Error("Path should start with a slash");const t=e.replace(/^\/public/,"").match(/^\/([^/]*)\//);return t?t[1]:"*"}_adjustRootPaths(e){"*"in this.scopeModeMap||"*"===e?this.rootPaths=["/"]:e in this.scopeModeMap||(this.rootPaths.push("/"+e+"/"),this.rootPaths.push("/public/"+e+"/"))}_scopeNameForParameter(e){if("*"===e.name&&this.storageType){if("2012.04"===this.storageType)return"";if(this.storageType.match(/remotestorage-0[01]/))return"root"}return e.name}setStorageType(e){this.storageType=e}_notifyChange(){this.rs&&"function"==typeof this.rs._checkScopeChange&&this.rs._checkScopeChange()}static _rs_init(){}}t.Access=n,t.default=n},275:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Authorize=void 0;const s=i(n(28)),o=i(n(334)),a=n(746),l=i(n(503)),c=n(368);let u;function h(e){const t=e||d.getLocation().href,n={};for(const[s,o]of new URL(t).searchParams)n[s]=o;const r=t.indexOf("#");if(-1===r)return n;const i=t.substring(r+1);return i.includes("=")?i.split("&").reduce(function(e,t){const n=t.split("=");if("state"===n[0]&&n[1].match(/rsDiscovery/)){let t=decodeURIComponent(n[1]);const r=t.substr(t.indexOf("rsDiscovery=")).split("&")[0].split("=")[1];e.rsDiscovery=JSON.parse(atob(r)),t=t.replace(new RegExp("&?rsDiscovery="+r),""),t.length>0&&(e.state=t)}else e[decodeURIComponent(n[0])]=decodeURIComponent(n[1]);return e},n):n}class d{static authorize(e,t){if((0,o.default)("[Authorize] authURL = ",t.authURL,"scope = ",t.scope,"redirectUri = ",t.redirectUri,"clientId = ",t.clientId,"response_type =",t.response_type),!t.scope)throw new Error("Cannot authorize due to undefined or empty scope; did you forget to access.claim()?");if("function"==typeof e._rememberPendingScope&&e._rememberPendingScope(t.scope),!(0,a.localStorageAvailable)()&&"remotestorage"===e.backend){t.redirectUri+=t.redirectUri.indexOf("#")>0?"&":"#";const n={userAddress:e.remote.userAddress,href:e.remote.href,storageApi:e.remote.storageApi,properties:e.remote.properties};t.redirectUri+="rsDiscovery="+(0,a.toBase64)(JSON.stringify(n))}const n=function(e){const t=new URL(e.redirectUri);e.state||(e.state=t.hash?t.hash.substring(1):""),e.response_type||(e.response_type="token");const n=new URL(e.authURL);n.searchParams.set("redirect_uri",e.redirectUri.replace(/#.*$/,"")),n.searchParams.set("scope",e.scope),n.searchParams.set("client_id",e.clientId);for(const r of["state","response_type","code_challenge","code_challenge_method","token_access_type"]){const t=e[r];t&&n.searchParams.set(r,t)}return n.href}(t);a.globalContext.cordova&&(d.getLocation().href.startsWith("file:")||"string"==typeof s.default.cordovaRedirectUri&&t.redirectUri===s.default.cordovaRedirectUri)?d.openWindow(n,t.redirectUri,"location=yes,clearsessioncache=yes,clearcache=yes").then(n=>{e.remote.configure({token:n.access_token}),"function"==typeof e._completeAuthorization&&e._completeAuthorization(n.scope||t.scope)}):d.setLocation(n)}static refreshAccessToken(e,t,n){return r(this,void 0,void 0,function*(){var e,r,i;yield t.configure({token:null,tokenType:null});const s=new URLSearchParams({grant_type:"refresh_token",client_id:t.clientId,refresh_token:n}),a=yield(0,c.requestWithTimeout)("POST",t.TOKEN_URL,{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:s.toString(),responseType:"json"});if(200!==(null==a?void 0:a.status))throw yield t.configure({refreshToken:null}),new l.default("refresh token rejected:"+JSON.stringify(a.response));{(0,o.default)(`[Authorize] access token good for ${null===(e=null==a?void 0:a.response)||void 0===e?void 0:e.expires_in} seconds`);const n={token:null===(r=null==a?void 0:a.response)||void 0===r?void 0:r.access_token,tokenType:null===(i=null==a?void 0:a.response)||void 0===i?void 0:i.token_type};if(!n.token)throw new Error(`no access_token in "successful" refresh: ${a.response}`);yield t.configure(n)}})}static setLocation(e){if("string"==typeof e)document.location.href=e;else{if("object"!=typeof e)throw"Invalid location "+e;document.location.href=e.href}}static _rs_supported(){return"undefined"!=typeof document}static _rs_cleanup(e){e.removeEventListener("features-loaded",u)}}t.Authorize=d,d.IMPLIED_FAKE_TOKEN=!1,d.getLocation=function(){return document.location},d.openWindow=function(e,t,n){return new Promise((r,i)=>{const s=open(e,"_blank",n);function o(){i("Authorization was canceled")}s&&!s.closed?(s.addEventListener("loadstart",function(e){if(0!==e.url.indexOf(t))return;s.removeEventListener("exit",o),s.close();const n=h(e.url);n?r(n):i("Authorization error")}),s.addEventListener("exit",o)):i("Authorization popup was blocked")})},d._rs_init=function(e){const t=h(),n=function(e){return"string"==typeof e.access_token||"string"==typeof e.code||"string"==typeof e.error||"string"==typeof e.remotestorage||"object"==typeof e.rsDiscovery}(t);let i;n&&(i=d.getLocation(),i.hash=""),u=function(){let s=!1;if(n){if(t.error)throw"function"==typeof e._forgetPendingScope&&e._forgetPendingScope(),"access_denied"===t.error?new l.default("Authorization failed: access denied",{code:"access_denied"}):new l.default(`Authorization failed: ${t.error}`);t.rsDiscovery&&e.remote.configure(t.rsDiscovery),t.access_token&&(e.remote.configure({token:t.access_token}),"function"==typeof e._completeAuthorization&&e._completeAuthorization(t.scope),s=!0),t.remotestorage&&(e.connect(t.remotestorage),s=!0),t.state&&(i=d.getLocation(),d.setLocation(i.href.split("#")[0]+"#"+t.state)),t.code&&(function(t){r(this,void 0,void 0,function*(){var n,r,s,a,l;const u=sessionStorage.getItem("remotestorage:codeVerifier");if(!u)return void(0,o.default)("[Authorize] Ignoring OAuth code parameter, because no PKCE code verifier found in sessionStorage");i=d.getLocation();let h=i.origin;"/"!==i.pathname&&(h+=i.pathname);const p=new URLSearchParams({code:t,grant_type:"authorization_code",client_id:e.remote.clientId,redirect_uri:h,code_verifier:u}),f=yield(0,c.requestWithTimeout)("POST",e.remote.TOKEN_URL,{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:p.toString(),responseType:"json"});switch(f.status){case 200:{(0,o.default)(`[Authorize] access token good for ${null===(n=null==f?void 0:f.response)||void 0===n?void 0:n.expires_in} seconds`);const t={token:null===(r=null==f?void 0:f.response)||void 0===r?void 0:r.access_token,refreshToken:null===(s=null==f?void 0:f.response)||void 0===s?void 0:s.refresh_token,tokenType:null===(a=null==f?void 0:f.response)||void 0===a?void 0:a.token_type};t.token?(e.remote.configure(t),"function"==typeof e._completeAuthorization&&e._completeAuthorization(null===(l=null==f?void 0:f.response)||void 0===l?void 0:l.scope)):e._emit("error",new Error(`no access_token in "successful" response: ${f.response}`)),sessionStorage.removeItem("remotestorage:codeVerifier");break}default:"function"==typeof e._forgetPendingScope&&e._forgetPendingScope(),e._emit("error",new Error(`${f.statusText}: ${f.response}`))}})}(t.code),s=!0),s||e.remote.stopWaitingForToken()}else e.remote.stopWaitingForToken()},e.on("features-loaded",u)},t.default=d},424:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseClient=void 0;const s=i(n(439)),o=i(n(613)),a=i(n(491)),l=i(n(93)),c=i(n(28)),u=n(746);class h{constructor(e,t){if(this.schemas={configurable:!0,get(){return h.Types.inScope(this.moduleName)}},"/"!==t[t.length-1])throw"Not a folder: "+t;"/"===t&&(this.makePath=e=>("/"===e[0]?"":"/")+e),this.storage=e,this.base=t,this.moduleName=function(e){const t=e.split("/");return e.length>2?t[1]:"root"}(this.base),this.addEvents(["change"]),this.on=this.on.bind(this),e.onChange(this.base,this._fireChange.bind(this))}scope(e){return new h(this.storage,this.makePath(e))}getListing(e,t){return r(this,void 0,void 0,function*(){if("string"!=typeof e)e="";else if(e.length>0&&!(0,u.isFolder)(e))return Promise.reject("Not a folder: "+e);return this.storage.get(this.makePath(e),t).then(e=>404===e.statusCode?{}:e.body)})}getAll(e,t){return r(this,void 0,void 0,function*(){if("string"!=typeof e)e="";else if(e.length>0&&!(0,u.isFolder)(e))return Promise.reject("Not a folder: "+e);return this.storage.get(this.makePath(e),t).then(n=>{if(404===n.statusCode)return{};if("object"==typeof n.body){const r=Object.keys(n.body);if(0===r.length)return{};const i=r.map(r=>this.storage.get(this.makePath(e+r),t).then(e=>{if("string"==typeof e.body)try{e.body=JSON.parse(e.body)}catch(e){}"object"==typeof e.body&&(n.body[r]=e.body)}));return Promise.all(i).then(()=>n.body)}})})}getFile(e,t){return r(this,void 0,void 0,function*(){return"string"!=typeof e?Promise.reject("Argument 'path' of baseClient.getFile must be a string"):this.storage.get(this.makePath(e),t).then(e=>({data:e.body,contentType:e.contentType,revision:e.revision}))})}storeFile(e,t,n){return r(this,void 0,void 0,function*(){return"string"!=typeof e?Promise.reject("Argument 'contentType' of baseClient.storeFile must be a string"):"string"!=typeof t?Promise.reject("Argument 'path' of baseClient.storeFile must be a string"):"string"!=typeof n&&"object"!=typeof n?Promise.reject("Argument 'body' of baseClient.storeFile must be a string, ArrayBuffer, or ArrayBufferView"):(this.storage.access.checkPathPermission(this.makePath(t),"rw")||console.warn("WARNING: Editing a document to which only read access ('r') was claimed"),this.storage.put(this.makePath(t),n,e).then(e=>200===e.statusCode||201===e.statusCode?e.revision:Promise.reject("Request (PUT "+this.makePath(t)+") failed with status: "+e.statusCode)))})}getObject(e,t){return r(this,void 0,void 0,function*(){return"string"!=typeof e?Promise.reject("Argument 'path' of baseClient.getObject must be a string"):this.storage.get(this.makePath(e),t).then(t=>{if("object"==typeof t.body)return t.body;if("string"==typeof t.body)try{return JSON.parse(t.body)}catch(t){throw new Error("Not valid JSON: "+this.makePath(e))}else if(void 0!==t.body&&200===t.statusCode)return Promise.reject("Not an object: "+this.makePath(e))})})}storeObject(e,t,n){return r(this,void 0,void 0,function*(){if("string"!=typeof e)return Promise.reject("Argument 'typeAlias' of baseClient.storeObject must be a string");if("string"!=typeof t)return Promise.reject("Argument 'path' of baseClient.storeObject must be a string");if("object"!=typeof n)return Promise.reject("Argument 'object' of baseClient.storeObject must be an object");this._attachType(n,e);try{const e=this.validate(n);if(!e.valid)return Promise.reject(e)}catch(e){return Promise.reject(e)}return this.storage.put(this.makePath(t),JSON.stringify(n),"application/json; charset=UTF-8").then(e=>200===e.statusCode||201===e.statusCode?e.revision:Promise.reject("Request (PUT "+this.makePath(t)+") failed with status: "+e.statusCode))})}remove(e){return r(this,void 0,void 0,function*(){return"string"!=typeof e?Promise.reject("Argument 'path' of baseClient.remove must be a string"):(this.storage.access.checkPathPermission(this.makePath(e),"rw")||console.warn("WARNING: Removing a document to which only read access ('r') was claimed"),this.storage.delete(this.makePath(e),this.storage.connected))})}getItemURL(e){return r(this,void 0,void 0,function*(){if("string"!=typeof e)throw"Argument 'path' of baseClient.getItemURL must be a string";if(this.storage.connected)return"function"==typeof this.storage.remote.getItemURL?this.storage.remote.getItemURL(this.makePath(e)):this.storage.remote.href+(0,u.cleanPath)(this.makePath(e))})}cache(e,t="ALL"){if("string"!=typeof e)throw"Argument 'path' of baseClient.cache must be a string";if("string"!=typeof t)throw"Argument 'strategy' of baseClient.cache must be a string or undefined";if("FLUSH"!==t&&"SEEN"!==t&&"ALL"!==t)throw'Argument \'strategy\' of baseclient.cache must be one of ["FLUSH", "SEEN", "ALL"]';return this.storage.caching.set(this.makePath(e),t),this}declareType(e,t,n){let r;if(n&&"string"==typeof t)r=t;else if(n||"string"==typeof t){if(!n&&"string"==typeof t)throw new Error("declareType() requires a JSON Schema object to be passed, in order to validate object types/formats")}else n=t,r=this._defaultTypeURI(e);h.Types.declare(this.moduleName,e,r,n)}validate(e){const t=h.Types.getSchema(e["@context"]);if(t)return s.default.validateResult(e,t);throw new a.default(e["@context"])}_defaultTypeURI(e){return"http://remotestorage.io/spec/modules/"+encodeURIComponent(this.moduleName)+"/"+encodeURIComponent(e)}_attachType(e,t){e["@context"]=h.Types.resolveAlias(this.moduleName+"/"+t)||this._defaultTypeURI(t)}makePath(e){return this.base+(e||"")}_fireChange(e){c.default.changeEvents[e.origin]&&(["new","old","lastCommon"].forEach(function(t){if((!e[t+"ContentType"]||/^application\/(.*)json(.*)/.exec(e[t+"ContentType"]))&&"string"==typeof e[t+"Value"])try{e[t+"Value"]=JSON.parse(e[t+"Value"])}catch(e){}}),this._emit("change",e))}static _rs_init(){}}t.BaseClient=h,h.Types=o.default,(0,u.applyMixins)(h,[l.default]),t.default=h},285:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Caching=void 0;const i=n(746),s=r(n(334));class o{constructor(e){this.pendingActivations=[],this._access=e.access,this.reset()}set(e,t){if("string"!=typeof e)throw new Error("path should be a string");if(!(0,i.isFolder)(e))throw new Error("path should be a folder");if(!this._access.checkPathPermission(e,"r"))throw new Error('No access to path "'+e+'". You must claim access to it first.');if(void 0===t||!t.match(/^(FLUSH|SEEN|ALL)$/))throw new Error("strategy should be 'FLUSH', 'SEEN', or 'ALL'");this._rootPaths[e]=t,"ALL"===t&&(this.activateHandler?this.activateHandler(e):this.pendingActivations.push(e))}enable(e){this.set(e,"ALL")}disable(e){this.set(e,"FLUSH")}onActivate(e){(0,s.default)("[Caching] Setting activate handler",e,this.pendingActivations),this.activateHandler=e;for(let t=0;t<this.pendingActivations.length;t++)e(this.pendingActivations[t]);this.pendingActivations=[]}resetActivationHandler(){this.activateHandler=void 0,this.pendingActivations=[]}checkPath(e){return void 0!==this._rootPaths[e]?this._rootPaths[e]:"/"===e?"SEEN":this.checkPath((0,i.containingFolder)(e))}reset(){this._rootPaths={}}static _rs_init(){}}t.Caching=o,t.default=o},496:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const s=i(n(451)),o=i(n(93)),a=i(n(28)),l=i(n(334)),c=n(746);function u(e){if("object"==typeof e&&"string"==typeof e.path)if((0,c.isFolder)(e.path)){if(e.local&&e.local.itemsMap)return e.local;if(e.common&&e.common.itemsMap)return e.common}else{if(e.local){if(e.local.body&&e.local.contentType)return e.local;if(!1===e.local.body)return}if(e.common&&e.common.body&&e.common.contentType)return e.common}}function h(e,t){for(const n in e){if(e[n]&&e[n].remote)return!0;const r=u(e[n]);if(r&&r.timestamp&&(new Date).getTime()-r.timestamp<=t)return!1;if(!r)return!0}return!0}function d(e){const t={path:e,common:{}};return(0,c.isFolder)(e)&&(t.common.itemsMap={}),t}function p(e,t){return e.common||(e.common={itemsMap:{}}),e.common.itemsMap||(e.common.itemsMap={}),e.local||(e.local=(0,c.deepClone)(e.common)),e.local.itemsMap||(e.local.itemsMap=e.common.itemsMap),e.local.itemsMap[t]=!0,e}class f{constructor(){this._updateNodesRunning=!1,this._updateNodesQueued=[],(new s.default).isBrowser()&&c.globalContext.BroadcastChannel&&(this.broadcastChannel=new BroadcastChannel("remotestorage:changes"),this.broadcastChannel.onmessage=e=>{this.emitChange(e.data)})}get(e,t,n){return r(this,void 0,void 0,function*(){return"number"==typeof t?this.getNodes((0,c.pathsFromRoot)(e)).then(r=>{const i=u(r[e]);return h(r,t)?n(e):i?{statusCode:200,body:i.body||i.itemsMap,contentType:(0,c.stripLegacyCharsetBinary)(i.contentType||null)}:{statusCode:404}}):this.getNodes([e]).then(t=>{const n=u(t[e]);if(n){if((0,c.isFolder)(e))for(const e in n.itemsMap)n.itemsMap.hasOwnProperty(e)&&!1===n.itemsMap[e]&&delete n.itemsMap[e];return{statusCode:200,body:n.body||n.itemsMap,contentType:(0,c.stripLegacyCharsetBinary)(n.contentType||null)}}return{statusCode:404}})})}put(e,t,n){return r(this,void 0,void 0,function*(){const r=(0,c.pathsFromRoot)(e);return this._updateNodes(r,function(e,r){try{for(let i=0,s=e.length;i<s;i++){const s=e[i];let o,a=r[s];a||(r[s]=a=d(s)),0===i?(o=u(a),a.local={body:t,contentType:n,previousBody:o?o.body:void 0,previousContentType:o?o.contentType:void 0}):a=p(a,e[i-1].substring(s.length))}return r}catch(e){throw(0,l.default)("[Cachinglayer] Error during PUT",r,e),e}})})}delete(e,t){return r(this,void 0,void 0,function*(){const n=(0,c.pathsFromRoot)(e);return this._updateNodes(n,function(e,n){for(let r=0,i=e.length;r<i;r++){const i=e[r],s=n[i];let o;if(s)if(0===r)o=u(s),s.local={body:!t&&void 0,previousBody:o?o.body:void 0,previousContentType:o?o.contentType:void 0};else{s.local||(s.local=(0,c.deepClone)(s.common));const t=e[r-1].substring(i.length);if(delete s.local.itemsMap[t],Object.getOwnPropertyNames(s.local.itemsMap).length>0)break}else console.error("Cannot delete non-existing node "+i)}return n})})}flush(e){return this._getAllDescendentPaths(e).then(e=>this.getNodes(e)).then(e=>{for(const t in e){const n=e[t];n&&n.common&&n.local&&this.emitChange({path:n.path,origin:"local",oldValue:!1===n.local.body?void 0:n.local.body,newValue:!1===n.common.body?void 0:n.common.body}),e[t]=void 0}return this.setNodes(e)})}emitChange(e){a.default.changeEvents[e.origin]&&this._emit("change",e)}fireInitial(){a.default.changeEvents.local&&this.forAllNodes(e=>{if((0,c.isDocument)(e.path)){const t=u(e);t&&this.emitChange({path:e.path,origin:"local",oldValue:void 0,oldContentType:void 0,newValue:t.body,newContentType:t.contentType})}}).then(()=>{this._emit("local-events-done")})}onDiff(e){this.diffHandler=e}_updateNodes(e,t){return new Promise((n,r)=>{this._doUpdateNodes(e,t,{resolve:n,reject:r})})}_doUpdateNodes(e,t,n){return r(this,void 0,void 0,function*(){if(this._updateNodesRunning)return void this._updateNodesQueued.push({paths:e,cb:t,promise:n});this._updateNodesRunning=!0;try{let r=yield this.getNodes(e);const i=(0,c.deepClone)(r),s=[];r=t(e,r);for(const e in r){const t=r[e];(0,c.equal)(t,i[e])?delete r[e]:(0,c.isDocument)(e)&&((0,c.equal)(t.local.body,t.local.previousBody)&&t.local.contentType===t.local.previousContentType||s.push({path:e,origin:"window",oldValue:t.local.previousBody,newValue:!1===t.local.body?void 0:t.local.body,oldContentType:t.local.previousContentType,newContentType:t.local.contentType}),void 0===t.local.body?r[e]=void 0:(delete t.local.previousBody,delete t.local.previousContentType))}yield this.setNodes(r),this._emitChangeEvents(s),n.resolve({statusCode:200})}catch(e){n.reject(e)}this._updateNodesRunning=!1;const r=this._updateNodesQueued.shift();r&&(yield this._doUpdateNodes(r.paths,r.cb,r.promise))})}_emitChangeEvents(e){for(let t=0,n=e.length;t<n;t++){const n=e[t];this.emitChange(n),this.diffHandler&&this.diffHandler(n.path),this.broadcastChannel&&"window"===n.origin&&this.broadcastChannel.postMessage(n)}}_getAllDescendentPaths(e){return(0,c.isFolder)(e)?this.getNodes([e]).then(t=>{const n=[e],r=u(t[e]),i=Object.keys(r.itemsMap).map(t=>this._getAllDescendentPaths(e+t).then(e=>{for(let t=0,r=e.length;t<r;t++)n.push(e[t])}));return Promise.all(i).then(()=>n)}):Promise.resolve([e])}_getInternals(){return{getLatest:u,makeNode:d,isOutdated:h}}}(0,c.applyMixins)(f,[o.default]),e.exports=f},28:function(e){e.exports={cache:!0,changeEvents:{local:!0,window:!1,remote:!0,conflict:!0},cordovaRedirectUri:void 0,discovery:{allowPrivateAddresses:!0,timeout:5e3},logging:!1,modules:[],backgroundSyncInterval:6e4,disableFeatures:[],isBackground:!1,requestTimeout:3e4,syncInterval:1e4}},373:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=r(n(713)),s=r(n(28)),o=r(n(334)),a=n(746);let l;const c="remotestorage:discover";let u={};const h=function(e){if(e in u)return Promise.resolve(u[e]);const t=new i.default({tls_only:!1,uri_fallback:!0,request_timeout:s.default.discovery.timeout,allow_private_addresses:s.default.discovery.allowPrivateAddresses});let n;const r=new Promise((e,t)=>{n=setTimeout(()=>{t(new Error("timed out"))},s.default.discovery.timeout)});return Promise.race([t.lookup(e),r]).then(t=>{if(clearTimeout(n),"object"!=typeof t.idx.links.remotestorage||"number"!=typeof t.idx.links.remotestorage.length||t.idx.links.remotestorage.length<=0)throw(0,o.default)("[Discover] WebFinger record for "+e+" does not have remotestorage defined in the links section ",JSON.stringify(t.object)),new Error("WebFinger record for "+e+" does not have remotestorage defined in the links section.");const r=t.idx.links.remotestorage[0],i=r.properties||{},s=i["http://tools.ietf.org/html/rfc6749#section-4.2"]||i["auth-endpoint"],a=i["http://remotestorage.io/spec/version"]||r.type;return u[e]={href:r.href,storageApi:a,authURL:s,properties:i},l&&localStorage.setItem(c,JSON.stringify({cache:u})),u[e]}).catch(e=>{throw clearTimeout(n),e})};(h.DiscoveryError=function(e){this.name="DiscoveryError",this.message=e,this.stack=(new Error).stack}).prototype=Object.create(Error.prototype),h.DiscoveryError.prototype.constructor=h.DiscoveryError,h._rs_init=function(){if(l=(0,a.localStorageAvailable)(),l){const e=JSON.parse(localStorage.getItem(c));e&&(u=e.cache)}},h._rs_supported=function(){return Object.prototype.hasOwnProperty.call(a.globalContext,"fetch")||Object.prototype.hasOwnProperty.call(a.globalContext,"XMLHttpRequest")},h._rs_cleanup=function(){l&&localStorage.removeItem(c)},e.exports=h},706:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const s=i(n(93)),o=i(n(941)),a=i(n(982)),l=i(n(503)),c=n(746),u=n(368),h=n(684),d=i(n(275));let p;const f="remotestorage:dropbox",g="https://api.dropboxapi.com/2/files/list_folder",m="https://api.dropboxapi.com/2/files/list_folder/continue";function y(e){return("/remotestorage/"+e).replace(/\/+$/,"").replace(/\/+/g,"/")}const v=/[\u007f-\uffff]/g;function b(e){return JSON.stringify(e).replace(v,function(e){return"\\u"+("000"+e.charCodeAt(0).toString(16)).slice(-4)})}function w(e,t){return new RegExp("^"+t.join("\\/")+"(\\/|$)").test(e.error_summary)}class _ extends h.RemoteBase{constructor(e){if(super(e),this.online=!0,this.storageApi="draft-dejong-remotestorage-19",this._initialFetchDone=!1,this.addEvents(["connected","not-connected"]),this.clientId=e.apiKeys.dropbox.appKey,this.TOKEN_URL="https://api.dropboxapi.com/oauth2/token",this._revCache=new o.default("rev"),this._fetchDeltaCursor=null,this._fetchDeltaPromise=null,this._itemRefs={},p=(0,c.localStorageAvailable)(),p){const e=(0,c.getJSONFromLocalStorage)(f);e&&this.configure(e),this._itemRefs=(0,c.getJSONFromLocalStorage)(`${f}:shares`)||{}}this.connected&&setTimeout(this._emit.bind(this),0,"connected")}connect(){return r(this,void 0,void 0,function*(){try{if(this.rs.setBackend("dropbox"),this.token)S(this.rs);else{const{codeVerifier:e,codeChallenge:t,state:n}=yield(0,c.generateCodeVerifier)();sessionStorage.setItem("remotestorage:codeVerifier",e),sessionStorage.setItem("remotestorage:state",n),this.rs.authorize({authURL:"https://www.dropbox.com/oauth2/authorize",scope:"account_info.read files.content.read files.content.write files.metadata.read files.metadata.write sharing.read sharing.write",clientId:this.clientId,response_type:"code",state:n,code_challenge:t,code_challenge_method:"S256",token_access_type:"offline"})}}catch(e){throw this.rs._emit("error",e),this.rs.setBackend(void 0),e}})}configure(e){return r(this,void 0,void 0,function*(){void 0!==e.userAddress&&(this.userAddress=e.userAddress),void 0!==e.token&&(this.token=e.token),void 0!==e.refreshToken&&(this.refreshToken=e.refreshToken),void 0!==e.tokenType&&(this.tokenType=e.tokenType);const t=()=>{p&&localStorage.setItem(f,JSON.stringify({userAddress:this.userAddress,token:this.token,refreshToken:this.refreshToken,tokenType:this.tokenType}))};if(this.refreshToken||this.token)if(this.connected=!0,this.userAddress)this._emit("connected"),t();else try{const e=yield this.info();this.userAddress=e.email,this._emit("connected"),t()}catch(e){this.connected=!1,this.rs._emit("error",new Error("Could not fetch user info.")),t.apply(this)}else(()=>{this.connected=!1,p&&(localStorage.removeItem(f),localStorage.removeItem(`${f}:shares`)),this.rs.setBackend(void 0)})()})}_getFolder(e){const t=this._revCache,n=n=>{let i;if(200!==n.status&&409!==n.status)return Promise.reject("Unexpected response status: "+n.status);try{i=JSON.parse(n.responseText)}catch(e){return Promise.reject(e)}if(409===n.status)return w(i,["path","not_found"])?Promise.resolve({}):Promise.reject(new Error("API returned an error: "+i.error_summary));const s=i.entries.reduce((n,r)=>{try{const i="folder"===r[".tag"],s=r.path_display.split("/").slice(-1)[0]+(i?"/":"");if(i)n[s]={ETag:t.get(e+s)};else{const t=new Date(r.server_modified);n[s]={ETag:r.rev,"Content-Length":r.size,"Last-Modified":t.toUTCString()},this._revCache.set(e+s,r.rev)}}catch(t){console.error(`[Dropbox] folder “${e}” has entry ${JSON.stringify(r)}:`,t)}return n},{});return i.has_more?r(i.cursor).then(function(e){return Object.assign(s,e)}):Promise.resolve(s)},r=e=>{const t={body:{cursor:e}};return this._request("POST",m,t).then(n)};return this._request("POST",g,{body:{path:y(e)}}).then(n).then(function(n){return Promise.resolve({statusCode:200,body:n,contentType:"application/json; charset=UTF-8",revision:t.get(e)})})}get(e,t={}){if(!this.connected)return Promise.reject("not connected (path: "+e+")");const n=this._revCache.get(e);if(null===n)return Promise.resolve({statusCode:404});if(t&&t.ifNoneMatch){if(!this._initialFetchDone)return this.fetchDelta().then(()=>this.get(e,t));if(n&&n===t.ifNoneMatch)return Promise.resolve({statusCode:304})}if("/"===e.slice(-1))return this._getFolder(e);const r={headers:{"Dropbox-API-Arg":b({path:y(e)})},responseType:"arraybuffer"};return t&&t.ifNoneMatch&&(r.headers["If-None-Match"]=t.ifNoneMatch),this._request("GET","https://content.dropboxapi.com/2/files/download",r).then(t=>{const n=t.status;let r,i,s,o;return 200!==n&&409!==n?Promise.resolve({statusCode:n}):(r=t.getResponseHeader("Dropbox-API-Result"),(0,c.getTextFromArrayBuffer)(t.response,"UTF-8").then(a=>{i=a,409===n&&(r=i);try{r=JSON.parse(r)}catch(e){return Promise.reject(e)}if(409===n)return w(r,["path","not_found"])?{statusCode:404}:Promise.reject(new Error('API error while downloading file ("'+e+'"): '+r.error_summary));if(s=t.getResponseHeader("Content-Type"),o=r.rev,this._revCache.set(e,o),this._shareIfNeeded(e),(0,c.shouldBeTreatedAsBinary)(a,s))i=t.response;else try{i=JSON.parse(i),s="application/json; charset=UTF-8"}catch(e){}return{statusCode:n,body:i,contentType:(0,c.stripLegacyCharsetBinary)(s),revision:o}}))})}put(e,t,n){return r(this,arguments,void 0,function*(e,t,n,r={}){if(!this.connected)throw new Error("not connected (path: "+e+")");const i=this._revCache.get(e);if(r&&r.ifMatch&&i&&i!==r.ifMatch)return{statusCode:412,revision:i};if(r&&"*"===r.ifNoneMatch&&i&&"rev"!==i)return{statusCode:412,revision:i};if(t.length>157286400)throw new Error("Cannot upload file larger than 150MB");const s={body:t,contentType:n,path:e};if(r&&(r.ifMatch||"*"===r.ifNoneMatch)){const t=yield this._getMetadata(e);if(r&&"*"===r.ifNoneMatch&&t)return{statusCode:412,revision:t.rev};if(r&&r.ifMatch&&t&&t.rev!==r.ifMatch)return{statusCode:412,revision:t.rev}}const o=yield this._uploadSimple(s);return this._shareIfNeeded(e),o})}delete(e){return r(this,arguments,void 0,function*(e,t={}){if(!this.connected)throw new Error("not connected (path: "+e+")");const n=this._revCache.get(e);if((null==t?void 0:t.ifMatch)&&n&&t.ifMatch!==n)return{statusCode:412,revision:n};if(null==t?void 0:t.ifMatch){const n=yield this._getMetadata(e);if((null==t?void 0:t.ifMatch)&&n&&n.rev!==t.ifMatch)return{statusCode:412,revision:n.rev}}return this._deleteSimple(e)})}_shareIfNeeded(e){if(e.match(/^\/public\/.*[^/]$/)&&void 0===this._itemRefs[e])return this.share(e)}getItemURL(e){return r(this,void 0,void 0,function*(){if(e.match(/^\/public\/.*[^/]$/))return this._itemRefs[e]?this._itemRefs[e]:this.share(e)})}share(e){const t={body:{path:y(e)}};return this._request("POST","https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings",t).then(t=>{if(200!==t.status&&409!==t.status)return Promise.reject(new Error("Invalid response status:"+t.status));let n;try{n=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid response body: "+t.responseText))}return 409===t.status?w(n,["shared_link_already_exists"])?this._getSharedLink(e):Promise.reject(new Error("API error: "+n.error_summary)):Promise.resolve(n.url)}).then(t=>(this._itemRefs[e]=t,p&&localStorage.setItem("remotestorage:dropbox:shares",JSON.stringify(this._itemRefs)),Promise.resolve(t)),t=>(t.message='Sharing Dropbox file or folder ("'+e+'") failed: '+t.message,Promise.reject(t)))}info(){return this._request("POST","https://api.dropboxapi.com/2/users/get_current_account",{}).then(function(e){let t;try{const n=JSON.parse(e.responseText);t=null==n?void 0:n.email}catch(t){return Promise.reject(new Error("Could not query current account info: Invalid API response: "+e.responseText))}return Promise.resolve({email:t})})}_request(e,t,n){return r(this,arguments,void 0,function*(e,t,n,r=1){if(this.isForbiddenRequestMethod(e,t))throw`Don't use ${e} on directories!`;if(!this.token)throw new l.default("No access token");var i;n.headers||(n.headers={}),n.headers.Authorization="Bearer "+this.token,"object"!=typeof n.body||(i=n.body)instanceof ArrayBuffer||(0,u.isArrayBufferView)(i)||(n.body=JSON.stringify(n.body),n.headers["Content-Type"]="application/json; charset=UTF-8"),this.rs._emit("wire-busy",{method:e,isFolder:(0,c.isFolder)(t)});try{const i=yield(0,u.requestWithTimeout)(e,t,n);return this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:e,isFolder:(0,c.isFolder)(t),success:!0}),401===(null==i?void 0:i.status)&&this.refreshToken?r>=3?(console.error(`Abandoned after ${r} attempts: ${e} ${t}`),i):(this.rs._emit("wire-busy",{method:e,isFolder:(0,c.isFolder)(t)}),yield d.default.refreshAccessToken(this.rs,this,this.refreshToken),this.rs._emit("wire-done",{method:e,isFolder:(0,c.isFolder)(t),success:!0}),this._request(e,t,n,r+1)):[503,429].includes(null==i?void 0:i.status)?(this.online&&(this.online=!1,this.rs._emit("network-offline")),r>=3?(console.warn(`Abandoned after ${r} attempts: ${e} ${t}`),i):(yield new Promise(e=>setTimeout(e,(0,u.retryAfterMs)(i))),this._request(e,t,n,r+1))):i}catch(n){throw this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:e,isFolder:(0,c.isFolder)(t),success:!1}),n}})}fetchDelta(...e){if(this._fetchDeltaPromise)return this._fetchDeltaPromise;const t=e=>r(this,void 0,void 0,function*(){let n,r;"string"==typeof e?(n=m,r={cursor:e}):(n=g,r={path:"/remotestorage",recursive:!0,include_deleted:!0});try{const i=yield this._request("POST",n,{body:r});if(401===i.status)throw new l.default;if(200!==i.status&&409!==i.status)throw new Error("Invalid response status: "+i.status);let s;try{s=JSON.parse(i.responseText)}catch(e){throw new Error("Invalid response body: "+i.responseText)}if(409===i.status){if(!w(s,["path","not_found"]))throw new Error("API returned an error: "+s.error_summary);s={cursor:null,entries:[],has_more:!1}}if(e||this._revCache.deactivatePropagation(),s.entries.forEach(e=>{const t=e.path_display.slice(14);"deleted"===e[".tag"]?(this._revCache.delete(t),this._revCache.delete(t+"/")):"file"===e[".tag"]&&this._revCache.set(t,e.rev)}),this._fetchDeltaCursor=s.cursor,s.has_more)return t(s.cursor);this._revCache.activatePropagation(),this._initialFetchDone=!0}catch(e){if("timeout"===e)return;throw e}});return this._fetchDeltaPromise=t(this._fetchDeltaCursor).catch(e=>("object"==typeof e&&"message"in e?e.message="Dropbox: fetchDelta: "+e.message:e=`Dropbox: fetchDelta: ${e}`,this.rs._emit("error",e),this._fetchDeltaPromise=null,Promise.reject(e))).then(()=>(this._fetchDeltaPromise=null,Promise.resolve(e))),this._fetchDeltaPromise}_getMetadata(e){const t={path:y(e)};return this._request("POST","https://api.dropboxapi.com/2/files/get_metadata",{body:t}).then(e=>{if(200!==e.status&&409!==e.status)return Promise.reject(new Error("Invalid response status:"+e.status));let t;try{t=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid response body: "+e.responseText))}return 409===e.status?w(t,["path","not_found"])?Promise.resolve():Promise.reject(new Error("API error: "+t.error_summary)):Promise.resolve(t)}).then(void 0,t=>(t.message='Could not load metadata for file or folder ("'+e+'"): '+t.message,Promise.reject(t)))}_uploadSimple(e){const t={path:y(e.path),mode:{".tag":"overwrite",update:void 0},mute:!0};return e.ifMatch&&(t.mode={".tag":"update",update:e.ifMatch}),this._request("POST","https://content.dropboxapi.com/2/files/upload",{body:e.body,headers:{"Content-Type":"application/octet-stream","Dropbox-API-Arg":b(t)}}).then(t=>{if(200!==t.status&&409!==t.status)return Promise.resolve({statusCode:t.status});let n;try{n=JSON.parse(t.responseText)}catch(e){return Promise.reject(new Error("Invalid API result: "+t.responseText))}return 409===t.status?w(n,["path","conflict"])?this._getMetadata(e.path).then(function(e){return Promise.resolve({statusCode:412,revision:e.rev})}):(this.rs._emit("error",new Error(n.error_summary)),Promise.resolve({statusCode:t.status})):(this._revCache.set(e.path,n.rev),Promise.resolve({statusCode:t.status,revision:n.rev}))})}_deleteSimple(e){const t={path:y(e)};return this._request("POST","https://api.dropboxapi.com/2/files/delete",{body:t}).then(e=>{if(200!==e.status&&409!==e.status)return Promise.resolve({statusCode:e.status});let t;try{t=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid response body: "+e.responseText))}if(409===e.status){if(w(t,["path_lookup","not_found"]))return Promise.resolve({statusCode:404});this.rs._emit("error",new Error(t.error_summary))}return Promise.resolve({statusCode:e.status,revision:200===e.status?t.rev:void 0})}).then(t=>(200!==t.statusCode&&404!==t.statusCode||(this._revCache.delete(e),delete this._itemRefs[e]),Promise.resolve(t)),t=>(t.message='Could not delete Dropbox file or folder ("'+e+'"): '+t.message,Promise.reject(t)))}_getSharedLink(e){return r(this,void 0,void 0,function*(){const t={body:{path:y(e),direct_only:!0}};return this._request("POST","https://api.dropboxapi.com/2/sharing/list_shared_links",t).then(e=>{if(200!==e.status&&409!==e.status)return Promise.reject(new Error("Invalid response status: "+e.status));let t;try{t=JSON.parse(e.responseText)}catch(t){return Promise.reject(new Error("Invalid response body: "+e.responseText))}return 409===e.status?Promise.reject(new Error("API error: "+(null==t?void 0:t.error_summary)||0)):t.links.length?Promise.resolve(t.links[0].url):Promise.reject(new Error("No links returned"))},t=>(t.message='Could not get link to a shared file or folder ("'+e+'"): '+t.message,Promise.reject(t)))})}static _rs_init(e){p=(0,c.localStorageAvailable)(),e.apiKeys.dropbox&&(e.dropbox=new _(e)),"dropbox"===e.backend&&S(e)}static _rs_supported(){return!0}static _rs_cleanup(e){(function(e){(function(e){e._origRemote&&(e.remote=e._origRemote,delete e._origRemote)})(e),function(e){e._dropboxOrigSync&&(e.sync.sync=e._dropboxOrigSync,delete e._dropboxOrigSync)}(e),C(e)})(e),p&&localStorage.removeItem(f),e.setBackend(void 0)}}function x(e,...t){e._dropboxOrigSync||(e._dropboxOrigSync=e.sync.sync.bind(e.sync),e.sync.sync=function(){return this.dropbox.fetchDelta(e,...t).then(e._dropboxOrigSync,function(t){e._emit("error",new a.default(t)),e._emit("sync-done",{completed:!1})})}.bind(e))}function C(e){e._dropboxOrigSyncCycle&&(e.syncCycle=e._dropboxOrigSyncCycle,delete e._dropboxOrigSyncCycle)}function S(e){(function(e){e._origRemote||(e._origRemote=e.remote,e.remote=e.dropbox)})(e),e.sync?x(e):function(e,...t){e._dropboxOrigSyncCycle||(e._dropboxOrigSyncCycle=e.syncCycle,e.syncCycle=()=>{if(!e.sync)throw new Error("expected sync to be initialized by now");x(e),e._dropboxOrigSyncCycle(e,...t),C(e)})}(e)}(0,c.applyMixins)(_,[s.default]),e.exports=_},451:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=r(n(93)),s=n(746),o=r(n(334));class a{constructor(){this.addEvents(["background","foreground"]),this.mode="undefined"!=typeof window?"browser":"node","browser"===this.mode&&(this.setBrowserPrefixedNames(),document.addEventListener(this.visibilityChangeEvent,this.setVisibility.bind(this),!1),this.setVisibility())}setBrowserPrefixedNames(){"browser"===this.mode&&(void 0!==document.hidden?(this.hiddenProperty="hidden",this.visibilityChangeEvent="visibilitychange"):void 0!==document.mozHidden?(this.hiddenProperty="mozHidden",this.visibilityChangeEvent="mozvisibilitychange"):void 0!==document.msHidden?(this.hiddenProperty="msHidden",this.visibilityChangeEvent="msvisibilitychange"):void 0!==document.webkitHidden&&(this.hiddenProperty="webkitHidden",this.visibilityChangeEvent="webkitvisibilitychange"))}setVisibility(){document[this.hiddenProperty]?((0,o.default)("[Env] Going into background mode"),this.goBackground()):((0,o.default)("[Env] Going into foreground mode"),this.goForeground())}isBrowser(){return"browser"===this.mode}isNode(){return"node"===this.mode}goBackground(){this._emit("background")}goForeground(){this._emit("foreground")}static _rs_init(){}static _rs_cleanup(){}}(0,s.applyMixins)(a,[i.default]),e.exports=a},93:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.EventHandling=void 0;const i=r(n(334));class s{addEvents(e){e.forEach(e=>this._addEvent(e))}addEventListener(e,t){if("string"!=typeof e)throw new Error("Argument eventName should be a string");if("function"!=typeof t)throw new Error("Argument handler should be a function");(0,i.default)("[EventHandling] Adding event listener",e),this._validateEvent(e),this._handlers[e].push(t)}on(e,t){return this.addEventListener(e,t)}removeEventListener(e,t){this._validateEvent(e);const n=this._handlers[e].length;for(let r=0;r<n;r++)if(this._handlers[e][r]===t)return void this._handlers[e].splice(r,1)}_emit(e,...t){this._validateEvent(e),this._handlers[e].slice().forEach(e=>{e(...t)})}_validateEvent(e){if(!(e in this._handlers))throw new Error("Unknown event: "+e)}_delegateEvent(e,t){t.on(e,t=>{this._emit(e,t)})}_addEvent(e){void 0===this._handlers&&(this._handlers={}),this._handlers[e]=[]}}t.EventHandling=s,t.default=s},545:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=r(n(28)),s=r(n(451)),o=r(n(334)),a=n(746),l=r(n(370)),c=r(n(548)),u=r(n(275)),h=r(n(373)),d=r(n(424)),p=r(n(801)),f=r(n(706)),g=r(n(600)),m=r(n(313)),y=r(n(285)),v=r(n(567)),b=r(n(794)),w=r(n(365));e.exports={features:[],featuresDone:0,readyFired:!1,loadFeatures(){this.features=[],this.featuresDone=0,this.readyFired=!1,this.featureModules={WireClient:g.default,Dropbox:f.default,GoogleDrive:p.default,Access:c.default,Discover:h.default,Authorize:u.default,BaseClient:d.default,Env:s.default},i.default.cache&&(0,a.extend)(this.featureModules,{Caching:y.default,IndexedDB:v.default,LocalStorage:b.default,InMemoryStorage:w.default,Sync:m.default}),i.default.disableFeatures.forEach(e=>{this.featureModules[e]&&delete this.featureModules[e]}),this._allLoaded=!1;for(const e in this.featureModules)this.loadFeature(e)},hasFeature(e){for(let t=this.features.length-1;t>=0;t--)if(this.features[t].name===e)return this.features[t].supported;return!1},loadFeature(e){const t=this.featureModules[e],n=!t._rs_supported||t._rs_supported();(0,o.default)(`[RemoteStorage] [FEATURE ${e}] initializing ...`),"object"==typeof n?n.then(()=>{this.featureSupported(e,!0),this.initFeature(e)},()=>{this.featureSupported(e,!1)}):"boolean"==typeof n?(this.featureSupported(e,n),n&&this.initFeature(e)):this.featureSupported(e,!1)},initFeature(e){const t=this.featureModules[e];let n;try{n=t._rs_init(this)}catch(t){return void this.featureFailed(e,t)}"object"==typeof n&&"function"==typeof n.then?n.then(()=>{this.featureInitialized(e)},t=>{this.featureFailed(e,t)}):this.featureInitialized(e)},featureFailed(e,t){(0,o.default)(`[RemoteStorage] [FEATURE ${e}] initialization failed (${t})`),this.featureDone()},featureSupported(e,t){(0,o.default)(`[RemoteStorage] [FEATURE ${e}]${t?"":"not "} supported`),t||this.featureDone()},featureInitialized(e){(0,o.default)(`[RemoteStorage] [FEATURE ${e}] initialized`),this.features.push({name:e,init:this.featureModules[e]._rs_init,supported:!0,cleanup:this.featureModules[e]._rs_cleanup}),this.featureDone()},featureDone(){this.featuresDone++,this.featuresDone===Object.keys(this.featureModules).length&&setTimeout(this.featuresLoaded.bind(this),0)},_setCachingModule(){["IndexedDB","LocalStorage","InMemoryStorage"].some(e=>{if(this.features.some(t=>t.name===e))return this.features.local=this.featureModules[e],!0})},_fireReady(){try{this.readyFired||(this._emit("ready"),this.readyFired=!0)}catch(e){console.error("'ready' failed: ",e,e.stack),this._emit("error",e)}},featuresLoaded(){(0,o.default)("[RemoteStorage] All features loaded"),this._setCachingModule(),this.local=i.default.cache&&this.features.local&&new this.features.local,this.local&&this.remote?(this._setGPD(l.default,this),this._bindChange(this.local)):this.remote&&this._setGPD(this.remote,this.remote),this.remote&&(this.remote.on("connected",()=>{this._fireReady(),this._emit("connected")}),this.remote.on("not-connected",()=>{this._fireReady(),this._emit("not-connected")}),this.remote.connected&&(this._fireReady(),this._emit("connected")),this.hasFeature("Authorize")||this.remote.stopWaitingForToken()),this._collectCleanupFunctions();try{this._allLoaded=!0,this._emit("features-loaded")}catch(e){(0,a.logError)(e),this._emit("error",e)}this._processPending()},_collectCleanupFunctions(){this._cleanups=[];for(let e=0;e<this.features.length;e++){const t=this.features[e].cleanup;"function"==typeof t&&this._cleanups.push(t)}}}},801:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})};const i=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(n(93)),s=n(746),o=n(368),a=n(684),l="remotestorage:googledrive",c="application/vnd.google-apps.folder";let u;function h(e){return"/"===e.substr(-1)&&(e=e.substr(0,e.length-1)),decodeURIComponent(e)}function d(e){return e.replace(/[^\/]+\/?$/,"")}function p(e){const t=e.split("/");return"/"===e.substr(-1)?t[t.length-2]+"/":t[t.length-1]}function f(e){return(0,s.cleanPath)(`/remotestorage/${e}`)}class g{constructor(e){this._items={},this.maxAge=e,this._items={}}get(e){const t=this._items[e],n=(new Date).getTime();return t&&t.t>=n-this.maxAge?t.v:void 0}set(e,t){this._items[e]={v:t,t:(new Date).getTime()}}}class m extends a.RemoteBase{constructor(e,t){if(super(e),this.online=!0,this.storageApi="draft-dejong-remotestorage-19",this.addEvents(["connected","not-connected"]),this.clientId=t,this._fileIdCache=new g(300),u=(0,s.localStorageAvailable)(),u){const e=(0,s.getJSONFromLocalStorage)(l);e&&this.configure(e)}}configure(e){void 0!==e.userAddress&&(this.userAddress=e.userAddress),void 0!==e.token&&(this.token=e.token);const t=function(){u&&localStorage.setItem(l,JSON.stringify({userAddress:this.userAddress,token:this.token}))},n=function(){this.connected=!1,delete this.token,u&&localStorage.removeItem(l)};this.token?(this.connected=!0,this.userAddress?(this._emit("connected"),t.apply(this)):this.info().then(e=>{this.userAddress=e.user.emailAddress,this._emit("connected"),t.apply(this)}).catch(()=>{n.apply(this),this.rs._emit("error",new Error("Could not fetch user info."))})):n.apply(this)}connect(){this.rs.setBackend("googledrive"),this.rs.authorize({authURL:"https://accounts.google.com/o/oauth2/auth",scope:"https://www.googleapis.com/auth/drive",clientId:this.clientId})}get(e,t={}){return(0,s.isFolder)(e)?this._getFolder(f(e)):this._getFile(f(e),t)}put(e,t,n,r={}){const i=f(e);function s(e){if(e.status>=200&&e.status<300){const t=JSON.parse(e.responseText),n=this.stripQuotes(t.etag);return Promise.resolve({statusCode:200,contentType:t.mimeType,revision:n})}return 412===e.status?Promise.resolve({statusCode:412,revision:"conflict"}):Promise.reject("PUT failed with status "+e.status+" ("+e.responseText+")")}return this._getFileId(i).then(e=>e?r&&"*"===r.ifNoneMatch?s({status:412}):this._updateFile(e,i,t,n,r).then(s):this._createFile(i,t,n).then(s))}delete(e,t={}){const n=f(e);return this._getFileId(n).then(e=>e?this._getMeta(e).then(n=>{let r;return"object"==typeof n&&"string"==typeof n.etag&&(r=this.stripQuotes(n.etag)),t&&t.ifMatch&&t.ifMatch!==r?{statusCode:412,revision:r}:this._request("DELETE","https://www.googleapis.com/drive/v2/files/"+e,{}).then(e=>200===e.status||204===e.status?{statusCode:200}:Promise.reject("Delete failed: "+e.status+" ("+e.responseText+")"))}):Promise.resolve({statusCode:200}))}info(){return this._request("GET","https://www.googleapis.com/drive/v2/about?fields=user",{}).then(function(e){try{const t=JSON.parse(e.responseText);return Promise.resolve(t)}catch(e){return Promise.reject(e)}})}_updateFile(e,t,n,r,i){const s={mimeType:r},o={"Content-Type":"application/json; charset=UTF-8"};return i&&i.ifMatch&&(o["If-Match"]=this.addQuotes(i.ifMatch)),this._request("PUT","https://www.googleapis.com/upload/drive/v2/files/"+e+"?uploadType=resumable",{body:JSON.stringify(s),headers:o}).then(e=>412===e.status?e:this._request("PUT",e.getResponseHeader("Location"),{body:r.match(/^application\/json/)?JSON.stringify(n):n}))}_createFile(e,t,n){return this._getParentId(e).then(r=>{const i={title:h(p(e)),mimeType:n,parents:[{kind:"drive#fileLink",id:r}]};return this._request("POST","https://www.googleapis.com/upload/drive/v2/files?uploadType=resumable",{body:JSON.stringify(i),headers:{"Content-Type":"application/json; charset=UTF-8"}}).then(e=>this._request("POST",e.getResponseHeader("Location"),{body:n.match(/^application\/json/)?JSON.stringify(t):t}))})}_getFile(e,t){return this._getFileId(e).then(e=>this._getMeta(e).then(e=>{let n;if("object"==typeof e&&"string"==typeof e.etag&&(n=this.stripQuotes(e.etag)),t&&t.ifNoneMatch&&n===t.ifNoneMatch)return Promise.resolve({statusCode:304});if(!e.downloadUrl){if(!e.exportLinks||!e.exportLinks["text/html"])return Promise.resolve({statusCode:200,body:"",contentType:e.mimeType,revision:n});e.mimeType+=";export=text/html",e.downloadUrl=e.exportLinks["text/html"]}return this._request("GET",e.downloadUrl,{responseType:"arraybuffer"}).then(t=>(0,s.getTextFromArrayBuffer)(t.response,"UTF-8").then(function(r){let i=r;if(e.mimeType.match(/^application\/json/))try{i=JSON.parse(i)}catch(e){}else(0,s.shouldBeTreatedAsBinary)(r,e.mimeType)&&(i=t.response);return{statusCode:200,body:i,contentType:(0,s.stripLegacyCharsetBinary)(e.mimeType),revision:n}}))}))}_getFolder(e){return this._getFileId(e).then(t=>{let n,r,i;if(!t)return Promise.resolve({statusCode:404});const o="'"+t+"' in parents";return this._request("GET","https://www.googleapis.com/drive/v2/files?q="+encodeURIComponent(o)+"&fields=items(downloadUrl%2Cetag%2CfileSize%2Cid%2CmimeType%2Ctitle%2Clabels)&maxResults=1000&trashed=false",{}).then(t=>{var o;if(200!==t.status)return Promise.reject("request failed or something: "+t.status);try{n=JSON.parse(t.responseText)}catch(e){return Promise.reject("non-JSON response from GoogleDrive")}i={};for(const a of n.items)null!==(o=a.labels)&&void 0!==o&&o.trashed||(r=this.stripQuotes(a.etag),a.mimeType===c?(this._fileIdCache.set(e+(0,s.cleanPath)(a.title)+"/",a.id),i[a.title+"/"]={ETag:r}):(this._fileIdCache.set(e+(0,s.cleanPath)(a.title),a.id),i[a.title]={ETag:r,"Content-Type":a.mimeType,"Content-Length":a.fileSize}));return Promise.resolve({statusCode:200,body:i,contentType:"application/json; charset=UTF-8",revision:void 0})})})}_getParentId(e){const t=d(e);return this._getFileId(t).then(e=>e?Promise.resolve(e):this._createFolder(t))}_createFolder(e){return this._getParentId(e).then(t=>this._request("POST","https://www.googleapis.com/drive/v2/files",{body:JSON.stringify({title:h(p(e)),mimeType:c,parents:[{id:t}]}),headers:{"Content-Type":"application/json; charset=UTF-8"}}).then(e=>{const t=JSON.parse(e.responseText);return Promise.resolve(t.id)}))}_getFileId(e){let t;return"/"===e?Promise.resolve("root"):(t=this._fileIdCache.get(e))?Promise.resolve(t):this._getFolder(d(e)).then(()=>(t=this._fileIdCache.get(e),t?Promise.resolve(t):"/"===e.substr(-1)?this._createFolder(e).then(()=>this._getFileId(e)):Promise.resolve()))}_getMeta(e){return this._request("GET","https://www.googleapis.com/drive/v2/files/"+e,{}).then(function(t){return 200===t.status?Promise.resolve(JSON.parse(t.responseText)):Promise.reject("request (getting metadata for "+e+") failed with status: "+t.status)})}_request(e,t,n){return this.isForbiddenRequestMethod(e,t)?Promise.reject(`Don't use ${e} on directories!`):(n.headers||(n.headers={}),n.headers.Authorization="Bearer "+this.token,this.rs._emit("wire-busy",{method:e,isFolder:(0,s.isFolder)(t)}),(0,o.requestWithTimeout)(e,t,n).then(n=>n&&401===n.status?void this.connect():(this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:e,isFolder:(0,s.isFolder)(t),success:!0}),Promise.resolve(n)),n=>(this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:e,isFolder:(0,s.isFolder)(t),success:!1}),Promise.reject(n))))}getItemURL(e){return r(this,void 0,void 0,function*(){throw new Error("getItemURL is not implemented for Google Drive yet")})}static _rs_init(e){const t=e.apiKeys.googledrive;t&&(e.googledrive=new m(e,t.clientId),"googledrive"===e.backend&&(e._origRemote=e.remote,e.remote=e.googledrive))}static _rs_supported(){return!0}static _rs_cleanup(e){e.setBackend(void 0),e._origRemote&&(e.remote=e._origRemote,delete e._origRemote)}}(0,s.applyMixins)(m,[i.default]),e.exports=m},567:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const s=i(n(93)),o=i(n(496)),a=i(n(334)),l=n(746),c="remotestorage";let u;class h extends o.default{constructor(e){super(),this.addEvents(["change","local-events-done"]),this.db=e||u,this.db?(this.getsRunning=0,this.putsRunning=0,this.changesQueued={},this.changesRunning={},this.commitSlownessWarning=null):(0,a.default)("[IndexedDB] Failed to open DB")}getNodes(e){return r(this,void 0,void 0,function*(){const t=[],n={};for(let r=0,i=e.length;r<i;r++)void 0!==this.changesQueued[e[r]]?n[e[r]]=(0,l.deepClone)(this.changesQueued[e[r]]||void 0):void 0!==this.changesRunning[e[r]]?n[e[r]]=(0,l.deepClone)(this.changesRunning[e[r]]||void 0):t.push(e[r]);return t.length>0?this.getNodesFromDb(t).then(function(e){for(const t in n)e[t]=n[t];return e}):n})}setNodes(e){return r(this,void 0,void 0,function*(){for(const t in e)this.changesQueued[t]=e[t]||!1;this.maybeFlush()})}maybeFlush(){0===this.putsRunning?this.flushChangesQueued():this.commitSlownessWarning||(this.commitSlownessWarning=n.g.setInterval(function(){console.warn("WARNING: waited more than 10 seconds for previous commit to finish")},1e4))}flushChangesQueued(){this.commitSlownessWarning&&(clearInterval(this.commitSlownessWarning),this.commitSlownessWarning=null),Object.keys(this.changesQueued).length>0&&(this.changesRunning=this.changesQueued,this.changesQueued={},this.setNodesInDb(this.changesRunning).then(this.flushChangesQueued.bind(this)))}getNodesFromDb(e){return new Promise((t,n)=>{const r=this.db.transaction(["nodes"],"readonly"),i=r.objectStore("nodes"),s={};this.getsRunning++,e.map(e=>{i.get(e).onsuccess=t=>{s[e]=t.target.result}}),r.oncomplete=()=>{t(s),this.getsRunning--},r.onerror=r.onabort=()=>{n("get transaction error/abort"),this.getsRunning--}})}setNodesInDb(e){return r(this,void 0,void 0,function*(){return new Promise((t,n)=>{const r=this.db.transaction(["nodes"],"readwrite"),i=r.objectStore("nodes"),s=(new Date).getTime();this.putsRunning++,(0,a.default)("[IndexedDB] Starting puts",e,this.putsRunning);for(const o in e){const t=e[o];if("object"==typeof t)try{i.put(t)}catch(e){throw(0,a.default)("[IndexedDB] Error while putting",t,e),e}else try{i.delete(o)}catch(e){throw(0,a.default)("[IndexedDB] Error while removing",i,t,e),e}}r.oncomplete=()=>{this.putsRunning--,(0,a.default)("[IndexedDB] Finished puts",e,this.putsRunning,(new Date).getTime()-s+"ms"),t()},r.onerror=()=>{this.putsRunning--,n("transaction error")},r.onabort=()=>{n("transaction abort"),this.putsRunning--}})})}reset(e){const t=this.db.name;this.db.close(),h.clean(t,()=>{h.open(t,(n,r)=>{n?(0,a.default)(`[IndexedDB] Error while resetting database ${t}:`,n):this.db=r,"function"==typeof e&&e(self)})})}forAllNodes(e){return r(this,void 0,void 0,function*(){return new Promise(t=>{this.db.transaction(["nodes"],"readonly").objectStore("nodes").openCursor().onsuccess=n=>{const r=n.target.result;r?(e(r.value),r.continue()):t()}})})}closeDB(){0===this.putsRunning?this.db.close():setTimeout(this.closeDB.bind(this),100)}static open(e,t){const n=setTimeout(function(){t("timeout trying to open db")},1e4);try{const r=indexedDB.open(e,2);r.onerror=function(){(0,a.default)("[IndexedDB] Opening DB failed",r),clearTimeout(n),t(r.error)},r.onupgradeneeded=function(e){const t=r.result;(0,a.default)("[IndexedDB] Upgrade: from ",e.oldVersion," to ",e.newVersion),t.objectStoreNames.contains("nodes")||((0,a.default)("[IndexedDB] Creating object store: nodes"),t.createObjectStore("nodes",{keyPath:"path"})),t.objectStoreNames.contains("changes")||((0,a.default)("[IndexedDB] Creating object store: changes"),t.createObjectStore("changes",{keyPath:"path"}))},r.onsuccess=function(){clearTimeout(n);const i=r.result;if(!i.objectStoreNames.contains("nodes")||!i.objectStoreNames.contains("changes"))return(0,a.default)("[IndexedDB] Missing object store. Resetting the database."),i.close(),void h.clean(e,function(){h.open(e,t)});t(null,r.result)}}catch(r){(0,a.default)("[IndexedDB] Failed to open database: "+r),(0,a.default)("[IndexedDB] Resetting database and trying again."),clearTimeout(n),h.clean(e,function(){h.open(e,t)})}}static clean(e,t){const n=indexedDB.deleteDatabase(e);n.onblocked=function(t){console.warn(`Deleting IndexedDB database "${e}" is blocked by another open connection`,t)},n.onsuccess=function(){(0,a.default)(`[IndexedDB] Deleted database "${e}"`),t()},n.onerror=n.onabort=function(t){console.error('Failed to remove database "'+e+'"',t)}}static _rs_init(e){return new Promise((t,n)=>{h.open(c,function(r,i){if(r)n(r);else{if(!i)return void n(new Error("IndexedDB opened without a database instance"));u=i,i.onerror=t=>{e._emit("error",h.eventToError(t))},t()}})})}static _rs_supported(){return new Promise((e,t)=>{const n=(0,l.getGlobalContext)();let r=!1;if("undefined"!=typeof navigator&&navigator.userAgent.match(/Android (2|3|4\.[0-3])/)&&(navigator.userAgent.match(/Chrome|Firefox/)||(r=!0)),"indexedDB"in n&&!r)try{const n=indexedDB.open("rs-check");n.onerror=function(){t()},n.onsuccess=function(){n.result.close(),indexedDB.deleteDatabase("rs-check"),e()}}catch(e){t()}else t()})}static _rs_cleanup(e){return new Promise(t=>{e.local instanceof h&&e.local.closeDB(),h.clean(c,t)})}static eventToError(e){var t;const n=null==e?void 0:e.target,r=null==n?void 0:n.error;if(r)return r;if(null===(t=null==n?void 0:n.db)||void 0===t?void 0:t.name){const e=n.objectStoreNames,t=e?Array.from(e).join(", "):"";return new Error(`Error in store(s) “${t}” in database “${n.db.name}”`)}return new Error("Unknown IndexedDB error")}diffHandler(){}}(0,l.applyMixins)(h,[s.default]),e.exports=h},365:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=r(n(93)),s=r(n(496)),o=n(746);class a extends s.default{constructor(){super(),this._storage={},this.addEvents(["change","local-events-done"])}getNodes(e){const t={};for(let n=0,r=e.length;n<r;n++)t[e[n]]=(0,o.deepClone)(this._storage[e[n]]);return Promise.resolve(t)}setNodes(e){for(const t in e)void 0===e[t]?delete this._storage[t]:this._storage[t]=e[t];return Promise.resolve()}forAllNodes(e){for(const t in this._storage)e(this._storage[t]);return Promise.resolve()}diffHandler(){}static _rs_init(){}static _rs_supported(){return!0}static _rs_cleanup(){}}(0,o.applyMixins)(a,[i.default]),e.exports=a},794:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const i=r(n(496)),s=r(n(93)),o=r(n(334)),a=n(746),l="remotestorage:cache:nodes:";function c(e){return e.substr(0,26)===l||"remotestorage:cache:changes:"===e.substr(0,28)}function u(e){return e.substr(0,26)===l}class h extends i.default{constructor(){super(),this.addEvents(["change","local-events-done"])}diffHandler(...e){}getNodes(e){const t={};for(let n=0,i=e.length;n<i;n++)try{const r=JSON.parse(localStorage.getItem(l+e[n]));t[e[n]]=r||void 0}catch(r){(0,o.default)(`[LocalStorage] Failed to get node: ${r.message}`),t[e[n]]=void 0}return Promise.resolve(t)}setNodes(e){for(const t in e)localStorage.setItem(l+t,JSON.stringify(e[t]));return Promise.resolve()}forAllNodes(e){let t;for(let n=0,r=localStorage.length;n<r;n++)if(u(localStorage.key(n))){try{t=JSON.parse(localStorage.getItem(localStorage.key(n)))}catch(e){t=void 0}t&&e(t)}return Promise.resolve()}static _rs_init(){}static _rs_supported(){return(0,a.localStorageAvailable)()}static _rs_cleanup(){const e=[];(0,o.default)("[LocalStorage] Starting cleanup");for(let t=0,n=localStorage.length;t<n;t++){const n=localStorage.key(t);c(n)&&e.push(n)}for(const t in e)(0,o.default)("[LocalStorage] Removing",t),localStorage.removeItem(t)}}(0,a.applyMixins)(h,[s.default]),e.exports=h},334:function(e,t,n){const r=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(n(28));e.exports=function(...e){r.default.logging&&console.log(...e)}},684:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RemoteBase=void 0;const i=r(n(93)),s=n(746);class o extends i.default{constructor(e){super(),this.rs=e,this.connected=!1}stopWaitingForToken(){this.connected||this._emit("not-connected")}addQuotes(e){return"string"!=typeof e?e:"*"===e?"*":'"'+e+'"'}stripQuotes(e){return"string"!=typeof e?e:e.replace(/^["']|["']$/g,"")}isForbiddenRequestMethod(e,t){return("PUT"===e||"DELETE"===e)&&(0,s.isFolder)(t)}}t.RemoteBase=o},423:function(e,t,n){var r,i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||(r=function(e){return r=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},r(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n=r(e),o=0;o<n.length;o++)"default"!==n[o]&&i(t,e,n[o]);return s(t,e),t}),a=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.RemoteStorage=void 0;const c=l(n(28)),u=l(n(334)),h=n(746),d=l(n(548)),p=l(n(275)),f=l(n(424)),g=l(n(285)),m=n(93),y=l(n(801)),v=l(n(706)),b=l(n(373)),w=l(n(982)),_=l(n(503)),x=l(n(545)),C=o(n(746)),S=(0,h.getGlobalContext)();let k;const E="remotestorage:authorized-scope",R="remotestorage:pending-scope";function T(e){if("string"!=typeof e)return null;const t=e.trim().split(/\s+/).filter(Boolean);return 0===t.length?null:Array.from(new Set(t)).sort().join(" ")}function L(e){const t=(0,h.getJSONFromLocalStorage)(e);return"object"==typeof t&&null!==t?t:null}function I(e){return 403!==e.statusCode&&401!==e.statusCode||this._emit("error",new _.default),Promise.resolve(e)}function P(e){return"number"==typeof e&&e>=2e3&&e<=36e5}var M;!function(e){e.GOOGLE="googledrive",e.DROPBOX="dropbox"}(M||(M={}));class A{constructor(e){if(this._pending=[],this._cleanups=[],this._pathHandlers={change:{}},this.apiKeys={},this._init=x.default.loadFeatures,this.features=x.default.features,this.loadFeature=x.default.loadFeature,this.featureSupported=x.default.featureSupported,this.featureDone=x.default.featureDone,this.featuresDone=x.default.featuresDone,this.featuresLoaded=x.default.featuresLoaded,this.featureInitialized=x.default.featureInitialized,this.featureFailed=x.default.featureFailed,this.hasFeature=x.default.hasFeature,this._setCachingModule=x.default._setCachingModule,this._collectCleanupFunctions=x.default._collectCleanupFunctions,this._fireReady=x.default._fireReady,this.initFeature=x.default.initFeature,"object"==typeof e&&null!==e){const t=e,{discovery:n}=t,r=a(t,["discovery"]);Object.assign(c.default,r),n&&"object"==typeof n&&Object.assign(c.default.discovery,n)}if(this.addEvents(["ready","authing","connecting","connected","disconnected","not-connected","conflict","error","features-loaded","scope-change-required","sync-interval-change","sync-started","sync-req-done","sync-done","wire-busy","wire-done","network-offline","network-online"]),this._setGPD({get:this._pendingGPD("get"),put:this._pendingGPD("put"),delete:this._pendingGPD("delete")}),k=(0,h.localStorageAvailable)(),k){this.apiKeys=(0,h.getJSONFromLocalStorage)("remotestorage:api-keys")||{};const e=localStorage.getItem("remotestorage:backend");"dropbox"===e||"googledrive"===e?this.setBackend(e):this.setBackend("remotestorage")}this._authorizedScope=this._loadAuthorizedScope(),this._scopeChangeRequired=!1,this._scopeChangeEvent=null;const t=this.on;this.on=function(e,n){const r=t.call(this,e,n);if("scope-change-required"===e&&this._scopeChangeRequired&&this._scopeChangeEvent&&setTimeout(()=>{n(this._scopeChangeEvent)},0),this._allLoaded)switch(e){case"features-loaded":setTimeout(n,0);break;case"ready":this.remote&&setTimeout(n,0);break;case"connected":this.remote&&this.remote.connected&&setTimeout(n,0);break;case"not-connected":this.remote&&!this.remote.connected&&setTimeout(n,0)}return r},this._init(),this.fireInitial=function(){this.local&&setTimeout(this.local.fireInitial.bind(this.local),0)}.bind(this),this.on("ready",this.fireInitial.bind(this)),this.loadModules()}get connected(){return this.remote.connected}get scopeChangeRequired(){return this._scopeChangeRequired}loadModules(){c.default.modules.forEach(this.addModule.bind(this))}authorize(e){if(this.access.setStorageType(this.remote.storageApi),void 0===e.scope&&(e.scope=this.access.scopeParameter),S.cordova&&"string"==typeof c.default.cordovaRedirectUri)e.redirectUri=c.default.cordovaRedirectUri;else{const t=p.default.getLocation();let n=t.origin;"/"!==t.pathname&&(n+=t.pathname),e.redirectUri=n}void 0===e.clientId&&(e.clientId=e.redirectUri.match(/^(https?:\/\/[^/]+)/)[0]),p.default.authorize(this,e)}impliedauth(e,t){e=e||this.remote.storageApi,t=t||String(document.location),(0,u.default)("ImpliedAuth proceeding due to absent authURL; storageApi = "+e+" redirectUri = "+t),this.remote.configure({token:p.default.IMPLIED_FAKE_TOKEN}),document.location.href=t}connect(e,t){if(this.setBackend("remotestorage"),e.indexOf("@")<0&&!e.match(/^(https?:\/\/)?[^\s\/$\.?#]+\.[^\s]*$/))this._emit("error",new A.DiscoveryError("Not a valid user address or URL."));else{if(e.indexOf("@")<0&&!e.match(/^https?:\/\//)&&(e=`https://${e}`),S.cordova){if("string"!=typeof c.default.cordovaRedirectUri)return void this._emit("error",new A.DiscoveryError("Please supply a custom HTTPS redirect URI for your Cordova app"));if(!S.cordova.InAppBrowser)return void this._emit("error",new A.DiscoveryError("Please include the InAppBrowser Cordova plugin to enable OAuth"))}this.remote.configure({userAddress:e}),this._emit("connecting"),A.Discover(e).then(n=>{if(this._emit("authing"),n.userAddress=e,this.remote.configure(n),!this.remote.connected)if(n.authURL)if(void 0===t)this.authorize({authURL:n.authURL});else{if("string"!=typeof t)throw new Error("Supplied bearer token must be a string");(0,u.default)("Skipping authorization sequence and connecting with known token"),this.remote.configure({token:t}),this._rememberAuthorizedScope(this.access.scopeParameter)}else this.impliedauth()},()=>{this._emit("error",new A.DiscoveryError("No storage information found for this user address."))})}}reconnect(){this.remote.configure({token:null}),"remotestorage"===this.backend?this.connect(this.remote.userAddress):this.remote.connect()}reauthorize(){this.reconnect()}disconnect(){this.remote&&this.remote.configure({userAddress:null,href:null,storageApi:null,token:null,refreshToken:null,properties:null}),this._forgetPendingScope(),this._rememberAuthorizedScope(null),this._setGPD({get:this._pendingGPD("get"),put:this._pendingGPD("put"),delete:this._pendingGPD("delete")});const e=this._cleanups.length;let t=0;const n=()=>{t++,t>=e&&(this._init(),(0,u.default)('Cleanups done, emitting "disconnected" event'),this._emit("disconnected"))};e>0?this._cleanups.forEach(e=>{const t=e(this);"object"==typeof t&&"function"==typeof t.then?t.then(n):n()}):n()}setBackend(e){if(this.backend=e,k&&(void 0!==e?localStorage.setItem("remotestorage:backend",e):localStorage.removeItem("remotestorage:backend")),void 0===e)return this._authorizedScope=null,this._scopeChangeRequired=!1,void(this._scopeChangeEvent=null);this._authorizedScope=this._loadAuthorizedScope(),this._checkScopeChange()}_rememberPendingScope(e){const t=T(e);k&&(t&&this.backend?localStorage.setItem(R,JSON.stringify({backend:this.backend,scope:t})):localStorage.removeItem(R))}_forgetPendingScope(){k&&localStorage.removeItem(R)}_rememberAuthorizedScope(e){const t=T(e);k?t&&this.backend?(localStorage.setItem(E,JSON.stringify({backend:this.backend,scope:t})),this._authorizedScope=t,this._checkScopeChange()):(localStorage.removeItem(E),this._authorizedScope=null,this._checkScopeChange()):(this._authorizedScope=t,this._checkScopeChange())}_completeAuthorization(e){const t=this._loadPendingScope()||T(e);this._forgetPendingScope(),t?this._rememberAuthorizedScope(t):this._checkScopeChange()}_checkScopeChange(){const e=T(this.access.scopeParameter),t=this._authorizedScope||this._loadAuthorizedScope(),n=!(!e||!t||e===t),r=n&&(!this._scopeChangeRequired||!this._scopeChangeEvent||this._scopeChangeEvent.requestedScope!==e||this._scopeChangeEvent.authorizedScope!==t);this._scopeChangeRequired=n,n?(this._scopeChangeEvent=this._buildScopeChangeEvent(e,t),r&&this._emit("scope-change-required",this._scopeChangeEvent)):this._scopeChangeEvent=null}_loadAuthorizedScope(){if(!k||!this.backend)return null;const e=L(E);return e&&e.backend===this.backend?T(e.scope):null}_loadPendingScope(){if(!k||!this.backend)return null;const e=L(R);return e&&e.backend===this.backend?T(e.scope):null}_buildScopeChangeEvent(e=T(this.access.scopeParameter),t=this._authorizedScope){return{requestedScope:e||"",authorizedScope:t||"",reauthorize:this.reauthorize.bind(this)}}onChange(e,t){this._pathHandlers.change[e]||(this._pathHandlers.change[e]=[]),this._pathHandlers.change[e].push(t)}enableLog(){c.default.logging=!0}disableLog(){c.default.logging=!1}log(...e){u.default.apply(A,e)}setApiKeys(e){const t=[M.GOOGLE,M.DROPBOX];if("object"!=typeof e||!Object.keys(e).every(e=>t.includes(e)))return console.error("setApiKeys() was called with invalid arguments"),!1;Object.keys(e).forEach(t=>{const n=e[t];if(n){switch(t){case M.DROPBOX:this.apiKeys[M.DROPBOX]={appKey:n},void 0!==this.dropbox&&this.dropbox.clientId===n||v.default._rs_init(this);break;case M.GOOGLE:this.apiKeys[M.GOOGLE]={clientId:n},void 0!==this.googledrive&&this.googledrive.clientId===n||y.default._rs_init(this)}return!0}delete this.apiKeys[t]}),k&&localStorage.setItem("remotestorage:api-keys",JSON.stringify(this.apiKeys))}setCordovaRedirectUri(e){if("string"!=typeof e||!e.match(/http(s)?:\/\//))throw new Error("Cordova redirect URI must be a URI string");c.default.cordovaRedirectUri=e}_setGPD(e,t){function n(e){return function(...n){return e.apply(t,n).then(I.bind(this))}}this.get=n(e.get),this.put=n(e.put),this.delete=n(e.delete)}_pendingGPD(e){return(...t)=>{const n=Array.prototype.slice.call(t);return new Promise((t,r)=>{this._pending.push({method:e,args:n,promise:{resolve:t,reject:r}})})}}_processPending(){this._pending.forEach(e=>{try{this[e.method](...e.args).then(e.promise.resolve,e.promise.reject)}catch(t){e.promise.reject(t)}}),this._pending=[]}_bindChange(e){e.on("change",this._dispatchEvent.bind(this,"change"))}_dispatchEvent(e,t){Object.keys(this._pathHandlers[e]).forEach(n=>{const r=n.length;t.path.substr(0,r)===n&&this._pathHandlers[e][n].forEach(e=>{const r={};for(const n in t)r[n]=t[n];r.relativePath=t.path.replace(new RegExp("^"+n),"");try{e(r)}catch(e){console.error("'change' handler failed: ",e,e.stack),this._emit("error",e)}})})}scope(e){if("string"!=typeof e)throw"Argument 'path' of baseClient.scope must be a string";return this.access.checkPathPermission(e,"r")||console.warn("WARNING: Please use remoteStorage.access.claim() to ask for access permissions first: https://remotestorage.io/rs.js/docs/api/access/classes/Access.html#claim"),new f.default(this,e)}getSyncInterval(){return c.default.syncInterval}setSyncInterval(e){if(!P(e))throw e+" is not a valid sync interval";const t=c.default.syncInterval;c.default.syncInterval=e,this._emit("sync-interval-change",{oldValue:t,newValue:e})}getBackgroundSyncInterval(){return c.default.backgroundSyncInterval}setBackgroundSyncInterval(e){if(!P(e))throw e+" is not a valid sync interval";const t=c.default.backgroundSyncInterval;c.default.backgroundSyncInterval=e,this._emit("sync-interval-change",{oldValue:t,newValue:e})}getCurrentSyncInterval(){return c.default.isBackground?c.default.backgroundSyncInterval:c.default.syncInterval}getRequestTimeout(){return c.default.requestTimeout}setRequestTimeout(e){if("number"!=typeof e)throw e+" is not a valid request timeout";c.default.requestTimeout=e}setupSyncCycle(){this.sync&&!this.sync.stopped&&((0,u.default)("[Sync] Setting up sync cycle"),this.on("sync-done",()=>{(0,u.default)("[Sync] Sync done. Setting timer to",this.getCurrentSyncInterval()),this.sync&&!this.sync.stopped&&(this._syncTimer&&clearTimeout(this._syncTimer),this._syncTimer=setTimeout(this.sync.sync.bind(this.sync),this.getCurrentSyncInterval()))}),this.sync.sync())}startSync(){return c.default.cache?(this.sync.stopped=!1,this.syncStopped=!1,this.sync.sync()):(console.warn("Nothing to sync, because caching is disabled."),Promise.resolve())}stopSync(){clearTimeout(this._syncTimer),this._syncTimer=void 0,this.sync?((0,u.default)("[Sync] Stopping sync"),this.sync.stopped=!0):((0,u.default)("[Sync] Will instantiate sync stopped"),this.syncStopped=!0)}addModule(e){const t=e.name,n=e.builder;if(Object.defineProperty(this,t,{configurable:!0,get:function(){const e=this._loadModule(t,n);return Object.defineProperty(this,t,{value:e}),e}}),-1!==t.indexOf("-")){const e=t.replace(/\-[a-z]/g,function(e){return e[1].toUpperCase()});Object.defineProperty(this,e,{get:function(){return this[t]}})}}_loadModule(e,t){if(t)return t(new f.default(this,"/"+e+"/"),new f.default(this,"/public/"+e+"/")).exports;throw"Unknown module: "+e}}t.RemoteStorage=A,A.SyncError=w.default,A.Unauthorized=_.default,A.Discover=b.default,A.DiscoveryError=b.default.DiscoveryError,A.util=C,Object.defineProperty(A.prototype,"access",{configurable:!0,get:function(){const e=new d.default(this);return Object.defineProperty(this,"access",{value:e,writable:!0,configurable:!0}),e}}),Object.defineProperty(A.prototype,"caching",{configurable:!0,get:function(){const e=new g.default(this);return Object.defineProperty(this,"caching",{value:e,writable:!0,configurable:!0}),e}}),(0,h.applyMixins)(A,[m.EventHandling]),t.default=A},368:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isArrayBufferView=void 0,t.retryAfterMs=function(e){const t=1e3*parseInt(e.getResponseHeader("Retry-After"));return t>=1e3?t:Math.max(1500,Math.min(6e4,Math.round(o.default.syncInterval/(2.9+.2*Math.random()))))},t.requestWithTimeout=function(e,n,i){return r(this,void 0,void 0,function*(){return"function"==typeof fetch?function(e,t,n){return r(this,void 0,void 0,function*(){const r="function"==typeof AbortController?new AbortController:null;let i;const a=new Promise((e,t)=>{i=setTimeout(()=>{r&&r.abort(),t("timeout")},o.default.requestTimeout)});let l;const c={},u=fetch(t,{method:e,headers:n.headers,body:n.body,signal:r?r.signal:void 0}).then(e=>{switch((0,s.default)("[requests fetch]",e),e.headers.forEach((e,t)=>{c[t.toUpperCase()]=e}),l={readyState:4,status:e.status,statusText:e.statusText,response:void 0,getResponseHeader:e=>c[e.toUpperCase()]||null,responseType:n.responseType,responseURL:t},n.responseType){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json();case void 0:case"":case"text":return e.text();default:throw new Error("responseType 'document' is not currently supported using fetch")}}).then(e=>(l.response=e,n.responseType&&"text"!==n.responseType||(l.responseText=e),l)).finally(()=>{clearTimeout(i)});return Promise.race([u,a])})}(e,n,i):"function"==typeof XMLHttpRequest?function(e,n,i){return r(this,void 0,void 0,function*(){return new Promise((r,a)=>{(0,s.default)("[requests XHR]",e,n);let l=!1;const c=setTimeout(()=>{l=!0,a("timeout")},o.default.requestTimeout),u=new XMLHttpRequest;if(u.open(e,n,!0),i.responseType&&(u.responseType=i.responseType),i.headers)for(const e in i.headers)u.setRequestHeader(e,i.headers[e]);u.onload=()=>{l||(clearTimeout(c),r(u))},u.onerror=e=>{l||(clearTimeout(c),a(e))};let h=i.body;"object"==typeof h&&!(0,t.isArrayBufferView)(h)&&h instanceof ArrayBuffer&&(h=new Uint8Array(h)),u.send(h)})})}(e,n,i):Promise.reject("[Requests] You need to add a polyfill for fetch or XMLHttpRequest")})};const s=i(n(334)),o=i(n(28));if("function"==typeof(n.g||window).ArrayBufferView)t.isArrayBufferView=function(e){return e&&e instanceof(n.g||window).ArrayBufferView};else{const e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];t.isArrayBufferView=function(t){for(let n=0;n<8;n++)if(t instanceof e[n])return!0;return!1}}},941:function(e){e.exports=class{constructor(e){this._itemsRev={},this._storage={},this._canPropagate=!1,this.defaultValue=e,this.activatePropagation()}get(e){e=e.toLowerCase();let t=this._storage[e];return void 0===t&&(t=this.defaultValue,this._storage[e]=t),t}set(e,t){return e=e.toLowerCase(),this._storage[e]===t||(this._storage[e]=t,t||delete this._itemsRev[e],this._updateParentFolderItemRev(e,t),this._canPropagate&&this._propagate(e)),t}delete(e){return this.set(e,null)}deactivatePropagation(){return this._canPropagate=!1,!0}activatePropagation(){return this._canPropagate||(this._generateFolderRev("/"),this._canPropagate=!0),!0}_hashCode(e){let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}_generateHash(e){const t=e.sort().join("|");return""+this._hashCode(t)}_updateParentFolderItemRev(e,t){if("/"!==e){const n=this._getParentFolder(e);this._itemsRev[n]||(this._itemsRev[n]={});const r=this._itemsRev[n];t?r[e]=t:delete r[e],this._updateParentFolderItemRev(n,this.defaultValue)}}_getParentFolder(e){return e.substr(0,e.lastIndexOf("/",e.length-2)+1)}_propagate(e){if("/"!==e){const t=this._getParentFolder(e),n=this._itemsRev[t],r=[];for(const e in n)r.push(n[e]);const i=this._generateHash(r);this.set(t,i)}}_generateFolderRev(e){const t=this._itemsRev[e];let n=this.defaultValue;if(t){const e=[];for(const n in t){let r;r="/"===n.substr(-1)?this._generateFolderRev(n):t[n],e.push(r)}e.length>0&&(n=this._generateHash(e))}return this.set(e,n),n}}},491:function(e){class t extends Error{constructor(e){super();const t=new Error("Schema not found: "+e);return t.name="SchemaNotFound",t}}e.exports=t},982:function(e){class t extends Error{constructor(e){super(),this.name="SyncError",this.message="Sync failed: ","string"==typeof e?this.message+=e:(this.message+=e.message,this.stack=e.stack,this.originalError=e)}}e.exports=t},313:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Sync=void 0;const s=i(n(28)),o=i(n(451)),a=i(n(93)),l=i(n(334)),c=i(n(275)),u=i(n(982)),h=i(n(503)),d=n(746);let p,f;function g(e,t,n){return{action:e,path:t,promise:n}}function m(e,t){return e.common.revision!==t&&(!e.remote||e.remote.revision!==t)}function y(e){return!!e.common&&!!e.common.revision}class v{constructor(e){this.numThreads=10,this._tasks={},this._running={},this._timeStarted={},this._finishedTasks=[],this.rs=e,this.rs.local.onDiff(e=>{this.addTask(e),this.doTasks()}),this.rs.caching.onActivate(e=>{this.addTask(e),this.doTasks()}),this.addEvents(["done","req-done"])}now(){return(new Date).getTime()}queueGetRequest(e){return r(this,void 0,void 0,function*(){return new Promise((t,n)=>{this.rs.remote.connected?this.rs.remote.online?(this.addTask(e,function(){this.rs.local.get(e).then(e=>t(e))}.bind(this)),this.doTasks()):n("cannot fulfill maxAge requirement - remote is not online"):n("cannot fulfill maxAge requirement - remote is not connected")})})}corruptServerItemsMap(e){if("object"!=typeof e||Array.isArray(e))return!0;for(const t in e){const n=e[t];if("object"!=typeof n)return!0;if("string"!=typeof n.ETag)return!0;if((0,d.isFolder)(t)){if(-1!==t.substring(0,t.length-1).indexOf("/"))return!0}else if(-1!==t.indexOf("/"))return!0}return!1}corruptItemsMap(e){if("object"!=typeof e||Array.isArray(e))return!0;for(const t in e)if("boolean"!=typeof e[t])return!0;return!1}corruptRevision(e){return"object"!=typeof e||Array.isArray(e)||e.revision&&"string"!=typeof e.revision||e.body&&"string"!=typeof e.body&&"object"!=typeof e.body||e.contentType&&"string"!=typeof e.contentType||e.contentLength&&"number"!=typeof e.contentLength||e.timestamp&&"number"!=typeof e.timestamp||e.itemsMap&&this.corruptItemsMap(e.itemsMap)}isCorrupt(e){return"object"!=typeof e||Array.isArray(e)||"string"!=typeof e.path||this.corruptRevision(e.common)||e.local&&this.corruptRevision(e.local)||e.remote&&this.corruptRevision(e.remote)||e.push&&this.corruptRevision(e.push)}hasTasks(){return Object.keys(this._tasks).length>0}collectDiffTasks(){return r(this,void 0,void 0,function*(){let e=0;return this.rs.local.forAllNodes(t=>{e>100||(this.isCorrupt(t)?((0,l.default)("[Sync] WARNING: corrupt node in local cache",t),"object"==typeof t&&t.path&&(this.addTask(t.path),e++)):(this.needsFetch(t)&&this.rs.access.checkPathPermission(t.path,"r")||(0,d.isDocument)(t.path)&&this.needsPush(t)&&this.rs.access.checkPathPermission(t.path,"rw"))&&(this.addTask(t.path),e++))}).then(()=>e)})}inConflict(e){return!(!e.local||!e.remote||void 0===e.remote.body&&!e.remote.itemsMap)}needsRefresh(e){return!!e.common&&(!e.common.timestamp||this.now()-e.common.timestamp>s.default.syncInterval)}needsFetch(e){return!!this.inConflict(e)||!(!e.common||void 0!==e.common.itemsMap||void 0!==e.common.body)||!(!e.remote||void 0!==e.remote.itemsMap||void 0!==e.remote.body)}needsPush(e){return!this.inConflict(e)&&(!(!e.local||e.push)||void 0)}needsRemotePut(e){return!(!e.local||void 0===e.local.body||!1===e.local.body)}needsRemoteDelete(e){return e.local&&!1===e.local.body}getParentPath(e){const t=e.match(/^(.*\/)([^\/]+\/?)$/);if(t)return t[1];throw new Error('Not a valid path: "'+e+'"')}deleteChildPathsFromTasks(){for(const e in this._tasks){const t=(0,d.pathsFromRoot)(e);for(let n=1;n<t.length;n++)this._tasks[t[n]]&&(Array.isArray(this._tasks[e])&&this._tasks[e].length&&Array.prototype.push.apply(this._tasks[t[n]],this._tasks[e]),delete this._tasks[e])}}collectRefreshTasks(){return r(this,void 0,void 0,function*(){yield this.rs.local.forAllNodes(e=>{let t;if(this.needsRefresh(e)){try{t=this.getParentPath(e.path)}catch(e){}t&&this.rs.access.checkPathPermission(t,"r")?this.addTask(t):this.rs.access.checkPathPermission(e.path,"r")&&this.addTask(e.path)}}),this.deleteChildPathsFromTasks()})}flush(e){for(const t in e)"FLUSH"===this.rs.caching.checkPath(t)&&e[t]&&!e[t].local&&((0,l.default)("[Sync] Flushing",t),e[t]=void 0);return e}doTask(e){return r(this,void 0,void 0,function*(){return this.rs.local.getNodes([e]).then(t=>{const n=t[e];return void 0===n||function(e){return!(!e.remote||!e.remote.revision||e.remote.itemsMap||e.remote.body)}(n)?g("get",e,this.rs.remote.get(e)):this.needsRemotePut(n)?(n.push=(0,d.deepClone)(n.local),n.push.timestamp=this.now(),this.rs.local.setNodes(this.flush(t)).then(()=>{let t;return t=y(n)?{ifMatch:n.common.revision}:{ifNoneMatch:"*"},g("put",e,this.rs.remote.put(e,n.push.body,n.push.contentType,t))})):this.needsRemoteDelete(n)?(n.push={body:!1,timestamp:this.now()},this.rs.local.setNodes(this.flush(t)).then(()=>y(n)?g("delete",e,this.rs.remote.delete(e,{ifMatch:n.common.revision})):g("get",e,this.rs.remote.get(e)))):y(n)?g("get",e,this.rs.remote.get(e,{ifNoneMatch:n.common.revision})):g("get",e,this.rs.remote.get(e))})})}autoMergeFolder(e){if(e.remote.itemsMap&&(e.common=e.remote,delete e.remote,e.common.itemsMap)){for(const t in e.common.itemsMap)e.local.itemsMap[t]||(e.local.itemsMap[t]=!1);for(const t in e.local.itemsMap)e.common.itemsMap[t]||this.addTask(e.path+t);(0,d.equal)(e.local.itemsMap,e.common.itemsMap)&&delete e.local}return e}autoMergeDocument(e){var t;return function(e){return(!e.remote||!e.remote.revision||e.remote.revision===e.common.revision)&&(void 0===e.common.body&&!1===e.remote.body||e.remote.body===e.common.body&&e.remote.contentType===e.common.contentType)}(e)?delete(e=function(e){return e.remote&&!1===e.remote.body&&e.local&&!1===e.local.body&&delete e.local,e}(e)).remote:void 0!==e.remote.body&&(!1===e.remote.body&&!1===(null===(t=e.local)||void 0===t?void 0:t.body)||((0,l.default)("[Sync] Emitting conflict event"),setTimeout(this.rs.local.emitChange.bind(this.rs.local),10,{origin:"conflict",path:e.path,oldValue:e.local.body,newValue:e.remote.body,lastCommonValue:e.common.body,oldContentType:e.local.contentType,newContentType:e.remote.contentType,lastCommonContentType:e.common.contentType})),!1===e.remote.body?e.common={}:e.common=e.remote,delete e.remote,delete e.local),e}autoMerge(e){if(e.remote){if(e.local)return(0,d.isFolder)(e.path)?this.autoMergeFolder(e):this.autoMergeDocument(e);if((0,d.isFolder)(e.path))void 0!==e.remote.itemsMap&&(e.common=e.remote,delete e.remote);else if(void 0!==e.remote.body){const t={origin:"remote",path:e.path,oldValue:!1===e.common.body?void 0:e.common.body,newValue:!1===e.remote.body?void 0:e.remote.body,oldContentType:e.common.contentType,newContentType:e.remote.contentType};if(void 0===t.oldValue&&void 0===t.newValue||this.rs.local.emitChange(t),!1===e.remote.body)return;e.common=e.remote,delete e.remote}return e}e.common.body&&this.rs.local.emitChange({origin:"remote",path:e.path,oldValue:e.common.body,newValue:void 0,oldContentType:e.common.contentType,newContentType:void 0})}updateCommonTimestamp(e,t){return r(this,void 0,void 0,function*(){return this.rs.local.getNodes([e]).then(n=>(n[e]&&n[e].common&&n[e].common.revision===t&&(n[e].common.timestamp=this.now()),this.rs.local.setNodes(this.flush(n))))})}markChildren(e,t,n,i){return r(this,void 0,void 0,function*(){const r=[],s={},o={};for(const n in t)r.push(e+n),s[e+n]=t[n];for(const t in i)r.push(e+t);const a=yield this.rs.local.getNodes(r);let l,c;for(const t in a)if(c=a[t],s[t])c&&c.common?m(c,s[t].ETag)&&(n[t]=(0,d.deepClone)(c),n[t].remote={revision:s[t].ETag,timestamp:this.now()},n[t]=this.autoMerge(n[t])):(l=this.rs.caching.checkPath(t),"ALL"===l&&(n[t]={path:t,common:{timestamp:this.now()},remote:{revision:s[t].ETag,timestamp:this.now()}})),n[t]&&s[t]["Content-Type"]&&(n[t].remote.contentType=s[t]["Content-Type"]),n[t]&&s[t]["Content-Length"]&&(n[t].remote.contentLength=s[t]["Content-Length"]);else if(i[t.substring(e.length)]&&c&&c.common){if(c.common.itemsMap)for(const e in c.common.itemsMap)o[t+e]=!0;if(c.local&&c.local.itemsMap)for(const e in c.local.itemsMap)o[t+e]=!0;if(c.remote||(0,d.isFolder)(t))n[t]=void 0;else if(n[t]=this.autoMerge(c),void 0===n[t]){const r=n[this.getParentPath(t)],i=t.substring(e.length);r&&r.local&&(delete r.local.itemsMap[i],(0,d.equal)(r.local.itemsMap,r.common.itemsMap)&&delete r.local)}}const u=yield this.markRemoteDeletions(Object.keys(o),n);u&&(yield this.rs.local.setNodes(this.flush(u)))})}markRemoteDeletions(e,t){return r(this,void 0,void 0,function*(){if(0===e.length)return t;const n=yield this.rs.local.getNodes(e),r={};function i(e,t){if(e&&e.itemsMap)for(const n in e.itemsMap)r[t+n]=!0}for(const e in n){const r=n[e];r&&((0,d.isFolder)(e)?(i(r.common,e),i(r.local,e)):r.common&&void 0!==r.common.body&&(t[e]=(0,d.deepClone)(r),t[e].remote={body:!1,timestamp:this.now()},t[e]=this.autoMerge(t[e])))}const s=yield this.markRemoteDeletions(Object.keys(r),t);s&&(yield this.rs.local.setNodes(this.flush(s)))})}completeFetch(e,t,n,i){return r(this,void 0,void 0,function*(){let r,s;const o=(0,d.pathsFromRoot)(e);(0,d.isFolder)(e)?r=[e]:(s=o[1],r=[e,s]);const a=yield this.rs.local.getNodes(r),l=a[s],c={};let u,h=a[e];function p(e){if(e&&e.itemsMap)for(u in e.itemsMap)t[u]||(c[u]=!0)}if("object"==typeof h&&h.path===e&&"object"==typeof h.common||(h={path:e,common:{}},a[e]=h),h.remote={revision:i,timestamp:this.now()},(0,d.isFolder)(e))for(u in p(h.common),p(h.remote),h.remote.itemsMap={},t)h.remote.itemsMap[u]=!0;else h.remote.body=t,h.remote.contentType=n,l&&l.local&&l.local.itemsMap&&(u=e.substring(s.length),!1!==t?l.local.itemsMap[u]=!0:l.local.itemsMap[u]&&delete l.local.itemsMap[u],(0,d.equal)(l.local.itemsMap,l.common.itemsMap)&&delete l.local);return a[e]=this.autoMerge(h),{toBeSaved:a,missingChildren:c}})}completePush(e,t,n,i){return r(this,void 0,void 0,function*(){const r=yield this.rs.local.getNodes([e]),s=r[e];if(!s.push)throw this.stopped=!0,new Error("completePush called but no push version!");n?((0,l.default)("[Sync] We have a conflict"),s.remote&&s.remote.revision===i||(s.remote={revision:i||"conflict",timestamp:this.now()},delete s.push),r[e]=this.autoMerge(s)):(s.common={revision:i,timestamp:this.now()},"put"===t?(s.common.body=s.push.body,s.common.contentType=s.push.contentType,(0,d.equal)(s.local.body,s.push.body)&&s.local.contentType===s.push.contentType&&delete s.local,delete s.push):"delete"===t&&(!1===s.local.body?r[e]=void 0:delete s.push)),yield this.rs.local.setNodes(this.flush(r))})}dealWithFailure(e){return r(this,void 0,void 0,function*(){const t=yield this.rs.local.getNodes([e]);if(t[e])return delete t[e].push,this.rs.local.setNodes(this.flush(t))})}interpretStatus(e){const t={statusCode:e,successful:void 0,conflict:void 0,unAuth:void 0,notFound:void 0,changed:void 0,networkProblems:void 0};return"string"!=typeof e||"offline"!==e&&"timeout"!==e?"number"==typeof e?(t.successful=2===Math.floor(e/100)||304===e||412===e||404===e,t.conflict=412===e,t.unAuth=401===e&&this.rs.remote.token!==c.default.IMPLIED_FAKE_TOKEN||402===e||403===e,t.notFound=404===e,t.changed=304!==e,t):void 0:(t.successful=!1,t.networkProblems=!0,t)}handleGetResponse(e,t,n,i,s){return r(this,void 0,void 0,function*(){if(t.notFound&&(n=!!(0,d.isFolder)(e)&&{}),t.changed){const t=yield this.completeFetch(e,n,i,s);if((0,d.isFolder)(e)){if(this.corruptServerItemsMap(n))return(0,l.default)("[Sync] WARNING: Discarding corrupt folder description from server for "+e),!1;yield this.markChildren(e,n,t.toBeSaved,t.missingChildren)}else yield this.rs.local.setNodes(this.flush(t.toBeSaved))}else yield this.updateCommonTimestamp(e,s);return!0})}handleResponse(e,t,n){return r(this,void 0,void 0,function*(){const r=this.interpretStatus(n.statusCode);if(r.successful){if("get"===t)return this.handleGetResponse(e,r,n.body,n.contentType,n.revision);if("put"===t||"delete"===t)return this.completePush(e,t,r.conflict,n.revision).then(function(){return!0});throw new Error(`cannot handle response for unknown action ${t}`)}{let t;return t=r.unAuth?new h.default:r.networkProblems?new u.default("Network request failed."):new Error("HTTP response code "+r.statusCode+" received."),this.dealWithFailure(e).then(()=>{throw this.rs._emit("error",t),t})}})}finishTask(e){return r(this,arguments,void 0,function*(e,t=!0){if(void 0===e.action)return void delete this._running[e.path];if(t&&((0,l.default)("[Sync] queue finished task:",e.path),this._finishedTasks.push(e),this._finishedTasks.length>1))return void(0,l.default)("[Sync] delaying finished task:",e.path);let n;(0,l.default)("[Sync] run task:",e.path);try{n=yield e.promise}catch(t){(0,l.default)("[Sync] wire client rejects its promise",e.path,e.action,t),n={statusCode:"offline"}}try{const t=yield this.handleResponse(e.path,e.action,n);this.finishSuccessfulTask(e,t)}catch(t){this.finishUnsuccessfulTask(e,t)}})}finishSuccessfulTask(e,t){return r(this,void 0,void 0,function*(){if(this._finishedTasks.shift(),delete this._timeStarted[e.path],delete this._running[e.path],t&&this._tasks[e.path]){for(let t=0;t<this._tasks[e.path].length;t++)this._tasks[e.path][t]();delete this._tasks[e.path]}this.rs._emit("sync-req-done",{tasksRemaining:Object.keys(this._tasks).length}),this._finishedTasks.length>0?yield this.finishTask(this._finishedTasks[0],!1):yield this.collectTasks(!1).then(()=>{!this.hasTasks()||this.stopped?(this.done||(this.done=!0),this.rs._emit("sync-done",{completed:!0})):setTimeout(()=>{this.doTasks()},10)})})}finishUnsuccessfulTask(e,t){return r(this,void 0,void 0,function*(){(0,l.default)("[Sync]",t.message),this._finishedTasks.shift(),delete this._timeStarted[e.path],delete this._running[e.path],this.rs._emit("sync-req-done",{tasksRemaining:Object.keys(this._tasks).length}),this._finishedTasks.length>0?yield this.finishTask(this._finishedTasks[0],!1):this.done||(this.done=!0,this.rs._emit("sync-done",{completed:!1}))})}tasksWanted(){return this.rs.remote.connected?this.rs.remote.online?this.numThreads:1:0}doTasks(){const e=this.tasksWanted()-Object.keys(this._running).length;if(e<=0)return!0;this.hasTasks()&&!this.done&&this.rs._emit("sync-started");let t,n=0;for(t in this._tasks)if(!this._running[t]&&(this._timeStarted[t]=this.now(),this._running[t]=this.doTask(t).then(this.finishTask.bind(this)),n++,n>=e))break;return n>=e}collectTasks(){return r(this,arguments,void 0,function*(e=!0){if(!this.hasTasks()&&!this.stopped)return(yield this.collectDiffTasks())>0?void 0:e?this.collectRefreshTasks():void 0})}addTask(e,t){this._tasks[e]||(this._tasks[e]=[]),"function"==typeof t&&this._tasks[e].push(t)}sync(){return r(this,void 0,void 0,function*(){if(this.done=!1,!this.doTasks()){try{yield this.collectTasks()}catch(e){throw(0,l.default)("[Sync] Sync error",e),new Error("Local cache unavailable")}this.doTasks()}})}static _rs_init(e){p=function(){const t=new o.default;t.isBrowser()&&function(e,t){function n(e){const n=t.getCurrentSyncInterval();s.default.isBackground=!e;const r=t.getCurrentSyncInterval();t._emit("sync-interval-change",{oldValue:n,newValue:r})}e.on("background",()=>n(!1)),e.on("foreground",()=>n(!0))}(t,e),e.sync||(e.sync=new v(e),e.syncStopped&&((0,l.default)("[Sync] Initializing with sync stopped"),e.sync.stopped=!0,delete e.syncStopped)),e.setupSyncCycle()},f=function(){e.removeEventListener("connected",f),e.startSync()},e.on("ready",p),e.on("connected",f)}static _rs_cleanup(e){e.stopSync(),e.removeEventListener("ready",p),e.removeEventListener("connected",f),e.caching.resetActivationHandler(),e.sync=void 0,delete e.sync}}t.Sync=v,(0,d.applyMixins)(v,[a.default]),t.default=v},370:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})};const i=(this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(n(334));function s(e){return"dropbox"===this.backend&&!!e.match(/^\/public\/.*[^\/]$/)}const o={get:function(e,t){if(this.local){if(void 0===t)t="object"==typeof(n=this).remote&&n.remote.connected&&n.remote.online?2*n.getSyncInterval():((0,i.default)("Not setting default maxAge, because remote is offline or not connected"),!1);else if("number"!=typeof t&&!1!==t)return Promise.reject("Argument 'maxAge' must be 'false' or a number");return this.local.get(e,t,this.sync.queueGetRequest.bind(this.sync))}return this.remote.get(e);var n},put:function(e,t,n){return s.bind(this)(e)?o._wrapBusyDone.call(this,this.remote.put(e,t,n)):this.local?this.local.put(e,t,n):o._wrapBusyDone.call(this,this.remote.put(e,t,n))},delete:function(e,t){return this.local?this.local.delete(e,t):o._wrapBusyDone.call(this,this.remote.delete(e,t))},_wrapBusyDone:function(e){return r(this,void 0,void 0,function*(){return this._emit("wire-busy"),e.then(e=>(this._emit("wire-done",{success:!0}),Promise.resolve(e)),e=>(this._emit("wire-done",{success:!1}),Promise.reject(e)))})}};e.exports=o},613:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.BaseClientTypes=void 0;class n{constructor(){this.uris={},this.schemas={},this.aliases={}}declare(e,t,n,r){const i=e+"/"+t;if(r.extends){const t=r.extends.split("/"),n=1===t.length?e+"/"+t.shift():t.join("/"),s=this.uris[n];if(!s)throw"Type '"+i+"' tries to extend unknown schema '"+n+"'";r.extends=this.schemas[s]}this.uris[i]=n,this.aliases[n]=i,this.schemas[n]=r}resolveAlias(e){return this.uris[e]}getSchema(e){return this.schemas[e]}inScope(e){const t=e.length,n={};for(const r in this.uris)if(r.substr(0,t+1)===e+"/"){const e=this.uris[r];n[e]=this.schemas[e]}return n}}t.BaseClientTypes=n,t.default=new n},503:function(e){class t extends Error{constructor(e,t={}){super(),this.name="Unauthorized",this.message=void 0===e?"App authorization expired or revoked.":e,void 0!==t.code&&(this.code=t.code),this.stack=(new Error).stack}}e.exports=t},746:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.toBase64=t.getTextFromArrayBuffer=t.stripLegacyCharsetBinary=t.shouldBeTreatedAsBinary=t.getJSONFromLocalStorage=t.localStorageAvailable=t.pathsFromRoot=t.deepClone=t.equal=t.bindAll=t.cleanPath=t.baseName=t.isDocument=t.isFolder=t.containingFolder=t.extend=t.getGlobalContext=t.globalContext=t.logError=void 0,t.generateCodeVerifier=function(){return r(this,arguments,void 0,function*(e=128){const t=new Uint8Array(e);crypto.getRandomValues(t);const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=Array.from(t).map(e=>n[e%66]),i=r.join(""),s=Uint8Array.from(r.map(e=>e.charCodeAt(0))),o=(a=yield crypto.subtle.digest("SHA-256",s),btoa(String.fromCharCode.apply(null,new Uint8Array(a))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""));var a;return crypto.getRandomValues(t),{codeVerifier:i,codeChallenge:o,state:Array.from(t).map(e=>n[e%66]).join("")}})},t.applyMixins=function(e,t){t.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(n=>{Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))})})},t.logError=e=>{"string"==typeof e?console.error(e):console.error(e.message,e.stack)},t.globalContext="undefined"!=typeof window?window:"object"==typeof self?self:n.g,t.getGlobalContext=()=>"undefined"!=typeof window?window:"object"==typeof self?self:n.g,t.extend=(...e)=>{const t=e[0];return Array.prototype.slice.call(e,1).forEach(function(e){for(const n in e)t[n]=e[n]}),t},t.containingFolder=e=>{if(""===e)return"/";if(!e)throw"Path not given!";return e.replace(/\/+/g,"/").replace(/[^\/]+\/?$/,"")},t.isFolder=e=>"/"===e.slice(-1),t.isDocument=e=>!(0,t.isFolder)(e),t.baseName=e=>{const n=e.split("/");return(0,t.isFolder)(e)?n[n.length-2]+"/":n[n.length-1]},t.cleanPath=e=>e.replace(/\/+/g,"/").split("/").map(encodeURIComponent).join("/").replace(/'/g,"%27"),t.bindAll=e=>{for(const t in this)"function"==typeof e[t]&&(e[t]=e[t].bind(e))},t.equal=(e,n,r=[])=>{let i;if(typeof e!=typeof n)return!1;if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return e===n;if("function"==typeof e)return e.toString()===n.toString();if(e instanceof ArrayBuffer&&n instanceof ArrayBuffer&&(e=new Uint8Array(e),n=new Uint8Array(n)),null===e||null===n)return e===n;if(e instanceof Array){if(e.length!==n.length)return!1;for(let i=0,s=e.length;i<s;i++)if(!(0,t.equal)(e[i],n[i],r))return!1}else{for(i in e)if(e.hasOwnProperty(i)&&!(i in n))return!1;for(i in n){if(!n.hasOwnProperty(i))continue;if(!(i in e))return!1;let s;if("object"==typeof n[i]){if(r.indexOf(n[i])>=0)continue;s=r.slice(),s.push(n[i])}if(!(0,t.equal)(e[i],n[i],s))return!1}}return!0},t.deepClone=e=>void 0===e?void 0:"function"==typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e)),t.pathsFromRoot=e=>{const t=[e],n=e.replace(/\/$/,"").split("/");for(;n.length>1;)n.pop(),t.push(n.join("/")+"/");return t},t.localStorageAvailable=()=>{const e=(0,t.getGlobalContext)();if(!("localStorage"in e))return!1;try{return e.localStorage.setItem("rs-check","1"),e.localStorage.removeItem("rs-check"),!0}catch(e){return!1}},t.getJSONFromLocalStorage=e=>{const n=(0,t.getGlobalContext)();try{return JSON.parse(n.localStorage.getItem(e))}catch(e){}},t.shouldBeTreatedAsBinary=(e,t)=>!!(t&&t.match(/charset=binary/)||/[\x00-\x08\x0E-\x1F\x80-\x9F\uFFFD]/.test(e)),t.stripLegacyCharsetBinary=e=>e?e.replace(/\s*;\s*charset=binary\b/i,""):e,t.getTextFromArrayBuffer=(e,n)=>new Promise(r=>{if("undefined"==typeof Blob||"undefined"==typeof FileReader)r(Buffer.from(e).toString(n));else{let i;const s=t.globalContext;if(s.BlobBuilder=s.BlobBuilder||s.WebKitBlobBuilder,void 0!==s.BlobBuilder){const t=new s.BlobBuilder;t.append(e),i=t.getBlob()}else i=new Blob([e]);const o=new FileReader;"function"==typeof o.addEventListener?o.addEventListener("loadend",function(e){r(e.target.result)}):o.onloadend=function(e){r(e.target.result)},o.readAsText(i,n)}}),t.toBase64=e=>{const n=(0,t.getGlobalContext)();return"btoa"in n?n.btoa(e):Buffer.from(e).toString("base64")}},600:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};const s=i(n(275)),o=i(n(93)),a=i(n(503)),l=i(n(334)),c=n(746),u=n(368),h=n(684);let d;const p="remotestorage:wireclient",f={"draft-dejong-remotestorage-00":2,"draft-dejong-remotestorage-01":3,"draft-dejong-remotestorage-02":4,"https://www.w3.org/community/rww/wiki/read-write-web-00#simple":1};class g extends h.RemoteBase{constructor(e){if(super(e),this._revisionCache={},d=(0,c.localStorageAvailable)(),this.addEvents(["connected","not-connected"]),d){const e=function(){const{userAddress:e,href:t,storageApi:n,token:r,properties:i}=(0,c.getJSONFromLocalStorage)(p)||{};return{userAddress:e,href:t,storageApi:n,token:r,properties:i}}();e&&setTimeout(()=>{this.configure(e)},0)}this.connected&&setTimeout(this._emit.bind(this),0,"connected")}_request(e,t,n,i,o,h,d){return r(this,void 0,void 0,function*(){if(this.isForbiddenRequestMethod(e,t))return Promise.reject(`Don't use ${e} on directories!`);let r;return n!==s.default.IMPLIED_FAKE_TOKEN&&(i.Authorization="Bearer "+n),this.rs._emit("wire-busy",{method:e,isFolder:(0,c.isFolder)(t)}),(0,u.requestWithTimeout)(e,t,{body:o,headers:i,responseType:"arraybuffer"}).then(n=>{if(this.online||(this.online=!0,this.rs._emit("network-online")),this.rs._emit("wire-done",{method:e,isFolder:(0,c.isFolder)(t),success:!0}),i=n.status,[401,403,404,412].indexOf(i)>=0)return(0,l.default)("[WireClient] Error response status",n.status),r=h?this.stripQuotes(n.getResponseHeader("ETag")):void 0,401===n.status&&this.rs._emit("error",new a.default),Promise.resolve({statusCode:n.status,revision:r});if(function(e){return[201,204,304].indexOf(e)>=0}(n.status)||200===n.status&&"GET"!==e)return r=this.stripQuotes(n.getResponseHeader("ETag")),(0,l.default)("[WireClient] Successful request",r),Promise.resolve({statusCode:n.status,revision:r});{const e=n.getResponseHeader("Content-Type");r=h?this.stripQuotes(n.getResponseHeader("ETag")):200===n.status?d:void 0;const t=function(e){let t,n="utf-8";return e&&(t=e.match(/charset=(.+)$/),t&&(n=t[1])),n}(e);return(0,c.shouldBeTreatedAsBinary)(n.response,e)?((0,l.default)("[WireClient] Successful request with unknown or binary mime-type",r),Promise.resolve({statusCode:n.status,body:n.response,contentType:(0,c.stripLegacyCharsetBinary)(e),revision:r})):(0,c.getTextFromArrayBuffer)(n.response,t).then(t=>((0,l.default)("[WireClient] Successful request",r),Promise.resolve({statusCode:n.status,body:t,contentType:(0,c.stripLegacyCharsetBinary)(e),revision:r})))}var i},n=>(this.online&&(this.online=!1,this.rs._emit("network-offline")),this.rs._emit("wire-done",{method:e,isFolder:(0,c.isFolder)(t),success:!1}),Promise.reject(n)))})}configure(e){if("object"!=typeof e)throw new Error("WireClient configure settings parameter should be an object");if(void 0!==e.userAddress&&(this.userAddress=e.userAddress),void 0!==e.href&&(this.href=e.href),void 0!==e.storageApi&&(this.storageApi=e.storageApi),void 0!==e.token&&(this.token=e.token),void 0!==e.properties&&(this.properties=e.properties),"string"==typeof this.storageApi){const e=f[this.storageApi]||5;this.supportsRevs=e>=2}this.href&&this.token?(this.connected=!0,this.online=!0,this._emit("connected")):this.connected=!1,d&&localStorage.setItem(p,JSON.stringify({userAddress:this.userAddress,href:this.href,storageApi:this.storageApi,token:this.token,properties:this.properties}))}get(e,t={}){if(!this.connected)return Promise.reject("not connected (path: "+e+")");const n={};return this.supportsRevs&&t.ifNoneMatch&&(n["If-None-Match"]=this.addQuotes(t.ifNoneMatch)),this._request("GET",this.href+(0,c.cleanPath)(e),this.token,n,void 0,this.supportsRevs,this._revisionCache[e]).then(t=>{if(!(0,c.isFolder)(e))return Promise.resolve(t);let n={};if(void 0!==t.body)try{t.body=JSON.parse(t.body)}catch(t){return Promise.reject("Folder description at "+this.href+(0,c.cleanPath)(e)+" is not JSON")}if(200===t.statusCode&&"object"==typeof t.body){if(0===Object.keys(t.body).length)t.statusCode=404;else if("http://remotestorage.io/spec/folder-description"===(r=t.body)["@context"]&&"object"==typeof r.items){for(const n in t.body.items)this._revisionCache[e+n]=t.body.items[n].ETag;n=t.body.items}else Object.keys(t.body).forEach(r=>{this._revisionCache[e+r]=t.body[r],n[r]={ETag:t.body[r]}});return t.body=n,Promise.resolve(t)}return Promise.resolve(t);var r})}put(e,t,n,r={}){if(!this.connected)return Promise.reject("not connected (path: "+e+")");const i={"Content-Type":n};return this.supportsRevs&&(r.ifMatch&&(i["If-Match"]=this.addQuotes(r.ifMatch)),r.ifNoneMatch&&(i["If-None-Match"]=this.addQuotes(r.ifNoneMatch))),this._request("PUT",this.href+(0,c.cleanPath)(e),this.token,i,t,this.supportsRevs)}delete(e,t={}){if(!this.connected)throw new Error("not connected (path: "+e+")");t||(t={});const n={};return this.supportsRevs&&t.ifMatch&&(n["If-Match"]=this.addQuotes(t.ifMatch)),this._request("DELETE",this.href+(0,c.cleanPath)(e),this.token,n,void 0,this.supportsRevs)}static _rs_init(e){e.remote=new g(e),e.remote.online=!0}static _rs_supported(){return"function"==typeof fetch||"function"==typeof XMLHttpRequest}static _rs_cleanup(){d&&delete localStorage[p]}}(0,c.applyMixins)(g,[o.default]),e.exports=g},439:function(e,t){var n;void 0===(n=function(){var e,t,n,r;Object.keys||(Object.keys=(e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),r=(n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"]).length,function(i){if("object"!=typeof i&&"function"!=typeof i||null===i)throw new TypeError("Object.keys called on non-object");var s=[];for(var o in i)e.call(i,o)&&s.push(o);if(t)for(var a=0;a<r;a++)e.call(i,n[a])&&s.push(n[a]);return s})),Object.create||(Object.create=function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create implementation only accepts one parameter.");return e.prototype=t,new e}}()),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e){if(null===this)throw new TypeError;var t=Object(this),n=t.length>>>0;if(0===n)return-1;var r=0;if(arguments.length>1&&((r=Number(arguments[1]))!=r?r=0:0!==r&&r!==1/0&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=n)return-1;for(var i=r>=0?r:Math.max(n-Math.abs(r),0);i<n;i++)if(i in t&&t[i]===e)return i;return-1}),Object.isFrozen||(Object.isFrozen=function(e){for(var t="tv4_test_frozen_key";e.hasOwnProperty(t);)t+=Math.random();try{return e[t]=!0,delete e[t],!1}catch(e){return!0}});var i={"+":!0,"#":!0,".":!0,"/":!0,";":!0,"?":!0,"&":!0},s={"*":!0};function o(e){return encodeURI(e).replace(/%25[0-9][0-9]/g,function(e){return"%"+e.substring(3)})}function a(e){var t="";i[e.charAt(0)]&&(t=e.charAt(0),e=e.substring(1));var n="",r="",a=!0,l=!1,c=!1;"+"===t?a=!1:"."===t?(r=".",n="."):"/"===t?(r="/",n="/"):"#"===t?(r="#",a=!1):";"===t?(r=";",n=";",l=!0,c=!0):"?"===t?(r="?",n="&",l=!0):"&"===t&&(r="&",n="&",l=!0);for(var u=[],h=e.split(","),d=[],p={},f=0;f<h.length;f++){var g=h[f],m=null;if(-1!==g.indexOf(":")){var y=g.split(":");g=y[0],m=parseInt(y[1],10)}for(var v={};s[g.charAt(g.length-1)];)v[g.charAt(g.length-1)]=!0,g=g.substring(0,g.length-1);var b={truncate:m,name:g,suffices:v};d.push(b),p[g]=b,u.push(g)}var w=function(e){for(var t="",i=0,s=0;s<d.length;s++){var u=d[s],h=e(u.name);if(null==h||Array.isArray(h)&&0===h.length||"object"==typeof h&&0===Object.keys(h).length)i++;else if(t+=s===i?r:n||",",Array.isArray(h)){l&&(t+=u.name+"=");for(var p=0;p<h.length;p++)p>0&&(t+=u.suffices["*"]&&n||",",u.suffices["*"]&&l&&(t+=u.name+"=")),t+=a?encodeURIComponent(h[p]).replace(/!/g,"%21"):o(h[p])}else if("object"==typeof h){l&&!u.suffices["*"]&&(t+=u.name+"=");var f=!0;for(var g in h)f||(t+=u.suffices["*"]&&n||","),f=!1,t+=a?encodeURIComponent(g).replace(/!/g,"%21"):o(g),t+=u.suffices["*"]?"=":",",t+=a?encodeURIComponent(h[g]).replace(/!/g,"%21"):o(h[g])}else l&&(t+=u.name,c&&""===h||(t+="=")),null!=u.truncate&&(h=h.substring(0,u.truncate)),t+=a?encodeURIComponent(h).replace(/!/g,"%21"):o(h)}return t};return w.varNames=u,{prefix:r,substitution:w}}function l(e){if(!(this instanceof l))return new l(e);for(var t=e.split("{"),n=[t.shift()],r=[],i=[],s=[];t.length>0;){var o=t.shift(),c=o.split("}")[0],u=o.substring(c.length+1),h=a(c);i.push(h.substitution),r.push(h.prefix),n.push(u),s=s.concat(h.substitution.varNames)}this.fill=function(e){for(var t=n[0],r=0;r<i.length;r++)t+=(0,i[r])(e),t+=n[r+1];return t},this.varNames=s,this.template=e}l.prototype={toString:function(){return this.template},fillFromObject:function(e){return this.fill(function(t){return e[t]})}};var c=function(e,t,n,r,i){if(this.missing=[],this.missingMap={},this.formatValidators=e?Object.create(e.formatValidators):{},this.schemas=e?Object.create(e.schemas):{},this.collectMultiple=t,this.errors=[],this.handleError=t?this.collectError:this.returnError,r&&(this.checkRecursive=!0,this.scanned=[],this.scannedFrozen=[],this.scannedFrozenSchemas=[],this.scannedFrozenValidationErrors=[],this.validatedSchemasKey="tv4_validation_id",this.validationErrorsKey="tv4_validation_errors_id"),i&&(this.trackUnknownProperties=!0,this.knownPropertyPaths={},this.unknownPropertyPaths={}),this.errorReporter=n||y("en"),"string"==typeof this.errorReporter)throw new Error("debug");if(this.definedKeywords={},e)for(var s in e.definedKeywords)this.definedKeywords[s]=e.definedKeywords[s].slice(0)};function u(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(Array.isArray(e)!==Array.isArray(t))return!1;if(Array.isArray(e)){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!u(e[n],t[n]))return!1}else{var r;for(r in e)if(void 0===t[r]&&void 0!==e[r])return!1;for(r in t)if(void 0===e[r]&&void 0!==t[r])return!1;for(r in e)if(!u(e[r],t[r]))return!1}return!0}return!1}c.prototype.defineKeyword=function(e,t){this.definedKeywords[e]=this.definedKeywords[e]||[],this.definedKeywords[e].push(t)},c.prototype.createError=function(e,t,n,r,i,s,o){var a=new x(e,t,n,r,i);return a.message=this.errorReporter(a,s,o),a},c.prototype.returnError=function(e){return e},c.prototype.collectError=function(e){return e&&this.errors.push(e),null},c.prototype.prefixErrors=function(e,t,n){for(var r=e;r<this.errors.length;r++)this.errors[r]=this.errors[r].prefixWith(t,n);return this},c.prototype.banUnknownProperties=function(e,t){for(var n in this.unknownPropertyPaths){var r=this.createError(v.UNKNOWN_PROPERTY,{path:n},n,"",null,e,t),i=this.handleError(r);if(i)return i}return null},c.prototype.addFormat=function(e,t){if("object"==typeof e){for(var n in e)this.addFormat(n,e[n]);return this}this.formatValidators[e]=t},c.prototype.resolveRefs=function(e,t){if(void 0!==e.$ref){if((t=t||{})[e.$ref])return this.createError(v.CIRCULAR_REFERENCE,{urls:Object.keys(t).join(", ")},"","",null,void 0,e);t[e.$ref]=!0,e=this.getSchema(e.$ref,t)}return e},c.prototype.getSchema=function(e,t){var n;if(void 0!==this.schemas[e])return n=this.schemas[e],this.resolveRefs(n,t);var r=e,i="";if(-1!==e.indexOf("#")&&(i=e.substring(e.indexOf("#")+1),r=e.substring(0,e.indexOf("#"))),"object"==typeof this.schemas[r]){n=this.schemas[r];var s=decodeURIComponent(i);if(""===s)return this.resolveRefs(n,t);if("/"!==s.charAt(0))return;for(var o=s.split("/").slice(1),a=0;a<o.length;a++){var l=o[a].replace(/~1/g,"/").replace(/~0/g,"~");if(void 0===n[l]){n=void 0;break}n=n[l]}if(void 0!==n)return this.resolveRefs(n,t)}void 0===this.missing[r]&&(this.missing.push(r),this.missing[r]=r,this.missingMap[r]=r)},c.prototype.searchSchemas=function(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++)this.searchSchemas(e[n],t);else if(e&&"object"==typeof e)for(var r in"string"==typeof e.id&&function(e,t){if(t.substring(0,e.length)===e){var n=t.substring(e.length);if(t.length>0&&"/"===t.charAt(e.length-1)||"#"===n.charAt(0)||"?"===n.charAt(0))return!0}return!1}(t,e.id)&&void 0===this.schemas[e.id]&&(this.schemas[e.id]=e),e)if("enum"!==r)if("object"==typeof e[r])this.searchSchemas(e[r],t);else if("$ref"===r){var i=g(e[r]);i&&void 0===this.schemas[i]&&void 0===this.missingMap[i]&&(this.missingMap[i]=i)}},c.prototype.addSchema=function(e,t){if("string"!=typeof e||void 0===t){if("object"!=typeof e||"string"!=typeof e.id)return;e=(t=e).id}e===g(e)+"#"&&(e=g(e)),this.schemas[e]=t,delete this.missingMap[e],m(t,e),this.searchSchemas(t,e)},c.prototype.getSchemaMap=function(){var e={};for(var t in this.schemas)e[t]=this.schemas[t];return e},c.prototype.getSchemaUris=function(e){var t=[];for(var n in this.schemas)e&&!e.test(n)||t.push(n);return t},c.prototype.getMissingUris=function(e){var t=[];for(var n in this.missingMap)e&&!e.test(n)||t.push(n);return t},c.prototype.dropSchemas=function(){this.schemas={},this.reset()},c.prototype.reset=function(){this.missing=[],this.missingMap={},this.errors=[]},c.prototype.validateAll=function(e,t,n,r,i){var s;if(!(t=this.resolveRefs(t)))return null;if(t instanceof x)return this.errors.push(t),t;var o,a=this.errors.length,l=null,c=null;if(this.checkRecursive&&e&&"object"==typeof e){if(s=!this.scanned.length,e[this.validatedSchemasKey]){var u=e[this.validatedSchemasKey].indexOf(t);if(-1!==u)return this.errors=this.errors.concat(e[this.validationErrorsKey][u]),null}if(Object.isFrozen(e)&&-1!==(o=this.scannedFrozen.indexOf(e))){var h=this.scannedFrozenSchemas[o].indexOf(t);if(-1!==h)return this.errors=this.errors.concat(this.scannedFrozenValidationErrors[o][h]),null}if(this.scanned.push(e),Object.isFrozen(e))-1===o&&(o=this.scannedFrozen.length,this.scannedFrozen.push(e),this.scannedFrozenSchemas.push([])),l=this.scannedFrozenSchemas[o].length,this.scannedFrozenSchemas[o][l]=t,this.scannedFrozenValidationErrors[o][l]=[];else{if(!e[this.validatedSchemasKey])try{Object.defineProperty(e,this.validatedSchemasKey,{value:[],configurable:!0}),Object.defineProperty(e,this.validationErrorsKey,{value:[],configurable:!0})}catch(t){e[this.validatedSchemasKey]=[],e[this.validationErrorsKey]=[]}c=e[this.validatedSchemasKey].length,e[this.validatedSchemasKey][c]=t,e[this.validationErrorsKey][c]=[]}}var d=this.errors.length,p=this.validateBasic(e,t,i)||this.validateNumeric(e,t,i)||this.validateString(e,t,i)||this.validateArray(e,t,i)||this.validateObject(e,t,i)||this.validateCombinations(e,t,i)||this.validateHypermedia(e,t,i)||this.validateFormat(e,t,i)||this.validateDefinedKeywords(e,t,i)||null;if(s){for(;this.scanned.length;)delete this.scanned.pop()[this.validatedSchemasKey];this.scannedFrozen=[],this.scannedFrozenSchemas=[]}if(p||d!==this.errors.length)for(;n&&n.length||r&&r.length;){var f=n&&n.length?""+n.pop():null,g=r&&r.length?""+r.pop():null;p&&(p=p.prefixWith(f,g)),this.prefixErrors(d,f,g)}return null!==l?this.scannedFrozenValidationErrors[o][l]=this.errors.slice(a):null!==c&&(e[this.validationErrorsKey][c]=this.errors.slice(a)),this.handleError(p)},c.prototype.validateFormat=function(e,t){if("string"!=typeof t.format||!this.formatValidators[t.format])return null;var n=this.formatValidators[t.format].call(null,e,t);return"string"==typeof n||"number"==typeof n?this.createError(v.FORMAT_CUSTOM,{message:n},"","/format",null,e,t):n&&"object"==typeof n?this.createError(v.FORMAT_CUSTOM,{message:n.message||"?"},n.dataPath||"",n.schemaPath||"/format",null,e,t):null},c.prototype.validateDefinedKeywords=function(e,t,n){for(var r in this.definedKeywords)if(void 0!==t[r])for(var i=this.definedKeywords[r],s=0;s<i.length;s++){var o=(0,i[s])(e,t[r],t,n);if("string"==typeof o||"number"==typeof o)return this.createError(v.KEYWORD_CUSTOM,{key:r,message:o},"","",null,e,t).prefixWith(null,r);if(o&&"object"==typeof o){var a=o.code;if("string"==typeof a){if(!v[a])throw new Error("Undefined error code (use defineError): "+a);a=v[a]}else"number"!=typeof a&&(a=v.KEYWORD_CUSTOM);var l="object"==typeof o.message?o.message:{key:r,message:o.message||"?"},c=o.schemaPath||"/"+r.replace(/~/g,"~0").replace(/\//g,"~1");return this.createError(a,l,o.dataPath||null,c,null,e,t)}}return null},c.prototype.validateBasic=function(e,t,n){var r;return(r=this.validateType(e,t,n))||(r=this.validateEnum(e,t,n))?r.prefixWith(null,"type"):null},c.prototype.validateType=function(e,t){if(void 0===t.type)return null;var n=typeof e;null===e?n="null":Array.isArray(e)&&(n="array");var r=t.type;Array.isArray(r)||(r=[r]);for(var i=0;i<r.length;i++){var s=r[i];if(s===n||"integer"===s&&"number"===n&&e%1==0)return null}return this.createError(v.INVALID_TYPE,{type:n,expected:r.join("/")},"","",null,e,t)},c.prototype.validateEnum=function(e,t){if(void 0===t.enum)return null;for(var n=0;n<t.enum.length;n++)if(u(e,t.enum[n]))return null;return this.createError(v.ENUM_MISMATCH,{value:"undefined"!=typeof JSON?JSON.stringify(e):e},"","",null,e,t)},c.prototype.validateNumeric=function(e,t,n){return this.validateMultipleOf(e,t,n)||this.validateMinMax(e,t,n)||this.validateNaN(e,t,n)||null};var h=Math.pow(2,-51),d=1-h;function p(e){var t=String(e).replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return t?{href:t[0]||"",protocol:t[1]||"",authority:t[2]||"",host:t[3]||"",hostname:t[4]||"",port:t[5]||"",pathname:t[6]||"",search:t[7]||"",hash:t[8]||""}:null}function f(e,t){return t=p(t||""),e=p(e||""),t&&e?(t.protocol||e.protocol)+(t.protocol||t.authority?t.authority:e.authority)+(n=t.protocol||t.authority||"/"===t.pathname.charAt(0)?t.pathname:t.pathname?(e.authority&&!e.pathname?"/":"")+e.pathname.slice(0,e.pathname.lastIndexOf("/")+1)+t.pathname:e.pathname,r=[],n.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(e){"/.."===e?r.pop():r.push(e)}),r.join("").replace(/^\//,"/"===n.charAt(0)?"/":""))+(t.protocol||t.authority||t.pathname?t.search:t.search||e.search)+t.hash:null;var n,r}function g(e){return e.split("#")[0]}function m(e,t){if(e&&"object"==typeof e)if(void 0===t?t=e.id:"string"==typeof e.id&&(t=f(t,e.id),e.id=t),Array.isArray(e))for(var n=0;n<e.length;n++)m(e[n],t);else for(var r in"string"==typeof e.$ref&&(e.$ref=f(t,e.$ref)),e)"enum"!==r&&m(e[r],t)}function y(e){var t=C[e=e||"en"];return function(e){var n=t[e.code]||_[e.code];if("string"!=typeof n)return"Unknown error code "+e.code+": "+JSON.stringify(e.messageParams);var r=e.params;return n.replace(/\{([^{}]*)\}/g,function(e,t){var n=r[t];return"string"==typeof n||"number"==typeof n?n:e})}}c.prototype.validateMultipleOf=function(e,t){var n=t.multipleOf||t.divisibleBy;if(void 0===n)return null;if("number"==typeof e){var r=e/n%1;if(r>=h&&r<d)return this.createError(v.NUMBER_MULTIPLE_OF,{value:e,multipleOf:n},"","",null,e,t)}return null},c.prototype.validateMinMax=function(e,t){if("number"!=typeof e)return null;if(void 0!==t.minimum){if(e<t.minimum)return this.createError(v.NUMBER_MINIMUM,{value:e,minimum:t.minimum},"","/minimum",null,e,t);if(t.exclusiveMinimum&&e===t.minimum)return this.createError(v.NUMBER_MINIMUM_EXCLUSIVE,{value:e,minimum:t.minimum},"","/exclusiveMinimum",null,e,t)}if(void 0!==t.maximum){if(e>t.maximum)return this.createError(v.NUMBER_MAXIMUM,{value:e,maximum:t.maximum},"","/maximum",null,e,t);if(t.exclusiveMaximum&&e===t.maximum)return this.createError(v.NUMBER_MAXIMUM_EXCLUSIVE,{value:e,maximum:t.maximum},"","/exclusiveMaximum",null,e,t)}return null},c.prototype.validateNaN=function(e,t){return"number"!=typeof e?null:!0===isNaN(e)||e===1/0||e===-1/0?this.createError(v.NUMBER_NOT_A_NUMBER,{value:e},"","/type",null,e,t):null},c.prototype.validateString=function(e,t,n){return this.validateStringLength(e,t,n)||this.validateStringPattern(e,t,n)||null},c.prototype.validateStringLength=function(e,t){return"string"!=typeof e?null:void 0!==t.minLength&&e.length<t.minLength?this.createError(v.STRING_LENGTH_SHORT,{length:e.length,minimum:t.minLength},"","/minLength",null,e,t):void 0!==t.maxLength&&e.length>t.maxLength?this.createError(v.STRING_LENGTH_LONG,{length:e.length,maximum:t.maxLength},"","/maxLength",null,e,t):null},c.prototype.validateStringPattern=function(e,t){if("string"!=typeof e||"string"!=typeof t.pattern&&!(t.pattern instanceof RegExp))return null;var n;if(t.pattern instanceof RegExp)n=t.pattern;else{var r,i="",s=t.pattern.match(/^\/(.+)\/([img]*)$/);s?(r=s[1],i=s[2]):r=t.pattern,n=new RegExp(r,i)}return n.test(e)?null:this.createError(v.STRING_PATTERN,{pattern:t.pattern},"","/pattern",null,e,t)},c.prototype.validateArray=function(e,t,n){return Array.isArray(e)&&(this.validateArrayLength(e,t,n)||this.validateArrayUniqueItems(e,t,n)||this.validateArrayItems(e,t,n))||null},c.prototype.validateArrayLength=function(e,t){var n;return void 0!==t.minItems&&e.length<t.minItems&&(n=this.createError(v.ARRAY_LENGTH_SHORT,{length:e.length,minimum:t.minItems},"","/minItems",null,e,t),this.handleError(n))||void 0!==t.maxItems&&e.length>t.maxItems&&(n=this.createError(v.ARRAY_LENGTH_LONG,{length:e.length,maximum:t.maxItems},"","/maxItems",null,e,t),this.handleError(n))?n:null},c.prototype.validateArrayUniqueItems=function(e,t){if(t.uniqueItems)for(var n=0;n<e.length;n++)for(var r=n+1;r<e.length;r++)if(u(e[n],e[r])){var i=this.createError(v.ARRAY_UNIQUE,{match1:n,match2:r},"","/uniqueItems",null,e,t);if(this.handleError(i))return i}return null},c.prototype.validateArrayItems=function(e,t,n){if(void 0===t.items)return null;var r,i;if(Array.isArray(t.items)){for(i=0;i<e.length;i++)if(i<t.items.length){if(r=this.validateAll(e[i],t.items[i],[i],["items",i],n+"/"+i))return r}else if(void 0!==t.additionalItems)if("boolean"==typeof t.additionalItems){if(!t.additionalItems&&(r=this.createError(v.ARRAY_ADDITIONAL_ITEMS,{},"/"+i,"/additionalItems",null,e,t),this.handleError(r)))return r}else if(r=this.validateAll(e[i],t.additionalItems,[i],["additionalItems"],n+"/"+i))return r}else for(i=0;i<e.length;i++)if(r=this.validateAll(e[i],t.items,[i],["items"],n+"/"+i))return r;return null},c.prototype.validateObject=function(e,t,n){return"object"!=typeof e||null===e||Array.isArray(e)?null:this.validateObjectMinMaxProperties(e,t,n)||this.validateObjectRequiredProperties(e,t,n)||this.validateObjectProperties(e,t,n)||this.validateObjectDependencies(e,t,n)||null},c.prototype.validateObjectMinMaxProperties=function(e,t){var n,r=Object.keys(e);return void 0!==t.minProperties&&r.length<t.minProperties&&(n=this.createError(v.OBJECT_PROPERTIES_MINIMUM,{propertyCount:r.length,minimum:t.minProperties},"","/minProperties",null,e,t),this.handleError(n))||void 0!==t.maxProperties&&r.length>t.maxProperties&&(n=this.createError(v.OBJECT_PROPERTIES_MAXIMUM,{propertyCount:r.length,maximum:t.maxProperties},"","/maxProperties",null,e,t),this.handleError(n))?n:null},c.prototype.validateObjectRequiredProperties=function(e,t){if(void 0!==t.required)for(var n=0;n<t.required.length;n++){var r=t.required[n];if(void 0===e[r]){var i=this.createError(v.OBJECT_REQUIRED,{key:r},"","/required/"+n,null,e,t);if(this.handleError(i))return i}}return null},c.prototype.validateObjectProperties=function(e,t,n){var r;for(var i in e){var s=n+"/"+i.replace(/~/g,"~0").replace(/\//g,"~1"),o=!1;if(void 0!==t.properties&&void 0!==t.properties[i]&&(o=!0,r=this.validateAll(e[i],t.properties[i],[i],["properties",i],s)))return r;if(void 0!==t.patternProperties)for(var a in t.patternProperties)if(new RegExp(a).test(i)&&(o=!0,r=this.validateAll(e[i],t.patternProperties[a],[i],["patternProperties",a],s)))return r;if(o)this.trackUnknownProperties&&(this.knownPropertyPaths[s]=!0,delete this.unknownPropertyPaths[s]);else if(void 0!==t.additionalProperties){if(this.trackUnknownProperties&&(this.knownPropertyPaths[s]=!0,delete this.unknownPropertyPaths[s]),"boolean"==typeof t.additionalProperties){if(!t.additionalProperties&&(r=this.createError(v.OBJECT_ADDITIONAL_PROPERTIES,{key:i},"","/additionalProperties",null,e,t).prefixWith(i,null),this.handleError(r)))return r}else if(r=this.validateAll(e[i],t.additionalProperties,[i],["additionalProperties"],s))return r}else this.trackUnknownProperties&&!this.knownPropertyPaths[s]&&(this.unknownPropertyPaths[s]=!0)}return null},c.prototype.validateObjectDependencies=function(e,t,n){var r;if(void 0!==t.dependencies)for(var i in t.dependencies)if(void 0!==e[i]){var s=t.dependencies[i];if("string"==typeof s){if(void 0===e[s]&&(r=this.createError(v.OBJECT_DEPENDENCY_KEY,{key:i,missing:s},"","",null,e,t).prefixWith(null,i).prefixWith(null,"dependencies"),this.handleError(r)))return r}else if(Array.isArray(s))for(var o=0;o<s.length;o++){var a=s[o];if(void 0===e[a]&&(r=this.createError(v.OBJECT_DEPENDENCY_KEY,{key:i,missing:a},"","/"+o,null,e,t).prefixWith(null,i).prefixWith(null,"dependencies"),this.handleError(r)))return r}else if(r=this.validateAll(e,s,[],["dependencies",i],n))return r}return null},c.prototype.validateCombinations=function(e,t,n){return this.validateAllOf(e,t,n)||this.validateAnyOf(e,t,n)||this.validateOneOf(e,t,n)||this.validateNot(e,t,n)||null},c.prototype.validateAllOf=function(e,t,n){if(void 0===t.allOf)return null;for(var r,i=0;i<t.allOf.length;i++){var s=t.allOf[i];if(r=this.validateAll(e,s,[],["allOf",i],n))return r}return null},c.prototype.validateAnyOf=function(e,t,n){if(void 0===t.anyOf)return null;var r,i,s=[],o=this.errors.length;this.trackUnknownProperties&&(r=this.unknownPropertyPaths,i=this.knownPropertyPaths);for(var a=!0,l=0;l<t.anyOf.length;l++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var c=t.anyOf[l],u=this.errors.length,h=this.validateAll(e,c,[],["anyOf",l],n);if(null===h&&u===this.errors.length){if(this.errors=this.errors.slice(0,o),this.trackUnknownProperties){for(var d in this.knownPropertyPaths)i[d]=!0,delete r[d];for(var p in this.unknownPropertyPaths)i[p]||(r[p]=!0);a=!1;continue}return null}h&&s.push(h.prefixWith(null,""+l).prefixWith(null,"anyOf"))}return this.trackUnknownProperties&&(this.unknownPropertyPaths=r,this.knownPropertyPaths=i),a?(s=s.concat(this.errors.slice(o)),this.errors=this.errors.slice(0,o),this.createError(v.ANY_OF_MISSING,{},"","/anyOf",s,e,t)):void 0},c.prototype.validateOneOf=function(e,t,n){if(void 0===t.oneOf)return null;var r,i,s=null,o=[],a=this.errors.length;this.trackUnknownProperties&&(r=this.unknownPropertyPaths,i=this.knownPropertyPaths);for(var l=0;l<t.oneOf.length;l++){this.trackUnknownProperties&&(this.unknownPropertyPaths={},this.knownPropertyPaths={});var c=t.oneOf[l],u=this.errors.length,h=this.validateAll(e,c,[],["oneOf",l],n);if(null===h&&u===this.errors.length){if(null!==s)return this.errors=this.errors.slice(0,a),this.createError(v.ONE_OF_MULTIPLE,{index1:s,index2:l},"","/oneOf",null,e,t);if(s=l,this.trackUnknownProperties){for(var d in this.knownPropertyPaths)i[d]=!0,delete r[d];for(var p in this.unknownPropertyPaths)i[p]||(r[p]=!0)}}else h&&o.push(h)}return this.trackUnknownProperties&&(this.unknownPropertyPaths=r,this.knownPropertyPaths=i),null===s?(o=o.concat(this.errors.slice(a)),this.errors=this.errors.slice(0,a),this.createError(v.ONE_OF_MISSING,{},"","/oneOf",o,e,t)):(this.errors=this.errors.slice(0,a),null)},c.prototype.validateNot=function(e,t,n){if(void 0===t.not)return null;var r,i,s=this.errors.length;this.trackUnknownProperties&&(r=this.unknownPropertyPaths,i=this.knownPropertyPaths,this.unknownPropertyPaths={},this.knownPropertyPaths={});var o=this.validateAll(e,t.not,null,null,n),a=this.errors.slice(s);return this.errors=this.errors.slice(0,s),this.trackUnknownProperties&&(this.unknownPropertyPaths=r,this.knownPropertyPaths=i),null===o&&0===a.length?this.createError(v.NOT_PASSED,{},"","/not",null,e,t):null},c.prototype.validateHypermedia=function(e,t,n){if(!t.links)return null;for(var r,i=0;i<t.links.length;i++){var s=t.links[i];if("describedby"===s.rel){for(var o=new l(s.href),a=!0,c=0;c<o.varNames.length;c++)if(!(o.varNames[c]in e)){a=!1;break}if(a){var u={$ref:o.fillFromObject(e)};if(r=this.validateAll(e,u,[],["links",i],n))return r}}}};var v={INVALID_TYPE:0,ENUM_MISMATCH:1,ANY_OF_MISSING:10,ONE_OF_MISSING:11,ONE_OF_MULTIPLE:12,NOT_PASSED:13,NUMBER_MULTIPLE_OF:100,NUMBER_MINIMUM:101,NUMBER_MINIMUM_EXCLUSIVE:102,NUMBER_MAXIMUM:103,NUMBER_MAXIMUM_EXCLUSIVE:104,NUMBER_NOT_A_NUMBER:105,STRING_LENGTH_SHORT:200,STRING_LENGTH_LONG:201,STRING_PATTERN:202,OBJECT_PROPERTIES_MINIMUM:300,OBJECT_PROPERTIES_MAXIMUM:301,OBJECT_REQUIRED:302,OBJECT_ADDITIONAL_PROPERTIES:303,OBJECT_DEPENDENCY_KEY:304,ARRAY_LENGTH_SHORT:400,ARRAY_LENGTH_LONG:401,ARRAY_UNIQUE:402,ARRAY_ADDITIONAL_ITEMS:403,FORMAT_CUSTOM:500,KEYWORD_CUSTOM:501,CIRCULAR_REFERENCE:600,UNKNOWN_PROPERTY:1e3},b={};for(var w in v)b[v[w]]=w;var _={INVALID_TYPE:"Invalid type: {type} (expected {expected})",ENUM_MISMATCH:"No enum match for: {value}",ANY_OF_MISSING:'Data does not match any schemas from "anyOf"',ONE_OF_MISSING:'Data does not match any schemas from "oneOf"',ONE_OF_MULTIPLE:'Data is valid against more than one schema from "oneOf": indices {index1} and {index2}',NOT_PASSED:'Data matches schema from "not"',NUMBER_MULTIPLE_OF:"Value {value} is not a multiple of {multipleOf}",NUMBER_MINIMUM:"Value {value} is less than minimum {minimum}",NUMBER_MINIMUM_EXCLUSIVE:"Value {value} is equal to exclusive minimum {minimum}",NUMBER_MAXIMUM:"Value {value} is greater than maximum {maximum}",NUMBER_MAXIMUM_EXCLUSIVE:"Value {value} is equal to exclusive maximum {maximum}",NUMBER_NOT_A_NUMBER:"Value {value} is not a valid number",STRING_LENGTH_SHORT:"String is too short ({length} chars), minimum {minimum}",STRING_LENGTH_LONG:"String is too long ({length} chars), maximum {maximum}",STRING_PATTERN:"String does not match pattern: {pattern}",OBJECT_PROPERTIES_MINIMUM:"Too few properties defined ({propertyCount}), minimum {minimum}",OBJECT_PROPERTIES_MAXIMUM:"Too many properties defined ({propertyCount}), maximum {maximum}",OBJECT_REQUIRED:"Missing required property: {key}",OBJECT_ADDITIONAL_PROPERTIES:"Additional properties not allowed",OBJECT_DEPENDENCY_KEY:"Dependency failed - key must exist: {missing} (due to key: {key})",ARRAY_LENGTH_SHORT:"Array is too short ({length}), minimum {minimum}",ARRAY_LENGTH_LONG:"Array is too long ({length}), maximum {maximum}",ARRAY_UNIQUE:"Array items are not unique (indices {match1} and {match2})",ARRAY_ADDITIONAL_ITEMS:"Additional items not allowed",FORMAT_CUSTOM:"Format validation failed ({message})",KEYWORD_CUSTOM:"Keyword failed: {key} ({message})",CIRCULAR_REFERENCE:"Circular $refs: {urls}",UNKNOWN_PROPERTY:"Unknown property (not in schema)"};function x(e,t,n,r,i){if(Error.call(this),void 0===e)throw new Error("No error code supplied: "+r);this.message="",this.params=t,this.code=e,this.dataPath=n||"",this.schemaPath=r||"",this.subErrors=i||null;var s=new Error(this.message);if(this.stack=s.stack||s.stacktrace,!this.stack)try{throw s}catch(s){this.stack=s.stack||s.stacktrace}}x.prototype=Object.create(Error.prototype),x.prototype.constructor=x,x.prototype.name="ValidationError",x.prototype.prefixWith=function(e,t){if(null!==e&&(e=e.replace(/~/g,"~0").replace(/\//g,"~1"),this.dataPath="/"+e+this.dataPath),null!==t&&(t=t.replace(/~/g,"~0").replace(/\//g,"~1"),this.schemaPath="/"+t+this.schemaPath),null!==this.subErrors)for(var n=0;n<this.subErrors.length;n++)this.subErrors[n].prefixWith(e,t);return this};var C={},S=function e(t){var n,r,i=new c,s={setErrorReporter:function(e){return"string"==typeof e?this.language(e):(r=e,!0)},addFormat:function(){i.addFormat.apply(i,arguments)},language:function(e){return e?(C[e]||(e=e.split("-")[0]),!!C[e]&&(n=e,e)):n},addLanguage:function(e,t){var n;for(n in v)t[n]&&!t[v[n]]&&(t[v[n]]=t[n]);var r=e.split("-")[0];if(C[r])for(n in C[e]=Object.create(C[r]),t)void 0===C[r][n]&&(C[r][n]=t[n]),C[e][n]=t[n];else C[e]=t,C[r]=t;return this},freshApi:function(t){var n=e();return t&&n.language(t),n},validate:function(e,t,s,o){var a=y(n),l=new c(i,!1,r?function(e,t,n){return r(e,t,n)||a(e,t,n)}:a,s,o);"string"==typeof t&&(t={$ref:t}),l.addSchema("",t);var u=l.validateAll(e,t,null,null,"");return!u&&o&&(u=l.banUnknownProperties(e,t)),this.error=u,this.missing=l.missing,this.valid=null===u,this.valid},validateResult:function(){var e={toString:function(){return this.valid?"valid":this.error.message}};return this.validate.apply(e,arguments),e},validateMultiple:function(e,t,s,o){var a=y(n),l=new c(i,!0,r?function(e,t,n){return r(e,t,n)||a(e,t,n)}:a,s,o);"string"==typeof t&&(t={$ref:t}),l.addSchema("",t),l.validateAll(e,t,null,null,""),o&&l.banUnknownProperties(e,t);var u={toString:function(){return this.valid?"valid":this.error.message}};return u.errors=l.errors,u.missing=l.missing,u.valid=0===u.errors.length,u},addSchema:function(){return i.addSchema.apply(i,arguments)},getSchema:function(){return i.getSchema.apply(i,arguments)},getSchemaMap:function(){return i.getSchemaMap.apply(i,arguments)},getSchemaUris:function(){return i.getSchemaUris.apply(i,arguments)},getMissingUris:function(){return i.getMissingUris.apply(i,arguments)},dropSchemas:function(){i.dropSchemas.apply(i,arguments)},defineKeyword:function(){i.defineKeyword.apply(i,arguments)},defineError:function(e,t,n){if("string"!=typeof e||!/^[A-Z]+(_[A-Z]+)*$/.test(e))throw new Error("Code name must be a string in UPPER_CASE_WITH_UNDERSCORES");if("number"!=typeof t||t%1!=0||t<1e4)throw new Error("Code number must be an integer > 10000");if(void 0!==v[e])throw new Error("Error already defined: "+e+" as "+v[e]);if(void 0!==b[t])throw new Error("Error code already used: "+b[t]+" as "+t);for(var r in v[e]=t,b[t]=e,_[e]=_[t]=n,C){var i=C[r];i[e]&&(i[t]=i[t]||i[e])}},reset:function(){i.reset(),this.error=null,this.missing=[],this.valid=!0},missing:[],error:null,valid:!0,normSchema:m,resolveUrl:f,getDocumentUri:g,errorCodes:v};return s.language(t||"en"),s}();return S.addLanguage("en-gb",_),S.tv4=S,S}.apply(t,[]))||(e.exports=n)},713:function(e){!function(){{const t=function(){var e={"http://webfinger.net/rel/avatar":"avatar",remotestorage:"remotestorage","http://tools.ietf.org/id/draft-dejong-remotestorage":"remotestorage",remoteStorage:"remotestorage","http://www.packetizer.com/rel/share":"share","http://webfinger.net/rel/profile-page":"profile",me:"profile",vcard:"vcard",blog:"blog","http://packetizer.com/rel/blog":"blog","http://schemas.google.com/g/2010#updates-from":"updates","https://camlistore.org/rel/server":"camilstore"},t={avatar:[],remotestorage:[],blog:[],vcard:[],updates:[],share:[],profile:[],camlistore:[]},n=["webfinger","host-meta","host-meta.json"],r="(?:25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)",i=new RegExp(`^(?:${r}\\.){3}${r}$`),s=new RegExp(`^(${r})\\.(${r})\\.(${r})\\.(${r})$`),o=/^localhost(?:\.localdomain)?(?::\d+)?$/,a=/^\d+$/,l=/^[a-zA-Z0-9.-]+$/,c=/^127\.(?:\d{1,3}\.){2}\d{1,3}$/;function u(e){const t=e.match(s);return t?t.slice(1).map(Number):null}function h(e){const[t,n]=e;return 0===t||10===t||127===t||172===t&&n>=16&&n<=31||192===t&&168===n||169===t&&254===n||t>=224&&t<=239||t>=240}class d extends Error{status;constructor(e,t){super(e),this.name="WebFingerError",this.status=t}}class p{static default;config;constructor(e={}){this.config={tls_only:void 0===e.tls_only||e.tls_only,uri_fallback:void 0!==e.uri_fallback&&e.uri_fallback,request_timeout:void 0!==e.request_timeout?e.request_timeout:1e4,allow_private_addresses:void 0!==e.allow_private_addresses&&e.allow_private_addresses}}async fetchJRD(e,t=0){if(t>3)throw new d("too many redirects");const n=new AbortController,r=setTimeout(()=>{n.abort()},this.config.request_timeout);try{const i=await fetch(e,{headers:{Accept:"application/jrd+json, application/json"},redirect:"manual",signal:n.signal});if(i.status>=300&&i.status<400){const n=i.headers.get("location");if(!n)throw new d("redirect without location header");let s;try{s=new URL(n,e)}catch{throw new d("invalid redirect URL")}try{await this.resolveAndValidateHost(s.host)}catch(e){if(e instanceof d)throw new d("redirect to private or internal address blocked");throw e}return clearTimeout(r),this.fetchJRD(s.toString(),t+1)}if(404===i.status)throw new d("resource not found",404);if(!i.ok)throw new d("error during request",i.status);const s=i.headers.get("content-type")||"",o=s.toLowerCase().split(";")[0].trim();"application/jrd+json"===o||("application/json"===o?console.debug('WebFinger: Server uses "application/json" instead of RFC 7033 recommended "application/jrd+json".'):console.warn(`WebFinger: Server returned unexpected content-type "${s}". Expected "application/jrd+json" per RFC 7033.`));const a=await i.text();if(p.isValidJSON(a))return a;throw new d("invalid json")}catch(e){if(n.signal.aborted)throw new d("request timed out");throw e}finally{clearTimeout(r)}}static isValidJSON(e){try{JSON.parse(e)}catch{return!1}return!0}static isLocalhost(e){return o.test(e)}static isPrivateAddress(e){let t=e;if(t.startsWith("[")&&t.includes("]:"))t=t.substring(1,t.lastIndexOf("]:"));else if(t.startsWith("[")&&t.endsWith("]"))t=t.substring(1,t.length-1);else if(t.includes(":")&&1===(t.match(/:/g)||[]).length){const e=t.split(":"),n=e[0],r=e[1];if(r&&!a.test(r))throw new d("invalid host format");(n.match(i)||n.match(l))&&(t=n)}if("localhost"===t||"127.0.0.1"===t||t.match(c)||"::1"===t||"localhost.localdomain"===t)return!0;const n=u(t);if(n)return h(n);const r=function(e){let t=e.toLowerCase();const n=u(t.substring(t.lastIndexOf(":")+1));if(n&&(t=`${t.substring(0,t.lastIndexOf(":"))}:${(n[0]<<8|n[1]).toString(16)}:${(n[2]<<8|n[3]).toString(16)}`),!/^[0-9a-f:]+$/.test(t)||t.indexOf("::")!==t.lastIndexOf("::"))return null;const r=t.includes("::"),[i="",s=""]=t.split("::"),o=i?i.split(":"):[],a=r&&s?s.split(":"):[],l=8-o.length-a.length;if(!r&&8!==o.length||r&&l<1)return null;const c=(r?[...o,...Array(l).fill("0"),...a]:o).map(e=>Number.parseInt(e,16));return 8===c.length&&c.every(e=>e>=0&&e<=65535)?c:null}(t);if(r){const e=r.slice(0,5).every(e=>0===e)&&65535===r[5],t=r.slice(0,6).every(e=>0===e);if(e||t)return h([r[6]>>8,255&r[6],r[7]>>8,255&r[7]]);const n=r[0];return 64512==(65024&n)||65152==(65472&n)||!(65280&~n)}return!1}static getExplicitPort(e){if(e.startsWith("[")){const t=e.lastIndexOf("]:");if(-1!==t){const n=e.substring(t+2);if(!a.test(n))throw new d("invalid host format");return n}return}if(1===(e.match(/:/g)||[]).length){const[,t=""]=e.split(":");if(!t||!a.test(t))throw new d("invalid host format");return t}}static parseAddress(e){const t=e.replace(/ /g,"");if(t.includes("://")){let e;try{e=new URL(t)}catch{throw new d("invalid URI format")}if(!e.hostname)throw new d("could not determine host from address");return{host:e.host}}const n=t.split("@");if(2!==n.length||!n[1])throw new d("invalid useraddress format");return{host:n[1]}}async resolveAndValidateHost(e){const t=p.normalizeHost(e);if(!this.config.allow_private_addresses){if(p.isPrivateAddress(t.host))throw new d("private or internal addresses are not allowed");await this.validateDNSResolution(t.hostname)}return t}static normalizeHost(e){const t=e.split("/")[0];if(!t||0===t.length)throw new d("invalid host format");if(/[?# @]/.test(t))throw new d("invalid characters in host");const n=p.getExplicitPort(t);let r;try{r=new URL(`http://${t}`)}catch{throw new d("invalid host format")}const i=r.hostname;return{host:n?`${i}:${n}`:r.host||i,hostname:i}}static async processJRD(n,r){const i=JSON.parse(r);if("object"!=typeof i||"object"!=typeof i.links)throw void 0!==i.error?new d(i.error):new d("unknown response from server");const s={object:i,idx:{properties:{name:void 0},links:JSON.parse(JSON.stringify(t))}};(Array.isArray(i.links)?i.links:[]).map(function(t){if(Object.prototype.hasOwnProperty.call(e,String(t.rel))){const n=e[String(t.rel)];if(s.idx.links[n]){const e={href:String(t.href||""),rel:String(t.rel||"")};Object.keys(t).map(function(n){"object"==typeof t[n]&&null!==t[n]?e[n]=t[n]:e[n]=String(t[n])}),s.idx.links[n].push(e)}}});const o=i.properties||{};for(const e in o)Object.prototype.hasOwnProperty.call(o,e)&&"http://packetizer.com/ns/name"===e&&(s.idx.properties.name=o[e]);return s}async validateDNSResolution(e){if(!e.match(i)&&!e.includes(":")&&"localhost"!==e&&"undefined"!=typeof process&&process.versions?.node){const t="function"==typeof process.getBuiltinModule?process.getBuiltinModule("node:dns")?.promises:null;if(t)try{const[n,r]=await Promise.allSettled([t.resolve4(e).catch(()=>[]),t.resolve6(e).catch(()=>[])]),i="fulfilled"===n.status?n.value:[],s="fulfilled"===r.status?r.value:[];for(const t of[...i,...s])if(p.isPrivateAddress(t))throw new d(`hostname ${e} resolves to private address ${t}`)}catch(e){if(e instanceof d)throw e}}}async lookup(e){if(!e)throw new d("address is required");const{host:t}=p.parseAddress(e),{host:r}=await this.resolveAndValidateHost(t);let i=0,s="https";p.isLocalhost(r)&&(s="http");const o=async e=>{if(this.config.uri_fallback&&i!==n.length-1)return i+=1,a();if(this.config.tls_only||"https"!==s)throw e instanceof Error?e:new d(String(e));return i=0,s="http",a()},a=async()=>{const t=(()=>{let t="";return e.split("://")[1]||(t="acct:"),s+"://"+r+"/.well-known/"+n[i]+"?resource="+t+e})();try{const e=await this.fetchJRD(t);return p.processJRD(t,e)}catch(e){return await o(e)}};return a()}async lookupLink(e,n){if(Object.prototype.hasOwnProperty.call(t,n)){const t=(await this.lookup(e)).idx.links[n];return 0===t.length?Promise.reject('no links found with rel="'+n+'"'):Promise.resolve(t[0])}return Promise.reject("unsupported rel "+n)}}return p.default=p,p}();e.exports=t,e.exports.default=t}}("undefined"!=typeof self&&self)}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,n),s.exports}return n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n(423).default}()},"object"==typeof e&&"object"==typeof t?t.exports=r():"function"==typeof define&&define.amd?define("RemoteStorage",[],r):"object"==typeof e?e.RemoteStorage=r():n.RemoteStorage=r()}),tB=l(eB(),1),nB="0123456789ABCDEFGHJKMNPQRSTVWXYZ";!function(e){e.Base32IncorrectEncoding="B32_ENC_INVALID",e.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",e.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",e.EncodeTimeNegative="ENC_TIME_NEG",e.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",e.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",e.PRNGDetectFailure="PRNG_DETECT",e.ULIDInvalid="ULID_INVALID",e.Unexpected="UNEXPECTED",e.UUIDInvalid="UUID_INVALID"}(HU||(HU={}));var rB=class extends Error{constructor(e,t){super(`${t} (${e})`),this.name="ULIDError",this.code=e}};function iB(e){const t=Math.floor(32*e())%32;return nB.charAt(t)}var sB={type:"object",properties:{id:{type:"string"},title:{type:"string"},lat:{type:"number"},lon:{type:"number"},geohash:{type:"string"},zoom:{type:"number"},url:{type:"string"},osmId:{type:"string"},osmType:{type:"string"},osmTags:{type:"object",additionalProperties:{type:"string"}},description:{type:"string"},tags:{type:"array",items:{type:"string"},default:[]},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"}},required:["id","title","lat","lon","geohash","createdAt"]},oB={type:"object",properties:{id:{type:"string"},title:{type:"string"},color:{type:"string"},placeRefs:{type:"array",items:{type:"object",properties:{id:{type:"string"},geohash:{type:"string"}},required:["id","geohash"]},default:[]},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"}},required:["id","title","placeRefs","createdAt"]},aB={name:"places",builder:function(e){function t(e,t){return`${e.substring(0,2)}/${e.substring(2,4)}/${t}`}e.declareType("place",sB),e.declareType("list",oB);const n={async getAll(){const t=await e.getAll("_lists/");return t?Object.values(t):[]},async get(t){const n=`_lists/${t}`;return e.getObject(n)},async getPlaces(n){const r=await this.get(n);if(!r)throw new Error(`List not found: ${n}`);if(!r.placeRefs||!Array.isArray(r.placeRefs))return[];const i=r.placeRefs.map(async n=>{if(!n.id||!n.geohash)return null;const r=t(n.geohash,n.id);return await e.getObject(r)});return(await Promise.all(i)).filter(e=>!!e)},async create(t,n,r){const i=`_lists/${t}`;let s=await e.getObject(i);const o=(new Date).toISOString();return s?(s.title=n,r&&(s.color=r),s.updatedAt=o):s={id:t,title:n,color:r,placeRefs:[],createdAt:o,updatedAt:o},await e.storeObject("list",i,s),s},async delete(t){await e.remove(`_lists/${t}`)},async addPlace(t,n,r){const i=`_lists/${t}`,s=await e.getObject(i);if(!s)throw new Error(`List not found: ${t}`);return-1===s.placeRefs.findIndex(e=>e.id===n)&&(s.placeRefs.push({id:n,geohash:r}),s.updatedAt=(new Date).toISOString(),await e.storeObject("list",i,s)),s},async removePlace(t,n){const r=`_lists/${t}`,i=await e.getObject(r);if(!i)throw new Error(`List not found: ${t}`);const s=i.placeRefs.findIndex(e=>e.id===n);return-1!==s&&(i.placeRefs.splice(s,1),i.updatedAt=(new Date).toISOString(),await e.storeObject("list",r,i)),i},async initDefaults(){for(const e of[{id:"to-go",title:"Want to go",color:"#2e9e4f"},{id:"to-do",title:"To do",color:"#2a7fff"}])await this.get(e.id)||await this.create(e.id,e.title,e.color)}};return{exports:{lists:n,store:async function(n){const r=function(e){const t=(new Date).toISOString(),n=e.id||function(e,t){const n=t||function(){const e="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:null,t=e&&(e.crypto||e.msCrypto)||null;if("function"==typeof t?.getRandomValues)return()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]/256};if("function"==typeof t?.randomBytes)return()=>t.randomBytes(1).readUInt8()/256;throw new rB(HU.PRNGDetectFailure,"Failed to find a reliable PRNG")}();return function(e,t=10){if(isNaN(e))throw new rB(HU.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>0xffffffffffff)throw new rB(HU.EncodeTimeSizeExceeded,`Cannot encode a time larger than 281474976710655: ${e}`);if(e<0)throw new rB(HU.EncodeTimeNegative,`Time must be positive: ${e}`);if(!1===Number.isInteger(e))throw new rB(HU.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let n,r="";for(let i=t;i>0;i--)n=e%32,r=nB.charAt(n)+r,e=(e-n)/32;return r}(!e||isNaN(e)?Date.now():e,10)+function(e,t){let n="";for(;e>0;e--)n=iB(t)+n;return n}(16,n)}(),r="number"==typeof e.lat?e.lat:0,i="number"==typeof e.lon?e.lon:0,s=e.title||"Untitled Place",o=e.geohash||Bj.encode(r,i,10),a={...e,id:n,lat:r,lon:i,geohash:o,title:s,tags:e.tags||[],createdAt:e.createdAt||t,updatedAt:e.id?t:void 0};return Object.keys(a).forEach(e=>{void 0===a[e]&&delete a[e]}),a}(n),i=t(r.geohash,r.id);return await e.storeObject("place",i,r),r},remove:async function(r,i){if(!r||!i)throw new Error("Both id and geohash are required to remove a place");const s=await n.getAll();await Promise.all(s.map(async t=>{const n=t.placeRefs.findIndex(e=>e.id===r);-1!==n&&(t.placeRefs.splice(n,1),t.updatedAt=(new Date).toISOString(),await e.storeObject("list",`_lists/${t.id}`,t))}));const o=t(i,r);return e.remove(o)},get:async function(n,r){if(!n||!r)throw new Error("Both id and geohash are required to get a place");const i=t(r,n);return e.getObject(i)},listByPrefix:async function(t){let n="";return t.length>=2&&(n+=t.substring(0,2)+"/"),t.length>=4&&(n+=t.substring(2,4)+"/"),e.getAll(n)},getPlaces:async function(t){const n=[],r=async t=>{const r=await e.getAll(t,!1);r&&Object.values(r).forEach(e=>{e&&"object"==typeof e&&!e.toString().endsWith("/")&&n.push(e)})};if(t&&t.length>0){const e=t.map(async e=>{if(e.length<4)return;const t=e.substring(0,2),n=e.substring(2,4);await r(`${t}/${n}/`)});await Promise.all(e)}else{const t=e=>{if(!e||"object"!=typeof e)return[];let t=e;return e.items&&"object"==typeof e.items&&(t=e.items),Object.keys(t).filter(e=>e.endsWith("/")&&!e.startsWith("@"))},n=t(await e.getListing("",!1));await Promise.all(n.map(async n=>{const i=await e.getListing(n,!1),s=t(i);await Promise.all(s.map(async e=>{await r(n+e)}))}))}return n}}}}},lB=o((e,t)=>{var n,r;n=self,r=()=>(()=>{var e={d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function r(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}e.d(t,{default:()=>i});const i=function(){return e=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.rs=t,this.leaveOpen=!!n.leaveOpen&&n.leaveOpen,this.autoCloseAfter=n.autoCloseAfter?n.autoCloseAfter:1500,this.skipInitial=!!n.skipInitial&&n.skipInitial,this.logging=!!n.logging&&n.logging,this.parentContainerEl=null,n.hasOwnProperty("modalBackdrop")){if("boolean"!=typeof n.modalBackdrop&&"onlySmallScreens"!==n.modalBackdrop)throw'options.modalBackdrop has to be true/false or "onlySmallScreens"';this.modalBackdrop=n.modalBackdrop}else this.modalBackdrop="onlySmallScreens";this.active=!1,this.online=!1,this.closed=!1,this.lastSynced=null,this.lastSyncedUpdateLoop=null},t=[{key:"log",value:function(){if(this.logging){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];(e=console).debug.apply(e,["[RS-WIDGET] "].concat(n))}}},{key:"eventHandler",value:function(e,t){var n=this;switch(this.log("EVENT: ",e),e){case"ready":this.setState(this.state);break;case"sync-started":case"sync-req-done":this.handleSyncStarted();break;case"sync-done":if(this.online&&(null==t||!t.completed))return;this.syncInProgress=!1,this.rsSyncButton.classList.remove("rs-rotate"),this.updateLastSyncedStatus(),!this.closed&&this.shouldCloseWhenSyncDone&&setTimeout(this.close.bind(this),this.autoCloseAfter);break;case"disconnected":this.active=!1,this.setOnline(),this.setBackendClass(),this.open(),this.setInitialState();break;case"connected":this.active=!0,this.online=!0,this.rs.hasFeature("Sync")?(this.shouldCloseWhenSyncDone=!0,this.rs.on("sync-req-done",function(e){return n.eventHandler("sync-req-done",e)}),this.rs.on("sync-done",function(e){return n.eventHandler("sync-done",e)})):(this.rsSyncButton.classList.add("rs-hidden"),setTimeout(this.close.bind(this),this.autoCloseAfter));var r=this.rs.remote.userAddress;this.rsConnectedUser.innerHTML=r,this.setBackendClass(this.rs.backend),this.rsConnectedLabel.textContent="Connected",this.setState("connected");break;case"network-offline":this.setOffline();break;case"network-online":this.setOnline();break;case"error":this.setBackendClass(this.rs.backend),"DiscoveryError"===(null==t?void 0:t.name)?this.handleDiscoveryError(t):"SyncError"===(null==t?void 0:t.name)?this.handleSyncError(t):"Unauthorized"===(null==t?void 0:t.name)?this.handleUnauthorized(t):console.debug('Encountered unhandled error: "'.concat(t,'"'))}}},{key:"setState",value:function(e){if(e){this.log("Setting state ",e);var t=this.parentContainerEl.querySelector(".rs-box.rs-selected");t&&(t.classList.remove("rs-selected"),t.setAttribute("aria-hidden","true"));var n=this.parentContainerEl.querySelector(".rs-box.rs-box-"+e);n&&(n.classList.add("rs-selected"),n.setAttribute("aria-hidden","false"));var r=this.rsWidget.className.match(/rs-state-\S+/g)[0];this.rsWidget.classList.remove(r),this.rsWidget.classList.add("rs-state-".concat(e||this.state)),this.state=e}}},{key:"setInitialState",value:function(){this.skipInitial?this.showChooseOrSignIn():this.setState("initial")}},{key:"createHtmlTemplate",value:function(){var e=document.createElement("div");e.id="remotestorage-widget",e.innerHTML='<div class="remotestorage-widget-modal-backdrop"></div> <div class="rs-widget rs-state-initial"> <div class="rs-widget-icon"> <svg class="rs-main-logo" id="rs-main-logo-remotestorage" xmlns="http://www.w3.org/2000/svg" version="1.1" xml:space="preserve" width="0.739008in" height="0.853339in" style="shape-rendering:geometricPrecision;text-rendering:geometricPrecision;image-rendering:optimizeQuality;fill-rule:evenodd;clip-rule:evenodd" viewBox="0 0 739 853" xmlns:xlink="http://www.w3.org/1999/xlink"> <g> <polygon class="rs-logo-shape" points="370,754 0,542 0,640 185,747 370,853 554,747 739,640 739,525 739,525 739,476 739,427 739,378 653,427 370,589 86,427 86,427 86,361 185,418 370,524 554,418 653,361 739,311 739,213 739,213 554,107 370,0 185,107 58,180 144,230 228,181 370,100 511,181 652,263 370,425 87,263 87,263 0,213 0,213 0,311 0,378 0,427 0,476 86,525 185,582 370,689 554,582 653,525 653,590 653,592 "/> </g> </svg> <svg class="rs-main-logo" id="rs-main-logo-dropbox" width="40" height="36" xml:space="preserve" stroke-miterlimit="1.4142" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 97" stroke-linejoin="round" version="1.1" clip-rule="evenodd"> <path d="m30.691 0l-30.691 20.039 21.221 16.994 30.946-19.108-21.476-17.925z" fill="#007ee5"/> <path d="m0 54.028l30.691 20.039 21.476-17.926-30.945-19.108-21.222 16.995z" fill="#007ee5"/> <path d="m52.167 56.142l21.477 17.926 30.696-20.039-21.227-16.995-30.946 19.108z" fill="#007ee5"/> <path d="m104.34 20.039l-30.696-20.039-21.477 17.925 30.946 19.108 21.227-16.994z" fill="#007ee5"/> <path d="m52.23 59.998l-21.538 17.873-9.218-6.018v6.747l30.756 18.443 30.756-18.443v-6.747l-9.216 6.018-21.54-17.873z" fill="#007ee5"/> </svg> <svg class="rs-main-logo" id="rs-main-logo-googledrive" width="40" height="40" version="1.1" stroke-miterlimit="1.4142" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" width="100%" stroke-linejoin="round" clip-rule="evenodd" viewBox="0 0 511 442" height="100%"> <path d="m166.23 0.10955l0.44-0.009998 0.04 0.49-0.56 0.02 0.08-0.5z" fill="#0ba25e"/> <path d="m164.52 3.3896c0.39-0.56 1.15-1.68 1.54-2.24l0.7-0.11c0.52 6.34 2.38 12.45 3.78 18.62 6.02 26.81 12.1 53.6 18.43 80.33 4.15 18.33 8.78 36.57 12.58 54.97 3.3 11.39 5.07 23.14 8.26 34.55 2.06 10.64 5.29 21.02 7.02 31.72-0.7 1.17-1.4 2.35-2.11 3.52-0.17 0.27-0.53 0.83-0.7 1.11l-0.26 0.45c-0.04 0.08-0.13 0.25-0.18 0.33-0.39 0.72-1.17 2.15-1.56 2.86-0.07 0.13-0.22 0.39-0.3 0.52l-0.71 1.26c-0.09 0.15-0.26 0.44-0.34 0.59l-0.83 1.45c-0.04 0.08-0.13 0.24-0.18 0.32l-1.03 1.8c-0.09 0.15-0.27 0.47-0.36 0.63-0.1 0.17-0.3 0.5-0.4 0.67l-1.01 1.74c-0.08 0.13-0.24 0.41-0.32 0.54l-0.62 1.05c-0.1 0.18-0.32 0.55-0.42 0.73-0.4 0.69-1.19 2.07-1.59 2.77-0.07 0.12-0.22 0.37-0.29 0.5l-0.63 1.05c-0.1 0.19-0.32 0.55-0.43 0.74-0.37 0.65-1.13 1.94-1.5 2.59-0.09 0.15-0.26 0.46-0.35 0.61l-0.75 1.35c-0.07 0.12-0.21 0.37-0.28 0.49l-0.77 1.35-0.32 0.56c-0.4 0.66-1.18 1.99-1.57 2.66-0.09 0.15-0.27 0.46-0.36 0.62l-0.71 1.28c-0.07 0.12-0.2 0.35-0.26 0.47l-0.82 1.42c-0.07 0.13-0.22 0.38-0.29 0.5-0.42 0.72-1.25 2.15-1.67 2.87-0.07 0.13-0.23 0.39-0.31 0.52l-0.6 0.99c-0.1 0.18-0.31 0.53-0.41 0.71-0.38 0.66-1.13 1.97-1.51 2.63-0.06 0.11-0.2 0.35-0.26 0.46l-0.82 1.46c-0.06 0.11-0.18 0.32-0.24 0.43l-0.84 1.47c-0.07 0.11-0.21 0.35-0.28 0.46-0.39 0.66-1.18 1.96-1.57 2.62-0.11 0.17-0.31 0.53-0.42 0.71l-0.59 1.1c-0.08 0.14-0.23 0.42-0.3 0.55l-1.03 1.78c-0.08 0.15-0.26 0.45-0.34 0.6-0.09 0.14-0.25 0.43-0.33 0.57-1.69 2.85-3.22 5.79-5.09 8.53-10.65 17.37-20.45 35.28-30.76 52.86-16.74 28.97-33.46 57.94-50.2 86.91-2.51 4.51-5.37 8.83-7.53 13.54-0.11 0.16-0.33 0.48-0.44 0.64-4.01-5.78-7.11-12.16-10.78-18.16-16.74-28.99-33.49-57.97-50.22-86.97-9.3-16.31-18.99-32.42-28.04-48.88 35.84-61.85 71.52-123.81 107.29-185.7 0.03-0.06 0.1-0.17 0.13-0.23l0.98-1.68c0.04-0.07 0.12-0.21 0.17-0.28l0.99-1.69c0.09-0.15 0.27-0.47 0.37-0.62 0.1-0.18 0.3-0.53 0.4-0.71l0.99-1.76 0.28-0.48 0.74-1.18c0.13-0.19 0.39-0.58 0.52-0.78 0.36-0.54 1.09-1.63 1.46-2.17 0.04-0.18 0.11-0.53 0.15-0.7l0.87-1.67 0.16-0.28 1-1.68c0.1-0.16 0.3-0.5 0.4-0.67 0.11-0.19 0.33-0.58 0.45-0.78l0.84-1.47c0.09-0.16 0.27-0.47 0.36-0.62l0.7-1.23c0.08-0.13 0.24-0.41 0.32-0.55 0.39-0.67 1.17-2.01 1.57-2.68l0.32-0.56 0.73-1.33c0.06-0.1 0.18-0.32 0.24-0.42l0.96-1.68c0.12-0.2 0.37-0.61 0.5-0.81l0.65-0.98c0.14-0.2 0.41-0.59 0.55-0.78 0.12-0.2 0.37-0.6 0.5-0.8l0.54-1.04c0.18-0.39 0.55-1.17 0.73-1.56l0.55-0.77c0.1-0.14 0.29-0.41 0.39-0.55 0.37-0.31 1.12-0.95 1.49-1.27l-0.07-1.17c0.06-0.14 0.2-0.42 0.27-0.56l0.85-1.69c0.07-0.12 0.21-0.37 0.28-0.49l0.75-1.22c0.14-0.2 0.41-0.6 0.55-0.8 0.34-0.56 1.03-1.66 1.37-2.21 0.1-0.2 0.28-0.59 0.38-0.79l0.53-1.15c0.16-0.3 0.5-0.91 0.67-1.22l0.66-0.94c0.14-0.19 0.42-0.57 0.56-0.76 0.12-0.2 0.37-0.6 0.49-0.8l0.49-1.03c0.11-0.23 0.34-0.7 0.45-0.93l0.86-1.66c0.13-0.2 0.38-0.62 0.5-0.83l0.66-0.98c0.14-0.2 0.42-0.58 0.56-0.78 0.13-0.2 0.38-0.61 0.5-0.81l0.51-1.04c0.15-0.29 0.44-0.86 0.58-1.15l0.68-1.12c0.12-0.19 0.36-0.57 0.49-0.76 0.36-0.56 1.09-1.68 1.46-2.23 0.04-0.17 0.13-0.51 0.17-0.68l0.87-1.66c0.03-0.07 0.11-0.2 0.15-0.27l1-1.71c0.1-0.17 0.29-0.5 0.39-0.67 0.1-0.16 0.29-0.5 0.39-0.66l1-1.75c0.04-0.07 0.12-0.21 0.16-0.29l0.94-1.63c0.05-0.07 0.14-0.22 0.18-0.3l1.01-1.7c0.09-0.16 0.27-0.46 0.36-0.62 0.1-0.17 0.3-0.52 0.4-0.7l0.96-1.69c0.06-0.11 0.18-0.32 0.24-0.42l0.81-1.31c0.13-0.19 0.39-0.58 0.51-0.77 0.37-0.55 1.09-1.65 1.46-2.2 0.03-0.17 0.11-0.51 0.15-0.68l0.85-1.63c0.07-0.12 0.22-0.37 0.29-0.5l0.76-1.19c0.14-0.19 0.4-0.58 0.54-0.78 0.35-0.56 1.05-1.67 1.4-2.23 0.05-0.16 0.14-0.48 0.19-0.64l0.88-1.65c0.04-0.08 0.12-0.22 0.16-0.3l1.02-1.7204c0.08-0.15 0.26-0.45 0.35-0.6 0.09-0.17 0.27-0.49 0.36-0.65l1-1.78c0.05-0.07 0.13-0.22 0.17-0.29l0.95-1.61c0.03-0.05 0.1-0.16 0.13-0.21z" fill="#0ba25e"/> <path id="#fccd48ff" fill="#fccd48" d="m166.67 0.099552c32.48-0.15 64.97-0.02 97.46-0.07 26.88 0.099998 53.78-0.21 80.65 0.15 0.53 1.02 1.07 2.03 1.64 3.04 0.08 0.13 0.23 0.41 0.31 0.55 2.6 4.53 5.24 9.0404 7.81 13.58 0.05 0.08 0.13 0.23 0.18 0.3 4.98 8.55 9.94 17.11 14.83 25.71 0.04 0.07 0.13 0.21 0.17 0.29 0.89 1.53 1.81 3.06 2.72 4.6 0.08 0.13 0.23 0.4 0.31 0.54 1.25 2.2 2.51 4.39 3.78 6.58 0.05 0.07 0.13 0.21 0.17 0.29 1.27 2.18 2.52 4.38 3.78 6.58 0.08 0.13 0.23 0.39 0.31 0.52 1.27 2.14 2.5 4.3 3.72 6.46 0.08 0.13 0.23 0.4 0.31 0.53 11.94 20.62 23.85 41.25 35.75 61.9-1.36 5.99 1.93 11.95 0.1 17.97-1.11 16.45-7.32 32.46-17.56 45.38-3.33 3.61-0.1 8.62-0.46 12.9-3.59 4.35-8.21 7.6-12.57 11.11 0.01 3.28 0.02 6.56-0.13 9.85-3.89 2.57-8.35 4.06-12.3 6.54-0.42 1.33-0.85 2.67-1.26 4.02-3.17 1.5-6.56 2.47-9.73 3.99-12.55-3.6-24.97-7.61-37.49-11.32-11.65-3.85-23.58-6.87-35.11-11.11l-0.66-1.18c-0.06-0.09-0.16-0.27-0.21-0.36l-0.95-1.61-0.4-0.68c-0.09-0.15-0.25-0.44-0.34-0.59-0.71-1.26-1.36-2.55-1.94-3.87l-0.06-0.13-0.07-0.1c-0.44-0.7-1.33-2.11-1.78-2.81-0.05-0.08-0.15-0.24-0.2-0.33l-0.29-0.46c-0.17-0.29-0.52-0.86-0.69-1.15-0.43-0.73-1.3-2.19-1.73-2.92-0.11-0.18-0.32-0.55-0.43-0.73l-0.61-1.04c-0.08-0.14-0.24-0.41-0.32-0.55l-0.97-1.67c-0.04-0.07-0.13-0.21-0.17-0.29l-1.02-1.75c-0.09-0.16-0.27-0.48-0.36-0.63-0.1-0.18-0.31-0.55-0.41-0.73l-0.83-1.46c-0.1-0.17-0.3-0.53-0.4-0.7l-0.64-1.13c-0.09-0.15-0.26-0.45-0.35-0.6-0.39-0.72-1.18-2.15-1.58-2.87-0.04-0.08-0.14-0.25-0.18-0.33l-0.27-0.47c-0.19-0.28-0.56-0.84-0.75-1.12-0.99-1.66-1.92-3.36-2.81-5.07-0.05-0.08-0.14-0.25-0.18-0.33l-0.26-0.46c-0.19-0.27-0.57-0.81-0.76-1.07-0.44-0.79-1.32-2.37-1.76-3.16-0.05-0.08-0.15-0.25-0.19-0.34l-0.27-0.48c-0.2-0.33-0.59-0.98-0.79-1.31l-0.86-1.45c-0.08-0.14-0.25-0.42-0.34-0.57-0.38-0.66-1.15-1.99-1.54-2.65-0.09-0.15-0.26-0.46-0.35-0.62-0.68-1.13-1.33-2.27-1.97-3.41-0.05-0.09-0.16-0.27-0.21-0.36l-0.95-1.63c-0.1-0.16-0.29-0.48-0.38-0.65-0.09-0.15-0.26-0.45-0.35-0.6l-1.01-1.76c-0.05-0.08-0.14-0.25-0.19-0.33l-0.82-1.47c-0.07-0.12-0.2-0.35-0.27-0.47-0.38-0.67-1.15-2-1.53-2.67-0.08-0.14-0.24-0.41-0.32-0.54-0.62-1.03-1.24-2.07-1.84-3.1-27.73-48.12-55.5-96.21-83.29-144.3-1.74-3.0004-3.32-6.1204-5.45-8.8804l-0.05-0.45005-0.04-0.49z"/> <path d="m166.15 0.60955l0.56-0.02 0.05 0.45005-0.7 0.11 0.09-0.54005z" fill="#089156"/> <path d="m166.76 1.0396c2.13 2.76 3.71 5.88 5.45 8.88 27.79 48.09 55.56 96.18 83.29 144.3-12.84 22.36-25.78 44.67-38.67 67.01-1.73-10.7-4.96-21.08-7.02-31.72-3.19-11.41-4.96-23.16-8.26-34.55-3.8-18.4-8.43-36.64-12.58-54.97-6.33-26.73-12.41-53.52-18.43-80.33-1.4-6.17-3.26-12.28-3.78-18.62z" fill="#089156"/> <path d="m164.39 3.5996c0.03-0.05 0.1-0.16 0.13-0.21-0.03 0.05-0.1 0.16-0.13 0.21z" fill="#089156"/> <path d="m163.27 5.4996c0.05-0.07 0.13-0.22 0.17-0.29-0.04 0.07-0.12 0.22-0.17 0.29z" fill="#089156"/> <path d="m161.91 7.9296c0.09-0.17 0.27-0.49 0.36-0.65-0.09 0.16-0.27 0.48-0.36 0.65z" fill="#089156"/> <path d="m161.56 8.5296c0.08-0.15 0.26-0.45 0.35-0.6-0.09 0.15-0.27 0.45-0.35 0.6z" fill="#089156"/> <path d="m160.38 10.55c0.04-0.08 0.12-0.22 0.16-0.3-0.04 0.08-0.12 0.22-0.16 0.3z" fill="#089156"/> <path d="m159.31 12.84c0.05-0.16 0.14-0.48 0.19-0.64-0.05 0.16-0.14 0.48-0.19 0.64z" fill="#089156"/> <path d="m157.91 15.07c0.35-0.56 1.05-1.67 1.4-2.23-0.35 0.56-1.05 1.67-1.4 2.23z" fill="#089156"/> <path d="m157.37 15.85c0.14-0.19 0.4-0.58 0.54-0.78-0.14 0.2-0.4 0.59-0.54 0.78z" fill="#089156"/> <path d="m156.32 17.54c0.07-0.12 0.22-0.37 0.29-0.5-0.07 0.13-0.22 0.38-0.29 0.5z" fill="#089156"/> <path d="m155.32 19.85c0.03-0.17 0.11-0.51 0.15-0.68-0.04 0.17-0.12 0.51-0.15 0.68z" fill="#089156"/> <path d="m153.86 22.05c0.37-0.55 1.09-1.65 1.46-2.2-0.37 0.55-1.09 1.65-1.46 2.2z" fill="#089156"/> <path d="m153.35 22.82c0.13-0.19 0.39-0.58 0.51-0.77-0.12 0.19-0.38 0.58-0.51 0.77z" fill="#089156"/> <path d="m152.3 24.55c0.06-0.11 0.18-0.32 0.24-0.42-0.06 0.1-0.18 0.31-0.24 0.42z" fill="#089156"/> <path d="m150.94 26.94c0.1-0.17 0.3-0.52 0.4-0.7-0.1 0.18-0.3 0.53-0.4 0.7z" fill="#089156"/> <path d="m150.58 27.56c0.09-0.16 0.27-0.46 0.36-0.62-0.09 0.16-0.27 0.46-0.36 0.62z" fill="#089156"/> <path d="m149.39 29.56c0.05-0.07 0.14-0.22 0.18-0.3-0.04 0.08-0.13 0.23-0.18 0.3z" fill="#089156"/> <path d="m148.29 31.48c0.04-0.07 0.12-0.21 0.16-0.29-0.04 0.08-0.12 0.22-0.16 0.29z" fill="#089156"/> <path d="m146.9 33.89c0.1-0.16 0.29-0.5 0.39-0.66-0.1 0.16-0.29 0.5-0.39 0.66z" fill="#089156"/> <path d="m146.51 34.56c0.1-0.17 0.29-0.5 0.39-0.67-0.1 0.17-0.29 0.5-0.39 0.67z" fill="#089156"/> <path d="m145.36 36.54c0.03-0.07 0.11-0.2 0.15-0.27-0.04 0.07-0.12 0.2-0.15 0.27z" fill="#089156"/> <path d="m144.32 38.88c0.04-0.17 0.13-0.51 0.17-0.68-0.04 0.17-0.13 0.51-0.17 0.68z" fill="#089156"/> <path d="m142.86 41.11c0.36-0.56 1.09-1.68 1.46-2.23-0.37 0.55-1.1 1.67-1.46 2.23z" fill="#089156"/> <path d="m142.37 41.87c0.12-0.19 0.36-0.57 0.49-0.76-0.13 0.19-0.37 0.57-0.49 0.76z" fill="#089156"/> <path d="m141.11 44.14c0.15-0.29 0.44-0.86 0.58-1.15-0.14 0.29-0.43 0.86-0.58 1.15z" fill="#089156"/> <path d="m140.1 45.99c0.13-0.2 0.38-0.61 0.5-0.81-0.12 0.2-0.37 0.61-0.5 0.81z" fill="#089156"/> <path d="m139.54 46.77c0.14-0.2 0.42-0.58 0.56-0.78-0.14 0.2-0.42 0.58-0.56 0.78z" fill="#089156"/> <path d="m138.38 48.58c0.13-0.2 0.38-0.62 0.5-0.83-0.12 0.21-0.37 0.63-0.5 0.83z" fill="#089156"/> <path d="m137.07 51.17c0.11-0.23 0.34-0.7 0.45-0.93-0.11 0.23-0.34 0.7-0.45 0.93z" fill="#089156"/> <path d="m136.09 53c0.12-0.2 0.37-0.6 0.49-0.8-0.12 0.2-0.37 0.6-0.49 0.8z" fill="#089156"/> <path d="m135.53 53.76c0.14-0.19 0.42-0.57 0.56-0.76-0.14 0.19-0.42 0.57-0.56 0.76z" fill="#089156"/> <path d="m134.2 55.92c0.16-0.3 0.5-0.91 0.67-1.22-0.17 0.31-0.51 0.92-0.67 1.22z" fill="#089156"/> <path d="m133.29 57.86c0.1-0.2 0.28-0.59 0.38-0.79-0.1 0.2-0.28 0.59-0.38 0.79z" fill="#089156"/> <path d="m131.92 60.07c0.34-0.56 1.03-1.66 1.37-2.21-0.34 0.55-1.03 1.65-1.37 2.21z" fill="#089156"/> <path d="m131.37 60.87c0.14-0.2 0.41-0.6 0.55-0.8-0.14 0.2-0.41 0.6-0.55 0.8z" fill="#089156"/> <path d="m130.34 62.58c0.07-0.12 0.21-0.37 0.28-0.49-0.07 0.12-0.21 0.37-0.28 0.49z" fill="#089156"/> <path d="m129.22 64.83c0.06-0.14 0.2-0.42 0.27-0.56-0.07 0.14-0.21 0.42-0.27 0.56z" fill="#089156"/> <path d="m127.8 67.27c0.35-0.61 1.06-1.83 1.42-2.44l0.07 1.17c-0.37 0.32-1.12 0.96-1.49 1.27z" fill="#089156"/> <path d="m127.41 67.82c0.1-0.14 0.29-0.41 0.39-0.55-0.1 0.14-0.29 0.41-0.39 0.55z" fill="#089156"/> <path d="m126.13 70.15c0.18-0.39 0.55-1.17 0.73-1.56-0.18 0.39-0.55 1.17-0.73 1.56z" fill="#089156"/> <path d="m125.09 71.99c0.12-0.2 0.37-0.6 0.5-0.8-0.13 0.2-0.38 0.6-0.5 0.8z" fill="#089156"/> <path d="m124.54 72.77c0.14-0.2 0.41-0.59 0.55-0.78-0.14 0.19-0.41 0.58-0.55 0.78z" fill="#089156"/> <path d="m123.39 74.56c0.12-0.2 0.37-0.61 0.5-0.81-0.13 0.2-0.38 0.61-0.5 0.81z" fill="#089156"/> <path d="m122.19 76.66c0.06-0.1 0.18-0.32 0.24-0.42-0.06 0.1-0.18 0.32-0.24 0.42z" fill="#089156"/> <path d="m121.14 78.55l0.32-0.56-0.32 0.56z" fill="#089156"/> <path d="m119.25 81.78c0.08-0.13 0.24-0.41 0.32-0.55-0.08 0.14-0.24 0.42-0.32 0.55z" fill="#089156"/> <path d="m118.19 83.63c0.09-0.16 0.27-0.47 0.36-0.62-0.09 0.15-0.27 0.46-0.36 0.62z" fill="#089156"/> <path d="m116.9 85.88c0.11-0.19 0.33-0.58 0.45-0.78-0.12 0.2-0.34 0.59-0.45 0.78z" fill="#089156"/> <path d="m116.5 86.55c0.1-0.16 0.3-0.5 0.4-0.67-0.1 0.17-0.3 0.51-0.4 0.67z" fill="#089156"/> <path d="m115.34 88.51l0.16-0.28-0.16 0.28z" fill="#089156"/> <path d="m114.32 90.88c0.04-0.18 0.11-0.53 0.15-0.7-0.04 0.17-0.11 0.52-0.15 0.7z" fill="#089156"/> <path d="m112.86 93.05c0.36-0.54 1.09-1.63 1.46-2.17-0.37 0.54-1.1 1.63-1.46 2.17z" fill="#089156"/> <path d="m112.34 93.83c0.13-0.19 0.39-0.58 0.52-0.78-0.13 0.2-0.39 0.59-0.52 0.78z" fill="#089156"/> <path d="m111.32 95.49l0.28-0.48-0.28 0.48z" fill="#089156"/> <path d="m109.93 97.96c0.1-0.18 0.3-0.53 0.4-0.71-0.1 0.18-0.3 0.53-0.4 0.71z" fill="#089156"/> <path d="m109.56 98.58c0.09-0.15 0.27-0.47 0.37-0.62-0.1 0.15-0.28 0.47-0.37 0.62z" fill="#089156"/> <path d="m108.4 100.55c0.04-0.07 0.12-0.21 0.17-0.28-0.05 0.07-0.13 0.21-0.17 0.28z" fill="#089156"/> <path d="m107.29 102.46c0.03-0.06 0.1-0.17 0.13-0.23-0.03 0.06-0.1 0.17-0.13 0.23z" fill="#089156"/> <path d="m214.02 225.86c0.17-0.28 0.53-0.84 0.7-1.11-0.17 0.27-0.53 0.83-0.7 1.11z" fill="#089156"/> <path d="m213.58 226.64c0.05-0.08 0.14-0.25 0.18-0.33-0.04 0.08-0.13 0.25-0.18 0.33z" fill="#089156"/> <path d="m211.72 230.02c0.08-0.13 0.23-0.39 0.3-0.52-0.07 0.13-0.22 0.39-0.3 0.52z" fill="#089156"/> <path d="m210.67 231.87c0.08-0.15 0.25-0.44 0.34-0.59-0.09 0.15-0.26 0.44-0.34 0.59z" fill="#089156"/> <path d="m209.66 233.64c0.05-0.08 0.14-0.24 0.18-0.32-0.04 0.08-0.13 0.24-0.18 0.32z" fill="#089156"/> <path d="m208.27 236.07c0.09-0.16 0.27-0.48 0.36-0.63-0.09 0.15-0.27 0.47-0.36 0.63z" fill="#089156"/> <path d="m207.87 236.74c0.1-0.17 0.3-0.5 0.4-0.67-0.1 0.17-0.3 0.5-0.4 0.67z" fill="#089156"/> <path d="m206.54 239.02c0.08-0.13 0.24-0.41 0.32-0.54-0.08 0.13-0.24 0.41-0.32 0.54z" fill="#089156"/> <path d="m205.5 240.8c0.1-0.18 0.32-0.55 0.42-0.73-0.1 0.18-0.32 0.55-0.42 0.73z" fill="#089156"/> <path d="m203.62 244.07c0.07-0.13 0.22-0.38 0.29-0.5-0.07 0.12-0.22 0.37-0.29 0.5z" fill="#089156"/> <path d="m202.56 245.86c0.11-0.19 0.33-0.55 0.43-0.74-0.1 0.19-0.32 0.55-0.43 0.74z" fill="#089156"/> <path d="m200.71 249.06c0.09-0.15 0.26-0.46 0.35-0.61-0.09 0.15-0.26 0.46-0.35 0.61z" fill="#089156"/> <path d="m199.68 250.9c0.07-0.12 0.21-0.37 0.28-0.49-0.07 0.12-0.21 0.37-0.28 0.49z" fill="#089156"/> <path d="m198.59 252.81l0.32-0.56-0.32 0.56z" fill="#089156"/> <path d="m196.66 256.09c0.09-0.16 0.27-0.47 0.36-0.62-0.09 0.15-0.27 0.46-0.36 0.62z" fill="#089156"/> <path d="m195.69 257.84c0.06-0.12 0.19-0.35 0.26-0.47-0.07 0.12-0.2 0.35-0.26 0.47z" fill="#089156"/> <path d="m194.58 259.76c0.07-0.12 0.22-0.37 0.29-0.5-0.07 0.13-0.22 0.38-0.29 0.5z" fill="#089156"/> <path d="m192.6 263.15c0.08-0.13 0.24-0.39 0.31-0.52-0.07 0.13-0.23 0.39-0.31 0.52z" fill="#089156"/> <path d="m191.59 264.85c0.1-0.18 0.31-0.53 0.41-0.71-0.1 0.18-0.31 0.53-0.41 0.71z" fill="#089156"/> <path d="m189.82 267.94c0.06-0.11 0.2-0.35 0.26-0.46-0.06 0.11-0.2 0.35-0.26 0.46z" fill="#089156"/> <path d="m188.76 269.83c0.06-0.11 0.18-0.32 0.24-0.43-0.06 0.11-0.18 0.32-0.24 0.43z" fill="#089156"/> <path d="m187.64 271.76c0.07-0.11 0.21-0.35 0.28-0.46-0.07 0.11-0.21 0.35-0.28 0.46z" fill="#089156"/> <path d="m185.65 275.09c0.11-0.18 0.31-0.54 0.42-0.71-0.11 0.17-0.31 0.53-0.42 0.71z" fill="#089156"/> <path d="m184.76 276.74c0.07-0.13 0.22-0.41 0.3-0.55-0.08 0.14-0.23 0.42-0.3 0.55z" fill="#089156"/> <path d="m183.39 279.12c0.08-0.15 0.26-0.45 0.34-0.6-0.08 0.15-0.26 0.45-0.34 0.6z" fill="#089156"/> <path d="m183.06 279.69c0.08-0.14 0.24-0.43 0.33-0.57-0.09 0.14-0.25 0.43-0.33 0.57z" fill="#089156"/> <path d="m346.42 3.2196c0.08 0.13 0.23 0.41 0.31 0.55-0.08-0.14-0.23-0.42-0.31-0.55z" fill="#10985b"/> <path d="m354.54 17.35c0.05 0.08 0.13 0.23 0.18 0.3-0.05-0.07-0.13-0.22-0.18-0.3z" fill="#10985b"/> <path d="m369.55 43.36c0.04 0.07 0.13 0.21 0.17 0.29-0.04-0.08-0.13-0.22-0.17-0.29z" fill="#10985b"/> <path d="m372.44 48.25c0.08 0.13 0.23 0.4 0.31 0.54-0.08-0.14-0.23-0.41-0.31-0.54z" fill="#10985b"/> <path d="m376.53 55.37c0.05 0.07 0.13 0.21 0.17 0.29-0.04-0.08-0.12-0.22-0.17-0.29z" fill="#10985b"/> <path d="m380.48 62.24c0.08 0.13 0.23 0.39 0.31 0.52-0.08-0.13-0.23-0.39-0.31-0.52z" fill="#10985b"/> <path d="m384.51 69.22c0.08 0.13 0.23 0.4 0.31 0.53-0.08-0.13-0.23-0.4-0.31-0.53z" fill="#10985b"/> <path d="m420.57 131.65c17.39 30.13 34.89 60.21 52.14 90.43 0.08 0.13 0.24 0.41 0.32 0.54 0.4 0.66 1.2 1.97 1.59 2.62 0.08 0.13 0.24 0.4 0.32 0.53l0.8 1.37c0.05 0.09 0.15 0.28 0.21 0.37l1 1.74c0.1 0.17 0.29 0.52 0.39 0.69 0.09 0.15 0.27 0.46 0.36 0.62l0.98 1.7 0.16 0.28 0.98 1.68c0.04 0.07 0.12 0.2 0.16 0.27l0.98 1.7c0.1 0.17 0.29 0.5 0.39 0.67 0.09 0.17 0.28 0.5 0.37 0.66l1.01 1.78c0.14 0.35 0.42 1.03 0.56 1.37l0.28 0.55 0.13 0.29 0.22 0.29 0.59 0.89c0.21 0.33 0.62 0.99 0.83 1.32 0.12 0.2 0.38 0.6 0.5 0.8l0.66 1.05c0.2 0.45 0.6 1.36 0.8 1.81l0.3 0.54 0.11 0.21 0.09 0.13c0.44 0.65 1.31 1.96 1.75 2.61 0.11 0.18 0.33 0.54 0.45 0.72l0.6 1c0.09 0.16 0.27 0.47 0.36 0.62l1.01 1.77c0.09 0.16 0.27 0.48 0.36 0.64s0.27 0.47 0.36 0.63l1 1.71c0.04 0.08 0.13 0.23 0.18 0.3l0.91 1.6c0.06 0.1 0.18 0.31 0.24 0.41l0.92 1.61c0.11 0.18 0.32 0.55 0.43 0.73 0.09 0.16 0.28 0.48 0.37 0.64 0.74 1.23 1.45 2.48 2.11 3.76 0.1 0.21 0.3 0.63 0.39 0.84l0.46 1.04c0.12 0.2 0.36 0.61 0.47 0.81 0.15 0.2 0.44 0.58 0.59 0.77l0.69 0.98c0.12 0.19 0.36 0.57 0.49 0.77l1.01 1.75c0.09 0.16 0.27 0.48 0.36 0.64s0.27 0.47 0.37 0.63l1 1.72c0.04 0.08 0.12 0.22 0.16 0.29l0.95 1.66c0.04 0.07 0.12 0.2 0.16 0.27l0.97 1.69c0.1 0.17 0.3 0.51 0.4 0.69 0.1 0.17 0.3 0.51 0.39 0.68l1 1.72c0.04 0.07 0.11 0.21 0.15 0.28l1.06 1.98-0.01 0.9c-25.02-7.19-49.64-15.72-74.73-22.65-22.77-7.35-45.75-14.04-68.52-21.35 3.17-1.52 6.56-2.49 9.73-3.99 0.41-1.35 0.84-2.69 1.26-4.02 3.95-2.48 8.41-3.97 12.3-6.54 0.15-3.29 0.14-6.57 0.13-9.85 4.36-3.51 8.98-6.76 12.57-11.11 0.36-4.28-2.87-9.29 0.46-12.9 10.24-12.92 16.45-28.93 17.56-45.38 1.83-6.02-1.46-11.98-0.1-17.97z" fill="#f9c941"/> <path d="m509.91 287.41l0.52 0.02 0.29 0.76-0.59 0.04-0.22-0.82z" fill="#f9c941"/> <path d="m257.34 157.32c0.08 0.13 0.24 0.4 0.32 0.54-0.08-0.14-0.24-0.41-0.32-0.54z" fill="#e3b73a"/> <path d="m259.19 160.53c0.07 0.12 0.2 0.35 0.27 0.47-0.07-0.12-0.2-0.35-0.27-0.47z" fill="#e3b73a"/> <path d="m260.28 162.47c0.05 0.08 0.14 0.25 0.19 0.33-0.05-0.08-0.14-0.25-0.19-0.33z" fill="#e3b73a"/> <path d="m261.48 164.56c0.09 0.15 0.26 0.45 0.35 0.6-0.09-0.15-0.26-0.45-0.35-0.6z" fill="#e3b73a"/> <path d="m261.83 165.16c0.09 0.17 0.28 0.49 0.38 0.65-0.1-0.16-0.29-0.48-0.38-0.65z" fill="#e3b73a"/> <path d="m263.16 167.44c0.05 0.09 0.16 0.27 0.21 0.36-0.05-0.09-0.16-0.27-0.21-0.36z" fill="#e3b73a"/> <path d="m265.34 171.21c0.09 0.16 0.26 0.47 0.35 0.62-0.09-0.15-0.26-0.46-0.35-0.62z" fill="#e3b73a"/> <path d="m267.23 174.48c0.09 0.15 0.26 0.43 0.34 0.57-0.08-0.14-0.25-0.42-0.34-0.57z" fill="#e3b73a"/> <path d="m268.43 176.5c0.2 0.33 0.59 0.98 0.79 1.31-0.2-0.33-0.59-0.98-0.79-1.31z" fill="#e3b73a"/> <path d="m269.49 178.29c0.04 0.09 0.14 0.26 0.19 0.34-0.05-0.08-0.15-0.25-0.19-0.34z" fill="#e3b73a"/> <path d="m271.44 181.79c0.19 0.26 0.57 0.8 0.76 1.07-0.19-0.27-0.57-0.81-0.76-1.07z" fill="#e3b73a"/> <path d="m272.46 183.32c0.04 0.08 0.13 0.25 0.18 0.33-0.05-0.08-0.14-0.25-0.18-0.33z" fill="#e3b73a"/> <path d="m275.45 188.72c0.19 0.28 0.56 0.84 0.75 1.12-0.19-0.28-0.56-0.84-0.75-1.12z" fill="#e3b73a"/> <path d="m276.47 190.31c0.04 0.08 0.14 0.25 0.18 0.33-0.04-0.08-0.14-0.25-0.18-0.33z" fill="#e3b73a"/> <path d="m278.23 193.51c0.09 0.15 0.26 0.45 0.35 0.6-0.09-0.15-0.26-0.45-0.35-0.6z" fill="#e3b73a"/> <path d="m279.22 195.24c0.1 0.17 0.3 0.53 0.4 0.7-0.1-0.17-0.3-0.53-0.4-0.7z" fill="#e3b73a"/> <path d="m280.45 197.4c0.1 0.18 0.31 0.55 0.41 0.73-0.1-0.18-0.31-0.55-0.41-0.73z" fill="#e3b73a"/> <path d="m280.86 198.13c0.09 0.15 0.27 0.47 0.36 0.63-0.09-0.16-0.27-0.48-0.36-0.63z" fill="#e3b73a"/> <path d="m282.24 200.51c0.04 0.08 0.13 0.22 0.17 0.29-0.04-0.07-0.13-0.21-0.17-0.29z" fill="#e3b73a"/> <path d="m283.38 202.47c0.08 0.14 0.24 0.41 0.32 0.55-0.08-0.14-0.24-0.41-0.32-0.55z" fill="#e3b73a"/> <path d="m284.31 204.06c0.11 0.18 0.32 0.55 0.43 0.73-0.11-0.18-0.32-0.55-0.43-0.73z" fill="#e3b73a"/> <path d="m286.47 207.71c0.17 0.29 0.52 0.86 0.69 1.15-0.17-0.29-0.52-0.86-0.69-1.15z" fill="#e3b73a"/> <path d="m287.45 209.32c0.05 0.09 0.15 0.25 0.2 0.33-0.05-0.08-0.15-0.24-0.2-0.33z" fill="#e3b73a"/> <path d="m289.43 212.46l0.07 0.1 0.06 0.13c-0.03-0.06-0.1-0.17-0.13-0.23z" fill="#e3b73a"/> <path d="m291.5 216.56c0.09 0.15 0.25 0.44 0.34 0.59-0.09-0.15-0.25-0.44-0.34-0.59z" fill="#e3b73a"/> <path d="m291.84 217.15l0.4 0.68-0.4-0.68z" fill="#e3b73a"/> <path d="m293.19 219.44c0.05 0.09 0.15 0.27 0.21 0.36-0.06-0.09-0.16-0.27-0.21-0.36z" fill="#e3b73a"/> <path d="m294.06 220.98c11.53 4.24 23.46 7.26 35.11 11.11 12.52 3.71 24.94 7.72 37.49 11.32 22.77 7.31 45.75 14 68.52 21.35-0.34 4.87 0.62 9.86-0.59 14.64-0.93 4.65-6.49 5.38-8.78 9.09-30.77 0.01-61.53 0.1-92.29-0.03l-0.66-0.05c-12.71-22.6-25.93-44.92-38.8-67.43z" fill="#e3b73a"/> <path d="m472.71 222.08c0.08 0.13 0.24 0.41 0.32 0.54-0.08-0.13-0.24-0.41-0.32-0.54z" fill="#e8b835"/> <path d="m474.62 225.24c0.08 0.13 0.24 0.4 0.32 0.53-0.08-0.13-0.24-0.4-0.32-0.53z" fill="#e8b835"/> <path d="m475.74 227.14c0.05 0.09 0.15 0.28 0.21 0.37-0.06-0.09-0.16-0.28-0.21-0.37z" fill="#e8b835"/> <path d="m476.95 229.25c0.1 0.17 0.29 0.52 0.39 0.69-0.1-0.17-0.29-0.52-0.39-0.69z" fill="#e8b835"/> <path d="m477.34 229.94c0.09 0.15 0.27 0.46 0.36 0.62-0.09-0.16-0.27-0.47-0.36-0.62z" fill="#e8b835"/> <path d="m478.68 232.26l0.16 0.28-0.16-0.28z" fill="#e8b835"/> <path d="m479.82 234.22c0.04 0.07 0.12 0.2 0.16 0.27-0.04-0.07-0.12-0.2-0.16-0.27z" fill="#e8b835"/> <path d="m480.96 236.19c0.1 0.17 0.29 0.5 0.39 0.67-0.1-0.17-0.29-0.5-0.39-0.67z" fill="#e8b835"/> <path d="m481.35 236.86c0.09 0.17 0.28 0.5 0.37 0.66-0.09-0.16-0.28-0.49-0.37-0.66z" fill="#e8b835"/> <path d="m482.73 239.3c0.14 0.35 0.42 1.03 0.56 1.37-0.14-0.34-0.42-1.02-0.56-1.37z" fill="#e8b835"/> <path d="m483.57 241.22c0.09 0.15 0.26 0.44 0.35 0.58l-0.22-0.29-0.13-0.29z" fill="#e8b835"/> <path d="m484.51 242.69c0.21 0.33 0.62 0.99 0.83 1.32-0.21-0.33-0.62-0.99-0.83-1.32z" fill="#e8b835"/> <path d="m485.34 244.01c0.12 0.2 0.38 0.6 0.5 0.8-0.12-0.2-0.38-0.6-0.5-0.8z" fill="#e8b835"/> <path d="m486.5 245.86c0.2 0.45 0.6 1.36 0.8 1.81-0.2-0.45-0.6-1.36-0.8-1.81z" fill="#e8b835"/> <path d="m487.6 248.21c0.05 0.09 0.15 0.26 0.2 0.34l-0.09-0.13-0.11-0.21z" fill="#e8b835"/> <path d="m489.55 251.16c0.11 0.18 0.33 0.54 0.45 0.72-0.12-0.18-0.34-0.54-0.45-0.72z" fill="#e8b835"/> <path d="m490.6 252.88c0.09 0.16 0.27 0.47 0.36 0.62-0.09-0.15-0.27-0.46-0.36-0.62z" fill="#e8b835"/> <path d="m491.97 255.27c0.09 0.16 0.27 0.48 0.36 0.64-0.09-0.16-0.27-0.48-0.36-0.64z" fill="#e8b835"/> <path d="m492.33 255.91c0.09 0.16 0.27 0.47 0.36 0.63-0.09-0.16-0.27-0.47-0.36-0.63z" fill="#e8b835"/> <path d="m493.69 258.25c0.04 0.08 0.13 0.23 0.18 0.3-0.05-0.07-0.14-0.22-0.18-0.3z" fill="#e8b835"/> <path d="m494.78 260.15c0.06 0.1 0.18 0.31 0.24 0.41-0.06-0.1-0.18-0.31-0.24-0.41z" fill="#e8b835"/> <path d="m495.94 262.17c0.11 0.18 0.32 0.55 0.43 0.73-0.11-0.18-0.32-0.55-0.43-0.73z" fill="#e8b835"/> <path d="m496.37 262.9c0.09 0.16 0.28 0.48 0.37 0.64-0.09-0.16-0.28-0.48-0.37-0.64z" fill="#e8b835"/> <path d="m435.18 264.76c25.09 6.93 49.71 15.46 74.73 22.65l0.22 0.82c-28.09 0.64-56.22 0.11-84.32 0.26 2.29-3.71 7.85-4.44 8.78-9.09 1.21-4.78 0.25-9.77 0.59-14.64z" fill="#e8b835"/> <path d="m498.85 267.3c0.1 0.21 0.3 0.63 0.39 0.84-0.09-0.21-0.29-0.63-0.39-0.84z" fill="#e8b835"/> <path d="m499.7 269.18c0.12 0.2 0.36 0.61 0.47 0.81-0.11-0.2-0.35-0.61-0.47-0.81z" fill="#e8b835"/> <path d="m500.17 269.99c0.15 0.2 0.44 0.58 0.59 0.77-0.15-0.19-0.44-0.57-0.59-0.77z" fill="#e8b835"/> <path d="m501.45 271.74c0.12 0.19 0.36 0.57 0.49 0.77-0.13-0.2-0.37-0.58-0.49-0.77z" fill="#e8b835"/> <path d="m502.95 274.26c0.09 0.16 0.27 0.48 0.36 0.64-0.09-0.16-0.27-0.48-0.36-0.64z" fill="#e8b835"/> <path d="m503.31 274.9c0.09 0.16 0.27 0.47 0.37 0.63-0.1-0.16-0.28-0.47-0.37-0.63z" fill="#e8b835"/> <path d="m504.68 277.25c0.04 0.08 0.12 0.22 0.16 0.29-0.04-0.07-0.12-0.21-0.16-0.29z" fill="#e8b835"/> <path d="m505.79 279.2c0.04 0.07 0.12 0.2 0.16 0.27-0.04-0.07-0.12-0.2-0.16-0.27z" fill="#e8b835"/> <path d="m506.92 281.16c0.1 0.17 0.3 0.51 0.4 0.69-0.1-0.18-0.3-0.52-0.4-0.69z" fill="#e8b835"/> <path d="m507.32 281.85c0.1 0.17 0.3 0.51 0.39 0.68-0.09-0.17-0.29-0.51-0.39-0.68z" fill="#e8b835"/> <path d="m508.71 284.25c0.04 0.07 0.11 0.21 0.15 0.28-0.04-0.07-0.11-0.21-0.15-0.28z" fill="#e8b835"/> <path d="m509.92 286.51c0.13 0.23 0.38 0.69 0.51 0.92l-0.52-0.02 0.01-0.9z" fill="#e8b835"/> <path d="m147.21 341.08c10.31-17.58 20.11-35.49 30.76-52.86 51.63 0.19 103.27-0.29 154.89 0.19l0.66 0.05c-26.11 0.84-52.29-0.22-78.4 0.44-4.98 3.21-8.3 8.41-13.07 11.91-4.43 3.23-7.69 7.73-11.92 11.18-5.93 4.37-10.34 10.43-16.36 14.71-6.96 7.37-14.99 13.58-22.01 20.91-5.26 4.04-9.66 9.03-14.56 13.48-5.39 3.91-9.52 9.21-14.56 13.53-0.13 0.11-0.38 0.33-0.51 0.45-0.27 0.21-0.8 0.65-1.07 0.86-0.13 0.11-0.37 0.31-0.5 0.42-3.97 3.07-7.01 7.12-10.91 10.27-0.13 0.11-0.38 0.32-0.5 0.42-0.13 0.11-0.38 0.32-0.51 0.42-5.69 4.67-10.25 10.58-16.22 14.93-6.01 5.96-12.79 11.08-18.5 17.36-8.44 6.94-15.74 15.13-24.44 21.78 2.16-4.71 5.02-9.03 7.53-13.54 16.74-28.97 33.46-57.94 50.2-86.91z" fill="#296ad9"/> <path d="m89.04 442.17c0.11-0.16 0.33-0.48 0.44-0.64l-0.03 0.65-0.41-0.01z" fill="#296ad9"/> <path id="#2a71e9ff" fill="#2a71e9" d="m333.52 288.46c30.76 0.13 61.52 0.04 92.29 0.03 28.1-0.15 56.23 0.38 84.32-0.26l0.59-0.04 0.4 0.11v0.08c-29.66 51.27-59.23 102.6-88.89 153.88-110.93-0.03-221.86 0.1-332.78-0.08l0.03-0.65c8.7-6.65 16-14.84 24.44-21.78 5.71-6.28 12.49-11.4 18.5-17.36 5.97-4.35 10.53-10.26 16.22-14.93 0.13-0.1 0.38-0.31 0.51-0.42 0.12-0.1 0.37-0.31 0.5-0.42 3.9-3.15 6.94-7.2 10.91-10.27 0.13-0.11 0.37-0.31 0.5-0.42 0.27-0.21 0.8-0.65 1.07-0.86 0.13-0.12 0.38-0.34 0.51-0.45 5.04-4.32 9.17-9.62 14.56-13.53 4.9-4.45 9.3-9.44 14.56-13.48 7.02-7.33 15.05-13.54 22.01-20.91 6.02-4.28 10.43-10.34 16.36-14.71 4.23-3.45 7.49-7.95 11.92-11.18 4.77-3.5 8.09-8.7 13.07-11.91 26.11-0.66 52.29 0.4 78.4-0.44z"/> <path d="m162.13 375.07c0.13-0.12 0.38-0.34 0.51-0.45-0.13 0.11-0.38 0.33-0.51 0.45z" fill="#286ee6"/> <path d="m161.06 375.93c0.27-0.21 0.8-0.65 1.07-0.86-0.27 0.21-0.8 0.65-1.07 0.86z" fill="#286ee6"/> <path d="m160.56 376.35c0.13-0.11 0.37-0.31 0.5-0.42-0.13 0.11-0.37 0.31-0.5 0.42z" fill="#286ee6"/> <path d="m149.15 387.04c0.12-0.1 0.37-0.31 0.5-0.42-0.13 0.11-0.38 0.32-0.5 0.42z" fill="#286ee6"/> <path d="m148.64 387.46c0.13-0.1 0.38-0.31 0.51-0.42-0.13 0.11-0.38 0.32-0.51 0.42z" fill="#286ee6"/> </svg> </div> <div class="rs-box rs-box-initial" aria-hidden="false"> <h3 class="rs-small-headline">Connect your storage</h3> <span class="rs-sub-headline">To sync data with your account</span> </div> <div class="rs-box rs-box-connected" aria-hidden="true"> <div class="rs-connected-text"> <h1 class="rs-user rs-small-headline">user@provider.com</h1> <span class="rs-sub-headline">Connected</span> </div> <div class="rs-connected-buttons"> <button class="rs-button rs-button-small rs-sync" title="Sync now"> <svg class="rs-icon rs-loop-icon" xml:space="preserve" version="1.1" x="0px" y="0px" height="16" width="16" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512" xmlns="http://www.w3.org/2000/svg"> <path d="m273.4 300.5l-0.3 58c48.9-8.2 86.3-51 86.3-102.5 0-15.9-3.6-31-10-44.5-2.8-5.8-6-11.3-9.8-16.5l47.1-43.5c1.1 1.3 2.1 2.7 3.1 4 20.9 28 33.2 62.8 33.2 100.5v3.7c-1.5 71.5-47.6 132-111.4 154.6-12.3 4.3-25.2 7.3-38.5 8.7l-0.1 57-76.2-67-26.2-23 44.4-38.7 58.4-50.8z"/> <path d="m89 252.3c1.6-72.1 48.3-133 112.9-155.2 11.7-4 24-6.8 36.8-8.1l0.1-57 76.1 66.9 26.2 23.1-44.3 38.6-58.4 50.9 0.2-57.9c-48.8 8.3-86 51.1-86 102.4 0 16 3.6 31.1 10.1 44.7 2.7 5.8 6 11.2 9.7 16.3l-47 43.6c-1.3-1.6-2.6-3.3-3.8-5-20.5-27.9-32.6-62.3-32.6-99.6v-3.7z"/> </svg> </button> <button class="rs-button rs-button-small rs-disconnect" title="Disconnect"> <svg class="rs-icon rs-power-icon" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="16" height="16" style="enable-background:new 0 0 512 512" xml:space="preserve" viewBox="0 0 512 512" version="1.1"> <path d="m256 256c-17.7 0-32-14.3-32-32v-160c0-17.7 14.3-32 32-32s32 14.3 32 32v160c0 17.7-14.3 32-32 32z"/> <path d="m379 68.8c-5-3-10.8-4.8-17-4.8-17.7 0-32 14.3-32 32 0 6.2 1.8 12 4.8 16.9 2 3.2 4.6 6.1 7.6 8.4 1.2 0.9 2.4 1.7 3.7 2.5 8.1 5.6 15.8 11.9 23 19.1 30.3 30.2 46.9 70.4 46.9 113.1s-16.6 82.9-46.9 113.1c-30.2 30.3-70.4 46.9-113.1 46.9s-82.9-16.6-113.1-46.9c-30.3-30.2-46.9-70.4-46.9-113.1s16.6-82.9 46.9-113.1c7.1-7.1 14.8-13.5 22.9-19 1.4-0.8 2.6-1.6 3.9-2.6 3-2.3 5.5-5.1 7.5-8.3 3.1-4.9 4.8-10.7 4.8-16.9 0-17.7-14.3-32-32-32-6.2 0-12 1.8-16.9 4.8l-0.1-0.1c-60.8 40-101 108.9-101 187.2 0 123.7 100.3 224 224 224s224-100.3 224-224c0-78.3-40.2-147.2-101-187.2z"/> </svg> </button> </div> </div> <div class="rs-box rs-box-error" aria-hidden="true"> <div class="rs-error-message"></div> <div class="rs-error-buttons"> <a href="#" class="rs-reconnect rs-hidden">Renew</a> <button class="rs-button rs-button-small rs-disconnect" title="Disconnect"> <svg class="rs-icon rs-power-icon" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="16" height="16" style="enable-background:new 0 0 512 512" xml:space="preserve" viewBox="0 0 512 512" version="1.1"> <path d="m256 256c-17.7 0-32-14.3-32-32v-160c0-17.7 14.3-32 32-32s32 14.3 32 32v160c0 17.7-14.3 32-32 32z"/> <path d="m379 68.8c-5-3-10.8-4.8-17-4.8-17.7 0-32 14.3-32 32 0 6.2 1.8 12 4.8 16.9 2 3.2 4.6 6.1 7.6 8.4 1.2 0.9 2.4 1.7 3.7 2.5 8.1 5.6 15.8 11.9 23 19.1 30.3 30.2 46.9 70.4 46.9 113.1s-16.6 82.9-46.9 113.1c-30.2 30.3-70.4 46.9-113.1 46.9s-82.9-16.6-113.1-46.9c-30.3-30.2-46.9-70.4-46.9-113.1s16.6-82.9 46.9-113.1c7.1-7.1 14.8-13.5 22.9-19 1.4-0.8 2.6-1.6 3.9-2.6 3-2.3 5.5-5.1 7.5-8.3 3.1-4.9 4.8-10.7 4.8-16.9 0-17.7-14.3-32-32-32-6.2 0-12 1.8-16.9 4.8l-0.1-0.1c-60.8 40-101 108.9-101 187.2 0 123.7 100.3 224 224 224s224-100.3 224-224c0-78.3-40.2-147.2-101-187.2z"/> </svg> </button> </div> </div> <div class="rs-box rs-box-choose" aria-hidden="true"> <div class="rs-content"> <h1 class="rs-big-headline">Connect your storage</h1> <p class="rs-short-desc"> This app allows you to sync data with a <a class="rs-help" href="https://remotestorage.io/" target="_blank" rel="noopener">storage provider of your choice</a>. </p> <div class="rs-button-wrap"> <button class="rs-button rs-button-big rs-choose-rs"> <svg class="rs-logo" fill-rule="evenodd" height="40" width="40" xmlns="http://www.w3.org/2000/svg" version="1.1" style="shape-rendering:geometricPrecision;image-rendering:optimizeQuality;text-rendering:geometricPrecision" clip-rule="evenodd" xml:space="preserve" viewBox="0 0 739 853"> <g> <polygon class="rs-logo-shape" points="370 754 0 542 0 640 185 747 370 853 554 747 739 640 739 525 739 525 739 476 739 427 739 378 653 427 370 589 86 427 86 427 86 361 185 418 370 524 554 418 653 361 739 311 739 213 739 213 554 107 370 0 185 107 58 180 144 230 228 181 370 100 511 181 652 263 370 425 87 263 87 263 0 213 0 213 0 311 0 378 0 427 0 476 86 525 185 582 370 689 554 582 653 525 653 590 653 592"/> </g> </svg> <div>RemoteStorage</div> </button> <button class="rs-button rs-button-big rs-choose-dropbox"> <svg class="dropbox-logo" width="40" height="40" xml:space="preserve" stroke-miterlimit="1.4142" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 104 97" stroke-linejoin="round" version="1.1" clip-rule="evenodd"> <path d="m30.691 0l-30.691 20.039 21.221 16.994 30.946-19.108-21.476-17.925z" fill="#007ee5"/> <path d="m0 54.028l30.691 20.039 21.476-17.926-30.945-19.108-21.222 16.995z" fill="#007ee5"/> <path d="m52.167 56.142l21.477 17.926 30.696-20.039-21.227-16.995-30.946 19.108z" fill="#007ee5"/> <path d="m104.34 20.039l-30.696-20.039-21.477 17.925 30.946 19.108 21.227-16.994z" fill="#007ee5"/> <path d="m52.23 59.998l-21.538 17.873-9.218-6.018v6.747l30.756 18.443 30.756-18.443v-6.747l-9.216 6.018-21.54-17.873z" fill="#007ee5"/> </svg> <div>Dropbox</div> </button> <button class="rs-button rs-button-big rs-choose-googledrive"> <svg class="googledrive-logo" width="40" height="40" version="1.1" stroke-miterlimit="1.4142" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" width="100%" stroke-linejoin="round" clip-rule="evenodd" viewBox="0 0 511 442" height="100%"> <path d="m166.23 0.10955l0.44-0.009998 0.04 0.49-0.56 0.02 0.08-0.5z" fill="#0ba25e"/> <path d="m164.52 3.3896c0.39-0.56 1.15-1.68 1.54-2.24l0.7-0.11c0.52 6.34 2.38 12.45 3.78 18.62 6.02 26.81 12.1 53.6 18.43 80.33 4.15 18.33 8.78 36.57 12.58 54.97 3.3 11.39 5.07 23.14 8.26 34.55 2.06 10.64 5.29 21.02 7.02 31.72-0.7 1.17-1.4 2.35-2.11 3.52-0.17 0.27-0.53 0.83-0.7 1.11l-0.26 0.45c-0.04 0.08-0.13 0.25-0.18 0.33-0.39 0.72-1.17 2.15-1.56 2.86-0.07 0.13-0.22 0.39-0.3 0.52l-0.71 1.26c-0.09 0.15-0.26 0.44-0.34 0.59l-0.83 1.45c-0.04 0.08-0.13 0.24-0.18 0.32l-1.03 1.8c-0.09 0.15-0.27 0.47-0.36 0.63-0.1 0.17-0.3 0.5-0.4 0.67l-1.01 1.74c-0.08 0.13-0.24 0.41-0.32 0.54l-0.62 1.05c-0.1 0.18-0.32 0.55-0.42 0.73-0.4 0.69-1.19 2.07-1.59 2.77-0.07 0.12-0.22 0.37-0.29 0.5l-0.63 1.05c-0.1 0.19-0.32 0.55-0.43 0.74-0.37 0.65-1.13 1.94-1.5 2.59-0.09 0.15-0.26 0.46-0.35 0.61l-0.75 1.35c-0.07 0.12-0.21 0.37-0.28 0.49l-0.77 1.35-0.32 0.56c-0.4 0.66-1.18 1.99-1.57 2.66-0.09 0.15-0.27 0.46-0.36 0.62l-0.71 1.28c-0.07 0.12-0.2 0.35-0.26 0.47l-0.82 1.42c-0.07 0.13-0.22 0.38-0.29 0.5-0.42 0.72-1.25 2.15-1.67 2.87-0.07 0.13-0.23 0.39-0.31 0.52l-0.6 0.99c-0.1 0.18-0.31 0.53-0.41 0.71-0.38 0.66-1.13 1.97-1.51 2.63-0.06 0.11-0.2 0.35-0.26 0.46l-0.82 1.46c-0.06 0.11-0.18 0.32-0.24 0.43l-0.84 1.47c-0.07 0.11-0.21 0.35-0.28 0.46-0.39 0.66-1.18 1.96-1.57 2.62-0.11 0.17-0.31 0.53-0.42 0.71l-0.59 1.1c-0.08 0.14-0.23 0.42-0.3 0.55l-1.03 1.78c-0.08 0.15-0.26 0.45-0.34 0.6-0.09 0.14-0.25 0.43-0.33 0.57-1.69 2.85-3.22 5.79-5.09 8.53-10.65 17.37-20.45 35.28-30.76 52.86-16.74 28.97-33.46 57.94-50.2 86.91-2.51 4.51-5.37 8.83-7.53 13.54-0.11 0.16-0.33 0.48-0.44 0.64-4.01-5.78-7.11-12.16-10.78-18.16-16.74-28.99-33.49-57.97-50.22-86.97-9.3-16.31-18.99-32.42-28.04-48.88 35.84-61.85 71.52-123.81 107.29-185.7 0.03-0.06 0.1-0.17 0.13-0.23l0.98-1.68c0.04-0.07 0.12-0.21 0.17-0.28l0.99-1.69c0.09-0.15 0.27-0.47 0.37-0.62 0.1-0.18 0.3-0.53 0.4-0.71l0.99-1.76 0.28-0.48 0.74-1.18c0.13-0.19 0.39-0.58 0.52-0.78 0.36-0.54 1.09-1.63 1.46-2.17 0.04-0.18 0.11-0.53 0.15-0.7l0.87-1.67 0.16-0.28 1-1.68c0.1-0.16 0.3-0.5 0.4-0.67 0.11-0.19 0.33-0.58 0.45-0.78l0.84-1.47c0.09-0.16 0.27-0.47 0.36-0.62l0.7-1.23c0.08-0.13 0.24-0.41 0.32-0.55 0.39-0.67 1.17-2.01 1.57-2.68l0.32-0.56 0.73-1.33c0.06-0.1 0.18-0.32 0.24-0.42l0.96-1.68c0.12-0.2 0.37-0.61 0.5-0.81l0.65-0.98c0.14-0.2 0.41-0.59 0.55-0.78 0.12-0.2 0.37-0.6 0.5-0.8l0.54-1.04c0.18-0.39 0.55-1.17 0.73-1.56l0.55-0.77c0.1-0.14 0.29-0.41 0.39-0.55 0.37-0.31 1.12-0.95 1.49-1.27l-0.07-1.17c0.06-0.14 0.2-0.42 0.27-0.56l0.85-1.69c0.07-0.12 0.21-0.37 0.28-0.49l0.75-1.22c0.14-0.2 0.41-0.6 0.55-0.8 0.34-0.56 1.03-1.66 1.37-2.21 0.1-0.2 0.28-0.59 0.38-0.79l0.53-1.15c0.16-0.3 0.5-0.91 0.67-1.22l0.66-0.94c0.14-0.19 0.42-0.57 0.56-0.76 0.12-0.2 0.37-0.6 0.49-0.8l0.49-1.03c0.11-0.23 0.34-0.7 0.45-0.93l0.86-1.66c0.13-0.2 0.38-0.62 0.5-0.83l0.66-0.98c0.14-0.2 0.42-0.58 0.56-0.78 0.13-0.2 0.38-0.61 0.5-0.81l0.51-1.04c0.15-0.29 0.44-0.86 0.58-1.15l0.68-1.12c0.12-0.19 0.36-0.57 0.49-0.76 0.36-0.56 1.09-1.68 1.46-2.23 0.04-0.17 0.13-0.51 0.17-0.68l0.87-1.66c0.03-0.07 0.11-0.2 0.15-0.27l1-1.71c0.1-0.17 0.29-0.5 0.39-0.67 0.1-0.16 0.29-0.5 0.39-0.66l1-1.75c0.04-0.07 0.12-0.21 0.16-0.29l0.94-1.63c0.05-0.07 0.14-0.22 0.18-0.3l1.01-1.7c0.09-0.16 0.27-0.46 0.36-0.62 0.1-0.17 0.3-0.52 0.4-0.7l0.96-1.69c0.06-0.11 0.18-0.32 0.24-0.42l0.81-1.31c0.13-0.19 0.39-0.58 0.51-0.77 0.37-0.55 1.09-1.65 1.46-2.2 0.03-0.17 0.11-0.51 0.15-0.68l0.85-1.63c0.07-0.12 0.22-0.37 0.29-0.5l0.76-1.19c0.14-0.19 0.4-0.58 0.54-0.78 0.35-0.56 1.05-1.67 1.4-2.23 0.05-0.16 0.14-0.48 0.19-0.64l0.88-1.65c0.04-0.08 0.12-0.22 0.16-0.3l1.02-1.7204c0.08-0.15 0.26-0.45 0.35-0.6 0.09-0.17 0.27-0.49 0.36-0.65l1-1.78c0.05-0.07 0.13-0.22 0.17-0.29l0.95-1.61c0.03-0.05 0.1-0.16 0.13-0.21z" fill="#0ba25e"/> <path id="#fccd48ff" fill="#fccd48" d="m166.67 0.099552c32.48-0.15 64.97-0.02 97.46-0.07 26.88 0.099998 53.78-0.21 80.65 0.15 0.53 1.02 1.07 2.03 1.64 3.04 0.08 0.13 0.23 0.41 0.31 0.55 2.6 4.53 5.24 9.0404 7.81 13.58 0.05 0.08 0.13 0.23 0.18 0.3 4.98 8.55 9.94 17.11 14.83 25.71 0.04 0.07 0.13 0.21 0.17 0.29 0.89 1.53 1.81 3.06 2.72 4.6 0.08 0.13 0.23 0.4 0.31 0.54 1.25 2.2 2.51 4.39 3.78 6.58 0.05 0.07 0.13 0.21 0.17 0.29 1.27 2.18 2.52 4.38 3.78 6.58 0.08 0.13 0.23 0.39 0.31 0.52 1.27 2.14 2.5 4.3 3.72 6.46 0.08 0.13 0.23 0.4 0.31 0.53 11.94 20.62 23.85 41.25 35.75 61.9-1.36 5.99 1.93 11.95 0.1 17.97-1.11 16.45-7.32 32.46-17.56 45.38-3.33 3.61-0.1 8.62-0.46 12.9-3.59 4.35-8.21 7.6-12.57 11.11 0.01 3.28 0.02 6.56-0.13 9.85-3.89 2.57-8.35 4.06-12.3 6.54-0.42 1.33-0.85 2.67-1.26 4.02-3.17 1.5-6.56 2.47-9.73 3.99-12.55-3.6-24.97-7.61-37.49-11.32-11.65-3.85-23.58-6.87-35.11-11.11l-0.66-1.18c-0.06-0.09-0.16-0.27-0.21-0.36l-0.95-1.61-0.4-0.68c-0.09-0.15-0.25-0.44-0.34-0.59-0.71-1.26-1.36-2.55-1.94-3.87l-0.06-0.13-0.07-0.1c-0.44-0.7-1.33-2.11-1.78-2.81-0.05-0.08-0.15-0.24-0.2-0.33l-0.29-0.46c-0.17-0.29-0.52-0.86-0.69-1.15-0.43-0.73-1.3-2.19-1.73-2.92-0.11-0.18-0.32-0.55-0.43-0.73l-0.61-1.04c-0.08-0.14-0.24-0.41-0.32-0.55l-0.97-1.67c-0.04-0.07-0.13-0.21-0.17-0.29l-1.02-1.75c-0.09-0.16-0.27-0.48-0.36-0.63-0.1-0.18-0.31-0.55-0.41-0.73l-0.83-1.46c-0.1-0.17-0.3-0.53-0.4-0.7l-0.64-1.13c-0.09-0.15-0.26-0.45-0.35-0.6-0.39-0.72-1.18-2.15-1.58-2.87-0.04-0.08-0.14-0.25-0.18-0.33l-0.27-0.47c-0.19-0.28-0.56-0.84-0.75-1.12-0.99-1.66-1.92-3.36-2.81-5.07-0.05-0.08-0.14-0.25-0.18-0.33l-0.26-0.46c-0.19-0.27-0.57-0.81-0.76-1.07-0.44-0.79-1.32-2.37-1.76-3.16-0.05-0.08-0.15-0.25-0.19-0.34l-0.27-0.48c-0.2-0.33-0.59-0.98-0.79-1.31l-0.86-1.45c-0.08-0.14-0.25-0.42-0.34-0.57-0.38-0.66-1.15-1.99-1.54-2.65-0.09-0.15-0.26-0.46-0.35-0.62-0.68-1.13-1.33-2.27-1.97-3.41-0.05-0.09-0.16-0.27-0.21-0.36l-0.95-1.63c-0.1-0.16-0.29-0.48-0.38-0.65-0.09-0.15-0.26-0.45-0.35-0.6l-1.01-1.76c-0.05-0.08-0.14-0.25-0.19-0.33l-0.82-1.47c-0.07-0.12-0.2-0.35-0.27-0.47-0.38-0.67-1.15-2-1.53-2.67-0.08-0.14-0.24-0.41-0.32-0.54-0.62-1.03-1.24-2.07-1.84-3.1-27.73-48.12-55.5-96.21-83.29-144.3-1.74-3.0004-3.32-6.1204-5.45-8.8804l-0.05-0.45005-0.04-0.49z"/> <path d="m166.15 0.60955l0.56-0.02 0.05 0.45005-0.7 0.11 0.09-0.54005z" fill="#089156"/> <path d="m166.76 1.0396c2.13 2.76 3.71 5.88 5.45 8.88 27.79 48.09 55.56 96.18 83.29 144.3-12.84 22.36-25.78 44.67-38.67 67.01-1.73-10.7-4.96-21.08-7.02-31.72-3.19-11.41-4.96-23.16-8.26-34.55-3.8-18.4-8.43-36.64-12.58-54.97-6.33-26.73-12.41-53.52-18.43-80.33-1.4-6.17-3.26-12.28-3.78-18.62z" fill="#089156"/> <path d="m164.39 3.5996c0.03-0.05 0.1-0.16 0.13-0.21-0.03 0.05-0.1 0.16-0.13 0.21z" fill="#089156"/> <path d="m163.27 5.4996c0.05-0.07 0.13-0.22 0.17-0.29-0.04 0.07-0.12 0.22-0.17 0.29z" fill="#089156"/> <path d="m161.91 7.9296c0.09-0.17 0.27-0.49 0.36-0.65-0.09 0.16-0.27 0.48-0.36 0.65z" fill="#089156"/> <path d="m161.56 8.5296c0.08-0.15 0.26-0.45 0.35-0.6-0.09 0.15-0.27 0.45-0.35 0.6z" fill="#089156"/> <path d="m160.38 10.55c0.04-0.08 0.12-0.22 0.16-0.3-0.04 0.08-0.12 0.22-0.16 0.3z" fill="#089156"/> <path d="m159.31 12.84c0.05-0.16 0.14-0.48 0.19-0.64-0.05 0.16-0.14 0.48-0.19 0.64z" fill="#089156"/> <path d="m157.91 15.07c0.35-0.56 1.05-1.67 1.4-2.23-0.35 0.56-1.05 1.67-1.4 2.23z" fill="#089156"/> <path d="m157.37 15.85c0.14-0.19 0.4-0.58 0.54-0.78-0.14 0.2-0.4 0.59-0.54 0.78z" fill="#089156"/> <path d="m156.32 17.54c0.07-0.12 0.22-0.37 0.29-0.5-0.07 0.13-0.22 0.38-0.29 0.5z" fill="#089156"/> <path d="m155.32 19.85c0.03-0.17 0.11-0.51 0.15-0.68-0.04 0.17-0.12 0.51-0.15 0.68z" fill="#089156"/> <path d="m153.86 22.05c0.37-0.55 1.09-1.65 1.46-2.2-0.37 0.55-1.09 1.65-1.46 2.2z" fill="#089156"/> <path d="m153.35 22.82c0.13-0.19 0.39-0.58 0.51-0.77-0.12 0.19-0.38 0.58-0.51 0.77z" fill="#089156"/> <path d="m152.3 24.55c0.06-0.11 0.18-0.32 0.24-0.42-0.06 0.1-0.18 0.31-0.24 0.42z" fill="#089156"/> <path d="m150.94 26.94c0.1-0.17 0.3-0.52 0.4-0.7-0.1 0.18-0.3 0.53-0.4 0.7z" fill="#089156"/> <path d="m150.58 27.56c0.09-0.16 0.27-0.46 0.36-0.62-0.09 0.16-0.27 0.46-0.36 0.62z" fill="#089156"/> <path d="m149.39 29.56c0.05-0.07 0.14-0.22 0.18-0.3-0.04 0.08-0.13 0.23-0.18 0.3z" fill="#089156"/> <path d="m148.29 31.48c0.04-0.07 0.12-0.21 0.16-0.29-0.04 0.08-0.12 0.22-0.16 0.29z" fill="#089156"/> <path d="m146.9 33.89c0.1-0.16 0.29-0.5 0.39-0.66-0.1 0.16-0.29 0.5-0.39 0.66z" fill="#089156"/> <path d="m146.51 34.56c0.1-0.17 0.29-0.5 0.39-0.67-0.1 0.17-0.29 0.5-0.39 0.67z" fill="#089156"/> <path d="m145.36 36.54c0.03-0.07 0.11-0.2 0.15-0.27-0.04 0.07-0.12 0.2-0.15 0.27z" fill="#089156"/> <path d="m144.32 38.88c0.04-0.17 0.13-0.51 0.17-0.68-0.04 0.17-0.13 0.51-0.17 0.68z" fill="#089156"/> <path d="m142.86 41.11c0.36-0.56 1.09-1.68 1.46-2.23-0.37 0.55-1.1 1.67-1.46 2.23z" fill="#089156"/> <path d="m142.37 41.87c0.12-0.19 0.36-0.57 0.49-0.76-0.13 0.19-0.37 0.57-0.49 0.76z" fill="#089156"/> <path d="m141.11 44.14c0.15-0.29 0.44-0.86 0.58-1.15-0.14 0.29-0.43 0.86-0.58 1.15z" fill="#089156"/> <path d="m140.1 45.99c0.13-0.2 0.38-0.61 0.5-0.81-0.12 0.2-0.37 0.61-0.5 0.81z" fill="#089156"/> <path d="m139.54 46.77c0.14-0.2 0.42-0.58 0.56-0.78-0.14 0.2-0.42 0.58-0.56 0.78z" fill="#089156"/> <path d="m138.38 48.58c0.13-0.2 0.38-0.62 0.5-0.83-0.12 0.21-0.37 0.63-0.5 0.83z" fill="#089156"/> <path d="m137.07 51.17c0.11-0.23 0.34-0.7 0.45-0.93-0.11 0.23-0.34 0.7-0.45 0.93z" fill="#089156"/> <path d="m136.09 53c0.12-0.2 0.37-0.6 0.49-0.8-0.12 0.2-0.37 0.6-0.49 0.8z" fill="#089156"/> <path d="m135.53 53.76c0.14-0.19 0.42-0.57 0.56-0.76-0.14 0.19-0.42 0.57-0.56 0.76z" fill="#089156"/> <path d="m134.2 55.92c0.16-0.3 0.5-0.91 0.67-1.22-0.17 0.31-0.51 0.92-0.67 1.22z" fill="#089156"/> <path d="m133.29 57.86c0.1-0.2 0.28-0.59 0.38-0.79-0.1 0.2-0.28 0.59-0.38 0.79z" fill="#089156"/> <path d="m131.92 60.07c0.34-0.56 1.03-1.66 1.37-2.21-0.34 0.55-1.03 1.65-1.37 2.21z" fill="#089156"/> <path d="m131.37 60.87c0.14-0.2 0.41-0.6 0.55-0.8-0.14 0.2-0.41 0.6-0.55 0.8z" fill="#089156"/> <path d="m130.34 62.58c0.07-0.12 0.21-0.37 0.28-0.49-0.07 0.12-0.21 0.37-0.28 0.49z" fill="#089156"/> <path d="m129.22 64.83c0.06-0.14 0.2-0.42 0.27-0.56-0.07 0.14-0.21 0.42-0.27 0.56z" fill="#089156"/> <path d="m127.8 67.27c0.35-0.61 1.06-1.83 1.42-2.44l0.07 1.17c-0.37 0.32-1.12 0.96-1.49 1.27z" fill="#089156"/> <path d="m127.41 67.82c0.1-0.14 0.29-0.41 0.39-0.55-0.1 0.14-0.29 0.41-0.39 0.55z" fill="#089156"/> <path d="m126.13 70.15c0.18-0.39 0.55-1.17 0.73-1.56-0.18 0.39-0.55 1.17-0.73 1.56z" fill="#089156"/> <path d="m125.09 71.99c0.12-0.2 0.37-0.6 0.5-0.8-0.13 0.2-0.38 0.6-0.5 0.8z" fill="#089156"/> <path d="m124.54 72.77c0.14-0.2 0.41-0.59 0.55-0.78-0.14 0.19-0.41 0.58-0.55 0.78z" fill="#089156"/> <path d="m123.39 74.56c0.12-0.2 0.37-0.61 0.5-0.81-0.13 0.2-0.38 0.61-0.5 0.81z" fill="#089156"/> <path d="m122.19 76.66c0.06-0.1 0.18-0.32 0.24-0.42-0.06 0.1-0.18 0.32-0.24 0.42z" fill="#089156"/> <path d="m121.14 78.55l0.32-0.56-0.32 0.56z" fill="#089156"/> <path d="m119.25 81.78c0.08-0.13 0.24-0.41 0.32-0.55-0.08 0.14-0.24 0.42-0.32 0.55z" fill="#089156"/> <path d="m118.19 83.63c0.09-0.16 0.27-0.47 0.36-0.62-0.09 0.15-0.27 0.46-0.36 0.62z" fill="#089156"/> <path d="m116.9 85.88c0.11-0.19 0.33-0.58 0.45-0.78-0.12 0.2-0.34 0.59-0.45 0.78z" fill="#089156"/> <path d="m116.5 86.55c0.1-0.16 0.3-0.5 0.4-0.67-0.1 0.17-0.3 0.51-0.4 0.67z" fill="#089156"/> <path d="m115.34 88.51l0.16-0.28-0.16 0.28z" fill="#089156"/> <path d="m114.32 90.88c0.04-0.18 0.11-0.53 0.15-0.7-0.04 0.17-0.11 0.52-0.15 0.7z" fill="#089156"/> <path d="m112.86 93.05c0.36-0.54 1.09-1.63 1.46-2.17-0.37 0.54-1.1 1.63-1.46 2.17z" fill="#089156"/> <path d="m112.34 93.83c0.13-0.19 0.39-0.58 0.52-0.78-0.13 0.2-0.39 0.59-0.52 0.78z" fill="#089156"/> <path d="m111.32 95.49l0.28-0.48-0.28 0.48z" fill="#089156"/> <path d="m109.93 97.96c0.1-0.18 0.3-0.53 0.4-0.71-0.1 0.18-0.3 0.53-0.4 0.71z" fill="#089156"/> <path d="m109.56 98.58c0.09-0.15 0.27-0.47 0.37-0.62-0.1 0.15-0.28 0.47-0.37 0.62z" fill="#089156"/> <path d="m108.4 100.55c0.04-0.07 0.12-0.21 0.17-0.28-0.05 0.07-0.13 0.21-0.17 0.28z" fill="#089156"/> <path d="m107.29 102.46c0.03-0.06 0.1-0.17 0.13-0.23-0.03 0.06-0.1 0.17-0.13 0.23z" fill="#089156"/> <path d="m214.02 225.86c0.17-0.28 0.53-0.84 0.7-1.11-0.17 0.27-0.53 0.83-0.7 1.11z" fill="#089156"/> <path d="m213.58 226.64c0.05-0.08 0.14-0.25 0.18-0.33-0.04 0.08-0.13 0.25-0.18 0.33z" fill="#089156"/> <path d="m211.72 230.02c0.08-0.13 0.23-0.39 0.3-0.52-0.07 0.13-0.22 0.39-0.3 0.52z" fill="#089156"/> <path d="m210.67 231.87c0.08-0.15 0.25-0.44 0.34-0.59-0.09 0.15-0.26 0.44-0.34 0.59z" fill="#089156"/> <path d="m209.66 233.64c0.05-0.08 0.14-0.24 0.18-0.32-0.04 0.08-0.13 0.24-0.18 0.32z" fill="#089156"/> <path d="m208.27 236.07c0.09-0.16 0.27-0.48 0.36-0.63-0.09 0.15-0.27 0.47-0.36 0.63z" fill="#089156"/> <path d="m207.87 236.74c0.1-0.17 0.3-0.5 0.4-0.67-0.1 0.17-0.3 0.5-0.4 0.67z" fill="#089156"/> <path d="m206.54 239.02c0.08-0.13 0.24-0.41 0.32-0.54-0.08 0.13-0.24 0.41-0.32 0.54z" fill="#089156"/> <path d="m205.5 240.8c0.1-0.18 0.32-0.55 0.42-0.73-0.1 0.18-0.32 0.55-0.42 0.73z" fill="#089156"/> <path d="m203.62 244.07c0.07-0.13 0.22-0.38 0.29-0.5-0.07 0.12-0.22 0.37-0.29 0.5z" fill="#089156"/> <path d="m202.56 245.86c0.11-0.19 0.33-0.55 0.43-0.74-0.1 0.19-0.32 0.55-0.43 0.74z" fill="#089156"/> <path d="m200.71 249.06c0.09-0.15 0.26-0.46 0.35-0.61-0.09 0.15-0.26 0.46-0.35 0.61z" fill="#089156"/> <path d="m199.68 250.9c0.07-0.12 0.21-0.37 0.28-0.49-0.07 0.12-0.21 0.37-0.28 0.49z" fill="#089156"/> <path d="m198.59 252.81l0.32-0.56-0.32 0.56z" fill="#089156"/> <path d="m196.66 256.09c0.09-0.16 0.27-0.47 0.36-0.62-0.09 0.15-0.27 0.46-0.36 0.62z" fill="#089156"/> <path d="m195.69 257.84c0.06-0.12 0.19-0.35 0.26-0.47-0.07 0.12-0.2 0.35-0.26 0.47z" fill="#089156"/> <path d="m194.58 259.76c0.07-0.12 0.22-0.37 0.29-0.5-0.07 0.13-0.22 0.38-0.29 0.5z" fill="#089156"/> <path d="m192.6 263.15c0.08-0.13 0.24-0.39 0.31-0.52-0.07 0.13-0.23 0.39-0.31 0.52z" fill="#089156"/> <path d="m191.59 264.85c0.1-0.18 0.31-0.53 0.41-0.71-0.1 0.18-0.31 0.53-0.41 0.71z" fill="#089156"/> <path d="m189.82 267.94c0.06-0.11 0.2-0.35 0.26-0.46-0.06 0.11-0.2 0.35-0.26 0.46z" fill="#089156"/> <path d="m188.76 269.83c0.06-0.11 0.18-0.32 0.24-0.43-0.06 0.11-0.18 0.32-0.24 0.43z" fill="#089156"/> <path d="m187.64 271.76c0.07-0.11 0.21-0.35 0.28-0.46-0.07 0.11-0.21 0.35-0.28 0.46z" fill="#089156"/> <path d="m185.65 275.09c0.11-0.18 0.31-0.54 0.42-0.71-0.11 0.17-0.31 0.53-0.42 0.71z" fill="#089156"/> <path d="m184.76 276.74c0.07-0.13 0.22-0.41 0.3-0.55-0.08 0.14-0.23 0.42-0.3 0.55z" fill="#089156"/> <path d="m183.39 279.12c0.08-0.15 0.26-0.45 0.34-0.6-0.08 0.15-0.26 0.45-0.34 0.6z" fill="#089156"/> <path d="m183.06 279.69c0.08-0.14 0.24-0.43 0.33-0.57-0.09 0.14-0.25 0.43-0.33 0.57z" fill="#089156"/> <path d="m346.42 3.2196c0.08 0.13 0.23 0.41 0.31 0.55-0.08-0.14-0.23-0.42-0.31-0.55z" fill="#10985b"/> <path d="m354.54 17.35c0.05 0.08 0.13 0.23 0.18 0.3-0.05-0.07-0.13-0.22-0.18-0.3z" fill="#10985b"/> <path d="m369.55 43.36c0.04 0.07 0.13 0.21 0.17 0.29-0.04-0.08-0.13-0.22-0.17-0.29z" fill="#10985b"/> <path d="m372.44 48.25c0.08 0.13 0.23 0.4 0.31 0.54-0.08-0.14-0.23-0.41-0.31-0.54z" fill="#10985b"/> <path d="m376.53 55.37c0.05 0.07 0.13 0.21 0.17 0.29-0.04-0.08-0.12-0.22-0.17-0.29z" fill="#10985b"/> <path d="m380.48 62.24c0.08 0.13 0.23 0.39 0.31 0.52-0.08-0.13-0.23-0.39-0.31-0.52z" fill="#10985b"/> <path d="m384.51 69.22c0.08 0.13 0.23 0.4 0.31 0.53-0.08-0.13-0.23-0.4-0.31-0.53z" fill="#10985b"/> <path d="m420.57 131.65c17.39 30.13 34.89 60.21 52.14 90.43 0.08 0.13 0.24 0.41 0.32 0.54 0.4 0.66 1.2 1.97 1.59 2.62 0.08 0.13 0.24 0.4 0.32 0.53l0.8 1.37c0.05 0.09 0.15 0.28 0.21 0.37l1 1.74c0.1 0.17 0.29 0.52 0.39 0.69 0.09 0.15 0.27 0.46 0.36 0.62l0.98 1.7 0.16 0.28 0.98 1.68c0.04 0.07 0.12 0.2 0.16 0.27l0.98 1.7c0.1 0.17 0.29 0.5 0.39 0.67 0.09 0.17 0.28 0.5 0.37 0.66l1.01 1.78c0.14 0.35 0.42 1.03 0.56 1.37l0.28 0.55 0.13 0.29 0.22 0.29 0.59 0.89c0.21 0.33 0.62 0.99 0.83 1.32 0.12 0.2 0.38 0.6 0.5 0.8l0.66 1.05c0.2 0.45 0.6 1.36 0.8 1.81l0.3 0.54 0.11 0.21 0.09 0.13c0.44 0.65 1.31 1.96 1.75 2.61 0.11 0.18 0.33 0.54 0.45 0.72l0.6 1c0.09 0.16 0.27 0.47 0.36 0.62l1.01 1.77c0.09 0.16 0.27 0.48 0.36 0.64s0.27 0.47 0.36 0.63l1 1.71c0.04 0.08 0.13 0.23 0.18 0.3l0.91 1.6c0.06 0.1 0.18 0.31 0.24 0.41l0.92 1.61c0.11 0.18 0.32 0.55 0.43 0.73 0.09 0.16 0.28 0.48 0.37 0.64 0.74 1.23 1.45 2.48 2.11 3.76 0.1 0.21 0.3 0.63 0.39 0.84l0.46 1.04c0.12 0.2 0.36 0.61 0.47 0.81 0.15 0.2 0.44 0.58 0.59 0.77l0.69 0.98c0.12 0.19 0.36 0.57 0.49 0.77l1.01 1.75c0.09 0.16 0.27 0.48 0.36 0.64s0.27 0.47 0.37 0.63l1 1.72c0.04 0.08 0.12 0.22 0.16 0.29l0.95 1.66c0.04 0.07 0.12 0.2 0.16 0.27l0.97 1.69c0.1 0.17 0.3 0.51 0.4 0.69 0.1 0.17 0.3 0.51 0.39 0.68l1 1.72c0.04 0.07 0.11 0.21 0.15 0.28l1.06 1.98-0.01 0.9c-25.02-7.19-49.64-15.72-74.73-22.65-22.77-7.35-45.75-14.04-68.52-21.35 3.17-1.52 6.56-2.49 9.73-3.99 0.41-1.35 0.84-2.69 1.26-4.02 3.95-2.48 8.41-3.97 12.3-6.54 0.15-3.29 0.14-6.57 0.13-9.85 4.36-3.51 8.98-6.76 12.57-11.11 0.36-4.28-2.87-9.29 0.46-12.9 10.24-12.92 16.45-28.93 17.56-45.38 1.83-6.02-1.46-11.98-0.1-17.97z" fill="#f9c941"/> <path d="m509.91 287.41l0.52 0.02 0.29 0.76-0.59 0.04-0.22-0.82z" fill="#f9c941"/> <path d="m257.34 157.32c0.08 0.13 0.24 0.4 0.32 0.54-0.08-0.14-0.24-0.41-0.32-0.54z" fill="#e3b73a"/> <path d="m259.19 160.53c0.07 0.12 0.2 0.35 0.27 0.47-0.07-0.12-0.2-0.35-0.27-0.47z" fill="#e3b73a"/> <path d="m260.28 162.47c0.05 0.08 0.14 0.25 0.19 0.33-0.05-0.08-0.14-0.25-0.19-0.33z" fill="#e3b73a"/> <path d="m261.48 164.56c0.09 0.15 0.26 0.45 0.35 0.6-0.09-0.15-0.26-0.45-0.35-0.6z" fill="#e3b73a"/> <path d="m261.83 165.16c0.09 0.17 0.28 0.49 0.38 0.65-0.1-0.16-0.29-0.48-0.38-0.65z" fill="#e3b73a"/> <path d="m263.16 167.44c0.05 0.09 0.16 0.27 0.21 0.36-0.05-0.09-0.16-0.27-0.21-0.36z" fill="#e3b73a"/> <path d="m265.34 171.21c0.09 0.16 0.26 0.47 0.35 0.62-0.09-0.15-0.26-0.46-0.35-0.62z" fill="#e3b73a"/> <path d="m267.23 174.48c0.09 0.15 0.26 0.43 0.34 0.57-0.08-0.14-0.25-0.42-0.34-0.57z" fill="#e3b73a"/> <path d="m268.43 176.5c0.2 0.33 0.59 0.98 0.79 1.31-0.2-0.33-0.59-0.98-0.79-1.31z" fill="#e3b73a"/> <path d="m269.49 178.29c0.04 0.09 0.14 0.26 0.19 0.34-0.05-0.08-0.15-0.25-0.19-0.34z" fill="#e3b73a"/> <path d="m271.44 181.79c0.19 0.26 0.57 0.8 0.76 1.07-0.19-0.27-0.57-0.81-0.76-1.07z" fill="#e3b73a"/> <path d="m272.46 183.32c0.04 0.08 0.13 0.25 0.18 0.33-0.05-0.08-0.14-0.25-0.18-0.33z" fill="#e3b73a"/> <path d="m275.45 188.72c0.19 0.28 0.56 0.84 0.75 1.12-0.19-0.28-0.56-0.84-0.75-1.12z" fill="#e3b73a"/> <path d="m276.47 190.31c0.04 0.08 0.14 0.25 0.18 0.33-0.04-0.08-0.14-0.25-0.18-0.33z" fill="#e3b73a"/> <path d="m278.23 193.51c0.09 0.15 0.26 0.45 0.35 0.6-0.09-0.15-0.26-0.45-0.35-0.6z" fill="#e3b73a"/> <path d="m279.22 195.24c0.1 0.17 0.3 0.53 0.4 0.7-0.1-0.17-0.3-0.53-0.4-0.7z" fill="#e3b73a"/> <path d="m280.45 197.4c0.1 0.18 0.31 0.55 0.41 0.73-0.1-0.18-0.31-0.55-0.41-0.73z" fill="#e3b73a"/> <path d="m280.86 198.13c0.09 0.15 0.27 0.47 0.36 0.63-0.09-0.16-0.27-0.48-0.36-0.63z" fill="#e3b73a"/> <path d="m282.24 200.51c0.04 0.08 0.13 0.22 0.17 0.29-0.04-0.07-0.13-0.21-0.17-0.29z" fill="#e3b73a"/> <path d="m283.38 202.47c0.08 0.14 0.24 0.41 0.32 0.55-0.08-0.14-0.24-0.41-0.32-0.55z" fill="#e3b73a"/> <path d="m284.31 204.06c0.11 0.18 0.32 0.55 0.43 0.73-0.11-0.18-0.32-0.55-0.43-0.73z" fill="#e3b73a"/> <path d="m286.47 207.71c0.17 0.29 0.52 0.86 0.69 1.15-0.17-0.29-0.52-0.86-0.69-1.15z" fill="#e3b73a"/> <path d="m287.45 209.32c0.05 0.09 0.15 0.25 0.2 0.33-0.05-0.08-0.15-0.24-0.2-0.33z" fill="#e3b73a"/> <path d="m289.43 212.46l0.07 0.1 0.06 0.13c-0.03-0.06-0.1-0.17-0.13-0.23z" fill="#e3b73a"/> <path d="m291.5 216.56c0.09 0.15 0.25 0.44 0.34 0.59-0.09-0.15-0.25-0.44-0.34-0.59z" fill="#e3b73a"/> <path d="m291.84 217.15l0.4 0.68-0.4-0.68z" fill="#e3b73a"/> <path d="m293.19 219.44c0.05 0.09 0.15 0.27 0.21 0.36-0.06-0.09-0.16-0.27-0.21-0.36z" fill="#e3b73a"/> <path d="m294.06 220.98c11.53 4.24 23.46 7.26 35.11 11.11 12.52 3.71 24.94 7.72 37.49 11.32 22.77 7.31 45.75 14 68.52 21.35-0.34 4.87 0.62 9.86-0.59 14.64-0.93 4.65-6.49 5.38-8.78 9.09-30.77 0.01-61.53 0.1-92.29-0.03l-0.66-0.05c-12.71-22.6-25.93-44.92-38.8-67.43z" fill="#e3b73a"/> <path d="m472.71 222.08c0.08 0.13 0.24 0.41 0.32 0.54-0.08-0.13-0.24-0.41-0.32-0.54z" fill="#e8b835"/> <path d="m474.62 225.24c0.08 0.13 0.24 0.4 0.32 0.53-0.08-0.13-0.24-0.4-0.32-0.53z" fill="#e8b835"/> <path d="m475.74 227.14c0.05 0.09 0.15 0.28 0.21 0.37-0.06-0.09-0.16-0.28-0.21-0.37z" fill="#e8b835"/> <path d="m476.95 229.25c0.1 0.17 0.29 0.52 0.39 0.69-0.1-0.17-0.29-0.52-0.39-0.69z" fill="#e8b835"/> <path d="m477.34 229.94c0.09 0.15 0.27 0.46 0.36 0.62-0.09-0.16-0.27-0.47-0.36-0.62z" fill="#e8b835"/> <path d="m478.68 232.26l0.16 0.28-0.16-0.28z" fill="#e8b835"/> <path d="m479.82 234.22c0.04 0.07 0.12 0.2 0.16 0.27-0.04-0.07-0.12-0.2-0.16-0.27z" fill="#e8b835"/> <path d="m480.96 236.19c0.1 0.17 0.29 0.5 0.39 0.67-0.1-0.17-0.29-0.5-0.39-0.67z" fill="#e8b835"/> <path d="m481.35 236.86c0.09 0.17 0.28 0.5 0.37 0.66-0.09-0.16-0.28-0.49-0.37-0.66z" fill="#e8b835"/> <path d="m482.73 239.3c0.14 0.35 0.42 1.03 0.56 1.37-0.14-0.34-0.42-1.02-0.56-1.37z" fill="#e8b835"/> <path d="m483.57 241.22c0.09 0.15 0.26 0.44 0.35 0.58l-0.22-0.29-0.13-0.29z" fill="#e8b835"/> <path d="m484.51 242.69c0.21 0.33 0.62 0.99 0.83 1.32-0.21-0.33-0.62-0.99-0.83-1.32z" fill="#e8b835"/> <path d="m485.34 244.01c0.12 0.2 0.38 0.6 0.5 0.8-0.12-0.2-0.38-0.6-0.5-0.8z" fill="#e8b835"/> <path d="m486.5 245.86c0.2 0.45 0.6 1.36 0.8 1.81-0.2-0.45-0.6-1.36-0.8-1.81z" fill="#e8b835"/> <path d="m487.6 248.21c0.05 0.09 0.15 0.26 0.2 0.34l-0.09-0.13-0.11-0.21z" fill="#e8b835"/> <path d="m489.55 251.16c0.11 0.18 0.33 0.54 0.45 0.72-0.12-0.18-0.34-0.54-0.45-0.72z" fill="#e8b835"/> <path d="m490.6 252.88c0.09 0.16 0.27 0.47 0.36 0.62-0.09-0.15-0.27-0.46-0.36-0.62z" fill="#e8b835"/> <path d="m491.97 255.27c0.09 0.16 0.27 0.48 0.36 0.64-0.09-0.16-0.27-0.48-0.36-0.64z" fill="#e8b835"/> <path d="m492.33 255.91c0.09 0.16 0.27 0.47 0.36 0.63-0.09-0.16-0.27-0.47-0.36-0.63z" fill="#e8b835"/> <path d="m493.69 258.25c0.04 0.08 0.13 0.23 0.18 0.3-0.05-0.07-0.14-0.22-0.18-0.3z" fill="#e8b835"/> <path d="m494.78 260.15c0.06 0.1 0.18 0.31 0.24 0.41-0.06-0.1-0.18-0.31-0.24-0.41z" fill="#e8b835"/> <path d="m495.94 262.17c0.11 0.18 0.32 0.55 0.43 0.73-0.11-0.18-0.32-0.55-0.43-0.73z" fill="#e8b835"/> <path d="m496.37 262.9c0.09 0.16 0.28 0.48 0.37 0.64-0.09-0.16-0.28-0.48-0.37-0.64z" fill="#e8b835"/> <path d="m435.18 264.76c25.09 6.93 49.71 15.46 74.73 22.65l0.22 0.82c-28.09 0.64-56.22 0.11-84.32 0.26 2.29-3.71 7.85-4.44 8.78-9.09 1.21-4.78 0.25-9.77 0.59-14.64z" fill="#e8b835"/> <path d="m498.85 267.3c0.1 0.21 0.3 0.63 0.39 0.84-0.09-0.21-0.29-0.63-0.39-0.84z" fill="#e8b835"/> <path d="m499.7 269.18c0.12 0.2 0.36 0.61 0.47 0.81-0.11-0.2-0.35-0.61-0.47-0.81z" fill="#e8b835"/> <path d="m500.17 269.99c0.15 0.2 0.44 0.58 0.59 0.77-0.15-0.19-0.44-0.57-0.59-0.77z" fill="#e8b835"/> <path d="m501.45 271.74c0.12 0.19 0.36 0.57 0.49 0.77-0.13-0.2-0.37-0.58-0.49-0.77z" fill="#e8b835"/> <path d="m502.95 274.26c0.09 0.16 0.27 0.48 0.36 0.64-0.09-0.16-0.27-0.48-0.36-0.64z" fill="#e8b835"/> <path d="m503.31 274.9c0.09 0.16 0.27 0.47 0.37 0.63-0.1-0.16-0.28-0.47-0.37-0.63z" fill="#e8b835"/> <path d="m504.68 277.25c0.04 0.08 0.12 0.22 0.16 0.29-0.04-0.07-0.12-0.21-0.16-0.29z" fill="#e8b835"/> <path d="m505.79 279.2c0.04 0.07 0.12 0.2 0.16 0.27-0.04-0.07-0.12-0.2-0.16-0.27z" fill="#e8b835"/> <path d="m506.92 281.16c0.1 0.17 0.3 0.51 0.4 0.69-0.1-0.18-0.3-0.52-0.4-0.69z" fill="#e8b835"/> <path d="m507.32 281.85c0.1 0.17 0.3 0.51 0.39 0.68-0.09-0.17-0.29-0.51-0.39-0.68z" fill="#e8b835"/> <path d="m508.71 284.25c0.04 0.07 0.11 0.21 0.15 0.28-0.04-0.07-0.11-0.21-0.15-0.28z" fill="#e8b835"/> <path d="m509.92 286.51c0.13 0.23 0.38 0.69 0.51 0.92l-0.52-0.02 0.01-0.9z" fill="#e8b835"/> <path d="m147.21 341.08c10.31-17.58 20.11-35.49 30.76-52.86 51.63 0.19 103.27-0.29 154.89 0.19l0.66 0.05c-26.11 0.84-52.29-0.22-78.4 0.44-4.98 3.21-8.3 8.41-13.07 11.91-4.43 3.23-7.69 7.73-11.92 11.18-5.93 4.37-10.34 10.43-16.36 14.71-6.96 7.37-14.99 13.58-22.01 20.91-5.26 4.04-9.66 9.03-14.56 13.48-5.39 3.91-9.52 9.21-14.56 13.53-0.13 0.11-0.38 0.33-0.51 0.45-0.27 0.21-0.8 0.65-1.07 0.86-0.13 0.11-0.37 0.31-0.5 0.42-3.97 3.07-7.01 7.12-10.91 10.27-0.13 0.11-0.38 0.32-0.5 0.42-0.13 0.11-0.38 0.32-0.51 0.42-5.69 4.67-10.25 10.58-16.22 14.93-6.01 5.96-12.79 11.08-18.5 17.36-8.44 6.94-15.74 15.13-24.44 21.78 2.16-4.71 5.02-9.03 7.53-13.54 16.74-28.97 33.46-57.94 50.2-86.91z" fill="#296ad9"/> <path d="m89.04 442.17c0.11-0.16 0.33-0.48 0.44-0.64l-0.03 0.65-0.41-0.01z" fill="#296ad9"/> <path id="#2a71e9ff" fill="#2a71e9" d="m333.52 288.46c30.76 0.13 61.52 0.04 92.29 0.03 28.1-0.15 56.23 0.38 84.32-0.26l0.59-0.04 0.4 0.11v0.08c-29.66 51.27-59.23 102.6-88.89 153.88-110.93-0.03-221.86 0.1-332.78-0.08l0.03-0.65c8.7-6.65 16-14.84 24.44-21.78 5.71-6.28 12.49-11.4 18.5-17.36 5.97-4.35 10.53-10.26 16.22-14.93 0.13-0.1 0.38-0.31 0.51-0.42 0.12-0.1 0.37-0.31 0.5-0.42 3.9-3.15 6.94-7.2 10.91-10.27 0.13-0.11 0.37-0.31 0.5-0.42 0.27-0.21 0.8-0.65 1.07-0.86 0.13-0.12 0.38-0.34 0.51-0.45 5.04-4.32 9.17-9.62 14.56-13.53 4.9-4.45 9.3-9.44 14.56-13.48 7.02-7.33 15.05-13.54 22.01-20.91 6.02-4.28 10.43-10.34 16.36-14.71 4.23-3.45 7.49-7.95 11.92-11.18 4.77-3.5 8.09-8.7 13.07-11.91 26.11-0.66 52.29 0.4 78.4-0.44z"/> <path d="m162.13 375.07c0.13-0.12 0.38-0.34 0.51-0.45-0.13 0.11-0.38 0.33-0.51 0.45z" fill="#286ee6"/> <path d="m161.06 375.93c0.27-0.21 0.8-0.65 1.07-0.86-0.27 0.21-0.8 0.65-1.07 0.86z" fill="#286ee6"/> <path d="m160.56 376.35c0.13-0.11 0.37-0.31 0.5-0.42-0.13 0.11-0.37 0.31-0.5 0.42z" fill="#286ee6"/> <path d="m149.15 387.04c0.12-0.1 0.37-0.31 0.5-0.42-0.13 0.11-0.38 0.32-0.5 0.42z" fill="#286ee6"/> <path d="m148.64 387.46c0.13-0.1 0.38-0.31 0.51-0.42-0.13 0.11-0.38 0.32-0.51 0.42z" fill="#286ee6"/> </svg> <div>Google Drive</div> </button> </div> </div> </div> <div class="rs-box rs-box-sign-in" aria-hidden="true"> <div class="rs-content"> <form name="rs-sign-in-form" class="rs-sign-in-form"> <h1 class="rs-big-headline">Connect your storage</h1> <input type="text" name="rs-user-address" placeholder="user@provider.com" autocapitalize="off"> <div class="rs-sign-in-error rs-hidden"></div> <button type="submit" class="rs-connect">Connect</button> <a href="https://remotestorage.io/get/" class="rs-help" target="_blank" rel="noopener">Need help?</a> </form> </div> </div> </div> ';var t=document.createElement("style");return t.innerHTML='#remotestorage-widget {\n z-index: 21000000;\n}\n\n.rs-widget {\n box-sizing: border-box;\n overflow: hidden;\n max-width: 350px;\n padding: 10px;\n margin: 10px;\n border-radius: 3px;\n background-color: #fff;\n box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1), 0 3px 8px 0 rgba(0,0,0,0.2);\n font-family: arial, sans-serif;\n font-size: 16px;\n color: #333;\n will-change: max-height, height, width, opacity, max-width, background, box-shadow;\n transition-property: width, height, opacity, max-width, max-height, background, box-shadow;\n transition-duration: 300ms;\n}\n\n.rs-widget * {\n box-sizing: border-box;\n}\n\n.rs-widget .rs-hidden {\n display: none;\n}\n\n.rs-box {\n overflow: hidden;\n will-change: height;\n transition-property: height, width, max-height;\n transition-duration: 300ms;\n transition-timing-function: ease-in;\n opacity: 0;\n max-height: 0px;\n}\n\n.rs-box.rs-selected:not([aria-hidden=true]) {\n opacity: 1;\n max-height: 420px;\n}\n\n/* Main logo */\n.rs-main-logo {\n float: left;\n height: 36px;\n width: 36px;\n margin-top: 1px;\n margin-right: 0.625em;\n transition: margin-left 300ms ease-out, transform 300ms ease-out;\n cursor: pointer;\n}\n.rs-widget .rs-backend-remotestorage svg#rs-main-logo-remotestorage {\n display: block;\n}\n.rs-widget[class*="rs-backend-"]:not(.rs-backend-remotestorage) svg#rs-main-logo-remotestorage {\n display: none;\n}\n.rs-widget.rs-backend-dropbox svg#rs-main-logo-dropbox {\n display: block;\n}\n.rs-widget:not(.rs-backend-dropbox) svg#rs-main-logo-dropbox {\n display: none;\n}\n.rs-widget.rs-backend-googledrive svg#rs-main-logo-googledrive {\n display: block;\n}\n.rs-widget:not(.rs-backend-googledrive) svg#rs-main-logo-googledrive {\n display: none;\n}\n\npolygon.rs-logo-shape {\n fill: #FF4B03;\n}\n\npolygon.rs-logo-shape,\n#rs-main-logo-dropbox path,\n#rs-main-logo-googledrive path {\n transition-property: fill;\n transition-duration: 0.5s;\n}\n\n.rs-offline polygon.rs-logo-shape,\n.rs-offline #rs-main-logo-dropbox path,\n.rs-offline #rs-main-logo-googledrive path {\n fill: #888;\n transition-property: fill;\n transition-duration: 0.5s;\n}\n\n/* Hide everything except logo when connected and clicked outside of box */\n.rs-closed {\n max-width: 56px;\n background-color: transparent;\n box-shadow: none;\n opacity: 0.5;\n\n transition: max-height 100ms ease-out 0ms, max-width 300ms ease-out 300ms, background 300ms ease-in 200ms, opacity 300ms ease 200ms;\n}\n\n.rs-closed:hover {\n cursor: pointer;\n opacity: 1;\n}\n\n.rs-box-initial {\n transition-duration: 0ms;\n}\n\n.rs-box-initial:hover {\n cursor: pointer;\n}\n\n.rs-widget a {\n color: #0093cc;\n}\n\n/* HEADLINE */\n.rs-small-headline {\n font-size: 1em;\n font-weight: bold;\n margin: 0;\n margin-bottom: 2px;\n height: 1.2em;\n word-break: break-all;\n overflow: hidden;\n line-height: 1em;\n}\n\n.rs-sub-headline {\n word-break: break-all;\n overflow: hidden;\n color: #666;\n font-size: 0.92em;\n height: 1.2em;\n}\n.rs-big-headline {\n font-size: 1.625em;\n font-weight: normal;\n text-align: center;\n margin-top: 20px;\n margin-bottom: 20px;\n}\n\n/* BUTTONS */\n.rs-button {\n font: inherit;\n color: inherit;\n background-color: transparent;\n border: 1px solid #dcdcdc;\n border-radius: 3px;\n cursor: pointer;\n}\n.rs-button-small {\n padding: 0.6em 0.7em;\n margin-left: 0.2em;\n transition: border-color 300ms ease-out;\n}\n.rs-button-small svg {\n vertical-align: top;\n}\n.rs-button-wrap {\n margin-top: 10px;\n}\n\n.rs-button-wrap img,\n.rs-button-wrap svg {\n float: left;\n margin-right: 0.6em;\n width: 40px;\n height: 40px;\n}\n\n.rs-button-big {\n padding: 15px 10px;\n margin-bottom: 10px;\n display: block;\n width: 100%;\n text-align: left;\n transition: box-shadow 200ms;\n}\n.rs-button-big > div {\n font-size: 1.125em;\n padding: 10px 0;\n}\n.rs-button-big:hover {\n box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1), 0 3px 8px 0 rgba(0,0,0,0.2);\n}\n.rs-button-big:active {\n background-color: #eee;\n box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1), 0 3px 8px 0 rgba(0,0,0,0.2);\n}\n.rs-button-big:last-child {\n margin-bottom: 0;\n}\n\n.rs-content {\n padding: 0 10px 10px 10px;\n}\n\n\n.rs-state-choose .rs-main-logo,\n.rs-state-sign-in .rs-main-logo {\n margin-left: 45%;\n float: none;\n}\n\n.rs-sign-in-form input[type=text] {\n padding: 15px 10px;\n display: block;\n width: 100%;\n font: inherit;\n height: 52px;\n border: 1px solid #aaa;\n border-radius: 0;\n box-shadow: none;\n}\n.rs-sign-in-form button.rs-connect {\n padding: 15px 10px;\n margin-top: 20px;\n margin-bottom: 15px;\n display: block;\n width: 100%;\n border: none;\n border-radius: 3px;\n background-color: #3fb34f;\n font: inherit;\n color: #fff;\n transition: box-shadow 200ms, background-color 200ms;\n}\n\n.rs-sign-in-form button.rs-connect:hover {\n cursor: pointer;\n background-color: #4BCB5D;\n box-shadow: 0 1px 2px 0 rgba(0,0,0,0.1), 0 3px 8px 0 rgba(0,0,0,0.2);\n}\n\n.rs-sign-in-form button.rs-connect:active {\n background-color: #3fb34f;\n}\n\n.rs-sign-in-form button.rs-connect:disabled,\n.rs-sign-in-form button.rs-connect:disabled:hover {\n background-color: #aaa;\n}\n\n.rs-sign-in-form button.rs-connecting svg {\n height: 1em;\n width: auto;\n vertical-align: middle;\n margin-left: 0.5em;\n animation: rs-spin 1s linear infinite;\n}\n\n.rs-sign-in-error.rs-hidden,\n.rs-box-error.rs-hidden {\n height: 0;\n}\n\n.rs-sign-in-error.rs-visible,\n.rs-box-error.rs-visible {\n height: auto;\n border-radius: 3px;\n padding: 0.5em 0.5em;\n margin-top: 0.5em;\n text-align: center;\n background-color: rgba(255,0,0,0.1);\n color: darkred;\n}\n\n.rs-box-error {\n display: flex;\n flex-direction: row;\n}\n\n.rs-box-error .rs-error-message {\n flex: auto;\n}\n\n /*Choose provider box */\n.rs-box-choose {\n text-align: center;\n overflow: hidden;\n}\n\n.rs-box-choose p {\n margin-top: 0;\n margin-bottom: 20px;\n line-height: 1.4em;\n}\n\n/*Connected box */\n.rs-box-connected {\n display: flex;\n flex-direction: row;\n height: 40px;\n transition: height 0s;\n}\n.rs-connected-text {\n flex: auto;\n min-width: 0;\n}\n.rs-box-connected .rs-user {\n font-weight: bold;\n text-overflow: ellipsis;\n overflow: hidden;\n word-break: keep-all;\n}\n.rs-connected-buttons, .rs-error-buttons {\n flex: none;\n}\n.rs-disconnect:hover {\n border-color: #FF2D2D;\n}\n.rs-disconnect:hover .rs-icon{\n fill: #FF2D2D;\n}\n.rs-sync:hover {\n border-color: #FFBB0C;\n}\n.rs-sync:hover .rs-icon {\n fill: #FFBB0C;\n}\n.rs-sync.rs-rotate {\n border-color: #FFBB0C;\n}\n.rs-sync.rs-rotate .rs-icon {\n fill: #FFBB0C;\n animation: rs-spin 1s linear infinite;\n}\n\n/* Floating widget styles (top right corner) */\n.rs-floating {\n position: fixed;\n top: 0;\n right: 0;\n}\n\n@keyframes rs-spin {\n 100% {\n transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n/* Small/mobile screens */\n@media screen and (max-width: 420px) {\n .rs-widget {\n font-size: 100%;\n transition: all 300ms ease-out;\n max-width: 400px;\n }\n .rs-floating {\n position: relative;\n top: auto;\n right: auto\n }\n .rs-closed {\n max-width: 56px;\n }\n .rs-state-choose,\n .rs-state-sign-in {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n max-width: 100%;\n }\n}\n\n/* remove dotted outline border on Firefox */\n.rs-widget a:focus,\n.rs-widget a:active,\n.rs-widget button:focus,\n.rs-widget input:focus {\n outline:none;\n}\n.rs-widget button::-moz-focus-inner,\n.rs-widget input[type="button"]::-moz-focus-inner {\n border:0;\n}\n\n/* prevent rounded buttons on mobile Safari */\n.rs-widget button,\n.rs-widget input[type="button"] {\n -webkit-appearance: none;\n}\n\n.remotestorage-widget-modal-backdrop {\n display: none;\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: rgba(0, 0, 0, 0.5);\n opacity: 0;\n transition: opacity 0.3s linear;\n}\n\n.remotestorage-widget-modal-backdrop.visible {\n opacity: 1;\n transition: opacity 0.3s linear;\n}\n',e.appendChild(t),e}},{key:"setModalClass",value:function(){if(this.modalBackdrop){if("onlySmallScreens"===this.modalBackdrop&&!this.isSmallScreen())return;this.rsWidget.classList.add("rs-modal")}}},{key:"setupElements",value:function(){if(!this.parentContainerEl)throw new Error("Parent container element not found");this.rsWidget=this.parentContainerEl.querySelector(".rs-widget"),this.rsBackdrop=this.parentContainerEl.querySelector(".remotestorage-widget-modal-backdrop"),this.rsInitial=this.parentContainerEl.querySelector(".rs-box-initial"),this.rsChoose=this.parentContainerEl.querySelector(".rs-box-choose"),this.rsConnected=this.parentContainerEl.querySelector(".rs-box-connected"),this.rsSignIn=this.parentContainerEl.querySelector(".rs-box-sign-in"),this.rsConnectedLabel=this.parentContainerEl.querySelector(".rs-box-connected .rs-sub-headline"),this.rsChooseRemoteStorageButton=this.parentContainerEl.querySelector("button.rs-choose-rs"),this.rsChooseDropboxButton=this.parentContainerEl.querySelector("button.rs-choose-dropbox"),this.rsChooseGoogleDriveButton=this.parentContainerEl.querySelector("button.rs-choose-googledrive"),this.rsErrorBox=this.parentContainerEl.querySelector(".rs-box-error .rs-error-message"),this.rs.apiKeys.hasOwnProperty("googledrive")||this.rsChooseGoogleDriveButton.parentNode.removeChild(this.rsChooseGoogleDriveButton),this.rs.apiKeys.hasOwnProperty("dropbox")||this.rsChooseDropboxButton.parentNode.removeChild(this.rsChooseDropboxButton),this.rsSignInForm=this.parentContainerEl.querySelector(".rs-sign-in-form"),this.rsAddressInput=this.rsSignInForm.querySelector("input[name=rs-user-address]"),this.rsConnectButton=this.parentContainerEl.querySelector(".rs-connect"),this.rsDisconnectButton=this.parentContainerEl.querySelector(".rs-disconnect"),this.rsSyncButton=this.parentContainerEl.querySelector(".rs-sync"),this.rsLogo=this.parentContainerEl.querySelector(".rs-widget-icon"),this.rsErrorReconnectLink=this.parentContainerEl.querySelector(".rs-box-error a.rs-reconnect"),this.rsErrorDisconnectButton=this.parentContainerEl.querySelector(".rs-box-error button.rs-disconnect"),this.rsConnectedUser=this.parentContainerEl.querySelector(".rs-connected-text h1.rs-user")}},{key:"setupHandlers",value:function(){var e=this;this.rs.on("connected",function(){return e.eventHandler("connected")}),this.rs.on("ready",function(){return e.eventHandler("ready")}),this.rs.on("disconnected",function(){return e.eventHandler("disconnected")}),this.rs.on("network-online",function(){return e.eventHandler("network-online")}),this.rs.on("network-offline",function(){return e.eventHandler("network-offline")}),this.rs.on("error",function(t){return e.eventHandler("error",t)}),this.setEventListeners(),this.setClickHandlers()}},{key:"attach",value:function(e){var t=this.createHtmlTemplate(e);if(this.parentContainerEl,e instanceof HTMLElement)this.parentContainerEl=e;else if("string"==typeof e){if(this.parentContainerEl=document.getElementById(e),!this.parentContainerEl)throw new Error('Failed to find target DOM element with id="'+e+'"')}else{if(e)throw new Error("Unknown element type. Expected instance of HTMLElement or type of string.");this.parentContainerEl=document.body}this.parentContainerEl.appendChild(t),this.setupElements(),this.setupHandlers(),this.setInitialState(),this.setModalClass()}},{key:"setEventListeners",value:function(){var e=this;this.rsSignInForm.addEventListener("submit",function(t){t.preventDefault();var n=e.parentContainerEl.querySelector("input[name=rs-user-address]").value.trim();e.disableConnectButton(),e.rs.connect(n)})}},{key:"showChooseOrSignIn",value:function(){this.rsWidget.classList.contains("rs-modal")&&(this.rsBackdrop.style.display="block",this.rsBackdrop.classList.add("visible")),this.rs.apiKeys&&Object.keys(this.rs.apiKeys).length>0?this.setState("choose"):this.setState("sign-in")}},{key:"setClickHandlers",value:function(){var e=this;this.rsInitial.addEventListener("click",function(){return e.showChooseOrSignIn()}),this.rsChooseRemoteStorageButton.addEventListener("click",function(){e.setState("sign-in"),e.rsAddressInput.focus()}),this.rsChooseDropboxButton.addEventListener("click",function(){return e.rs.dropbox.connect()}),this.rsChooseGoogleDriveButton.addEventListener("click",function(){return e.rs.googledrive.connect()}),this.rsDisconnectButton.addEventListener("click",function(){return e.rs.disconnect()}),this.rsErrorReconnectLink.addEventListener("click",function(){return e.rs.reconnect()}),this.rsErrorDisconnectButton.addEventListener("click",function(){return e.rs.disconnect()}),this.rs.hasFeature("Sync")&&this.rsSyncButton.addEventListener("click",function(){e.rsSyncButton.classList.contains("rs-rotate")?(e.rs.stopSync(),e.rsSyncButton.classList.remove("rs-rotate")):(e.rsConnectedLabel.textContent="Synchronizing",e.rs.startSync(),e.rsSyncButton.classList.add("rs-rotate"))}),document.addEventListener("click",function(){return e.close()}),this.rsWidget.addEventListener("click",function(e){return e.stopPropagation()}),this.rsLogo.addEventListener("click",function(){return e.toggle()})}},{key:"toggle",value:function(){this.closed?this.open():"initial"===this.state?this.showChooseOrSignIn():this.close()}},{key:"open",value:function(){this.closed=!1,this.rsWidget.classList.remove("rs-closed"),this.shouldCloseWhenSyncDone=!1;var e=this.parentContainerEl.querySelector(".rs-box.rs-selected");e&&e.setAttribute("aria-hidden","false")}},{key:"close",value:function(){var e=this;if("error"!==this.state){if(!this.leaveOpen&&this.active){this.closed=!0,this.rsWidget.classList.add("rs-closed");var t=this.parentContainerEl.querySelector(".rs-box.rs-selected");t&&t.setAttribute("aria-hidden","true")}else this.active?this.setState("connected"):this.setInitialState();this.rsWidget.classList.contains("rs-modal")&&(this.rsBackdrop.classList.remove("visible"),setTimeout(function(){e.rsBackdrop.style.display="none"},300))}}},{key:"disableConnectButton",value:function(){this.rsConnectButton.disabled=!0,this.rsConnectButton.classList.add("rs-connecting"),this.rsConnectButton.innerHTML="Connecting ".concat('<svg width="38" height="38" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#fff">\n <g fill="none" fill-rule="evenodd">\n <g transform="translate(1 1)" stroke-width="2">\n <circle stroke-opacity=".5" cx="18" cy="18" r="18"/>\n <path d="M36 18c0-9.94-8.06-18-18-18"></path>\n </g>\n </g>\n</svg>\n')}},{key:"enableConnectButton",value:function(){this.rsConnectButton.disabled=!1,this.rsConnectButton.textContent="Connect",this.rsConnectButton.classList.remove("rs-connecting")}},{key:"setOffline",value:function(){this.online&&(this.rsWidget.classList.add("rs-offline"),this.rsConnectedLabel.textContent="Offline",this.online=!1)}},{key:"setOnline",value:function(){this.online||(this.rsWidget.classList.remove("rs-offline"),this.active&&(this.rsConnectedLabel.textContent="Connected")),this.online=!0}},{key:"setBackendClass",value:function(e){this.rsWidget.classList.remove("rs-backend-remotestorage"),this.rsWidget.classList.remove("rs-backend-dropbox"),this.rsWidget.classList.remove("rs-backend-googledrive"),e&&this.rsWidget.classList.add("rs-backend-".concat(e))}},{key:"showErrorBox",value:function(e){this.rsErrorBox.innerHTML=e,this.setState("error")}},{key:"hideErrorBox",value:function(){this.rsErrorBox.innerHTML="",this.close()}},{key:"handleSyncStarted",value:function(){var e=this;this.syncInProgress=!0,this.rsSyncButton.classList.add("rs-rotate"),setTimeout(function(){e.syncInProgress&&(e.rsConnectedLabel.textContent="Synchronizing")},1e3)}},{key:"handleDiscoveryError",value:function(e){var t=this.parentContainerEl.querySelector(".rs-sign-in-error");t.innerHTML=e.message,t.classList.remove("rs-hidden"),t.classList.add("rs-visible"),this.enableConnectButton()}},{key:"handleSyncError",value:function(){this.setOffline()}},{key:"handleUnauthorized",value:function(e){e.code&&"access_denied"===e.code?this.rs.disconnect():(this.open(),this.showErrorBox(e.message+" "),this.rsErrorBox.appendChild(this.rsErrorReconnectLink),this.rsErrorReconnectLink.classList.remove("rs-hidden"))}},{key:"updateLastSyncedStatus",value:function(){var e=new Date;this.online?(this.lastSynced=e,this.rsConnectedLabel.textContent="Synced"):this.rsWidget.classList.contains("rs-state-unauthorized")||(this.rsConnectedLabel.textContent="Offline")}},{key:"isSmallScreen",value:function(){return window.innerWidth<421}}],t&&function(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();return t.default})(),"object"==typeof e&&"object"==typeof t?t.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof e?e.Widget=r():n.Widget=r()}),cB=l(lB(),1),uB=new WeakMap;function hB(e,t,...n){if(e[t],e.isDestroying)return;"boolean"==typeof n[n.length-1]&&n[n.length-2];let r=uB.get(e);var i;let s;r||(r=new Map,uB.set(e,r),Ex(e,(i=r,function(){0!==i.size&&i.forEach(e=>Ms(e.cancelId))}))),s=r.has(t)?r.get(t).debouncedTask:(...n)=>{r.delete(t),e[t](...n)};let o=As(e,s,...n);r.set(t,{debouncedTask:s,cancelId:o})}var dB=a({default:()=>pB}),pB=class extends pp{static{dF(this.prototype,"osm",[dp])}#B=void fF(this,"osm");static{dF(this.prototype,"toast",[dp])}#Ie=void fF(this,"toast");rs;widget;static{dF(this.prototype,"placesInView",[Vr],function(){return[]})}#Pe=void fF(this,"placesInView");static{dF(this.prototype,"savedPlaces",[Vr],function(){return[]})}#Me=void fF(this,"savedPlaces");static{dF(this.prototype,"loadedPrefixes",[Vr],function(){return[]})}#Ae=void fF(this,"loadedPrefixes");static{dF(this.prototype,"currentBbox",[Vr],function(){return null})}#Oe=void fF(this,"currentBbox");static{dF(this.prototype,"lists",[Vr],function(){return[]})}#Ne=void fF(this,"lists");static{dF(this.prototype,"version",[Vr],function(){return 0})}#Fe=void fF(this,"version");static{dF(this.prototype,"initialSyncDone",[Vr],function(){return!1})}#De=void fF(this,"initialSyncDone");static{dF(this.prototype,"connected",[Vr],function(){return!1})}#ze=void fF(this,"connected");static{dF(this.prototype,"userAddress",[Vr],function(){return null})}#je=void fF(this,"userAddress");static{dF(this.prototype,"isWidgetOpen",[Vr],function(){return!1})}#Ue=void fF(this,"isWidgetOpen");isNewConnection=!0;constructor(){super(...arguments),this.checkInitialConnectionState(),this.rs=new tB.default({modules:[aB]}),this.rs.access.claim("places","rw"),this.rs.caching.enable("/places/"),window.remoteStorage=this.rs,this.widget=new cB.default(this.rs,{leaveOpen:!0,skipInitial:!0}),this.rs.on("ready",()=>{}),this.rs.on("error",e=>{e&&(console.info("[rs] Error —",`${e.name}: ${e.message}`),"Unauthorized"===e.name&&this.showConnectWidget())}),this.rs.on("connected",()=>{this.connected=!0,this.userAddress=this.rs.remote.userAddress,this.isNewConnection&&(this.toast.show("Remote storage connected",3e3),this.isNewConnection=!1),this.loadLists()}),this.rs.on("not-connected",()=>{this.loadLists()}),this.rs.on("disconnected",()=>{this.connected=!1,this.userAddress=null,this.placesInView=[],this.savedPlaces=[],this.loadedPrefixes=[],this.lists=[],this.initialSyncDone=!1,this.isNewConnection=!0}),this.rs.on("sync-done",()=>{this.initialSyncDone||(this.initialSyncDone=!0,this.loadLists())}),this.rs.scope("/places/").on("change",e=>{e.relativePath.startsWith("_lists/")?this.loadLists():(this.handlePlaceChange(e),hB(this,"reloadCurrentView",200))})}checkInitialConnectionState(){this.isNewConnection=!0;try{if(window.localStorage)for(const e of["remotestorage:wireclient","remotestorage:dropbox","remotestorage:googledrive"]){const t=window.localStorage.getItem(e);if(t){const e=JSON.parse(t);if(e&&e.token){this.isNewConnection=!1;break}}}}catch(e){console.warn("Failed to check localStorage for existing connection:",e)}}handlePlaceChange(e){const{newValue:t,relativePath:n}=e,r=n.split("/"),i=r[r.length-1];if(t){const e={...t,id:i},n=this.savedPlaces.findIndex(e=>e.id===i);if(-1!==n){const t=[...this.savedPlaces];t[n]=e,this.savedPlaces=t}else this.savedPlaces=[...this.savedPlaces,e]}else this.savedPlaces=this.savedPlaces.filter(e=>e.id!==i)}get places(){return this.rs.places}notifyChange(){this.version++,hB(this,"reloadCurrentView",200)}reloadCurrentView(){if(!this.currentBbox)return;const e=qj(this.currentBbox);console.debug("Reloading view due to changes, prefixes:",e),this.loadAllPlaces(e)}async loadLists(){try{if(!this.places.lists)return;await this.places.lists.initDefaults();const e=await this.places.lists.getAll();this.lists=e||[],this.lists.forEach(e=>{"to-go"===e.id?e.icon="bookmark":"to-do"===e.id&&(e.icon="check-square")}),this.refreshPlaceListAssociations()}catch(e){console.error("Failed to load lists:",e)}}refreshPlaceListAssociations(){const e=new Map;this.lists.forEach(t=>{t.placeRefs&&Array.isArray(t.placeRefs)&&t.placeRefs.forEach(n=>{n.id&&(e.has(n.id)||e.set(n.id,[]),e.get(n.id).push(t.id))})});const t=t=>(t._listIds=e.get(t.id)||[],t);this.savedPlaces=this.savedPlaces.map(e=>t({...e})),this.placesInView=this.placesInView.map(e=>t({...e}))}async togglePlaceList(e,t,n){if(!e)return;let r=e;if(!e.id||!e.geohash){if(!n)return;r=await this.storePlace(e)}try{return n?await this.places.lists.addPlace(t,r.id,r.geohash):await this.places.lists.removePlace(t,r.id),await this.loadLists(),this.findPlaceById(r.id)}catch(i){throw console.error("Failed to toggle place in list:",i),i}}async getPlacesInList(e){return this.places&&this.places.lists?this.places.lists.getPlaces(e):[]}async loadPlacesInBounds(e){const t=qj(e).filter(e=>!this.loadedPrefixes.includes(e));0!==t.length&&(console.debug("Loading new prefixes:",t),await this.loadAllPlaces(t),this.loadedPrefixes=[...this.loadedPrefixes,...t],this.currentBbox=e)}async loadAllPlaces(e=null){try{const t=await this.places.getPlaces(e);if(t&&Array.isArray(t)){if(e){const n=new Set(e),r=this.placesInView.filter(e=>{if(!e.lat||!e.lon)return!1;try{const t=Bj.encode(e.lat,e.lon,4);return!n.has(t)}catch{return!0}});this.placesInView=[...r,...t]}else this.placesInView=t;this.refreshPlaceListAssociations()}else e||(this.placesInView=[]);console.debug("Loaded saved places:",this.placesInView.length)}catch(t){console.error("Failed to load places:",t)}}findPlaceById(e){if(!e)return;const t=String(e);let n=this.savedPlaces.find(e=>e.id&&String(e.id)===t);return n||(n=this.placesInView.find(e=>e.id&&String(e.id)===t),n||(n=this.savedPlaces.find(e=>e.osmId&&String(e.osmId)===t),n||(n=this.placesInView.find(e=>e.osmId&&String(e.osmId)===t),n)))}isPlaceSaved(e){return!!this.findPlaceById(e)}async storePlace(e){const t=await this.places.store(e);return this.savedPlaces.some(e=>e.id===t.id)?this.savedPlaces=this.savedPlaces.map(e=>e.id===t.id?t:e):this.savedPlaces=[...this.savedPlaces,t],this.placesInView.some(e=>e.id===t.id)?this.placesInView=this.placesInView.map(e=>e.id===t.id?t:e):this.placesInView=[...this.placesInView,t],t}async updatePlace(e){const t=await this.places.store(e),n=this.savedPlaces.findIndex(e=>e.id===t.id);if(-1!==n){const e=[...this.savedPlaces];e[n]=t,this.savedPlaces=e}return this.placesInView=this.placesInView.map(e=>e.id===t.id?t:e),t}async removePlace(e){await this.places.remove(e.id,e.geohash),this.savedPlaces=this.savedPlaces.filter(t=>t.id!==e.id),this.placesInView.length>0&&(this.placesInView=this.placesInView.filter(t=>t.id!==e.id))}async refreshPlace(e){if(!(e&&e.id&&e.osmId&&e.osmType))return null;try{console.debug(`Checking for updates for ${e.title} (${e.osmId})`);const t=await this.osm.fetchOsmObject(e.osmId,e.osmType,{forceFresh:!0});if(!t)return console.warn("Could not fetch fresh data for",e.osmId),null;let n=!1;const r={},i=Math.abs(e.lat-t.lat),s=Math.abs(e.lon-t.lon);(i>1e-5||s>1e-5)&&(n=!0,r.lat=t.lat,r.lon=t.lon);const o=e.osmTags||{},a=t.osmTags||{},l=new Set([...Object.keys(o),...Object.keys(a)]);for(const e of l)if(o[e]!==a[e]){n=!0,r.osmTags=a;break}if(!n)return console.debug("No changes detected for",e.title),null;console.debug("Changes detected:",r);const c={...e,...r},u=UU(o),h=UU(a);return e.title===u&&u!==h&&(c.title=h),await this.updatePlace(c)}catch(t){return console.error("Failed to refresh place:",t),null}}showConnectWidget(){this.isWidgetOpen=!0,document.querySelector(".rs-widget")||this.widget.attach("rs-widget-container")}static{pF(this.prototype,"showConnectWidget",[ql])}closeWidget(){this.isWidgetOpen=!1}static{pF(this.prototype,"closeWidget",[ql])}disconnect(){this.rs.disconnect(),this.isWidgetOpen=!1}static{pF(this.prototype,"disconnect",[ql])}},fB=a({default:()=>gB}),gB=class extends pp{static{dF(this.prototype,"message",[Vr],function(){return null})}#Be=void fF(this,"message");static{dF(this.prototype,"isVisible",[Vr],function(){return!1})}#$e=void fF(this,"isVisible");timeoutId=null;show(e,t=3e3){this.message=e,this.isVisible=!0,this.timeoutId&&clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isVisible=!1},t)}},mB=a({getDistance:()=>yB});function yB(e,t,n,r){const i=e*Math.PI/180,s=n*Math.PI/180,o=(n-e)*Math.PI/180,a=(r-t)*Math.PI/180,l=Math.sin(o/2)*Math.sin(o/2)+Math.cos(i)*Math.cos(s)*Math.sin(a/2)*Math.sin(a/2);return 2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l))*6371e3}var vB=a({getIcon:()=>_B,isIconFilled:()=>xB}),bB={activity:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-activity"><polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline></svg>',angelfish:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M14.94 8.78C13.95 5.9 10.78 1 4.65 1C1.57 1 0 2.18 0 2.18L0.56 2.19C1.42 2.23 3.04 2.33 3.93 2.71C4.02 2.75 4.1 2.82 4.15 2.9L4.22 3.04C4.46 3.55 4.88 4.73 4.28 5.96C4.16 6.18 3.9 6.28 3.67 6.2L3.33 6.09C2.71 5.88 1.79 5.5 1.07 4.97C0.81 4.78 0.44 4.85 0.37 5.16C0.07 6.42 0.07 8.58 0.37 9.84C0.44 10.15 0.81 10.22 1.07 10.03C1.94 9.39 3.08 8.98 3.67 8.8C3.9 8.72 4.16 8.82 4.28 9.04C4.94 10.4 4.37 11.68 4.15 12.1C4.1 12.18 4.02 12.25 3.93 12.29C2.68 12.82 0 12.82 0 12.82C0.58 13.21 2.56 14 5.81 14C11.01 14 13.91 10.86 14.8 9.7C15 9.44 15.06 9.08 14.94 8.78ZM10.46 9.13C9.65 9.13 9 8.48 9 7.68C9 6.88 9.65 6.23 10.46 6.23C11.26 6.23 11.91 6.88 11.91 7.68C11.91 8.48 11.26 9.13 10.46 9.13Z"/>\n</svg>',"arrow-left":'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>',barbell:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M4 3.5c-0.5 0 -1 0.5 -1 1v2.5h-0.5v-1.25c0 -0.41 -0.4 -0.75 -0.75 -0.75s-0.75 0.34 -0.75 0.75v1.25h-0.5c-0.28 0 -0.5 0.26 -0.5 0.5s0.22 0.5 0.5 0.5h0.5v1.25c0 0.41 0.4 0.75 0.75 0.75s0.75 -0.34 0.75 -0.75v-1.25h0.5v2.5c0 0.5 0.5 1 1 1s1 -0.5 1 -1v-2.5h5v2.5c0 0.5 0.5 1 1 1s1 -0.5 1 -1v-2.5h0.5v1.25c0 0.41 0.4 0.75 0.75 0.75s0.75 -0.34 0.75 -0.75v-1.25h0.5c0.28 0 0.5 -0.26 0.5 -0.5s-0.22 -0.5 -0.5 -0.5h-0.5v-1.25c0 -0.41 -0.4 -0.75 -0.75 -0.75s-0.75 0.34 -0.75 0.75v1.25h-0.5v-2.5c0 -0.5 -0.5 -1 -1 -1s-1 0.5 -1 1v2.5h-5v-2.5c0 -0.48 -0.5 -1 -1 -1z"/>\n</svg>',banknote:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M1 3C0.45 3 0 3.45 0 4v7c0 0.55 0.45 1 1 1h13c0.55 0 1 -0.45 1 -1V4c0 -0.55 -0.45 -1 -1 -1H1zM1 4h1.5C2.78 4 3 4.22 3 4.5S2.78 5 2.5 5S2 4.78 2 4.5L1.5 5C1.78 5 2 5.22 2 5.5S1.78 6 1.5 6S1 5.78 1 5.5V4zM7.5 4C8.88 4 10 5.57 10 7.5l0 0C10 9.43 8.88 11 7.5 11S5 9.43 5 7.5S6.12 4 7.5 4zM12.5 4H14v1.5C14 5.78 13.78 6 13.5 6S13 5.78 13 5.5S13.22 5 13.5 5L13 4.5C13 4.78 12.78 5 12.5 5S12 4.78 12 4.5S12.22 4 12.5 4zM7.5 5.5c-0.32 0 -0.53 0.11 -0.68 0.25h1.36C8.03 5.61 7.82 5.5 7.5 5.5zM6.63 6C6.58 6.09 6.56 6.17 6.54 6.25h1.91C8.44 6.17 8.42 6.09 8.38 6H6.63zM6.5 6.5v0.25h2V6.5H6.5zM6.5 7v0.25h2V7H6.5zM6.5 7.5v0.25h2V7.5H6.5zM6.5 8L6.25 8.25h2L8.5 8H6.5zM6 8.5c0 0 0.04 0.1 0.1 0.25H8.38L8 8.5H6zM1.5 9C1.78 9 2 9.22 2 9.5S1.78 10 1.5 10L2 10.5C2 10.22 2.22 10 2.5 10S3 10.22 3 10.5S2.78 11 2.5 11H1V9.5C1 9.22 1.22 9 1.5 9zM6.24 9C6.28 9.09 6.31 9.16 6.38 9.25h2.27C8.71 9.11 8.75 9 8.75 9H6.24zM13.5 9C13.78 9 14 9.22 14 9.5V11h-1.5c-0.28 0 -0.5 -0.22 -0.5 -0.5s0.22 -0.5 0.5 -0.5s0.5 0.22 0.5 0.5l0.5 -0.5C13.22 10 13 9.78 13 9.5S13.22 9 13.5 9zM6.57 9.5c0.08 0.09 0.16 0.18 0.26 0.25h1.42C8.35 9.67 8.43 9.59 8.5 9.5H6.57z"/>\n</svg>',"badge-shield-with-fire":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M11.5 0L14.5 2.76C14.02 3.54 12.92 4.69 12.92 5.71C12.92 6.45 13.21 7.15 13.47 7.77C13.69 8.31 14.13 8.92 14.13 9.56C14.13 11.85 12.25 12.57 10.47 13.47L9.83 13.8C8.98 14.23 8.22 14.25 7.5 15C6.78 14.25 6.02 14.23 5.17 13.8L4.53 13.47C2.75 12.57 0.87 11.85 0.87 9.56C0.87 8.92 1.3 8.31 1.53 7.77C1.79 7.15 2.08 6.45 2.08 5.71C2.08 4.69 1.05 3.47 0.5 2.76L3.5 0C3.87 0.39 4.74 1.29 5.5 1.29C6.26 1.29 7.12 0.41 7.5 0C7.86 0.39 8.74 1.29 9.5 1.29C10.26 1.29 11.1 0.43 11.5 0ZM7.5 2.5C4.64 3.39 3.5 6.07 3.5 8.21C3.5 10.36 4.9 11.97 6.7 12.5C5.1 10.17 5.1 8.21 7.5 6.79C7.1 7.75 7.5 9.64 8.3 10.36C8.65 10.07 9.1 9.34 9.1 8.93C10.7 10.36 9.55 11.52 9.1 12.5C9.97 12.1 11.5 11.07 11.5 8.93C11.5 6.79 9.9 6.07 9.9 3.93C8.79 4.36 8.3 5.36 8.3 6.07C7.54 5.67 6.7 4.1 7.5 2.5Z"/>\n</svg>',"beach-umbrella-in-ground":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M5.36 1.67l-0.01 4.02a4.45 4.45 0 0 0 -1.1 -0.11c-0.37 0.1 -0.74 0.63 -1.1 0.76A4.2 4.2 0 0 1 5.36 1.67Zm2.41 -0.64l2.03 3.45a3.18 3.18 0 0 1 0.84 -0.61c0.36 -0.1 0.94 0.17 1.34 0.11A4.2 4.2 0 0 0 7.77 1.03ZM1 13h13c-0.66 -0.66 -2.64 -1.11 -4.34 -1.33l-1.87 -7c0.52 -0.05 1.15 0.03 1.53 0l-2.11 -3.6h-0.01a6.17 6.17 0 0 0 -0.7 0.14a4.38 4.38 0 0 0 -0.64 0.22l-0.01 4.15c0.35 -0.17 0.84 -0.54 1.3 -0.74l1.8 6.74c-0.58 -0.05 -1.09 -0.08 -1.45 -0.08C6.03 11.5 2 12 1 13Z"/>\n</svg>',"beer-mug-with-foam":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M3.21 0C2.14 0 1.07 1.07 1.07 2.14L1.07 12.86C1.07 13.93 0 15 0 15L11.79 15C11.79 15 10.71 13.93 10.71 12.86L13.93 12.86C15 12.86 15 11.79 15 11.79L15 5.36C15 4.29 13.93 3.21 12.86 3.21L10.71 3.21L10.71 2.14C10.71 0.81 9.93 0 8.57 0L3.21 0ZM4.29 1.07L7.5 1.07C8.98 1.07 9.64 1.45 9.64 2.14C6.43 2.14 4.13 2.35 4.29 5.36C4.29 7.5 2.14 7.5 2.14 5.36L2.14 3.21C2.14 1.6 2.67 1.07 4.29 1.07ZM10.71 4.82L11.79 4.82C12.53 4.82 13.39 4.85 13.39 6.43L13.39 11.25L10.71 11.25L10.71 4.82ZM2.14 12.86L9.64 12.86L9.64 13.93L2.14 13.93L2.14 12.86Z"/>\n</svg>',bookmark:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bookmark"><path d="M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"></path></svg>',"boxing-glove-up":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M5.63 0.01C4.37 0.1 3.36 1.31 3.46 2.56C3.47 3.03 3.44 3.5 3.48 3.96C3.69 4.42 4.35 4.06 4.72 4.3C5.69 4.56 6.15 5.64 6.08 6.57C6.05 6.84 6.18 7.23 5.83 7.34C5.37 7.46 5.34 6.93 5.38 6.62C5.41 6.03 5.33 5.37 4.78 5.04C4 4.51 2.76 4.92 2.56 5.87C2.47 6.6 2.53 7.34 2.52 8.07C2.47 9.38 3.66 10.56 4.97 10.49C6.75 10.48 8.53 10.51 10.31 10.48C11.59 10.39 12.6 9.16 12.48 7.89C12.48 6 12.5 4.1 12.47 2.21C12.39 1 11.27 0 9.92 0.01C8.57 0.01 7.1 -0.02 5.63 0.01ZM4.04 11.61V15H10.81V11.61Z"/>\n</svg>',"burger-and-drink-cup-with-straw":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M14.67 4.55L13.49 13.8L9.5 13.8L8.32 4.5L13.19 4.5L14.16 1.18L14.7 1.34L13.78 4.54L14.67 4.55L14.67 4.55ZM7.76 9.9C7.76 9.9 7.91 8.7 5.84 8.7L2.55 8.7C0.49 8.7 0.63 9.9 0.63 9.9L7.76 9.9L7.76 9.9ZM0.63 12.6C0.63 12.6 0.48 13.8 2.55 13.8L5.84 13.8C7.91 13.8 7.76 12.6 7.76 12.6L0.63 12.6L0.63 12.6ZM7.45 12C7.79 12 8.06 11.67 8.06 11.25C8.06 10.83 7.79 10.5 7.45 10.5L0.91 10.5C0.58 10.5 0.3 10.83 0.3 11.25C0.3 11.67 0.58 12 0.91 12L7.45 12Z"/>\n</svg>',bridge:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M15 6C13.9 6 13 6.9 13 8L13 12L9.5 12L9.5 8C9.5 6.9 8.6 6 7.5 6C6.4 6 5.5 6.9 5.5 8L5.5 12L2 12L2 8C2 6.9 1.1 6 0 6L0 3L15 3L15 6Z"/>\n</svg>',bus:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M2 3C2 1.9 2.9 1 4 1L11 1C12.1 1 13 1.9 13 3L13 11C13 12 12 12 12 12L12 13C12 13 12 14 11 14C10 14 10 13 10 13L10 12L5 12L5 13C5 13 5 14 4 14C3 14 3 13 3 13L3 12C2 12 2 11 2 11L2 7.2L2 3ZM3.5 2.5C3.22 2.5 3 2.72 3 3L3 7C3 7.28 3.22 7.5 3.5 7.5L11.5 7.5C11.78 7.5 12 7.28 12 7L12 3C12 2.72 11.78 2.5 11.5 2.5L3.5 2.5ZM4 9C3.45 9 3 9.45 3 10C3 10.55 3.45 11 4 11C4.55 11 5 10.55 5 10C5 9.45 4.55 9 4 9ZM11 9C10.45 9 10 9.45 10 10C10 10.55 10.45 11 11 11C11.55 11 12 10.55 12 10C12 9.45 11.55 9 11 9Z"/>\n</svg>',camera:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M6 2C5.45 2 5.25 2.5 5 3L4.5 4h-2C1.67 4 1 4.67 1 5.5v5C1 11.33 1.67 12 2.5 12h10c0.83 0 1.5 -0.67 1.5 -1.5v-5C14 4.67 13.33 4 12.5 4h-2L10 3C9.75 2.5 9.55 2 9 2H6zM2.5 5C2.78 5 3 5.22 3 5.5S2.78 6 2.5 6S2 5.78 2 5.5S2.22 5 2.5 5zM7.5 5c1.66 0 3 1.34 3 3s-1.34 3 -3 3s-3 -1.34 -3 -3S5.84 5 7.5 5zM7.5 6.5C6.67 6.5 6 7.17 6 8l0 0c0 0.83 0.67 1.5 1.5 1.5l0 0C8.33 9.5 9 8.83 9 8l0 0C9 7.17 8.33 6.5 7.5 6.5L7.5 6.5z"/>\n</svg>',"feather-camera":'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-camera"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"></path><circle cx="12" cy="13" r="4"></circle></svg>',"check-square":'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-square"><polyline points="9 11 12 14 22 4"></polyline><path d="M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11"></path></svg>',"chevron-left":'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-left"><polyline points="15 18 9 12 15 6"></polyline></svg>',"chevron-right":'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>',"cigarette-with-smoke-curl":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M13 12L12 12L12 15L13 15L13 12ZM13.93 10.71C13.21 9.64 11.79 8.57 11.79 7.5C11.79 6.43 15 5.36 15 3.21C15 1.07 12.86 1.07 10.71 0C11.07 1.43 12.86 2.14 12.86 3.21C11.79 4.29 9.64 5.36 9.64 7.5C9.64 9.64 10.71 9.64 13.93 10.71ZM15 12L14 12L14 15L15 15L15 12ZM0 15L11 15L11 12L0 12L0 15Z"/>\n</svg>',"city-gate":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M0 1.07L0 4.29L15 4.29L15 1.07L12.86 1.07L12.86 3.21L10.71 3.21L10.71 1.07L8.57 1.07L8.57 3.21L6.43 3.21L6.43 1.07L4.29 1.07L4.29 3.21L2.14 3.21L2.14 1.07L0 1.07ZM0 5.36L0 13.93L2.68 13.93C2.68 10.71 3.74 6.96 7.5 6.96C11.15 6.94 12.32 10.71 12.32 13.93L15 13.93L15 5.36L0 5.36ZM7.5 8.57C5.36 8.57 4.29 10.71 4.29 13.93L10.71 13.93C10.71 10.71 9.64 8.57 7.5 8.57Z"/>\n</svg>',climbing_wall:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12.11 0.55L2.9 0c-0.47 0 -0.85 0.43 -0.85 0.95v14.05l10.9 -2.13V1.5c0 -0.52 -0.38 -0.95 -0.84 -0.95ZM9.59 4c0.28 -0.31 0.75 -0.34 1.06 -0.06c0.31 0.28 0.34 0.75 0.06 1.06l-1.06 0.06c-0.31 -0.28 -0.34 -0.75 -0.06 -1.06ZM4.96 7.31l-1.05 0.19c-0.34 -0.24 -0.43 -0.71 -0.19 -1.05s0.71 -0.43 1.05 -0.19s0.43 0.71 0.19 1.05ZM5.22 3.19c-0.12 -0.25 0 -0.55 0.25 -0.66c0.25 -0.11 0.53 -0.01 0.65 0.22c0.1 0.07 0.41 0.05 0.56 -0.02c0 -0.22 0.13 -0.43 0.35 -0.5c0.26 -0.08 0.54 0.06 0.63 0.33c0.12 0.38 -0.03 0.88 -0.65 1.11c-0.21 0.08 -0.44 0.12 -0.66 0.12c-0.48 0 -0.93 -0.19 -1.13 -0.6ZM7.67 12.09l-1.05 0.19c-0.34 -0.24 -0.43 -0.71 -0.19 -1.05s0.71 -0.43 1.05 -0.19s0.43 0.71 0.19 1.05ZM10.74 9.06c-0.21 0.08 -0.44 0.12 -0.66 0.12c-0.48 0 -0.93 -0.19 -1.13 -0.6c-0.12 -0.25 0 -0.55 0.25 -0.66c0.24 -0.11 0.53 -0.01 0.65 0.22c0.1 0.07 0.41 0.05 0.56 -0.02c0 -0.22 0.13 -0.43 0.35 -0.5c0.26 -0.08 0.54 0.06 0.63 0.33c0.12 0.38 -0.03 0.88 -0.65 1.11Z"/>\n</svg>',check:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check"><polyline points="20 6 9 17 4 12"></polyline></svg>',"alert-circle":'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-alert-circle"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="12"></line><line x1="12" y1="16" x2="12.01" y2="16"></line></svg>',"alert-triangle":'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-alert-triangle"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>',"classical-building":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7.5 0L1 3.5V4h13V3.5L7.5 0zM2 5v5l-1 1.6V13h13v-1.4L13 10V5H2zM4 6h1v5.5H4V6zM7 6h1v5.5H7V6zM10 6h1v5.5h-1V6z"/>\n</svg>',"classical-building-with-clock":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M13 4H9l0 -3L7.5 0L6 1v3H2L1 5v1h13V5L13 4zM7.5 1.5c0.4 0 0.7 0.3 0.7 0.8S7.9 3 7.5 3S6.7 2.7 6.7 2.2C6.7 1.8 7.1 1.5 7.5 1.5zM13 7H2v4l-1 1.5V14h13v-1.5L13 11V7zM5 12.5H4V8h1V12.5zM8 12.5H7V8h1V12.5zM11 12.5h-1V8h1V12.5z"/>\n</svg>',"classical-building-with-dome-and-flag":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7 1L9 0L11 1L13 0L13 3L11 4L9 3L8 3.5L8 5L7 5L7 1ZM2.5 9L12.5 9L12.5 15L2.5 15L2.5 9ZM4 10L4 14L5 14L5 10L4 10ZM7 10L7 14L8 14L8 10L7 10ZM10 10L10 14L11 14L11 10L10 10ZM2.5 8.5C2.75 5.97 4.89 4 7.5 4C10.11 4 12.25 5.97 12.5 8.5L2.5 8.5Z"/>\n</svg>',"classical-building-with-flag":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7 4.17L7 1L9 0L11 1L13 0L13 3L11 4L9 3L8 3.5L8 4.17L13.5 6L13.5 7L1.5 7L1.5 6L7 4.17ZM2.5 7.5L12.5 7.5L12.5 12L13.5 13L13.5 14L1.5 14L1.5 13L2.5 12L2.5 7.5ZM4 8.5L4 12.5L5 12.5L5 8.5L4 8.5ZM7 8.5L7 12.5L8 12.5L8 8.5L7 8.5ZM10 8.5L10 12.5L11 12.5L11 8.5L10 8.5Z"/>\n</svg>',"commercial-building":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M14 6h-13c0.09 -1.38 0.43 -2.74 1 -4h11c0.57 1.26 0.91 2.62 1 4zm-11 1h9v6h-1v-5h-3v5h-5zm1 3h3v-2h-3z"/>\n</svg>',"clothes-hanger":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M6.75 7.14L6.75 5.5C6.75 5.09 7.09 4.75 7.5 4.75C8.19 4.75 8.75 4.19 8.75 3.5C8.75 2.81 8.19 2.25 7.5 2.25C6.81 2.25 6.25 2.81 6.25 3.5C6.25 3.91 5.91 4.25 5.5 4.25C5.09 4.25 4.75 3.91 4.75 3.5C4.75 1.98 5.98 0.75 7.5 0.75C9.02 0.75 10.25 1.98 10.25 3.5C10.25 4.76 9.4 5.82 8.25 6.15L8.25 7.14L14.3 12.03C14.59 12.26 14.76 12.62 14.76 13C14.76 13.69 14.2 14.25 13.51 14.25L1.49 14.25C1.11 14.25 0.75 14.08 0.51 13.79C0.08 13.25 0.16 12.46 0.7 12.03L6.75 7.14ZM12.81 12.75L7.5 8.46L2.19 12.75L12.81 12.75Z"/>\n</svg>',cleaver:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12.44 4.2L13.28 4.74C12.92 6.09 12.46 7.19 11.92 8.03C11.24 9.08 10.14 10.15 8.63 11.26L9.47 11.8C10.98 10.7 12.07 9.62 12.75 8.57C13.44 7.52 13.97 6.09 14.37 4.26L9.33 0.99L8.79 0.63C8.33 0.33 7.71 0.46 7.4 0.93C7.35 1.01 7.31 1.09 7.28 1.19C6.98 2.22 6.65 3.08 6.3 3.78C5.81 4.76 4.9 6.16 3.57 7.98L7.79 10.71C9.3 9.61 10.4 8.53 11.08 7.48C11.62 6.64 12.08 5.54 12.44 4.2ZM9.42 2.23C9.88 2.53 10.01 3.15 9.71 3.62C9.41 4.08 8.79 4.21 8.33 3.91C7.87 3.61 7.73 2.99 8.04 2.53C8.34 2.06 8.96 1.93 9.42 2.23ZM3.33 8.41L0.88 12.19C0.42 12.88 0.62 13.81 1.32 14.26C1.97 14.68 2.82 14.53 3.29 13.94L3.38 13.82L3.65 13.39C3.31 12.81 3.33 12.07 3.7 11.5L5 9.5L3.33 8.41Z"/>\n</svg>',cloth:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12.98 2.1C8.07 2.06 7.02 0.78 4.93 0.78C2.45 0.78 0.99 1.46 0.37 1.85C-0.1 2.1 0.01 1.62 0.01 1.45C0.01 1.28 0.29 1.12 0.29 1.12C0.86 0.75 2.34 0 4.93 0C7.02 0 8.08 1.28 13 1.32C13 1.32 13.37 1.28 13.37 1.62C13.37 1.95 13.35 2.1 12.98 2.1ZM13.37 14.52C13.37 14.18 13 14.22 13 14.22C8.08 14.19 7.02 12.9 4.93 12.9C2.34 12.9 0.86 13.65 0.29 14.02C0.29 14.02 0.01 14.18 0.01 14.35C0.01 14.52 -0.1 15 0.37 14.75C0.99 14.37 2.45 13.68 4.93 13.68C7.02 13.68 8.07 14.96 12.98 15C13.35 15 13.37 14.85 13.37 14.52ZM13.37 3.21C13.37 2.87 13 2.91 13 2.91C8.08 2.88 7.02 1.59 4.93 1.59C2.34 1.59 0.86 2.34 0.29 2.71C0.29 2.71 0.01 2.87 0.01 3.04L0.01 12.74C0.01 12.91 -0.1 13.39 0.37 13.14C0.99 12.75 2.45 12.07 4.93 12.07C7.02 12.07 8.07 13.35 12.98 13.39C13.35 13.39 13.37 13.24 13.37 12.91L13.37 3.21Z"/>\n</svg>',cocktail:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7.5 1c-2 0 -7 0.25 -6.5 0.75L7 8v4c0 1 -3 0.5 -3 2h7c0 -1.5 -3 -1 -3 -2V8l6 -6.25C14.5 1.25 9.5 1 7.5 1zM7.5 2c2.5 0 4.75 0.25 4.75 0.25L11.5 3h-8L2.75 2.25C2.75 2.25 5 2 7.5 2z"/>\n</svg>',clock:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-clock"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>',"coffee-bean":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M13.5 1C14 0.5 6.5 0 3 3.5C1 5.5 0 8.5 0 10C0 12 1 15 3 15C10 15 12.5 9.5 13.5 7.5C14.5 5.5 15 1.5 14 1.5C13.5 1.5 11 3 10 4C9 5 9 7 8 8C7 9 5.5 9 4.5 10C3.5 11 2 12.5 2 12.5C2 12.5 2.5 10 3.5 9C4.5 8 5.5 8 6.5 7C7.5 6 8 4 9 3C10 2 13 1.5 13.5 1z"/>\n</svg>',"comedy-mask-and-tragedy-mask":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M2 1c0 0 -1 0 -1 1v5.16C1 8.89 1.35 11 4.5 11H5V8L2.5 9c0 0 0 -2.5 2.5 -2.5V5c0 -0.71 0.09 -1.32 0.5 -1.78C5.88 2.81 6.5 1.97 8.16 2.75L9 3.3V2c0 0 0 -1 -1 -1C7.29 1 6.02 2 5 2S2.79 1 2 1zM3 3c0.55 0 1 0.45 1 1S3.55 5 3 5S2 4.55 2 4S2.45 3 3 3zM7 4c0 0 -1 0 -1 1v5c0 2 1 4 4 4s4 -2 4 -4V5c0 -1 -1 -1 -1 -1c-0.71 0 -1.98 1 -3 1S7.79 4 7 4zM8 6c0.55 0 1 0.45 1 1S8.55 8 8 8S7 7.55 7 7S7.45 6 8 6zM12 6c0.55 0 1 0.45 1 1s-0.45 1 -1 1s-1 -0.45 -1 -1S11.45 6 12 6zM7.5 10H10h2.5c0 0 0 2.5 -2.5 2.5S7.5 10 7.5 10z"/>\n</svg>',croissant:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M5.29 4.38L6 9.5a0.98 0.98 0 0 0 1 1H8a0.98 0.98 0 0 0 1 -1l0.71 -5.12C9.71 3 7.5 3 7.5 3S5.29 3 5.29 4.38ZM3.5 5C2 5 2 6 2 6l1 4H4.5a0.79 0.79 0 0 0 0.79 -0.76L4.5 5Zm-2 2.5a1.53 1.53 0 0 0 -1.06 0.41A1.37 1.37 0 0 0 0 8.79V11H0.88A1.02 1.02 0 0 0 2 10ZM11.5 5C13 5 13 6 13 6l-1 4H10.5a0.79 0.79 0 0 1 -0.79 -0.76L10.5 5Zm2 2.5a1.53 1.53 0 0 1 1.06 0.41A1.37 1.37 0 0 1 15 8.79V11h-0.88A1.02 1.02 0 0 1 13 10Z"/>\n</svg>',"cup-and-saucer":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12 5h-2V3H2v4c0.01 2.21 1.81 3.99 4.02 3.98C7.43 10.97 8.74 10.22 9.45 9H12c1.1 0 2 -0.9 2 -2S13.1 5 12 5zM12 8H9.86C9.95 7.67 10 7.34 10 7V6h2c0.55 0 1 0.45 1 1S12.55 8 12 8zM10 12.5c0 0.28 -0.22 0.5 -0.5 0.5h-7C2.22 13 2 12.78 2 12.5S2.22 12 2.5 12h7C9.78 12 10 12.22 10 12.5z"/>\n</svg>',database:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-database"><ellipse cx="12" cy="5" rx="9" ry="3"></ellipse><path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"></path><path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"></path></svg>',donut:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7.5 0C11.64 0 15 3.36 15 7.5C15 11.64 11.64 15 7.5 15C3.36 15 0 11.64 0 7.5C0 3.36 3.36 0 7.5 0zM7.21 11.12C7.12 10.88 6.35 11.16 6.42 11.38C6.48 11.61 6.83 12.78 6.93 13.04C7.02 13.3 7.83 13.04 7.75 12.78C7.67 12.53 7.3 11.35 7.21 11.12zM3.51 11.31C3.24 11.22 3 12.06 3.23 12.16C3.47 12.27 4.67 12.65 4.88 12.7C5.09 12.75 5.39 11.98 5.15 11.88C4.99 11.8 3.77 11.4 3.51 11.31zM9.7 10.98C9.47 10.89 9.12 11.66 9.39 11.79C9.69 11.92 10.75 12.33 11 12.41C11.25 12.48 11.61 11.73 11.31 11.6C11.02 11.47 9.93 11.07 9.7 10.98zM11.32 9.23C11.05 9.19 10.91 10.04 11.2 10.09C11.48 10.14 12.67 10.32 12.91 10.33C13.16 10.34 13.29 9.51 13.03 9.47C12.78 9.44 11.59 9.28 11.32 9.23zM7.5 5.19C6.23 5.19 5.19 6.23 5.19 7.5C5.19 8.78 6.23 9.81 7.5 9.81C8.78 9.81 9.81 8.78 9.81 7.5C9.81 6.23 8.78 5.19 7.5 5.19zM2.64 8.65C2.42 8.64 2.31 9.49 2.55 9.52C2.8 9.55 3.99 9.68 4.27 9.7C4.56 9.72 4.59 8.86 4.37 8.84C4.14 8.81 2.86 8.67 2.64 8.65zM12.74 6.37C12.65 6.64 12.2 7.86 12.12 8.07C12.05 8.28 12.86 8.54 12.95 8.31C13.05 8.08 13.42 6.94 13.5 6.67C13.58 6.41 12.83 6.11 12.74 6.37zM2.74 5.57C2.54 5.73 1.6 6.61 1.42 6.77C1.25 6.93 1.8 7.58 1.97 7.44C2.14 7.3 3.03 6.46 3.24 6.26C3.44 6.06 2.93 5.41 2.74 5.57zM11.71 3.53C11.59 3.35 10.86 3.69 10.99 3.94C11.13 4.19 11.71 5.25 11.83 5.45C11.95 5.66 12.71 5.24 12.59 5.03C12.47 4.83 11.84 3.72 11.71 3.53zM7.96 3.47C7.77 3.41 7.46 4.2 7.69 4.29C7.92 4.39 9.08 4.75 9.34 4.83C9.59 4.91 9.84 4.09 9.61 4.01C9.38 3.92 8.15 3.54 7.96 3.47zM2.66 3.53C2.28 3.52 2.31 4.39 2.57 4.41C2.83 4.42 4.07 4.52 4.3 4.53C4.56 4.53 4.69 3.64 4.41 3.63C4.21 3.61 3.03 3.55 2.66 3.53zM5.09 1.48C4.94 1.38 4.34 1.99 4.55 2.16C4.77 2.33 5.71 3.09 5.92 3.22C6.13 3.36 6.65 2.72 6.45 2.54C6.25 2.36 5.25 1.59 5.09 1.48zM9.44 1.16C9.19 1.19 7.97 1.39 7.73 1.43C7.48 1.47 7.61 2.31 7.86 2.28C8.11 2.25 9.34 2.07 9.57 2.01C9.8 1.95 9.68 1.13 9.44 1.16z"/>\n</svg>',edit:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>',eyeglasses:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M1.78 3.81C2.03 3.31 2.54 3 3.1 3C3.49 3 3.86 3.15 4.14 3.43L4.85 4.15C5.05 4.34 5.05 4.66 4.85 4.85C4.66 5.05 4.34 5.05 4.15 4.85L3.43 4.14C3.34 4.05 3.22 4 3.1 4C2.92 4 2.76 4.1 2.68 4.26L1.31 7H5.25C6.07 7 6.75 7.57 6.94 8.32C7.11 8.28 7.3 8.25 7.5 8.25C7.7 8.25 7.89 8.28 8.06 8.32C8.25 7.57 8.93 7 9.75 7H13.69L12.32 4.26C12.24 4.1 12.08 4 11.9 4C11.78 4 11.66 4.05 11.57 4.14L10.85 4.85C10.66 5.05 10.34 5.05 10.15 4.85C9.95 4.66 9.95 4.34 10.15 4.15L10.86 3.43C11.14 3.15 11.51 3 11.9 3C12.46 3 12.97 3.31 13.22 3.81L14.94 7.26L14.94 7.26C14.98 7.33 15 7.41 15 7.5V8.5C15 8.78 14.78 9 14.5 9H14V9.5C14 11.09 13 12 11.25 12H10.75C9 12 8 11.09 8 9.5V9.34C7.85 9.29 7.67 9.25 7.5 9.25C7.33 9.25 7.15 9.29 7 9.34V9.5C7 11.09 6 12 4.25 12H3.75C2 12 1 11.09 1 9.5V9H0.5C0.22 9 0 8.78 0 8.5V7.5C0 7.41 0.02 7.33 0.06 7.26L0.06 7.26L1.78 3.81ZM9.75 8C9.34 8 9 8.34 9 8.75V9.5C9 10.2 9.2 11 10.75 11H11.25C12.8 11 13 10.2 13 9.5V8.75C13 8.34 12.66 8 12.25 8H9.75ZM2.75 8C2.34 8 2 8.34 2 8.75V9.5C2 10.2 2.2 11 3.75 11H4.25C5.8 11 6 10.2 6 9.5V8.75C6 8.34 5.66 8 5.25 8H2.75Z"/>\n</svg>',facebook:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-facebook"><path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z"></path></svg>',"fancy-mirror-with-reflection-and-stars":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7.54 0C6.14 0 4.99 0.86 4.31 2.04C3.49 2.19 2.71 2.54 2.13 3.18C1.5 3.89 1.14 4.91 1.17 6.17C1.21 7.51 1.86 8.59 2.45 9.59C3.05 10.58 3.58 11.48 3.66 12.45C3.68 12.73 3.9 12.97 4.18 13.01C4.18 13.02 4.21 13.04 4.26 13.11C4.36 13.26 4.52 13.53 4.75 13.82C5.22 14.4 6.09 15.02 7.55 15C8.99 14.98 9.83 14.37 10.27 13.81C10.49 13.53 10.63 13.27 10.74 13.14C10.84 13.01 10.84 13.02 10.89 13.01C11.19 12.97 11.42 12.71 11.42 12.4C11.42 11.35 11.94 10.38 12.53 9.38C13.12 8.39 13.81 7.38 13.83 6.16C13.86 4.06 12.52 2.48 10.78 2.07C10.11 0.87 8.95 0 7.54 0ZM7.62 1.24C8.59 1.27 9.44 1.9 9.88 2.85C9.97 3.03 10.14 3.16 10.34 3.2C11.62 3.41 12.62 4.46 12.59 6.15C12.58 6.87 12.08 7.74 11.47 8.75C10.92 9.69 10.35 10.79 10.25 12.08C10.09 12.19 9.86 12.26 9.76 12.38C9.57 12.63 9.45 12.86 9.3 13.05C9 13.43 8.69 13.75 7.53 13.77C6.38 13.78 6.03 13.44 5.71 13.05C5.56 12.85 5.43 12.63 5.25 12.39C5.15 12.24 4.98 12.09 4.78 11.97C4.59 10.82 4.04 9.83 3.51 8.95C2.93 7.97 2.43 7.08 2.41 6.14C2.38 5.12 2.65 4.46 3.05 4.01C3.45 3.55 4.03 3.28 4.72 3.19C4.93 3.16 5.11 3.03 5.2 2.84C5.64 1.9 6.48 1.28 7.44 1.24L7.16 1.77L6.36 1.86L6.92 2.44L6.76 3.23L7.48 2.87L8.18 3.27L8.07 2.47L8.66 1.93L7.87 1.79L7.62 1.24ZM7.54 3.9C6.34 3.9 6.25 4.24 5.36 6.58C4.8 8.08 5.36 9.02 6.16 9.49C5.68 9.88 5.31 10.46 5.12 11.16C7.11 13.76 8.56 12.67 9.95 11.17C9.77 10.45 9.38 9.86 8.89 9.47C9.64 8.98 10.18 8.03 9.71 6.58C8.99 4.31 8.74 3.9 7.54 3.9ZM4.1 4.63L3.77 5.04L3.24 5L3.53 5.44L3.34 5.93L3.84 5.79L4.24 6.12L4.27 5.6L4.71 5.32L4.22 5.14L4.1 4.63ZM10.64 6.06L10.59 6.42L10.26 6.59L10.59 6.74L10.65 7.11L10.91 6.84L11.27 6.9L11.09 6.57L11.26 6.25L10.9 6.31L10.64 6.06Z"/>\n</svg>',"family-restroom-symbol":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M4 3L2 3L0.5 11L2 11L2 15L4 15L4 11L5.5 11L4 3ZM14 3.5L13 3L11 3L10 3.5L10 9.5L11 9.5L11 15L13 15L13 9.5L14 9.5L14 3.5ZM12.25 2.5L11.75 2.5C11.13 2.5 10.75 2.13 10.75 1.5L10.75 1C10.75 0.38 11.13 0 11.75 0L12.38 0C12.88 0 13.25 0.38 13.25 1L13.25 1.63C13.25 2.13 12.88 2.5 12.25 2.5ZM3.25 2.5L2.75 2.5C2.13 2.5 1.75 2.13 1.75 1.5L1.75 1C1.75 0.38 2.13 0 2.75 0L3.38 0C3.88 0 4.25 0.38 4.25 1L4.25 1.63C4.25 2.13 3.88 2.5 3.25 2.5ZM7.73 7.31L7.27 7.31C6.68 7.31 6.33 6.96 6.33 6.38L6.33 5.92C6.33 5.35 6.68 5 7.27 5L7.85 5C8.32 5 8.67 5.35 8.67 5.92L8.67 6.5C8.67 6.96 8.32 7.31 7.73 7.31ZM9 8.75L8 7.75L7 7.75L6 8.75L6 12.5L7 15L8 15L9 12.5L9 8.75Z"/>\n</svg>',film:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M2 1C1.45 1 1 1.45 1 2L1 13C1 13.55 1.45 14 2 14L13 14C13.55 14 14 13.55 14 13L14 2C14 1.45 13.55 1 13 1L2 1ZM2.25 2L2.75 2C2.89 2 3 2.11 3 2.25L3 2.75C3 2.89 2.89 3 2.75 3L2.25 3C2.11 3 2 2.89 2 2.75L2 2.25C2 2.11 2.11 2 2.25 2ZM4 2L11 2L11 7L4 7L4 2ZM12.25 2L12.75 2C12.89 2 13 2.11 13 2.25L13 2.75C13 2.89 12.89 3 12.75 3L12.25 3C12.11 3 12 2.89 12 2.75L12 2.25C12 2.11 12.11 2 12.25 2ZM2.25 4L2.75 4C2.89 4 3 4.11 3 4.25L3 4.75C3 4.89 2.89 5 2.75 5L2.25 5C2.11 5 2 4.89 2 4.75L2 4.25C2 4.11 2.11 4 2.25 4ZM12.25 4L12.75 4C12.89 4 13 4.11 13 4.25L13 4.75C13 4.89 12.89 5 12.75 5L12.25 5C12.11 5 12 4.89 12 4.75L12 4.25C12 4.11 12.11 4 12.25 4ZM2.25 6L2.75 6C2.89 6 3 6.11 3 6.25L3 6.75C3 6.89 2.89 7 2.75 7L2.25 7C2.11 7 2 6.89 2 6.75L2 6.25C2 6.11 2.11 6 2.25 6ZM12.25 6L12.75 6C12.89 6 13 6.11 13 6.25L13 6.75C13 6.89 12.89 7 12.75 7L12.25 7C12.11 7 12 6.89 12 6.75L12 6.25C12 6.11 12.11 6 12.25 6ZM2.25 8L2.75 8C2.89 8 3 8.11 3 8.25L3 8.75C3 8.89 2.89 9 2.75 9L2.25 9C2.11 9 2 8.89 2 8.75L2 8.25C2 8.11 2.11 8 2.25 8ZM4 8L11 8L11 13L4 13L4 8ZM12.25 8L12.75 8C12.89 8 13 8.11 13 8.25L13 8.75C13 8.89 12.89 9 12.75 9L12.25 9C12.11 9 12 8.89 12 8.75L12 8.25C12 8.11 12.11 8 12.25 8ZM2.25 10L2.75 10C2.89 10 3 10.11 3 10.25L3 10.75C3 10.89 2.89 11 2.75 11L2.25 11C2.11 11 2 10.89 2 10.75L2 10.25C2 10.11 2.11 10 2.25 10ZM12.25 10L12.75 10C12.89 10 13 10.11 13 10.25L13 10.75C13 10.89 12.89 11 12.75 11L12.25 11C12.11 11 12 10.89 12 10.75L12 10.25C12 10.11 12.11 10 12.25 10ZM2.25 12L2.75 12C2.89 12 3 12.11 3 12.25L3 12.75C3 12.89 2.89 13 2.75 13L2.25 13C2.11 13 2 12.89 2 12.75L2 12.25C2 12.11 2.11 12 2.25 12ZM12.25 12L12.75 12C12.89 12 13 12.11 13 12.25L13 12.75C13 12.89 12.89 13 12.75 13L12.25 13C12.11 13 12 12.89 12 12.75L12 12.25C12 12.11 12.11 12 12.25 12Z"/>\n</svg>',"fingernail-polished":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M11 6.5C11.5 9 12 11 12 15L11 15C11 12 10.5 9.5 10.5 9.5C10.5 9.5 10.5 12 7.5 12C4.5 12 4.5 9.5 4.5 9.5C4.5 9.5 4 12 4 15C4 15 3 15 3 15C3 11 3.5 9 4 6.5C4 2 4 0 7.5 0C11 0 11 2 11 6.5zM7.5 1C5 1 5 2.5 5 7C5.5 4 5.5 2 7.5 1z"/>\n</svg>',fish:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M14.5 6.38L14.5 6.75C14.5 6.8 13.85 7.07 12.54 7.55C12.46 7.64 12.46 7.64 12.46 7.72C12.46 7.79 12.54 7.88 12.63 7.88L14.88 7.88L14.88 8.25C12.86 9.82 10.75 10.5 8.25 10.5C6.58 10.5 5 9.75 3.5 8.25L0 10.5L0 9.5L1.25 7.5L0 5.5L0 4.5L3.5 6.75C5 5.25 6.58 4.5 8.25 4.5C12.75 4.5 14.5 6.38 14.5 6.38ZM11.5 7.25C11.96 7.25 12.25 6.95 12.25 6.5C12.25 6.05 11.96 5.75 11.5 5.75C11.05 5.75 10.75 6.05 10.75 6.5C10.75 6.95 11.05 7.25 11.5 7.25Z"/>\n</svg>',"flag-checkered":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M4.99 1.58C5.04 1.31 4.85 1.05 4.58 1.01C4.31 0.96 4.05 1.15 4.01 1.42L2.01 13.42C1.96 13.69 2.15 13.95 2.42 13.99C2.69 14.04 2.95 13.85 2.99 13.58L3.66 9.56C4.47 9.68 5.34 9.72 6.03 10.2C6.45 10.51 6.94 10.7 7.46 10.78C8.42 10.93 9.29 10.4 10.24 10.55L11.53 10.74C11.79 10.78 12.06 10.58 12.1 10.32L12.98 4.39L12.99 4.38C13.02 4.12 12.82 3.86 12.56 3.82L11.27 3.63C10.31 3.48 9.44 4 8.49 3.86C8.06 3.79 7.65 3.63 7.3 3.38C6.56 2.86 5.68 2.78 4.81 2.66L4.99 1.58ZM4.4 5.12L4.73 3.15C5.33 3.23 5.97 3.28 6.52 3.52L6.23 5.48C5.66 5.25 5.01 5.2 4.4 5.12ZM3.75 9.07L4.07 7.1C4.69 7.18 5.35 7.22 5.93 7.46L6.23 5.49C6.89 5.76 7.39 6.22 8.13 6.33L8.43 4.35C9.16 4.46 9.77 4.17 10.48 4.11L10.18 6.08C9.47 6.14 8.86 6.44 8.12 6.33L7.84 8.31C7.1 8.2 6.6 7.73 5.94 7.46L5.64 9.44C5.04 9.2 4.38 9.16 3.75 9.07ZM7.84 8.31C8.57 8.42 9.19 8.12 9.9 8.06L10.18 6.08C10.84 6.02 11.51 6.19 12.15 6.29L11.87 8.26C11.23 8.17 10.56 8 9.9 8.06L9.6 10.03C8.89 10.08 8.27 10.39 7.54 10.28L7.84 8.31Z"/>\n</svg>',"flower-bouquet":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M1.5 1A2.7 2.7 0 0 1 4 3l0.5 -3L5 3A2.7 2.7 0 0 1 7.5 1c-0.2 0.03 -1 0.26 -1 2v0.08A1.96 1.96 0 0 1 4.5 5H4.42A1.96 1.96 0 0 1 2.5 3C2.5 1.26 1.7 1.03 1.5 1ZM12.01 11l3 -0.5l-3 -0.5A2.69 2.69 0 0 0 14 7.5c-0.03 0.2 -0.25 1 -1.99 1a2 2 0 0 0 0 4c1.74 0 1.96 0.8 1.99 1A2.69 2.69 0 0 0 12.01 11ZM9.69 5.55a1 1 0 0 1 0 -2a1 1 0 0 1 0 -2a0.99 0.99 0 0 1 0.85 0.51l0.02 -0.01a0.98 0.98 0 0 1 -0.12 -0.44a1 1 0 1 1 2 0a0.98 0.98 0 0 1 -0.12 0.44l0.02 0.01a0.99 0.99 0 0 1 0.85 -0.5a1 1 0 0 1 0.03 2a1 1 0 0 1 -0.02 2a0.99 0.99 0 0 1 -0.85 -0.5l-0.02 0.01a0.98 0.98 0 0 1 0.11 0.44a1 1 0 0 1 -2 0a0.98 0.98 0 0 1 0.11 -0.44l-0.02 -0.01a0.99 0.99 0 0 1 -0.85 0.51Zm0.71 -1.99A1.05 1.05 0 1 0 11.45 2.5A1.05 1.05 0 0 0 10.4 3.55v0ZM4.95 11.44l-0.52 -0.51L8.89 6.48A1.75 1.75 0 0 1 8.44 6.22L4.08 10.58l-0.52 -0.52A16.05 16.05 0 0 0 4.91 6a3.37 3.37 0 0 1 -0.41 0.04c-0.04 0 -0.07 -0.01 -0.11 -0.01A16.95 16.95 0 0 1 3.13 9.63L2.76 9.26a0.25 0.25 0 0 0 -0.4 0.08L0.23 14.45a0.29 0.29 0 0 0 -0.02 0.09a0.25 0.25 0 0 0 0.25 0.25a0.29 0.29 0 0 0 0.1 -0.02l5.1 -2.12a0.25 0.25 0 0 0 0.08 -0.4l-0.37 -0.37a16.87 16.87 0 0 1 3.61 -1.26c0 -0.06 -0.01 -0.11 -0.01 -0.17A3.35 3.35 0 0 1 9 10.09A16.08 16.08 0 0 0 4.95 11.44Z"/>\n</svg>',"fork-and-knife":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M3.5 0l-0.5 5.5c-0.15 0.81 1.78 1.18 1.75 2l-0.25 6.5c-0.04 1 1 1 1 1s1.04 0 1 -1l-0.25 -6.5c-0.03 -0.82 1.73 -1.18 1.75 -2l-0.5 -5.5h-0.5l-0.25 4l-0.75 0.5l-0.25 -4.5h-0.5l-0.25 4.5l-0.75 -0.5l-0.25 -4zm8.5 0c-0.74 0 -1.96 0.65 -2.46 1.64c-0.4 0.73 -0.54 2.38 -0.54 3.36v2.5c0 0.82 1.09 1 1.5 1l-0.5 5.5c-0.09 1 1 1 1 1s1 0 1 -1z"/>\n</svg>',fort:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M1.07 1.07L1.07 3.21L6.43 3.21L6.43 1.07L5.36 1.07L5.36 2.14L4.29 2.14L4.29 1.07L3.21 1.07L3.21 2.14L2.14 2.14L2.14 1.07L1.07 1.07ZM8.57 1.07L8.57 3.21L13.93 3.21L13.93 1.07L12.86 1.07L12.86 2.14L11.79 2.14L11.79 1.07L10.71 1.07L10.71 2.14L9.64 2.14L9.64 1.07L8.57 1.07ZM1.07 4.29L1.07 10.71L13.93 10.71L13.93 4.29L8.57 4.29L8.57 6.43L6.43 6.43L6.43 4.29L1.07 4.29ZM3.21 6.43L4.29 6.43L4.29 7.5L3.75 8.57L3.21 7.5L3.21 6.43ZM10.71 6.43L11.79 6.43L11.79 7.5L11.25 8.57L10.71 7.5L10.71 6.43ZM1.07 11.79L0 15L15 15L13.93 11.79L1.07 11.79Z"/>\n</svg>',gift:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-gift"><polyline points="20 12 20 22 4 22 4 12"></polyline><rect x="2" y="7" width="20" height="5"></rect><line x1="12" y1="22" x2="12" y2="7"></line><path d="M12 7H7.5a2.5 2.5 0 0 1 0-5C11 2 12 7 12 7z"></path><path d="M12 7h4.5a2.5 2.5 0 0 0 0-5C13 2 12 7 12 7z"></path></svg>',globe:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-globe"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>',gravestone:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M11.46 12h-0.68L12 3.55c0.02 -0.29 -0.2 -0.53 -0.49 -0.55C11.49 3 11.46 3 11.44 3h-1.18c0 -0.92 -1.23 -2 -2.75 -2S4.77 2.08 4.77 3H3.54C3.25 2.99 3.01 3.21 3 3.5C3 3.52 3 3.53 3 3.55L4.2 12H3.55C3.26 11.99 3.02 12.21 3 12.5V14h9v-1.51C11.98 12.21 11.74 11.99 11.46 12zM4.5 5h6v1h-6V5z"/>\n</svg>',"grecian-vase":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M3.21 0L3.21 1.07L4.29 1.07C4.93 1.07 5.19 2.19 5.29 3.11C4.25 2.3 3.24 2.01 2.38 2.18C1.27 2.38 0.54 3.4 0.54 4.55C0.54 5.46 0.87 6.25 1.44 7.06C1.94 7.78 2.64 8.61 3.52 9.61C3.91 11.07 4.63 12.4 5.36 13.13L5.36 13.93L4.29 14.46L4.29 15L10.71 15L10.71 14.46L9.64 13.93L9.64 13.13C10.37 12.4 11.09 11.07 11.48 9.61C12.36 8.61 13.06 7.78 13.56 7.06C14.13 6.25 14.46 5.46 14.46 4.55C14.46 3.4 13.73 2.38 12.62 2.18C11.76 2.01 10.75 2.3 9.71 3.11C9.81 2.19 10.07 1.07 10.71 1.07L11.79 1.07L11.79 0L3.21 0ZM2.54 3.25C3.09 3.15 4 3.36 5.06 4.32C3.86 4.47 3.21 5.52 3.21 7.5C3.21 7.53 3.21 7.57 3.21 7.6C2.85 7.18 2.55 6.8 2.31 6.46C1.81 5.74 1.61 5.21 1.61 4.55C1.61 3.8 1.94 3.36 2.54 3.25ZM11.92 3.25C12.12 3.22 12.3 3.22 12.46 3.25C13.06 3.36 13.39 3.8 13.39 4.55C13.39 5.21 13.19 5.74 12.69 6.46C12.45 6.8 12.15 7.18 11.79 7.6C11.79 7.57 11.79 7.53 11.79 7.5C11.79 5.52 11.14 4.47 9.94 4.32C10.71 3.62 11.39 3.32 11.92 3.25Z"/>\n</svg>',"greek-cross":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7 1C6.4 1 6 1.4 6 2v4H2C1.4 6 1 6.4 1 7v1c0 0.6 0.4 1 1 1h4v4c0 0.6 0.4 1 1 1h1c0.6 0 1 -0.4 1 -1V9h4c0.6 0 1 -0.4 1 -1V7c0 -0.6 -0.4 -1 -1 -1H9V2c0 -0.6 -0.4 -1 -1 -1H7z"/>\n</svg>',heart:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-heart"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"></path></svg>',home:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>',"ice-cream-on-cone":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M5.44 8.17a3.47 3.47 0 0 0 2 -0.63A3.5 3.5 0 0 0 9 8.14h0.44L8 13.7a0.5 0.5 0 0 1 -0.92 0Zm6 -3.47a2 2 0 0 1 -4 0h0a2 2 0 1 1 -2 -2h0.12a2 2 0 1 1 3.75 0h0.13A2 2 0 0 1 11.44 4.7Z"/>\n</svg>',"industrial-building":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M14 1v12H1V8.72c0 -0.14 0.06 -0.28 0.17 -0.37l3 -3.22c0.21 -0.18 0.52 -0.16 0.71 0.05C4.96 5.27 5 5.39 5 5.51v3l3.16 -3.37c0.2 -0.19 0.52 -0.18 0.71 0.03C8.95 5.26 9 5.38 9 5.51V11h3V1H14z"/>\n</svg>',info:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-info"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>',"info-i":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7.5 1C6.7 1 6 1.7 6 2.5S6.7 4 7.5 4S9 3.3 9 2.5S8.3 1 7.5 1zM4 5v1c0 0 2 0 2 2v2c0 2 -2 2 -2 2v1h7v-1c0 0 -2 0 -2 -2V6c0 -0.5 -0.5 -1 -1 -1H4z"/>\n</svg>',instagram:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-instagram"><rect x="2" y="2" width="20" height="20" rx="5" ry="5"></rect><path d="M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z"></path><line x1="17.5" y1="6.5" x2="17.51" y2="6.5"></line></svg>',jewel:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M15 5.5C15 5.5 11.5 1.5 11.5 1.5C11.5 1.5 3.5 1.5 3.5 1.5C3.5 1.5 0 5.5 0 5.5C0 5.5 7.5 14 7.5 14C7.5 14 15 5.5 15 5.5zM10.75 5.5L11.5 2.5L14 5.5L10.75 5.5zM10.5 6.25L13.25 6.25L8.5 12L10.5 6.25zM10 5.5L8 2.25L10.75 2.25L10 5.5zM5.5 6.25L9.5 6.25L7.5 12.5L5.5 6.25zM5.75 5.5L7.5 2.5L9.25 5.5L5.75 5.5zM5 5.5L4.25 2.25L7 2.25L5 5.5zM6.5 12L1.5 6.25L4.5 6.25L6.5 12zM3.5 2.5L4.25 5.5L1 5.5L3.5 2.5z"/>\n</svg>',"log-in":'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-in"><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"></path><polyline points="10 17 15 12 10 7"></polyline><line x1="15" y1="12" x2="3" y2="12"></line></svg>',"log-out":'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-out"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg>',"lowrise-building":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M3 2v11h5v-3h3v3h1V2H3zM7 12H4v-2h3V12zM7 9H4V7h3V9zM7 6H4V4h3V6zM11 9H8V7h3V9zM11 6H8V4h3V6z"/>\n</svg>',mail:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-mail"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg>',map:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-map"><polygon points="1 6 1 22 8 18 16 22 23 18 23 2 16 6 8 2 1 6"></polygon><line x1="8" y1="2" x2="8" y2="18"></line><line x1="16" y1="6" x2="16" y2="22"></line></svg>',"map-pin":'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-map-pin"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path><circle cx="12" cy="10" r="3"></circle></svg>',"market-stall":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M1 1L1 1.93L1 2.86C1 3.88 1.83 4.71 2.86 4.71C3.88 4.71 4.71 3.88 4.71 2.86L5.64 2.86C5.64 3.88 6.47 4.71 7.5 4.71C8.53 4.71 9.36 3.88 9.36 2.86L10.29 2.86C10.29 3.88 11.12 4.71 12.14 4.71C13.17 4.71 14 3.88 14 2.86L14 1.93L14 1L12.14 1L1 1ZM1 5.64L1 9.36L1 11.21L1 14L2.86 14L2.86 11.21L12.14 11.21L12.14 14L14 14L14 11.21L14 9.36L14 5.64L12.14 5.64L12.14 9.36L2.86 9.36L2.86 5.64L1 5.64Z"/>\n</svg>',"memorial-stone-with-inscription":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M13.5 13L14 15L1 15L1.5 13L13.5 13ZM7.5 0C9.5 0 11 1 12 3L12 12.5L3 12.5L3 3C4 1 5.5 0 7.5 0ZM9.5 8L5.5 8L5.5 9L9.5 9L9.5 8ZM10.5 6L4.5 6L4.5 7L10.5 7L10.5 6ZM9 4L6 4L6 5L9 5L9 4Z"/>\n</svg>',menu:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg>',"mobile-phone-with-keypad-and-antenna":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M10.5 0C10.78 0 11 0.22 11 0.5L11 13.18C11 13.82 10.6 14.4 10 14.63C9.34 14.87 8.64 15 7.93 15L7.07 15C6.36 15 5.66 14.87 5 14.63C4.4 14.4 4 13.82 4 13.18L4 3.82C4 3.18 4.4 2.6 5 2.38C5.66 2.13 6.36 2 7.07 2L7.93 2C8.64 2 9.34 2.13 10 2.38L10 0.5C10 0.22 10.22 0 10.5 0ZM5.75 12L5.25 12C5.11 12 5 12.11 5 12.25L5 12.75C5 12.89 5.11 13 5.25 13L5.75 13C5.89 13 6 12.89 6 12.75L6 12.25C6 12.11 5.89 12 5.75 12ZM7.75 12L7.25 12C7.11 12 7 12.11 7 12.25L7 12.75C7 12.89 7.11 13 7.25 13L7.75 13C7.89 13 8 12.89 8 12.75L8 12.25C8 12.11 7.89 12 7.75 12ZM9.75 12L9.25 12C9.11 12 9 12.11 9 12.25L9 12.75C9 12.89 9.11 13 9.25 13L9.75 13C9.89 13 10 12.89 10 12.75L10 12.25C10 12.11 9.89 12 9.75 12ZM5.75 10L5.25 10C5.11 10 5 10.11 5 10.25L5 10.75C5 10.89 5.11 11 5.25 11L5.75 11C5.89 11 6 10.89 6 10.75L6 10.25C6 10.11 5.89 10 5.75 10ZM7.75 10L7.25 10C7.11 10 7 10.11 7 10.25L7 10.75C7 10.89 7.11 11 7.25 11L7.75 11C7.89 11 8 10.89 8 10.75L8 10.25C8 10.11 7.89 10 7.75 10ZM9.75 10L9.25 10C9.11 10 9 10.11 9 10.25L9 10.75C9 10.89 9.11 11 9.25 11L9.75 11C9.89 11 10 10.89 10 10.75L10 10.25C10 10.11 9.89 10 9.75 10ZM5.75 8L5.25 8C5.11 8 5 8.11 5 8.25L5 8.75C5 8.89 5.11 9 5.25 9L5.75 9C5.89 9 6 8.89 6 8.75L6 8.25C6 8.11 5.89 8 5.75 8ZM7.75 8L7.25 8C7.11 8 7 8.11 7 8.25L7 8.75C7 8.89 7.11 9 7.25 9L7.75 9C7.89 9 8 8.89 8 8.75L8 8.25C8 8.11 7.89 8 7.75 8ZM9.75 8L9.25 8C9.11 8 9 8.11 9 8.25L9 8.75C9 8.89 9.11 9 9.25 9L9.75 9C9.89 9 10 8.89 10 8.75L10 8.25C10 8.11 9.89 8 9.75 8ZM9.5 5L5.5 5C5.22 5 5 5.22 5 5.5L5 6.5C5 6.78 5.22 7 5.5 7L9.5 7C9.78 7 10 6.78 10 6.5L10 5.5C10 5.22 9.78 5 9.5 5ZM8.5 3L6.5 3C6.22 3 6 3.22 6 3.5C6 3.78 6.22 4 6.5 4L8.5 4C8.78 4 9 3.78 9 3.5C9 3.22 8.78 3 8.5 3Z"/>\n</svg>',"molar-tooth":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M4.36 14c-1 0 -0.56 -2.67 -0.86 -5c-0.1 -0.76 -1 -1.49 -1.12 -2.06C2 5 1.39 1.44 3.66 1S6 3 7.54 3s1.57 -2.36 3.85 -2s1.59 3.9 1.29 5.9c-0.1 0.45 -1.1 1.48 -1.18 2.06c-0.33 2.4 0.32 5 -0.8 5c-0.93 0 -1.32 -2.72 -2 -4.5C8.43 8.63 8.06 8 7.54 8C6 8 5.75 14 4.36 14z"/>\n</svg>',"more-horizontal":'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-more-horizontal"><circle cx="12" cy="12" r="1"></circle><circle cx="19" cy="12" r="1"></circle><circle cx="5" cy="12" r="1"></circle></svg>',"more-vertical":'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-more-vertical"><circle cx="12" cy="12" r="1"></circle><circle cx="12" cy="5" r="1"></circle><circle cx="12" cy="19" r="1"></circle></svg>',navigation:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-navigation"><polygon points="3 11 22 2 13 21 11 13 3 11"></polygon></svg>',"needle-and-spool-of-thread":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M5.87 1.98L5.13 1.97C4.97 1.97 4.83 1.97 4.68 1.97C3.24 2 2.41 2.16 2.1 2.71C1.65 3.5 2.47 4.27 4.54 5.33L5.23 5.68C5.72 5.93 6.09 6.14 6.35 6.32C6.4 6.35 6.45 6.38 6.49 6.41L6.29 6.46L5.62 6.58L5 6.71C3.41 7.09 2.5 7.73 2.5 9L2.5 13L7.5 13L7.5 9L3.5 9C3.5 8.39 3.99 8.02 5.03 7.74L5.23 7.69C5.36 7.66 5.49 7.63 5.65 7.6L6.37 7.46L6.68 7.39C6.91 7.34 7.08 7.29 7.22 7.22C7.61 7.04 7.84 6.71 7.69 6.28C7.53 5.83 6.88 5.4 5.46 4.67L5.22 4.55C4.25 4.06 3.59 3.66 3.23 3.35L3.07 3.21C3.03 3.17 3.01 3.16 2.99 3.17L2.98 3.19C3.1 3.12 3.69 3.01 4.51 2.98L4.7 2.97C5.09 2.96 5.48 2.97 6.02 2.98L6.37 3C6.39 3 6.41 3 6.43 3L7.54 4.58C8.97 6.6 11.46 10.04 15 14.92L11.07 6.14C9.65 3 8.86 1.28 8.68 0.98C8.24 0.21 7.37 -0.3 6.5 0.2C5.81 0.6 5.68 1.32 5.87 1.98ZM9 13.5L9 8.5C9 8.22 8.78 8 8.5 8C8.22 8 8 8.22 8 8.5L8 13.5C8 13.78 8.22 14 8.5 14C8.78 14 9 13.78 9 13.5ZM2 13.5L2 8.5C2 8.22 1.78 8 1.5 8C1.22 8 1 8.22 1 8.5L1 13.5C1 13.78 1.22 14 1.5 14C1.78 14 2 13.78 2 13.5ZM7.82 3.48L6.82 1.75C6.68 1.51 6.76 1.2 7 1.06C7.24 0.93 7.54 1.01 7.68 1.25L8.68 2.98C8.82 3.22 8.74 3.52 8.5 3.66C8.29 3.78 8.03 3.74 7.87 3.55L7.82 3.48Z"/>\n</svg>',nostrich:'<svg width="24" height="24" viewBox="0 0 24 24" class="icon-nostrich" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M17.7084 10.1607C18.1683 13.3466 14.8705 14.0207 12.9733 13.9618C12.8515 13.958 12.7366 14.0173 12.6647 14.1157C12.4684 14.384 12.1547 14.7309 11.9125 14.7309C11.6405 14.7309 11.3957 15.254 11.284 15.5795C11.2723 15.6137 11.3059 15.6452 11.3403 15.634C14.345 14.6584 15.5241 14.3238 16.032 14.4178C16.4421 14.4937 17.209 15.8665 17.5413 16.5434C16.7155 16.5909 16.4402 15.8507 16.2503 15.7178C16.0985 15.6116 16.0415 16.0974 16.032 16.3536C15.8517 16.2587 15.6239 16.1259 15.6049 15.7178C15.5859 15.3098 15.3771 15.4142 15.2157 15.4332C15.0544 15.4521 12.5769 16.2493 12.2067 16.3536C11.8366 16.458 11.4094 16.6004 11.0582 16.8471C10.4697 17.1318 10.09 16.9325 9.98561 16.4485C9.90208 16.0614 10.4444 14.8701 10.726 14.3229C10.3779 14.4526 9.65529 14.7158 9.54898 14.7309C9.44588 14.7457 8.13815 15.7552 7.43879 16.3038C7.398 16.3358 7.37174 16.3827 7.36236 16.4336C7.25047 17.0416 6.89335 17.2118 6.27423 17.5303C5.77602 17.7867 4.036 20.4606 3.14127 21.9041C3.0794 22.0039 2.9886 22.0806 2.8911 22.1461C2.32279 22.5276 1.74399 23.4985 1.50923 23.9737C1.17511 23.0095 1.61048 22.1802 1.86993 21.886C1.75602 21.7873 1.49341 21.8449 1.37634 21.886C1.69907 20.7757 2.82862 20.7757 2.79066 20.7757C2.99948 20.5954 5.44842 17.0938 5.50538 16.9325C5.56187 16.7725 5.46892 16.0242 6.69975 15.6139C6.7193 15.6073 6.73868 15.5984 6.75601 15.5873C7.71493 14.971 8.43427 13.9774 8.67571 13.5542C7.39547 13.4662 5.92943 12.7525 5.16289 12.294C4.99765 12.1952 4.8224 12.1092 4.63108 12.0875C3.58154 11.9687 2.53067 12.6401 2.10723 13.0228C1.93258 12.7799 2.12938 12.0739 2.24961 11.7513C1.82437 11.6905 1.19916 12.308 0.939711 12.6243C0.658747 12.184 0.904907 11.397 1.06311 11.0585C0.501179 11.0737 0.120232 11.3306 0 11.4571C0.465109 7.99343 4.02275 9.00076 4.06259 9.04675C3.87275 8.84937 3.88857 8.59126 3.92021 8.48688C6.0749 8.54381 7.08105 8.18321 7.71702 7.81313C12.7288 5.01374 14.8882 6.73133 15.6856 7.1631C16.4829 7.59487 17.9304 7.77042 18.9318 7.37187C20.1278 6.83097 19.9478 5.43673 19.7054 4.90461C19.4397 4.32101 17.9399 3.51438 17.4084 2.49428C16.8768 1.47418 17.34 0.233672 17.9558 0.0607684C18.5425 -0.103972 18.9615 0.0876835 19.2831 0.378128C19.4974 0.571763 20.0994 0.710259 20.3509 0.800409C20.6024 0.890558 21.0201 1.00918 20.9964 1.08035C20.9726 1.15152 20.5699 1.14202 20.5075 1.14202C20.3794 1.14202 20.2275 1.161 20.3794 1.23217C20.5575 1.30439 20.8263 1.40936 20.955 1.47846C20.9717 1.48744 20.9683 1.51084 20.95 1.51577C20.0765 1.75085 19.2966 1.26578 18.7183 1.82526C18.1298 2.39463 19.3827 2.83114 20.0282 3.51438C20.6736 4.19762 21.3381 5.01372 20.8065 6.87365C20.395 8.31355 18.6703 9.53781 17.7795 10.0167C17.7282 10.0442 17.7001 10.1031 17.7084 10.1607Z" fill="currentColor"/>\n</svg>\n',"open-book":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M0.09 10.16C-0.01 10.08 0 9.94 0 9.94L0.61 2.77C0.61 2.77 0.62 2.69 0.66 2.66C0.67 2.62 0.7 2.59 0.75 2.57C1.36 2.33 4.67 0.54 6.35 2.2C6.62 2.52 6.92 2.99 6.92 3.35L6.92 9.41C6.92 9.41 6.93 9.54 6.81 9.62C6.78 9.64 6.67 9.69 6.53 9.62C3.96 8.35 1.1 9.79 0.37 10.18C0.23 10.25 0.12 10.17 0.09 10.16ZM14.63 10.18C13.9 9.8 11.04 8.35 8.47 9.62C8.33 9.69 8.22 9.63 8.19 9.62C8.07 9.54 8.08 9.41 8.08 9.41L8.08 3.35C8.08 2.99 8.38 2.52 8.65 2.2C10.33 0.54 13.62 2.33 14.23 2.57C14.28 2.59 14.31 2.62 14.33 2.65C14.37 2.69 14.38 2.77 14.38 2.77L15 9.94C15 9.94 15.01 10.08 14.91 10.16C14.88 10.17 14.77 10.25 14.63 10.18ZM9.07 13.31C9.12 13.3 9.18 13.27 9.21 13.22C9.23 13.18 9.25 13.15 9.25 13.09C9.31 12.02 11.12 11.02 14.62 13.06C14.71 13.11 14.82 13.11 14.9 13.04C15 12.97 15 12.85 15 12.85L15 12.22C15 12.22 15 12.13 14.97 12.09C14.94 12.05 14.91 12.02 14.86 11.98C12.52 10.48 9.57 9.8 8.07 11.8C8.04 11.84 8.02 11.87 7.98 11.9C7.93 11.95 7.85 11.95 7.85 11.95L7.17 11.95C7.17 11.95 7.08 11.95 7.02 11.9C6.97 11.87 6.96 11.84 6.93 11.8C5.43 9.8 2.48 10.45 0.14 11.95C0.09 11.97 0.06 12.01 0.03 12.05C0 12.1 0 12.19 0 12.19L0 12.82C0 12.82 0 12.95 0.09 13.01C0.18 13.08 0.29 13.08 0.37 13.04C3.85 11 5.68 12.03 5.73 13.11C5.73 13.16 5.76 13.19 5.78 13.23C5.8 13.27 5.87 13.31 5.92 13.32C6.76 13.52 7.97 13.6 9.07 13.31Z"/>\n</svg>',palace:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12.86 2.14L11.79 3.75L11.79 4.29L15 4.29L15 3.75L13.93 2.14L12.86 2.14ZM1.07 2.14L0 3.75L0 4.29L3.21 4.29L3.21 3.75L2.14 2.14L1.07 2.14ZM4.29 4.29L10.71 4.29L10.71 3.21L7.5 0L4.29 3.21L4.29 4.29ZM0 5.36L0 13.93L5.36 13.93C5.36 12.86 5.36 10.71 7.5 10.71C9.64 10.71 9.64 12.86 9.64 13.93L15 13.93L15 5.36L11.81 5.36L11.79 6.43L10.71 6.43L10.75 5.36L4.33 5.36L4.29 6.43L3.21 6.43L3.21 5.36L0 5.36ZM3.21 8.57C4.29 8.57 4.29 9.64 4.29 10.71L2.14 10.71C2.14 9.64 2.14 8.57 3.21 8.57ZM11.79 8.57C12.86 8.57 12.86 9.35 12.86 10.71L10.71 10.74C10.68 9.37 10.71 8.57 11.79 8.57Z"/>\n</svg>',"person-cricket-batting-at-cricket-ball":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M8 1.5C8 2.33 7.33 3 6.5 3S5 2.33 5 1.5S5.67 0 6.5 0S8 0.67 8 1.5zM10.88 7.18L10.88 7.18l-2 -2l0 0l0 0C8.78 5.06 8.63 5 8.48 5H3.75C3.37 4.99 3.05 5.27 3 5.64l0 0l-1 7.7l0 0c-0.01 0.05 -0.01 0.09 0 0.14c0 0.28 0.22 0.5 0.5 0.5c0.23 0.02 0.43 -0.13 0.5 -0.34l0 0l1.2 -3.89l0 0l0.26 -0.83l0.4 0.44l0 0L6 10.6v2.9C6 13.78 6.22 14 6.5 14S7 13.78 7 13.5v-3l0 0l0 0c-0.01 -0.08 -0.04 -0.15 -0.08 -0.22l0 0L5.48 8.5l1 -2.5h1.71l2 1.84l0 0c0.09 0.11 0.23 0.17 0.37 0.17C10.82 7.98 11.01 7.76 11 7.5C11 7.38 10.96 7.27 10.88 7.18zM14 11.27c-0.41 0 -0.75 0.34 -0.75 0.75s0.34 0.75 0.75 0.75s0.75 -0.34 0.75 -0.75S14.41 11.27 14 11.27zM10.76 9.74V9c0 -0.14 -0.11 -0.25 -0.25 -0.25S10.26 8.86 10.26 9v0.74c-0.15 0.09 -0.25 0.25 -0.25 0.42v3.34c0 0.28 0.22 0.5 0.5 0.5s0.5 -0.22 0.5 -0.5v-3.34C11.01 9.99 10.91 9.83 10.76 9.74z"/>\n</svg>',"person-boarding-tram-with-destination-display-and-pantograph-on-tram-track":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M5.5 7.51C5.5 7.64 5.45 7.76 5.35 7.85L4.35 8.85C4.2 9.01 3.96 9.05 3.76 8.94L3.5 8.8L3.5 9.94L4.72 10.55C4.89 10.64 5 10.81 5 11L5 12.5C5 12.78 4.78 13 4.5 13C4.22 13 4 12.78 4 12.5L4 11.31L3.05 10.83C3.03 10.85 3.02 10.86 3 10.87L3 12L2.97 12.16L2.47 13.66C2.39 13.92 2.1 14.06 1.84 13.97C1.58 13.89 1.44 13.6 1.53 13.34L2 11.92L2 10.87C1.7 10.69 1.5 10.37 1.5 10L1.5 8.25C1.5 7.7 1.95 7.25 2.5 7.25C2.71 7.25 2.9 7.31 3.07 7.43L3.91 7.88L4.65 7.15C4.84 6.95 5.16 6.95 5.35 7.15C5.45 7.24 5.5 7.36 5.5 7.49L5.5 4.83C5.5 4.3 5.71 3.79 6.09 3.41L7.5 2L9 2L9 1L7.5 1C7.22 1 7 0.78 7 0.5C7 0.22 7.22 0 7.5 0L11.5 0C11.78 0 12 0.22 12 0.5C12 0.78 11.78 1 11.5 1L10 1L10 2L11.5 2L12.91 3.41C13.29 3.79 13.5 4.3 13.5 4.83L13.5 11C13.5 12.1 12.6 13 11.5 13L7.5 13C6.4 13 5.5 12.1 5.5 11L5.5 7.51ZM8.25 13.5L7.5 15L6 15L6.75 13.5L8.25 13.5ZM12.25 13.5L13 15L11.5 15L10.75 13.5L12.25 13.5ZM10.5 12L11.5 12C12.05 12 12.5 11.55 12.5 11L12.5 10C11.4 10 10.5 10.9 10.5 12ZM8.5 12C8.5 10.9 7.6 10 6.5 10L6.5 11C6.5 11.55 6.95 12 7.5 12L8.5 12ZM6.5 5.5L6.5 8.5C6.5 8.78 6.72 9 7 9L12 9C12.28 9 12.5 8.78 12.5 8.5L12.5 5.5C12.5 5.22 12.28 5 12 5L7 5C6.72 5 6.5 5.22 6.5 5.5ZM7.5 3.5C7.5 3.78 7.72 4 8 4L11 4C11.28 4 11.5 3.78 11.5 3.5C11.5 3.22 11.28 3 11 3L8 3C7.72 3 7.5 3.22 7.5 3.5ZM2.5 7C1.95 7 1.5 6.55 1.5 6C1.5 5.45 1.95 5 2.5 5C3.05 5 3.5 5.45 3.5 6C3.5 6.55 3.05 7 2.5 7Z"/>\n</svg>',"person-jockeying-racehorse":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M10 1C9.73 1 9.48 1.11 9.29 1.29C9.11 1.48 9 1.73 9 2C9 2.27 9.11 2.52 9.29 2.71C9.48 2.89 9.73 3 10 3C10.27 3 10.52 2.89 10.71 2.71C10.89 2.52 11 2.27 11 2C11 1.73 10.89 1.48 10.71 1.29C10.52 1.11 10.27 1 10 1ZM5.5 3C5.25 3 4.5 3 5 3.75L6.25 6H4.5C4.22 6 3.98 6.1 3.75 6.25C2.94 5.12 2.24 5.55 1.51 6C1.11 6.25 0.69 6.5 0.25 6.5C0.18 6.5 0.12 6.53 0.08 6.58C0.03 6.62 0 6.68 0 6.75C0 6.82 0.03 6.88 0.08 6.92C0.12 6.97 0.18 7 0.25 7C0.63 7.02 1.06 6.91 1.49 6.79C2.14 6.62 2.8 6.45 3.25 6.75C3.16 6.94 3 7.5 3 8L3 9.51C2.79 9.71 2.62 9.63 2.44 9.55C2.3 9.49 2.16 9.42 2 9.5L1 12.45C1 12.7 1.39 12.75 1.5 12.5L2.25 10.74C3 10.74 4.5 10 5 9L9 10L11.5 12.5C11.7 12.7 12.12 12.36 11.96 12.12L10 9L12 6.5C12.25 7 12.5 7 12.99 7H13L13.6 7.75C13.99 8.24 14.82 7.74 14.5 7.25L12.83 4.79L13 4.5C13.06 4.31 12.64 3.92 12.5 4L10.5 5.5L8.89 3.19C8.84 3.13 8.78 3.08 8.72 3.05C8.65 3.02 8.57 3 8.5 3H5.5ZM9 5.25L9.5 6L6.78 7.92C6.72 7.95 6.66 7.98 6.6 8C6.53 8.01 6.46 8.01 6.4 8C6.33 7.99 6.27 7.96 6.21 7.93C6.16 7.89 6.11 7.84 6.07 7.79C6.03 7.73 6.01 7.67 6 7.6C5.98 7.54 5.98 7.47 6 7.4C6.01 7.34 6.04 7.28 6.08 7.22C6.12 7.17 6.17 7.12 6.22 7.08L9 5.25Z"/>\n</svg>',"person-playing-tennis":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M13.27 7.26C13.57 7.26 13.82 7.51 13.82 7.82C13.82 8.12 13.57 8.36 13.27 8.36C12.96 8.36 12.72 8.12 12.72 7.82C12.72 7.51 12.96 7.27 13.27 7.27L13.27 7.26ZM5.62 2.69C4.96 2.69 4.43 2.15 4.43 1.49C4.43 0.83 4.96 0.3 5.62 0.3C6.28 0.3 6.82 0.83 6.82 1.49C6.82 2.15 6.28 2.69 5.62 2.69ZM0.48 13.31L2.42 11.02L3.03 7.48L3.56 5.09L2.96 5.43L1.94 7.39C1.86 7.53 1.73 7.64 1.58 7.68C1.42 7.73 1.25 7.72 1.11 7.64C0.97 7.57 0.86 7.44 0.82 7.28C0.77 7.13 0.78 6.96 0.86 6.82L1.99 4.68C2.01 4.65 2.03 4.61 2.07 4.57C2.15 4.49 2.33 4.39 2.33 4.39L4.49 3.17C4.76 3.03 5.06 2.98 5.37 3.05C5.49 3.08 5.61 3.12 5.74 3.2L5.77 3.21C5.88 3.27 6.27 3.5 6.51 4.06L7.62 6.29L9.37 6.63L9.41 6.64L10.99 5.53C11.34 5.28 11.39 4.54 11.39 4.51C11.43 4 11.73 3.52 12.2 3.19C12.62 2.89 13.13 2.76 13.6 2.84C13.97 2.9 14.27 3.09 14.47 3.36C14.63 3.58 14.71 3.84 14.71 4.11L14.69 4.35C14.6 4.82 14.32 5.26 13.89 5.56C13.47 5.87 12.96 5.99 12.49 5.91L12.38 5.89C12.37 5.89 11.67 5.67 11.32 5.9L9.83 6.96L9.87 7.05C9.9 7.1 9.92 7.17 9.91 7.24C9.91 7.28 9.91 7.31 9.9 7.35C9.84 7.68 9.52 7.9 9.19 7.83L7.09 7.42C7.09 7.42 6.91 7.37 6.84 7.31C6.77 7.27 6.72 7.19 6.69 7.14L6.11 5.99L5.73 7.79C5.73 7.81 5.73 7.82 5.73 7.82L7.45 9.63L7.51 9.67C7.67 9.82 7.8 10.01 7.8 10.22L7.8 13.98C7.8 14.39 7.45 14.71 7.05 14.71C6.65 14.71 6.3 14.39 6.3 13.98L6.3 10.85C6 10.69 4.85 9.33 4.5 8.98L4.13 11.09C4.11 11.23 4.04 11.36 3.96 11.46L1.58 14.26C1.46 14.4 1.28 14.5 1.09 14.51C0.89 14.53 0.71 14.47 0.56 14.34C0.39 14.2 0.3 13.99 0.3 13.79C0.3 13.65 0.33 13.52 0.41 13.41L0.48 13.31ZM12 5.12C12.13 5.3 12.33 5.41 12.57 5.45C12.92 5.51 13.3 5.42 13.62 5.18C13.94 4.95 14.16 4.62 14.22 4.28L14.24 4.11C14.24 3.93 14.19 3.77 14.09 3.63C13.77 3.19 13.05 3.16 12.47 3.57C11.94 3.95 11.72 4.58 11.94 5.03L12 5.12Z"/>\n</svg>',"person-running":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M10.48 2.31C11.12 2.31 11.63 1.79 11.63 1.15C11.63 0.52 11.12 0 10.48 0C9.85 0 9.33 0.52 9.33 1.15C9.33 1.79 9.85 2.31 10.48 2.31ZM1.83 10.38L4.71 10.38L5.87 6.92L7.02 4.9L5.87 4.62L3.21 5.77C2.89 5.9 2.53 5.75 2.4 5.42C2.29 5.14 2.4 4.82 2.65 4.67L2.75 4.62L5.87 3.46L8.17 3.46L10.48 4.62L11.63 5.77L13.37 5.77C13.69 5.77 13.94 6.02 13.94 6.35C13.94 6.67 13.69 6.92 13.37 6.92L10.48 6.92L9.33 5.77L8.17 8.08L10.48 10.38L10.48 14.42C10.48 14.75 10.23 15 9.9 15C9.58 15 9.33 14.75 9.33 14.42L9.33 10.83L7.02 9.23L5.87 11.54L1.83 11.54C1.5 11.54 1.25 11.28 1.25 10.96C1.25 10.64 1.5 10.38 1.83 10.38Z"/>\n</svg>',"person-sleeping-in-bed":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M0.5 2.5C0.2 2.5 0 2.7 0 3L0 10.5L0 12.5C0 12.8 0.2 13 0.5 13C0.8 13 1 12.8 1 12.5L1 11L14 11L14 12.5C14 12.8 14.2 13 14.5 13C14.8 13 15 12.8 15 12.5L15 10.5C15 10.2 14.8 10 14.5 10L1 10L1 3C1 2.7 0.8 2.5 0.5 2.5ZM3.5 3C2.7 3 2 3.7 2 4.5L2 4.5C2 5.3 2.7 6 3.5 6L3.5 6C4.3 6 5 5.3 5 4.5L5 4.5C5 3.7 4.3 3 3.5 3L3.5 3ZM7 4C5.5 4 5.5 5.5 5.5 5.5L5.5 7L3 7C2.45 7 2 7.45 2 8C2 8.55 2.45 9 3 9L6 9L6 9L15 9L15 6.5C15 4 12.5 4 12.5 4L7 4Z"/>\n</svg>',"person-swimming-in-water":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12.5 9.5C12.82 9.5 13.14 9.61 13.39 9.81L13.71 10.07C14.01 10.31 14.39 10.46 14.78 10.5L15 10.5L15 12L14.95 12C14.49 12 14.06 11.84 13.71 11.56L13.39 11.31C13.14 11.11 12.82 11 12.5 11C12.18 11 11.86 11.11 11.61 11.31L11.3 11.56C10.94 11.84 10.5 12 10.05 12L9.95 12C9.5 12 9.06 11.84 8.7 11.56L8.39 11.31C8.14 11.11 7.82 11 7.5 11C7.18 11 6.86 11.11 6.61 11.31L6.3 11.56C5.94 11.84 5.5 12 5.05 12L4.95 12C4.5 12 4.06 11.84 3.7 11.56L3.39 11.31C3.14 11.11 2.82 11 2.5 11C2.18 11 1.86 11.11 1.61 11.31L1.29 11.56C0.99 11.81 0.61 11.96 0.22 11.99L0 12L0 10.5L0.05 10.5C0.51 10.5 0.94 10.35 1.29 10.07L1.61 9.81C1.86 9.61 2.18 9.5 2.5 9.5C2.82 9.5 3.14 9.61 3.39 9.81L3.7 10.06C4.06 10.35 4.5 10.5 4.95 10.5L5.05 10.5C5.5 10.5 5.94 10.35 6.3 10.06L6.61 9.81C6.86 9.61 7.18 9.5 7.5 9.5C7.82 9.5 8.14 9.61 8.39 9.81L8.7 10.06C9.06 10.35 9.5 10.5 9.95 10.5L10.05 10.5C10.5 10.5 10.94 10.35 11.3 10.06L11.61 9.81C11.86 9.61 12.18 9.5 12.5 9.5ZM10.11 2C10.64 2 11 2.29 11 2.5L11.01 2.71C11.01 2.93 10.98 3.2 10.67 3.4L8 5L11.05 8.98L10.67 9.28C10.5 9.42 10.28 9.5 10.05 9.5L9.95 9.5C9.72 9.5 9.5 9.42 9.33 9.28L9.01 9.03C8.58 8.69 8.05 8.5 7.5 8.5C6.95 8.5 6.42 8.69 5.99 9.03L5.67 9.28C5.5 9.42 5.28 9.5 5.05 9.5L4.95 9.5C4.72 9.5 4.5 9.42 4.33 9.28L4.01 9.03C3.7 8.78 3.33 8.61 2.94 8.54L3 8.5L6.97 6.47L6 5.06C5.74 4.71 5.91 4 6.35 3.83L9.68 2.15C9.68 2.15 10 2 10.11 2ZM12.25 5C13.22 5 14 5.78 14 6.75C14 7.72 13.22 8.5 12.25 8.5C11.28 8.5 10.5 7.72 10.5 6.75C10.5 5.78 11.28 5 12.25 5Z"/>\n</svg>',"person-swinging-golf-club":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M3.4 1.1c0 0.1 0 0.2 0 0.2c0 0.4 0.3 0.7 0.7 0.7c0.3 0 0.5 -0.2 0.6 -0.5l0 0L4.9 1l5.6 2.3L6.6 6C6.2 6.3 6.2 6.7 6.3 7.1l0.9 2.1l-1.3 3.9C5.7 13.6 6.1 14 6.5 14c0.3 0 0.5 -0.1 0.6 -0.5l1.4 -4l0.1 0.3v3.5c0 0 0 0.7 0.7 0.7s0.7 -0.7 0.7 -0.7V10c0 -0.2 0 -0.3 -0.1 -0.5L8.5 6.1l2.7 -1.9c0.2 -0.2 0.4 -0.3 0.4 -0.6s-0.2 -0.5 -0.4 -0.6L4 0.1c-0.09 0 -0.12 0.02 -0.2 0.1L3.4 1.1zM5.5 3C4.7 3 4 3.7 4 4.5S4.7 6 5.5 6S7 5.3 7 4.5S6.3 3 5.5 3z"/>\n</svg>',phone:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-phone"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"></path></svg>',"plane-top-right":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M14.12 0.88C14.48 1.24 14.12 3 13.06 4.07L12 5.13L12 13.61L11.3 14.32L9 8.13L6.7 10.43L6.69 13.25L5.98 13.95L4.39 10.59L1.03 9L1.74 8.3L4.58 8.31L6.88 6.01L0.69 3.71L1.4 3L9.88 3L10.94 1.94C12 0.88 13.77 0.53 14.12 0.88Z"/>\n</svg>',"plant-in-raised-planter":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12 12L12 10.5C12 10.22 12.22 10 12.5 10L13.5 10C13.78 10 14 10.22 14 10.5L14 12L14 13.5C14 13.78 13.78 14 13.5 14L1.5 14C1.22 14 1 13.78 1 13.5L1 12L1 10.5C1 10.22 1.22 10 1.5 10L2.5 10C2.78 10 3 10.22 3 10.5L3 12L12 12ZM7 5.5L5.66 4.83C4.64 4.32 4 3.28 4 2.15L4 1C5.6 1.53 6.87 2.73 7.5 4.26C8.13 2.73 9.4 1.53 11 1L11 2.15C11 3.28 10.36 4.32 9.34 4.83L8 5.5L8 7.96C8.94 6.55 10.35 5.5 12 5C12 7.42 10.28 9.44 8 9.9L8 11.5L7 11.5L7 9.9C4.72 9.44 3 7.42 3 5C4.65 5.5 6.06 6.55 7 7.96L7 5.5Z"/>\n</svg>',"place-of-worship-building":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7.5 0l-2 2v2h4V2L7.5 0zM5.5 4.5L4 6h7L9.5 4.5H5.5zM2 6.5c-0.55 0 -1 0.45 -1 1V13h2V7.5C3 6.95 2.55 6.5 2 6.5zM4 6.5V13h7V6.5H4zM13 6.5c-0.55 0 -1 0.45 -1 1V13h2V7.5C14 6.95 13.55 6.5 13 6.5z"/>\n</svg>',"play-structure-with-slide":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M6 10L6 10.01L6 14L5 14L5 11.13L2.75 13.66C2.38 14.08 1.75 14.11 1.34 13.75C0.92 13.38 0.89 12.75 1.25 12.34L5 8.12L5 4L4 4L4 3L7.5 1L11 3L11 4L10 4L10 8L12.5 12L13 12C13.55 12 14 12.45 14 13L14 13C14 13.55 13.55 14 13 14C13 14 13 14 13 14L11.5 14L10 11.6L10 14L9 14L9 10L6 10ZM6.59 7.69C6.6 7.7 6.6 7.7 6.61 7.71C6.86 7.89 7.17 8 7.5 8C8.33 8 9 7.33 9 6.5C9 5.67 8.33 5 7.5 5C6.67 5 6 5.67 6 6.5C6 6.99 6.23 7.42 6.59 7.69L6.59 7.69Z"/>\n</svg>',"police-officer-with-stop-arm":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M14 7L14 13.5C14 13.5 14 13.5 14 13.5C14 13.78 13.77 14 13.5 14L8 13.98L14 7ZM7 13.5L7 9L2 9C1.45 9 1 8.55 1 8C1 7.45 1.45 7 2 7L12.5 7L7 13.5ZM13 4C13.09 4.43 12.99 6.5 10.5 6.5C8 6.5 7.98 4.44 8.07 4L10.5 5L13 4ZM14 2.75L10.5 4.25L7 2.75L7 1C7.92 0.95 8.59 0.87 9 0.75C9.41 0.63 9.9 0.38 10.46 0C11.04 0.37 11.55 0.62 12 0.75C12.45 0.88 13.11 0.96 14 1L14 2.75ZM11.5 2.01C11.44 1.94 11.38 1.88 11.3 1.82C10.75 1.38 9.94 1.46 9.5 2.01L9.5 2.01L10.11 2.77C10.13 2.8 10.16 2.83 10.19 2.85C10.4 3.02 10.72 2.99 10.89 2.77L11.5 2.01Z"/>\n</svg>',plus:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>',"round-structure-with-flag":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M7 1v2v1.5v0.51C4.17 5.1 2 5.97 2 7v4.5c0 1.1 2.46 2 5.5 2s5.5 -0.9 5.5 -2V7c0 -1.03 -2.17 -1.9 -5 -1.99V4.06L11 2.75L7 1zM3 8.15c0.51 0.27 1.2 0.48 2 0.63v2.97C3.79 11.48 3 11.02 3 10.5V8.15zM12 8.15V10.5c0 0.52 -0.79 0.98 -2 1.25V8.78C10.8 8.63 11.49 8.42 12 8.15zM6 8.92C6.49 8.97 6.99 9 7.5 9C8.01 9 8.51 8.97 9 8.92v2.98C8.53 11.96 8.03 12 7.5 12S6.47 11.96 6 11.91V8.92z"/>\n</svg>',remotestorage:'<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n\x3c!-- Creator: CorelDRAW X7 --\x3e\n\n<svg\n xml:space="preserve"\n width="24"\n height="24"\n version="1.1"\n style="clip-rule:evenodd;fill-rule:evenodd;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"\n viewBox="0 0 249.99729 249.90068"\n id="svg1"\n sodipodi:docname="icon-square.svg"\n inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"\n xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview\n id="namedview1"\n pagecolor="#ffffff"\n bordercolor="#666666"\n borderopacity="1.0"\n inkscape:showpageshadow="2"\n inkscape:pageopacity="0.0"\n inkscape:pagecheckerboard="true"\n inkscape:deskcolor="#d1d1d1"\n inkscape:document-units="in"\n inkscape:zoom="6.5838793"\n inkscape:cx="2.1264059"\n inkscape:cy="39.414453"\n inkscape:window-width="2160"\n inkscape:window-height="1281"\n inkscape:window-x="0"\n inkscape:window-y="0"\n inkscape:window-maximized="1"\n inkscape:current-layer="Layer_x0020_1" /> <defs\n id="defs1"></defs> <g\n id="Layer_x0020_1"\n inkscape:label="Layer 1"\n inkscape:groupmode="layer"\n transform="translate(-66.822266,-0.16483529)"> <metadata\n id="CorelCorpID_0Corel-Layer" /> <polygon\n fill="currentColor"\n points="228,181 370,100 511,181 652,263 370,425 87,263 87,263 0,213 0,213 0,311 0,378 0,427 0,476 86,525 185,582 370,689 554,582 653,525 653,590 653,592 370,754 0,542 0,640 185,747 370,853 554,747 739,640 739,525 739,476 739,427 739,378 653,427 370,589 86,427 86,361 185,418 370,524 554,418 653,361 739,311 739,213 554,107 370,0 185,107 58,180 144,230 "\n id="polygon1"\n transform="matrix(0.29308006,0,0,0.29308006,83.527829,-0.02838471)"\n /> </g> </svg>\n',"sailing-ship-in-water":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M12.5 12.5C12.82 12.5 13.14 12.61 13.39 12.81L13.71 13.07C14.01 13.31 14.39 13.46 14.78 13.5L15 13.5L15 15L14.95 15C14.49 15 14.06 14.84 13.71 14.56L13.39 14.31C13.14 14.11 12.82 14 12.5 14C12.18 14 11.86 14.11 11.61 14.31L11.3 14.56C10.94 14.84 10.5 15 10.05 15L9.95 15C9.5 15 9.06 14.84 8.7 14.56L8.39 14.31C8.14 14.11 7.82 14 7.5 14C7.18 14 6.86 14.11 6.61 14.31L6.3 14.56C5.94 14.84 5.5 15 5.05 15L4.95 15C4.5 15 4.06 14.84 3.7 14.56L3.39 14.31C3.14 14.11 2.82 14 2.5 14C2.18 14 1.86 14.11 1.61 14.31L1.29 14.56C0.99 14.81 0.61 14.96 0.22 14.99L0 15L0 13.5L0.05 13.5C0.51 13.5 0.94 13.35 1.29 13.07L1.61 12.81C1.86 12.61 2.18 12.5 2.5 12.5C2.82 12.5 3.14 12.61 3.39 12.81L3.7 13.06C4.06 13.35 4.5 13.5 4.95 13.5L5.05 13.5C5.5 13.5 5.94 13.35 6.3 13.06L6.61 12.81C6.86 12.61 7.18 12.5 7.5 12.5C7.82 12.5 8.14 12.61 8.39 12.81L8.73 13L8.63 13L8.7 13.06C9.01 13.31 9.39 13.46 9.78 13.49L9.95 13.5L10.05 13.5C10.5 13.5 10.94 13.35 11.3 13.06L11.61 12.81C11.86 12.61 12.18 12.5 12.5 12.5ZM7.48 0C7.5 0 7.52 0.01 7.53 0.03C7.54 0.03 7.55 0.06 7.55 0.08L7.6 2.51L9.48 3.66C9.51 3.67 9.53 3.71 9.54 3.74C9.68 4.39 9.83 5.04 9.85 5.7C9.87 6.36 9.74 7.04 9.3 7.7C9.27 7.77 9.2 7.78 9.15 7.75C8.71 7.48 8.22 7.32 7.69 7.24L7.73 9.23C9.41 9.16 10.16 8.6 10.52 8.07C10.89 7.51 10.85 7 10.85 7C10.84 6.86 10.92 6.74 11.05 6.71L13.69 6.09L13.73 6.08C13.84 6.08 13.95 6.16 13.98 6.27C14.03 6.4 13.98 6.53 13.89 6.6L12.15 7.85C12.29 8.71 12.41 9.59 12.27 10.43C12.2 10.8 12.07 11.2 11.86 11.59C11.54 11.67 11.24 11.82 10.98 12.03L10.67 12.28C10.5 12.42 10.28 12.5 10.05 12.5L9.95 12.5C9.72 12.5 9.5 12.42 9.33 12.28L9.01 12.03C8.58 11.69 8.05 11.5 7.5 11.5C6.95 11.5 6.42 11.69 5.99 12.03L5.67 12.28C5.5 12.42 5.28 12.5 5.05 12.5L4.95 12.5C4.72 12.5 4.5 12.42 4.33 12.28L4.01 12.03C3.71 11.79 3.35 11.62 2.97 11.55C2.82 11.13 2.75 10.53 2.78 9.61L1.66 9.27C1.63 9.27 1.6 9.25 1.58 9.23L1.55 9.2C1.24 8.86 1.05 8.41 1.01 7.96C0.97 7.5 1.08 7.02 1.4 6.67C1.46 6.61 1.55 6.58 1.62 6.6L4.06 7.16C4.09 7.17 4.13 7.18 4.16 7.21C5.43 5.26 5.91 3.33 5.32 1.4C5.32 1.36 5.32 1.31 5.34 1.27C5.37 1.24 5.4 1.22 5.45 1.22C5.46 1.22 5.49 1.23 5.51 1.24L7.4 2.39L7.4 1.45L7.39 1.46C7.21 1.52 6.99 1.53 6.78 1.47C6.56 1.43 6.36 1.32 6.21 1.13C6.07 0.94 6.01 0.78 5.94 0.65C5.87 0.52 5.8 0.43 5.62 0.36C5.58 0.34 5.56 0.29 5.56 0.26C5.56 0.22 5.58 0.17 5.62 0.16C5.77 0.1 5.89 0.08 6 0.1C6.1 0.13 6.19 0.19 6.26 0.25L6.42 0.39C6.5 0.46 6.58 0.52 6.69 0.54C6.9 0.57 6.98 0.55 7.06 0.48C7.14 0.41 7.22 0.28 7.38 0.1C7.39 0.1 7.4 0.09 7.41 0.08C7.41 0.03 7.44 0 7.48 0ZM7.54 10.04C7.4 10.04 7.26 10.1 7.16 10.2C7.06 10.3 7 10.44 7 10.59C7 10.9 7.24 11.15 7.54 11.15C7.69 11.15 7.83 11.09 7.93 10.99C8.03 10.89 8.09 10.75 8.09 10.59C8.09 10.44 8.03 10.3 7.93 10.2C7.83 10.1 7.69 10.04 7.54 10.04ZM4.78 9.64C4.63 9.64 4.49 9.7 4.39 9.8C4.29 9.91 4.23 10.05 4.23 10.2C4.23 10.5 4.48 10.76 4.78 10.76C4.93 10.76 5.06 10.69 5.16 10.59C5.26 10.49 5.32 10.35 5.32 10.2C5.32 10.04 5.26 9.91 5.16 9.8C5.06 9.7 4.93 9.64 4.78 9.64ZM10.27 9.52C10.13 9.52 9.99 9.58 9.88 9.68C9.78 9.78 9.73 9.93 9.73 10.08C9.73 10.23 9.78 10.37 9.88 10.47C9.99 10.57 10.13 10.63 10.27 10.63C10.57 10.63 10.82 10.38 10.82 10.08C10.82 9.77 10.57 9.52 10.27 9.52ZM6.93 7.16C6.1 7.14 5.2 7.26 4.26 7.46L4.26 7.53C4.26 7.66 4.29 7.98 4.56 8.31C4.9 8.74 5.66 9.23 7.37 9.24L7.38 8.24L7.38 7.19L6.93 7.16ZM8.57 2.22L8.58 2.22C9.71 2.27 10.46 2.45 10.98 2.71C11.49 2.97 11.76 3.32 11.92 3.67C12.08 4.04 12.15 4.4 12.24 4.73C12.33 5.01 12.45 5.24 12.69 5.42L12.81 5.5C12.83 5.51 12.84 5.53 12.83 5.54C12.82 5.56 12.81 5.56 12.8 5.56C12.43 5.49 11.97 5.65 11.61 5.88C11.43 5.99 11.27 6.12 11.17 6.24C11.06 6.37 11.01 6.49 11.03 6.59C11.03 6.6 11.02 6.61 11.01 6.62L10.98 6.62C10.64 6.38 10.53 6.07 10.51 5.72C10.48 5.37 10.54 4.98 10.53 4.59C10.52 4.19 10.46 3.8 10.17 3.41C9.92 3.04 9.49 2.7 8.78 2.37L8.56 2.28C8.55 2.28 8.54 2.27 8.54 2.26L8.54 2.24C8.54 2.23 8.55 2.22 8.57 2.22Z"/>\n</svg>',"scissors-open":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M15 3c0 0 -2 -0.6 -3.5 0.5l-4.3 3C6.4 5.9 5.2 5.2 4 4.8V4c0 -1.1 -0.9 -2 -2 -2C0.9 2 0 2.9 0 4v1.5C0 6 0.5 6 0.5 6H2h0.5C4.5 6 6 7.5 6 7.5S4.5 9 2.5 9H2H0.5C0.5 9 0 9 0 9.5V11c0 1.1 0.9 2 2 2c1.1 0 2 -0.9 2 -2v-0.8c1.2 -0.4 2.4 -1.1 3.2 -1.7l4.3 3C13 12.6 15 12 15 12L8.5 7.5L15 3zM3 5H2H1V4c0 -0.6 0.4 -1 1 -1c0.6 0 1 0.4 1 1V5zM3 11c0 0.6 -0.4 1 -1 1c-0.6 0 -1 -0.4 -1 -1v-1h1h1V11zM7.25 8c-0.28 0 -0.5 -0.22 -0.5 -0.5S6.97 7 7.25 7s0.5 0.22 0.5 0.5S7.53 8 7.25 8z"/>\n</svg>',"shipwreck-in-water":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M2.5 11C2.82 11 3.14 11.11 3.39 11.31L3.7 11.56C4.06 11.85 4.5 12 4.95 12L5.05 12C5.5 12 5.94 11.85 6.3 11.56L6.61 11.31C6.86 11.11 7.18 11 7.5 11C7.82 11 8.14 11.11 8.39 11.31L8.7 11.56C9.01 11.81 9.39 11.96 9.78 11.99L9.95 12L10.05 12C10.5 12 10.94 11.85 11.3 11.56L11.61 11.31C11.86 11.11 12.18 11 12.5 11C12.82 11 13.14 11.11 13.39 11.31L13.71 11.57C14.01 11.81 14.39 11.96 14.78 12L15 12L15 13.5L14.95 13.5C14.49 13.5 14.06 13.34 13.71 13.06L13.39 12.81C13.14 12.61 12.82 12.5 12.5 12.5C12.18 12.5 11.86 12.61 11.61 12.81L11.3 13.06C10.94 13.34 10.5 13.5 10.05 13.5L9.95 13.5C9.5 13.5 9.06 13.34 8.7 13.06L8.39 12.81C8.14 12.61 7.82 12.5 7.5 12.5C7.18 12.5 6.86 12.61 6.61 12.81L6.3 13.06C5.94 13.34 5.5 13.5 5.05 13.5L4.95 13.5C4.5 13.5 4.06 13.34 3.7 13.06L3.39 12.81C3.14 12.61 2.82 12.5 2.5 12.5C2.18 12.5 1.86 12.61 1.61 12.81L1.29 13.06C0.94 13.34 0.51 13.5 0.05 13.5L0 13.5L0 12L0.05 12C0.51 12 0.94 11.85 1.29 11.57L1.61 11.31C1.86 11.11 2.18 11 2.5 11ZM5.68 1.82L6.32 3.43L6.75 3.21L7.71 2.79L8.04 3.75L6.64 4.29L8.04 7.5L9.67 6.81C11.53 6.01 12.96 5.36 12.96 5.36L12.66 7.07C12.61 7.37 12.56 7.69 12.51 8.01L12.44 8.45L12.35 9.11C12.31 9.43 12.27 9.74 12.24 10.02C11.78 10.06 11.35 10.24 10.98 10.53L10.67 10.78C10.5 10.92 10.28 11 10.05 11L9.95 11C9.72 11 9.5 10.92 9.33 10.78L9.01 10.53C8.58 10.19 8.05 10 7.5 10C6.95 10 6.42 10.19 5.99 10.53L5.67 10.78C5.5 10.92 5.28 11 5.05 11L4.95 11C4.72 11 4.5 10.92 4.33 10.78L4.01 10.53C3.58 10.19 3.05 10 2.5 10C2.41 10 2.33 10.01 2.24 10.02L2.63 9.84C3.39 9.49 4.7 8.92 6.14 8.31L7.29 7.82L5.89 4.61L4.39 5.25L4.07 4.39L4.82 4.06C5.02 3.96 5.25 3.86 5.46 3.75L4.82 2.14L5.68 1.82Z"/>\n</svg>',"steam-train-on-railway-track":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M9 1L9 2C9.55 2 10 2.45 10 3L10 3.88C10.91 4.61 11.5 5.74 11.5 7C11.5 7.69 11.33 8.34 11.02 8.91L11.44 9.71C11.7 10.19 11.52 10.8 11.03 11.06C10.98 11.08 10.93 11.11 10.88 11.12L7.5 12.25L4.12 11.12C3.6 10.95 3.32 10.38 3.49 9.86C3.51 9.81 3.53 9.75 3.56 9.71L3.98 8.91C3.67 8.34 3.5 7.69 3.5 7C3.5 5.74 4.09 4.61 5 3.88L5 3C5 2.45 5.45 2 6 2L6 1L5.5 1C5.22 1 5 0.78 5 0.5C5 0.22 5.22 0 5.5 0L9.5 0C9.78 0 10 0.22 10 0.5C10 0.78 9.78 1 9.5 1L9 1ZM5.79 12.43L5.5 13L9.5 13L9.21 12.43L10.5 12L12 15L10.5 15L10 14L5 14L4.5 15L3 15L4.5 12L5.79 12.43ZM7.5 8C8.05 8 8.5 7.55 8.5 7C8.5 6.45 8.05 6 7.5 6C6.95 6 6.5 6.45 6.5 7C6.5 7.55 6.95 8 7.5 8Z"/>\n</svg>',"shopping-bag":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M8.62 1C8.99 1.01 9.35 1.07 9.7 1.18C10.41 1.38 10.95 1.95 11.11 2.67L11.5 5L14.33 5C14.38 5 14.42 5.01 14.47 5.02C14.74 5.11 14.88 5.39 14.8 5.65L12.92 13.95C12.72 14.57 12.15 15 11.5 15L3.5 15C2.85 15 2.27 14.57 2.07 13.95L0.19 5.65C0.18 5.6 0.17 5.55 0.17 5.5C0.17 5.22 0.39 5 0.67 5L3.5 5L3.89 2.67C4.05 1.95 4.59 1.38 5.3 1.18C5.65 1.07 6.01 1.01 6.38 1L8.62 1ZM8.62 2L6.38 2C6.12 2.01 5.87 2.05 5.62 2.13C5.25 2.19 4.96 2.47 4.88 2.83L4.52 5L10.48 5L10.13 2.83C10.05 2.47 9.76 2.19 9.39 2.13C9.14 2.05 8.88 2.01 8.62 2Z"/>\n</svg>',search:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',server:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-server"><rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect><rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect><line x1="6" y1="6" x2="6.01" y2="6"></line><line x1="6" y1="18" x2="6.01" y2="18"></line></svg>',settings:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>',"shopping-basket":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M3 3.07s0.19 -1.06 1 -1.06H5V1.73a0.5 0.5 0 0 1 0.5 -0.5H9.49a0.5 0.5 0 0 1 0.5 0.5v0.28h1.01a0.83 0.83 0 0 1 0.64 0.29a1.76 1.76 0 0 1 0.36 0.77s0.31 1.57 0.59 2.92h-0.94L11 3L3.98 3L3.33 5.99H2.38Zm11 4.91a1 1 0 0 1 -1 1l-1 3.97s-0.19 1.04 -1 1.04h-7c-0.81 0 -1 -1.04 -1 -1.04L1.98 8.98a1 1 0 0 1 0.02 -2h11A1 1 0 0 1 14 7.98ZM5.03 12.13L5.03 11.01L4.64 9.47a0.54 0.54 0 1 0 -1.06 0.14L3.78 11.01l0.19 1.27A0.54 0.54 0 1 0 5.03 12.13Zm2 -2.6A0.53 0.53 0 0 0 6.5 9l0 0L6.49 9a0.5 0.5 0 0 0 -0.36 0.15a0.53 0.53 0 0 0 -0.16 0.38v2.68a0.53 0.53 0 1 0 1.07 0Zm2 0A0.53 0.53 0 0 0 8.69 9.04a0.5 0.5 0 0 0 -0.39 0a0.53 0.53 0 0 0 -0.34 0.49v2.68a0.53 0.53 0 1 0 1.07 0Zm2.39 0.08a0.54 0.54 0 1 0 -1.06 -0.14L9.96 10.99L9.96 12.13a0.54 0.54 0 1 0 1.06 0.14Z"/>\n</svg>',"shopping-cart":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M1.75 1.5L1.98 1.5C2.38 1.51 3.31 1.58 3.75 2C4.28 2.52 4.5 2.92 4.5 4L13.8 4L12.41 8.81L12.39 8.84C12.16 9.49 11.55 9.97 10.81 9.99C10.81 10 10.8 10 10.8 10L4.3 10L4.3 10.23C4.31 10.31 4.33 10.52 4.45 10.78L4.5 10.9C4.7 11.3 4.8 11.5 5.6 11.5L12.1 11.5C13.1 11.5 13.1 13 12.1 13L5.7 13C4.5 13 3.6 12.3 3.3 11.6C3 10.9 3 10.3 3 10.3L3 4C3 3.48 2.77 3 2.3 3L1.75 3C1.34 3 1 2.66 1 2.25C1 1.84 1.34 1.5 1.75 1.5ZM5.8 13C6.4 13 6.8 13.4 6.8 14C6.8 14.6 6.4 15 5.8 15C5.2 15 4.8 14.6 4.8 14C4.8 13.4 5.2 13 5.8 13ZM10.8 13C11.4 13 11.8 13.4 11.8 14C11.8 14.6 11.4 15 10.8 15C10.2 15 9.8 14.6 9.8 14C9.8 13.4 10.2 13 10.8 13Z"/>\n</svg>',"table-tennis-paddle":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M11.97 10.23a3.81 3.81 0 0 1 -1.91 0.98L3.77 4.93A4.03 4.03 0 0 1 4.77 3.03C7.03 0.77 9.98 0.22 12.38 2.62S14.23 7.97 11.97 10.23Zm-6.99 1.61A3.84 3.84 0 0 1 6.15 11.28A4.53 4.53 0 0 1 8 11.45L3.55 7a4.41 4.41 0 0 1 0.16 1.92a3.66 3.66 0 0 1 -0.52 1.12c-1.07 1.26 -2.13 1.73 -2.13 2.19A1.84 1.84 0 0 0 2.77 13.95C3.23 13.95 3.69 12.94 4.98 11.84Z"/>\n</svg>',"tattoo-machine":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M6.41 2.03C5.43 0.69 3.56 0.39 2.22 1.36C1.99 1.53 1.94 1.84 2.11 2.06C2.26 2.26 2.52 2.33 2.73 2.22L2.8 2.17C3.7 1.52 4.95 1.72 5.6 2.62L0.34 6.44C0.12 6.6 0.07 6.91 0.23 7.13C0.39 7.36 0.7 7.41 0.93 7.25L1.33 6.95L3.1 9.38L3.5 9.08L4.09 9.89L3.28 10.48C3.06 10.64 3.01 10.96 3.17 11.18C3.33 11.4 3.64 11.45 3.87 11.29L9.12 7.47L9.71 8.28L9.31 8.57C9.08 8.74 9.04 9.05 9.2 9.27L11.55 12.51C11.71 12.73 12.02 12.78 12.25 12.62L12.65 12.32L13.24 13.13L14.82 14.46L14.05 12.55L13.46 11.74L13.87 11.44C14.09 11.28 14.14 10.97 13.98 10.74L11.62 7.51C11.46 7.28 11.15 7.24 10.93 7.4L10.52 7.69L9.93 6.88L11.55 5.71L11.85 6.11C12.01 6.33 12.32 6.38 12.54 6.22L13.35 5.63C13.58 5.47 13.63 5.16 13.46 4.94L12.29 3.32C12.13 3.09 11.81 3.04 11.59 3.21L10.78 3.79C10.56 3.96 10.51 4.27 10.67 4.49L10.96 4.9L9.35 6.07L6.99 2.84L7.4 2.54C7.62 2.38 7.67 2.07 7.51 1.84C7.35 1.62 7.04 1.57 6.81 1.73L6.41 2.03ZM6.19 3.42L8.54 6.66L7.32 7.54L6.74 6.73L7.14 6.44L5.38 4.01L6.19 3.42ZM2.95 5.78L3.76 5.19L5.52 7.62L5.93 7.32L6.51 8.13L4.9 9.31L4.31 8.5L4.71 8.2L2.95 5.78Z"/>\n</svg>',toolbox:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M10.64 4.51C10.57 4.51 10.5 4.46 10.5 4.39L10.5 2.53C10.5 2.46 10.46 2.4 10.39 2.4L4.62 2.4C4.54 2.4 4.5 2.46 4.5 2.53L4.5 4.39C4.5 4.46 4.42 4.5 4.35 4.5L0.44 4.5C0.36 4.5 0.3 4.58 0.3 4.65L0.3 6.71C0.3 6.79 0.36 6.9 0.44 6.9L6.74 6.9C6.81 6.9 6.9 6.79 6.9 6.71L6.9 6.28C6.9 6.2 6.93 6 7.01 6L8 6C8.08 6 8.1 6.2 8.1 6.28L8.1 6.72C8.1 6.79 8.2 6.9 8.27 6.9L14.57 6.9C14.64 6.9 14.7 6.79 14.7 6.72L14.7 4.66C14.7 4.58 14.64 4.5 14.57 4.5L10.66 4.5L10.65 4.51L10.64 4.51ZM5.43 4.5C5.35 4.5 5.4 4.46 5.4 4.39L5.4 3.33C5.4 3.26 5.36 3.3 5.43 3.3L9.57 3.3C9.65 3.3 9.6 3.26 9.6 3.33L9.6 4.39C9.6 4.46 9.65 4.5 9.57 4.5L5.43 4.5ZM8.12 8.91C8.12 8.99 8.07 9 8 9L7 9C6.93 9 6.9 9.03 6.9 8.96L6.9 7.48C6.9 7.41 6.8 7.2 6.73 7.2L0.44 7.2C0.36 7.2 0.3 7.41 0.3 7.48L0.3 11.87C0.3 11.94 0.36 12 0.44 12L14.57 12C14.64 12 14.7 11.94 14.7 11.87L14.7 7.48C14.7 7.41 14.64 7.2 14.57 7.2L8.27 7.2C8.19 7.2 8.1 7.41 8.1 7.48L8.1 8.96L8.12 8.92L8.12 8.91Z"/>\n</svg>',target:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-target"><circle cx="12" cy="12" r="10"></circle><circle cx="12" cy="12" r="6"></circle><circle cx="12" cy="12" r="2"></circle></svg>',"trash-2":'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-trash-2"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path><line x1="10" y1="11" x2="10" y2="17"></line><line x1="14" y1="11" x2="14" y2="17"></line></svg>',"upload-cloud":'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-upload-cloud"><polyline points="16 16 12 12 8 16"></polyline><line x1="12" y1="12" x2="12" y2="21"></line><path d="M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"></path><polyline points="16 16 12 12 8 16"></polyline></svg>',"tree-and-bench-with-backrest":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M4 10.94L4 14L3 14L3 10.95C1.93 10.73 1.12 9.77 1.12 8.63C1.12 8.5 1.13 8.37 1.15 8.24C1.97 3.41 2.77 1 3.56 1C4.34 1 5.11 3.41 5.86 8.23L5.86 8.23C6.05 9.49 5.23 10.68 4 10.94ZM6 11L14 11L14 14L13 14L13 12L7 12L7 14L6 14L6 11ZM7 8L13 8L13 10.5L7 10.5L7 8Z"/>\n</svg>',user:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>',"village-buildings":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M6.18 1.18a0.25 0.25 0 0 0 -0.35 0l-4.4 4.4A0.25 0.25 0 0 0 1.6 6H3v6.75a0.25 0.25 0 0 0 0.25 0.25h3.5A0.25 0.25 0 0 0 7 12.75v-7.43c0 -0.07 0.03 -0.13 0.07 -0.18L8.5 3.5L6.18 1.18ZM6 11H5v-1h1v1Zm0 -2H5V8h1v1Zm0 -3v1H5V6h1ZM12.75 3h-0.5a0.25 0.25 0 0 0 -0.25 0.25V5l-1.32 -1.82a0.25 0.25 0 0 0 -0.35 0L8.06 5.93A0.25 0.25 0 0 0 8 6.09v6.66a0.25 0.25 0 0 0 0.25 0.25h1.5a0.25 0.25 0 0 0 0.25 -0.25V11h1v1.75a0.25 0.25 0 0 0 0.25 0.25h1.5a0.25 0.25 0 0 0 0.25 -0.25V3.25a0.25 0.25 0 0 0 -0.25 -0.25ZM10 8H9V7h1v1Zm2 0h-1V7h1v1Zm-2 2H9V9h1v1Zm2 0h-1V9h1v1Z"/>\n</svg>',"wall-hanging-with-mountains-and-sun":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M10.71 3l-2.86 -2.85c-0.19 -0.2 -0.51 -0.2 -0.71 0c0 0 0 0 0 0l-2.85 2.85h-2.79c-0.28 0 -0.5 0.22 -0.5 0.5v9c0 0.28 0.22 0.5 0.5 0.5h12c0.28 0 0.5 -0.22 0.5 -0.5v-9c0 -0.28 -0.22 -0.5 -0.5 -0.5zm-3.21 -1.79l1.79 1.79h-3.58zm5.5 10.79h-11v-8h11zm-8 -5c-0.55 0 -1 -0.45 -1 -1s0.45 -1 1 -1s1 0.45 1 1s-0.45 1 -1 1zm7 4h-7.5l1.5 -3l1.25 2.5l2.25 -4.5z"/>\n</svg>',"womens-and-mens-restroom-symbol":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M5.67 3.46L3.33 3.46L1 11.54L3.33 11.54L3.33 15L5.67 15L5.67 11.54L8 11.54L5.67 3.46ZM4.73 2.31L4.27 2.31C3.68 2.31 3.33 1.96 3.33 1.38L3.33 0.92C3.33 0.35 3.68 0 4.27 0L4.85 0C5.32 0 5.67 0.35 5.67 0.92L5.67 1.5C5.67 1.96 5.32 2.31 4.73 2.31ZM12.83 3.53L8.21 3.53L8.21 9.3L9.36 9.3L9.36 15.07L11.67 15.07L11.67 9.3L12.83 9.3L12.83 3.53ZM10.73 2.31L10.27 2.31C9.68 2.31 9.33 1.96 9.33 1.38L9.33 0.92C9.33 0.35 9.68 0 10.27 0L10.85 0C11.32 0 11.67 0.35 11.67 0.92L11.67 1.5C11.67 1.96 11.32 2.31 10.73 2.31Z"/>\n</svg>',whatsapp:'<?xml version="1.0" encoding="UTF-8"?>\n<svg viewBox="-1.66 0 740.82 740.82" xmlns="http://www.w3.org/2000/svg">\n <path d="m630.06 107.66c-69.329-69.387-161.53-107.62-259.76-107.66-202.4 0-367.13 164.67-367.22 367.07-0.027 64.699 16.883 127.86 49.016 183.52l-52.095 190.23 194.67-51.047c53.634 29.244 114.02 44.656 175.48 44.682h0.151c202.38 0 367.13-164.69 367.21-367.09 0.039-98.088-38.121-190.32-107.45-259.71m-259.76 564.8h-0.125c-54.766-0.021-108.48-14.729-155.34-42.529l-11.146-6.613-115.52 30.293 30.834-112.59-7.258-11.543c-30.552-48.58-46.689-104.73-46.665-162.38 0.067-168.23 136.99-305.1 305.34-305.1 81.521 0.031 158.15 31.81 215.78 89.482s89.342 134.33 89.311 215.86c-0.07 168.24-136.99 305.12-305.21 305.12m167.42-228.51c-9.176-4.591-54.286-26.782-62.697-29.843-8.41-3.061-14.526-4.591-20.644 4.592-6.116 9.182-23.7 29.843-29.054 35.964-5.351 6.122-10.703 6.888-19.879 2.296-9.175-4.591-38.739-14.276-73.786-45.526-27.275-24.32-45.691-54.36-51.043-63.542-5.352-9.183-0.569-14.148 4.024-18.72 4.127-4.11 9.175-10.713 13.763-16.07 4.587-5.356 6.116-9.182 9.174-15.303 3.059-6.122 1.53-11.479-0.764-16.07s-20.643-49.739-28.29-68.104c-7.447-17.886-15.012-15.466-20.644-15.746-5.346-0.266-11.469-0.323-17.585-0.323-6.117 0-16.057 2.296-24.468 11.478-8.41 9.183-32.112 31.374-32.112 76.521s32.877 88.763 37.465 94.885c4.587 6.122 64.699 98.771 156.74 138.5 21.891 9.45 38.982 15.093 52.307 19.323 21.981 6.979 41.983 5.994 57.793 3.633 17.628-2.633 54.285-22.19 61.932-43.616 7.646-21.426 7.646-39.791 5.352-43.617-2.293-3.826-8.41-6.122-17.585-10.714" clip-rule="evenodd" fill-rule="evenodd"/>\n</svg>\n',wikipedia:'<?xml version="1.0" encoding="UTF-8"?>\n<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="7.15 7.15 113.7 113.7" fill="currentColor">\n<path d="M 120.85,29.21 C 120.85,29.62 120.72,29.99 120.47,30.33 C 120.21,30.66 119.94,30.83 119.63,30.83 C 117.14,31.07 115.09,31.87 113.51,33.24 C 111.92,34.6 110.29,37.21 108.6,41.05 L 82.8,99.19 C 82.63,99.73 82.16,100 81.38,100 C 80.77,100 80.3,99.73 79.96,99.19 L 65.49,68.93 L 48.85,99.19 C 48.51,99.73 48.04,100 47.43,100 C 46.69,100 46.2,99.73 45.96,99.19 L 20.61,41.05 C 19.03,37.44 17.36,34.92 15.6,33.49 C 13.85,32.06 11.4,31.17 8.27,30.83 C 8,30.83 7.74,30.69 7.51,30.4 C 7.27,30.12 7.15,29.79 7.15,29.42 C 7.15,28.47 7.42,28 7.96,28 C 10.22,28 12.58,28.1 15.05,28.3 C 17.34,28.51 19.5,28.61 21.52,28.61 C 23.58,28.61 26.01,28.51 28.81,28.3 C 31.74,28.1 34.34,28 36.6,28 C 37.14,28 37.41,28.47 37.41,29.42 C 37.41,30.36 37.24,30.83 36.91,30.83 C 34.65,31 32.87,31.58 31.57,32.55 C 30.27,33.53 29.62,34.81 29.62,36.4 C 29.62,37.21 29.89,38.22 30.43,39.43 L 51.38,86.74 L 63.27,64.28 L 52.19,41.05 C 50.2,36.91 48.56,34.23 47.28,33.03 C 46,31.84 44.06,31.1 41.46,30.83 C 41.22,30.83 41,30.69 40.78,30.4 C 40.56,30.12 40.45,29.79 40.45,29.42 C 40.45,28.47 40.68,28 41.16,28 C 43.42,28 45.49,28.1 47.38,28.3 C 49.2,28.51 51.14,28.61 53.2,28.61 C 55.22,28.61 57.36,28.51 59.62,28.3 C 61.95,28.1 64.24,28 66.5,28 C 67.04,28 67.31,28.47 67.31,29.42 C 67.31,30.36 67.15,30.83 66.81,30.83 C 62.29,31.14 60.03,32.42 60.03,34.68 C 60.03,35.69 60.55,37.26 61.6,39.38 L 68.93,54.26 L 76.22,40.65 C 77.23,38.73 77.74,37.11 77.74,35.79 C 77.74,32.69 75.48,31.04 70.96,30.83 C 70.55,30.83 70.35,30.36 70.35,29.42 C 70.35,29.08 70.45,28.76 70.65,28.46 C 70.86,28.15 71.06,28 71.26,28 C 72.88,28 74.87,28.1 77.23,28.3 C 79.49,28.51 81.35,28.61 82.8,28.61 C 83.84,28.61 85.38,28.52 87.4,28.35 C 89.96,28.12 92.11,28 93.83,28 C 94.23,28 94.43,28.4 94.43,29.21 C 94.43,30.29 94.06,30.83 93.32,30.83 C 90.69,31.1 88.57,31.83 86.97,33.01 C 85.37,34.19 83.37,36.87 80.98,41.05 L 71.26,59.02 L 84.42,85.83 L 103.85,40.65 C 104.52,39 104.86,37.48 104.86,36.1 C 104.86,32.79 102.6,31.04 98.08,30.83 C 97.67,30.83 97.47,30.36 97.47,29.42 C 97.47,28.47 97.77,28 98.38,28 C 100.03,28 101.99,28.1 104.25,28.3 C 106.34,28.51 108.1,28.61 109.51,28.61 C 111,28.61 112.72,28.51 114.67,28.3 C 116.7,28.1 118.52,28 120.14,28 C 120.61,28 120.85,28.4 120.85,29.21 z" />\n</svg>',winding_way_wide:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M2 0L7 0C11.2 1.11 13.53 2.44 14 4C14.7 6.34 9.75 7.27 10 10C10.17 11.82 11.5 13.49 14 15L2 15C0.11 13.32 -0.3 11.32 0.75 9C2.33 5.52 6.68 6.1 7 4C7.21 2.6 5.54 1.27 2 0Z"/>\n</svg>',parking_p:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M10 0C12.76 0 15 2.24 15 5C15 7.76 12.76 10 10 10L5 10L5 15L2 15L2 0L10 0ZM5 7L10 7C11.1 7 12 6.1 12 5C12 3.9 11.1 3 10 3L5 3L5 7Z"/>\n</svg>',car:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M4.62 2L10.38 2C10.76 2 11.11 2.21 11.28 2.55L13 6C13.55 6 14 6.45 14 7L14 11.5L13 11.5L13 12.5C13 13.05 12.55 13.5 12 13.5L11 13.5C10.45 13.5 10 13.05 10 12.5L10 11.5L5 11.5L5 12.5C5 13.05 4.55 13.5 4 13.5L3 13.5C2.45 13.5 2 13.05 2 12.5L2 11.5L1 11.5L1 7C1 6.45 1.45 6 2 6L3.72 2.55C3.89 2.21 4.24 2 4.62 2ZM4.25 7.5C3.56 7.5 3 8.06 3 8.75C3 9.44 3.56 10 4.25 10C4.94 10 5.5 9.44 5.5 8.75C5.5 8.06 4.94 7.5 4.25 7.5ZM10.75 7.5C10.06 7.5 9.5 8.06 9.5 8.75C9.5 9.44 10.06 10 10.75 10C11.44 10 12 9.44 12 8.75C12 8.06 11.44 7.5 10.75 7.5ZM10.25 3.5L4.75 3.5L3.5 6L11.5 6L10.25 3.5Z"/>\n</svg>',"car-and-wrench":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M9.64 6C9.85 6 10.04 6.14 10.11 6.34L11 9C11.55 9 12 9.45 12 10L12 13L11 13L11 14C11 14.55 10.55 15 10 15C9.45 15 9 14.55 9 14L9 13L6 13L6 14C6 14.55 5.55 15 5 15C4.45 15 4 14.55 4 14L4 13L3 13L3 10C3 9.45 3.45 9 4 9L4.89 6.34C4.96 6.14 5.15 6 5.36 6L9.64 6ZM5 10C4.45 10 4 10.45 4 11C4 11.55 4.45 12 5 12C5.55 12 6 11.55 6 11C6 10.45 5.55 10 5 10ZM10 10C9.45 10 9 10.45 9 11C9 11.55 9.45 12 10 12C10.55 12 11 11.55 11 11C11 10.45 10.55 10 10 10ZM9.38 7L5.62 7L5 9L10 9L9.38 7ZM11.5 0.5C12.52 0.5 13.4 1.12 13.79 2L11.5 2L11 3L11.5 4L13.79 4C13.4 4.88 12.52 5.5 11.5 5.5C10.48 5.5 9.6 4.88 9.21 4L3 4C2.45 4 2 3.55 2 3C2 2.45 2.45 2 3 2L9.21 2C9.6 1.12 10.48 0.5 11.5 0.5Z"/>\n</svg>',"castle-keep":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 15">\n <path d="M11 4H4C3.45 4 3 3.55 3 3V0.5C3 0.22 3.22 0 3.5 0S4 0.22 4 0.5V2h1V1c0 -0.55 0.45 -1 1 -1s1 0.45 1 1v1h1V1c0 -0.55 0.45 -1 1 -1s1 0.45 1 1v1h1V0.5C11 0.22 11.22 0 11.5 0S12 0.22 12 0.5V3C12 3.55 11.55 4 11 4zM14 14.5c0 0.28 -0.22 0.5 -0.5 0.5h-12C1.22 15 1 14.78 1 14.5S1.22 14 1.5 14H2c0.55 0 1 -0.45 1 -1c0 0 1 -6 1 -7c0 -0.55 0.45 -1 1 -1h5c0.55 0 1 0.45 1 1c0 1 1 7 1 7c0 0.55 0.45 1 1 1h0.5c0.27 0 0.49 0.22 0.5 0.49V14.5zM9 10.5C9 9.67 8.33 9 7.5 9S6 9.67 6 10.5V14h3V10.5z"/>\n</svg>',x:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>',zap:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-zap"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon></svg>',"loading-ring":'<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" data-ember-extension="1"><path d="M10.72,19.9a8,8,0,0,1-6.5-9.79A7.77,7.77,0,0,1,10.4,4.16a8,8,0,0,1,9.49,6.52A1.54,1.54,0,0,0,21.38,12h.13a1.37,1.37,0,0,0,1.38-1.54,11,11,0,1,0-12.7,12.39A1.54,1.54,0,0,0,12,21.34h0A1.47,1.47,0,0,0,10.72,19.9Z"><animateTransform attributeName="transform" type="rotate" dur="0.75s" values="0 12 12;360 12 12" repeatCount="indefinite"/></path></svg>'},wB=["fork-and-knife","wikipedia","whatsapp","cup-and-saucer","coffee-bean","shopping-basket","person-sleeping-in-bed","loading-ring","nostrich"];function _B(e){return bB[e]}function xB(e){return wB.includes(e)}var CB=a({POI_ICON_RULES:()=>SB,getIconNameForTags:()=>kB,getIconSvgForTags:()=>EB}),SB=[{tags:{cuisine:"donut"},icon:"donut"},{tags:{cuisine:"doughnut"},icon:"donut"},{tags:{cuisine:"coffee_shop"},icon:"coffee-bean"},{tags:{cuisine:"coffee"},icon:"coffee-bean"},{tags:{amenity:"ice_cream"},icon:"ice-cream-on-cone"},{tags:{cuisine:"ice_cream"},icon:"ice-cream-on-cone"},{tags:{shop:"ice_cream"},icon:"ice-cream-on-cone"},{tags:{amenity:"cafe"},icon:"cup-and-saucer"},{tags:{amenity:"restaurant"},icon:"fork-and-knife"},{tags:{amenity:"fast_food"},icon:"burger-and-drink-cup-with-straw"},{tags:{amenity:"pub"},icon:"beer-mug-with-foam"},{tags:{amenity:"bar"},icon:"cocktail"},{tags:{amenity:"food_court"},icon:"fork-and-knife"},{tags:{amenity:"childcare"},icon:"family-restroom-symbol"},{tags:{amenity:"community_centre"},icon:"family-restroom-symbol"},{tags:{amenity:"social_centre"},icon:"family-restroom-symbol"},{tags:{amenity:"social_facility"},icon:"family-restroom-symbol"},{tags:{amenity:"bank"},icon:"banknote"},{tags:{amenity:"place_of_worship"},icon:"place-of-worship-building"},{tags:{amenity:"townhall"},icon:"classical-building-with-clock"},{tags:{building:"townhall"},icon:"classical-building-with-clock"},{tags:{amenity:"fire_station"},icon:"badge-shield-with-fire"},{tags:{amenity:"police"},icon:"police-officer-with-stop-arm"},{tags:{amenity:"toilets"},icon:"womens-and-mens-restroom-symbol"},{tags:{amenity:"school"},icon:"open-book"},{tags:{amenity:"driving_school"},icon:"car"},{tags:{shop:"coffee"},icon:"coffee-bean"},{tags:{shop:"tea"},icon:"coffee-bean"},{tags:{shop:"pastry"},icon:"donut"},{tags:{shop:"supermarket"},icon:"shopping-cart"},{tags:{shop:"convenience"},icon:"shopping-basket"},{tags:{shop:"grocery"},icon:"shopping-basket"},{tags:{shop:"greengrocer"},icon:"shopping-basket"},{tags:{shop:"bakery"},icon:"croissant"},{tags:{shop:"butcher"},icon:"cleaver"},{tags:{shop:"seafood"},icon:"fish"},{tags:{shop:"deli"},icon:"shopping-basket"},{tags:{shop:"clothes"},icon:"clothes-hanger"},{tags:{shop:"clothing"},icon:"clothes-hanger"},{tags:{shop:"hairdresser"},icon:"scissors-open"},{tags:{shop:"optician"},icon:"eyeglasses"},{tags:{shop:"fabric"},icon:"cloth"},{tags:{shop:"flea_market"},icon:"market-stall"},{tags:{shop:"kiosk"},icon:"shopping-basket"},{tags:{shop:"leather"},icon:"shopping-bag"},{tags:{shop:"tailor"},icon:"needle-and-spool-of-thread"},{tags:{shop:"jewelry"},icon:"jewel"},{tags:{shop:"jewellery"},icon:"jewel"},{tags:{shop:"tobacco"},icon:"cigarette-with-smoke-curl"},{tags:{shop:"cannabis"},icon:"cigarette-with-smoke-curl"},{tags:{shop:"florist"},icon:"flower-bouquet"},{tags:{shop:"garden_centre"},icon:"plant-in-raised-planter"},{tags:{shop:"estate_agent"},icon:"village-buildings"},{tags:{shop:"mobile_phone"},icon:"mobile-phone-with-keypad-and-antenna"},{tags:{beauty:"nails"},icon:"fingernail-polished"},{tags:{shop:"tattoo"},icon:"tattoo-machine"},{tags:{shop:"beauty"},icon:"fancy-mirror-with-reflection-and-stars"},{tags:{shop:"car_repair"},icon:"car-and-wrench"},{tags:{craft:"tailor"},icon:"needle-and-spool-of-thread"},{tags:{office:"estate_agent"},icon:"village-buildings"},{tags:{office:!0},icon:"commercial-building"},{tags:{craft:!0},icon:"toolbox"},{tags:{shop:!0},icon:"shopping-bag"},{tags:{natural:"beach"},icon:"beach-umbrella-in-ground"},{tags:{leisure:"park"},icon:"tree-and-bench-with-backrest"},{tags:{leisure:"playground"},icon:"play-structure-with-slide"},{tags:{aeroway:"aerodrome"},icon:"plane-top-right"},{tags:{aeroway:"heliport"},icon:"plane-top-right"},{tags:{aeroway:"helipad"},icon:"plane-top-right"},{tags:{highway:"bus_stop"},icon:"bus"},{tags:{bus:!0},icon:"bus"},{tags:{railway:"tram_stop"},icon:"person-boarding-tram-with-destination-display-and-pantograph-on-tram-track"},{tags:{tourism:"museum"},icon:"classical-building"},{tags:{tourism:"gallery"},icon:"wall-hanging-with-mountains-and-sun"},{tags:{tourism:"aquarium"},icon:"angelfish"},{tags:{tourism:"theme_park"},icon:"camera"},{tags:{tourism:"attraction"},icon:"camera"},{tags:{tourism:"viewpoint"},icon:"camera"},{tags:{tourism:"zoo"},icon:"camera"},{tags:{tourism:"artwork"},icon:"camera"},{tags:{tourism:"information"},icon:"info-i"},{tags:{amenity:"cinema"},icon:"film"},{tags:{amenity:"theatre"},icon:"camera"},{tags:{amenity:"arts_centre"},icon:"comedy-mask-and-tragedy-mask"},{tags:{amenity:"arts_center"},icon:"comedy-mask-and-tragedy-mask"},{tags:{historic:"canal"},icon:"winding_way_wide"},{tags:{historic:"bridge"},icon:"bridge"},{tags:{historic:"bridge_site"},icon:"bridge"},{tags:{historic:"fort"},icon:"fort"},{tags:{historic:"city_gate"},icon:"city-gate"},{tags:{historic:"castle"},icon:"palace"},{tags:{building:"tower",historic:"yes"},icon:"castle-keep"},{tags:{historic:"building"},icon:"classical-building-with-flag"},{tags:{historic:"archaeological_site"},icon:"grecian-vase"},{tags:{historic:"memorial"},icon:"memorial-stone-with-inscription"},{tags:{historic:"tomb"},icon:"gravestone"},{tags:{historic:"monument"},icon:"classical-building-with-dome-and-flag"},{tags:{historic:"folly"},icon:"classical-building"},{tags:{historic:"industrial"},icon:"industrial-building"},{tags:{historic:"railway_station"},icon:"steam-train-on-railway-track"},{tags:{historic:"ship"},icon:"sailing-ship-in-water"},{tags:{historic:"wreck"},icon:"shipwreck-in-water"},{tags:{historic:"ruins"},icon:"camera"},{tags:{historic:"ruin"},icon:"camera"},{tags:{historic:"yes"},icon:"camera"},{tags:{tourism:"hotel"},icon:"person-sleeping-in-bed"},{tags:{tourism:"hostel"},icon:"person-sleeping-in-bed"},{tags:{tourism:"motel"},icon:"person-sleeping-in-bed"},{tags:{tourism:"guest_house"},icon:"person-sleeping-in-bed"},{tags:{sport:"motor"},icon:"flag-checkered"},{tags:{sport:"karting"},icon:"flag-checkered"},{tags:{sport:"motocross"},icon:"flag-checkered"},{tags:{sport:"cricket"},icon:"person-cricket-batting-at-cricket-ball"},{tags:{sport:"boxing"},icon:"boxing-glove-up"},{tags:{sport:"martial_arts"},icon:"boxing-glove-up"},{tags:{sport:"tennis"},icon:"person-playing-tennis"},{tags:{sport:"squash"},icon:"person-playing-tennis"},{tags:{sport:"padel"},icon:"person-playing-tennis"},{tags:{sport:"table_tennis"},icon:"table-tennis-paddle"},{tags:{sport:"climbing"},icon:"climbing_wall"},{tags:{leisure:"water_park"},icon:"person-swimming-in-water"},{tags:{sport:"swimming"},icon:"person-swimming-in-water"},{tags:{sport:"golf"},icon:"person-swinging-golf-club"},{tags:{leisure:"golf_course"},icon:"person-swinging-golf-club"},{tags:{sport:"horse_racing"},icon:"person-jockeying-racehorse"},{tags:{sport:"fitness"},icon:"barbell"},{tags:{sport:"fitness_centre"},icon:"barbell"},{tags:{leisure:"fitness_centre"},icon:"barbell"},{tags:{sport:"stadium"},icon:"round-structure-with-flag"},{tags:{leisure:"stadium"},icon:"round-structure-with-flag"},{tags:{leisure:"sports_centre"},icon:"person-running"},{tags:{leisure:"pitch"},icon:"person-running"},{tags:{sport:!0},icon:"person-running"},{tags:{amenity:"dentist"},icon:"molar-tooth"},{tags:{healthcare:"dentist"},icon:"molar-tooth"},{tags:{healthcare:!0},icon:"greek-cross"},{tags:{amenity:"parking"},icon:"parking_p"},{tags:{building:"commercial"},icon:"commercial-building"},{tags:{building:"apartments"},icon:"lowrise-building"}];function kB(e){if(!e)return null;for(const t of SB){let n=!0;for(const[r,i]of Object.entries(t.tags)){const t=e[r];if(!t){n=!1;break}const s=t.split(";").map(e=>e.trim());if(!0!==i&&!s.includes(i)){n=!1;break}}if(n)return t.icon}return null}function EB(e){const t=kB(e);return t?_B(t):null}var RB=a({getMatchingPoiCategories:()=>TB,getMatchingPoiCategoryIds:()=>LB});function TB(e,t){return Array.isArray(t)&&e?t.filter(t=>!!Array.isArray(t.filter)&&t.filter.some(t=>function(e,t){const n=function(e){if(!e)return[];const t=e.match(/\[[^\]]+\]/g);return t?t.map(e=>function(e){const t=e.match(/^"([^"]+)"$/);if(t)return{type:"presence",key:t[1]};const n=e.match(/^"([^"]+)"\s*=\s*"([^"]*)"$/);if(n)return{type:"equals",key:n[1],value:n[2]};const r=e.match(/^"([^"]+)"\s*~\s*"([^"]*)"$/);if(r)return{type:"regex",key:r[1],pattern:r[2],regex:new RegExp(r[2])};const i=e.match(/^"([^"]+)"\s*!~\s*"([^"]*)"$/);return i?{type:"not-regex",key:i[1],pattern:i[2],regex:new RegExp(i[2])}:null}(e.slice(1,-1).trim())).filter(Boolean):[]}(t);return 0!==n.length&&n.every(t=>function(e,t){const n=function(e,t){if(!e||!t)return[];const n=e[t];return null==n?[]:String(n).split(";").map(e=>e.trim()).filter(Boolean)}(e,t.key);switch(t.type){case"presence":return n.length>0;case"equals":return n.some(e=>e===t.value);case"regex":return n.some(e=>t.regex.test(e));case"not-regex":return 0===n.length||!n.some(e=>t.regex.test(e));default:return!1}}(e,t))}(e,t))):[]}function LB(e,t){return TB(e,t).map(e=>e.id)}var IB=a({CATEGORY_TAGS:()=>PB,getSuggestedPhotoTags:()=>MB}),PB={restaurants:["food","menu","vibe","front"],coffee:["food","menu","vibe","front"],groceries:["front","food"],"things-to-do":["architecture","amenities","vibe","front"],accommodation:["rooms","amenities","food","vibe","front"]};function MB(e){const t=LB(e?.osmTags||e?.tags||{},VU),n=[];for(const r of t){const e=PB[r];if(Array.isArray(e))for(const t of e)n.includes(t)||n.push(t)}return 0===n.length?[]:n}var AB=a({mapToStorageSchema:()=>OB});function OB(e){return{title:e.title||UU(e.osmTags,"Untitled Place"),lat:e.lat,lon:e.lon,tags:[],url:e.osmTags?.website,osmId:String(e.osmId||e.id),osmType:e.osmType,osmTags:e.osmTags||{},description:e.description}}var NB=a({getSocialInfo:()=>DB}),FB=(e,...t)=>{for(const n of t)if(e[n])return e[n];return null};function DB(e,t){if(!e)return null;const n=`${t}.com`,r=FB(e,`contact:${t}`,t);if(!r)return null;if(r.startsWith("http"))try{const e=new URL(r);return"facebook"===t&&"/profile.php"===e.pathname&&e.searchParams.has("id")?{url:r,username:e.searchParams.get("id")}:{url:r,username:e.pathname.replace(/^\/|\/$/g,"")||r}}catch{return{url:r,username:r}}const i=r.replace(/^@/,"");return{url:`https://${n}/${i}`,username:i}}var zB,jB,UB,BB,$B,qB=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","#","$","%","*","+",",","-",".",":",";","=","?","@","[","]","^","_","{","|","}","~"],VB=e=>{let t=0;for(let n=0;n<e.length;n++){let r=e[n];t=83*t+qB.indexOf(r)}return t},WB=(e,t)=>{var n="";for(let r=1;r<=t;r++){let i=Math.floor(e)/Math.pow(83,t-r)%83;n+=qB[Math.floor(i)]}return n},HB=e=>{let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},GB=e=>{let t=Math.max(0,Math.min(1,e));return t<=.0031308?Math.trunc(12.92*t*255+.5):Math.trunc(255*(1.055*Math.pow(t,.4166666666666667)-.055)+.5)},KB=(e,t)=>(e=>e<0?-1:1)(e)*Math.pow(Math.abs(e),t),ZB=class extends Error{constructor(e){super(e),this.name="ValidationError",this.message=e}},YB=e=>{let t=e>>8&255,n=255&e;return[HB(e>>16),HB(t),HB(n)]},XB=(e,t)=>{let n=Math.floor(e/361),r=Math.floor(e/19)%19,i=e%19;return[KB((n-9)/9,2)*t,KB((r-9)/9,2)*t,KB((i-9)/9,2)*t]},JB=(e,t,n,r)=>{let i=0,s=0,o=0,a=4*t;for(let c=0;c<t;c++){let t=4*c;for(let l=0;l<n;l++){let n=t+l*a,u=r(c,l);i+=u*HB(e[n]),s+=u*HB(e[n+1]),o+=u*HB(e[n+2])}}let l=1/(t*n);return[i*l,s*l,o*l]},QB=a({});function e$(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t$(e,t,n,r){n&&Object.defineProperty(e,t,{enumerable:n.enumerable,configurable:n.configurable,writable:n.writable,value:n.initializer?n.initializer.call(r):void 0})}function n$(e,t,n,r,i){var s={};return Object.keys(r).forEach(function(e){s[e]=r[e]}),s.enumerable=!!s.enumerable,s.configurable=!!s.configurable,("value"in s||s.initializer)&&(s.writable=!0),s=n.slice().reverse().reduce(function(n,r){return r(e,t,n)||n},s),i&&void 0!==s.initializer&&(s.value=s.initializer?s.initializer.call(i):void 0,s.initializer=void 0),void 0===s.initializer&&(Object.defineProperty(e,t,s),s=null),s}self.onmessage=async e=>{if("PROCESS_IMAGE"!==e.data?.type)return;const{id:t,file:n,targetWidth:r,targetHeight:i,quality:s,computeBlurhash:o}=e.data;try{let e,c;try{const t=await createImageBitmap(n,{resizeWidth:r,resizeHeight:i,resizeQuality:"high"});if(e=new OffscreenCanvas(r,i),c=e.getContext("2d"),!c)throw new Error("Failed to get 2d context from OffscreenCanvas");c.drawImage(t,0,0,r,i),t.close()}catch(a){console.warn("Hardware resize failed, falling back to stepped software scaling:",a);const t=await n.arrayBuffer(),s=new Blob([t],{type:n.type}),o=await createImageBitmap(s);let l=o.width,u=o.height,h=new OffscreenCanvas(l,u),d=h.getContext("2d");for(d.imageSmoothingEnabled=!0,d.imageSmoothingQuality="high",d.drawImage(o,0,0);.5*h.width>r&&.5*h.height>i;){const e=new OffscreenCanvas(Math.floor(.5*h.width),Math.floor(.5*h.height)),t=e.getContext("2d");t.imageSmoothingEnabled=!0,t.imageSmoothingQuality="high",t.drawImage(h,0,0,e.width,e.height),h=e}e=new OffscreenCanvas(r,i),c=e.getContext("2d"),c.imageSmoothingEnabled=!0,c.imageSmoothingQuality="high",c.drawImage(h,0,0,r,i),o.close()}let u=null;if(o)try{u=((e,t,n)=>{if(t*n*4!==e.length)throw new ZB("Width and height must match the pixels array");let r=[];for(let l=0;l<3;l++)for(let i=0;i<4;i++){let s=0==i&&0==l?1:2,o=JB(e,t,n,(e,r)=>s*Math.cos(Math.PI*i*e/t)*Math.cos(Math.PI*l*r/n));r.push(o)}let i,s=r[0],o=r.slice(1),a="";if(a+=WB(21,1),o.length>0){let e=Math.max(...o.map(e=>Math.max(...e))),t=Math.floor(Math.max(0,Math.min(82,Math.floor(166*e-.5))));i=(t+1)/166,a+=WB(t,1)}else i=1,a+=WB(0,1);return a+=WB((e=>(GB(e[0])<<16)+(GB(e[1])<<8)+GB(e[2]))(s),4),o.forEach(e=>{a+=WB(((e,t)=>19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*KB(e[0]/t,.5)+9.5))))*19+19*Math.floor(Math.max(0,Math.min(18,Math.floor(9*KB(e[1]/t,.5)+9.5))))+Math.floor(Math.max(0,Math.min(18,Math.floor(9*KB(e[2]/t,.5)+9.5)))))(e,i),2)}),a})(c.getImageData(0,0,r,i).data,r,i)}catch(l){console.warn("Could not generate blurhash (possible canvas fingerprinting protection):",l)}const h=await e.convertToBlob({type:"image/jpeg",quality:s}),d=`${r}x${i}`;self.postMessage({id:t,success:!0,blob:h,dim:d,blurhash:u})}catch(_6){self.postMessage({id:t,success:!1,error:_6.message})}};var r$="undefined"!=typeof FastBoot,i$="routeDidChange",s$=["separator","prepend","replace"],o$=(zB=dp("router"),jB=dp("-document"),UB=class extends pp{constructor(e){if(super(e),t$(this,"router",BB,this),t$(this,"document",$B,this),e$(this,"tokens",[]),e$(this,"_defaultConfig",{separator:" | ",prepend:!0,replace:null}),e$(this,"scheduleTitleUpdate",()=>{Is("afterRender",this,this._updateTitle)}),this._validateExistingTitleElement(),function(e){return"resolveRegistration"in e}(e)){const n=e.resolveRegistration("config:environment");"object"==typeof(t=n)&&null!==t&&"pageTitle"in t&&s$.forEach(e=>{if(!function(e){if(null==e)return!0;if(!cr(e)&&"number"==typeof e.size)return!e.size;if("object"==typeof e){let t=ur(e,"size");if("number"==typeof t)return!t;let n=ur(e,"length");if("number"==typeof n)return!n}return"number"==typeof e.length&&"function"!=typeof e&&!e.length}(n.pageTitle[e])){const t=n.pageTitle[e];this._defaultConfig[e]=t}})}var t;this.router.on(i$,this.scheduleTitleUpdate)}applyTokenDefaults(e){const t=this._defaultConfig.separator,n=this._defaultConfig.prepend,r=this._defaultConfig.replace;e.previous??=null,e.next??=null,null==e.separator&&(e.separator=t),null==e.prepend&&null!=n&&(e.prepend=n),null==e.replace&&null!=r&&(e.replace=r)}inheritFromPrevious(e){const t=e.previous;t&&(null==e.separator&&(e.separator=t.separator),null==e.prepend&&(e.prepend=t.prepend))}push(e){const t=this._findTokenById(e.id);if(t){const n=this.tokens.indexOf(t),r=[...this.tokens];return e.previous=t.previous,e.next=t.next,this.inheritFromPrevious(e),this.applyTokenDefaults(e),r.splice(n,1,e),void(this.tokens=r)}const n=this.tokens.slice(-1)[0];n&&(e.previous=n??null,n.next=e,this.inheritFromPrevious(e)),this.applyTokenDefaults(e),this.tokens=[...this.tokens,e]}remove(e){const t=this._findTokenById(e);if(!t)return;const{next:n,previous:r}=t;n&&(n.previous=r),r&&(r.next=n),t.previous=t.next=null;const i=[...this.tokens];i.splice(i.indexOf(t),1),this.tokens=i}get visibleTokens(){const e=this.tokens;let t=e?e.length:0;const n=[];for(;t--;){const r=e[t];if(r){if(r.replace){n.unshift(r);break}n.unshift(r)}}return n}get sortedTokens(){const e=this.visibleTokens;if(!e)return[];let t=!0,n=[];const r=[n],i=[];return e.forEach(e=>{e.front?i.unshift(e):e.prepend?(t&&(t=!1,n=[],r.push(n)),n.unshift(e)):(t||(t=!0,n=[],r.push(n)),n.push(e))}),i.concat(r.reduce((e,t)=>e.concat(t),[]))}toString(){const e=this.sortedTokens,t=[];for(let n=0,r=e.length;n<r;n++){const i=e[n];i&&i.title&&(t.push(i.title),n+1<r&&t.push(i.separator))}return t.join("")}willDestroy(){super.willDestroy(),this.router.off(i$,this.scheduleTitleUpdate)}_updateTitle(){const e=this.toString();r$?this.updateFastbootTitle(e):this.document.title=e,this.titleDidUpdate(e)}_validateExistingTitleElement(){r$||document.head.querySelectorAll("title").length}_findTokenById(e){return this.tokens.find(t=>t.id===e)}updateFastbootTitle(e){if(!r$)return;const t=this.document.head,n=t.childNodes;for(let s=0;s<n.length;s++){const e=n[s];e&&"title"===e.nodeName.toLowerCase()&&t.removeChild(e)}const r=this.document.createElement("title"),i=this.document.createTextNode(e);r.appendChild(i),t.appendChild(r)}titleDidUpdate(e){}},BB=n$(UB.prototype,"router",[zB],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),$B=n$(UB.prototype,"document",[jB],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),UB),a$=a({default:()=>o$}),l$=wl.create({target:null,action:null,actionContext:null,actionContextObject:Yn("actionContext",function(){let e=ur(this,"actionContext");if("string"==typeof e){let t=ur(this,e);return void 0===t&&(t=ur(Xr.lookup,e)),t}return e}),triggerAction(e={}){let{action:t,target:n,actionContext:r}=e;t=t||ur(this,"action"),n=n||function(e){let t=ur(e,"target");if(t){if("string"==typeof t){let n=ur(e,t);return void 0===n&&(n=ur(Xr.lookup,t)),n}return t}return e._target?e._target:null}(this),void 0===r&&(r=ur(this,"actionContextObject")||this);let i=Array.isArray(r)?r:[r];if(n&&t){let e;if(e=null!=(s=n)&&"object"==typeof s&&"function"==typeof s.send?n.send(t,...i):n[t](...i),!1!==e)return!0}var s;return!1}}),c$=wl.create({send(e,...t){let n=this.actions&&this.actions[e];if(n&&!0!==n.apply(this,t))return;let r=ur(this,"target");r&&r.send(...arguments)}}),u$=Object.freeze({appendChild(){throw new Error("You can't use appendChild outside of the rendering process")},handleEvent:()=>!0,rerender(){},destroy(){}}),h$=Object.freeze({...u$}),d$=Object.freeze({...u$,rerender(e){e.renderer.rerender()},destroy(e){e.renderer.remove(e)},handleEvent:(e,t,n)=>!e.has(t)||cv(0,0,()=>_s(e,e.trigger,t,n))}),p$=Object.freeze({...d$,enter(e){e.renderer.register(e)}}),f$=Object.freeze({...u$,appendChild(){throw new Error("You can't call appendChild on a view being destroyed")},rerender(){throw new Error("You can't call rerender on a view being destroyed")}}),g$=Object.freeze({preRender:h$,inDOM:p$,hasElement:d$,destroying:f$}),m$=class extends(Yc.extend(vc,Sl)){isView=!0;_superTrigger;_superHas;init(e){super.init(e),this._superTrigger=this.trigger,this.trigger=this._trigger,this._superHas=this.has,this.has=this._has,this.parentView??=null,this._state="preRender",this._currentState=this._states.preRender}static{Gh(this.prototype,"renderer",[$r("renderer","-dom")])}#qe=void Zh(this,"renderer");instrumentDetails(e){return e.object=this.toString(),e.containerKey=this._debugContainerKey,e.view=this,e}_trigger(e,...t){this._superTrigger(e,...t);let n=this[e];if("function"==typeof n)return n.apply(this,t)}_has(e){return"function"==typeof this[e]||this._superHas(e)}static isViewFactory=!0};m$.prototype._states=g$;var y$=a({Input:()=>l_,Textarea:()=>h_,capabilities:()=>lb,default:()=>w$,getComponentTemplate:()=>Op,setComponentManager:()=>_$,setComponentTemplate:()=>Ap}),v$=new WeakMap,b$=Object.freeze([]),w$=class extends(m$.extend(l$,c$,{didReceiveAttrs(){},didRender(){},didUpdate(){},didUpdateAttrs(){},willRender(){},willUpdate(){}},{concatenatedProperties:["attributeBindings","classNames","classNameBindings"],classNames:b$,classNameBindings:b$})){isComponent=!0;init(e){super.init(e),this._superRerender=this.rerender,this.rerender=this._rerender,this[Tv]=!1,this[Rv]=fe(),this[Lv]=null;const t=this._dispatcher;if(t){let e=v$.get(t);e||(e=new WeakSet,v$.set(t,e));let n=Object.getPrototypeOf(this);e.has(n)||(t.lazyEvents.forEach((e,n)=>{null!==e&&"function"==typeof this[e]&&t.setupHandlerForBrowserEvent(n)}),e.add(n))}this.elementId||""===this.tagName||(this.elementId=al(this))}__dispatcher;get _dispatcher(){if(void 0===this.__dispatcher){let e=Ur(this);if(e.lookup("-environment:main").isInteractive){let t=e.lookup("event_dispatcher:main");this.__dispatcher=t}else this.__dispatcher=null}return this.__dispatcher}on(e,t,n){return this._dispatcher?.setupHandlerForEmberEvent(e),super.on(e,t,n)}_rerender(){de(this[Rv]),this._superRerender()}[Un](e,t){if(this[Tv])return;let n=Ev.get(this),r=void 0!==n?n[e]:void 0;void 0!==r&&bt(r)&&_t(r,2===arguments.length?t:ur(this,e))}getAttr(e){return this.get(e)}readDOMAttr(e){let t=Jl(this),n="http://www.w3.org/2000/svg"===t.namespaceURI,{type:r,normalized:i}=Cg(t,e);return n||"attr"===r?t.getAttribute(i):t[i]}get childViews(){return ic(this)}static{Kh(this.prototype,"childViews",[C({configurable:!1,enumerable:!1})])}appendChild(e){sc(this,e)}_transitionTo(e){let t=this._currentState,n=this._currentState=this._states[e];this._state=e,t&&t.exit&&t.exit(this),n.enter&&n.enter(this)}nearestOfType(e){let t=this.parentView;for(;t;){if(e.detect(t.constructor))return t;t=t.parentView}}nearestWithProperty(e){let t=this.parentView;for(;t;){if(e in t)return t;t=t.parentView}}rerender(){return this._currentState.rerender(this)}get element(){return this.renderer.getElement(this)}static{Kh(this.prototype,"element",[C({configurable:!1,enumerable:!1})])}appendTo(e){let t;return t=Mo&&"string"==typeof e?document.querySelector(e):e,this.renderer.appendTo(this,t),this}append(){return this.appendTo(document.body)}willInsertElement(){return this}didInsertElement(){return this}willClearRender(){return this}destroy(){return super.destroy(),this._currentState.destroy(this),this}willDestroyElement(){return this}didDestroyElement(){return this}parentViewDidChange(){return this}handleEvent(e,t){return this._currentState.handleEvent(this,e,t)}static isComponentFactory=!0;static toString(){return"@ember/component"}};function _$(e,t){return gb(e,t)}w$.reopenClass({positionalParams:[]}),Nu(Nv,w$);var x$=a({default:()=>I$}),C$=new WeakMap,S$=new WeakMap,k$=class{constructor(e,t){this.args=t,C$.set(this,!1),S$.set(this,!1)}args;get isDestroying(){return C$.get(this)||!1}get isDestroyed(){return S$.get(this)||!1}willDestroy(){}},E$=class{owner;constructor(e){this.owner=e}createComponent(e,t){return new e(this.owner,t.named)}getContext(e){return e}},R$=lb(0,{destructor:!0,asyncLifecycleCallbacks:!1,updateHook:!1});function T$(e){e.isDestroyed||(te(e),function(e){S$.set(e,!0)}(e))}var L$=class extends E${capabilities=R$;destroyComponent(e){e.isDestroying||(function(e){C$.set(e,!0)}(e),ks("actions",e,e.willDestroy),ks("destroy",this,T$,e))}},I$=class extends k${constructor(e,t){super(e,t),Br(this,e)}};_$(e=>new L$(e),I$);var P$=mb,M$=class extends I${get svg(){return _B(this.args.name)}get size(){return this.args.size||16}get color(){return this.args.color||"#898989"}get style(){return $v(`width:${this.size}px;height:${this.size}px;color:${this.color}`)}get title(){return this.args.title||""}get isFilled(){return this.args.filled||xB(this.args.name)}static{Ap(rg({id:null,block:'[[[41,[30,0,["svg"]],[[[1," "],[10,1],[15,0,[29,["icon ",[52,[30,0,["isFilled"]],"icon-filled"]]]],[15,5,[30,0,["style"]]],[15,"title",[30,0,["title"]]],[12],[1,"\\n "],[1,[28,[32,0],[[30,0,["svg"]]],null]],[1,"\\n "],[13],[1,"\\n"]],[]],null]],[],["if"]]',moduleName:"(unknown template module)",scope:()=>({htmlSafe:$v}),isStrictMode:!0}),this)}};function A$(e){return Be(e.argsCache)}var O$=class{argsCache;constructor(e,t=()=>ay){let n=Ue(()=>t(e));this.argsCache=n}get named(){return A$(this).named||sy}get positional(){return A$(this).positional||oy}};function N$(e,t,n){const r=jr(e),i=Ou(t).getDelegateFor(r);let s,o=new O$(e,n),a=i.createHelper(t,o);if(!wu(i))throw new Error("TODO: unreachable, to be implemented with hasScheduledEffect");return s=Ue(()=>i.getValue(a)),Q(e,s),_u(i)&&Q(s,i.getDestroyable(a)),s}function F$(e,t){return e===t}function D$(e,t){return e!==t}function z$(e,t){return e>t}function j$(e,t){return e>=t}function U$(e,t){return e<t}function B$(e,t){return e<=t}var $$=qv(({positional:e})=>ft(()=>{let t;for(let n=0;n<e.length;n++){let r=e[n];if(t=r?wt(r):r,!U(t))return t}return t},null)),q$=qv(({positional:e})=>ft(()=>{let t;for(let n=0;n<e.length;n++){let r=e[n];if(t=r?wt(r):r,U(t))return t}return t},null)),V$=(...e)=>!U(e[0]),W$={createInstance:!0,wrapped:!0},H$=new class{getCapabilities(){return W$}getDebugName(e){return`(element "${e.tagName}")`}getSelf(){return ct}getDestroyable(){return null}didCreateElement(){}create(e,t){return t.tagName||null}getTagName(e){return e}didRenderLayout(){}didUpdateLayout(){}didCreate(){}didUpdate(){}},G$=class{constructor(e){this.tagName=e}toString(){return`(element "${this.tagName}")`}};Nu(H$,G$.prototype);var K$=new Map;Uv(({positional:e,named:t})=>ft(()=>function(e){let t=K$.get(e);return void 0===t&&(t=new G$(e),K$.set(e,t)),t}(wt(e[0])),null));var Z$=Wv,Y$=z$;function X$(e){return"object"==typeof e&&e&&"isTruthy"in e&&"boolean"==typeof e.isTruthy?e.isTruthy:Ic(e)?0!==e.length:!!e}var J$=class extends wb{compute(e){for(let t=0,n=e.length;t<n;t++)if(!0===X$(e[t]))return e[t];return e[e.length-1]}},Q$=kb(function([e]){return zU(e)}),eq=class extends I${get item(){return this.args.item}get primaryPhoto(){return this.item?.photos?.[0]||null}get extraPhotoCount(){return Math.max(0,(this.item?.photos?.length||0)-1)}get placeName(){return this.item?.placeName}get isNameLoading(){return this.item?.placeNameLoading}get tags(){const e=(this.item?.photos||[]).flatMap(e=>e.tags||[]);return[...new Set(e)]}static{Ap(rg({id:null,block:'[[[10,"li"],[12],[1,"\\n "],[11,"button"],[24,0,"contribution-item"],[24,4,"button"],[4,[32,0],["click",[28,[32,1],[[30,1],[30,2]],null]],null],[12],[1,"\\n "],[10,0],[14,0,"contribution-thumb"],[12],[1,"\\n"],[41,[30,0,["primaryPhoto"]],[[[1," "],[10,"img"],[15,"src",[28,[32,2],[[30,0,["primaryPhoto","thumbUrl"]],[30,0,["primaryPhoto","url"]]],null]],[15,"alt",[28,[32,2],[[30,0,["primaryPhoto","alt"]],"Place photo"],null]],[14,"loading","lazy"],[12],[13],[1,"\\n"]],[]],null],[41,[28,[32,3],[[30,0,["extraPhotoCount"]],0],null],[[[1," "],[10,1],[14,0,"contribution-thumb-badge"],[12],[1,"+"],[1,[30,0,["extraPhotoCount"]]],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n "],[10,0],[14,0,"contribution-info"],[12],[1,"\\n "],[10,0],[14,0,"contribution-place"],[12],[1,"\\n"],[41,[30,0,["placeName"]],[[[1," "],[1,[30,0,["placeName"]]],[1,"\\n"]],[]],[[[41,[30,0,["isNameLoading"]],[[[1," "],[10,1],[14,0,"contribution-name-loading"],[12],[1,"Loading…"],[13],[1,"\\n"]],[]],[[[1," "],[10,1],[14,0,"contribution-name-loading"],[12],[1,"Unnamed place"],[13],[1,"\\n "]],[]]]],[]]],[1," "],[13],[1,"\\n "],[10,0],[14,0,"contribution-meta"],[12],[1,"\\n "],[1,[28,[32,4],[[30,2,["createdAt"]]],null]],[1,"\\n"],[41,[28,[32,3],[[30,0,["item","photos","length"]],1],null],[[[1," ·\\n "],[1,[30,0,["item","photos","length"]]],[1,"\\n photos\\n"]],[]],[[[1," · 1 photo\\n"]],[]]],[1," "],[13],[1,"\\n"],[41,[30,0,["tags","length"]],[[[1," "],[10,0],[14,0,"contribution-tags"],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,0,["tags"]]],null]],null],null,[[[1," "],[10,1],[14,0,"contribution-tag"],[12],[1,[30,3]],[13],[1,"\\n"]],[3]],null],[1," "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onSelect","@item","tag"],["if","each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({on:Ww,fn:Z$,or:J$,__keyword__gt:Y$,formatRelativeDate:Q$}),isStrictMode:!0}),this)}},tq=ob,nq=Ap(rg({id:null,block:'[[[11,0],[24,0,"modal-overlay"],[24,"role","dialog"],[24,"tabindex","-1"],[4,[32,0],["click",[30,1]],null],[12],[1,"\\n "],[11,0],[24,0,"modal-content"],[24,"role","document"],[24,"tabindex","0"],[4,[32,0],["click",[30,2]],null],[12],[1,"\\n "],[11,"button"],[16,0,[29,["close-modal-btn btn-text ",[52,[30,3],"disabled"]]]],[16,"disabled",[30,3]],[24,4,"button"],[4,[32,0],["click",[30,1]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["x",24,"currentColor"]],null],[1,"\\n "],[13],[1,"\\n "],[18,4,null],[1,"\\n "],[13],[1,"\\n"],[13]],["@close","@stopProp","@disableClose","&default"],["if","yield"]]',moduleName:"(unknown template module)",scope:()=>({on:Ww,Icon:M$}),isStrictMode:!0}),tq()),rq=class extends I${get isTesting(){return"test"===rx.environment}get destinationElement(){return document.getElementById("modal-portal")||document.body}stopProp(e){e.stopPropagation()}static{pF(this.prototype,"stopProp",[ql])}close(){this.args.disableClose||this.args.onClose&&this.args.onClose()}static{pF(this.prototype,"close",[ql])}static{Ap(rg({id:null,block:'[[[41,[30,0,["isTesting"]],[[[1," "],[8,[32,0],null,[["@close","@stopProp","@disableClose"],[[30,0,["close"]],[30,0,["stopProp"]],[30,1]]],[["default"],[[[[1,"\\n "],[18,2,null],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],[[[40,[[[1," "],[8,[32,0],null,[["@close","@stopProp","@disableClose"],[[30,0,["close"]],[30,0,["stopProp"]],[30,1]]],[["default"],[[[[1,"\\n "],[18,2,null],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],"%cursor:0%",[28,[31,3],[[30,0,["destinationElement"]]],null]]],[]]]],["@disableClose","&default"],["if","yield","in-element","-in-el-null"]]',moduleName:"(unknown template module)",scope:()=>({ModalContent:nq}),isStrictMode:!0}),this)}},iq=class extends wb{compute(e){for(let t=0,n=e.length;t<n;t++)if(!1===X$(e[t]))return e[t];return e[e.length-1]}};function sq(e,t){return e===t}function oq(...e){return e.every(e=>!X$(e))}var aq=class{capabilities=pb();constructor(e){this.owner=e}createModifier(e,t){return{instance:new e(this.owner,t),element:null}}installModifier(e,t,n){(function(e,t){const n=e;return n.element=t,n})(e,t).instance.modify(t,n.positional,n.named)}updateModifier(e,t){e.instance.modify(e.element,t.positional,t.named)}destroyModifier({instance:e}){te(e)}};P$(e=>new aq(e),class{constructor(e,t){Y_(this,e)}modify(e,t,n){}});var lq=new class{capabilities=pb();createModifier(e){return{element:null,instance:e}}installModifier(e,t,n){const r=function(e,t){const n=e;return n.element=t,n}(e,t),{positional:i,named:s}=n,o=e.instance(t,i,s);"function"==typeof o&&(r.teardown=o)}updateModifier(e,t){"function"==typeof e.teardown&&e.teardown();const n=e.instance(e.element,t.positional,t.named);"function"==typeof n&&(e.teardown=n)}destroyModifier(e){"function"==typeof e.teardown&&e.teardown()}getDebugName(e){return e.instance.toString()}getDebugInstance(e){return e}};function cq(e,t){return e.toString=()=>t?.name||e.name,P$(()=>lq,e)}var uq=o((e,t)=>{t.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}}),hq=o(e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');t=e},e.isKanjiModeEnabled=function(){return void 0!==t},e.toSJIS=function(e){return t(e)}}),dq=o(e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+t)}}(t)}catch(r){return n}}}),pq=o((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let n=0;n<t;n++)this.putBit(1==(e>>>t-n-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n}),fq=o((e,t)=>{function n(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){const i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n}),gq=o(e=>{var t=hq().getSymbolSize;e.getRowColCoords=function(e){if(1===e)return[];const n=Math.floor(e/7)+2,r=t(e),i=145===r?26:2*Math.ceil((r-13)/(2*n-2)),s=[r-7];for(let t=1;t<n-1;t++)s[t]=s[t-1]-i;return s.push(6),s.reverse()},e.getPositions=function(t){const n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)0===e&&0===t||0===e&&t===i-1||e===i-1&&0===t||n.push([r[e],r[t]]);return n}}),mq=o(e=>{var t=hq().getSymbolSize;e.getPositions=function(e){const n=t(e);return[[0,0],[n-7,0],[0,n-7]]}}),yq=o(e=>{function t(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}}e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},e.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){const t=e.size;let n=0,r=0,i=0,s=null,o=null;for(let a=0;a<t;a++){r=i=0,s=o=null;for(let l=0;l<t;l++){let t=e.get(a,l);t===s?r++:(r>=5&&(n+=r-5+3),s=t,r=1),t=e.get(l,a),t===o?i++:(i>=5&&(n+=i-5+3),o=t,i=1)}r>=5&&(n+=r-5+3),i>=5&&(n+=i-5+3)}return n},e.getPenaltyN2=function(e){const t=e.size;let n=0;for(let r=0;r<t-1;r++)for(let i=0;i<t-1;i++){const t=e.get(r,i)+e.get(r,i+1)+e.get(r+1,i)+e.get(r+1,i+1);4!==t&&0!==t||n++}return 3*n},e.getPenaltyN3=function(e){const t=e.size;let n=0,r=0,i=0;for(let s=0;s<t;s++){r=i=0;for(let o=0;o<t;o++)r=r<<1&2047|e.get(s,o),o>=10&&(1488===r||93===r)&&n++,i=i<<1&2047|e.get(o,s),o>=10&&(1488===i||93===i)&&n++}return 40*n},e.getPenaltyN4=function(e){let t=0;const n=e.data.length;for(let r=0;r<n;r++)t+=e.data[r];return 10*Math.abs(Math.ceil(100*t/n/5)-10)},e.applyMask=function(e,n){const r=n.size;for(let i=0;i<r;i++)for(let s=0;s<r;s++)n.isReserved(s,i)||n.xor(s,i,t(e,s,i))},e.getBestMask=function(t,n){const r=Object.keys(e.Patterns).length;let i=0,s=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);const r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<s&&(s=r,i=o)}return i}}),vq=o(e=>{var t=dq(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[4*(e-1)+0];case t.M:return n[4*(e-1)+1];case t.Q:return n[4*(e-1)+2];case t.H:return n[4*(e-1)+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[4*(e-1)+0];case t.M:return r[4*(e-1)+1];case t.Q:return r[4*(e-1)+2];case t.H:return r[4*(e-1)+3];default:return}}}),bq=o(e=>{var t=new Uint8Array(512),n=new Uint8Array(256);!function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,256&e&&(e^=285);for(let n=255;n<512;n++)t[n]=t[n-255]}(),e.log=function(e){if(e<1)throw new Error("log("+e+")");return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return 0===e||0===r?0:t[n[e]+n[r]]}}),wq=o(e=>{var t=bq();e.mul=function(e,n){const r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let s=0;s<n.length;s++)r[i+s]^=t.mul(e[i],n[s]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){const e=r[0];for(let s=0;s<n.length;s++)r[s]^=t.mul(n[s],e);let i=0;for(;i<r.length&&0===r[i];)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}}),_q=o((e,t)=>{var n=wq();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){const e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r}),xq=o(e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}}),Cq=o(e=>{var t="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+",n="(?:(?![A-Z0-9 $%*+\\-./:]|"+(t=t.replace(/u/g,"\\u"))+")(?:.|[\r\n]))+";e.KANJI=new RegExp(t,"g"),e.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),e.BYTE=new RegExp(n,"g"),e.NUMERIC=new RegExp("[0-9]+","g"),e.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");var r=new RegExp("^"+t+"$"),i=new RegExp("^[0-9]+$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");e.testKanji=function(e){return r.test(e)},e.testNumeric=function(e){return i.test(e)},e.testAlphanumeric=function(e){return s.test(e)}}),Sq=o(e=>{var t=xq(),n=Cq();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!t.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},e.isValid=function(e){return e&&e.bit&&e.ccBits},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(r){return n}}}),kq=o(e=>{var t=hq(),n=vq(),r=dq(),i=Sq(),s=xq(),o=t.getBCHDigit(7973);function a(e,t){return i.getCharCountIndicator(e,t)+4}function l(e,t){let n=0;return e.forEach(function(e){const r=a(e.mode,t);n+=r+e.getBitsLength()}),n}e.from=function(e,t){return s.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!s.isValid(e))throw new Error("Invalid QR Code version");void 0===o&&(o=i.BYTE);const l=8*(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r));if(o===i.MIXED)return l;const c=l-a(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(t,n){let s;const o=r.from(n,r.M);if(Array.isArray(t)){if(t.length>1)return function(t,n){for(let r=1;r<=40;r++)if(l(t,r)<=e.getCapacity(r,n,i.MIXED))return r}(t,o);if(0===t.length)return 1;s=t[0]}else s=t;return function(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}(s.mode,s.getLength(),o)},e.getEncodedBits=function(e){if(!s.isValid(e)||e<7)throw new Error("Invalid QR Code version");let n=e<<12;for(;t.getBCHDigit(n)-o>=0;)n^=7973<<t.getBCHDigit(n)-o;return e<<12|n}}),Eq=o(e=>{var t=hq(),n=t.getBCHDigit(1335);e.getEncodedBits=function(e,r){const i=e.bit<<3|r;let s=i<<10;for(;t.getBCHDigit(s)-n>=0;)s^=1335<<t.getBCHDigit(s)-n;return 21522^(i<<10|s)}}),Rq=o((e,t)=>{var n=Sq();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);const i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,3*i+1))},t.exports=r}),Tq=o((e,t)=>{var n=Sq(),r=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=45*r.indexOf(this.data[t]);n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i}),Lq=o((e,t)=>{var n=Sq();function r(e){this.mode=n.BYTE,this.data="string"==typeof e?(new TextEncoder).encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return 8*e},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r}),Iq=o((e,t)=>{var n=Sq(),r=hq();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return 13*e},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else{if(!(n>=57408&&n<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");n-=49472}n=192*(n>>>8&255)+(255&n),e.put(n,13)}},t.exports=i}),Pq=o((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},s={};s[t]=0;var o,a,l,c,u,h,d,p=n.PriorityQueue.make();for(p.push(t,0);!p.empty();)for(l in a=(o=p.pop()).value,c=o.cost,u=e[a]||{})u.hasOwnProperty(l)&&(h=c+u[l],d=s[l],(void 0===s[l]||d>h)&&(s[l]=h,p.push(l,h),i[l]=a));if(void 0!==r&&void 0===s[r]){var f=["Could not find a path from ",t," to ",r,"."].join("");throw new Error(f)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t,r=n.PriorityQueue,i={};for(t in e=e||{},r)r.hasOwnProperty(t)&&(i[t]=r[t]);return i.queue=[],i.sorter=e.sorter||r.default_sorter,i},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};void 0!==t&&(t.exports=n)}),Mq=o(e=>{var t=Sq(),n=Rq(),r=Tq(),i=Lq(),s=Iq(),o=Cq(),a=hq(),l=Pq();function c(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){const r=[];let i;for(;null!==(i=e.exec(n));)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function h(e){const n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e);let i,s;return a.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),s=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),s=[]),n.concat(r,i,s).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function d(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return s.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e,o){let l;const c=t.getBestModeForData(e);if(l=t.from(o,c),l!==t.BYTE&&l.bit<c.bit)throw new Error('"'+e+'" cannot be encoded with mode '+t.toString(l)+".\n Suggested mode is: "+t.toString(c));switch(l!==t.KANJI||a.isKanjiModeEnabled()||(l=t.BYTE),l){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new s(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return"string"==typeof t?e.push(p(t,null)):t.data&&e.push(p(t.data,t.mode)),e},[])},e.fromString=function(n,r){const i=function(e,n){const r={},i={start:{}};let s=["start"];for(let o=0;o<e.length;o++){const a=e[o],l=[];for(let e=0;e<a.length;e++){const c=a[e],u=""+o+e;l.push(u),r[u]={node:c,lastCount:0},i[u]={};for(let e=0;e<s.length;e++){const o=s[e];r[o]&&r[o].node.mode===c.mode?(i[o][u]=d(r[o].lastCount+c.length,c.mode)-d(r[o].lastCount,c.mode),r[o].lastCount+=c.length):(r[o]&&(r[o].lastCount=c.length),i[o][u]=d(c.length,c.mode)+4+t.getCharCountIndicator(c.mode,n))}}s=l}for(let t=0;t<s.length;t++)i[s[t]].end=0;return{map:i,table:r}}(function(e){const n=[];for(let r=0;r<e.length;r++){const i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:c(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:c(i.data)}])}}return n}(h(n,a.isKanjiModeEnabled())),r),s=l.find_path(i.map,"start","end"),o=[];for(let e=1;e<s.length-1;e++)o.push(i.table[s[e]].node);return e.fromArray(o.reduce(function(e,t){const n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[]))},e.rawSplit=function(t){return e.fromArray(h(t,a.isKanjiModeEnabled()))}}),Aq=o(e=>{var t=hq(),n=dq(),r=pq(),i=fq(),s=gq(),o=mq(),a=yq(),l=vq(),c=_q(),u=kq(),h=Eq(),d=Sq(),p=Mq();function f(e,t,n){const r=e.size,i=h.getEncodedBits(t,n);let s,o;for(s=0;s<15;s++)o=1==(i>>s&1),s<6?e.set(s,8,o,!0):s<8?e.set(s+1,8,o,!0):e.set(r-15+s,8,o,!0),s<8?e.set(8,r-s-1,o,!0):s<9?e.set(8,15-s-1+1,o,!0):e.set(8,15-s-1,o,!0);e.set(r-8,8,1,!0)}e.create=function(e,h){if(void 0===e||""===e)throw new Error("No input text");let g,m,y=n.M;return void 0!==h&&(y=n.from(h.errorCorrectionLevel,n.M),g=u.from(h.version),m=a.from(h.maskPattern),h.toSJISFunc&&t.setToSJISFunction(h.toSJISFunc)),function(e,n,h,g){let m;if(Array.isArray(e))m=p.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let t=n;if(!t){const n=p.rawSplit(e);t=u.getBestVersionForData(n,h)}m=p.fromString(e,t||40)}}const y=u.getBestVersionForData(m,h);if(!y)throw new Error("The amount of data is too big to be stored in a QR Code");if(n){if(n<y)throw new Error("\nThe chosen QR Code version cannot contain this amount of data.\nMinimum version required to store current data is: "+y+".\n")}else n=y;const v=function(e,n,i){const s=new r;i.forEach(function(t){s.put(t.mode.bit,4),s.put(t.getLength(),d.getCharCountIndicator(t.mode,e)),t.write(s)});const o=8*(t.getSymbolTotalCodewords(e)-l.getTotalCodewordsCount(e,n));for(s.getLengthInBits()+4<=o&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(0);const a=(o-s.getLengthInBits())/8;for(let t=0;t<a;t++)s.put(t%2?17:236,8);return function(e,n,r){const i=t.getSymbolTotalCodewords(n),s=i-l.getTotalCodewordsCount(n,r),o=l.getBlocksCount(n,r),a=o-i%o,u=Math.floor(i/o),h=Math.floor(s/o),d=h+1,p=u-h,f=new c(p);let g=0;const m=new Array(o),y=new Array(o);let v=0;const b=new Uint8Array(e.buffer);for(let t=0;t<o;t++){const e=t<a?h:d;m[t]=b.slice(g,g+e),y[t]=f.encode(m[t]),g+=e,v=Math.max(v,e)}const w=new Uint8Array(i);let _,x,C=0;for(_=0;_<v;_++)for(x=0;x<o;x++)_<m[x].length&&(w[C++]=m[x][_]);for(_=0;_<p;_++)for(x=0;x<o;x++)w[C++]=y[x][_];return w}(s,e,n)}(n,h,m),b=t.getSymbolSize(n),w=new i(b);return function(e,t){const n=e.size,r=o.getPositions(t);for(let i=0;i<r.length;i++){const t=r[i][0],s=r[i][1];for(let r=-1;r<=7;r++)if(!(t+r<=-1||n<=t+r))for(let i=-1;i<=7;i++)s+i<=-1||n<=s+i||(r>=0&&r<=6&&(0===i||6===i)||i>=0&&i<=6&&(0===r||6===r)||r>=2&&r<=4&&i>=2&&i<=4?e.set(t+r,s+i,!0,!0):e.set(t+r,s+i,!1,!0))}}(w,n),function(e){const t=e.size;for(let n=8;n<t-8;n++){const t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}(w),function(e,t){const n=s.getPositions(t);for(let r=0;r<n.length;r++){const t=n[r][0],i=n[r][1];for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)-2===n||2===n||-2===r||2===r||0===n&&0===r?e.set(t+n,i+r,!0,!0):e.set(t+n,i+r,!1,!0)}}(w,n),f(w,h,0),n>=7&&function(e,t){const n=e.size,r=u.getEncodedBits(t);let i,s,o;for(let a=0;a<18;a++)i=Math.floor(a/3),s=a%3+n-8-3,o=1==(r>>a&1),e.set(i,s,o,!0),e.set(s,i,o,!0)}(w,n),function(e,t){const n=e.size;let r=-1,i=n-1,s=7,o=0;for(let a=n-1;a>0;a-=2)for(6===a&&a--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,a-n)){let r=!1;o<t.length&&(r=1==(t[o]>>>s&1)),e.set(i,a-n,r),s--,-1===s&&(o++,s=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}(w,v),isNaN(g)&&(g=a.getBestMask(w,f.bind(null,w,h))),a.applyMask(g,w),f(w,h,g),{modules:w,version:n,errorCorrectionLevel:h,maskPattern:g,segments:m}}(e,g,y,m)}}),Oq=o(e=>{function t(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),6===t.length&&t.push("F","F");const n=parseInt(t.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:255&n,hex:"#"+t.slice(0,6).join("")}}e.getOptions=function(e){e||(e={}),e.color||(e.color={});const n=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||"#000000ff"),light:t(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},e.getImageWidth=function(t,n){const r=e.getScale(t,n);return Math.floor((t+2*n.margin)*r)},e.qrToImageData=function(t,n,r){const i=n.modules.size,s=n.modules.data,o=e.getScale(i,r),a=Math.floor((i+2*r.margin)*o),l=r.margin*o,c=[r.color.light,r.color.dark];for(let e=0;e<a;e++)for(let n=0;n<a;n++){let u=4*(e*a+n),h=r.color.light;e>=l&&n>=l&&e<a-l&&n<a-l&&(h=c[s[Math.floor((e-l)/o)*i+Math.floor((n-l)/o)]?1:0]),t[u++]=h.r,t[u++]=h.g,t[u++]=h.b,t[u]=h.a}}}),Nq=o(e=>{var t=Oq();e.render=function(e,n,r){let i=r,s=n;void 0!==i||n&&n.getContext||(i=n,n=void 0),n||(s=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),i=t.getOptions(i);const o=t.getImageWidth(e.modules.size,i),a=s.getContext("2d"),l=a.createImageData(o,o);return t.qrToImageData(l.data,e,i),function(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=n,t.width=n,t.style.height=n+"px",t.style.width=n+"px"}(a,s,o),a.putImageData(l,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;void 0!==i||n&&n.getContext||(i=n,n=void 0),i||(i={});const s=e.render(t,n,i),o=i.type||"image/png",a=i.rendererOpts||{};return s.toDataURL(o,a.quality)}}),Fq=o(e=>{var t=Oq();function n(e,t){const n=e.a/255,r=t+'="'+e.hex+'"';return n<1?r+" "+t+'-opacity="'+n.toFixed(2).slice(1)+'"':r}function r(e,t,n){let r=e+t;return void 0!==n&&(r+=" "+n),r}e.render=function(e,i,s){const o=t.getOptions(i),a=e.modules.size,l=e.modules.data,c=a+2*o.margin,u=o.color.light.a?"<path "+n(o.color.light,"fill")+' d="M0 0h'+c+"v"+c+'H0z"/>':"",h="<path "+n(o.color.dark,"stroke")+' d="'+function(e,t,n){let i="",s=0,o=!1,a=0;for(let l=0;l<e.length;l++){const c=Math.floor(l%t),u=Math.floor(l/t);c||o||(o=!0),e[l]?(a++,l>0&&c>0&&e[l-1]||(i+=o?r("M",c+n,.5+u+n):r("m",s,0),s=0,o=!1),c+1<t&&e[l+1]||(i+=r("h",a),a=0)):s++}return i}(l,a,o.margin)+'"/>',d='viewBox="0 0 '+c+" "+c+'"',p='<svg xmlns="http://www.w3.org/2000/svg" '+(o.width?'width="'+o.width+'" height="'+o.width+'" ':"")+d+' shape-rendering="crispEdges">'+u+h+"</svg>\n";return"function"==typeof s&&s(null,p),p}}),Dq=o(e=>{var t=uq(),n=Aq(),r=Nq(),i=Fq();function s(e,r,i,s,o){const a=[].slice.call(arguments,1),l=a.length,c="function"==typeof a[l-1];if(!c&&!t())throw new Error("Callback required as last argument");if(!c){if(l<1)throw new Error("Too few arguments provided");return 1===l?(i=r,r=s=void 0):2!==l||r.getContext||(s=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,s),r,s))}catch(a){o(a)}})}if(l<2)throw new Error("Too few arguments provided");2===l?(o=i,i=r,r=s=void 0):3===l&&(r.getContext&&void 0===o?(o=s,s=void 0):(o=s,s=i,i=r,r=void 0));try{const t=n.create(i,s);o(null,e(t,r,s))}catch(u){o(u)}}e.create=n.create,e.toCanvas=s.bind(null,r.render),e.toDataURL=s.bind(null,r.renderToDataURL),e.toString=s.bind(null,function(e,t,n){return i.render(e,n)})}),zq=l(Dq(),1),jq=cq((e,[t])=>{t&&zq.toCanvas(e,t,{width:256,margin:2,color:{dark:"#000000",light:"#ffffff"}}).catch(e=>{console.error("Failed to generate QR code",e)})}),Uq=class extends I${static{dF(this.prototype,"nostrAuth",[dp])}#N=void fF(this,"nostrAuth");static{dF(this.prototype,"toast",[dp])}#Ie=void fF(this,"toast");get hasExtension(){return"undefined"!=typeof window&&void 0!==window.nostr}async connectExtension(){try{await this.nostrAuth.connectWithExtension(),this.toast.show("Nostr connected successfully"),this.args.onConnect&&this.args.onConnect()}catch(e){console.error(e),alert(e.message)}}static{pF(this.prototype,"connectExtension",[ql])}async connectApp(){try{await this.nostrAuth.connectWithApp(),this.toast.show("Nostr connected successfully"),this.args.onConnect&&this.args.onConnect()}catch(e){console.error(e),alert(e.message)}}static{pF(this.prototype,"connectApp",[ql])}async copyConnectUri(){const e=this.nostrAuth.connectUri;try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e);else{const t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");if(document.body.removeChild(t),!n)throw new Error("Fallback copy failed")}this.toast.show("Connection link copied to clipboard")}catch(RD){console.error("Failed to copy text: ",RD),alert("Failed to copy link")}}static{pF(this.prototype,"copyConnectUri",[ql])}static{Ap(rg({id:null,block:'[[[10,0],[14,0,"nostr-connect-modal"],[12],[1,"\\n "],[10,"h2"],[12],[1,"Connect with Nostr"],[13],[1,"\\n\\n "],[10,0],[14,0,"nostr-connect-options"],[12],[1,"\\n"],[41,[30,0,["hasExtension"]],[[[1," "],[11,"button"],[24,0,"btn btn-primary"],[24,4,"button"],[4,[32,0],["click",[30,0,["connectExtension"]]],null],[12],[1,"\\n Browser Extension (nos2x, Alby)\\n "],[13],[1,"\\n"]],[]],[[[1," "],[10,"button"],[14,0,"btn btn-outline"],[14,"disabled",""],[14,"title","No Nostr extension found in your browser"],[14,4,"button"],[12],[1,"\\n Browser Extension (Not Found)\\n "],[13],[1,"\\n"]],[]]],[1,"\\n "],[11,"button"],[24,0,"btn btn-primary"],[24,4,"button"],[4,[32,0],["click",[30,0,["connectApp"]]],null],[12],[1,"\\n Mobile Signer App (Amber, etc.)\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n"],[41,[28,[32,1],[[30,0,["nostrAuth","connectStatus"]],"waiting"],null],[[[1," "],[10,0],[14,0,"nostr-connect-status"],[12],[1,"\\n"],[41,[30,0,["nostrAuth","isMobile"]],[[[1," "],[10,2],[12],[1,"Waiting for you to approve the connection in your mobile signer\\n app..."],[13],[1,"\\n "],[10,0],[14,0,"mobile-connect-actions"],[12],[1,"\\n "],[10,3],[15,6,[30,0,["nostrAuth","connectUri"]]],[14,0,"btn btn-primary"],[12],[1,"\\n Open Signer App\\n "],[13],[1,"\\n "],[11,"button"],[24,0,"btn btn-outline"],[24,4,"button"],[4,[32,0],["click",[30,0,["copyConnectUri"]]],null],[12],[1,"\\n Copy Connection Link\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],[[[1," "],[10,2],[12],[1,"Scan this QR code with a Nostr signer app (like Amber):"],[13],[1,"\\n "],[10,0],[14,0,"qr-code-container"],[12],[1,"\\n "],[11,"canvas"],[4,[32,2],[[30,0,["nostrAuth","connectUri"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n"]],[]],null],[13]],[],["if"]]',moduleName:"(unknown template module)",scope:()=>({on:Ww,eq:sq,qrCode:jq}),isStrictMode:!0}),this)}},Bq=cq((e,[t])=>{e&&"number"==typeof t&&t>0&&requestAnimationFrame(()=>{e.scrollTop=t})}),$q=class extends I${static{dF(this.prototype,"isNostrConnectModalOpen",[Vr],function(){return!1})}#Ve=void fF(this,"isNostrConnectModalOpen");openNostrConnectModal(e){e.preventDefault(),this.isNostrConnectModalOpen=!0}static{pF(this.prototype,"openNostrConnectModal",[ql])}closeNostrConnectModal(){this.isNostrConnectModalOpen=!1}static{pF(this.prototype,"closeNostrConnectModal",[ql])}onNostrConnected(){this.closeNostrConnectModal(),this.args.onNostrConnected?.()}static{pF(this.prototype,"onNostrConnected",[ql])}static{Ap(rg({id:null,block:'[[[10,0],[14,0,"sidebar"],[12],[1,"\\n "],[10,0],[14,0,"sidebar-header has-back-btn"],[12],[1,"\\n "],[11,"button"],[24,0,"back-btn"],[24,4,"button"],[4,[32,0],["click",[30,1]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["arrow-left",20,"#333"]],null],[1,"\\n "],[13],[1,"\\n "],[10,"h2"],[14,0,"sidebar-header-text-centered"],[12],[1,"\\n "],[10,1],[14,0,"sidebar-header-icon-wrapper"],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["activity",20,"#898989"]],null],[1,"\\n "],[13],[1,"\\n My Contributions\\n "],[13],[1,"\\n "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,0],["click",[30,2]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["x",20,"#333"]],null],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[11,0],[24,0,"sidebar-content"],[4,[32,2],[[30,3]],null],[12],[1,"\\n"],[41,[30,4],[[[1," "],[10,0],[14,0,"sidebar-loading"],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["loading-ring",24,"#898989"]],null],[1,"\\n "],[13],[1,"\\n"]],[]],[[[41,[28,[32,3],[[30,5]],null],[[[1," "],[10,2],[14,0,"empty-state"],[12],[1,"\\n "],[11,3],[24,6,"#"],[24,"role","button"],[24,"tabindex","0"],[4,[32,0],["click",[30,0,["openNostrConnectModal"]]],null],[12],[1,"Connect your Nostr account"],[13],[1,"\\n to see your contributions.\\n "],[13],[1,"\\n"]],[]],[[[41,[28,[32,3],[[30,6,["length"]]],null],[[[1," "],[10,2],[14,0,"empty-state"],[12],[1,"No contributions yet. Start by adding photos to\\n places."],[13],[1,"\\n"]],[]],[[[1," "],[10,"ul"],[14,0,"contributions-list"],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,6]],null]],null],null,[[[41,[28,[32,4],[[30,7,["type"]],"photo"],null],[[[1," "],[8,[32,5],null,[["@item","@onSelect"],[[30,7],[30,8]]],null],[1,"\\n"]],[]],null]],[7]],null],[1," "],[13],[1,"\\n "]],[]]]],[]]]],[]]],[1," "],[13],[1,"\\n"],[13],[1,"\\n\\n"],[41,[30,0,["isNostrConnectModalOpen"]],[[[1," "],[8,[32,6],null,[["@onClose"],[[30,0,["closeNostrConnectModal"]]]],[["default"],[[[[1,"\\n "],[8,[32,7],null,[["@onConnect"],[[30,0,["onNostrConnected"]]]],null],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],null]],["@onBack","@onClose","@scrollTop","@isLoading","@isConnected","@items","item","@onSelect"],["if","each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({on:Ww,Icon:M$,restoreScroll:Bq,not:oq,eq:sq,ContributionPhoto:eq,Modal:rq,NostrConnect:Uq}),isStrictMode:!0}),this)}},qq=a({default:()=>Vq}),Vq=Ap(rg({id:null,block:'[[[41,[30,1,["mapUi","isSidebarVisible"]],[[[1," "],[8,[32,0],null,[["@items","@isLoading","@isConnected","@scrollTop","@onSelect","@onBack","@onClose","@onNostrConnected"],[[30,1,["items"]],[30,1,["loadContributionsTask","isRunning"]],[30,1,["isConnected"]],[30,1,["scrollTop"]],[30,1,["selectContribution"]],[30,1,["backToMenu"]],[30,1,["close"]],[30,1,["onNostrConnected"]]]],null],[1,"\\n"]],[]],null]],["@controller"],["if"]]',moduleName:"(unknown template module)",scope:()=>({ContributionsTimeline:$q}),isStrictMode:!0}),tq()),Wq=class{assert(){}async(e){Promise.resolve().then(e)}reportUncaughtRejection(){this.async(e=>{throw e})}defer(){let e={promise:null,resolve:null,reject:null};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}globalDebuggingEnabled(){return!1}},Hq=new Wq,Gq=class{constructor(e){this.maxConcurrency=e||1}},Kq="CANCELLED",Zq="STARTED",Yq="QUEUED",Xq={type:Zq},Jq={type:Yq},Qq=e=>({type:Kq,reason:e}),eV=Qq("it belongs to a 'drop' Task that was already running"),tV=class{constructor(e){this.remainingSlots=e}step(){return this.remainingSlots>0?(this.remainingSlots--,Xq):eV}},nV=class extends Gq{makeReducer(){return new tV(this.maxConcurrency)}},rV=class{constructor(e){this.remainingSlots=e}step(){return this.remainingSlots>0?(this.remainingSlots--,Xq):Jq}},iV=class extends Gq{makeReducer(){return new rV(this.maxConcurrency)}},sV=Qq("it belongs to a 'keepLatest' Task that was already running"),oV=class{constructor(e,t){this.remainingSlots=e,this.numToCancel=t}step(){return this.remainingSlots>0?(this.remainingSlots--,Xq):this.numToCancel>0?(this.numToCancel--,sV):Jq}},aV=class extends Gq{makeReducer(e,t){let n=e+t;return new oV(this.maxConcurrency,n-this.maxConcurrency-1)}},lV=Qq("it belongs to a 'restartable' Task that was .perform()ed again"),cV=class{constructor(e){this.numToCancel=e}step(){return this.numToCancel>0?(this.numToCancel--,lV):Xq}},uV=class extends Gq{makeReducer(e,t){return new cV(e+t-this.maxConcurrency)}},hV=new class{step(){return Xq}},dV=class{makeReducer(){return hV}},pV=new Map,fV=class{constructor(e,t,n){this.stateTracker=t,this.schedulerPolicy=e,this.initialTaskInstances=n,this.startingInstances=[]}process(){let[e,t,n]=this.filterFinishedTaskInstances(),r=this.schedulerPolicy.makeReducer(t,n),i=e.filter(e=>this.setTaskInstanceExecutionState(e,r.step()));return this.stateTracker.computeFinalStates(e=>this.applyState(e)),this.startingInstances.forEach(e=>e.start()),i}filterFinishedTaskInstances(){let e=0,t=0;return[this.initialTaskInstances.filter(n=>{let r=this.stateTracker.stateFor(n.task),i=n.executor.state;return i.isFinished?(r.onCompletion(n),!1):(i.hasStarted?e+=1:t+=1,!0)}),e,t]}setTaskInstanceExecutionState(e,t){let n=this.stateTracker.stateFor(e.task);switch(e.executor.counted||(e.executor.counted=!0,n.onPerformed(e)),t.type){case Kq:return e.cancel(t.reason),!1;case Zq:return e.executor.state.hasStarted||(this.startingInstances.push(e),n.onStart(e)),n.onRunning(e),!0;case Yq:return n.onQueued(e),!0}}applyState(e){let{taskable:t}=e;if(!t.onState)return;const{guid:n}=t;if(pV.has(n)&&e.tag<pV.get(n))return;let r=Object.assign({numRunning:e.numRunning,numQueued:e.numQueued,numPerformedInc:e.numPerformedInc},e.attrs);t.onState(r,t),pV.set(n,e.tag)}},gV=class{constructor(e,t){this.taskable=e,this.numRunning=0,this.numQueued=0,this.numPerformedInc=0,this.attrs={},this.tag=t}onCompletion(e){let t=e.completionState;this.attrs.lastRunning=null,this.attrs.lastComplete=e,1===t?this.attrs.lastSuccessful=e:(2===t?this.attrs.lastErrored=e:3===t&&(this.attrs.lastCanceled=e),this.attrs.lastIncomplete=e)}onPerformed(e){this.numPerformedInc+=1,this.attrs.lastPerformed=e}onStart(e){this.attrs.last=e}onRunning(e){this.attrs.lastRunning=e,this.numRunning+=1}onQueued(){this.numQueued+=1}applyStateFrom(e){Object.assign(this.attrs,e.attrs),this.numRunning+=e.numRunning,this.numQueued+=e.numQueued,this.numPerformedInc+=e.numPerformedInc}},mV=new Map,yV=class{constructor(){this.states=new Map}stateFor(e){let t=e.guid,n=this.states.get(t);if(!n){let r=mV.has(t)?mV.get(t):0;n=new gV(e,++r),this.states.set(t,n),mV.set(t,r)}return n}computeFinalStates(e){this.forEachState(t=>e(t))}forEachState(e){this.states.forEach(t=>e(t))}},vV=new class{onCompletion(){}onPerformed(){}onStart(){}onRunning(){}onQueued(){}},bV=class{stateFor(){return vV}computeFinalStates(){}},wV=class{constructor(e,t){this.schedulerPolicy=e,this.stateTrackingEnabled=t,this.taskInstances=[]}cancelAll(e,t){let n=this.taskInstances.map(n=>{n.task.guids[e]&&n.executor.cancel(t)}).filter(e=>!!e);return Promise.all(n)}perform(e){e.onFinalize(()=>this.scheduleRefresh()),this.taskInstances.push(e),this.refresh()}scheduleRefresh(){Promise.resolve().then(()=>this.refresh())}refresh(){let e=this.stateTrackingEnabled?new yV:new bV,t=new fV(this.schedulerPolicy,e,this.taskInstances);this.taskInstances=t.process()}},_V=class{constructor(e,t,n){this.value=e,this.done=t,this.errored=n}},xV=class{constructor(e){this.done=!1,this.generatorFactory=e,this.iterator=null}step(e,t){try{let{value:n,done:r}=this.getIterator()[t](e);return r?this.finalize(n,!1):new _V(n,!1,!1)}catch(n){return this.finalize(n,!0)}}getIterator(){return this.iterator||this.done||(this.iterator=this.generatorFactory()),this.iterator}finalize(e,t){return this.done=!0,this.iterator=null,new _V(e,!0,t)}},CV="__ec_cancel__",SV="__ec_yieldable__",kV="next",EV="throw",RV="return",TV="cancel",LV=class{constructor(e,t){this._taskInstance=e,this._resumeIndex=t}getTaskInstance(){return this._taskInstance}cancel(){let e=this._taskInstance;e.proceed.call(e,this._resumeIndex,TV)}next(e){let t=this._taskInstance;t.proceed.call(t,this._resumeIndex,kV,e)}return(e){let t=this._taskInstance;t.proceed.call(t,this._resumeIndex,RV,e)}throw(e){let t=this._taskInstance;t.proceed.call(t,this._resumeIndex,EV,e)}},IV=class{constructor(){this[SV]=this[SV].bind(this)}onYield(){}_deferable(){let e={resolve:void 0,reject:void 0};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}_toPromise(){let e=this._deferable(),t=this[SV]({proceed(t,n,r){"next"==n||"return"==n?e.resolve(r):e.reject(r)}},0);return e.promise[CV]=t,e.promise}then(...e){return this._toPromise().then(...e)}catch(...e){return this._toPromise().catch(...e)}finally(...e){return this._toPromise().finally(...e)}[SV](e,t){let n=new LV(e,t);return this.onYield(n)}},PV=(new class extends IV{onYield(){}},{completionState:0,value:null,error:null,isSuccessful:!1,isError:!1,isCanceled:!1,hasStarted:!1,isFinished:!1}),MV=class{constructor(e,t){this.kind=e,this.reason=t,this.promise=new Promise(e=>{this.finalize=e})}},AV={},OV=[],NV=class{constructor({generatorFactory:e,env:t,debug:n}){this.generatorState=new xV(e),this.state=Object.assign({},PV),this.index=1,this.disposers=[],this.finalizeCallbacks=[],this.env=t,this.debug=n,this.cancelRequest=null}start(){this.state.hasStarted||this.cancelRequest||(this.setState({hasStarted:!0}),this.proceedSync(kV,void 0))}cancel(e){return this.requestCancel(e)?(this.state.hasStarted?this.proceedWithCancelAsync():this.finalizeWithCancel(),this.cancelRequest.promise):(e.finalize(),e.promise)}setState(e){Object.assign(this.state,e),this.taskInstance.setState(this.state)}proceedChecked(e,t,n){this.state.isFinished||this.advanceIndex(e)&&("cancel"===t?(this.requestCancel(new MV("yielded"),n),this.proceedWithCancelAsync()):this.proceedAsync(t,n))}proceedWithCancelAsync(){this.proceedAsync(RV,AV)}proceedAsync(e,t){this.advanceIndex(this.index),this.env.async(()=>this.proceedSync(e,t))}proceedSync(e,t){this.state.isFinished||(this.dispose(),this.generatorState.done?this.handleResolvedReturnedValue(e,t):this.handleResolvedContinueValue(e,t))}handleResolvedContinueValue(e,t){let n=this.index,r=this.generatorStep(t,e);this.advanceIndex(n)&&(r.errored?this.finalize(r.value,2):this.handleYieldedValue(r))}handleResolvedReturnedValue(e,t){switch(e){case kV:case RV:this.finalize(t,1);break;case EV:this.finalize(t,2)}}handleYieldedUnknownThenable(e){let t=this.index;e.then(e=>{this.proceedChecked(t,kV,e)},e=>{this.proceedChecked(t,EV,e)})}advanceIndex(e){if(this.index===e)return++this.index}handleYieldedValue(e){let t=e.value;t?(this.addDisposer(t[CV]),t.__ec_yieldable__?this.invokeYieldable(t):"function"==typeof t.then?this.handleYieldedUnknownThenable(t):this.proceedWithSimpleValue(t)):this.proceedWithSimpleValue(t)}proceedWithSimpleValue(e){this.proceedAsync(kV,e)}addDisposer(e){"function"==typeof e&&this.disposers.push(e)}dispose(){let e=this.disposers;0!==e.length&&(this.disposers=[],e.forEach(e=>e()))}generatorStep(e,t){OV.push(this);let n=this.generatorState.step(e,t);if(OV.pop(),this._expectsLinkedYield){let e=n.value;e&&"PERFORM_TYPE_LINKED"===e.performType||console.warn("You performed a .linked() task without immediately yielding/returning it. This is currently unsupported (but might be supported in future version of ember-concurrency)."),this._expectsLinkedYield=!1}return n}maybeResolveDefer(){this.defer&&this.state.isFinished&&(1===this.state.completionState?this.defer.resolve(this.state.value):this.defer.reject(this.state.error))}onFinalize(e){this.finalizeCallbacks.push(e),this.state.isFinished&&this.runFinalizeCallbacks()}runFinalizeCallbacks(){this.finalizeCallbacks.forEach(e=>e()),this.finalizeCallbacks=[],this.maybeResolveDefer(),this.maybeThrowUnhandledTaskErrorLater()}promise(){return this.defer||(this.defer=this.env.defer(),this.asyncErrorsHandled=!0,this.maybeResolveDefer()),this.defer.promise}maybeThrowUnhandledTaskErrorLater(){var e;this.asyncErrorsHandled||2!==this.state.completionState||(e=this.state.error)&&"TaskCancelation"===e.name||this.env.async(()=>{this.asyncErrorsHandled||this.env.reportUncaughtRejection(this.state.error)})}requestCancel(e){return!this.cancelRequest&&!this.state.isFinished&&(this.cancelRequest=e,!0)}finalize(e,t){if(this.cancelRequest)return this.finalizeWithCancel();let n={completionState:t};1===t?(n.isSuccessful=!0,n.value=e):2===t?(n.isError=!0,n.error=e):3===t&&(n.error=e),this.finalizeShared(n)}finalizeWithCancel(){let e=this.taskInstance.formatCancelReason(this.cancelRequest.reason),t=new Error(e);this.debugEnabled()&&console.log(e),t.name="TaskCancelation",this.finalizeShared({isCanceled:!0,completionState:3,error:t,cancelReason:e}),this.cancelRequest.finalize()}debugEnabled(){return this.debug||this.env.globalDebuggingEnabled()}finalizeShared(e){this.index++,e.isFinished=!0,this.setState(e),this.runFinalizeCallbacks()}invokeYieldable(e){try{let t=e[SV](this.taskInstance,this.index);this.addDisposer(t)}catch(t){this.env.reportUncaughtRejection(t)}}onYielded(e,t){this.asyncErrorsHandled=!0,this.onFinalize(()=>{let n=this.state.completionState;1===n?e.proceed(t,kV,this.state.value):2===n?e.proceed(t,EV,this.state.error):3===n&&e.proceed(t,TV,null)});let n=this.getPerformType();if("PERFORM_TYPE_UNLINKED"!==n)return()=>{this.detectSelfCancelLoop(n,e),this.cancel(new MV("parent_cancel"))}}getPerformType(){return this.taskInstance.performType||"PERFORM_TYPE_DEFAULT"}detectSelfCancelLoop(e,t){if("PERFORM_TYPE_DEFAULT"!==e)return;let n=t.executor&&t.executor.cancelRequest;!n||"lifespan_end"!==n.kind||this.cancelRequest||this.state.isFinished||this.taskInstance.selfCancelLoopWarning(t)}},FV={last:null,lastRunning:null,lastPerformed:null,lastSuccessful:null,lastComplete:null,lastErrored:null,lastCanceled:null,lastIncomplete:null,performCount:0};Object.freeze(FV);var DV=0,zV=class{constructor(e){this.context=e.context,this.debug=e.debug||!1,this.enabledModifiers=e.enabledModifiers,this.env=e.env,this.group=e.group,this.hasEnabledEvents=e.hasEnabledEvents,this.modifierOptions=e.modifierOptions,this.name=e.name,this.onStateCallback=e.onStateCallback,this.scheduler=e.scheduler,this.guid="ec_"+DV++,this.guids={},this.guids[this.guid]=!0,this.group&&Object.assign(this.guids,this.group.guids)}cancelAll(e){let{reason:t,cancelRequestKind:n,resetState:r}=e||{};t=t||".cancelAll() was explicitly called on the Task";let i=new MV(n||"explicit",t);return this.scheduler.cancelAll(this.guid,i).then(()=>{r&&this._resetState()})}get _isAlive(){return!0}_resetState(){this.setState(FV)}setState(){}};Object.assign(zV.prototype,FV),Object.assign(zV.prototype,{numRunning:0,numQueued:0,isRunning:!1,isQueued:!1,isIdle:!0,state:"idle"});var jV,UV,BV=class{constructor(e,t,n){this.task=e,this.performType=t,this.linkedObject=n}perform(...e){return this.task._performShared(e,this.performType,this.linkedObject)}},$V=class e extends zV{constructor(e){super(e),this.generatorFactory=e.generatorFactory,this.perform=this._perform.bind(this)}linked(){let e=OV[OV.length-1];if(!e)throw new Error("You can only call .linked() from within a task.");return new BV(this,"PERFORM_TYPE_LINKED",e)}unlinked(){return new BV(this,"PERFORM_TYPE_UNLINKED",null)}toString(){return`<Task:${this.name}>`}_clone(){return new e({context:this.context,debug:this.debug,env:this.env,generatorFactory:this.generatorFactory,group:this.group,hasEnabledEvents:this.hasEnabledEvents,name:this.name,onStateCallback:this.onStateCallback,scheduler:this.scheduler})}_curry(...e){let t=this._clone();return t._curryArgs=[...this._curryArgs||[],...e],t}_perform(...e){return this._performShared(e,"PERFORM_TYPE_DEFAULT",null)}_performShared(e,t,n){let r=this._curryArgs?[...this._curryArgs,...e]:e,i=this._taskInstanceFactory(r,t,n);return"PERFORM_TYPE_LINKED"===t&&(n._expectsLinkedYield=!0),this._isAlive||i.cancel(),this.scheduler.perform(i),i}_taskInstanceOptions(e,t,n){return{args:e,executor:new NV({generatorFactory:()=>this.generatorFactory(e),env:this.env,debug:this.debug}),performType:t,hasEnabledEvents:this.hasEnabledEvents}}},qV={enqueue:(e,t)=>t&&e.setBufferPolicy(iV),debug:(e,t)=>t&&e.setDebug(t),drop:(e,t)=>t&&e.setBufferPolicy(nV),keepLatest:(e,t)=>t&&e.setBufferPolicy(aV),maxConcurrency:(e,t)=>e.setMaxConcurrency(t),onState:(e,t)=>e.setOnState(t),restartable:(e,t)=>t&&e.setBufferPolicy(uV)},VV=class{env=Hq;_debug=null;_enabledModifiers=[];_hasSetConcurrencyConstraint=!1;_hasSetBufferPolicy=!1;_hasEnabledEvents=!1;_maxConcurrency=null;_onStateCallback=(e,t)=>t.setState(e);_schedulerPolicyClass=dV;constructor(e="<unknown>",t=null,n={}){this.name=e,this.taskDefinition=t,this.options=n,this._processModifierOptions(n)}createTask(e){let t=this.getTaskOptions(e);return new $V(Object.assign({generatorFactory:t=>this.taskDefinition.apply(e,t)},t))}getModifier(e){if(function(e){return e in qV}(e))return qV[e].bind(null,this)}getOptions(){return this.options}getScheduler(e,t){return new wV(e,t)}getTaskOptions(e){let t,n=this._onStateCallback,r=new this._schedulerPolicyClass(this._maxConcurrency);return t=this.getScheduler(r,n&&"function"==typeof n),{context:e,debug:this._debug,env:this.env,name:this.name,group:void 0,scheduler:t,hasEnabledEvents:this._hasEnabledEvents,onStateCallback:n,enabledModifiers:this._enabledModifiers,modifierOptions:this.getOptions()}}setBufferPolicy(e){return function(e){if(e._hasSetBufferPolicy)throw new Error(`Cannot set multiple buffer policies on a task. ${e._schedulerPolicyClass} has already been set for task '${e.name}'`)}(this),this._hasSetBufferPolicy=!0,this._hasSetConcurrencyConstraint=!0,this._schedulerPolicyClass=e,this}setDebug(e){return this._debug=e,this}setEvented(e){return this._hasEnabledEvents=e,this}setMaxConcurrency(e){return this._hasSetConcurrencyConstraint=!0,this._maxConcurrency=e,this}setName(e){return this.name=e,this}setOnState(e){return this._onStateCallback=e,this}setTaskDefinition(e){return this.taskDefinition=e,this}_processModifierOptions(e){if(e)for(let t of Object.keys(e)){let n=e[t],r=this.getModifier(t);"function"==typeof r&&r(n)&&this._enabledModifiers.push(t)}}},WV=a({EventTarget:()=>Oo,Promise:()=>ra,all:()=>aa,allSettled:()=>ca,asap:()=>Ea,async:()=>Da,cast:()=>Fa,configure:()=>Fo,default:()=>Ua,defer:()=>ma,denodeify:()=>sa,filter:()=>Ca,hash:()=>da,hashSettled:()=>fa,map:()=>va,off:()=>ja,on:()=>za,race:()=>ua,reject:()=>wa,resolve:()=>ba,rethrow:()=>ga}),HV=new class extends Wq{assert(...e){}async(e){_s(()=>ks("actions",e))}reportUncaughtRejection(e){Ps(null,function(){throw e})}defer(){return ma()}globalDebuggingEnabled(){return!1}},GV=class extends wV{scheduleRefresh(){Ls(this,this.refresh)}},KV=class{constructor({task:e,args:t,executor:n,performType:r,hasEnabledEvents:i}){this.task=e,this.args=t,this.performType=r,this.executor=n,this.executor.taskInstance=this,this.hasEnabledEvents=i}setState(){}formatCancelReason(){}selfCancelLoopWarning(){}onFinalize(e){this.executor.onFinalize(e)}proceed(e,t,n){this.executor.proceedChecked(e,t,n)}[SV](e,t){return this.executor.onYielded(e,t)}cancel(e=".cancel() was explicitly called"){this.executor.cancel(new MV("explicit",e))}then(...e){return this.executor.promise().then(...e)}catch(...e){return this.executor.promise().catch(...e)}finally(...e){return this.executor.promise().finally(...e)}toString(){return`${this.task} TaskInstance`}start(){return this.executor.start(),this}};function ZV(e,t){return Object.keys(e).reduce((t,n)=>function(e,t,n){const r=Object.getOwnPropertyDescriptor(e,n);return r.initializer=r.initializer||(()=>e[n]),delete r.value,t[n]=Vr(t,n,r),t}(e,t,n),t)}Object.assign(KV.prototype,PV),Object.assign(KV.prototype,{state:"waiting",isDropped:!1,isRunning:!0}),jV=ZV(FV,{}),jV=ZV({numRunning:0,numQueued:0,isRunning:!1,isQueued:!1,isIdle:!0,state:"idle"},jV),UV=ZV(PV,{}),UV=ZV({state:"waiting",isDropped:!1,isRunning:!1},UV),Object.freeze(jV),Object.freeze(UV);var YV=class extends KV{setState(e){let t=this._recomputeState(e);Object.assign(this,{...e,isRunning:!e.isFinished,isDropped:"dropped"===t,state:t})}_recomputeState(e){return e.isDropped?"dropped":e.isCanceled?e.hasStarted?"canceled":"dropped":e.isFinished?"finished":e.hasStarted?"running":"waiting"}formatCancelReason(e){return`TaskInstance '${this.getName()}' was canceled because ${e}. For more information, see: http://ember-concurrency.com/docs/task-cancelation-help`}getName(){return this.name||(this.name=this.task&&this.task.name||"<unknown>"),this.name}selfCancelLoopWarning(e){let t=`\`${e.getName()}\``,n=`\`${this.getName()}\``;console.warn(`ember-concurrency detected a potentially hazardous "self-cancel loop" between parent task ${t} and child task ${n}. If you want child task ${n} to be canceled when parent task ${t} is canceled, please change \`.perform()\` to \`.linked().perform()\`. If you want child task ${n} to keep running after parent task ${t} is canceled, change it to \`.unlinked().perform()\``)}triggerEvent(...e){if(!this.hasEnabledEvents)return;let t=this.task,n=t.context,r=t&&t.name;if(n&&n.trigger&&r){let[t,...i]=e;n.trigger(`${r}:${t}`,...i)}}};UV&&Object.defineProperties(YV.prototype,UV);var XV={_performCount:0,setState(e){this._performCount=this._performCount+(e.numPerformedInc||0);let t=e.numRunning>0,n=e.numQueued>0,r=Object.assign({},e,{performCount:this._performCount,isRunning:t,isQueued:n,isIdle:!t&&!n,state:t?"running":"idle"});Object.assign(this,r)},onState(e,t){t.onStateCallback&&t.onStateCallback(e,t)}},JV=class e extends $V{constructor(e){super(e),re(this.context)||Ex(this.context,()=>{this.cancelAll({reason:"the object it lives on was destroyed or unrendered",cancelRequestKind:"lifespan_end"})})}get _isAlive(){return!re(this.context)}_taskInstanceFactory(e,t,n){let r=this._taskInstanceOptions(e,t,n);return r.task=this,new YV(r)}_clone(){return new e({context:this.context,debug:this.debug,env:this.env,generatorFactory:this.generatorFactory,group:this.group,hasEnabledEvents:this.hasEnabledEvents,name:this.name,onStateCallback:this.onStateCallback,scheduler:this.scheduler})}};jV&&Object.defineProperties(JV.prototype,jV),Object.assign(JV.prototype,XV);var QV=class extends VV{env=HV;createTask(e){this.taskDefinition;let t=this.getTaskOptions(e);return new JV(Object.assign({generatorFactory:t=>this.taskDefinition.apply(e,t)},t))}getModifier(e){return super.getModifier(e)}getScheduler(e,t){return new GV(e,t)}get taskFn(){return this.taskDefinition}set taskFn(e){this.setTaskDefinition(e)}};function eW(e,t,n,r){let i=t;r&&(i=Object.assign({},i),i[r]=!0);const s=e();return new QV(n||"<unknown>",s.generator,i).createTask(s.context)}var tW=a({default:()=>nW}),nW=class extends eu{static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");static{dF(this.prototype,"nostrAuth",[dp])}#N=void fF(this,"nostrAuth");static{dF(this.prototype,"contributions",[dp])}#Ge=void fF(this,"contributions");static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");loadContributionsTask=eW(()=>({context:this,generator:function*(e){e&&(yield this.contributions.load(e))}}),{restartable:!0},"loadContributionsTask",null);get scrollTop(){return this.mapUi.getScrollPosition("contributions")}get items(){return this.contributions.items}get isConnected(){return this.nostrAuth.isConnected}selectContribution(e){if(!e)return;const t=document.querySelector(".sidebar-content");t&&this.mapUi.saveScrollPosition("contributions",t.scrollTop),this.mapUi.returnToRoute={name:"contributions"},this.mapUi.showSidebar(),this.mapUi.preventNextZoom=!0,this.router.transitionTo(`/place/${e.placeIdentifier}`)}static{pF(this.prototype,"selectContribution",[ql])}onNostrConnected(){this.loadContributionsTask.perform(this.nostrAuth.pubkey)}static{pF(this.prototype,"onNostrConnected",[ql])}backToMenu(){this.router.transitionTo("menu")}static{pF(this.prototype,"backToMenu",[ql])}close(){this.router.transitionTo("index")}static{pF(this.prototype,"close",[ql])}},rW=a({default:()=>iW}),iW=class extends Jh{static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");static{dF(this.prototype,"nostrAuth",[dp])}#N=void fF(this,"nostrAuth");static{dF(this.prototype,"contributions",[dp])}#Ge=void fF(this,"contributions");activate(){this.mapUi.showSidebar()}setupController(e,t){super.setupController(e,t),e&&e.loadContributionsTask&&e.loadContributionsTask.perform(this.nostrAuth.pubkey)}deactivate(){this.contributions.stop()}},sW=a({default:()=>oW}),oW=Ap(rg({id:null,block:'[[[46,[28,[31,1],null,null],null,null,null]],[],["component","-outlet"]]',moduleName:"(unknown template module)",isStrictMode:!0}),tq()),aW=a({default:()=>lW}),lW=class extends Jh{static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");activate(){this.mapUi.showSidebar()}},cW=class extends I${static{dF(this.prototype,"title",[Vr],function(){return""})}#Ke=void fF(this,"title");static{dF(this.prototype,"description",[Vr],function(){return""})}#Ze=void fF(this,"description");constructor(){super(...arguments),this.title=this.args.place?.title||"",this.description=this.args.place?.description||""}get shouldAutofocus(){return"undefined"!=typeof window&&window.innerWidth>768}handleSubmit(e){e.preventDefault(),this.args.onSave&&this.args.onSave({title:this.title,description:this.description})}static{pF(this.prototype,"handleSubmit",[ql])}updateTitle(e){this.title=e.target.value}static{pF(this.prototype,"updateTitle",[ql])}updateDescription(e){this.description=e.target.value}static{pF(this.prototype,"updateDescription",[ql])}static{Ap(rg({id:null,block:'[[[11,"form"],[24,0,"edit-form"],[4,[32,0],["submit",[30,0,["handleSubmit"]]],null],[12],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","edit-title"],[12],[1,"Title"],[13],[1,"\\n"],[1," "],[11,"input"],[24,1,"edit-title"],[16,2,[30,0,["title"]]],[24,0,"form-control"],[24,"placeholder","Name of the place"],[16,"autofocus",[30,0,["shouldAutofocus"]]],[24,4,"text"],[4,[32,0],["input",[30,0,["updateTitle"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","edit-desc"],[12],[1,"Description"],[13],[1,"\\n "],[11,"textarea"],[24,1,"edit-desc"],[16,2,[30,0,["description"]]],[24,0,"form-control"],[24,"rows","3"],[24,"placeholder","Add some details..."],[4,[32,0],["input",[30,0,["updateDescription"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"edit-actions"],[12],[1,"\\n "],[10,"button"],[14,0,"btn btn-blue"],[14,4,"submit"],[12],[1,"Save"],[13],[1,"\\n "],[11,"button"],[24,0,"btn btn-outline"],[24,4,"button"],[4,[32,0],["click",[30,1]],null],[12],[1,"Cancel"],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onCancel"],[]]',moduleName:"(unknown template module)",scope:()=>({on:Ww}),isStrictMode:!0}),this)}},uW=cq((e,[t])=>{const n=n=>{e&&!e.contains(n.target)&&t(n)},r=setTimeout(()=>{document.addEventListener("click",n)},0);return()=>{clearTimeout(r),document.removeEventListener("click",n)}}),hW=class extends I${static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");static{dF(this.prototype,"_forceClear",[Vr],function(){return!1})}#Ye=void fF(this,"_forceClear");get isSaved(){return this.args.isSaved}get placeListIds(){return this._forceClear?[]:this.args.place._listIds||[]}styleFor(e){return $v(`background-color: ${e}`)}isInList(e){return!!this.placeListIds&&this.placeListIds.includes(e.id)}static{pF(this.prototype,"isInList",[ql])}async toggleSaved(){if(this.isSaved){const{osmId:e,osmType:t}=this.args.place;if(await this.storage.removePlace(this.args.place),this.args.place&&(this.args.place.id=null,this.args.place.createdAt=null,this.args.place._listIds=[],this._forceClear=!0),e&&t){const e={...this.args.place};delete e.id,delete e.createdAt,delete e._listIds,this.router.transitionTo("place",e)}else this.router.transitionTo("index");this.args.onClose&&this.args.onClose()}else await this.storage.storePlace(this.args.place)}static{pF(this.prototype,"toggleSaved",[ql])}async toggleList(e){const t=!this.placeListIds.includes(e.id);t&&!this.isSaved&&await this.storage.storePlace(this.args.place);try{await this.storage.togglePlaceList(this.args.place,e.id,t)}catch(n){console.error(n),alert("Failed to update list: "+n.message)}}static{pF(this.prototype,"toggleList",[ql])}static{Ap(rg({id:null,block:'[[[11,0],[24,0,"place-lists-manager"],[4,[32,0],[[30,1]],null],[12],[1,"\\n "],[10,0],[14,0,"list-item master-toggle"],[12],[1,"\\n "],[10,"label"],[12],[1,"\\n "],[11,"input"],[16,"checked",[30,0,["isSaved"]]],[24,4,"checkbox"],[4,[32,1],["change",[30,0,["toggleSaved"]]],null],[12],[13],[1,"\\n "],[10,1],[14,0,"list-color-dot"],[12],[13],[1,"\\n "],[10,1],[14,0,"list-name"],[12],[1,"Saved places"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"divider"],[12],[13],[1,"\\n\\n "],[10,0],[14,0,"lists-container"],[12],[1,"\\n"],[42,[28,[31,1],[[28,[31,1],[[30,0,["storage","lists"]]],null]],null],null,[[[1," "],[10,0],[14,0,"list-item"],[12],[1,"\\n "],[10,"label"],[12],[1,"\\n "],[11,"input"],[16,"checked",[28,[30,0,["isInList"]],[[30,2]],null]],[16,"disabled",[52,[51,[30,0,["isSaved"]]],true]],[24,4,"checkbox"],[4,[32,1],["change",[28,[32,2],[[30,0,["toggleList"]],[30,2]],null]],null],[12],[13],[1,"\\n"],[1," "],[10,1],[14,0,"list-color-dot"],[15,5,[28,[30,0,["styleFor"]],[[30,2,["color"]]],null]],[12],[13],[1,"\\n "],[10,1],[14,0,"list-name"],[12],[1,[30,2,["title"]]],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[2]],null],[1," "],[13],[1,"\\n"],[13]],["@onClose","list"],["each","-track-array","unless"]]',moduleName:"(unknown template module)",scope:()=>({onClickOutside:uW,on:Ww,fn:Z$}),isStrictMode:!0}),this)}},dW=class extends I${renderBlurhash=cq((e,[t,n,r])=>{if(!t||!e)return;const i=n||32,s=r||18;e.width=i,e.height=s;const o=e.getContext("2d");if(o)try{const e=((e,t,n)=>{(e=>{if(!e||e.length<6)throw new ZB("The blurhash string must be at least 6 characters");let t=VB(e[0]),n=Math.floor(t/9)+1,r=t%9+1;if(e.length!==4+2*r*n)throw new ZB(`blurhash length mismatch: length is ${e.length} but it should be ${4+2*r*n}`)})(e);let r=VB(e[0]),i=Math.floor(r/9)+1,s=r%9+1,o=(VB(e[1])+1)/166,a=new Array(s*i);for(let u=0;u<a.length;u++)if(0===u){let t=VB(e.substring(2,6));a[u]=YB(t)}else{let t=VB(e.substring(4+2*u,6+2*u));a[u]=XB(t,1*o)}let l=4*t,c=new Uint8ClampedArray(l*n);for(let u=0;u<n;u++)for(let e=0;e<t;e++){let r=0,o=0,h=0;for(let l=0;l<i;l++)for(let i=0;i<s;i++){let c=Math.cos(Math.PI*e*i/t)*Math.cos(Math.PI*u*l/n),d=a[i+l*s];r+=d[0]*c,o+=d[1]*c,h+=d[2]*c}let d=GB(r),p=GB(o),f=GB(h);c[4*e+0+u*l]=d,c[4*e+1+u*l]=p,c[4*e+2+u*l]=f,c[4*e+3+u*l]=255}return c})(t,i,s),n=o.createImageData(i,s);n.data.set(e),o.putImageData(n,0,0)}catch(a){console.warn("Failed to decode blurhash:",a.message||a)}});static{Ap(rg({id:null,block:'[[[11,"canvas"],[24,0,"blurhash-canvas"],[17,1],[4,[30,0,["renderBlurhash"]],[[30,2],[30,3],[30,4]],null],[12],[13]],["&attrs","@hash","@width","@height"],[]]',moduleName:"(unknown template module)",isStrictMode:!0}),this)}},pW=class extends I${static{dF(this.prototype,"blossom",[dp])}#Xe=void fF(this,"blossom");static{dF(this.prototype,"imageProcessor",[dp])}#Je=void fF(this,"imageProcessor");static{dF(this.prototype,"toast",[dp])}#Ie=void fF(this,"toast");static{dF(this.prototype,"thumbnailUrl",[Vr],function(){return""})}#Qe=void fF(this,"thumbnailUrl");static{dF(this.prototype,"blurhash",[Vr],function(){return""})}#et=void fF(this,"blurhash");static{dF(this.prototype,"error",[Vr],function(){return""})}#tt=void fF(this,"error");static{dF(this.prototype,"statusText",[Vr],function(){return""})}#nt=void fF(this,"statusText");constructor(){super(...arguments),this.args.file&&(this.thumbnailUrl=URL.createObjectURL(this.args.file),this.uploadTask.perform(this.args.file))}willDestroy(){super.willDestroy(...arguments),this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl)}showErrorToast(){this.error&&this.toast.show(this.error)}static{pF(this.prototype,"showErrorToast",[ql])}uploadTask=eW(()=>({context:this,generator:function*(e){this.error="",this.statusText="Processing";try{const t=yield this.imageProcessor.process(e,1920,.9,!0);this.blurhash=t.blurhash;const n=yield this.imageProcessor.process(e,350,.9,!1);let r,i;const s=oz(),o=e=>{"signing"===e&&(this.statusText="Signing photo upload"),"uploading"===e&&(this.statusText="Uploading photo")},a=e=>{"signing"===e&&(this.statusText="Signing thumbnail upload"),"uploading"===e&&(this.statusText="Uploading thumbnail")};if(s)r=yield this.blossom.upload(t.blob,{sequential:!0,onProgress:o}),i=yield this.blossom.upload(n.blob,{sequential:!0,onProgress:a});else{const e=this.blossom.upload(t.blob,{onProgress:o}),s=this.blossom.upload(n.blob,{onProgress:a});[r,i]=yield Promise.all([e,s])}this.args.onSuccess&&this.args.onSuccess({file:e,url:r.url,fallbackUrls:r.fallbackUrls,thumbUrl:i.url,blurhash:t.blurhash,type:"image/jpeg",dim:t.dim,hash:r.hash,thumbHash:i.hash})}catch(t){this.error=t.message}}}),null,"uploadTask",null);static{Ap(rg({id:null,block:'[[[10,0],[15,0,[29,["photo-upload-item\\n ",[52,[30,0,["uploadTask","isRunning"]],"is-uploading"],"\\n ",[52,[30,0,["error"]],"has-error"]]]],[12],[1,"\\n"],[41,[30,0,["blurhash"]],[[[1," "],[8,[32,0],[[24,0,"place-header-photo-blur"]],[["@hash"],[[30,0,["blurhash"]]]],null],[1,"\\n"]],[]],null],[1," "],[10,"img"],[15,"src",[30,0,["thumbnailUrl"]]],[14,"alt","thumbnail"],[12],[13],[1,"\\n\\n"],[41,[30,0,["uploadTask","isRunning"]],[[[1," "],[10,0],[14,0,"overlay"],[12],[1,"\\n "],[8,[32,1],[[24,0,"spin-animation"]],[["@name","@size","@color"],["loading-ring",24,"white"]],null],[1,"\\n"],[41,[30,0,["statusText"]],[[[1," "],[10,1],[14,0,"upload-status-text"],[12],[1,[30,0,["statusText"]]],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["error"]],[[[1," "],[11,"button"],[24,0,"overlay error-overlay"],[16,"title",[30,0,["error"]]],[24,4,"button"],[4,[32,2],["click",[30,0,["showErrorToast"]]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["alert-circle",24,"white"]],null],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n "],[11,"button"],[24,0,"btn-remove-photo"],[24,"title","Remove photo"],[24,4,"button"],[4,[32,2],["click",[28,[32,3],[[30,1],[30,2]],null]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["x",16,"white"]],null],[1,"\\n "],[13],[1,"\\n"],[13]],["@onRemove","@file"],["if"]]',moduleName:"(unknown template module)",scope:()=>({Blurhash:dW,Icon:M$,on:Ww,fn:Z$}),isStrictMode:!0}),this)}},fW=kb(function([e]){return DU(e)}),gW=kb(function([e,t]){return!!Array.isArray(e)&&e.includes(t)}),mW=class extends I${static{dF(this.prototype,"nostrAuth",[dp])}#N=void fF(this,"nostrAuth");static{dF(this.prototype,"nostrRelay",[dp])}#ae=void fF(this,"nostrRelay");static{dF(this.prototype,"nostrData",[dp])}#F=void fF(this,"nostrData");static{dF(this.prototype,"blossom",[dp])}#Xe=void fF(this,"blossom");static{dF(this.prototype,"toast",[dp])}#Ie=void fF(this,"toast");static{dF(this.prototype,"file",[Vr],function(){return null})}#rt=void fF(this,"file");static{dF(this.prototype,"uploadedPhoto",[Vr],function(){return null})}#it=void fF(this,"uploadedPhoto");static{dF(this.prototype,"error",[Vr],function(){return""})}#tt=void fF(this,"error");static{dF(this.prototype,"isPublishing",[Vr],function(){return!1})}#st=void fF(this,"isPublishing");static{dF(this.prototype,"isDragging",[Vr],function(){return!1})}#ot=void fF(this,"isDragging");static{dF(this.prototype,"selectedTags",[Vr],function(){return[]})}#at=void fF(this,"selectedTags");static{dF(this.prototype,"altText",[Vr],function(){return""})}#lt=void fF(this,"altText");get place(){return this.args.place||{}}get title(){return this.place.title||"this place"}get allUploaded(){return this.file&&this.uploadedPhoto&&this.file===this.uploadedPhoto.file}get suggestedTags(){return MB(this.place)}handleFileSelect(e){this.addFile(e.target.files[0]),e.target.value=""}static{pF(this.prototype,"handleFileSelect",[ql])}handleDragOver(e){e.preventDefault(),this.isDragging=!0}static{pF(this.prototype,"handleDragOver",[ql])}handleDragLeave(e){e.preventDefault(),this.isDragging=!1}static{pF(this.prototype,"handleDragLeave",[ql])}handleDrop(e){e.preventDefault(),this.isDragging=!1,e.dataTransfer.files.length>0&&this.addFile(e.dataTransfer.files[0])}static{pF(this.prototype,"handleDrop",[ql])}addFile(e){e&&e.type.startsWith("image/")?(this.error="",this.uploadedPhoto&&this.deletePhotoTask.perform(this.uploadedPhoto),this.file=e,this.uploadedPhoto=null,this.args.onUploadStateChange&&this.args.onUploadStateChange(!0)):this.error="Please select a valid image file."}handleUploadSuccess(e){this.uploadedPhoto=e}static{pF(this.prototype,"handleUploadSuccess",[ql])}removeFile(){this.uploadedPhoto&&this.deletePhotoTask.perform(this.uploadedPhoto),this.file=null,this.uploadedPhoto=null,this.selectedTags=[],this.altText="",this.args.onUploadStateChange&&this.args.onUploadStateChange(!1)}static{pF(this.prototype,"removeFile",[ql])}toggleTag(e){this.selectedTags.includes(e)?this.selectedTags=[]:this.selectedTags=[e]}static{pF(this.prototype,"toggleTag",[ql])}updateAltText(e){this.altText=e.target.value}static{pF(this.prototype,"updateAltText",[ql])}deletePhotoTask=eW(()=>({context:this,generator:function*(e){try{e.hash&&(yield this.blossom.delete(e.hash)),e.thumbHash&&(yield this.blossom.delete(e.thumbHash))}catch(t){this.toast.show(`Failed to delete photo from server: ${t.message}`,5e3)}}}),null,"deletePhotoTask",null);async publish(){if(!this.nostrAuth.isConnected)return void(this.error="You must connect Nostr first.");if(!this.allUploaded)return void(this.error="Please wait for all photos to finish uploading.");const{osmId:e,lat:t,lon:n}=this.place,r=this.place.osmType||"node";if(e){this.error="",this.isPublishing=!0;try{const i=[["i",`osm:${r}:${e}`]];for(const e of this.selectedTags)i.push(["t",e]);t&&n&&(i.push(["g",Bj.encode(t,n,4)]),i.push(["g",Bj.encode(t,n,6)]),i.push(["g",Bj.encode(t,n,7)]),i.push(["g",Bj.encode(t,n,9)]));const s=this.uploadedPhoto,o=["imeta",`url ${s.url}`];o.push(`m ${s.type}`),s.dim&&o.push(`dim ${s.dim}`);const a=this.altText.trim();if(a&&o.push(`alt ${a}`),s.fallbackUrls&&s.fallbackUrls.length>0)for(const e of s.fallbackUrls)o.push(`fallback ${e}`);s.thumbUrl&&o.push(`thumb ${s.thumbUrl}`),s.blurhash&&o.push(`blurhash ${s.blurhash}`),i.push(o);const l=await SN.fromKind(360).content("").modifyPublicTags(()=>i).as(this.nostrAuth.signer).sign();await this.nostrRelay.publish(this.nostrData.activeWriteRelays,l),this.nostrData.store.add(l),this.toast.show("Photo published successfully"),this.file=null,this.uploadedPhoto=null,this.altText="",this.args.onUploadStateChange&&this.args.onUploadStateChange(!1),this.args.onClose&&this.args.onClose(l.id)}catch(i){this.error="Failed to publish: "+i.message}finally{this.isPublishing=!1}}else this.error="This place does not have a valid OSM ID."}static{pF(this.prototype,"publish",[ql])}static{Ap(rg({id:null,block:'[[[10,0],[14,0,"place-photo-upload"],[12],[1,"\\n "],[10,"h2"],[12],[1,"Add Photo for "],[1,[30,0,["title"]]],[13],[1,"\\n\\n"],[41,[30,0,["error"]],[[[1," "],[10,0],[14,0,"alert alert-error"],[12],[1,"\\n "],[1,[30,0,["error"]]],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["file"]],[[[1," "],[8,[32,0],null,[["@file","@onSuccess","@onRemove"],[[30,0,["file"]],[30,0,["handleUploadSuccess"]],[30,0,["removeFile"]]]],null],[1,"\\n\\n"],[41,[30,0,["suggestedTags","length"]],[[[1," "],[10,0],[14,0,"photo-tag-suggestions"],[12],[1,"\\n "],[10,2],[14,0,"photo-tag-suggestions-title"],[12],[1,"\\n Choose a tag/category (optional):\\n "],[13],[1,"\\n "],[10,0],[14,0,"photo-tag-suggestions-list"],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,0,["suggestedTags"]]],null]],null],null,[[[1," "],[11,"button"],[16,0,[29,["photo-tag-chip\\n ",[52,[28,[32,1],[[30,0,["selectedTags"]],[30,1]],null],"is-selected"]]]],[24,4,"button"],[4,[32,2],["click",[28,[32,3],[[30,0,["toggleTag"]],[30,1]],null]],null],[12],[1,"\\n "],[1,[28,[32,4],[[30,1]],null]],[1,"\\n "],[13],[1,"\\n"]],[1]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","photo-alt-input"],[12],[1,"Description (optional):"],[13],[1,"\\n "],[11,"input"],[24,1,"photo-alt-input"],[24,0,"form-control"],[24,"placeholder","Describe this photo"],[16,2,[30,0,["altText"]]],[16,"disabled",[30,0,["isPublishing"]]],[24,4,"text"],[4,[32,2],["input",[30,0,["updateAltText"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n\\n "],[11,"button"],[24,0,"btn btn-primary btn-publish"],[16,"disabled",[28,[32,5],[[28,[32,6],[[30,0,["allUploaded"]]],null],[30,0,["isPublishing"]]],null]],[24,4,"button"],[4,[32,2],["click",[30,0,["publish"]]],null],[12],[1,"\\n"],[41,[30,0,["isPublishing"]],[[[1," Publishing...\\n"]],[]],[[[1," Publish Photo\\n"]],[]]],[1," "],[13],[1,"\\n"]],[]],[[[1," "],[11,0],[16,0,[29,["dropzone ",[52,[30,0,["isDragging"]],"is-dragging"]]]],[4,[32,2],["dragover",[30,0,["handleDragOver"]]],null],[4,[32,2],["dragleave",[30,0,["handleDragLeave"]]],null],[4,[32,2],["drop",[30,0,["handleDrop"]]],null],[12],[1,"\\n "],[10,"label"],[14,"for","photo-upload-input"],[14,0,"dropzone-label"],[12],[1,"\\n "],[8,[32,7],null,[["@name","@size","@color"],["upload-cloud",48,"#ccc"]],null],[1,"\\n "],[10,2],[12],[1,"Drag and drop a photo here, or click to browse"],[13],[1,"\\n "],[13],[1,"\\n "],[11,"input"],[24,1,"photo-upload-input"],[24,"accept","image/*"],[24,0,"file-input-hidden"],[16,"disabled",[30,0,["isPublishing"]]],[24,4,"file"],[4,[32,2],["change",[30,0,["handleFileSelect"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n"]],[]]],[13]],["tag"],["if","each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({PlacePhotoUploadItem:pW,includes:gW,on:Ww,fn:Z$,capitalize:fW,or:J$,not:oq,Icon:M$}),isStrictMode:!0}),this)}},yW=cq((e,[t])=>{if(!t)return;let n;e.classList.remove("loaded"),e.classList.remove("loaded-instant");const r=()=>{const t=e.parentElement,n=t&&"PICTURE"===t.tagName?t.parentElement:t;if(n&&n.closest(".photo-carousel.gallery-main")){const e=n.querySelector(".place-header-photo-blur");e&&(e.style.opacity="0")}},i=()=>{e.classList.contains("loaded-instant")||e.classList.add("loaded"),r()};return e.addEventListener("load",i),n=new IntersectionObserver((n,i)=>{n.forEach(n=>{if(n.isIntersecting){i.unobserve(e);const n=new Image;n.src=t,n.complete&&(e.classList.add("loaded-instant"),r());const s=e.parentElement;s&&"PICTURE"===s.tagName&&s.querySelectorAll("source").forEach(e=>{e.dataset.srcset&&(e.srcset=e.dataset.srcset)}),e.dataset.src?e.src=e.dataset.src:e.src=t}})},{root:null,rootMargin:"100px 100%",threshold:0}),n.observe(e),()=>{e.removeEventListener("load",i),n&&n.disconnect()}}),vW=class extends I${static{dF(this.prototype,"canScrollLeft",[Vr],function(){return!1})}#ct=void fF(this,"canScrollLeft");static{dF(this.prototype,"canScrollRight",[Vr],function(){return!1})}#ut=void fF(this,"canScrollRight");internalEventId=null;carouselElement=null;get photos(){return this.args.photos||[]}get showChevrons(){return this.photos.length>1}get cannotScrollLeft(){return!this.canScrollLeft}get cannotScrollRight(){return!this.canScrollRight}get isGalleryMain(){return"gallery-main"===this.args.variant}get isGalleryThumbnails(){return"gallery-thumbnails"===this.args.variant}get variantClass(){return this.args.variant||"inline"}lastResetKey=null;resetScrollPosition=cq((e,[t])=>{void 0!==t&&t!==this.lastResetKey&&(this.lastResetKey=t,e.scrollLeft=0,setTimeout(()=>this.updateScrollState(),50))});isProgrammaticScroll=!1;scrollToNewPhoto=cq((e,[t])=>{if(t&&t!==this.lastEventId){const n=!this.lastEventId;if(this.lastEventId=t,this.internalEventId===t)return;this.internalEventId=t,this.isProgrammaticScroll=!0;const r=()=>{const r=e.querySelector(`[data-event-id="${t}"]`);if(r)if(n){const t=e.style.scrollBehavior;e.style.scrollBehavior="auto",e.scrollLeft=r.offsetLeft,setTimeout(()=>{e.style.scrollBehavior=t,this.isProgrammaticScroll=!1},50)}else e.scrollLeft=r.offsetLeft,setTimeout(()=>{this.isProgrammaticScroll=!1},500);else this.isProgrammaticScroll=!1};n?r():setTimeout(r,100)}});setupCarousel=cq(e=>{let t,n;return this.carouselElement=e,setTimeout(()=>{this.updateScrollState()},50),window.ResizeObserver&&(t=new ResizeObserver(()=>this.updateScrollState()),t.observe(e)),this.args.onVisiblePhotoChange&&window.IntersectionObserver&&"test"!==rx.environment&&(n=new IntersectionObserver(e=>{if(!this.isProgrammaticScroll)for(let t of e)if(t.isIntersecting&&t.intersectionRatio>=.5){const e=t.target.dataset.eventId;this.internalEventId=e;const n=this.photos.find(t=>t.eventId===e);n&&this.args.onVisiblePhotoChange(n)}},{root:e,threshold:.5}),e.querySelectorAll(".carousel-slide").forEach(e=>n.observe(e))),()=>{t&&t.unobserve(e),n&&n.disconnect()}});updateScrollState(){if(!this.carouselElement)return;const{scrollLeft:e,scrollWidth:t,clientWidth:n}=this.carouselElement;this.canScrollLeft=e>1,this.canScrollRight=e+n<t-1}static{pF(this.prototype,"updateScrollState",[ql])}scrollLeft(){this.carouselElement&&this.carouselElement.scrollBy({left:-this.carouselElement.clientWidth,behavior:"smooth"})}static{pF(this.prototype,"scrollLeft",[ql])}scrollRight(){this.carouselElement&&this.carouselElement.scrollBy({left:this.carouselElement.clientWidth,behavior:"smooth"})}static{pF(this.prototype,"scrollRight",[ql])}handlePhotoClick(e){this.args.onPhotoClick&&this.args.onPhotoClick(e)}static{pF(this.prototype,"handlePhotoClick",[ql])}static{Ap(rg({id:null,block:'[[[41,[30,0,["photos","length"]],[[[1," "],[10,0],[15,0,[29,["photo-carousel ",[30,0,["variantClass"]]]]],[12],[1,"\\n "],[11,0],[24,0,"photo-carousel-track"],[4,[30,0,["setupCarousel"]],null,null],[4,[30,0,["resetScrollPosition"]],[[30,1]],null],[4,[30,0,["scrollToNewPhoto"]],[[30,2]],null],[4,[32,0],["scroll",[30,0,["updateScrollState"]]],null],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,0,["photos"]]],null]],null],null,[[[1," "],[11,0],[16,0,[29,["carousel-slide\\n ",[52,[30,3,["isLandscape"]],"landscape","portrait"],"\\n ",[52,[28,[32,1],[[30,2],[28,[32,2],[[30,3,["eventId"]],[30,2]],null]],null],"active"]]]],[16,5,[30,3,["style"]]],[16,"data-event-id",[30,3,["eventId"]]],[4,[32,0],["click",[28,[32,3],[[30,0,["handlePhotoClick"]],[30,3]],null]],null],[12],[1,"\\n"],[41,[30,3,["blurhash"]],[[[1," "],[8,[32,4],[[24,0,"place-header-photo-blur"]],[["@hash","@width","@height"],[[30,3,["blurhash"]],32,18]],null],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["isGalleryMain"]],[[[1," "],[11,"img"],[16,"data-src",[30,3,["url"]]],[16,0,[29,["place-header-photo\\n ",[52,[30,3,["isLandscape"]],"landscape","portrait"]]]],[16,"alt",[30,3,["alt"]]],[4,[32,5],[[30,3,["url"]]],null],[12],[13],[1,"\\n"]],[]],[[[41,[30,0,["isGalleryThumbnails"]],[[[1," "],[11,"img"],[16,"data-src",[52,[30,3,["thumbUrl"]],[30,3,["thumbUrl"]],[30,3,["url"]]]],[16,0,[29,["place-header-photo\\n ",[52,[30,3,["isLandscape"]],"landscape","portrait"]]]],[16,"alt",[30,3,["alt"]]],[4,[32,5],[[52,[30,3,["thumbUrl"]],[30,3,["thumbUrl"]],[30,3,["url"]]]],null],[12],[13],[1,"\\n"]],[]],[[[41,[30,3,["isLandscape"]],[[[1," "],[10,"picture"],[12],[1,"\\n"],[41,[30,3,["thumbUrl"]],[[[1," "],[10,"source"],[14,"media","(max-width: 768px)"],[15,"data-srcset",[30,3,["thumbUrl"]]],[12],[13],[1,"\\n"]],[]],null],[1," "],[11,"img"],[16,"data-src",[30,3,["url"]]],[24,0,"place-header-photo landscape"],[16,"alt",[30,3,["alt"]]],[4,[32,5],[[30,3,["url"]]],null],[12],[13],[1,"\\n "],[13],[1,"\\n"]],[]],[[[1," "],[11,"img"],[16,"data-src",[52,[30,3,["thumbUrl"]],[30,3,["thumbUrl"]],[30,3,["url"]]]],[24,0,"place-header-photo portrait"],[16,"alt",[30,3,["alt"]]],[4,[32,5],[[52,[30,3,["thumbUrl"]],[30,3,["thumbUrl"]],[30,3,["url"]]]],null],[12],[13],[1,"\\n"]],[]]],[1," "]],[]]]],[]]],[1," "],[13],[1,"\\n"]],[3]],null],[1,"\\n "],[10,0],[14,0,"carousel-placeholder"],[12],[13],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["showChevrons"]],[[[1," "],[11,"button"],[16,0,[29,["carousel-nav-btn prev\\n ",[52,[30,0,["cannotScrollLeft"]],"disabled"]]]],[16,"disabled",[30,0,["cannotScrollLeft"]]],[24,"aria-label","Previous photo"],[24,4,"button"],[4,[32,0],["click",[30,0,["scrollLeft"]]],null],[12],[1,"\\n "],[8,[32,6],null,[["@name","@color","@size"],["chevron-left","currentColor",[52,[28,[32,2],[[30,4],"gallery-main"],null],24,16]]],null],[1,"\\n "],[13],[1,"\\n\\n "],[11,"button"],[16,0,[29,["carousel-nav-btn next\\n ",[52,[30,0,["cannotScrollRight"]],"disabled"]]]],[16,"disabled",[30,0,["cannotScrollRight"]]],[24,"aria-label","Next photo"],[24,4,"button"],[4,[32,0],["click",[30,0,["scrollRight"]]],null],[12],[1,"\\n "],[8,[32,6],null,[["@name","@color","@size"],["chevron-right","currentColor",[52,[28,[32,2],[[30,4],"gallery-main"],null],24,16]]],null],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n"]],[]],null]],["@resetKey","@scrollToEventId","photo","@variant"],["if","each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({on:Ww,and:iq,eq:sq,fn:Z$,Blurhash:dW,fadeInImage:yW,Icon:M$}),isStrictMode:!0}),this)}},bW=class extends I${static{dF(this.prototype,"isOpen",[Vr],function(){return!1})}#ht=void fF(this,"isOpen");toggleMenu(e){e?.stopPropagation(),this.isOpen=!this.isOpen}static{pF(this.prototype,"toggleMenu",[ql])}closeMenu(e){e?.stopPropagation(),this.isOpen=!1}static{pF(this.prototype,"closeMenu",[ql])}get triggerIcon(){return this.args.triggerIcon||"more-vertical"}static{Ap(rg({id:null,block:'[[[10,0],[14,0,"dropdown-menu-container"],[12],[1,"\\n "],[11,"button"],[24,0,"dropdown-trigger-btn btn-press"],[16,"title",[30,1]],[24,4,"button"],[4,[32,0],["click",[30,0,["toggleMenu"]]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],[[30,0,["triggerIcon"]],[30,2],[30,3]]],null],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["isOpen"]],[[[1," "],[10,0],[15,0,[29,["dropdown-popover ",[30,4]]]],[12],[1,"\\n "],[18,5,[[30,0,["closeMenu"]]]],[1,"\\n "],[13],[1,"\\n "],[11,0],[24,0,"menu-backdrop"],[24,"role","button"],[4,[32,0],["click",[30,0,["closeMenu"]]],null],[12],[13],[1,"\\n"]],[]],null],[13]],["@triggerTitle","@iconSize","@iconColor","@popoverClass","&default"],["if","yield"]]',moduleName:"(unknown template module)",scope:()=>({on:Ww,Icon:M$}),isStrictMode:!0}),this)}},wW=Ap(rg({id:null,block:'[[[11,0],[24,0,"photo-gallery-overlay"],[24,"role","dialog"],[24,"tabindex","-1"],[4,[32,0],["click",[30,1]],null],[4,[30,2],[[30,3]],null],[12],[1,"\\n"],[1," "],[10,0],[14,0,"photo-gallery-content"],[15,"data-current-event-id",[30,4,["eventId"]]],[12],[1,"\\n "],[10,0],[14,0,"photo-gallery-header"],[12],[1,"\\n "],[10,0],[14,0,"actions-btn-container"],[12],[1,"\\n "],[8,[32,1],null,[["@iconSize","@triggerIcon","@iconColor"],[24,[30,5],"white"]],[["default"],[[[[1,"\\n "],[11,"button"],[24,0,"dropdown-item"],[24,4,"button"],[4,[32,0],["click",[28,[32,2],[[30,7],[30,6]],null]],null],[12],[1,"Copy Photo Event ID"],[13],[1,"\\n"],[41,[30,8],[[[1," "],[11,"button"],[24,0,"dropdown-item text-danger"],[24,4,"button"],[4,[32,0],["click",[28,[32,2],[[30,9,["perform"]],[30,6]],null]],null],[12],[1,"Delete Photo"],[13],[1,"\\n"]],[]],null],[1," "]],[6]]]]],[1,"\\n "],[13],[1,"\\n\\n"],[41,[28,[32,3],[[30,10],[30,11]],null],[[[1," "],[10,0],[14,0,"photo-gallery-uploader-info"],[12],[1,"\\n"],[41,[30,10],[[[1," "],[10,1],[14,0,"photo-gallery-uploader-name"],[12],[1,[30,10]],[13],[1,"\\n"]],[]],null],[41,[30,11],[[[1," "],[10,1],[14,0,"photo-gallery-uploader-date"],[12],[1,"\\n "],[1,[28,[32,4],[[30,11]],null]],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n\\n "],[11,"button"],[24,0,"close-btn btn-text"],[24,"aria-label","Close gallery"],[24,"title","Close"],[24,4,"button"],[4,[32,0],["click",[30,12]],null],[12],[1,"\\n "],[8,[32,5],null,[["@name","@size","@color"],["x",24,"white"]],null],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"main-photo-container"],[12],[1,"\\n "],[8,[32,6],null,[["@variant","@photos","@scrollToEventId","@onVisiblePhotoChange","@name"],["gallery-main",[30,13],[30,4,["eventId"]],[30,14],[30,15]]],null],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"thumbnail-strip-container"],[12],[1,"\\n "],[8,[32,6],null,[["@variant","@photos","@scrollToEventId","@onPhotoClick","@name"],["gallery-thumbnails",[30,13],[30,4,["eventId"]],[30,16],[30,15]]],null],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@handleBackgroundClick","@bindKeyboard","@handleKeydown","@currentPhoto","@triggerIcon","closeMenu","@copyEventId","@canDeletePhoto","@deletePhotoTask","@uploaderName","@photoDate","@handleClose","@photos","@handleVisiblePhotoChange","@placeName","@selectPhoto"],["if"]]',moduleName:"(unknown template module)",scope:()=>({on:Ww,DropdownMenu:bW,fn:Z$,or:J$,formatRelativeDate:Q$,Icon:M$,PhotoCarousel:vW}),isStrictMode:!0}),tq()),_W=class extends I${get isTesting(){return"test"===rx.environment}get destinationElement(){return document.getElementById("modal-portal")||document.body}static{dF(this.prototype,"toast",[dp])}#Ie=void fF(this,"toast");static{dF(this.prototype,"nostrAuth",[dp])}#N=void fF(this,"nostrAuth");static{dF(this.prototype,"nostrData",[dp])}#F=void fF(this,"nostrData");static{dF(this.prototype,"nostrRelay",[dp])}#ae=void fF(this,"nostrRelay");static{dF(this.prototype,"blossom",[dp])}#Xe=void fF(this,"blossom");static{dF(this.prototype,"settings",[dp])}#D=void fF(this,"settings");static{dF(this.prototype,"currentPhoto",[Vr],function(){return this.args.selectedPhoto||this.args.photos?.[0]})}#dt=void fF(this,"currentPhoto");get triggerIcon(){return"undefined"!=typeof window&&window.innerWidth<=768?"more-vertical":"more-horizontal"}get isCreator(){return this.currentPhoto?.pubkey&&this.nostrAuth.pubkey&&this.currentPhoto.pubkey===this.nostrAuth.pubkey}get canDeletePhoto(){return this.isCreator&&!0===this.settings.experimentalEnablePhotoDeletion}get uploaderName(){const e=this.currentPhoto?.pubkey;if(!e)return null;const t=this.nostrData.getProfile?.(e);return t&&(t.displayName||t.display_name||t.name)||null}get photoDate(){return this.currentPhoto?.publishedAt||this.currentPhoto?.createdAt||null}bindKeyboard=cq((e,[t])=>(document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)));handleClose(){this.args.onClose&&this.args.onClose()}static{pF(this.prototype,"handleClose",[ql])}handleBackgroundClick(e){e.target.closest(".thumbnail-strip-container")||e.target.closest(".carousel-nav-btn")||e.target.closest(".close-btn")||e.target.closest(".photo-gallery-header")||this.handleClose()}static{pF(this.prototype,"handleBackgroundClick",[ql])}selectPhoto(e){this.currentPhoto=e}static{pF(this.prototype,"selectPhoto",[ql])}handleVisiblePhotoChange(e){this.currentPhoto!==e&&(this.currentPhoto=e)}static{pF(this.prototype,"handleVisiblePhotoChange",[ql])}handleKeydown(e){if(!this.args.photos||0===this.args.photos.length)return;if("Escape"===e.key)return void this.handleClose();const t=this.args.photos.indexOf(this.currentPhoto);-1!==t&&("ArrowLeft"===e.key&&t>0?this.currentPhoto=this.args.photos[t-1]:"ArrowRight"===e.key&&t<this.args.photos.length-1&&(this.currentPhoto=this.args.photos[t+1]))}static{pF(this.prototype,"handleKeydown",[ql])}async copyEventId(e){if(this.currentPhoto?.eventId)try{await navigator.clipboard.writeText(this.currentPhoto.eventId),this.toast.show("Event ID copied to clipboard")}catch(RD){console.error("Failed to copy event ID:",RD),this.toast.show("Failed to copy event ID")}e()}static{pF(this.prototype,"copyEventId",[ql])}deletePhotoTask=eW(()=>({context:this,generator:function*(e){if(confirm("Are you sure you want to delete this photo? This cannot be undone."))try{const n=[["e",this.currentPhoto.eventId]];this.currentPhoto.placeIdentifier&&n.push(["i",this.currentPhoto.placeIdentifier]);const r=yield SN.fromKind(5).content("Deleted photo").modifyPublicTags(()=>n).as(this.nostrAuth.signer).sign();yield this.nostrRelay.publish(this.nostrData.activeWriteRelays,r),this.nostrData.store.add(r);const i=/[0-9a-f]{64}/i;if(this.currentPhoto.url){const e=this.currentPhoto.url.match(i);if(e)try{yield this.blossom.delete(e[0])}catch(t){console.warn("Failed to delete main image from blossom:",t)}}if(this.currentPhoto.thumbUrl){const e=this.currentPhoto.thumbUrl.match(i);if(e)try{yield this.blossom.delete(e[0])}catch(t){console.warn("Failed to delete thumb image from blossom:",t)}}this.toast.show("Photo deleted successfully"),e&&e(),this.handleClose()}catch(t){console.error("Failed to delete photo:",t),this.toast.show("Failed to delete photo: "+t.message),e&&e()}else e&&e()}}),null,"deletePhotoTask",null);static{Ap(rg({id:null,block:'[[[41,[30,0,["isTesting"]],[[[1," "],[8,[32,0],null,[["@handleBackgroundClick","@bindKeyboard","@handleKeydown","@copyEventId","@canDeletePhoto","@deletePhotoTask","@handleClose","@photos","@currentPhoto","@handleVisiblePhotoChange","@placeName","@selectPhoto","@uploaderName","@photoDate","@triggerIcon"],[[30,0,["handleBackgroundClick"]],[30,0,["bindKeyboard"]],[30,0,["handleKeydown"]],[30,0,["copyEventId"]],[30,0,["canDeletePhoto"]],[30,0,["deletePhotoTask"]],[30,0,["handleClose"]],[30,1],[30,0,["currentPhoto"]],[30,0,["handleVisiblePhotoChange"]],[30,2],[30,0,["selectPhoto"]],[30,0,["uploaderName"]],[30,0,["photoDate"]],[30,0,["triggerIcon"]]]],null],[1,"\\n"]],[]],[[[40,[[[1," "],[8,[32,0],null,[["@handleBackgroundClick","@bindKeyboard","@handleKeydown","@copyEventId","@canDeletePhoto","@deletePhotoTask","@handleClose","@photos","@currentPhoto","@handleVisiblePhotoChange","@placeName","@selectPhoto","@uploaderName","@photoDate","@triggerIcon"],[[30,0,["handleBackgroundClick"]],[30,0,["bindKeyboard"]],[30,0,["handleKeydown"]],[30,0,["copyEventId"]],[30,0,["canDeletePhoto"]],[30,0,["deletePhotoTask"]],[30,0,["handleClose"]],[30,1],[30,0,["currentPhoto"]],[30,0,["handleVisiblePhotoChange"]],[30,2],[30,0,["selectPhoto"]],[30,0,["uploaderName"]],[30,0,["photoDate"]],[30,0,["triggerIcon"]]]],null],[1,"\\n"]],[]],"%cursor:0%",[28,[31,2],[[30,0,["destinationElement"]]],null]]],[]]]],["@photos","@placeName"],["if","in-element","-in-el-null"]]',moduleName:"(unknown template module)",scope:()=>({GalleryContent:wW}),isStrictMode:!0}),this)}},xW=class extends I${static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");static{dF(this.prototype,"nostrAuth",[dp])}#N=void fF(this,"nostrAuth");static{dF(this.prototype,"nostrData",[dp])}#F=void fF(this,"nostrData");static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");static{dF(this.prototype,"isEditing",[Vr],function(){return!1})}#pt=void fF(this,"isEditing");static{dF(this.prototype,"showLists",[Vr],function(){return!1})}#ft=void fF(this,"showLists");static{dF(this.prototype,"isPhotoUploadActive",[Vr],function(){return!1})}#gt=void fF(this,"isPhotoUploadActive");static{dF(this.prototype,"isConnectingNostr",[Vr],function(){return!1})}#mt=void fF(this,"isConnectingNostr");static{dF(this.prototype,"isGalleryOpen",[Vr],function(){return!1})}#yt=void fF(this,"isGalleryOpen");static{dF(this.prototype,"selectedGalleryPhoto",[Vr],function(){return null})}#vt=void fF(this,"selectedGalleryPhoto");static{dF(this.prototype,"isPhotoUploadModalOpen",[Vr],function(){return!1})}#bt=void fF(this,"isPhotoUploadModalOpen");static{dF(this.prototype,"isNostrConnectModalOpen",[Vr],function(){return!1})}#Ve=void fF(this,"isNostrConnectModalOpen");static{dF(this.prototype,"newlyUploadedPhotoId",[Vr],function(){return null})}#wt=void fF(this,"newlyUploadedPhotoId");handleUploadStateChange(e){this.isPhotoUploadActive=e}static{pF(this.prototype,"handleUploadStateChange",[ql])}openPhotoUploadModal(e){e&&e.preventDefault(),this.nostrAuth.isConnected?this.isPhotoUploadModalOpen=!0:this.isNostrConnectModalOpen=!0}static{pF(this.prototype,"openPhotoUploadModal",[ql])}closePhotoUploadModal(e){this.isPhotoUploadActive||(this.isPhotoUploadModalOpen=!1,"string"==typeof e&&(this.newlyUploadedPhotoId=e,setTimeout(()=>{const e=document.querySelector(".sidebar-content");e&&(e.scrollTop=0)},50)))}static{pF(this.prototype,"closePhotoUploadModal",[ql])}closeNostrConnectModal(){this.isNostrConnectModalOpen=!1}static{pF(this.prototype,"closeNostrConnectModal",[ql])}onNostrConnected(){this.isNostrConnectModalOpen=!1,this.isPhotoUploadModalOpen=!0}static{pF(this.prototype,"onNostrConnected",[ql])}get isSaved(){return this.storage.isPlaceSaved(this.place.id||this.place.osmId)}get place(){return this.args.place||{}}get saveablePlace(){return this.place.createdAt?this.place:OB(this.place)}get tags(){return this.place.osmTags||{}}get name(){return this.place.title||UU(this.tags)||"Unnamed Place"}get photos(){return jj(this.nostrData.placePhotos).map(e=>({...e,style:$v(`--slide-ratio: ${e.aspectRatio};`)}))}startEditing(){this.isSaved&&(this.isEditing=!0)}static{pF(this.prototype,"startEditing",[ql])}cancelEditing(){this.isEditing=!1}static{pF(this.prototype,"cancelEditing",[ql])}toggleLists(e){e&&e.stopPropagation(),this.showLists=!this.showLists}static{pF(this.prototype,"toggleLists",[ql])}closeLists(){this.showLists=!1}static{pF(this.prototype,"closeLists",[ql])}async saveChanges(e){this.args.onSave&&await this.args.onSave({...this.place,...e}),this.isEditing=!1}static{pF(this.prototype,"saveChanges",[ql])}get type(){return $U(this.tags)}get address(){const e=this.tags,t=[],n=(...t)=>{for(const n of t)if(e[n])return e[n];return null};let r=n("addr:street","street");const i=n("addr:housenumber","housenumber");r&&(i&&(r=`${r} ${i}`),t.push(r));let s=n("addr:city","city");const o=n("addr:postcode","postcode");s&&(o&&(s=`${o} ${s}`),t.push(s));const a=n("addr:state","state"),l=n("addr:country","country");return a&&a!==s&&t.push(a),l&&t.push(l),0===t.length?null:t.join(", ")}formatMultiLine(e,t){if(!e)return null;const n=[...new Set(e.split(";").map(e=>e.trim()).filter(Boolean))];return 0===n.length?null:$v("phone"===t?n.map(e=>`<a href="tel:${e.replace(/[\s-]+/g,"")}">${e}</a>`).join("<br>"):"email"===t?n.map(e=>`<a href="mailto:${e}">${e}</a>`).join("<br>"):"whatsapp"===t?n.map(e=>`<a href="https://wa.me/${e.replace(/[\s()+.-]/g,"")}" target="_blank" rel="noopener noreferrer">${e}</a>`).join("<br>"):"url"===t?n.map(e=>`<a href="${e}" target="_blank" rel="noopener noreferrer">${this.getDomain(e)}</a>`).join("<br>"):n.join("<br>"))}get phone(){const e=[this.tags.phone,this.tags["contact:phone"],this.tags.mobile,this.tags["contact:mobile"]].filter(Boolean);return 0===e.length?null:this.formatMultiLine(e.join(";"),"phone")}get whatsapp(){const e=[this.tags.whatsapp,this.tags["contact:whatsapp"]].filter(Boolean);return 0===e.length?null:this.formatMultiLine(e.join(";"),"whatsapp")}get email(){const e=this.tags.email||this.tags["contact:email"];return this.formatMultiLine(e,"email")}get website(){const e=this.place.url||this.tags.website||this.tags["contact:website"];return this.formatMultiLine(e,"url")}getDomain(e){try{return new URL(e).hostname}catch{return e}}get openingHours(){const e=this.tags.opening_hours;return this.formatMultiLine(e)}get cuisine(){return this.tags.cuisine?this.tags.cuisine.split(";").map(e=>FU(e)).join(", "):null}get facebook(){return DB(this.tags,"facebook")}get instagram(){return DB(this.tags,"instagram")}get wikipedia(){const e=this.tags.wikipedia;return e?e.split(";").map(e=>e.trim()).filter(Boolean)[0]:null}get geoLink(){const e=this.place.lat,t=this.place.lon;return e&&t?`geo:${e},${t}?q=${e},${t}(${encodeURIComponent(this.name)})`:"#"}get visibleGeoLink(){const e=this.place.lat,t=this.place.lon;return e&&t?`${Number(e).toFixed(6)}, ${Number(t).toFixed(6)}`:""}get osmUrl(){const e=this.place.osmId;if(e)return`https://www.openstreetmap.org/${this.place.osmType||"node"}/${e}`;const t=this.place.lat,n=this.place.lon;if(!t||!n)return null;const r=this.mapUi.currentCenter?.lat??t,i=this.mapUi.currentCenter?.lon??n,s=this.mapUi.currentZoom??17,o=Math.round(s);return`https://www.openstreetmap.org/search?lat=${t}&lon=${n}&zoom=${o}#map=${o}/${Number(r).toFixed(5)}/${Number(i).toFixed(5)}`}get gmapsUrl(){return this.place.gmapsId||this.place.osmId?`https://www.google.com/maps/search/?api=1&query=${this.name}&query=${this.place.lat},${this.place.lon}`:null}get showDescription(){return"photon"!==this.place.source&&!!this.place.description}openGallery(e){this.selectedGalleryPhoto=e,this.isGalleryOpen=!0}static{pF(this.prototype,"openGallery",[ql])}closeGallery(){this.isGalleryOpen=!1,this.selectedGalleryPhoto=null}static{pF(this.prototype,"closeGallery",[ql])}static{Ap(rg({id:null,block:'[[[10,0],[14,0,"place-details"],[12],[1,"\\n"],[41,[30,0,["isEditing"]],[[[1," "],[8,[32,0],null,[["@place","@onSave","@onCancel"],[[30,0,["place"]],[30,0,["saveChanges"]],[30,0,["cancelEditing"]]]],null],[1,"\\n"]],[]],[[[1," "],[8,[32,1],null,[["@variant","@photos","@name","@resetKey","@scrollToEventId","@onPhotoClick"],["inline",[30,0,["photos"]],[30,0,["name"]],[30,0,["place","osmId"]],[30,0,["newlyUploadedPhotoId"]],[30,0,["openGallery"]]]],null],[1,"\\n "],[10,"h3"],[12],[1,[30,0,["name"]]],[13],[1,"\\n "],[10,2],[14,0,"place-type"],[12],[1,"\\n "],[1,[30,0,["type"]]],[1,"\\n "],[13],[1,"\\n"],[41,[30,0,["showDescription"]],[[[1," "],[10,2],[14,0,"place-description"],[12],[1,"\\n "],[1,[30,0,["place","description"]]],[1,"\\n "],[13],[1,"\\n"]],[]],null]],[]]],[1,"\\n "],[10,0],[14,0,"actions"],[12],[1,"\\n "],[10,0],[14,0,"save-button-wrapper"],[12],[1,"\\n "],[11,"button"],[16,0,[52,[30,0,["isSaved"]],"btn btn-secondary","btn btn-outline"]],[24,4,"button"],[4,[32,2],["click",[30,0,["toggleLists"]]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@color"],["bookmark",[52,[30,0,["isSaved"]],"currentColor","var(--link-color)"]]],null],[1,"\\n "],[1,[52,[30,0,["isSaved"]],"Saved","Save"]],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["showLists"]],[[[1," "],[8,[32,4],null,[["@place","@onClose","@isSaved"],[[30,0,["saveablePlace"]],[30,0,["closeLists"]],[30,0,["isSaved"]]]],null],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n\\n"],[41,[30,0,["isSaved"]],[[[1," "],[11,"button"],[24,0,"btn btn-outline"],[24,"title","Edit"],[16,"disabled",[30,0,["isEditing"]]],[24,4,"button"],[4,[32,2],["click",[30,0,["startEditing"]]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@color"],["edit","var(--link-color)"]],null],[1,"\\n Edit\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n\\n "],[10,0],[14,0,"meta-info"],[12],[1,"\\n\\n"],[41,[30,0,["cuisine"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["fork-and-knife","Cuisine"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[1,[30,0,["cuisine"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["openingHours"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["clock","Opening hours"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[1,[30,0,["openingHours"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["phone"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["phone","Phone"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[1,[30,0,["phone"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["whatsapp"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["whatsapp","WhatsApp"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[1,[30,0,["whatsapp"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["website"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["globe","Website"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[1,[30,0,["website"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["email"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["mail","Email"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[1,[30,0,["email"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["facebook"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["facebook","Facebook"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[10,3],[15,6,[30,0,["facebook","url"]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"\\n "],[1,[30,0,["facebook","username"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["instagram"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["instagram","Instagram"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[10,3],[15,6,[30,0,["instagram","url"]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"\\n "],[1,[30,0,["instagram","username"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["wikipedia"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["wikipedia","Wikipedia"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[10,3],[15,6,[29,["https://wikipedia.org/wiki/",[30,0,["wikipedia"]]]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"\\n Wikipedia\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"meta-info"],[12],[1,"\\n\\n"],[41,[30,0,["address"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["home","Address"]],null],[1,"\\n "],[10,1],[12],[1,[30,0,["address"]]],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@title"],["map-pin","Geo link"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[10,3],[15,6,[30,0,["geoLink"]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"\\n "],[1,[30,0,["visibleGeoLink"]]],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["osmUrl"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name"],["map"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[10,3],[15,6,[30,0,["osmUrl"]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"\\n OpenStreetMap\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["gmapsUrl"]],[[[1," "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name"],["map"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[10,3],[15,6,[30,0,["gmapsUrl"]]],[14,"target","_blank"],[14,"rel","noopener noreferrer"],[12],[1,"\\n Google Maps\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["place","osmId"]],[[[1," "],[10,0],[14,0,"meta-info"],[12],[1,"\\n "],[10,2],[14,0,"content-with-icon"],[12],[1,"\\n "],[8,[32,3],null,[["@name"],["feather-camera"]],null],[1,"\\n "],[10,1],[12],[1,"\\n "],[11,"button"],[24,0,"btn-link"],[24,4,"button"],[4,[32,2],["click",[30,0,["openPhotoUploadModal"]]],null],[12],[1,"\\n Add a photo\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[13],[1,"\\n\\n"],[41,[30,0,["isPhotoUploadModalOpen"]],[[[1," "],[8,[32,5],null,[["@onClose","@disableClose"],[[30,0,["closePhotoUploadModal"]],[30,0,["isPhotoUploadActive"]]]],[["default"],[[[[1,"\\n "],[8,[32,6],null,[["@place","@onClose","@onUploadStateChange"],[[30,0,["saveablePlace"]],[30,0,["closePhotoUploadModal"]],[30,0,["handleUploadStateChange"]]]],null],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["isNostrConnectModalOpen"]],[[[1," "],[8,[32,5],null,[["@onClose"],[[30,0,["closeNostrConnectModal"]]]],[["default"],[[[[1,"\\n "],[8,[32,7],null,[["@onConnect"],[[30,0,["onNostrConnected"]]]],null],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],null],[1,"\\n"],[41,[30,0,["isGalleryOpen"]],[[[1," "],[8,[32,8],null,[["@photos","@selectedPhoto","@placeName","@onClose"],[[30,0,["photos"]],[30,0,["selectedGalleryPhoto"]],[30,0,["name"]],[30,0,["closeGallery"]]]],null],[1,"\\n"]],[]],null]],[],["if"]]',moduleName:"(unknown template module)",scope:()=>({PlaceEditForm:cW,PhotoCarousel:vW,on:Ww,Icon:M$,PlaceListsManager:hW,Modal:rq,PlacePhotoUpload:mW,NostrConnect:Uq,PhotoGallery:_W}),isStrictMode:!0}),this)}},CW=kb(function([e]){return FU(e)}),SW=class extends I${static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");static{dF(this.prototype,"nostrData",[dp])}#F=void fF(this,"nostrData");createNewPlace(){const e=this.router.currentRoute.queryParams,t=e.lat,n=e.lon;t&&n?this.router.transitionTo("place.new",{queryParams:{lat:t,lon:n}}):this.router.transitionTo("place.new",{queryParams:{lat:0,lon:0}})}static{pF(this.prototype,"createNewPlace",[ql])}selectPlace(e){this.args.onSelect&&this.args.onSelect(e)}static{pF(this.prototype,"selectPlace",[ql])}clearSelection(){this.args.onSelect&&this.args.onSelect(null)}static{pF(this.prototype,"clearSelection",[ql])}async toggleSave(e){if(e)if(e.createdAt)try{if(await this.storage.removePlace(e),console.debug("Place deleted:",e.title),this.args.onBookmarkChange&&this.args.onBookmarkChange(),this.args.onUpdate){const t={...e,id:void 0,geohash:void 0,createdAt:void 0};this.args.onUpdate(t)}this.args.onSelect&&this.args.onSelect(null),this.args.onClose&&this.args.onClose()}catch(t){console.error("Failed to delete:",t),alert("Failed to delete: "+t.message)}else{const t={title:UU(e.osmTags,"Untitled Place"),lat:e.lat,lon:e.lon,tags:[],url:e.osmTags.website,osmId:String(e.osmId||e.id),osmType:e.osmType,osmTags:e.osmTags};try{const e=await this.storage.storePlace(t);console.debug("Place saved:",t.title),this.args.onBookmarkChange&&this.args.onBookmarkChange(),this.args.onUpdate&&this.args.onUpdate(e),this.args.onSelect&&this.args.onSelect(e)}catch(_6){console.error("Failed to save place:",_6),alert("Failed to save place: "+_6.message)}}}static{pF(this.prototype,"toggleSave",[ql])}async updateBookmark(e){try{const t=await this.storage.updatePlace(e);console.debug("Place updated:",t.title),this.args.onBookmarkChange&&this.args.onBookmarkChange(),this.args.onUpdate&&this.args.onUpdate(t)}catch(t){console.error("Failed to update place:",t),alert("Failed to update place: "+t.message)}}static{pF(this.prototype,"updateBookmark",[ql])}get isNearbySearch(){const e=this.router.currentRoute.queryParams;return!e.q&&!e.category&&e.lat&&e.lon}get hasHeaderPhoto(){return this.args.selectedPlace&&this.nostrData.placePhotos&&this.nostrData.placePhotos.length>0}static{Ap(rg({id:null,block:'[[[10,0],[14,0,"sidebar"],[12],[1,"\\n "],[10,0],[15,0,[29,["sidebar-header\\n ",[52,[30,0,["hasHeaderPhoto"]],"no-border"],"\\n ",[52,[28,[32,0],[[28,[32,1],[[30,1]],null],[30,2]],null],"has-back-btn"]]]],[12],[1,"\\n"],[41,[30,1],[[[1," "],[11,"button"],[24,0,"back-btn"],[24,4,"button"],[4,[32,2],["click",[30,0,["clearSelection"]]],null],[12],[8,[32,3],null,[["@name","@size","@color"],["arrow-left",20,"#333"]],null],[13],[1,"\\n"]],[]],[[[41,[30,2],[[[1," "],[11,"button"],[24,0,"back-btn"],[24,4,"button"],[4,[32,2],["click",[30,2]],null],[12],[8,[32,3],null,[["@name","@size","@color"],["arrow-left",20,"#333"]],null],[13],[1,"\\n"]],[]],null],[41,[30,2],[[[1," "],[10,"h2"],[14,0,"sidebar-header-text-centered"],[12],[1,"\\n "],[10,1],[14,0,"sidebar-header-icon-wrapper"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@size","@color"],["bookmark",20,[28,[32,4],[[30,3],"#898989"],null]]],null],[1,"\\n "],[13],[1,"\\n "],[1,[30,4]],[1,"\\n "],[13],[1,"\\n"]],[]],[[[41,[30,0,["isNearbySearch"]],[[[1," "],[10,"h2"],[12],[8,[32,3],null,[["@name","@size","@color"],["target",20,"#ea4335"]],null],[1,"\\n Nearby"],[13],[1,"\\n"]],[]],[[[1," "],[10,"h2"],[12],[8,[32,3],null,[["@name","@size","@color"],["search",20,"#333"]],null],[1,"\\n Results"],[13],[1,"\\n"]],[]]]],[]]]],[]]],[1," "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,2],["click",[30,5]],null],[12],[8,[32,3],null,[["@name","@size","@color"],["x",20,"#333"]],null],[13],[1,"\\n "],[13],[1,"\\n\\n "],[11,0],[24,0,"sidebar-content"],[4,[32,5],[[30,6]],null],[12],[1,"\\n"],[41,[30,1],[[[1," "],[8,[32,6],null,[["@place","@onToggleSave","@onSave"],[[30,1],[30,0,["toggleSave"]],[30,0,["updateBookmark"]]]],null],[1,"\\n"]],[]],[[[41,[30,7],[[[1," "],[10,0],[14,0,"sidebar-loading"],[12],[1,"\\n "],[8,[32,3],null,[["@name","@size","@color"],["loading-ring",24,"#898989"]],null],[1,"\\n "],[13],[1,"\\n"]],[]],[[[41,[30,8],[[[1," "],[10,"ul"],[14,0,"places-list"],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,8]],null]],null],null,[[[1," "],[10,"li"],[12],[1,"\\n "],[11,"button"],[24,0,"place-item"],[24,4,"button"],[4,[32,2],["click",[28,[32,7],[[30,0,["selectPlace"]],[30,9]],null]],null],[12],[1,"\\n "],[10,0],[14,0,"place-name"],[12],[1,[28,[32,4],[[30,9,["title"]],[30,9,["osmTags","name"]],[30,9,["osmTags","name:en"]],"Unnamed Place"],null]],[13],[1,"\\n "],[10,0],[14,0,"place-type"],[12],[1,"\\n"],[41,[28,[32,8],[[30,9,["source"]],"osm"],null],[[[1," "],[1,[28,[32,9],[[30,9,["type"]]],null]],[1,"\\n"]],[]],[[[41,[28,[32,8],[[30,9,["source"]],"photon"],null],[[[1," "],[1,[30,9,["description"]]],[1,"\\n"]],[]],[[[41,[28,[32,10],[[30,9,["osmTags"]]],null],[[[1," "],[1,[28,[32,10],[[30,9,["osmTags"]]],null]],[1,"\\n"]],[]],[[[1," Saved place\\n "]],[]]]],[]]]],[]]],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[9]],null],[1," "],[13],[1,"\\n"]],[]],[[[41,[30,0,["isNearbySearch"]],[[[1," "],[10,2],[14,0,"empty-state"],[12],[1,"No places found nearby."],[13],[1,"\\n"]],[]],[[[1," "],[10,2],[14,0,"empty-state"],[12],[1,"No results found."],[13],[1,"\\n"]],[]]]],[]]],[1,"\\n "],[11,"button"],[24,0,"btn btn-outline create-place"],[24,4,"button"],[4,[32,2],["click",[30,0,["createNewPlace"]]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@size","@color"],["plus",18,"var(--link-color)"]],null],[1,"\\n Create new place\\n "],[13],[1,"\\n"]],[]]]],[]]],[1," "],[13],[1,"\\n"],[13]],["@selectedPlace","@onBack","@color","@title","@onClose","@scrollTop","@isLoading","@places","place"],["if","each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({and:iq,not:oq,on:Ww,Icon:M$,or:J$,restoreScroll:Bq,PlaceDetails:xW,fn:Z$,eq:sq,humanizeOsmTag:CW,getPlaceType:$U}),isStrictMode:!0}),this)}},kW=a({default:()=>EW}),EW=Ap(rg({id:null,block:'[[[41,[30,1,["mapUi","isSidebarVisible"]],[[[1," "],[8,[32,0],null,[["@places","@title","@color","@scrollTop","@isLoading","@onSelect","@onClose","@onBack"],[[30,1,["places"]],[30,1,["listTitle"]],[30,1,["listColor"]],[30,1,["scrollTop"]],[30,1,["loadPlacesTask","isRunning"]],[30,1,["selectPlace"]],[30,1,["close"]],[30,1,["backToLists"]]]],null],[1,"\\n"]],[]],null]],["@controller"],["if"]]',moduleName:"(unknown template module)",scope:()=>({PlacesSidebar:SW}),isStrictMode:!0}),tq()),RW=a({default:()=>MW});function TW(e){const t=e.createdAt;if(!t)return 0;if("number"==typeof t)return t;const n=Date.parse(t);return isNaN(n)?0:n}var LW,IW,PW,MW=class extends eu{static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");static{dF(this.prototype,"model",[Vr])}#_t=void fF(this,"model");static{dF(this.prototype,"loadedPlaces",[Vr],function(){return[]})}#xt=void fF(this,"loadedPlaces");get listId(){return this.model?.list_id}loadPlacesTask=eW(()=>({context:this,generator:function*(e){this.loadedPlaces=[];try{this.loadedPlaces=yield this.storage.getPlacesInList(e)}catch(t){console.error("Failed to load places in list",e,t),this.loadedPlaces=[]}}}),{restartable:!0},"loadPlacesTask",null);get scrollTop(){return this.mapUi.getScrollPosition(`list-${this.listId}`)}get listColor(){const e=this.storage.lists.find(e=>e.id===this.listId);return e&&e.color?e.color:getComputedStyle(document.documentElement).getPropertyValue("--default-list-color").trim()}get listTitle(){const e=this.storage.lists.find(e=>e.id===this.listId);return e?e.title:"Collections"}get places(){const e=this.storage.lists.find(e=>e.id===this.listId),t=new Set(e?.placeRefs?.map(e=>e.id)||[]),n=this.storage.savedPlaces.filter(e=>t.has(e.id)),r=[],i=new Set;return n.forEach(e=>{r.push(e),i.add(e.id)}),this.loadedPlaces.forEach(e=>{t.has(e.id)&&!i.has(e.id)&&(r.push(e),i.add(e.id))}),r.sort((e,t)=>TW(t)-TW(e))}selectPlace(e){if(e){const t=document.querySelector(".sidebar-content");t&&this.mapUi.saveScrollPosition(`list-${this.listId}`,t.scrollTop),this.mapUi.returnToRoute={name:"lists.list",model:this.listId},this.mapUi.showSidebar(),this.mapUi.preventNextZoom=!0,this.router.transitionTo("place",e)}}static{pF(this.prototype,"selectPlace",[ql])}close(){this.router.transitionTo("index")}static{pF(this.prototype,"close",[ql])}backToLists(){this.router.transitionTo("lists.index")}static{pF(this.prototype,"backToLists",[ql])}},AW=a({default:()=>OW}),OW=class extends Jh{static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");model(e){return{list_id:e.list_id}}setupController(e,t){console.debug("DEBUG: setupController controller is:",e),console.debug("DEBUG: controller.loadPlacesTask is:",e?.loadPlacesTask),e.model=t,super.setupController(e,t),e&&e.loadPlacesTask?e.loadPlacesTask.perform(t.list_id):console.error("DEBUG: ERROR! controller.loadPlacesTask is undefined!")}},NW=a({default:()=>FW}),FW=class extends I${static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");styleFor(e){const t=e||getComputedStyle(document.documentElement).getPropertyValue("--default-list-color").trim();return $v(`background-color: ${t}`)}selectList(e){this.router.transitionTo("lists.list",e)}static{pF(this.prototype,"selectList",[ql])}close(){this.router.transitionTo("index")}static{pF(this.prototype,"close",[ql])}backToMenu(){this.router.transitionTo("menu")}static{pF(this.prototype,"backToMenu",[ql])}static{Ap(rg({id:null,block:'[[[41,[30,0,["mapUi","isSidebarVisible"]],[[[1," "],[10,0],[14,0,"sidebar"],[12],[1,"\\n "],[10,0],[14,0,"sidebar-header has-back-btn"],[12],[1,"\\n "],[11,"button"],[24,0,"back-btn"],[24,4,"button"],[4,[32,0],["click",[30,0,["backToMenu"]]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["arrow-left",20,"#333"]],null],[1,"\\n "],[13],[1,"\\n "],[10,"h2"],[14,0,"sidebar-header-text-centered"],[12],[1,"\\n "],[10,1],[14,0,"sidebar-header-icon-wrapper"],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["bookmark",20,"#898989"]],null],[1,"\\n "],[13],[1,"\\n Collections\\n "],[13],[1,"\\n "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,0],["click",[30,0,["close"]]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["x",20,"#333"]],null],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"sidebar-content"],[12],[1,"\\n "],[10,"ul"],[14,0,"places-list"],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,0,["storage","lists"]]],null]],null],null,[[[1," "],[10,"li"],[12],[1,"\\n "],[11,"button"],[24,0,"lists-index-item"],[24,4,"button"],[4,[32,0],["click",[28,[32,2],[[30,0,["selectList"]],[30,1,["id"]]],null]],null],[12],[1,"\\n "],[10,0],[14,0,"lists-index-item-left"],[12],[1,"\\n"],[1," "],[10,1],[14,0,"list-color-dot"],[15,5,[28,[30,0,["styleFor"]],[[30,1,["color"]]],null]],[12],[13],[1,"\\n "],[10,0],[14,0,"lists-index-name"],[12],[1,[30,1,["title"]]],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"lists-index-count"],[12],[1,"\\n"],[41,[30,1,["placeRefs","length"]],[[[1," "],[1,[30,1,["placeRefs","length"]]],[1,"\\n places\\n"]],[]],[[[1," empty\\n"]],[]]],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[1]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null]],["list"],["if","each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({on:Ww,Icon:M$,fn:Z$}),isStrictMode:!0}),this)}},DW=a({default:()=>zW}),zW=class extends Jh{},jW=a({default:()=>UW}),UW=class extends I${static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");selectPlace(e){if(e){const t=document.querySelector(".sidebar-content");t&&this.mapUi.saveScrollPosition("search",t.scrollTop),this.mapUi.returnToSearch=!0,this.mapUi.showSidebar(),this.mapUi.preventNextZoom=!0,this.router.transitionTo("place",e)}}static{pF(this.prototype,"selectPlace",[ql])}close(){this.mapUi.hideSidebar()}static{pF(this.prototype,"close",[ql])}static{Ap(rg({id:null,block:'[[[41,[30,0,["mapUi","isSidebarVisible"]],[[[1," "],[8,[32,0],null,[["@places","@scrollTop","@onSelect","@onClose"],[[30,0,["mapUi","searchResults"]],[28,[30,0,["mapUi","getScrollPosition"]],["search"],null],[30,0,["selectPlace"]],[30,0,["close"]]]],null],[1,"\\n"]],[]],null]],[],["if"]]',moduleName:"(unknown template module)",scope:()=>({PlacesSidebar:SW}),isStrictMode:!0}),this)}},BW=a({default:()=>$W}),$W=class extends eu{static{dF(this.prototype,"osm",[dp])}#B=void fF(this,"osm");static{dF(this.prototype,"photon",[dp])}#Ct=void fF(this,"photon");static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");static{dF(this.prototype,"toast",[dp])}#Ie=void fF(this,"toast");queryParams=["lat","lon","q","selected","category"];lat=null;lon=null;q=null;selected=null;category=null;fetchResultsTask=eW(()=>({context:this,generator:function*(e){const t=this.mapUi.currentSearch&&e.q===this.mapUi.currentSearch.q&&e.category===this.mapUi.currentSearch.category&&e.lat===this.mapUi.currentSearch.lat&&e.lon===this.mapUi.currentSearch.lon,n=this.mapUi.searchResults&&this.mapUi.searchResults.length>0;if(t&&n)return void(this.mapUi.isSidebarVisible&&this.mapUi.showSidebar());this.mapUi.hideSidebar(),this.mapUi.clearSearchResults();const r=e.lat?parseFloat(e.lat):null,i=e.lon?parseFloat(e.lon):null;let s=[],o=null,a=null;try{if(e.category&&r&&i){o="category",a=e.category,this.mapUi.startLoading(o,a);let t=this.mapUi.currentBounds;if(!t){const e=.01;t={minLat:r-e,maxLat:r+e,minLon:i-e,maxLon:i+e}}s=yield this.osm.getCategoryPois(t,e.category,r,i),s=s.map(e=>({...e,_distance:yB(r,i,e.lat,e.lon)})).sort((e,t)=>e._distance-t._distance)}else if(e.q){o="text",a=e.q,this.mapUi.startLoading(o,a),s=yield this.photon.search(e.q,r,i);const t=e.q.toLowerCase();let n=[];t.length>=3&&(n=this.storage.savedPlaces.filter(e=>e.title?.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t))),n.forEach(e=>{s.find(t=>e.osmId&&t.osmId===e.osmId||t.id&&t.id===e.id)||s.push(e)})}else if(r&&i){const e=50;s=yield this.osm.getNearbyPois(r,i,e),this.storage.savedPlaces.filter(t=>yB(r,i,t.lat,t.lon)<=e).forEach(e=>{s.find(t=>e.osmId&&t.osmId===e.osmId||t.id&&t.id===e.id)||s.push(e)}),s=s.map(e=>({...e,_distance:yB(r,i,e.lat,e.lon)})).sort((e,t)=>e._distance-t._distance)}}catch(_6){return console.error("Search request failed.",_6),this.toast.show("Search request failed. Please try again."),void this.mapUi.stopSearch()}finally{o&&a&&this.mapUi.stopLoading(o,a)}s=s.map(e=>this.storage.findPlaceById(e.osmId)||e);const l=e.selected||e.q;if(l&&s.length>0){let e=s.find(e=>e.osmTags&&(e.osmTags.name===l||e.osmTags["name:en"]===l));if(!e){const t=s[0];t._distance<=10&&(e=t)}if(e)return this.router.replaceWith("place",e),void this.mapUi.stopSearch()}this.mapUi.setSearchResults(s),this.mapUi.showSidebar(),this.mapUi.stopSearch()}}),{restartable:!0},"fetchResultsTask",null)},qW=a({default:()=>VW}),VW=class extends Jh{static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");static{dF(this.prototype,"toast",[dp])}#Ie=void fF(this,"toast");queryParams={lat:{refreshModel:!0},lon:{refreshModel:!0},q:{refreshModel:!0},selected:{refreshModel:!0},category:{refreshModel:!0}};model(e){return e}setupController(e,t){super.setupController(e,t),e.fetchResultsTask.perform(t);const{q:n,category:r,lat:i,lon:s}=this.paramsFor("search");this.mapUi.currentSearch={q:n,category:r,lat:i,lon:s}}resetController(e,t){t&&(e.fetchResultsTask.cancelAll(),this.mapUi.stopSearch())}error(e,t){return this.mapUi.stopSearch(),this.toast.show("Search request failed. Please try again."),t&&t.abort(),!1}static{pF(this.prototype,"error",[ql])}},WW=a({cacheFor:()=>Qn,guidFor:()=>al}),HW=(LW=dp("page-title"),PW=n$((IW=class extends wb{constructor(e){super(e),t$(this,"tokens",PW,this),e$(this,"tokenId",al(this)),this.tokens.push({id:this.tokenId})}compute(e,t){const n={...t,id:this.tokenId,title:e.join("")};return this.tokens.push(n),this.tokens.scheduleTitleUpdate(),""}willDestroy(){super.willDestroy(),this.tokens.remove(this.tokenId),this.tokens.scheduleTitleUpdate()}}).prototype,"tokens",[LW],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),IW),GW="add",KW="remove",ZW="propertychange";function YW(e){for(const t in e)delete e[t]}function XW(e){let t;for(t in e)return!1;return!t}function JW(e,t,n,r,i){if(i){const i=n;n=function(s){return e.removeEventListener(t,n),i.call(r??this,s)}}else r&&r!==e&&(n=n.bind(r));const s={target:e,type:t,listener:n};return e.addEventListener(t,n),s}function QW(e,t,n,r){return JW(e,t,n,r,!0)}function eH(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),YW(e))}var tH="change",nH="contextmenu",rH="click",iH="keydown",sH="keypress",oH="touchmove",aH="wheel",lH=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function cH(e,t){return e>t?1:e<t?-1:0}function uH(e,t){return e<t?1:e>t?-1:0}function hH(e,t,n){if(e[0]<=t)return 0;const r=e.length;if(t<=e[r-1])return r-1;if("function"==typeof n){for(let i=1;i<r;++i){const r=e[i];if(r===t)return i;if(r<t)return n(t,e[i-1],r)>0?i-1:i}return r-1}if(n>0){for(let n=1;n<r;++n)if(e[n]<t)return n-1;return r-1}if(n<0){for(let n=1;n<r;++n)if(e[n]<=t)return n;return r-1}for(let i=1;i<r;++i){if(e[i]==t)return i;if(e[i]<t)return e[i-1]-t<t-e[i]?i-1:i}return r-1}function dH(e,t,n){for(;t<n;){const r=e[t];e[t]=e[n],e[n]=r,++t,--n}}function pH(e,t){const n=Array.isArray(t)?t:[t],r=n.length;for(let i=0;i<r;i++)e[e.length]=n[i]}function fH(e,t){const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function gH(){return!0}function mH(){return!1}function yH(){}function vH(e){let t,n,r;return function(){const i=Array.prototype.slice.call(arguments);return n&&this===r&&fH(i,n)||(r=this,n=i,t=e.apply(this,arguments)),t}}function bH(e){return function(){let t;try{t=e()}catch(RD){return Promise.reject(RD)}return t instanceof Promise?t:Promise.resolve(t)}()}var wH=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},_H=class extends lH{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const n=this.listeners_||(this.listeners_={}),r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){const t="string"==typeof e,n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;const i=t?new wH(e):e;i.target||(i.target=this.eventTarget_||this);const s=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;n in s||(s[n]=0,o[n]=0),++s[n];for(let l=0,c=r.length;l<c;++l)if(a="handleEvent"in r[l]?r[l].handleEvent(i):r[l].call(this,i),!1===a||i.propagationStopped){a=!1;break}if(0===--s[n]){let e=o[n];for(delete o[n];e--;)this.removeEventListener(n,yH);delete s[n]}return a}disposeInternal(){this.listeners_&&YW(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return!!this.listeners_&&(e?e in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(e,t){if(!this.listeners_)return;const n=this.listeners_[e];if(!n)return;const r=n.indexOf(t);-1!==r&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=yH,++this.pendingRemovals_[e]):(n.splice(r,1),0===n.length&&delete this.listeners_[e]))}},xH=class extends _H{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(tH)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const n=e.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=JW(this,e[i],t);return r}return JW(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){const r=e.length;n=new Array(r);for(let i=0;i<r;++i)n[i]=QW(this,e[i],t)}else n=QW(this,e,t);return t.ol_key=n,n}unInternal(e,t){const n=t.ol_key;if(n)!function(e){if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)eH(e[t]);else eH(e)}(n);else if(Array.isArray(e))for(let r=0,i=e.length;r<i;++r)this.removeEventListener(e[r],t);else this.removeEventListener(e,t)}};function CH(){throw new Error("Unimplemented abstract method.")}xH.prototype.on,xH.prototype.once,xH.prototype.un;var SH=0;function kH(e){return e.ol_uid||(e.ol_uid=String(++SH))}var EH=class extends wH{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},RH=class extends xH{constructor(e){super(),this.on,this.once,this.un,kH(this),this.values_=null,void 0!==e&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}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(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new EH(n,e,t)),n=ZW,this.hasListener(n)&&this.dispatchEvent(new EH(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){const r=this.values_||(this.values_={});if(n)r[e]=t;else{const n=r[e];r[e]=t,n!==t&&this.notify(e,n)}}setProperties(e,t){for(const n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){const n=this.values_[e];delete this.values_[e],XW(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},TH="length",LH=class extends wH{constructor(e,t,n){super(e),this.element=t,this.index=n}},IH=class extends RH{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let n=1,r=this.array_.length;n<r;++n)this.assertUnique_(this.array_[n],n);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){const t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(TH)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new LH(GW,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){const t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){const t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;const t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new LH(KW,t,e)),t}setAt(e,t){if(e>=this.getLength())return void this.insertAt(e,t);if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);const n=this.array_[e];this.array_[e]=t,this.dispatchEvent(new LH(KW,n,e)),this.dispatchEvent(new LH(GW,t,e))}updateLength_(){this.set(TH,this.array_.length)}assertUnique_(e,t){const n=this.array_;for(let r=0,i=n.length;r<i;++r)if(n[r]===e&&r!==t)throw new Error("Duplicate item added to a unique collection")}},PH=class extends wH{constructor(e,t,n){super(e),this.map=t,this.frameState=void 0!==n?n:null}},MH=class extends PH{constructor(e,t,n,r,i,s){super(e,t,i),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==r&&r,this.activePointers=s}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},AH={SINGLECLICK:"singleclick",CLICK:rH,DBLCLICK:"dblclick",POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},OH="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",NH=(OH.includes("safari")&&!OH.includes("chrom")&&(OH.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(OH)),OH.includes("webkit")&&!OH.includes("edge")),FH=OH.includes("macintosh"),DH="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,zH="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,jH="undefined"!=typeof Image&&Image.prototype.decode,UH="function"==typeof createImageBitmap,BH=function(){let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("_",null,t),window.removeEventListener("_",null,t)}catch{}return e}(),$H="pointerdown",qH=class extends _H{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===t?1:t,this.down_=null;const n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=JW(n,$H,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=JW(n,"pointermove",this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(oH,this.boundHandleTouchMove_,!!BH&&{passive:!1})}emulateClick_(e){let t=new MH(AH.CLICK,this.map_,e);this.dispatchEvent(t),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new MH(AH.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const t=new MH(AH.SINGLECLICK,this.map_,e);this.dispatchEvent(t)},250)}updateActivePointers_(e){const t=e,n=t.pointerId;if(t.type==AH.POINTERUP||t.type==AH.POINTERCANCEL){delete this.trackedTouches_[n];for(const e in this.trackedTouches_)if(this.trackedTouches_[e].target!==t.target){delete this.trackedTouches_[e];break}}else t.type!=AH.POINTERDOWN&&t.type!=AH.POINTERMOVE||(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);const t=new MH(AH.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(eH),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return 0===e.button}handlePointerDown_(e){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(e);const t=new MH(AH.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),0===this.dragListenerKeys_.length){const e=this.map_.getOwnerDocument();this.dragListenerKeys_.push(JW(e,AH.POINTERMOVE,this.handlePointerMove_,this),JW(e,AH.POINTERUP,this.handlePointerUp_,this),JW(this.element_,AH.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==e&&this.dragListenerKeys_.push(JW(this.element_.getRootNode(),AH.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;const t=new MH(AH.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;const t=!(!this.down_||!this.isMoving_(e));this.dispatchEvent(new MH(AH.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){const t=this.originalPointerMoveEvent_;t&&!t.defaultPrevented||"boolean"==typeof e.cancelable&&!0!==e.cancelable||e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(eH(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(oH,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(eH(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(eH),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},VH="postrender",WH="loadstart",HH="loadend",GH="layergroup",KH="size",ZH="target",YH="view";function XH(e,t){if(!e)throw new Error(t)}var JH=1/0,QH=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,YW(this.queuedElements_)}dequeue(){const e=this.elements_,t=this.priorities_,n=e[0];1==e.length?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));const r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){XH(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const t=this.priorityFunction_(e);return t!=1/0&&(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(e){return 2*e+1}getRightChildIndex_(e){return 2*e+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return 0===this.elements_.length}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){const t=this.elements_,n=this.priorities_,r=t.length,i=t[e],s=n[e],o=e;for(;e<r>>1;){const i=this.getLeftChildIndex_(e),s=this.getRightChildIndex_(e),o=s<r&&n[s]<n[i]?s:i;t[e]=t[o],n[e]=n[o],e=o}t[e]=i,n[e]=s,this.siftDown_(o,e)}siftDown_(e,t){const n=this.elements_,r=this.priorities_,i=n[t],s=r[t];for(;t>e;){const e=this.getParentIndex_(t);if(!(r[e]>s))break;n[t]=n[e],r[t]=r[e],t=e}n[t]=i,r[t]=s}reprioritize(){const e=this.priorityFunction_,t=this.elements_,n=this.priorities_;let r=0;const i=t.length;let s,o,a;for(o=0;o<i;++o)s=t[o],a=e(s),a==1/0?delete this.queuedElements_[this.keyFunction_(s)]:(n[r]=a,t[r++]=s);t.length=r,n.length=r,this.heapify_()}},eG=class extends QH{constructor(e,t){super(t=>e.apply(null,t),e=>e[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){const t=super.enqueue(e);return t&&e[0].addEventListener(tH,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){const t=e.target,n=t.getState();if(2===n||3===n||4===n){3!==n&&t.removeEventListener(tH,this.boundHandleTileChange_);const e=t.getKey();e in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[e],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){const e=this.dequeue()[0],t=e.getKey();0!==e.getState()||t in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[t]=!0,++this.tilesLoading_,++n,e.load())}}},tG={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function nG(e,t,n){return Math.min(Math.max(e,t),n)}function rG(e,t,n,r,i,s){const o=i-n,a=s-r;if(0!==o||0!==a){const l=((e-n)*o+(t-r)*a)/(o*o+a*a);l>1?(n=i,r=s):l>0&&(n+=o*l,r+=a*l)}return iG(e,t,n,r)}function iG(e,t,n,r){const i=n-e,s=r-t;return i*i+s*s}function sG(e){return 180*e/Math.PI}function oG(e){return e*Math.PI/180}function aG(e,t){const n=e%t;return n*t<0?n+t:n}function lG(e,t,n){return e+n*(t-e)}function cG(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}function uG(e,t){return Math.floor(cG(e,t))}function hG(e,t){return Math.ceil(cG(e,t))}function dG(e,t,n){if(e>=t&&e<n)return e;const r=n-t;return((e-t)%r+r)%r+t}function pG(e,t,n){return function(r,i,s,o,a){if(!r)return;if(!i&&!t)return r;const l=t?0:s[0]*i,c=t?0:s[1]*i,u=a?a[0]:0,h=a?a[1]:0;let d=e[0]+l/2+u,p=e[2]-l/2+u,f=e[1]+c/2+h,g=e[3]-c/2+h;d>p&&(d=(p+d)/2,p=d),f>g&&(f=(g+f)/2,g=f);let m=nG(r[0],d,p),y=nG(r[1],f,g);if(o&&n&&i){const e=30*i;m+=-e*Math.log(1+Math.max(0,d-r[0])/e)+e*Math.log(1+Math.max(0,r[0]-p)/e),y+=-e*Math.log(1+Math.max(0,f-r[1])/e)+e*Math.log(1+Math.max(0,r[1]-g)/e)}return[m,y]}}function fG(e){return e}function gG(e){const t=[1/0,1/0,-1/0,-1/0];for(let n=0,r=e.length;n<r;++n)LG(t,e[n]);return t}function mG(e,t,n){return n?(n[0]=e[0]-t,n[1]=e[1]-t,n[2]=e[2]+t,n[3]=e[3]+t,n):[e[0]-t,e[1]-t,e[2]+t,e[3]+t]}function yG(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e.slice()}function vG(e,t,n){let r,i;return r=t<e[0]?e[0]-t:e[2]<t?t-e[2]:0,i=n<e[1]?e[1]-n:e[3]<n?n-e[3]:0,r*r+i*i}function bG(e,t){return _G(e,t[0],t[1])}function wG(e,t){return e[0]<=t[0]&&t[2]<=e[2]&&e[1]<=t[1]&&t[3]<=e[3]}function _G(e,t,n){return e[0]<=t&&t<=e[2]&&e[1]<=n&&n<=e[3]}function xG(e,t){const n=e[0],r=e[1],i=e[2],s=e[3],o=t[0],a=t[1];let l=0;return o<n?l|=16:o>i&&(l|=4),a<r?l|=8:a>s&&(l|=2),0===l&&(l=1),l}function CG(e,t,n,r,i){return i?(i[0]=e,i[1]=t,i[2]=n,i[3]=r,i):[e,t,n,r]}function SG(e){return CG(1/0,1/0,-1/0,-1/0,e)}function kG(e,t){const n=e[0],r=e[1];return CG(n,r,n,r,t)}function EG(e,t,n,r,i){return IG(SG(i),e,t,n,r)}function RG(e,t){return e[0]==t[0]&&e[2]==t[2]&&e[1]==t[1]&&e[3]==t[3]}function TG(e,t){return t[0]<e[0]&&(e[0]=t[0]),t[2]>e[2]&&(e[2]=t[2]),t[1]<e[1]&&(e[1]=t[1]),t[3]>e[3]&&(e[3]=t[3]),e}function LG(e,t){t[0]<e[0]&&(e[0]=t[0]),t[0]>e[2]&&(e[2]=t[0]),t[1]<e[1]&&(e[1]=t[1]),t[1]>e[3]&&(e[3]=t[1])}function IG(e,t,n,r,i){for(;n<r;n+=i)PG(e,t[n],t[n+1]);return e}function PG(e,t,n){e[0]=Math.min(e[0],t),e[1]=Math.min(e[1],n),e[2]=Math.max(e[2],t),e[3]=Math.max(e[3],n)}function MG(e,t){let n;return n=t(OG(e)),n||(n=t(NG(e)),n||(n=t(VG(e)),n||(n=t(qG(e)),n||!1)))}function AG(e){let t=0;return GG(e)||(t=WG(e)*UG(e)),t}function OG(e){return[e[0],e[1]]}function NG(e){return[e[2],e[1]]}function FG(e){return[(e[0]+e[2])/2,(e[1]+e[3])/2]}function DG(e,t){let n;if("bottom-left"===t)n=OG(e);else if("bottom-right"===t)n=NG(e);else if("top-left"===t)n=qG(e);else{if("top-right"!==t)throw new Error("Invalid corner");n=VG(e)}return n}function zG(e,t,n,r,i){const[s,o,a,l,c,u,h,d]=jG(e,t,n,r);return CG(Math.min(s,a,c,h),Math.min(o,l,u,d),Math.max(s,a,c,h),Math.max(o,l,u,d),i)}function jG(e,t,n,r){const i=t*r[0]/2,s=t*r[1]/2,o=Math.cos(n),a=Math.sin(n),l=i*o,c=i*a,u=s*o,h=s*a,d=e[0],p=e[1];return[d-l+h,p-c-u,d-l-h,p-c+u,d+l-h,p+c+u,d+l+h,p+c-u,d-l+h,p-c-u]}function UG(e){return e[3]-e[1]}function BG(e,t,n){const r=n||[1/0,1/0,-1/0,-1/0];return HG(e,t)?(e[0]>t[0]?r[0]=e[0]:r[0]=t[0],e[1]>t[1]?r[1]=e[1]:r[1]=t[1],e[2]<t[2]?r[2]=e[2]:r[2]=t[2],e[3]<t[3]?r[3]=e[3]:r[3]=t[3]):SG(r),r}function $G(e,t){if(!HG(e,t))return[e.slice()];if(wG(t,e))return[];const[n,r,i,s]=e,o=Math.max(n,t[0]),a=Math.max(r,t[1]),l=Math.min(i,t[2]),c=Math.min(s,t[3]),u=[];return o>n&&u.push([n,r,o,s]),l<i&&u.push([l,r,i,s]),a>r&&u.push([o,r,l,a]),c<s&&u.push([o,c,l,s]),u}function qG(e){return[e[0],e[3]]}function VG(e){return[e[2],e[3]]}function WG(e){return e[2]-e[0]}function HG(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function GG(e){return e[2]<e[0]||e[3]<e[1]}function KG(e,t,n,r){if(GG(e))return SG(n);let i=[];if(r>1){const t=e[2]-e[0],n=e[3]-e[1];for(let s=0;s<r;++s)i.push(e[0]+t*s/r,e[1],e[2],e[1]+n*s/r,e[2]-t*s/r,e[3],e[0],e[3]-n*s/r)}else i=[e[0],e[1],e[2],e[1],e[2],e[3],e[0],e[3]];t(i,i,2);const s=[],o=[];for(let a=0,l=i.length;a<l;a+=2)s.push(i[a]),o.push(i[a+1]);return function(e,t,n){return CG(Math.min.apply(null,e),Math.min.apply(null,t),Math.max.apply(null,e),Math.max.apply(null,t),n)}(s,o,n)}function ZG(e,t){const n=t.getExtent(),r=FG(e);if(t.canWrapX()&&(r[0]<n[0]||r[0]>=n[2])){const t=WG(n),i=Math.floor((r[0]-n[0])/t)*t;e[0]-=i,e[2]-=i}return e}function YG(e,t,n){if(t.canWrapX()){const r=t.getExtent();if(!isFinite(e[0])||!isFinite(e[2]))return[[r[0],e[1],r[2],e[3]]];ZG(e,t);const i=WG(r);if(WG(e)>i&&!n)return[[r[0],e[1],r[2],e[3]]];if(e[0]<r[0])return[[e[0]+i,e[1],r[2],e[3]],[r[0],e[1],e[2],e[3]]];if(e[2]>r[2])return[[e[0],e[1],r[2],e[3]],[r[0],e[1],e[2]-i,e[3]]]}return[e]}function XG(e,t){let n=[e];for(let r=0,i=t.length;r<i&&n.length>0;++r){const e=[];for(let i=0,s=n.length;i<s;++i)e.push(...$G(n[i],t[r]));n=e}return n}function JG(e,t){let n=!0;for(let r=e.length-1;r>=0;--r)if(e[r]!=t[r]){n=!1;break}return n}function QG(e,t){const n=Math.cos(t),r=Math.sin(t),i=e[0]*n-e[1]*r,s=e[1]*n+e[0]*r;return e[0]=i,e[1]=s,e}function eK(e,t){if(t.canWrapX()){const n=WG(t.getExtent()),r=function(e,t,n){const r=t.getExtent();let i=0;return t.canWrapX()&&(e[0]<r[0]||e[0]>r[2])&&(n=n||WG(r),i=Math.floor((e[0]-r[0])/n)),i}(e,t,n);r&&(e[0]-=r*n)}return e}function tK(e){return Math.pow(e,3)}function nK(e){return 1-tK(1-e)}function rK(e){return 3*e*e-2*e*e*e}function iK(e){return e}function sK(e,t,n){n=n||6371008.8;const r=oG(e[1]),i=oG(t[1]),s=(i-r)/2,o=oG(t[0]-e[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(r)*Math.cos(i);return 2*n*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}function oK(e,t,n,r){r=r||6371008.8;const i=oG(e[1]),s=oG(e[0]),o=t/r,a=Math.asin(Math.sin(i)*Math.cos(o)+Math.cos(i)*Math.sin(o)*Math.cos(n));return[sG(s+Math.atan2(Math.sin(n)*Math.sin(o)*Math.cos(i),Math.cos(o)-Math.sin(i)*Math.sin(a))),sG(a)]}function aK(...e){console.warn(...e)}var lK={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},cK=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=void 0!==e.extent?e.extent:null,this.worldExtent_=void 0!==e.worldExtent?e.worldExtent:null,this.axisOrientation_=void 0!==e.axisOrientation?e.axisOrientation:"enu",this.global_=void 0!==e.global&&e.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||lK[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!(!e||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!(!this.global_||!e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},uK=6378137,hK=Math.PI*uK,dK=[-hK,-hK,hK,hK],pK=[-180,-85,180,85],fK=uK*Math.log(Math.tan(Math.PI/2)),gK=class extends cK{constructor(e){super({code:e,units:"m",extent:dK,global:!0,worldExtent:pK,getPointResolution:function(e,t){return e/Math.cosh(t[1]/uK)}})}},mK=[new gK("EPSG:3857"),new gK("EPSG:102100"),new gK("EPSG:102113"),new gK("EPSG:900913"),new gK("http://www.opengis.net/def/crs/EPSG/0/3857"),new gK("http://www.opengis.net/gml/srs/epsg.xml#3857")],yK=[-180,-90,180,90],vK=6378137*Math.PI/180,bK=class extends cK{constructor(e,t){super({code:e,units:"degrees",extent:yK,axisOrientation:t,global:!0,metersPerUnit:vK,worldExtent:yK})}},wK=[new bK("CRS:84"),new bK("EPSG:4326","neu"),new bK("urn:ogc:def:crs:OGC:1.3:CRS84"),new bK("urn:ogc:def:crs:OGC:2:84"),new bK("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new bK("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new bK("http://www.opengis.net/def/crs/EPSG/0/4326","neu")],_K={},xK={};function CK(e,t,n){const r=e.getCode(),i=t.getCode();r in xK||(xK[r]={}),xK[r][i]=n}function SK(e,t){return e in xK&&t in xK[e]?xK[e][t]:null}var kK=.9996,EK=.00669438,RK=EK*EK*EK,TK=EK/.99330562,LK=Math.sqrt(.99330562),IK=(1-LK)/(1+LK),PK=IK*IK,MK=PK*IK,AK=MK*IK,OK=AK*IK,NK=.9983242984503243,FK=35*RK/3072,DK=1.5*IK-27/32*MK+269/512*OK,zK=21/16*PK-55/32*AK,jK=151/96*MK-417/128*OK,UK=1097/512*AK,BK=6378137;function $K(e,t,n){const r=e-5e5,i=(n.north?t:t-1e7)/kK/(BK*NK),s=i+DK*Math.sin(2*i)+zK*Math.sin(4*i)+jK*Math.sin(6*i)+UK*Math.sin(8*i),o=Math.sin(s),a=o*o,l=Math.cos(s),c=o/l,u=c*c,h=u*u,d=1-EK*a,p=Math.sqrt(1-EK*a),f=TK*l**2,g=f*f,m=r/(BK/p*kK),y=m*m,v=y*m,b=v*m,w=b*m,_=s-c/(.99330562/d)*(y/2-b/24*(5+3*u+10*f-4*g-9*TK))+w*m/720*(61+90*u+298*f+45*h-252*TK-3*g);let x=(m-v/6*(1+2*u+f)+w/120*(5-2*f+28*u-3*g+8*TK+24*h))/l;return x=dG(x+oG(VK(n.number)),-Math.PI,Math.PI),[sG(x),sG(_)]}function qK(e,t,n){e=dG(e,-180,180),t<-80?t=-80:t>84&&(t=84);const r=oG(t),i=Math.sin(r),s=Math.cos(r),o=i/s,a=o*o,l=a*a,c=oG(e),u=oG(VK(n.number)),h=BK/Math.sqrt(1-EK*i**2),d=TK*s**2,p=s*dG(c-u,-Math.PI,Math.PI),f=p*p,g=f*p,m=g*p,y=m*p,v=y*p,b=BK*(NK*r-.002514607064228144*Math.sin(2*r)+26390466021299826e-22*Math.sin(4*r)-FK*Math.sin(6*r)),w=kK*h*(p+g/6*(1-a+d)+y/120*(5-18*a+l+72*d-58*TK))+5e5;let _=kK*(b+h*o*(f/2+m/24*(5-a+9*d+4*d**2)+v/720*(61-58*a+l+600*d-330*TK)));return n.north||(_+=1e7),[w,_]}function VK(e){return 6*(e-1)-180+3}var WK=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function HK(e){let t=0;for(const i of WK){const n=e.match(i);if(n){t=parseInt(n[1]);break}}if(!t)return null;let n=0,r=!1;return t>32700&&t<32761?n=t-32700:t>32600&&t<32661&&(r=!0,n=t-32600),n?{number:n,north:r}:null}function GK(e,t){return function(n,r,i,s){const o=n.length;i=i>1?i:2,s=s??i,r||(r=i>2?n.slice():new Array(o));for(let a=0;a<o;a+=s){const i=n[a],s=n[a+1],o=e(i,s,t);r[a]=o[0],r[a+1]=o[1]}return r}}var KK,ZK,YK,XK=[function(e){const t=HK(e.getCode());return t?{forward:GK(qK,t),inverse:GK($K,t)}:null}],JK=[function(e){return HK(e)?new cK({code:e,units:"m"}):null}],QK=!0;function eZ(e){QK=!(void 0===e||e)}function tZ(e,t){if(void 0!==t)for(let n=0,r=e.length;n<r;++n)t[n]=e[n];else t=e.slice();return t}function nZ(e,t){if(void 0!==t&&e!==t){for(let n=0,r=e.length;n<r;++n)t[n]=e[n];e=t}return e}function rZ(e){!function(e,t){_K[e]=t}(e.getCode(),e),CK(e,e,tZ)}function iZ(e){if("string"!=typeof e)return e;const t=_K[n=e]||_K[n.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null;var n;if(t)return t;for(const r of JK){const t=r(e);if(t)return t}return null}function sZ(e,t,n,r){let i;const s=(e=iZ(e)).getPointResolutionFunc();if(s){if(i=s(t,n),r&&r!==e.getUnits()){const t=e.getMetersPerUnit();t&&(i=i*t/lK[r])}}else{const s=e.getUnits();if("degrees"==s&&!r||"degrees"==r)i=t;else{const o=hZ(e,iZ("EPSG:4326"));if(o||"degrees"===s){let e=[n[0]-t/2,n[1],n[0]+t/2,n[1],n[0],n[1]-t/2,n[0],n[1]+t/2];e=o(e,e,2),i=(sK(e.slice(0,2),e.slice(2,4))+sK(e.slice(4,6),e.slice(6,8)))/2}else i=t*e.getMetersPerUnit();const a=r?lK[r]:e.getMetersPerUnit();void 0!==a&&(i/=a)}}return i}function oZ(e){!function(e){e.forEach(rZ)}(e),e.forEach(function(t){e.forEach(function(e){t!==e&&CK(t,e,tZ)})})}function aZ(e,t){return e?"string"==typeof e?iZ(e):e:iZ(t)}function lZ(e,t){return eZ(),fZ(e,"EPSG:4326",void 0!==t?t:"EPSG:3857")}function cZ(e,t){const n=fZ(e,void 0!==t?t:"EPSG:3857","EPSG:4326"),r=n[0];return(r<-180||r>180)&&(n[0]=aG(r+180,360)-180),n}function uZ(e,t){if(e===t)return!0;const n=e.getUnits()===t.getUnits();return(e.getCode()===t.getCode()||hZ(e,t)===tZ)&&n}function hZ(e,t){const n=e.getCode(),r=t.getCode();let i=SK(n,r);if(i)return i;let s=null,o=null;for(const l of XK)s||(s=l(e)),o||(o=l(t));if(!s&&!o)return null;const a="EPSG:4326";if(o)if(s)i=dZ(s.inverse,o.forward);else{const e=SK(n,a);e&&(i=dZ(e,o.forward))}else{const e=SK(a,r);e&&(i=dZ(s.inverse,e))}return i&&(rZ(e),rZ(t),CK(e,t,i)),i}function dZ(e,t){return function(n,r,i,s){return r=e(n,r,i,s),t(r,r,i,s)}}function pZ(e,t){return hZ(iZ(e),iZ(t))}function fZ(e,t,n){const r=pZ(t,n);if(!r){const e=iZ(t).getCode(),r=iZ(n).getCode();throw new Error(`No transform available between ${e} and ${r}`)}return r(e,void 0,e.length)}function gZ(e,t,n,r){return KG(e,pZ(t,n),void 0,r)}function mZ(e){return e}function yZ(e){return QK&&!JG(e,[0,0])&&e[0]>=-180&&e[0]<=180&&e[1]>=-90&&e[1]<=90&&(QK=!1,aK("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),e}function vZ(e){return e}oZ(mK),oZ(wK),KK=mK,ZK=function(e,t,n,r){const i=e.length;n=n>1?n:2,r=r??n,void 0===t&&(t=n>2?e.slice():new Array(i));for(let s=0;s<i;s+=r){t[s]=hK*e[s]/180;let n=uK*Math.log(Math.tan(Math.PI*(+e[s+1]+90)/360));n>fK?n=fK:n<-fK&&(n=-fK),t[s+1]=n}return t},YK=function(e,t,n,r){const i=e.length;n=n>1?n:2,r=r??n,void 0===t&&(t=n>2?e.slice():new Array(i));for(let s=0;s<i;s+=r)t[s]=180*e[s]/hK,t[s+1]=360*Math.atan(Math.exp(e[s+1]/uK))/Math.PI-90;return t},wK.forEach(function(e){KK.forEach(function(t){CK(e,t,ZK),CK(t,e,YK)})});var bZ=[1,0,0,1,0,0],wZ=new Array(6);function _Z(){return bZ.slice(0)}function xZ(e){return SZ(e,1,0,0,1,0,0)}function CZ(e,t){const n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=t[0],c=t[1],u=t[2],h=t[3],d=t[4],p=t[5];return e[0]=n*l+i*c,e[1]=r*l+s*c,e[2]=n*u+i*h,e[3]=r*u+s*h,e[4]=n*d+i*p+o,e[5]=r*d+s*p+a,e}function SZ(e,t,n,r,i,s,o){return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e[4]=s,e[5]=o,e}function kZ(e,t){const n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function EZ(e,t,n){return CZ(e,SZ(wZ,t,0,0,n,0,0))}function RZ(e,t,n,r,i,s,o,a){const l=Math.sin(s),c=Math.cos(s);return e[0]=r*c,e[1]=i*l,e[2]=-r*l,e[3]=i*c,e[4]=o*r*c-a*r*l+t,e[5]=o*i*l+a*i*c+n,e}function TZ(e,t){const n=(r=t)[0]*r[3]-r[1]*r[2];var r;XH(0!==n,"Transformation matrix cannot be inverted");const i=t[0],s=t[1],o=t[2],a=t[3],l=t[4],c=t[5];return e[0]=a/n,e[1]=-s/n,e[2]=-o/n,e[3]=i/n,e[4]=(o*c-a*l)/n,e[5]=-(i*c-s*l)/n,e}var LZ=[1e5,1e5,1e5,1e5,2,2];function IZ(e){return e.substring(7,e.length-1).split(",").map(parseFloat)}function PZ(e,t,n,r,i,s,o){s=s||[],o=o||2;let a=0;for(let l=t;l<n;l+=r){const t=e[l],n=e[l+1];s[a++]=i[0]*t+i[2]*n+i[4],s[a++]=i[1]*t+i[3]*n+i[5];for(let r=2;r<o;r++)s[a++]=e[l+r]}return s&&s.length!=a&&(s.length=a),s}function MZ(e,t,n,r,i,s,o){o=o||[];const a=Math.cos(i),l=Math.sin(i),c=s[0],u=s[1];let h=0;for(let d=t;d<n;d+=r){const t=e[d]-c,n=e[d+1]-u;o[h++]=c+t*a-n*l,o[h++]=u+t*l+n*a;for(let i=d+2;i<d+r;++i)o[h++]=e[i]}return o&&o.length!=h&&(o.length=h),o}var AZ=_Z(),OZ=[NaN,NaN],NZ=class extends RH{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=vH((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);const r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return CH()}closestPointXY(e,t,n,r){return CH()}containsXY(e,t){return 0===this.closestPointXY(e,t,OZ,Number.MIN_VALUE)}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return CH()}getExtent(e){if(this.extentRevision_!=this.getRevision()){const e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&SG(e),this.extentRevision_=this.getRevision()}return function(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e}(this.extent_,e)}rotate(e,t){CH()}scale(e,t,n){CH()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return CH()}getType(){return CH()}applyTransform(e){CH()}intersectsExtent(e){return CH()}translate(e,t){CH()}transform(e,t){const n=iZ(e),r="tile-pixels"==n.getUnits()?function(e,r,i){const s=n.getExtent(),o=n.getWorldExtent(),a=UG(o)/UG(s);RZ(AZ,o[0],o[3],a,-a,0,0,0);const l=PZ(e,0,e.length,i,AZ,r),c=pZ(n,t);return c?c(l,l,i):l}:pZ(n,t);return this.applyTransform(r),this}},FZ=class extends NZ{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return EG(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return CH()}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(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=zZ(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){CH()}setLayout(e,t,n){let r;if(e)r=zZ(e);else{for(let e=0;e<n;++e){if(0===t.length)return this.layout="XY",void(this.stride=2);t=t[0]}r=t.length,e=DZ(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(e,t){const n=this.getFlatCoordinates();if(n){const r=this.getStride();MZ(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){void 0===t&&(t=e),n||(n=FG(this.getExtent()));const r=this.getFlatCoordinates();if(r){const i=this.getStride();!function(e,t,n,r,i,s,o,a){a=a||[];const l=o[0],c=o[1];let u=0;for(let h=0;h<n;h+=r){const t=e[h]-l,n=e[h+1]-c;a[u++]=l+i*t,a[u++]=c+s*n;for(let i=h+2;i<h+r;++i)a[u++]=e[i]}a&&a.length!=u&&(a.length=u)}(r,0,r.length,i,e,t,n,r),this.changed()}}translate(e,t){const n=this.getFlatCoordinates();if(n){const r=this.getStride();!function(e,t,n,r,i,s,o){o=o||[];let a=0;for(let l=0;l<n;l+=r){o[a++]=e[l]+i,o[a++]=e[l+1]+s;for(let t=l+2;t<l+r;++t)o[a++]=e[t]}o&&o.length!=a&&(o.length=a)}(n,0,n.length,r,e,t,n),this.changed()}}};function DZ(e){let t;return 2==e?t="XY":3==e?t="XYZ":4==e&&(t="XYZM"),t}function zZ(e){let t;return"XY"==e?t=2:"XYZ"==e||"XYM"==e?t=3:"XYZM"==e&&(t=4),t}function jZ(e,t,n,r){let i=0;const s=e[n-r],o=e[n-r+1];let a=0,l=0;for(;t<n;t+=r){const n=e[t]-s,r=e[t+1]-o;i+=l*n-a*r,a=n,l=r}return i/2}function UZ(e,t,n,r){let i=0;for(let s=0,o=n.length;s<o;++s){const o=n[s];i+=jZ(e,t,o,r),t=o}return i}function BZ(e,t,n,r,i,s,o){const a=e[t],l=e[t+1],c=e[n]-a,u=e[n+1]-l;let h;if(0===c&&0===u)h=t;else{const d=((i-a)*c+(s-l)*u)/(c*c+u*u);if(d>1)h=n;else{if(d>0){for(let i=0;i<r;++i)o[i]=lG(e[t+i],e[n+i],d);return void(o.length=r)}h=t}}for(let d=0;d<r;++d)o[d]=e[h+d];o.length=r}function $Z(e,t,n,r,i){let s=e[t],o=e[t+1];for(t+=r;t<n;t+=r){const n=e[t],r=e[t+1],a=iG(s,o,n,r);a>i&&(i=a),s=n,o=r}return i}function qZ(e,t,n,r,i){for(let s=0,o=n.length;s<o;++s){const o=n[s];i=$Z(e,t,o,r,i),t=o}return i}function VZ(e,t,n,r,i,s,o,a,l,c,u){if(t==n)return c;let h,d;if(0===i){if(d=iG(o,a,e[t],e[t+1]),d<c){for(h=0;h<r;++h)l[h]=e[t+h];return l.length=r,d}return c}u=u||[NaN,NaN];let p=t+r;for(;p<n;)if(BZ(e,p-r,p,r,o,a,u),d=iG(o,a,u[0],u[1]),d<c){for(c=d,h=0;h<r;++h)l[h]=u[h];l.length=r,p+=r}else p+=r*Math.max((Math.sqrt(d)-Math.sqrt(c))/i|0,1);if(s&&(BZ(e,n-r,t,r,o,a,u),d=iG(o,a,u[0],u[1]),d<c)){for(c=d,h=0;h<r;++h)l[h]=u[h];l.length=r}return c}function WZ(e,t,n,r,i,s,o,a,l,c,u){u=u||[NaN,NaN];for(let h=0,d=n.length;h<d;++h){const d=n[h];c=VZ(e,t,d,r,i,s,o,a,l,c,u),t=d}return c}function HZ(e,t,n,r){for(let i=0,s=n.length;i<s;++i){const s=n[i];for(let n=0;n<r;++n)e[t++]=s[n]}return t}function GZ(e,t,n,r,i){i=i||[];let s=0;for(let o=0,a=n.length;o<a;++o){const a=HZ(e,t,n[o],r);i[s++]=a,t=a}return i.length=s,i}function KZ(e,t,n,r,i){i=i||[];let s=0;for(let o=0,a=n.length;o<a;++o){const a=GZ(e,t,n[o],r,i[s]);0===a.length&&(a[0]=t),i[s++]=a,t=a[a.length-1]}return i.length=s,i}function ZZ(e,t,n,r,i){i=void 0!==i?i:[];let s=0;for(let o=t;o<n;o+=r)i[s++]=e.slice(o,o+r);return i.length=s,i}function YZ(e,t,n,r,i){i=void 0!==i?i:[];let s=0;for(let o=0,a=n.length;o<a;++o){const a=n[o];i[s++]=ZZ(e,t,a,r,i[s]),t=a}return i.length=s,i}function XZ(e,t,n,r,i){i=void 0!==i?i:[];let s=0;for(let o=0,a=n.length;o<a;++o){const a=n[o];i[s++]=1===a.length&&a[0]===t?[]:YZ(e,t,a,r,i[s]),t=a[a.length-1]}return i.length=s,i}function JZ(e,t,n,r,i){return!MG(i,function(i){return!QZ(e,t,n,r,i[0],i[1])})}function QZ(e,t,n,r,i,s){let o=0,a=e[n-r],l=e[n-r+1];for(;t<n;t+=r){const n=e[t],r=e[t+1];l<=s?r>s&&(n-a)*(s-l)-(i-a)*(r-l)>0&&o++:r<=s&&(n-a)*(s-l)-(i-a)*(r-l)<0&&o--,a=n,l=r}return 0!==o}function eY(e,t,n,r,i,s){if(0===n.length)return!1;if(!QZ(e,t,n[0],r,i,s))return!1;for(let o=1,a=n.length;o<a;++o)if(QZ(e,n[o-1],n[o],r,i,s))return!1;return!0}function tY(e,t,n,r,i){let s;for(t+=r;t<n;t+=r)if(s=i(e.slice(t-r,t),e.slice(t,t+r)),s)return s;return!1}function nY(e,t,n,r,i,s){return s=s??IG([1/0,1/0,-1/0,-1/0],e,t,n,r),!!HG(i,s)&&(s[0]>=i[0]&&s[2]<=i[2]||s[1]>=i[1]&&s[3]<=i[3]||tY(e,t,n,r,function(e,t){return function(e,t,n){let r=!1;const i=xG(e,t),s=xG(e,n);if(1===i||1===s)r=!0;else{const o=e[0],a=e[1],l=e[2],c=e[3],u=t[0],h=t[1],d=n[0],p=n[1],f=(p-h)/(d-u);let g,m;2&s&&!(2&i)&&(g=d-(p-c)/f,r=g>=o&&g<=l),r||!(4&s)||4&i||(m=p-(d-l)*f,r=m>=a&&m<=c),r||!(8&s)||8&i||(g=d-(p-a)/f,r=g>=o&&g<=l),r||!(16&s)||16&i||(m=p-(d-o)*f,r=m>=a&&m<=c)}return r}(i,e,t)}))}function rY(e,t,n,r,i){return!!(nY(e,t,n,r,i)||QZ(e,t,n,r,i[0],i[1])||QZ(e,t,n,r,i[0],i[3])||QZ(e,t,n,r,i[2],i[1])||QZ(e,t,n,r,i[2],i[3]))}function iY(e,t,n,r,i){if(!rY(e,t,n[0],r,i))return!1;if(1===n.length)return!0;for(let s=1,o=n.length;s<o;++s)if(JZ(e,n[s-1],n[s],r,i)&&!nY(e,n[s-1],n[s],r,i))return!1;return!0}function sY(e,t,n,r,i,s,o){const a=(n-t)/r;if(a<3){for(;t<n;t+=r)s[o++]=e[t],s[o++]=e[t+1];return o}const l=new Array(a);l[0]=1,l[a-1]=1;const c=[t,n-r];let u=0;for(;c.length>0;){const n=c.pop(),s=c.pop();let o=0;const a=e[s],h=e[s+1],d=e[n],p=e[n+1];for(let t=s+r;t<n;t+=r){const n=rG(e[t],e[t+1],a,h,d,p);n>o&&(u=t,o=n)}o>i&&(l[(u-t)/r]=1,s+r<u&&c.push(s,u),u+r<n&&c.push(u,n))}for(let h=0;h<a;++h)l[h]&&(s[o++]=e[t+h*r],s[o++]=e[t+h*r+1]);return o}function oY(e,t,n,r,i,s,o,a){for(let l=0,c=n.length;l<c;++l){const c=n[l];o=sY(e,t,c,r,i,s,o),a.push(o),t=c}return o}function aY(e,t){return t*Math.round(e/t)}function lY(e,t,n,r,i,s,o){if(t==n)return o;let a,l,c=aY(e[t],i),u=aY(e[t+1],i);t+=r,s[o++]=c,s[o++]=u;do{if(a=aY(e[t],i),l=aY(e[t+1],i),(t+=r)==n)return s[o++]=a,s[o++]=l,o}while(a==c&&l==u);for(;t<n;){const n=aY(e[t],i),h=aY(e[t+1],i);if(t+=r,n==a&&h==l)continue;const d=a-c,p=l-u,f=n-c,g=h-u;d*g==p*f&&(d<0&&f<d||d==f||d>0&&f>d)&&(p<0&&g<p||p==g||p>0&&g>p)?(a=n,l=h):(s[o++]=a,s[o++]=l,c=a,u=l,a=n,l=h)}return s[o++]=a,s[o++]=l,o}function cY(e,t,n,r,i,s,o,a){for(let l=0,c=n.length;l<c;++l){const c=n[l];o=lY(e,t,c,r,i,s,o),a.push(o),t=c}return o}var uY=class e extends FZ{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===t||Array.isArray(e[0])?this.setCoordinates(e,t):this.setFlatCoordinates(t,e)}clone(){return new e(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<vG(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt($Z(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),VZ(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return jZ(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return ZZ(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const n=[];return n.length=sY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,n,0),new e(n,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return nY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=HZ(this.flatCoordinates,0,e,this.stride),this.changed()}},hY=class e extends FZ{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){const t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,n,r){const i=this.flatCoordinates,s=iG(e,t,i[0],i[1]);if(s<r){const e=this.stride;for(let t=0;t<e;++t)n[t]=i[t];return n.length=e,s}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return kG(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return _G(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=function(e,t,n){for(let r=0,i=n.length;r<i;++r)e[t++]=n[r];return t}(this.flatCoordinates,0,e,this.stride),this.changed()}};function dY(e,t,n,r,i,s,o){let a,l,c,u,h,d,p;const f=i[s+1],g=[];for(let v=0,b=n.length;v<b;++v){const i=n[v];for(u=e[i-r],d=e[i-r+1],a=t;a<i;a+=r)h=e[a],p=e[a+1],(f<=d&&p<=f||d<=f&&f<=p)&&(c=(f-d)/(p-d)*(h-u)+u,g.push(c)),u=h,d=p}let m=NaN,y=-1/0;for(g.sort(cH),u=g[0],a=1,l=g.length;a<l;++a){h=g[a];const i=Math.abs(h-u);i>y&&(c=(u+h)/2,eY(e,t,n,r,c,f)&&(m=c,y=i)),u=h}return isNaN(m)&&(m=i[s]),o?(o.push(m,f,y),o):[m,f,y]}function pY(e,t,n,r,i){let s=[];for(let o=0,a=n.length;o<a;++o){const a=n[o];s=dY(e,t,a,r,i,2*o,s),t=a[a.length-1]}return s}function fY(e,t,n,r){for(;t<n-r;){for(let i=0;i<r;++i){const s=e[t+i];e[t+i]=e[n-r+i],e[n-r+i]=s}t+=r,n-=r}}function gY(e,t,n,r){let i=0,s=e[n-r],o=e[n-r+1];for(;t<n;t+=r){const n=e[t],r=e[t+1];i+=(n-s)*(r+o),s=n,o=r}return 0===i?void 0:i>0}function mY(e,t,n,r,i){i=void 0!==i&&i;for(let s=0,o=n.length;s<o;++s){const o=n[s],a=gY(e,t,o,r);if(0===s){if(i&&a||!i&&!a)return!1}else if(i&&!a||!i&&a)return!1;t=o}return!0}function yY(e,t,n,r,i){for(let s=0,o=n.length;s<o;++s){const o=n[s];if(!mY(e,t,o,r,i))return!1;o.length&&(t=o[o.length-1])}return!0}function vY(e,t,n,r,i){i=void 0!==i&&i;for(let s=0,o=n.length;s<o;++s){const o=n[s],a=gY(e,t,o,r);(0===s?i&&a||!i&&!a:i&&!a||!i&&a)&&fY(e,t,o,r),t=o}return t}function bY(e,t,n,r,i){for(let s=0,o=n.length;s<o;++s)t=vY(e,t,n[s],r,i);return t}function wY(e,t){const n=[];let r,i=0,s=0;for(let o=0,a=t.length;o<a;++o){const a=t[o],l=gY(e,i,a,2);if(void 0===r&&(r=l),l===r)n.push(t.slice(s,o+1));else{if(0===n.length)continue;n[n.length-1].push(t[s])}s=o+1,i=a}return n}var _Y=class e extends FZ{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,void 0!==t&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?pH(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(e,t,n,r){return r<vG(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(qZ(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),WZ(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return eY(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return UZ(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return void 0!==e?(t=this.getOrientedFlatCoordinates().slice(),vY(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,YZ(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const e=FG(this.getExtent());this.flatInteriorPoint_=dY(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new hY(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new uY(this.flatCoordinates.slice(0===e?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){const e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[];let i=0;for(let s=0,o=n.length;s<o;++s){const o=n[s],a=new uY(t.slice(i,o),e);r.push(a),i=o}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;mY(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=vY(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const n=[],r=[];return n.length=cY(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),n,0,r),new e(n,"XY",r)}getType(){return"Polygon"}intersectsExtent(e){return iY(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=GZ(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=0===n.length?0:n[n.length-1],this.changed()}};function xY(e){if(GG(e))throw new Error("Cannot create polygon from empty extent");const t=e[0],n=e[1],r=e[2],i=e[3],s=[t,n,t,i,r,i,r,n,t,n];return new _Y(s,"XY",[s.length])}function CY(e,t,n,r){const i=WG(t)/n[0],s=UG(t)/n[1];return r?Math.min(e,Math.max(i,s)):Math.min(e,Math.min(i,s))}function SY(e,t,n){let r=Math.min(e,t);return r*=Math.log(1+50*Math.max(0,e/t-1))/50+1,n&&(r=Math.max(r,n),r/=Math.log(1+50*Math.max(0,n/e-1))/50+1),nG(r,n/2,2*t)}function kY(e,t,n,r,i){return n=void 0===n||n,function(s,o,a,l){if(void 0!==s){const o=r?CY(e,r,a,i):e;return n&&l?SY(s,o,t):nG(s,t,o)}}}function EY(e){if(void 0!==e)return 0}function RY(e){if(void 0!==e)return e}var TY=class extends RH{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=aZ(e.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,e.projection&&eZ(),e.center&&(e.center=yZ(e.center,this.projection_)),e.extent&&(e.extent=vZ(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){const t=Object.assign({},e);for(const o in tG)delete t[o];this.setProperties(t,!0);const n=function(e){let t,n,r,i=void 0!==e.minZoom?e.minZoom:0,s=void 0!==e.maxZoom?e.maxZoom:28;const o=void 0!==e.zoomFactor?e.zoomFactor:2,a=void 0!==e.multiWorld&&e.multiWorld,l=void 0===e.smoothResolutionConstraint||e.smoothResolutionConstraint,c=void 0!==e.showFullExtent&&e.showFullExtent,u=aZ(e.projection,"EPSG:3857"),h=u.getExtent();let d=e.constrainOnlyCenter,p=e.extent;if(a||p||!u.isGlobal()||(d=!1,p=h),void 0!==e.resolutions){const o=e.resolutions;n=o[i],r=void 0!==o[s]?o[s]:o[o.length-1],t=e.constrainResolution?function(e,t,n,r){return t=void 0===t||t,function(i,s,o,a){if(void 0!==i){const l=e[0],c=e[e.length-1],u=n?CY(l,n,o,r):l;if(a)return t?SY(i,u,c):nG(i,c,u);const h=Math.floor(hH(e,Math.min(u,i),s));return e[h]>u&&h<e.length-1?e[h+1]:e[h]}}}(o,l,!d&&p,c):kY(n,r,l,!d&&p,c)}else{const a=(h?Math.max(WG(h),UG(h)):360*lK.degrees/u.getMetersPerUnit())/256/Math.pow(2,0),f=a/Math.pow(2,28);n=e.maxResolution,void 0!==n?i=0:n=a/Math.pow(o,i),r=e.minResolution,void 0===r&&(r=void 0!==e.maxZoom?void 0!==e.maxResolution?n/Math.pow(o,s):a/Math.pow(o,s):f),s=i+Math.floor(Math.log(n/r)/Math.log(o)),r=n/Math.pow(o,s-i),t=e.constrainResolution?function(e,t,n,r,i,s){return r=void 0===r||r,n=void 0!==n?n:0,function(o,a,l,c){if(void 0!==o){const u=i?CY(t,i,l,s):t;if(c)return r?SY(o,u,n):nG(o,n,u);const h=Math.ceil(Math.log(t/u)/Math.log(e)-1e-9),d=.499999999*-a+.5,p=Math.floor(Math.log(t/Math.min(u,o))/Math.log(e)+d);return nG(t/Math.pow(e,Math.max(h,p)),n,u)}}}(o,n,r,l,!d&&p,c):kY(n,r,l,!d&&p,c)}return{constraint:t,maxResolution:n,minResolution:r,minZoom:i,zoomFactor:o}}(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;const r=function(e){if(void 0!==e.extent){const t=void 0===e.smoothExtentConstraint||e.smoothExtentConstraint;return pG(e.extent,e.constrainOnlyCenter,t)}const t=aZ(e.projection,"EPSG:3857");if(!0!==e.multiWorld&&t.isGlobal()){const e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,pG(e,!1,!1)}return fG}(e),i=n.constraint,s=function(e){if(void 0===e.enableRotation||e.enableRotation){const t=e.constrainRotation;return void 0===t||!0===t?function(){const e=oG(5);return function(t,n){return n||void 0===t?t:Math.abs(t)<=e?0:t}}():!1===t?RY:"number"==typeof t?function(e){const t=2*Math.PI/e;return function(e,n){return n?e:void 0!==e?e=Math.floor(e/t+.5)*t:void 0}}(t):RY}return EY}(e);this.constraints_={center:r,resolution:i,rotation:s},this.setRotation(void 0!==e.rotation?e.rotation:0),this.setCenterInternal(void 0!==e.center?e.center:null),void 0!==e.resolution?this.setResolution(e.resolution):void 0!==e.zoom&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;const n=this.getCenterInternal();if(n){const r=e||[0,0,0,0];t=t||[0,0,0,0];const i=this.getResolution(),s=i/2*(r[3]-t[3]+t[1]-r[1]),o=i/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+s,n[1]-o])}}getUpdatedOptions_(e){const t=this.getProperties();return void 0!==t.resolution?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const t=new Array(arguments.length);for(let n=0;n<t.length;++n){let e=arguments[n];e.center&&(e=Object.assign({},e),e.center=yZ(e.center,this.getProjection())),e.anchor&&(e=Object.assign({},e),e.anchor=yZ(e.anchor,this.getProjection())),t[n]=e}this.animateInternal.apply(this,t)}animateInternal(e){let t,n=arguments.length;n>1&&"function"==typeof arguments[n-1]&&(t=arguments[n-1],--n);let r=0;for(;r<n&&!this.isDef();++r){const e=arguments[r];e.center&&this.setCenterInternal(e.center),void 0!==e.zoom?this.setZoom(e.zoom):e.resolution&&this.setResolution(e.resolution),void 0!==e.rotation&&this.setRotation(e.rotation)}if(r===n)return void(t&&LY(t,!0));let i=Date.now(),s=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const l=[];for(;r<n;++r){const e=arguments[r],n={start:i,complete:!1,anchor:e.anchor,duration:void 0!==e.duration?e.duration:1e3,easing:e.easing||rK,callback:t};if(e.center&&(n.sourceCenter=s,n.targetCenter=e.center.slice(),s=n.targetCenter),void 0!==e.zoom?(n.sourceResolution=o,n.targetResolution=this.getResolutionForZoom(e.zoom),o=n.targetResolution):e.resolution&&(n.sourceResolution=o,n.targetResolution=e.resolution,o=n.targetResolution),void 0!==e.rotation){n.sourceRotation=a;const t=aG(e.rotation-a+Math.PI,2*Math.PI)-Math.PI;n.targetRotation=a+t,a=n.targetRotation}IY(n)?n.complete=!0:i+=n.duration,l.push(n)}this.animations_.push(l),this.setHint(0,1),this.updateAnimations_()}getAnimating(){return this.hints_[0]>0}getInteracting(){return this.hints_[1]>0}cancelAnimations(){let e;this.setHint(0,-this.hints_[0]);for(let t=0,n=this.animations_.length;t<n;++t){const n=this.animations_[t];if(n[0].callback&&LY(n[0].callback,!1),!e)for(let t=0,r=n.length;t<r;++t){const r=n[t];if(!r.complete){e=r.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const e=Date.now();let t=!1;for(let n=this.animations_.length-1;n>=0;--n){const r=this.animations_[n];let i=!0;for(let n=0,s=r.length;n<s;++n){const s=r[n];if(s.complete)continue;const o=e-s.start;let a=s.duration>0?o/s.duration:1;a>=1?(s.complete=!0,a=1):i=!1;const l=s.easing(a);if(s.sourceCenter){const e=s.sourceCenter[0],t=s.sourceCenter[1],n=s.targetCenter[0],r=s.targetCenter[1];this.nextCenter_=s.targetCenter;const i=e+l*(n-e),o=t+l*(r-t);this.targetCenter_=[i,o]}if(s.sourceResolution&&s.targetResolution){const e=1===l?s.targetResolution:s.sourceResolution+l*(s.targetResolution-s.sourceResolution);if(s.anchor){const t=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(e,0,t,!0);this.targetCenter_=this.calculateCenterZoom(n,s.anchor)}this.nextResolution_=s.targetResolution,this.targetResolution_=e,this.applyTargetState_(!0)}if(void 0!==s.sourceRotation&&void 0!==s.targetRotation){const e=1===l?aG(s.targetRotation+Math.PI,2*Math.PI)-Math.PI:s.sourceRotation+l*(s.targetRotation-s.sourceRotation);if(s.anchor){const t=this.constraints_.rotation(e,!0);this.targetCenter_=this.calculateCenterRotate(t,s.anchor)}this.nextRotation_=s.targetRotation,this.targetRotation_=e}if(this.applyTargetState_(!0),t=!0,!s.complete)break}if(i){this.animations_[n]=null,this.setHint(0,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const e=r[0].callback;e&&LY(e,!0)}}this.animations_=this.animations_.filter(Boolean),t&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n;const r=this.getCenterInternal();var i,s;return void 0!==r&&(n=[r[0]-t[0],r[1]-t[1]],QG(n,e-this.getRotation()),s=t,(i=n)[0]+=+s[0],i[1]+=+s[1]),n}calculateCenterZoom(e,t){let n;const r=this.getCenterInternal(),i=this.getResolution();return void 0!==r&&void 0!==i&&(n=[t[0]-e*(t[0]-r[0])/i,t[1]-e*(t[1]-r[1])/i]),n}getViewportSize_(e){const t=this.viewportSize_;if(e){const n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const e=this.getCenterInternal();return e?mZ(e,this.getProjection()):e}getCenterInternal(){return this.get(tG.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return void 0!==e?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){return t=this.calculateExtentInternal(e),this.getProjection(),t;var t}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();const t=this.getCenterInternal();XH(t,"The view center is not defined");const n=this.getResolution();XH(void 0!==n,"The view resolution is not defined");const r=this.getRotation();return XH(void 0!==r,"The view rotation is not defined"),zG(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(tG.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(vZ(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();const n=WG(e)/t[0],r=UG(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e=e||2;const t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return function(n){return t/Math.pow(e,n*r)}}getRotation(){return this.get(tG.ROTATION)}getValueForResolutionFunction(e){const t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,i=Math.log(n/r)/t;return function(e){return Math.log(n/e)/t/i}}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e);const n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){const e=this.getProjection(),t=this.getResolution(),n=this.getRotation();let r=this.getCenterInternal();const i=this.padding_;if(i){const e=this.getViewportSizeMinusPadding_();r=PY(r,this.getViewportSize_(),[e[0]/2+i[3],e[1]/2+i[0]],t,n)}return{center:r.slice(0),projection:void 0!==e?e:null,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e;const t=this.getResolution();return void 0!==t&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t,n,r=this.minZoom_||0;if(this.resolutions_){const i=hH(this.resolutions_,e,1);r=i,t=this.resolutions_[i],n=i==this.resolutions_.length-1?2:t/this.resolutions_[i+1]}else t=this.maxResolution_,n=this.zoomFactor_;return r+Math.log(t/e)/Math.log(n)}getResolutionForZoom(e){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const t=nG(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,nG(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(XH(Array.isArray(e)||"function"==typeof e.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(e))XH(!GG(e),"Cannot fit empty extent provided as `geometry`"),n=xY(vZ(e,this.getProjection()));else if("Circle"===e.getType()){const t=vZ(e.getExtent(),this.getProjection());n=xY(t),n.rotate(this.getRotation(),FG(t))}else{const t=null;n=t?e.clone().transform(t,this.getProjection()):e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){const t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),i=e.getFlatCoordinates(),s=e.getStride();let o=1/0,a=1/0,l=-1/0,c=-1/0;for(let u=0,h=i.length;u<h;u+=s){const e=i[u]*n-i[u+1]*r,t=i[u]*r+i[u+1]*n;o=Math.min(o,e),a=Math.min(a,t),l=Math.max(l,e),c=Math.max(c,t)}return[o,a,l,c]}fitInternal(e,t){let n=(t=t||{}).size;n||(n=this.getViewportSizeMinusPadding_());const r=void 0!==t.padding?t.padding:[0,0,0,0],i=void 0!==t.nearest&&t.nearest;let s;s=void 0!==t.minResolution?t.minResolution:void 0!==t.maxZoom?this.getResolutionForZoom(t.maxZoom):0;const o=this.rotatedExtentForGeometry(e);let a=this.getResolutionForExtentInternal(o,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);a=isNaN(a)?s:Math.max(a,s),a=this.getConstrainedResolution(a,i?0:1);const l=this.getRotation(),c=Math.sin(l),u=Math.cos(l),h=FG(o);h[0]+=(r[1]-r[3])/2*a,h[1]+=(r[0]-r[2])/2*a;const d=h[0]*u-h[1]*c,p=h[1]*u+h[0]*c,f=this.getConstrainedCenter([d,p],a),g=t.callback?t.callback:yH;void 0!==t.duration?this.animateInternal({resolution:a,center:f,duration:t.duration,easing:t.easing},g):(this.targetResolution_=a,this.targetCenter_=f,this.applyTargetState_(!1,!0),LY(g,!0))}centerOn(e,t,n){this.centerOnInternal(yZ(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(PY(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let i;const s=this.padding_;if(s&&e){const o=this.getViewportSizeMinusPadding_(-n),a=PY(e,r,[o[0]/2+s[3],o[1]/2+s[0]],t,n);i=[e[0]-a[0],e[1]-a[1]]}return i}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(e){const t=mZ(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){const t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&yZ(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){const n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(i,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=yZ(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){const n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e?yZ(e,this.getProjection()):e)}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){const n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),i=this.getViewportSize_(r),s=this.constraints_.resolution(this.targetResolution_,0,i,n),o=this.constraints_.center(this.targetCenter_,s,i,n,this.calculateCenterShift(this.targetCenter_,s,r,i));this.get(tG.ROTATION)!==r&&this.set(tG.ROTATION,r),this.get(tG.RESOLUTION)!==s&&(this.set(tG.RESOLUTION,s),this.set("zoom",this.getZoom(),!0)),o&&this.get(tG.CENTER)&&JG(this.get(tG.CENTER),o)||this.set(tG.CENTER,o),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=void 0!==e?e:200;const r=t||0,i=this.constraints_.rotation(this.targetRotation_),s=this.getViewportSize_(i),o=this.constraints_.resolution(this.targetResolution_,r,s),a=this.constraints_.center(this.targetCenter_,o,s,!1,this.calculateCenterShift(this.targetCenter_,o,i,s));if(0===e&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=i,this.targetCenter_=a,void this.applyTargetState_();n=n||(0===e?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===i&&this.getCenterInternal()&&JG(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:i,center:a,resolution:o,duration:e,easing:nK,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(1,1)}endInteraction(e,t,n){n=n&&yZ(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(1,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){const n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){const n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t=t||0;const n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}};function LY(e,t){setTimeout(function(){e(t)},0)}function IY(e){return!(e.sourceCenter&&e.targetCenter&&!JG(e.sourceCenter,e.targetCenter))&&e.sourceResolution===e.targetResolution&&e.sourceRotation===e.targetRotation}function PY(e,t,n,r,i){const s=Math.cos(-i);let o=Math.sin(-i),a=e[0]*s-e[1]*o,l=e[1]*s+e[0]*o;return a+=(t[0]/2-n[0])*r,l+=(n[1]-t[1]/2)*r,o=-o,[a*s-l*o,l*s+a*o]}var MY,AY="ol-hidden",OY="ol-unselectable",NY="ol-control",FY="ol-collapsed",DY=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-z0-9]+?)\\s*$"].join(""),"i"),zY=["style","variant","weight","size","lineHeight","family"],jY={normal:400,bold:700},UY=function(e){const t=e.match(DY);if(!t)return null;const n={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let r=0,i=zY.length;r<i;++r){const e=t[r+1];void 0!==e&&(n[zY[r]]="string"==typeof e?e.trim():e)}return isNaN(Number(n.weight))&&n.weight in jY&&(n.weight=jY[n.weight]),n.families=n.family.split(/,\s?/).map(e=>e.trim().replace(/^['"]|['"]$/g,"")),n};function BY(e,t,n,r){let i;return i=n&&n.length?n.shift():zH?new class extends OffscreenCanvas{style={}}(e??300,t??150):document.createElement("canvas"),e&&(i.width=e),t&&(i.height=t),i.getContext("2d",r)}function $Y(){return MY||(MY=BY(1,1)),MY}function qY(e){const t=e.canvas;t.width=1,t.height=1,e.clearRect(0,0,1,1)}function VY(e){let t=e.offsetWidth;const n=getComputedStyle(e);return t+=parseInt(n.marginLeft,10)+parseInt(n.marginRight,10),t}function WY(e){let t=e.offsetHeight;const n=getComputedStyle(e);return t+=parseInt(n.marginTop,10)+parseInt(n.marginBottom,10),t}function HY(e,t){const n=t.parentNode;n&&n.replaceChild(e,t)}function GY(e){for(;e.lastChild;)e.lastChild.remove()}function KY(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){const t=this.childNodes.indexOf(e);if(-1===t)throw new Error("Node to remove was not found");return this.childNodes.splice(t,1),e},insertBefore:function(e,t){const n=this.childNodes.indexOf(t);if(-1===n)throw new Error("Reference node not found");return this.childNodes.splice(n,0,e),e},style:{}},{get:(e,t,n)=>"firstElementChild"===t?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)})}function ZY(e){return"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas}var YY=class extends RH{constructor(e){super();const t=e.element;!t||e.target||t.style.pointerEvents||(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let t=0,n=this.listenerKeys.length;t<n;++t)eH(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=e,e){const t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==yH&&this.listenerKeys.push(JW(e,VH,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_="string"==typeof e?document.getElementById(e):e}},XY=class extends YY{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===e.collapsed||e.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==e.collapsible,this.collapsible_=void 0===e.collapsible||e.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;const t=void 0!==e.className?e.className:"ol-attribution",n=void 0!==e.tipLabel?e.tipLabel:"Attributions",r=void 0!==e.expandClassName?e.expandClassName:t+"-expand",i=void 0!==e.collapseLabel?e.collapseLabel:"›",s=void 0!==e.collapseClassName?e.collapseClassName:t+"-collapse";"string"==typeof i?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=i,this.collapseLabel_.className=s):this.collapseLabel_=i;const o=void 0!==e.label?e.label:"i";"string"==typeof o?(this.label_=document.createElement("span"),this.label_.textContent=o,this.label_.className=r):this.label_=o;const a=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=n,this.toggleButton_.appendChild(a),this.toggleButton_.addEventListener(rH,this.handleClick_.bind(this),!1);const l=t+" "+OY+" "+NY+(this.collapsed_&&this.collapsible_?" "+FY:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=l,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){const t=this.getMap().getAllLayers(),n=new Set(t.flatMap(t=>t.getAttributions(e)));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach(e=>n.add(e)):n.add(this.attributions_)),!this.overrideCollapsible_){const e=!t.some(e=>!1===e.getSource()?.getAttributionsCollapsible());this.setCollapsible(e)}return Array.from(n)}async updateElement_(e){if(!e)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const t=await Promise.all(this.collectSourceAttributions_(e).map(e=>bH(()=>e))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!fH(t,this.renderedAttributions_)){GY(this.ulElement_);for(let e=0,n=t.length;e<n;++e){const n=document.createElement("li");n.innerHTML=t[e],this.ulElement_.appendChild(n)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(FY),this.collapsed_?HY(this.collapseLabel_,this.label_):HY(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,this.collapsible_&&this.collapsed_!==e&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},JY=class extends YY{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});const t=void 0!==e.className?e.className:"ol-rotate",n=void 0!==e.label?e.label:"⇧",r=void 0!==e.compassClassName?e.compassClassName:"ol-compass";this.label_=null,"string"==typeof n?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));const i=e.tipLabel?e.tipLabel:"Reset rotation",s=document.createElement("button");s.className=t+"-reset",s.setAttribute("type","button"),s.title=i,s.appendChild(this.label_),s.addEventListener(rH,this.handleClick_.bind(this),!1);const o=t+" "+OY+" "+NY,a=this.element;a.className=o,a.appendChild(s),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=void 0!==e.duration?e.duration:250,this.autoHide_=void 0===e.autoHide||e.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(AY)}handleClick_(e){e.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const e=this.getMap().getView();if(!e)return;const t=e.getRotation();void 0!==t&&(this.duration_>0&&t%(2*Math.PI)!=0?e.animate({rotation:0,duration:this.duration_,easing:nK}):e.setRotation(0))}render(e){const t=e.frameState;if(!t)return;const n=t.viewState.rotation;if(n!=this.rotation_){const e="rotate("+n+"rad)";if(this.autoHide_){const e=this.element.classList.contains(AY);e||0!==n?e&&0!==n&&this.element.classList.remove(AY):this.element.classList.add(AY)}this.label_.style.transform=e}this.rotation_=n}},QY=class extends YY{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});const t=void 0!==e.className?e.className:"ol-zoom",n=void 0!==e.delta?e.delta:1,r=void 0!==e.zoomInClassName?e.zoomInClassName:t+"-in",i=void 0!==e.zoomOutClassName?e.zoomOutClassName:t+"-out",s=void 0!==e.zoomInLabel?e.zoomInLabel:"+",o=void 0!==e.zoomOutLabel?e.zoomOutLabel:"–",a=void 0!==e.zoomInTipLabel?e.zoomInTipLabel:"Zoom in",l=void 0!==e.zoomOutTipLabel?e.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=r,c.setAttribute("type","button"),c.title=a,c.appendChild("string"==typeof s?document.createTextNode(s):s),c.addEventListener(rH,this.handleClick_.bind(this,n),!1);const u=document.createElement("button");u.className=i,u.setAttribute("type","button"),u.title=l,u.appendChild("string"==typeof o?document.createTextNode(o):o),u.addEventListener(rH,this.handleClick_.bind(this,-n),!1);const h=t+" "+OY+" "+NY,d=this.element;d.className=h,d.appendChild(c),d.appendChild(u),this.duration_=void 0!==e.duration?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){const t=this.getMap().getView();if(!t)return;const n=t.getZoom();if(void 0!==n){const r=t.getConstrainedZoom(n+e);this.duration_>0?(t.getAnimating()&&t.cancelAnimations(),t.animate({zoom:r,duration:this.duration_,easing:nK})):t.setZoom(r)}}};function eX(e){e=e||{};const t=new IH;return(void 0===e.zoom||e.zoom)&&t.push(new QY(e.zoomOptions)),(void 0===e.rotate||e.rotate)&&t.push(new JY(e.rotateOptions)),(void 0===e.attribution||e.attribution)&&t.push(new XY(e.attributionOptions)),t}var tX=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;const e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;const r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;const i=this.points_[t]-this.points_[n],s=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(s,i),this.initialVelocity_=Math.sqrt(i*i+s*s)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},nX="active",rX=class extends RH{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(nX)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(nX,e)}setMap(e){this.map_=e}};function iX(e,t,n,r){const i=e.getZoom();if(void 0===i)return;const s=e.getConstrainedZoom(i+t),o=e.getResolutionForZoom(s);e.getAnimating()&&e.cancelAnimations(),e.animate({resolution:o,anchor:n,duration:void 0!==r?r:250,easing:nK})}var sX=class extends rX{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=void 0!==e.duration?e.duration:250}handleEvent(e){let t=!1;if(e.type==AH.DBLCLICK){const n=e.originalEvent,r=e.map,i=e.coordinate,s=n.shiftKey?-this.delta_:this.delta_;iX(r.getView(),s,i,this.duration_),n.preventDefault(),t=!0}return!t}};function oX(e){const t=arguments;return function(e){let n=!0;for(let r=0,i=t.length;r<i&&(n=n&&t[r](e),n);++r);return n}}var aX=function(e){const t=e.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},lX=function(e){const t=e.map.getTargetElement(),n=t.getRootNode();return!(n instanceof ShadowRoot?n.host:t).hasAttribute("tabindex")||function(e){const t=e.map.getTargetElement(),n=t.getRootNode(),r=e.map.getOwnerDocument().activeElement;return n instanceof ShadowRoot?n.host.contains(r):t.contains(r)}(e)},cX=gH,uX=function(e){const t=e.originalEvent;return"pointerId"in t&&0==t.button&&!(NH&&FH&&t.ctrlKey)},hX=function(e){const t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},dX=function(e){const t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},pX=function(e){const t=e.originalEvent,n=t.target.tagName;return"INPUT"!==n&&"SELECT"!==n&&"TEXTAREA"!==n&&!t.target.isContentEditable},fX=function(e){const t=e.originalEvent;return"pointerId"in t&&"mouse"==t.pointerType},gX=function(e){const t=e.originalEvent;return"pointerId"in t&&t.isPrimary&&0===t.button},mX=class extends rX{constructor(e){super(e=e||{}),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==AH.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==AH.POINTERUP){const t=this.handleUpEvent(e);this.handlingDownUpSequence=t&&this.targetPointers.length>0}}else if(e.type==AH.POINTERDOWN){const n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==AH.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function yX(e){const t=e.length;let n=0,r=0;for(let i=0;i<t;i++)n+=e[i].clientX,r+=e[i].clientY;return{clientX:n/t,clientY:r/t}}var vX=class extends mX{constructor(e){super({stopDown:mH}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const t=e.condition?e.condition:oX(hX,gX);this.condition_=e.onFocusOnly?oX(lX,t):t,this.noKinetic_=!1}handleDragEvent(e){const t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());const n=this.targetPointers,r=t.getEventPixel(yX(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){const t=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],n=e.map.getView();i=t,s=n.getResolution(),i[0]*=s,i[1]*=s,QG(t,n.getRotation()),n.adjustCenterInternal(t)}}else this.kinetic_&&this.kinetic_.begin();var i,s;this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){const t=e.map,n=t.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const e=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),i=n.getCenterInternal(),s=t.getPixelFromCoordinateInternal(i),o=t.getCoordinateFromPixelInternal([s[0]-e*Math.cos(r),s[1]-e*Math.sin(r)]);n.animateInternal({center:n.getConstrainedCenter(o),duration:500,easing:nK})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){const t=e.map.getView();return this.lastCentroid=null,t.getAnimating()&&t.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},bX=class extends mX{constructor(e){e=e||{},super({stopDown:mH}),this.condition_=e.condition?e.condition:aX,this.lastAngle_=void 0,this.duration_=void 0!==e.duration?e.duration:250}handleDragEvent(e){if(!fX(e))return;const t=e.map,n=t.getView();if(n.getConstraints().rotation===EY)return;const r=t.getSize(),i=e.pixel,s=Math.atan2(r[1]/2-i[1],i[0]-r[0]/2);if(void 0!==this.lastAngle_){const e=s-this.lastAngle_;n.adjustRotationInternal(-e)}this.lastAngle_=s}handleUpEvent(e){return!fX(e)||(e.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(e){return!(!fX(e)||!uX(e)||!this.condition_(e)||(e.map.getView().beginInteraction(),this.lastAngle_=void 0,0))}},wX=class extends lH{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const e=this.startPixel_,t=this.endPixel_,n="px",r=this.element_.style;r.left=Math.min(e[0],t[0])+n,r.top=Math.min(e[1],t[1])+n,r.width=Math.abs(t[0]-e[0])+n,r.height=Math.abs(t[1]-e[1])+n}setMap(e){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_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const e=this.startPixel_,t=this.endPixel_,n=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new _Y([n])}getGeometry(){return this.geometry_}},_X="boxcancel",xX=class extends wH{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},CX=class extends mX{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new wX(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??uX,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){const r=n[0]-t[0],i=n[1]-t[1];return r*r+i*i>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new xX("boxdrag",e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;const t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new xX(t?"boxend":_X,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return!!this.condition_(e)&&(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new xX("boxstart",e.coordinate,e)),!0)}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new xX(_X,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new xX(_X,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},SX=class extends CX{constructor(e){super({condition:(e=e||{}).condition?e.condition:dX,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=void 0!==e.duration?e.duration:200,this.out_=void 0!==e.out&&e.out}onBoxEnd(e){const t=this.getMap().getView();let n=this.getGeometry();if(this.out_){const e=t.rotatedExtentForGeometry(n),r=t.getResolutionForExtentInternal(e),i=t.getResolution()/r;n=n.clone(),n.scale(i*i)}t.fitInternal(n,{duration:this.duration_,easing:nK})}},kX="ArrowLeft",EX="ArrowRight",RX="ArrowDown",TX=class extends rX{constructor(e){super(),e=e||{},this.defaultCondition_=function(e){return hX(e)&&pX(e)},this.condition_=void 0!==e.condition?e.condition:this.defaultCondition_,this.duration_=void 0!==e.duration?e.duration:100,this.pixelDelta_=void 0!==e.pixelDelta?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==iH){const n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==RX||r==kX||r==EX||"ArrowUp"==r)){const i=e.map.getView(),s=i.getResolution()*this.pixelDelta_;let o=0,a=0;r==RX?a=-s:r==kX?o=-s:r==EX?o=s:a=s;const l=[o,a];QG(l,i.getRotation()),function(e,t,n){const r=e.getCenterInternal();if(r){const i=[r[0]+t[0],r[1]+t[1]];e.animateInternal({duration:void 0!==n?n:250,easing:iK,center:e.getConstrainedCenter(i)})}}(i,l,this.duration_),n.preventDefault(),t=!0}}return!t}},LX=class extends rX{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(e){return!function(e){const t=e.originalEvent;return FH?t.metaKey:t.ctrlKey}(e)&&pX(e)},this.delta_=e.delta?e.delta:1,this.duration_=void 0!==e.duration?e.duration:100}handleEvent(e){let t=!1;if(e.type==iH||e.type==sH){const n=e.originalEvent,r=n.key;if(this.condition_(e)&&("+"===r||"-"===r)){const i=e.map,s="+"===r?this.delta_:-this.delta_;iX(i.getView(),s,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},IX=class extends rX{constructor(e){super(e=e||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==e.maxDelta?e.maxDelta:1,this.duration_=void 0!==e.duration?e.duration:250,this.timeout_=void 0!==e.timeout?e.timeout:80,this.useAnchor_=void 0===e.useAnchor||e.useAnchor,this.constrainResolution_=void 0!==e.constrainResolution&&e.constrainResolution;const t=e.condition?e.condition:cX;this.condition_=e.onFocusOnly?oX(lX,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(e){if(this.ctrlKeyListenerKeys_.forEach(eH),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){const t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(JW(t,"keydown",e=>{"Control"===e.key&&(this.ctrlKeyPressed_=!0)}),JW(t,"keyup",e=>{"Control"===e.key&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;const e=this.getMap();if(!e)return;const t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e))return!0;if(e.type!==aH)return!0;const t=e.map,n=e.originalEvent;n.preventDefault();const r=n.ctrlKey&&!this.ctrlKeyPressed_;n.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let i=n.deltaY;switch(n.deltaMode){case WheelEvent.DOM_DELTA_LINE:i*=40;break;case WheelEvent.DOM_DELTA_PAGE:i*=300}if(0===i)return!1;this.lastDelta_=i;const s=Date.now();void 0===this.startTime_&&(this.startTime_=s),(!this.mode_||s-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(i)<4?"trackpad":"wheel");const o=t.getView();if("trackpad"===this.mode_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),r&&(i*=3),o.adjustZoom(-i/this.deltaPerZoom_,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=s,!1;this.totalDelta_+=i;const a=Math.max(this.timeout_-(s-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,t),a),!1}handleWheelZoom_(e){const t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-nG(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),iX(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},PX=class extends mX{constructor(e){const t=e=e||{};t.stopDown||(t.stopDown=mH),super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==e.threshold?e.threshold:.3,this.duration_=void 0!==e.duration?e.duration:250}handleDragEvent(e){let t=0;const n=this.targetPointers[0],r=this.targetPointers[1],i=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(void 0!==this.lastAngle_){const e=i-this.lastAngle_;this.rotationDelta_+=e,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=e}this.lastAngle_=i;const s=e.map,o=s.getView();o.getConstraints().rotation!==EY&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(yX(this.targetPointers))),this.rotating_&&(s.render(),o.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return!(this.targetPointers.length<2&&(e.map.getView().endInteraction(this.duration_),1))}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},MX=class extends mX{constructor(e){const t=e=e||{};t.stopDown||(t.stopDown=mH),super(t),this.anchor_=null,this.duration_=void 0!==e.duration?e.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1;const n=this.targetPointers[0],r=this.targetPointers[1],i=n.clientX-r.clientX,s=n.clientY-r.clientY,o=Math.sqrt(i*i+s*s);void 0!==this.lastDistance_&&(t=this.lastDistance_/o),this.lastDistance_=o;const a=e.map,l=a.getView();1!=t&&(this.lastScaleDelta_=t),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(yX(this.targetPointers))),a.render(),l.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){const t=e.map.getView(),n=this.lastScaleDelta_>1?1:-1;return t.endInteraction(this.duration_,n),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){const t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}};function AX(e){e=e||{};const t=new IH,n=new tX(-.005,.05,100);return(void 0===e.altShiftDragRotate||e.altShiftDragRotate)&&t.push(new bX),(void 0===e.doubleClickZoom||e.doubleClickZoom)&&t.push(new sX({delta:e.zoomDelta,duration:e.zoomDuration})),(void 0===e.dragPan||e.dragPan)&&t.push(new vX({onFocusOnly:e.onFocusOnly,kinetic:n})),(void 0===e.pinchRotate||e.pinchRotate)&&t.push(new PX),(void 0===e.pinchZoom||e.pinchZoom)&&t.push(new MX({duration:e.zoomDuration})),(void 0===e.keyboard||e.keyboard)&&(t.push(new TX),t.push(new LX({delta:e.zoomDelta,duration:e.zoomDuration}))),(void 0===e.mouseWheelZoom||e.mouseWheelZoom)&&t.push(new IX({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration})),(void 0===e.shiftDragZoom||e.shiftDragZoom)&&t.push(new SX({duration:e.zoomDuration})),t}var OX="opacity",NX="visible",FX="extent",DX="zIndex",zX="maxResolution",jX="minResolution",UX="maxZoom",BX="minZoom",$X="source",qX=class extends RH{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;const t=Object.assign({},e);"object"==typeof e.properties&&(delete t.properties,Object.assign(t,e.properties)),t[OX]=void 0!==e.opacity?e.opacity:1,XH("number"==typeof t[OX],"Layer opacity must be a number"),t[NX]=void 0===e.visible||e.visible,t[DX]=e.zIndex,t[zX]=void 0!==e.maxResolution?e.maxResolution:1/0,t[jX]=void 0!==e.minResolution?e.minResolution:0,t[BX]=void 0!==e.minZoom?e.minZoom:-1/0,t[UX]=void 0!==e.maxZoom?e.maxZoom:1/0,this.className_=void 0!==t.className?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){const t=this.state_||{layer:this,managed:void 0===e||e},n=this.getZIndex();return t.opacity=nG(Math.round(100*this.getOpacity())/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=void 0!==n||t.managed?n:1/0,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return CH()}getLayerStatesArray(e){return CH()}getExtent(){return this.get(FX)}getMaxResolution(){return this.get(zX)}getMinResolution(){return this.get(jX)}getMinZoom(){return this.get(BX)}getMaxZoom(){return this.get(UX)}getOpacity(){return this.get(OX)}getSourceState(){return CH()}getVisible(){return this.get(NX)}getZIndex(){return this.get(DX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(FX,e)}setMaxResolution(e){this.set(zX,e)}setMinResolution(e){this.set(jX,e)}setMaxZoom(e){this.set(UX,e)}setMinZoom(e){this.set(BX,e)}setOpacity(e){XH("number"==typeof e,"Layer opacity must be a number"),this.set(OX,e)}setVisible(e){this.set(NX,e)}setZIndex(e){this.set(DX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},VX="addlayer",WX="removelayer",HX=class extends wH{constructor(e,t){super(e),this.layer=t}},GX="layers",KX=class e extends qX{constructor(e){e=e||{};const t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(GX,this.handleLayersChanged_),n?Array.isArray(n)?n=new IH(n.slice(),{unique:!0}):XH("function"==typeof n.getArray,"Expected `layers` to be an array or a `Collection`"):n=new IH(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(eH),this.layersListenerKeys_.length=0;const e=this.getLayers();this.layersListenerKeys_.push(JW(e,GW,this.handleLayersAdd_,this),JW(e,KW,this.handleLayersRemove_,this));for(const n in this.listenerKeys_)this.listenerKeys_[n].forEach(eH);YW(this.listenerKeys_);const t=e.getArray();for(let n=0,r=t.length;n<r;n++){const e=t[n];this.registerLayerListeners_(e),this.dispatchEvent(new HX(VX,e))}this.changed()}registerLayerListeners_(t){const n=[JW(t,ZW,this.handleLayerChange_,this),JW(t,tH,this.handleLayerChange_,this)];t instanceof e&&n.push(JW(t,VX,this.handleLayerGroupAdd_,this),JW(t,WX,this.handleLayerGroupRemove_,this)),this.listenerKeys_[kH(t)]=n}handleLayerGroupAdd_(e){this.dispatchEvent(new HX(VX,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new HX(WX,e.layer))}handleLayersAdd_(e){const t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new HX(VX,t)),this.changed()}handleLayersRemove_(e){const t=e.element,n=kH(t);this.listenerKeys_[n].forEach(eH),delete this.listenerKeys_[n],this.dispatchEvent(new HX(WX,t)),this.changed()}getLayers(){return this.get(GX)}setLayers(e){const t=this.getLayers();if(t){const e=t.getArray();for(let t=0,n=e.length;t<n;++t)this.dispatchEvent(new HX(WX,e[t]))}this.set(GX,e)}getLayersArray(e){return e=void 0!==e?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){const t=void 0!==e?e:[],n=t.length;this.getLayers().forEach(function(e){e.getLayerStatesArray(t)});const r=this.getLayerState();let i=r.zIndex;e||void 0!==r.zIndex||(i=0);for(let s=n,o=t.length;s<o;s++){const e=t[s];e.opacity*=r.opacity,e.visible=e.visible&&r.visible,e.maxResolution=Math.min(e.maxResolution,r.maxResolution),e.minResolution=Math.max(e.minResolution,r.minResolution),e.minZoom=Math.max(e.minZoom,r.minZoom),e.maxZoom=Math.min(e.maxZoom,r.maxZoom),void 0!==r.extent&&(void 0!==e.extent?e.extent=BG(e.extent,r.extent):e.extent=r.extent),void 0===e.zIndex&&(e.zIndex=i)}return t}getSourceState(){return"ready"}},ZX="prerender",YX="postrender",XX="precompose",JX="rendercomplete",QX=class extends qX{constructor(e){const t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener($X,this.handleSourcePropertyChange_);const n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return(e=e||[]).push(this),e}getLayerStatesArray(e){return(e=e||[]).push(this.getLayerState()),e}getSource(){return this.get($X)||null}getRenderSource(){return this.getSource()}getSourceState(){const e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(eH(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const e=this.getSource();e&&(this.sourceChangeKey_=JW(e,tH,this.handleSourceChange_,this),"ready"===e.getState()&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return this.renderer_&&this.rendered?this.renderer_.getData(e):null}isVisible(e){let t;const n=this.getMapInternal();let r;if(!e&&n&&(e=n.getView()),t=e instanceof TY?{viewState:e.getState(),extent:e.calculateExtent()}:e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray()),t.layerStatesArray){if(r=t.layerStatesArray.find(e=>e.layer===this),!r)return!1}else r=this.getLayerState();const i=this.getExtent();return eJ(r,t.viewState)&&(!i||HG(i,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];const t=this.getSource()?.getAttributions();if(!t)return[];let n=t(e instanceof TY?e.getViewStateAndExtent():e);return Array.isArray(n)||(n=[n]),n}render(e,t){const n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){const t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set("map",e)}getMapInternal(){return this.get("map")}setMap(e){this.mapPrecomposeKey_&&(eH(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(eH(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=JW(e,XX,this.handlePrecompose_,this),this.mapRenderKey_=JW(this,tH,e.render,e),this.changed())}handlePrecompose_(e){const t=e.frameState.layerStatesArray,n=this.getLayerState(!1);XH(!t.some(e=>e.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set($X,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function eJ(e,t){if(!e.visible)return!1;const n=t.resolution;if(n<e.minResolution||n>=e.maxResolution)return!1;const r=t.zoom;return r>e.minZoom&&r<=e.maxZoom}function tJ(e,t,n=0,r=e.length-1,i=rJ){for(;r>n;){if(r-n>600){const s=r-n+1,o=t-n+1,a=Math.log(s),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);tJ(e,t,Math.max(n,Math.floor(t-o*l/s+c)),Math.min(r,Math.floor(t+(s-o)*l/s+c)),i)}const s=e[t];let o=n,a=r;for(nJ(e,n,t),i(e[r],s)>0&&nJ(e,n,r);o<a;){for(nJ(e,o,a),o++,a--;i(e[o],s)<0;)o++;for(;i(e[a],s)>0;)a--}0===i(e[n],s)?nJ(e,n,a):(a++,nJ(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function nJ(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function rJ(e,t){return e<t?-1:e>t?1:0}var iJ=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const n=[];if(!mJ(e,t))return n;const r=this.toBBox,i=[];for(;t;){for(let s=0;s<t.children.length;s++){const o=t.children[s],a=t.leaf?r(o):o;mJ(e,a)&&(t.leaf?n.push(o):gJ(e,a)?this._all(o,n):i.push(o))}t=i.pop()}return n}collides(e){let t=this.data;if(!mJ(e,t))return!1;const n=[];for(;t;){for(let r=0;r<t.children.length;r++){const i=t.children[r],s=t.leaf?this.toBBox(i):i;if(mJ(e,s)){if(t.leaf||gJ(e,s))return!0;n.push(i)}}t=n.pop()}return!1}load(e){if(!e||!e.length)return this;if(e.length<this._minEntries){for(let t=0;t<e.length;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(this.data.children.length)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)}else this.data=t;return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=yJ([]),this}remove(e,t){if(!e)return this;let n=this.data;const r=this.toBBox(e),i=[],s=[];let o,a,l;for(;n||i.length;){if(n||(n=i.pop(),a=i[i.length-1],o=s.pop(),l=!0),n.leaf){const r=sJ(e,n.children,t);if(-1!==r)return n.children.splice(r,1),i.push(n),this._condense(i),this}l||n.leaf||!gJ(n,r)?a?(o++,n=a.children[o],l=!1):n=null:(i.push(n),s.push(o),o=0,a=n,n=n.children[0])}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){const n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){const i=n-t+1;let s,o=this._maxEntries;if(i<=o)return s=yJ(e.slice(t,n+1)),oJ(s,this.toBBox),s;r||(r=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,r-1))),s=yJ([]),s.leaf=!1,s.height=r;const a=Math.ceil(i/o),l=a*Math.ceil(Math.sqrt(o));vJ(e,t,n,l,this.compareMinX);for(let c=t;c<=n;c+=l){const t=Math.min(c+l-1,n);vJ(e,c,t,a,this.compareMinY);for(let n=c;n<=t;n+=a){const i=Math.min(n+a-1,t);s.children.push(this._build(e,n,i,r-1))}}return oJ(s,this.toBBox),s}_chooseSubtree(e,t,n,r){for(;r.push(t),!t.leaf&&r.length-1!==n;){let n,r=1/0,i=1/0;for(let s=0;s<t.children.length;s++){const o=t.children[s],a=hJ(o),l=pJ(e,o)-a;l<i?(i=l,r=a<r?a:r,n=o):l===i&&a<r&&(r=a,n=o)}t=n||t.children[0]}return t}_insert(e,t,n){const r=n?e:this.toBBox(e),i=[],s=this._chooseSubtree(r,this.data,t,i);for(s.children.push(e),lJ(s,r);t>=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(r,i,t)}_split(e,t){const n=e[t],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);const s=this._chooseSplitIndex(n,i,r),o=yJ(n.children.splice(s,n.children.length-s));o.height=n.height,o.leaf=n.leaf,oJ(n,this.toBBox),oJ(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(n,o)}_splitRoot(e,t){this.data=yJ([e,t]),this.data.height=e.height+1,this.data.leaf=!1,oJ(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,i=1/0,s=1/0;for(let o=t;o<=n-t;o++){const t=aJ(e,0,o,this.toBBox),a=aJ(e,o,n,this.toBBox),l=fJ(t,a),c=hJ(t)+hJ(a);l<i?(i=l,r=o,s=c<s?c:s):l===i&&c<s&&(s=c,r=o)}return r||n-t}_chooseSplitAxis(e,t,n){const r=e.leaf?this.compareMinX:cJ,i=e.leaf?this.compareMinY:uJ;this._allDistMargin(e,t,n,r)<this._allDistMargin(e,t,n,i)&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);const i=this.toBBox,s=aJ(e,0,t,i),o=aJ(e,n-t,n,i);let a=dJ(s)+dJ(o);for(let l=t;l<n-t;l++){const t=e.children[l];lJ(s,e.leaf?i(t):t),a+=dJ(s)}for(let l=n-t-1;l>=t;l--){const t=e.children[l];lJ(o,e.leaf?i(t):t),a+=dJ(o)}return a}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)lJ(t[r],e)}_condense(e){for(let t,n=e.length-1;n>=0;n--)0===e[n].children.length?n>0?(t=e[n-1].children,t.splice(t.indexOf(e[n]),1)):this.clear():oJ(e[n],this.toBBox)}};function sJ(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function oJ(e,t){aJ(e,0,e.children.length,t,e)}function aJ(e,t,n,r,i){i||(i=yJ(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let s=t;s<n;s++){const t=e.children[s];lJ(i,e.leaf?r(t):t)}return i}function lJ(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function cJ(e,t){return e.minX-t.minX}function uJ(e,t){return e.minY-t.minY}function hJ(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function dJ(e){return e.maxX-e.minX+(e.maxY-e.minY)}function pJ(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function fJ(e,t){const n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),i=Math.min(e.maxX,t.maxX),s=Math.min(e.maxY,t.maxY);return Math.max(0,i-n)*Math.max(0,s-r)}function gJ(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function mJ(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function yJ(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function vJ(e,t,n,r,i){const s=[t,n];for(;s.length;){if((n=s.pop())-(t=s.pop())<=r)continue;const o=t+Math.ceil((n-t)/r/2)*r;tJ(e,o,t,n,i),s.push(t,o,o,n)}}var bJ,wJ=[NaN,NaN,NaN,0],_J=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,xJ=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,CJ=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,SJ=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function kJ(e,t){return e.endsWith("%")?Number(e.substring(0,e.length-1))/t:Number(e)}function EJ(e){throw new Error('failed to parse "'+e+'" as color')}function RJ(e){if(e.toLowerCase().startsWith("rgb")){const t=e.match(xJ)||e.match(_J)||e.match(CJ);if(t){const e=t[4],n=100/255;return[nG(kJ(t[1],n)+.5|0,0,255),nG(kJ(t[2],n)+.5|0,0,255),nG(kJ(t[3],n)+.5|0,0,255),void 0!==e?nG(kJ(e,100),0,1):1]}EJ(e)}if(e.startsWith("#")){if(SJ.test(e)){const t=e.substring(1),n=t.length<=4?1:2,r=[0,0,0,255];for(let e=0,i=t.length;e<i;e+=n){let i=parseInt(t.substring(e,e+n),16);1===n&&(i+=i<<4),r[e/n]=i}return r[3]=r[3]/255,r}EJ(e)}const t=(bJ||(bJ=BY(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),bJ);t.fillStyle="#abcdef";let n=t.fillStyle;t.fillStyle=e,t.fillStyle===n&&(t.fillStyle="#fedcba",n=t.fillStyle,t.fillStyle=e,t.fillStyle===n&&EJ(e));const r=t.fillStyle;if(r.startsWith("#")||r.startsWith("rgba"))return RJ(r);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);const i=Array.from(t.getImageData(0,0,1,1).data);return i[3]=cG(i[3]/255,3),i}var TJ={},LJ=0;function IJ(e){if(4===e.length)return e;const t=e.slice();return t[3]=1,t}function PJ(e){return e>.0031308?269.025*Math.pow(e,1/2.4)-14.025:3294.6*e}function MJ(e){return e>.2068965?Math.pow(e,3):108/841*(e-4/29)}function AJ(e){return e>10.314724?Math.pow((e+14.025)/269.025,2.4):e/3294.6}function OJ(e){return e>.0088564?Math.pow(e,1/3):e/(108/841)+4/29}function NJ(e){const t=AJ(e[0]),n=AJ(e[1]),r=AJ(e[2]),i=OJ(.222488403*t+.716873169*n+.06060791*r),s=500*(OJ(.452247074*t+.399439023*n+.148375274*r)-i),o=200*(i-OJ(.016863605*t+.117638439*n+.865350722*r)),a=Math.atan2(o,s)*(180/Math.PI);return[116*i-16,Math.sqrt(s*s+o*o),a<0?a+360:a,e[3]]}function FJ(e){if("none"===e)return wJ;if(TJ.hasOwnProperty(e))return TJ[e];if(LJ>=1024){let e=0;for(const t in TJ)3&e++||(delete TJ[t],--LJ)}const t=RJ(e);4!==t.length&&EJ(e);for(const n of t)isNaN(n)&&EJ(e);return TJ[e]=t,++LJ,t}function DJ(e){return Array.isArray(e)?e:FJ(e)}function zJ(e){let t=e[0];t!=(0|t)&&(t=t+.5|0);let n=e[1];n!=(0|n)&&(n=n+.5|0);let r=e[2];return r!=(0|r)&&(r=r+.5|0),"rgba("+t+","+n+","+r+","+(void 0===e[3]?1:Math.round(1e3*e[3])/1e3)+")"}function jJ(e){return e[0]>0&&e[1]>0}function UJ(e,t){return Array.isArray(e)?e:(void 0===t?t=[e,e]:(t[0]=e,t[1]=e),t)}var BJ=0,$J=1<<BJ++,qJ=1<<BJ++,VJ=1<<BJ++,WJ=1<<BJ++,HJ=1<<BJ++,GJ=1<<BJ++,KJ=Math.pow(2,6)-1,ZJ={[$J]:"boolean",[qJ]:"number",[VJ]:"string",[WJ]:"color",[HJ]:"number[]",[GJ]:"size"},YJ=Object.keys(ZJ).map(Number).sort(cH);function XJ(e){const t=[];for(const n of YJ)JJ(e,n)&&t.push(ZJ[n]);return 0===t.length?"untyped":t.length<3?t.join(" or "):t.slice(0,-1).join(", ")+", or "+t[t.length-1]}function JJ(e,t){return(e&t)===t}function QJ(e,t){return!!(e&t)}function eQ(e,t){return e===t}var tQ=class{constructor(e,t){if(!function(e){return e in ZJ}(e))throw new Error(`literal expressions must have a specific type, got ${XJ(e)}`);this.type=e,this.value=t}},nQ=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function rQ(e){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:e}}function iQ(e,t,n){switch(typeof e){case"boolean":if(eQ(t,VJ))return new tQ(VJ,e?"true":"false");if(!JJ(t,$J))throw new Error(`got a boolean, but expected ${XJ(t)}`);return new tQ($J,e);case"number":if(eQ(t,GJ))return new tQ(GJ,UJ(e));if(eQ(t,$J))return new tQ($J,!!e);if(eQ(t,VJ))return new tQ(VJ,e.toString());if(!JJ(t,qJ))throw new Error(`got a number, but expected ${XJ(t)}`);return new tQ(qJ,e);case"string":if(eQ(t,WJ))return new tQ(WJ,FJ(e));if(eQ(t,$J))return new tQ($J,!!e);if(!JJ(t,VJ))throw new Error(`got a string, but expected ${XJ(t)}`);return new tQ(VJ,e)}if(!Array.isArray(e))throw new Error("expression must be an array or a primitive value");if(0===e.length)throw new Error("empty expression");if("string"==typeof e[0])return function(e,t,n){const r=e[0],i=JQ[r];if(!i)throw new Error(`unknown operator: ${r}`);return i(e,t,n)}(e,t,n);for(const r of e)if("number"!=typeof r)throw new Error("expected an array of numbers");if(eQ(t,GJ)){if(2!==e.length)throw new Error(`expected an array of two values for a size, got ${e.length}`);return new tQ(GJ,e)}if(eQ(t,WJ)){if(3===e.length)return new tQ(WJ,[...e,1]);if(4===e.length)return new tQ(WJ,e);throw new Error(`expected an array of 3 or 4 values for a color, got ${e.length}`)}if(!JJ(t,HJ))throw new Error(`got an array of numbers, but expected ${XJ(t)}`);return new tQ(HJ,e)}var sQ="get",oQ="var",aQ="concat",lQ="geometry-type",cQ="line-metric",uQ="any",hQ="all",dQ="!",pQ="resolution",fQ="zoom",gQ="time",mQ="==",yQ="!=",vQ=">",bQ=">=",wQ="<",_Q="<=",xQ="*",CQ="/",SQ="+",kQ="-",EQ="clamp",RQ="%",TQ="^",LQ="abs",IQ="floor",PQ="ceil",MQ="round",AQ="sin",OQ="cos",NQ="atan",FQ="sqrt",DQ="match",zQ="between",jQ="interpolate",UQ="coalesce",BQ="case",$Q="in",qQ="number",VQ="string",WQ="array",HQ="color",GQ="id",KQ="band",ZQ="palette",YQ="to-string",XQ="has",JQ={[sQ]:a0(n0(1,1/0),QQ),[oQ]:function(e,t,n){const r=e[1];if("string"!=typeof r)throw new Error("expected a string argument for var operation");let i=t;const s=n.inputVariables?.[r];if(void 0!==s){const e=iQ(s,KJ,n);if(!(e instanceof tQ))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${r}`);let o=e.type;if("string"==typeof s&&QJ(i,WJ)&&!QJ(i,VJ)?o=WJ:Array.isArray(s)&&2===s.length&&QJ(i,GJ)&&!QJ(i,HJ)&&(o=GJ),i&=o,0===i)throw new Error(`the type expected from the var operator (${XJ(t)}) did not have any overlap with the type of the corresponding style variables (${XJ(o)}), variable name: ${r}`)}if(n.variables.has(r)){const e=n.variables.get(r);if(i&=e,0===i)throw new Error(`a new type expected from the var operator (${XJ(t)}) did not have any overlap with the previous type expected for it (${XJ(e)}), variable name: ${r}`)}return n.variables.set(r,i),new nQ(i,"var",new tQ(VJ,r))},[XQ]:a0(n0(1,1/0),QQ),[GQ]:a0(function(e,t,n){n.featureId=!0},t0),[aQ]:a0(n0(2,1/0),i0(VJ)),[lQ]:a0(function(e,t,n){n.geometryType=!0},t0),[cQ]:a0(function(e,t,n){n.mCoordinate=!0},t0),[pQ]:a0(e0,t0),[fQ]:a0(e0,t0),[gQ]:a0(e0,t0),[uQ]:a0(n0(2,1/0),i0($J)),[hQ]:a0(n0(2,1/0),i0($J)),[dQ]:a0(n0(1,1),i0($J)),[mQ]:a0(n0(2,2),s0()),[yQ]:a0(n0(2,2),s0()),[vQ]:a0(n0(2,2),i0(qJ)),[bQ]:a0(n0(2,2),i0(qJ)),[wQ]:a0(n0(2,2),i0(qJ)),[_Q]:a0(n0(2,2),i0(qJ)),[xQ]:a0(n0(2,1/0),r0),[UQ]:a0(n0(2,1/0),r0),[CQ]:a0(n0(2,2),i0(qJ)),[SQ]:a0(n0(2,1/0),i0(qJ)),[kQ]:a0(n0(2,2),i0(qJ)),[EQ]:a0(n0(3,3),i0(qJ)),[RQ]:a0(n0(2,2),i0(qJ)),[TQ]:a0(n0(2,2),i0(qJ)),[LQ]:a0(n0(1,1),i0(qJ)),[IQ]:a0(n0(1,1),i0(qJ)),[PQ]:a0(n0(1,1),i0(qJ)),[MQ]:a0(n0(1,1),i0(qJ)),[AQ]:a0(n0(1,1),i0(qJ)),[OQ]:a0(n0(1,1),i0(qJ)),[NQ]:a0(n0(1,2),i0(qJ)),[FQ]:a0(n0(1,1),i0(qJ)),[DQ]:a0(n0(4,1/0),o0,function(e,t,n){const r=e.length-1,i=iQ(e[e.length-1],t,n);let s=VJ|qJ|$J;const o=new Array(r-2);for(let a=0;a<r-2;a+=2){try{s&=iQ(e[a+2],s,n).type}catch(RD){throw new Error(`failed to parse argument ${a+1} of match expression: ${RD.message}`)}if(0===s)throw new Error("no common type was found among the arguments of match expression")}for(let a=0;a<r-2;a+=2){try{const t=iQ(e[a+2],s,n);o[a]=t}catch(RD){throw new Error(`failed to parse argument ${a+1} of match expression: ${RD.message}`)}try{const t=iQ(e[a+3],i.type,n);o[a+1]=t}catch(RD){throw new Error(`failed to parse argument ${a+2} of match expression: ${RD.message}`)}}return[iQ(e[1],s,n),...o,i]}),[zQ]:a0(n0(3,3),i0(qJ)),[jQ]:a0(n0(6,1/0),o0,function(e,t,n){const r=e[1];let i;switch(r[0]){case"linear":i=1;break;case"exponential":const e=r[1];if("number"!=typeof e||e<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(e)} instead`);i=e;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(r)}`)}const s=new tQ(qJ,i);let o;try{o=iQ(e[2],qJ,n)}catch(RD){throw new Error(`failed to parse argument 1 in interpolate expression: ${RD.message}`)}const a=new Array(e.length-3);for(let l=0;l<a.length;l+=2){try{const t=iQ(e[l+3],qJ,n);a[l]=t}catch(RD){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${RD.message}`)}try{const r=iQ(e[l+4],t,n);a[l+1]=r}catch(RD){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${RD.message}`)}}return[s,o,...a]}),[BQ]:a0(n0(3,1/0),function(e){const t=e[0],n=e.length-1;if(n%2==0)throw new Error(`expected an odd number of arguments for ${t}, got ${n} instead`)},function(e,t,n){const r=iQ(e[e.length-1],t,n),i=new Array(e.length-1);for(let s=0;s<i.length-1;s+=2){try{const t=iQ(e[s+1],$J,n);i[s]=t}catch(RD){throw new Error(`failed to parse argument ${s} of case expression: ${RD.message}`)}try{const t=iQ(e[s+2],r.type,n);i[s+1]=t}catch(RD){throw new Error(`failed to parse argument ${s+1} of case expression: ${RD.message}`)}}return i[i.length-1]=r,i}),[$Q]:a0(n0(2,2),function(e,t,n){let r,i=e[2];if(!Array.isArray(i))throw new Error('the second argument for the "in" operator must be an array');if("literal"===i[0]){if(i=i[1],!Array.isArray(i))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if("string"==typeof i[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');r="string"==typeof i[0]?VJ:qJ;const s=new Array(i.length);for(let o=0;o<s.length;o++)try{const e=iQ(i[o],r,n);s[o]=e}catch(RD){throw new Error(`failed to parse haystack item ${o} for "in" expression: ${RD.message}`)}return[iQ(e[1],r,n),...s]}),[qQ]:a0(n0(1,1/0),i0(KJ)),[VQ]:a0(n0(1,1/0),i0(KJ)),[WQ]:a0(n0(1,1/0),i0(qJ)),[HQ]:a0(n0(1,4),i0(qJ)),[KQ]:a0(n0(1,3),i0(qJ)),[ZQ]:a0(n0(2,2),function(e,t,n){let r;try{r=iQ(e[1],qJ,n)}catch(RD){throw new Error(`failed to parse first argument in palette expression: ${RD.message}`)}const i=e[2];if(!Array.isArray(i))throw new Error("the second argument of palette must be an array");const s=new Array(i.length);for(let o=0;o<s.length;o++){let e;try{e=iQ(i[o],WJ,n)}catch(RD){throw new Error(`failed to parse color at index ${o} in palette expression: ${RD.message}`)}if(!(e instanceof tQ))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=e}return[r,...s]}),[YQ]:a0(n0(1,1),i0($J|qJ|VJ|WJ))};function QQ(e,t,n){const r=e.length-1,i=new Array(r);for(let s=0;s<r;++s){const r=e[s+1];switch(typeof r){case"number":i[s]=new tQ(qJ,r);break;case"string":i[s]=new tQ(VJ,r);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${r}`)}0===s&&n.properties.set(String(r),t)}return i}function e0(e,t,n){n.mapState=!0}function t0(e){const t=e[0];if(1!==e.length)throw new Error(`expected no arguments for ${t} operation`);return[]}function n0(e,t){return function(n){const r=n[0],i=n.length-1;if(e===t){if(i!==e)throw new Error(`expected ${e} argument${1===e?"":"s"} for ${r}, got ${i}`)}else if(i<e||i>t)throw new Error(`expected ${t===1/0?`${e} or more`:`${e} to ${t}`} arguments for ${r}, got ${i}`)}}function r0(e,t,n){const r=e.length-1,i=new Array(r);for(let s=0;s<r;++s){const r=iQ(e[s+1],t,n);i[s]=r}return i}function i0(e){return function(t,n,r){const i=t.length-1,s=new Array(i);for(let o=0;o<i;++o){const n=iQ(t[o+1],e,r);s[o]=n}return s}}function s0(){return function(e,t,n){const r=e[0],i=e.length-1,s=new Array(i);let o=KJ;for(let a=0;a<i;++a)o&=iQ(e[a+1],o,n).type;if(0===o)throw new Error(`no common type was found among the arguments of ${r}`);for(let a=0;a<i;++a){const t=iQ(e[a+1],o,n);s[a]=t}return s}}function o0(e){const t=e[0],n=e.length-1;if(n%2==1)throw new Error(`expected an even number of arguments for operation ${t}, got ${n} instead`)}function a0(...e){return function(t,n,r){const i=t[0];let s;for(let o=0;o<e.length;o++){const i=e[o](t,n,r);if(o==e.length-1){if(!i)throw new Error("expected last argument validator to return the parsed args");s=i}}return new nQ(n,i,...s)}}function l0(e){if(!e)return"";const t=e.getType();switch(t){case"Point":case"LineString":case"Polygon":return t;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return t.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return l0(e.getGeometries()[0]);default:return""}}function c0(e,t,n){return u0(iQ(e,t,n),n)}function u0(e,t){if(e instanceof tQ){if(e.type===WJ&&"string"==typeof e.value){const t=FJ(e.value);return function(){return t}}return function(){return e.value}}const n=e.operator;switch(n){case qQ:case VQ:case UQ:return function(e,t){const n=e.operator,r=e.args.length,i=new Array(r);for(let s=0;s<r;++s)i[s]=u0(e.args[s],t);switch(n){case UQ:return e=>{for(let t=0;t<r;++t){const n=i[t](e);if(null!=n)return n}throw new Error("Expected one of the values to be non-null")};case qQ:case VQ:return e=>{for(let t=0;t<r;++t){const r=i[t](e);if(typeof r===n)return r}throw new Error(`Expected one of the values to be a ${n}`)};default:throw new Error(`Unsupported assertion operator ${n}`)}}(e,t);case sQ:case oQ:case XQ:return function(e){const t=e.args[0].value;switch(e.operator){case sQ:return n=>{const r=e.args;let i=n.properties[t];for(let e=1,t=r.length;e<t;++e)i=i[r[e].value];return i};case oQ:return e=>e.variables[t];case XQ:return n=>{const r=e.args;if(!(t in n.properties))return!1;let i=n.properties[t];for(let e=1,t=r.length;e<t;++e){const t=r[e].value;if(!i||!Object.hasOwn(i,t))return!1;i=i[t]}return!0};default:throw new Error(`Unsupported accessor operator ${e.operator}`)}}(e);case"id":return e=>e.featureId;case lQ:return e=>e.geometryType;case aQ:{const n=e.args.map(e=>u0(e,t));return e=>"".concat(...n.map(t=>t(e).toString()))}case pQ:return e=>e.resolution;case uQ:case hQ:case zQ:case $Q:case"!":return function(e,t){const n=e.operator,r=e.args.length,i=new Array(r);for(let s=0;s<r;++s)i[s]=u0(e.args[s],t);switch(n){case uQ:return e=>{for(let t=0;t<r;++t)if(i[t](e))return!0;return!1};case hQ:return e=>{for(let t=0;t<r;++t)if(!i[t](e))return!1;return!0};case zQ:return e=>{const t=i[0](e),n=i[1](e),r=i[2](e);return t>=n&&t<=r};case $Q:return e=>{const t=i[0](e);for(let n=1;n<r;++n)if(t===i[n](e))return!0;return!1};case"!":return e=>!i[0](e);default:throw new Error(`Unsupported logical operator ${n}`)}}(e,t);case mQ:case yQ:case"<":case _Q:case">":case bQ:return function(e,t){const n=e.operator,r=u0(e.args[0],t),i=u0(e.args[1],t);switch(n){case mQ:return e=>r(e)===i(e);case yQ:return e=>r(e)!==i(e);case"<":return e=>r(e)<i(e);case _Q:return e=>r(e)<=i(e);case">":return e=>r(e)>i(e);case bQ:return e=>r(e)>=i(e);default:throw new Error(`Unsupported comparison operator ${n}`)}}(e,t);case"*":case"/":case"+":case"-":case EQ:case"%":case"^":case LQ:case IQ:case PQ:case MQ:case AQ:case OQ:case NQ:case FQ:return function(e,t){const n=e.operator,r=e.args.length,i=new Array(r);for(let s=0;s<r;++s)i[s]=u0(e.args[s],t);switch(n){case"*":return e=>{let t=1;for(let n=0;n<r;++n)t*=i[n](e);return t};case"/":return e=>i[0](e)/i[1](e);case"+":return e=>{let t=0;for(let n=0;n<r;++n)t+=i[n](e);return t};case"-":return e=>i[0](e)-i[1](e);case EQ:return e=>{const t=i[0](e),n=i[1](e);if(t<n)return n;const r=i[2](e);return t>r?r:t};case"%":return e=>i[0](e)%i[1](e);case"^":return e=>Math.pow(i[0](e),i[1](e));case LQ:return e=>Math.abs(i[0](e));case IQ:return e=>Math.floor(i[0](e));case PQ:return e=>Math.ceil(i[0](e));case MQ:return e=>Math.round(i[0](e));case AQ:return e=>Math.sin(i[0](e));case OQ:return e=>Math.cos(i[0](e));case NQ:return 2===r?e=>Math.atan2(i[0](e),i[1](e)):e=>Math.atan(i[0](e));case FQ:return e=>Math.sqrt(i[0](e));default:throw new Error(`Unsupported numeric operator ${n}`)}}(e,t);case BQ:return function(e,t){const n=e.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=u0(e.args[i],t);return e=>{for(let t=0;t<n-1;t+=2)if(r[t](e))return r[t+1](e);return r[n-1](e)}}(e,t);case DQ:return function(e,t){const n=e.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=u0(e.args[i],t);return e=>{const t=r[0](e);for(let i=1;i<n-1;i+=2)if(t===r[i](e))return r[i+1](e);return r[n-1](e)}}(e,t);case jQ:return function(e,t){const n=e.args.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=u0(e.args[i],t);return e=>{const t=r[0](e),i=r[1](e);let s,o;for(let a=2;a<n;a+=2){const n=r[a](e);let l=r[a+1](e);const c=Array.isArray(l);if(c&&(l=IJ(l)),n>=i)return 2===a?l:c?d0(t,i,s,o,n,l):h0(t,i,s,o,n,l);s=n,o=l}return o}}(e,t);case YQ:return function(e,t){const n=e.operator,r=e.args.length,i=new Array(r);for(let s=0;s<r;++s)i[s]=u0(e.args[s],t);if(n===YQ)return t=>{const n=i[0](t);return e.args[0].type===WJ?zJ(n):n.toString()};throw new Error(`Unsupported convert operator ${n}`)}(e,t);default:throw new Error(`Unsupported operator ${n}`)}}function h0(e,t,n,r,i,s){const o=i-n;if(0===o)return r;const a=t-n;return r+(1===e?a/o:(Math.pow(e,a)-1)/(Math.pow(e,o)-1))*(s-r)}function d0(e,t,n,r,i,s){if(i-n===0)return r;const o=NJ(r),a=NJ(s);let l=a[2]-o[2];return l>180?l-=360:l<-180&&(l+=360),function(e){const t=(e[0]+16)/116,n=e[1],r=e[2]*Math.PI/180,i=MJ(t),s=MJ(t+n/500*Math.cos(r)),o=MJ(t-n/200*Math.sin(r)),a=PJ(3.021973625*s-1.617392459*i-.404875592*o),l=PJ(-.943766287*s+1.916279586*i+.027607165*o),c=PJ(.069407491*s-.22898585*i+1.159737864*o);return[nG(a+.5|0,0,255),nG(l+.5|0,0,255),nG(c+.5|0,0,255),e[3]]}([h0(e,t,n,o[0],i,a[0]),h0(e,t,n,o[1],i,a[1]),o[2]+h0(e,t,n,0,i,l),h0(e,t,n,r[3],i,s[3])])}var p0=class extends _H{constructor(e,t,n,r){super(),this.extent=e,this.pixelRatio_=n,this.resolution=t,this.state="function"==typeof r?0:r,this.image_=null,this.loader="function"==typeof r?r:null}changed(){this.dispatchEvent(tH)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(0==this.state&&this.loader){this.state=1,this.changed();const e=this.getResolution(),t=Array.isArray(e)?e[0]:e;bH(()=>this.loader(this.getExtent(),t,this.getPixelRatio())).then(e=>{"image"in e&&(this.image_=e.image),"extent"in e&&(this.extent=e.extent),"resolution"in e&&(this.resolution=e.resolution),"pixelRatio"in e&&(this.pixelRatio_=e.pixelRatio),(e instanceof HTMLImageElement||UH&&e instanceof ImageBitmap||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement)&&(this.image_=e),this.state=2}).catch(e=>{this.state=3,console.error(e)}).finally(()=>this.changed())}}setImage(e){this.image_=e}setResolution(e){this.resolution=e}};function f0(e,t){return e+":"+(t?DJ(t):"null")}var g0=new class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(const t in this.cache_){const n=this.cache_[t];3&e++||n.hasListener()||(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){const n=f0(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){const n=f0(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){const i=f0(e,t),s=i in this.cache_;this.cache_[i]=n,r&&(0===n.getImageState()&&n.load(),1===n.getImageState()?n.ready().then(()=>{this.patternCache_[i]=$Y().createPattern(n.getImage(1),"repeat")}):this.patternCache_[i]=$Y().createPattern(n.getImage(1),"repeat")),s||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}},m0=null,y0=class extends _H{constructor(e,t,n,r,i){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=i,this.imageState_=void 0===r?0:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(void 0===this.tainted_&&2===this.imageState_){m0||(m0=BY(1,1,void 0,{willReadFrequently:!0})),m0.drawImage(this.image_,0,0);try{m0.getImageData(0,0,1,1),this.tainted_=!1}catch{m0=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(tH)}handleImageError_(){this.imageState_=3,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=2,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const e=this.size_[0],t=this.size_[1],n=BY(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(0===this.imageState_){this.image_||this.initializeImage_(),this.imageState_=1;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&(e=this.image_,t=this.src_,t&&(e.src=t),e.src&&jH?new Promise((t,n)=>e.decode().then(()=>t(e)).catch(r=>e.complete&&e.width?t(e):n(r))):function(e){return new Promise((t,n)=>{function r(){s(),t(e)}function i(){s(),n(new Error("Image load error"))}function s(){e.removeEventListener("load",r),e.removeEventListener("error",i)}e.addEventListener("load",r),e.addEventListener("error",i)})}(e)).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}var e,t}replaceColor_(e){if(!this.color_||this.canvas_[e]||2!==this.imageState_)return;const t=this.image_,n=BY(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;var i;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle="string"==typeof(i=this.color_)?i:zJ(i),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(2===this.imageState_||3===this.imageState_)e();else{const t=()=>{2!==this.imageState_&&3!==this.imageState_||(this.removeEventListener(tH,t),e())};this.addEventListener(tH,t)}})),this.ready_}};function v0(e,t,n,r,i,s){let o=void 0===t?void 0:g0.get(t,i);return o||(o=new y0(e,e&&"src"in e?e.src||void 0:t,n,r,i),g0.set(t,i,o,s)),s&&o&&!g0.getPattern(t,i)&&g0.set(t,i,o,s),o}function b0(e){return e?Array.isArray(e)?zJ(e):"object"==typeof e&&"src"in e?function(e){if(!e.offset||!e.size)return g0.getPattern(e.src,e.color);const t=e.src+":"+e.offset,n=g0.getPattern(t,e.color);if(n)return n;const r=g0.get(e.src,null);if(2!==r.getImageState())return null;const i=BY(e.size[0],e.size[1]);return i.drawImage(r.getImage(1),e.offset[0],e.offset[1],e.size[0],e.size[1],0,0,e.size[0],e.size[1]),v0(i.canvas,t,void 0,2,e.color,!0),g0.getPattern(t,e.color)}(e):e:null}var w0,_0="#000",x0="round",C0=[],S0="round",k0="#000",E0="center",R0=[0,0,0,0],T0=new RH,L0=null,I0={},P0=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function M0(e,t,n){return`${e} ${t} 16px "${n}"`}var A0=function(){const e=100;let t,n;async function r(e){await n.ready;const t=UY(e),r=t.families[0].toLowerCase(),i=t.weight,s=[];return n.forEach(e=>{const n=e.family.replace(/^['"]|['"]$/g,"").toLowerCase(),o=jY[e.weight]||e.weight;n===r&&e.style===t.style&&o==i&&s.push(e)}),0!==s.length&&(await Promise.all(s.map(e=>e.load().then(()=>!0,()=>!1)))).some(e=>e)}async function i(){await n.ready;let s=!0;const o=T0.getProperties(),a=Object.keys(o).filter(t=>o[t]<e);for(let t=a.length-1;t>=0;--t){const n=a[t];let i=o[n];i<e&&(await r(n)?(YW(I0),T0.set(n,e)):(i+=10,T0.set(n,i,!0),i<e&&(s=!1)))}t=void 0,s||(t=setTimeout(i,100))}return async function(e){n||(n=zH?self.fonts:document.fonts);const r=UY(e);if(!r)return;const s=r.families;let o=!1;for(const t of s){if(P0.has(t))continue;const e=M0(r.style,r.weight,t);void 0===T0.get(e)&&(T0.set(e,0,!0),o=!0)}o&&(clearTimeout(t),t=setTimeout(i,100))}}(),O0=function(){let e;return function(t){let n=I0[t];if(null==n){if(zH){const e=UY(t),r=N0(t,"Žg");n=(isNaN(Number(e.lineHeight))?1.2:Number(e.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else e||(e=document.createElement("div"),e.innerHTML="M",e.style.minHeight="0",e.style.maxHeight="none",e.style.height="auto",e.style.padding="0",e.style.border="none",e.style.position="absolute",e.style.display="block",e.style.left="-99999px"),e.style.font=t,document.body.appendChild(e),n=e.offsetHeight,document.body.removeChild(e);I0[t]=n}return n}}();function N0(e,t){return L0||(L0=BY(1,1)),e!=w0&&(L0.font=e,w0=L0.font),L0.measureText(t)}function F0(e,t){return N0(e,t).width}function D0(e,t,n){if(t in n)return n[t];const r=t.split("\n").reduce((t,n)=>Math.max(t,F0(e,n)),0);return n[t]=r,r}var z0=class e{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=UJ(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){const t=this.getScale();return new e({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 CH()}getImage(e){return CH()}getHitDetectionImage(){return CH()}getPixelRatio(e){return 1}getImageState(){return CH()}getImageSize(){return CH()}getOrigin(){return CH()}getSize(){return CH()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=UJ(e)}listenImageChange(e){CH()}load(){CH()}unlistenImageChange(e){CH()}ready(){return Promise.resolve()}},j0=class e extends z0{constructor(e){super({opacity:1,rotateWithView:void 0!==e.rotateWithView&&e.rotateWithView,rotation:void 0!==e.rotation?e.rotation:0,scale:void 0!==e.scale?e.scale:1,displacement:void 0!==e.displacement?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=void 0!==e.fill?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=void 0!==e.angle?e.angle:0,this.stroke_=void 0!==e.stroke?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?1:2,1===this.imageState_&&this.ready().then(()=>this.imageState_=2),this.render()}clone(){const t=this.getScale(),n=new e({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 n.setOpacity(this.getOpacity()),n}getAnchor(){const e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){const t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(",");let r=g0.get(n,null)?.getImage(1);if(!r){const t=this.renderOptions_,i=Math.ceil(t.size*e),s=BY(i,i);this.draw_(t,s,e),r=s.canvas;const o=new y0(r,void 0,null,2,null);g0.set(n,null,o),createImageBitmap(r).then(e=>{o.setImage(e)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(0===t||this.points_===1/0||"bevel"!==e&&"miter"!==e)return t;let r=this.radius,i=void 0===this.radius2_?r:this.radius2_;if(r<i){const e=r;r=i,i=e}const s=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/s,a=i*Math.sin(o),l=r-Math.sqrt(i*i-a*a),c=Math.sqrt(a*a+l*l),u=c/a;if("miter"===e&&u<=n)return u*t;const h=t/2/u,d=t/2*(l/c),p=Math.sqrt((r+h)*(r+h)+d*d)-r;if(void 0===this.radius2_||"bevel"===e)return 2*p;const f=r*Math.sin(o),g=i-Math.sqrt(r*r-f*f),m=Math.sqrt(f*f+g*g)/f;if(m<=n){const e=m*t/2-i-r;return 2*Math.max(p,e)}return 2*p}createRenderOptions(){let e,t=x0,n=S0,r=0,i=null,s=0,o=0;this.stroke_&&(e=b0(this.stroke_.getColor()??"#000"),o=this.stroke_.getWidth()??1,i=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,n=this.stroke_.getLineJoin()??"round",t=this.stroke_.getLineCap()??"round",r=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(n,o,r),l=Math.max(this.radius,this.radius2_||0);return{strokeStyle:e,strokeWidth:o,size:Math.ceil(2*l+a),lineCap:t,lineDash:i,lineDashOffset:s,lineJoin:n,miterLimit:r}}render(){this.renderOptions_=this.createRenderOptions();const e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let e=this.fill_.getColor();null===e&&(e=_0),t.fillStyle=b0(e),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;"string"==typeof n&&(n=DJ(n)),null===n?r=1:Array.isArray(n)&&(r=4===n.length?n[3]:1),0===r&&(t=BY(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_;const n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{const r=void 0===this.radius2_?n:this.radius2_;void 0!==this.radius2_&&(t*=2);const i=this.angle_-Math.PI/2,s=2*Math.PI/t;for(let o=0;o<t;o++){const t=i+o*s,a=o%2==0?n:r;e.lineTo(a*Math.cos(t),a*Math.sin(t))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=_0,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},U0=class e extends j0{constructor(e){super({points:1/0,fill:(e=e||{radius:5}).fill,radius:e.radius,stroke:e.stroke,scale:void 0!==e.scale?e.scale:1,rotation:void 0!==e.rotation?e.rotation:0,rotateWithView:void 0!==e.rotateWithView&&e.rotateWithView,displacement:void 0!==e.displacement?e.displacement:[0,0],declutterMode:e.declutterMode})}clone(){const t=this.getScale(),n=new e({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 n.setOpacity(this.getOpacity()),n}},B0=class e{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,void 0!==e.color&&this.setColor(e.color)}clone(){const t=this.getColor();return new e({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(e){if(null!==e&&"object"==typeof e&&"src"in e){const t=v0(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),0===t.getImageState()&&t.load(),1===t.getImageState()&&(this.patternImage_=t)}this.color_=e}getKey(){const e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?kH(e):"object"==typeof e&&"src"in e?e.src+":"+e.offset:DJ(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}};function $0(e,t,n,r){return void 0!==n&&void 0!==r?[n/e,r/t]:void 0!==n?n/e:void 0!==r?r/t:1}var q0=class e extends z0{constructor(e){const t=void 0!==(e=e||{}).opacity?e.opacity:1,n=void 0!==e.rotation?e.rotation:0,r=void 0!==e.scale?e.scale:1,i=void 0!==e.rotateWithView&&e.rotateWithView;super({opacity:t,rotation:n,scale:r,displacement:void 0!==e.displacement?e.displacement:[0,0],rotateWithView:i,declutterMode:e.declutterMode}),this.anchor_=void 0!==e.anchor?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==e.anchorOrigin?e.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==e.anchorXUnits?e.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==e.anchorYUnits?e.anchorYUnits:"fraction",this.crossOrigin_=void 0!==e.crossOrigin?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;const s=void 0!==e.img?e.img:null;let o,a=e.src;if(XH(!(void 0!==a&&s),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!s||(a=s.src||kH(s)),XH(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),XH(!((void 0!==e.width||void 0!==e.height)&&void 0!==e.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==e.src?o=0:void 0!==s&&(o="complete"in s?s.complete?s.src?2:0:1:2),this.color_=void 0!==e.color?DJ(e.color):null,this.iconImage_=v0(s,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},o,this.color_),this.offset_=void 0!==e.offset?e.offset:[0,0],this.offsetOrigin_=void 0!==e.offsetOrigin?e.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==e.size?e.size:null,this.initialOptions_,void 0!==e.width||void 0!==e.height){let t,n;if(e.size)[t,n]=e.size;else{const r=this.getImage(1);if(r.width&&r.height)t=r.width,n=r.height;else if(r instanceof HTMLImageElement){this.initialOptions_=e;const t=()=>{if(this.unlistenImageChange(t),!this.initialOptions_)return;const n=this.iconImage_.getSize();this.setScale($0(n[0],n[1],e.width,e.height))};return void this.listenImageChange(t)}}void 0!==t&&this.setScale($0(t,n,e.width,e.height))}}clone(){let t,n,r;return this.initialOptions_?(n=this.initialOptions_.width,r=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new e({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_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:n,height:r,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;const t=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!t)return null;e=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(e[0]*=t[0]),"fraction"==this.anchorYUnits_&&(e[1]*=t[1])}if("top-left"!=this.anchorOrigin_){if(!t)return null;e===this.anchor_&&(e=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(e[0]=-e[0]+t[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(e[1]=-e[1]+t[1])}this.normalizedAnchor_=e}const t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){const t=e?DJ(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((e,n)=>e===t[n]))return;this.color_=t;const n=this.getSrc(),r=void 0!==n?null:this.getHitDetectionImage(),i=void 0!==n?0:this.iconImage_.getImageState();this.iconImage_=v0(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},i,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if("top-left"!=this.offsetOrigin_){const t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(e[0]=n[0]-t[0]-e[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=v0(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},0,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const e=this.getScaleArray();return this.size_?this.size_[0]*e[0]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[0]*e[0]:void 0}getHeight(){const e=this.getScaleArray();return this.size_?this.size_[1]*e[1]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[1]*e[1]:void 0}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(tH,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(tH,e)}ready(){return this.iconImage_.ready()}},V0=class e{constructor(e){e=e||{},this.color_=void 0!==e.color?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=void 0!==e.lineDash?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){const t=this.getColor();return new e({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(),offset:this.getOffset(),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_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}},W0=class e{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=K0,void 0!==e.geometry&&this.setGeometry(e.geometry),this.fill_=void 0!==e.fill?e.fill:null,this.image_=void 0!==e.image?e.image:null,this.renderer_=void 0!==e.renderer?e.renderer:null,this.hitDetectionRenderer_=void 0!==e.hitDetectionRenderer?e.hitDetectionRenderer:null,this.stroke_=void 0!==e.stroke?e.stroke:null,this.text_=void 0!==e.text?e.text:null,this.zIndex_=e.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new e({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(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){"function"==typeof e?this.geometryFunction_=e:"string"==typeof e?this.geometryFunction_=function(t){return t.get(e)}:e?void 0!==e&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=K0,this.geometry_=e}setZIndex(e){this.zIndex_=e}},H0=null;function G0(){if(!H0){const e=new B0({color:"rgba(255,255,255,0.4)"}),t=new V0({color:"#3399CC",width:1.25});H0=[new W0({image:new U0({fill:e,stroke:t,radius:5}),fill:e,stroke:t})]}return H0}function K0(e){return e.getGeometry()}var Z0=class e{constructor(e){e=e||{},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=UJ(void 0!==e.scale?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=void 0!==e.fill?e.fill:new B0({color:"#333"}),this.maxAngle_=void 0!==e.maxAngle?e.maxAngle:Math.PI/4,this.placement_=void 0!==e.placement?e.placement:"point",this.overflow_=!!e.overflow,this.stroke_=void 0!==e.stroke?e.stroke:null,this.offsetX_=void 0!==e.offsetX?e.offsetX:0,this.offsetY_=void 0!==e.offsetY?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=void 0===e.padding?null:e.padding,this.declutterMode_=e.declutterMode}clone(){const t=this.getScale();return new e({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof B0?this.getFill().clone():this.getFill(),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,declutterMode:this.getDeclutterMode()})}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_}getKeepUpright(){return this.keepUpright_}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_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=UJ(void 0!==e?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}};function Y0(){return!0}function X0(e,t){t=t??rQ();const n=e.length,r=new Array(n);for(let o=0;o<n;++o)r[o]=J0(e[o],t);const i={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},s=new Array(n);return function(e,o){if(i.properties=e.getPropertiesInternal(),i.resolution=o,t.featureId){const t=e.getId();i.featureId=void 0!==t?t:null}t.geometryType&&(i.geometryType=l0(e.getGeometry()));let a=0;for(let t=0;t<n;++t){const e=r[t](i);e&&(s[a]=e,a+=1)}return s.length=a,s}}function J0(e,t){const n=Q0(e,"",t),r=e1(e,"",t),i=function(e,t){const n="text-",r=r1(e,"text-value",t);if(!r)return null;const i=Q0(e,n,t),s=Q0(e,"text-background-",t),o=e1(e,n,t),a=e1(e,"text-background-",t),l=r1(e,"text-font",t),c=n1(e,"text-max-angle",t),u=n1(e,"text-offset-x",t),h=n1(e,"text-offset-y",t),d=i1(e,"text-overflow",t),p=r1(e,"text-placement",t),f=n1(e,"text-repeat",t),g=c1(e,"text-scale",t),m=i1(e,"text-rotate-with-view",t),y=n1(e,"text-rotation",t),v=r1(e,"text-align",t),b=r1(e,"text-justify",t),w=r1(e,"text-baseline",t),_=i1(e,"text-keep-upright",t),x=o1(e,"text-padding",t),C=f1(e,"text-declutter-mode"),S=new Z0({declutterMode:C});return function(e){if(S.setText(r(e)),i&&S.setFill(i(e)),s&&S.setBackgroundFill(s(e)),o&&S.setStroke(o(e)),a&&S.setBackgroundStroke(a(e)),l&&S.setFont(l(e)),c&&S.setMaxAngle(c(e)),u&&S.setOffsetX(u(e)),h&&S.setOffsetY(h(e)),d&&S.setOverflow(d(e)),p){const t=p(e);if("point"!==t&&"line"!==t)throw new Error("Expected point or line for text-placement");S.setPlacement(t)}if(f&&S.setRepeat(f(e)),g&&S.setScale(g(e)),m&&S.setRotateWithView(m(e)),y&&S.setRotation(y(e)),v){const t=v(e);if("left"!==t&&"center"!==t&&"right"!==t&&"end"!==t&&"start"!==t)throw new Error("Expected left, right, center, start, or end for text-align");S.setTextAlign(t)}if(b){const t=b(e);if("left"!==t&&"right"!==t&&"center"!==t)throw new Error("Expected left, right, or center for text-justify");S.setJustify(t)}if(w){const t=w(e);if("bottom"!==t&&"top"!==t&&"middle"!==t&&"alphabetic"!==t&&"hanging"!==t)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");S.setTextBaseline(t)}return x&&S.setPadding(x(e)),_&&S.setKeepUpright(_(e)),S}}(e,t),s=function(e,t){return"icon-src"in e?function(e,t){const n="icon-src",r=m1(e[n],n),i=a1(e,"icon-anchor",t),s=c1(e,"icon-scale",t),o=n1(e,"icon-opacity",t),a=a1(e,"icon-displacement",t),l=n1(e,"icon-rotation",t),c=i1(e,"icon-rotate-with-view",t),u=d1(e,"icon-anchor-origin"),h=p1(e,"icon-anchor-x-units"),d=p1(e,"icon-anchor-y-units"),p=t1(e,"icon-color");let f,g=null;void 0!==p&&(Array.isArray(p)&&p.length>0&&"string"==typeof p[0]?g=s1(e,"icon-color",t):f=v1(p,"icon-color"));const m=function(e,t){const n=e[t];if(void 0!==n){if("string"!=typeof n)throw new Error(`Expected a string for ${t}`);return n}}(e,"icon-cross-origin"),y=function(e,t){const n=e[t];if(void 0!==n)return g1(n,t)}(e,"icon-offset"),v=d1(e,"icon-offset-origin"),b=u1(e,"icon-width"),w={src:r,anchorOrigin:u,anchorXUnits:h,anchorYUnits:d,crossOrigin:m,offset:y,offsetOrigin:v,height:u1(e,"icon-height"),width:b,size:h1(e,"icon-size"),declutterMode:f1(e,"icon-declutter-mode")};let _=null;return function(e){if(_)g&&_.setColor(g(e));else{const t=g?g(e):f;_=new q0(void 0!==t?Object.assign({},w,{color:t}):Object.assign({},w))}return o&&_.setOpacity(o(e)),a&&_.setDisplacement(a(e)),l&&_.setRotation(l(e)),c&&_.setRotateWithView(c(e)),s&&_.setScale(s(e)),i&&_.setAnchor(i(e)),_}}(e,t):"shape-points"in e?function(e,t){const n="shape-",r="shape-points",i="shape-radius",s=y1(e[r],r);if(!(i in e))throw new Error(`Expected a number for ${i}`);const o=n1(e,i,t),a="number"==typeof e[i]?e[i]:5,l="shape-radius2",c=n1(e,l,t),u="number"==typeof e[l]?e[l]:void 0,h=Q0(e,n,t),d=e1(e,n,t),p=c1(e,"shape-scale",t),f=a1(e,"shape-displacement",t),g=n1(e,"shape-rotation",t),m=i1(e,"shape-rotate-with-view",t),y=u1(e,"shape-angle"),v=f1(e,"shape-declutter-mode"),b=new j0({points:s,radius:a,radius2:u,angle:y,declutterMode:v});return function(e){return o&&b.setRadius(o(e)),c&&b.setRadius2(c(e)),h&&b.setFill(h(e)),d&&b.setStroke(d(e)),f&&b.setDisplacement(f(e)),g&&b.setRotation(g(e)),m&&b.setRotateWithView(m(e)),p&&b.setScale(p(e)),b}}(e,t):"circle-radius"in e?function(e,t){const n="circle-",r=Q0(e,n,t),i=e1(e,n,t),s=n1(e,"circle-radius",t),o=c1(e,"circle-scale",t),a=a1(e,"circle-displacement",t),l=n1(e,"circle-rotation",t),c=i1(e,"circle-rotate-with-view",t),u=f1(e,"circle-declutter-mode"),h=new U0({radius:5,declutterMode:u});return function(e){return s&&h.setRadius(s(e)),r&&h.setFill(r(e)),i&&h.setStroke(i(e)),a&&h.setDisplacement(a(e)),l&&h.setRotation(l(e)),c&&h.setRotateWithView(c(e)),o&&h.setScale(o(e)),h}}(e,t):null}(e,t),o=n1(e,"z-index",t);if(!(n||r||i||s||XW(e)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(e));const a=new W0;return function(e){let t=!0;if(n){const r=n(e);r&&(t=!1),a.setFill(r)}if(r){const n=r(e);n&&(t=!1),a.setStroke(n)}if(i){const n=i(e);n&&(t=!1),a.setText(n)}if(s){const n=s(e);n&&(t=!1),a.setImage(n)}return o&&a.setZIndex(o(e)),t?null:a}}function Q0(e,t,n){let r;if(t+"fill-pattern-src"in e)r=function(e,t,n){const r=r1(e,t+"pattern-src",n),i=l1(e,t+"pattern-offset",n),s=l1(e,t+"pattern-size",n),o=s1(e,t+"color",n);return function(e){return{src:r(e),offset:i&&i(e),size:s&&s(e),color:o&&o(e)}}}(e,t+"fill-",n);else{if("none"===e[t+"fill-color"])return()=>null;r=s1(e,t+"fill-color",n)}if(!r)return null;const i=new B0;return function(e){const t=r(e);return t===wJ?null:(i.setColor(t),i)}}function e1(e,t,n){const r=n1(e,t+"stroke-width",n),i=s1(e,t+"stroke-color",n);if(!r&&!i)return null;const s=r1(e,t+"stroke-line-cap",n),o=r1(e,t+"stroke-line-join",n),a=o1(e,t+"stroke-line-dash",n),l=n1(e,t+"stroke-line-dash-offset",n),c=n1(e,t+"stroke-miter-limit",n),u=n1(e,t+"stroke-offset",n),h=new V0;return function(e){if(i){const t=i(e);if(t===wJ)return null;h.setColor(t)}if(r&&h.setWidth(r(e)),s){const t=s(e);if("butt"!==t&&"round"!==t&&"square"!==t)throw new Error("Expected butt, round, or square line cap");h.setLineCap(t)}if(o){const t=o(e);if("bevel"!==t&&"round"!==t&&"miter"!==t)throw new Error("Expected bevel, round, or miter line join");h.setLineJoin(t)}return a&&h.setLineDash(a(e)),l&&h.setLineDashOffset(l(e)),c&&h.setMiterLimit(c(e)),u&&h.setOffset(u(e)),h}}function t1(e,t){if(!(t in e))return;const n=e[t];return void 0===n?void 0:n}function n1(e,t,n){const r=t1(e,t);if(void 0===r)return;const i=c0(r,qJ,n);return function(e){return y1(i(e),t)}}function r1(e,t,n){const r=t1(e,t);if(void 0===r)return null;const i=c0(r,VJ,n);return function(e){return m1(i(e),t)}}function i1(e,t,n){const r=t1(e,t);if(void 0===r)return null;const i=c0(r,$J,n);return function(e){const n=i(e);if("boolean"!=typeof n)throw new Error(`Expected a boolean for ${t}`);return n}}function s1(e,t,n){const r=t1(e,t);if(void 0===r)return null;const i=c0(r,WJ,n);return function(e){return v1(i(e),t)}}function o1(e,t,n){const r=t1(e,t);if(void 0===r)return null;if(Array.isArray(r)&&(0===r.length||"string"!=typeof r[0])){const e=r.map((e,r)=>{if("number"==typeof e)return()=>e;const i=c0(e,qJ,n);return function(e){return y1(i(e),`${t}[${r}]`)}});return function(t){const n=new Array(e.length);for(let r=0;r<e.length;++r)n[r]=e[r](t);return n}}const i=c0(r,HJ,n);return function(e){return g1(i(e),t)}}function a1(e,t,n){const r=t1(e,t);if(void 0===r)return null;const i=c0(r,HJ,n);return function(e){const n=g1(i(e),t);if(2!==n.length)throw new Error(`Expected two numbers for ${t}`);return n}}function l1(e,t,n){const r=t1(e,t);if(void 0===r)return null;const i=c0(r,HJ,n);return function(e){return b1(i(e),t)}}function c1(e,t,n){const r=t1(e,t);if(void 0===r)return null;const i=c0(r,HJ|qJ,n);return function(e){return"number"==typeof(n=i(e))?n:b1(n,t);var n}}function u1(e,t){const n=e[t];if(void 0!==n){if("number"!=typeof n)throw new Error(`Expected a number for ${t}`);return n}}function h1(e,t){const n=e[t];if(void 0!==n){if("number"==typeof n)return UJ(n);if(!Array.isArray(n))throw new Error(`Expected a number or size array for ${t}`);if(2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])throw new Error(`Expected a number or size array for ${t}`);return n}}function d1(e,t){const n=e[t];if(void 0!==n){if("bottom-left"!==n&&"bottom-right"!==n&&"top-left"!==n&&"top-right"!==n)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return n}}function p1(e,t){const n=e[t];if(void 0!==n){if("pixels"!==n&&"fraction"!==n)throw new Error(`Expected pixels or fraction for ${t}`);return n}}function f1(e,t){const n=e[t];if(void 0!==n){if("string"!=typeof n)throw new Error(`Expected a string for ${t}`);if("declutter"!==n&&"obstacle"!==n&&"none"!==n)throw new Error(`Expected declutter, obstacle, or none for ${t}`);return n}}function g1(e,t){if(!Array.isArray(e))throw new Error(`Expected an array for ${t}`);const n=e.length;for(let r=0;r<n;++r)if("number"!=typeof e[r])throw new Error(`Expected an array of numbers for ${t}`);return e}function m1(e,t){if("string"!=typeof e)throw new Error(`Expected a string for ${t}`);return e}function y1(e,t){if("number"!=typeof e)throw new Error(`Expected a number for ${t}`);return e}function v1(e,t){if("string"==typeof e)return e;const n=g1(e,t),r=n.length;if(r<3||r>4)throw new Error(`Expected a color with 3 or 4 values for ${t}`);return n}function b1(e,t){const n=g1(e,t);if(2!==n.length)throw new Error(`Expected an array of two numbers for ${t}`);return n}var w1="renderOrder",_1=class extends QX{constructor(e){e=e||{};const t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=void 0!==e.renderBuffer?e.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=void 0!==e.updateWhileAnimating&&e.updateWhileAnimating,this.updateWhileInteracting_=void 0!==e.updateWhileInteracting&&e.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(w1)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){const n=this.getDeclutter();n in e.declutter==0&&(e.declutter[n]=new iJ(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(w1,e)}setStyle(e){this.style_=void 0===e?G0:e;const t=function(e){if(void 0===e)return G0;if(!e)return null;if("function"==typeof e)return e;if(e instanceof W0)return e;if(Array.isArray(e)&&0===e.length)return[];if(Array.isArray(e)&&e[0]instanceof W0){const t=e.length,n=new Array(t);for(let r=0;r<t;++r){const t=e[r];if(!(t instanceof W0))throw new Error("Expected a list of style instances");n[r]=t}return n}return function(e,t){if(t=t??rQ(),!Array.isArray(e))return X0([e],t);const n=e.length;if("style"in e[0]){const r=new Array(n);for(let t=0;t<n;++t){const n=e[t];if(!("style"in n))throw new Error("Expected a list of rules with a style property");r[t]=n}return function(e,t){const n=function(e,t){const n=e.length,r=new Array(n);for(let i=0;i<n;++i){const n=e[i],s="filter"in n?c0(n.filter,$J,t):Y0;let o;if(Array.isArray(n.style)){const e=n.style.length;o=new Array(e);for(let r=0;r<e;++r)o[r]=J0(n.style[r],t)}else o=[J0(n.style,t)];r[i]={filter:s,styles:o}}return function(t){const i=[];let s=!1;for(let o=0;o<n;++o)if((0,r[o].filter)(t)&&(!e[o].else||!s)){s=!0;for(const e of r[o].styles){const n=e(t);n&&i.push(n)}}return i}}(e,t=t??rQ()),r={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(e,i){if(r.properties=e.getPropertiesInternal(),r.resolution=i,t.featureId){const t=e.getId();r.featureId=void 0!==t?t:null}return t.geometryType&&(r.geometryType=l0(e.getGeometry())),n(r)}}(r,t)}return X0(e,t)}(e)}(e);this.styleFunction_=null===e?void 0:function(e){let t;if("function"==typeof e)t=e;else{let n;Array.isArray(e)?n=e:(XH("function"==typeof e.getZIndex,"Expected an `Style` or an array of `Style`"),n=[e]),t=function(){return n}}return t}(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}},x1=class extends wH{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},C1=class extends lH{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){CH()}calculateMatrices2D(e){const t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;RZ(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),TZ(r,n)}forEachFeatureAtCoordinate(e,t,n,r,i,s,o,a){let l;const c=t.viewState;function u(e,t,n,r){return i.call(s,t,e?n:null,r)}const h=c.projection,d=eK(e.slice(),h),p=[[0,0]];if(h.canWrapX()&&r){const e=WG(h.getExtent());p.push([-e,0],[e,0])}const f=t.layerStatesArray,g=f.length,m=[],y=[];for(let b=0;b<p.length;b++)for(let r=g-1;r>=0;--r){const i=f[r],s=i.layer;if(s.hasRenderer()&&eJ(i,c)&&o.call(a,s)){const r=s.getRenderer(),o=s.getSource();if(r&&o){const s=o.getWrapX()?d:e,a=u.bind(null,i.managed);y[0]=s[0]+p[b][0],y[1]=s[1]+p[b][1],l=r.forEachFeatureAtCoordinate(y,t,n,a,m)}if(l)return l}}if(0===m.length)return;const v=1/m.length;return m.forEach((e,t)=>e.distanceSq+=t*v),m.sort((e,t)=>e.distanceSq-t.distanceSq),m.some(e=>l=e.callback(e.feature,e.layer,e.geometry)),l}hasFeatureAtCoordinate(e,t,n,r,i,s){return void 0!==this.forEachFeatureAtCoordinate(e,t,n,r,gH,this,i,s)}getMap(){return this.map_}renderFrame(e){CH()}scheduleExpireIconCache(e){g0.canExpireCache()&&e.postRenderFunctions.push(S1)}};function S1(){g0.expire()}var k1=class extends C1{constructor(e){super(e),this.fontChangeListenerKey_=JW(T0,ZW,e.redrawText,e),this.element_=zH?KY():document.createElement("div");const t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=OY+" ol-layers";const n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){const n=this.getMap();if(n.hasListener(e)){const r=new x1(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){eH(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(e),this.dispatchRenderEvent(XX,e);const t=e.layerStatesArray.sort((e,t)=>e.zIndex-t.zIndex);t.some(e=>e.layer instanceof _1&&e.layer.getDeclutter())&&(e.declutter={});const n=e.viewState;this.children_.length=0;const r=this.getMap().getTargetElement();let i;ZY(r)&&(i=r.getContext("2d"),i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,r.width,r.height));const s=[];let o=i?r:null;for(let a=0,l=t.length;a<l;++a){const r=t[a];e.layerIndex=a;const i=r.layer,l=i.getSourceState();if(!eJ(r,n)||"ready"!=l&&"undefined"!=l){i.unrender();continue}const c=i.render(e,o);c&&(c!==o&&(this.children_.push(c),o=c),s.push(r))}this.declutter(e,s),function(e,t){const n=e.childNodes;for(let r=0;;++r){const i=n[r],s=t[r];if(!i&&!s)break;i!==s&&(i?s?e.insertBefore(s,i):(e.removeChild(i),--r):e.appendChild(s))}}(this.element_,this.children_);for(const a of i?this.children_:[]){const e=a.firstElementChild||a,t=a.style.backgroundColor;if(t&&(!ZY(e)||e.width>0)&&(i.fillStyle=t,i.fillRect(0,0,i.canvas.width,i.canvas.height)),!ZY(e)||0===e.width)continue;i.save();const n=a.style.opacity||e.style.opacity;i.globalAlpha=""===n?1:Number(n);const r=e.style.transform;if(r)i.transform(...IZ(r));else{const t=parseFloat(e.style.width)/e.width,n=parseFloat(e.style.height)/e.height;i.transform(t,0,0,n,0,0)}i.drawImage(e,0,0),i.restore()}this.dispatchRenderEvent("postcompose",e),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){const r=t[n],i=r.layer;i.getDeclutter()&&i.renderDeclutter(e,r)}t.forEach(t=>t.layer.renderDeferred(e))}}};function E1(e){e instanceof QX?e.setMapInternal(null):e instanceof KX&&e.getLayers().forEach(E1)}function R1(e,t){if(e instanceof QX)e.setMapInternal(t);else if(e instanceof KX){const n=e.getLayers().getArray();for(let e=0,r=n.length;e<r;++e)R1(n[e],t)}}var T1=class extends RH{constructor(e){super(),e=e||{},this.on,this.once,this.un;const t=function(e){let t=null;void 0!==e.keyboardEventTarget&&(t="string"==typeof e.keyboardEventTarget?document.getElementById(e.keyboardEventTarget):e.keyboardEventTarget);const n={},r=e.layers&&"function"==typeof e.layers.getLayers?e.layers:new KX({layers:e.layers});let i,s,o;return n[GH]=r,n[ZH]=e.target,n[YH]=e.view instanceof TY?e.view:new TY,void 0!==e.controls&&(Array.isArray(e.controls)?i=new IH(e.controls.slice()):(XH("function"==typeof e.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),i=e.controls)),void 0!==e.interactions&&(Array.isArray(e.interactions)?s=new IH(e.interactions.slice()):(XH("function"==typeof e.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),s=e.interactions)),void 0!==e.overlays?Array.isArray(e.overlays)?o=new IH(e.overlays.slice()):(XH("function"==typeof e.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=e.overlays):o=new IH,{controls:i,interactions:s,keyboardEventTarget:t,overlays:o,values:n}}(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=void 0!==e.maxTilesLoading?e.maxTilesLoading:16,this.pixelRatio_=void 0!==e.pixelRatio?e.pixelRatio:DH,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=_Z(),this.pixelToCoordinateTransform_=_Z(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,zH||(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_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,zH||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(zH?new IH:eX()),this.interactions=t.interactions||(zH?new IH:AX({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new eG(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(GH,this.handleLayerGroupChanged_),this.addChangeListener(YH,this.handleViewChanged_),this.addChangeListener(KH,this.handleSizeChanged_),this.addChangeListener(ZH,this.handleTargetChanged_),this.setProperties(t.values);const n=this;!e.view||e.view instanceof TY||e.view.then(function(e){n.setView(new TY(e))}),this.controls.addEventListener(GW,e=>{e.element.setMap(this)}),this.controls.addEventListener(KW,e=>{e.element.setMap(null)}),this.interactions.addEventListener(GW,e=>{e.element.setMap(this)}),this.interactions.addEventListener(KW,e=>{e.element.setMap(null)}),this.overlays_.addEventListener(GW,e=>{this.addOverlayInternal_(e.element)}),this.overlays_.addEventListener(KW,e=>{const t=e.element.getId();void 0!==t&&delete this.overlayIdIndex_[t.toString()],e.element.setMap(null)}),this.controls.forEach(e=>{e.setMap(this)}),this.interactions.forEach(e=>{e.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){R1(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){const t=e.getId();void 0!==t&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;const r=this.getCoordinateFromPixelInternal(e),i=void 0!==(n=void 0!==n?n:{}).hitTolerance?n.hitTolerance:0,s=void 0!==n.layerFilter?n.layerFilter:gH,o=!1!==n.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,i,o,t,null,s,null)}getFeaturesAtPixel(e,t){const n=[];return this.forEachFeatureAtPixel(e,function(e){n.push(e)},t),n}getAllLayers(){const e=[];return function t(n){n.forEach(function(n){n instanceof KX?t(n.getLayers()):e.push(n)})}(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;const n=this.getCoordinateFromPixelInternal(e),r=void 0!==(t=void 0!==t?t:{}).layerFilter?t.layerFilter:gH,i=void 0!==t.hitTolerance?t.hitTolerance:0,s=!1!==t.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,i,s,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){const t=this.viewport_.getBoundingClientRect(),n=this.getSize(),r=t.width/n[0],i=t.height/n[1],s="changedTouches"in e?e.changedTouches[0]:e;return[(s.clientX-t.left)/r,(s.clientY-t.top)/i]}getTarget(){return this.get(ZH)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return mZ(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){const t=this.frameState_;return t?kZ(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){const t=this.overlayIdIndex_[e.toString()];return void 0!==t?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(GH)}setLayers(e){const t=this.getLayerGroup();if(e instanceof IH)return void t.setLayers(e);const n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){const n=e[t];if(!n.visible)continue;const r=n.layer.getRenderer();if(r&&!r.ready)return!0;const i=n.layer.getSource();if(i&&i.loading)return!0}return!1}getPixelFromCoordinate(e){const t=yZ(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){const t=this.frameState_;return t?kZ(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(KH)}getView(){return this.get(YH)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,r){return function(e,t,n,r,i){if(!e||!(n in e.wantedTiles))return JH;if(!e.wantedTiles[n][t.getKey()])return JH;const s=e.viewState.center,o=r[0]-s[0],a=r[1]-s[1];return 65536*Math.log(i)+Math.sqrt(o*o+a*a)/i}(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;const n=new MH(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;const t=e.originalEvent,n=t.type;if(n===$H||n===aH||n===iH){const e=this.getOwnerDocument(),n=this.viewport_.getRootNode?this.viewport_.getRootNode():e,r=t.target,i=n instanceof ShadowRoot?n.host===r?n.host.ownerDocument:n:n===e?e.documentElement:n;if(this.overlayContainerStopEvent_.contains(r)||!i.contains(r))return}if(e.frameState=this.frameState_,!1!==this.dispatchEvent(e)){const t=this.getInteractions().getArray().slice();for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.getMap()===this&&r.getActive()&&this.getTargetElement()&&(!r.handleEvent(e)||e.propagationStopped))break}}}handlePostRender(){const e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let n=this.maxTilesLoading_,r=n;const i=e?e.viewHints:void 0,s=!!i&&(i[0]||i[1]);if(s){const t=Date.now()-e.time>8;n=t?0:8,r=t?0:2}t.getTilesLoading()<n&&(s&&t.reprioritize(),t.loadMoreTiles(n,r))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(JX)&&this.renderer_.dispatchRenderEvent(JX,e),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new PH(HH,this,e)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new PH(WH,this,e))));const n=this.postRenderFunctions_;if(e)for(let r=0,i=n.length;r<i;++r)n[r](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let e=0,t=this.targetChangeHandlerKeys_.length;e<t;++e)eH(this.targetChangeHandlerKeys_[e]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(nH,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(aH,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!ZY(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 e=this.getTarget(),t="string"==typeof e?document.getElementById(e):e;if(this.targetElement_=t,t){if(ZY(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new k1(this)),!ZY(t)){this.mapBrowserEventHandler_=new qH(this,this.moveTolerance_);for(const t in AH)this.mapBrowserEventHandler_.addEventListener(AH[t],this.handleMapBrowserEvent.bind(this));let e;if(this.viewport_.addEventListener(nH,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(aH,this.boundHandleBrowserEvent_,!!BH&&{passive:!1}),this.keyboardEventTarget_)e=this.keyboardEventTarget_;else{const n=t.getRootNode();e=n instanceof ShadowRoot?n.host:t}if(this.targetChangeHandlerKeys_=[JW(e,iH,this.handleBrowserEvent,this),JW(e,sH,this.handleBrowserEvent,this)],!ZY(t)){const e=t.getRootNode();e instanceof ShadowRoot&&this.resizeObserver_.observe(e.host),this.resizeObserver_?.observe(t)}}this.updateSize()}else 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)}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(eH(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(eH(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=JW(e,ZW,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=JW(e,tH,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(eH),this.layerGroupPropertyListenerKeys_=null);const e=this.getLayerGroup();e&&(this.handleLayerAdd_(new HX("addlayer",e)),this.layerGroupPropertyListenerKeys_=[JW(e,ZW,this.render,this),JW(e,tH,this.render,this),JW(e,"addlayer",this.handleLayerAdd_,this),JW(e,"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(){if(!this.frameState_)return;const e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){const n=e[t].layer;n.hasRenderer()&&n.getRenderer().handleFontsChanged()}}render(){this.renderer_&&void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){E1(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){const t=this.getSize(),n=this.getView(),r=this.frameState_;let i=null;if(void 0!==t&&jJ(t)&&n&&n.isDef()){const r=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),s=n.getState();if(i={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:zG(s.center,s.resolution,s.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:s,viewHints:r,wantedTiles:{},mapId:kH(this),renderTargets:{}},s.nextCenter&&s.nextResolution){const e=isNaN(s.nextRotation)?s.rotation:s.nextRotation;i.nextExtent=zG(s.nextCenter,s.nextResolution,e,t)}}this.frameState_=i,this.renderer_.renderFrame(i),i&&(i.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,i.postRenderFunctions),r&&(this.previousExtent_&&(GG(this.previousExtent_)||RG(i.extent,this.previousExtent_))||(this.dispatchEvent(new PH("movestart",this,r)),this.previousExtent_=SG(this.previousExtent_))),!this.previousExtent_||i.viewHints[0]||i.viewHints[1]||RG(i.extent,this.previousExtent_)||(this.dispatchEvent(new PH("moveend",this,i)),yG(i.extent,this.previousExtent_))),this.dispatchEvent(new PH(VH,this,i)),this.renderComplete_=(this.hasListener(WH)||this.hasListener(HH)||this.hasListener(JX))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){const t=this.getLayerGroup();t&&this.handleLayerRemove_(new HX("removelayer",t)),this.set(GH,e)}setSize(e){this.set(KH,e)}setTarget(e){this.set(ZH,e)}setView(e){if(!e||e instanceof TY)return void this.set(YH,e);this.set(YH,new TY);const t=this;e.then(function(e){t.setView(new TY(e))})}updateSize(){const e=this.getTargetElement();let t;if(e){let n,r;if(ZY(e)){const t=e.getContext("2d").getTransform();n=e.width/t.a,r=e.height/t.d}else{const t=getComputedStyle(e);n=e.offsetWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderRightWidth),r=e.offsetHeight-parseFloat(t.borderTopWidth)-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)-parseFloat(t.borderBottomWidth)}isNaN(n)||isNaN(r)||(t=[Math.max(0,n),Math.max(0,r)],!jJ(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&aK("No map visible because the map container's width or height are 0."))}const n=this.getSize();!t||n&&fH(t,n)||(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){const t=this.getView();t&&t.setViewportSize(e)}},L1="element",I1="map",P1="offset",M1="position",A1="positioning",O1=class extends RH{constructor(e){super(),this.on,this.once,this.un,this.options=e,this.id=e.id,this.insertFirst=void 0===e.insertFirst||e.insertFirst,this.stopEvent=void 0===e.stopEvent||e.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==e.className?e.className:"ol-overlay-container ol-selectable",this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===e.autoPan?{}:e.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(L1,this.handleElementChanged),this.addChangeListener(I1,this.handleMapChanged),this.addChangeListener(P1,this.handleOffsetChanged),this.addChangeListener(M1,this.handlePositionChanged),this.addChangeListener(A1,this.handlePositioningChanged),void 0!==e.element&&this.setElement(e.element),this.setOffset(void 0!==e.offset?e.offset:[0,0]),this.setPositioning(e.positioning||"top-left"),void 0!==e.position&&this.setPosition(e.position)}getElement(){return this.get(L1)}getId(){return this.id}getMap(){return this.get(I1)||null}getOffset(){return this.get(P1)}getPosition(){return this.get(M1)}getPositioning(){return this.get(A1)}handleElementChanged(){GY(this.element);const e=this.getElement();e&&this.element.appendChild(e)}handleMapChanged(){this.mapPostrenderListenerKey&&(this.element?.remove(),eH(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const e=this.getMap();if(e){this.mapPostrenderListenerKey=JW(e,VH,this.render,this),this.updatePixelPosition();const t=this.stopEvent?e.getOverlayContainerStopEvent():e.getOverlayContainer();this.insertFirst?t.insertBefore(this.element,t.childNodes[0]||null):t.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(e){this.set(L1,e)}setMap(e){this.set(I1,e)}setOffset(e){this.set(P1,e)}setPosition(e){this.set(M1,e)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(e){const t=this.getMap();if(!t||!t.getTargetElement()||!this.get(M1))return;const n=this.getRect(t.getTargetElement(),t.getSize()),r=this.getElement(),i=this.getRect(r,[VY(r),WY(r)]),s=void 0===(e=e||{}).margin?20:e.margin;if(!wG(n,i)){const r=i[0]-n[0],o=n[2]-i[2],a=i[1]-n[1],l=n[3]-i[3],c=[0,0];if(r<0?c[0]=r-s:o<0&&(c[0]=Math.abs(o)+s),a<0?c[1]=a-s:l<0&&(c[1]=Math.abs(l)+s),0!==c[0]||0!==c[1]){const n=t.getView().getCenterInternal(),r=t.getPixelFromCoordinateInternal(n);if(!r)return;const i=[r[0]+c[0],r[1]+c[1]],s=e.animation||{};t.getView().animateInternal({center:t.getCoordinateFromPixelInternal(i),duration:s.duration,easing:s.easing})}}}getRect(e,t){const n=e.getBoundingClientRect(),r=n.left+window.pageXOffset,i=n.top+window.pageYOffset;return[r,i,r+t[0],i+t[1]]}setPositioning(e){this.set(A1,e)}setVisible(e){this.rendered.visible!==e&&(this.element.style.display=e?"":"none",this.rendered.visible=e)}updatePixelPosition(){const e=this.getMap(),t=this.getPosition();if(!e||!e.isRendered()||!t)return void this.setVisible(!1);const n=e.getPixelFromCoordinate(t),r=e.getSize();this.updateRenderedPosition(n,r)}updateRenderedPosition(e,t){const n=this.element.style,r=this.getOffset(),i=this.getPositioning();this.setVisible(!0);let s="0%",o="0%";"bottom-right"==i||"center-right"==i||"top-right"==i?s="-100%":"bottom-center"!=i&&"center-center"!=i&&"top-center"!=i||(s="-50%"),"bottom-left"==i||"bottom-center"==i||"bottom-right"==i?o="-100%":"center-left"!=i&&"center-center"!=i&&"center-right"!=i||(o="-50%");const a=`translate(${s}, ${o}) translate(${e[0]+r[0]}px, ${e[1]+r[1]}px)`;this.rendered.transform_!=a&&(this.rendered.transform_=a,n.transform=a)}getOptions(){return this.options}},N1=class e extends RH{constructor(e){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_),e)if("function"==typeof e.getSimplifiedGeometry){const t=e;this.setGeometry(t)}else{const t=e;this.setProperties(t)}}clone(){const t=new e,n=this.geometryName_;t.setGeometryName(n);const r=this.getPropertiesInternal();if(r){const e=this.getGeometry();for(const i in r)i===n&&e?t.set(i,e.clone()):t.set(i,r[i],!0)}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_&&(eH(this.geometryChangeKey_),this.geometryChangeKey_=null);const e=this.getGeometry();e&&(this.geometryChangeKey_=JW(e,tH,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?function(e){if("function"==typeof e)return e;let t;return Array.isArray(e)?t=e:(XH("function"==typeof e.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[e]),function(){return t}}(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){e!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function F1(e,t,n,r,i,s,o){let a,l;const c=(n-t)/r;if(1===c)a=t;else if(2===c)a=t,l=i;else if(0!==c){let s=e[t],o=e[t+1],c=0;const u=[0];for(let i=t+r;i<n;i+=r){const t=e[i],n=e[i+1];c+=Math.sqrt((t-s)*(t-s)+(n-o)*(n-o)),u.push(c),s=t,o=n}const h=i*c,d=function(e,t,n){let r,i;n=n||cH;let s=0,o=e.length,a=!1;for(;s<o;)r=s+(o-s>>1),i=+n(e[r],t),i<0?s=r+1:(o=r,a=!i);return a?s:~s}(u,h);d<0?(l=(h-u[-d-2])/(u[-d-1]-u[-d-2]),a=t+(-d-2)*r):a=t+d*r}o=o>1?o:2,s=s||new Array(o);for(let u=0;u<o;++u)s[u]=void 0===a?NaN:void 0===l?e[a+u]:lG(e[a+u],e[a+r+u],l);return s}function D1(e,t,n,r,i,s){if(n==t)return null;let o;if(i<e[t+r-1])return s?(o=e.slice(t,t+r),o[r-1]=i,o):null;if(e[n-1]<i)return s?(o=e.slice(n-r,n),o[r-1]=i,o):null;if(i==e[t+r-1])return e.slice(t,t+r);let a=t/r,l=n/r;for(;a<l;){const t=a+l>>1;i<e[(t+1)*r-1]?l=t:a=t+1}const c=e[a*r-1];if(i==c)return e.slice((a-1)*r,(a-1)*r+r);const u=(i-c)/(e[(a+1)*r-1]-c);o=[];for(let h=0;h<r-1;++h)o.push(lG(e[(a-1)*r+h],e[a*r+h],u));return o.push(i),o}function z1(e,t,n,r){let i=e[t],s=e[t+1],o=0;for(let a=t+r;a<n;a+=r){const t=e[a],n=e[a+1];o+=Math.sqrt((t-i)*(t-i)+(n-s)*(n-s)),i=t,s=n}return o}var j1=class e extends FZ{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===t||Array.isArray(e[0])?this.setCoordinates(e,t):this.setFlatCoordinates(t,e)}appendCoordinate(e){pH(this.flatCoordinates,e),this.changed()}clone(){const t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,n,r){return r<vG(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt($Z(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),VZ(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,r))}forEachSegment(e){return tY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(t=void 0!==t&&t,D1(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return ZZ(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return F1(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return z1(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 n=[];return n.length=sY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,n,0),new e(n,"XY")}getType(){return"LineString"}intersectsExtent(e){return nY(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=HZ(this.flatCoordinates,0,e,this.stride),this.changed()}},U1=class e extends FZ{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(void 0!==t&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{const t=e,n=[],r=[];for(let e=0,s=t.length;e<s;++e)pH(n,t[e].getFlatCoordinates()),r.push(n.length);const i=0===t.length?this.getLayout():t[0].getLayout();this.setFlatCoordinates(i,n),this.ends_=r}}appendLineString(e){pH(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(e,t,n,r){return r<vG(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(qZ(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),WZ(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,n,r))}getCoordinateAtM(e,t,n){return"XYM"!=this.layout&&"XYZM"!=this.layout||0===this.flatCoordinates.length?null:(t=void 0!==t&&t,n=void 0!==n&&n,function(e,t,n,r,i,s,o){if(o)return D1(e,t,n[n.length-1],r,i,s);let a;if(i<e[r-1])return s?(a=e.slice(0,r),a[r-1]=i,a):null;if(e[e.length-1]<i)return s?(a=e.slice(e.length-r),a[r-1]=i,a):null;for(let l=0,c=n.length;l<c;++l){const s=n[l];if(t!=s){if(i<e[t+r-1])return null;if(i<=e[s-1])return D1(e,t,s,r,i,!1);t=s}}return null}(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return YZ(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new j1(this.flatCoordinates.slice(0===e?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){const e=this.flatCoordinates,t=this.ends_,n=this.layout,r=[];let i=0;for(let s=0,o=t.length;s<o;++s){const o=t[s],a=new j1(e.slice(i,o),n);r.push(a),i=o}return r}getLength(){const e=this.ends_;let t=0,n=0;for(let r=0,i=e.length;r<i;++r)n+=z1(this.flatCoordinates,t,e[r],this.stride),t=e[r];return n}getFlatMidpoints(){const e=[],t=this.flatCoordinates;let n=0;const r=this.ends_,i=this.stride;for(let s=0,o=r.length;s<o;++s){const o=r[s];pH(e,F1(t,n,o,i,.5)),n=o}return e}getSimplifiedGeometryInternal(t){const n=[],r=[];return n.length=oY(this.flatCoordinates,0,this.ends_,this.stride,t,n,0,r),new e(n,"XY",r)}getType(){return"MultiLineString"}intersectsExtent(e){return function(e,t,n,r,i){for(let s=0,o=n.length;s<o;++s){if(nY(e,t,n[s],r,i))return!0;t=n[s]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);const n=GZ(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=0===n.length?0:n[n.length-1],this.changed()}},B1=class e extends FZ{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){pH(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){const t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,n,r){if(r<vG(this.getExtent(),e,t))return r;const i=this.flatCoordinates,s=this.stride;for(let o=0,a=i.length;o<a;o+=s){const a=iG(e,t,i[o],i[o+1]);if(a<r){r=a;for(let e=0;e<s;++e)n[e]=i[o+e];n.length=s}}return r}getCoordinates(){return ZZ(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){const t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new hY(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){const e=this.flatCoordinates,t=this.layout,n=this.stride,r=[];for(let i=0,s=e.length;i<s;i+=n){const s=new hY(e.slice(i,i+n),t);r.push(s)}return r}getType(){return"MultiPoint"}intersectsExtent(e){const t=this.flatCoordinates,n=this.stride;for(let r=0,i=t.length;r<i;r+=n)if(_G(e,t[r],t[r+1]))return!0;return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=HZ(this.flatCoordinates,0,e,this.stride),this.changed()}};function $1(e,t,n,r){const i=[];let s=[1/0,1/0,-1/0,-1/0];for(let o=0,a=n.length;o<a;++o){const a=n[o];s=EG(e,t,a[0],r),i.push((s[0]+s[2])/2,(s[1]+s[3])/2),t=a[a.length-1]}return i}var q1=class e extends FZ{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){const r=e,i=[],s=[];for(let e=0,t=r.length;e<t;++e){const t=r[e],n=i.length,o=t.getEnds();for(let e=0,r=o.length;e<r;++e)o[e]+=n;pH(i,t.getFlatCoordinates()),s.push(o)}t=0===r.length?this.getLayout():r[0].getLayout(),e=i,n=s}void 0!==t&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(this.flatCoordinates){const n=this.flatCoordinates.length;pH(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let e=0,r=t.length;e<r;++e)t[e]+=n}else this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();this.endss_.push(t),this.changed()}clone(){const t=this.endss_.length,n=new Array(t);for(let e=0;e<t;++e)n[e]=this.endss_[e].slice();const r=new e(this.flatCoordinates.slice(),this.layout,n);return r.applyProperties(this),r}closestPointXY(e,t,n,r){return r<vG(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(e,t,n,r,i){for(let s=0,o=n.length;s<o;++s){const o=n[s];i=qZ(e,t,o,r,i),t=o[o.length-1]}return i}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(e,t,n,r,i,s,o,a,l,c,u){u=u||[NaN,NaN];for(let h=0,d=n.length;h<d;++h){const s=n[h];c=WZ(e,t,s,r,i,!0,o,a,l,c,u),t=s[s.length-1]}return c}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,0,e,t,n,r))}containsXY(e,t){return function(e,t,n,r,i,s){if(0===n.length)return!1;for(let o=0,a=n.length;o<a;++o){const a=n[o];if(eY(e,t,a,r,i,s))return!0;t=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return function(e,t,n,r){let i=0;for(let s=0,o=n.length;s<o;++s){const o=n[s];i+=UZ(e,t,o,r),t=o[o.length-1]}return i}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return void 0!==e?(t=this.getOrientedFlatCoordinates().slice(),bY(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,XZ(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const e=$1(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=pY(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new B1(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const e=this.flatCoordinates;yY(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=bY(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const n=[],r=[];return n.length=function(e,t,n,r,i,s,o,a){for(let l=0,c=n.length;l<c;++l){const c=n[l],u=[];o=cY(e,t,c,r,i,s,o,u),a.push(u),t=c[c.length-1]}return o}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),n,0,r),new e(n,"XY",r)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(0===e)t=0;else{const n=this.endss_[e-1];t=n[n.length-1]}const n=this.endss_[e].slice(),r=n[n.length-1];if(0!==t)for(let i=0,s=n.length;i<s;++i)n[i]-=t;return new _Y(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){const e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[];let i=0;for(let s=0,o=n.length;s<o;++s){const o=n[s].slice(),a=o[o.length-1];if(0!==i)for(let e=0,t=o.length;e<t;++e)o[e]-=i;const l=new _Y(t.slice(i,a),e,o);r.push(l),i=a}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return function(e,t,n,r,i){for(let s=0,o=n.length;s<o;++s){const o=n[s];if(iY(e,t,o,r,i))return!0;t=o[o.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);const n=KZ(this.flatCoordinates,0,e,this.stride,this.endss_);if(0===n.length)this.flatCoordinates.length=0;else{const e=n[n.length-1];this.flatCoordinates.length=0===e.length?0:e[e.length-1]}this.changed()}},V1=class{drawCustom(e,t,n,r,i){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},W1=11,H1=[8],G1=[12],K1=[1],Z1=[3],Y1=class extends V1{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){const t=this.pixelRatio;return 1==t?e:e.map(function(e){return e*t})}appendFlatPointCoordinates(e,t){const n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,i=this.coordinates;let s=i.length;for(let o=0,a=e.length;o<a;o+=t)r[0]=e[o],r[1]=e[o+1],bG(n,r)&&(i[s++]=r[0],i[s++]=r[1]);return s}appendFlatLineCoordinates(e,t,n,r,i,s){const o=this.coordinates;let a=o.length;const l=this.getBufferedMaxExtent();s&&(t+=r);let c=e[t],u=e[t+1];const h=this.tmpCoordinate_;let d,p,f,g=!0;for(d=t+r;d<n;d+=r)h[0]=e[d],h[1]=e[d+1],f=xG(l,h),f!==p?(g&&(o[a++]=c,o[a++]=u,g=!1),o[a++]=h[0],o[a++]=h[1]):1===f?(o[a++]=h[0],o[a++]=h[1],g=!1):g=!0,c=h[0],u=h[1],p=f;return(i&&g||d===t+r)&&(o[a++]=c,o[a++]=u),a}drawCustomCoordinates_(e,t,n,r,i){for(let s=0,o=n.length;s<o;++s){const o=n[s],a=this.appendFlatLineCoordinates(e,t,o,r,!1,!1);i.push(a),t=o}return t}drawCustom(e,t,n,r,i){this.beginGeometry(e,t,i);const s=e.getType(),o=e.getStride(),a=this.coordinates.length;let l,c,u,h,d;switch(s){case"MultiPolygon":l=e.getOrientedFlatCoordinates(),h=[];const t=e.getEndss();d=0;for(let e=0,n=t.length;e<n;++e){const n=[];d=this.drawCustomCoordinates_(l,d,t[e],o,n),h.push(n)}this.instructions.push([4,a,h,e,n,XZ,i]),this.hitDetectionInstructions.push([4,a,h,e,r||n,XZ,i]);break;case"Polygon":case"MultiLineString":u=[],l="Polygon"==s?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),d=this.drawCustomCoordinates_(l,0,e.getEnds(),o,u),this.instructions.push([4,a,u,e,n,YZ,i]),this.hitDetectionInstructions.push([4,a,u,e,r||n,YZ,i]);break;case"LineString":case"Circle":l=e.getFlatCoordinates(),c=this.appendFlatLineCoordinates(l,0,l.length,o,!1,!1),this.instructions.push([4,a,c,e,n,ZZ,i]),this.hitDetectionInstructions.push([4,a,c,e,r||n,ZZ,i]);break;case"MultiPoint":l=e.getFlatCoordinates(),c=this.appendFlatPointCoordinates(l,o),c>a&&(this.instructions.push([4,a,c,e,n,ZZ,i]),this.hitDetectionInstructions.push([4,a,c,e,r||n,ZZ,i]));break;case"Point":l=e.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),c=this.coordinates.length,this.instructions.push([4,a,c,e,n,void 0,i]),this.hitDetectionInstructions.push([4,a,c,e,r||n,void 0,i])}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[0,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[0,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const e=this.hitDetectionInstructions;let t;e.reverse();const n=e.length;let r,i,s=-1;for(t=0;t<n;++t)r=e[t],i=r[0],7==i?s=t:0==i&&(r[2]=t,dH(this.hitDetectionInstructions,s,t),s=-1)}fillStyleToState(e,t={}){if(e){const n=e.getColor();t.fillPatternScale=n&&"object"==typeof n&&"src"in n?this.pixelRatio:1,t.fillStyle=b0(n||"#000")??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){const n=e.getColor();t.strokeStyle=b0(n||k0);const r=e.getLineCap();t.lineCap=void 0!==r?r:x0;const i=e.getLineDash();t.lineDash=i?i.slice():C0;const s=e.getLineDashOffset();t.lineDashOffset=s||0;const o=e.getLineJoin();t.lineJoin=void 0!==o?o:S0;const a=e.getWidth();t.lineWidth=void 0!==a?a:1;const l=e.getMiterLimit();t.miterLimit=void 0!==l?l:10,t.strokeOffset=e.getOffset()??0,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){const n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){const t=e.fillStyle,n=[10,t];return"string"!=typeof t&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[W1,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){const n=e.fillStyle;(void 0!==n&&"string"!=typeof n||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){const n=e.strokeStyle,r=e.lineCap,i=e.lineDash,s=e.lineDashOffset,o=e.lineJoin,a=e.lineWidth,l=e.miterLimit,c=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||i!=e.currentLineDash&&!fH(e.currentLineDash,i)||e.currentLineDashOffset!=s||e.currentLineJoin!=o||e.currentLineWidth!=a||e.currentMiterLimit!=l||e.currentStrokeOffset!=c)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=i,e.currentLineDashOffset=s,e.currentLineJoin=o,e.currentLineWidth=a,e.currentMiterLimit=l,e.currentStrokeOffset=c)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const t=[7,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=yG(this.maxExtent),this.maxLineWidth>0)){const e=this.resolution*(this.maxLineWidth+1)/2;mG(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},X1=class extends Y1{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r,i){const s=this.state,o=void 0!==s.fillStyle,a=void 0!==s.strokeStyle,l=n.length;this.instructions.push(K1),this.hitDetectionInstructions.push(K1);for(let c=0;c<l;++c){const s=n[c],o=this.coordinates.length,l=this.appendFlatLineCoordinates(e,t,s,r,!0,!a);this.instructions.push([9,o,l,i*this.pixelRatio,!0]),this.hitDetectionInstructions.push([9,o,l,i,!0]),a&&(this.instructions.push(Z1),this.hitDetectionInstructions.push(Z1)),t=s}return o&&(this.instructions.push(H1),this.hitDetectionInstructions.push(H1)),a&&(this.instructions.push(G1),this.hitDetectionInstructions.push(G1)),t}drawCircle(e,t,n){const r=this.state,i=r.fillStyle,s=r.strokeStyle,o=r.strokeOffset;if(void 0===i&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),void 0!==r.fillStyle&&this.hitDetectionInstructions.push([10,_0]),void 0!==r.strokeStyle&&this.hitDetectionInstructions.push([W1,k0,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,C0,0]);const a=e.getFlatCoordinates(),l=e.getStride(),c=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,l,!1,!1);const u=[2,c,o];this.instructions.push(K1,u),this.hitDetectionInstructions.push(K1,u),void 0!==r.fillStyle&&(this.instructions.push(H1),this.hitDetectionInstructions.push(H1)),void 0!==r.strokeStyle&&(this.instructions.push(G1),this.hitDetectionInstructions.push(G1)),this.endGeometry(t)}drawPolygon(e,t,n){const r=this.state,i=r.fillStyle,s=r.strokeStyle,o=r.strokeOffset;if(void 0===i&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),void 0!==r.fillStyle&&this.hitDetectionInstructions.push([10,_0]),void 0!==r.strokeStyle&&this.hitDetectionInstructions.push([W1,k0,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,C0,0]);const a=e.getEnds(),l=e.getOrientedFlatCoordinates(),c=e.getStride();this.drawFlatCoordinatess_(l,0,a,c,o),this.endGeometry(t)}drawMultiPolygon(e,t,n){const r=this.state,i=r.fillStyle,s=r.strokeStyle,o=r.strokeOffset;if(void 0===i&&void 0===s)return;if(this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),void 0!==r.fillStyle&&this.hitDetectionInstructions.push([10,_0]),void 0!==r.strokeStyle&&this.hitDetectionInstructions.push([W1,k0,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,C0,0]);const a=e.getEndss(),l=e.getOrientedFlatCoordinates(),c=e.getStride();let u=0;for(let h=0,d=a.length;h<d;++h)u=this.drawFlatCoordinatess_(l,u,a[h],c,o);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const e=this.tolerance;if(0!==e){const t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=aY(t[n],e)}return super.finish()}setFillStrokeStyles_(){const e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){const t=this.state,n=t.fillStyle,r=t.strokeStyle,i=t.strokeOffset;return Math.abs(i)>0&&void 0!==n&&void 0!==r&&(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=i,e(),t.fillStyle=n,!0)}},J1=0,Q1=1;function e2(e,t,n,r,i,s,o,a){const l=o-i,c=a-s;let u=0,h=1;if(0===l){if(i<e||i>n)return!1}else{let t=(e-i)/l,r=(n-i)/l;if(t>r){const e=t;t=r,r=e}if(t>u&&(u=t),r<h&&(h=r),u>h)return!1}if(0===c){if(s<t||s>r)return!1}else{let e=(t-s)/c,n=(r-s)/c;if(e>n){const t=e;e=n,n=t}if(e>u&&(u=e),n<h&&(h=n),u>h)return!1}return J1=u,Q1=h,!0}function t2(e,t,n,r,i){const s=[];let o=n,a=0,l=t.slice(n,2);for(;a<e&&o+i<r;){const[n,r]=l.slice(-2),c=t[o+i],u=t[o+i+1],h=Math.sqrt((c-n)*(c-n)+(u-r)*(u-r));if(a+=h,a>=e){const t=(e-a+h)/h,d=lG(n,c,t),p=lG(r,u,t);l.push(d,p),s.push(l),l=[d,p],a==e&&(o+=i),a=0}else if(a<e)l.push(t[o+i],t[o+i+1]),o+=i;else{const e=h-a,t=lG(n,c,e/h),d=lG(r,u,e/h);l.push(t,d),s.push(l),l=[t,d],a=0,o+=i}}return a>0&&s.push(l),s}function n2(e,t,n,r,i){let s,o,a,l,c,u,h,d,p,f,g=n,m=n,y=0,v=0,b=n;for(o=n;o<r;o+=i){const n=t[o],r=t[o+1];void 0!==c&&(p=n-c,f=r-u,l=Math.sqrt(p*p+f*f),void 0!==h&&(v+=a,s=Math.acos((h*p+d*f)/(a*l)),s>e&&(v>y&&(y=v,g=b,m=o),v=0,b=o-i)),a=l,h=p,d=f),c=n,u=r}return v+=l,v>y?[b,o]:[g,m]}var r2,i2={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},s2={Circle:X1,Default:Y1,Image:class extends Y1{constructor(e,t,n,r){super(e,t,n,r),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(e,t,n){if(!this.image_||this.maxExtent&&!bG(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);const r=e.getFlatCoordinates(),i=e.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(r,i);this.instructions.push([6,s,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([6,s,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(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);const r=e.getFlatCoordinates(),i=[];for(let a=0,l=r.length;a<l;a+=e.getStride())this.maxExtent&&!bG(this.maxExtent,r.slice(a,a+2))||i.push(r[a],r[a+1]);const s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,2);this.instructions.push([6,s,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([6,s,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(t)}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(e,t){const n=e.getAnchor(),r=e.getSize(),i=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=i[0],this.originY_=i[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},LineString:class extends Y1{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,i){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([9,s,o,i*this.pixelRatio]),this.hitDetectionInstructions.push([9,s,o,i]),n}drawLineString(e,t,n){const r=this.state,i=r.strokeStyle,s=r.lineWidth,o=r.strokeOffset;if(void 0===i||void 0===s)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([W1,k0,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,C0,0],K1);const a=e.getFlatCoordinates(),l=e.getStride();this.drawFlatCoordinates_(a,0,a.length,l,o),this.hitDetectionInstructions.push(G1),this.endGeometry(t)}drawMultiLineString(e,t,n){const r=this.state,i=r.strokeStyle,s=r.lineWidth,o=r.strokeOffset;if(void 0===i||void 0===s)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([W1,k0,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,C0,0],K1);const a=e.getEnds(),l=e.getFlatCoordinates(),c=e.getStride();let u=0;for(let h=0,d=a.length;h<d;++h)u=this.drawFlatCoordinates_(l,u,a[h],c,o);this.hitDetectionInstructions.push(G1),this.endGeometry(t)}finish(){const e=this.state;return null!=e.lastStroke&&e.lastStroke!=this.coordinates.length&&this.instructions.push(G1),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){null!=e.lastStroke&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(G1),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(K1)}},Polygon:X1,Text:class extends Y1{constructor(e,t,n,r){super(e,t,n,r),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[_0]={fillStyle:_0},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){const r=this.textFillState_,i=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!r&&!i)return;const o=this.coordinates;let a=o.length;const l=e.getType();let c=null,u=e.getStride();if("line"!==s.placement||"LineString"!=l&&"MultiLineString"!=l&&"Polygon"!=l&&"MultiPolygon"!=l){let r=s.overflow?null:[];switch(l){case"Point":case"MultiPoint":c=e.getFlatCoordinates();break;case"LineString":c=e.getFlatMidpoint();break;case"Circle":c=e.getCenter();break;case"MultiLineString":c=e.getFlatMidpoints(),u=2;break;case"Polygon":c=e.getFlatInteriorPoint(),s.overflow||r.push(c[2]/this.resolution),u=3;break;case"MultiPolygon":const t=e.getFlatInteriorPoints();c=[];for(let e=0,n=t.length;e<n;e+=3)s.overflow||r.push(t[e+2]/this.resolution),c.push(t[e],t[e+1]);if(0===c.length)return;u=2}const i=this.appendFlatPointCoordinates(c,u);if(i===a)return;if(r&&(i-a)/2!==c.length/u){let e=a/2;r=r.filter((t,n)=>{const r=o[2*(e+n)]===c[n*u]&&o[2*(e+n)+1]===c[n*u+1];return r||--e,r})}this.saveTextStates_();const h=s.backgroundFill?this.createFill(this.fillStyleToState(s.backgroundFill)):null,d=s.backgroundStroke?this.createStroke(this.strokeStyleToState(s.backgroundStroke)):null;this.beginGeometry(e,t,n);let p=s.padding;if(p!=R0&&(s.scale[0]<0||s.scale[1]<0)){let e=s.padding[0],t=s.padding[1],n=s.padding[2],r=s.padding[3];s.scale[0]<0&&(t=-t,r=-r),s.scale[1]<0&&(e=-e,n=-n),p=[e,t,n,r]}const f=this.pixelRatio;this.instructions.push([6,a,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,p==R0?R0:p.map(function(e){return e*f}),h,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]);const g=1/f,m=h?h.slice(0):null;m&&(m[1]=_0),this.hitDetectionInstructions.push([6,a,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[g,g],NaN,this.declutterMode_,this.declutterImageWithText_,p,m,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?_0:this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]),this.endGeometry(t)}else{const r=e.getExtent();if(!HG(this.maxExtent,r))return;let i;if(c=e.getFlatCoordinates(),"LineString"==l)i=[c.length];else if("MultiLineString"==l)i=e.getEnds();else if("Polygon"==l)i=e.getEnds().slice(0,1);else if("MultiPolygon"==l){const t=e.getEndss();i=[];for(let e=0,n=t.length;e<n;++e)i.push(t[e][0])}if(("LineString"==l||"MultiLineString"==l)&&!wG(this.getBufferedMaxExtent(),r)){const e=function(e,t,n,r){const i=r[0],s=r[1],o=r[2],a=r[3],l=[],c=[];let u,h,d=!1,p=0;for(let f=0,g=t.length;f<g;++f){const r=t[f];let g=e[p],m=e[p+1],y=!1;for(let t=p+n;t<r;t+=n){const n=e[t],r=e[t+1];if(e2(i,s,o,a,g,m,n,r)){const e=n-g,t=r-m,i=g+J1*e,s=m+J1*t,o=g+Q1*e,a=m+Q1*t;d&&y&&i===u&&s===h?l.push(o,a):(d&&c.push(l.length),l.push(i,s,o,a),d=!0),u=o,h=a,y=!0}g=n,m=r}p=r}return d&&c.push(l.length),{flatCoordinates:l,ends:c}}(c,i,u,this.getBufferedMaxExtent());if(c=e.flatCoordinates,i=e.ends,u=2,0===i.length)return}this.beginGeometry(e,t,n);const h=s.repeat,d=h?void 0:s.textAlign;let p=0;for(let e=0,t=i.length;e<t;++e){let t;t=h?t2(h*this.resolution,c,p,i[e],u):[c.slice(p,i[e])];for(let n=0,r=t.length;n<r;++n){const r=t[n];let l=0,c=r.length;if(null==d){const e=n2(s.maxAngle,r,0,r.length,2);l=e[0],c=e[1]}for(let e=l;e<c;e+=u)o.push(r[e],r[e+1]);const h=o.length;p=i[e],this.drawChars_(a,h),a=h}}this.endGeometry(t)}}saveTextStates_(){const e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));const i=this.textKey_;i in this.textStates||(this.textStates[i]={font:t.font,textAlign:t.textAlign||"center",justify:t.justify,textBaseline:t.textBaseline||"middle",scale:t.scale});const s=this.fillKey_;n&&(s in this.fillStates||(this.fillStates[s]={fillStyle:n.fillStyle}))}drawChars_(e,t){const n=this.textStrokeState_,r=this.textState_,i=this.strokeKey_,s=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,l=i2[r.textBaseline],c=this.textOffsetX_*a,u=this.textOffsetY_*a,h=this.text_,d=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([5,e,t,l,r.overflow,o,r.maxAngle,a,u,i,d*a,h,s,1,this.declutterMode_,this.textKeepUpright_,c]),this.hitDetectionInstructions.push([5,e,t,l,r.overflow,o?_0:o,r.maxAngle,a,u,i,d*a,h,s,1/a,this.declutterMode_,this.textKeepUpright_,c])}setTextStyle(e,t){let n,r,i;if(e){const t=e.getFill();t?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=b0(t.getColor()||"#000")):(r=null,this.textFillState_=r);const s=e.getStroke();if(s){i=this.textStrokeState_,i||(i={},this.textStrokeState_=i);const e=s.getLineDash(),t=s.getLineDashOffset(),n=s.getWidth(),r=s.getMiterLimit();i.lineCap=s.getLineCap()||"round",i.lineDash=e?e.slice():C0,i.lineDashOffset=void 0===t?0:t,i.lineJoin=s.getLineJoin()||"round",i.lineWidth=void 0===n?1:n,i.miterLimit=void 0===r?10:r,i.strokeStyle=b0(s.getColor()||"#000")}else i=null,this.textStrokeState_=i;n=this.textState_;const o=e.getFont()||"10px sans-serif";A0(o);const a=e.getScaleArray();n.overflow=e.getOverflow(),n.font=o,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||"middle",n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||R0,n.scale=void 0===a?[1,1]:a;const l=e.getOffsetX(),c=e.getOffsetY(),u=e.getRotateWithView(),h=e.getKeepUpright(),d=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=void 0===l?0:l,this.textOffsetY_=void 0===c?0:c,this.textRotateWithView_=void 0!==u&&u,this.textKeepUpright_=void 0===h||h,this.textRotation_=void 0===d?0:d,this.strokeKey_=i?("string"==typeof i.strokeStyle?i.strokeStyle:kH(i.strokeStyle))+i.lineCap+i.lineDashOffset+"|"+i.lineWidth+i.lineJoin+i.miterLimit+"["+i.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?"string"==typeof r.fillStyle?r.fillStyle:"|"+kH(r.fillStyle):""}else this.text_="";this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}},o2=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){const e={};for(const t in this.buildersByZIndex_){e[t]=e[t]||{};const n=this.buildersByZIndex_[t];for(const r in n){const i=n[r].finish();e[t][r]=i}}return e}getBuilder(e,t){const n=void 0!==e?e.toString():"0";let r=this.buildersByZIndex_[n];void 0===r&&(r={},this.buildersByZIndex_[n]=r);let i=r[t];return void 0===i&&(i=new(0,s2[t])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=i),i}};function a2(e,t,n,r,i,s,o,a){o=o??[],a=a??r;const l=e[t+r],c=e[t+r+1],u=e[n-2*r],h=e[n-2*r+1];let d,p,f,g,m,y,v,b,w=0;for(let _=t;_<n;_+=r){f=d,g=p,m=void 0,y=void 0,_+r<n&&(m=e[_+r],y=e[_+r+1]),s&&_===t&&(f=u,g=h),s&&_===n-r&&(m=l,y=c),d=e[_],p=e[_+1],[v,b]=l2(d,p,f,g,m,y,i),o[w++]=v,o[w++]=b;for(let t=2;t<a;t++)o[w++]=e[_+t]}return o.length!=w&&(o.length=w),o}function l2(e,t,n,r,i,s,o){let a,l;void 0!==n&&void 0!==r?(a=e-n,l=t-r):void 0!==i&&void 0!==s?(a=i-e,l=s-t):(a=1,l=0);const c=Math.hypot(a,l),u=a/c,h=l/c;if(a=-h,l=u,void 0===n||void 0===r)return[e+a*o,t+l*o];if(void 0===i||void 0===s)return[e+a*o,t+l*o];const d=function(e,t,n){const r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),i=[(t[0]-e[0])/r,(t[1]-e[1])/r],s=[-i[1],i[0]],o=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),a=[(n[0]-e[0])/o,(n[1]-e[1])/o];let l=0===r||0===o?0:Math.acos(nG(a[0]*i[0]+a[1]*i[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:2*Math.PI-l}([e,t],[n,r],[i,s]);if(Math.cos(d)>.998)return[e+u*o,t+h*o];const p=Math.cos(d/2),f=Math.sin(d/2);return[e+1/f*(f*a+p*l)*o,t+1/f*(-p*a+f*l)*o]}function c2(e,t,n=!1){for(let r=0,i=e.length-2;r<i;r+=t)for(let s=n&&0===r?e.length-3*t:e.length-2*t;s>r+t;s-=t){const n=e[r],i=e[r+1],o=e[r+t],a=e[r+t+1],l=e[s],c=e[s+1],u=e[s+t],h=e[s+t+1],d=(h-c)*(o-n)-(u-l)*(a-i);if(0===d)continue;const p=((u-l)*(i-c)-(h-c)*(n-l))/d,f=((o-n)*(i-c)-(a-i)*(n-l))/d;if(p>0&&p<1&&f>0&&f<1){const l=n+p*(o-n),c=i+p*(a-i);e[r+t]=l,e[r+t+1]=c,e.splice(r+2*t,s-r-t);break}}return e}function u2(e,t,n,r,i,s,o,a,l,c,u,h,d=!0){let p=e[t],f=e[t+1],g=0,m=0,y=0,v=0;function b(){g=p,m=f,p=e[t+=r],f=e[t+1],v+=y,y=Math.sqrt((p-g)*(p-g)+(f-m)*(f-m))}do{b()}while(t<n-r&&v+y<s);let w=0===y?0:(s-v)/y;const _=lG(g,p,w),x=lG(m,f,w),C=t-r,S=v,k=s+a*l(c,i,u);for(;t<n-r&&v+y<k;)b();w=0===y?0:(k-v)/y;const E=lG(g,p,w),R=lG(m,f,w);let T=!1;if(d)if(h){const e=[_,x,E,R];MZ(e,0,4,2,h,e,e),T=e[0]>e[2]}else T=_>E;const L=Math.PI,I=[],P=C+r===t;let M;if(y=0,v=S,p=e[t=C],f=e[t+1],P)return b(),M=Math.atan2(f-m,p-g),T&&(M+=M>0?-L:L),I[0]=[(E+_)/2,(R+x)/2,(k-s)/2,M,i],I;i=i.replace(/\n/g," ");const A=Array.from((r2||(r2=new Intl.Segmenter(void 0,{granularity:"grapheme"})),r2).segment(i),e=>e.segment);for(let O=0,N=A.length;O<N;){b();let e=Math.atan2(f-m,p-g);if(T&&(e+=e>0?-L:L),void 0!==M){let t=e-M;if(t+=t>L?-2*L:t<-L?2*L:0,Math.abs(t)>o)return null}M=e;const i=O;let h=0;for(;O<N;++O){const e=a*l(c,A[T?N-O-1:O],u);if(t+r<n&&v+y<s+h+e/2)break;h+=e}if(O===i)continue;const d=(T?A.slice(N-O,N-i):A.slice(i,O)).join("");w=0===y?0:(s+h/2-v)/y;const _=lG(g,p,w),x=lG(m,f,w);I.push([_,x,h/2,e,d]),s+=h}return I}var h2=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy($Y(),{get:(e,t)=>{if("function"==typeof e[t])return this.pendingMethod_=t,this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){const t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>{this.push_(this.pendingMethod_,e)};pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){const r=t[n];if("function"==typeof r){r(e);continue}const i=t[++n];"function"==typeof e[r]?e[r](...i):e[r]="function"==typeof i?i(e):i}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},d2=[1/0,1/0,-1/0,-1/0],p2=[],f2=[],g2=[],m2=[];function y2(e){return e[3].declutterBox}var v2=new RegExp("["+String.fromCharCode(1425)+"-ࣿיִ-﷿ﹰ-ﻼࠀ--]");function b2(e,t){return"start"===t?t=v2.test(e)?"right":"left":"end"===t&&(t=v2.test(e)?"left":"right"),i2[t]}function w2(e,t,n){return n>0&&e.push("\n",""),e.push(t,""),e}function _2(e,t,n){return n%2==0&&(e+=t),e}var x2=class{constructor(e,t,n,r,i){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=_Z(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=i?new h2:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){const i=e+t+n+r;if(this.labels_[i])return this.labels_[i];const s=r?this.strokeStates[r]:null,o=n?this.fillStates[n]:null,a=this.textStates[t],l=this.pixelRatio,c=[a.scale[0]*l,a.scale[1]*l],u=a.justify?i2[a.justify]:b2(Array.isArray(e)?e[0]:e,a.textAlign||"center"),h=r&&s.lineWidth?s.lineWidth:0,d=Array.isArray(e)?e:String(e).split("\n").reduce(w2,[]),{width:p,height:f,widths:g,heights:m,lineWidths:y}=function(e,t){const n=[],r=[],i=[];let s=0,o=0,a=0,l=0;for(let c=0,u=t.length;c<=u;c+=2){const h=t[c];if("\n"===h||c===u){s=Math.max(s,o),i.push(o),o=0,a+=l,l=0;continue}const d=t[c+1]||e.font,p=F0(d,h);n.push(p),o+=p;const f=O0(d);r.push(f),l=Math.max(l,f)}return{width:s,height:a,widths:n,heights:r,lineWidths:i}}(a,d),v=p+h,b=[],w=(v+2)*c[0],_=(f+h)*c[1],x={width:w<0?Math.floor(w):Math.ceil(w),height:_<0?Math.floor(_):Math.ceil(_),contextInstructions:b};1==c[0]&&1==c[1]||b.push("scale",c),r&&(b.push("strokeStyle",s.strokeStyle),b.push("lineWidth",h),b.push("lineCap",s.lineCap),b.push("lineJoin",s.lineJoin),b.push("miterLimit",s.miterLimit),b.push("setLineDash",[s.lineDash]),b.push("lineDashOffset",s.lineDashOffset)),n&&b.push("fillStyle",o.fillStyle),b.push("textBaseline","middle"),b.push("textAlign","center");const C=.5-u;let S=u*v+C*h;const k=[],E=[];let R,T=0,L=0,I=0,P=0;for(let M=0,A=d.length;M<A;M+=2){const e=d[M];if("\n"===e){L+=T,T=0,S=u*v+C*h,++P;continue}const t=d[M+1]||a.font;t!==R&&(r&&k.push("font",t),n&&E.push("font",t),R=t),T=Math.max(T,m[I]);const i=[e,S+C*g[I]+u*(g[I]-y[P]),.5*(h+T)+L];S+=g[I],r&&k.push("strokeText",i),n&&E.push("fillText",i),++I}return Array.prototype.push.apply(b,k),Array.prototype.push.apply(b,E),this.labels_[i]=x,x}replayTextBackground_(e,t,n,r,i,s,o){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,i),e.lineTo.apply(e,t),s&&(this.alignAndScaleFill_=s[2],e.fillStyle=s[1],this.fill_(e)),o&&(this.setStrokeStyle_(e,o),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,i,s,o,a,l,c,u,h,d,p,f,g){let m=n-(o*=h[0]),y=r-(a*=h[1]);const v=i+l>e?e-l:i,b=s+c>t?t-c:s,w=p[3]+v*h[0]+p[1],_=p[0]+b*h[1]+p[2],x=m-p[3],C=y-p[0];let S;return(f||0!==u)&&(p2[0]=x,m2[0]=x,p2[1]=C,f2[1]=C,f2[0]=x+w,g2[0]=f2[0],g2[1]=C+_,m2[1]=g2[1]),0!==u?(S=RZ(_Z(),n,r,1,1,u,-n,-r),kZ(S,p2),kZ(S,f2),kZ(S,g2),kZ(S,m2),CG(Math.min(p2[0],f2[0],g2[0],m2[0]),Math.min(p2[1],f2[1],g2[1],m2[1]),Math.max(p2[0],f2[0],g2[0],m2[0]),Math.max(p2[1],f2[1],g2[1],m2[1]),d2)):CG(Math.min(x,x+w),Math.min(C,C+_),Math.max(x,x+w),Math.max(C,C+_),d2),d&&(m=Math.round(m),y=Math.round(y)),{drawImageX:m,drawImageY:y,drawImageW:v,drawImageH:b,originX:l,originY:c,declutterBox:{minX:d2[0],minY:d2[1],maxX:d2[2],maxY:d2[3],value:g},canvasTransform:S,scale:h}}replayImageOrLabel_(e,t,n,r,i,s,o){const a=!(!s&&!o),l=r.declutterBox,c=o?o[2]*r.scale[0]/2:0;return l.minX-c<=t[0]&&l.maxX+c>=0&&l.minY-c<=t[1]&&l.maxY+c>=0&&(a&&this.replayTextBackground_(e,p2,f2,g2,m2,s,o),function(e,t,n,r,i,s,o,a,l,c,u){e.save(),1!==n&&(void 0===e.globalAlpha?e.globalAlpha=e=>e.globalAlpha*=n:e.globalAlpha*=n),t&&e.transform.apply(e,t),r.contextInstructions?(e.translate(l,c),e.scale(u[0],u[1]),function(e,t){const n=e.contextInstructions;for(let r=0,i=n.length;r<i;r+=2)Array.isArray(n[r+1])?t[n[r]].apply(t,n[r+1]):t[n[r]]=n[r+1]}(r,e)):u[0]<0||u[1]<0?(e.translate(l,c),e.scale(u[0],u[1]),e.drawImage(r,i,s,o,a,0,0,o,a)):e.drawImage(r,i,s,o,a,l,c,o*u[0],a*u[1]),e.restore()}(e,r.canvasTransform,i,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){const t=this.alignAndScaleFill_;if(t){const n=kZ(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),1!==t&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){const i=this.textStates[t],s=this.createLabel(e,t,r,n),o=this.strokeStates[n],a=this.pixelRatio,l=b2(Array.isArray(e)?e[0]:e,i.textAlign||"center"),c=i2[i.textBaseline||"middle"],u=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*i.scale[0])+2*(.5-l)*u,anchorY:c*s.height/a+2*(.5-c)*u}}execute_(e,t,n,r,i,s,o,a){const l=this.zIndexContext_;let c;var u,h;this.pixelCoordinates_&&fH(n,this.renderedTransform_)?c=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),c=PZ(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),h=n,(u=this.renderedTransform_)[0]=h[0],u[1]=h[1],u[2]=h[2],u[3]=h[3],u[4]=h[4],u[5]=h[5]);let d=0;const p=r.length;let f,g=0;const m=[];let y,v,b,w,_,x,C,S,k,E,R,T,L,I=0,P=0;const M=this.coordinateCache_,A=this.viewRotation_,O=Math.round(1e12*Math.atan2(-n[1],n[0]))/1e12,N={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},F=this.instructions!=r||this.overlaps?0:200;let D,z,j,U;for(;d<p;){const n=r[d];switch(n[0]){case 0:D=n[1],U=n[3],D.getGeometry()?void 0===o||HG(o,U.getExtent())?++d:d=n[2]+1:d=n[2],l&&(l.zIndex=n[4]);break;case 1:I>F&&(this.fill_(e),I=0),P>F&&(e.stroke(),P=0),I||P||(e.beginPath(),_=NaN,x=NaN),++d;break;case 2:g=n[1],b=n[2]??0;const r=c[g],u=c[g+1],h=c[g+2]-b-r,p=c[g+3]-b-u,B=Math.sqrt(h*h+p*p);e.moveTo(r+B,u),e.arc(r,u,B,0,2*Math.PI,!0),++d;break;case 3:e.closePath(),++d;break;case 4:g=n[1],f=n[2];const $=n[3],q=n[4],V=n[5];N.geometry=$,N.feature=D,d in M||(M[d]=[]);const W=M[d];V?V(c,g,f,2,W):(W[0]=c[g],W[1]=c[g+1],W.length=2),l&&(l.zIndex=n[6]),q(W,N),++d;break;case 6:g=n[1],f=n[2],k=n[3],y=n[4],v=n[5];let H=n[6];const G=n[7],K=n[8],Z=n[9],Y=n[10];let X=n[11];const J=n[12];let Q=n[13];w=n[14]||"declutter";const ee=n[15];if(!k&&n.length>=20){E=n[19],R=n[20],T=n[21],L=n[22];const e=this.drawLabelWithPointPlacement_(E,R,T,L);k=e.label,n[3]=k;const t=n[23];y=(e.anchorX-t)*this.pixelRatio,n[4]=y;const r=n[24];v=(e.anchorY-r)*this.pixelRatio,n[5]=v,H=k.height,n[6]=H,Q=k.width,n[13]=Q}let te,ne,re,ie;n.length>25&&(te=n[25]),n.length>17?(ne=n[16],re=n[17],ie=n[18]):(ne=R0,re=null,ie=null),Y&&O?X+=A:Y||O||(X-=A);let se=0;for(;g<f;g+=2){if(te&&te[se++]<Q/this.pixelRatio)continue;const n=this.calculateImageOrLabelDimensions_(k.width,k.height,c[g],c[g+1],Q,H,y,v,K,Z,X,J,i,ne,!!re||!!ie,D),r=[e,t,k,n,G,re,ie];if(a){let e,t,i,s,o;if(ee){const n=f-g;if(!ee[n]){ee[n]={args:r,declutterMode:w};continue}const s=ee[n];e=s.args,t=s.declutterMode,delete ee[n],i=y2(e)}if(!e||"declutter"===t&&a.collides(i)||(s=!0),"declutter"===w&&a.collides(n.declutterBox)||(o=!0),"declutter"===t&&"declutter"===w){const e=s&&o;s=e,o=e}s&&("none"!==t&&a.insert(i),this.replayImageOrLabel_.apply(this,e)),o&&("none"!==w&&a.insert(n.declutterBox),this.replayImageOrLabel_.apply(this,r))}else this.replayImageOrLabel_.apply(this,r)}++d;break;case 5:const oe=n[1],ae=n[2],le=n[3],ce=n[4];L=n[5];const ue=n[6],he=n[7],de=n[8];T=n[9];const pe=n[10];E=n[11],Array.isArray(E)&&(E=E.reduce(_2,"")),R=n[12];const fe=[n[13],n[13]];w=n[14]||"declutter";const ge=n[15],me=n[16],ye=this.textStates[R],ve=ye.font,be=[ye.scale[0]*he,ye.scale[1]*he];let we;ve in this.widths_?we=this.widths_[ve]:(we={},this.widths_[ve]=we);const _e=z1(c,oe,ae,2),xe=Math.abs(be[0])*D0(ve,E,we);if(ce||xe<=_e){const n=u2(c,oe,ae,2,E,(_e-xe)*b2(E,this.textStates[R].textAlign),ue,Math.abs(be[0]),D0,ve,we,O?0:this.viewRotation_,ge);e:if(n){const r=[];let i,s,o,l,c;if(T)for(i=0,s=n.length;i<s;++i){c=n[i],o=c[4],l=this.createLabel(o,R,"",T),y=c[2]+(be[0]<0?-pe:pe)-me,v=le*l.height+2*(.5-le)*pe*be[1]/be[0]-de;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,c[0],c[1],l.width,l.height,y,v,0,0,c[3],fe,!1,R0,!1,D);if(a&&"declutter"===w&&a.collides(s.declutterBox))break e;r.push([e,t,l,s,1,null,null])}if(L)for(i=0,s=n.length;i<s;++i){c=n[i],o=c[4],l=this.createLabel(o,R,L,""),y=c[2]-me,v=le*l.height-de;const s=this.calculateImageOrLabelDimensions_(l.width,l.height,c[0],c[1],l.width,l.height,y,v,0,0,c[3],fe,!1,R0,!1,D);if(a&&"declutter"===w&&a.collides(s.declutterBox))break e;r.push([e,t,l,s,1,null,null])}a&&"none"!==w&&a.load(r.map(y2));for(let e=0,t=r.length;e<t;++e)this.replayImageOrLabel_.apply(this,r[e])}}++d;break;case 7:if(void 0!==s){D=n[1];const e=s(D,U,w);if(e)return e}++d;break;case 8:F?I++:this.fill_(e),++d;break;case 9:let Ce,Se,ke;if(g=n[1],f=n[2],b=n[3],b){const e=(n[4]??!1)||Math.abs(c[g]-c[f-2])<1e-6&&Math.abs(c[g+1]-c[f-1])<1e-6;a2(c,g,f,2,b,e,m),c2(m,2,e),Ce=m,Se=0,ke=Ce.length}else Ce=c,Se=g,ke=f;z=Ce[Se],j=Ce[Se+1],e.moveTo(z,j),_=z+.5|0,x=j+.5|0;for(let t=Se+2;t<ke;t+=2)z=Ce[t],j=Ce[t+1],C=z+.5|0,S=j+.5|0,t!=ke-2&&C===_&&S===x||(e.lineTo(z,j),_=C,x=S);++d;break;case 10:this.alignAndScaleFill_=n[2],I?(this.fill_(e),I=0,P&&(e.stroke(),P=0)):P&&n[1]&&(e.stroke(),P=0),e.fillStyle=n[1],++d;break;case W1:I&&n[1]&&(this.fill_(e),I=0),P&&(e.stroke(),P=0),this.setStrokeStyle_(e,n),++d;break;case 12:F?P++:e.stroke(),++d;break;default:++d}}I&&this.fill_(e),P&&e.stroke()}execute(e,t,n,r,i,s){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,i,void 0,void 0,s)}executeHitDetection(e,t,n,r,i){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,i)}},C2=["Polygon","Circle","LineString","Image","Text","Default"],S2=["Image","Text"],k2=C2.filter(e=>!S2.includes(e)),E2=!1,R2=!1,T2=class{constructor(e,t,n,r,i,s,o){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=s,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=_Z(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(i,o)}clip(e,t){const n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(const n in e){let r=this.executorsByZIndex_[n];void 0===r&&(r={},this.executorsByZIndex_[n]=r);const i=e[n];for(const e in i){const n=i[e];r[e]=new x2(this.resolution_,this.pixelRatio_,this.overlaps_,n,t)}}}hasExecutors(e){for(const t in this.executorsByZIndex_){const n=this.executorsByZIndex_[t];for(let t=0,r=e.length;t<r;++t)if(e[t]in n)return!0}return!1}forEachFeatureAtCoordinate(e,t,n,r,i,s){!1===R2&&function(){let e=0;const t=t=>{const n=BY(1,1,null,{willReadFrequently:t});let r=0;const i=performance.now();for(;performance.now()-i<50;++r)n.fillStyle=`rgba(255,0,${r%256},1)`,n.fillRect(0,0,1,1),n.getImageData(0,0,1,1);return e=r>e?r:e,r};E2={[t(!0)]:!0,[t(!1)]:!1,[t(void 0)]:void 0}[e],R2=!0}();const o=2*(r=Math.round(r))+1,a=RZ(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=BY(o,o,null,{willReadFrequently:E2}));const c=this.hitDetectionContext_;let u;c.canvas.width!==o||c.canvas.height!==o?(c.canvas.width=o,c.canvas.height=o):l||c.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(u=[1/0,1/0,-1/0,-1/0],LG(u,e),mG(u,t*(this.renderBuffer_+r),u));const h=function(e){if(void 0!==L2[e])return L2[e];const t=2*e+1,n=e*e,r=new Array(n+1);for(let s=0;s<=e;++s)for(let i=0;i<=e;++i){const o=s*s+i*i;if(o>n)break;let a=r[o];a||(a=[],r[o]=a),a.push(4*((e+s)*t+(e+i))+3),s>0&&a.push(4*((e-s)*t+(e+i))+3),i>0&&(a.push(4*((e+s)*t+(e-i))+3),s>0&&a.push(4*((e-s)*t+(e-i))+3))}const i=[];for(let s=0,o=r.length;s<o;++s)r[s]&&i.push(...r[s]);return L2[e]=i,i}(r);let d;function p(e,t,n){const a=c.getImageData(0,0,o,o).data;for(let l=0,u=h.length;l<u;l++)if(a[h[l]]>0){if(!s||"none"===n||"Image"!==d&&"Text"!==d||s.includes(e)){const n=(h[l]-3)/4,s=r-n%o,a=r-(n/o|0),c=i(e,t,s*s+a*a);if(c)return c}c.clearRect(0,0,o,o);break}}const f=Object.keys(this.executorsByZIndex_).map(Number);let g,m,y,v,b;for(f.sort(cH),g=f.length-1;g>=0;--g){const e=f[g].toString();for(y=this.executorsByZIndex_[e],m=C2.length-1;m>=0;--m)if(d=C2[m],v=y[d],void 0!==v&&(b=v.executeHitDetection(c,a,n,p,u),b))return b}}getClipCoords(e){const t=this.maxExtent_;if(!t)return null;const n=t[0],r=t[1],i=t[2],s=t[3],o=[n,r,n,s,i,s,i,r];return PZ(o,0,8,2,e,o),o}isEmpty(){return XW(this.executorsByZIndex_)}execute(e,t,n,r,i,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?uH:cH),s=s||C2;const l=C2.length;for(let c=0,u=a.length;c<u;++c){const u=a[c].toString(),h=this.executorsByZIndex_[u];for(let d=0,p=s.length;d<p;++d){const u=s[d],p=h[u];if(void 0!==p){const s=null===o?void 0:p.getZIndexContext(),h=s?s.getContext():e,d=this.maxExtent_&&"Image"!==u&&"Text"!==u;if(d&&(h.save(),this.clip(h,n)),s&&"Text"!==u&&"Image"!==u?s.pushFunction(e=>p.execute(e,t,n,r,i,o)):p.execute(h,t,n,r,i,o),d&&h.restore(),s){s.offset();const e=a[c]*l+C2.indexOf(u);this.deferredZIndexContexts_[e]||(this.deferredZIndexContexts_[e]=[]),this.deferredZIndexContexts_[e].push(s)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(cH);for(let n=0,r=t.length;n<r;++n)e[t[n]].forEach(e=>{e.draw(this.renderedContext_),e.clear()}),e[t[n]].length=0}},L2={},I2=class extends V1{constructor(e,t,n,r,i,s,o){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?cG(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=i,this.squaredTolerance_=s,this.userTransform_=o,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_=_Z()}drawImages_(e,t,n,r){if(!this.image_)return;const i=PZ(e,t,n,r,this.transform_,this.pixelCoordinates_),s=this.context_,o=this.tmpLocalTransform_,a=s.globalAlpha;1!=this.imageOpacity_&&(s.globalAlpha=a*this.imageOpacity_);let l=this.imageRotation_;0===this.transformRotation_&&(l-=this.viewRotation_),this.imageRotateWithView_&&(l+=this.viewRotation_);for(let c=0,u=i.length;c<u;c+=2){const e=i[c]-this.imageAnchorX_,t=i[c+1]-this.imageAnchorY_;if(0!==l||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const n=e+this.imageAnchorX_,r=t+this.imageAnchorY_;RZ(o,n,r,1,1,l,-n,-r),s.save(),s.transform.apply(s,o),s.translate(n,r),s.scale(this.imageScale_[0],this.imageScale_[1]),s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),s.restore()}else s.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,e,t,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(s.globalAlpha=a)}drawText_(e,t,n,r){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const i=PZ(e,t,n,r,this.transform_,this.pixelCoordinates_),s=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);t<n;t+=r){const e=i[t]+this.textOffsetX_,n=i[t+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(s.save(),s.translate(e-this.textOffsetX_,n-this.textOffsetY_),s.rotate(o),s.translate(this.textOffsetX_,this.textOffsetY_),s.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&s.strokeText(this.text_,0,0),this.textFillState_&&s.fillText(this.text_,0,0),s.restore()):(this.textStrokeState_&&s.strokeText(this.text_,e,n),this.textFillState_&&s.fillText(this.text_,e,n))}}moveToLineTo_(e,t,n,r,i,s){const o=this.context_;let a=PZ(e,t,n,r,this.transform_,this.pixelCoordinates_);if(Math.abs(s)>0){const e=a.length,t=i||Math.abs(a[0]-a[e-2])<1e-6&&Math.abs(a[1]-a[e-1])<1e-6;a=a2(a,0,e,2,s,t,a),c2(a,2,t)}o.moveTo(a[0],a[1]);let l=a.length;i&&(l-=2);for(let c=2;c<l;c+=2)o.lineTo(a[c],a[c+1]);return i&&o.closePath(),n}drawRings_(e,t,n,r,i){for(let s=0,o=n.length;s<o;++s)t=this.moveToLineTo_(e,t,n[s],r,!0,i);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),HG(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=function(e,t,n){const r=e.getFlatCoordinates();if(!r)return null;const i=e.getStride();return PZ(r,0,r.length,i,t,n)}(e,this.transform_,this.pixelCoordinates_),n=t[2]-t[0],r=t[3]-t[1],i=Math.sqrt(n*n+r*r),s=this.context_;s.beginPath(),s.arc(t[0],t[1],i,0,2*Math.PI),this.fillState_&&s.fill(),this.strokeState_&&s.stroke()}""!==this.text_&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e)}}drawFeature(e,t){const n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){const t=e.getGeometriesArray();for(let n=0,r=t.length;n<r;++n)this.drawGeometry(t[n])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),""!==this.text_&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),""!==this.text_&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),HG(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(""!==this.text_){const t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const t=e.getExtent();if(HG(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const t=this.context_,n=e.getFlatCoordinates();let r=0;const i=e.getEnds(),s=e.getStride();t.beginPath();for(let e=0,o=i.length;e<o;++e)r=this.moveToLineTo_(n,r,i[e],s,!1,this.strokeState_.strokeOffset);t.stroke()}if(""!==this.text_){const t=e.getFlatMidpoints();this.drawText_(t,0,t.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),HG(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(""!==this.text_){const t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),HG(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const t=this.context_,n=e.getOrientedFlatCoordinates();let r=0;const i=e.getEndss(),s=e.getStride();t.beginPath();for(let e=0,o=i.length;e<o;++e){const t=i[e];r=this.drawRings_(n,r,t,s,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(""!==this.text_){const t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){const t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){const t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),fH(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){const t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:E0;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(e){const t=e.getColor();this.fillState_={fillStyle:b0(t||_0)}}else this.fillState_=null;if(t){const e=t.getColor(),n=t.getLineCap(),r=t.getLineDash(),i=t.getLineDashOffset(),s=t.getLineJoin(),o=t.getWidth(),a=t.getMiterLimit(),l=r||C0,c=t.getOffset();this.strokeState_={lineCap:void 0!==n?n:x0,lineDash:1===this.pixelRatio_?l:l.map(e=>e*this.pixelRatio_),lineDashOffset:(i||0)*this.pixelRatio_,lineJoin:void 0!==s?s:S0,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:b0(e||k0),strokeOffset:(c??0)*this.pixelRatio_}}else this.strokeState_=null}setImageStyle(e){let t;if(!e||!(t=e.getSize()))return void(this.image_=null);const n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),i=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=i[0],this.imageOriginY_=i[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();const s=e.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/n,s[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(e){const t=e.getFill();if(t){const e=t.getColor();this.textFillState_={fillStyle:b0(e||_0)}}else this.textFillState_=null;const n=e.getStroke();if(n){const e=n.getColor(),t=n.getLineCap(),r=n.getLineDash(),i=n.getLineDashOffset(),s=n.getLineJoin(),o=n.getWidth(),a=n.getMiterLimit();this.textStrokeState_={lineCap:void 0!==t?t:x0,lineDash:r||C0,lineDashOffset:i||0,lineJoin:void 0!==s?s:S0,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:b0(e||k0)}}else this.textStrokeState_=null;const r=e.getFont(),i=e.getOffsetX(),s=e.getOffsetY(),o=e.getRotateWithView(),a=e.getRotation(),l=e.getScaleArray(),c=e.getText(),u=e.getTextAlign(),h=e.getTextBaseline();this.textState_={font:void 0!==r?r:"10px sans-serif",textAlign:void 0!==u?u:E0,textBaseline:void 0!==h?h:"middle"},this.text_=void 0!==c?Array.isArray(c)?c.reduce((e,t,n)=>e+(n%2?" ":t),""):c:"",this.textOffsetX_=void 0!==i?this.pixelRatio_*i:0,this.textOffsetY_=void 0!==s?this.pixelRatio_*s:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*l[0],this.pixelRatio_*l[1]]}else this.text_=""}},P2=.5;function M2(e,t,n,r,i,s,o,a,l){const c=i,u=BY(e[0]*P2,e[1]*P2);u.imageSmoothingEnabled=!1;const h=u.canvas,d=new I2(u,P2,i,null,o,a,l?hZ(null,l):null),p=n.length,f=Math.floor(16777215/p),g={};for(let y=1;y<=p;++y){const e=n[y-1],t=e.getStyleFunction()||r;if(!t)continue;let i=t(e,s);if(!i)continue;Array.isArray(i)||(i=[i]);const o=(y*f).toString(16).padStart(7,"#00000");for(let n=0,r=i.length;n<r;++n){const t=i[n],r=t.getGeometryFunction()(e);if(!r||!HG(c,r.getExtent()))continue;const s=t.clone(),a=s.getFill();a&&a.setColor(o);const l=s.getStroke();l&&(l.setColor(o),l.setLineDash(null)),s.setText(void 0);const u=t.getImage();if(u){const e=u.getImageSize();if(!e)continue;const t=BY(e[0],e[1],void 0,{alpha:!1}),n=t.canvas;t.fillStyle=o,t.fillRect(0,0,n.width,n.height),s.setImage(new q0({img:n,anchor:u.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:u.getOrigin(),opacity:1,size:u.getSize(),scale:u.getScale(),rotation:u.getRotation(),rotateWithView:u.getRotateWithView()}))}const h=s.getZIndex()||0;let d=g[h];d||(d={},g[h]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]);const p=r.getType();if("GeometryCollection"===p){const e=r.getGeometriesArrayRecursive();for(let t=0,n=e.length;t<n;++t){const n=e[t];d[n.getType().replace("Multi","")].push(n,s)}}else d[p.replace("Multi","")].push(r,s)}}const m=Object.keys(g).map(Number).sort(cH);for(let y=0,v=m.length;y<v;++y){const e=g[m[y]];for(const n in e){const r=e[n];for(let e=0,n=r.length;e<n;e+=2){d.setStyle(r[e+1]);for(let n=0,i=t.length;n<i;++n)d.setTransform(t[n]),d.drawGeometry(r[e])}}}return u.getImageData(0,0,h.width,h.height)}function A2(e,t,n){const r=[];if(n){const i=Math.floor(Math.round(e[0])*P2),s=Math.floor(Math.round(e[1])*P2),o=4*(nG(i,0,n.width-1)+nG(s,0,n.height-1)*n.width),a=n.data[o],l=n.data[o+1],c=n.data[o+2]+256*(l+256*a),u=Math.floor(16777215/t.length);c&&c%u===0&&r.push(t[c/u-1])}return r}var O2={Point:function(e,t,n,r,i,s){const o=n.getImage(),a=n.getText(),l=a&&a.getText(),c=s&&o&&l?{}:void 0;if(o){if(2!=o.getImageState())return;const s=e.getBuilder(n.getZIndex(),"Image");s.setImageStyle(o,c),s.drawPoint(t,r,i)}if(l){const s=e.getBuilder(n.getZIndex(),"Text");s.setTextStyle(a,c),s.drawText(t,r,i)}},LineString:function(e,t,n,r,i){const s=n.getStroke();if(s){const o=e.getBuilder(n.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawLineString(t,r,i)}const o=n.getText();if(o&&o.getText()){const s=e.getBuilder(n.getZIndex(),"Text");s.setTextStyle(o),s.drawText(t,r,i)}},Polygon:function(e,t,n,r,i){const s=n.getFill(),o=n.getStroke();if(s||o){const a=e.getBuilder(n.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawPolygon(t,r,i)}const a=n.getText();if(a&&a.getText()){const s=e.getBuilder(n.getZIndex(),"Text");s.setTextStyle(a),s.drawText(t,r,i)}},MultiPoint:function(e,t,n,r,i,s){const o=n.getImage(),a=o&&0!==o.getOpacity(),l=n.getText(),c=l&&l.getText(),u=s&&a&&c?{}:void 0;if(a){if(2!=o.getImageState())return;const s=e.getBuilder(n.getZIndex(),"Image");s.setImageStyle(o,u),s.drawMultiPoint(t,r,i)}if(c){const s=e.getBuilder(n.getZIndex(),"Text");s.setTextStyle(l,u),s.drawText(t,r,i)}},MultiLineString:function(e,t,n,r,i){const s=n.getStroke();if(s){const o=e.getBuilder(n.getZIndex(),"LineString");o.setFillStrokeStyle(null,s),o.drawMultiLineString(t,r,i)}const o=n.getText();if(o&&o.getText()){const s=e.getBuilder(n.getZIndex(),"Text");s.setTextStyle(o),s.drawText(t,r,i)}},MultiPolygon:function(e,t,n,r,i){const s=n.getFill(),o=n.getStroke();if(o||s){const a=e.getBuilder(n.getZIndex(),"Polygon");a.setFillStrokeStyle(s,o),a.drawMultiPolygon(t,r,i)}const a=n.getText();if(a&&a.getText()){const s=e.getBuilder(n.getZIndex(),"Text");s.setTextStyle(a),s.drawText(t,r,i)}},GeometryCollection:function(e,t,n,r,i,s){const o=t.getGeometriesArray();let a,l;for(a=0,l=o.length;a<l;++a)(0,O2[o[a].getType()])(e,o[a],n,r,i,s)},Circle:function(e,t,n,r,i){const s=n.getFill(),o=n.getStroke();if(s||o){const a=e.getBuilder(n.getZIndex(),"Circle");a.setFillStrokeStyle(s,o),a.drawCircle(t,r,i)}const a=n.getText();if(a&&a.getText()){const s=e.getBuilder(n.getZIndex(),"Text");s.setTextStyle(a),s.drawText(t,r,i)}}};function N2(e,t){return parseInt(kH(e),10)-parseInt(kH(t),10)}function F2(e,t){const n=D2(e,t);return n*n}function D2(e,t){return.5*e/t}function z2(e,t,n,r,i,s,o,a){const l=[],c=n.getImage();if(c){let e=!0;const t=c.getImageState();2==t||3==t?e=!1:0==t&&c.load(),e&&l.push(c.ready())}const u=n.getFill();u&&u.loading()&&l.push(u.ready());const h=l.length>0;return h&&Promise.all(l).then(()=>i(null)),function(e,t,n,r,i,s,o){const a=n.getGeometryFunction()(t);if(!a)return;const l=a.simplifyTransformed(r,i);n.getRenderer()?j2(e,l,n,t,o):(0,O2[l.getType()])(e,l,n,t,o,s)}(e,t,n,r,s,o,a),h}function j2(e,t,n,r,i){if("GeometryCollection"==t.getType()){const s=t.getGeometries();for(let t=0,o=s.length;t<o;++t)j2(e,s[t],n,r,i);return}e.getBuilder(n.getZIndex(),"Default").drawCustom(t,r,n.getRenderer(),n.getHitDetectionRenderer(),i)}var U2=class extends xH{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=5,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(e){this.renderedSourceKey_?this.renderedSourceKey_!==e&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=e):this.renderedSourceKey_=e}getFeatures(e){return CH()}getData(e){return null}prepareFrame(e){return CH()}renderFrame(e,t){return CH()}forEachFeatureAtCoordinate(e,t,n,r,i){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){const t=e.target;2!==t.getState()&&3!==t.getState()||this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return 2!=t&&3!=t&&e.addEventListener(tH,this.boundHandleImageChange_),0==t&&(e.load(),t=e.getState()),2==t}renderIfReadyAndVisible(){const e=this.getLayer();e&&e.getVisible()&&"ready"===e.getSourceState()&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},B2=[],$2=null,q2=class extends U2{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=_Z(),this.pixelTransform=_Z(),this.inversePixelTransform=_Z(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){let r;$2||($2=BY(1,1,void 0,{willReadFrequently:!0})),$2.clearRect(0,0,1,1);try{$2.drawImage(e,t,n,1,1,0,0,1,1),r=$2.getImageData(0,0,1,1).data}catch{return $2=null,null}return r}getBackground(e){let t=this.getLayer().getBackground();return"function"==typeof t&&(t=t(e.viewState.resolution)),t||void 0}useContainer(e,t,n,r,i){if(ZY(e)&&0===this.pixelTransform[1]&&0===this.pixelTransform[2]&&0===this.pixelTransform[4]&&0===this.pixelTransform[5]&&e.width===r&&e.height===i){const t=e,r=t.getContext("2d");if(r)return this.container=e,this.context=r,this.containerReused=!0,void(n&&(r.fillStyle=n,r.fillRect(0,0,t.width,t.height)))}const s=this.getLayer().getClassName();let o,a;if(e&&e.className===s&&(!n||e&&e.style.backgroundColor&&fH(DJ(e.style.backgroundColor),DJ(n)))){const t=e.firstElementChild;ZY(t)&&(a=t.getContext("2d"))}if(a&&function(e,t){const n=IZ(e),r=IZ(t);for(let i=0;i<6;++i)if(0!==Math.round((n[i]-r[i])*LZ[i]))return!1;return!0}(a.canvas.style.transform,t)?(this.container=e,this.context=a,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){o=zH?KY():document.createElement("div"),o.className=s;let e=o.style;e.position="absolute",e.width="100%",e.height="100%",a=BY();const t=a.canvas;o.appendChild(t),e=t.style,e.position="absolute",e.left="0",e.transformOrigin="top left",this.container=o,this.context=a}this.containerReused||!n||this.container.style.backgroundColor||(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){const r=qG(n),i=VG(n),s=NG(n),o=OG(n);kZ(t.coordinateToPixelTransform,r),kZ(t.coordinateToPixelTransform,i),kZ(t.coordinateToPixelTransform,s),kZ(t.coordinateToPixelTransform,o);const a=this.inversePixelTransform;kZ(a,r),kZ(a,i),kZ(a,s),kZ(a,o),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(i[0]),Math.round(i[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.clip()}prepareContainer(e,t){const n=e.extent,r=e.viewState.resolution,i=e.viewState.rotation,s=e.pixelRatio,o=Math.round(WG(n)/r*s),a=Math.round(UG(n)/r*s);RZ(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/s,1/s,i,-o/2,-a/2),TZ(this.inversePixelTransform,this.pixelTransform);const l="matrix("+this.pixelTransform.join(", ")+")",c=this.getBackground(e);if(this.useContainer(t,l,c,o,a),!this.containerReused){const e=this.context.canvas;e.width!=o||e.height!=a?(e.width=o,e.height=a):this.context.clearRect(0,0,o,a),l!==e.style.transform&&(e.style.transform=l)}}dispatchRenderEvent_(e,t,n){const r=this.getLayer();if(r.hasListener(e)){const i=new x1(e,this.inversePixelTransform,n,t);r.dispatchEvent(i)}}preRender(e,t){this.frameState=t,t.declutter||this.dispatchRenderEvent_(ZX,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(YX,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new h2),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(ZX,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(YX,this.context,e))}getRenderTransform(e,t,n,r,i,s,o){const a=i/2,l=s/2,c=r/t,u=-c,h=-e[0]+o,d=-e[1];return RZ(this.tempTransform,a,l,c,u,-n,h,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}},V2=class extends q2{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,n){const r=t.extent,i=t.viewState,s=i.center,o=i.resolution,a=i.projection,l=i.rotation,c=a.getExtent(),u=this.getLayer().getSource(),h=this.getLayer().getDeclutter(),d=t.pixelRatio,p=t.viewHints,f=!(p[0]||p[1]),g=this.context,m=Math.round(WG(r)/o*d),y=Math.round(UG(r)/o*d),v=u.getWrapX()&&a.canWrapX(),b=v?WG(c):null,w=v?Math.ceil((r[2]-c[2])/b)+(this.extendX_?2:1):1;let _=v?Math.floor((r[0]-c[0])/b)-(this.extendX_?1:0):0;do{let r=this.getRenderTransform(s,o,0,d,m,y,_*b);t.declutter&&(r=r.slice(0)),e.execute(g,[g.canvas.width,g.canvas.height],r,l,f,void 0===n?C2:n?S2:k2,n?h&&t.declutter[h]:void 0)}while(++_<w)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=BY(this.context.canvas.width,this.context.canvas.height,B2))}resetDrawContext_(){if(1!==this.opacity_&&this.targetContext_){const e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,qY(this.context),B2.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(e,t){const n=e.layerStatesArray[e.layerIndex];this.opacity_=n.opacity;const r=e.viewState;this.prepareContainer(e,t);const i=this.context,s=this.replayGroup_;let o=s&&!s.isEmpty();if(!o&&!this.getLayer().hasListener(ZX)&&!this.getLayer().hasListener(YX))return this.container;this.setDrawContext_(),this.preRender(i,e),r.projection,this.clipExtent_=null;let a=!1;if(o&&n.extent&&this.clipping){const t=n.extent;o=HG(t,e.extent),o&&!wG(t,e.extent)&&(e.declutter?this.clipExtent_=t:(this.clipUnrotated(i,e,t),a=!0))}return o&&this.renderWorlds(s,e,!this.getLayer().getDeclutter()&&void 0),a&&i.restore(),this.postRender(i,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const e=this.frameState.size.slice(),t=this.renderedCenter_,n=this.renderedResolution_,r=this.renderedRotation_,i=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],l=e[0]*P2,c=e[1]*P2;a.push(this.getRenderTransform(t,n,r,P2,l,c,0).slice());const u=o.getSource(),h=i.getExtent();if(u.getWrapX()&&i.canWrapX()&&!wG(h,s)){let e=s[0];const i=WG(h);let o,u=0;for(;e<h[0];)--u,o=i*u,a.push(this.getRenderTransform(t,n,r,P2,l,c,o).slice()),e+=i;for(u=0,e=s[2];e>h[2];)++u,o=i*u,a.push(this.getRenderTransform(t,n,r,P2,l,c,o).slice()),e-=i}const d=null;this.hitDetectionImageData_=M2(e,a,this.renderedFeatures_,o.getStyleFunction(),s,n,r,F2(n,this.renderedPixelRatio_),d?i:null)}t(A2(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,i){if(!this.replayGroup_)return;const s=t.viewState.resolution,o=t.viewState.rotation,a=this.getLayer(),l={},c=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,s,o,n,function(e,t,n){const s=kH(e),o=l[s];if(o){if(!0!==o&&n<o.distanceSq){if(0===n)return l[s]=!0,i.splice(i.lastIndexOf(o),1),r(e,a,t);o.geometry=t,o.distanceSq=n}}else{if(0===n)return l[s]=!0,r(e,a,t);i.push(l[s]={feature:e,layer:a,geometry:t,distanceSq:n,callback:r})}},c?t.declutter?.[c]?.all().map(e=>e.value):null)}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){const t=this.getLayer(),n=t.getSource();if(!n)return!1;const r=e.viewHints[0],i=e.viewHints[1],s=t.getUpdateWhileAnimating(),o=t.getUpdateWhileInteracting();if(this.ready&&!s&&r||!o&&i)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=e.extent,l=e.viewState,c=l.projection,u=l.resolution,h=e.pixelRatio,d=t.getRevision(),p=t.getRenderBuffer();let f=t.getRenderOrder();void 0===f&&(f=N2);const g=l.center.slice(),m=mG(a,p*u),y=m.slice(),v=[m.slice()],b=c.getExtent(),w=n.getWrapX()&&c.canWrapX();if(this.extendX_=!1,w){const e=n.getExtent();e&&!GG(e)&&(this.extendX_=e[0]<b[0]||e[2]>b[2])}if(w&&(!wG(b,e.extent)||this.extendX_)){const e=WG(b),t=Math.max(WG(m)/2,e);let n=b[0],r=b[2];this.extendX_&&(n-=e,r+=e),m[0]=n-t,m[2]=r+t,eK(g,c);const i=ZG(v[0],c);i[0]<b[0]&&i[2]<b[2]?v.push([i[0]+e,i[1],i[2]+e,i[3]]):i[0]>b[0]&&i[2]>b[2]&&v.push([i[0]-e,i[1],i[2]-e,i[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===h&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&this.renderedFrameDeclutter_===!!e.declutter&&wG(this.wrappedRenderedExtent_,m))return fH(this.renderedExtent_,y)||(this.hitDetectionImageData_=null,this.renderedExtent_=y),this.renderedCenter_=g,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const _=new o2(D2(u,h),m,u,h);for(let L=0,I=v.length;L<I;++L)n.loadFeatures(v[L],u,c);const x=F2(u,h);let C=!0;const S=(e,n)=>{let r;const i=e.getStyleFunction()||t.getStyleFunction();if(i&&(r=i(e,u)),r){const t=this.renderFeature(e,x,r,_,undefined,this.getLayer().getDeclutter(),n);C=C&&!t}},k=m,E=n.getFeaturesInExtent(k);f&&E.sort(f);for(let L=0,I=E.length;L<I;++L)S(E[L],L);this.renderedFeatures_=E,this.ready=C;const R=_.finish(),T=new T2(m,u,h,n.getOverlaps(),R,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=u,this.renderedRevision_=d,this.renderedRenderOrder_=f,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=y,this.wrappedRenderedExtent_=m,this.renderedCenter_=g,this.renderedProjection_=c,this.renderedPixelRatio_=h,this.replayGroup_=T,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,i,s,o){if(!n)return!1;let a=!1;if(Array.isArray(n))for(let l=0,c=n.length;l<c;++l)a=z2(r,e,n[l],t,this.boundHandleStyleImageChange_,i,s,o)||a;else a=z2(r,e,n,t,this.boundHandleStyleImageChange_,i,s,o);return a}},W2=class extends _1{constructor(e){super(e)}createRenderer(){return new V2(this)}};function H2(e,t,n,r,i,s,o){const a=new XMLHttpRequest;a.open("GET","function"==typeof e?e(n,r,i):e,!0),"arraybuffer"==t.getType()&&(a.responseType="arraybuffer"),a.withCredentials=!1,a.onload=function(){if(!a.status||a.status>=200&&a.status<300){const e=t.getType();try{let r;"text"==e||"json"==e?r=a.responseText:"xml"==e?r=a.responseXML||a.responseText:"arraybuffer"==e&&(r=a.response),r?s(t.readFeatures(r,{extent:n,featureProjection:i}),t.readProjection(r)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function G2(e,t){return function(n,r,i,s,o){H2(e,t,n,r,i,e=>{this.addFeatures(e),void 0!==s&&s(e)},()=>{this.changed(),void 0!==o&&o()})}}function K2(){return[[-1/0,-1/0,1/0,1/0]]}function Z2(e){return[e]}var Y2=_Z(),X2=class e{constructor(e,t,n,r,i,s){this.styleFunction,this.extent_,this.id_=s,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=i,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?kG(this.flatCoordinates_):EG(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const e=FG(this.getExtent());this.flatInteriorPoints_=dY(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const e=wY(this.flatCoordinates_,this.ends_),t=$1(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=pY(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=F1(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const e=this.flatCoordinates_;let t=0;const n=this.ends_;for(let r=0,i=n.length;r<i;++r){const i=n[r],s=F1(e,t,i,this.stride_,.5);pH(this.flatMidpoints_,s),t=i}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){const t=(e=iZ(e)).getExtent(),n=e.getWorldExtent();if(t&&n){const e=UG(n)/UG(t);RZ(Y2,n[0],n[3],e,-e,0,0,0),PZ(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Y2,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new e(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=vH((t,n)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),n&&this.simplifiedGeometry_.applyTransform(n);const r=this.simplifiedGeometry_.getFlatCoordinates();let i;switch(this.type_){case"LineString":r.length=sY(r,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,r,0),i=[r.length];break;case"MultiLineString":i=[],r.length=oY(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,r,0,i);break;case"Polygon":i=[],r.length=cY(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),r,0,i)}return i&&(this.simplifiedGeometry_=new e(this.type_,r,i,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}};X2.prototype.getFlatCoordinates=X2.prototype.getOrientedFlatCoordinates;var J2=class{constructor(e){this.rbush_=new iJ(e),this.items_={}}insert(e,t){const n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[kH(t)]=n}load(e,t){const n=new Array(t.length);for(let r=0,i=t.length;r<i;r++){const i=e[r],s=t[r],o={minX:i[0],minY:i[1],maxX:i[2],maxY:i[3],value:s};n[r]=o,this.items_[kH(s)]=o}this.rbush_.load(n)}remove(e){const t=kH(e),n=this.items_[t];return delete this.items_[t],null!==this.rbush_.remove(n)}update(e,t){const n=this.items_[kH(t)];RG([n.minX,n.minY,n.maxX,n.maxY],e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(e){const t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(e){return e.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,i=e.length;r<i;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return XW(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){const t=this.rbush_.toJSON();return CG(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(const t in e.items_)this.items_[t]=e.items_[t]}},Q2=class extends RH{constructor(e){super(),this.projection=iZ(e.projection),this.attributions_=e3(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=void 0!==e.state?e.state:"ready",this.wrapX_=void 0!==e.wrapX&&e.wrapX,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;const t=this;this.viewPromise_=new Promise(function(e,n){t.viewResolver=e,t.viewRejector=n})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}ready(){const e=this.getState();return"ready"===e?Promise.resolve():"error"===e?Promise.reject(new Error("Source failed to load")):new Promise((e,t)=>{const n=()=>{const r=this.getState();"ready"===r?(this.un("change",n),e()):"error"===r&&(this.un("change",n),t(new Error("Source failed to load")))};this.on("change",n)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=e3(e),this.changed()}setState(e){this.state_=e,this.changed()}};function e3(e){return e?"function"==typeof e?e:(Array.isArray(e)||(e=[e]),()=>e):null}var t3="addfeature",n3="removefeature",r3=class extends wH{constructor(e,t,n){super(e),this.feature=t,this.features=n}},i3=class extends Q2{constructor(e){super({attributions:(e=e||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===e.wrapX||e.wrapX}),this.on,this.once,this.un,this.loader_=yH,this.format_=e.format||null,this.overlaps_=void 0===e.overlaps||e.overlaps,this.url_=e.url,void 0!==e.loader?this.loader_=e.loader:void 0!==this.url_&&(XH(this.format_,"`format` must be set when `url` is set"),this.loader_=G2(this.url_,this.format_)),this.strategy_=void 0!==e.strategy?e.strategy:K2;const t=void 0===e.useSpatialIndex||e.useSpatialIndex;let n,r;this.featuresRtree_=t?new J2:null,this.loadedExtentsRtree_=new J2,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(e.features)?r=e.features:e.features&&(n=e.features,r=n.getArray()),t||void 0!==n||(n=new IH(r)),void 0!==r&&this.addFeaturesInternal(r),void 0!==n&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){const t=kH(e);if(!this.addToIndex_(t,e))return void(this.featuresCollection_&&this.featuresCollection_.remove(e));this.setupChangeEvents_(t,e);const n=e.getGeometry();if(n){const t=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(t,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new r3(t3,e))}setupChangeEvents_(e,t){t instanceof X2||(this.featureChangeKeys_[e]=[JW(t,tH,this.handleFeatureChange_,this),JW(t,ZW,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(void 0!==t.getId()){const e=String(t.getId());if(e in this.idIndex_)if(t instanceof X2){const r=this.idIndex_[e];r instanceof X2?Array.isArray(r)?r.push(t):this.idIndex_[e]=[r,t]:n=!1}else n=!1;else this.idIndex_[e]=t}return n&&(XH(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){const t=[],n=[],r=[];for(let i=0,s=e.length;i<s;i++){const t=e[i],r=kH(t);this.addToIndex_(r,t)&&n.push(t)}for(let i=0,s=n.length;i<s;i++){const e=n[i],s=kH(e);this.setupChangeEvents_(s,e);const o=e.getGeometry();if(o){const n=o.getExtent();t.push(n),r.push(e)}else this.nullGeometryFeatures_[s]=e}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(t3))for(let i=0,s=n.length;i<s;i++)this.dispatchEvent(new r3(t3,n[i]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(t3,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(n3,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(GW,e=>{t||(t=!0,this.addFeature(e.element),t=!1)}),e.addEventListener(KW,e=>{t||(t=!0,this.removeFeature(e.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(const e in this.featureChangeKeys_)this.featureChangeKeys_[e].forEach(eH);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(e=>{this.removeFeatureInternal(e)});for(const e in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[e])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const t=new r3("clear");this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){const n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(n){const r=n.getGeometry();if(r instanceof X2||r.intersectsCoordinate(e))return t(n)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){const r=n.getGeometry();if(r instanceof X2||r.intersectsExtent(e)){const e=t(n);if(e)return e}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),XW(this.nullGeometryFeatures_)||pH(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){const t=[];return this.forEachFeatureAtCoordinateDirect(e,function(e){t.push(e)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);const n=YG(e,t);return[].concat(...n.map(e=>this.featuresRtree_.getInExtent(e)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){const n=e[0],r=e[1];let i=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return t=t||gH,this.featuresRtree_.forEachInExtent(a,function(e){if(t(e)){const t=e.getGeometry(),l=o;if(o=t instanceof X2?0:t.closestPointXY(n,r,s,o),o<l){i=e;const t=Math.sqrt(o);a[0]=n-t,a[1]=r-t,a[2]=n+t,a[3]=r+t}}}),i}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){const t=this.idIndex_[e.toString()];return void 0!==t?t:null}getFeatureByUid(e){const t=this.uidIndex_[e];return void 0!==t?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){const t=e.target,n=kH(t),r=t.getGeometry();if(r){const e=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(e,t)):this.featuresRtree_&&this.featuresRtree_.update(e,t)}else n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);const i=t.getId();if(void 0!==i){const e=i.toString();this.idIndex_[e]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[e]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new r3("changefeature",t))}hasFeature(e){const t=e.getId();if(void 0!==t){const n=this.idIndex_[String(t)];return Array.isArray(n)?n.includes(e):n===e}return kH(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&XW(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(e,t,n){const r=this.loadedExtentsRtree_,i=this.strategy_(e,t,n);for(let s=0,o=i.length;s<o;++s){const e=i[s];if(!r.forEachInExtent(e,function(t){return wG(t.extent,e)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new r3("featuresloadstart"));const i=e=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new r3("featuresloadend",void 0,e))},s=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new r3("featuresloaderror"))};let o=!1;const a=this.loader_.call(this,e,t,n,e=>o||i(e),()=>o||s());a instanceof Promise?(o=!0,a.then(e=>{this.addFeatures(e),i(e)}).catch(s)):this.loader_.length<4&&(this.loading=!1),r.insert(e,{extent:e.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){const t=this.loadedExtentsRtree_,n=[];t.forEachInExtent(e,function(e){n.push(e)}),n.forEach(n=>{t.remove(n);const r=$G(n.extent,e);for(const e of r)t.insert(e,{extent:e})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){e&&this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){const t=kH(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(eH),delete this.featureChangeKeys_[t];const n=e.getId();if(void 0!==n){const t=n.toString(),r=this.idIndex_[t];r===e?delete this.idIndex_[t]:Array.isArray(r)&&(r.splice(r.indexOf(e),1),1===r.length&&(this.idIndex_[t]=r[0]))}return delete this.uidIndex_[t],this.hasListener(n3)&&this.dispatchEvent(new r3(n3,e)),!0}removeFromIdIndex_(e){for(const t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){XH(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(G2(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},s3=class e extends NZ{constructor(e){super(),this.geometries_=e,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(eH),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const e=this.geometries_;for(let t=0,n=e.length;t<n;++t)this.changeEventsKeys_.push(JW(e[t],tH,this.changed,this))}clone(){const t=new e(o3(this.geometries_));return t.applyProperties(this),t}closestPointXY(e,t,n,r){if(r<vG(this.getExtent(),e,t))return r;const i=this.geometries_;for(let s=0,o=i.length;s<o;++s)r=i[s].closestPointXY(e,t,n,r);return r}containsXY(e,t){const n=this.geometries_;for(let r=0,i=n.length;r<i;++r)if(n[r].containsXY(e,t))return!0;return!1}computeExtent(e){SG(e);const t=this.geometries_;for(let n=0,r=t.length;n<r;++n)TG(e,t[n].getExtent());return e}getGeometries(){return o3(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let e=[];const t=this.geometries_;for(let n=0,r=t.length;n<r;++n)t[n].getType()===this.getType()?e=e.concat(t[n].getGeometriesArrayRecursive()):e.push(t[n]);return e}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const n=[],r=this.geometries_;let i=!1;for(let e=0,s=r.length;e<s;++e){const s=r[e],o=s.getSimplifiedGeometry(t);n.push(o),o!==s&&(i=!0)}return i?new e(n):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return"GeometryCollection"}intersectsExtent(e){const t=this.geometries_;for(let n=0,r=t.length;n<r;++n)if(t[n].intersectsExtent(e))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(e,t){const n=this.geometries_;for(let r=0,i=n.length;r<i;++r)n[r].rotate(e,t);this.changed()}scale(e,t,n){n||(n=FG(this.getExtent()));const r=this.geometries_;for(let i=0,s=r.length;i<s;++i)r[i].scale(e,t,n);this.changed()}setGeometries(e){this.setGeometriesArray(o3(e))}setGeometriesArray(e){this.unlistenGeometriesChange_(),this.geometries_=e,this.listenGeometriesChange_(),this.changed()}applyTransform(e){const t=this.geometries_;for(let n=0,r=t.length;n<r;++n)t[n].applyTransform(e);this.changed()}translate(e,t){const n=this.geometries_;for(let r=0,i=n.length;r<i;++r)n[r].translate(e,t);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}};function o3(e){return e.map(e=>e.clone())}var a3=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=N1,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let n=t.dataProjection?iZ(t.dataProjection):this.readProjection(e);t.extent&&n&&"tile-pixels"===n.getUnits()&&(n=iZ(n),n.setWorldExtent(t.extent)),t={dataProjection:n,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return CH()}readFeature(e,t){return CH()}readFeatures(e,t){return CH()}readGeometry(e,t){return CH()}readProjection(e){return CH()}writeFeature(e,t){return CH()}writeFeatures(e,t){return CH()}writeGeometry(e,t){return CH()}};function l3(e,t,n){const r=n?iZ(n.featureProjection):null,i=n?iZ(n.dataProjection):null;let s=e;if(r&&i&&!uZ(r,i)){t&&(s=e.clone());const n=t?r:i,o=t?i:r;"tile-pixels"===n.getUnits()?s.transform(n,o):s.applyTransform(pZ(n,o))}if(t&&n&&void 0!==n.decimals){const t=Math.pow(10,n.decimals),r=function(e){for(let n=0,r=e.length;n<r;++n)e[n]=Math.round(e[n]*t)/t;return e};s===e&&(s=e.clone()),s.applyTransform(r)}return s}var c3={Point:hY,LineString:j1,Polygon:_Y,MultiPoint:B1,MultiLineString:U1,MultiPolygon:q1};function u3(e,t){const n=e.geometry;if(!n)return[];if(Array.isArray(n))return n.map(t=>u3({...e,geometry:t})).flat();const r="MultiPolygon"===n.type?"Polygon":n.type;if("GeometryCollection"===r||"Circle"===r)throw new Error("Unsupported geometry type: "+r);const i=n.layout.length;return l3(new X2(r,"Polygon"===r?function(e,t,n){return Array.isArray(t[0])?(yY(e,0,t,n)||bY(e=e.slice(),0,t,n),e):(mY(e,0,t,n)||vY(e=e.slice(),0,t,n),e)}(n.flatCoordinates,n.ends,i):n.flatCoordinates,n.ends?.flat(),i,e.properties||{},e.id).enableSimplifyTransformed(),!1,t)}function h3(e,t){if(!e)return null;if(Array.isArray(e)){const n=e.map(e=>h3(e,t));return new s3(n)}return l3(new(0,c3[e.type])(e.flatCoordinates,e.layout||"XY",e.ends),!1,t)}var d3=class extends a3{constructor(){super()}getType(){return"json"}readFeature(e,t){return this.readFeatureFromObject(p3(e),this.getReadOptions(e,t))}readFeatures(e,t){return this.readFeaturesFromObject(p3(e),this.getReadOptions(e,t))}readFeatureFromObject(e,t){return CH()}readFeaturesFromObject(e,t){return CH()}readGeometry(e,t){return this.readGeometryFromObject(p3(e),this.getReadOptions(e,t))}readGeometryFromObject(e,t){return CH()}readProjection(e){return this.readProjectionFromObject(p3(e))}readProjectionFromObject(e){return CH()}writeFeature(e,t){return JSON.stringify(this.writeFeatureObject(e,t))}writeFeatureObject(e,t){return CH()}writeFeatures(e,t){return JSON.stringify(this.writeFeaturesObject(e,t))}writeFeaturesObject(e,t){return CH()}writeGeometry(e,t){return JSON.stringify(this.writeGeometryObject(e,t))}writeGeometryObject(e,t){return CH()}};function p3(e){return"string"==typeof e?JSON.parse(e)||null:null!==e?e:null}var f3=class extends d3{constructor(e){e=e||{},super(),this.dataProjection=iZ(e.dataProjection?e.dataProjection:"EPSG:4326"),e.featureProjection&&(this.defaultFeatureProjection=iZ(e.featureProjection)),e.featureClass&&(this.featureClass=e.featureClass),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(e,t){let n=null;n="Feature"===e.type?e:{type:"Feature",geometry:e,properties:null};const r=g3(n.geometry);if(this.featureClass===X2)return u3({geometry:r,id:n.id,properties:n.properties},t);const i=new(0,this.featureClass);return this.geometryName_?i.setGeometryName(this.geometryName_):this.extractGeometryName_&&n.geometry_name&&i.setGeometryName(n.geometry_name),i.setGeometry(h3(r,t)),"id"in n&&i.setId(n.id),n.properties&&i.setProperties(n.properties,!0),i}readFeaturesFromObject(e,t){let n=null;if("FeatureCollection"===e.type){n=[];const r=e.features;for(let e=0,i=r.length;e<i;++e){const i=this.readFeatureFromObject(r[e],t);i&&n.push(i)}}else n=[this.readFeatureFromObject(e,t)];return n.flat()}readGeometryFromObject(e,t){return function(e,t){return h3(g3(e),t)}(e,t)}readProjectionFromObject(e){const t=e.crs;let n;if(t)if("name"==t.type)n=iZ(t.properties.name);else{if("EPSG"!==t.type)throw new Error("Unknown SRS type");n=iZ("EPSG:"+t.properties.code)}else n=this.dataProjection;return n}writeFeatureObject(e,t){t=this.adaptOptions(t);const n={type:"Feature",geometry:null,properties:null},r=e.getId();if(void 0!==r&&(n.id=r),!e.hasProperties())return n;const i=e.getProperties(),s=e.getGeometry();return s&&(n.geometry=m3(s,t),delete i[e.getGeometryName()]),XW(i)||(n.properties=i),n}writeFeaturesObject(e,t){t=this.adaptOptions(t);const n=[];for(let r=0,i=e.length;r<i;++r)n.push(this.writeFeatureObject(e[r],t));return{type:"FeatureCollection",features:n}}writeGeometryObject(e,t){return m3(e,this.adaptOptions(t))}};function g3(e){if(!e)return null;let t;switch(e.type){case"Point":t=function(e){const t=e.coordinates;return{type:"Point",flatCoordinates:t,layout:DZ(t.length)}}(e);break;case"LineString":t=function(e){const t=e.coordinates,n=t.flat();return{type:"LineString",flatCoordinates:n,ends:[n.length],layout:DZ(t[0]?.length||2)}}(e);break;case"Polygon":t=function(e){const t=e.coordinates,n=[],r=t[0]?.[0]?.length;return{type:"Polygon",flatCoordinates:n,ends:GZ(n,0,t,r),layout:DZ(r)}}(e);break;case"MultiPoint":t=function(e){const t=e.coordinates;return{type:"MultiPoint",flatCoordinates:t.flat(),layout:DZ(t[0]?.length||2)}}(e);break;case"MultiLineString":t=function(e){const t=e.coordinates,n=t[0]?.[0]?.length||2,r=[];return{type:"MultiLineString",flatCoordinates:r,ends:GZ(r,0,t,n),layout:DZ(n)}}(e);break;case"MultiPolygon":t=function(e){const t=e.coordinates,n=[],r=t[0]?.[0]?.[0].length||2;return{type:"MultiPolygon",flatCoordinates:n,ends:KZ(n,0,t,r),layout:DZ(r)}}(e);break;case"GeometryCollection":t=function(e){return e.geometries.map(function(e){return g3(e)})}(e);break;default:throw new Error("Unsupported GeoJSON type: "+e.type)}return t}function m3(e,t){const n=(e=l3(e,!0,t)).getType();let r;switch(n){case"Point":r=function(e){return{type:"Point",coordinates:e.getCoordinates()}}(e);break;case"LineString":r=function(e){return{type:"LineString",coordinates:e.getCoordinates()}}(e);break;case"Polygon":r=function(e,t){let n;return t&&(n=t.rightHanded),{type:"Polygon",coordinates:e.getCoordinates(n)}}(e,t);break;case"MultiPoint":r=function(e){return{type:"MultiPoint",coordinates:e.getCoordinates()}}(e);break;case"MultiLineString":r=function(e){return{type:"MultiLineString",coordinates:e.getCoordinates()}}(e);break;case"MultiPolygon":r=function(e,t){let n;return t&&(n=t.rightHanded),{type:"MultiPolygon",coordinates:e.getCoordinates(n)}}(e,t);break;case"GeometryCollection":r=function(e,t){return delete(t=Object.assign({},t)).featureProjection,{type:"GeometryCollection",geometries:e.getGeometriesArray().map(function(e){return m3(e,t)})}}(e,t);break;case"Circle":r={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+n)}return r}var y3="accuracy",v3="accuracyGeometry",b3="altitude",w3="altitudeAccuracy",_3="heading",x3="position",C3="projection",S3="speed",k3="tracking",E3="trackingOptions",R3=class extends wH{constructor(e){super("error"),this.code=e.code,this.message=e.message}},T3=class extends RH{constructor(e){super(),this.on,this.once,this.un,e=e||{},this.position_=null,this.transform_=nZ,this.watchId_=void 0,this.addChangeListener(C3,this.handleProjectionChanged_),this.addChangeListener(k3,this.handleTrackingChanged_),void 0!==e.projection&&this.setProjection(e.projection),void 0!==e.trackingOptions&&this.setTrackingOptions(e.trackingOptions),this.setTracking(void 0!==e.tracking&&e.tracking)}disposeInternal(){this.setTracking(!1),super.disposeInternal()}handleProjectionChanged_(){const e=this.getProjection();e&&(this.transform_=hZ(iZ("EPSG:4326"),e),this.position_&&this.set(x3,this.transform_(this.position_)))}handleTrackingChanged_(){if("geolocation"in navigator){const e=this.getTracking();e&&void 0===this.watchId_?this.watchId_=navigator.geolocation.watchPosition(this.positionChange_.bind(this),this.positionError_.bind(this),this.getTrackingOptions()):e||void 0===this.watchId_||(navigator.geolocation.clearWatch(this.watchId_),this.watchId_=void 0)}}positionChange_(e){const t=e.coords;this.set(y3,t.accuracy),this.set(b3,null===t.altitude?void 0:t.altitude),this.set(w3,null===t.altitudeAccuracy?void 0:t.altitudeAccuracy),this.set(_3,null===t.heading?void 0:oG(t.heading)),this.position_?(this.position_[0]=t.longitude,this.position_[1]=t.latitude):this.position_=[t.longitude,t.latitude];const n=this.transform_(this.position_);this.set(x3,n.slice()),this.set(S3,null===t.speed?void 0:t.speed);const r=function(e,t,n){n=n||32;const r=[];for(let i=0;i<n;++i)pH(r,oK(e,t,2*Math.PI*i/n,void 0));return r.push(r[0],r[1]),new _Y(r,"XY",[r.length])}(this.position_,t.accuracy);r.applyTransform(this.transform_),this.set(v3,r),this.changed()}positionError_(e){this.dispatchEvent(new R3(e))}getAccuracy(){return this.get(y3)}getAccuracyGeometry(){return this.get(v3)||null}getAltitude(){return this.get(b3)}getAltitudeAccuracy(){return this.get(w3)}getHeading(){return this.get(_3)}getPosition(){return this.get(x3)}getProjection(){return this.get(C3)}getSpeed(){return this.get(S3)}getTracking(){return this.get(k3)}getTrackingOptions(){return this.get(E3)}setProjection(e){this.set(C3,iZ(e))}setTracking(e){this.set(k3,e)}setTrackingOptions(e){this.set(E3,e)}},L3={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}},I3=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function P3(e,t){const n={};for(const r in e)"ref"!==r&&(n[r]=e[r]);return I3.forEach(e=>{e in t&&(n[e]=t[e])}),n}function M3(e){e=e.slice();const t=Object.create(null);for(let n=0;n<e.length;n++)t[e[n].id]=e[n];for(let n=0;n<e.length;n++)"ref"in e[n]&&(e[n]=P3(e[n],t[e[n].ref]));return e}var A3=class{constructor(e,t,n,r){this.message=(e?`${e}: `:"")+n,r&&(this.identifier=r),null!=t&&t.__line__&&(this.line=t.__line__)}};function O3(e,...t){for(const n of t)for(const t in n)e[t]=n[t];return e}var N3=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}},F3=class e{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[n,r]of t)this.bindings[n]=r}concat(t){return new e(this,t)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}},D3={kind:"null"},z3={kind:"number"},j3={kind:"string"},U3={kind:"boolean"},B3={kind:"color"},$3={kind:"projectionDefinition"},q3={kind:"object"},V3={kind:"value"},W3={kind:"collator"},H3={kind:"formatted"},G3={kind:"padding"},K3={kind:"colorArray"},Z3={kind:"numberArray"},Y3={kind:"resolvedImage"},X3={kind:"variableAnchorOffsetCollection"};function J3(e,t){return{kind:"array",itemType:e,N:t}}function Q3(e){if("array"===e.kind){const t=Q3(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}var e5=[D3,z3,j3,U3,B3,$3,H3,q3,J3(V3),G3,Z3,K3,Y3,X3];function t5(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!t5(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of e5)if(!t5(e,t))return null}return`Expected ${Q3(e)} but found ${Q3(t)} instead.`}function n5(e,t){return t.some(t=>t.kind===e.kind)}function r5(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}function i5(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}var s5=.96422,o5=.82521,a5=4/29,l5=6/29,c5=3*l5*l5,u5=l5*l5*l5,h5=Math.PI/180,d5=180/Math.PI;function p5(e){return(e%=360)<0&&(e+=360),e}function f5([e,t,n,r]){let i,s;const o=m5((.2225045*(e=g5(e))+.7168786*(t=g5(t))+.0606169*(n=g5(n)))/1);e===t&&t===n?i=s=o:(i=m5((.4360747*e+.3850649*t+.1430804*n)/s5),s=m5((.0139322*e+.0971045*t+.7141733*n)/o5));const a=116*o-16;return[a<0?0:a,500*(i-o),200*(o-s),r]}function g5(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function m5(e){return e>u5?Math.pow(e,1/3):e/c5+a5}function y5([e,t,n,r]){let i=(e+16)/116,s=isNaN(t)?i:i+t/500,o=isNaN(n)?i:i-n/200;return i=1*b5(i),s=s5*b5(s),o=o5*b5(o),[v5(3.1338561*s-1.6168667*i-.4906146*o),v5(-.9787684*s+1.9161415*i+.033454*o),v5(.0719453*s-.2289914*i+1.4052427*o),r]}function v5(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function b5(e){return e>l5?e*e*e:c5*(e-a5)}var w5=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function _5(e,t){return w5(e,t)?e[t]:void 0}function x5(e){return parseInt(e.padEnd(2,e),16)/255}function C5(e,t){return S5(t?e/100:e,0,1)}function S5(e,t,n){return Math.min(Math.max(t,e),n)}function k5(e){return!e.some(Number.isNaN)}var E5={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]};function R5(e,t,n){return e+n*(t-e)}function T5(e,t,n){return e.map((e,r)=>R5(e,t[r],n))}var L5=class e{constructor(e,t,n,r=1,i=!0){this.r=e,this.g=t,this.b=n,this.a=r,i||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[e,t,n,r]))}static{this.black=new e(0,0,0,1)}static{this.white=new e(1,1,1,1)}static{this.transparent=new e(0,0,0,0)}static{this.red=new e(1,0,0,1)}static parse(t){if(t instanceof e)return t;if("string"!=typeof t)return;const n=function(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];const t=_5(E5,e);if(t){const[e,n,r]=t;return[e/255,n/255,r/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){const t=e.length<6?1:2;let n=1;return[x5(e.slice(n,n+=t)),x5(e.slice(n,n+=t)),x5(e.slice(n,n+=t)),x5(e.slice(n,n+t)||"ff")]}if(e.startsWith("rgb")){const t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){const[e,n,r,i,s,o,a,l,c,u,h,d]=t,p=[i||" ",a||" ",u].join("");if(" "===p||" /"===p||",,"===p||",,,"===p){const e=[r,o,c].join(""),t="%%%"===e?100:""===e?255:0;if(t){const e=[S5(+n/t,0,1),S5(+s/t,0,1),S5(+l/t,0,1),h?C5(+h,d):1];if(k5(e))return e}}return}}const n=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){const[e,t,r,i,s,o,a,l,c]=n,u=[r||" ",s||" ",a].join("");if(" "===u||" /"===u||",,"===u||",,,"===u){const e=[+t,S5(+i,0,100),S5(+o,0,100),l?C5(+l,c):1];if(k5(e))return function([e,t,n,r]){function i(r){const i=(r+e/30)%12,s=t*Math.min(n,1-n);return n-s*Math.max(-1,Math.min(i-3,9-i,1))}return e=p5(e),t/=100,n/=100,[i(0),i(8),i(4),r]}(e)}}}(t);return n?new e(...n,!1):void 0}get rgb(){const{r:e,g:t,b:n,a:r}=this,i=r||1/0;return this.overwriteGetter("rgb",[e/i,t/i,n/i,r])}get hcl(){return this.overwriteGetter("hcl",function(e){const[t,n,r,i]=f5(e),s=Math.sqrt(n*n+r*r);return[Math.round(1e4*s)?p5(Math.atan2(r,n)*d5):NaN,s,t,i]}(this.rgb))}get lab(){return this.overwriteGetter("lab",f5(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){const[e,t,n,r]=this.rgb;return`rgba(${[e,t,n].map(e=>Math.round(255*e)).join(",")},${r})`}static interpolate(t,n,r,i="rgb"){switch(i){case"rgb":{const[i,s,o,a]=T5(t.rgb,n.rgb,r);return new e(i,s,o,a,!1)}case"hcl":{const[i,s,o,a]=t.hcl,[l,c,u,h]=n.hcl;let d,p;if(isNaN(i)||isNaN(l))isNaN(i)?isNaN(l)?d=NaN:(d=l,1!==o&&0!==o||(p=c)):(d=i,1!==u&&0!==u||(p=s));else{let e=l-i;l>i&&e>180?e-=360:l<i&&i-l>180&&(e+=360),d=i+r*e}const[f,g,m,y]=function([e,t,n,r]){return e=isNaN(e)?0:e*h5,y5([n,Math.cos(e)*t,Math.sin(e)*t,r])}([d,p??R5(s,c,r),R5(o,u,r),R5(a,h,r)]);return new e(f,g,m,y,!1)}case"lab":{const[i,s,o,a]=y5(T5(t.lab,n.lab,r));return new e(i,s,o,a,!1)}}}},I5=class{constructor(e,t,n){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},P5=["bottom","center","top"],M5=class{constructor(e,t,n,r,i,s){this.text=e,this.image=t,this.scale=n,this.fontStack=r,this.textColor=i,this.verticalAlign=s}},A5=class e{constructor(e){this.sections=e}static fromString(t){return new e([new M5(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&0!==e.image.name.length)}static factory(t){return t instanceof e?t:e.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}},O5=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if("number"==typeof t)return new e([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new e(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,r){return new e(T5(t.values,n.values,r))}},N5=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if("number"==typeof t)return new e([t]);if(Array.isArray(t)){for(const e of t)if("number"!=typeof e)return;return new e(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,r){return new e(T5(t.values,n.values,r))}},F5=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if("string"==typeof t){const n=L5.parse(t);if(!n)return;return new e([n])}if(!Array.isArray(t))return;const n=[];for(const e of t){if("string"!=typeof e)return;const t=L5.parse(e);if(!t)return;n.push(t)}return new e(n)}toString(){return JSON.stringify(this.values)}static interpolate(t,n,r,i="rgb"){const s=[];if(t.values.length!=n.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${n.values.length}), cannot interpolate.`);for(let e=0;e<t.values.length;e++)s.push(L5.interpolate(t.values[e],n.values[e],r,i));return new e(s)}},D5=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},z5=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),j5=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){const n=t[e],r=t[e+1];if("string"!=typeof n||!z5.has(n))return;if(!Array.isArray(r)||2!==r.length||"number"!=typeof r[0]||"number"!=typeof r[1])return}return new e(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,r){const i=t.values,s=n.values;if(i.length!==s.length)throw new D5(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${n.toString()}`);const o=[];for(let e=0;e<i.length;e+=2){if(i[e]!==s[e])throw new D5(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${i[e]}, to[${e}]: ${s[e]}`);o.push(i[e]);const[t,n]=i[e+1],[a,l]=s[e+1];o.push([R5(t,a,r),R5(n,l,r)])}return new e(o)}},U5=class e{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(t){return t?new e({name:t,available:!1}):null}},B5=class e{constructor(e,t,n){this.from=e,this.to=t,this.transition=n}static interpolate(t,n,r){return new e(t,n,r)}static parse(t){return t instanceof e?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new e(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new e(t.from,t.to,t.transition):"string"==typeof t?new e(t,t,1):void 0}};function $5(e,t,n,r){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===r||"number"==typeof r&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,n,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof r?[e,t,n,r]:[e,t,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function q5(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof B5||e instanceof L5||e instanceof I5||e instanceof A5||e instanceof O5||e instanceof N5||e instanceof F5||e instanceof j5||e instanceof U5)return!0;if(Array.isArray(e)){for(const t of e)if(!q5(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!q5(e[t]))return!1;return!0}return!1}function V5(e){if(null===e)return D3;if("string"==typeof e)return j3;if("boolean"==typeof e)return U3;if("number"==typeof e)return z3;if(e instanceof L5)return B3;if(e instanceof B5)return $3;if(e instanceof I5)return W3;if(e instanceof A5)return H3;if(e instanceof O5)return G3;if(e instanceof N5)return Z3;if(e instanceof F5)return K3;if(e instanceof j5)return X3;if(e instanceof U5)return Y3;if(Array.isArray(e)){const t=e.length;let n;for(const r of e){const e=V5(r);if(n){if(n===e)continue;n=V3;break}n=e}return J3(n||V3,t)}return q3}function W5(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof L5||e instanceof B5||e instanceof A5||e instanceof O5||e instanceof N5||e instanceof F5||e instanceof j5||e instanceof U5?e.toString():JSON.stringify(e)}var H5=class e{constructor(e,t){this.type=e,this.value=t}static parse(t,n){if(2!==t.length)return n.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!q5(t[1]))return n.error("invalid value");const r=t[1];let i=V5(r);const s=n.expectedType;return"array"!==i.kind||0!==i.N||!s||"array"!==s.kind||"number"==typeof s.N&&0!==s.N||(i=s),new e(i,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},G5={string:j3,number:z3,boolean:U3,object:q3},K5=class e{constructor(e,t){this.type=e,this.args=t}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let r,i=1;const s=t[0];if("array"===s){let e,s;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in G5)||"object"===r)return n.error('The item type argument of "array" must be one of string, number, boolean',1);e=G5[r],i++}else e=V3;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return n.error('The length argument to "array" must be a positive integer literal',2);s=t[2],i++}r=J3(e,s)}else{if(!G5[s])throw new Error(`Types doesn't contain name = ${s}`);r=G5[s]}const o=[];for(;i<t.length;i++){const e=n.parse(t[i],i,V3);if(!e)return null;o.push(e)}return new e(r,o)}evaluate(e){for(let t=0;t<this.args.length;t++){const n=this.args[t].evaluate(e);if(!t5(this.type,V5(n)))return n;if(t===this.args.length-1)throw new D5(`Expected value to be of type ${Q3(this.type)}, but found ${Q3(V5(n))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Z5={"to-boolean":U3,"to-color":B3,"to-number":z3,"to-string":j3},Y5=class e{constructor(e,t){this.type=e,this.args=t}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const r=t[0];if(!Z5[r])throw new Error(`Can't parse ${r} as it is not part of the known types`);if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return n.error("Expected one argument.");const i=Z5[r],s=[];for(let e=1;e<t.length;e++){const r=n.parse(t[e],e,V3);if(!r)return null;s.push(r)}return new e(i,s)}evaluate(e){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(e));case"color":{let t,n;for(const r of this.args){if(t=r.evaluate(e),n=null,t instanceof L5)return t;if("string"==typeof t){const n=e.parseColor(t);if(n)return n}else if(Array.isArray(t)&&(n=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:$5(t[0],t[1],t[2],t[3]),!n))return new L5(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new D5(n||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"padding":{let t;for(const n of this.args){t=n.evaluate(e);const r=O5.parse(t);if(r)return r}throw new D5(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"numberArray":{let t;for(const n of this.args){t=n.evaluate(e);const r=N5.parse(t);if(r)return r}throw new D5(`Could not parse numberArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"colorArray":{let t;for(const n of this.args){t=n.evaluate(e);const r=F5.parse(t);if(r)return r}throw new D5(`Could not parse colorArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(const n of this.args){t=n.evaluate(e);const r=j5.parse(t);if(r)return r}throw new D5(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(const n of this.args){if(t=n.evaluate(e),null===t)return 0;const r=Number(t);if(!isNaN(r))return r}throw new D5(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return A5.fromString(W5(this.args[0].evaluate(e)));case"resolvedImage":return U5.fromString(W5(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return W5(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},X5=["Unknown","Point","LineString","Polygon"],J5=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?X5[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=L5.parse(e),this._parseColorCache.set(e,t)),t}},Q5=class e{constructor(e,t,n=[],r,i=new F3,s=[]){this.registry=e,this.path=n,this.key=n.map(e=>`[${e}]`).join(""),this.scope=i,this.errors=s,this.expectedType=r,this._isConstant=t}parse(e,t,n,r,i={}){return t?this.concat(t,n,r)._parse(e,i):this._parse(e,i)}_parse(e,t){function n(e,t,n){return"assert"===n?new K5(t,[e]):"coerce"===n?new Y5(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const i=e[0];if("string"!=typeof i)return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const s=this.registry[i];if(s){let i=s.parse(e,this);if(!i)return null;if(this.expectedType){const e=this.expectedType,r=i.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==r.kind){if("projectionDefinition"===e.kind&&["string","array"].includes(r.kind)||["color","formatted","resolvedImage"].includes(e.kind)&&["value","string"].includes(r.kind)||["padding","numberArray"].includes(e.kind)&&["value","number","array"].includes(r.kind)||"colorArray"===e.kind&&["value","string","array"].includes(r.kind)||"variableAnchorOffsetCollection"===e.kind&&["value","array"].includes(r.kind))i=n(i,e,t.typeAnnotation||"coerce");else if(this.checkSubtype(e,r))return null}else i=n(i,e,t.typeAnnotation||"assert")}if(!(i instanceof H5)&&"resolvedImage"!==i.type.kind&&this._isConstant(i)){const e=new J5;try{i=new H5(i.type,i.evaluate(e))}catch(r){return this.error(r.message),null}}return i}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===e?this.error("'undefined' value invalid. Use null instead."):"object"==typeof e?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(t,n,r){const i="number"==typeof t?this.path.concat(t):this.path,s=r?this.scope.concat(r):this.scope;return new e(this.registry,this._isConstant,i,n||null,s,this.errors)}error(e,...t){const n=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new N3(n,e))}checkSubtype(e,t){const n=t5(e,t);return n&&this.error(n),n}},e4=class e{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(t,n){if(t.length<4)return n.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let e=1;e<t.length-1;e+=2){const i=t[e];if("string"!=typeof i)return n.error(`Expected string, but found ${typeof i} instead.`,e);if(/[^a-zA-Z0-9_]/.test(i))return n.error("Variable names must contain only alphanumeric characters or '_'.",e);const s=n.parse(t[e+1],e+1);if(!s)return null;r.push([i,s])}const i=n.parse(t[t.length-1],t.length-1,n.expectedType,r);return i?new e(r,i):null}outputDefined(){return this.result.outputDefined()}},t4=class e{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(t,n){if(2!==t.length||"string"!=typeof t[1])return n.error("'var' expression requires exactly one string literal argument.");const r=t[1];return n.scope.has(r)?new e(r,n.scope.get(r)):n.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}};function n4(e,t){const n=e.length-1;let r,i,s=0,o=n,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),r=e[a],i=e[a+1],r<=t){if(a===n||t<i)return a;s=a+1}else{if(!(r>t))throw new D5("Input is not a number.");o=a-1}return 0}var r4=class e{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[r,i]of n)this.labels.push(r),this.outputs.push(i)}static parse(t,n){if(t.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");const r=n.parse(t[1],1,z3);if(!r)return null;const i=[];let s=null;n.expectedType&&"value"!==n.expectedType.kind&&(s=n.expectedType);for(let e=1;e<t.length;e+=2){const r=1===e?-1/0:t[e],o=t[e+1],a=e,l=e+1;if("number"!=typeof r)return n.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(i.length&&i[i.length-1][0]>=r)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const c=n.parse(o,l,s);if(!c)return null;s=s||c.type,i.push([r,c])}return new e(s,r,i)}evaluate(e){const t=this.labels,n=this.outputs;if(1===t.length)return n[0].evaluate(e);const r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);const i=t.length;return r>=t[i-1]?n[i-1].evaluate(e):n[n4(t,r)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}},i4=class e{constructor(e,t,n,r,i){this.type=e,this.operator=t,this.interpolation=n,this.input=r,this.labels=[],this.outputs=[];for(const[s,o]of i)this.labels.push(s),this.outputs.push(o)}static interpolationFactor(e,t,n,r){let i=0;if("exponential"===e.name)i=s4(t,e.base,n,r);else if("linear"===e.name)i=s4(t,1,n,r);else if("cubic-bezier"===e.name){const s=e.controlPoints;i=function(e,t,n,r){const i=3*e,s=3*(n-e)-i,o=1-i-s,a=3*t,l=3*(r-t)-a,c=1-a-l;return function(e,t=1e-6){if(e<=0)return 0;if(e>=1)return 1;let n=e;for(let h=0;h<8;h++){const r=((o*n+s)*n+i)*n-e;if(Math.abs(r)<t)return((c*n+l)*n+a)*n;const u=(3*o*n+2*s)*n+i;if(Math.abs(u)<1e-6)break;n-=r/u}let r=0,u=1;n=e;for(let a=0;a<20;a++){const a=((o*n+s)*n+i)*n;if(Math.abs(a-e)<t)break;e>a?r=n:u=n,n=.5*(r+u)}return((c*n+l)*n+a)*n}}(s[0],s[1],s[2],s[3])(s4(t,1,n,r))}return i}static parse(t,n){let[r,i,s,...o]=t;if(!Array.isArray(i)||0===i.length)return n.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){const e=i[1];if("number"!=typeof e)return n.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:e}}else{if("cubic-bezier"!==i[0])return n.error(`Unknown interpolation type ${String(i[0])}`,1,0);{const e=i.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:e}}}if(t.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(s=n.parse(s,2,z3),!s)return null;const a=[];let l=null;"interpolate-hcl"!==r&&"interpolate-lab"!==r||n.expectedType==K3?n.expectedType&&"value"!==n.expectedType.kind&&(l=n.expectedType):l=B3;for(let e=0;e<o.length;e+=2){const t=o[e],r=o[e+1],i=e+3,s=e+4;if("number"!=typeof t)return n.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(a.length&&a[a.length-1][0]>=t)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const c=n.parse(r,s,l);if(!c)return null;l=l||c.type,a.push([t,c])}return i5(l,z3)||i5(l,$3)||i5(l,B3)||i5(l,G3)||i5(l,Z3)||i5(l,K3)||i5(l,X3)||i5(l,J3(z3))?new e(l,r,i,s,a):n.error(`Type ${Q3(l)} is not interpolatable.`)}evaluate(t){const n=this.labels,r=this.outputs;if(1===n.length)return r[0].evaluate(t);const i=this.input.evaluate(t);if(i<=n[0])return r[0].evaluate(t);const s=n.length;if(i>=n[s-1])return r[s-1].evaluate(t);const o=n4(n,i),a=n[o],l=n[o+1],c=e.interpolationFactor(this.interpolation,i,a,l),u=r[o].evaluate(t),h=r[o+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return R5(u,h,c);case"color":return L5.interpolate(u,h,c);case"padding":return O5.interpolate(u,h,c);case"colorArray":return F5.interpolate(u,h,c);case"numberArray":return N5.interpolate(u,h,c);case"variableAnchorOffsetCollection":return j5.interpolate(u,h,c);case"array":return T5(u,h,c);case"projectionDefinition":return B5.interpolate(u,h,c)}case"interpolate-hcl":switch(this.type.kind){case"color":return L5.interpolate(u,h,c,"hcl");case"colorArray":return F5.interpolate(u,h,c,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return L5.interpolate(u,h,c,"lab");case"colorArray":return F5.interpolate(u,h,c,"lab")}}}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function s4(e,t,n,r){const i=r-n,s=e-n;return 0===i?0:1===t?s/i:(Math.pow(t,s)-1)/(Math.pow(t,i)-1)}L5.interpolate,O5.interpolate,N5.interpolate,F5.interpolate,j5.interpolate;var o4=class e{constructor(e,t){this.type=e,this.args=t}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let r=null;const i=n.expectedType;i&&"value"!==i.kind&&(r=i);const s=[];for(const e of t.slice(1)){const t=n.parse(e,1+s.length,r,void 0,{typeAnnotation:"omit"});if(!t)return null;r=r||t.type,s.push(t)}if(!r)throw new Error("No output type");return i&&s.some(e=>t5(i,e.type))?new e(V3,s):new e(r,s)}evaluate(e){let t,n=null,r=0;for(const i of this.args)if(r++,n=i.evaluate(e),n&&n instanceof U5&&!n.available&&(t||(t=n.name),n=null,r===this.args.length&&(n=t)),null!==n)break;return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function a4(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function l4(e,t,n,r){return 0===r.compare(t,n)}function c4(e,t,n){const r="=="!==e&&"!="!==e;return class i{constructor(e,t,n){this.type=U3,this.lhs=e,this.rhs=t,this.collator=n,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const n=e[0];let s=t.parse(e[1],1,V3);if(!s)return null;if(!a4(n,s.type))return t.concat(1).error(`"${n}" comparisons are not supported for type '${Q3(s.type)}'.`);let o=t.parse(e[2],2,V3);if(!o)return null;if(!a4(n,o.type))return t.concat(2).error(`"${n}" comparisons are not supported for type '${Q3(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return t.error(`Cannot compare types '${Q3(s.type)}' and '${Q3(o.type)}'.`);r&&("value"===s.type.kind&&"value"!==o.type.kind?s=new K5(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new K5(s.type,[o])));let a=null;if(4===e.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,W3),!a)return null}return new i(s,o,a)}evaluate(i){const s=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(r&&this.hasUntypedArgument){const t=V5(s),n=V5(o);if(t.kind!==n.kind||"string"!==t.kind&&"number"!==t.kind)throw new D5(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${n.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){const e=V5(s),n=V5(o);if("string"!==e.kind||"string"!==n.kind)return t(i,s,o)}return this.collator?n(i,s,o,this.collator.evaluate(i)):t(i,s,o)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}var u4=c4("==",function(e,t,n){return t===n},l4),h4=c4("!=",function(e,t,n){return t!==n},function(e,t,n,r){return!l4(0,t,n,r)}),d4=c4("<",function(e,t,n){return t<n},function(e,t,n,r){return r.compare(t,n)<0}),p4=c4(">",function(e,t,n){return t>n},function(e,t,n,r){return r.compare(t,n)>0}),f4=c4("<=",function(e,t,n){return t<=n},function(e,t,n,r){return r.compare(t,n)<=0}),g4=c4(">=",function(e,t,n){return t>=n},function(e,t,n,r){return r.compare(t,n)>=0}),m4=class e{constructor(e,t,n){this.type=W3,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(t,n){if(2!==t.length)return n.error("Expected one argument.");const r=t[1];if("object"!=typeof r||Array.isArray(r))return n.error("Collator options argument must be an object.");const i=n.parse(void 0!==r["case-sensitive"]&&r["case-sensitive"],1,U3);if(!i)return null;const s=n.parse(void 0!==r["diacritic-sensitive"]&&r["diacritic-sensitive"],1,U3);if(!s)return null;let o=null;return r.locale&&(o=n.parse(r.locale,1,j3),!o)?null:new e(i,s,o)}evaluate(e){return new I5(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},y4=8192;function v4(e,t){const n=(180+e[0])/360,r=(i=e[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360);var i;const s=Math.pow(2,t.z);return[Math.round(n*s*y4),Math.round(r*s*y4)]}function b4(e,t){const n=Math.pow(2,t.z);return[(i=(e[0]/y4+t.x)/n,360*i-180),(r=(e[1]/y4+t.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,i}function w4(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function _4(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function x4(e,t,n){return t[1]>e[1]!=n[1]>e[1]&&e[0]<(n[0]-t[0])*(e[1]-t[1])/(n[1]-t[1])+t[0]}function C4(e,t,n){const r=e[0]-t[0],i=e[1]-t[1],s=e[0]-n[0],o=e[1]-n[1];return r*o-s*i===0&&r*s<=0&&i*o<=0}function S4(e,t,n,r){const i=[t[0]-e[0],t[1]-e[1]];return 0!==function(e,t){return e[0]*t[1]-e[1]*t[0]}([r[0]-n[0],r[1]-n[1]],i)&&!(!I4(e,t,n,r)||!I4(n,r,e,t))}function k4(e,t,n){for(const r of n)for(let n=0;n<r.length-1;++n)if(S4(e,t,r[n],r[n+1]))return!0;return!1}function E4(e,t,n=!1){let r=!1;for(const i of t)for(let t=0;t<i.length-1;t++){if(C4(e,i[t],i[t+1]))return n;x4(e,i[t],i[t+1])&&(r=!r)}return r}function R4(e,t){for(const n of t)if(E4(e,n))return!0;return!1}function T4(e,t){for(const n of e)if(!E4(n,t))return!1;for(let n=0;n<e.length-1;++n)if(k4(e[n],e[n+1],t))return!1;return!0}function L4(e,t){for(const n of t)if(T4(e,n))return!0;return!1}function I4(e,t,n,r){const i=e[0]-n[0],s=e[1]-n[1],o=t[0]-n[0],a=t[1]-n[1],l=r[0]-n[0],c=r[1]-n[1],u=i*c-l*s,h=o*c-l*a;return u>0&&h<0||u<0&&h>0}function P4(e,t,n){const r=[];for(let i=0;i<e.length;i++){const s=[];for(let r=0;r<e[i].length;r++){const o=v4(e[i][r],n);w4(t,o),s.push(o)}r.push(s)}return r}function M4(e,t,n){const r=[];for(let i=0;i<e.length;i++){const s=P4(e[i],t,n);r.push(s)}return r}function A4(e,t,n,r){if(e[0]<n[0]||e[0]>n[2]){const t=.5*r;let i=e[0]-n[0]>t?-r:n[0]-e[0]>t?r:0;0===i&&(i=e[0]-n[2]>t?-r:n[2]-e[0]>t?r:0),e[0]+=i}w4(t,e)}function O4(e,t,n,r){const i=Math.pow(2,r.z)*y4,s=[r.x*y4,r.y*y4],o=[];for(const a of e)for(const e of a){const r=[e.x+s[0],e.y+s[1]];A4(r,t,n,i),o.push(r)}return o}function N4(e,t,n,r){const i=Math.pow(2,r.z)*y4,s=[r.x*y4,r.y*y4],o=[];for(const a of e){const e=[];for(const n of a){const r=[n.x+s[0],n.y+s[1]];w4(t,r),e.push(r)}o.push(e)}if(t[2]-t[0]<=i/2){!function(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}(t);for(const e of o)for(const r of e)A4(r,t,n,i)}return o}var F4=class e{constructor(e,t){this.type=U3,this.geojson=e,this.geometries=t}static parse(t,n){if(2!==t.length)return n.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(q5(t[1])){const n=t[1];if("FeatureCollection"===n.type){const t=[];for(const e of n.features){const{type:n,coordinates:r}=e.geometry;"Polygon"===n&&t.push(r),"MultiPolygon"===n&&t.push(...r)}if(t.length)return new e(n,{type:"MultiPolygon",coordinates:t})}else if("Feature"===n.type){const t=n.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new e(n,n.geometry)}else if("Polygon"===n.type||"MultiPolygon"===n.type)return new e(n,n)}return n.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if("Polygon"===t.type){const s=P4(t.coordinates,r,i),o=O4(e.geometry(),n,r,i);if(!_4(n,r))return!1;for(const e of o)if(!E4(e,s))return!1}if("MultiPolygon"===t.type){const s=M4(t.coordinates,r,i),o=O4(e.geometry(),n,r,i);if(!_4(n,r))return!1;for(const e of o)if(!R4(e,s))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if("Polygon"===t.type){const s=P4(t.coordinates,r,i),o=N4(e.geometry(),n,r,i);if(!_4(n,r))return!1;for(const e of o)if(!T4(e,s))return!1}if("MultiPolygon"===t.type){const s=M4(t.coordinates,r,i),o=N4(e.geometry(),n,r,i);if(!_4(n,r))return!1;for(const e of o)if(!L4(e,s))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},D4=class{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:n}=this,r=t[e];for(;e>0;){const i=e-1>>1,s=t[i];if(n(r,s)>=0)break;t[e]=s,e=i}t[e]=r}_down(e){const{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e<r;){let r=1+(e<<1);const s=r+1;if(s<this.length&&n(t[s],t[r])<0&&(r=s),n(t[r],i)>=0)break;t[e]=t[r],e=r}t[e]=i}};function z4(e){let t=0;for(let n,r,i=0,s=e.length,o=s-1;i<s;o=i++)n=e[i],r=e[o],t+=(r.x-n.x)*(n.y+r.y);return t}var j4=Math.PI/180,U4=class{constructor(e){const t=6378.137*j4*1e3,n=Math.cos(e*j4),r=1/(1-.0066943799901413165*(1-n*n)),i=Math.sqrt(r);this.kx=t*i*n,this.ky=t*i*r*.9933056200098587}distance(e,t){const n=this.wrap(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(n*n+r*r)}pointOnLine(e,t){let n,r,i,s,o=1/0;for(let a=0;a<e.length-1;a++){let l=e[a][0],c=e[a][1],u=this.wrap(e[a+1][0]-l)*this.kx,h=(e[a+1][1]-c)*this.ky,d=0;0===u&&0===h||(d=(this.wrap(t[0]-l)*this.kx*u+(t[1]-c)*this.ky*h)/(u*u+h*h),d>1?(l=e[a+1][0],c=e[a+1][1]):d>0&&(l+=u/this.kx*d,c+=h/this.ky*d)),u=this.wrap(t[0]-l)*this.kx,h=(t[1]-c)*this.ky;const p=u*u+h*h;p<o&&(o=p,n=l,r=c,i=a,s=d)}return{point:[n,r],index:i,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}};function B4(e,t){return t[0]-e[0]}function $4(e){return e[1]-e[0]+1}function q4(e,t){return e[1]>=e[0]&&e[1]<t}function V4(e,t){if(e[0]>e[1])return[null,null];const n=$4(e);if(t){if(2===n)return[e,null];const t=Math.floor(n/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===n)return[e,null];const r=Math.floor(n/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function W4(e,t){if(!q4(t,e.length))return[1/0,1/0,-1/0,-1/0];const n=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)w4(n,e[r]);return n}function H4(e){const t=[1/0,1/0,-1/0,-1/0];for(const n of e)for(const e of n)w4(t,e);return t}function G4(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function K4(e,t,n){if(!G4(e)||!G4(t))return NaN;let r=0,i=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(i=e[1]-t[3]),e[3]<t[1]&&(i=t[1]-e[3]),n.distance([0,0],[r,i])}function Z4(e,t,n){const r=n.pointOnLine(t,e);return n.distance(e,r.point)}function Y4(e,t,n,r,i){const s=Math.min(Z4(e,[n,r],i),Z4(t,[n,r],i)),o=Math.min(Z4(n,[e,t],i),Z4(r,[e,t],i));return Math.min(s,o)}function X4(e,t,n,r,i){if(!q4(t,e.length)||!q4(r,n.length))return 1/0;let s=1/0;for(let o=t[0];o<t[1];++o){const t=e[o],a=e[o+1];for(let e=r[0];e<r[1];++e){const r=n[e],o=n[e+1];if(S4(t,a,r,o))return 0;s=Math.min(s,Y4(t,a,r,o,i))}}return s}function J4(e,t,n,r,i){if(!q4(t,e.length)||!q4(r,n.length))return NaN;let s=1/0;for(let o=t[0];o<=t[1];++o)for(let t=r[0];t<=r[1];++t)if(s=Math.min(s,i.distance(e[o],n[t])),0===s)return s;return s}function Q4(e,t,n){if(E4(e,t,!0))return 0;let r=1/0;for(const i of t){const t=i[0],s=i[i.length-1];if(t!==s&&(r=Math.min(r,Z4(e,[s,t],n)),0===r))return r;const o=n.pointOnLine(i,e);if(r=Math.min(r,n.distance(e,o.point)),0===r)return r}return r}function e6(e,t,n,r){if(!q4(t,e.length))return NaN;for(let s=t[0];s<=t[1];++s)if(E4(e[s],n,!0))return 0;let i=1/0;for(let s=t[0];s<t[1];++s){const t=e[s],o=e[s+1];for(const e of n)for(let n=0,s=e.length,a=s-1;n<s;a=n++){const s=e[a],l=e[n];if(S4(t,o,s,l))return 0;i=Math.min(i,Y4(t,o,s,l,r))}}return i}function t6(e,t){for(const n of e)for(const e of n)if(E4(e,t,!0))return!0;return!1}function n6(e,t,n,r=1/0){const i=H4(e),s=H4(t);if(r!==1/0&&K4(i,s,n)>=r)return r;if(_4(i,s)){if(t6(e,t))return 0}else if(t6(t,e))return 0;let o=1/0;for(const a of e)for(let e=0,r=a.length,i=r-1;e<r;i=e++){const r=a[i],s=a[e];for(const e of t)for(let t=0,i=e.length,a=i-1;t<i;a=t++){const i=e[a],l=e[t];if(S4(r,s,i,l))return 0;o=Math.min(o,Y4(r,s,i,l,n))}}return o}function r6(e,t,n,r,i,s){if(!s)return;const o=K4(W4(r,s),i,n);o<t&&e.push([o,s,[0,0]])}function i6(e,t,n,r,i,s,o){if(!s||!o)return;const a=K4(W4(r,s),W4(i,o),n);a<t&&e.push([a,s,o])}function s6(e,t,n,r,i=1/0){let s=Math.min(r.distance(e[0],n[0][0]),i);if(0===s)return s;const o=new D4([[0,[0,e.length-1],[0,0]]],B4),a=H4(n);for(;o.length>0;){const i=o.pop();if(i[0]>=s)continue;const l=i[1],c=t?50:100;if($4(l)<=c){if(!q4(l,e.length))return NaN;if(t){const t=e6(e,l,n,r);if(isNaN(t)||0===t)return t;s=Math.min(s,t)}else for(let t=l[0];t<=l[1];++t){const i=Q4(e[t],n,r);if(s=Math.min(s,i),0===s)return 0}}else{const n=V4(l,t);r6(o,s,r,e,a,n[0]),r6(o,s,r,e,a,n[1])}}return s}function o6(e,t,n,r,i,s=1/0){let o=Math.min(s,i.distance(e[0],n[0]));if(0===o)return o;const a=new D4([[0,[0,e.length-1],[0,n.length-1]]],B4);for(;a.length>0;){const s=a.pop();if(s[0]>=o)continue;const l=s[1],c=s[2],u=t?50:100,h=r?50:100;if($4(l)<=u&&$4(c)<=h){if(!q4(l,e.length)&&q4(c,n.length))return NaN;let s;if(t&&r)s=X4(e,l,n,c,i),o=Math.min(o,s);else if(t&&!r){const t=e.slice(l[0],l[1]+1);for(let e=c[0];e<=c[1];++e)if(s=Z4(n[e],t,i),o=Math.min(o,s),0===o)return o}else if(!t&&r){const t=n.slice(c[0],c[1]+1);for(let n=l[0];n<=l[1];++n)if(s=Z4(e[n],t,i),o=Math.min(o,s),0===o)return o}else s=J4(e,l,n,c,i),o=Math.min(o,s)}else{const s=V4(l,t),u=V4(c,r);i6(a,o,i,e,n,s[0],u[0]),i6(a,o,i,e,n,s[0],u[1]),i6(a,o,i,e,n,s[1],u[0]),i6(a,o,i,e,n,s[1],u[1])}}return o}function a6(e){return"MultiPolygon"===e.type?e.coordinates.map(e=>({type:"Polygon",coordinates:e})):"MultiLineString"===e.type?e.coordinates.map(e=>({type:"LineString",coordinates:e})):"MultiPoint"===e.type?e.coordinates.map(e=>({type:"Point",coordinates:e})):[e]}var l6=class e{constructor(e,t){this.type=z3,this.geojson=e,this.geometries=t}static parse(t,n){if(2!==t.length)return n.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(q5(t[1])){const n=t[1];if("FeatureCollection"===n.type)return new e(n,n.features.map(e=>a6(e.geometry)).flat());if("Feature"===n.type)return new e(n,a6(n.geometry));if("type"in n&&"coordinates"in n)return new e(n,a6(n))}return n.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const n=e.geometry(),r=n.flat().map(t=>b4([t.x,t.y],e.canonical));if(0===n.length)return NaN;const i=new U4(r[0][1]);let s=1/0;for(const o of t){switch(o.type){case"Point":s=Math.min(s,o6(r,!1,[o.coordinates],!1,i,s));break;case"LineString":s=Math.min(s,o6(r,!1,o.coordinates,!0,i,s));break;case"Polygon":s=Math.min(s,s6(r,!1,o.coordinates,i,s))}if(0===s)return s}return s}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const n=e.geometry(),r=n.flat().map(t=>b4([t.x,t.y],e.canonical));if(0===n.length)return NaN;const i=new U4(r[0][1]);let s=1/0;for(const o of t){switch(o.type){case"Point":s=Math.min(s,o6(r,!0,[o.coordinates],!1,i,s));break;case"LineString":s=Math.min(s,o6(r,!0,o.coordinates,!0,i,s));break;case"Polygon":s=Math.min(s,s6(r,!0,o.coordinates,i,s))}if(0===s)return s}return s}(e,this.geometries);if("Polygon"===e.geometryType())return function(e,t){const n=e.geometry();if(0===n.length||0===n[0].length)return NaN;const r=function(e){if(e.length<=1)return[e];const t=[];let n,r;for(const i of e){const e=z4(i);0!==e&&(i.area=Math.abs(e),void 0===r&&(r=e<0),r===e<0?(n&&t.push(n),n=[i]):n.push(i))}return n&&t.push(n),t}(n).map(t=>t.map(t=>t.map(t=>b4([t.x,t.y],e.canonical)))),i=new U4(r[0][0][0][1]);let s=1/0;for(const o of t)for(const e of r){switch(o.type){case"Point":s=Math.min(s,s6([o.coordinates],!1,e,i,s));break;case"LineString":s=Math.min(s,s6(o.coordinates,!0,e,i,s));break;case"Polygon":s=Math.min(s,n6(e,o.coordinates,i,s))}if(0===s)return s}return s}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},c6=class e{constructor(e){this.type=V3,this.key=e}static parse(t,n){if(2!==t.length)return n.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=t[1];return null==r?n.error("Global state property must be defined."):"string"!=typeof r?n.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new e(r)}evaluate(e){const t=e.globals?.globalState;return t&&0!==Object.keys(t).length?_5(t,this.key)??null:null}eachChild(){}outputDefined(){return!1}},u6={"==":u4,"!=":h4,">":p4,"<":d4,">=":g4,"<=":f4,array:K5,at:class e{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(t,n){if(3!==t.length)return n.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=n.parse(t[1],1,z3),i=n.parse(t[2],2,J3(n.expectedType||V3));if(!r||!i)return null;const s=i.type;return new e(s.itemType,r,i)}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new D5(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new D5(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new D5(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},boolean:K5,case:class e{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(t,n){if(t.length<4)return n.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return n.error("Expected an odd number of arguments.");let r;n.expectedType&&"value"!==n.expectedType.kind&&(r=n.expectedType);const i=[];for(let e=1;e<t.length-1;e+=2){const s=n.parse(t[e],e,U3);if(!s)return null;const o=n.parse(t[e+1],e+1,r);if(!o)return null;i.push([s,o]),r=r||o.type}const s=n.parse(t[t.length-1],t.length-1,r);if(!s)return null;if(!r)throw new Error("Can't infer output type");return new e(r,i,s)}evaluate(e){for(const[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}},coalesce:o4,collator:m4,format:class e{constructor(e){this.type=H3,this.sections=e}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return n.error("First argument must be an image or text section.");const i=[];let s=!1;for(let e=1;e<=t.length-1;++e){const r=t[e];if(s&&"object"==typeof r&&!Array.isArray(r)){s=!1;let e=null;if(r["font-scale"]&&(e=n.parse(r["font-scale"],1,z3),!e))return null;let t=null;if(r["text-font"]&&(t=n.parse(r["text-font"],1,J3(j3)),!t))return null;let o=null;if(r["text-color"]&&(o=n.parse(r["text-color"],1,B3),!o))return null;let a=null;if(r["vertical-align"]){if("string"==typeof r["vertical-align"]&&!P5.includes(r["vertical-align"]))return n.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${r["vertical-align"]}' instead.`);if(a=n.parse(r["vertical-align"],1,j3),!a)return null}const l=i[i.length-1];l.scale=e,l.font=t,l.textColor=o,l.verticalAlign=a}else{const r=n.parse(t[e],1,V3);if(!r)return null;const o=r.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");s=!0,i.push({content:r,scale:null,font:null,textColor:null,verticalAlign:null})}}return new e(i)}evaluate(e){return new A5(this.sections.map(t=>{const n=t.content.evaluate(e);return V5(n)===Y3?new M5("",n,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new M5(W5(n),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)}))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}},image:class e{constructor(e){this.type=Y3,this.input=e}static parse(t,n){if(2!==t.length)return n.error("Expected two arguments.");const r=n.parse(t[1],1,j3);return r?new e(r):n.error("No image name provided.")}evaluate(e){const t=this.input.evaluate(e),n=U5.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},in:class e{constructor(e,t){this.type=U3,this.needle=e,this.haystack=t}static parse(t,n){if(3!==t.length)return n.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=n.parse(t[1],1,V3),i=n.parse(t[2],2,V3);return r&&i?n5(r.type,[U3,j3,z3,D3,V3])?new e(r,i):n.error(`Expected first argument to be of type boolean, string, number or null, but found ${Q3(r.type)} instead`):null}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!r5(t,["boolean","string","number","null"]))throw new D5(`Expected first argument to be of type boolean, string, number or null, but found ${Q3(V5(t))} instead.`);if(!r5(n,["string","array"]))throw new D5(`Expected second argument to be of type array or string, but found ${Q3(V5(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},"index-of":class e{constructor(e,t,n){this.type=z3,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const r=n.parse(t[1],1,V3),i=n.parse(t[2],2,V3);if(!r||!i)return null;if(!n5(r.type,[U3,j3,z3,D3,V3]))return n.error(`Expected first argument to be of type boolean, string, number or null, but found ${Q3(r.type)} instead`);if(4===t.length){const s=n.parse(t[3],3,z3);return s?new e(r,i,s):null}return new e(r,i)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!r5(t,["boolean","string","number","null"]))throw new D5(`Expected first argument to be of type boolean, string, number or null, but found ${Q3(V5(t))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(e)),r5(n,["string"])){const e=n.indexOf(t,r);return-1===e?-1:[...n.slice(0,e)].length}if(r5(n,["array"]))return n.indexOf(t,r);throw new D5(`Expected second argument to be of type array or string, but found ${Q3(V5(n))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},interpolate:i4,"interpolate-hcl":i4,"interpolate-lab":i4,length:class e{constructor(e){this.type=z3,this.input=e}static parse(t,n){if(2!==t.length)return n.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=n.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?n.error(`Expected argument of type string or array, but found ${Q3(r.type)} instead.`):new e(r):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return[...t].length;if(Array.isArray(t))return t.length;throw new D5(`Expected value to be of type string or array, but found ${Q3(V5(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}},let:e4,literal:H5,match:class e{constructor(e,t,n,r,i,s){this.inputType=e,this.type=t,this.input=n,this.cases=r,this.outputs=i,this.otherwise=s}static parse(t,n){if(t.length<5)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return n.error("Expected an even number of arguments.");let r,i;n.expectedType&&"value"!==n.expectedType.kind&&(i=n.expectedType);const s={},o=[];for(let e=2;e<t.length-1;e+=2){let a=t[e];const l=t[e+1];Array.isArray(a)||(a=[a]);const c=n.concat(e);if(0===a.length)return c.error("Expected at least one branch label.");for(const e of a){if("number"!=typeof e&&"string"!=typeof e)return c.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return c.error("Numeric branch labels must be integer values.");if(r){if(c.checkSubtype(r,V5(e)))return null}else r=V5(e);if(void 0!==s[String(e)])return c.error("Branch labels must be unique.");s[String(e)]=o.length}const u=n.parse(l,e,i);if(!u)return null;i=i||u.type,o.push(u)}const a=n.parse(t[1],1,V3);if(!a)return null;const l=n.parse(t[t.length-1],t.length-1,i);return l?"value"!==a.type.kind&&n.concat(1).checkSubtype(r,a.type)?null:new e(r,i,a,s,o,l):null}evaluate(e){const t=this.input.evaluate(e);return(V5(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},number:K5,"number-format":class e{constructor(e,t,n,r,i,s){this.type=j3,this.number=e,this.locale=t,this.currency=n,this.unit=r,this.minFractionDigits=i,this.maxFractionDigits=s}static parse(t,n){if(3!==t.length)return n.error("Expected two arguments.");const r=n.parse(t[1],1,z3);if(!r)return null;const i=t[2];if("object"!=typeof i||Array.isArray(i))return n.error("NumberFormat options argument must be an object.");let s=null;if(i.locale&&(s=n.parse(i.locale,1,j3),!s))return null;let o=null;if(i.currency&&(o=n.parse(i.currency,1,j3),!o))return null;let a=null;if(i.unit&&(a=n.parse(i.unit,1,j3),!a))return null;if(o&&a)return n.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(i["min-fraction-digits"]&&(l=n.parse(i["min-fraction-digits"],1,z3),!l))return null;let c=null;return i["max-fraction-digits"]&&(c=n.parse(i["max-fraction-digits"],1,z3),!c)?null:new e(r,s,o,a,l,c)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},object:K5,slice:class e{constructor(e,t,n,r){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=r}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);const r=n.parse(t[1],1,V3),i=n.parse(t[2],2,z3);if(!r||!i)return null;if(!n5(r.type,[J3(V3),j3,V3]))return n.error(`Expected first argument to be of type array or string, but found ${Q3(r.type)} instead`);if(4===t.length){const s=n.parse(t[3],3,z3);return s?new e(r.type,r,i,s):null}return new e(r.type,r,i)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);let r;if(this.endIndex&&(r=this.endIndex.evaluate(e)),r5(t,["string"]))return[...t].slice(n,r).join("");if(r5(t,["array"]))return t.slice(n,r);throw new D5(`Expected first argument to be of type array or string, but found ${Q3(V5(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}},step:r4,string:K5,"to-boolean":Y5,"to-color":Y5,"to-number":Y5,"to-string":Y5,var:t4,within:F4,distance:l6,"global-state":c6},h6=class e{constructor(e,t,n,r){this.name=e,this.type=t,this._evaluate=n,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(t,n){const r=t[0],i=e.definitions[r];if(!i)return n.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const s=Array.isArray(i)?i[0]:i.type,o=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,a=o.filter(([e])=>!Array.isArray(e)||e.length===t.length-1);let l=null;for(const[c,u]of a){l=new Q5(n.registry,m6,n.path,null,n.scope);const i=[];let o=!1;for(let e=1;e<t.length;e++){const n=t[e],r=Array.isArray(c)?c[e-1]:c.type,s=l.parse(n,1+i.length,r);if(!s){o=!0;break}i.push(s)}if(!o)if(Array.isArray(c)&&c.length!==i.length)l.error(`Expected ${c.length} arguments, but found ${i.length} instead.`);else{for(let e=0;e<i.length;e++){const t=Array.isArray(c)?c[e]:c.type,n=i[e];l.concat(e+1).checkSubtype(t,n.type)}if(0===l.errors.length)return new e(r,s,u,i)}}if(1===a.length)n.errors.push(...l.errors);else{const e=(a.length?a:o).map(([e])=>{return t=e,Array.isArray(t)?`(${t.map(Q3).join(", ")})`:`(${Q3(t.type)}...)`;var t}).join(" | "),r=[];for(let i=1;i<t.length;i++){const e=n.parse(t[i],1+r.length);if(!e)return null;r.push(Q3(e.type))}n.error(`Expected arguments of type ${e}, but found (${r.join(", ")}) instead.`)}return null}static register(t,n){e.definitions=n;for(const r in n)t[r]=e}};function d6(e,[t,n,r,i]){t=t.evaluate(e),n=n.evaluate(e),r=r.evaluate(e);const s=i?i.evaluate(e):1,o=$5(t,n,r,s);if(o)throw new D5(o);return new L5(t/255,n/255,r/255,s,!1)}function p6(e,t){return e in t}function f6(e,t){const n=t[e];return void 0===n?null:n}function g6(e){return{type:e}}function m6(e){if(e instanceof t4)return m6(e.boundExpression);if(e instanceof h6&&"error"===e.name)return!1;if(e instanceof m4)return!1;if(e instanceof F4)return!1;if(e instanceof l6)return!1;if(e instanceof c6)return!1;const t=e instanceof Y5||e instanceof K5;let n=!0;return e.eachChild(e=>{n=t?n&&m6(e):n&&e instanceof H5}),!!n&&y6(e)&&b6(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function y6(e){if(e instanceof h6){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof F4)return!1;if(e instanceof l6)return!1;let t=!0;return e.eachChild(e=>{t&&!y6(e)&&(t=!1)}),t}function v6(e){if(e instanceof h6&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!v6(e)&&(t=!1)}),t}function b6(e,t){if(e instanceof h6&&t.indexOf(e.name)>=0)return!1;let n=!0;return e.eachChild(e=>{n&&!b6(e,t)&&(n=!1)}),n}function w6(e){return{result:"success",value:e}}function _6(e){return{result:"error",value:e}}function x6(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function C6(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function S6(e){return!!e.expression&&e.expression.interpolated}function k6(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function E6(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&V5(e)===q3}h6.register(u6,{error:[{kind:"error"},[j3],(e,[t])=>{throw new D5(t.evaluate(e))}],typeof:[j3,[V3],(e,[t])=>Q3(V5(t.evaluate(e)))],"to-rgba":[J3(z3,4),[B3],(e,[t])=>{const[n,r,i,s]=t.evaluate(e).rgb;return[255*n,255*r,255*i,s]}],rgb:[B3,[z3,z3,z3],d6],rgba:[B3,[z3,z3,z3,z3],d6],has:{type:U3,overloads:[[[j3],(e,[t])=>p6(t.evaluate(e),e.properties())],[[j3,q3],(e,[t,n])=>p6(t.evaluate(e),n.evaluate(e))]]},get:{type:V3,overloads:[[[j3],(e,[t])=>f6(t.evaluate(e),e.properties())],[[j3,q3],(e,[t,n])=>f6(t.evaluate(e),n.evaluate(e))]]},"feature-state":[V3,[j3],(e,[t])=>f6(t.evaluate(e),e.featureState||{})],properties:[q3,[],e=>e.properties()],"geometry-type":[j3,[],e=>e.geometryType()],id:[V3,[],e=>e.id()],zoom:[z3,[],e=>e.globals.zoom],"heatmap-density":[z3,[],e=>e.globals.heatmapDensity||0],elevation:[z3,[],e=>e.globals.elevation||0],"line-progress":[z3,[],e=>e.globals.lineProgress||0],accumulated:[V3,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[z3,g6(z3),(e,t)=>{let n=0;for(const r of t)n+=r.evaluate(e);return n}],"*":[z3,g6(z3),(e,t)=>{let n=1;for(const r of t)n*=r.evaluate(e);return n}],"-":{type:z3,overloads:[[[z3,z3],(e,[t,n])=>t.evaluate(e)-n.evaluate(e)],[[z3],(e,[t])=>-t.evaluate(e)]]},"/":[z3,[z3,z3],(e,[t,n])=>t.evaluate(e)/n.evaluate(e)],"%":[z3,[z3,z3],(e,[t,n])=>t.evaluate(e)%n.evaluate(e)],ln2:[z3,[],()=>Math.LN2],pi:[z3,[],()=>Math.PI],e:[z3,[],()=>Math.E],"^":[z3,[z3,z3],(e,[t,n])=>Math.pow(t.evaluate(e),n.evaluate(e))],sqrt:[z3,[z3],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[z3,[z3],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[z3,[z3],(e,[t])=>Math.log(t.evaluate(e))],log2:[z3,[z3],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[z3,[z3],(e,[t])=>Math.sin(t.evaluate(e))],cos:[z3,[z3],(e,[t])=>Math.cos(t.evaluate(e))],tan:[z3,[z3],(e,[t])=>Math.tan(t.evaluate(e))],asin:[z3,[z3],(e,[t])=>Math.asin(t.evaluate(e))],acos:[z3,[z3],(e,[t])=>Math.acos(t.evaluate(e))],atan:[z3,[z3],(e,[t])=>Math.atan(t.evaluate(e))],min:[z3,g6(z3),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[z3,g6(z3),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[z3,[z3],(e,[t])=>Math.abs(t.evaluate(e))],round:[z3,[z3],(e,[t])=>{const n=t.evaluate(e);return n<0?-Math.round(-n):Math.round(n)}],floor:[z3,[z3],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[z3,[z3],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[U3,[j3,V3],(e,[t,n])=>e.properties()[t.value]===n.value],"filter-id-==":[U3,[V3],(e,[t])=>e.id()===t.value],"filter-type-==":[U3,[j3],(e,[t])=>e.geometryType()===t.value],"filter-<":[U3,[j3,V3],(e,[t,n])=>{const r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r<i}],"filter-id-<":[U3,[V3],(e,[t])=>{const n=e.id(),r=t.value;return typeof n==typeof r&&n<r}],"filter->":[U3,[j3,V3],(e,[t,n])=>{const r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>i}],"filter-id->":[U3,[V3],(e,[t])=>{const n=e.id(),r=t.value;return typeof n==typeof r&&n>r}],"filter-<=":[U3,[j3,V3],(e,[t,n])=>{const r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[U3,[V3],(e,[t])=>{const n=e.id(),r=t.value;return typeof n==typeof r&&n<=r}],"filter->=":[U3,[j3,V3],(e,[t,n])=>{const r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[U3,[V3],(e,[t])=>{const n=e.id(),r=t.value;return typeof n==typeof r&&n>=r}],"filter-has":[U3,[V3],(e,[t])=>t.value in e.properties()],"filter-has-id":[U3,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[U3,[J3(j3)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[U3,[J3(V3)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[U3,[j3,J3(V3)],(e,[t,n])=>n.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[U3,[j3,J3(V3)],(e,[t,n])=>function(e,t,n,r){for(;n<=r;){const i=n+r>>1;if(t[i]===e)return!0;t[i]>e?r=i-1:n=i+1}return!1}(e.properties()[t.value],n.value,0,n.value.length-1)],all:{type:U3,overloads:[[[U3,U3],(e,[t,n])=>t.evaluate(e)&&n.evaluate(e)],[g6(U3),(e,t)=>{for(const n of t)if(!n.evaluate(e))return!1;return!0}]]},any:{type:U3,overloads:[[[U3,U3],(e,[t,n])=>t.evaluate(e)||n.evaluate(e)],[g6(U3),(e,t)=>{for(const n of t)if(n.evaluate(e))return!0;return!1}]]},"!":[U3,[U3],(e,[t])=>!t.evaluate(e)],"is-supported-script":[U3,[j3],(e,[t])=>{const n=e.globals&&e.globals.isSupportedScript;return!n||n(t.evaluate(e))}],upcase:[j3,[j3],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[j3,[j3],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[j3,g6(V3),(e,t)=>t.map(t=>W5(t.evaluate(e))).join("")],split:[J3(j3),[j3,j3],(e,[t,n])=>t.evaluate(e).split(n.evaluate(e))],join:[j3,[J3(j3),j3],(e,[t,n])=>t.evaluate(e).join(n.evaluate(e))],"resolved-locale":[j3,[W3],(e,[t])=>t.evaluate(e).resolvedLocale()]});var R6=class{constructor(e,t,n){this.expression=e,this._warningHistory={},this._evaluator=new J5,this._defaultValue=t?function(e){if("color"===e.type&&E6(e.default))return new L5(0,0,0,0);switch(e.type){case"color":return L5.parse(e.default)||null;case"padding":return O5.parse(e.default)||null;case"numberArray":return N5.parse(e.default)||null;case"colorArray":return F5.parse(e.default)||null;case"variableAnchorOffsetCollection":return j5.parse(e.default)||null;case"projectionDefinition":return B5.parse(e.default)||null;default:return void 0===e.default?null:e.default}}(t):null,this._enumValues=t&&"enum"===t.type?t.values:null,this._globalState=n}evaluateWithoutErrorHandling(e,t,n,r,i,s){return this._globalState&&(e=N6(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,r,i,s){this._globalState&&(e=N6(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new D5(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(o){return this._warningHistory[o.message]||(this._warningHistory[o.message]=!0,"undefined"!=typeof console&&console.warn(o.message)),this._defaultValue}}};function T6(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in u6}function L6(e,t,n){const r=new Q5(u6,m6,[],t?function(e){const t={color:B3,string:j3,number:z3,enum:j3,boolean:U3,formatted:H3,padding:G3,numberArray:Z3,colorArray:K3,projectionDefinition:$3,resolvedImage:Y3,variableAnchorOffsetCollection:X3};return"array"===e.type?J3(t[e.value]||V3,e.length):t[e.type]}(t):void 0),i=r.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return i?w6(new R6(i,t,n)):_6(r.errors)}var I6=class{constructor(e,t,n){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!v6(t.expression),this.globalStateRefs=O6(t.expression),this._globalState=n}evaluateWithoutErrorHandling(e,t,n,r,i,s){return this._globalState&&(e=N6(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,s)}evaluate(e,t,n,r,i,s){return this._globalState&&(e=N6(e,this._globalState)),this._styleExpression.evaluate(e,t,n,r,i,s)}},P6=class{constructor(e,t,n,r,i){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent="camera"!==e&&!v6(t.expression),this.globalStateRefs=O6(t.expression),this.interpolationType=r,this._globalState=i}evaluateWithoutErrorHandling(e,t,n,r,i,s){return this._globalState&&(e=N6(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,s)}evaluate(e,t,n,r,i,s){return this._globalState&&(e=N6(e,this._globalState)),this._styleExpression.evaluate(e,t,n,r,i,s)}interpolationFactor(e,t,n){return this.interpolationType?i4.interpolationFactor(this.interpolationType,e,t,n):0}};function M6(e,t,n){const r=L6(e,t,n);if("error"===r.result)return r;const i=r.value.expression,s=y6(i);if(!s&&!x6(t))return _6([new N3("","data expressions not supported")]);const o=b6(i,["zoom"]);if(!o&&!C6(t))return _6([new N3("","zoom expressions not supported")]);const a=A6(i);if(!a&&!o)return _6([new N3("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof N3)return _6([a]);if(a instanceof i4&&!S6(t))return _6([new N3("",'"interpolate" expressions cannot be used with this property')]);if(!a)return w6(new I6(s?"constant":"source",r.value,n));const l=a instanceof i4?a.interpolation:void 0;return w6(new P6(s?"camera":"composite",r.value,a.labels,l,n))}function A6(e){let t=null;if(e instanceof e4)t=A6(e.result);else if(e instanceof o4){for(const n of e.args)if(t=A6(n),t)break}else(e instanceof r4||e instanceof i4)&&e.input instanceof h6&&"zoom"===e.input.name&&(t=e);return t instanceof N3||e.eachChild(e=>{const n=A6(e);n instanceof N3?t=n:!t&&n?t=new N3("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&n&&t!==n&&(t=new N3("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function O6(e,t=new Set){return e instanceof c6&&t.add(e.key),e.eachChild(e=>{O6(e,t)}),t}function N6(e,t){const{zoom:n,heatmapDensity:r,elevation:i,lineProgress:s,isSupportedScript:o,accumulated:a}=e??{};return{zoom:n,heatmapDensity:r,elevation:i,lineProgress:s,isSupportedScript:o,accumulated:a,globalState:t}}function F6(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!F6(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}var D6={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function z6(e,t){return e<t?-1:e>t?1:0}function j6(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(j6(e[t]))return!0;return!1}function U6(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?B6(e[1],e[2],"=="):"!="===t?V6(B6(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?B6(e[1],e[2],t):"any"===t?(n=e.slice(1),["any"].concat(n.map(U6))):"all"===t?["all"].concat(e.slice(1).map(U6)):"none"===t?["all"].concat(e.slice(1).map(U6).map(V6)):"in"===t?$6(e[1],e.slice(2)):"!in"===t?V6($6(e[1],e.slice(2))):"has"===t?q6(e[1]):"!has"!==t||V6(q6(e[1]));var n}function B6(e,t,n){switch(e){case"$type":return[`filter-type-${n}`,t];case"$id":return[`filter-id-${n}`,t];default:return[`filter-${n}`,e,t]}}function $6(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort(z6)]]:["filter-in-small",e,["literal",t]]}}function q6(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function V6(e){return["!",e]}function W6(e){return"object"==typeof e?["literal",e]:e}function H6(e,t){let n=e.stops;if(!n)return function(e,t){const n=["get",e.property];if(void 0===e.default)return"string"===t.type?["string",n]:n;if("enum"===t.type)return["match",n,Object.keys(t.values),n,e.default];{const r=["color"===t.type?"to-color":t.type,n,W6(e.default)];return"array"===t.type&&r.splice(1,0,t.value,t.length||null),r}}(e,t);const r=n&&"object"==typeof n[0][0],i=r||void 0!==e.property,s=r||!i;return n=n.map(e=>!i&&t.tokens&&"string"==typeof e[1]?[e[0],Q6(e[1])]:[e[0],W6(e[1])]),r?function(e,t,n){const r={},i={},s=[];for(let o=0;o<n.length;o++){const t=n[o],a=t[0].zoom;void 0===r[a]&&(r[a]={zoom:a,type:e.type,property:e.property,default:e.default},i[a]=[],s.push(a)),i[a].push([t[0].value,t[1]])}if("exponential"===J6({},t)){const n=[G6(e),["linear"],["zoom"]];for(const e of s)X6(n,e,Z6(r[e],t,i[e]),!1);return n}{const e=["step",["zoom"]];for(const n of s)X6(e,n,Z6(r[n],t,i[n]),!0);return Y6(e),e}}(e,t,n):s?function(e,t,n,r=["zoom"]){const i=J6(e,t);let s,o=!1;if("interval"===i)s=["step",r],o=!0;else{if("exponential"!==i)throw new Error(`Unknown zoom function type "${i}"`);{const t=void 0!==e.base?e.base:1;s=[G6(e),1===t?["linear"]:["exponential",t],r]}}for(const a of n)X6(s,a[0],a[1],o);return Y6(s),s}(e,t,n):Z6(e,t,n)}function G6(e){switch(e.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function K6(e,t){const n=W6((r=e.default,i=t.default,void 0!==r?r:void 0!==i?i:void 0));var r,i;return void 0===n&&"resolvedImage"===t.type?"":n}function Z6(e,t,n){const r=J6(e,t),i=["get",e.property];if("categorical"===r&&"boolean"==typeof n[0][0]){const r=["case"];for(const e of n)r.push(["==",i,e[0]],e[1]);return r.push(K6(e,t)),r}if("categorical"===r){const r=["match",i];for(const e of n)X6(r,e[0],e[1],!1);return r.push(K6(e,t)),r}if("interval"===r){const t=["step",["number",i]];for(const e of n)X6(t,e[0],e[1],!0);return Y6(t),void 0===e.default?t:["case",["==",["typeof",i],"number"],t,W6(e.default)]}if("exponential"===r){const t=void 0!==e.base?e.base:1,r=[G6(e),1===t?["linear"]:["exponential",t],["number",i]];for(const e of n)X6(r,e[0],e[1],!1);return void 0===e.default?r:["case",["==",["typeof",i],"number"],r,W6(e.default)]}throw new Error(`Unknown property function type ${r}`)}function Y6(e){"step"===e[0]&&3===e.length&&(e.push(0),e.push(e[3]))}function X6(e,t,n,r){e.length>3&&t===e[e.length-2]||(r&&2===e.length||e.push(t),e.push(n))}function J6(e,t){return e.type?e.type:t.expression.interpolated?"exponential":"interval"}function Q6(e){const t=["concat"],n=/{([^{}]+)}/g;let r=0;for(let i=n.exec(e);null!==i;i=n.exec(e)){const s=e.slice(r,n.lastIndex-i[0].length);r=n.lastIndex,s.length>0&&t.push(s),t.push(["get",i[1]])}if(1===t.length)return e;if(r<e.length)t.push(e.slice(r));else if(2===t.length)return["to-string",t[1]];return t}function e8(e){const t=e.key,n=e.value;return n?[new A3(t,n,"constants have been deprecated as of v8")]:[]}function t8(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function n8(e){if(Array.isArray(e))return e.map(n8);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const n in e)t[n]=n8(e[n]);return t}return t8(e)}function r8(e){const t=e.key,n=e.value,r=e.valueSpec||{},i=e.objectElementValidators||{},s=e.style,o=e.styleSpec,a=e.validateSpec;let l=[];const c=k6(n);if("object"!==c)return[new A3(t,n,`object expected, ${c} found`)];for(const u in n){const e=u.split(".")[0],c=_5(r,e)||r["*"];let h;if(_5(i,e))h=i[e];else if(_5(r,e)){if(void 0===n[u])continue;h=a}else if(i["*"])h=i["*"];else{if(!r["*"]){l.push(new A3(t,n[u],`unknown property "${u}"`));continue}h=a}l=l.concat(h({key:(t?`${t}.`:t)+u,value:n[u],valueSpec:c,style:s,styleSpec:o,object:n,objectKey:u,validateSpec:a},n))}for(const u in r)i[u]||r[u].required&&void 0===r[u].default&&void 0===n[u]&&l.push(new A3(t,n,`missing required property "${u}"`));return l}function i8(e){const t=e.value,n=e.valueSpec,r=e.validateSpec,i=e.style,s=e.styleSpec,o=e.key,a=e.arrayElementValidator||r;if("array"!==k6(t))return[new A3(o,t,`array expected, ${k6(t)} found`)];if(n.length&&t.length!==n.length)return[new A3(o,t,`array length ${n.length} expected, length ${t.length} found`)];let l={type:n.value,values:n.values};s.$version<7&&(l.function=n.function),"object"===k6(n.value)&&(l=n.value);let c=[];for(let u=0;u<t.length;u++)c=c.concat(a({array:t,arrayIndex:u,value:t[u],valueSpec:l,validateSpec:e.validateSpec,style:i,styleSpec:s,key:`${o}[${u}]`}));return c}function s8(e){const t=e.key,n=e.value,r=e.valueSpec;let i=k6(n);return"number"===i&&n!=n&&(i="NaN"),"number"!==i?[new A3(t,n,`number expected, ${i} found`)]:"minimum"in r&&n<r.minimum?[new A3(t,n,`${n} is less than the minimum value ${r.minimum}`)]:"maximum"in r&&n>r.maximum?[new A3(t,n,`${n} is greater than the maximum value ${r.maximum}`)]:[]}function o8(e){const t=e.valueSpec,n=t8(e.value.type);let r,i,s,o={};const a="categorical"!==n&&void 0===e.value.property,l=!a,c="array"===k6(e.value.stops)&&"array"===k6(e.value.stops[0])&&"object"===k6(e.value.stops[0][0]),u=r8({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===n)return[new A3(e.key,e.value,'identity function may not have a "stops" property')];let t=[];const r=e.value;return t=t.concat(i8({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:h})),"array"===k6(r)&&0===r.length&&t.push(new A3(e.key,r,"array must have at least one stop")),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===n&&a&&u.push(new A3(e.key,e.value,'missing required property "property"')),"identity"===n||e.value.stops||u.push(new A3(e.key,e.value,'missing required property "stops"')),"exponential"===n&&e.valueSpec.expression&&!S6(e.valueSpec)&&u.push(new A3(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!x6(e.valueSpec)?u.push(new A3(e.key,e.value,"property functions not supported")):a&&!C6(e.valueSpec)&&u.push(new A3(e.key,e.value,"zoom functions not supported"))),"categorical"!==n&&!c||void 0!==e.value.property||u.push(new A3(e.key,e.value,'"property" property is required')),u;function h(e){let n=[];const r=e.value,a=e.key;if("array"!==k6(r))return[new A3(a,r,`array expected, ${k6(r)} found`)];if(2!==r.length)return[new A3(a,r,`array length 2 expected, length ${r.length} found`)];if(c){if("object"!==k6(r[0]))return[new A3(a,r,`object expected, ${k6(r[0])} found`)];if(void 0===r[0].zoom)return[new A3(a,r,"object stop key must have zoom")];if(void 0===r[0].value)return[new A3(a,r,"object stop key must have value")];if(s&&s>t8(r[0].zoom))return[new A3(a,r[0].zoom,"stop zoom values must appear in ascending order")];t8(r[0].zoom)!==s&&(s=t8(r[0].zoom),i=void 0,o={}),n=n.concat(r8({key:`${a}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:s8,value:d}}))}else n=n.concat(d({key:`${a}[0]`,value:r[0],valueSpec:{},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return T6(n8(r[1]))?n.concat([new A3(`${a}[1]`,r[1],"expressions are not allowed in function stops.")]):n.concat(e.validateSpec({key:`${a}[1]`,value:r[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function d(e,s){const a=k6(e.value),l=t8(e.value),c=null!==e.value?e.value:s;if(r){if(a!==r)return[new A3(e.key,c,`${a} stop domain type must match previous stop domain type ${r}`)]}else r=a;if("number"!==a&&"string"!==a&&"boolean"!==a)return[new A3(e.key,c,"stop domain value must be a number, string, or boolean")];if("number"!==a&&"categorical"!==n){let r=`number expected, ${a} found`;return x6(t)&&void 0===n&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new A3(e.key,c,r)]}return"categorical"!==n||"number"!==a||isFinite(l)&&Math.floor(l)===l?"categorical"!==n&&"number"===a&&void 0!==i&&l<i?[new A3(e.key,c,"stop domain values must appear in ascending order")]:(i=l,"categorical"===n&&l in o?[new A3(e.key,c,"stop domain values must be unique")]:(o[l]=!0,[])):[new A3(e.key,c,`integer expected, found ${l}`)]}}function a8(e){const t=("property"===e.expressionContext?M6:L6)(n8(e.value),e.valueSpec);if("error"===t.result)return t.value.map(t=>new A3(`${e.key}${t.key}`,e.value,t.message));const n=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!n.outputDefined())return[new A3(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!v6(n))return[new A3(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!v6(n))return[new A3(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!b6(n,["zoom","feature-state"]))return[new A3(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!y6(n))return[new A3(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function l8(e){const t=e.key,n=e.value,r=k6(n);return"string"!==r?[new A3(t,n,`color expected, ${r} found`)]:L5.parse(String(n))?[]:[new A3(t,n,`color expected, "${n}" found`)]}function c8(e){const t=e.key,n=e.value,r=e.valueSpec,i=[];return Array.isArray(r.values)?-1===r.values.indexOf(t8(n))&&i.push(new A3(t,n,`expected one of [${r.values.join(", ")}], ${JSON.stringify(n)} found`)):-1===Object.keys(r.values).indexOf(t8(n))&&i.push(new A3(t,n,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(n)} found`)),i}function u8(e){return F6(n8(e.value))?a8(O3({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):h8(e)}function h8(e){const t=e.value,n=e.key;if("array"!==k6(t))return[new A3(n,t,`array expected, ${k6(t)} found`)];const r=e.styleSpec;let i,s=[];if(t.length<1)return[new A3(n,t,"filter array must have at least 1 element")];switch(s=s.concat(c8({key:`${n}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),t8(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===t8(t[1])&&s.push(new A3(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&s.push(new A3(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(i=k6(t[1]),"string"!==i&&s.push(new A3(`${n}[1]`,t[1],`string expected, ${i} found`)));for(let o=2;o<t.length;o++)i=k6(t[o]),"$type"===t8(t[1])?s=s.concat(c8({key:`${n}[${o}]`,value:t[o],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&s.push(new A3(`${n}[${o}]`,t[o],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let r=1;r<t.length;r++)s=s.concat(h8({key:`${n}[${r}]`,value:t[r],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":i=k6(t[1]),2!==t.length?s.push(new A3(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):"string"!==i&&s.push(new A3(`${n}[1]`,t[1],`string expected, ${i} found`))}return s}function d8(e,t){const n=e.key,r=e.validateSpec,i=e.style,s=e.styleSpec,o=e.value,a=e.objectKey,l=s[`${t}_${e.layerType}`];if(!l)return[];const c=a.match(/^(.*)-transition$/);if("paint"===t&&c&&l[c[1]]&&l[c[1]].transition)return r({key:n,value:o,valueSpec:s.transition,style:i,styleSpec:s});const u=e.valueSpec||l[a];if(!u)return[new A3(n,o,`unknown property "${a}"`)];let h;if("string"===k6(o)&&x6(u)&&!u.tokens&&(h=/^{([^}]+)}$/.exec(o)))return[new A3(n,o,`"${a}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];const d=[];return"symbol"===e.layerType&&"text-font"===a&&E6(n8(o))&&"identity"===t8(o.type)&&d.push(new A3(n,o,'"text-font" does not support identity functions')),d.concat(r({key:e.key,value:o,valueSpec:u,style:i,styleSpec:s,expressionContext:"property",propertyType:t,propertyKey:a}))}function p8(e){return d8(e,"paint")}function f8(e){return d8(e,"layout")}function g8(e){let t=[];const n=e.value,r=e.key,i=e.style,s=e.styleSpec;if("object"!==k6(n))return[new A3(r,n,`object expected, ${k6(n)} found`)];n.type||n.ref||t.push(new A3(r,n,'either "type" or "ref" is required'));let o=t8(n.type);const a=t8(n.ref);if(n.id){const s=t8(n.id);for(let o=0;o<e.arrayIndex;o++){const e=i.layers[o];t8(e.id)===s&&t.push(new A3(r,n.id,`duplicate layer id "${n.id}", previously used at line ${e.id.__line__}`))}}if("ref"in n){let e;["type","source","source-layer","filter","layout"].forEach(e=>{e in n&&t.push(new A3(r,n[e],`"${e}" is prohibited for ref layers`))}),i.layers.forEach(t=>{t8(t.id)===a&&(e=t)}),e?e.ref?t.push(new A3(r,n.ref,"ref cannot reference another ref layer")):o=t8(e.type):t.push(new A3(r,n.ref,`ref layer "${a}" not found`))}else if("background"!==o)if(n.source){const e=i.sources&&i.sources[n.source],s=e&&t8(e.type);e?"vector"===s&&"raster"===o?t.push(new A3(r,n.source,`layer "${n.id}" requires a raster source`)):"raster-dem"!==s&&"hillshade"===o||"raster-dem"!==s&&"color-relief"===o?t.push(new A3(r,n.source,`layer "${n.id}" requires a raster-dem source`)):"raster"===s&&"raster"!==o?t.push(new A3(r,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==s||n["source-layer"]?"raster-dem"===s&&"hillshade"!==o&&"color-relief"!==o?t.push(new A3(r,n.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"!==o||!n.paint||!n.paint["line-gradient"]||"geojson"===s&&e.lineMetrics||t.push(new A3(r,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new A3(r,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new A3(r,n.source,`source "${n.source}" not found`))}else t.push(new A3(r,n,'missing required property "source"'));return"raster"===o&&n.paint?.resampling&&n.paint?.["raster-resampling"]&&t.push(new A3(r,n.paint,`layer "${n.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),t=t.concat(r8({key:r,value:n,valueSpec:s.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${r}.type`,value:n.type,valueSpec:s.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:n,objectKey:"type"}),filter:u8,layout:e=>r8({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>f8(O3({layerType:o},e))}}),paint:e=>r8({layer:n,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>p8(O3({layerType:o},e))}})}})),t}function m8(e){const t=e.value,n=e.key,r=k6(t);return"string"!==r?[new A3(n,t,`string expected, ${r} found`)]:[]}var y8={promoteId:function({key:e,value:t}){if("string"===k6(t))return m8({key:e,value:t});{const n=[];for(const r in t)n.push(...m8({key:`${e}.${r}`,value:t[r]}));return n}}};function v8(e){const t=e.value,n=e.key,r=e.styleSpec,i=e.style,s=e.validateSpec;if(!t.type)return[new A3(n,t,'"type" is required')];const o=t8(t.type);let a;switch(o){case"vector":case"raster":return a=r8({key:n,value:t,valueSpec:r[`source_${o.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:y8,validateSpec:s}),a;case"raster-dem":return a=function(e){const t=e.sourceName??"",n=e.value,r=e.styleSpec,i=r.source_raster_dem,s=e.style;let o=[];const a=k6(n);if(void 0===n)return o;if("object"!==a)return o.push(new A3("source_raster_dem",n,`object expected, ${a} found`)),o;const l="custom"===t8(n.encoding),c=["redFactor","greenFactor","blueFactor","baseShift"],u=e.value.encoding?`"${e.value.encoding}"`:"Default";for(const h in n)!l&&c.includes(h)?o.push(new A3(h,n[h],`In "${t}": "${h}" is only valid when "encoding" is set to "custom". ${u} encoding found`)):i[h]?o=o.concat(e.validateSpec({key:h,value:n[h],valueSpec:i[h],validateSpec:e.validateSpec,style:s,styleSpec:r})):o.push(new A3(h,n[h],`unknown property "${h}"`));return o}({sourceName:n,value:t,style:e.style,styleSpec:r,validateSpec:s}),a;case"geojson":if(a=r8({key:n,value:t,valueSpec:r.source_geojson,style:i,styleSpec:r,validateSpec:s,objectElementValidators:y8}),t.cluster)for(const e in t.clusterProperties){const[r,i]=t.clusterProperties[e],o="string"==typeof r?[r,["accumulated"],["get",e]]:r;a.push(...a8({key:`${n}.${e}.map`,value:i,validateSpec:s,expressionContext:"cluster-map"})),a.push(...a8({key:`${n}.${e}.reduce`,value:o,validateSpec:s,expressionContext:"cluster-reduce"}))}return a;case"video":return r8({key:n,value:t,valueSpec:r.source_video,style:i,validateSpec:s,styleSpec:r});case"image":return r8({key:n,value:t,valueSpec:r.source_image,style:i,validateSpec:s,styleSpec:r});case"canvas":return[new A3(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return c8({key:`${n}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,validateSpec:s,styleSpec:r})}}function b8(e){const t=e.value,n=e.styleSpec,r=n.light,i=e.style;let s=[];const o=k6(t);if(void 0===t)return s;if("object"!==o)return s=s.concat([new A3("light",t,`object expected, ${o} found`)]),s;for(const a in t){const o=a.match(/^(.*)-transition$/);s=o&&r[o[1]]&&r[o[1]].transition?s.concat(e.validateSpec({key:a,value:t[a],valueSpec:n.transition,validateSpec:e.validateSpec,style:i,styleSpec:n})):r[a]?s.concat(e.validateSpec({key:a,value:t[a],valueSpec:r[a],validateSpec:e.validateSpec,style:i,styleSpec:n})):s.concat([new A3(a,t[a],`unknown property "${a}"`)])}return s}function w8(e){const t=e.value,n=e.styleSpec,r=n.sky,i=e.style,s=k6(t);if(void 0===t)return[];if("object"!==s)return[new A3("sky",t,`object expected, ${s} found`)];let o=[];for(const a in t)o=r[a]?o.concat(e.validateSpec({key:a,value:t[a],valueSpec:r[a],style:i,styleSpec:n})):o.concat([new A3(a,t[a],`unknown property "${a}"`)]);return o}function _8(e){const t=e.value,n=e.styleSpec,r=n.terrain,i=e.style;let s=[];const o=k6(t);if(void 0===t)return s;if("object"!==o)return s=s.concat([new A3("terrain",t,`object expected, ${o} found`)]),s;for(const a in t)s=r[a]?s.concat(e.validateSpec({key:a,value:t[a],valueSpec:r[a],validateSpec:e.validateSpec,style:i,styleSpec:n})):s.concat([new A3(a,t[a],`unknown property "${a}"`)]);return s}function x8(e){let t=[];const n=e.value,r=e.key;if(Array.isArray(n)){const i=[],s=[];for(const o in n)n[o].id&&i.includes(n[o].id)&&t.push(new A3(r,n,`all the sprites' ids must be unique, but ${n[o].id} is duplicated`)),i.push(n[o].id),n[o].url&&s.includes(n[o].url)&&t.push(new A3(r,n,`all the sprites' URLs must be unique, but ${n[o].url} is duplicated`)),s.push(n[o].url),t=t.concat(r8({key:`${r}[${o}]`,value:n[o],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return m8({key:r,value:n})}function C8(e){return Boolean(e)&&e.constructor===Object}function S8(e){return C8(e.value)?[]:[new A3(e.key,e.value,`object expected, ${k6(e.value)} found`)]}var k8={"*":()=>[],array:i8,boolean:function(e){const t=e.value,n=e.key,r=k6(t);return"boolean"!==r?[new A3(n,t,`boolean expected, ${r} found`)]:[]},number:s8,color:l8,constants:e8,enum:c8,filter:u8,function:o8,layer:g8,object:r8,source:v8,light:b8,sky:w8,terrain:_8,projection:function(e){const t=e.value,n=e.styleSpec,r=n.projection,i=e.style,s=k6(t);if(void 0===t)return[];if("object"!==s)return[new A3("projection",t,`object expected, ${s} found`)];let o=[];for(const a in t)o=r[a]?o.concat(e.validateSpec({key:a,value:t[a],valueSpec:r[a],style:i,styleSpec:n})):o.concat([new A3(a,t[a],`unknown property "${a}"`)]);return o},projectionDefinition:function(e){const t=e.key;let n=e.value;n=n instanceof String?n.valueOf():n;const r=k6(n);return"array"!==r||function(e){return Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]}(n)||function(e){return!!["interpolate","step","literal"].includes(e[0])}(n)?["array","string"].includes(r)?[]:[new A3(t,n,`projection expected, invalid type "${r}" found`)]:[new A3(t,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:m8,formatted:function(e){return 0===m8(e).length?[]:a8(e)},resolvedImage:function(e){return 0===m8(e).length?[]:a8(e)},padding:function(e){const t=e.key,n=e.value;if("array"===k6(n)){if(n.length<1||n.length>4)return[new A3(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];const r={type:"number"};let i=[];for(let s=0;s<n.length;s++)i=i.concat(e.validateSpec({key:`${t}[${s}]`,value:n[s],validateSpec:e.validateSpec,valueSpec:r}));return i}return s8({key:t,value:n,valueSpec:{}})},numberArray:function(e){const t=e.key,n=e.value;if("array"===k6(n)){const r={type:"number"};if(n.length<1)return[new A3(t,n,"array length at least 1 expected, length 0 found")];let i=[];for(let s=0;s<n.length;s++)i=i.concat(e.validateSpec({key:`${t}[${s}]`,value:n[s],validateSpec:e.validateSpec,valueSpec:r}));return i}return s8({key:t,value:n,valueSpec:{}})},colorArray:function(e){const t=e.key,n=e.value;if("array"===k6(n)){if(n.length<1)return[new A3(t,n,"array length at least 1 expected, length 0 found")];let e=[];for(let r=0;r<n.length;r++)e=e.concat(l8({key:`${t}[${r}]`,value:n[r],valueSpec:{}}));return e}return l8({key:t,value:n,valueSpec:{}})},variableAnchorOffsetCollection:function(e){const t=e.key,n=e.value,r=k6(n),i=e.styleSpec;if("array"!==r||n.length<1||n.length%2!=0)return[new A3(t,n,"variableAnchorOffsetCollection requires a non-empty array of even length")];let s=[];for(let o=0;o<n.length;o+=2)s=s.concat(c8({key:`${t}[${o}]`,value:n[o],valueSpec:i.layout_symbol["text-anchor"]})),s=s.concat(i8({key:`${t}[${o+1}]`,value:n[o+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:i}));return s},sprite:x8,state:S8,fontFaces:function(e){const t=e.key,n=e.value,r=e.validateSpec,i=e.styleSpec,s=e.style;if(!C8(n))return[new A3(t,n,`object expected, ${k6(n)} found`)];const o=[];for(const a in n){const e=n[a],l=k6(e);if("string"===l)o.push(...m8({key:`${t}.${a}`,value:e}));else if("array"===l){const n={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[l,c]of e.entries())o.push(...r8({key:`${t}.${a}[${l}]`,value:c,valueSpec:n,styleSpec:i,style:s,validateSpec:r}))}else o.push(new A3(`${t}.${a}`,e,`string or array expected, ${l} found`))}return o}};function E8(e){const t=e.value,n=e.valueSpec,r=e.styleSpec;return e.validateSpec=E8,n.expression&&E6(t8(t))?o8(e):n.expression&&T6(n8(t))?a8(e):n.type&&k8[n.type]?k8[n.type](e):r8(O3({},e,{valueSpec:n.type?r[n.type]:n}))}function R8(e){const t=e.value,n=e.key,r=m8(e);return r.length||(-1===t.indexOf("{fontstack}")&&r.push(new A3(n,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&r.push(new A3(n,t,'"glyphs" url must include a "{range}" token'))),r}function T8(e,t=L3){let n=[];return n=n.concat(E8({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:E8,objectElementValidators:{glyphs:R8,"*":()=>[]}})),e.constants&&(n=n.concat(e8({key:"constants",value:e.constants,style:e,styleSpec:t,validateSpec:E8}))),I8(n)}function L8(e){return function(t){return e(Object.assign({},t,{validateSpec:E8}))}}function I8(e){return[].concat(e).sort((e,t)=>e.line-t.line)}function P8(e){return function(...t){return I8(e.apply(this,t))}}T8.source=P8(L8(v8)),T8.sprite=P8(L8(x8)),T8.glyphs=P8(L8(R8)),T8.light=P8(L8(b8)),T8.sky=P8(L8(w8)),T8.terrain=P8(L8(_8)),T8.state=P8(L8(S8)),T8.layer=P8(L8(g8)),T8.filter=P8(L8(u8)),T8.paintProperty=P8(L8(p8)),T8.layoutProperty=P8(L8(f8));var M8=L3,A8=4294967296,O8="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8"),N8=class{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,t,n=this.length){let r;for(;r=this.nextField(n);)e(r,t,this);return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*A8;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*A8;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf,n=t[this.pos++];if(n<128)return n;let r,i=127&n;return r=t[this.pos++],i|=(127&r)<<7,r<128?i:(r=t[this.pos++],i|=(127&r)<<14,r<128?i:(r=t[this.pos++],i|=(127&r)<<21,r<128?i:(r=t[this.pos],i|=(15&r)<<28,function(e,t,n){const r=n.buf;let i,s;if(s=r[n.pos++],i=(112&s)>>4,s<128)return F8(e,i,t);if(s=r[n.pos++],i|=(127&s)<<3,s<128)return F8(e,i,t);if(s=r[n.pos++],i|=(127&s)<<10,s<128)return F8(e,i,t);if(s=r[n.pos++],i|=(127&s)<<17,s<128)return F8(e,i,t);if(s=r[n.pos++],i|=(127&s)<<24,s<128)return F8(e,i,t);if(s=r[n.pos++],i|=(1&s)<<31,s<128)return F8(e,i,t);throw new Error("Expected varint not more than 10 bytes")}(i,e,this))))}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&O8?O8.decode(this.buf.subarray(t,e)):function(e,t,n){let r="",i=t;for(;i<n;){const t=e[i];let s,o,a,l=null,c=t>239?4:t>223?3:t>191?2:1;if(i+c>n)break;1===c?t<128&&(l=t):2===c?(s=e[i+1],128==(192&s)&&(l=(31&t)<<6|63&s,l<=127&&(l=null))):3===c?(s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&(l=(15&t)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===c&&(s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&t)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,c=1):l>65535&&(l-=65536,r+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),r+=String.fromCharCode(l),i+=c}return r}(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;const t=this.readVarint();return this.type=7&t,this._valueStart=this.pos,t>>>3}skip(e){const t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}};function F8(e,t,n){return n?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}var D8=class extends a3{constructor(e){super(),e=e||{},this.dataProjection=new cK({code:"",units:"tile-pixels"}),this.featureClass=e.featureClass?e.featureClass:X2,this.geometryName_=e.geometryName,this.layerName_=e.layerName?e.layerName:"layer",this.layers_=e.layers?e.layers:null,this.idProperty_=e.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(e,t,n,r){e.pos=t.geometry;const i=e.readVarint()+e.pos;let s=1,o=0,a=0,l=0,c=0,u=0;for(;e.pos<i;){if(!o){const t=e.readVarint();s=7&t,o=t>>3}if(o--,1===s||2===s)a+=e.readSVarint(),l+=e.readSVarint(),1===s&&c>u&&(r.push(c),u=c),n.push(a,l),c+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");c>u&&(n.push(n[u],n[u+1]),c+=2)}}c>u&&(r.push(c),u=c)}createFeature_(e,t,n){const r=t.type;if(0===r)return null;let i;const s=t.properties;let o;this.idProperty_?(o=s[this.idProperty_],delete s[this.idProperty_]):o=t.id,s[this.layerName_]=t.layer.name;const a=[],l=[];this.readRawGeometry_(e,t,a,l);const c=function(e,t){let n;return 1===e?n=1===t?"Point":"MultiPoint":2===e?n=1===t?"LineString":"MultiLineString":3===e&&(n="Polygon"),n}(r,l.length);if(this.featureClass===X2)i=new this.featureClass(c,a,l,2,s,o),i.transform(n.dataProjection);else{let e;if("Polygon"==c){const t=wY(a,l);e=t.length>1?new q1(a,"XY",t):new _Y(a,"XY",l)}else e="Point"===c?new hY(a,"XY"):"LineString"===c?new j1(a,"XY"):"MultiPoint"===c?new B1(a,"XY"):"MultiLineString"===c?new U1(a,"XY",l):null;i=new(0,this.featureClass),this.geometryName_&&i.setGeometryName(this.geometryName_);const t=l3(e,!1,n);i.setGeometry(t),void 0!==o&&i.setId(o),i.setProperties(s,!0)}return i}getType(){return"arraybuffer"}readFeatures(e,t){const n=this.layers_,r=iZ((t=this.adaptOptions(t)).dataProjection);r.setWorldExtent(t.extent),t.dataProjection=r;const i=new N8(e),s=i.readFields(z8,{}),o=[];for(const a in s){if(n&&!n.includes(a))continue;const e=s[a],l=e?[0,0,e.extent,e.extent]:null;r.setExtent(l);for(let n=0,r=e.length;n<r;++n){const r=B8(i,e,n),s=this.createFeature_(i,r,t);null!==s&&o.push(s)}}return o}readProjection(e){return this.dataProjection}setLayers(e){this.layers_=e}};function z8(e,t,n){if(3===e){const e={keys:[],values:[],features:[]},r=n.readVarint()+n.pos;n.readFields(j8,e,r),e.length=e.features.length,e.length&&(t[e.name]=e)}}function j8(e,t,n){if(15===e)t.version=n.readVarint();else if(1===e)t.name=n.readString();else if(5===e)t.extent=n.readVarint();else if(2===e)t.features.push(n.pos);else if(3===e)t.keys.push(n.readString());else if(4===e){let r=null;const i=n.readVarint()+n.pos;for(;n.pos<i;)r=1==(e=n.readVarint()>>3)?n.readString():2===e?n.readFloat():3===e?n.readDouble():4===e?n.readVarint(!0):5===e?n.readVarint():6===e?n.readSVarint():7===e?n.readBoolean():null;t.values.push(r)}}function U8(e,t,n){if(1==e)t.id=n.readVarint();else if(2==e){const e=n.readVarint()+n.pos;for(;n.pos<e;){const e=t.layer.keys[n.readVarint()],r=t.layer.values[n.readVarint()];t.properties[e]=r}}else 3==e?t.type=n.readVarint():4==e&&(t.geometry=n.pos)}function B8(e,t,n){e.pos=t.features[n];const r=e.readVarint()+e.pos,i={layer:t,type:0,properties:{}};return e.readFields(U8,i,r),i}var $8=class extends _H{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=void 0===n.transition?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(tH)}release(){this.setState(4)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(4!==this.state){if(3!==this.state&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){CH()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(n){if(-1===n)return 1}else n=t,this.transitionStarts_[e]=n;const r=t-n+1e3/60;return r>=this.transition_?1:tK(r/this.transition_)}inTransition(e){return!!this.transition_&&-1!==this.transitionStarts_[e]}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}};function q8(e){return e instanceof Image||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageBitmap?e:null}var V8,W8=new Error("disposed"),H8=[256,256],G8=class extends $8{constructor(e){super(e.tileCoord,0,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;const e=q8(this.data_);return e?[e.width,e.height]:H8}getData(){return this.data_}getError(){return this.error_}load(){if(0!==this.state&&3!==this.state)return;this.state=1,this.changed();const e=this;this.loader_().then(function(t){e.data_=t,e.state=2,e.changed()}).catch(function(t){e.error_=t,e.state=3,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(W8),this.controller_=null),super.disposeInternal()}},K8=class extends $8{constructor(e,t,n,r,i,s){super(e,t,s),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=n,this.key=n,this.image_,zH?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=i}getImage(){return this.image_}setImage(e){this.image_=e,this.state=2,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=3,this.unlistenImage_(),this.image_=function(){const e=BY(1,1);return e.fillStyle="rgba(0,0,0,0)",e.fillRect(0,0,1,1),e.canvas}(),this.changed()}handleImageLoad_(){if(zH)this.state=2;else{const e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=2:this.state=4}this.unlistenImage_(),this.changed()}load(){3==this.state&&(this.state=0,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),0==this.state&&(this.state=1,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(e,t,n){const r=e;let i=!0,s=!1,o=!1;const a=[QW(r,"load",function(){o=!0,s||t()})];return r.src&&jH?(s=!0,r.decode().then(function(){i&&t()}).catch(function(){i&&(o?t():n())})):a.push(QW(r,"error",n)),function(){i=!1,a.forEach(eH)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}},Z8=class{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}};function Y8(e,t,n,r,i){return void 0!==i?(i.minX=e,i.maxX=t,i.minY=n,i.maxY=r,i):new Z8(e,t,n,r)}var X8=[];function J8(e,t,n,r,i){e.beginPath(),e.moveTo(0,0),e.lineTo(t,n),e.lineTo(r,i),e.closePath(),e.save(),e.clip(),e.fillRect(0,0,Math.max(t,r)+1,Math.max(n,i)),e.restore()}function Q8(e,t){return Math.abs(e[4*t]-210)>2||Math.abs(e[4*t+3]-191.25)>2}function e7(e,t,n,r){const i=fZ(n,t,e);let s=sZ(t,r,n);const o=t.getMetersPerUnit();void 0!==o&&(s*=o);const a=e.getMetersPerUnit();void 0!==a&&(s/=a);const l=e.getExtent();if(!l||bG(l,i)){const t=sZ(e,s,i)/s;isFinite(t)&&t>0&&(s/=t)}return s}function t7(e,t,n,r,i,s,o,a,l,c,u,h,d,p){const f=BY(Math.round(n*e),Math.round(n*t),X8);if(h||(f.imageSmoothingEnabled=!1),0===l.length)return f.canvas;function g(e){return Math.round(e*n)/n}f.scale(n,n),f.globalCompositeOperation="lighter";const m=[1/0,1/0,-1/0,-1/0];let y;l.forEach(function(e){TG(m,e.extent)});const v=n/r,b=(h?1:1+Math.pow(2,-24))/v;if(!d||1!==l.length||0!==c){if(y=BY(Math.round(WG(m)*v),Math.round(UG(m)*v),X8),h||(y.imageSmoothingEnabled=!1),i&&p){const e=(i[0]-m[0])*v,t=-(i[3]-m[3])*v,n=WG(i)*v,r=UG(i)*v;y.rect(e,t,n,r),y.clip()}l.forEach(function(e){if(e.image.width>0&&e.image.height>0){if(e.clipExtent){y.save();const t=(e.clipExtent[0]-m[0])*v,n=-(e.clipExtent[3]-m[3])*v,r=WG(e.clipExtent)*v,i=UG(e.clipExtent)*v;y.rect(h?t:Math.round(t),h?n:Math.round(n),h?r:Math.round(t+r)-Math.round(t),h?i:Math.round(n+i)-Math.round(n)),y.clip()}const t=(e.extent[0]-m[0])*v,n=-(e.extent[3]-m[3])*v,r=WG(e.extent)*v,i=UG(e.extent)*v;y.drawImage(e.image,c,c,e.image.width-2*c,e.image.height-2*c,h?t:Math.round(t),h?n:Math.round(n),h?r:Math.round(t+r)-Math.round(t),h?i:Math.round(n+i)-Math.round(n)),e.clipExtent&&y.restore()}})}const w=qG(o);return a.getTriangles().forEach(function(e){const t=e.source,n=e.target;let r=t[0][0],i=t[0][1],o=t[1][0],a=t[1][1],c=t[2][0],u=t[2][1];const d=g((n[0][0]-w[0])/s),p=g(-(n[0][1]-w[1])/s),v=g((n[1][0]-w[0])/s),_=g(-(n[1][1]-w[1])/s),x=g((n[2][0]-w[0])/s),C=g(-(n[2][1]-w[1])/s),S=r,k=i;r=0,i=0,o-=S,a-=k,c-=S,u-=k;const E=function(e){const t=e.length;for(let r=0;r<t;r++){let n=r,i=Math.abs(e[r][r]);for(let o=r+1;o<t;o++){const t=Math.abs(e[o][r]);t>i&&(i=t,n=o)}if(0===i)return null;const s=e[n];e[n]=e[r],e[r]=s;for(let o=r+1;o<t;o++){const n=-e[o][r]/e[r][r];for(let i=r;i<t+1;i++)r==i?e[o][i]=0:e[o][i]+=n*e[r][i]}}const n=new Array(t);for(let r=t-1;r>=0;r--){n[r]=e[r][t]/e[r][r];for(let i=r-1;i>=0;i--)e[i][t]-=e[i][r]*n[r]}return n}([[o,a,0,0,v-d],[c,u,0,0,x-d],[0,0,o,a,_-p],[0,0,c,u,C-p]]);if(!E)return;if(f.save(),f.beginPath(),function(){if(void 0===V8){const e=BY(6,6,X8);e.globalCompositeOperation="lighter",e.fillStyle="rgba(210, 0, 0, 0.75)",J8(e,4,5,4,0),J8(e,4,5,0,5);const t=e.getImageData(0,0,3,3).data;V8=Q8(t,0)||Q8(t,4)||Q8(t,8),qY(e),X8.push(e.canvas)}return V8}()||!h){f.moveTo(v,_);const e=4,t=d-v,n=p-_;for(let r=0;r<e;r++)f.lineTo(v+g((r+1)*t/e),_+g(r*n/3)),3!=r&&f.lineTo(v+g((r+1)*t/e),_+g((r+1)*n/3));f.lineTo(x,C)}else f.moveTo(v,_),f.lineTo(d,p),f.lineTo(x,C);let R;if(f.clip(),f.transform(E[0],E[2],E[1],E[3],d,p),f.translate(m[0]-S,m[3]-k),y)R=y.canvas,f.scale(b,-b);else{const e=l[0],t=e.extent;R=e.image,f.scale(WG(t)/R.width,-UG(t)/R.height)}f.drawImage(R,0,0),f.restore()}),y&&(qY(y),X8.push(y.canvas)),u&&(f.save(),f.globalCompositeOperation="source-over",f.strokeStyle="black",f.lineWidth=1,a.getTriangles().forEach(function(e){const t=e.target,n=(t[0][0]-w[0])/s,r=-(t[0][1]-w[1])/s,i=(t[1][0]-w[0])/s,o=-(t[1][1]-w[1])/s,a=(t[2][0]-w[0])/s,l=-(t[2][1]-w[1])/s;f.beginPath(),f.moveTo(i,o),f.lineTo(n,r),f.lineTo(a,l),f.closePath(),f.stroke()}),f.restore()),f.canvas}var n7=class{constructor(e,t,n,r,i,s,o){this.sourceProj_=e,this.targetProj_=t;let a={};const l=o?(c=e=>kZ(o,fZ(e,this.targetProj_,this.sourceProj_)),function(e,t,n,r){const i=e.length;n=void 0!==n?n:2,r=r??n,t=void 0!==t?t:new Array(i);for(let s=0;s<i;s+=r){const i=c(e.slice(s,s+n)),o=i.length;for(let n=0,a=r;n<a;++n)t[s+n]=n>=o?e[s+n]:i[n]}return t}):pZ(this.targetProj_,this.sourceProj_);var c;this.transformInv_=function(e){const t=e[0]+"/"+e[1];return a[t]||(a[t]=l(e)),a[t]},this.maxSourceExtent_=r,this.errorThresholdSquared_=i*i,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&WG(r)>=WG(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?WG(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?WG(this.targetProj_.getExtent()):null;const u=qG(n),h=VG(n),d=NG(n),p=OG(n),f=this.transformInv_(u),g=this.transformInv_(h),m=this.transformInv_(d),y=this.transformInv_(p),v=10+(s?Math.max(0,Math.ceil(Math.log2(AG(n)/(s*s*256*256)))):0);if(this.addQuad_(u,h,d,p,f,g,m,y,v),this.wrapsXInSource_){let e=1/0;this.triangles_.forEach(function(t){e=Math.min(e,t.source[0][0],t.source[1][0],t.source[2][0])}),this.triangles_.forEach(t=>{if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-e>this.sourceWorldWidth_/2){const n=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];n[0][0]-e>this.sourceWorldWidth_/2&&(n[0][0]-=this.sourceWorldWidth_),n[1][0]-e>this.sourceWorldWidth_/2&&(n[1][0]-=this.sourceWorldWidth_),n[2][0]-e>this.sourceWorldWidth_/2&&(n[2][0]-=this.sourceWorldWidth_);const r=Math.min(n[0][0],n[1][0],n[2][0]);Math.max(n[0][0],n[1][0],n[2][0])-r<this.sourceWorldWidth_/2&&(t.source=n)}})}a={}}addTriangle_(e,t,n,r,i,s){this.triangles_.push({source:[r,i,s],target:[e,t,n]})}addQuad_(e,t,n,r,i,s,o,a,l){const c=gG([i,s,o,a]),u=this.sourceWorldWidth_?WG(c)/this.sourceWorldWidth_:null,h=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&u>.5&&u<1;let p=!1;if(l>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(p=WG(gG([e,t,n,r]))/this.targetWorldWidth_>.25||p),!d&&this.sourceProj_.isGlobal()&&u&&(p=u>.25||p)),!p&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!HG(c,this.maxSourceExtent_))return;let f=0;if(!(p||isFinite(i[0])&&isFinite(i[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)p=!0;else if(f=(isFinite(i[0])&&isFinite(i[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=f&&2!=f&&4!=f&&8!=f)return;if(l>0){if(!p){const t=[(e[0]+n[0])/2,(e[1]+n[1])/2],r=this.transformInv_(t);let s;s=d?(aG(i[0],h)+aG(o[0],h))/2-aG(r[0],h):(i[0]+o[0])/2-r[0];const a=(i[1]+o[1])/2-r[1];p=s*s+a*a>this.errorThresholdSquared_}if(p){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){const c=[(t[0]+n[0])/2,(t[1]+n[1])/2],u=this.transformInv_(c),h=[(r[0]+e[0])/2,(r[1]+e[1])/2],d=this.transformInv_(h);this.addQuad_(e,t,c,h,i,s,u,d,l-1),this.addQuad_(h,c,n,r,d,u,o,a,l-1)}else{const c=[(e[0]+t[0])/2,(e[1]+t[1])/2],u=this.transformInv_(c),h=[(n[0]+r[0])/2,(n[1]+r[1])/2],d=this.transformInv_(h);this.addQuad_(e,c,h,r,i,u,d,a,l-1),this.addQuad_(c,t,n,h,u,s,o,d,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}11&f||this.addTriangle_(e,n,r,i,o,a),14&f||this.addTriangle_(e,n,t,i,o,s),f&&(13&f||this.addTriangle_(t,r,e,s,a,i),7&f||this.addTriangle_(t,r,n,s,a,o))}calculateSourceExtent(){const e=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(t){const n=t.source;LG(e,n[0]),LG(e,n[1]),LG(e,n[2])}),e}getTriangles(){return this.triangles_}},r7=class extends $8{constructor(e,t,n,r,i,s,o,a,l,c,u,h){super(i,0,h),this.renderEdges_=void 0!==u&&u,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=s||i,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;const d=r.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const g=p?BG(d,p):d;if(0===AG(g))return void(this.state=4);const m=e.getExtent();m&&(f=f?BG(f,m):m);const y=r.getResolution(this.wrappedTileCoord_[0]),v=function(e,t,n,r){let i=e7(e,t,FG(n),r);return(!isFinite(i)||i<=0)&&MG(n,function(n){return i=e7(e,t,n,r),isFinite(i)&&i>0}),i}(e,n,g,y);if(!isFinite(v)||v<=0)return void(this.state=4);const b=void 0!==c?c:.5;if(this.triangulation_=new n7(e,n,g,f,v*b,y),0===this.triangulation_.getTriangles().length)return void(this.state=4);this.sourceZ_=t.getZForResolution(v);let w=this.triangulation_.calculateSourceExtent();if(f&&(e.canWrapX()?(w[1]=nG(w[1],f[1],f[3]),w[3]=nG(w[3],f[1],f[3])):w=BG(w,f)),AG(w)){let n=0,r=0;e.canWrapX()&&(n=WG(m),r=Math.floor((w[0]-m[0])/n)),YG(w.slice(),e,!0).forEach(e=>{const i=t.getTileRangeForExtentAndZ(e,this.sourceZ_);for(let t=i.minX;t<=i.maxX;t++)for(let e=i.minY;e<=i.maxY;e++){const i=r*n;this.sourceTiles_.push({getTile:()=>l(this.sourceZ_,t,e,o),offset:i})}++r}),0===this.sourceTiles_.length&&(this.state=4)}else this.state=4}getImage(){return this.canvas_}reproject_(){const e=[];if(this.sourceTiles_.forEach(t=>{const n=t.tile;if(n&&2==n.getState()){const r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;const i=this.clipExtent_?.slice();i&&(i[0]+=t.offset,i[2]+=t.offset),e.push({extent:r,clipExtent:i,image:n.getImage()})}}),this.sourceTiles_.length=0,0===e.length)this.state=3;else{const t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r="number"==typeof n?n:n[0],i="number"==typeof n?n:n[1],s=this.targetTileGrid_.getResolution(t),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=t7(r,i,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=2}this.changed()}load(){for(const e of this.sourceTiles_)e.tile=e.getTile();if(0==this.state){this.state=1,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{const n=t.getState();if(0==n||1==n){e++;const n=JW(t,tH,()=>{const r=t.getState();2!=r&&3!=r&&4!=r||(eH(n),e--,0===e&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(n)}}),0===e?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e}){0==e.getState()&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(eH),this.sourcesListenerKeys_=null}release(){this.canvas_&&(qY(this.canvas_.getContext("2d")),X8.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},i7=class{constructor(e){this.highWaterMark=void 0!==e?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const e=this.pop();e instanceof lH&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){const n=this.entries_[e];return XH(void 0!==n,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){const t=this.entries_[e];return XH(void 0!==t,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){const e=new Array(this.count_);let t,n=0;for(t=this.newest_;t;t=t.older)e[n++]=t.key_;return e}getValues(){const e=new Array(this.count_);let t,n=0;for(t=this.newest_;t;t=t.older)e[n++]=t.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){const e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){XH(!(e in this.entries_),"Tried to set a value for a key that is used already");const n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}};function s7(e,t,n,r){return void 0!==r?(r[0]=e,r[1]=t,r[2]=n,r):[e,t,n]}function o7(e,t,n,r,i){return`${kH(e)},${t},${function(e,t,n){return e+"/"+t+"/"+n}(n,r,i)}`}function a7(e,t,n){if(!(n in e))return e[n]=new Set([t]),!0;const r=e[n],i=r.has(t);return i||r.add(t),!i}function l7(e,t,n){const r=e[n];return!!r&&r.delete(t)}function c7(e,t){const n=e.layerStatesArray[e.layerIndex];n.extent&&(t=BG(t,vZ(n.extent,e.viewState.projection)));const r=n.layer.getRenderSource();if(!r.getWrapX()){const n=r.getTileGridForProjection(e.viewState.projection).getExtent();n&&(t=BG(t,n))}return t}var u7=class extends q2{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new Z8(0,0,0,0),this.tempTileCoord_=s7(0,0,0);const n=void 0!==t.cacheSize?t.cacheSize:512;this.tileCache_=new i7(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*n}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new i7(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){const i=this.tileCache_,s=this.getLayer().getSource(),o=o7(s,s.getKey(),e,t,n);let a;if(i.containsKey(o))a=i.get(o);else{const l=r.viewState.projection,c=s.getProjection();if(a=s.getTile(e,t,n,r.pixelRatio,l,!c||uZ(c,l)?void 0:this.getSourceTileCache()),!a)return null;i.set(o,a)}return a}getTile(e,t,n,r){return this.getOrCreateTile(e,t,n,r)||null}getData(e){const t=this.frameState;if(!t)return null;const n=this.getLayer(),r=kZ(t.pixelToCoordinateTransform,e.slice()),i=n.getExtent();if(i&&!bG(i,r))return null;const s=t.viewState,o=n.getRenderSource(),a=o.getTileGridForProjection(s.projection),l=o.getTilePixelRatio(t.pixelRatio);for(let c=a.getZForResolution(s.resolution);c>=a.getMinZoom();--c){const e=a.getTileCoordForCoordAndZ(r,c),n=this.getTile(c,e[1],e[2],t);if(!n||2!==n.getState())continue;const i=a.getOrigin(c),u=UJ(a.getTileSize(c)),h=a.getResolution(c);let d;if(n instanceof K8||n instanceof r7)d=n.getImage();else{if(!(n instanceof G8))continue;if(d=q8(n.getData()),!d)continue}const p=Math.floor(l*((r[0]-i[0])/h-e[1]*u[0])),f=Math.floor(l*((i[1]-r[1])/h-e[2]*u[1])),g=Math.round(l*o.getGutterForProjection(s.projection));return this.getImageData(d,p+g,f+g)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;const t=this.getLayer().getSource();if(!t)return!1;const n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,i){const s=e.viewState,o=this.getLayer(),a=o.getRenderSource(),l=a.getTileGridForProjection(s.projection),c=kH(a);c in e.wantedTiles||(e.wantedTiles[c]={});const u=e.wantedTiles[c],h=o.getMapInternal(),d=Math.max(n-i,l.getMinZoom(),l.getZForResolution(Math.min(o.getMaxResolution(),h?h.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):l.getResolution(0)),a.zDirection)),p=s.rotation,f=p?jG(s.center,s.resolution,p,e.size):void 0;for(let g=n;g>=d;--g){const n=l.getTileRangeForExtentAndZ(t,g,this.tempTileRange_),i=l.getResolution(g);for(let t=n.minX;t<=n.maxX;++t)for(let s=n.minY;s<=n.maxY;++s){if(p&&!l.tileCoordIntersectsViewport([g,t,s],f))continue;const n=this.getTile(g,t,s,e);if(!n)continue;if(!a7(r,n,g))continue;const o=n.getKey();if(u[o]=!0,0===n.getState()&&!e.tileQueue.isKeyQueued(o)){const r=s7(g,t,s,this.tempTileCoord_);e.tileQueue.enqueue([n,c,l.getTileCoordCenter(r),i])}}}}findStaleTile_(e,t){const n=this.tileCache_,r=e[0],i=e[1],s=e[2],o=this.getStaleKeys();for(let a=0;a<o.length;++a){const e=o7(this.getLayer().getSource(),o[a],r,i,s);if(n.containsKey(e)){const i=n.peek(e);if(2===i.getState())return i.endTransition(kH(this)),a7(t,i,r),!0}}return!1}findAltTiles_(e,t,n,r){const i=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!i)return!1;let s=!0;const o=this.tileCache_,a=this.getLayer().getRenderSource(),l=a.getKey();for(let c=i.minX;c<=i.maxX;++c)for(let e=i.minY;e<=i.maxY;++e){const t=o7(a,l,n,c,e);let i=!1;if(o.containsKey(t)){const e=o.peek(t);2===e.getState()&&(a7(r,e,n),i=!0)}i||(s=!1)}return s}renderFrame(e,t){this.renderComplete=!0;const n=e.layerStatesArray[e.layerIndex],r=e.viewState,i=r.projection,s=r.resolution,o=r.center,a=e.pixelRatio,l=this.getLayer(),c=l.getSource(),u=c.getTileGridForProjection(i),h=u.getZForResolution(s,c.zDirection),d=u.getResolution(h);this.updateStaleKeys(c.getKey());let p=e.extent;const f=c.getTilePixelRatio(a);this.prepareContainer(e,t);const g=this.context.canvas.width,m=this.context.canvas.height;this.layerExtent=n.extent?n.extent:null,this.layerExtent&&(p=BG(p,this.layerExtent));const y=d*g/2/f,v=d*m/2/f,b=[o[0]-y,o[1]-v,o[0]+y,o[1]+v],w={};this.renderedTiles.length=0;const _=l.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){const t=u.getZForResolution(r.nextResolution,c.zDirection),n=c7(e,e.nextExtent);this.enqueueTiles(e,n,t,w,_)}const x=c7(e,p);if(this.enqueueTiles(e,x,h,w,0),_>0&&setTimeout(()=>{this.enqueueTiles(e,x,h-1,w,_-1)},0),!(h in w))return this.container;const C=kH(this),S=e.time;for(const P of w[h]){const t=P.getState();if(4===t)continue;const n=P.tileCoord;if(2===t&&1===P.getAlpha(C,S)){P.endTransition(C);continue}if(3!==t&&(this.renderComplete=!1),this.findStaleTile_(n,w)){l7(w,P,h),e.animate=!0;continue}if(this.findAltTiles_(u,n,h+1,w))continue;const r=u.getMinZoom();for(let e=h-1;e>=r&&!this.findAltTiles_(u,n,e,w);--e);}const k=d/s*a/f,E=this.getRenderContext(e);RZ(this.tempTransform,g/2,m/2,k,k,0,-g/2,-m/2),this.layerExtent&&this.clipUnrotated(E,e,this.layerExtent),c.getInterpolate()||(E.imageSmoothingEnabled=!1),this.preRender(E,e);const R=Object.keys(w).map(Number);R.sort(cH);const T=[],L=[],I=[];for(let P=R.length-1;P>=0;--P){const t=R[P],n=c.getTilePixelSize(t,a,i),r=u.getResolution(t)/d,s=n[0]*r*k,o=n[1]*r*k,l=u.getTileCoordForCoordAndZ(qG(b),t),p=u.getTileCoordExtent(l),g=kZ(this.tempTransform,[f*(p[0]-b[0])/d,f*(b[3]-p[3])/d]),m=f*c.getGutterForProjection(i);for(const i of w[t]){if(2!==i.getState())continue;const n=i.tileCoord,r=l[1]-n[1],a=Math.round(g[0]-(r-1)*s),u=l[2]-n[2],d=Math.round(g[1]-(u-1)*o),p=Math.round(g[0]-r*s),f=Math.round(g[1]-u*o),y=a-p,v=d-f,b=t===h;if(b&&i.inTransition(C)){I.push({tile:i,x:p,y:f,w:y,h:v,gutter:m}),this.renderedTiles.unshift(i),this.updateUsedTiles(e.usedTiles,c,i);continue}const w=[p,f,p+y,f+v],_=[];for(let e=0,i=T.length;e<i;++e)t<L[e]&&HG(w,T[e])&&_.push(T[e]);let x;_.length>0&&(x=XG(w,_)),T.push(w),L.push(t),this.drawTile(i,e,p,f,y,v,m,b,x),this.renderedTiles.unshift(i),this.updateUsedTiles(e.usedTiles,c,i)}}for(let P=0,M=I.length;P<M;++P){const{tile:t,x:n,y:r,w:i,h:s,gutter:o}=I[P];this.drawTile(t,e,n,r,i,s,o,!0,void 0)}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!RG(this.renderedExtent_,b),this.renderedExtent_=b,this.renderedPixelRatio=a,this.postRender(this.context,e),this.layerExtent&&E.restore(),E.imageSmoothingEnabled=!0,this.renderComplete){const t=(e,t)=>{const n=kH(c),r=t.wantedTiles[n],i=r?Object.keys(r).length:0;this.updateCacheSize(i),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push(t)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*e)}drawTile(e,t,n,r,i,s,o,a,l){let c;if(e instanceof G8){if(c=q8(e.getData()),!c)throw new Error("Rendering array data is not yet supported")}else c=this.getTileImage(e);if(!c)return;const u=this.getRenderContext(t),h=kH(this),d=t.layerStatesArray[t.layerIndex],p=d.opacity*(a?e.getAlpha(h,t.time):1),f=p!==u.globalAlpha;f&&(u.save(),u.globalAlpha=p);const g=c.width-2*o,m=c.height-2*o;if(l){const e=g/i,t=m/s;for(let i=0,s=l.length;i<s;++i){const s=l[i],a=s[0],h=s[1],d=s[2]-s[0],p=s[3]-s[1];u.drawImage(c,o+(a-n)*e,o+(h-r)*t,d*e,p*t,a,h,d,p)}}else u.drawImage(c,o,o,g,m,n,r,i,s);f&&u.restore(),p!==d.opacity?t.animate=!0:a&&e.endTransition(h)}getImage(){const e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){const r=kH(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},h7="preload",d7="useInterimTilesOnError",p7=class extends QX{constructor(e){e=e||{};const t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(void 0!==e.preload?e.preload:0),this.setUseInterimTilesOnError(void 0===e.useInterimTilesOnError||e.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(h7)}setPreload(e){this.set(h7,e)}getUseInterimTilesOnError(){return this.get(d7)}setUseInterimTilesOnError(e){this.set(d7,e)}getData(e){return super.getData(e)}},f7=class extends p7{constructor(e){super(e)}createRenderer(){return new u7(this,{cacheSize:this.getCacheSize()})}},g7={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},m7={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]},y7=class extends u7{constructor(e,t){super(e,t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=_Z(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(e,t,n,r,i,s,o,a,l){this.updateExecutorGroup_(e,t.pixelRatio,t.viewState.projection),this.tileImageNeedsRender_(e)&&this.renderTileImage_(e,t),super.drawTile(e,t,n,r,i,s,o,a,l)}getTile(e,t,n,r){const i=this.getOrCreateTile(e,t,n,r);if(!i)return null;const s=r.viewState,o=s.resolution,a=r.viewHints,l=this.getLayer().getSource(),c=l.getTileGridForProjection(s.projection),u=!(a[0]||a[1]),h=c.getZForResolution(o,l.zDirection)===e;return u&&h?i.wantedResolution=o:i.wantedResolution||(i.wantedResolution=c.getResolution(e)),i}prepareFrame(e){const t=this.getLayer().getRevision();return this.renderedLayerRevision_!==t&&(this.renderedLayerRevision_=t,this.renderedTiles.length=0),super.prepareFrame(e)}updateExecutorGroup_(e,t,n){const r=this.getLayer(),i=r.getRevision(),s=r.getRenderOrder()||null,o=e.wantedResolution,a=e.getReplayState(r);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==i&&a.renderedPixelRatio===t&&a.renderedRenderOrder==s)return;const l=r.getSource(),c=!!r.getDeclutter(),u=l.getTileGrid(),h=l.getTileGridForProjection(n).getTileCoordExtent(e.wrappedTileCoord),d=l.getSourceTiles(t,n,e),p=kH(r);delete e.hitDetectionImageData[p],e.executorGroups[p]=[],a.dirty=!1;for(let f=0,g=d.length;f<g;++f){const i=d[f];if(2!=i.getState())continue;const g=l.getProjection(),m=i.tileCoord;let y=u.getTileCoordExtent(m);n&&g&&!uZ(n,g)&&(y=gZ(y,g,n,32));const v=BG(h,y),b=mG(v,r.getRenderBuffer()*o,this.tempExtent),w=RG(y,v)?null:b,_=new o2(0,v,o,t),x=F2(o,t),C=function(e,t){let n;const i=e.getStyleFunction()||r.getStyleFunction();if(i&&(n=i(e,o)),n){const r=this.renderFeature(e,x,n,_,c,t);a.dirty=a.dirty||r}},S=i.getFeatures();s&&s!==a.renderedRenderOrder&&S.sort(s);for(let e=0,t=S.length;e<t;++e){let t=S[e];n&&i.projection&&!uZ(n,i.projection)&&(t=t.clone(),t.getGeometry().applyTransform(pZ(i.projection,n))),w&&!HG(w,t.getGeometry().getExtent())||C.call(this,t,e)}const k=_.finish(),E="vector"!==r.getRenderMode()&&c&&1===d.length?null:v,R=new T2(E,o,t,l.getOverlaps(),k,r.getRenderBuffer(),!0);e.executorGroups[p].push(R)}a.renderedRevision=i,a.renderedPixelRatio=t,a.renderedRenderOrder=s,a.renderedResolution=o}forEachFeatureAtCoordinate(e,t,n,r,i){const s=t.viewState.resolution,o=t.viewState.rotation;n=null==n?0:n;const a=this.getLayer(),l=a.getSource().getTileGridForProjection(t.viewState.projection),c=a.getRenderBuffer(),u=gG([e]);mG(u,s*(c+n),u);const h={},d=function(e,t,n){let s=e.getId();void 0===s&&(s=kH(e));const o=h[s];if(o){if(!0!==o&&n<o.distanceSq){if(0===n)return h[s]=!0,i.splice(i.lastIndexOf(o),1),r(e,a,t);o.geometry=t,o.distanceSq=n}}else{if(0===n)return h[s]=!0,r(e,a,t);i.push(h[s]={feature:e,layer:a,geometry:t,distanceSq:n,callback:r})}},p=this.renderedTiles,f=kH(a),g=a.getDeclutter(),m=g?t.declutter?.[g]?.all().map(e=>e.value):null;let y;e:for(let v=p.length-1;v>=0;--v){const t=p[v];if(!HG(l.getTileCoordExtent(t.wrappedTileCoord),u))continue;const r=t.executorGroups[f];for(let i=0,a=r.length;i<a;++i)if(y=r[i].forEachFeatureAtCoordinate(e,s,o,n,d,m),y)break e}return y}getFeatures(e){return 0===this.renderedTiles.length?Promise.resolve([]):new Promise(t=>{const n=this.getLayer(),r=n.getSource(),i=this.renderedProjection,s=i.getExtent(),o=this.renderedResolution,a=r.getTileGridForProjection(i),l=kZ(this.renderedPixelToCoordinateTransform_,e.slice()),c=a.getTileCoordForCoordAndResolution(l,o).toString(),u=this.renderedTiles.find(e=>e.tileCoord.toString()===c&&2===e.getState());if(!u||u.loadingSourceTiles>0)return void t([]);r.getWrapX()&&i.canWrapX()&&!wG(s,a.getTileCoordExtent(u.tileCoord))&&eK(l,i);const h=kH(n),d=qG(a.getTileCoordExtent(u.wrappedTileCoord)),p=[(l[0]-d[0])/o,(d[1]-l[1])/o],f=u.getSourceTiles().reduce((e,t)=>e.concat(t.getFeatures()),[]);let g=u.hitDetectionImageData[h];if(!g){const e=UJ(a.getTileSize(a.getZForResolution(o,r.zDirection))),t=this.renderedRotation_;g=M2(e,[this.getRenderTransform(a.getTileCoordCenter(u.wrappedTileCoord),o,0,P2,e[0]*P2,e[1]*P2,0)],f,n.getStyleFunction(),a.getTileCoordExtent(u.wrappedTileCoord),u.getReplayState(n).renderedResolution,t),u.hitDetectionImageData[h]=g}t(A2(p,f,g))})}getFeaturesInExtent(e){const t=[],n=this.getTileCache();if(0===n.getCount())return t;const r=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),i=r.getZForResolution(this.renderedResolution),s={};return n.forEach(n=>{if(n.tileCoord[0]!==i||2!==n.getState())return;const o=n.getSourceTiles();for(let i=0,a=o.length;i<a;++i){const n=o[i],a=n.getKey();if(a in s)continue;s[a]=!0;const l=n.tileCoord;if(HG(e,r.getTileCoordExtent(l))){const r=n.getFeatures();if(r)for(let n=0,i=r.length;n<i;++n){const i=r[n],s=i.getGeometry();HG(e,s.getExtent())&&t.push(i)}}}}),t}handleFontsChanged(){const e=this.getLayer();e.getVisible()&&void 0!==this.renderedLayerRevision_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}renderDeclutter(e,t){const n=this.context,r=n.globalAlpha;n.globalAlpha=t.opacity;const i=e.viewHints,s=!(i[0]||i[1]),o=[this.context.canvas.width,this.context.canvas.height],a=this.getLayer().getDeclutter(),l=a?e.declutter?.[a]:void 0,c=kH(this.getLayer()),u=this.renderedTiles;for(let h=0,d=u.length;h<d;++h){const t=u[h],n=t.executorGroups[c];if(n)for(let r=n.length-1;r>=0;--r)n[r].execute(this.context,o,this.getTileRenderTransform(t,e),e.viewState.rotation,s,S2,l)}n.globalAlpha=r}renderDeferredInternal(e){const t=this.renderedTiles,n=kH(this.getLayer()),r=t.reduce((e,t,r)=>(t.executorGroups[n].forEach(t=>e.push({executorGroup:t,index:r})),e),[]),i=r.map(({executorGroup:e})=>e.getDeferredZIndexContexts()),s={};for(let a=0,l=r.length;a<l;++a){const e=r[a].executorGroup.getDeferredZIndexContexts();for(const t in e)s[t]=!0}const o=Object.keys(s).map(Number).sort(cH);this.layerExtent&&this.clipUnrotated(this.context,e,this.layerExtent),o.forEach(e=>{i.forEach((t,n)=>{t[e]&&(t[e].forEach(e=>{const{executorGroup:t,index:i}=r[n],s=t.getRenderedContext(),o=s.globalAlpha;s.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[i];a&&a.draw(s),e.draw(s),a&&s.restore(),s.globalAlpha=o,e.clear()}),t[e].length=0)})}),this.layerExtent&&this.context.restore()}getTileRenderTransform(e,t){const n=t.pixelRatio,r=t.viewState,i=r.center,s=r.resolution,o=r.rotation,a=t.size,l=Math.round(a[0]*n),c=Math.round(a[1]*n),u=this.getLayer().getSource().getTileGridForProjection(t.viewState.projection),h=e.tileCoord,d=u.getTileCoordExtent(e.wrappedTileCoord),p=u.getTileCoordExtent(h,this.tempExtent)[0]-d[0];return CZ(EZ(this.inversePixelTransform.slice(),1/n,1/n),this.getRenderTransform(i,s,o,n,l,c,p))}clipTileContext_(e,t,n,r,i,s){const o=[];for(let l=0,c=n.length;l<c;++l)i<r[l]&&HG(t,n[l])&&o.push(n[l]);if(0===o.length)return!1;const a=XG(t,o);e.save(),e.beginPath();for(let l=0,c=a.length;l<c;++l){const t=a[l],n=kZ(s,[t[0],t[1]]),r=kZ(s,[t[0],t[3]]),i=kZ(s,[t[2],t[3]]),o=kZ(s,[t[2],t[1]]);e.moveTo(n[0],n[1]),e.lineTo(r[0],r[1]),e.lineTo(i[0],i[1]),e.lineTo(o[0],o[1]),e.closePath()}return e.clip(),!0}postRender(e,t){const n=t.viewHints,r=!(n[0]||n[1]);this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice(),this.renderedRotation_=t.viewState.rotation,this.renderedOpacity_=t.layerStatesArray[t.layerIndex].opacity;const i=this.getLayer(),s=i.getRenderMode(),o=e.globalAlpha;e.globalAlpha=this.renderedOpacity_;const a=i.getDeclutter(),l=a?m7[s].filter(e=>!S2.includes(e)):m7[s],c=t.viewState,u=c.rotation;this.layerExtent&&this.clipUnrotated(e,t,this.layerExtent);const h=i.getSource(),d=h.getTileGridForProjection(c.projection).getZForResolution(c.resolution,h.zDirection),p=this.renderedTiles,f=[],g=[],m=[],y=kH(i);let v=!0;for(let b=p.length-1;b>=0;--b){const n=p[b];v=v&&!n.getReplayState(i).dirty;const s=n.executorGroups[y].filter(e=>e.hasExecutors(l));if(0===s.length)continue;const o=this.getTileRenderTransform(n,t),c=n.tileCoord[0];let h=!1;const w=s[0].getClipCoords(bZ);let _,x=e;if(w){const e=[w[0],w[1],w[4],w[5]];_=new h2,x=_.getContext(),d!==c&&(h=this.clipTileContext_(x,e,f,g,c,o)),f.push(e),g.push(c)}for(let i=0,d=s.length;i<d;++i)s[i].execute(e,[e.canvas.width,e.canvas.height],o,u,r,l,t.declutter?.[a]);h&&(x===e?x.restore():m[b]=_)}this.layerExtent&&e.restore(),e.globalAlpha=o,this.ready=v,this.tileClipContexts_=m,t.declutter||this.renderDeferredInternal(t),super.postRender(e,t)}renderFeature(e,t,n,r,i,s){if(!n)return!1;let o=!1;if(Array.isArray(n))for(let a=0,l=n.length;a<l;++a)o=z2(r,e,n[a],t,this.boundHandleStyleImageChange_,void 0,i,s)||o;else o=z2(r,e,n,t,this.boundHandleStyleImageChange_,void 0,i,s);return o}tileImageNeedsRender_(e){const t=this.getLayer();if("vector"===t.getRenderMode())return!1;const n=e.getReplayState(t),r=t.getRevision(),i=e.wantedResolution;return n.renderedTileResolution!==i||n.renderedTileRevision!==r}renderTileImage_(e,t){const n=this.getLayer(),r=e.getReplayState(n),i=n.getRevision(),s=e.executorGroups[kH(n)];r.renderedTileRevision=i;const o=e.wrappedTileCoord,a=o[0],l=n.getSource();let c=t.pixelRatio;const u=t.viewState.projection,h=l.getTileGridForProjection(u),d=h.getResolution(e.tileCoord[0]),p=t.pixelRatio/e.wantedResolution*d,f=h.getResolution(a),g=e.getContext();c=Math.round(Math.max(c,p/c));const m=l.getTilePixelSize(a,c,u);g.canvas.width=m[0],g.canvas.height=m[1];const y=c/p;if(1!==y){const e=xZ(this.tmpTransform_);EZ(e,y,y),g.setTransform.apply(g,e)}const v=h.getTileCoordExtent(o,this.tempExtent),b=p/f,w=xZ(this.tmpTransform_);EZ(w,b,-b),function(e,t,n){CZ(e,SZ(wZ,1,0,0,1,t,n))}(w,-v[0],-v[3]);for(let _=0,x=s.length;_<x;++_)s[_].execute(g,[g.canvas.width*y,g.canvas.height*y],w,0,!0,g7[n.getRenderMode()],null);r.renderedTileResolution=e.wantedResolution}},v7=class extends _1{constructor(e){e=e||{};const t=Object.assign({},e);delete t.preload;const n=void 0===e.cacheSize?0:e.cacheSize;delete e.cacheSize,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n;const r=e.renderMode||"hybrid";XH("hybrid"==r||"vector"==r,"`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=r,this.setPreload(e.preload?e.preload:0),this.setUseInterimTilesOnError(void 0===e.useInterimTilesOnError||e.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new y7(this,{cacheSize:this.cacheSize_})}getFeatures(e){return super.getFeatures(e)}getFeaturesInExtent(e){return this.getRenderer().getFeaturesInExtent(e)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(h7)}getUseInterimTilesOnError(){return this.get(d7)}setPreload(e){this.set(h7,e)}setUseInterimTilesOnError(e){this.set(d7,e)}},b7=[0,0,0],w7=class{constructor(e){let t=e.minZoom;const n=e.resolutions;let r;if(void 0===t&&n&&(t=n.findIndex(e=>void 0!==e)),this.minZoom=void 0!==t?t:0,this.resolutions_=n,XH(function(e){const t=((e,t)=>t-e)||cH;return e.every(function(n,r){if(0===r)return!0;const i=t(e[r-1],n);return!(i>0||0===i)})}(this.resolutions_),"`resolutions` must be sorted in descending order"),!e.origins)for(let s=0,o=this.resolutions_.length-1;s<o;++s)if(r){if(this.resolutions_[s]/this.resolutions_[s+1]!==r){r=void 0;break}}else r=this.resolutions_[s]/this.resolutions_[s+1];this.zoomFactor_=r,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==e.origin?e.origin:null,this.origins_=null,void 0!==e.origins&&(this.origins_=e.origins,XH(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const i=e.extent;void 0===i||this.origin_||this.origins_||(this.origin_=qG(i)),XH(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,void 0!==e.tileSizes&&(this.tileSizes_=e.tileSizes,XH(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=void 0!==e.tileSize?e.tileSize:this.tileSizes_?null:256,XH(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==i?i:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==e.tileRanges?this.fullTileRanges_=e.tileRanges:void 0!==e.sizes?this.fullTileRanges_=e.sizes.map((e,t)=>{const n=new Z8(Math.min(0,e[0]),Math.max(e[0]-1,-1),Math.min(0,e[1]),Math.max(e[1]-1,-1));if(i){const e=this.getTileRangeForExtentAndZ(i,t);n.minX=Math.max(e.minX,n.minX),n.maxX=Math.min(e.maxX,n.maxX),n.minY=Math.max(e.minY,n.minY),n.maxY=Math.min(e.maxY,n.maxY)}return n}):i&&this.calculateTileRanges_(i)}forEachTileCoord(e,t,n){const r=this.getTileRangeForExtentAndZ(e,t);for(let i=r.minX,s=r.maxX;i<=s;++i)for(let e=r.minY,o=r.maxY;e<=o;++e)n([t,i,e])}forEachTileCoordParentTileRange(e,t,n,r){let i,s,o,a=null,l=e[0]-1;for(2===this.zoomFactor_?(s=e[1],o=e[2]):a=this.getTileCoordExtent(e,r);l>=this.minZoom;){if(void 0!==s&&void 0!==o?(s=Math.floor(s/2),o=Math.floor(o/2),i=Y8(s,s,o,o,n)):i=this.getTileRangeForExtentAndZ(a,l,n),t(l,i))return!0;--l}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]<this.maxZoom){if(2===this.zoomFactor_){const n=2*e[1],r=2*e[2];return Y8(n,n+1,r,r+1,t)}const r=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;const r=e[0],i=e[1],s=e[2];if(t===r)return Y8(i,s,i,s,n);if(this.zoomFactor_){const e=Math.pow(this.zoomFactor_,t-r),o=Math.floor(i*e),a=Math.floor(s*e);return t<r?Y8(o,o,a,a,n):Y8(o,Math.floor(e*(i+1))-1,a,Math.floor(e*(s+1))-1,n)}const o=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,b7);const r=b7[1],i=b7[2];return this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,b7),Y8(r,b7[1],i,b7[2],n)}getTileCoordCenter(e){const t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=UJ(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*r[0]*n,t[1]-(e[2]+.5)*r[1]*n]}getTileCoordExtent(e,t){const n=this.getOrigin(e[0]),r=this.getResolution(e[0]),i=UJ(this.getTileSize(e[0]),this.tmpSize_),s=n[0]+e[1]*i[0]*r,o=n[1]-(e[2]+1)*i[1]*r;return CG(s,o,s+i[0]*r,o+i[1]*r,t)}getTileCoordForCoordAndResolution(e,t,n){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,n)}getTileCoordForXYAndResolution_(e,t,n,r,i){const s=this.getZForResolution(n),o=n/this.getResolution(s),a=this.getOrigin(s),l=UJ(this.getTileSize(s),this.tmpSize_);let c=o*(e-a[0])/n/l[0],u=o*(a[1]-t)/n/l[1];return r?(c=hG(c,5)-1,u=hG(u,5)-1):(c=uG(c,5),u=uG(u,5)),s7(s,c,u,i)}getTileCoordForXYAndZ_(e,t,n,r,i){const s=this.getOrigin(n),o=this.getResolution(n),a=UJ(this.getTileSize(n),this.tmpSize_);let l=(e-s[0])/o/a[0],c=(s[1]-t)/o/a[1];return r?(l=hG(l,5)-1,c=hG(c,5)-1):(l=uG(l,5),c=uG(c,5)),s7(n,l,c,i)}getTileCoordForCoordAndZ(e,t,n){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,n)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){return nG(hH(this.resolutions_,e,t||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return rY(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){const t=this.resolutions_.length,n=new Array(t);for(let r=this.minZoom;r<t;++r)n[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=n}};function _7(e){let t=e.getDefaultTileGrid();return t||(t=function(e){return function(e,t,n,r){r=void 0!==r?r:"top-left";const i=C7(e,void 0,n);return new w7({extent:e,origin:DG(e,r),resolutions:i,tileSize:n})}(S7(e),0,void 0,void 0)}(e),e.setDefaultTileGrid(t)),t}function x7(e){const t=e||{},n=t.extent||iZ("EPSG:3857").getExtent(),r={extent:n,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:C7(n,t.maxZoom,t.tileSize,t.maxResolution)};return new w7(r)}function C7(e,t,n,r){t=void 0!==t?t:42,n=UJ(void 0!==n?n:256);const i=UG(e),s=WG(e);r=r>0?r:Math.max(s/n[0],i/n[1]);const o=t+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=r/Math.pow(2,l);return a}function S7(e){let t=(e=iZ(e)).getExtent();if(!t){const n=180*lK.degrees/e.getMetersPerUnit();t=CG(-n,-n,n,n)}return t}var k7=/\{z\}/g,E7=/\{x\}/g,R7=/\{y\}/g,T7=/\{-y\}/g;function L7(e,t){return function(n){if(!n)return;let r;const i=n[0];if(t){const e=t.getFullTileRange(i);e&&(r=e.getHeight()-1)}return function(e,t,n,r,i){return e.replace(k7,t.toString()).replace(E7,n.toString()).replace(R7,r.toString()).replace(T7,function(){if(void 0===i)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(i-r).toString()})}(e,i,n[1],n[2],r)}}function I7(e,t){const n=e.length,r=new Array(n);for(let i=0;i<n;++i)r[i]=L7(e[i],t);return function(e){return 1===e.length?e[0]:function(t,n,r){if(!t)return;const i=function(e){return function(e,t,n){return(t<<e)+n}(e[0],e[1],e[2])}(t);return e[aG(i,e.length)](t,n,r)}}(r)}var P7=class extends Q2{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=void 0!==e.tilePixelRatio?e.tilePixelRatio:1,this.tileGrid=void 0!==e.tileGrid?e.tileGrid:null,this.tileGrid&&UJ(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=e.key||kH(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){const t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,i,s){return CH()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:_7(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){const r=this.getTileGridForProjection(n),i=this.getTilePixelRatio(t),s=UJ(r.getTileSize(e),this.tmpSize);return 1==i?s:(o=s,a=i,void 0===(l=this.tmpSize)&&(l=[0,0]),l[0]=o[0]*a+.5|0,l[1]=o[1]*a+.5|0,l);var o,a,l}getTileCoordForTileUrlFunction(e,t){const n=void 0!==t?t:this.getProjection(),r=void 0!==t?this.getTileGridForProjection(n):this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=function(e,t,n){const r=t[0],i=e.getTileCoordCenter(t),s=S7(n);if(!bG(s,i)){const t=WG(s),n=Math.ceil((s[0]-i[0])/t);return i[0]+=t*n,e.getTileCoordForCoordAndZ(i,r)}return t}(r,e,n)),function(e,t){const n=e[0],r=e[1],i=e[2];if(t.getMinZoom()>n||n>t.getMaxZoom())return!1;const s=t.getFullTileRange(n);return!s||s.containsXY(r,i)}(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},M7=class extends wH{constructor(e,t){super(e),this.tile=t}},A7=class e extends P7{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,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===e.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(e){const t=e.target,n=kH(t),r=t.getState();let i;1==r?(this.tileLoadingKeys_[n]=!0,i="tileloadstart"):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],i=3==r?"tileloaderror":2==r?"tileloadend":void 0),null!=i&&this.dispatchEvent(new M7(i,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,void 0!==t?this.setKey(t):this.changed()}setUrl(e){const t=function(e){const t=[];let n=/\{([a-z])-([a-z])\}/.exec(e);if(n){const r=n[1].charCodeAt(0),i=n[2].charCodeAt(0);let s;for(s=r;s<=i;++s)t.push(e.replace(n[0],String.fromCharCode(s)));return t}if(n=/\{(\d+)-(\d+)\}/.exec(e),n){const r=parseInt(n[2],10);for(let i=parseInt(n[1],10);i<=r;i++)t.push(e.replace(n[0],i.toString()));return t}return t.push(e),t}(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;const t=e.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(I7(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},O7=class extends A7{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:N7,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:void 0===e.interpolate||e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=void 0!==e.crossOrigin?e.crossOrigin:null,this.referrerPolicy=e.referrerPolicy,this.tileClass=void 0!==e.tileClass?e.tileClass:K8,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!uZ(this.getProjection(),e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=":disable-interpolation"),e}getTileGridForProjection(e){const t=this.getProjection();if(this.tileGrid&&(!t||uZ(t,e)))return this.tileGrid;const n=kH(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=_7(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,i,s){const o=[e,t,n],a=this.getTileCoordForTileUrlFunction(o,i),l=a?this.tileUrlFunction(a,r,i):void 0,c=new this.tileClass(o,void 0!==l?0:4,void 0!==l?l:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return c.key=s,c.addEventListener(tH,this.handleTileChange.bind(this)),c}getTile(e,t,n,r,i,s){const o=this.getProjection();if(!o||!i||uZ(o,i))return this.getTileInternal(e,t,n,r,o||i);const a=[e,t,n],l=this.getKey(),c=this.getTileGridForProjection(o),u=this.getTileGridForProjection(i),h=this.getTileCoordForTileUrlFunction(a,i),d=new r7(o,c,i,u,a,h,this.getTilePixelRatio(r),this.getGutter(),(e,t,n,r)=>this.getTileInternal(e,t,n,r,o,s),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=l,d}getTileInternal(e,t,n,r,i,s){const o=this.getKey(),a=o7(this,o,e,t,n);if(s&&s.containsKey(a))return s.get(a);const l=this.createTile_(e,t,n,r,i,o);return s?.set(a,l),l}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){const n=iZ(e);if(n){const e=kH(n);e in this.tileGridForProjection||(this.tileGridForProjection[e]=t)}}};function N7(e,t){if(zH){const n=e.getCrossOrigin();let r="same-origin",i="same-origin";"anonymous"===n||""===n?(r="cors",i="omit"):"use-credentials"===n&&(r="cors",i="include");const s={mode:r,credentials:i,referrerPolicy:e.getReferrerPolicy()};return void fetch(t,s).then(e=>{if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.blob()}).then(e=>createImageBitmap(e)).then(t=>{const n=e.getImage();n.width=t.width,n.height=t.height,n.getContext("2d").drawImage(t,0,0),t.close?.(),n.dispatchEvent(new Event("load"))}).catch(()=>{e.getImage().dispatchEvent(new Event("error"))})}e.getImage().src=t}var F7=class extends O7{constructor(e){if(super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:iZ("EPSG:3857"),reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:"loading",tileLoadFunction:e.tileLoadFunction,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition,zDirection:e.zDirection}),this.tileJSON_=null,this.tileSize_=e.tileSize,e.url)if(e.jsonp)!function(e,t,n){const r=document.createElement("script"),i="olc_"+kH(t);function s(){delete window[i],r.parentNode.removeChild(r)}r.async=!0,r.src=e+(e.includes("?")?"&":"?")+"callback="+i;const o=setTimeout(function(){s(),n&&n()},1e4);window[i]=function(e){clearTimeout(o),s(),t(e)},document.head.appendChild(r)}(e.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.onXHRLoad_.bind(this)),t.addEventListener("error",this.onXHRError_.bind(this)),t.open("GET",e.url),t.send()}else{if(!e.tileJSON)throw new Error("Either `url` or `tileJSON` options must be provided");this.handleTileJSONResponse(e.tileJSON)}}onXHRLoad_(e){const t=e.target;if(!t.status||t.status>=200&&t.status<300){let e;try{e=JSON.parse(t.responseText)}catch{return void this.handleTileJSONError()}this.handleTileJSONResponse(e)}else this.handleTileJSONError()}onXHRError_(e){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(e){const t=iZ("EPSG:4326"),n=this.getProjection();let r;if(void 0!==e.bounds){const i=hZ(t,n);r=KG(e.bounds,i)}const i=S7(n),s=e.minzoom||0,o=x7({extent:i,maxZoom:e.maxzoom||22,minZoom:s,tileSize:this.tileSize_});if(this.tileGrid=o,this.tileUrlFunction=I7(e.tiles,o),e.attribution&&!this.getAttributions()){const t=void 0!==r?r:i;this.setAttributions(function(n){return HG(t,n.extent)?[e.attribution]:null})}this.tileJSON_=e,this.setState("ready")}handleTileJSONError(){this.setState("error")}},D7=[],z7=class extends $8{constructor(e,t,n,r,i){super(e,t,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=r.bind(void 0,this),this.removeSourceTiles_=i,this.wrappedTileCoord=n}getContext(){return this.context_||(this.context_=BY(1,1,D7)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(e){const t=kH(e);return t in this.replayState_||(this.replayState_[t]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[t]}load(){this.getSourceTiles()}release(){this.context_&&(qY(this.context_),D7.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}},j7=class extends $8{constructor(e,t,n,r,i,s){super(e,t,s),this.extent=null,this.format_=r,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=i,this.url_=n,this.key=n}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){0==this.state&&(this.setState(1),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(e,t){this.setFeatures(e)}onError(){this.setState(3)}setFeatures(e){this.features_=e,this.setState(2)}setLoader(e){this.loader_=e}},U7=class extends A7{constructor(e){const t=e.projection||"EPSG:3857",n=e.extent||S7(t),r=e.tileGrid||x7({extent:n,maxResolution:e.maxResolution,maxZoom:void 0!==e.maxZoom?e.maxZoom:22,minZoom:e.minZoom,tileSize:e.tileSize||512});super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,interpolate:!0,projection:t,state:e.state,tileGrid:r,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:B7,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:void 0===e.wrapX||e.wrapX,transition:e.transition,zDirection:void 0===e.zDirection?1:e.zDirection}),this.format_=e.format?e.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=null==e.overlaps||e.overlaps,this.tileClass=e.tileClass?e.tileClass:j7,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceZ_(e,t,n){const r=this.projection,i=t&&r&&!uZ(t,r)?e/r.getMetersPerUnit()*t.getMetersPerUnit():e;return this.tileGrid.getZForResolution(i,n)}getSourceTiles(e,t,n,r){if(0===n.getState()){n.setState(1);const i=n.wrappedTileCoord,s=this.getTileGridForProjection(t);let o=s.getTileCoordExtent(i);const a=i[0],l=s.getResolution(a);mG(o,-l,o);const c=this.projection;t&&this.projection&&!uZ(t,c)&&(o=gZ(o,t,c));const u=this.tileGrid,h=u.getExtent();h&&BG(o,h,o);const d=this.getSourceZ_(l,t,this.zDirection),p=r||this.tileUrlFunction;u.forEachTileCoord(o,d,r=>{const i=p(r,e,t);this.sourceTiles_[i]||(this.sourceTiles_[i]=new this.tileClass(r,i?0:4,i,this.format_,this.tileLoadFunction));const s=this.sourceTiles_[i];n.sourceTiles.push(s),this.tileKeysBySourceTileUrl_[i]||(this.tileKeysBySourceTileUrl_[i]=[]),this.tileKeysBySourceTileUrl_[i].push(n.getKey());const o=s.getState();if(o<2){const e=t=>{this.handleTileChange(t);const r=s.getState();if(2===r||3===r){const t=s.getKey();t in n.errorTileKeys?2===s.getState()&&delete n.errorTileKeys[t]:n.loadingSourceTiles--,3===r?n.errorTileKeys[t]=!0:s.removeEventListener(tH,e),0===n.loadingSourceTiles&&n.setState(XW(n.errorTileKeys)?2:3)}};s.addEventListener(tH,e),n.loadingSourceTiles++}0===o&&(s.extent=u.getTileCoordExtent(r),s.projection=this.projection,s.resolution=u.getResolution(r[0]),s.load())}),n.loadingSourceTiles||n.setState(n.sourceTiles.some(e=>3===e.getState())?3:2)}return n.sourceTiles}removeSourceTiles(e){const t=e.getKey(),n=e.sourceTiles;for(let r=0,i=n.length;r<i;++r){const e=n[r].getTileUrl();if(!this.tileKeysBySourceTileUrl_[e])return;const i=this.tileKeysBySourceTileUrl_[e].indexOf(t);-1!==i&&(this.tileKeysBySourceTileUrl_[e].splice(i,1),0===this.tileKeysBySourceTileUrl_[e].length&&(delete this.tileKeysBySourceTileUrl_[e],delete this.sourceTiles_[e]))}}getTile(e,t,n,r,i){const s=[e,t,n];let o=this.getTileCoordForTileUrlFunction(s,i);const a=this.getTileGrid().getExtent(),l=this.projection,c=this.getTileGridForProjection(i);if(o&&a){const t=c.getTileCoordExtent(o);mG(t,-c.getResolution(e),t),HG(a,i&&l&&!uZ(i,l)?gZ(t,i,l):t)||(o=null)}let u=!0;if(null!==o){const t=this.tileGrid,n=c.getResolution(e),s=this.getSourceZ_(n,i,1),a=c.getTileCoordExtent(o);mG(a,-n,a),t.forEachTileCoord(i&&l&&!uZ(i,l)?gZ(a,i,l):a,s,e=>{u=u&&!this.tileUrlFunction(e,r,l)})}const h=this.tileUrlFunction,d=new z7(s,u?4:0,o,e=>this.getSourceTiles(r,i,e,h),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(e){const t=e.getCode();let n=this.tileGrids_[t];if(!n){const r=this.projection;if(null!==r&&!uZ(r,e))return _7(e);const i=this.tileGrid,s=i.getResolutions().slice(),o=s.map(function(e,t){return i.getOrigin(t)}),a=s.map(function(e,t){return i.getTileSize(t)}),l=43;for(let e=s.length;e<l;++e)s.push(s[e-1]/2),o.push(o[e-1]),a.push(a[e-1]);n=new w7({extent:i.getExtent(),origins:o,resolutions:s,tileSizes:a}),this.tileGrids_[t]=n}return n}getTilePixelRatio(e){return e}getTilePixelSize(e,t,n){const r=UJ(this.getTileGridForProjection(n).getTileSize(e),this.tmpSize);return[Math.round(r[0]*t),Math.round(r[1]*t)]}setOverlaps(e){this.overlaps_=e,this.changed()}};function B7(e,t){e.setLoader(function(n,r,i){H2(t,e.getFormat(),n,r,i,e.onLoad.bind(e),e.onError.bind(e))})}function $7(e,t){const n=t[0].evaluate(e),r=t[1].evaluate(e),i=t[2].evaluate(e),s=t[3]?t[3].evaluate(e):1;return L5.parse(`hsla(${n}, ${r}%, ${i}%, ${s})`)}function q7(e){if(Array.isArray(e)){if(0===e.length)return e;const t=e[0];if("literal"===t)return e;if("image"===t&&3===e.length&&"object"==typeof e[2]&&null!==e[2]&&!Array.isArray(e[2]))return["image-config",q7(e[1]),["literal",e[2]]];const n=e.length;for(let r=1;r<n;++r){const i=e[r],s=q7(i);if(s!==i){const i=[t];for(let t=1;t<r;++t)i.push(e[t]);i.push(s);for(let t=r+1;t<n;++t)i.push(q7(e[t]));return i}}}return e}var V7={},W7={zoom:0,distanceFromCenter:0};h6.register(u6,{...h6.definitions,pitch:[{kind:"number"},[],()=>W7.pitch||0],"distance-from-center":[{kind:"number"},[],()=>W7.distanceFromCenter||0],"to-hsla":[{kind:"array",itemType:{kind:"number"},N:4},[{kind:"string"}],(e,[t])=>function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,i=e[3],s=Math.max(t,n,r),o=Math.min(t,n,r),a=(s+o)/2;let l,c;if(s===o)l=0,c=0;else{const e=s-o;switch(c=a>.5?e/(2-s-o):e/(s+o),s){case t:l=(n-r)/e+(n<r?6:0);break;case n:l=(r-t)/e+2;break;case r:l=(t-n)/e+4;break;default:l=0}l/=6}return[360*l,100*c,100*a,i]}(FJ(t.evaluate(e)))],hsl:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"}],$7],hsla:[{kind:"color"},[{kind:"number"},{kind:"number"},{kind:"number"},{kind:"number"}],$7],"image-config":[{kind:"value"},[{kind:"string"},{kind:"value"}],(e,[t,n])=>t.evaluate(e)],"measure-light":[{kind:"number"},[{kind:"value"}],()=>1],config:[{kind:"value"},[{kind:"string"}],(e,[t])=>{const n=V7[t.evaluate(e)];return void 0===n?{}:n}]});var H7="https://api.mapbox.com";function G7(e){return 0!==e.indexOf("mapbox://")?"":e.slice(9)}function K7(e,t,n){const r=G7(e);if(!t||!r)return decodeURI(new URL(e,n).href);if(0!==r.indexOf("sprites/"))throw new Error(`unexpected sprites url: ${e}`);const i=r.slice(8);return`${H7}/styles/v1/${i}/sprite?access_token=${t}`}function Z7(e,t){const n=G7(e);if(!n||!t)return decodeURI(new URL(e,location.href).href);if(0!==n.indexOf("styles/"))throw new Error(`unexpected style url: ${e}`);const r=n.slice(7);return`${H7}/styles/v1/${r}?&access_token=${t}`}var Y7=["a","b","c","d"];function X7(e,t,n,r){const i=new URL(e,r||location.href),s=G7(e);return s?"mapbox.satellite"===s?[`https://api.mapbox.com/v4/${s}/{z}/{x}/{y}${window.devicePixelRatio>=1.5?"@2x":""}.webp?access_token=${t}`]:Y7.map(e=>`https://${e}.tiles.mapbox.com/v4/${s}/{z}/{x}/{y}.vector.pbf?access_token=${t}`):t?(i.searchParams.has(n)||i.searchParams.set(n,t),[decodeURI(i.href)]):[decodeURI(i.href)]}var J7=class extends q2{constructor(e){super(e),this.image=null,this.renderedSourceRevision_=0}getImage(){return this.image?this.image.getImage():null}prepareFrame(e){const t=e.layerStatesArray[e.layerIndex],n=e.pixelRatio,r=e.viewState,i=r.resolution,s=this.getLayer().getSource(),o=e.viewHints;let a=e.extent;if(void 0!==t.extent&&(a=BG(a,vZ(t.extent,r.projection))),!o[0]&&!o[1]&&!GG(a))if(s){this.getLayer().rendered||this.renderedSourceRevision_===s.getRevision()||(this.image=null),this.renderedSourceRevision_=s.getRevision();const e=r.projection,t=s.getImage(a,i,n,e);t&&(this.loadImage(t)?this.image=t:4===t.getState()&&(this.image=null))}else this.image=null;return!!this.image}getData(e){const t=this.frameState;if(!t)return null;const n=this.getLayer(),r=kZ(t.pixelToCoordinateTransform,e.slice()),i=n.getExtent();if(i&&!bG(i,r))return null;const s=this.image.getExtent(),o=this.image.getImage(),a=WG(s),l=Math.floor(o.width*((r[0]-s[0])/a));if(l<0||l>=o.width)return null;const c=UG(s),u=Math.floor(o.height*((s[3]-r[1])/c));return u<0||u>=o.height?null:this.getImageData(o,l,u)}renderFrame(e,t){const n=this.image,r=n.getExtent(),i=n.getResolution(),[s,o]=Array.isArray(i)?i:[i,i],a=n.getPixelRatio(),l=e.layerStatesArray[e.layerIndex],c=e.pixelRatio,u=e.viewState,h=u.center,d=u.resolution,p=c*s/(d*a),f=c*o/(d*a);this.prepareContainer(e,t);const g=this.context.canvas.width,m=this.context.canvas.height,y=this.getRenderContext(e);let v=!1,b=!0;if(l.extent){const t=vZ(l.extent,u.projection);b=HG(t,e.extent),v=b&&!wG(t,e.extent),v&&this.clipUnrotated(y,e,t)}const w=n.getImage(),_=RZ(this.tempTransform,g/2,m/2,p,f,0,a*(r[0]-h[0])/s,a*(h[1]-r[3])/o);this.renderedResolution=o*c/a;const x=w.width*_[0],C=w.height*_[3];if(this.getLayer().getSource().getInterpolate()||(y.imageSmoothingEnabled=!1),this.preRender(y,e),b&&x>=.5&&C>=.5){const e=_[4],t=_[5],n=l.opacity;1!==n&&(y.save(),y.globalAlpha=n),y.drawImage(w,0,0,+w.width,+w.height,e,t,x,C),1!==n&&y.restore()}return this.postRender(this.context,e),v&&y.restore(),y.imageSmoothingEnabled=!0,this.container}},Q7=class extends QX{constructor(e){super(e=e||{})}},e9=class extends Q7{constructor(e){super(e)}createRenderer(){return new J7(this)}getData(e){return super.getData(e)}},t9=class extends p0{constructor(e,t,n,r,i){super(e,t,n,void 0!==i?0:2),this.loader_=void 0!==i?i:null,this.canvas_=r,this.error_=null}getError(){return this.error_}handleLoad_(e){e?(this.error_=e,this.state=3):this.state=2,this.changed()}load(){0==this.state&&(this.state=1,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}};function n9(e){return Array.isArray(e)?Math.min(...e):e}var r9=class extends p0{constructor(e,t,n,r,i,s,o){let a=e.getExtent();a&&e.canWrapX()&&(a=a.slice(),a[0]=-1/0,a[2]=1/0);let l=t.getExtent();l&&t.canWrapX()&&(l=l.slice(),l[0]=-1/0,l[2]=1/0);const c=l?BG(n,l):n,u=e7(e,t,FG(c),r),h=new n7(e,t,c,a,.5*u,r),d=h.calculateSourceExtent(),p=GG(d)?null:s(d,u,i),f=p?0:4,g=p?p.getPixelRatio():1;super(n,r,g,f),this.targetProj_=t,this.maxSourceExtent_=a,this.triangulation_=h,this.targetResolution_=r,this.targetExtent_=n,this.sourceImage_=p,this.sourcePixelRatio_=g,this.interpolate_=o,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){1==this.state&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const e=this.sourceImage_.getState();if(2==e){const e=WG(this.targetExtent_)/this.targetResolution_,t=UG(this.targetExtent_)/this.targetResolution_;this.canvas_=t7(e,t,this.sourcePixelRatio_,n9(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=e,this.changed()}load(){if(0==this.state){this.state=1,this.changed();const e=this.sourceImage_.getState();2==e||3==e?this.reproject_():(this.sourceListenerKey_=JW(this.sourceImage_,tH,()=>{const e=this.sourceImage_.getState();2!=e&&3!=e||(this.unlistenSource_(),this.reproject_())}),this.sourceImage_.load())}}unlistenSource_(){eH(this.sourceListenerKey_),this.sourceListenerKey_=null}},i9=class extends wH{constructor(e,t){super(e),this.image=t}},s9=class extends Q2{constructor(e){super({attributions:e.attributions,projection:e.projection,state:e.state,interpolate:void 0===e.interpolate||e.interpolate}),this.on,this.once,this.un,this.loader=e.loader||null,this.resolutions_=void 0!==e.resolutions?e.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=!!e.loader&&0===e.loader.length,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(e){this.resolutions_=e}findNearestResolution(e){const t=this.getResolutions();return t&&(e=t[hH(t,e,0)]),e}getImage(e,t,n,r){const i=this.getProjection();if(!i||!r||uZ(i,r))return i&&(r=i),this.getImageInternal(e,t,n,r);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&uZ(this.reprojectedImage_.getProjection(),r)&&this.reprojectedImage_.getResolution()==t&&RG(this.reprojectedImage_.getExtent(),e))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new r9(i,r,e,t,n,(e,t,n)=>this.getImageInternal(e,t,n,i),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(e,t,n,r){if(this.loader){const i=function(e,t,n){const r=t/n,i=FG(e),s=hG(WG(e)/r,4),o=hG(UG(e)/r,4);return zG(i,r,0,[s+2*hG(0*s/2,4),o+2*hG(0*o/2,4)])}(e,t,n),s=this.findNearestResolution(t);if(this.image&&(this.static_||this.wantedProjection_===r&&(this.wantedExtent_&&wG(this.wantedExtent_,i)||wG(this.image.getExtent(),i))&&(this.wantedResolution_&&n9(this.wantedResolution_)===s||n9(this.image.getResolution())===s)))return this.image;this.wantedProjection_=r,this.wantedExtent_=i,this.wantedResolution_=s,this.image=new p0(i,s,n,this.loader),this.image.addEventListener(tH,this.handleImageChange.bind(this))}return this.image}handleImageChange(e){const t=e.target;let n;switch(t.getState()){case 1:this.loading=!0,n="imageloadstart";break;case 2:this.loading=!1,n="imageloadend";break;case 3:this.loading=!1,n="imageloaderror";break;default:return}this.hasListener(n)&&this.dispatchEvent(new i9(n,t))}};function o9(e){return function(t){const n=t.buffers,r=t.meta,i=t.imageOps,s=t.width,o=t.height,a=n.length,l=n[0].byteLength;if(i){const t=new Array(a);for(let e=0;e<a;++e)t[e]=new ImageData(new Uint8ClampedArray(n[e]),s,o);return e(t,r).data.buffer}const c=new Uint8ClampedArray(l),u=new Array(a),h=new Array(a);for(let e=0;e<a;++e)u[e]=new Uint8ClampedArray(n[e]),h[e]=[0,0,0,0];for(let d=0;d<l;d+=4){for(let e=0;e<a;++e){const t=u[e];h[e][0]=t[d],h[e][1]=t[d+1],h[e][2]=t[d+2],h[e][3]=t[d+3]}const t=e(h,r);c[d]=t[0],c[d+1]=t[1],c[d+2]=t[2],c[d+3]=t[3]}return c.buffer}}function a9(e,t){const n=Object.keys(e.lib||{}).map(function(t){return"const "+t+" = "+e.lib[t].toString()+";"}).concat(["const __minion__ = ("+o9.toString()+")(",e.operation.toString(),");",'self.addEventListener("message", function(event) {'," const buffer = __minion__(event.data);"," self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);","});"]),r=new Worker("undefined"==typeof Blob?"data:text/javascript;base64,"+Buffer.from(n.join("\n"),"binary").toString("base64"):URL.createObjectURL(new Blob(n,{type:"text/javascript"})));return r.addEventListener("message",t),r}var l9=class extends lH{constructor(e){let t;super(),this.imageOps_=!!e.imageOps,t=0===e.threads?0:this.imageOps_?1:e.threads||1;const n=new Array(t);if(t)for(let r=0;r<t;++r)n[r]=a9(e,this.onWorkerMessage_.bind(this,r));else n[0]=function(e,t){const n=o9(e.operation);let r=!1;return{postMessage:function(e){setTimeout(function(){r||t({data:{buffer:n(e),meta:e.meta}})},0)},terminate:function(){r=!0}}}(e,this.onWorkerMessage_.bind(this,0));this.workers_=n,this.queue_=[],this.maxQueueLength_=e.queue||1/0,this.running_=0,this.dataLookup_={},this.job_=null}process(e,t,n){this.enqueue_({inputs:e,meta:t,callback:n}),this.dispatch_()}enqueue_(e){for(this.queue_.push(e);this.queue_.length>this.maxQueueLength_;)this.queue_.shift().callback(null,null)}dispatch_(){if(this.running_||0===this.queue_.length)return;const e=this.queue_.shift();this.job_=e;const t=e.inputs[0].width,n=e.inputs[0].height,r=e.inputs.map(function(e){return e.data.buffer}),i=this.workers_.length;if(this.running_=i,1===i)return void this.workers_[0].postMessage({buffers:r,meta:e.meta,imageOps:this.imageOps_,width:t,height:n},r);const s=e.inputs[0].data.length,o=4*Math.ceil(s/4/i);for(let a=0;a<i;++a){const i=a*o,s=[];for(let e=0,t=r.length;e<t;++e)s.push(r[e].slice(i,i+o));this.workers_[a].postMessage({buffers:s,meta:e.meta,imageOps:this.imageOps_,width:t,height:n},s)}}onWorkerMessage_(e,t){this.disposed||(this.dataLookup_[e]=t.data,--this.running_,0===this.running_&&this.resolveJob_())}resolveJob_(){const e=this.job_,t=this.workers_.length;let n,r;if(1===t)n=new Uint8ClampedArray(this.dataLookup_[0].buffer),r=this.dataLookup_[0].meta;else{const i=e.inputs[0].data.length;n=new Uint8ClampedArray(i),r=new Array(t);const s=4*Math.ceil(i/4/t);for(let e=0;e<t;++e){const t=this.dataLookup_[e].buffer,i=e*s;n.set(new Uint8ClampedArray(t),i),r[e]=this.dataLookup_[e].meta}}this.job_=null,this.dataLookup_={},e.callback(null,new ImageData(n,e.inputs[0].width,e.inputs[0].height),r),this.dispatch_()}disposeInternal(){for(let e=0;e<this.workers_.length;++e)this.workers_[e].terminate();this.workers_.length=0}},c9=class extends wH{constructor(e,t,n){super(e),this.extent=t.extent,this.resolution=t.viewState.resolution/t.pixelRatio,this.data=n}},u9=class extends s9{constructor(e){super({interpolate:e.interpolate,projection:null}),this.on,this.once,this.un,this.processor_=null,this.operationType_=void 0!==e.operationType?e.operationType:"pixel",this.threads_=void 0!==e.threads?e.threads:1,this.layers_=function(e){const t=e.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=p9(e[r]);return n}(e.sources);const t=this.changed.bind(this);for(let r=0,i=this.layers_.length;r<i;++r)this.layers_[r].addEventListener(tH,t);var n;this.useResolutions_=null!==e.resolutions,this.tileQueue_=new eG(function(){return 1},this.processSources_.bind(this)),this.requestedFrameState_,this.renderedImageCanvas_=null,this.renderedRevision_,this.frameState_={animate:!1,coordinateToPixelTransform:_Z(),declutter:null,extent:null,index:0,layerIndex:0,layerStatesArray:(n=this.layers_,n.map(function(e){return e.getLayerState()})),pixelRatio:1,pixelToCoordinateTransform:_Z(),postRenderFunctions:[],size:[0,0],tileQueue:this.tileQueue_,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:kH(this),renderTargets:{}},this.setAttributions(function(t){const n=[];for(let r=0,i=e.sources.length;r<i;++r){const i=e.sources[r],s=i instanceof Q2?i:i.getSource();if(!s)continue;const o=s.getAttributions()?.(t);"string"==typeof o?n.push(o):void 0!==o&&n.push(...o)}return n}),void 0!==e.operation&&this.setOperation(e.operation,e.lib)}setOperation(e,t){this.processor_&&this.processor_.dispose(),this.processor_=new l9({operation:e,imageOps:"image"===this.operationType_,queue:1,lib:t,threads:this.threads_}),this.changed()}updateFrameState_(e,t,n){const r=Object.assign({},this.frameState_);r.viewState=Object.assign({},r.viewState);const i=FG(e);r.size[0]=Math.ceil(WG(e)/t),r.size[1]=Math.ceil(UG(e)/t),r.extent=[i[0]-r.size[0]*t/2,i[1]-r.size[1]*t/2,i[0]+r.size[0]*t/2,i[1]+r.size[1]*t/2],r.time=Date.now();const s=r.viewState;return s.center=i,s.projection=n,s.resolution=t,r}allSourcesReady_(){let e,t=!0;for(let n=0,r=this.layers_.length;n<r;++n)if(e=this.layers_[n].getSource(),!e||"ready"!==e.getState()){t=!1;break}return t}getImage(e,t,n,r){if(!this.allSourcesReady_())return null;this.tileQueue_.loadMoreTiles(16,16),t=this.findNearestResolution(t);const i=this.updateFrameState_(e,t,r);if(this.requestedFrameState_=i,this.renderedImageCanvas_){const e=this.renderedImageCanvas_.getResolution(),n=this.renderedImageCanvas_.getExtent();t===e&&RG(i.extent,n)||(this.renderedImageCanvas_=null)}return this.renderedImageCanvas_&&this.getRevision()===this.renderedRevision_||this.processSources_(),i.animate&&requestAnimationFrame(this.changed.bind(this)),this.renderedImageCanvas_}processSources_(){const e=this.requestedFrameState_,t=this.layers_.length,n=new Array(t),r=new Array(t);for(let s=0;s<t;++s){const t=this.layers_[s].getSource();n[s]=t.getRevision(),e.layerIndex=s,e.renderTargets={};const i=d9(this.layers_[s],e);if(!i)return;r[s]=i}const i={};this.dispatchEvent(new c9("beforeoperations",e,i)),this.processor_.process(r,i,this.onWorkerComplete_.bind(this,e,n))}onWorkerComplete_(e,t,n,r,i){if(n||!r)return;const s=e.extent,o=e.viewState.resolution;if(o!==this.requestedFrameState_.viewState.resolution||!RG(s,this.requestedFrameState_.extent))return;for(let l=0;l<this.layers_.length;++l){const e=this.layers_[l].getSource();if(t[l]!==e.getRevision())return}let a;this.renderedImageCanvas_?a=this.renderedImageCanvas_.getImage().getContext("2d"):(a=BY(e.size[0],e.size[1]),this.renderedImageCanvas_=new t9(s,o,1,a.canvas)),a.putImageData(r,0,0),e.animate?requestAnimationFrame(this.changed.bind(this)):this.changed(),this.renderedRevision_=this.getRevision(),this.dispatchEvent(new c9("afteroperations",e,i))}getResolutions(e){if(!this.useResolutions_)return null;let t=super.getResolutions();if(!t)for(let n=0,r=this.layers_.length;n<r&&(t=this.layers_[n].getSource().getResolutions(e),!t);++n);return t}disposeInternal(){this.processor_&&this.processor_.dispose(),super.disposeInternal()}};u9.prototype.dispose;var h9=null;function d9(e,t){const n=e.getRenderer();if(!n)throw new Error("Unsupported layer type: "+e);if(!n.prepareFrame(t))return null;const r=t.size[0],i=t.size[1];if(0===r||0===i)return null;const s=n.renderFrame(t,null);let o;if(s instanceof HTMLCanvasElement)o=s;else{if(s&&(o=s.firstElementChild),!(o instanceof HTMLCanvasElement))throw new Error("Unsupported rendered element: "+o);if(o.width===r&&o.height===i)return o.getContext("2d").getImageData(0,0,r,i)}if(h9){const e=h9.canvas;e.width!==r||e.height!==i?h9=BY(r,i,void 0,{willReadFrequently:!0}):h9.clearRect(0,0,r,i)}else h9=BY(r,i,void 0,{willReadFrequently:!0});return h9.drawImage(o,0,0,r,i),h9.getImageData(0,0,r,i)}function p9(e){let t;return e instanceof Q2?e instanceof P7?t=new f7({source:e}):e instanceof s9&&(t=new e9({source:e})):t=e,t}function f9(e,t){const n=e[0],r=n.width,i=n.height,s=n.data,o=new Uint8ClampedArray(s.length),a=2*t.resolution,l=r-1,c=i-1,u=[0,0,0,0],h=Math.PI,d=t.encoding,p=t.exaggeration,f=t.zoom,g=t.method||"standard",m=t.accentColor,y=t.shadowColors||[t.shadowColor],v=t.highlightColors||[t.highlightColor],b=(t.azimuths||[t.sunAz]).map(e=>e*h/180),w=(t.altitudes||[45]).map(e=>e*h/180),_=Math.min(b.length,w.length,y.length,v.length,4),x=f<2?.4:f<4.5?.35:.3,C=f<15?Math.pow(2,(15-f)*x):1;function S(e,t="mapbox"){return"mapbox"===t?.1*(256*e[0]*256+256*e[1]+e[2])-1e4:"terrarium"===t?256*e[0]+e[1]+e[2]/256-32768:0}function k(e,t){return 0!==e?Math.atan2(t,-e):h/2*(t>0?1:-1)}const E="igor"===g?function(e,t){const n=k(e*=2*p,t*=2*p),r=b[0]+h,i=Math.atan(Math.sqrt(e*e+t*t))*(2/h);let s=(n+r)/h+.5;s%=2,s<0&&(s+=2);const o=1-Math.abs(s-1),a=i*o,l=i*(1-o),c=y[0],u=v[0];return[c.r*a+u.r*l,c.g*a+u.g*l,c.b*a+u.b*l,c.a*a+u.a*l]}:"basic"===g?function(e,t){e*=2*p,t*=2*p;const n=b[0]+h,r=Math.cos(n),i=Math.sin(n),s=Math.cos(w[0]),o=(Math.sin(w[0])-(t*r*s-e*i*s))/Math.sqrt(1+e*e+t*t),a=Math.max(0,Math.min(1,o));if(a>.5){const e=2*a-1,t=v[0];return[t.r*e,t.g*e,t.b*e,t.a*e]}const l=1-2*a,c=y[0];return[c.r*l,c.g*l,c.b*l,c.a*l]}:"combined"===g?function(e,t){e*=2*p,t*=2*p;const n=b[0]+h,r=Math.cos(n),i=Math.sin(n),s=Math.cos(w[0]),o=Math.sin(w[0]);let a=Math.acos((o-(t*r*s-e*i*s))/Math.sqrt(1+e*e+t*t));a=Math.max(0,Math.min(h/2,a));const l=Math.atan(Math.sqrt(e*e+t*t))*(4/h/h),c=a*l,u=(h/2-a)*l,d=y[0],f=v[0];return[d.r*c+f.r*u,d.g*c+f.g*u,d.b*c+f.b*u,d.a*c+f.a*u]}:"multidirectional"===g?function(e,t){const n=(e*=2*p)*e+(t*=2*p)*t,r=Math.sqrt(1+n);let i=0,s=0,o=0,a=0;for(let l=0;l<_;l++){const n=Math.cos(w[l]),c=(Math.sin(w[l])-(t*-Math.cos(b[l])*n-e*-Math.sin(b[l])*n))/r,u=Math.max(0,Math.min(1,c)),h=y[Math.min(l,y.length-1)],d=v[Math.min(l,v.length-1)];if(u>.5){const e=(2*u-1)/_;i+=d.r*e,s+=d.g*e,o+=d.b*e,a+=d.a*e}else{const e=(1-2*u)/_;i+=h.r*e,s+=h.g*e,o+=h.b*e,a+=h.a*e}}return[i,s,o,a]}:function(e,t){const n=b[0]+h,r=Math.atan(.625*Math.sqrt(e*e+t*t)),i=k(e,t),s=1.875-1.75*p,o=.5*h,a=.5!==p?(Math.pow(s,r)-1)/(Math.pow(s,o)-1)*o:r,l=Math.cos(a),c=Math.min(Math.max(2*p,0),1),u=(1-l)*c,d=m,f=d.r*u,g=d.g*u,w=d.b*u,_=d.a*u;let x=(i+n)/h+.5;x%=2,x<0&&(x+=2);const C=Math.abs(x-1),S=Math.sin(a)*c,E=y[0],R=v[0],T=(E.r*(1-C)+R.r*C)*S,L=(E.g*(1-C)+R.g*C)*S,I=(E.b*(1-C)+R.b*C)*S,P=(E.a*(1-C)+R.a*C)*S;return[f*(1-P)+T,g*(1-P)+L,w*(1-P)+I,_*(1-P)+P]};let R,T,L,I,P,M,A,O,N,F,D;for(T=0;T<=c;++T)for(P=0===T?0:T-1,M=T===c?c:T+1,R=0;R<=l;++R){L=0===R?0:R-1,I=R===l?l:R+1,A=4*(T*r+L),u[0]=s[A],u[1]=s[A+1],u[2]=s[A+2],u[3]=s[A+3],O=S(u,d),A=4*(T*r+I),u[0]=s[A],u[1]=s[A+1],u[2]=s[A+2],u[3]=s[A+3],N=S(u,d),F=(N-O)/a*C,A=4*(P*r+R),u[0]=s[A],u[1]=s[A+1],u[2]=s[A+2],u[3]=s[A+3],O=S(u,d),A=4*(M*r+R),u[0]=s[A],u[1]=s[A+1],u[2]=s[A+2],u[3]=s[A+3],N=S(u,d),D=(N-O)/a*C;const e=E(F,D),t=e[3];A=4*(T*r+R),t>0&&(o[A]=e[0]/t*255,o[A+1]=e[1]/t*255,o[A+2]=e[2]/t*255),o[A+3]=255*t}return new ImageData(o,r,i)}function g9(e,t){const n=e[0],r=n.width,i=n.height,s=n.data,o=new Uint8ClampedArray(s.length),a=r-1,l=i-1,c=[0,0,0,0];let u,h,d;const p=(f=t.saturation)>0?1-1/(1.001-f):-f;var f;const g=(m=t.contrast)>0?1/(1-m):1+m;var m;const y=function(e){e*=Math.PI/180;const t=Math.sin(e),n=Math.cos(e);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}(t.hueRotate),v=y,b=[y[2],y[0],y[1]],w=[y[1],y[2],y[0]],_=t.brightnessLow,x=t.brightnessHigh;for(h=0;h<=l;++h)for(u=0;u<=a;++u){d=4*(h*r+u),c[0]=s[d],c[1]=s[d+1],c[2]=s[d+2],c[3]=s[d+3];const e=c[0],t=c[1],n=c[2],i=(e,t)=>{let n=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r];return n};let a=i([e,t,n],v),l=i([e,t,n],b),f=i([e,t,n],w);const m=(a+l+f)/3;a+=(m-a)*p,l+=(m-l)*p,f+=(m-f)*p,a=(a-127.5)*g+127.5,l=(l-127.5)*g+127.5,f=(f-127.5)*g+127.5,a=_*(255-a)+x*a,l=_*(255-l)+x*l,f=_*(255-f)+x*f,o[d]=a,o[d+1]=l,o[d+2]=f,o[d+3]=c[3]}return new ImageData(o,r,i)}var m9={thin:100,hairline:100,"ultra-light":200,"extra-light":200,light:300,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,heavy:900,black:900,"heavy-black":900,fat:900,poster:900,"ultra-black":950,"extra-black":950},y9=" ",v9=/(italic|oblique)$/i,b9={};function w9(e,t,n){var r=b9[e];if(!r){Array.isArray(e)||(e=[e]);for(var i,s,o=400,a="normal",l=[],c=0,u=e.length;c<u;++c){var h=e[c].split(" "),d=h[h.length-1].toLowerCase();for(var p in"normal"==d||"italic"==d||"oblique"==d?(a=s?a:d,s=!0,h.pop(),d=h[h.length-1].toLowerCase()):v9.test(d)&&(d=d.replace(v9,""),a=s?a:h[h.length-1].replace(d,""),s=!0),m9){var f=h.length>1?h[h.length-2].toLowerCase():"";if(d==p||d==p.replace("-","")||f+"-"+d==p){o=i?o:m9[p],h.pop(),f&&p.startsWith(f)&&h.pop();break}}i||"number"!=typeof d||(o=d,i=!0);var g=h.join(y9).replace("Klokantech Noto Sans","Noto Sans").replace("DIN Pro","Barlow").replace("Arial Unicode MS","Arial");-1!==g.indexOf(y9)&&(g='"'+g+'"'),l.push(g)}r=b9[e]=[a,o,l]}return r[0]+y9+r[1]+y9+t+"px"+(n?"/"+n:"")+y9+r[2]}var _9=Object.freeze({}),x9={},C9={},S9=0;function k9(e){return e.id||(e.id=S9++),e.id}function E9(e){let t=x9[e.id];return t||(t={},x9[k9(e)]=t),t}function R9(e){return e*Math.PI/180}var T9=function(){const e=[];for(let t=78271.51696402048;e.length<=24;t/=2)e.push(t);return e}();function L9(e,t){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(e,t);const n=document.createElement("canvas");return n.width=e,n.height=t,n}function I9(e,t){let n=0;const r=t.length;for(;n<r;++n)if(t[n]<e&&n+1<r){const r=t[n]/t[n+1];return n+Math.log(t[n]/e)/Math.log(r)}return r-1}function P9(e,t){const n=Math.floor(e),r=Math.pow(2,e-n);return t[n]/r}var M9={};function A9(e,t,n={},r){if(t in M9)return r&&(r.url=M9[t][0].url),M9[t][1];const i=n.transformRequest&&n.transformRequest(t,e)||t,s=function(){return delete M9[t],Promise.reject(new Error("Error fetching source "+t))},o=function(e){return delete M9[t],e.ok?e.json():Promise.reject(new Error("Error fetching source "+t))},a=bH(()=>i).then(e=>e instanceof Response?(r&&(r.url=e.url),o(e)):(e instanceof Request||(e=new Request(e)),e.headers.get("Accept")||e.headers.set("Accept","application/json"),r&&(r.url=e.url),fetch(e).then(o).catch(s))).catch(s);return M9[t]=[i,a],a}function O9(e,t){if("string"!=typeof e)return Promise.resolve(e);if(!e.trim().startsWith("{"))return A9("Style",e=Z7(e,t.accessToken),t);try{const t=JSON.parse(e);return Promise.resolve(t)}catch(_6){return Promise.reject(_6)}}var N9={};function F9(e,t,n={}){const r=[t,JSON.stringify(e)].toString();let i=N9[r];if(!i||n.transformRequest){let s;n.transformRequest&&(s=(e,t)=>{const r=n.transformRequest&&n.transformRequest(t,"Tiles")||t;if(e instanceof j7)e.setLoader((t,n,i)=>{const s=function(n){n.arrayBuffer().then(n=>{const r=e.getFormat().readFeatures(n,{extent:t,featureProjection:i});e.setFeatures(r)})};bH(()=>r).then(t=>{if(t instanceof Response)return s(t);fetch(t).then(s).catch(()=>e.setState(3))}).catch(()=>e.setState(3))});else{const t=e.getImage();bH(()=>r).then(n=>{if("string"==typeof n)return void(t.src=n);const r=e=>e.blob().then(e=>{const n=URL.createObjectURL(e);t.addEventListener("load",()=>URL.revokeObjectURL(n)),t.addEventListener("error",()=>URL.revokeObjectURL(n)),t.src=n});if(n instanceof Response)return r(n);fetch(n).then(r).catch(()=>e.setState(3))}).catch(()=>e.setState(3))}});const o=e.url;if(o&&!e.tiles){const r=X7(o,n.accessToken,n.accessTokenParam||"access_token",t||location.href);if(o.startsWith("mapbox://"))i=Promise.resolve({tileJson:Object.assign({},e,{url:void 0,tiles:r}),tileLoadFunction:s});else{const e={};i=A9("Source",r[0],n,e).then(function(t){return t.tiles=t.tiles.map(function(r){return"tms"===t.scheme&&(r=r.replace("{y}","{-y}")),X7(r,n.accessToken,n.accessTokenParam||"access_token",e.url)[0]}),Promise.resolve({tileJson:t,tileLoadFunction:s})})}}else e.tiles?(e=Object.assign({},e,{tiles:e.tiles.map(function(r){return"tms"===e.scheme&&(r=r.replace("{y}","{-y}")),X7(r,n.accessToken,n.accessTokenParam||"access_token",t||location.href)[0]})}),i=Promise.resolve({tileJson:Object.assign({},e),tileLoadFunction:s})):i=Promise.reject(new Error("source has no `tiles` nor `url`"));N9[r]=i}return i}function D9(e,t,n,r){const i=[2*n*t.pixelRatio+t.width,2*n*t.pixelRatio+t.height],s=L9(i[0],i[1]),o=s.getContext("2d");o.drawImage(e,t.x,t.y,t.width,t.height,n*t.pixelRatio,n*t.pixelRatio,t.width,t.height);const a=o.getImageData(0,0,i[0],i[1]);o.globalCompositeOperation="destination-over",o.fillStyle=`rgba(${255*r.r},${255*r.g},${255*r.b},${r.a})`;const l=a.data;for(let c=0,u=a.width;c<u;++c)for(let e=0,r=a.height;e<r;++e)l[4*(e*u+c)+3]>0&&o.arc(c,e,n*t.pixelRatio,0,2*Math.PI);return o.fill(),s}function z9(e,t,n){const r=Math.max(0,Math.min(1,(n-e)/(t-e)));return r*r*(3-2*r)}function j9(e,t,n){const r=L9(t.width,t.height),i=r.getContext("2d");i.drawImage(e,t.x,t.y,t.width,t.height,0,0,t.width,t.height);const s=i.getImageData(0,0,t.width,t.height),o=s.data;for(let a=0,l=s.width;a<l;++a)for(let e=0,t=s.height;e<t;++e){const t=4*(e*l+a),r=z9(.65,.85,o[t+3]/255);r>0?(o[t+0]=Math.round(255*n.r*r),o[t+1]=Math.round(255*n.g*r),o[t+2]=Math.round(255*n.b*r),o[t+3]=Math.round(255*r)):o[t+3]=0}return i.putImageData(s,0,0),r}var U9,B9=Array(256).join(" ");function $9(e,t){if(t>=.05){let n="";const r=e.split("\n"),i=B9.slice(0,Math.round(t/.1));for(let e=0,t=r.length;e<t;++e)e>0&&(n+="\n"),n+=r[e].split("").join(i);return n}return e}function q9(){return U9||(U9=L9(1,1).getContext("2d")),U9}function V9(e,t){if(/\d+ \d+/.test(e)){const[n,r]=e.split(" ").map(Number);return n<=t&&t<=r}return e==t}function W9(e,t){return q9().measureText(e).width+(e.length-1)*t}var H9={};function G9(e,t,n,r){if(-1!==e.indexOf("\n")){const i=e.split("\n"),s=[];for(let e=0,o=i.length;e<o;++e)s.push(G9(i[e],t,n,r));return s.join("\n")}const i=n+","+t+","+e+","+r;let s=H9[i];if(!s){const o=e.split(" ");if(o.length>1){const e=q9();e.font=t;const i=e.measureText("M").width*n;let a="";const l=[];for(let t=0,n=o.length;t<n;++t){const e=o[t],n=a+(a?" ":"")+e;W9(n,r)<=i?a=n:(a&&l.push(a),a=e)}a&&l.push(a);for(let t=0,n=l.length;t<n&&n>1;++t){const e=l[t];if(W9(e,r)<.35*i){const i=t>0?W9(l[t-1],r):1/0,s=t<n-1?W9(l[t+1],r):1/0;l.splice(t,1),n-=1,i<s?(l[t-1]+=" "+e,t-=1):l[t]=e+" "+l[t]}}for(let t=0,n=l.length-1;t<n;++t){const e=l[t],s=l[t+1];if(W9(e,r)>.7*i&&W9(s,r)<.6*i){const o=e.split(" "),a=o.pop();W9(a,r)<.2*i&&(l[t]=o.join(" "),l[t+1]=a+" "+s),n-=1}}s=l.join("\n")}else s=e;s=$9(s,r),H9[i]=s}return s}T0.on("propertychange",()=>{for(const e in H9)delete H9[e]});var K9,Z9,Y9=["Arial","Courier New","Times New Roman","Verdana","sans-serif","serif","monospace","cursive","fantasy"],X9={},J9={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},Q9={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},eee=function(e,t){let n=M6(e,t);if("error"===n.result){const r=q7(e);r!==e&&(n=M6(r,t))}if("error"===n.result){const r=n.value[0];return console.error("Error parsing expression:",e,r.key,r.message),{evaluate:()=>t.default}}return n.value};function tee(e,t,n,r,i,s){const o=e.id;i||(i={},console.warn("No functionCache provided to getValue()")),i[o]||(i[o]={});const a=i[o];if(!a[n]){let r=(e[t]||_9)[n];const i=M8[`${t}_${e.type}`]&&M8[`${t}_${e.type}`][n];void 0===r&&i&&(r=i.default);let s=T6(r);if(!s&&E6(r)&&(r=H6(r,i),s=!0),s){const e=eee(r,i);a[n]=e.evaluate.bind(e)}else{const e=i?i.type:typeof r;"color"!==e&&"colorArray"!==e||(r=L5.parse(r));let t=!1;if("array"===e)for(let n=0;n<r.length;++n){const e=r[n];if(T6(e)||E6(e)){t=!0;break}}if(t){const e=Object.assign({},i,{type:i.value}),t=[];for(let n=0;n<r.length;++n){let i=r[n];if(!T6(i)&&E6(i)&&(i=H6(i,e)),T6(i)){const n=eee(i,e);t.push(n.evaluate.bind(n))}else t.push(function(){return i})}a[n]=function(e,n,r){const i=[];for(let s=0;s<t.length;++s)i[s]=t[s](e,n,r);return i}}else a[n]=function(){return r}}}return a[n](W7,r,s)}function nee(e,t,n,r){return tee(e,"layout",`${n}-allow-overlap`,t,r)?tee(e,"layout",`${n}-ignore-placement`,t,r)?"none":"obstacle":"declutter"}function ree(e,t,n,r){if(r||console.warn("No filterCache provided to evaluateFilter()"),!(e in r))try{r[e]=function(e){if(null==e)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};F6(e)||(e=U6(e));const t=L6(e,D6,void 0);if("error"===t.result)throw new Error(t.value.map(e=>`${e.key}: ${e.message}`).join(", "));return{filter:(e,n,r)=>t.value.evaluate(e,n,{},r),needGeometry:j6(e),getGlobalStateRefs:()=>O6(t.value.expression)}}(t).filter}catch(i){console.warn("Filter will evaluate to false: "+i.message),r[e]=function(){return!1}}return r[e](W7,n)}function iee(e,t){if(e){if(0===e.a||0===t)return;const n=e.a;return t=void 0===t?1:t,0===n?"transparent":"rgba("+Math.round(255*e.r/n)+","+Math.round(255*e.g/n)+","+Math.round(255*e.b/n)+","+n*t+")"}return e}var see=/\{[^{}}]*\}/g;function oee(e,t){return e.replace(see,function(e){return t[e.slice(1,-1)]||""})}function aee(e,t){let n=e.split(":")[0];return n===e&&(n="default"),t[n]}var lee={},cee=L5.parse("#000000"),uee=L5.parse("#FFFFFF"),hee=L5.parse("#000000"),dee=["raster-saturation","raster-contrast","raster-brightness-max","raster-brightness-min","raster-hue-rotate"],pee=["background","circle","fill","fill-extrusion","line","symbol","raster","hillshade"];function fee(e,t=512){return e.getExtent()?x7({extent:e.getExtent(),tileSize:t,maxZoom:22}).getResolutions():T9}function gee(e,t){return t.accessToken||(t=Object.assign({},t),new URL(e).searchParams.forEach((e,n)=>{t.accessToken=e,t.accessTokenParam=n})),t}var mee=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function yee(e,t){if(!t.ref)return t;const n=e.find(e=>e.id===t.ref);if(!n)return t;const r=Object.assign({},t);for(const i of mee)!(i in r)&&i in n&&(r[i]=n[i]);return r}function vee(e,t,n){const r=new F7({tileJSON:t,tileSize:e.tileSize||t.tileSize||512}),i=r.getTileJSON(),s=r.getTileGrid(),o=iZ(n.projection||"EPSG:3857"),a=function(e,t){const n=e.bounds;if(n){const e=lZ([n[0],n[1]],t),r=lZ([n[2],n[3]],t);return[e[0],e[1],r[0],r[1]]}return iZ(t).getExtent()}(i,o),l=o.getExtent(),c=i.minzoom||0,u=i.maxzoom||22,h={attributions:r.getAttributions(),projection:o,tileGrid:new w7({origin:l?qG(l):s.getOrigin(0),extent:a||s.getExtent(),minZoom:c,resolutions:fee(o,t.tileSize).slice(0,u+1),tileSize:s.getTileSize(0)})};return Array.isArray(i.tiles)?h.urls=i.tiles:h.url=i.tiles,h}function bee(e,t,n){return new Promise(function(r,i){F9(e,t,n).then(function({tileJson:t,tileLoadFunction:i}){const s=vee(e,t,n);s.tileLoadFunction=i,s.format=new D8({layerName:"mvt:layer"});const o=new U7(s);o.set("mapbox-source",e),r(o)}).catch(i)})}function wee(e){return`{bbox-${(e?e.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function _ee(e,t,n){const r=new f7;return function(e,t,n){return new Promise(function(r,i){F9(e,t,n).then(function({tileJson:t,tileLoadFunction:i}){const s=new F7({interpolate:void 0===n.interpolate||n.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:t});s.tileGrid=vee(e,t,n).tileGrid,n.projection&&(s.projection=iZ(n.projection));const o=s.getTileUrlFunction();i&&s.setTileLoadFunction(i),s.setTileUrlFunction(function(e,t,n){const r=wee(n);let i=o(e,t,n);if(-1!=i.indexOf(r)){const t=s.getTileGrid().getTileCoordExtent(e);i=i.replace(r,t.toString())}return i}),s.set("mapbox-source",e),r(s)}).catch(function(e){i(e)})})}(e,t,n).then(function(e){r.setSource(e)}).catch(function(){r.setSource(void 0)}),r}function xee(e,t,n){const r=n.projection?new f3({dataProjection:n.projection}):new f3,i=e.data,s={};if("string"==typeof i){const[s]=X7(i,n.accessToken,n.accessTokenParam||"access_token",t||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(s)){const t=(e,t,n)=>{const r=wee(n);return s.replace(r,`${e.join(",")}`)},i=new i3({attributions:e.attribution,format:r,loader:(e,r,s,o,a)=>{A9("GeoJSON","function"==typeof t?t(e,r,s):t,n).then(e=>{const t=i.getFormat().readFeatures(e,{featureProjection:s});i.addFeatures(t),o(t)}).catch(()=>{i.removeLoadedExtent(e),a()})},strategy:Z2});return i.set("mapbox-source",e),i}const o=new i3({attributions:e.attribution,format:r,url:s,loader:(e,t,r,i,a)=>{A9("GeoJSON",s,n).then(e=>{const t=o.getFormat().readFeatures(e,{featureProjection:r});o.addFeatures(t),i(t)}).catch(()=>{o.removeLoadedExtent(e),a()})}});return o}s.features=r.readFeatures(i,{featureProjection:"EPSG:3857"});const o=new i3(Object.assign({attributions:e.attribution,format:r},s));return o.set("mapbox-source",e),o}function Cee(e,t,n,r){n=yee(e.layers,n);const i=E9(e),s=n.type;let o=n.source;const a=e.sources[o];let l;var c;return"background"==s?(l=function(e,t,n){const r=zH?{style:{}}:document.createElement("div");return r.className="ol-mapbox-style-background",r.style.position="absolute",r.style.width="100%",r.style.height="100%",new QX({source:new Q2({}),render(i){const s=function(e,t,n,r){const i={id:e.id,type:e.type},s=e.paint||{};let o;i.paint=s,W7.zoom=I9(t,n.resolutions||T9),W7.distanceFromCenter=0;const a=tee(i,"paint","background-color",_9,r);return void 0!==s["background-opacity"]&&(o=tee(i,"paint","background-opacity",_9,r)),"none"===tee(i,"layout","visibility",_9,r)?void 0:iee(a,o)}(e,i.viewState.resolution,t,n);return r.style.backgroundColor=s,r}})}(n,r,i),o=void 0):"vector"==a.type?l=function(e,t,n){const r=new v7({declutter:!0,visible:!1});return bee(e,t,n).then(function(e){r.setSource(e)}).catch(function(){r.setSource(void 0)}),r}(a,t,r):"raster"==a.type?(Object.keys(n.paint||{}).find(e=>dee.includes(e))?(c=_ee(a,t,r),l=new e9({source:new u9({operationType:"image",operation:g9,sources:[c]})}),function(e,t,n,r){e.getSource().on("beforeoperations",function(e){W7.zoom=I9(e.resolution,n.resolutions||T9),W7.distanceFromCenter=0;const i=e.data;i.saturation=tee(t,"paint","raster-saturation",_9,r),i.contrast=tee(t,"paint","raster-contrast",_9,r),i.brightnessHigh=tee(t,"paint","raster-brightness-max",_9,r),i.brightnessLow=tee(t,"paint","raster-brightness-min",_9,r),i.hueRotate=tee(t,"paint","raster-hue-rotate",_9,r)})}(l,n,r,i)):l=_ee(a,t,r),l.setVisible(!n.layout||"none"!==tee(n,"layout","visibility",_9,i)),l.on("prerender",function(e,t,n){let r=null;return function(i){e.paint&&"raster-opacity"in e.paint&&i.frameState.viewState.zoom!==r&&(r=i.frameState.viewState.zoom,delete n[e.id],function(e,t,n,r){W7.zoom=n,W7.distanceFromCenter=0;const i=tee(e,"paint","raster-opacity",_9,r);t.setOpacity(i)}(e,t,r,n))}}(n,l,i))):"geojson"==a.type?l=function(e,t,n){return new W2({declutter:!0,source:xee(e,t,n),visible:!1})}(a,t,r):"raster-dem"==a.type&&"hillshade"==n.type&&(l=function(e){return new e9({source:new u9({operationType:"image",operation:f9,sources:[e]})})}(_ee(a,t,r)),function(e,t,n,r,i){e.getSource().on("beforeoperations",function(e){const s=e.data;s.resolution=sZ(r.projection||"EPSG:3857",e.resolution,FG(e.extent),"m");const o=I9(e.resolution,r.resolutions||T9);W7.zoom=o,W7.distanceFromCenter=0,s.zoom=o,s.encoding=t.encoding,s.method=tee(n,"paint","hillshade-method",_9,i)||"standard",s.exaggeration=tee(n,"paint","hillshade-exaggeration",_9,i);let a=tee(n,"paint","hillshade-illumination-direction",_9,i);null==a&&(a=335),s.azimuths=Array.isArray(a)?a:[a],s.sunAz=s.azimuths[0];let l=tee(n,"paint","hillshade-illumination-altitude",_9,i);function c(e){return e&&e.values?e.values[0]:e}function u(e){const t=n.paint?.[e];if(Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&void 0!==L5.parse(t[0]))return t.map(e=>L5.parse(e));let r=tee(n,"paint",e,_9,i);return r=c(r),r?[r]:void 0}null==l&&(l=45),s.altitudes=Array.isArray(l)?l:[l],s.highlightColors=u("hillshade-highlight-color"),s.highlightColor=s.highlightColors?.[0]||uee,s.highlightColors||(s.highlightColors=[s.highlightColor]),s.shadowColors=u("hillshade-shadow-color"),s.shadowColor=s.shadowColors?.[0]||cee,s.shadowColors||(s.shadowColors=[s.shadowColor]),s.accentColor=c(tee(n,"paint","hillshade-accent-color",_9,i))||hee})}(l,a,n,r,i),l.setVisible(!n.layout||"none"!==tee(n,"layout","visibility",_9,i))),l&&l.set("mapbox-source",o),l}function See(e,t,n,r){e.schema&&Object.assign(V7,Object.keys(e.schema).reduce((t,n)=>(t[n]=e.schema[n]?.default,t),{}));const i=[];let s=null;if(t instanceof T1){if(s=t.getView(),!s.isDef()&&!s.getRotation()&&!s.getResolutions()){const e=r.projection?iZ(r.projection):s.getProjection();s=new TY(Object.assign(s.getProperties(),{maxResolution:T9[0]/lK[e.getUnits()],projection:r.projection||s.getProjection()})),t.setView(s)}"center"in e&&!s.getCenter()&&s.setCenter(lZ(e.center,s.getProjection())),"zoom"in e&&void 0===s.getZoom()&&s.setResolution(T9[0]/lK[s.getProjection().getUnits()]/Math.pow(2,e.zoom)),s.getCenter()&&void 0!==s.getZoom()||s.fit(s.getProjection().getExtent(),{nearest:!0,size:t.getSize()})}t.set("mapbox-style",e),t.set("mapbox-metadata",{styleUrl:n,options:r});const o=e.layers;let a,l,c,u=[];for(let h=0,d=o.length;h<d;++h){const s=yee(o,o[h]),d=s.type;pee.includes(d)?(c=s.source,c&&c==l||(u.length&&(i.push(kee(a,u,e,n,t,r)),u=[]),a=Cee(e,n,s,r),a instanceof W2||a instanceof v7||(u=[]),l=a.get("mapbox-source")),u.push(s.id)):console.warn(`layers[${h}].type "${d}" not supported`)}return i.push(kee(a,u,e,n,t,r)),Promise.all(i)}function kee(e,t,n,r,i,s={}){let o=24,a=0;const l=n.layers;for(let c=0,u=l.length;c<u;++c){const e=l[c];-1!==t.indexOf(e.id)&&(o=Math.min("minzoom"in e?e.minzoom:0,o),a=Math.max("maxzoom"in e?e.maxzoom:24,a))}return new Promise(function(l,c){const u=function(){const u=e.getSource();if(u&&"error"!==u.getState()){if("getTileGrid"in u){const t=u.getTileGrid();if(t){const n=t.getMinZoom();(o>0||n>0)&&e.setMaxResolution(Math.min(P9(Math.max(0,o-1e-12),T9),P9(Math.max(0,n-1e-12),t.getResolutions()))),a<24&&e.setMinResolution(P9(a,T9))}}else o>0&&e.setMaxResolution(P9(Math.max(0,o-1e-12),T9));u instanceof i3||u instanceof U7?function(e,t,n="",r={},i){let s,o,a,l,c=!0;return"string"==typeof n||Array.isArray(n)?l=n:(a=n,l=a.source||a.layers,r=a),"string"==typeof r?(s=r,a={}):(s=r.styleUrl,a=r),!1===a.updateSource&&(c=!1),i||(i=a.resolutions),s||"string"!=typeof t||t.trim().startsWith("{")||(s=t),s&&(s=s.startsWith("data:")?location.href:Z7(s,a.accessToken),a=gee(s,a)),new Promise(function(n,r){O9(t,a).then(function(t){if(8!=t.version)return r(new Error("glStyle version 8 required."));if(!(e instanceof W2||e instanceof v7))return r(new Error("Can only apply to VectorLayer or VectorTileLayer"));const u=e instanceof v7?"vector":"geojson";if(l?o=Array.isArray(l)?t.layers.find(function(e){return e.id===l[0]}).source:l:(o=t.layers.find(function(e){return e.source&&t.sources[e.source].type===u}).source,l=o),!o)return r(new Error(`No ${u} source found in the glStyle.`));function h(){if(!c)return Promise.resolve();if(e instanceof v7)return bee(t.sources[o],s,a).then(function(t){const n=e.getSource();n?t!==n&&(n.setTileUrlFunction(t.getTileUrlFunction()),"function"==typeof n.setUrls&&"function"==typeof t.getUrls&&n.setUrls(t.getUrls()),n.format_||(n.format_=t.format_),n.getAttributions()||n.setAttributions(t.getAttributions()),n.getTileLoadFunction()===B7&&n.setTileLoadFunction(t.getTileLoadFunction()),uZ(n.getProjection(),t.getProjection())&&(n.tileGrid=t.getTileGrid())):e.setSource(t);const r=e.getSource().getTileGrid();!isFinite(e.getMaxResolution())&&!isFinite(e.getMinZoom())&&r.getMinZoom()>0&&e.setMaxResolution(P9(Math.max(0,r.getMinZoom()-1e-12),r.getResolutions()))});const n=t.sources[o];let r=e.getSource();r&&r.get("mapbox-source")===n||(r=xee(n,s,a));const i=e.getSource();return i?r!==i&&(i.getAttributions()||i.setAttributions(r.getAttributions()),i.format_||(i.format_=r.getFormat()),i.url_=r.getUrl()):e.setSource(r),Promise.resolve()}let d,p;const f={},g={};function m(){if(p||t.sprite&&!f)p?(e.setStyle(p),h().then(n).catch(r)):r(new Error("Something went wrong trying to apply style."));else{if(a.projection&&!i){const e=iZ(a.projection).getUnits();"m"!==e&&(i=T9.map(t=>t/lK[e]))}let s;const c=e.getSource();c instanceof U7&&c.format_ instanceof D8&&(s=c.format_.layerName_),p=function(e,t,n,r=T9,i,s,o,a){if("string"==typeof t&&(t=JSON.parse(t)),t.schema)for(const b in t.schema){const e=t.schema[b];"default"in e&&(V7[b]=e.default)}if(8!=t.version)throw new Error("glStyle version 8 required.");lee[function(e,t){return k9(e)+"."+kH(t)}(t,e)]=Array.from(arguments);const l={};("string"==typeof s||s instanceof Request||s instanceof Response||s instanceof Promise)&&(s={default:s});for(const b in s){const t=s[b];bH(()=>t).then(async t=>{let n;if("undefined"!=typeof Image){const r=new Image;if("string"==typeof t)r.crossOrigin="anonymous",r.src=t;else{let e;t instanceof Request?e=await fetch(t):t instanceof Response&&(e=t);const i=await e.blob();n=URL.createObjectURL(i),r.src=n}r.addEventListener("load",function t(){r.removeEventListener("load",t),l[b]={image:r,size:[r.width,r.height]},e.changed(),n&&URL.revokeObjectURL(n)}),r.addEventListener("error",function e(){URL.revokeObjectURL(n),r.removeEventListener("error",e)})}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const e=self;e.postMessage({action:"loadImage",src:t}),e.addEventListener("message",function(e){"imageLoaded"===e.data.action&&e.data.src===t&&(l[b]={image:e.data.image,size:[e.data.image.width,e.data.image.height]})})}})}const c=M3(t.layers),u={},h=[],d={},p={},f=E9(t),g=function(e){let t=C9[e.id];return t||(t={},C9[k9(e)]=t),t}(t);let m;for(let b=0,w=c.length;b<w;++b){const e=c[b],r=e.id;if("string"==typeof n&&e.source==n||Array.isArray(n)&&-1!==n.indexOf(r)){const n=e["source-layer"];if(m){if(e.source!==m)throw new Error(`Layer "${r}" does not use source "${m}`)}else{m=e.source;const n=t.sources[m];if(!n)throw new Error(`Source "${m}" is not defined`);const r=n.type;if("vector"!==r&&"geojson"!==r)throw new Error(`Source "${m}" is not of type "vector" or "geojson", but "${r}"`)}let i=u[n];i||(i=[],u[n]=i),i.push({layer:e,index:b}),h.push(r)}}const y=[],v=function(n,s,c){const h=e.getSource?.()?.format_?.layerName_??"mvt:layer",m=n.getProperties(),v=u[m[h]];if(!v)return;let b=r.indexOf(s);-1==b&&(b=I9(s,r)),W7.zoom=b,W7.distanceFromCenter=0;const w=n.getGeometry(),_=J9[w.getType()],x=e.get("map");if(x&&x instanceof T1&&1===_){const e=x.getSize();if(e){const t=x.getView().getCenter(),n=FG(w.getExtent());W7.distanceFromCenter=(C=t,S=n,Math.sqrt(function(e,t){const n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}(C,S))/s/e[1])}}var C,S;const k={id:n.getId(),properties:m,type:_},E=e.get("mapbox-featurestate")[n.getId()];let R,T=-1;for(let r=0,u=v.length;r<u;++r){const u=v[r],h=u.layer,w=h.id;if(void 0!==c&&c!==w)continue;const x=h.layout||_9,C=h.paint||_9;if("none"===tee(h,"layout","visibility",k,f,E)||"minzoom"in h&&b<h.minzoom||"maxzoom"in h&&b>=h.maxzoom)continue;const S=h.filter;if(!S||ree(w,S,k,g)){let r,c,g,v,b,w;R=h;const S=u.index;if(3==_&&("fill"==h.type||"fill-extrusion"==h.type))if(c=tee(h,"paint",h.type+"-opacity",k,f,E),h.type+"-pattern"in C){const e=tee(h,"paint",h.type+"-pattern",k,f,E);if(e){const t="string"==typeof e?oee(e,m):e.toString(),n=aee(t,l);if(i&&i[t]&&n){++T,w=y[T],w&&w.getFill()&&!w.getStroke()&&!w.getText()||(w=new W0({fill:new B0}),y[T]=w),g=w.getFill(),w.setZIndex(S);const e=t+"."+c;let r=p[e];if(!r){const s=i[t],o=L9(s.width,s.height),a=o.getContext("2d");a.globalAlpha=c,a.drawImage(n.image,s.x,s.y,s.width,s.height,0,0,s.width,s.height),r=a.createPattern(o,"repeat"),p[e]=r}g.setColor(r)}}}else if(r=iee(tee(h,"paint",h.type+"-color",k,f,E),c),h.type+"-outline-color"in C&&(b=iee(tee(h,"paint",h.type+"-outline-color",k,f,E),c)),b||(b=r),r||b){if(++T,w=y[T],(!w||r&&!w.getFill()||!r&&w.getFill()||b&&!w.getStroke()||!b&&w.getStroke()||w.getText())&&(w=new W0({fill:r?new B0:void 0,stroke:b?new V0:void 0}),y[T]=w),r&&(g=w.getFill(),g.setColor(r)),"fill-extrusion"===h.type){const e=tee(h,"paint","fill-extrusion-height",k,f,E);if(e>0){const t=Math.max(.1,.9-Math.min(e,225)/280);if(b&&"transparent"!==b){const e=L5.parse(b);b=`rgba(${Math.round(255*e.r*t)},${Math.round(255*e.g*t)},${Math.round(255*e.b*t)},${e.a})`}}}b&&(v=w.getStroke(),v.setColor(b),v.setWidth(.5)),w.setZIndex(S)}if(1!=_&&"line"==h.type){r="line-pattern"in C?void 0:iee(tee(h,"paint","line-color",k,f,E),tee(h,"paint","line-opacity",k,f,E));const e=tee(h,"paint","line-width",k,f,E);r&&e>0&&(++T,w=y[T],w&&w.getStroke()&&!w.getFill()&&!w.getText()||(w=new W0({stroke:new V0}),y[T]=w),v=w.getStroke(),v.setLineCap(tee(h,"layout","line-cap",k,f,E)),v.setLineJoin(tee(h,"layout","line-join",k,f,E)),v.setMiterLimit(tee(h,"layout","line-miter-limit",k,f,E)),v.setColor(r),v.setWidth(e),v.setLineDash(C["line-dasharray"]?tee(h,"paint","line-dasharray",k,f,E).map(function(t){return t*e}):null),"function"==typeof v.setOffset&&v.setOffset(tee(h,"paint","line-offset",k,f,E)),w.setZIndex(S))}let L,I,P,M,A,O,N,F,D,z=!1,j=null,U=0;if((1==_||2==_)&&"icon-image"in x){const t=tee(h,"layout","icon-image",k,f,E);if(t){let r;L="string"==typeof t?oee(t,m):t.toString();const o=a?a(e,L):void 0,c=aee(L,l);if(i&&i[L]&&c||o){const e=tee(h,"layout","icon-rotation-alignment",k,f,E);if(2==_){const t=n.getGeometry();if(t.getFlatMidpoint||t.getFlatMidpoints){const n=t.getExtent();if(Math.sqrt(Math.max(Math.pow((n[2]-n[0])/s,2),Math.pow((n[3]-n[1])/s,2)))>150){const n="MultiLineString"===t.getType()?t.getFlatMidpoints():t.getFlatMidpoint();if(Z9||(Z9=new X2("Point",K9=[NaN,NaN],[],2,{},void 0)),r=Z9,K9[0]=n[0],K9[1]=n[1],"line"===tee(h,"layout","symbol-placement",k,f,E)&&"map"===e){const e=t.getStride(),r=t.getFlatCoordinates();for(let t=0,i=r.length-e;t<i;t+=e){const i=r[t],s=r[t+1],o=r[t+e],a=r[t+e+1],l=Math.min(i,o),c=Math.max(i,o),u=n[0],h=(a-s)*(u-i)-(o-i)*(n[1]-s);if(Math.abs(h)<.001&&u<=c&&u>=l){U=Math.atan2(s-a,o-i);break}}}}}}if(2!==_||r){const t=tee(h,"layout","icon-size",k,f,E),n=void 0!==C["icon-color"]?tee(h,"paint","icon-color",k,f,E):null;if(!n||0!==n.a){const r=tee(h,"paint","icon-halo-color",k,f,E),s=tee(h,"paint","icon-halo-width",k,f,E);let a=`${L}.${t}.${s}.${r}`;if(null!==n&&(a+=`.${n}`),I=d[a],!I){const l=nee(h,k,"icon",f);let u;"icon-offset"in x&&(u=tee(h,"layout","icon-offset",k,f,E).slice(0),u[0]*=t,u[1]*=-t);let p=n?[255*n.r,255*n.g,255*n.b,n.a]:void 0;if(o){const n={color:p,rotateWithView:"map"===e,displacement:u,declutterMode:l,scale:t};"string"==typeof o?n.src=o:(n.img=o,n.imgSize=[o.width,o.height]),I=new q0(n)}else{const o=i[L];let a,h,d;s?o.sdf?(a=D9(j9(c.image,o,n||[0,0,0,1]),{x:0,y:0,width:o.width,height:o.height,pixelRatio:o.pixelRatio},s,r),p=void 0):a=D9(c.image,o,s,r):(o.sdf&&(c.unSDFed||(c.image=j9(c.image,{x:0,y:0,width:c.size[0],height:c.size[1]},{r:1,g:1,b:1,a:1}),c.unSDFed=!0)),a=c.image,h=[o.width,o.height],d=[o.x,o.y]),I=new q0({color:p,img:a,imgSize:c.size,size:h,offset:d,rotateWithView:"map"===e,scale:t/o.pixelRatio,displacement:u,declutterMode:l})}d[a]=I}}I&&(++T,w=y[T],w&&w.getImage()&&!w.getFill()&&!w.getStroke()||(w=new W0,y[T]=w),w.setGeometry(r),I.setRotation(U+R9(tee(h,"layout","icon-rotate",k,f,E))),I.setOpacity(tee(h,"paint","icon-opacity",k,f,E)),I.setAnchor(Q9[tee(h,"layout","icon-anchor",k,f,E)]),w.setImage(I),j=w.getText(),w.setText(void 0),w.setZIndex(S),z=!0,P=!1)}else P=!0}}}if(1==_&&"circle"===h.type){++T,w=y[T],w&&w.getImage()&&!w.getFill()&&!w.getStroke()||(w=new W0,y[T]=w);const e="circle-radius"in C?tee(h,"paint","circle-radius",k,f,E):5,t=iee(tee(h,"paint","circle-stroke-color",k,f,E),tee(h,"paint","circle-stroke-opacity",k,f,E)),n=tee(h,"paint","circle-translate",k,f,E),r=iee(tee(h,"paint","circle-color",k,f,E),tee(h,"paint","circle-opacity",k,f,E)),i=tee(h,"paint","circle-stroke-width",k,f,E),s=e+"."+t+"."+r+"."+i+"."+n[0]+"."+n[1];I=d[s],I||(I=new U0({radius:e,displacement:[n[0],-n[1]],stroke:t&&i>0?new V0({width:i,color:t}):void 0,fill:r?new B0({color:r}):void 0,declutterMode:"none"}),d[s]=I),w.setImage(I),j=w.getText(),w.setText(void 0),w.setGeometry(void 0),w.setZIndex(S),z=!0}if("text-field"in x){N=Math.round(tee(h,"layout","text-size",k,f,E));const e=tee(h,"layout","text-font",k,f,E);O=tee(h,"layout","text-line-height",k,f,E),A=w9(o?o(e,t.metadata?t.metadata["ol:webfonts"]:void 0):e,N,O),A.includes("sans-serif")||(A+=",sans-serif"),F=tee(h,"layout","text-letter-spacing",k,f,E),D=tee(h,"layout","text-max-width",k,f,E);const n=tee(h,"layout","text-field",k,f,E);M="object"==typeof n&&n.sections?1===n.sections.length?n.toString():n.sections.reduce((t,n)=>{const r=n.fontStack?n.fontStack.split(","):e,i=w9(o?o(r):r,N*(n.scale||1),O);let s=n.text;if("\n"===s)return t.push("\n",""),t;if(2==_)return t.push($9(s,F),i),t;s=G9(s,i,D,F).split("\n");for(let e=0,o=s.length;e<o;++e)e>0&&t.push("\n",""),t.push(s[e],i);return t},[]):oee(n,m).trim(),c=tee(h,"paint","text-opacity",k,f,E)}if(M&&c&&!P){z||(++T,w=y[T],w&&w.getText()&&!w.getFill()&&!w.getStroke()||(w=new W0,y[T]=w),w.setImage(void 0),w.setGeometry(void 0));const e=nee(h,k,"text",f);w.getText()||w.setText(j),j=w.getText(),(!j||"getDeclutterMode"in j&&j.getDeclutterMode()!==e)&&(j=new Z0({padding:[2,2,2,2],declutterMode:e}),w.setText(j));const t=tee(h,"layout","text-transform",k,f,E);"uppercase"==t?M=Array.isArray(M)?M.map((e,t)=>t%2?e:e.toUpperCase()):M.toUpperCase():"lowercase"==t&&(M=Array.isArray(M)?M.map((e,t)=>t%2?e:e.toLowerCase()):M.toLowerCase());const n=Array.isArray(M)?M:2==_?$9(M,F):G9(M,A,D,F);if(j.setText(n),j.setFont(A),j.setRotation(R9(tee(h,"layout","text-rotate",k,f,E))),"function"==typeof j.setKeepUpright){const e=tee(h,"layout","text-keep-upright",k,f,E);j.setKeepUpright(e)}const r=tee(h,"layout","text-anchor",k,f,E),i=z||1==_?"point":tee(h,"layout","symbol-placement",k,f,E);let s;if("line-center"===i?(j.setPlacement("line"),s="center"):j.setPlacement(i),"line"===i&&"function"==typeof j.setRepeat){const e=tee(h,"layout","symbol-spacing",k,f,E);j.setRepeat(2*e)}j.setOverflow("point"===i);let o=tee(h,"paint","text-halo-width",k,f,E);const a=tee(h,"layout","text-offset",k,f,E),l=tee(h,"paint","text-translate",k,f,E);let u=0,d=0;if("point"==i){s="center",-1!==r.indexOf("left")?(s="left",d=o):-1!==r.indexOf("right")&&(s="right",d=-o);const e=tee(h,"layout","text-rotation-alignment",k,f,E);j.setRotateWithView("map"==e)}else j.setMaxAngle(R9(tee(h,"layout","text-max-angle",k,f,E))*M.length/n.length),j.setRotateWithView(!1);j.setTextAlign(s);let p="middle";0==r.indexOf("bottom")?(p="bottom",u=-o-.5*(O-1)*N):0==r.indexOf("top")&&(p="top",u=o+.5*(O-1)*N),j.setTextBaseline(p);const g=tee(h,"layout","text-justify",k,f,E);j.setJustify("auto"===g?void 0:g),j.setOffsetX(a[0]*N+d+l[0]),j.setOffsetY(a[1]*N+u+l[1]);const m=j.getFill()||new B0;m.setColor(iee(tee(h,"paint","text-color",k,f,E),c)),j.setFill(m);const v=iee(tee(h,"paint","text-halo-color",k,f,E),c);if(v&&o>0){const e=j.getStroke()||new V0;e.setColor(v),o*=2;const t=.5*N;e.setWidth(o<=t?o:t),j.setStroke(e)}else j.setStroke(void 0);const b=tee(h,"layout","text-padding",k,f,E),x=j.getPadding();b!==x[0]&&(x[0]=b,x[1]=b,x[2]=b,x[3]=b),w.setZIndex(S)}}}return T>-1?(y.length=T+1,y):void 0};return e.setStyle(v),e.set("mapbox-layers",h),e.set("mapbox-source",m),e.set("mapbox-featurestate",e.get("mapbox-featurestate")||{}),v}(e,t,l,i,f,g,(e,t=a.webfonts)=>function(e,t="https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css"){if(zH)return e;let n;for(let r=0,i=e.length;r<i;++r){const t=e[r];if(t in X9)continue;X9[t]=!0;const i=w9(t,16).split(" ");n||(n=[]),n.push([i.slice(3).join(" ").replace(/"/g,""),i[1],i[0]])}return n?((async()=>{await document.fonts.ready;for(let e=0,r=n.length;e<r;++e){const r=n[e],i=r[0];if(Y9.includes(i))continue;const s=r[1],o=r[2];if(!(await document.fonts.load(`${o} ${s} 16px "${i}"`)).some(e=>e.family.replace(/^['"]|['"]$/g,"").toLowerCase()===i.toLowerCase()&&V9(e.weight,s)&&e.style===o)){const e=t.replace("{font-family}",i.replace(/ /g,"-").toLowerCase()).replace("{Font+Family}",i.replace(/ /g,"+")).replace("{fontweight}",s).replace("{-fontstyle}",o.replace("normal","").replace(/(.+)/,"-$1")).replace("{fontstyle}",o);if(!document.querySelector('link[href="'+e+'"]')){const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)}}}})(),e):e}(e,t),a.getImage,s),e.getStyle()?h().then(n).catch(r):r(new Error(`Nothing to show for source [${o}]`))}}if(t.sprite){const e=function(e,t,n){if("string"==typeof e)return[{id:"default",url:K7(e,t,n)}];for(const r of e)r.url=K7(r.url,t,n);return e}(t.sprite,a.accessToken,s||location.href);d=zH?1:window.devicePixelRatio>=1.5?.5:1;const n=.5==d?"@2x":"";Promise.all(e.map(function(e){const t=new URL(e.url);let i=t.origin+t.pathname+n+".json"+t.search;return new Promise(function(e,n){A9("Sprite",i,a).then(e).catch(function(){i=t.origin+t.pathname+".json"+t.search,A9("Sprite",i,a).then(e).catch(n)})}).then(function(i){let s;if(void 0===i&&r(new Error("No sprites found.")),s=t.origin+t.pathname+n+".png"+t.search,a.transformRequest){const e=a.transformRequest(s,"SpriteImage")||s;(e instanceof Request||e instanceof Promise)&&(s=e)}g[e.id]=s;for(const t in i){const n="default"==e.id?t:`${e.id}:${t}`;f[n]=i[t]}}).catch(function(e){r(new Error(`Sprites cannot be loaded: ${i}: ${e.message}`))})})).then(m).catch(r)}else m()}).catch(r)})}(e,n,t,Object.assign({styleUrl:r},s)).then(function(){!function(e,t,n){function r(){const r=t.get("mapbox-style");if(!r)return;const i=M3(r.layers),s=e.get("mapbox-layers"),o=i.filter(function(e){return s.includes(e.id)}).some(function(e){return!e.layout||"visible"===tee(e,"layout","visibility",_9,n)});e.get("visible")!==o&&e.setVisible(o)}e.on("change",r),r()}(e,i,E9(n)),l()}).catch(c):l()}else c(new Error("Error accessing data for source "+e.get("mapbox-source")))};e.set("mapbox-layers",t);const h=i.getLayers();-1===h.getArray().indexOf(e)&&h.push(e),e.getSource()?u():e.once("change:source",u)})}var Eee=class extends I${static{dF(this.prototype,"osm",[dp])}#B=void fF(this,"osm");static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");static{dF(this.prototype,"settings",[dp])}#D=void fF(this,"settings");static{dF(this.prototype,"nostrData",[dp])}#F=void fF(this,"nostrData");mapInstance;bookmarkSource;searchResultsSource;selectedShapeSource;searchOverlay;searchOverlayElement;selectedPinOverlay;selectedPinElement;crosshairElement;crosshairOverlay;ignoreNextMapClick=!1;setupMap=cq(e=>{if(this.mapInstance)return;const t=new KX;this.selectedShapeSource=new i3;const n=new W2({source:this.selectedShapeSource,style:new W0({stroke:new V0({color:"#3388ff",width:4}),fill:new B0({color:"rgba(51, 136, 255, 0.1)"})}),zIndex:5});this.bookmarkSource=new i3;const r=new W2({source:this.bookmarkSource,style:e=>{const t=e.get("originalPlace");let n=getComputedStyle(document.documentElement).getPropertyValue("--default-list-color").trim()||"#000000";if(t&&t._listIds&&t._listIds.length>0){const e=t._listIds[0],r=this.storage.lists.find(t=>t.id===e);r&&r.color&&(n=r.color)}return[new W0({image:new U0({radius:10,fill:new B0({color:"rgba(0, 0, 0, 0.2)"}),displacement:[0,-2]})}),new W0({image:new U0({radius:9,fill:new B0({color:n}),stroke:new V0({color:"#fff",width:2})})})]},zIndex:10});this.searchResultsSource=new i3;const i=new Map,s=new W2({source:this.searchResultsSource,style:e=>{const t=e.get("originalPlace"),n=this.mapUi.selectedPlace;if(n){const e=t.osmId&&n.osmId&&t.osmId===n.osmId,r=t.id&&n.id&&t.id===n.id,i=t.lat===n.lat&&t.lon===n.lon;if(e||r||i)return new W0({})}const r=kB(t.osmTags||t),s=r||"default";if(!i.has(s)){const e=getComputedStyle(document.documentElement).getPropertyValue("--marker-color-primary").trim()||"#ea4335";let t=`<circle cx="12" cy="12" r="8" fill="${e}"/>`;if(r){const n=_B(r);if(n){let r=n.trim();const i=r.indexOf("<svg"),s=r.indexOf(">",i)+1,o=r.lastIndexOf("</svg>");-1!==i&&-1!==o&&(r=r.substring(s,o)),t=`\n <circle cx="12" cy="12" r="8" fill="${e}"/>\n <g transform="translate(6, 6) scale(0.8)" fill="white">\n ${r}\n </g>\n `}}const n=`\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="-4 -4 32 40" width="40" height="50">\n <defs>\n <filter id="shadow" x="-50%" y="-50%" width="200%" height="200%">\n <feDropShadow dx="0" dy="2" stdDeviation="1.5" flood-color="black" flood-opacity="0.3"/>\n </filter>\n </defs>\n <path d="M12 2C6.5 2 2 6.5 2 12C2 17.5 12 24 12 24C12 24 22 17.5 22 12C22 6.5 17.5 2 12 2Z" fill="white" filter="url(#shadow)"/>\n ${t}\n </svg>\n `;i.set(s,"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(n.trim()))}return new W0({image:new q0({src:i.get(s),anchor:[.5,.65],scale:1})})},zIndex:11});let o=[14.21683569,27.060114248],a=2.661,l=!1;try{const e=localStorage.getItem("marco:map-view");if(e){const t=JSON.parse(e);t.center&&Array.isArray(t.center)&&2===t.center.length&&"number"==typeof t.zoom&&(o=t.center,a=t.zoom,l=!0)}}catch(k){console.warn("Failed to restore map view:",k)}const c=new TY({center:lZ(o),zoom:a,projection:"EPSG:3857"});this.mapInstance=new T1({target:e,layers:[t,n,s,r],view:c,controls:eX({zoom:!0,rotate:!0,attribution:!0}),interactions:AX({dragPan:!1})});const u=cZ(c.getCenter());this.mapUi.updateCenter(u[1],u[0]),this.mapUi.updateZoom(c.getZoom()),function(e,t,n={}){let r,i;if(zH){if(!(e instanceof T1||e instanceof KX))throw new Error("ol-mapbox-style in a web worker requires a Map or a LayerGroup as first argument");i=e}else i="string"==typeof e||e instanceof HTMLElement?new T1({target:e}):e;if("string"==typeof t){const e=t.startsWith("data:")?location.href:Z7(t,n.accessToken);n=gee(e,n),r=new Promise(function(r,s){O9(t,n).then(function(t){See(t,i,e,n).then(function(){r(i)}).catch(s)}).catch(function(e){s(new Error(`Could not load ${t}: ${e.message}`))})})}else r=new Promise(function(e,r){See(t,i,!n.styleUrl||n.styleUrl.startsWith("data:")?location.href:Z7(n.styleUrl,n.accessToken),n).then(function(){e(i)}).catch(r)})}(this.mapInstance,"https://tiles.openfreemap.org/styles/liberty",{webfonts:"data:text/css,"}),this.searchOverlayElement=document.createElement("div"),this.searchOverlayElement.className="search-pulse",this.searchOverlay=new O1({element:this.searchOverlayElement,positioning:"center-center",stopEvent:!1}),this.mapInstance.addOverlay(this.searchOverlay),this.selectedPinElement=document.createElement("div"),this.selectedPinElement.className="selected-pin-container";const h=document.createElement("div");h.className="selected-pin",h.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"></path><circle cx="12" cy="10" r="3" style="fill: var(--marker-color-dark); stroke: none;"></circle></svg>';const d=document.createElement("div");d.className="selected-pin-shadow",this.selectedPinElement.appendChild(h),this.selectedPinElement.appendChild(d),this.selectedPinOverlay=new O1({element:this.selectedPinElement,positioning:"bottom-center",stopEvent:!1}),this.mapInstance.addOverlay(this.selectedPinOverlay),this.crosshairElement=document.createElement("div"),this.crosshairElement.className="map-crosshair",this.crosshairElement.innerHTML='\n <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <line x1="12" y1="5" x2="12" y2="19"></line>\n <line x1="5" y1="12" x2="19" y2="12"></line>\n </svg>\n ',e.appendChild(this.crosshairElement),this.locationOverlayElement=document.createElement("div"),this.locationOverlayElement.className="search-pulse blue",this.locationOverlay=new O1({element:this.locationOverlayElement,positioning:"center-center",stopEvent:!1}),this.mapInstance.addOverlay(this.locationOverlay),e.addEventListener("pointerdown",()=>{this.mapUi.searchBoxHasFocus&&(this.ignoreNextMapClick=!0)},!0);const p=new T3({trackingOptions:{enableHighAccuracy:!0},projection:c.getProjection()}),f=new N1;f.setStyle(new W0({image:new U0({radius:6,fill:new B0({color:"#3399CC"}),stroke:new V0({color:"#fff",width:2})})}));const g=new i3({features:[f]}),m=new W2({source:g,zIndex:15});p.on("change:position",function(){const e=p.getPosition();f.setGeometry(e?new hY(e):null)});const y=document.createElement("div");y.className="ol-control ol-locate";const v=document.createElement("button");let b,w;v.style.display="flex",v.style.alignItems="center",v.style.justifyContent="center",v.innerHTML=`<span class="icon" style="width: 14px; height: 14px; display: flex;">${_B("navigation")}</span>`,v.title="Locate Me",y.appendChild(v);const _=()=>{b&&(clearTimeout(b),b=null);try{w&&(p.un("change:position",x),w=null)}catch{}this.locationOverlayElement&&this.locationOverlayElement.classList.remove("active")},x=()=>{const e=p.getPosition(),t=p.getAccuracyGeometry(),n=p.getAccuracy();if(console.debug("Geolocation change:",{coordinates:e,accuracy:n}),!e)return;const r=this.mapInstance.getSize(),i=this.mapInstance.getView();let s=null;if(this.locationOverlayElement){const t=i.getResolution(),r=2*(n||50)/sZ(i.getProjection(),t,e);this.locationOverlayElement.style.width=`${r}px`,this.locationOverlayElement.style.height=`${r}px`,this.locationOverlay.setPosition(e)}if(n&&n<=20&&_(),t){const e=t.getExtent();s=3.162*i.getResolutionForExtent(e,r)}else n&&(s=6.325*n/Math.min(r[0],r[1])/sZ(i.getProjection(),1,e));let o={center:e,duration:1e3};if(s){const e=i.getResolutionForZoom(17);o.resolution=Math.max(s,e)}else o.zoom=16;this.mapInstance.getView().animate(o)},C=()=>{console.debug("Getting current geolocation..."),_(),p.setTracking(!0);const e=p.getPosition();this.locationOverlayElement&&this.locationOverlayElement.classList.add("active"),e&&x(),w=p.on("change:position",x),b=setTimeout(()=>{_()},1e4)};v.addEventListener("click",C);const S=new YY({element:y});this.mapInstance.addLayer(m),this.mapInstance.addControl(S),l||"index"!==this.router.currentRouteName||C(),this.mapInstance.on("singleclick",this.handleMapClick),this.mapInstance.on("moveend",this.handleMapMove),this.mapInstance.on("pointermove",e=>{const t=this.mapInstance.getEventPixel(e.originalEvent),n=this.mapInstance.hasFeatureAtPixel(t,{hitTolerance:10});this.mapInstance.getTarget().style.cursor=n?"pointer":""}),this.storage.rs.on("ready",()=>{this.handleMapMove()})});updateInteractions=cq(()=>{if(!this.mapInstance)return;this.mapInstance.getInteractions().getArray().slice().forEach(e=>{e instanceof vX&&this.mapInstance.removeInteraction(e)});const e=!!this.settings.mapKinetic&&new tX(-.005,.05,100);this.settings.mapKinetic&&window.innerWidth<=768&&(e.minVelocity_=.25),this.mapInstance.addInteraction(new vX({kinetic:e}))});updateSearchResults=cq(()=>{if(!this.searchResultsSource)return;this.searchResultsSource.clear();const e=this.mapUi.searchResults;if(!e||0===e.length)return;const t=[];e.forEach(e=>{if(e.lat&&e.lon){const n=new N1({geometry:new hY(lZ([e.lon,e.lat])),name:e.title,id:e.id,isSearchResult:!0,originalPlace:e});t.push(n)}}),t.length>0&&this.searchResultsSource.addFeatures(t)});updateSelectedPin=cq(()=>{const e=this.mapUi.selectedPlace,t=this.mapUi.selectionOptions||{};if(this.searchResultsSource&&this.searchResultsSource.changed(),this.selectedPinOverlay&&this.selectedPinElement)if(this.selectedShapeSource&&this.selectedShapeSource.clear(),e&&e.lat&&e.lon){const r=lZ([e.lon,e.lat]);if(this.selectedPinOverlay.setPosition(r),this.selectedPinElement.classList.remove("active"),this.selectedPinElement.offsetWidth,this.selectedPinElement.classList.add("active"),e.geojson&&this.selectedShapeSource)try{const t=(new f3).readFeature(e.geojson,{featureProjection:"EPSG:3857"});this.selectedShapeSource.addFeature(t)}catch(n){console.warn("Failed to render selected place shape:",n)}t.preventZoom?e.bbox&&!this.bboxFitsInView(e.bbox)?this.zoomToBbox(e.bbox):this.handlePinVisibility(r,{maintainZoom:!0}):e.bbox?this.zoomToBbox(e.bbox):this.handlePinVisibility(r)}else this.selectedPinElement.classList.remove("active"),this.selectedPinOverlay.setPosition(void 0)});bboxFitsInView(e){if(!this.mapInstance||!e)return!0;const t=this.mapInstance.getView(),n=this.mapInstance.getSize();return wG(t.calculateExtent(n),[...lZ([e.minLon,e.minLat]),...lZ([e.maxLon,e.maxLat])])}zoomToBbox(e){if(!this.mapInstance||!e)return;const t=this.mapInstance.getView(),n=this.mapInstance.getSize(),r=[...lZ([e.minLon,e.minLat]),...lZ([e.maxLon,e.maxLat])];let i=[.15*n[1],.15*n[0],.15*n[1],.15*n[0]];if(n[0]<=768){const e=.5*n[1],t=.15*e,r=.5*n[1]+.15*e;i[0]=t,i[2]=r}else if(this.args.isSidebarOpen){const e=getComputedStyle(document.documentElement).getPropertyValue("--sidebar-width").trim(),t=parseInt(e,10)||360,r=n[0]-t;i[3]=t+.15*r,i[1]=.15*r}const s=t.getZoom();t.fit(r,{padding:i,duration:1e3,easing:e=>e*(2-e),maxZoom:Math.max(s,18)})}handlePinVisibility(e,t={}){if(!this.mapInstance)return;const n=this.mapInstance.getView().getZoom();if(!t.maintainZoom&&n<16)return void this.animateToSmartCenter(e,16);const r=this.mapInstance.getPixelFromCoordinate(e),i=this.mapInstance.getSize();if(!r||r[0]<0||r[0]>i[0]||r[1]<0||r[1]>i[1]){const n=t.maintainZoom?null:16;this.animateToSmartCenter(e,n)}else this.panIfObscured(e)}animateToSmartCenter(e,t=null){if(!this.mapInstance)return;const n=this.mapInstance.getSize(),r=this.mapInstance.getView();let i=r.getResolution();null!==t&&(i=r.getResolutionForZoom(t));let s=e;if(n[0]<=768){const t=n[1],r=document.querySelector(".app-header"),o=r?r.offsetHeight:60,a=(t/2-(o+(t/2-o)/2))*i;s=[e[0],e[1]-a]}else if(this.args.isSidebarOpen){const t=getComputedStyle(document.documentElement).getPropertyValue("--sidebar-width").trim(),n=(parseInt(t,10)||360)/2*i;s=[e[0]-n,e[1]]}const o={center:s,duration:1e3,easing:e=>e*(2-e)};null!==t&&(o.zoom=t),r.animate(o)}panIfObscured(e){if(!this.mapInstance)return;const t=this.mapInstance.getSize(),n=this.mapInstance.getPixelFromCoordinate(e);if(!n)return;const r=this.mapInstance.getView(),i=r.getCenter(),s=r.getResolution();let o=n[0],a=n[1],l=!1;const c=document.querySelector(".app-header"),u=c?c.offsetHeight:60;if(t[0]<=768){const e=t[1],r=e/2;n[1]>r&&(a=u+(e/2-u)/2,l=!0)}else if(this.args.isSidebarOpen){const e=getComputedStyle(document.documentElement).getPropertyValue("--sidebar-width").trim(),r=parseInt(e,10)||360;n[0]<r&&(o=r+(t[0]-r)/2,l=!0)}const h=u+20;if(a<h&&(a=h+30,l=!0),l){const e=n[0]-o,t=n[1]-a,l=i[0]+e*s,c=i[1]-t*s;r.animate({center:[l,c],duration:500,easing:e=>e*(2-e)})}}updateBookmarks=cq(()=>{const e=this.storage.placesInView;this.loadBookmarks(e)});async loadBookmarks(e=[]){try{if(!this.bookmarkSource)return;e&&0!==e.length||(e=this.storage.placesInView),this.bookmarkSource.clear(),e&&Array.isArray(e)&&e.forEach(e=>{if(e.lat&&e.lon){const t=new N1({geometry:new hY(lZ([e.lon,e.lat])),name:e.title,id:e.id,isBookmark:!0,originalPlace:e});this.bookmarkSource.addFeature(t)}})}catch(t){console.error("Failed to load bookmarks:",t)}}syncPulse=cq(()=>{this.searchOverlayElement&&(this.mapUi.isSearching?this.searchOverlayElement.classList.add("active"):this.searchOverlayElement.classList.remove("active"))});syncCreationMode=cq(()=>{if(this.crosshairElement&&this.mapInstance)if(this.mapUi.isCreating){this.crosshairElement.classList.add("visible");const e=this.mapUi.creationCoordinates;if(e&&e.lat&&e.lon){const t=lZ([e.lon,e.lat]);this.animateToCrosshair(t)}}else this.crosshairElement.classList.remove("visible")});animateToCrosshair(e){if(!this.mapInstance||!this.crosshairElement)return;const t=this.mapInstance.getTargetElement().getBoundingClientRect(),n=this.crosshairElement.getBoundingClientRect(),r=n.left+n.width/2-t.left,i=n.top+n.height/2-t.top,s=this.mapInstance.getSize(),o=r-s[0]/2,a=i-s[1]/2,l=this.mapInstance.getView(),c=l.getResolution(),u=o*c,h=-a*c,d=e[0]-u,p=e[1]-h,f=l.getCenter();Math.sqrt(Math.pow(f[0]-d,2)+Math.pow(f[1]-p,2))>5*c&&l.animate({center:[d,p],duration:800,easing:e=>e*(2-e)})}handleMapMove=async()=>{if(!this.mapInstance||this.isDestroying||this.isDestroyed)return;const e=this.mapInstance.getView(),t=cZ(e.getCenter());if(this.mapUi.updateCenter(t[1],t[0]),this.mapUi.updateZoom(e.getZoom()),this.mapUi.isCreating){const e=this.mapInstance.getTargetElement().getBoundingClientRect(),t=this.crosshairElement.getBoundingClientRect(),n=t.left+t.width/2-e.left,r=t.top+t.height/2-e.top,i=cZ(this.mapInstance.getCoordinateFromPixel([n,r])),s=parseFloat(i[1].toFixed(6)),o=parseFloat(i[0].toFixed(6));this.mapUi.updateCreationCoordinates(s,o),this.router.replaceWith("place.new",{queryParams:{lat:s,lon:o}})}const n=this.mapInstance.getSize(),r=this.mapInstance.getView().calculateExtent(n),[i,s]=cZ([r[0],r[1]]),[o,a]=cZ([r[2],r[3]]),l={minLat:s,minLon:i,maxLat:a,maxLon:o};if(this.mapUi.updateBounds(l),await this.storage.loadPlacesInBounds(l),!this.isDestroying&&!this.isDestroyed){this.nostrData.loadPlacesInBounds(l),this.loadBookmarks(this.storage.placesInView);try{const e=this.mapInstance.getView(),t={center:cZ(e.getCenter()),zoom:e.getZoom()};localStorage.setItem("marco:map-view",JSON.stringify(t))}catch(c){console.warn("Failed to save map view:",c)}}};handleMapClick=async e=>{if(this.ignoreNextMapClick)return void(this.ignoreNextMapClick=!1);const t=this.mapInstance.getFeaturesAtPixel(e.pixel,{hitTolerance:10});let n=null,r=null,i=null;if(t&&t.length>0){console.debug(`Found ${t.length} features in map layer:`);for(const n of t)console.debug(n);const e=t.find(e=>e.get("isBookmark")),s=t.find(e=>e.get("isSearchResult"));e?n=e.get("originalPlace"):s&&(r=s.get("originalPlace"));const o=t[0].getProperties();o.name&&(i=o.name)}const s=e=>{("search"===this.router.currentRouteName||this.mapUi.currentSearch&&this.mapUi.searchResults.length>0)&&(this.mapUi.returnToSearch=!0),this.mapUi.preventNextZoom=!0,this.mapUi.selectPlace(e,{preventZoom:!0}),this.mapUi.showSidebar(),this.router.transitionTo("place",e)};if(this.args.isSidebarOpen){const e=n||r;return e?(console.debug("Clicked feature while sidebar open (switching):",e),void s(e)):void(this.args.onOutsideClick&&this.args.onOutsideClick())}if(n)return console.debug("Clicked bookmark:",n),void s(n);if(r)return console.debug("Clicked search result:",r),void s(r);if(this.mapUi.searchResults&&this.mapUi.searchResults.length>0)return console.debug("Clearing active search and markers on map click"),void this.router.transitionTo("index");if(this.mapInstance.getView().getZoom()<16)return;const[o,a]=cZ(e.coordinate),l=i?30:50;if(this.searchOverlayElement){const t=this.mapInstance.getView(),n=2*l/sZ(t.getProjection(),t.getResolution(),e.coordinate);this.searchOverlayElement.style.width=`${n}px`,this.searchOverlayElement.style.height=`${n}px`,this.searchOverlay.setPosition(e.coordinate)}this.mapUi.startSearch();const c={lat:a.toFixed(6),lon:o.toFixed(6),q:null,category:null,selected:i||null};this.router.transitionTo("search",{queryParams:c})};static{Ap(rg({id:null,block:'[[[11,0],[16,0,[29,["map-container ",[52,[30,1],"sidebar-open"]]]],[4,[30,0,["setupMap"]],null,null],[4,[30,0,["updateInteractions"]],null,null],[4,[30,0,["updateBookmarks"]],null,null],[4,[30,0,["updateSearchResults"]],null,null],[4,[30,0,["updateSelectedPin"]],null,null],[4,[30,0,["syncPulse"]],null,null],[4,[30,0,["syncCreationMode"]],null,null],[12],[13]],["@isSidebarOpen"],["if"]]',moduleName:"(unknown template module)",isStrictMode:!0}),this)}},Ree=class extends I${static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");static{dF(this.prototype,"osmAuth",[dp])}#St=void fF(this,"osmAuth");static{dF(this.prototype,"nostrAuth",[dp])}#N=void fF(this,"nostrAuth");static{dF(this.prototype,"nostrData",[dp])}#F=void fF(this,"nostrData");static{dF(this.prototype,"isNostrConnectModalOpen",[Vr],function(){return!1})}#Ve=void fF(this,"isNostrConnectModalOpen");connectRS(){this.args.onClose(),this.args.storage.showConnectWidget()}static{pF(this.prototype,"connectRS",[ql])}disconnectRS(){this.args.storage.disconnect()}static{pF(this.prototype,"disconnectRS",[ql])}connectOsm(){this.args.onClose(),this.osmAuth.login()}static{pF(this.prototype,"connectOsm",[ql])}disconnectOsm(){this.osmAuth.logout()}static{pF(this.prototype,"disconnectOsm",[ql])}openNostrConnectModal(){this.isNostrConnectModalOpen=!0}static{pF(this.prototype,"openNostrConnectModal",[ql])}closeNostrConnectModal(){this.isNostrConnectModalOpen=!1}static{pF(this.prototype,"closeNostrConnectModal",[ql])}disconnectNostr(){this.nostrAuth.disconnect()}static{pF(this.prototype,"disconnectNostr",[ql])}static{Ap(rg({id:null,block:'[[[10,0],[14,0,"user-menu-popover"],[12],[1,"\\n "],[10,"ul"],[14,0,"account-list"],[12],[1,"\\n "],[10,"li"],[14,0,"account-item"],[12],[1,"\\n "],[10,0],[14,0,"account-header"],[12],[1,"\\n "],[10,0],[14,0,"account-info"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["remotestorage",18]],null],[1,"\\n "],[10,1],[12],[1,"RemoteStorage"],[13],[1,"\\n "],[13],[1,"\\n"],[41,[30,1,["connected"]],[[[1," "],[11,"button"],[24,0,"btn-text text-danger"],[24,4,"button"],[4,[32,1],["click",[30,0,["disconnectRS"]]],null],[12],[1,"Disconnect"],[13],[1,"\\n"]],[]],[[[1," "],[11,"button"],[24,0,"btn-text text-primary"],[24,4,"button"],[4,[32,1],["click",[30,0,["connectRS"]]],null],[12],[1,"Connect"],[13],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n "],[10,0],[14,0,"account-status"],[12],[1,"\\n"],[41,[30,1,["connected"]],[[[1," "],[10,"strong"],[12],[1,[30,1,["userAddress"]]],[13],[1,"\\n"]],[]],[[[1," Not connected\\n"]],[]]],[1," "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,"li"],[14,0,"account-item"],[12],[1,"\\n "],[10,0],[14,0,"account-header"],[12],[1,"\\n "],[10,0],[14,0,"account-info"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["map",18]],null],[1,"\\n "],[10,1],[12],[1,"OpenStreetMap"],[13],[1,"\\n "],[13],[1,"\\n"],[41,[30,0,["osmAuth","isConnected"]],[[[1," "],[11,"button"],[24,0,"btn-text text-danger"],[24,4,"button"],[4,[32,1],["click",[30,0,["disconnectOsm"]]],null],[12],[1,"Disconnect"],[13],[1,"\\n"]],[]],[[[1," "],[11,"button"],[24,0,"btn-text text-primary"],[24,4,"button"],[4,[32,1],["click",[30,0,["connectOsm"]]],null],[12],[1,"Connect"],[13],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n "],[10,0],[14,0,"account-status"],[12],[1,"\\n"],[41,[30,0,["osmAuth","isConnected"]],[[[1," "],[10,"strong"],[12],[1,[30,0,["osmAuth","userDisplayName"]]],[13],[1,"\\n"]],[]],[[[1," Not connected\\n"]],[]]],[1," "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,"li"],[14,0,"account-item"],[12],[1,"\\n "],[10,0],[14,0,"account-header"],[12],[1,"\\n "],[10,0],[14,0,"account-info"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["zap",18]],null],[1,"\\n "],[10,1],[12],[1,"Nostr"],[13],[1,"\\n "],[13],[1,"\\n"],[41,[30,0,["nostrAuth","isConnected"]],[[[1," "],[11,"button"],[24,0,"btn-text text-danger"],[24,4,"button"],[4,[32,1],["click",[30,0,["disconnectNostr"]]],null],[12],[1,"Disconnect"],[13],[1,"\\n"]],[]],[[[1," "],[11,"button"],[24,0,"btn-text text-primary"],[24,4,"button"],[4,[32,1],["click",[30,0,["openNostrConnectModal"]]],null],[12],[1,"Connect"],[13],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n "],[10,0],[14,0,"account-status"],[12],[1,"\\n"],[41,[30,0,["nostrAuth","isConnected"]],[[[1," "],[10,"strong"],[15,"title",[30,0,["nostrAuth","pubkey"]]],[12],[1,"\\n "],[1,[30,0,["nostrData","userDisplayName"]]],[1,"\\n "],[13],[1,"\\n"]],[]],[[[1," Not connected\\n"]],[]]],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13],[1,"\\n\\n"],[41,[30,0,["isNostrConnectModalOpen"]],[[[1," "],[8,[32,2],null,[["@onClose"],[[30,0,["closeNostrConnectModal"]]]],[["default"],[[[[1,"\\n "],[8,[32,3],null,[["@onConnect"],[[30,0,["closeNostrConnectModal"]]]],null],[1,"\\n "]],[]]]]],[1,"\\n"]],[]],null]],["@storage"],["if"]]',moduleName:"(unknown template module)",scope:()=>({Icon:M$,on:Ww,Modal:rq,NostrConnect:Uq}),isStrictMode:!0}),this)}};function Tee(e){return e}function Lee(e){return Object.keys(e).map(t=>e[t])}function Iee(e){if(e)if(e instanceof YV)e.executor.asyncErrorsHandled=!0;else if(e instanceof IV)return e._toPromise();return e}function Pee(e,t,n){return function(r){let i=function(e,t){if(Array.isArray(e))return e.map(t);if("object"==typeof e&&null!==e){let n={};return Object.keys(e).forEach(r=>{n[r]=t(e[r])}),n}return e}(r,Iee),s=n(i);Array.isArray(s);let o=Ua.defer();e[t](i).then(o.resolve,o.reject);let a=!1,l=()=>{a||(a=!0,s.forEach(e=>{e&&(e instanceof YV?e.cancel():"function"==typeof e.__ec_cancel__&&e[CV]())}))},c=o.promise.finally(l);return c[CV]=l,c}}Pee(Ua.Promise,"all",Tee),Pee(Ua,"allSettled",Tee),Pee(ra,"race",Tee),Pee(Ua,"hash",Lee),Pee(Ua,"hashSettled",Lee);var Mee=class extends IV{_deferable(){return HV.defer()}},Aee=class extends Mee{constructor(e){super(),this.ms=e}onYield(e){let t=Ts(()=>e.next(),this.ms);return()=>Ms(t)}},Oee=class extends I${static{dF(this.prototype,"photon",[dp])}#Ct=void fF(this,"photon");static{dF(this.prototype,"osm",[dp])}#B=void fF(this,"osm");static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");static{dF(this.prototype,"map",[dp])}#kt=void fF(this,"map");static{dF(this.prototype,"_internalQuery",[Vr],function(){return""})}#Et=void fF(this,"_internalQuery");static{dF(this.prototype,"results",[Vr],function(){return[]})}#Rt=void fF(this,"results");static{dF(this.prototype,"isFocused",[Vr],function(){return!1})}#Tt=void fF(this,"isFocused");static{dF(this.prototype,"isLoading",[Vr],function(){return!1})}#Lt=void fF(this,"isLoading");get query(){return this.args.query??this._internalQuery}set query(e){this._internalQuery=e}get showPopover(){return this.isFocused&&this.results.length>0}handleInput(e){const t=e.target.value;this.query=t,this.args.onQueryChange&&this.args.onQueryChange(t),t.length<2?this.results=[]:this.searchTask.perform(t)}static{pF(this.prototype,"handleInput",[ql])}formatSavedPlace(e){const t=(e._listIds||[]).map(e=>this.storage.lists?.find(t=>t.id===e)?.title).filter(Boolean).join(", "),n=t?`Saved place (${t})`:"Saved place";return{source:"saved",id:e.id,title:e.title,icon:"bookmark",description:n,osmId:e.osmId,osmType:e.osmType,lat:e.lat,lon:e.lon}}searchTask=eW(()=>({context:this,generator:function*(e){yield new Aee(300);const t="string"==typeof e?e:this.query;if(!(t.length<2)){this.isLoading=!0;try{let e,n;this.mapUi.currentCenter&&({lat:e,lon:n}=this.mapUi.currentCenter);const r=t.toLowerCase(),i=VU.filter(e=>e.label.toLowerCase().includes(r)).map(e=>({source:"category",title:e.label,id:e.id,icon:"search"}));let s=[];r.length>=3&&(s=this.storage.savedPlaces.filter(e=>e.title&&e.title.toLowerCase().includes(r)).map(e=>this.formatSavedPlace(e)));const o=yield this.photon.search(t,e,n),a=new Set(s.map(e=>e.osmId).filter(Boolean)),l=o.filter(e=>!a.has(e.osmId));this.results=[...i,...s,...l]}catch(n){console.error("Search failed",n),this.results=[]}finally{this.isLoading=!1}}}}),{restartable:!0},"searchTask",null);handleFocus(){this.isFocused=!0,this.mapUi.setSearchBoxFocus(!0),this.query.length>=2&&0===this.results.length&&this.searchTask.perform()}static{pF(this.prototype,"handleFocus",[ql])}handleBlur(){setTimeout(()=>{this.isFocused=!1,this.mapUi.setSearchBoxFocus(!1)},300)}static{pF(this.prototype,"handleBlur",[ql])}handleSubmit(e){if(e.preventDefault(),!this.query)return;let t={q:this.query,selected:null,category:null};if(this.mapUi.currentCenter){const{lat:e,lon:n}=this.mapUi.currentCenter;t.lat=parseFloat(e).toFixed(4),t.lon=parseFloat(n).toFixed(4)}this.router.transitionTo("search",{queryParams:t}),this.isFocused=!1}static{pF(this.prototype,"handleSubmit",[ql])}selectResult(e){if("category"===e.source){this.query=e.title,this.args.onQueryChange&&this.args.onQueryChange(e.title),this.results=[];let t=null,n=null;return this.mapUi.currentCenter&&(({lat:t,lon:n}=this.mapUi.currentCenter),t=t?.toString(),n=n?.toString()),void this.router.transitionTo("search",{queryParams:{q:e.title,category:e.id,selected:null,lat:t,lon:n}})}if(this.query=e.title,this.args.onQueryChange&&this.args.onQueryChange(e.title),this.results=[],"saved"===e.source&&e.id&&!e.osmId)this.router.transitionTo("place",e.id);else if(e.osmId){const t=`osm:${e.osmType}:${e.osmId}`;this.router.transitionTo("place",t)}else this.router.transitionTo("search",{queryParams:{q:e.title,lat:e.lat,lon:e.lon,selected:null,category:null}})}static{pF(this.prototype,"selectResult",[ql])}clear(){this.searchTask.cancelAll(),this.mapUi.stopLoading(),this.osm.cancelAll(),this.photon.cancelAll(),this.query="",this.results=[],this.args.onQueryChange&&this.args.onQueryChange(""),this.router.transitionTo("index")}static{pF(this.prototype,"clear",[ql])}static{Ap(rg({id:null,block:'[[[10,0],[14,0,"search-box"],[12],[1,"\\n "],[11,"form"],[24,0,"search-form"],[4,[32,0],["submit",[30,0,["handleSubmit"]]],null],[12],[1,"\\n "],[11,"button"],[24,0,"menu-btn-integrated"],[24,"aria-label","Menu"],[24,4,"button"],[4,[32,0],["click",[30,1]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["menu",20,"#5f6368"]],null],[1,"\\n "],[13],[1,"\\n\\n "],[11,"input"],[24,0,"search-input"],[24,"placeholder","Search places..."],[24,"aria-label","Search places"],[16,2,[30,0,["query"]]],[24,"autocomplete","off"],[24,4,"search"],[4,[32,0],["input",[30,0,["handleInput"]]],null],[4,[32,0],["focus",[30,0,["handleFocus"]]],null],[4,[32,0],["blur",[30,0,["handleBlur"]]],null],[12],[13],[1,"\\n\\n "],[10,"button"],[14,0,"search-submit-btn"],[14,"aria-label","Search"],[14,4,"submit"],[12],[1,"\\n"],[41,[28,[32,2],[[28,[32,3],[[30,0,["mapUi","loadingState","type"]],"text"],null],[28,[32,3],[[30,0,["mapUi","loadingState","type"]],"category"],null]],null],[[[1," "],[8,[32,1],null,[["@name","@size"],["loading-ring",20]],null],[1,"\\n"]],[]],[[[1," "],[8,[32,1],null,[["@name","@size","@color"],["search",20,"#5f6368"]],null],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n\\n"],[41,[30,0,["query"]],[[[1," "],[11,"button"],[24,0,"search-clear-btn"],[24,"aria-label","Clear"],[24,4,"button"],[4,[32,0],["click",[30,0,["clear"]]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["x",20,"#5f6368"]],null],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n\\n"],[41,[30,0,["showPopover"]],[[[1," "],[10,0],[14,0,"search-results-popover"],[12],[1,"\\n "],[10,"ul"],[14,0,"search-results-list"],[12],[1,"\\n"],[42,[28,[31,2],[[28,[31,2],[[30,0,["results"]]],null]],null],null,[[[1," "],[10,"li"],[12],[1,"\\n "],[11,"button"],[24,0,"search-result-item"],[24,4,"button"],[4,[32,0],["click",[28,[32,4],[[30,0,["selectResult"]],[30,2]],null]],null],[12],[1,"\\n "],[10,0],[14,0,"result-icon"],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],[[52,[30,2,["icon"]],[30,2,["icon"]],"map-pin"],16,"#666"]],null],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"result-info"],[12],[1,"\\n "],[10,1],[14,0,"result-title"],[12],[1,[30,2,["title"]]],[13],[1,"\\n"],[41,[28,[32,3],[[30,2,["source"]],"osm"],null],[[[1," "],[10,1],[14,0,"result-desc"],[12],[1,[28,[32,5],[[30,2,["type"]]],null]],[13],[1,"\\n"]],[]],[[[41,[30,2,["description"]],[[[1," "],[10,1],[14,0,"result-desc"],[12],[1,[30,2,["description"]]],[13],[1,"\\n"]],[]],null]],[]]],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[2]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null],[13]],["@onToggleMenu","result"],["if","each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({on:Ww,Icon:M$,or:J$,eq:sq,fn:Z$,humanizeOsmTag:CW}),isStrictMode:!0}),this)}},Nee=class extends I${static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");get categories(){return VU}searchCategory(e){this.args.onSelect&&this.args.onSelect(e);let t={category:e.id,q:null};if(this.mapUi.currentCenter){const{lat:e,lon:n}=this.mapUi.currentCenter;t.lat=parseFloat(e).toFixed(4),t.lon=parseFloat(n).toFixed(4)}this.router.transitionTo("search",{queryParams:t})}static{pF(this.prototype,"searchCategory",[ql])}static{Ap(rg({id:null,block:'[[[10,0],[14,0,"category-chips-scroll"],[12],[1,"\\n "],[10,0],[14,0,"category-chips-container"],[12],[1,"\\n"],[42,[28,[31,1],[[28,[31,1],[[30,0,["categories"]]],null]],null],null,[[[1," "],[11,"button"],[24,0,"category-chip"],[16,"aria-label",[30,1,["label"]]],[16,"disabled",[28,[32,0],[[28,[32,1],[[30,0,["mapUi","loadingState","type"]],"category"],null],[28,[32,1],[[30,0,["mapUi","loadingState","value"]],[30,1,["id"]]],null]],null]],[24,4,"button"],[4,[32,2],["click",[28,[32,3],[[30,0,["searchCategory"]],[30,1]],null]],null],[12],[1,"\\n "],[8,[32,4],null,[["@name","@size"],[[30,1,["icon"]],16]],null],[1,"\\n "],[10,1],[12],[1,[30,1,["label"]]],[13],[1,"\\n "],[13],[1,"\\n"]],[1]],null],[1," "],[13],[1,"\\n"],[13]],["category"],["each","-track-array"]]',moduleName:"(unknown template module)",scope:()=>({and:iq,eq:sq,on:Ww,fn:Z$,Icon:M$}),isStrictMode:!0}),this)}},Fee=cq((e,[t])=>{let n=null;return async function(){if(t)try{const r=await caches.open("nostr-image-cache-v1"),i=await r.match(t);if(i){const t=await i.blob();return n=URL.createObjectURL(t),void(e.src=n)}const s=await fetch(t,{mode:"cors",credentials:"omit"});if(s.ok){const i=s.clone();await r.put(t,i);const o=await s.blob();n=URL.createObjectURL(o),e.src=n}else e.src=t}catch(_6){console.warn(`Failed to cache image ${t}, falling back to standard src`,_6),e.src=t}else e.src=""}(),()=>{n&&(URL.revokeObjectURL(n),n=null)}}),Dee=class extends I${static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");static{dF(this.prototype,"settings",[dp])}#D=void fF(this,"settings");static{dF(this.prototype,"nostrAuth",[dp])}#N=void fF(this,"nostrAuth");static{dF(this.prototype,"nostrData",[dp])}#F=void fF(this,"nostrData");static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");static{dF(this.prototype,"isUserMenuOpen",[Vr],function(){return!1})}#It=void fF(this,"isUserMenuOpen");static{dF(this.prototype,"searchQuery",[Vr],function(){return""})}#Pt=void fF(this,"searchQuery");constructor(){super(...arguments),this.router&&"function"==typeof this.router.on&&this.router.on("routeDidChange",this.syncSearchQuery),this.syncSearchQuery()}willDestroy(){this.router&&"function"==typeof this.router.off&&this.router.off("routeDidChange",this.syncSearchQuery),super.willDestroy(...arguments)}syncSearchQuery(){const e=this.mapUi.currentSearch||this.router?.currentRoute?.queryParams;if(e?.q)this.searchQuery=e.q;else if(e?.category){const t=VU.find(t=>t.id===e.category);this.searchQuery=t?t.label:e.category}else this.searchQuery=""}static{pF(this.prototype,"syncSearchQuery",[ql])}get isSearching(){return!(!this.mapUi.searchBoxHasFocus||!this.searchQuery)||("search"===this.router?.currentRouteName?!this.mapUi.loadingState&&this.mapUi.searchResults&&this.mapUi.searchResults.length>0:!("search"===this.router?.currentRouteName||!this.searchQuery))}get showQuickSearch(){const e=this.mapUi.currentZoom??13;return this.settings.showQuickSearchButtons&&e>=12}toggleUserMenu(){this.isUserMenuOpen=!this.isUserMenuOpen}static{pF(this.prototype,"toggleUserMenu",[ql])}closeUserMenu(){this.isUserMenuOpen=!1}static{pF(this.prototype,"closeUserMenu",[ql])}handleQueryChange(e){this.searchQuery=e}static{pF(this.prototype,"handleQueryChange",[ql])}handleChipSelect(e){this.searchQuery=e.label}static{pF(this.prototype,"handleChipSelect",[ql])}static{Ap(rg({id:null,block:'[[[10,"header"],[14,0,"app-header"],[12],[1,"\\n "],[10,0],[14,0,"header-left"],[12],[1,"\\n "],[8,[32,0],null,[["@query","@onToggleMenu","@onQueryChange"],[[30,0,["searchQuery"]],[30,1],[30,0,["handleQueryChange"]]]],null],[1,"\\n "],[13],[1,"\\n\\n"],[41,[30,0,["showQuickSearch"]],[[[1," "],[10,0],[15,0,[29,["header-center ",[52,[30,0,["isSearching"]],"searching"]]]],[12],[1,"\\n "],[8,[32,1],null,[["@onSelect"],[[30,0,["handleChipSelect"]]]],null],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1,"\\n "],[10,0],[14,0,"header-right"],[12],[1,"\\n "],[10,0],[14,0,"user-menu-container"],[12],[1,"\\n "],[11,"button"],[24,0,"user-btn btn-press"],[24,"aria-label","User Menu"],[24,4,"button"],[4,[32,2],["click",[30,0,["toggleUserMenu"]]],null],[12],[1,"\\n"],[41,[28,[32,3],[[30,0,["nostrAuth","isConnected"]],[30,0,["nostrData","profile","picture"]]],null],[[[1," "],[11,"img"],[24,0,"user-avatar"],[24,"alt","User Avatar"],[4,[32,4],[[30,0,["nostrData","profile","picture"]]],null],[12],[13],[1,"\\n"]],[]],[[[1," "],[10,0],[14,0,"user-avatar-placeholder"],[12],[1,"\\n "],[8,[32,5],null,[["@name","@size","@color"],["user",20,"white"]],null],[1,"\\n "],[13],[1,"\\n"]],[]]],[1," "],[13],[1,"\\n\\n"],[41,[30,0,["isUserMenuOpen"]],[[[1," "],[8,[32,6],null,[["@storage","@onClose"],[[30,0,["storage"]],[30,0,["closeUserMenu"]]]],null],[1,"\\n "],[11,0],[24,0,"menu-backdrop"],[24,"role","button"],[4,[32,2],["click",[30,0,["closeUserMenu"]]],null],[12],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onToggleMenu"],["if"]]',moduleName:"(unknown template module)",scope:()=>({SearchBox:Oee,CategoryChips:Nee,on:Ww,and:iq,cachedImage:Fee,Icon:M$,UserMenu:Ree}),isStrictMode:!0}),this)}},zee=class extends I${static{dF(this.prototype,"toast",[dp])}#Ie=void fF(this,"toast");static{Ap(rg({id:null,block:'[[[41,[30,0,["toast","isVisible"]],[[[1," "],[10,0],[14,0,"toast-notification"],[12],[1,"\\n "],[1,[30,0,["toast","message"]]],[1,"\\n "],[13],[1,"\\n"]],[]],null]],[],["if"]]',moduleName:"(unknown template module)",isStrictMode:!0}),this)}},jee=a({default:()=>Uee}),Uee=class extends I${static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");get isSidebarOpen(){const e=this.router.currentRouteName;return this.mapUi.isSidebarVisible&&("place"===e||"place.new"===e||"search"===e||"menu"===e||"contributions"===e||e.startsWith("lists"))}constructor(){super(...arguments),console.debug("Application component constructed"),this.storage}toggleAppMenu(){"menu"===this.router.currentRouteName?this.router.transitionTo("index"):this.router.transitionTo("menu")}static{pF(this.prototype,"toggleAppMenu",[ql])}handleOutsideClick(){const e=this.router.currentRouteName;("search"===e||"place"===e||"menu"===e||"contributions"===e||e.startsWith("lists"))&&(this.mapUi.clearSelection(),this.mapUi.hideSidebar(),"menu"===e||"contributions"===e||e.startsWith("lists")?this.router.transitionTo("index"):"place"===e&&(this.mapUi.returnToSearch&&this.mapUi.currentSearch?this.router.transitionTo("search",{queryParams:this.mapUi.currentSearch}):this.router.transitionTo("index")))}static{pF(this.prototype,"handleOutsideClick",[ql])}refreshBookmarks(){this.storage.notifyChange()}static{pF(this.prototype,"refreshBookmarks",[ql])}static{Ap(rg({id:null,block:'[[[1,[28,[32,0],["Marco"],null]],[1,"\\n\\n"],[10,0],[15,0,[52,[30,0,["mapUi","isSidebarOpening"]],"sidebar-opening"]],[12],[1,"\\n "],[8,[32,1],null,[["@onToggleMenu"],[[30,0,["toggleAppMenu"]]]],null],[1,"\\n\\n "],[10,0],[14,1,"rs-widget-container"],[15,0,[52,[30,0,["storage","isWidgetOpen"]],"visible"]],[12],[13],[1,"\\n\\n"],[41,[30,0,["storage","isWidgetOpen"]],[[[1," "],[11,0],[24,0,"rs-backdrop"],[24,"role","button"],[4,[32,2],["click",[30,0,["storage","closeWidget"]]],null],[12],[13],[1,"\\n"]],[]],null],[1,"\\n "],[8,[32,3],null,[["@isSidebarOpen","@onOutsideClick"],[[30,0,["isSidebarOpen"]],[30,0,["handleOutsideClick"]]]],null],[1,"\\n\\n "],[8,[32,4],null,null,null],[1,"\\n\\n "],[46,[28,[31,2],null,null],null,null,null],[1,"\\n"],[13]],[],["if","component","-outlet"]]',moduleName:"(unknown template module)",scope:()=>({pageTitle:HW,AppHeader:Dee,on:Ww,Map:Eee,Toast:zee}),isStrictMode:!0}),this)}},Bee=a({default:()=>$ee}),$ee=class extends Jh{static{dF(this.prototype,"osm",[dp])}#B=void fF(this,"osm");static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage")},qee=a({default:()=>Vee}),Vee=class extends Jh{static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");activate(){this.mapUi.clearSearchResults(),this.mapUi.hideSidebar()}},Wee=Ap(rg({id:null,block:'[[[10,0],[14,0,"sidebar-header"],[12],[1,"\\n "],[10,"h2"],[12],[1,"\\n "],[10,1],[14,0,"app-logo-icon"],[12],[1,"\\n "],[1,[28,[32,0],[[32,1]],null]],[1,"\\n "],[13],[1,"\\n Marco\\n "],[13],[1,"\\n "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,2],["click",[30,1]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@size","@color"],["x",20,"#333"]],null],[1,"\\n "],[13],[1,"\\n"],[13],[1,"\\n\\n"],[10,0],[14,0,"sidebar-content"],[12],[1,"\\n "],[10,"ul"],[14,0,"app-menu"],[12],[1,"\\n "],[10,"li"],[12],[1,"\\n "],[11,"button"],[24,4,"button"],[4,[32,2],["click",[30,2]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@size"],["bookmark",20]],null],[1,"\\n "],[10,1],[12],[1,"Collections"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"li"],[12],[1,"\\n "],[11,"button"],[24,4,"button"],[4,[32,2],["click",[30,3]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@size"],["activity",20]],null],[1,"\\n "],[10,1],[12],[1,"My Contributions"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"li"],[12],[1,"\\n "],[11,"button"],[24,4,"button"],[4,[32,2],["click",[28,[32,4],[[30,4],"settings"],null]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@size"],["settings",20]],null],[1,"\\n "],[10,1],[12],[1,"Settings"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"li"],[12],[1,"\\n "],[11,"button"],[24,4,"button"],[4,[32,2],["click",[28,[32,4],[[30,4],"about"],null]],null],[12],[1,"\\n "],[8,[32,3],null,[["@name","@size"],["info",20]],null],[1,"\\n "],[10,1],[12],[1,"About"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onClose","@onSavedPlaces","@onContributions","@onNavigate"],[]]',moduleName:"(unknown template module)",scope:()=>({htmlSafe:$v,iconRounded:'<svg\n width="1024"\n height="1024"\n viewBox="0 0 1024 1024"\n xmlns="http://www.w3.org/2000/svg"\n>\n \x3c!-- Background --\x3e\n <rect\n x="0"\n y="0"\n width="1024"\n height="1024"\n rx="220"\n fill="#F6E9A6"\n />\n\n \x3c!-- Subtle map grid (kept well outside safe zone) --\x3e\n <g stroke="#E6D88A" stroke-width="10" opacity="0.6">\n <line x1="256" y1="0" x2="256" y2="1024" />\n <line x1="512" y1="0" x2="512" y2="1024" />\n <line x1="768" y1="0" x2="768" y2="1024" />\n\n <line x1="0" y1="256" x2="1024" y2="256" />\n <line x1="0" y1="512" x2="1024" y2="512" />\n <line x1="0" y1="768" x2="1024" y2="768" />\n </g>\n\n \x3c!-- Location pin (exact app shape, larger, centered, safe-zone compliant) --\x3e\n \x3c!-- Safe zone target: ~680px diameter --\x3e\n <g\n transform="\n translate(512 512)\n scale(22)\n translate(-12 -12)\n "\n fill="#ea4335"\n stroke="#b31412"\n stroke-width="1"\n stroke-linecap="round"\n stroke-linejoin="round"\n >\n <path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z" />\n <circle cx="12" cy="10" r="3" fill="#b31412" stroke="none" />\n </g>\n</svg>\n',on:Ww,Icon:M$,fn:Z$}),isStrictMode:!0}),tq()),Hee=class extends I${static{dF(this.prototype,"settings",[dp])}#D=void fF(this,"settings");static{Ap(rg({id:null,block:'[[[10,"details"],[12],[1,"\\n "],[10,"summary"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["map",20]],null],[1,"\\n "],[10,1],[12],[1,"Map & UI"],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"details-content form-layout"],[12],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","show-quick-search"],[12],[1,"Quick search buttons visible"],[13],[1,"\\n "],[11,"select"],[24,1,"show-quick-search"],[24,0,"form-control"],[4,[32,1],["change",[28,[32,2],[[30,1],"showQuickSearchButtons"],null]],null],[12],[1,"\\n "],[10,"option"],[14,2,"true"],[15,"selected",[52,[30,0,["settings","showQuickSearchButtons"]],"selected"]],[12],[1,"\\n Yes\\n "],[13],[1,"\\n "],[10,"option"],[14,2,"false"],[15,"selected",[52,[51,[30,0,["settings","showQuickSearchButtons"]]],"selected"]],[12],[1,"\\n No\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","map-kinetic"],[12],[1,"Map Inertia (Kinetic Panning)"],[13],[1,"\\n "],[11,"select"],[24,1,"map-kinetic"],[24,0,"form-control"],[4,[32,1],["change",[28,[32,2],[[30,1],"mapKinetic"],null]],null],[12],[1,"\\n "],[10,"option"],[14,2,"true"],[15,"selected",[52,[30,0,["settings","mapKinetic"]],"selected"]],[12],[1,"\\n On\\n "],[13],[1,"\\n "],[10,"option"],[14,2,"false"],[15,"selected",[52,[51,[30,0,["settings","mapKinetic"]]],"selected"]],[12],[1,"\\n Off\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onChange"],["if","unless"]]',moduleName:"(unknown template module)",scope:()=>({Icon:M$,on:Ww,fn:Z$}),isStrictMode:!0}),this)}},Gee=class extends I${static{dF(this.prototype,"settings",[dp])}#D=void fF(this,"settings");static{Ap(rg({id:null,block:'[[[10,"details"],[12],[1,"\\n "],[10,"summary"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["server",20]],null],[1,"\\n "],[10,1],[12],[1,"API Providers"],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"details-content form-layout"],[12],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","overpass-api"],[12],[1,"Overpass API Provider"],[13],[1,"\\n "],[11,"select"],[24,1,"overpass-api"],[24,0,"form-control"],[4,[32,1],["change",[28,[32,2],[[30,1],"overpassApi"],null]],null],[12],[1,"\\n"],[42,[28,[31,1],[[28,[31,1],[[30,0,["settings","overpassApis"]]],null]],null],null,[[[1," "],[10,"option"],[15,2,[30,2,["url"]]],[15,"selected",[52,[28,[32,3],[[30,2,["url"]],[30,0,["settings","overpassApi"]]],null],"selected"]],[12],[1,"\\n "],[1,[30,2,["name"]]],[1,"\\n "],[13],[1,"\\n"]],[2]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","photon-api"],[12],[1,"Photon API Provider"],[13],[1,"\\n "],[11,"select"],[24,1,"photon-api"],[24,0,"form-control"],[4,[32,1],["change",[28,[32,2],[[30,1],"photonApi"],null]],null],[12],[1,"\\n"],[42,[28,[31,1],[[28,[31,1],[[30,0,["settings","photonApis"]]],null]],null],null,[[[1," "],[10,"option"],[15,2,[30,3,["url"]]],[15,"selected",[52,[28,[32,3],[[30,3,["url"]],[30,0,["settings","photonApi"]]],null],"selected"]],[12],[1,"\\n "],[1,[30,3,["name"]]],[1,"\\n "],[13],[1,"\\n"]],[3]],null],[1," "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onChange","api","api"],["each","-track-array","if"]]',moduleName:"(unknown template module)",scope:()=>({Icon:M$,on:Ww,fn:Z$,eq:sq}),isStrictMode:!0}),this)}},Kee=e=>e?e.replace(/^wss?:\/\//,""):"",Zee=class extends I${static{dF(this.prototype,"settings",[dp])}#D=void fF(this,"settings");static{dF(this.prototype,"nostrData",[dp])}#F=void fF(this,"nostrData");static{dF(this.prototype,"toast",[dp])}#Ie=void fF(this,"toast");static{dF(this.prototype,"newReadRelay",[Vr],function(){return""})}#Mt=void fF(this,"newReadRelay");static{dF(this.prototype,"newWriteRelay",[Vr],function(){return""})}#At=void fF(this,"newWriteRelay");get customReadRelays(){return zj(this.settings.nostrReadRelays||[],this.nostrData.requiredReadRelays)}get customWriteRelays(){return zj(this.settings.nostrWriteRelays||[],this.nostrData.requiredWriteRelays)}get readRelayExclusions(){return this.settings.nostrReadRelayExclusions||[]}get writeRelayExclusions(){return this.settings.nostrWriteRelayExclusions||[]}get requiredReadRelaySet(){return new Set(this.nostrData.requiredReadRelays.filter(Boolean))}get requiredWriteRelaySet(){return new Set(this.nostrData.requiredWriteRelays.filter(Boolean))}get mailboxReadRelaySet(){return new Set(this.nostrData.mailboxReadRelays)}get mailboxWriteRelaySet(){return new Set(this.nostrData.mailboxWriteRelays)}get hasReadOverrides(){return this.customReadRelays.length>0||this.readRelayExclusions.length>0}get hasWriteOverrides(){return this.customWriteRelays.length>0||this.writeRelayExclusions.length>0}get readRelaysForDisplay(){return this.nostrData.activeReadRelays.map(e=>({url:e,isRequired:this.requiredReadRelaySet.has(e)}))}get writeRelaysForDisplay(){return this.nostrData.activeWriteRelays.map(e=>({url:e,isRequired:this.requiredWriteRelaySet.has(e)}))}updateNewReadRelay(e){this.newReadRelay=e.target.value}static{pF(this.prototype,"updateNewReadRelay",[ql])}updateNewWriteRelay(e){this.newWriteRelay=e.target.value}static{pF(this.prototype,"updateNewWriteRelay",[ql])}addReadRelay(){const e=Nj(this.newReadRelay);if(!e)return;const t=zj(Dj(this.nostrData.requiredReadRelays,[...this.customReadRelays,e]),this.nostrData.requiredReadRelays),n=this.readRelayExclusions.filter(t=>Nj(t)!==e);this.settings.update("nostrReadRelays",t.length>0?t:null),this.settings.update("nostrReadRelayExclusions",n.length>0?n:null),this.newReadRelay=""}static{pF(this.prototype,"addReadRelay",[ql])}removeReadRelay(e){if(this.requiredReadRelaySet.has(e))return;const t=Nj(e),n=this.customReadRelays.filter(e=>Nj(e)!==t),r=this.mailboxReadRelaySet.has(t)?Array.from(new Set([...this.readRelayExclusions,t])):this.readRelayExclusions;this.settings.update("nostrReadRelays",n.length>0?n:null),this.settings.update("nostrReadRelayExclusions",r.length>0?r:null)}static{pF(this.prototype,"removeReadRelay",[ql])}handleReadRelayKeydown(e){"Enter"===e.key&&this.addReadRelay()}static{pF(this.prototype,"handleReadRelayKeydown",[ql])}handleWriteRelayKeydown(e){"Enter"===e.key&&this.addWriteRelay()}static{pF(this.prototype,"handleWriteRelayKeydown",[ql])}resetReadRelays(){this.settings.update("nostrReadRelays",null),this.settings.update("nostrReadRelayExclusions",null)}static{pF(this.prototype,"resetReadRelays",[ql])}addWriteRelay(){const e=Nj(this.newWriteRelay);if(!e)return;const t=zj(Dj(this.nostrData.requiredWriteRelays,[...this.customWriteRelays,e]),this.nostrData.requiredWriteRelays),n=this.writeRelayExclusions.filter(t=>Nj(t)!==e);this.settings.update("nostrWriteRelays",t.length>0?t:null),this.settings.update("nostrWriteRelayExclusions",n.length>0?n:null),this.newWriteRelay=""}static{pF(this.prototype,"addWriteRelay",[ql])}removeWriteRelay(e){if(this.requiredWriteRelaySet.has(e))return;const t=Nj(e),n=this.customWriteRelays.filter(e=>Nj(e)!==t),r=this.mailboxWriteRelaySet.has(t)?Array.from(new Set([...this.writeRelayExclusions,t])):this.writeRelayExclusions;this.settings.update("nostrWriteRelays",n.length>0?n:null),this.settings.update("nostrWriteRelayExclusions",r.length>0?r:null)}static{pF(this.prototype,"removeWriteRelay",[ql])}resetWriteRelays(){this.settings.update("nostrWriteRelays",null),this.settings.update("nostrWriteRelayExclusions",null)}static{pF(this.prototype,"resetWriteRelays",[ql])}async clearCache(){try{await this.nostrData.clearCache(),this.toast.show("Nostr cache cleared")}catch(e){this.toast.show(`Failed to clear Nostr cache: ${e.message}`)}}static{pF(this.prototype,"clearCache",[ql])}static{Ap(rg({id:null,block:'[[[10,"details"],[12],[1,"\\n "],[10,"summary"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["zap",20]],null],[1,"\\n "],[10,1],[12],[1,"Nostr"],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"details-content form-layout"],[12],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","new-read-relay"],[12],[1,"Read Relays"],[13],[1,"\\n "],[10,"ul"],[14,0,"relay-list"],[12],[1,"\\n"],[42,[28,[31,1],[[28,[31,1],[[30,0,["readRelaysForDisplay"]]],null]],null],null,[[[1," "],[10,"li"],[12],[1,"\\n "],[10,1],[12],[1,[28,[32,1],[[30,1,["url"]]],null]],[13],[1,"\\n"],[41,[51,[30,1,["isRequired"]]],[[[1," "],[11,"button"],[24,0,"btn-remove-relay"],[24,"title","Remove relay"],[24,"aria-label","Remove"],[24,4,"button"],[4,[32,2],["click",[28,[32,3],[[30,0,["removeReadRelay"]],[30,1,["url"]]],null]],null],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size","@color"],["x",14,"currentColor"]],null],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n"]],[1]],null],[1," "],[13],[1,"\\n "],[10,0],[14,0,"add-relay-input"],[12],[1,"\\n "],[11,"input"],[24,1,"new-read-relay"],[24,0,"form-control"],[24,"placeholder","relay.example.com"],[16,2,[30,0,["newReadRelay"]]],[24,4,"text"],[4,[32,2],["input",[30,0,["updateNewReadRelay"]]],null],[4,[32,2],["keydown",[30,0,["handleReadRelayKeydown"]]],null],[12],[13],[1,"\\n "],[11,"button"],[24,0,"btn btn-secondary"],[24,4,"button"],[4,[32,2],["click",[30,0,["addReadRelay"]]],null],[12],[1,"Add"],[13],[1,"\\n "],[13],[1,"\\n"],[41,[30,0,["hasReadOverrides"]],[[[1," "],[11,"button"],[24,0,"btn-link reset-relays"],[24,4,"button"],[4,[32,2],["click",[30,0,["resetReadRelays"]]],null],[12],[1,"\\n Reset to Defaults\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","new-write-relay"],[12],[1,"Write Relays"],[13],[1,"\\n "],[10,"ul"],[14,0,"relay-list"],[12],[1,"\\n"],[42,[28,[31,1],[[28,[31,1],[[30,0,["writeRelaysForDisplay"]]],null]],null],null,[[[1," "],[10,"li"],[12],[1,"\\n "],[10,1],[12],[1,[28,[32,1],[[30,2,["url"]]],null]],[13],[1,"\\n"],[41,[51,[30,2,["isRequired"]]],[[[1," "],[11,"button"],[24,0,"btn-remove-relay"],[24,"title","Remove relay"],[24,"aria-label","Remove"],[24,4,"button"],[4,[32,2],["click",[28,[32,3],[[30,0,["removeWriteRelay"]],[30,2,["url"]]],null]],null],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size","@color"],["x",14,"currentColor"]],null],[1,"\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n"]],[2]],null],[1," "],[13],[1,"\\n "],[10,0],[14,0,"add-relay-input"],[12],[1,"\\n "],[11,"input"],[24,1,"new-write-relay"],[24,0,"form-control"],[24,"placeholder","relay.example.com"],[16,2,[30,0,["newWriteRelay"]]],[24,4,"text"],[4,[32,2],["input",[30,0,["updateNewWriteRelay"]]],null],[4,[32,2],["keydown",[30,0,["handleWriteRelayKeydown"]]],null],[12],[13],[1,"\\n "],[11,"button"],[24,0,"btn btn-secondary"],[24,4,"button"],[4,[32,2],["click",[30,0,["addWriteRelay"]]],null],[12],[1,"Add"],[13],[1,"\\n "],[13],[1,"\\n"],[41,[30,0,["hasWriteOverrides"]],[[[1," "],[11,"button"],[24,0,"btn-link reset-relays"],[24,4,"button"],[4,[32,2],["click",[30,0,["resetWriteRelays"]]],null],[12],[1,"\\n Reset to Defaults\\n "],[13],[1,"\\n"]],[]],null],[1," "],[13],[1,"\\n\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","nostr-photo-fallback-uploads"],[12],[1,"Upload photos to fallback\\n servers"],[13],[1,"\\n "],[11,"select"],[24,1,"nostr-photo-fallback-uploads"],[24,0,"form-control"],[4,[32,2],["change",[28,[32,3],[[30,3],"nostrPhotoFallbackUploads"],null]],null],[12],[1,"\\n "],[10,"option"],[14,2,"true"],[15,"selected",[52,[30,0,["settings","nostrPhotoFallbackUploads"]],"selected"]],[12],[1,"\\n Yes\\n "],[13],[1,"\\n "],[10,"option"],[14,2,"false"],[15,"selected",[52,[51,[30,0,["settings","nostrPhotoFallbackUploads"]]],"selected"]],[12],[1,"\\n No\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[12],[1,"Cached data"],[13],[1,"\\n "],[11,"button"],[24,0,"btn btn-outline btn-full"],[24,4,"button"],[4,[32,2],["click",[30,0,["clearCache"]]],null],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size","@color"],["database",18,"var(--danger-color)"]],null],[1,"\\n Clear profiles, photos, and reviews\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["relay","relay","@onChange"],["each","-track-array","unless","if"]]',moduleName:"(unknown template module)",scope:()=>({Icon:M$,stripProtocol:Kee,on:Ww,fn:Z$}),isStrictMode:!0}),this)}},Yee=class extends I${static{dF(this.prototype,"settings",[dp])}#D=void fF(this,"settings");static{Ap(rg({id:null,block:'[[[10,"details"],[12],[1,"\\n "],[10,"summary"],[12],[1,"\\n "],[8,[32,0],null,[["@name","@size"],["alert-triangle",20]],null],[1,"\\n "],[10,1],[12],[1,"Experimental"],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"details-content form-layout"],[12],[1,"\\n "],[10,0],[14,0,"form-group"],[12],[1,"\\n "],[10,"label"],[14,"for","experimental-enable-photo-deletion"],[12],[1,"Enable photo deletion\\n (own photos)"],[13],[1,"\\n "],[11,"select"],[24,1,"experimental-enable-photo-deletion"],[24,0,"form-control"],[4,[32,1],["change",[28,[32,2],[[30,1],"experimentalEnablePhotoDeletion"],null]],null],[12],[1,"\\n "],[10,"option"],[14,2,"true"],[15,"selected",[52,[30,0,["settings","experimentalEnablePhotoDeletion"]],"selected"]],[12],[1,"\\n On\\n "],[13],[1,"\\n "],[10,"option"],[14,2,"false"],[15,"selected",[52,[51,[30,0,["settings","experimentalEnablePhotoDeletion"]]],"selected"]],[12],[1,"\\n Off\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onChange"],["if","unless"]]',moduleName:"(unknown template module)",scope:()=>({Icon:M$,on:Ww,fn:Z$}),isStrictMode:!0}),this)}},Xee=class extends I${static{dF(this.prototype,"settings",[dp])}#D=void fF(this,"settings");updateSetting(e,t){let n=t.target.value;"true"===n&&(n=!0),"false"===n&&(n=!1),this.settings.update(e,n)}static{pF(this.prototype,"updateSetting",[ql])}static{Ap(rg({id:null,block:'[[[10,0],[14,0,"sidebar-header has-back-btn"],[12],[1,"\\n "],[11,"button"],[24,0,"back-btn"],[24,4,"button"],[4,[32,0],["click",[30,1]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["arrow-left",20,"#333"]],null],[1,"\\n "],[13],[1,"\\n "],[10,"h2"],[14,0,"sidebar-header-text-centered"],[12],[1,"Settings"],[13],[1,"\\n "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,0],["click",[30,2]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["x",20,"#333"]],null],[1,"\\n "],[13],[1,"\\n"],[13],[1,"\\n\\n"],[10,0],[14,0,"sidebar-content"],[12],[1,"\\n "],[10,"section"],[14,0,"settings-section"],[12],[1,"\\n "],[8,[32,2],null,[["@onChange"],[[30,0,["updateSetting"]]]],null],[1,"\\n "],[8,[32,3],null,[["@onChange"],[[30,0,["updateSetting"]]]],null],[1,"\\n "],[8,[32,4],null,[["@onChange"],[[30,0,["updateSetting"]]]],null],[1,"\\n "],[8,[32,5],null,[["@onChange"],[[30,0,["updateSetting"]]]],null],[1,"\\n "],[13],[1,"\\n"],[13]],["@onBack","@onClose"],[]]',moduleName:"(unknown template module)",scope:()=>({on:Ww,Icon:M$,AppMenuSettingsMapUi:Hee,AppMenuSettingsApis:Gee,AppMenuSettingsNostr:Zee,AppMenuSettingsExperimental:Yee}),isStrictMode:!0}),this)}},Jee=Ap(rg({id:null,block:'[[[10,0],[14,0,"sidebar-header has-back-btn"],[12],[1,"\\n "],[11,"button"],[24,0,"back-btn"],[24,4,"button"],[4,[32,0],["click",[30,1]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["arrow-left",20,"#333"]],null],[1,"\\n "],[13],[1,"\\n "],[10,"h2"],[14,0,"sidebar-header-text-centered"],[12],[1,"About"],[13],[1,"\\n "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,0],["click",[30,2]],null],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["x",20,"#333"]],null],[1,"\\n "],[13],[1,"\\n"],[13],[1,"\\n\\n"],[10,0],[14,0,"sidebar-content"],[12],[1,"\\n "],[10,"section"],[14,0,"about-section"],[12],[1,"\\n "],[10,2],[12],[1,"\\n "],[10,"strong"],[12],[1,"Marco"],[13],[1,"\\n (as in\\n "],[10,3],[14,6,"https://en.wikipedia.org/wiki/Marco_Polo"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"Marco Polo"],[13],[1,") is an unhosted maps application that respects your\\n privacy and choices.\\n "],[13],[1,"\\n "],[10,2],[12],[1,"\\n Connect your own\\n "],[10,3],[14,6,"https://remotestorage.io/"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"remote storage"],[13],[1,"\\n to sync place bookmarks across apps and devices.\\n "],[13],[1,"\\n "],[10,2],[12],[1,"\\n Connect your\\n "],[10,3],[14,6,"https://start.nostr.net"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"Nostr"],[13],[1,"\\n identity to publish photos of places.\\n "],[13],[1,"\\n\\n "],[10,"details"],[12],[1,"\\n "],[10,"summary"],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size"],["gift",20]],null],[1,"\\n "],[10,1],[12],[1,"Open Source"],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"details-content"],[12],[1,"\\n "],[10,"table"],[12],[1,"\\n "],[10,"thead"],[12],[1,"\\n "],[10,"tr"],[12],[1,"\\n "],[10,"th"],[12],[1,"Source"],[13],[1,"\\n "],[10,"th"],[12],[1,"License"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"tbody"],[12],[1,"\\n "],[10,"tr"],[12],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://gitea.kosmos.org/raucao/marco"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Marco App\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://en.wikipedia.org/wiki/GNU_Affero_General_Public_License"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n "],[10,"abbr"],[14,"title","GNU Affero General Public License"],[12],[1,"AGPL"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"tr"],[12],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://openstreetmap.org/copyright"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Map Data\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://opendatacommons.org/licenses/odbl/"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n "],[10,"abbr"],[14,"title","Open Data Commons Open Database License"],[12],[1,"ODbL"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"tr"],[12],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://openfreemap.org"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Map tiles\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://github.com/hyperknot/openfreemap/blob/main/LICENSE.md"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Various\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"tr"],[12],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://github.com/feathericons/feather"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Feather Icons\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://en.wikipedia.org/wiki/MIT_License"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n "],[10,"abbr"],[14,"title","MIT License"],[12],[1,"MIT"],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"tr"],[12],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://pinhead.ink/"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Pinhead Icons\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"td"],[12],[1,"\\n "],[10,3],[14,6,"https://github.com/waysidemapping/pinhead?tab=readme-ov-file#where-the-icons-are-from"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"\\n Various\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,"details"],[12],[1,"\\n "],[10,"summary"],[12],[1,"\\n "],[8,[32,1],null,[["@name","@size","@color"],["heart",20,"#e5533d"]],null],[1,"\\n "],[10,1],[12],[1,"Contribute"],[13],[1,"\\n "],[13],[1,"\\n "],[10,0],[14,0,"details-content"],[12],[1,"\\n "],[10,2],[12],[1,"\\n "],[10,"strong"],[12],[1,"Most impactful:"],[13],[1,"\\n "],[13],[1,"\\n "],[10,"ul"],[12],[1,"\\n "],[10,"li"],[12],[1,"\\n Add and improve data for points of interest in\\n "],[10,3],[14,6,"https://www.openstreetmap.org"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"OpenStreetMap"],[13],[1,".\\n "],[13],[1,"\\n "],[10,"li"],[12],[1,"\\n Add place photos with your Nostr account.\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[10,2],[12],[1,"\\n "],[10,"strong"],[12],[1,"Most appreciated:"],[13],[1,"\\n Use this app as much as you can and\\n "],[10,3],[14,6,"https://community.remotestorage.io/t/marco-an-unhosted-maps-app/941"],[14,"target","_blank"],[14,"rel","noopener"],[12],[1,"submit feedback"],[13],[1,"\\n about your experience, problems, feature wishes, etc.\\n "],[13],[1,"\\n "],[10,2],[12],[1,"\\n "],[10,"strong"],[12],[1,"Most supportive:"],[13],[1,"\\n Tell others about this app, on social media, in blog posts,\\n educational videos, etc.\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"],[13]],["@onBack","@onClose"],[]]',moduleName:"(unknown template module)",scope:()=>({on:Ww,Icon:M$}),isStrictMode:!0}),tq()),Qee=class extends I${static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");static{dF(this.prototype,"currentView",[Vr],function(){return"menu"})}#Ot=void fF(this,"currentView");setView(e){this.currentView=e}static{pF(this.prototype,"setView",[ql])}goToSavedPlaces(){this.router.transitionTo("lists.index")}static{pF(this.prototype,"goToSavedPlaces",[ql])}goToContributions(){this.router.transitionTo("contributions")}static{pF(this.prototype,"goToContributions",[ql])}static{Ap(rg({id:null,block:'[[[10,0],[14,0,"sidebar app-menu-pane"],[12],[1,"\\n"],[41,[28,[32,0],[[30,0,["currentView"]],"menu"],null],[[[1," "],[8,[32,1],null,[["@onNavigate","@onClose","@onSavedPlaces","@onContributions"],[[30,0,["setView"]],[30,1],[30,0,["goToSavedPlaces"]],[30,0,["goToContributions"]]]],null],[1,"\\n\\n"]],[]],[[[41,[28,[32,0],[[30,0,["currentView"]],"settings"],null],[[[1," "],[8,[32,2],null,[["@onBack","@onClose"],[[28,[32,3],[[30,0,["setView"]],"menu"],null],[30,1]]],null],[1,"\\n\\n"]],[]],[[[41,[28,[32,0],[[30,0,["currentView"]],"about"],null],[[[1," "],[8,[32,4],null,[["@onBack","@onClose"],[[28,[32,3],[[30,0,["setView"]],"menu"],null],[30,1]]],null],[1,"\\n "]],[]],null]],[]]]],[]]],[13]],["@onClose"],["if"]]',moduleName:"(unknown template module)",scope:()=>({eq:sq,AppMenuHome:Wee,AppMenuSettings:Xee,fn:Z$,AppMenuAbout:Jee}),isStrictMode:!0}),this)}},ete=a({default:()=>tte}),tte=class extends I${static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");close(){this.router.transitionTo("index")}static{pF(this.prototype,"close",[ql])}static{Ap(rg({id:null,block:'[[[8,[32,0],null,[["@onClose"],[[30,0,["close"]]]],null]],[],[]]',moduleName:"(unknown template module)",scope:()=>({AppMenu:Qee}),isStrictMode:!0}),this)}},nte=a({default:()=>rte}),rte=class extends Jh{static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");activate(){this.mapUi.showSidebar()}},ite=a({default:()=>ste}),ste=class extends Jh{static{dF(this.prototype,"osmAuth",[dp])}#St=void fF(this,"osmAuth");static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");async model(){try{await this.osmAuth.handleCallback()}catch(e){console.error("Failed to handle OSM OAuth callback",e)}finally{this.router.transitionTo("index")}}},ote=a({default:()=>ate}),ate=class extends I${static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");static{dF(this.prototype,"localPlace",[Vr],function(){return null})}#Nt=void fF(this,"localPlace");constructor(){super(...arguments),this.localPlace=this.args.model}get place(){const e=this.args.model,t=e.osmId||e.id;return this.storage.findPlaceById(t)||(!this.localPlace||this.localPlace.osmId!==t&&this.localPlace.id!==t?e.createdAt?{...e,id:void 0,createdAt:void 0,geohash:void 0}:e:this.localPlace)}handleUpdate(e){console.debug("Updating local place state:",e),this.localPlace=e,this.storage.notifyChange()}static{pF(this.prototype,"handleUpdate",[ql])}refreshMap(){this.storage.notifyChange()}static{pF(this.prototype,"refreshMap",[ql])}navigateBack(e){if(null===e)if(this.mapUi.returnToRoute){this.mapUi.showSidebar();const{name:e,model:t}=this.mapUi.returnToRoute;void 0!==t?this.router.transitionTo(e,t):this.router.transitionTo(e)}else this.mapUi.returnToSearch&&this.mapUi.currentSearch?(this.mapUi.showSidebar(),this.router.transitionTo("search",{queryParams:this.mapUi.currentSearch})):this.router.transitionTo("index");else this.mapUi.showSidebar(),this.router.transitionTo("place",e)}static{pF(this.prototype,"navigateBack",[ql])}close(){this.mapUi.clearSelection(),this.mapUi.hideSidebar(),this.mapUi.returnToSearch&&this.mapUi.currentSearch?this.router.transitionTo("search",{queryParams:this.mapUi.currentSearch}):this.router.transitionTo("index")}static{pF(this.prototype,"close",[ql])}static{Ap(rg({id:null,block:'[[[41,[30,0,["mapUi","isSidebarVisible"]],[[[1," "],[8,[32,0],null,[["@selectedPlace","@onClose","@onSelect","@onBookmarkChange","@onUpdate"],[[30,0,["place"]],[30,0,["close"]],[30,0,["navigateBack"]],[30,0,["refreshMap"]],[30,0,["handleUpdate"]]]],null],[1,"\\n"]],[]],null]],[],["if"]]',moduleName:"(unknown template module)",scope:()=>({PlacesSidebar:SW}),isStrictMode:!0}),this)}},lte=a({default:()=>cte}),cte=class extends Jh{static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");static{dF(this.prototype,"osm",[dp])}#B=void fF(this,"osm");static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");async model(e){const t=e.place_id;let n,r,i=!1;(t.startsWith("osm:node:")||t.startsWith("osm:way:")||t.startsWith("osm:relation:"))&&(i=!0,[,n,r]=t.split(":"),console.debug(`Fetching explicit OSM ${n}:`,r));let s=null;i&&(s=this.loadOsmPlace(r,n)),await this.waitForSync();let o=i?r:t,a=this.storage.findPlaceById(o);return a&&i&&a.osmType!==n&&(a=null),a?(console.debug("Found in bookmarks:",a.title),a):i?(console.debug(`Not in bookmarks, using explicitly fetched OSM ${n}:`,r),await s):(console.warn("Not in bookmarks:",t),null)}async waitForSync(){if(this.storage.initialSyncDone)return;console.debug("Waiting for initial storage sync...");const e=Date.now();for(;!this.storage.initialSyncDone;){if(Date.now()-e>5e3){console.warn("Timed out waiting for initial sync");break}await new Promise(e=>setTimeout(e,100))}}async afterModel(e){if(e&&e.osmId&&e.osmType&&"node"!==e.osmType&&!e.geojson){console.debug("Model missing geometry, fetching full OSM details...");const t=await this.loadOsmPlace(e.osmId,e.osmType);t&&(Object.assign(e,t),console.debug("Enriched model with full OSM details",e))}if(e){const t={preventZoom:this.mapUi.preventNextZoom};this.mapUi.selectPlace(e,t),this.mapUi.showSidebar(),this.mapUi.preventNextZoom=!1}this.mapUi.stopSearch()}deactivate(){this.mapUi.clearSelection(),this.mapUi.returnToSearch=!1,this.mapUi.returnToRoute=null}async loadOsmPlace(e,t=null){try{const n=await this.osm.fetchOsmObject(e,t);if(n)return console.debug("Found OSM POI:",n),n}catch(n){console.error("Failed to fetch POI",n)}return null}setupController(e,t){super.setupController(e,t),this.checkUpdates(t)}async checkUpdates(e){if(e&&e.osmId&&e.osmType){if(e.id){const t=await this.storage.refreshPlace(e);return void(t&&this.mapUi.selectPlace(t,{preventZoom:!0}))}try{const t=await this.osm.fetchOsmObject(e.osmId,e.osmType,{forceFresh:!0});t&&function(e,t){const n=Math.abs((e.lat??0)-(t.lat??0)),r=Math.abs((e.lon??0)-(t.lon??0));if(n>1e-5||r>1e-5)return!0;const i=e.osmTags||{},s=t.osmTags||{},o=new Set([...Object.keys(i),...Object.keys(s)]);for(const a of o)if(i[a]!==s[a])return!0;return!1}(e,t)&&(Object.assign(e,t),this.mapUi.selectPlace(e,{preventZoom:!0}))}catch(t){console.debug("[place] Fresh fetch failed for",e.osmId,t)}}}serialize(e){return e.osmId&&e.osmType?{place_id:`osm:${e.osmType}:${e.osmId}`}:e.id?{place_id:e.id}:{place_id:e.osmId}}},ute=a({default:()=>hte}),hte=class extends I${static{dF(this.prototype,"router",[dp])}#We=void fF(this,"router");static{dF(this.prototype,"storage",[dp])}#U=void fF(this,"storage");static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");get initialPlace(){return{title:"",description:""}}close(){this.router.transitionTo("index")}static{pF(this.prototype,"close",[ql])}async savePlace(e){try{const t=this.mapUi.creationCoordinates||{lat:this.args.model.lat,lon:this.args.model.lon},n=parseFloat(t.lat.toFixed(6)),r=parseFloat(t.lon.toFixed(6)),i={title:e.title||"Untitled Place",description:e.description,lat:n,lon:r,tags:[],osmTags:{}},s=await this.storage.storePlace(i);console.debug("Created private place:",s.title),this.router.replaceWith("place",s)}catch(t){console.error("Failed to create place:",t),alert("Failed to create place: "+t.message)}}static{pF(this.prototype,"savePlace",[ql])}static{Ap(rg({id:null,block:'[[[41,[30,0,["mapUi","isSidebarVisible"]],[[[1," "],[10,0],[14,0,"sidebar"],[12],[1,"\\n "],[10,0],[14,0,"sidebar-header"],[12],[1,"\\n "],[10,"h2"],[12],[8,[32,0],null,[["@name","@size","@color"],["plus-circle",20,"#ea4335"]],null],[1,"\\n New Place"],[13],[1,"\\n "],[11,"button"],[24,0,"close-btn"],[24,4,"button"],[4,[32,1],["click",[30,0,["close"]]],null],[12],[8,[32,0],null,[["@name","@size","@color"],["x",20,"#333"]],null],[13],[1,"\\n "],[13],[1,"\\n\\n "],[10,0],[14,0,"sidebar-content"],[12],[1,"\\n "],[10,2],[14,0,"helper-text"],[12],[1,"\\n Drag the map to position the crosshair.\\n "],[13],[1,"\\n\\n "],[8,[32,2],null,[["@place","@onSave","@onCancel"],[[30,0,["initialPlace"]],[30,0,["savePlace"]],[30,0,["close"]]]],null],[1,"\\n "],[13],[1,"\\n "],[13],[1,"\\n"]],[]],null]],[],["if"]]',moduleName:"(unknown template module)",scope:()=>({Icon:M$,on:Ww,PlaceEditForm:cW}),isStrictMode:!0}),this)}},dte=a({default:()=>pte}),pte=class extends Jh{static{dF(this.prototype,"mapUi",[dp])}#He=void fF(this,"mapUi");queryParams={lat:{refreshModel:!0},lon:{refreshModel:!0}};model(e){return{lat:parseFloat(e.lat),lon:parseFloat(e.lon)}}setupController(e,t){super.setupController(e,t),t.lat&&t.lon&&this.mapUi.updateCreationCoordinates(t.lat,t.lon),this.mapUi.startCreating(),this.mapUi.showSidebar()}deactivate(){this.mapUi.stopCreating()}},fte=Object.assign({},J_,{"marco/config/environment":nx,"marco/deprecation-workflow":_x,"marco/router":Lx,"marco/services/blossom":gF,"marco/services/contributions":kF,"marco/services/image-processor":LF,"marco/services/local-forage":MF,"marco/services/map-ui":NF,"marco/services/nostr-auth":lz,"marco/services/nostr-data":Vj,"marco/services/nostr-relay":hU,"marco/services/osm-auth":MU,"marco/services/osm":GU,"marco/services/photon":ZU,"marco/services/settings":XU,"marco/services/storage":dB,"marco/services/toast":fB,"marco/utils/contributions":bF,"marco/utils/device":sz,"marco/utils/format-text":NU,"marco/utils/geo":mB,"marco/utils/geohash-coverage":$j,"marco/utils/icons":vB,"marco/utils/nostr":Oj,"marco/utils/osm-icons":CB,"marco/utils/osm":jU,"marco/utils/photo-tag-suggestions":IB,"marco/utils/place-mapping":AB,"marco/utils/poi-categories":qU,"marco/utils/poi-category-matcher":RB,"marco/utils/social-links":NB,"marco/workers/image-processor":QB,"marco/services/page-title":a$,"marco/templates/contributions":qq,"marco/controllers/contributions":tW,"marco/routes/contributions":rW,"marco/templates/lists":sW,"marco/routes/lists":aW,"marco/templates/lists/list":kW,"marco/controllers/lists/list":RW,"marco/routes/lists/list":AW,"marco/templates/lists/index":NW,"marco/routes/lists/index":DW,"marco/templates/search":jW,"marco/controllers/search":BW,"marco/routes/search":qW,"marco/templates/application":jee,"marco/routes/application":Bee,"marco/routes/index":qee,"marco/templates/menu":ete,"marco/routes/menu":nte,"marco/routes/oauth/osm-callback":ite,"marco/templates/place":ote,"marco/routes/place":lte,"marco/templates/place/new":ute,"marco/routes/place/new":dte},{}),gte=class{constructor(e,t,n){this.limit=e,this.func=t,this.store=n,this.size=0,this.misses=0,this.hits=0,this.store=n||new Map}get(e){let t=this.store.get(e);return this.store.has(e)?(this.hits++,this.store.get(e)):(this.misses++,t=this.set(e,this.func(e)),t)}set(e,t){return this.limit>this.size&&(this.size++,this.store.set(e,t)),t}purge(){this.store.clear(),this.size=0,this.hits=0,this.misses=0}},mte=/[ _]/g,yte=new gte(1e3,e=>{return(t=e,Ete.get(t)).replace(mte,"-");var t}),vte=/^(\-|_)+(.)?/,bte=/(.)(\-|\_|\.|\s)+(.)?/g,wte=/(^|\/|\.)([a-z])/g,_te=new gte(1e3,e=>{const t=(e,t,n)=>n?`_${n.toUpperCase()}`:"",n=(e,t,n,r)=>t+(r?r.toUpperCase():""),r=e.split("/");for(let i=0;i<r.length;i++)r[i]=r[i].replace(vte,t).replace(bte,n);return r.join("/").replace(wte,e=>e.toUpperCase())}),xte=/([a-z\d])([A-Z]+)/g,Cte=/\-|\s+/g,Ste=new gte(1e3,e=>e.replace(xte,"$1_$2").replace(Cte,"_").toLowerCase()),kte=/([a-z\d])([A-Z])/g,Ete=new gte(1e3,e=>e.replace(kte,"$1_$2").toLowerCase()),Rte=class{constructor(e){this._entries=e||globalThis.requirejs.entries}moduleNames(){return Object.keys(this._entries)}has(e){return e in this._entries}get(...e){return globalThis.require(...e)}},Tte=class{static moduleBasedResolver=!0;moduleBasedResolver=!0;_deprecatedPodModulePrefix=!1;_normalizeCache=Object.create(null);static create(e){return new this(e)}moduleNameLookupPatterns=[this.podBasedModuleName,this.podBasedComponentsInSubdir,this.mainModuleName,this.defaultModuleName,this.nestedColocationComponentModuleName];static withModules(e){return class extends(this){static explicitModules=e}}constructor(e){if(Object.assign(this,e),!this._moduleRegistry){let e=this.constructor.explicitModules;e?this._moduleRegistry={moduleNames:()=>Object.keys(e),has:t=>Boolean(e[t]),get:t=>e[t],addModules(t){e=Object.assign({},e,t)}}:(void 0===globalThis.requirejs.entries&&(globalThis.requirejs.entries=globalThis.requirejs._eak_seen),this._moduleRegistry=new Rte)}this.pluralizedTypes=this.pluralizedTypes||Object.create(null),this.pluralizedTypes.config||(this.pluralizedTypes.config="config")}makeToString(e,t){return this.namespace.modulePrefix+"@"+t+":"}shouldWrapInClassFactory(){return!1}parseName(e){if(!0===e.parsedName)return e;let t,n,r,i=e.split("@");if(3===i.length){if(0===i[0].length){t=`@${i[1]}`;let e=i[2].split(":");n=e[0],r=e[1]}else t=`@${i[1]}`,n=i[0].slice(0,-1),r=i[2];"template:components"===n&&(r=`components/${r}`,n="template")}else if(2===i.length){let e=i[0].split(":");if(2===e.length)0===e[1].length?(n=e[0],r=`@${i[1]}`):(t=e[1],n=e[0],r=i[1]);else{let e=i[1].split(":");t=i[0],n=e[0],r=e[1]}"template"===n&&0===t.lastIndexOf("components/",0)&&(r=`components/${r}`,t=t.slice(11))}else i=e.split(":"),n=i[0],r=i[1];let s=r,o=this.namespace;return{parsedName:!0,fullName:e,prefix:t||this.prefix({type:n}),type:n,fullNameWithoutType:s,name:r,root:o,resolveMethodName:"resolve"+(a=n,_te.get(a))};var a}resolveOther(e){Lte("`modulePrefix` must be defined",this.namespace.modulePrefix);let t=this.findModuleName(e);if(t){let r=this._extractDefaultExport(t,e);if(void 0===r)throw new Error(` Expected to find: '${e.fullName}' within '${t}' but got 'undefined'. Did you forget to 'export default' within '${t}'?`);return this.shouldWrapInClassFactory(r,e)&&(n=r,r={create:e=>"function"==typeof n.extend?n.extend(e):n}),r}var n}normalize(e){return this._normalizeCache[e]||(this._normalizeCache[e]=this._normalize(e))}resolve(e){if("resolver:current"===e)return{create:()=>this};let t,n=this.parseName(e),r=n.resolveMethodName;return"function"==typeof this[r]&&(t=this[r](n)),null==t&&(t=this.resolveOther(n)),t}addModules(e){if(!this._moduleRegistry.addModules)throw new Error("addModules is only supported when your Resolver has been configured to use static modules via Resolver.withModules()");this._moduleRegistry.addModules(e)}_normalize(e){let t=e.split(":");if(t.length>1){let e=t[0];return"component"===e||"helper"===e||"modifier"===e||"template"===e&&0===t[1].indexOf("components/")?e+":"+t[1].replace(/_/g,"-"):e+":"+(n=t[1].replace(/\./g,"/"),yte.get(n))}return e;var n}pluralize(e){return this.pluralizedTypes[e]||(this.pluralizedTypes[e]=e+"s")}podBasedLookupWithPrefix(e,t){let n=t.fullNameWithoutType;return"template"===t.type&&(n=n.replace(/^components\//,"")),e+"/"+n+"/"+t.type}podBasedModuleName(e){let t=this.namespace.podModulePrefix||this.namespace.modulePrefix;return this.podBasedLookupWithPrefix(t,e)}podBasedComponentsInSubdir(e){let t=this.namespace.podModulePrefix||this.namespace.modulePrefix;if(t+="/components","component"===e.type||/^components/.test(e.fullNameWithoutType))return this.podBasedLookupWithPrefix(t,e)}resolveEngine(e){let t=e.fullNameWithoutType+"/engine";if(this._moduleRegistry.has(t))return this._extractDefaultExport(t)}resolveRouteMap(e){let t=e.fullNameWithoutType,n=t+"/routes";if(this._moduleRegistry.has(n)){let e=this._extractDefaultExport(n);return Lte(`The route map for ${t} should be wrapped by 'buildRoutes' before exporting.`,e.isRouteMap),e}}resolveTemplate(e){return this.resolveOther(e)}mainModuleName(e){if("main"===e.fullNameWithoutType)return e.prefix+"/"+e.type}defaultModuleName(e){return e.prefix+"/"+this.pluralize(e.type)+"/"+e.fullNameWithoutType}nestedColocationComponentModuleName(e){if("component"===e.type)return e.prefix+"/"+this.pluralize(e.type)+"/"+e.fullNameWithoutType+"/index"}prefix(e){let t=this.namespace.modulePrefix;return this.namespace[e.type+"Prefix"]&&(t=this.namespace[e.type+"Prefix"]),t}findModuleName(e){let t,n=this.moduleNameLookupPatterns;for(let r=0,i=n.length;r<i;r++){let i=n[r].call(this,e);if(i&&(i=this.chooseModuleName(i)),i&&this._moduleRegistry.has(i)&&(t=i),t)return t}}chooseModuleName(e){let t=(n=e,Ste.get(n));var n;if(e!==t&&this._moduleRegistry.has(e)&&this._moduleRegistry.has(t))throw new TypeError(`Ambiguous module names: '${e}' and '${t}'`);return this._moduleRegistry.has(e)?e:this._moduleRegistry.has(t)?t:void 0}knownForType(e){let t=this._moduleRegistry.moduleNames(),n=Object.create(null);for(let r=0,i=t.length;r<i;r++){let i=t[r],s=this.translateToContainerFullname(e,i);s&&(n[s]=!0)}return n}translateToContainerFullname(e,t){let n=this.prefix({type:e}),r=n+"/",i="/"+e,s=t.indexOf(r),o=t.indexOf(i);if(0===s&&o===t.length-i.length&&t.length>r.length+i.length)return e+":"+t.slice(s+r.length,o);let a=n+"/"+this.pluralize(e)+"/";return 0===t.indexOf(a)&&t.length>a.length?e+":"+t.slice(a.length):void 0}_extractDefaultExport(e){let t=this._moduleRegistry.get(e,null,null,!0);return t&&t.default&&(t=t.default),t}};function Lte(e,t){if(!t)throw new Error(e)}(class extends X_{modulePrefix=rx.modulePrefix;podModulePrefix=rx.podModulePrefix;Resolver=Tte.withModules(fte);inspector=function(e){!function(e){globalThis.emberInspectorApps||(globalThis.emberInspectorApps=[]),globalThis.emberInspectorApps.push({app:e,name:`app-${globalThis.emberInspectorApps.length}`,loadCompatInspector:()=>Ij(()=>import("./modules-4-12-DSaOCg7W.js"),[])}),globalThis.dispatchEvent&&globalThis.dispatchEvent(new Event("Ember"))}(e)}(this)}).create(rx.APP);export{Wv as $,ol as $n,re as $r,zp as $t,lx as A,hc as An,Yt as Ar,lm as At,pb as B,lc as Bn,et as Br,fg as Bt,tO as C,Yc as Cn,sr as Cr,sy as Ct,oA as D,_c as Dn,Yn as Dr,Qm as Dt,cA as E,kc as En,Un as Er,_m as Et,A_ as F,ic as Fn,At as Fr,Vg as Ft,ib as G,ec as Gn,Ze as Gr,Up as Gt,yb as H,Kl as Hn,nt as Hr,jp as Ht,jw as I,Xl as In,kt as Ir,im as It,ob as J,Dl as Jn,Ne as Jr,Vp as Jt,sb as K,Ul as Kn,Ke as Kr,Wp as Kt,hb as L,Gl as Ln,Et as Lr,Bg as Lt,S_ as M,tc as Mn,Xt as Mr,Qg as Mt,__ as N,nc as Nn,en as Nr,tm as Nt,WP as O,wc as On,Wt as Or,Xm as Ot,x_ as P,Hl as Pn,Pt as Pr,nm as Pt,Vv as Q,sl as Qn,ie as Qr,Dp as Qt,fb as R,cc as Rn,it as Rr,Cg as Rt,yO as S,Xc as Sn,ur as Sr,ay as St,zA as T,Pc as Tn,nr as Tr,Ym as Tt,mb as U,Wl as Un,rt as Ur,$p as Ut,gb as V,Jl as Vn,Qe as Vr,yg as Vt,eb as W,Ql as Wn,Je as Wr,Bp as Wt,Kv as X,Sl as Xn,le as Xr,Hp as Xt,tb as Y,Rl as Yn,ce as Yr,Gp as Yt,Zv as Z,wl as Zn,te as Zr,Np as Zt,c$ as _,gu as _n,Cr as _r,Uy as _t,z$ as a,b as ai,Fu as an,Po as ar,ky as at,KO as b,lu as bn,vr as br,ly as bt,B$ as c,_u as cn,fs as cr,Ty as ct,q$ as d,ju as dn,ti as dr,qy as dt,ee as ei,Fp as en,al as er,Hv as et,N$ as f,wu as fn,Kr as fr,Iy as ft,g$ as g,Iu as gn,Sr as gr,tv as gt,m$ as h,Mu as hn,Ir as hr,nv as ht,F$ as i,w as ii,xu as in,Ba as ir,iv as it,K_ as j,sc as jn,Jt as jr,qg as jt,kx as k,yc as kn,qt as kr,Jm as kt,D$ as l,Du as ln,xi as lr,$y as lt,y$ as m,Nu as mn,Mr as mr,rv as mt,WV as n,d as ni,Ap as nn,Qa as nr,Dv as nt,j$ as o,v as oi,Ou as on,Lo as or,Sy as ot,x$ as p,bu as pn,Dr as pr,Cy as pt,rb as q,jl as qn,xe as qr,qp as qt,$$ as r,u as ri,up as rn,$a as rr,gv as rt,U$ as s,a as si,Pu as sn,Hs as sr,wy as st,WW as t,g as ti,Op as tn,tl as tr,jv as tt,V$ as u,zu as un,ni as ur,_y as ut,l$ as v,vu as vn,Pr as vr,Ly as vt,YA as w,Hc as wn,tr as wr,oy as wt,FO as x,au as xn,fr as xr,bm as xt,uF as y,yu as yn,Er as yr,jy as yt,lb as z,oc as zn,tt as zr,gg as zt}; |